forgeos 0.1.0-alpha.70 → 0.1.0-alpha.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/forge-agent-fabric/SKILL.md +10 -1
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +12 -0
- package/docs/agent-fabric-programs.md +183 -168
- package/docs/agent-fabric.md +4 -6
- package/docs/architecture/agent-fabric/WORKFLOW_PROGRAM_COMPETITIVE_EVIDENCE.md +75 -0
- package/docs/architecture/agent-fabric/WORKFLOW_PROGRAM_COMPETITIVE_PLAN.md +137 -0
- package/docs/architecture/agent-fabric/WORKFLOW_PROGRAM_COMPETITIVE_REVIEW.md +56 -0
- package/docs/architecture/agent-fabric/WORKFLOW_PROGRAM_V2_ADR.md +81 -41
- package/docs/architecture/agent-fabric/WORKFLOW_PROGRAM_V2_CORRECTIONS.md +39 -0
- package/docs/architecture/agent-fabric/WORKFLOW_PROGRAM_V2_CORRECTIONS_EVIDENCE.md +53 -0
- package/docs/architecture/agent-fabric/WORKFLOW_PROGRAM_V2_EVIDENCE.md +49 -109
- package/docs/architecture/agent-fabric/WORKFLOW_PROGRAM_V2_PLAN.md +463 -423
- package/examples/agent-fabric-v2/README.md +16 -0
- package/examples/agent-fabric-v2/item-child.workflow.ts +11 -0
- package/examples/agent-fabric-v2/map-child.workflow.ts +10 -0
- package/examples/agent-fabric-v2/migrate.workflow.ts +1 -1
- package/examples/agent-fabric-v2/run-ui-fixture.ts +48 -0
- package/examples/agent-fabric-v2/templates/README.md +46 -0
- package/examples/agent-fabric-v2/templates/bugfix.json +12 -0
- package/examples/agent-fabric-v2/templates/migration.json +13 -0
- package/examples/agent-fabric-v2/templates/review.json +12 -0
- package/examples/agent-fabric-v2/ui-audit.workflow.ts +28 -0
- package/examples/agent-fabric-v2/ui-fixture-worker.cjs +36 -0
- package/examples/agent-fabric-v2/visual-population.json +13 -0
- package/package.json +7 -1
- package/scripts/summarize-fabric-benchmark.mjs +6 -0
- package/src/forge/_generated/releaseManifest.json +1 -1
- package/src/forge/_generated/releaseManifest.ts +3 -3
- package/src/forge/agent-fabric/claude-program-worker.ts +95 -0
- package/src/forge/agent-fabric/codex-sdk-worker.ts +12 -4
- package/src/forge/agent-fabric/index.ts +5 -0
- package/src/forge/agent-fabric/local-task-server.ts +2 -1
- package/src/forge/agent-fabric/managed-environment.ts +14 -8
- package/src/forge/agent-fabric/managed-workspace.ts +4 -0
- package/src/forge/agent-fabric/program-api.ts +37 -0
- package/src/forge/agent-fabric/program-authoring.ts +48 -0
- package/src/forge/agent-fabric/program-benchmark.ts +76 -0
- package/src/forge/agent-fabric/program-capabilities.ts +14 -0
- package/src/forge/agent-fabric/program-contract.ts +106 -36
- package/src/forge/agent-fabric/program-dsl.ts +45 -31
- package/src/forge/agent-fabric/program-evidence.ts +22 -0
- package/src/forge/agent-fabric/program-image.ts +15 -0
- package/src/forge/agent-fabric/program-lock.ts +50 -0
- package/src/forge/agent-fabric/program-observation.ts +63 -0
- package/src/forge/agent-fabric/program-owner.ts +16 -0
- package/src/forge/agent-fabric/program-runtime-options.ts +23 -0
- package/src/forge/agent-fabric/program-scheduler.ts +57 -0
- package/src/forge/agent-fabric/program-service.ts +423 -112
- package/src/forge/agent-fabric/program-store.ts +88 -55
- package/src/forge/agent-fabric/program-structure.ts +65 -0
- package/src/forge/agent-fabric/program-templates.ts +96 -0
- package/src/forge/agent-fabric/program-types.ts +21 -9
- package/src/forge/agent-fabric/program-view.ts +26 -0
- package/src/forge/agent-fabric/program-worker.ts +93 -23
- package/src/forge/agent-memory/mcp.ts +9 -3
- package/src/forge/cli/fabric.ts +4 -2
- package/src/forge/cli/main.ts +4 -0
- package/src/forge/cli/parse.ts +3 -1
- package/src/forge/version.ts +1 -1
|
@@ -166,4 +166,13 @@ Validate source against the owner registry before dispatch. Every mutation needs
|
|
|
166
166
|
requestId; subsequent mutations pin expectedVersion. Never treat data-only completed as
|
|
167
167
|
acceptance-ready or infer authority to apply from a worker's report. Preserve uncertain
|
|
168
168
|
outcomes and reconcile observed effects before resume. Fenced replan uses a global barrier;
|
|
169
|
-
|
|
169
|
+
Same-run completed output reuse happens before worker preparation; cross-run SDK caching is absent.
|
|
170
|
+
Use operatorVersion 2, explicit Blocks/results, after/sequence and waiting semantics; no legacy migration is required.
|
|
171
|
+
For scoped UI acceptance require item/final owner checks, current evidence and full final obligations.
|
|
172
|
+
Use program-history/program-explain/program-artifact-get/program-diff for inspection.
|
|
173
|
+
When avoiding LLM spending set FORGE_FABRIC_TEST_MODE=1 and use deterministic adapters/SDK stubs.
|
|
174
|
+
Publication still requires the user's task authorization.
|
|
175
|
+
|
|
176
|
+
## Workflow correction contract R2.2
|
|
177
|
+
|
|
178
|
+
Program subworkflows inherit ancestor activity quotas and cancellation; input is explicit. Owner visualCases binds route/viewport/state/dimensions to each population member; do not promise exhaustive UI coverage beyond that catalog. Capture obligations apply by assessment scope. New program runs use program-runs-v3/format 3 with immutable linked journal; no migration of old runs. program-explain includes graph nodes, observed instances and Mermaid. Typed refs/output(operation) improve authoring, while owner schemas remain authoritative. See docs/agent-fabric-programs.md and WORKFLOW_PROGRAM_V2_CORRECTIONS.md in the Forge source. For deterministic validation keep FORGE_FABRIC_TEST_MODE=1; do not launch real providers without explicit user authority.
|
package/AGENTS.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @forge-generated generator=0.1.0-alpha.
|
|
1
|
+
// @forge-generated generator=0.1.0-alpha.72 input=4096e19589f57b9568accde0ae34aa0782c1598f54261e161e1ff5ac7cc857b9 content=721818a6f9a664aa898092d4aa5cd68cbbd8ad6e150c7d3ad3ef785a2e3fcf53
|
|
2
2
|
# AGENTS.md
|
|
3
3
|
|
|
4
4
|
<!-- forge-generated:start -->
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# forgeos
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.72
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add owner-bound workflow authoring templates, durable usage budgets, fair scheduling, compatible recovery, conflict resolution and optional Claude adapter. Harden approval, evidence, accounting, Unicode transport and MCP interfaces; add paired benchmark reporting and focused CI coverage. Real-provider smoke and competitive quality evaluation remain unperformed.
|
|
8
|
+
|
|
9
|
+
## 0.1.0-alpha.71
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Complete Agent Fabric workflow R2.2 with typed authoring, inherited subworkflow quotas and cancellation, shared owner scheduling, crash-recoverable leases, compact durable history, scoped evidence and visual case validation. Ship workflow templates, graph explanations and deterministic coverage. Validate the real Codex adapter with one bounded read-only smoke; retain explicit limits on local durability and model cost.
|
|
14
|
+
|
|
3
15
|
## 0.1.0-alpha.70
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1,168 +1,183 @@
|
|
|
1
|
-
# Agent Fabric program workflows
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
`
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
are
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
live
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
1
|
+
# Agent Fabric program workflows
|
|
2
|
+
|
|
3
|
+
Current dev architecture: finite typed TypeScript → JSON IR (schemaVersion 2/operatorVersion 2) → exclusive local owner → activity scheduler → candidates/evidence → final assessment → gate → separate apply. There is no legacy interpreter or migration requirement. Start new runs after semantic upgrades. Normative architecture: `architecture/agent-fabric/WORKFLOW_PROGRAM_V2_ADR.md`; requirements and evidence are adjacent documents.
|
|
4
|
+
|
|
5
|
+
## R2.2 correction contract
|
|
6
|
+
|
|
7
|
+
Correction plan: `architecture/agent-fabric/WORKFLOW_PROGRAM_V2_CORRECTIONS.md`. Subworkflows inherit activity scopes, cancellation, dependencies, item identity and lexical loop state. Their `workflowInput()` is the explicit child input. Policy/acceptance cannot change; population is inherited and cannot be replaced. Prefer passing item data explicitly for portable child programs; static schemas remain authoritative.
|
|
8
|
+
|
|
9
|
+
The owner/store share one PID/token hardlink lease protocol, including recovery of dead reclaim guards. A live guard is never removed. Unknown process liveness stays conservative. No exactly-once external guarantee is added.
|
|
10
|
+
|
|
11
|
+
`ProgramExecutor.inputSchema` optionally validates activity input before preparation/dispatch, alongside conservative preflight inference. Output schemas remain mandatory. Typed author refs support `executorRef<Input,Output>` and `programRef<Input,Output>`; `schemaRef<Output>` types events. `output(operation)` retains output types, `field` checks typed keys, and typed map bodies retain collection result item types. `output("id")` remains schema-validated at preflight/runtime. Generics are author annotations, not inferred from registry files and not authority to weaken a schema. `WorkflowExpression`, `WorkflowValue`, `WorkflowResolved`, `WorkflowBody`, `WorkflowCollection`, `WorkflowActivityOptions` are exported type helpers. No second interpreter is introduced.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
const inspect = agent("inspect", {
|
|
15
|
+
executor: executorRef<{path:string},{ok:boolean}>("inspect", "v2"),
|
|
16
|
+
input: {path: "src/a.ts"}
|
|
17
|
+
});
|
|
18
|
+
const ok = field(output(inspect), "ok"); // WorkflowExpression<boolean>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Visual population
|
|
22
|
+
|
|
23
|
+
An owner population may declare `visualCases`, exactly one case per member:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{"itemKey":"checkout-mobile-error","route":"/checkout","viewport":"mobile","state":"error","width":390,"height":844}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Route/viewport/state tuples and member keys must be unique; excluded members remain cataloged but are not assessed. Every observed capture must match its owner tuple and dimensions. AssessmentContext carries the current expected cases to capture/review workers. Final capture requirements recapture every active case. Item capture requirements come only from item obligations; final-only obligations do not force local screenshots. Without visualCases, coverage is per member, not an inferred matrix. Receipt metadata and valid image headers do not prove that the pixels depict the declared route/state. The WebP header parser currently accepts VP8X only.
|
|
30
|
+
|
|
31
|
+
Capture blobs commit before result; all receipts of one attempt commit atomically with the observed attempt result. Invalid batches leave no accepted partial receipts. Orphan blobs may remain until explicit maintenance; no GC is implied.
|
|
32
|
+
|
|
33
|
+
### Storage and inspection
|
|
34
|
+
|
|
35
|
+
New runs use `.forge/local/agent-fabric/program-runs-v3`. Format 3 envelopes contain snapshot/journal pointers and CAS receipts, not duplicate full snapshots/history arrays. Each immutable journal node links its predecessor; history verifies the chain and historical snapshot identities. Snapshot and journal commit before atomic envelope publication. Old directories are preserved but unused; no checkpoint migration. Identical internal mutations do not write another checkpoint; authenticated request receipts still commit. Dispatch keeps a 24 MiB snapshot reserve and 90,000-transition reserve for recovery.
|
|
36
|
+
|
|
37
|
+
`program-explain.graph` returns `nodes`, observed `instances`, `mermaid`, and graph semantics. The diagram shows static dependencies, including control completion edges; dynamic map/loop expansions are separate instances. Mermaid labels are escaped. Storage metrics split actual written bytes into snapshot/journal/envelope/artifact categories, including temp files; full state snapshots still grow with the run. Profiling does not establish model speed or quality.
|
|
38
|
+
|
|
39
|
+
Reusable examples: `examples/agent-fabric-v2/map-child.workflow.ts`, `item-child.workflow.ts`, and `visual-population.json` (owner baseline digest required).
|
|
40
|
+
|
|
41
|
+
## Start and inspect
|
|
42
|
+
|
|
43
|
+
The owner reads `.forge/fabric-programs.json`: versioned schemas, executors, policies, acceptance, populations and optional child programs. Authors select references; requests cannot substitute a weaker owner registry. Keep `forge fabric serve` alive. New dispatch/apply checks current owner authorization; immutable historical facts retain their pinned definitions.
|
|
44
|
+
|
|
45
|
+
`forge fabric program-validate --file request.json --json` accepts `{source}` or `{program}`. Start adds `{requestId,input}`. CLI mutations use request files and `{runId,requestId,expectedVersion,...}`. The HTTP owner bounds requests at 40 KiB; offline source lowering caps at 256 KiB. Every control uses CAS and idempotency; use a new requestId when changing a decision after a conflict.
|
|
46
|
+
|
|
47
|
+
| Action | Request/meaning |
|
|
48
|
+
|---|---|
|
|
49
|
+
| program-validate | source/program, no dispatch |
|
|
50
|
+
| program-start | requestId, source/program, input |
|
|
51
|
+
| program-status | --run-id ID, authoritative state |
|
|
52
|
+
| program-wait | runId, cursor, waitMs; bounded long poll |
|
|
53
|
+
| program-pause | stop new dispatch; active work is observed |
|
|
54
|
+
| program-resume | continue settled work without replenishing budgets |
|
|
55
|
+
| program-signal | signalId, target, generation, type, correlation, payload, authorization, optional subject/expiresAt |
|
|
56
|
+
| program-replan | source/program, mode barrier/additive/fenced |
|
|
57
|
+
| program-cancel | request cancellation; unknown effects remain uncertain |
|
|
58
|
+
| program-reconcile | attemptId or operationId, resolution failed, observed reason; publication reconciliation is separate |
|
|
59
|
+
| program-apply | current gated result and authorization; scoped local files |
|
|
60
|
+
| program-history | --run-id ID, journal/stateRefs |
|
|
61
|
+
| program-explain | --run-id ID, scopes/queue/scheduler/storage/guarantees |
|
|
62
|
+
| program-artifact-get | runId, ref; optional binary:true/maxBytes; bounded reachable artifact only |
|
|
63
|
+
| program-diff | runId and proposed source/program, graph changes |
|
|
64
|
+
|
|
65
|
+
MCP exposes the same 15 actions as `fabric_program_*`. Status/history/explain accept `{runId}`; other actions use `{request:BODY}`. Both use the same authenticated owner and store. Apply is not automatic.
|
|
66
|
+
|
|
67
|
+
## Complete author API: 50 constructors
|
|
68
|
+
|
|
69
|
+
Import from `forgeos/agent-fabric/workflows`. Functions create finite IR data; they do not dispatch during authoring. `WorkflowDefinition`, `WorkflowOptions`, `WorkflowRef`, `WorkflowOperation` are exported author types. Normal TS compilation and static lowerer both support `as const`/`satisfies`; lowerer never evaluates callbacks, arbitrary imports or runtime I/O. JSON authors get identical owner validation.
|
|
70
|
+
|
|
71
|
+
`defineWorkflow({id,version,operatorVersion:2,mode,inputSchema,outputSchema,policy,acceptance,population?,steps,result})` defines the root. Mode data returns typed data; candidate mode requires a gate for acceptance-ready. Schema subset supports bounded objects/arrays/scalars, properties/required/additionalProperties, enum/const, numeric/string/array bounds and anyOf; unsupported keywords reject.
|
|
72
|
+
|
|
73
|
+
Seven reference constructors share `(id,version)` and have separate nominal kinds: `schemaRef`, `executorRef`, `policyRef`, `acceptanceRef`, `populationRef`, `recipeRef`, `programRef`.
|
|
74
|
+
|
|
75
|
+
All 13 operators use `(id,options)`, with optional common `after:string[]` and label. `after` is control dependency, not an operator. Reference dependencies are also inferred; independent roots run concurrently. IDs are lexical and cycles reject before dispatch. Multi-step Blocks require `{steps,result}`; a single operation is shorthand.
|
|
76
|
+
|
|
77
|
+
| Operator | Main options and result |
|
|
78
|
+
|---|---|
|
|
79
|
+
| value | value; pure data |
|
|
80
|
+
| agent | executor, input?, candidate?, writeScope?; typed worker data |
|
|
81
|
+
| command | same activity contract; registered command executor |
|
|
82
|
+
| map | items,key,body,completion,coverage?,quorum?,concurrency?,order?; sealed collection with item outcomes |
|
|
83
|
+
| branch | condition,then,else Blocks; selected result, unused arm skipped |
|
|
84
|
+
| loop | initialState,maxRounds,body,next,until; final state, bounded progress |
|
|
85
|
+
| repair | recipe,implement,review,checks,evidence?,assessmentScope?,entryMode,initialCandidate,writeScope,maxRepairRounds,maxAssessmentAttempts,maxInfrastructureAttempts,progressPolicy; accepted or explicit nonacceptance result |
|
|
86
|
+
| compose | candidates,onConflict:needs-resolution; integrated candidate; conflicts block |
|
|
87
|
+
| gate | candidate,coverage?,authorization?; owner-issued current receipt |
|
|
88
|
+
| subworkflow | program,input; child result under inherited limits/contracts |
|
|
89
|
+
| waitEvent | type,correlation,schema,subject?,timeoutMs?; one authorized event payload |
|
|
90
|
+
| sequence | steps,result; serial required children |
|
|
91
|
+
| parallel | steps,result,onFailure:collect-all/cancel-siblings; required children with diagnostics |
|
|
92
|
+
|
|
93
|
+
All 29 expressions:
|
|
94
|
+
|
|
95
|
+
| Expression | Meaning |
|
|
96
|
+
|---|---|
|
|
97
|
+
| workflowInput() | typed input |
|
|
98
|
+
| item() | current map item, including nested loop |
|
|
99
|
+
| loopState() | current loop state |
|
|
100
|
+
| output(id) | data result of lexical invocation; activity envelope is unwrapped |
|
|
101
|
+
| field(value,key) | bounded object field |
|
|
102
|
+
| literal(value) | literal data, no nested expression interpretation |
|
|
103
|
+
| object(record) | evaluate object entries |
|
|
104
|
+
| array(...values) | evaluate array entries |
|
|
105
|
+
| eq(a,b) | canonical data equality |
|
|
106
|
+
| and(...values) | boolean conjunction |
|
|
107
|
+
| or(...values) | boolean disjunction |
|
|
108
|
+
| not(value) | boolean negation |
|
|
109
|
+
| concat(...arrays) | bounded concatenation |
|
|
110
|
+
| filter(values,key,equals) | field equality selection |
|
|
111
|
+
| unique(values,key) | first unique field values |
|
|
112
|
+
| sort(values,key) | UTF-8 field ordering |
|
|
113
|
+
| take(values,count) | bounded prefix |
|
|
114
|
+
| length(value) | collection/string length |
|
|
115
|
+
| population() | owner population contract |
|
|
116
|
+
| acceptance() | owner acceptance contract |
|
|
117
|
+
| candidateFromBaseline(entry?) | owner baseline candidate; entry bounds item context |
|
|
118
|
+
| outputCandidate(id) | candidate from completed activity/composition |
|
|
119
|
+
| acceptedCandidate(id) | accepted repair candidate with owner receipt |
|
|
120
|
+
| acceptedCandidates(id) | accepted candidate collection |
|
|
121
|
+
| coverageFor(contract,discovered) | validate discovered items against owner catalog; issue receipt |
|
|
122
|
+
| coverageReceipt(id) | collection coverage receipt |
|
|
123
|
+
| acceptanceWriteScope(id) | inherited acceptance write scope |
|
|
124
|
+
| approvedChecksFor(entry) | owner-approved checks for work entry |
|
|
125
|
+
| acceptanceChecks(id) | checks inherited from the acceptance contract |
|
|
126
|
+
|
|
127
|
+
## Recovery and scopes
|
|
128
|
+
|
|
129
|
+
Owner activity capacity is four; run and ancestor map quotas can narrow it. Parent controls do not hold activity slots. Queue admission shares the absolute run deadline. Completed intact same-run outputs are reused before workspace/adapter preparation, including mocked/real SDK output records. This is distinct from cross-run cache, which is absent. Corrupt artifacts block and do not trigger silent redispatch.
|
|
130
|
+
|
|
131
|
+
Waiting is its own state. Independent siblings continue and survive resume. Events persist before consumption; target/generation/type/correlation/subject/schema/expiry bind their use. A live owner wakes on authorized event or deadline. After restart use explicit resume. Paused stays paused. Completed data is not acceptance-ready. Unobserved cancellation/dispatch stays uncertain and retains reservations through restart until observation/reconciliation. Exactly-once external effects are not promised.
|
|
132
|
+
|
|
133
|
+
Barrier replan recomputes changed branches and dependents, preserving compatible intact facts. Additive keeps existing templates. Fenced replacement requires owner opt-in and a global barrier; this is not independent live local fencing. Repair persists intent/counters before dispatch and never refunds exhausted budgets on resume.
|
|
134
|
+
|
|
135
|
+
## UI and candidate acceptance
|
|
136
|
+
|
|
137
|
+
Owner contracts declare `requiredChecksByScope:{item,final}`, `assessmentBindings` and obligations `{id,scope,criteria,requiredEvidence?}`. Review/check/capture receive AssessmentContext with candidateRef, obligationIds, environmentRef, itemKey and evidenceRefs. Evidence files are readonly inputs. Registered capture commands return JSON `evidenceArtifacts:[{path,itemKey,buildDigest,environmentRef,mime,width,height,route,viewport,state}]`; path must be in bounded scratch storage. Owner stores immutable bytes and issues capture receipts. Invalid/missing/stale evidence blocks; it does not become a UI defect requiring implementation.
|
|
138
|
+
|
|
139
|
+
Assess-first means a correct UI produces zero edits. Review approval alone is insufficient: findings must be empty, checks passed, all obligations covered, current candidate/env/evidence bound and distinct observed reviewer attempt. Final assessment after compose recaptures the complete population and can reject an item previously approved locally. Compose can opt into an owner-registered resolver; conflicting artifacts are data for resolution rather than simultaneously materialized. The resolver starts from the baseline, produces a fresh candidate and inherits no approval. A new final assessment is required.
|
|
140
|
+
|
|
141
|
+
Map keys normalize NFC before uniqueness, encode path segments once and order by UTF-8. Completion is all-required/partial/quorum; quorum is `{minAccepted:K}`, explicit and only closes when outcomes settle. Owner must authorize partial/quorum; such a result cannot alone satisfy all-required final obligations. Envelope item outcome is distinct from arbitrary user data (including a user field named status).
|
|
142
|
+
|
|
143
|
+
If `requireHumanApproval:true`, add a wait subject `{candidate: acceptedCandidate(finalId), contract: acceptance()}` and give `output(waitId)` as gate authorization. The authenticated host supplies provenance and approved payload, not a worker. A declined/expired/fabricated approval does not authorize gate/apply.
|
|
144
|
+
|
|
145
|
+
Apply commits an immutable intent before the first write, pins candidate/contract/semantic version/seals and checks beforeimages. Multiple files are not an atomic filesystem transaction. Divergent/partial writes become apply-uncertain. Reconciliation with `publication:true` requires observed complete files; retry requires authorization and complete original baseline, then explicit resume/revalidation. Source files remain untouched until apply.
|
|
146
|
+
|
|
147
|
+
## Runnable examples and no-LLM verification
|
|
148
|
+
|
|
149
|
+
`examples/agent-fabric-v2/ui-audit.workflow.ts` is the complete UI plan. `run-ui-fixture.ts` builds 20 local HTML pages with three known defects and registered deterministic discover/capture/review/implement/local/global-check commands. Test evidence: exactly three implementations, 43 captures including 20 fresh final captures, 21 final obligations, no apply and zero LLM calls. PNG fixtures verify transport/binding. Optional explicit browser path renders local HTML in headless Chromium/Edge; visual quality is still not model-evaluated.
|
|
150
|
+
|
|
151
|
+
Run `FORGE_FABRIC_TEST_MODE=1` using the shell's environment syntax, then `node bin/forge-bun.mjs run examples/agent-fabric-v2/run-ui-fixture.ts`. The test fuse refuses default real model factories; stubs remain supported. Runtime profiling: `node bin/forge-bun.mjs run scripts/benchmark-fabric-workflows.ts report.json`, fixed fan-out/fault/restart, no provider. Neither is a Claude/model-quality benchmark. Cross-run cache, distributed owner, automatic GC and unlimited streaming/race remain future extensions.
|
|
152
|
+
|
|
153
|
+
## Competitive workflow program
|
|
154
|
+
|
|
155
|
+
The detailed implementation plan is `architecture/agent-fabric/WORKFLOW_PROGRAM_COMPETITIVE_PLAN.md`. Owner-bound review, bugfix and migration authoring requests are in `examples/agent-fabric-v2/templates/`. `program-author --file request.json` proposes validated IR; `program-author-types` reads declarations generated from the owner registry. Both use the authenticated owner and dispatch no worker. Start and apply remain separate.
|
|
156
|
+
|
|
157
|
+
The owner reads optional `.forge/fabric-runtime.json` at startup:
|
|
158
|
+
|
|
159
|
+
```json
|
|
160
|
+
{"schemaVersion":1,"ownerCapacity":4,"ownerMaxTokens":100000}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Capacity accepts 1–32. Omit `ownerMaxTokens` to leave the owner token budget unspecified. Configuration is a regular bounded file, not a request override; changes take effect on explicit owner restart. Existing `ensure-owner` starts or reuses the detached local owner. No global service installation is required. Restart preserves uncertain attempts and does not automatically resume paused work.
|
|
164
|
+
|
|
165
|
+
The owner token budget is cumulative across runs retained in its store, including unspent final reservations. It has no implicit daily reset and is not a monetary budget. Preparation may happen before admission; these counters do not price CPU or storage. Settled unknown provider usage requires the declared allowance or an authenticated `program-reconcile` request with `resolution: "usage"`, observed counters, authorization provenance and a reason. Observed usage cannot be silently overwritten.
|
|
166
|
+
|
|
167
|
+
A policy may declare `resources: {maxTokens, reserveTokensPerAttempt, finalReserveTokens, unknownUsage: "block" | "allow"}`. These are durable admission budgets, not provider hard limits. In-flight work can exceed estimates. Unknown consumption is explicit and cannot be represented as measured zero. An owner-declared nonprovider command can use `tokenAccounting: "none"`; its usage is `not-applicable`, rather than measured zero. Arbitrary commands remain unknown without this declaration. Required final checks and review are never waived to fit a budget. `program-explain` reports usage liability, scheduler capacity, storage deduplication and actionable diagnostics. Observations are bounded, deduplicated and persisted before final schema validation; candidate acceptance still depends on owner receipts.
|
|
168
|
+
|
|
169
|
+
Program model workers prepare existing repository context from their current clone and record context diagnostics. Codex can receive native local images with delivery receipts; delivery does not prove comprehension. Codex thread recovery requires observed termination, the original workspace and compatible invocation. Reconcile explicitly before resuming; do not retry uncertain effects blindly.
|
|
170
|
+
|
|
171
|
+
The opt-in `kind: "claude"` executor requires one explicit native executable in `argv`, `isolation: "cooperative"`, `network: "host"` and owner policy allowing both. Its stream-JSON adapter uses structured output and restricted tools, disables inherited hooks/MCP, records usage including failed results, and checks session identity. It requires a CLI compatible with the documented flags (minimum indicated 2.1.259). This integration has deterministic protocol coverage; no real Claude smoke or quality comparison has been performed. Claude provides neither strong isolation nor observed process-tree termination here; native image delivery and workspace thread recovery are currently Codex capabilities.
|
|
172
|
+
|
|
173
|
+
Independent coding quality and competitive superiority require external evaluation. `scripts/summarize-fabric-benchmark.mjs` validates collected reports and keeps missing usage or independent assessment explicit. Deterministic runtime tests do not establish superiority over Claude Code.
|
|
174
|
+
|
|
175
|
+
### Corrections from implementation review
|
|
176
|
+
|
|
177
|
+
Templates requiring human approval must supply an owner-registered `approvalSchema` accepting an object with `approved: true`. The template emits a bound wait event and passes its output to the gate. `evidence` accepts readonly owner-registered executors. Capture obligations currently require the population migration template with evidence executors; review/bugfix convenience templates reject that profile before dispatch. Custom workflow IR remains available for broader UI assessment flows. Template scopes must fit acceptance, policy and executor permissions; resolver scope must cover every proposed file.
|
|
178
|
+
|
|
179
|
+
Trusted hosts may call `ProgramRunService.updateRuntimeOptions` to resize activity capacity without interrupting active attempts. File configuration remains startup/restart configuration. Completed publication may receive usage reconciliation, but does not reopen its gate or become resumable.
|
|
180
|
+
|
|
181
|
+
Recovery now binds the delivered repository context, supplementary runtime observations and evidence bytes to the invocation fingerprint. Older markers that lack this binding are conservatively incompatible; do not rewrite them to bypass reconciliation. Preparation observations separate workspace, environment, cache verification/copy, dependency installation, capture and execution timings. Nested phase durations must not be summed as independent wall time.
|
|
182
|
+
|
|
183
|
+
For paired external reports, use `node --import tsx scripts/summarize-fabric-benchmark.mjs LEFT.json RIGHT.json`. Comparison validates matching tasks, model, tools, context, contract and budget; unmatched inputs cannot establish controlled superiority. Missing metrics remain unknown. CI also verifies that each critical gate actually produces a passing test result.
|
package/docs/agent-fabric.md
CHANGED
|
@@ -9,12 +9,10 @@ Forge Agent Fabric is an experimental protocol-oriented execution layer for dyna
|
|
|
9
9
|
|
|
10
10
|
## Implementation status
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
the current capability inventory. This refresh did not rerun the SDK pilot or establish
|
|
17
|
-
publication of the inspected revision.
|
|
12
|
+
Workflow corrections R2.2: inherited subworkflow quotas/cancellation, shared recoverable leases, owner visual case catalogs, typed connections, compact linked journal and graph inspection. See [correction plan](architecture/agent-fabric/WORKFLOW_PROGRAM_V2_CORRECTIONS.md).
|
|
13
|
+
|
|
14
|
+
Current development workflow runtime adopts operatorVersion 2 directly, without a legacy interpreter or migration requirement. See [workflow API](./agent-fabric-programs.md), [normative architecture](./architecture/agent-fabric/WORKFLOW_PROGRAM_V2_ADR.md) and [current implementation evidence](./architecture/agent-fabric/WORKFLOW_PROGRAM_V2_EVIDENCE.md). This revision adds activity quotas, durable waiting/continuation, scoped item/final obligations and immutable capture evidence. Historical plans and SDK pilots are not proof of current model quality. This implementation was validated without real LLM calls.
|
|
15
|
+
|
|
18
16
|
|
|
19
17
|
The Codex-accompanied task mode now records acceptance criteria, scoped source snapshots,
|
|
20
18
|
independent review and checks in a persistent local task. Its dynamic workflow scheduler
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Forge Agent Fabric — implementação e evidências
|
|
2
|
+
|
|
3
|
+
Data: 2026-10-10. Baseline: `3e7475f7a0e47be0d351d5c37355ed9f3a5c0ecd`.
|
|
4
|
+
Plano: `WORKFLOW_PROGRAM_COMPETITIVE_PLAN.md`. Entrega local sem commit, push, publicação ou deployment.
|
|
5
|
+
|
|
6
|
+
## Entrega por etapa
|
|
7
|
+
|
|
8
|
+
| Etapa | Implementação | Evidência e limite |
|
|
9
|
+
|---|---|---|
|
|
10
|
+
| E0 | Relatório versionado de benchmark, validação e resumo com avaliação independente | Unknown não vira zero; aprovação do owner não prova sucesso externo. Nenhum benchmark de qualidade com provedor foi realizado. |
|
|
11
|
+
| E1 | Observações duráveis, deduplicação, semântica incremental/cumulativa, usage em falhas, diagnóstico estruturado | Teste de output inválido preserva consumo após restart; contadores inválidos/overflow bloqueiam. Não aplicável é distinto de medição zero. |
|
|
12
|
+
| E2 | Round-robin e capacidade owner configurável de 1 a 32 | Três runs elegíveis alternam; regressão T07 identificou e corrigiu cursor quando novas filas chegam. |
|
|
13
|
+
| E3 | Reconciliação explícita e retomada Codex com workspace original, término observado, geração e fingerprint | Serviço encaminha thread compatível; fixture Git com preparação real rejeita delta incompatível e marker adulterado antes de iniciar modelo. |
|
|
14
|
+
| E4 | Autoria pelo owner, declarações tipadas e templates review/bugfix/migration | Três templates executam até acceptance-ready com checks/gate; baseline correto gera zero implementação. Revisão negativa não edita nem aprova. |
|
|
15
|
+
| E5 | Contexto existente do repositório integrado ao clone dos program workers | Snapshot/diagnósticos registrados; qualidade do código gerado com esse contexto não foi medida. |
|
|
16
|
+
| E6 | Admissão serializada, reservas duráveis por run/owner e reserva final | Testes de restart, input forjado e orçamento entre runs. Uso real informado prevalece sobre declaração de comando sem provedor. |
|
|
17
|
+
| E7 | Preparação instrumentada e CAS deduplicado antes de escrita/fsync | Duplicata não aumenta bytesWritten; conteúdo corrompido continua rejeitado. Não há alegação de ganho geral de latência. Cache existente de dependências foi preservado. |
|
|
18
|
+
| E8 | Resolver autorizado, candidato novo e recibo causal de substituição | População fechada requer nova avaliação, obrigações de cada item e união de checks. Recibo vincula geração, semântica, contrato e população; relógio não autoriza reaproveitamento. |
|
|
19
|
+
| E9 | Adapter Claude opt-in, validação de versão, reutilização do owner background existente e imagens nativas Codex | Protocolo simulado e transporte de imagem verificados. Claude real não foi executado; adapter cooperativo, rede do host, sem término garantido da árvore. |
|
|
20
|
+
|
|
21
|
+
## Módulos e interfaces
|
|
22
|
+
|
|
23
|
+
- Runtime: `program-contract`, `program-service`, `program-scheduler`, `program-store`, `program-observation` e `program-view`.
|
|
24
|
+
- Workers: `program-worker`, `codex-sdk-worker`, `claude-program-worker`, observação de `managed-workspace` e contexto existente do repositório.
|
|
25
|
+
- Autoria: `program-authoring`, `program-templates`, opções compose no `program-api` e exemplos em `examples/agent-fabric-v2/templates/`.
|
|
26
|
+
- Interfaces: ações `program-author` e `program-author-types` em CLI/MCP/owner, configuração regular e limitada `.forge/fabric-runtime.json`, capabilities compartilhadas e exports públicos.
|
|
27
|
+
- Avaliação: `program-benchmark` e `scripts/summarize-fabric-benchmark.mjs`; apenas validam relatórios previamente coletados.
|
|
28
|
+
|
|
29
|
+
## Validação concluída
|
|
30
|
+
|
|
31
|
+
Foram usadas suítes direcionadas, sem executar modelos reais. Os números abaixo descrevem grupos de verificações; algumas rodadas repetiram somente casos afetados por correções e não devem ser somadas como testes únicos.
|
|
32
|
+
|
|
33
|
+
| Grupo | Resultado |
|
|
34
|
+
|---|---|
|
|
35
|
+
| SDK, autoria, configuração pública e templates | 21 testes passaram; 125 assertions na primeira integração |
|
|
36
|
+
| Adapter Claude, imagens e recuperação com Git real | 3 testes passaram; 22 assertions; 1,71 s na integração final |
|
|
37
|
+
| Runtime competitivo e execução de templates por ações do owner | 10 testes passaram; 69 assertions; 11,85 s na integração final |
|
|
38
|
+
| Gates críticos existentes selecionados | 4 passaram; 40 filtrados; nenhum erro |
|
|
39
|
+
| Contrato e classificador de CI | 2 passaram; caminhos centrais e desconhecidos preservam suíte ampla |
|
|
40
|
+
| Regressões selecionadas após correção do scheduler | 16 passaram; 23 filtradas; 15,11 s |
|
|
41
|
+
| Typecheck global | `node node_modules/typescript/bin/tsc --noEmit`: exit 0 |
|
|
42
|
+
| Lint e whitespace | Lint aprovado; `git diff --check`: exit 0 |
|
|
43
|
+
| Geração/export dos adapters | Geração e exports generic/codex aprovados |
|
|
44
|
+
| `verify framework --skip-tests --skip-typecheck` | Aprovado: estabilidade da geração, contrato, compiler workspace, policy, auth, RLS estrutural, adapters e lint |
|
|
45
|
+
|
|
46
|
+
A verificação framework omitiu deliberadamente a suíte completa e a repetição do typecheck, pois os testes selecionados e o typecheck foram executados separadamente. Não se declara aprovação da suíte completa. Uma rodada anterior de regressões foi interrompida após 59 aprovações ao revelar bloqueio no scheduler; o cursor foi corrigido e o caso afetado passou na seleção posterior. O aviso estrutural existente de RLS em pglite/memory não comprova isolamento em PostgreSQL.
|
|
47
|
+
|
|
48
|
+
## CI reduzida
|
|
49
|
+
|
|
50
|
+
Ubuntu/Node 22 roda uma vez no job verify. A matriz adicional usa Windows 22 em PRs, Windows 22 e Ubuntu 24 no main, e inclui macOS no disparo manual. Typecheck, geração estável, compiler checks, lint e segurança permanecem.
|
|
51
|
+
|
|
52
|
+
Somente mudanças em módulos explicitamente cobertos de autoria/templates/observação/benchmark/view/Claude e seus testes selecionam a suíte crítica. Alterações em owner, lease, store, workspace, serviços, dependências, arquivos compartilhados, caminhos desconhecidos ou histórico ausente mantêm cobertura ampla. Main mantém a suíte completa de Agent Fabric. Nenhum teste existente foi removido ou assertion enfraquecida. O tempo total do GitHub Actions não foi medido e a nova configuração ainda não foi executada no GitHub.
|
|
53
|
+
|
|
54
|
+
## Correções da revisão independente
|
|
55
|
+
|
|
56
|
+
1. Comandos sem provedor usam declaração explícita do owner `tokenAccounting: "none"` e estado não aplicável; comandos arbitrários continuam desconhecidos. Uso informado inesperadamente é contabilizado.
|
|
57
|
+
2. Resolver não herda aprovação dos itens: recibo causal permite substituir a proveniência original, com nova avaliação completa e checks de item/final.
|
|
58
|
+
3. Freshness usa IDs dos recibos emitidos pelo owner, evitando reaproveitamento baseado em timestamps iguais ou relógio regressivo.
|
|
59
|
+
4. CI reduzida foi restringida para preservar regressões dos módulos centrais.
|
|
60
|
+
5. Recuperação foi exercitada com workspace/marker reais, além do encaminhamento simulado da thread.
|
|
61
|
+
|
|
62
|
+
A revisão daquela rodada não encontrou bloqueadores adicionais no conjunto examinado. A revisão cruzada posterior encontrou e corrigiu bugs adicionais de recuperação, accounting, scopes, aprovação/evidências, Unicode, MCP e CI; veja `WORKFLOW_PROGRAM_COMPETITIVE_REVIEW.md` para os resultados atualizados e limites. Revisão estática e fixtures locais não certificam produção.
|
|
63
|
+
|
|
64
|
+
## Condições de operação e pendências externas
|
|
65
|
+
|
|
66
|
+
- OwnerMaxTokens é cumulativo sobre runs retidos e reservas finais; não se renova diariamente. É orçamento de admissão por tokens, sem preço de CPU/storage ou garantia de teto monetário.
|
|
67
|
+
- Trabalho em curso pode exceder a estimativa reservada; término desconhecido mantém reservas e exige reconciliação.
|
|
68
|
+
- Claude requer executável nativo compatível, versão >=2.1.259 e política cooperativa/rede explícita. A consulta de versão acontece antes de inferência no uso futuro; não foi executada nesta sessão.
|
|
69
|
+
- Retomada no workspace original e imagens nativas estão habilitadas para Codex. Claude não recebe essas garantias neste adapter.
|
|
70
|
+
- Imagem entregue não significa imagem compreendida. Protocolo simulado não demonstra qualidade de programação.
|
|
71
|
+
- Owner background reutiliza o startup local existente; nenhum serviço global foi instalado e nenhum owner permanente foi iniciado nesta entrega.
|
|
72
|
+
- Snapshot incremental, GC destrutivo, cache de respostas entre runs e owner distribuído continuam extensões condicionais, conforme o plano.
|
|
73
|
+
- G4–G6 — qualidade externa, eficiência representativa e superioridade competitiva — exigem avaliação posterior. Não são inferidos dos testes locais.
|
|
74
|
+
|
|
75
|
+
Os artefatos gerados foram atualizados pelo gerador, sem edição manual. Arquivos não rastreados preexistentes foram preservados. Alterações permanecem no checkout para revisão.
|