@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.
- package/CHANGELOG.md +53 -0
- package/README.md +12 -10
- package/SECURITY.md +1 -1
- package/SUPPORT.md +4 -4
- package/contracts/engine-api.json +334 -0
- package/contracts/public-api.json +267 -1
- package/contracts/stable-api-signatures.json +43 -43
- package/dist/acp-cli.js +54 -18
- package/dist/approvals/approval-history.d.ts +22 -0
- package/dist/approvals/explicit-review.d.ts +24 -0
- package/dist/approvals/host-policy-identity.d.ts +3 -0
- package/dist/cli/arguments.d.ts +6 -2
- package/dist/cli/checkpoints.d.ts +230 -0
- package/dist/cli/cli-profiles.d.ts +4 -2
- package/dist/cli/governance-report.d.ts +5 -0
- package/dist/cli/policy-decisions.d.ts +9 -0
- package/dist/cli/policy.d.ts +5 -0
- package/dist/cli/presentation.d.ts +3 -1
- package/dist/cli/terminal/terminal-ui.d.ts +4 -0
- package/dist/{cli-entry-xmf48p6a.js → cli-entry-1gfg3brj.js} +14921 -10692
- package/dist/cli-entry-bx3vjw7h.js +656 -0
- package/dist/{index-fvca1xea.js → cli-entry-d5788aay.js} +339 -58
- package/dist/{cli-qgwvtk0w.js → cli-etsmtst3.js} +918 -2222
- package/dist/cli.js +3 -5
- package/dist/client/acp-mcp-admission.d.ts +32 -0
- package/dist/client/acp-mcp-host.d.ts +19 -0
- package/dist/client/acp-mcp-session.d.ts +14 -0
- package/dist/client/acp-stdio.d.ts +2 -0
- package/dist/client/acp.d.ts +4 -1
- package/dist/client/adapter.d.ts +13 -1
- package/dist/client/json-contracts.d.ts +107 -4
- package/dist/client/local-service.d.ts +2 -0
- package/dist/client/protocol.d.ts +127 -1
- package/dist/client/service-events.d.ts +4 -0
- package/dist/compat/cli-options.d.ts +13 -1
- package/dist/compat/code-support.js +23 -87
- package/dist/{config-q32jm1e6.js → config-c002f06f.js} +1 -1
- package/dist/{config-6gtpxvjv.js → config-j3jga5wh.js} +3 -1
- package/dist/context/adaptive-compaction.d.ts +1 -0
- package/dist/context/compaction.d.ts +1 -1
- package/dist/context/request-measurements.d.ts +17 -0
- package/dist/context/request-projection.d.ts +10 -0
- package/dist/context/task-memory.d.ts +1 -0
- package/dist/engine/acp.d.ts +2 -0
- package/dist/engine/acp.js +197 -1
- package/dist/engine/client.js +11 -4
- package/dist/engine/desktop-providers-v1.d.ts +4 -0
- package/dist/engine/desktop-providers-v1.js +18 -0
- package/dist/engine/desktop-state-v1.d.ts +10 -0
- package/dist/engine/desktop-state-v1.js +168 -0
- package/dist/engine/index.d.ts +12 -0
- package/dist/engine/index.js +571 -71
- package/dist/engine/mcp-stdio-v1.d.ts +11 -0
- package/dist/engine/mcp-stdio-v1.js +108 -0
- package/dist/engine/models.d.ts +3 -0
- package/dist/engine/models.js +894 -0
- package/dist/engine/protocol.d.ts +1 -0
- package/dist/engine/protocol.js +24 -0
- package/dist/engine/service.js +12 -5
- package/dist/execution/acceptance-snapshot.d.ts +2 -0
- package/dist/execution/execution-environment.d.ts +10 -0
- package/dist/execution/mcp-oci-channel.d.ts +11 -0
- package/dist/execution/mcp-oci-server.d.ts +38 -0
- package/dist/execution/mcp-oci-workspace.d.ts +23 -0
- package/dist/execution/mcp-resource-recovery.d.ts +19 -0
- package/dist/execution/mcp-workspace-snapshot.d.ts +20 -0
- package/dist/hostile-repository-demo.js +3169 -1163
- package/dist/{index-f4sb0e2q.js → index-2jrdcj6b.js} +17 -2
- package/dist/{index-77h9qr5h.js → index-3ah1f369.js} +40 -10
- package/dist/{index-pgqz45fj.js → index-42gp2hy8.js} +197 -1091
- package/dist/{index-41fkzt91.js → index-4jw3tvy8.js} +10 -2
- package/dist/index-6m08wvab.js +1768 -0
- package/dist/index-8705zxpr.js +145 -0
- package/dist/{index-d0wrghff.js → index-8vm2m34s.js} +225 -1416
- package/dist/index-8zzhggxv.js +477 -0
- package/dist/index-a97bezbz.js +1073 -0
- package/dist/index-azmwjp95.js +1004 -0
- package/dist/{cli-entry-0mmeag20.js → index-gq9xagx2.js} +122 -836
- package/dist/index-h0mqx2ed.js +1373 -0
- package/dist/index-hnaxfpb5.js +5589 -0
- package/dist/{index-2aymdsqc.js → index-qfpz5y2v.js} +24 -0
- package/dist/{index-kfgt9yqq.js → index-w2sj0wkw.js} +33 -10
- package/dist/index-wg1sd3at.js +80 -0
- package/dist/index-xqxeypt5.js +888 -0
- package/dist/index-yb239ghk.js +961 -0
- package/dist/index-z0qxmkm2.js +3389 -0
- package/dist/index.js +85 -72
- package/dist/integrations/mcp-host-session.d.ts +26 -0
- package/dist/integrations/mcp-stdio-admission.d.ts +54 -0
- package/dist/integrations/mcp-stdio-client.d.ts +44 -0
- package/dist/integrations/mcp-stdio-framing.d.ts +18 -0
- package/dist/integrations/mcp-stdio-launch.d.ts +20 -0
- package/dist/integrations/mcp-stdio-session.d.ts +7 -0
- package/dist/integrations/mcp-stdio-tools.d.ts +12 -0
- package/dist/internal/desktop/catalog.d.ts +2 -0
- package/dist/internal/desktop/persistence.d.ts +2 -3
- package/dist/internal/desktop/providers.d.ts +1 -0
- package/dist/models/catalog.d.ts +2 -0
- package/dist/persistence/governance-context.d.ts +126 -0
- package/dist/persistence/governance-report.d.ts +299 -0
- package/dist/persistence/host-database-backup.d.ts +28 -0
- package/dist/persistence/mcp-execution-journal.d.ts +19 -0
- package/dist/persistence/mcp-reconciliation.d.ts +33 -0
- package/dist/persistence/mcp-resource-journal.d.ts +54 -0
- package/dist/persistence/workspace-checkpoints.d.ts +138 -0
- package/dist/providers/anthropic-continuation.d.ts +5 -0
- package/dist/providers/providers.d.ts +1 -1
- package/dist/providers/vertex-auth.d.ts +27 -0
- package/dist/runtime/delegation-contracts.d.ts +9 -0
- package/dist/runtime/delegation-correction.d.ts +9 -0
- package/dist/runtime/delegation-result.d.ts +73 -0
- package/dist/runtime/error-diagnostics.d.ts +86 -0
- package/dist/runtime/harness.d.ts +11 -1
- package/dist/runtime/policy-decisions.d.ts +66 -0
- package/dist/runtime/policy-inspection.d.ts +52 -0
- package/dist/runtime/provider-diagnostics.d.ts +1 -0
- package/dist/runtime/runtime-instructions.d.ts +8 -0
- package/dist/runtime/task-acceptance-checks.d.ts +103 -0
- package/dist/runtime/task-acceptance-delivery.d.ts +107 -0
- package/dist/runtime/task-acceptance-host.d.ts +20 -0
- package/dist/runtime/task-acceptance-record.d.ts +107 -0
- package/dist/runtime/task-acceptance-validation.d.ts +25 -0
- package/dist/runtime/task-acceptance.d.ts +47 -0
- package/dist/runtime/time-to-safe-fix.d.ts +83 -0
- package/dist/runtime/tool-policy-file.d.ts +23 -0
- package/dist/runtime/tool-policy-paths.d.ts +5 -0
- package/dist/runtime/tool-policy.d.ts +6 -0
- package/dist/service-cli.js +14 -7
- package/dist/{service-client-cli-gs78wrxe.js → service-client-cli-3365rfav.js} +307 -248
- package/dist/verify-historical-migrations.js +3134 -1129
- package/dist/workspace/path-policy.d.ts +4 -0
- package/dist/zhx.js +3 -5
- package/docs/ACP.md +14 -2
- package/docs/ANTHROPIC.md +33 -0
- package/docs/CLI.md +132 -0
- package/docs/CLIENT_PROTOCOL.md +45 -0
- package/docs/CODE_RELEASE.md +35 -18
- package/docs/ENGINE_API.md +216 -7
- package/docs/EXTENSIBILITY.md +46 -3
- package/docs/FIRST_USE.md +6 -6
- package/docs/LOCAL_SERVICE.md +13 -0
- package/docs/MCP_STDIO.md +20 -0
- package/docs/README.md +1 -0
- package/docs/STABILITY.md +4 -2
- package/docs/SUPPORT_MATRIX.md +1 -1
- package/docs/TOOL_POLICY.md +81 -0
- package/docs/VERTEX.md +50 -0
- package/docs/adr/0002-isolated-mcp-stdio.md +135 -0
- package/docs/fixtures/mcp-stdio-contract-v1.json +189 -0
- package/docs/support-matrix.json +2 -0
- package/evaluations/representative-assembly-matrix.json +46 -1
- package/evaluations/task-acceptance-routes.json +7 -0
- package/examples/README.md +3 -3
- package/package.json +43 -12
- package/dist/cli-entry-64pdp3k5.js +0 -17
- package/dist/cli-entry-7h9savv5.js +0 -375
- package/dist/index-5wjwe91x.js +0 -9434
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_PROVIDER_REGISTRY,
|
|
3
3
|
HARNESS_SUBAGENT_PROFILES
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-gq9xagx2.js";
|
|
5
5
|
|
|
6
6
|
// src/providers/routing.ts
|
|
7
7
|
var routeError = (value) => new Error(`Invalid route: ${value}. Use <profile>=<provider>[:<model>].`);
|
|
@@ -159,6 +159,7 @@ var CLI_OPTION_NAMES = [
|
|
|
159
159
|
"--help",
|
|
160
160
|
"--version",
|
|
161
161
|
"--search",
|
|
162
|
+
"--tool-policy",
|
|
162
163
|
"--pricing-file",
|
|
163
164
|
"--usage-limit-usd"
|
|
164
165
|
];
|
|
@@ -221,6 +222,7 @@ var childBudgets = [
|
|
|
221
222
|
var agent = [
|
|
222
223
|
"--compaction-model",
|
|
223
224
|
"--compaction-provider",
|
|
225
|
+
"--tool-policy",
|
|
224
226
|
"--pricing-file",
|
|
225
227
|
"--usage-limit-usd",
|
|
226
228
|
...provider,
|
|
@@ -250,6 +252,7 @@ var CLI_COMMAND_OPTION_CONTRACTS = {
|
|
|
250
252
|
init: contract([...provider, ...profile, "--update", "--json"]),
|
|
251
253
|
run: contract(["--service", "--session", ...agent, "--idempotency-key", "--approval-mode", "--yes", "--json", "--jsonl"]),
|
|
252
254
|
review: contract([
|
|
255
|
+
"--tool-policy",
|
|
253
256
|
"--pricing-file",
|
|
254
257
|
"--usage-limit-usd",
|
|
255
258
|
...provider,
|
|
@@ -266,18 +269,30 @@ var CLI_COMMAND_OPTION_CONTRACTS = {
|
|
|
266
269
|
]),
|
|
267
270
|
chat: contract(["--service", ...agent, "--approval-mode", "--yes", "--session", "--continue"]),
|
|
268
271
|
providers: contract(["--json"]),
|
|
272
|
+
policy: contract(["--service", ...agent, "--json"]),
|
|
269
273
|
doctor: contract([...provider, ...profile, ...locator, ...project, ...execution, ...budgets, "--allow-check", "--require-capability", "--subagent", "--json"]),
|
|
270
|
-
resume: contract(["--service", "--session", ...locator, "--approve", "--deny", "--json", "--jsonl"], [["--approve", "--deny"]]),
|
|
274
|
+
resume: contract(["--tool-policy", "--service", "--session", ...locator, "--approve", "--deny", "--json", "--jsonl"], [["--approve", "--deny"]]),
|
|
271
275
|
"runs:list": contract([...locator, "--status", "--limit", "--cursor", "--json"]),
|
|
272
276
|
"runs:inspect": contract([...locator, "--json"]),
|
|
273
277
|
"runs:cancel": contract([...locator, "--reason", "--cascade", "--final", "--json"]),
|
|
274
278
|
"runs:cleanup": contract([...locator, "--before", "--status", "--limit", "--json"], ["--before"]),
|
|
275
279
|
"runs:export": contract([...locator, "--json"]),
|
|
280
|
+
"runs:report": contract([...locator, "--json", "--session"]),
|
|
276
281
|
"sessions:list": contract(["--service", ...locator, "--limit", "--json", "--search"]),
|
|
277
282
|
"sessions:inspect": contract(["--service", ...locator, "--json"]),
|
|
278
283
|
"sessions:rename": contract(["--service", ...locator, "--json"]),
|
|
279
284
|
"sessions:fork": contract([...locator, "--json"]),
|
|
280
285
|
"sessions:archive": contract([...locator, "--json"]),
|
|
286
|
+
"checkpoints:storage": contract([...locator, "--json"]),
|
|
287
|
+
"checkpoints:prune-review": contract([...locator, "--json"]),
|
|
288
|
+
"checkpoints:prune-apply": contract([...locator, "--json"]),
|
|
289
|
+
"checkpoints:list": contract([...locator, "--json"]),
|
|
290
|
+
"checkpoints:capture": contract([...locator, "--json"]),
|
|
291
|
+
"checkpoints:inspect": contract([...locator, "--json"]),
|
|
292
|
+
"checkpoints:prepare": contract([...locator, "--json"]),
|
|
293
|
+
"checkpoints:review": contract([...locator, "--json"]),
|
|
294
|
+
"checkpoints:apply": contract([...locator, "--json"]),
|
|
295
|
+
"checkpoints:recover": contract([...locator, "--json"]),
|
|
281
296
|
"changes:create": contract(["--patch"], ["--patch"]),
|
|
282
297
|
"changes:verify": contract(["--patch", "--preconditions", "--now"], ["--patch"]),
|
|
283
298
|
"state:status": contract([...locator, "--json"]),
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// src/client/acp-mcp-session.ts
|
|
2
|
+
var providers = new WeakMap;
|
|
3
|
+
function issueAcpMcpSessionProvider(provider) {
|
|
4
|
+
const token = Object.freeze({});
|
|
5
|
+
providers.set(token, provider);
|
|
6
|
+
return token;
|
|
7
|
+
}
|
|
8
|
+
function resolveAcpMcpSessionProvider(token, adapter) {
|
|
9
|
+
const provider = providers.get(token);
|
|
10
|
+
if (!provider || provider.adapter !== adapter)
|
|
11
|
+
throw new Error("ACP MCP requires its host-owned adapter capability.");
|
|
12
|
+
return provider;
|
|
13
|
+
}
|
|
14
|
+
|
|
1
15
|
// src/client/acp.ts
|
|
2
16
|
import { randomUUID } from "node:crypto";
|
|
3
17
|
import { isAbsolute, resolve } from "node:path";
|
|
@@ -22,7 +36,9 @@ var createAcpConnection = (adapter, options) => {
|
|
|
22
36
|
const negotiated = adapter.negotiate([1]);
|
|
23
37
|
if (!negotiated.ok)
|
|
24
38
|
throw new Error(negotiated.error.code);
|
|
39
|
+
const mcp = options.mcpSessionProvider ? resolveAcpMcpSessionProvider(options.mcpSessionProvider, adapter) : undefined;
|
|
25
40
|
let initialized = false;
|
|
41
|
+
let creating = false;
|
|
26
42
|
const sessions = new Set;
|
|
27
43
|
let active;
|
|
28
44
|
const command = async (value) => {
|
|
@@ -49,7 +65,7 @@ var createAcpConnection = (adapter, options) => {
|
|
|
49
65
|
agentCapabilities: { loadSession: false, promptCapabilities: { image: false, audio: false, embeddedContext: false }, mcpCapabilities: { http: false, sse: false } },
|
|
50
66
|
authMethods: [],
|
|
51
67
|
agentInfo: { name: "zhivex-harness", title: "Zhivex Harness (text-session subset)", version: "1" },
|
|
52
|
-
_meta: { zhivex: { subset: true, fixedWorkspace: true, clientMcp:
|
|
68
|
+
_meta: { zhivex: { subset: true, fixedWorkspace: true, clientMcp: !!mcp } }
|
|
53
69
|
};
|
|
54
70
|
}
|
|
55
71
|
if (!initialized)
|
|
@@ -57,16 +73,29 @@ var createAcpConnection = (adapter, options) => {
|
|
|
57
73
|
if (method === "session/new") {
|
|
58
74
|
if (sessions.size >= 256)
|
|
59
75
|
throw new AcpFault(-32000, "Session capacity exceeded");
|
|
60
|
-
if (active)
|
|
76
|
+
if (active || creating)
|
|
61
77
|
throw new AcpFault(-32000, "BUSY");
|
|
62
|
-
const input2 = z.object({ cwd: z.string(), mcpServers: z.array(z.unknown()).max(0) }).strict().parse(params);
|
|
78
|
+
const input2 = z.object({ cwd: z.string(), mcpServers: z.array(z.unknown()).max(mcp ? 8 : 0) }).strict().parse(params);
|
|
63
79
|
if (!isAbsolute(input2.cwd) || resolve(input2.cwd) !== resolve(options.workspace))
|
|
64
80
|
throw new AcpFault(-32602, "Workspace is host-owned");
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
81
|
+
let servers;
|
|
82
|
+
try {
|
|
83
|
+
servers = mcp?.parse(input2.mcpServers);
|
|
84
|
+
} catch {
|
|
85
|
+
throw new AcpFault(-32602, "MCP configuration was not accepted by the host");
|
|
86
|
+
}
|
|
87
|
+
creating = true;
|
|
88
|
+
try {
|
|
89
|
+
const data = await command({ method: "session.create", idempotencyKey: randomUUID() });
|
|
90
|
+
if (data.kind !== "session")
|
|
91
|
+
throw new AcpFault(-32603, "Invalid adapter response");
|
|
92
|
+
if (mcp && servers)
|
|
93
|
+
mcp.bind(data.session.sessionId, servers);
|
|
94
|
+
sessions.add(data.session.sessionId);
|
|
95
|
+
return { sessionId: data.session.sessionId };
|
|
96
|
+
} finally {
|
|
97
|
+
creating = false;
|
|
98
|
+
}
|
|
70
99
|
}
|
|
71
100
|
if (method === "session/cancel") {
|
|
72
101
|
const input2 = sessionParams.parse(params);
|
|
@@ -86,7 +115,7 @@ var createAcpConnection = (adapter, options) => {
|
|
|
86
115
|
`);
|
|
87
116
|
if (!prompt.trim() || prompt.length > 64 * 1024)
|
|
88
117
|
throw new AcpFault(-32602, "Invalid prompt size");
|
|
89
|
-
if (active)
|
|
118
|
+
if (active || creating)
|
|
90
119
|
throw new AcpFault(-32000, "BUSY");
|
|
91
120
|
const permissionController = new AbortController;
|
|
92
121
|
let cancel;
|
|
@@ -213,6 +242,7 @@ var serveAcpStdio = async (adapter, options) => {
|
|
|
213
242
|
let transportFailure;
|
|
214
243
|
const connection = createAcpConnection(adapter, {
|
|
215
244
|
workspace: options.workspace,
|
|
245
|
+
...options.mcpSessionProvider ? { mcpSessionProvider: options.mcpSessionProvider } : {},
|
|
216
246
|
notify: write,
|
|
217
247
|
requestPermission: async (params, signal) => {
|
|
218
248
|
const id = `permission_${randomUUID2()}`;
|
|
@@ -323,4 +353,4 @@ var serveAcpStdio = async (adapter, options) => {
|
|
|
323
353
|
throw transportFailure;
|
|
324
354
|
};
|
|
325
355
|
|
|
326
|
-
export { createAcpConnection, serveAcpStdio };
|
|
356
|
+
export { issueAcpMcpSessionProvider, createAcpConnection, serveAcpStdio };
|