forgeos 0.1.0-alpha.63 → 0.1.0-alpha.65
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.md +1 -1
- package/CHANGELOG.md +29 -0
- package/docs/agent-fabric.md +416 -0
- package/package.json +7 -4
- package/schemas/agent-fabric/v0.1/control-event.schema.json +281 -0
- package/scripts/field-test-forgeos.mjs +11 -2
- package/src/forge/_generated/releaseManifest.json +1 -1
- package/src/forge/_generated/releaseManifest.ts +3 -3
- package/src/forge/agent-adapters/index.ts +18 -14
- package/src/forge/agent-adapters/types.ts +1 -1
- package/src/forge/agent-fabric/adapter.ts +131 -0
- package/src/forge/agent-fabric/authority.ts +298 -0
- package/src/forge/agent-fabric/canonical.ts +135 -0
- package/src/forge/agent-fabric/conductor.ts +754 -0
- package/src/forge/agent-fabric/dictionary.ts +12 -0
- package/src/forge/agent-fabric/errors.ts +32 -0
- package/src/forge/agent-fabric/hardened-conductor.ts +485 -0
- package/src/forge/agent-fabric/hardened-reducer.ts +211 -0
- package/src/forge/agent-fabric/index.ts +22 -0
- package/src/forge/agent-fabric/journal.ts +116 -0
- package/src/forge/agent-fabric/local-adaptive-digest-worker.mjs +26 -0
- package/src/forge/agent-fabric/local-adaptive-harness.ts +343 -0
- package/src/forge/agent-fabric/local-adaptive-service.ts +398 -0
- package/src/forge/agent-fabric/local-adaptive-worker.ts +146 -0
- package/src/forge/agent-fabric/local-approval-window.ts +211 -0
- package/src/forge/agent-fabric/local-coding-worker.ts +285 -0
- package/src/forge/agent-fabric/local-control-store.ts +239 -0
- package/src/forge/agent-fabric/local-effect-broker.ts +348 -0
- package/src/forge/agent-fabric/local-evolution-approval.ts +81 -0
- package/src/forge/agent-fabric/local-evolution-profile.ts +87 -0
- package/src/forge/agent-fabric/local-evolution-registry.ts +427 -0
- package/src/forge/agent-fabric/local-evolution-service.ts +200 -0
- package/src/forge/agent-fabric/local-intelligence.ts +281 -0
- package/src/forge/agent-fabric/local-paths.ts +18 -0
- package/src/forge/agent-fabric/local-task-contract.ts +203 -0
- package/src/forge/agent-fabric/local-task-inbox.ts +543 -0
- package/src/forge/agent-fabric/local-task-server.ts +249 -0
- package/src/forge/agent-fabric/local-task-service.ts +982 -0
- package/src/forge/agent-fabric/local-verification.ts +551 -0
- package/src/forge/agent-fabric/p0a.ts +104 -0
- package/src/forge/agent-fabric/p0b-model-adapter.ts +434 -0
- package/src/forge/agent-fabric/planning.ts +155 -0
- package/src/forge/agent-fabric/reducer.ts +863 -0
- package/src/forge/agent-fabric/resource-ledger.ts +266 -0
- package/src/forge/agent-fabric/serialized-local-adapter.ts +60 -0
- package/src/forge/agent-fabric/types.ts +424 -0
- package/src/forge/agent-fabric/validation.ts +500 -0
- package/src/forge/agent-memory/bridge.ts +223 -90
- package/src/forge/agent-memory/mcp.ts +71 -9
- package/src/forge/agent-memory/sources/codex-hook-runner.mjs +77 -116
- package/src/forge/cli/adaptive.ts +51 -0
- package/src/forge/cli/changed.ts +13 -32
- package/src/forge/cli/commands.ts +26 -4
- package/src/forge/cli/evolution.ts +40 -0
- package/src/forge/cli/fabric.ts +131 -0
- package/src/forge/cli/main.ts +24 -0
- package/src/forge/cli/new.ts +16 -4
- package/src/forge/cli/parse.ts +61 -0
- package/src/forge/cli/studio.ts +141 -77
- package/src/forge/cli/verify.ts +4 -1
- package/src/forge/compiler/app-graph/tsconfig-hash.ts +41 -4
- package/src/forge/compiler/package-graph/dts-extractor.ts +14 -1
- package/src/forge/dev-console/cycle.ts +6 -1
- package/src/forge/impact/index.ts +18 -21
- package/src/forge/review/index.ts +6 -2
- package/src/forge/runtime/ai/providers.ts +19 -4
- package/src/forge/version.ts +1 -1
- package/src/forge/workspace/change-summary.ts +37 -7
- package/src/forge/workspace/git-summary.ts +27 -25
- package/templates/agent-workroom/package.json +1 -0
- package/templates/agent-workroom/pnpm-workspace.yaml +2 -0
- package/templates/b2b-support-web/package.json +1 -0
- package/templates/b2b-support-web/pnpm-workspace.yaml +2 -0
- package/templates/b2b-support-web/web/package.json +1 -1
- package/templates/minimal-web/package.json +1 -0
- package/templates/minimal-web/pnpm-workspace.yaml +2 -0
- package/templates/nuxt-web/.yarnrc.yml +1 -0
- package/templates/nuxt-web/package.json +1 -0
- package/templates/nuxt-web/pnpm-workspace.yaml +2 -0
- package/templates/nuxt-web/web/package.json +1 -0
- package/templates/vendor-access/package.json +1 -0
- package/templates/vendor-access/pnpm-workspace.yaml +2 -0
package/AGENTS.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @forge-generated generator=0.1.0-alpha.
|
|
1
|
+
// @forge-generated generator=0.1.0-alpha.65 input=dbf2c962fa9cf8e2fa9dc988c6cf3a4e462e8f7dd759f143418b9538a08f4a85 content=721818a6f9a664aa898092d4aa5cd68cbbd8ad6e150c7d3ad3ef785a2e3fcf53
|
|
2
2
|
# AGENTS.md
|
|
3
3
|
|
|
4
4
|
<!-- forge-generated:start -->
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# forgeos
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.65
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#61](https://github.com/Stahldavid/forge/pull/61) [`6fb76d7`](https://github.com/Stahldavid/forge/commit/6fb76d734257d96d1d366528848801cbd3698395) Thanks [@Stahldavid](https://github.com/Stahldavid)! - Harden the single-owner Agent Fabric CLI and MCP pilot with durable patch and
|
|
8
|
+
verification receipts, owner-controlled source-grounded memory, guarded local
|
|
9
|
+
effects, a fixed two-worker harness, and a local Evolution Registry. Improve
|
|
10
|
+
Codex hook ingestion, Studio startup, release propagation checks, and targeted
|
|
11
|
+
CI coverage.
|
|
12
|
+
|
|
13
|
+
## 0.1.0-alpha.64
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [#9](https://github.com/Stahldavid/forge/pull/9) [`ea0e5b6`](https://github.com/Stahldavid/forge/commit/ea0e5b6067e520d40cca23b461ca53d057ef0aca) Thanks [@Stahldavid](https://github.com/Stahldavid)! - Add the experimental Forge Agent Fabric P0a protocol kernel with replay-prevalidated authoritative transitions, exact GoalContract/authorization binding, attenuated grants, journal-coupled resource accounting, globally unique attempt identities, fenced attempt-bound permits, non-terminal uncertainty observations, content-bound outcome provenance, deterministic replay, and adversarial conformance tests.
|
|
18
|
+
|
|
19
|
+
- [#54](https://github.com/Stahldavid/forge/pull/54) [`8721bb5`](https://github.com/Stahldavid/forge/commit/8721bb5466b337ccac75d7212c6a6e597bc338ac) Thanks [@Stahldavid](https://github.com/Stahldavid)! - Add the experimental Agent Fabric P0b-A bounded model adapter behind the P0a authorization, permit, and result boundary. Model invocation binds the provider target, context, and materialization to one attempt; enforces finite request, response, token, and time limits; blocks hidden retries and redirects; and treats ambiguous execution as uncertainty. A fixed loopback Ollama path supports keyless local inference. Model output remains non-authoritative; tools, delegation, persistent recovery, and production readiness are outside this release.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#57](https://github.com/Stahldavid/forge/pull/57) [`98c3211`](https://github.com/Stahldavid/forge/commit/98c321103d7771a38dc27a5720b336ff8c817f83) Thanks [@Stahldavid](https://github.com/Stahldavid)! - Add an experimental local `forge fabric` coding task flow with durable proposal and
|
|
24
|
+
control records, visible owner review, a bounded Ollama attempt, isolated Git diff
|
|
25
|
+
materialization, and a separate result decision. Keep MCP task mutation disabled
|
|
26
|
+
and correct Codex hook trust reporting for synthetic smoke events.
|
|
27
|
+
|
|
28
|
+
- [#58](https://github.com/Stahldavid/forge/pull/58) [`a4da2d0`](https://github.com/Stahldavid/forge/commit/a4da2d0eb5b84737bf56ae7ad5924ba16cee6669) Thanks [@Stahldavid](https://github.com/Stahldavid)! - Add a single local Agent Fabric owner process so CLI and MCP clients share the
|
|
29
|
+
same PGlite-backed task service. MCP can submit untrusted proposals and read
|
|
30
|
+
status while owner approval, execution, and diff acceptance remain outside MCP.
|
|
31
|
+
|
|
3
32
|
## 0.1.0-alpha.63
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
# Forge Agent Fabric
|
|
2
|
+
|
|
3
|
+
Forge Agent Fabric is an experimental protocol-oriented execution layer for dynamically materialized agents and workflows. It extends Forge's existing compiler, outbox, actions, workflows, policy, and agent runtime rather than replacing them.
|
|
4
|
+
|
|
5
|
+
## Implementation status
|
|
6
|
+
|
|
7
|
+
The deterministic P0a protocol kernel and the bounded P0b-A model adapter are implemented.
|
|
8
|
+
P0b-A invokes one real model through the existing P0a permit and result boundary. Its
|
|
9
|
+
accepted scope and exact adoption evidence are recorded in
|
|
10
|
+
[`P0B_A_ADOPTION_RECORD.md`](./architecture/agent-fabric/P0B_A_ADOPTION_RECORD.md).
|
|
11
|
+
|
|
12
|
+
The local coding pilot has bounded proposal validation, a single-process PGlite
|
|
13
|
+
control journal, browser-based owner review, an isolated Ollama coding worker,
|
|
14
|
+
and MCP proposal/status tools backed by a local owner process. It does not make
|
|
15
|
+
a production persistence or security claim. Its scope and remaining gates are
|
|
16
|
+
in [`P0B_B_LOCAL_CODING_SCOPE.md`](./architecture/agent-fabric/P0B_B_LOCAL_CODING_SCOPE.md).
|
|
17
|
+
The [single-owner acceptance matrix](./architecture/agent-fabric/LOCAL_SINGLE_OWNER_ACCEPTANCE.md)
|
|
18
|
+
separates the current local implementation from its remaining release and human
|
|
19
|
+
acceptance gates.
|
|
20
|
+
Owner-selected local memory, fixed two-process data workers, and a standalone
|
|
21
|
+
Evolution Registry have separate narrow workflows below. These do not grant
|
|
22
|
+
the Ollama coding worker new tools or executable extensions.
|
|
23
|
+
|
|
24
|
+
`LocalAdaptiveHarness.run()` is a fixed local demonstration of two permitted
|
|
25
|
+
Node processes (`inventory` and `constraints`) followed by an authoritative
|
|
26
|
+
join. Each child receives only bounded text on stdin, an empty environment,
|
|
27
|
+
and a one second wall limit. The coordinator validates each digest against its
|
|
28
|
+
own input before committing the P0a result; cancellation, timeout, or an
|
|
29
|
+
invalid report leaves the join blocked. This trusted data worker is not an
|
|
30
|
+
arbitrary coding agent or an OS security sandbox.
|
|
31
|
+
|
|
32
|
+
The single-PC CLI wraps that harness with a local owner decision and durable
|
|
33
|
+
readback. From the repository root, create a JSON file with exactly two fields,
|
|
34
|
+
for example `{"inventory":"src/a.ts","constraints":"read only"}`. Each field
|
|
35
|
+
is data of at most 256 UTF-8 bytes. Then run:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
node bin/forge.mjs fabric adaptive-propose --file input.json --json
|
|
39
|
+
node bin/forge.mjs fabric adaptive-review <run-id> --json
|
|
40
|
+
node bin/forge.mjs fabric adaptive-run <run-id> --json
|
|
41
|
+
node bin/forge.mjs fabric adaptive-status <run-id> --json
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
To narrow the two data fields through an owner-selected Evolution profile,
|
|
45
|
+
pass `--channel canary` or `--channel stable` to `adaptive-propose` after that
|
|
46
|
+
channel has a selected `local-adaptive-input-profile` version. The proposal
|
|
47
|
+
binds the immutable version ID before review. The owner window displays it,
|
|
48
|
+
and `adaptive-run` checks that the same version remains selected and loadable
|
|
49
|
+
before issuing permits. A changed or revoked selection blocks the run. The
|
|
50
|
+
profile validates labels and lengths only; it does not provide code, tools,
|
|
51
|
+
instructions, or worker behavior.
|
|
52
|
+
Profile decisions and an adaptive run share a local process lock, so a
|
|
53
|
+
promotion or revocation cannot race between profile readback and worker dispatch.
|
|
54
|
+
|
|
55
|
+
`adaptive-review` opens a loopback browser window showing both exact inputs,
|
|
56
|
+
the bound profile version when present, and their proposal digest. The approval
|
|
57
|
+
expires after five minutes and permits one run. The
|
|
58
|
+
CLI commits the owner authorization, fixed plan, child grants, and both P0a
|
|
59
|
+
permits to a separate local PGlite journal before starting either process.
|
|
60
|
+
The result record and authoritative join can be read after closing and
|
|
61
|
+
reopening the CLI. If the process dies after committing the join but before
|
|
62
|
+
saving the result record, status still reports the authoritative join but may
|
|
63
|
+
omit process IDs and child details. A run cannot be repeated; a crash after
|
|
64
|
+
dispatch is shown as uncertain unless the durable journal contains the join.
|
|
65
|
+
Cancellation, failed workers, or missing results never authorize a join.
|
|
66
|
+
Local records and the owner verifier key live under `.forge/local/agent-fabric`.
|
|
67
|
+
The local owner lock prevents concurrent mutating CLI invocations; after a
|
|
68
|
+
crash, inspect `adaptive-status` before any manual lock recovery. This is a
|
|
69
|
+
single-PC workflow, not a production security or multi-host claim.
|
|
70
|
+
|
|
71
|
+
The following remain explicitly deferred and must not be inferred from architecture notes, historical handoffs, or local experiments:
|
|
72
|
+
|
|
73
|
+
- model-selected tools, plugins or child delegation (the local data workers use
|
|
74
|
+
fixed code-owned child permits only);
|
|
75
|
+
- PGlite-backed production persistence/outbox integration for Agent Fabric;
|
|
76
|
+
- general consequential-effect brokers and arbitrary external-system effects
|
|
77
|
+
(the local pilot has fixed patch and Docker verification receipts only);
|
|
78
|
+
- recovery epochs and integrity-unknown recovery;
|
|
79
|
+
- adaptive model routing and general harness compilation beyond the fixed
|
|
80
|
+
two-process data workflow;
|
|
81
|
+
- executable plugin promotion, shared production memory, and autonomous self-evolution;
|
|
82
|
+
- production deployment or production security claims.
|
|
83
|
+
|
|
84
|
+
## P0a scope
|
|
85
|
+
|
|
86
|
+
The first vertical implements a deterministic control kernel with:
|
|
87
|
+
|
|
88
|
+
- explicit `OwnerAuthorization`, `GoalContract`, `RunPlanRevision`, `PlanDelta`, `AgentSpec`, `HarnessSpec`, `ExecutionProfile`, and `EffectiveRunSpec` contracts;
|
|
89
|
+
- an immutable-by-copy control journal with sequence, predecessor, digest chain, and deterministic reducer;
|
|
90
|
+
- owner authorization ingress through an injected verifier, with content-bound verification evidence recorded in the journal and revalidated during replay;
|
|
91
|
+
- root grants bound to an explicit verified owner authorization;
|
|
92
|
+
- exact binding between a permit's grant/root authorization and the `GoalContract.authorityInvocationId` of its active plan;
|
|
93
|
+
- child grants with monotonic attenuation and transitive revocation;
|
|
94
|
+
- resource reservation plus child-grant registration as one in-memory transactional operation;
|
|
95
|
+
- a Conductor-owned internal `ResourceLedger`, seeded from constructor definitions and hydrated from authoritative replay on resume;
|
|
96
|
+
- replay-side reconstruction of consumable, capacity, and counter accounting from trusted resource definitions and journaled reservation transitions;
|
|
97
|
+
- globally unique attempt identities, one claim lineage per attempt, and at most one execution permit per attempt;
|
|
98
|
+
- durable dispatch intent, non-authoritative offers, atomic claims, leases, fencing, and attempt-bound permits;
|
|
99
|
+
- deterministic adapter protocol behavior;
|
|
100
|
+
- worker result reports bound to permit, intent, plan revision, `EffectiveRunSpec`, and fencing generation;
|
|
101
|
+
- replay-side recomputation of the canonical `WorkerResultReport` digest from the persisted outcome fields;
|
|
102
|
+
- authoritative `succeeded | failed` outcome commit that preserves result-report provenance and rejects stale or revoked ancestry;
|
|
103
|
+
- late `AttemptUncertaintyObservation` evidence that does **not** become a terminal authoritative outcome and therefore does not by itself block retry;
|
|
104
|
+
- plan revisions that preserve `GoalContract` and workflow program identity and are exactly derivable from a registered `PlanDelta`;
|
|
105
|
+
- runtime event validation and a closed JSON Schema envelope/payload model;
|
|
106
|
+
- crash/replay reconstruction without re-running a planner.
|
|
107
|
+
|
|
108
|
+
P0a intentionally does not implement external effects, persistent memory, model routing, plugin promotion, or production deployment.
|
|
109
|
+
|
|
110
|
+
## Live transition rule: replay-valid before append
|
|
111
|
+
|
|
112
|
+
The public P0a `ForgeAgentConductor` wraps the underlying journal with replay prevalidation. Before a new authoritative event is appended, the candidate prefix is reconstructed with the same sequence/predecessor/digest rules and must be accepted by the hardened replay semantics.
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
current trusted journal prefix
|
|
116
|
+
+ candidate event
|
|
117
|
+
↓
|
|
118
|
+
hardened replay validation
|
|
119
|
+
↓
|
|
120
|
+
accept → append with journal CAS
|
|
121
|
+
reject → no append
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
This closes the class of bugs where a public Conductor method returns success but leaves an append-only journal that the same P0a implementation cannot replay.
|
|
125
|
+
|
|
126
|
+
The Conductor also pins its clock once per synchronous state transition so payload timestamps and the enclosing authoritative event timestamp are derived from the same clock observation when equality is part of the protocol invariant.
|
|
127
|
+
|
|
128
|
+
## Authority model
|
|
129
|
+
|
|
130
|
+
A workflow may choose how to work, but it may not create authority. The reference Conductor requires an `OwnerAuthorizationVerifier` before it can admit an `OwnerAuthorization`. The verification result is content-bound to the authorization digest and the replay path requires a trust-bound verifier to validate the recorded evidence again.
|
|
131
|
+
|
|
132
|
+
Root grants must remain within that authorization. Child grants must be strict subsets of their parent and remain invalid if:
|
|
133
|
+
|
|
134
|
+
- any ancestor is revoked or expired;
|
|
135
|
+
- the root authorization is revoked or expired;
|
|
136
|
+
- the child reservation is missing or has been released.
|
|
137
|
+
|
|
138
|
+
A grant is not sufficient merely because its capabilities/sources/targets fit an intent. Before permit issuance and during replay, P0a resolves:
|
|
139
|
+
|
|
140
|
+
```text
|
|
141
|
+
permit
|
|
142
|
+
→ dispatch intent
|
|
143
|
+
→ active RunPlanRevision
|
|
144
|
+
→ GoalContract
|
|
145
|
+
→ GoalContract.authorityInvocationId
|
|
146
|
+
→ exact OwnerAuthorization
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
The grant's `rootAuthorizationId` must equal that goal authority invocation, the authorization must include the goal, and authorization/plan/intent must belong to the same root execution.
|
|
150
|
+
|
|
151
|
+
```text
|
|
152
|
+
authenticated owner authorization
|
|
153
|
+
-> trusted ingress verification
|
|
154
|
+
-> root execution grant
|
|
155
|
+
-> derived child grant + resource reservation
|
|
156
|
+
-> dispatch intent
|
|
157
|
+
-> dispatch offer (not authority)
|
|
158
|
+
-> scheduling claim + lease + fencing
|
|
159
|
+
-> attempt execution permit
|
|
160
|
+
-> executor startup report
|
|
161
|
+
-> worker result report
|
|
162
|
+
-> conditional authoritative succeeded|failed outcome commit
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The concrete production identity provider, signature/trust-root mechanism, and credential lifecycle are deliberately outside P0a; the kernel only requires a verifier contract with deterministic/offline verification of recorded admission evidence.
|
|
166
|
+
|
|
167
|
+
## Attempt identity and result binding
|
|
168
|
+
|
|
169
|
+
`attemptId` is a stream-global identity, not merely a caller convenience. A second claim may not reuse an existing attempt ID, even for another intent, and an attempt may receive only one execution permit. Hardened replay independently checks the one-per-attempt permit invariant so a fabricated journal cannot bypass the live Conductor check.
|
|
170
|
+
|
|
171
|
+
A `WorkerResultReport` is explicitly bound to:
|
|
172
|
+
|
|
173
|
+
- `attemptId`;
|
|
174
|
+
- `permitId`;
|
|
175
|
+
- `intentId`;
|
|
176
|
+
- `planRevisionId`;
|
|
177
|
+
- `effectiveRunSpecDigest`;
|
|
178
|
+
- `fencingToken`.
|
|
179
|
+
|
|
180
|
+
The report digest covers those fields as well as status, result digest, evidence digests and report time. `commitOutcome()` runtime-validates the report and compares it against the persisted permit/claim/intent lineage before it can become authoritative. Hardened replay reconstructs the report representation from the persisted outcome fields and recomputes the digest; a journal cannot claim an unrelated `reportDigest` while keeping different report fields.
|
|
181
|
+
|
|
182
|
+
## Resource atomicity and replay
|
|
183
|
+
|
|
184
|
+
P0a uses `ResourceLedger.transaction()` to make reservation and child-grant journal registration atomic within the in-memory reference implementation. If journal registration fails, the ledger snapshot is restored, including consumable, capacity, and counter state.
|
|
185
|
+
|
|
186
|
+
The public Conductor does **not** retain caller-owned mutable ledger state as authority. When resource definitions are supplied at construction, it clones those definitions into a Conductor-owned internal ledger. On resume from an existing journal, the internal ledger is hydrated from the authoritative replay projection before new resource transitions are allowed. An empty constructor seed therefore cannot erase prior usage, and later out-of-band mutations of the caller's seed cannot change authority state. A conflicting non-empty seed fails closed.
|
|
187
|
+
|
|
188
|
+
The replay path does not accept a reservation merely because its shape matches a child grant. Resource definitions and limits are supplied through the replay trust context; reservation transitions are reapplied to reconstructed global/owner accounting. Duplicate resources, unknown resources, invalid transitions, or aggregate global overcommit fail closed.
|
|
189
|
+
|
|
190
|
+
Reservation `consume` and `release` operations have journaled transitions when performed through the Conductor. Releasing the reservation backing a derived grant makes that grant lineage non-current for future permits/startups/outcomes.
|
|
191
|
+
|
|
192
|
+
This remains an in-memory protocol proof. A later persistence slice must implement the same atomicity and journal coupling with a real transactional store/outbox.
|
|
193
|
+
|
|
194
|
+
## Uncertainty is not an authoritative outcome
|
|
195
|
+
|
|
196
|
+
P0a deliberately separates:
|
|
197
|
+
|
|
198
|
+
```text
|
|
199
|
+
AttemptUncertaintyObservation
|
|
200
|
+
!=
|
|
201
|
+
AuthoritativeOutcomeCommit
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
A late worker/adapter observation may say that startup or completion is uncertain even after a lease, permit, plan or grant has become stale. The observation is retained as evidence, but it does not make the intent terminal and cannot by itself block a later scheduling claim.
|
|
205
|
+
|
|
206
|
+
`executeP0aActivity()` preserves uncertainty not only when an adapter throws or explicitly returns `unknown`, but also when a positive startup/result report arrives too late or otherwise fails authoritative admission. The stale positive report does not regain authority; the control plane stores only a non-terminal uncertainty observation describing the rejected report path.
|
|
207
|
+
|
|
208
|
+
Only a currently authorized control path may commit a terminal P0a outcome, and P0a terminal outcomes are limited to `succeeded | failed`.
|
|
209
|
+
|
|
210
|
+
## Replay model and trust boundary
|
|
211
|
+
|
|
212
|
+
`MemoryControlJournal` stores cloned/frozen events and returns clones to callers. Every committed envelope carries:
|
|
213
|
+
|
|
214
|
+
- monotonic sequence;
|
|
215
|
+
- predecessor event ID;
|
|
216
|
+
- predecessor event digest;
|
|
217
|
+
- event digest;
|
|
218
|
+
- monotonic authoritative timestamp.
|
|
219
|
+
|
|
220
|
+
The public `replayControlState()` adds hardened protocol checks over the deterministic reducer and revalidates:
|
|
221
|
+
|
|
222
|
+
- a single `rootExecutionId` for the control stream;
|
|
223
|
+
- the digest chain and event shape;
|
|
224
|
+
- trusted owner-authorization evidence;
|
|
225
|
+
- exact GoalContract ↔ grant/root-authorization binding for execution permits;
|
|
226
|
+
- grant ancestry, reservation currentness and revocation;
|
|
227
|
+
- resource accounting against trust-bound definitions;
|
|
228
|
+
- global attempt/resource budgets;
|
|
229
|
+
- stream-unique event/idempotency/result identities;
|
|
230
|
+
- globally unique attempt identity;
|
|
231
|
+
- at most one permit per attempt;
|
|
232
|
+
- exact plan-delta lineage;
|
|
233
|
+
- claims, permits, startup and authoritative outcome bindings;
|
|
234
|
+
- canonical `WorkerResultReport` digest consistency.
|
|
235
|
+
|
|
236
|
+
Malformed replay input is normalized to `AgentFabricError(AF_INVALID_EVENT)` rather than leaking implementation-level exceptions such as `TypeError`.
|
|
237
|
+
|
|
238
|
+
The event hash chain is an **integrity mechanism, not a signature or proof of storage origin**. P0a assumes the journal prefix supplied for authoritative replay comes from the trusted journal/storage boundary. The reducer determines whether that prefix is semantically admissible; production durable storage/authentication of journal bytes is intentionally deferred to the persistence slice.
|
|
239
|
+
|
|
240
|
+
This distinction is important: arbitrary attacker-created bytes do not become authoritative merely because they form a self-consistent hash chain.
|
|
241
|
+
|
|
242
|
+
## Canonicalization scope
|
|
243
|
+
|
|
244
|
+
P0a currently uses `forge-canonical-json/v0.1`, a deterministic TypeScript/JavaScript reference profile with SHA-256. Canonicalization is defined over the JSON data model, not arbitrary JavaScript object behavior: objects must be plain or null-prototype data objects with own enumerable data properties, arrays must be dense and cannot carry extra/symbol properties, accessors are rejected, and an own property named `__proto__` is preserved as ordinary data and therefore participates in the canonical bytes and digest. This prevents different admitted in-memory values from collapsing to the same canonical representation through JavaScript prototype semantics.
|
|
245
|
+
|
|
246
|
+
The profile is **not** claimed to be the final cross-language canonicalization standard. A future protocol revision must adopt a cross-language profile (for example RFC 8785/JCS or an equivalently specified profile) with shared test vectors before Java/Python/Rust implementations are expected to produce identical digests.
|
|
247
|
+
|
|
248
|
+
## Public API
|
|
249
|
+
|
|
250
|
+
The experimental package API is exported only through:
|
|
251
|
+
|
|
252
|
+
```ts
|
|
253
|
+
import {
|
|
254
|
+
ForgeAgentConductor,
|
|
255
|
+
MemoryControlJournal,
|
|
256
|
+
ResourceLedger,
|
|
257
|
+
DeterministicTestAdapter,
|
|
258
|
+
replayControlState,
|
|
259
|
+
} from "forgeos/agent-fabric";
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
That public entry point exposes the hardened Conductor and hardened replay functions. The lower-level implementation modules remain internal implementation detail of the experimental P0a package surface.
|
|
263
|
+
|
|
264
|
+
## Local coding pilot (experimental)
|
|
265
|
+
|
|
266
|
+
The framework checkout also exposes a bounded single-owner CLI path. Run these commands
|
|
267
|
+
from the root of a trusted Git repository with Ollama running and `qwen2.5-coder:3b`
|
|
268
|
+
installed. This pilot uses no hosted API key or Codex model turn.
|
|
269
|
+
|
|
270
|
+
```text
|
|
271
|
+
node bin/forge.mjs fabric capabilities --json
|
|
272
|
+
node bin/forge.mjs fabric propose --file task.json --json
|
|
273
|
+
node bin/forge.mjs fabric memory-add --file note.json --json
|
|
274
|
+
node bin/forge.mjs fabric memory-list --file paths.json --json
|
|
275
|
+
node bin/forge.mjs fabric memory-delete <memory-id> --json
|
|
276
|
+
node bin/forge.mjs fabric status <task-id> --json
|
|
277
|
+
node bin/forge.mjs fabric evidence <task-id> --json
|
|
278
|
+
node bin/forge.mjs fabric review <task-id> --json
|
|
279
|
+
node bin/forge.mjs fabric run <task-id> --json
|
|
280
|
+
node bin/forge.mjs fabric cancel <task-id> --json
|
|
281
|
+
node bin/forge.mjs fabric reconcile <task-id> --json
|
|
282
|
+
node bin/forge.mjs fabric verify <task-id> --json
|
|
283
|
+
node bin/forge.mjs fabric review-result <task-id> --json
|
|
284
|
+
node bin/forge.mjs fabric serve --json
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
`task.json` is an untrusted proposal. Its required fields are `schemaVersion: 1`,
|
|
288
|
+
`repositoryId`, the full `baseCommit`, `goal`, `acceptanceCriteria`, `nonObjectives`,
|
|
289
|
+
`sourcePaths`, `writablePaths`, `requestedModelTargetId: "target:ollama:local"`,
|
|
290
|
+
`requestedModelId: "qwen2.5-coder:3b"`, and
|
|
291
|
+
`limits` with `maximumAttempts`, `maximumWallClockMs`, `maximumOutputTokens`,
|
|
292
|
+
`maximumContextBytes`, `maximumPatchBytes`, and a Unix millisecond `expiresAt`.
|
|
293
|
+
`review` opens a local browser window showing the exact proposal and digest; `run`
|
|
294
|
+
consumes one approved model attempt and writes a diff in an isolated Git worktree.
|
|
295
|
+
The model ID is part of that digest and appears in the owner review. Existing
|
|
296
|
+
tasks approved before model pinning cannot start a new model call; submit a fresh
|
|
297
|
+
proposal. Their saved outcomes and patches remain available for readback, while
|
|
298
|
+
the exact model for a legacy outcome is reported as unknown.
|
|
299
|
+
The service captures the allowlisted tracked source files at the exact current
|
|
300
|
+
HEAD when proposing and rechecks them before spending the approved model
|
|
301
|
+
attempt. Changed source content or HEAD blocks a stale attempt.
|
|
302
|
+
`cancel` revokes an unused owner approval so `run` cannot start it, including after
|
|
303
|
+
the owner restarts. During an active model call, it requests abort from the
|
|
304
|
+
local adapter. The returned `model_uncertain` state does not prove the provider
|
|
305
|
+
stopped; a dispatched attempt cannot be retried. Cancellation does not stop
|
|
306
|
+
patch materialization or Docker verification that has already started. Start
|
|
307
|
+
`fabric serve` before `run` when you need a second CLI process to cancel an
|
|
308
|
+
in-flight call; a one-shot `run` has no cross-process abort endpoint.
|
|
309
|
+
`review-result` shows the recorded diff for a separate owner decision. Acceptance
|
|
310
|
+
records a decision only; it does not alter the original checkout or merge code.
|
|
311
|
+
|
|
312
|
+
Private memory is opt in and local to this checkout. `memory-add` reads a JSON
|
|
313
|
+
file such as `{ "sourcePaths": ["src/example.ts"], "text": "Owner note",
|
|
314
|
+
"retentionMs": 86400000 }`; `memory-list` reads a JSON file containing only
|
|
315
|
+
`sourcePaths`. Both require an unchanged tracked source snapshot. Notes are
|
|
316
|
+
bounded to 2 KiB, retained for at most 30 days, and stored under
|
|
317
|
+
`.forge/local/agent-fabric`. `memory-delete` removes a note by its returned ID.
|
|
318
|
+
To select notes for a coding task, add `"memoryIds": ["memory:<id>"]` to
|
|
319
|
+
`task.json` using returned full IDs. The proposal digest binds those IDs; the
|
|
320
|
+
owner review displays their text and provenance. Missing, expired, deleted, or
|
|
321
|
+
source-stale notes block approval or execution. Selected notes consume the
|
|
322
|
+
existing context byte budget and are labeled `untrusted_memory` in the model
|
|
323
|
+
context. MCP task tools cannot add, list, or delete private memory.
|
|
324
|
+
|
|
325
|
+
An optional `verification` field binds an immutable local Docker image ID and
|
|
326
|
+
two to four bounded command descriptors into the proposal digest. The first
|
|
327
|
+
descriptor is `{ "kind": "git-diff-check", "timeoutMs": 5000 }`; the remaining
|
|
328
|
+
descriptors are `{ "kind": "node-test-file", "path": "pass.test.mjs",
|
|
329
|
+
"timeoutMs": 20000 }`. The owner sees these exact commands and image in the
|
|
330
|
+
approval window. The image ID must match the locally installed `node:22`
|
|
331
|
+
image with a `node@sha256` registry digest; the service rejects a proposal
|
|
332
|
+
pointing to another local image and rechecks the tag before execution.
|
|
333
|
+
Each Node test file must exist in the pinned commit and be outside the task's
|
|
334
|
+
writable paths, so the model cannot replace the test that judges its patch.
|
|
335
|
+
After `run` produces a patch, `verify` checks deterministic test paths,
|
|
336
|
+
mount encoding, Docker context, and the pinned image before recording a durable
|
|
337
|
+
intent. A dispatch barrier is recorded before container execution. The owner
|
|
338
|
+
can clear only an intent that has no dispatch barrier; a potentially started
|
|
339
|
+
container cannot be retried automatically. `git diff --check` runs with external
|
|
340
|
+
diff and filesystem monitor helpers disabled on the host; Node tests run inside
|
|
341
|
+
Docker Desktop without network, with an
|
|
342
|
+
immutable already-installed image, read-only checkout, nonroot user and resource
|
|
343
|
+
limits. Accepting a patch with an approved verification profile requires all
|
|
344
|
+
checks to pass; a failed or uncertain result can still be rejected by the owner.
|
|
345
|
+
|
|
346
|
+
The local store lives under `.forge/local/agent-fabric` and has one PGlite process
|
|
347
|
+
owner. Start `forge fabric serve` to keep that owner running while separate CLI
|
|
348
|
+
and MCP clients connect through a loopback endpoint. The endpoint token stays in
|
|
349
|
+
the local repository store and is not printed. The MCP tools `fabric_propose`,
|
|
350
|
+
`fabric_status`, and `fabric_evidence` use that same owner; they cannot approve,
|
|
351
|
+
run, or accept a task. `fabric_evidence` returns a digest-bound provenance summary
|
|
352
|
+
without raw model text or diff content.
|
|
353
|
+
Without a running owner, CLI commands open the store for a single operation and
|
|
354
|
+
MCP task tools report that the owner is unavailable. A crashed model attempt with
|
|
355
|
+
a committed permit and no outcome remains
|
|
356
|
+
uncertain; a repeated `run` does not spend another attempt. A committed model result
|
|
357
|
+
can be materialized after restart if no patch-effect intent was issued. Patch
|
|
358
|
+
materialization records a durable intent before creating the isolated checkout.
|
|
359
|
+
A crash after that intent reports `patch_uncertain`; `run` will not reapply it.
|
|
360
|
+
`fabric reconcile` reads the checkout and diff artifact against the committed
|
|
361
|
+
model result and records a receipt only when they match exactly. It never
|
|
362
|
+
creates or rewrites the patch. The existing MCP server reports the boundary
|
|
363
|
+
through `fabric_capabilities`. The popup is
|
|
364
|
+
a cooperative same-account interaction, so it is not a security boundary against
|
|
365
|
+
an agent with unrestricted shell or UI control. The model receives only approved
|
|
366
|
+
source files and cannot run shell commands. The Git worktree confines patch
|
|
367
|
+
materialization; optional Node verification is container isolated. This pilot
|
|
368
|
+
does not yet broker arbitrary consequential effects or attest to sandbox escape
|
|
369
|
+
resistance against a hostile local administrator.
|
|
370
|
+
|
|
371
|
+
Maintainers can run `bun scripts/agent-fabric-local-smoke.ts` for an opt-in real
|
|
372
|
+
Ollama fixture. That script injects a synthetic test approval and confirms a diff;
|
|
373
|
+
it does not prove the human popup flow or coding quality on real projects.
|
|
374
|
+
`FORGE_FABRIC_DOCKER_SMOKE=1 bun test tests/agent-fabric/local-task-service.test.ts`
|
|
375
|
+
exercises the service, approved verification, Docker Desktop, durable readback,
|
|
376
|
+
and acceptance with a synthetic approval callback.
|
|
377
|
+
|
|
378
|
+
### Local Evolution Registry (single owner)
|
|
379
|
+
|
|
380
|
+
The local extension workflow pins a candidate's bytes before evaluation. A
|
|
381
|
+
manifest is a repository file with exactly these fields:
|
|
382
|
+
|
|
383
|
+
```json
|
|
384
|
+
{"schemaVersion":1,"extensionKey":"sample","artifactPath":"extensions/sample.js"}
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
The artifact and manifest must be regular files inside the repository. The
|
|
388
|
+
artifact is limited to 1 MiB and the manifest to 16 KiB. Forge copies both to
|
|
389
|
+
content addressed files under `.forge/local/agent-fabric/evolution/`; edits to
|
|
390
|
+
the source files after registration do not change the registered version.
|
|
391
|
+
|
|
392
|
+
```bash
|
|
393
|
+
node bin/forge.mjs evolution register --manifest extensions/sample.json --json
|
|
394
|
+
node bin/forge.mjs evolution evaluate extension:sha256:<digest> --json
|
|
395
|
+
node bin/forge.mjs evolution status extension:sha256:<digest> --json
|
|
396
|
+
node bin/forge.mjs evolution review canary extension:sha256:<digest> --json
|
|
397
|
+
node bin/forge.mjs evolution review promote extension:sha256:<digest> --json
|
|
398
|
+
node bin/forge.mjs evolution load sample --channel stable --json
|
|
399
|
+
node bin/forge.mjs evolution review rollback extension:sha256:<older-digest> --json
|
|
400
|
+
node bin/forge.mjs evolution review revoke extension:sha256:<digest> --json
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
Evaluation is a fixed local suite that checks stored artifact integrity,
|
|
404
|
+
stored manifest integrity, and the manifest contract. It does not execute the
|
|
405
|
+
candidate. Each version evaluates once; a failed or interrupted evaluation
|
|
406
|
+
requires a new candidate version. Canary, promotion, rollback, and revocation
|
|
407
|
+
open a loopback owner review window. Rejection or timeout leaves selection
|
|
408
|
+
unchanged. Rollback can select only a previously stable version that still has
|
|
409
|
+
a passing evaluation. Revocation clears selections and blocks future loading.
|
|
410
|
+
|
|
411
|
+
The `load` command reports verified metadata. Local runtime callers can use
|
|
412
|
+
`LocalEvolutionService.loadSelected` to obtain bytes after the same channel,
|
|
413
|
+
evaluation, revocation, and digest checks. This registry does not import or
|
|
414
|
+
execute those bytes or grant them side effects. Its review window is a
|
|
415
|
+
cooperative human checkpoint; same-account shell or browser automation is
|
|
416
|
+
outside its protection boundary. No hosted model or API key is used.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "forgeos",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.65",
|
|
4
4
|
"description": "Agent-native application framework and compiler for building Forge apps without a mandatory dashboard.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"scripts/field-test-forgeos.mjs",
|
|
14
14
|
"docs/cair-protocol.md",
|
|
15
15
|
"docs/forge-protocol.md",
|
|
16
|
+
"docs/agent-fabric.md",
|
|
16
17
|
"examples/go-billing/",
|
|
17
18
|
"examples/java-billing/",
|
|
18
19
|
"!examples/**/target/**",
|
|
@@ -48,7 +49,8 @@
|
|
|
48
49
|
"./react": "./src/forge/react/index.ts",
|
|
49
50
|
"./vue": "./src/forge/vue/index.ts",
|
|
50
51
|
"./server": "./src/forge/server.ts",
|
|
51
|
-
"./policy": "./src/forge/policy.ts"
|
|
52
|
+
"./policy": "./src/forge/policy.ts",
|
|
53
|
+
"./agent-fabric": "./src/forge/agent-fabric/index.ts"
|
|
52
54
|
},
|
|
53
55
|
"scripts": {
|
|
54
56
|
"test": "node ./bin/forge-bun.mjs test --timeout 120000",
|
|
@@ -103,6 +105,7 @@
|
|
|
103
105
|
"@ai-sdk/anthropic": "^3.0.84",
|
|
104
106
|
"@ai-sdk/openai": "^3.0.71",
|
|
105
107
|
"@electric-sql/pglite": "^0.2.17",
|
|
108
|
+
"@types/react": "^19.2.17",
|
|
106
109
|
"ai": "^6.0.205",
|
|
107
110
|
"jose": "^6.2.3",
|
|
108
111
|
"postgres": "^3.4.5",
|
|
@@ -119,12 +122,12 @@
|
|
|
119
122
|
"@changesets/cli": "^2.31.0",
|
|
120
123
|
"@types/bun": "1.3.14",
|
|
121
124
|
"@types/node": "^24.0.0",
|
|
122
|
-
"@types/react": "^19.2.17",
|
|
123
125
|
"@types/react-test-renderer": "^19.1.0",
|
|
126
|
+
"ajv": "8.20.0",
|
|
124
127
|
"fast-check": "^3.23.2",
|
|
125
128
|
"react-test-renderer": "^19.2.7"
|
|
126
129
|
},
|
|
127
130
|
"overrides": {
|
|
128
131
|
"read-yaml-file": "^3.0.0"
|
|
129
132
|
}
|
|
130
|
-
}
|
|
133
|
+
}
|