@zhivex-ai/harness 1.3.0-rc.3 → 1.3.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 (157) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +12 -10
  3. package/SECURITY.md +1 -1
  4. package/SUPPORT.md +4 -4
  5. package/contracts/engine-api.json +334 -0
  6. package/contracts/public-api.json +267 -1
  7. package/contracts/stable-api-signatures.json +43 -43
  8. package/dist/acp-cli.js +54 -18
  9. package/dist/approvals/approval-history.d.ts +22 -0
  10. package/dist/approvals/explicit-review.d.ts +24 -0
  11. package/dist/approvals/host-policy-identity.d.ts +3 -0
  12. package/dist/cli/arguments.d.ts +6 -2
  13. package/dist/cli/checkpoints.d.ts +230 -0
  14. package/dist/cli/cli-profiles.d.ts +4 -2
  15. package/dist/cli/governance-report.d.ts +5 -0
  16. package/dist/cli/policy-decisions.d.ts +9 -0
  17. package/dist/cli/policy.d.ts +5 -0
  18. package/dist/cli/presentation.d.ts +3 -1
  19. package/dist/cli/terminal/terminal-ui.d.ts +4 -0
  20. package/dist/{cli-entry-xmf48p6a.js → cli-entry-1gfg3brj.js} +14921 -10692
  21. package/dist/cli-entry-bx3vjw7h.js +656 -0
  22. package/dist/{index-fvca1xea.js → cli-entry-d5788aay.js} +339 -58
  23. package/dist/{cli-qgwvtk0w.js → cli-etsmtst3.js} +918 -2222
  24. package/dist/cli.js +3 -5
  25. package/dist/client/acp-mcp-admission.d.ts +32 -0
  26. package/dist/client/acp-mcp-host.d.ts +19 -0
  27. package/dist/client/acp-mcp-session.d.ts +14 -0
  28. package/dist/client/acp-stdio.d.ts +2 -0
  29. package/dist/client/acp.d.ts +4 -1
  30. package/dist/client/adapter.d.ts +13 -1
  31. package/dist/client/json-contracts.d.ts +107 -4
  32. package/dist/client/local-service.d.ts +2 -0
  33. package/dist/client/protocol.d.ts +127 -1
  34. package/dist/client/service-events.d.ts +4 -0
  35. package/dist/compat/cli-options.d.ts +13 -1
  36. package/dist/compat/code-support.js +23 -87
  37. package/dist/{config-q32jm1e6.js → config-c002f06f.js} +1 -1
  38. package/dist/{config-6gtpxvjv.js → config-j3jga5wh.js} +3 -1
  39. package/dist/context/adaptive-compaction.d.ts +1 -0
  40. package/dist/context/compaction.d.ts +1 -1
  41. package/dist/context/request-measurements.d.ts +17 -0
  42. package/dist/context/request-projection.d.ts +10 -0
  43. package/dist/context/task-memory.d.ts +1 -0
  44. package/dist/engine/acp.d.ts +2 -0
  45. package/dist/engine/acp.js +197 -1
  46. package/dist/engine/client.js +11 -4
  47. package/dist/engine/desktop-providers-v1.d.ts +4 -0
  48. package/dist/engine/desktop-providers-v1.js +18 -0
  49. package/dist/engine/desktop-state-v1.d.ts +10 -0
  50. package/dist/engine/desktop-state-v1.js +168 -0
  51. package/dist/engine/index.d.ts +12 -0
  52. package/dist/engine/index.js +571 -71
  53. package/dist/engine/mcp-stdio-v1.d.ts +11 -0
  54. package/dist/engine/mcp-stdio-v1.js +108 -0
  55. package/dist/engine/models.d.ts +3 -0
  56. package/dist/engine/models.js +894 -0
  57. package/dist/engine/protocol.d.ts +1 -0
  58. package/dist/engine/protocol.js +24 -0
  59. package/dist/engine/service.js +12 -5
  60. package/dist/execution/acceptance-snapshot.d.ts +2 -0
  61. package/dist/execution/execution-environment.d.ts +10 -0
  62. package/dist/execution/mcp-oci-channel.d.ts +11 -0
  63. package/dist/execution/mcp-oci-server.d.ts +38 -0
  64. package/dist/execution/mcp-oci-workspace.d.ts +23 -0
  65. package/dist/execution/mcp-resource-recovery.d.ts +19 -0
  66. package/dist/execution/mcp-workspace-snapshot.d.ts +20 -0
  67. package/dist/hostile-repository-demo.js +3169 -1163
  68. package/dist/{index-f4sb0e2q.js → index-2jrdcj6b.js} +17 -2
  69. package/dist/{index-77h9qr5h.js → index-3ah1f369.js} +40 -10
  70. package/dist/{index-pgqz45fj.js → index-42gp2hy8.js} +197 -1091
  71. package/dist/{index-41fkzt91.js → index-4jw3tvy8.js} +10 -2
  72. package/dist/index-6m08wvab.js +1768 -0
  73. package/dist/index-8705zxpr.js +145 -0
  74. package/dist/{index-d0wrghff.js → index-8vm2m34s.js} +225 -1416
  75. package/dist/index-8zzhggxv.js +477 -0
  76. package/dist/index-a97bezbz.js +1073 -0
  77. package/dist/index-azmwjp95.js +1004 -0
  78. package/dist/{cli-entry-0mmeag20.js → index-gq9xagx2.js} +122 -836
  79. package/dist/index-h0mqx2ed.js +1373 -0
  80. package/dist/index-hnaxfpb5.js +5589 -0
  81. package/dist/{index-2aymdsqc.js → index-qfpz5y2v.js} +24 -0
  82. package/dist/{index-kfgt9yqq.js → index-w2sj0wkw.js} +33 -10
  83. package/dist/index-wg1sd3at.js +80 -0
  84. package/dist/index-xqxeypt5.js +888 -0
  85. package/dist/index-yb239ghk.js +961 -0
  86. package/dist/index-z0qxmkm2.js +3389 -0
  87. package/dist/index.js +85 -72
  88. package/dist/integrations/mcp-host-session.d.ts +26 -0
  89. package/dist/integrations/mcp-stdio-admission.d.ts +54 -0
  90. package/dist/integrations/mcp-stdio-client.d.ts +44 -0
  91. package/dist/integrations/mcp-stdio-framing.d.ts +18 -0
  92. package/dist/integrations/mcp-stdio-launch.d.ts +20 -0
  93. package/dist/integrations/mcp-stdio-session.d.ts +7 -0
  94. package/dist/integrations/mcp-stdio-tools.d.ts +12 -0
  95. package/dist/internal/desktop/catalog.d.ts +2 -0
  96. package/dist/internal/desktop/persistence.d.ts +2 -3
  97. package/dist/internal/desktop/providers.d.ts +1 -0
  98. package/dist/models/catalog.d.ts +2 -0
  99. package/dist/persistence/governance-context.d.ts +126 -0
  100. package/dist/persistence/governance-report.d.ts +299 -0
  101. package/dist/persistence/host-database-backup.d.ts +28 -0
  102. package/dist/persistence/mcp-execution-journal.d.ts +19 -0
  103. package/dist/persistence/mcp-reconciliation.d.ts +33 -0
  104. package/dist/persistence/mcp-resource-journal.d.ts +54 -0
  105. package/dist/persistence/workspace-checkpoints.d.ts +138 -0
  106. package/dist/providers/anthropic-continuation.d.ts +5 -0
  107. package/dist/providers/providers.d.ts +1 -1
  108. package/dist/providers/vertex-auth.d.ts +27 -0
  109. package/dist/runtime/delegation-contracts.d.ts +9 -0
  110. package/dist/runtime/delegation-correction.d.ts +9 -0
  111. package/dist/runtime/delegation-result.d.ts +73 -0
  112. package/dist/runtime/error-diagnostics.d.ts +86 -0
  113. package/dist/runtime/harness.d.ts +11 -1
  114. package/dist/runtime/policy-decisions.d.ts +66 -0
  115. package/dist/runtime/policy-inspection.d.ts +52 -0
  116. package/dist/runtime/provider-diagnostics.d.ts +1 -0
  117. package/dist/runtime/runtime-instructions.d.ts +8 -0
  118. package/dist/runtime/task-acceptance-checks.d.ts +103 -0
  119. package/dist/runtime/task-acceptance-delivery.d.ts +107 -0
  120. package/dist/runtime/task-acceptance-host.d.ts +20 -0
  121. package/dist/runtime/task-acceptance-record.d.ts +107 -0
  122. package/dist/runtime/task-acceptance-validation.d.ts +25 -0
  123. package/dist/runtime/task-acceptance.d.ts +47 -0
  124. package/dist/runtime/time-to-safe-fix.d.ts +83 -0
  125. package/dist/runtime/tool-policy-file.d.ts +23 -0
  126. package/dist/runtime/tool-policy-paths.d.ts +5 -0
  127. package/dist/runtime/tool-policy.d.ts +6 -0
  128. package/dist/service-cli.js +14 -7
  129. package/dist/{service-client-cli-gs78wrxe.js → service-client-cli-3365rfav.js} +307 -248
  130. package/dist/verify-historical-migrations.js +3134 -1129
  131. package/dist/workspace/path-policy.d.ts +4 -0
  132. package/dist/zhx.js +3 -5
  133. package/docs/ACP.md +14 -2
  134. package/docs/ANTHROPIC.md +33 -0
  135. package/docs/CLI.md +132 -0
  136. package/docs/CLIENT_PROTOCOL.md +45 -0
  137. package/docs/CODE_RELEASE.md +35 -18
  138. package/docs/ENGINE_API.md +216 -7
  139. package/docs/EXTENSIBILITY.md +46 -3
  140. package/docs/FIRST_USE.md +6 -6
  141. package/docs/LOCAL_SERVICE.md +13 -0
  142. package/docs/MCP_STDIO.md +20 -0
  143. package/docs/README.md +1 -0
  144. package/docs/STABILITY.md +4 -2
  145. package/docs/SUPPORT_MATRIX.md +1 -1
  146. package/docs/TOOL_POLICY.md +81 -0
  147. package/docs/VERTEX.md +50 -0
  148. package/docs/adr/0002-isolated-mcp-stdio.md +135 -0
  149. package/docs/fixtures/mcp-stdio-contract-v1.json +189 -0
  150. package/docs/support-matrix.json +2 -0
  151. package/evaluations/representative-assembly-matrix.json +46 -1
  152. package/evaluations/task-acceptance-routes.json +7 -0
  153. package/examples/README.md +3 -3
  154. package/package.json +43 -12
  155. package/dist/cli-entry-64pdp3k5.js +0 -17
  156. package/dist/cli-entry-7h9savv5.js +0 -375
  157. package/dist/index-5wjwe91x.js +0 -9434
@@ -1,8 +1,8 @@
1
1
  # Engine API and Code integration
2
2
 
3
3
  This checkout adds terminal-independent package entrypoints for
4
- Harness 1.3.0-rc.3. They are not present in the previously published Harness 1.2.0.
5
- Publication is pending the protected workflow; use the documented
4
+ Harness 1.3.0 (prepared for `latest`). They are not present in the previously published Harness 1.2.0.
5
+ Stable publication is pending the protected workflow; use the documented
6
6
  local candidate smoke to validate these bytes. Do not install registry 1.2.0 and
7
7
  expect the new entrypoints to exist.
8
8
 
@@ -16,6 +16,9 @@ expect the new entrypoints to exist.
16
16
  | `@zhivex-ai/harness/service` | Authenticated local service, recovery and activity events | Node |
17
17
  | `@zhivex-ai/harness/acp` | Experimental text-session ACP adapter and stream transport | Node |
18
18
  | `@zhivex-ai/harness/code-support` | Named host helpers used by Code, including a read-only SQLite diagnostic projection | Node |
19
+ | `@zhivex-ai/harness/models` | Beta catalog schemas, bundled metadata, model selection and display helpers; no host loading | Browser or Node |
20
+ | `@zhivex-ai/harness/mcp/stdio/v1` | Experimental host admission, isolated MCP sessions, recovery and reconciliation; see [host flow](MCP_STDIO.md) | Node or Bun |
21
+ | `@zhivex-ai/harness/desktop/v1/state` | Versioned host-only snapshot, validation, safe-file-read and lease handoff operations for Desktop updates | Node |
19
22
 
20
23
  [`contracts/engine-api.json`](../contracts/engine-api.json) enumerates every named
21
24
  export and its stability tier. Existing aliases keep their root tier. New helpers
@@ -29,6 +32,15 @@ prompt for credentials. Hosts explicitly construct and close the runtime, supply
29
32
  credentials/model instances, resolve approvals and choose their storage policy.
30
33
  Importing the engine does not itself execute a task or grant permissions.
31
34
 
35
+ The beta `/models` subpath was introduced after RC3 for HAR-HU-39 and is
36
+ published in RC7. Stable 1.3.0 retains its beta tier; previous RC3 bytes do not
37
+ contain it. Its six runtime exports and two types are listed
38
+ in `contracts/engine-api.json`. It performs no file access, credential resolution,
39
+ provider requests or process startup. Remote catalog loading remains host-owned.
40
+ Installed-package smoke compiles the public subpath for a browser and checks its
41
+ exports and type declarations in a clean consumer. Desktop migration and packaged
42
+ app acceptance are recorded separately in the repository-only report `docs/reports/HAR_HU_39_2026-09-29.md`.
43
+
32
44
  ```ts
33
45
  import { createHarness } from "@zhivex-ai/harness/engine";
34
46
  import { createHarnessClientAdapter } from "@zhivex-ai/harness/client";
@@ -56,8 +68,8 @@ switching presentation does not migrate state or authorize new effects.
56
68
  ## Terminal product
57
69
 
58
70
  `packages/code` is the independently built terminal product. Its current version
59
- is `0.1.0-rc.1`, prepared for independent publication to `next` with the exact
60
- engine dependency `@zhivex-ai/harness@1.3.0-rc.3`. Publication remains gated by
71
+ is `0.1.0`, prepared for independent publication to `latest` with the exact
72
+ engine dependency `@zhivex-ai/harness@1.3.0`. Publication remains gated by
61
73
  reviewed main, CI and registry evidence in the [Code release procedure](CODE_RELEASE.md).
62
74
  Code imports declared package APIs, never Harness source paths. Its build leaves
63
75
  Harness external.
@@ -66,8 +78,9 @@ Code owns `zhivex-code`. Harness 1.x continues to own `zhx`, `zhivex-harness` an
66
78
  `zhx-acp`, preserving commands, flags, exit codes, JSON contracts and state paths.
67
79
  The Code version/help identify the terminal product; engine diagnostics continue
68
80
  to identify Harness. The historical CLI stays a Harness compatibility snapshot,
69
- without a Harness dependency on Code. Desktop keeps its existing internal bridge
70
- until HAR-HU-39 migrates it separately.
81
+ without a Harness dependency on Code. Desktop now consumes installed engine,
82
+ protocol, service, models and versioned host contracts; it does not import the
83
+ old internal source bridges.
71
84
 
72
85
  Node >=22.13.0 is the runtime requirement. Bun builds and tests the source but is
73
86
  not required to install or run the JavaScript tarballs. Consumer projects retain
@@ -75,6 +88,36 @@ their own package manager and lockfile.
75
88
 
76
89
  ## Contributor validation
77
90
 
91
+ The local candidate also adds `/desktop/v1/state`, an explicitly versioned
92
+ integration contract for trusted Desktop main/worker processes. New names are
93
+ experimental; aliases of historical names retain their existing tiers. Exact
94
+ exports are recorded in `contracts/engine-api.json`. This is not a general SQL
95
+ interface: `SqliteDatabase`, arbitrary queries and migrations are not exported.
96
+
97
+ `createHostDatabaseSnapshot`, `verifyHostDatabaseSnapshot` and
98
+ `verifyHostDatabaseState` own whole-database checks, WAL snapshots and receipt
99
+ validation. Desktop remains responsible for closing admission, stopping workers,
100
+ coordinating multiple projects, and verifying the application before restoration.
101
+ Snapshot callers supply host-controlled paths. Existing `DESKTOP_*` error codes
102
+ are preserved. The 128 MiB limit, private permissions, no-follow reads, all-scope
103
+ idle checks and logical backup validation are unchanged.
104
+
105
+ The additional file-read/path validators serve updater artifact verification and
106
+ do not authorize writes. `SqliteAccessLease` and its acquire/adopt/descriptor
107
+ operations retain the macOS cooperative lock protocol. Inherited lease adoption
108
+ requires the trusted native handoff helper; it is never a renderer IPC operation.
109
+ Different copies of the package must not exchange lease objects. Installed smoke
110
+ verifies that engine and state entrypoints in one installation share ownership.
111
+ Compatibility with older clients that do not participate in this locking
112
+ protocol is not implied.
113
+
114
+ The new subpaths were introduced after RC3 and are published in RC7. Stable
115
+ 1.3.0 retains their declared tiers.
116
+ Desktop migration and packaged acceptance are documented in
117
+ the repository-only report `docs/reports/HAR_HU_39_2026-09-29.md`. Its dependency is pinned to the
118
+ exact prepared engine version and checked for required contracts/artifact identity; this does
119
+ not claim compatibility with the earlier published RC3 bytes or a broader range.
120
+
78
121
  ```sh
79
122
  bun run dev:code
80
123
  bun run typecheck:code
@@ -89,7 +132,12 @@ release workflow supplies the exact tarball via `HARNESS_CODE_HARNESS_ARTIFACT`;
89
132
  its bytes are copied, never repacked. The report identifies hashes, installed
90
133
  versions and observed results. Node execution uses a restricted PATH excluding
91
134
  Bun. Local fixtures exercise approval, persistence and restart, Code execution
92
- and cancellation without live keys. This is deterministic installed evidence,
135
+ and cancellation without live keys. Each manager has independent Harness-first
136
+ and Code-first consumers. Every installation step exercises the manager-created
137
+ launchers; final checks reject overlapping binary ownership, a reverse Code
138
+ dependency and unresolved local/workspace dependency references. Tarball overrides
139
+ use consistent relative paths to preserve Yarn Classic launchers across installs.
140
+ This is deterministic installed evidence,
93
141
  not provider certification or a registry release. Historical HU37/38 reports
94
142
  used temporary 1.3.0-dev.0 metadata; those reports do not certify RC1.
95
143
 
@@ -99,6 +147,57 @@ Installed acceptance uses tarballs instead of that link. The CI workflow defines
99
147
  the same four-manager check on Node 22.13.0 and Node 24; a workflow definition is
100
148
  not evidence that remote CI has run.
101
149
 
150
+ For a historical version boundary, run
151
+ `bun run smoke:state-upgrade /absolute/old-harness.tgz /absolute/candidate-harness.tgz incompatible`.
152
+ This installs both supplied artifacts in separate consumers and creates a pending
153
+ approval with the historical root API. The candidate must explain its incompatible
154
+ Harness identity without model calls, file effects or changes to the pending run.
155
+ The historical runtime must then complete that run with explicit approval. Artifact
156
+ hashes and observed versions are retained in the report. This test does not rewrite
157
+ fingerprints, certify an automatic migration or verify registry provenance.
158
+ Use `compatible` instead to require an unchanged binding and candidate completion
159
+ after explicit approval. Both modes preserve historical session metadata across
160
+ candidate and historical reopen. Distinct tarball bytes are required, and the
161
+ caller chooses the expected outcome before execution; a rejected compatible case
162
+ is a failure, not silently reclassified as success.
163
+ Set `HARNESS_COMPAT_RUNTIME=/absolute/path/to/node` to select the runtime for
164
+ both installed consumers; set it to `bun` to verify Bun runtime separately from
165
+ Bun package installation. Reports record the selected executable and observed
166
+ runtime version. The installer remains Bun regardless of the selected runtime.
167
+
168
+ `bun run smoke:global-code /absolute/harness.tgz /absolute/code.tgz` tests both
169
+ global installation orders with Bun in separate temporary global and binary
170
+ directories. It checks the manager-created launchers after each install, exact
171
+ resolved engine bytes, and deterministic CLI execution with Node and no Bun in
172
+ runtime PATH. These prefixed installs do not modify the operator's global tools.
173
+ Global locations use Bun's documented `BUN_INSTALL_GLOBAL_DIR` and
174
+ `BUN_INSTALL_BIN` controls (see [Bun configuration](https://bun.com/docs/runtime/bunfig)).
175
+ The default mode certifies Bun global installation; local manager coverage remains a
176
+ separate matrix and neither test establishes registry publication or provenance.
177
+ An optional third argument supplies a historical Harness tarball. Each temporary
178
+ prefix first installs it and verifies legacy help/version, then tests both orders
179
+ of candidate Harness and Code installation. Legacy launchers are checked after
180
+ every step, including when Code is installed before upgrading Harness. The
181
+ candidate override is explicit; this is local artifact acceptance, not evidence
182
+ of registry dependency resolution or a historical Code release.
183
+ `HARNESS_GLOBAL_MANAGER=npm` selects isolated npm global prefixes. This mode
184
+ retains the exact-engine assertion and records failures per order. npm global
185
+ may resolve Code's pinned Harness from the registry instead of reusing a locally
186
+ installed tarball with the same version; such a result does not certify the local
187
+ candidate. Reports retain both orders and exit nonzero if either fails.
188
+ Set `HARNESS_GLOBAL_REGISTRY_FIXTURE=1` for npm candidate acceptance: a read-only
189
+ loopback registry child serves the supplied Harness tarball unchanged, including
190
+ its SHA-512 integrity, and redirects other package requests to the public registry.
191
+ The child closes after the smoke. Reports label this `loopback-exact-candidate`,
192
+ distinct from default registry resolution; passing it does not erase a failed
193
+ default-registry attempt or certify publication/provenance.
194
+ Global acceptance also supports `HARNESS_GLOBAL_MANAGER=pnpm` (11.x) and `yarn`
195
+ (Classic 1.x), with `SMOKE_PNPM_PATH`/`SMOKE_YARN_PATH` selecting the executables.
196
+ Both use isolated package/bin directories and explicit temporary registry config.
197
+ pnpm's separate global installation roots are inspected individually. Shell
198
+ utilities needed by generated launchers remain available; Bun is absent from the
199
+ runtime PATH. These modes should use the exact-candidate registry fixture.
200
+
102
201
  The architecture gate follows transitive imports, re-exports and type references
103
202
  from the engine surfaces, rejecting CLI/Desktop/Code dependencies and computed
104
203
  module loads. Code has separate checks for public-package imports and manifest/bin
@@ -109,3 +208,113 @@ Publishing Code requires a compatible Harness release, authenticated scope/name
109
208
  verification and the release compatibility gates in
110
209
  [ADR 0001](https://github.com/Zhivex/zhivex-harness/blob/main/docs/adr/0001-harness-code-public-boundary.md).
111
210
  Local packing does not establish npm permissions or public availability.
211
+ ## Experimental task acceptance contracts
212
+
213
+ `runHarness(host, input, { taskAcceptance })` accepts application-owned requirements
214
+ for a new run. The strict `taskAcceptanceContractSchema` is exported from `/engine`.
215
+ It binds exact file paths, required check argv/backend/approval policy, and human
216
+ review requirements that remain `pending`. It does not introduce arbitrary shell
217
+ scripts or grant tool permissions. `compileTaskAcceptanceContract` provides the
218
+ canonical digest; compilation alone does not validate the workspace or authorize
219
+ execution. Runtime admission additionally validates the real workspace and host.
220
+
221
+ ```ts
222
+ import {
223
+ taskAcceptanceContractSchema, runHarness,
224
+ inspectHarnessTaskAcceptance, reviseHarnessTaskAcceptance
225
+ } from '@zhivex-ai/harness/engine';
226
+
227
+ const contract = taskAcceptanceContractSchema.parse({
228
+ schemaVersion: 1,
229
+ taskId: 'repair-parser',
230
+ allowedWritePaths: ['src/parser.ts', 'tests/parser.test.ts'],
231
+ protectedFiles: ['package.json'],
232
+ requiredChecks: [{
233
+ id: 'test', kind: 'package-script', script: 'test', expectedScript: 'bun test',
234
+ command: 'bun', args: ['--no-env-file', 'run', 'test'], purpose: 'Parser regression',
235
+ execution: { backend: 'none', approval: 'required' }
236
+ }],
237
+ humanReview: [{ id: 'readability', requirement: 'Review readability', status: 'pending' }]
238
+ });
239
+ const result = await runHarness(host, { prompt: 'Repair the parser' }, { taskAcceptance: contract });
240
+ const ledger = await inspectHarnessTaskAcceptance(host, result.state.runId);
241
+ // After an operator approves changed requirements, while the run is stopped:
242
+ const state = await host.store.load(result.state.runId, host.config.scope);
243
+ await reviseHarnessTaskAcceptance(host, {
244
+ runId: result.state.runId,
245
+ expectedRunRevision: state!.revision!,
246
+ expectedContractRevision: ledger!.revisions.at(-1)!.revision,
247
+ contract: { ...contract, humanReview: [{ id: 'readability', requirement: 'Review revised behavior', status: 'pending' }] }
248
+ });
249
+ ```
250
+
251
+ The package example requires a Bun-declared manifest with the exact `test` script,
252
+ an allowlisted `test` check, and a `run_check` tool. OCI argv checks use
253
+ `kind: 'argv'` and `execution: { backend: 'oci', approval: 'required', network: 'none' }`;
254
+ their executable must be in the host allowlist. File paths are exact, not globs.
255
+ Contracts are limited to 64 KiB and 32 checks. Revision history is bounded to
256
+ 16 revisions/1 MiB; capacity errors never silently discard prior requirements.
257
+
258
+ Inspection reads the host's durable store. Revision uses both run and contract
259
+ revisions for compare-and-swap, rejects active runs, and invalidates acceptance
260
+ evidence. Reload the state before resuming after a revision. Contract metadata
261
+ cannot be supplied through run input; the optional third argument is the trusted
262
+ application boundary. Runs with contracts use the host's configured scope.
263
+ Resumes use the stored contract, and `read_task` exposes its current revision even
264
+ after compaction. Existing runs without a contract keep their previous behavior.
265
+
266
+ For OCI execution, imports enforce the exact allowed paths and protected files,
267
+ then require every declared check to succeed against the same contract revision,
268
+ run, environment, patch and complete snapshot bytes. Altering a package script
269
+ or changing the snapshot invalidates verification. Recovery reconciles check
270
+ receipts against the durable tool journal; ambiguous or interrupted effects are
271
+ not replayed automatically.
272
+
273
+ The host-owned `zhivexTaskAcceptanceEvidenceV1` metadata adds acceptance outcomes
274
+ without changing SDK run statuses or `ChangeEnvelope` v1. Active work is `pending`;
275
+ terminal work without sufficient delivery evidence is `incomplete`; failed runs
276
+ or scope violations are `failed`. A completed run with a normal stop becomes
277
+ `verified` only after a confirmed import and a final inspection of delivered host
278
+ files and snapshot bytes. Required human review produces `pending_review` instead.
279
+ Model prose cannot supply this evidence. The `none` backend does not receive OCI
280
+ acceptance guarantees. Recovered import metadata is diagnostic evidence only until
281
+ its delivery can be confirmed; it cannot alone restore a verified outcome.
282
+
283
+ ### Portable governance projection (Experimental)
284
+
285
+ `exportHarnessGovernanceReport(store, scope, runId, options?)` reads durable runs
286
+ and journals into `HarnessGovernanceReport`. Validate portable JSON with
287
+ `harnessGovernanceReportSchema`; `renderHarnessGovernanceMarkdown(report)` renders
288
+ its bounded summary. `options.changeEnvelopes` accepts up to 32 existing v1
289
+ objects; `options.now` fixes the verification timestamp for reproducible exports.
290
+ Neither patch bytes nor producer authenticity are certified by an envelope digest.
291
+
292
+ Optional `options.session` is `{ id, index, history? }`: `index.get` and
293
+ `history.replay` must already be bound to the same workspace/scope as the run
294
+ store. The root must belong to the selected session. No current application policy
295
+ is substituted for missing historical evidence. Recorded child acceptance remains
296
+ separate from semantic review; exporting does not rerun child validation or tools.
297
+ See the CLI portable report documentation for redaction, retention and limits.
298
+
299
+ ## Request context and measurements
300
+
301
+ The default engine advertises a smaller common tool catalog. `discover_tools`
302
+ loads additional authorized schemas on demand; it does not change executors,
303
+ permissions, approval requirements or execution boundaries. Applications that
304
+ supply `toolNames` without `discover_tools` retain a fully advertised explicit
305
+ catalog. An explicit `toolChoice` keeps that authorized tool advertised.
306
+
307
+ Large successful check, search, dependency and diff results can appear as bounded
308
+ excerpts with a `resultId`. `read_tool_result` retrieves 4,000-character slices of
309
+ the original evidence from the current durable run. Originals remain unchanged;
310
+ unknown references and references from another run are rejected. If no durable
311
+ source exists, the engine sends the original result instead of an unreadable
312
+ reference. A partial excerpt is not proof that an omitted error or match does
313
+ not exist. Mutation receipts and tool failures remain intact.
314
+
315
+ The optional `runHarness(..., { onDiagnostics })` callback includes
316
+ `requestMeasurements`: numeric context sizes, estimated input tokens, reported
317
+ input/output/cache tokens and terminal completion for the current invocation.
318
+ It retains at most 128 requests plus an omitted count and contains no prompt or
319
+ result text. Missing usage is null, including an interrupted paid request; these
320
+ measurements do not claim invoice accuracy or provider tokenizer equivalence.
@@ -8,7 +8,7 @@ Built-in registrations are Meta, Qwen, OpenAI, and Gemini. Each registration own
8
8
 
9
9
  Library callers can use `DEFAULT_PROVIDER_REGISTRY`, `BUILTIN_PROVIDER_REGISTRATIONS`, `createProviderRegistry`, or `DEFAULT_PROVIDER_REGISTRY.extend(...)`, then pass the registry to `resolveHarnessConfig`, `createProviderModel`, provider diagnostics, or `createHarness({ providerRegistry })`. Registration IDs, environment-variable names, defaults, diagnostics, and factories are validated before they become selectable.
10
10
 
11
- The coordinated stable SDK batch pins `@zhivex-ai/agents@1.10.1`, `@zhivex-ai/core@1.26.0`, `@zhivex-ai/meta@0.2.8`, `@zhivex-ai/qwen@0.16.2`, `@zhivex-ai/openai@0.13.6`, and `@zhivex-ai/gemini@0.12.3`. Qwen 0.16.2 types malformed Responses tool arguments and malformed SSE events; Core 1.26.0 satisfies its published dependency range. These exact versions are pinned in the lockfile. Stable SDK publication does not replace Harness release-bound certification. Qwen `0.11.x` normalizes missing, placeholder, and continuation tool-call identifiers inside the adapter; Harness retains its deterministic provider-boundary normalizer as defense in depth until the exact candidate passes the complete release-bound representative matrix. A Core override keeps one runtime contract identity across every adapter, while Core `1.13.0` corrects compaction usage accounting and interaction-group retention. OpenAI `0.11.2` preserves synthetic assistant history in Responses, so the harness no longer requires its compaction transport or accounting workarounds.
11
+ The coordinated stable SDK batch pins `@zhivex-ai/agents@1.10.2`, `@zhivex-ai/core@1.28.0`, `@zhivex-ai/meta@0.2.8`, `@zhivex-ai/qwen@0.16.3`, `@zhivex-ai/openai@0.13.7`, and `@zhivex-ai/gemini@0.13.0`. Qwen 0.16.2 types malformed Responses tool arguments and malformed SSE events; Core 1.28.0 satisfies its published dependency range. These exact versions are pinned in the lockfile. Stable SDK publication does not replace Harness release-bound certification. Qwen `0.11.x` normalizes missing, placeholder, and continuation tool-call identifiers inside the adapter; Harness retains its deterministic provider-boundary normalizer as defense in depth until the exact candidate passes the complete release-bound representative matrix. A Core override keeps one runtime contract identity across every adapter, while Core `1.13.0` corrects compaction usage accounting and interaction-group retention. OpenAI `0.11.2` preserves synthetic assistant history in Responses, so the harness no longer requires its compaction transport or accounting workarounds.
12
12
 
13
13
  OpenAI is based on the GPT-5.6 family: `gpt-5.6-luna` is the default, with `gpt-5.6-terra` and `gpt-5.6-sol` available through `--model`. Availability remains organization-dependent while the upstream family is in limited preview, and the adapter uses the Responses API by default.
14
14
 
@@ -75,7 +75,7 @@ The schema is versioned independently:
75
75
 
76
76
  Every server requires a non-empty tool or exact-resource allowlist and permission set. Tool discovery is paginated and bounded. Tool names are prefixed with `<server>_` unless an explicit safe prefix is supplied. Configuration contains environment-variable names rather than credential values; diagnostics and fingerprints never include resolved header values. Credential variables must use the dedicated `ZHIVEX_MCP_*` namespace, and HTTP authentication is limited to the canonical `authorization` and `x-api-key` headers so a workspace file cannot select unrelated process credentials or arbitrary outbound headers.
77
77
 
78
- The legacy built-in transport supports HTTPS and loopback HTTP; the opt-in SDK transport requires HTTPS. Redirects, URL credentials, unsafe configurable headers, oversized configuration, symlinked configuration, and configuration outside the workspace are rejected. `stdio` is intentionally unavailable because spawning an MCP server is process execution; it remains deferred until the enforced execution environment in `0.6.x`.
78
+ The legacy built-in transport supports HTTPS and loopback HTTP; the opt-in SDK transport requires HTTPS. Redirects, URL credentials, unsafe configurable headers, oversized configuration, symlinked configuration, and configuration outside the workspace are rejected. `stdio` is intentionally unavailable because spawning an MCP server is process execution; the proposed admission and isolated-stream contract is documented in [ADR 0002](adr/0002-isolated-mcp-stdio.md). This design does not enable the transport.
79
79
 
80
80
  Library callers can inject a custom `McpClient`. Trusted read-only annotations are accepted only for an explicitly injected custom transport whose sole declared permission is `read`. HTTP always declares `network` and therefore always pauses for operator approval, even when a server claims a tool is read-only.
81
81
 
@@ -175,9 +175,52 @@ child must perform a successful allowed read and return `requiredOutput`; the pa
175
175
  without completed, accepted children for all configured contracts. The token
176
176
  checks a protocol condition, not the semantic correctness of the review.
177
177
 
178
+ An opt-in experimental `resultContract` replaces marker acceptance with versioned
179
+ JSON evidence for reviewer/explorer contracts:
180
+
181
+ ```ts
182
+ resultContract: {
183
+ schemaVersion: 1,
184
+ requiredReadPaths: ["target.txt"],
185
+ humanReviewRequired: true,
186
+ maxCorrections: 0
187
+ }
188
+ ```
189
+
190
+ Required paths must be a subset of `allowedReadPaths`. The result contains
191
+ `schemaVersion`, `taskId`, `status`, `inspectedFiles` and `findings`. Each inspected
192
+ file declares its digest and evidence entries with `toolCallId`, `startLine` and
193
+ `endLine`; findings reference those successful reads by path and call ID. Required
194
+ files need complete line coverage from receipts with the same digest. Clipped
195
+ lines, gaps, invented IDs, tool errors and invalid JSON cannot satisfy the
196
+ contract. Results are bounded to 64 KiB, 32 files and 32 findings.
197
+
198
+ The parent independently validates the durable child state and records
199
+ `zhivexDelegationAcceptanceV1` evaluations containing child status, contract
200
+ acceptance and semantic review status separately. An accepted schema and evidence
201
+ coverage never certify the semantic correctness of findings. This option adds no
202
+ write tools or arbitrary delegation authority.
203
+
204
+ `maxCorrections` allows zero to two feedback attempts for invalid structured
205
+ results. Each attempt remains in the same child run and consumes ordinary SDK
206
+ steps, tokens and an internal feedback tool call; existing limits can stop it
207
+ earlier. The model still sees only `read_file`. Invalid candidates remain in the
208
+ durable history as data, and exhausted attempts fail acceptance. No tool or path
209
+ permission is broadened for a correction.
210
+
211
+ Installed deterministic acceptance is available with
212
+ `bun run scripts/delegation-result-installed-smoke.ts <tarball> <node-path>`.
213
+ The shared HU44 cohort covers fabricated evidence, incomplete reads, tool errors,
214
+ invalid results, bounded correction, cancellation and durable reopen. It does not
215
+ certify a provider route. For the separate live orchestration gate, set
216
+ `ZHIVEX_HARNESS_LIVE_STRUCTURED_DELEGATION=1` alongside the normal live opt-in and
217
+ installed-artifact runtime settings. That mode checks structured acceptance and
218
+ pending semantic review before and after reopening; legacy marker certification
219
+ remains the default. Missing credentials or failed calls are not successful gates.
220
+
178
221
  Contracts are copied at construction and bound into parent/child fingerprints;
179
222
  resuming under a different contract is rejected. This mode retains SDK child
180
- linkage, usage, cancellation and persistence. It does not retry invalid proposals
223
+ linkage, usage, cancellation and persistence. Legacy marker contracts do not retry invalid proposals
181
224
  or increase a budget automatically. Callers without contracts keep the existing
182
225
  general-purpose delegation API, including approval-gated mutation profiles; the
183
226
  contract guarantees do not apply to that legacy mode. CLI configuration does not
package/docs/FIRST_USE.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # First use
2
2
 
3
- This guide targets the prepared `1.3.0-rc.3` candidate. Installation commands become available after protected publication to npm `next`; stable users can keep npm `latest`.
3
+ This guide targets the prepared stable `1.3.0` release. These exact-version commands become available after protected publication to npm `latest`; currently latest resolves to 1.2.0.
4
4
 
5
5
  ## Install and start
6
6
 
7
7
  Install Node.js 22.13.0 or newer and Git. Then:
8
8
 
9
9
  ```sh
10
- npm install -g @zhivex-ai/harness@1.3.0-rc.3
10
+ npm install -g @zhivex-ai/harness@1.3.0
11
11
  cd /path/to/your/project
12
12
  zhx
13
13
  ```
@@ -82,16 +82,16 @@ For command execution, configure [OCI isolation](EXECUTION_ENVIRONMENTS.md).
82
82
  With Bun 1.4.0 or newer and a supported Node runtime:
83
83
 
84
84
  ```sh
85
- bun add --global @zhivex-ai/harness@1.3.0-rc.3
85
+ bun add --global @zhivex-ai/harness@1.3.0
86
86
  zhx
87
87
  ```
88
88
 
89
89
  For a disposable version/help/environment check without a global installation:
90
90
 
91
91
  ```sh
92
- bunx @zhivex-ai/harness@1.3.0-rc.3 --version
93
- bunx @zhivex-ai/harness@1.3.0-rc.3 --help
94
- bunx @zhivex-ai/harness@1.3.0-rc.3 doctor
92
+ bunx @zhivex-ai/harness@1.3.0 --version
93
+ bunx @zhivex-ai/harness@1.3.0 --help
94
+ bunx @zhivex-ai/harness@1.3.0 doctor
95
95
  ```
96
96
 
97
97
  For source development, use the [contributor guide](https://github.com/Zhivex/zhivex-harness/blob/main/CONTRIBUTING.md).
@@ -140,3 +140,16 @@ busy timeout for its ownership transaction. Contention fails immediately rather
140
140
  than blocking the event loop while another recovery awaits filesystem I/O.
141
141
  `OpenSessionStoreOptions.busyTimeoutMs` accepts 0–5000 ms and preserves the prior
142
142
  5000 ms default for other callers. The additive signature snapshot is reviewed.
143
+
144
+ Policy-enabled hosts append sanitized `policy-decision` activity through the same
145
+ session event channel. These records describe policy evaluation before entering
146
+ the tool executor, including rule IDs, reason, approval/review requirements, digest
147
+ and backend. They are not execution receipts and cannot authorize an action.
148
+ Reasons are bounded and carry `reasonTruncated` when shortened. Replay pages expose
149
+ `hasMore`; `policyEvidenceIncomplete` remains true after retention removes evidence,
150
+ even after the client adopts the recovery cursor or the service reopens its store.
151
+
152
+ The decision `phase` distinguishes `approval-request` from `tool-entry`. A pending
153
+ approval emits the former before the tool executor is entered. Baseline decisions
154
+ without an additional policy are observable too; an allow evaluation does not
155
+ bypass the tool's own permission checks or certify successful execution.
@@ -0,0 +1,20 @@
1
+ # Isolated MCP stdio for trusted hosts
2
+
3
+ `@zhivex-ai/harness/mcp/stdio/v1` is an **experimental**, Node/Bun host-only entry point. It requires a local Docker daemon and previously provisioned immutable images. It does not enable `stdio` in workspace MCP JSON or ACP configuration. Never construct host policy, authorization callbacks, secret resolvers or host identity from model output or repository instructions.
4
+
5
+ The host owns the flow:
6
+
7
+ 1. Open the canonical workspace and SQLite persistence using the root `Workspace`, `resolveHarnessConfig` and `openHarnessPersistence` APIs. Choose a scoped run ID before launching.
8
+ 2. Call `prepareMcpWorkspaceSnapshot(workspace, maxWorkspaceBytes)`. Review the snapshot digest, explicit tool allowlist, permissions, image digest, command, literal environment, secret references and limits in a `McpStdioLaunchProposal`. Host authority must constrain every resource limit.
9
+ 3. Create `createMcpStdioAdmissionAuthority({ policyVersion, maximumLimits, authorize })`. Its authorization callback receives the reviewed proposal; require your explicit operator/policy decision. `admit(proposal)` returns a short-lived, one-use receipt bound to the exact proposal.
10
+ 4. Call `launchIsolatedMcpSession` with authority, receipt, proposal, snapshot, authenticated scope, immutable provisioner image ID, host secret resolver and `journal: { store, runId, scope, hostId }`. It recovers prior dead-owner resources before launch and refuses unresolved live/foreign resources. `hostId` must be a stable identity owned by the host, not the repository.
11
+ 5. Pass the returned `hostSession` as `isolatedMcpSession` to `createHarness`, with the same store, canonical workspace and scope. Call `runHarness` with the admitted run ID. Every MCP call requires interrupt approval, including tools claiming to be read-only. Closing the harness closes the isolated session.
12
+ 6. To resume a persisted approval after closing the host, reopen SQLite, create and admit a new session with the same reviewed proposal/snapshot, recreate the harness, and resume the saved state. Proposal changes invalidate the old approval. Secret values are resolved afresh by the trusted host.
13
+
14
+ A host can use `recoverDockerMcpResources({ store, runId, scope, hostId })` on startup without starting a new server. Recovery only considers persisted names and matching scope/host/daemon/images/labels. It refuses live or inaccessible owner PIDs and confirms resource absence before recording closure. Docker administrative access remains a trusted boundary.
15
+
16
+ Timeout, cancellation or loss of an execution acknowledgement leaves an uncertain outcome and blocks further MCP calls in that run. After cleanup and external inspection, `createMcpReconciliationAuthority` lets the host authorize a decision bound to call ID, expected revision, confirmed effect/no-effect and evidence digest. The previous outcome remains in the audit record. The original call key never becomes replayable. A new call still needs a new session admission and tool approval. This API supplies policy hooks, not a human review interface.
17
+
18
+ The snapshot is private and size-bounded. It does not mount the host workspace; changes inside it do not automatically return to the host. No host fallback or outbound network is granted. JSON Schema regex/reference features outside the supported bounded subset fail discovery. The entry point deliberately omits raw launch clients, arbitrary Docker execution and host capability issuers.
19
+
20
+ See [the isolation decision](adr/0002-isolated-mcp-stdio.md) and [API stability](STABILITY.md). Local candidate verification is distinct from registry publication.
package/docs/README.md CHANGED
@@ -8,6 +8,7 @@ Start with [First use](FIRST_USE.md). You only need `zhx` for everyday conversat
8
8
  - [Worked example](FIRST_USE_EXAMPLE.md): a small change with approval and restart recovery.
9
9
  - [Usage reference](USAGE.md): scripts, providers and security boundaries.
10
10
  - [Model catalog administration](MODEL_CATALOG.md): shared CLI/Desktop recommendations and remote distribution.
11
+ - [Anthropic direct API](ANTHROPIC.md): provisional setup and continuity contract.
11
12
  - [Credentials](CREDENTIALS.md): system keychain, temporary keys and automation.
12
13
  - [Project instructions and context](CONTEXT_ENGINEERING.md).
13
14
  - [Execution environments](EXECUTION_ENVIRONMENTS.md): isolated command execution.
package/docs/STABILITY.md CHANGED
@@ -4,7 +4,7 @@ The additive [engine entrypoints](ENGINE_API.md) are enumerated in
4
4
  [`../contracts/engine-api.json`](../contracts/engine-api.json). Aliases preserve
5
5
  their existing root tiers; newly exposed helpers have explicit tiers. The root
6
6
  compatibility surface remains unchanged. These entrypoints are source changes
7
- for the planned 1.3 line, not APIs available in the registry 1.2.0 package.
7
+ for the prepared 1.3.0 release and are available in the published RC7; they are absent from registry 1.2.0. Stable package numbering does not upgrade any export tier.
8
8
 
9
9
  [`../contracts/public-api.json`](../contracts/public-api.json) is the machine-checked 1.0 baseline for the package root, binaries, CLI commands/subcommands, exit codes, and document schemas. Every runtime and type export is present in the snapshot and belongs to exactly one explicit tier. Exports listed as stable form the intended 1.x compatibility surface; Time-to-Safe-Fix exports are experimental; the explicitly listed beta exports may evolve under the policy below.
10
10
 
@@ -16,6 +16,8 @@ The schema-1 observational parsers preserve unknown additive fields and distingu
16
16
 
17
17
  Beta APIs may change in a minor with changelog and migration guidance. Experimental APIs may change without a deprecation window and must not be the sole supported route for a stable operation. Human-readable terminal text and error messages are not contracts; command identity, exit codes, structured document schemas, and `HarnessError.code/category/retryable` are.
18
18
 
19
- The semantic compactor, compaction recommendations, declarative tool policy, progress monitor, ACP text-session adapter, and workspace checkpoint restoration APIs are experimental. ACP implements the documented text-session subset; it does not claim full editor interoperability. Deterministic compaction and the existing client protocol remain available. See [ACP limitations](ACP.md), [context behavior](CONTEXT_ENGINEERING.md), and [checkpoint constraints](WORKSPACE_CHECKPOINTS.md).
19
+ The host-only `/mcp/stdio/v1` entry point and `CreateHarnessOptions.isolatedMcpSession` option are experimental additive capabilities. Workspace MCP configuration does not enable stdio; see [host admission and lifecycle](MCP_STDIO.md).
20
+
21
+ The semantic compactor, compaction recommendations, declarative tool policy (including `toolPolicyFile` and `--tool-policy`), progress monitor, ACP text-session adapter, and workspace checkpoint restoration APIs are experimental. ACP implements the documented text-session subset; it does not claim full editor interoperability. Deterministic compaction and the existing client protocol remain available. See [tool policy semantics](TOOL_POLICY.md), [ACP limitations](ACP.md), [context behavior](CONTEXT_ENGINEERING.md), and [checkpoint constraints](WORKSPACE_CHECKPOINTS.md).
20
22
 
21
23
  Before `1.0.0-rc.1`, maintainers classified every current runtime and type export as stable, beta, or experimental. The gate rejects unreviewed additions, removals, omissions, and membership in more than one tier so future stability changes remain deliberate. Root aliases remain available during 1.x; any future beta subpath must be additive until the next major release.
@@ -10,7 +10,7 @@ The machine-readable source is [`support-matrix.json`](./support-matrix.json). `
10
10
  | OCI | Docker on Linux | — | Podman | managed remote sandbox |
11
11
  | Target package manager | npm | Bun | pnpm, Yarn | — |
12
12
  | MCP | bounded Streamable HTTP | — | broader remote implementations | stdio |
13
- | Provider | Meta `muse-spark-1.2`, Qwen `qwen3.8-max`, OpenAI `gpt-5.6-luna` | — | Gemini | undocumented providers |
13
+ | Provider | Meta `muse-spark-1.2`, Qwen `qwen3.8-max`, OpenAI `gpt-5.6-luna` | — | Gemini, Anthropic, Vertex (ADC) | undocumented providers |
14
14
 
15
15
  Provider evidence is release-, account-, endpoint-, model-, and date-bound. A provider is supported for a release only when the exact candidate passes base, orchestration, routing, and model-directed execution gates. The table does not imply upstream feature parity.
16
16
 
@@ -0,0 +1,81 @@
1
+ # Trusted tool policy (experimental)
2
+
3
+ An application can pass `toolPolicyFile` to `createHarness`. The CLI accepts
4
+ `--tool-policy /absolute/private/policy.json` for run, chat, review and resume.
5
+ The local service host accepts the same flag at startup. Service clients cannot
6
+ supply it: policy belongs to the process constructing the runtime.
7
+
8
+ ```json
9
+ {
10
+ "schemaVersion": 1,
11
+ "rules": [
12
+ {
13
+ "id": "protect-private-file",
14
+ "tools": ["read_file", "read_files"],
15
+ "paths": ["private.txt"],
16
+ "decision": "deny",
17
+ "reason": "This file is outside the task scope"
18
+ }
19
+ ]
20
+ }
21
+ ```
22
+
23
+ Choose the file explicitly outside the workspace and its containing repository.
24
+ The loader does not read policy instructions from AGENTS.md, skills, model output,
25
+ environment variables or client requests. It requires a regular file owned by the
26
+ current user, private permissions such as `0600`, one hard link, no symlink in the
27
+ path, valid UTF-8, a strict schema and at most 128 KiB. Unknown fields, versions
28
+ and unavailable tool names are errors. Never place secrets in rule reasons.
29
+
30
+ Rules use exact tool and workspace-relative file names, without wildcards.
31
+ The strongest matching decision wins: deny, then ask_user, then allow. Allow
32
+ does not grant filesystem permissions or remove an existing approval. ask_user
33
+ uses the current approval mechanism, including its configured automatic mode;
34
+ it does not independently require a human. Human-only review is separate work.
35
+
36
+ Built-in file resolvers cover read_file, read_files, propose_edits, apply_patch,
37
+ apply_reviewed_edits, apply_reviewed_replacement, move_file and quarantine_file.
38
+ Move rules inspect both endpoints; multi-file tools inspect every target.
39
+ Path-scoped rules for other tools fail at construction because shell commands,
40
+ directory queries and opaque restore IDs do not enumerate exact affected files.
41
+ Use a tool-wide rule when appropriate. A rule on one named tool does not restrict
42
+ other tools that could access the same data; this is an additional control, not
43
+ a replacement for the workspace permission boundary or sandbox.
44
+
45
+ File policies use `builtin-exact-files-v1`. Existing application-supplied policy
46
+ objects retain their explicit custom resolver interface; do not combine that
47
+ interface with toolPolicyFile. The policy and resolver version affect the durable
48
+ runtime fingerprint inherited by children. An already-open runtime keeps its
49
+ compiled policy when the file changes. Restart to load a change; incompatible
50
+ durable runs must not be resumed under the replacement policy. CLI resume requires
51
+ the operator to supply the policy again; the saved run does not authorize reading
52
+ an arbitrary policy path.
53
+
54
+ This capability remains experimental and has no effect when omitted. Local test
55
+ results and installed-package acceptance are tracked separately in the HU52 report.
56
+
57
+ HU53 adds an experimental opt-in `explicitReview: { "schemaVersion": 1 }` at
58
+ the policy root. It requires host-issued review evidence for all positive approval
59
+ resolutions and affects the policy digest. It does not add approval requirements
60
+ to otherwise unrestricted tools. Automatic resolution cannot satisfy it. Client
61
+ channels without compatible review evidence receive EXPLICIT_REVIEW_REQUIRED and
62
+ leave the operation pending. The local CLI in ask mode displays a complete bounded
63
+ payload and issues host evidence after explicit confirmation, without cached session
64
+ grants. With this policy, `resume --approve` also requires interactive review;
65
+ noninteractive invocation remains pending. Desktop accepts the operator-owned
66
+ policy through its `--tool-policy` startup argument. Its main process consumes a
67
+ bounded, expiring review ticket and sends the exact decision to the runtime through
68
+ their private process channel. The renderer cannot issue review evidence, and the
69
+ public HTTP command endpoint cannot use this private channel. Ordinary service
70
+ clients must leave positive approvals pending under this policy.
71
+ Local review evidence is not corporate identity and does not protect against a
72
+ compromised host process.
73
+
74
+ Approval history records the decision origin before effects: interactive for a
75
+ local answer, automatic for automatic modes or reused session grants, application
76
+ for ordinary API/protocol decisions, and unknown for historical records without
77
+ provenance. Each row includes its channel and the host policy digest when present.
78
+ Origin describes how the decision entered the host; an interactive label alone
79
+ is not evidence of the complete review required by explicitReview. Without that
80
+ option, recording provenance does not impose its five-minute review deadline.
81
+ An incompatible runtime fingerprint is rejected before recording approval intent.
package/docs/VERTEX.md ADDED
@@ -0,0 +1,50 @@
1
+ # Google Cloud Vertex AI (provisional)
2
+
3
+ Vertex is a separate provider (`vertex`), using Google Cloud Application Default
4
+ Credentials (ADC). A Gemini API key does not configure this route. The bundled
5
+ `gemini-3.7-flash` selection is unverified; its pinned SDK requires `global`.
6
+ Use a model enabled for your project and location. No live certification,
7
+ pricing or context limits are inferred from the Gemini direct API.
8
+
9
+ ## Configuration
10
+
11
+ Configure ADC on the host using your organization's Google Cloud workflow.
12
+ Local application-default credentials, an explicit ADC credential file, and
13
+ attached cloud identities are resolved by `google-auth-library`. Tokens are
14
+ cached and renewed by that library, not stored in Harness sessions or Keychain.
15
+
16
+ Set `GOOGLE_CLOUD_PROJECT` and `VERTEX_LOCATION` explicitly in the launching
17
+ environment. Set `GOOGLE_APPLICATION_CREDENTIALS` to an ADC file if required by
18
+ your deployment. Otherwise the host's standard ADC discovery applies. Harness
19
+ does not edit credential files or run a login flow. Static `VERTEX_ACCESS_TOKEN`,
20
+ `GOOGLE_ACCESS_TOKEN`, `VERTEX_API_KEY` and `GOOGLE_API_KEY` do not override ADC.
21
+ Custom Vertex endpoints are not supported by this integration.
22
+
23
+ Select `vertex` through the CLI provider selector or `--provider vertex`, then
24
+ choose your model. The CLI credentials screen explains ADC instead of asking for
25
+ an API key. In Desktop, launch the app with the same environment and select
26
+ Google Cloud Vertex AI in the model selector. The credentials screen checks
27
+ route configuration and can request an ADC token; it does not store/delete ADC.
28
+ Restart Desktop after changing its project or location.
29
+
30
+ Configuration presence is not an authentication or model-access check. ADC
31
+ renewal and generation can still fail due to expired grants, missing credentials,
32
+ IAM, model/region availability, quota or service errors. The ADC button only
33
+ checks token acquisition; it does not certify model access or issue generation.
34
+
35
+ ## Durable execution and diagnostics
36
+
37
+ Project, location and the explicit ADC-file path are hashed into the durable
38
+ transport binding. A changed route cannot approve a run created on another route.
39
+ Token renewal does not change the binding. Account changes behind the same ADC
40
+ file remain governed by Google Cloud IAM; Harness does not fingerprint tokens.
41
+ Unconfigured Vertex does not change existing provider transport bindings.
42
+
43
+ Errors expose bounded categories for authentication, permission, unavailable
44
+ model/route, rate limit and server failures. Raw Google payloads, token values,
45
+ credential paths and service-account identities are not retained in errors.
46
+
47
+ The integration pins `@zhivex-ai/vertex@1.1.2` with Core 1.26.0 and
48
+ `google-auth-library@11.0.2`. Deterministic tests exercise the installed SDK's
49
+ transport, streaming, signed continuation, approval/reopen and route mismatch.
50
+ They are not evidence of a live project, renewable ADC or IAM authorization.