@cassiomc1/forgeloop 1.13.0 → 1.14.0

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.
Files changed (211) hide show
  1. package/AGENT_COMPATIBILITY.md +8 -0
  2. package/DOCS_INDEX.md +35 -3
  3. package/ENG/nodejs-backend-development-eng.md +2 -2
  4. package/ENG/sec-code-eng.md +7 -7
  5. package/EXECUTION_STATE.md +12 -0
  6. package/LOOP_ENGINEERING.md +28 -2
  7. package/ORCHESTRATOR_INTEGRATION.md +9 -5
  8. package/PROTOCOL_INTEGRATION.md +55 -2
  9. package/README.md +40 -25
  10. package/TERMINOLOGY.md +2 -0
  11. package/THREAT_MODEL.md +140 -1
  12. package/completions/_forgeloop +19 -1
  13. package/completions/forgeloop.bash +37 -1
  14. package/completions/forgeloop.fish +123 -1
  15. package/docs/ADVISORY_CONTEXT.md +25 -0
  16. package/docs/AGENT_BROWSER_ADAPTER.md +81 -0
  17. package/docs/AGENT_BROWSER_VERIFICATION.md +6 -0
  18. package/docs/AGENT_PROTOCOL_SUMMARY.md +27 -2
  19. package/docs/AGENT_SKILL.md +66 -0
  20. package/docs/ARTIFACT_REFERENCE.md +123 -0
  21. package/docs/AUDIT_UX.md +46 -0
  22. package/docs/BROWSER_VERIFICATION.md +136 -0
  23. package/docs/CLI_REFERENCE.md +366 -6
  24. package/docs/CODE_ATTESTATION.md +2 -2
  25. package/docs/DOCUMENTATION_GUIDE.md +32 -11
  26. package/docs/JEV_BENCHMARKS.md +31 -0
  27. package/docs/MODEL_ROUTING.md +37 -0
  28. package/docs/OPENSRC_ADAPTER.md +241 -0
  29. package/docs/PACKAGE_CONTENTS.md +35 -8
  30. package/docs/PROVIDERS.md +126 -0
  31. package/docs/PROVIDER_ARCHITECTURE.md +199 -0
  32. package/docs/RECIPES.md +9 -0
  33. package/docs/RELEASE_CHECKLIST.md +38 -5
  34. package/docs/SECURITY_REVIEW.md +71 -0
  35. package/docs/SEMANTIC_DECISION_PLANE.md +71 -0
  36. package/docs/TEST_INTELLIGENCE.md +29 -0
  37. package/docs/TEST_PRUNING.md +14 -0
  38. package/docs/TROUBLESHOOTING.md +198 -1
  39. package/docs/UNIVERSAL_INTEGRATION.md +31 -0
  40. package/docs/assets/diagrams/forgeloop-code-attestation-flow.html +2 -2
  41. package/docs/assets/diagrams/forgeloop-code-attestation-flow.receipt.json +5 -5
  42. package/docs/assets/diagrams/forgeloop-code-attestation-flow.svg +1 -1
  43. package/docs/assets/diagrams/forgeloop-engineering-flow.html +39 -26
  44. package/docs/assets/diagrams/forgeloop-engineering-flow.receipt.json +6 -6
  45. package/docs/assets/diagrams/forgeloop-engineering-flow.svg +26 -26
  46. package/docs/assets/diagrams/forgeloop-verification-trust-flow.html +2 -1
  47. package/docs/assets/diagrams/forgeloop-verification-trust-flow.receipt.json +5 -5
  48. package/docs/assets/diagrams/forgeloop-verification-trust-flow.svg +1 -1
  49. package/docs/diagrams/README.md +13 -9
  50. package/docs/diagrams/forgeloop-code-attestation-flow.workflow.json +1 -1
  51. package/docs/diagrams/forgeloop-engineering-flow.workflow.json +24 -19
  52. package/docs/diagrams/forgeloop-verification-trust-flow.workflow.json +1 -0
  53. package/docs/diagrams/reviews/forgeloop-code-attestation-flow.review.json +4 -4
  54. package/docs/diagrams/reviews/forgeloop-engineering-flow.review.json +4 -4
  55. package/docs/diagrams/reviews/forgeloop-verification-trust-flow.review.json +4 -4
  56. package/docs/documentation-manifest.json +750 -5
  57. package/docs/protocol-requirements.json +24 -0
  58. package/package.json +30 -3
  59. package/schemas/config.schema.json +14 -0
  60. package/schemas/context-plan.schema.json +18 -0
  61. package/schemas/semantic-decision.schema.json +46 -0
  62. package/schemas/test-utility.schema.json +44 -0
  63. package/scripts/CI_VALIDATORS.md +6 -6
  64. package/scripts/benchmark-jev.mjs +5 -0
  65. package/scripts/benchmark-test-intelligence.mjs +4 -0
  66. package/scripts/generate-agent-protocol-summary.mjs +4 -1
  67. package/scripts/generate-forgeloop-skill.mjs +133 -0
  68. package/scripts/jev-smoke.mjs +19 -0
  69. package/skills/forgeloop/README.md +9 -0
  70. package/skills/forgeloop/SKILL.md +77 -0
  71. package/skills/forgeloop/references/lifecycle.md +9 -0
  72. package/skills/forgeloop/references/recovery.md +7 -0
  73. package/skills/forgeloop/references/verification.md +7 -0
  74. package/src/adapters/agent-browser/assertions.js +47 -0
  75. package/src/adapters/agent-browser/commands.js +54 -0
  76. package/src/adapters/agent-browser/index.js +3 -0
  77. package/src/adapters/agent-browser/locator.js +40 -0
  78. package/src/adapters/agent-browser/process.js +215 -0
  79. package/src/adapters/agent-browser/provider.js +313 -0
  80. package/src/adapters/emulated-services/constants.js +24 -0
  81. package/src/adapters/emulated-services/index.js +7 -0
  82. package/src/adapters/emulated-services/process.js +162 -0
  83. package/src/adapters/emulated-services/provider.js +282 -0
  84. package/src/adapters/opensrc/normalize.js +90 -0
  85. package/src/adapters/opensrc/process.js +248 -0
  86. package/src/adapters/opensrc/provider.js +338 -0
  87. package/src/adapters/opensrc/search.js +264 -0
  88. package/src/adapters/typesafe/client.js +28 -0
  89. package/src/adapters/typesafe/engine.js +63 -0
  90. package/src/adapters/typesafe/normalize.js +41 -0
  91. package/src/cli.js +108 -0
  92. package/src/commands/checkpoint-revalidate.js +176 -0
  93. package/src/commands/context-plan.js +38 -0
  94. package/src/commands/contract-create.js +264 -0
  95. package/src/commands/contract-revise.js +236 -0
  96. package/src/commands/decision-show.js +14 -0
  97. package/src/commands/decision-status.js +22 -0
  98. package/src/commands/discover.js +41 -0
  99. package/src/commands/doctor.js +15 -0
  100. package/src/commands/gate-record.js +205 -0
  101. package/src/commands/gate-revalidate.js +137 -0
  102. package/src/commands/model-route.js +32 -0
  103. package/src/commands/route.js +146 -18
  104. package/src/commands/semantic-plan.js +17 -0
  105. package/src/commands/task-abandon.js +224 -0
  106. package/src/commands/task-migrate-contract-bootstrap-repair.js +288 -0
  107. package/src/commands/task-repair-contract-bootstrap.js +263 -0
  108. package/src/commands/test-inventory.js +5 -0
  109. package/src/commands/test-prune-plan.js +5 -0
  110. package/src/commands/test-prune-probe.js +5 -0
  111. package/src/commands/test-utility.js +5 -0
  112. package/src/commands/validate-protocol.js +10 -1
  113. package/src/core/artifact-registry.js +24 -0
  114. package/src/core/audit-ux.js +514 -0
  115. package/src/core/browser-verification/constants.js +149 -0
  116. package/src/core/browser-verification/normalize.js +254 -0
  117. package/src/core/browser-verification/provider.js +519 -0
  118. package/src/core/browser-verification/service.js +115 -0
  119. package/src/core/checkpoint-revalidation.js +319 -0
  120. package/src/core/cli-command-definitions.js +241 -0
  121. package/src/core/command-executors.js +110 -0
  122. package/src/core/command-input.js +115 -43
  123. package/src/core/completion-artifacts.js +14 -5
  124. package/src/core/completion.js +4 -6
  125. package/src/core/config.js +3 -0
  126. package/src/core/context-compiler/budget.js +9 -0
  127. package/src/core/context-compiler/candidates.js +39 -0
  128. package/src/core/context-compiler/compiler.js +63 -0
  129. package/src/core/context-compiler/fingerprint.js +11 -0
  130. package/src/core/context-compiler/policy.js +13 -0
  131. package/src/core/context-compiler/result.js +23 -0
  132. package/src/core/contract-bootstrap-recovery.js +655 -0
  133. package/src/core/contract-revision.js +210 -0
  134. package/src/core/decision/artifact.js +69 -0
  135. package/src/core/decision/benchmarks.js +103 -0
  136. package/src/core/decision/cache.js +27 -0
  137. package/src/core/decision/constants.js +58 -0
  138. package/src/core/decision/cutover.js +34 -0
  139. package/src/core/decision/engine.js +22 -0
  140. package/src/core/decision/errors.js +68 -0
  141. package/src/core/decision/events.js +101 -0
  142. package/src/core/decision/freshness.js +19 -0
  143. package/src/core/decision/normalizers/index.js +115 -0
  144. package/src/core/decision/policy.js +18 -0
  145. package/src/core/decision/projection.js +16 -0
  146. package/src/core/decision/question-registry.js +201 -0
  147. package/src/core/decision/request.js +26 -0
  148. package/src/core/decision/resolver.js +130 -0
  149. package/src/core/decision/result.js +58 -0
  150. package/src/core/decision/service.js +156 -0
  151. package/src/core/decision/state-builder.js +65 -0
  152. package/src/core/decision/task-bindings.js +30 -0
  153. package/src/core/decision/test-provider.js +32 -0
  154. package/src/core/decision/thresholds.js +15 -0
  155. package/src/core/error-codes.js +278 -0
  156. package/src/core/events.js +226 -57
  157. package/src/core/evidence-readiness.js +9 -0
  158. package/src/core/execution-prerequisites.js +14 -0
  159. package/src/core/execution-profile.js +63 -38
  160. package/src/core/gate-provenance.js +124 -0
  161. package/src/core/integration-invocation-policy.js +27 -4
  162. package/src/core/integration-resources.js +86 -61
  163. package/src/core/model-router/constants.js +10 -0
  164. package/src/core/model-router/policy.js +103 -0
  165. package/src/core/model-router/router.js +37 -0
  166. package/src/core/next-action-model.js +58 -0
  167. package/src/core/next-action-phases.js +130 -42
  168. package/src/core/next-action-refresh.js +43 -9
  169. package/src/core/next-action-review-phase.js +7 -2
  170. package/src/core/next-action.js +35 -7
  171. package/src/core/phase.js +128 -10
  172. package/src/core/preflight-consistency.js +23 -9
  173. package/src/core/preflight-loaders.js +37 -5
  174. package/src/core/protocol-info.js +65 -0
  175. package/src/core/protocol.js +20 -0
  176. package/src/core/reconcile-closure.js +128 -52
  177. package/src/core/recovery-history.js +1 -0
  178. package/src/core/resumability.js +154 -44
  179. package/src/core/route-artifact.js +15 -1
  180. package/src/core/router.js +67 -1
  181. package/src/core/runtime-context.js +118 -61
  182. package/src/core/schema-validation.js +3 -0
  183. package/src/core/security-review/constants.js +64 -0
  184. package/src/core/security-review/normalize.js +245 -0
  185. package/src/core/security-review/provider.js +204 -0
  186. package/src/core/security-review/service.js +134 -0
  187. package/src/core/semantic-planning/constants.js +19 -0
  188. package/src/core/semantic-planning/projection.js +94 -0
  189. package/src/core/semantic-planning/service.js +15 -0
  190. package/src/core/sources.js +37 -0
  191. package/src/core/task-claim-state.js +201 -1
  192. package/src/core/task-conflict-inspection.js +31 -5
  193. package/src/core/task-paths.js +13 -0
  194. package/src/core/task-recovery.js +1 -0
  195. package/src/core/templates.js +3 -0
  196. package/src/core/test-intelligence/benchmarks.js +68 -0
  197. package/src/core/test-intelligence/inventory.js +73 -0
  198. package/src/core/test-intelligence/prune.js +90 -0
  199. package/src/core/test-intelligence/semantic-state.js +15 -0
  200. package/src/core/test-intelligence/service.js +40 -0
  201. package/src/core/test-intelligence/utility.js +50 -0
  202. package/src/core/trace.js +11 -7
  203. package/src/core/transaction.js +1 -0
  204. package/src/integration.d.ts +492 -0
  205. package/src/integration.js +54 -0
  206. package/src/providers/README.md +47 -0
  207. package/src/providers/capabilities.js +46 -0
  208. package/src/providers/errors.js +15 -0
  209. package/src/providers/index.js +29 -0
  210. package/src/providers/json-snapshot.js +105 -0
  211. package/src/providers/registry.js +152 -0
@@ -0,0 +1,241 @@
1
+ # OpenSrc Advisory Context Adapter
2
+
3
+ ## Status
4
+
5
+ Optional, host-injected, advisory-only. OpenSrc is an external
6
+ host-provisioned executable ([vercel-labs/opensrc](https://github.com/vercel-labs/opensrc),
7
+ Apache-2.0); ForgeLoop never installs, discovers, or invokes it automatically.
8
+
9
+ ## Purpose
10
+
11
+ Give a trusted host a bounded way to recall external package/repository
12
+ source-code snippets (npm, PyPI, crates.io, GitHub, GitLab, Bitbucket) as
13
+ ForgeLoop advisory context through the existing `advisoryContextProviders`
14
+ Integration API boundary.
15
+
16
+ ## Architecture
17
+
18
+ ```text
19
+ host / coding harness
20
+ ↓
21
+ createOpenSrcAdvisoryContextProvider(...)
22
+ ↓
23
+ createForgeLoopContext({ advisoryContextProviders: { opensrc } })
24
+ ↓
25
+ recallAdvisoryContext(...)
26
+ ↓
27
+ <absolute-opensrc> --version (qualified every recall)
28
+ ↓
29
+ <absolute-opensrc> path <source> --cwd <projectRoot> (one source per call)
30
+ ↓
31
+ canonical realpath containment inside OPENSRC_HOME
32
+ ↓
33
+ bounded deterministic Node.js search (ForgeLoop-owned)
34
+ ↓
35
+ normalized advisory items
36
+ ↓
37
+ NON_EVIDENCE_ADVISORY_CONTEXT
38
+ ```
39
+
40
+ OpenSrc owns source acquisition, version-aware resolution, and its own cache.
41
+ ForgeLoop owns snippet selection, normalization, and the advisory trust
42
+ boundary. No `rg`, `grep`, embeddings, or network search are used by ForgeLoop.
43
+
44
+ ## Prerequisites
45
+
46
+ - An OpenSrc executable provisioned by the host (ForgeLoop does not install it).
47
+ - A host-qualified exact expected version (for example `0.7.3`).
48
+ - A dedicated absolute cache root outside the project, passed as `OPENSRC_HOME`.
49
+ - An explicit allowlist of source specs (at most 8).
50
+
51
+ ## Host Configuration
52
+
53
+ ```javascript
54
+ import {
55
+ createForgeLoopContext,
56
+ createOpenSrcAdvisoryContextProvider,
57
+ recallAdvisoryContext,
58
+ } from "@cassiomc1/forgeloop/integration";
59
+
60
+ const opensrc = createOpenSrcAdvisoryContextProvider({
61
+ executablePath: "/absolute/path/to/opensrc",
62
+ expectedVersion: "<host-qualified-version>",
63
+ cacheRoot: "/absolute/path/to/opensrc-cache",
64
+ sources: ["zod", "vercel/next.js"],
65
+ });
66
+
67
+ const runtimeContext = createForgeLoopContext({
68
+ advisoryContextProviders: {
69
+ opensrc,
70
+ },
71
+ });
72
+
73
+ const context = await recallAdvisoryContext({
74
+ target: "/absolute/project",
75
+ taskId: "task-001",
76
+ providerName: "opensrc",
77
+ query: "parse error handling",
78
+ runtimeContext,
79
+ });
80
+ ```
81
+
82
+ Construction is inert: it validates configuration only and never spawns,
83
+ reads source, touches the network, populates the cache, or mutates ForgeLoop
84
+ state.
85
+
86
+ ## Executable Qualification
87
+
88
+ Before source resolution on every recall, the adapter runs
89
+ `<absolute-opensrc> --version` with `shell: false`, bounded output, and a
90
+ shared deadline, then requires `actualVersion === expectedVersion` exactly.
91
+ No semver ranges and no newer-version tolerance. Mismatch fails closed.
92
+
93
+ ## Source Allowlist
94
+
95
+ Only configured `sources` entries are resolved, one per `opensrc path`
96
+ invocation. Specs must be non-empty, bounded (256 chars), free of control or
97
+ whitespace characters, must not begin with `-`, and must not contain shell
98
+ metacharacters. Documented forms include bare npm names (with `@scope/` and
99
+ `@version` pins), `pypi:`, `crates:` (plus `pip:`, `python:`, `cargo:`,
100
+ `rust:` aliases), `owner/repo`, URLs, and `gitlab:` / `bitbucket:` specs.
101
+ Automatic dependency enumeration is out of scope.
102
+
103
+ ## Cache Behavior
104
+
105
+ `OPENSRC_HOME` is set to the configured `cacheRoot` for every OpenSrc child
106
+ process. The cache root and the project root must be fully disjoint: neither
107
+ may equal or contain the other, and the cache must not sit inside
108
+ `.forgeloop`. Each relationship is checked both lexically and canonically
109
+ (realpath), so symlinked prefixes cannot hide an overlap.
110
+ Each printed path must canonicalize inside the cache root, exist, be a
111
+ directory, and survive symlink-escape checks before any search runs.
112
+
113
+ ## Network Behavior
114
+
115
+ `opensrc path` may contact registries or remotes and shallow-clone source on
116
+ cache miss; later recalls may reuse the OpenSrc cache. This recall path is
117
+ protocol-state side-effect-free: ForgeLoop persists no advisory result,
118
+ writes no lifecycle state, and never auto-recalls. OpenSrc itself persists
119
+ cache data under `OPENSRC_HOME`; that is upstream behavior, not ForgeLoop
120
+ state.
121
+
122
+ ## Recall Example
123
+
124
+ See Host Configuration. Only `--version` and `path` are ever invoked; `fetch`,
125
+ `clean`, `remove`, and `rm` are never called by this adapter.
126
+
127
+ ## Result Shape
128
+
129
+ ```javascript
130
+ {
131
+ title: "zod — src/types.ts",
132
+ summary: "L120-L126 | <bounded single-line snippet>",
133
+ sourceRef: "opensrc:zod:src/types.ts#L120-L126"
134
+ }
135
+ ```
136
+
137
+ Summaries are flattened to one portable line because the core advisory
138
+ contract rejects control characters. Absolute cache paths, home directories,
139
+ stderr, environment, credentials, and cache metadata are never emitted. The
140
+ core service then applies `authority: ADVISORY`, `evidenceAuthority: NONE`,
141
+ `actionability: NON_EXECUTABLE`, `trustRole: NON_EVIDENCE_ADVISORY_CONTEXT`,
142
+ and `persisted: false`, plus item fingerprints and deep freezing.
143
+
144
+ ## Trust Boundary
145
+
146
+ Snippets are inert source text. They satisfy no verification requirement,
147
+ terminal requirement, gate, receipt, attestation, or run-check provenance.
148
+ Source content is never executed, even when it contains instruction-like
149
+ text. Provider output never advances phases, selects next actions, releases
150
+ claims, or authorizes durable actions.
151
+
152
+ ## Security
153
+
154
+ Threats and mitigations are tracked in `THREAT_MODEL.md` (OpenSrc rows):
155
+ binary substitution and version drift (exact lazy qualification), malicious
156
+ stdout paths and cache/symlink escapes (realpath containment), prompt
157
+ injection in source (inert bounded text, non-executable trust role),
158
+ credential leakage (no raw stderr/env/absolute-path emission), unbounded
159
+ trees and binary ingestion (sorted traversal, size/count/byte budgets, binary
160
+ skip), network/cache side effects (explicit host-owned `OPENSRC_HOME`,
161
+ documented fetch-on-miss), private-repository credentials (host-owned env,
162
+ never persisted or logged), timeouts and output overflow (shared deadline,
163
+ 64 KiB ceilings, SIGTERM/SIGKILL escalation).
164
+
165
+ ## Limits
166
+
167
+ - Sources: at most 8 configured; one `path` call each.
168
+ - Files read per source: 2,000; examined entries per source: 5,000
169
+ (skipped, oversized, and binary entries count toward traversal, never
170
+ bypass it).
171
+ - Per-file: 256 KiB; total reads: 8 MiB per advisory recall across all
172
+ configured sources through one shared budget.
173
+ - Matches per source: 32; snippet window: 7 lines.
174
+ - Process stdout/stderr: 64 KiB each; kill grace: 250 ms.
175
+ - One shared recall deadline spans version qualification, path resolution,
176
+ traversal, reads, matching, and normalization.
177
+ - Ranking: exact full-query match, then token overlap, then source order,
178
+ relative path, and line number. Repeated runs over unchanged fixtures are
179
+ byte-identical, including identical stopping points under budget pressure.
180
+
181
+ ## Private Repositories
182
+
183
+ Private sources work only through host-owned configuration (environment,
184
+ authenticated OpenSrc cache). ForgeLoop never discovers, persists, logs, or
185
+ returns credentials; errors never echo secret-bearing values.
186
+
187
+ ## Credentials Ownership
188
+
189
+ Credentials belong to the host. They travel only through host-supplied process
190
+ configuration, never through ForgeLoop artifacts, and never into advisory
191
+ output.
192
+
193
+ ## No Auto-Install
194
+
195
+ ForgeLoop never runs package installs, `npx`, `curl | sh`, or equivalents for
196
+ OpenSrc. An unavailable binary maps to the standard advisory-provider
197
+ unavailable semantics; the host provisions OpenSrc explicitly.
198
+
199
+ ## No PATH Discovery
200
+
201
+ The executable must be absolute. `which`, `where`, `command -v`, and PATH
202
+ resolution are never used.
203
+
204
+ ## No Evidence Authority
205
+
206
+ See Trust Boundary. Behavioral claims still require canonical ForgeLoop
207
+ verification with ForgeLoop-owned provenance.
208
+
209
+ ## No Lifecycle Authority
210
+
211
+ See Trust Boundary. Advisory recall is never triggered by `next`,
212
+ `preflight`, verification, `complete`, task creation, task discovery, or
213
+ Agent Skill loading.
214
+
215
+ ## Troubleshooting
216
+
217
+ | Symptom | Meaning | Action |
218
+ | --- | --- | --- |
219
+ | `E_ADVISORY_CONTEXT_PROVIDER_INVALID` on recall | Bad config, version mismatch, cache inside project, or malformed version output | Check absolute paths, exact version, `OPENSRC_HOME` placement |
220
+ | `E_ADVISORY_CONTEXT_PROVIDER_UNAVAILABLE` | Missing binary or spawn failure | Provision the host executable; ForgeLoop will not install it |
221
+ | `E_ADVISORY_CONTEXT_RESULT_INVALID` | Empty/multi-line/relative/outside-cache path, non-directory, or bad exit | Inspect host cache and source spec |
222
+ | `E_ADVISORY_CONTEXT_TIMEOUT` | Shared deadline expired | Retry with a larger recall `timeoutMs` within core ceilings |
223
+ | `E_ADVISORY_CONTEXT_OUTPUT_LIMIT` | 64 KiB process ceiling or item budget exceeded | Narrow sources or query |
224
+
225
+ ## Package Behavior
226
+
227
+ `src/adapters/opensrc/**`, this guide, and the integration declarations ship
228
+ in the core npm tarball. No OpenSrc binary, cache, fixture, credential, or
229
+ source snapshot ships. No new runtime dependency and no new package subpath
230
+ are added; `providerExtensions.publicRegistryApi` and
231
+ `providerExtensions.packageSubpathExported` remain false.
232
+
233
+ ## Compatibility
234
+
235
+ - Protocol v1, schema v1, Integration API v1 unchanged.
236
+ - `advisoryContextProviders` v1 and `providerExtensions` v1 unchanged; the
237
+ `ADVISORY_CONTEXT` provider kind covers this adapter.
238
+ - Requires Node.js 20+.
239
+ - Upstream behaviors referenced: `opensrc path <source> [--cwd]`,
240
+ `OPENSRC_HOME` override, fetch-on-miss, `opensrc 0.7.3` observed at
241
+ authoring time (never hardcoded into behavior).
@@ -11,12 +11,27 @@ part of the consumer tarball.
11
11
 
12
12
  The package exposes the `forgeloop` executable from `src/cli.js` and the
13
13
  `@cassiomc1/forgeloop/integration` subpath from `src/integration.js`, with its
14
- declaration file. The package has the approved exact `smol-toml` runtime
15
- dependency for bounded Cargo manifest parsing and requires Node.js 20 or
16
- newer.
14
+ declaration file. The package has the approved exact `@typesafe-ai/sdk`
15
+ dependency for the pinned semantic decision plane and `smol-toml` for bounded
16
+ Cargo manifest parsing. It requires Node.js 20 or newer.
17
17
 
18
18
  ## Included files
19
19
 
20
+ The public package includes the Jev decision-plane documentation and bounded
21
+ diagnostic scripts:
22
+
23
+ - `docs/JEV_BENCHMARKS.md`
24
+ - `docs/MODEL_ROUTING.md`
25
+ - `docs/SEMANTIC_DECISION_PLANE.md`
26
+ - `docs/TEST_INTELLIGENCE.md`
27
+ - `docs/TEST_PRUNING.md`
28
+ - `scripts/jev-smoke.mjs`
29
+ - `scripts/benchmark-jev.mjs`
30
+ - `scripts/benchmark-test-intelligence.mjs`
31
+ - `schemas/context-plan.schema.json`
32
+ - `schemas/semantic-decision.schema.json`
33
+ - `schemas/test-utility.schema.json`
34
+
20
35
  The published tarball includes the following consumer-facing groups:
21
36
 
22
37
  - **Runtime and protocol:** every maintained JavaScript module under `src/`,
@@ -53,8 +68,17 @@ The published tarball includes the following consumer-facing groups:
53
68
  Repository Index, Persistent Search Transport, troubleshooting, release,
54
69
  package-boundary, and related reference pages, together with the
55
70
  machine-readable documentation and protocol indexes and `CONTRIBUTING.md`.
56
- The advisory-context and Ripwire adapter guides ship with the corresponding
57
- public integration surface.
71
+ The advisory-context, Ripwire, OpenSrc, Agent Browser, and Audit UX guides ship with
72
+ the corresponding public integration surface.
73
+ Provider architecture, provider reference, and Security Review provider
74
+ documentation are also packaged.
75
+ The generated portable ForgeLoop Agent Skill and `docs/AGENT_SKILL.md` are
76
+ packaged as instruction/documentation content, not runtime authority.
77
+ Provider implementation modules ship under `src/`, but packaged source file
78
+ does not mean a supported public import path; the generic `./providers`
79
+ subpath remains unexported.
80
+ The lifecycle recovery surface includes the explicit `task-abandon` command;
81
+ it releases validated claims without asserting completion or publication.
58
82
  The typed diagram sources, generated HTML/SVG/receipt artifacts, and
59
83
  source-bound review records under `docs/diagrams/` are included together so
60
84
  the packaged documentation keeps its visual provenance.
@@ -67,6 +91,8 @@ The published tarball includes the following consumer-facing groups:
67
91
  The tarball intentionally omits repository-only material:
68
92
 
69
93
  - tests, conformance fixtures, coverage output, and secret-scanning helpers;
94
+ Harness-specific Agent Skill installation directories and Skill caches are
95
+ not packaged.
70
96
  - local `.forgeloop` state, task ledgers, locks, transactions, and execution
71
97
  receipts (the `.forgeloop/forgeloop.gitignore` template is the sole
72
98
  exception);
@@ -77,9 +103,10 @@ The tarball intentionally omits repository-only material:
77
103
  the consumer adapter surface;
78
104
  - historical release plans and retired MCP adapter sources; the MCP adapter
79
105
  is published as its own package;
80
- - the repository README hero PNG, which is a GitHub-only asset. The packaged
81
- README remains intentionally text-first around that relative repository
82
- image reference.
106
+ - the repository-only README hero assets
107
+ `docs/assets/forgeloop-architecture.svg` and
108
+ `docs/assets/forgeloop-lifecycle-animated.svg`. They are referenced by the
109
+ repository README and are intentionally outside the core tarball.
83
110
  - the execution PoC, its audit, and its evidence package. Packaged README and
84
111
  index links to this repository-only material use GitHub URLs so they remain
85
112
  truthful for npm consumers.
@@ -0,0 +1,126 @@
1
+ # Provider Extension Reference
2
+
3
+ ## Status
4
+
5
+ `providerExtensions` v1 is provider-neutral and experimental. This reference
6
+ describes the architecture vocabulary and maintainer expectations. It does
7
+ not document a supported import from `@cassiomc1/forgeloop/providers`.
8
+
9
+ ## Capability Discovery
10
+
11
+ Run `node src/cli.js protocol-info --json` and inspect
12
+ `features.providerExtensions`. The advertised capability includes the version,
13
+ provider kinds, strict result boundary, cooperative cancellation, and explicit
14
+ authority restrictions.
15
+
16
+ ## Provider Kinds
17
+
18
+ - `ADVISORY_CONTEXT`: optional context, never executable or canonical.
19
+ - `VERIFICATION_EXECUTION`: bounded execution observations, never completion truth.
20
+ - `BROWSER_VERIFICATION`: browser observations with no canonical vendor.
21
+ - `SECURITY_REVIEW`: bounded security observations pending any future explicit gate.
22
+ - `PRESENTATION`: read-only rendering that cannot mutate protocol state.
23
+
24
+ The canonical list is exported internally as `PROVIDER_KINDS`; public metadata
25
+ is synchronized from that source and must not duplicate its strings.
26
+
27
+ Concrete `ADVISORY_CONTEXT` adapters (Ripwire, OpenSrc) plug into the
28
+ dedicated advisory-context Integration API (`createForgeLoopContext` with
29
+ `advisoryContextProviders`, plus `recallAdvisoryContext`); they are not part
30
+ of the generic internal provider registry described here.
31
+
32
+ Browser verification is registered only through the runtime context option
33
+ `browserVerificationProviders` and is invoked explicitly with
34
+ `runBrowserVerification`. Registration is lazy and inert: it does not launch a
35
+ browser, perform network I/O, or mutate protocol state. Its provider-neutral
36
+ input includes task/target/requirement binding, a shared abort signal, and the
37
+ remaining timeout. ForgeLoop validates redirects and derives overall status;
38
+ provider output is observation only and cannot satisfy evidence or completion.
39
+
40
+ The optional `agent-browser` adapter is registered through the same boundary
41
+ with `createAgentBrowserVerificationProvider({ executablePath, expectedVersion })`.
42
+ The executable is host-owned and absolute; no package dependency or automatic
43
+ installation is added. The adapter returns browser observations only.
44
+
45
+ The optional `vercel-labs/emulate` adapter is host-injected through
46
+ `createEmulatedServicesProvider({ executablePath, expectedVersion })`. The
47
+ host must provide an absolute regular executable and explicitly choose the
48
+ services and loopback port range. ForgeLoop does not install the tool, search
49
+ `PATH`, invoke a shell, persist service state in the target project, or treat
50
+ service output as lifecycle, evidence, installation, or completion authority.
51
+ The supported host tool is pinned to `0.11.2`; invocation is lazy and inert
52
+ until `provider.start(...)` is called. Each bounded operation verifies the
53
+ qualified version, starts with argv-only execution, observes loopback
54
+ readiness, returns a detached observation, and cleans up its temporary state
55
+ and child process.
56
+
57
+ Security review is registered through `securityReviewProviders` and invoked
58
+ explicitly with `runSecurityReview`. Registration is lazy and inert. The
59
+ request accepts bounded scope, relative paths, categories, requirements, and a
60
+ revision binding; factory resolution and review share one deadline and abort
61
+ signal. Results are strict immutable observations with bounded findings and
62
+ summary counts. They cannot establish evidence, lifecycle, completion,
63
+ ownership, claims, commands, installation, or transaction authority. See
64
+ [`SECURITY_REVIEW.md`](./SECURITY_REVIEW.md) for the complete contract.
65
+
66
+ ## Common Contract
67
+
68
+ Providers are identified by an ID and kind, may resolve lazily, and receive a
69
+ bounded invocation context. Results are detached, deeply frozen strict JSON
70
+ snapshots. A provider may return an observation, never lifecycle state,
71
+ completion truth, canonical evidence, executable instructions, or installation
72
+ authority.
73
+
74
+ ## Invocation Context
75
+
76
+ The context includes a shared `AbortSignal`, the provider ID, and the remaining
77
+ timeout budget. Factories and operations consume the same deadline. Providers
78
+ must observe abort and clean up owned resources.
79
+
80
+ ## Limits
81
+
82
+ Invocation uses one shared timeout budget. Input and output are bounded by byte,
83
+ depth, and node limits. Synchronous JavaScript cannot be preempted; resource
84
+ owners remain responsible for cooperative cleanup after abort.
85
+
86
+ ## Error Codes
87
+
88
+ Malformed providers, unavailable providers, timeouts, invalid snapshots,
89
+ payload limits, authority escalation, and execution failures use the internal
90
+ provider error vocabulary. Provider exceptions are normalized so a provider
91
+ cannot spoof a ForgeLoop error code.
92
+
93
+ ## Trust Rules
94
+
95
+ Treat provider output as untrusted input. Pass it through ForgeLoop-owned
96
+ validation before any evidence or consumer use. Do not execute provider text,
97
+ interpret it as a next action, or treat provider identity as a trust grant.
98
+
99
+ ## Maturity
100
+
101
+ The public capability vocabulary is versioned at v1 but remains experimental.
102
+ The generic registry implementation is internal and experimental. No provider
103
+ is auto-installed or discovered by the lifecycle, and no provider CLI exists.
104
+
105
+ ## Internal vs Public Surfaces
106
+
107
+ The public surfaces are the protocol-info capability and these documentation
108
+ pages. The JavaScript registry under `src/providers/` ships as implementation
109
+ source but is not a supported package subpath or public registration contract.
110
+
111
+ ## Future Adapter Structure
112
+
113
+ An adapter proposal must specify its provider kind, bounded input/output,
114
+ timeout and cancellation behavior, error mapping, authority restrictions,
115
+ ForgeLoop validation boundary, tests, and documentation owner. Dedicated
116
+ Integration API capabilities remain separate from this generic vocabulary.
117
+
118
+ ## Testing Checklist
119
+
120
+ - Capability metadata is synchronized with `PROVIDER_KINDS`.
121
+ - Every provider kind denies lifecycle, completion, and evidence authority.
122
+ - Strict JSON rejects accessors, proxies, custom objects, cycles, and oversized payloads.
123
+ - Shared timeout and cooperative cancellation are tested.
124
+ - Provider exceptions cannot spoof ForgeLoop error codes.
125
+ - `protocol-info --json` advertises v1 without claiming a public registry API.
126
+ - The package does not export `./providers`.
@@ -0,0 +1,199 @@
1
+ # Provider Extension Architecture
2
+
3
+ ## Status
4
+
5
+ Provider extensions are a provider-neutral, experimental capability family in
6
+ Protocol v1. The capability vocabulary is public and versioned; the generic
7
+ provider registry is internal and is not a supported package API.
8
+
9
+ ## Scope
10
+
11
+ This document explains the common boundary around provider observations. It
12
+ does not add generic provider registration to `createForgeLoopContext()`; the
13
+ dedicated runtime-only `browserVerificationProviders` and
14
+ `securityReviewProviders` registrations are the exceptions documented by
15
+ their dedicated contracts. They do not add CLI
16
+ provider commands, automatic installation, lifecycle authority, or completion
17
+ authority.
18
+
19
+ ## Why ForgeLoop Uses Providers
20
+
21
+ Providers allow a host to connect bounded observations or execution services to
22
+ ForgeLoop without making a vendor, model, browser, scanner, or presentation
23
+ tool canonical. A provider result is an input to ForgeLoop-owned validation,
24
+ not a replacement for it.
25
+
26
+ ## Provider-Neutral Design
27
+
28
+ The public `providerExtensions` capability advertises architecture and
29
+ compatibility semantics only. It is provider-neutral, experimental, lazy at
30
+ the host boundary, and deliberately separate from the existing dedicated
31
+ `advisoryContextProviders` Integration API capability.
32
+
33
+ The generic registry is currently an internal implementation module. It is
34
+ not exported as `@cassiomc1/forgeloop/providers`, and capability advertising
35
+ does not imply a public registration or installation API.
36
+
37
+ ## Provider Kinds
38
+
39
+ The five kinds are derived from the canonical `PROVIDER_KINDS` source:
40
+
41
+ | Kind | Contract |
42
+ | --- | --- |
43
+ | `ADVISORY_CONTEXT` | Optional, non-authoritative context. It is never canonical state, evidence, completion authority, or executable instruction. |
44
+ | `VERIFICATION_EXECUTION` | A bounded execution boundary that may produce observations, but never completion truth. |
45
+ | `BROWSER_VERIFICATION` | Browser-driven observation and assertion collection. No vendor is canonical. |
46
+ | `SECURITY_REVIEW` | Bounded security findings, observation-oriented unless a future explicit gate contract exists. |
47
+ | `PRESENTATION` | Read-only presentation or rendering. It must never mutate protocol state. |
48
+
49
+ Every kind denies lifecycle, completion, and evidence authority. Providers do
50
+ not acquire installation authority.
51
+
52
+ ### Presentation vocabulary and Audit UX
53
+
54
+ `PRESENTATION` remains a provider-kind vocabulary slot for future bounded
55
+ renderers; it does not require a concrete provider in the completed roadmap.
56
+ The current Audit UX need is already served by `task/audit-view`, a canonical
57
+ read-only Integration API projection composed from ForgeLoop-owned resolvers.
58
+ Audit UX is not a provider, does not register through the provider boundary,
59
+ and cannot mutate protocol state, establish evidence, release claims, or
60
+ authorize completion.
61
+
62
+ ## Invocation Lifecycle
63
+
64
+ ```text
65
+ HOST
66
+ │
67
+ ▼
68
+ provider selection
69
+ │
70
+ ▼
71
+ registry lookup
72
+ │
73
+ ▼
74
+ lazy factory resolution
75
+ │
76
+ ▼
77
+ provider validation
78
+ │
79
+ ▼
80
+ bounded invocation
81
+ │
82
+ ▼
83
+ strict JSON normalization
84
+ │
85
+ ▼
86
+ authority validation
87
+ │
88
+ ▼
89
+ immutable observation
90
+ │
91
+ ▼
92
+ ForgeLoop consumer
93
+ ```
94
+
95
+ The result boundary is:
96
+
97
+ ```text
98
+ provider result
99
+ ↓
100
+ normalized observation
101
+ ↓
102
+ ForgeLoop-owned validation
103
+ ↓
104
+ optional canonical evidence/use
105
+ ```
106
+
107
+ A provider must never bypass ForgeLoop-owned validation.
108
+
109
+ Browser verification is an explicit Integration API operation, not a generic
110
+ provider command. Its registry is inert during context construction, its
111
+ factory and verify call share one deadline and cooperative `AbortSignal`, and
112
+ its final status is derived by ForgeLoop from the requested assertion results.
113
+ The origin allowlist validates observations but is not a network sandbox.
114
+
115
+ Security review is likewise an explicit Integration API operation through
116
+ `runSecurityReview`. Its host-injected registry is inert during context
117
+ construction. Requests and results are bounded strict snapshots, and provider
118
+ findings remain observation-only, non-evidence, and non-executable.
119
+
120
+ ## Trust Boundary
121
+
122
+ Provider output is untrusted input. It cannot establish lifecycle state,
123
+ completion truth, canonical evidence, next-action authority, or installation
124
+ authority. Provider identity and availability are descriptive and must not be
125
+ treated as proof of executable identity or trust.
126
+
127
+ ## Strict JSON Snapshot Boundary
128
+
129
+ Provider input and output use detached, deeply frozen snapshots. Allowed values
130
+ are `null`, booleans, finite numbers, strings, arrays, and plain objects.
131
+
132
+ The boundary rejects `undefined`, functions, symbols, bigints, non-finite
133
+ numbers, dates, maps, sets, promises, proxies, custom classes, accessors,
134
+ cycles, sparse or extended arrays, and hidden non-enumerable payload data.
135
+ Provider payloads are bounded by byte, depth, and node limits.
136
+
137
+ ## Timeout and Cancellation
138
+
139
+ Factory resolution and operation execution share one timeout budget and one
140
+ invocation context. The `AbortSignal` is propagated and cancellation is
141
+ cooperative. A late factory resolution cannot start an operation after the
142
+ deadline. Synchronous JavaScript cannot be preempted by a timer, so providers
143
+ that own subprocesses, browsers, requests, or sockets must clean them up when
144
+ the signal is aborted.
145
+
146
+ ## Error Normalization
147
+
148
+ Provider exceptions are normalized to ForgeLoop provider execution failures;
149
+ provider-supplied ForgeLoop-shaped error codes are not trusted. Validation and
150
+ timeout failures are generated outside the provider call boundary.
151
+
152
+ ## Authority Restrictions
153
+
154
+ The following public capability fields remain false: `autoInstall`,
155
+ `lifecycleAuthority`, `completionAuthority`, and `evidenceAuthority`.
156
+ Providers observe. ForgeLoop validates, owns lifecycle transitions, and decides
157
+ whether an observation can contribute to canonical evidence.
158
+
159
+ ## Evidence Conversion Boundary
160
+
161
+ An observation can become usable evidence only through the relevant
162
+ ForgeLoop-owned validation and evidence contract. Provider output is never
163
+ itself a completion claim or canonical evidence record.
164
+
165
+ ## Internal vs Public Surfaces
166
+
167
+ Public and versioned:
168
+
169
+ - `protocol-info --json` and `features.providerExtensions`.
170
+ - This architecture document and [`PROVIDERS.md`](./PROVIDERS.md).
171
+
172
+ Internal and experimental:
173
+
174
+ - `src/providers/index.js` and the generic registry implementation.
175
+ - Provider capability implementation details not included in the public
176
+ Integration API contract.
177
+
178
+ `@cassiomc1/forgeloop/providers` remains unexported.
179
+
180
+ ## Compatibility
181
+
182
+ Protocol version, Schema version, and Integration API version remain `1`.
183
+ `providerExtensions` is capability version `1`; consumers must feature-detect
184
+ it and may continue using the core protocol when they do not understand it.
185
+
186
+ ## Future Provider Adapters
187
+
188
+ Future adapters may implement a provider kind only after a provider-neutral
189
+ contract defines its input, output, resource bounds, trust treatment, and
190
+ ForgeLoop-owned validation boundary. Vendor-specific adapters remain optional
191
+ and must not become a competing source of protocol truth.
192
+
193
+ ## Security Considerations
194
+
195
+ Provider output can be malicious, oversized, mutable, delayed, or misleading.
196
+ Strict JSON snapshots, bounded invocation, cooperative cancellation, error
197
+ normalization, recursive authority checks, and no automatic installation keep
198
+ the boundary fail-closed. See [`THREAT_MODEL.md`](../THREAT_MODEL.md) for the
199
+ security ownership table.
package/docs/RECIPES.md CHANGED
@@ -353,6 +353,10 @@ forgeloop baseline --record --policy-reset-authorized --json
353
353
  # 1. Inspect deterministic classification and structured next action
354
354
  forgeloop next --task task-001 --json
355
355
 
356
+ # 1a. If the active task is intentionally no longer valid, explicitly abandon
357
+ # it; do not use clear-state or task-recover to bypass ownership
358
+ forgeloop task-abandon --task task-001 --acknowledge-abandonment --json
359
+
356
360
  # 2. RECOVERABLE must use reconcile-closure; do not use task-recover
357
361
  forgeloop reconcile-closure --task task-001 --id <verification-id> \
358
362
  --requirement "<exact verification text>" -- <verification-command>
@@ -378,6 +382,11 @@ artifact against the complete ledger history. If `next` returns
378
382
  `RESOLVE_RECOVERY_INCONSISTENCY`, run `validate-protocol`; do not create, edit,
379
383
  or delete `recovery.json` manually.
380
384
 
385
+ `task-abandon` is only for an explicit active non-terminal abandonment. It
386
+ records `TASK_ABANDONED`, leaves the phase unchanged, and releases claims as
387
+ `RELEASED_BY_RECOVERY`; it never proves completion. `clear-state` removes only
388
+ the checkpoint and is not a claim-release mechanism.
389
+
381
390
  ---
382
391
 
383
392
  ### Recipe 16 — Execute a Durable External Action Safely