Skip to content

Commit 83ea396

Browse files
committed
feat: dark-forest standalone package, agent protocol enhancements, spec-centric docs
- Extract dark-forest SDK into standalone @taskforest/dark-forest package - Add TDX quote verifier and attestation envelope builder - Add session stores (memory + localStorage) for MPP metering - Enhance taskforest program: disputes, compressed state, privacy levels - Enhance taskforest-payments: TEE attestation, ZK settlement compression - Update SDK types, tests, and taskforest client - Add spec-centric roadmap and architecture docs - Add e2e and devnet test scripts - Update README
1 parent 1a1a9cf commit 83ea396

50 files changed

Lines changed: 5561 additions & 407 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

β€Ž.gitignoreβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Rust / Anchor
22
/target
33
.anchor/
4+
/test-ledger
45

56
# Dependencies
67
node_modules/

β€ŽAnchor.tomlβ€Ž

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,11 @@ wallet = "keys/taskforest.json"
2323
[scripts]
2424
test = "npx ts-mocha -p ./tsconfig.json -t 1000000 tests/taskforest.ts"
2525
test-payments = "npx ts-mocha -p ./tsconfig.json -t 1000000 tests/taskforest-payments.ts"
26+
test-compress-settlement = "npx ts-mocha -p ./tsconfig.json -t 120000 tests/compress-settlement.ts"
2627
test-er = "npx ts-mocha -p ./tsconfig.json -t 120000 tests/er-devnet.ts"
28+
test-payments-er = "npx ts-mocha -p ./tsconfig.json -t 120000 tests/payments-er-devnet.ts"
29+
light = "light test-validator --stop && light test-validator --validator-args '--upgradeable-program Fgiye795epSDkytp6a334Y2AwjqdGDecWV24yc2neZ4s target/deploy/taskforest.so keys/taskforest.json --upgradeable-program 4hNP2tU5r5GgyASTrou84kWHbCwdyXVJJN4mve99rjgs target/deploy/taskforest_payments.so keys/taskforest.json'"
30+
light-stop = "light test-validator --stop"
31+
light-test-payments = "ANCHOR_PROVIDER_URL=http://127.0.0.1:8899 ANCHOR_WALLET=keys/taskforest.json npx ts-mocha -p ./tsconfig.json -t 1000000 tests/taskforest-payments.ts"
32+
light-test-compress-settlement = "ANCHOR_PROVIDER_URL=http://127.0.0.1:8899 ANCHOR_WALLET=keys/taskforest.json npx ts-mocha -p ./tsconfig.json -t 120000 tests/compress-settlement.ts"
33+
light-test-local = "./scripts/test-local.sh"

β€ŽCargo.lockβ€Ž

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€ŽREADME.mdβ€Ž

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,38 @@
88

99
## What is TaskForest?
1010

11-
TaskForest is a decentralized protocol where humans and AI agents post tasks, stake SOL, and settle with cryptographic proof β€” all on-chain.
11+
TaskForest is a decentralized protocol where humans and AI agents post tasks, stake SOL, and settle with cryptographic proof on Solana.
12+
13+
TaskForest also supports PMPP, our term for Private Machine Payment Protocol.
14+
Standard MPP is useful for metered machine payments, but fully public payment trails leak strategy.
15+
PMPP extends that model with private execution, private metering, and on-chain final settlement.
1216

1317
- **Agent Router** β€” intelligent matchmaking that auto-assigns jobs to the best available agent
1418
- **Verification Layer** β€” execution receipt DAGs, TEE attestation, dispute resolution, verifier panels
1519
- **Escrow + Settlement** β€” trustless SOL escrow with on-chain settlement and slash mechanics
1620

21+
## Privacy Model
22+
23+
TaskForest privacy comes from three layers:
24+
25+
- **Private execution** β€” jobs and payment flow can delegate into MagicBlock Ephemeral Rollups
26+
- **Private metering** β€” intermediate machine-payment activity does not need to be exposed on public Solana
27+
- **Minimized settlement footprint** β€” only the final settlement boundary and compressed commitments need to land on-chain
28+
29+
This matters because public payment trails can reveal:
30+
31+
- request frequency
32+
- endpoint usage
33+
- routing decisions
34+
- counterparties
35+
- spend curves
36+
37+
For production, the trust model is:
38+
39+
- Solana verifies escrow, settlement, and program state transitions
40+
- the on-chain payments program verifies signed attestation results bound to escrow and session state
41+
- full TDX quote parsing, certificate-chain validation, and collateral checks belong off-chain in a verifier service
42+
1743
---
1844

1945
## Architecture
@@ -31,6 +57,7 @@ TaskForest is a decentralized protocol where humans and AI agents post tasks, st
3157
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
3258
β”‚ MagicBlock Ephemeral Rollup β”‚
3359
β”‚ place_bid β†’ gasless, <50ms β”‚
60+
β”‚ PMPP metering β†’ private machine payments β”‚
3461
β”‚ close_bidding β†’ select winner, commit to L1 β”‚
3562
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
3663
```
@@ -91,26 +118,50 @@ npm install @taskforest/sdk
91118
```
92119

93120
```typescript
94-
import { TaskForest } from '@taskforest/sdk'
121+
import { TaskForest, SpecBuilder } from '@taskforest/sdk'
95122

96123
const tf = new TaskForest({ rpc: '...', wallet: agentKeypair, network: 'devnet' })
97124

98-
// Post a task
99-
await tf.postTask({ ttd: 'code-review-v1', input: {...}, reward: 0.5, privacy: 'encrypted' })
100-
101-
// Router: hire an agent automatically
102-
await tf.hireAgent({ problem: 'Review my code', maxBudget: 1.0, deadline: '2h' })
125+
const spec = new SpecBuilder('Review my code')
126+
.description('Review the repository and return a markdown report.')
127+
.criterion('ac-1', 'Cover the requested scope', 'coverage', { required: true, weight: 50 })
128+
.criterion('ac-2', 'Return the report in markdown', 'output', { required: true, weight: 50 })
129+
.input('url', 'Repository URL')
130+
.output('file', 'Audit report', { format: 'markdown' })
131+
.judgeMode('Score each criterion from 0-100.', 70)
132+
.build()
133+
134+
// Post a funded job from the approved spec
135+
await tf.postTask({
136+
title: spec.metadata.title,
137+
input: { repo_url: 'https://github.com/example/repo' },
138+
spec,
139+
reward: 0.5,
140+
deadline: '2h',
141+
privacy: 'encrypted',
142+
})
143+
144+
// Workers or verifiers can then act against the same spec commitment
145+
const tasks = await tf.searchTasks({ minReward: 0.1, status: 'open' })
146+
await tf.bid(tasks[0].pubkey, { stake: 0.05 })
103147

104148
// Disputes
105149
await tf.openDispute({ jobPubkey, disputedThread: 0, stakeLamports: 50000000, ... })
106150

107151
// Verifier panel voting
108152
await tf.castVote({ disputePubkey, verdict: 1 })
109-
await tf.tallyPanel(disputePubkey)
153+
await tf.tallyPanel(jobPubkey, disputePubkey, challengerPubkey, votePubkeys)
110154
```
111155

112156
See [`sdk/README.md`](sdk/README.md) for full API reference.
113157

158+
Dark Forest payment helpers are not part of `@taskforest/sdk`.
159+
Keep the core SDK lean and use `@taskforest/dark-forest` for PMPP, PER delegation, attestation, and private settlement helpers.
160+
161+
```bash
162+
npm install @taskforest/dark-forest
163+
```
164+
114165
---
115166

116167
## Repo Structure
@@ -125,6 +176,7 @@ taskforest-protocol/ ← this repo (public)
125176
β”‚ β”œβ”€β”€ types.ts ← type definitions
126177
β”‚ β”œβ”€β”€ receipts.ts ← Merkle DAG receipt builder
127178
β”‚ └── index.ts ← exports
179+
β”œβ”€β”€ dark-forest/ ← Dark Forest payments package (@taskforest/dark-forest)
128180
β”œβ”€β”€ tests/ ← Anchor integration tests
129181
β”œβ”€β”€ docs/ ← protocol design docs
130182
└── scripts/ ← deployment scripts

0 commit comments

Comments
Β (0)