@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
package/dist/acp-cli.js
CHANGED
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./index-
|
|
2
|
+
import"./index-4jw3tvy8.js";
|
|
3
3
|
import {
|
|
4
4
|
CLI_OPTION_DEFINITIONS,
|
|
5
5
|
parseHarnessModelRoute,
|
|
6
6
|
resolveHarnessModelRoutes,
|
|
7
7
|
validateCliCommandOptions
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-2jrdcj6b.js";
|
|
9
|
+
import {
|
|
10
|
+
serveAcpStdio
|
|
11
|
+
} from "./index-3ah1f369.js";
|
|
9
12
|
import {
|
|
10
13
|
createHarness,
|
|
11
14
|
createHarnessClientAdapter
|
|
12
|
-
} from "./index-
|
|
15
|
+
} from "./index-hnaxfpb5.js";
|
|
16
|
+
import"./index-h0mqx2ed.js";
|
|
17
|
+
import"./index-8zzhggxv.js";
|
|
18
|
+
import {
|
|
19
|
+
usagePricingSchema
|
|
20
|
+
} from "./index-42gp2hy8.js";
|
|
21
|
+
import"./index-azmwjp95.js";
|
|
22
|
+
import"./index-z0qxmkm2.js";
|
|
13
23
|
import {
|
|
14
24
|
FileChangedWhileReadingError,
|
|
15
25
|
FileSizeLimitError,
|
|
16
26
|
UnsafeFileTypeError,
|
|
17
|
-
readRegularFileNoFollow
|
|
18
|
-
|
|
19
|
-
} from "./index-pgqz45fj.js";
|
|
27
|
+
readRegularFileNoFollow
|
|
28
|
+
} from "./index-yb239ghk.js";
|
|
20
29
|
import {
|
|
21
30
|
HARNESS_REQUIRED_CAPABILITIES,
|
|
22
31
|
HARNESS_SUBAGENT_PROFILES,
|
|
@@ -28,11 +37,10 @@ import {
|
|
|
28
37
|
providerDescriptor,
|
|
29
38
|
reasoningEffortSchema,
|
|
30
39
|
resolveHarnessConfig
|
|
31
|
-
} from "./index-
|
|
32
|
-
import"./index-
|
|
33
|
-
import
|
|
34
|
-
|
|
35
|
-
} from "./index-77h9qr5h.js";
|
|
40
|
+
} from "./index-gq9xagx2.js";
|
|
41
|
+
import"./index-8705zxpr.js";
|
|
42
|
+
import"./index-xqxeypt5.js";
|
|
43
|
+
import"./index-qfpz5y2v.js";
|
|
36
44
|
import {
|
|
37
45
|
__require
|
|
38
46
|
} from "./index-1bx83sw4.js";
|
|
@@ -43,11 +51,22 @@ import { fileURLToPath } from "node:url";
|
|
|
43
51
|
|
|
44
52
|
// src/cli/cli-help.ts
|
|
45
53
|
var usage = {
|
|
54
|
+
"checkpoints:storage": "zhx checkpoints storage",
|
|
55
|
+
"checkpoints:prune-review": "zhx checkpoints prune-review <checkpoint:id|restore:id> [...]",
|
|
56
|
+
"checkpoints:prune-apply": "zhx checkpoints prune-apply <reviewedPlanId> <checkpoint:id|restore:id> [...]",
|
|
57
|
+
"checkpoints:list": "zhx checkpoints list <sessionId>",
|
|
58
|
+
"checkpoints:capture": "zhx checkpoints capture <sessionId> <turnId> <path> [paths...]",
|
|
59
|
+
"checkpoints:inspect": "zhx checkpoints inspect <checkpointId>",
|
|
60
|
+
"checkpoints:prepare": "zhx checkpoints prepare <checkpointId>",
|
|
61
|
+
"checkpoints:review": "zhx checkpoints review <operationId>",
|
|
62
|
+
"checkpoints:apply": "zhx checkpoints apply <operationId> <reviewedProposalId>",
|
|
63
|
+
"checkpoints:recover": "zhx checkpoints recover <operationId> <existingForkSessionId>",
|
|
46
64
|
init: "zhx init [--provider <id>] [--model <id>] [--profile <name>] [--update]",
|
|
47
65
|
run: 'zhx run [options] "task" | zhx run [options] -',
|
|
48
66
|
review: 'zhx review [options] "review task" | zhx review [options] -',
|
|
49
67
|
chat: "zhx [--continue | --session <id>]",
|
|
50
68
|
providers: "zhx providers [--json]",
|
|
69
|
+
policy: "zhx policy [options] [--json]",
|
|
51
70
|
doctor: "zhx doctor [options]",
|
|
52
71
|
resume: "zhx resume <runId> --approve|--deny",
|
|
53
72
|
"runs:list": "zhx runs list [options]",
|
|
@@ -55,6 +74,7 @@ var usage = {
|
|
|
55
74
|
"runs:cancel": "zhx runs cancel <runId> [options]",
|
|
56
75
|
"runs:cleanup": "zhx runs cleanup --before <date> [options]",
|
|
57
76
|
"runs:export": "zhx runs export <runId>",
|
|
77
|
+
"runs:report": "zhx runs report <runId> [envelope.json] [--session <sessionId>] [--json]",
|
|
58
78
|
"sessions:list": "zhx sessions list [--search <text>]",
|
|
59
79
|
"sessions:inspect": "zhx sessions inspect <sessionId>",
|
|
60
80
|
"sessions:rename": 'zhx sessions rename <sessionId> "title"',
|
|
@@ -197,8 +217,8 @@ var applyCliProfile = async (options, context = {}) => {
|
|
|
197
217
|
};
|
|
198
218
|
|
|
199
219
|
// src/cli/arguments.ts
|
|
200
|
-
var CLI_COMMANDS = ["init", "run", "review", "chat", "providers", "doctor", "resume", "runs", "sessions", "changes", "state", "help", "version"];
|
|
201
|
-
var CLI_RUNS_COMMANDS = ["list", "inspect", "cancel", "cleanup", "export"];
|
|
220
|
+
var CLI_COMMANDS = ["init", "run", "review", "chat", "providers", "doctor", "policy", "resume", "runs", "sessions", "checkpoints", "changes", "state", "help", "version"];
|
|
221
|
+
var CLI_RUNS_COMMANDS = ["list", "inspect", "cancel", "cleanup", "export", "report"];
|
|
202
222
|
var CLI_SESSIONS_COMMANDS = ["list", "inspect", "rename", "fork", "archive"];
|
|
203
223
|
var CLI_CHANGES_COMMANDS = ["create", "verify"];
|
|
204
224
|
var CLI_STATE_COMMANDS = ["status", "export", "import"];
|
|
@@ -269,7 +289,7 @@ var parseCliArgs = (argv) => {
|
|
|
269
289
|
words.push(arg);
|
|
270
290
|
}
|
|
271
291
|
const first = words[0];
|
|
272
|
-
const parts = first === "help" ? words.slice(1) : first && COMMANDS.has(first) ? words.slice(0, ["runs", "sessions", "changes", "state"].includes(first) ? 2 : 1) : [];
|
|
292
|
+
const parts = first === "help" ? words.slice(1) : first && COMMANDS.has(first) ? words.slice(0, ["runs", "sessions", "checkpoints", "changes", "state"].includes(first) ? 2 : 1) : [];
|
|
273
293
|
try {
|
|
274
294
|
const topic = resolveHelpTopic(parts, parts.length > 0);
|
|
275
295
|
return { ...options, command: "help", ...topic ? { helpTopic: topic } : {} };
|
|
@@ -354,6 +374,10 @@ var parseCliArgs = (argv) => {
|
|
|
354
374
|
options.mcpConfigPath = optionValue(argv, index, argument);
|
|
355
375
|
index += 1;
|
|
356
376
|
break;
|
|
377
|
+
case "--tool-policy":
|
|
378
|
+
options.toolPolicyFile = optionValue(argv, index, argument);
|
|
379
|
+
index += 1;
|
|
380
|
+
break;
|
|
357
381
|
case "--context-config":
|
|
358
382
|
options.contextConfigPath = optionValue(argv, index, argument);
|
|
359
383
|
index += 1;
|
|
@@ -758,16 +782,18 @@ var parseCliArgs = (argv) => {
|
|
|
758
782
|
} else if (options.command === "runs") {
|
|
759
783
|
const runsCommand = positional.shift();
|
|
760
784
|
if (!runsCommand || !RUNS_COMMANDS.has(runsCommand)) {
|
|
761
|
-
throw new CliUsageError("runs requires one of: list, inspect, cancel, cleanup, export.");
|
|
785
|
+
throw new CliUsageError("runs requires one of: list, inspect, cancel, cleanup, export, report.");
|
|
762
786
|
}
|
|
763
787
|
options.runsCommand = runsCommand;
|
|
764
|
-
if (runsCommand === "inspect" || runsCommand === "cancel" || runsCommand === "export") {
|
|
788
|
+
if (runsCommand === "inspect" || runsCommand === "cancel" || runsCommand === "export" || runsCommand === "report") {
|
|
765
789
|
const runId = positional.shift();
|
|
766
790
|
if (!runId) {
|
|
767
791
|
throw new CliUsageError(`runs ${runsCommand} requires a runId.`);
|
|
768
792
|
}
|
|
769
793
|
options.runId = runId;
|
|
770
794
|
}
|
|
795
|
+
if (runsCommand === "report" && positional.length)
|
|
796
|
+
options.reportEnvelopePath = positional.shift();
|
|
771
797
|
if (positional.length > 0) {
|
|
772
798
|
throw new CliUsageError(`runs ${runsCommand} received unexpected positional arguments.`);
|
|
773
799
|
}
|
|
@@ -793,6 +819,16 @@ var parseCliArgs = (argv) => {
|
|
|
793
819
|
if (positional.length > 0) {
|
|
794
820
|
throw new CliUsageError(`sessions ${sessionsCommand} received unexpected positional arguments.`);
|
|
795
821
|
}
|
|
822
|
+
} else if (options.command === "checkpoints") {
|
|
823
|
+
const command2 = positional.shift();
|
|
824
|
+
const counts = { list: [1, 1], capture: [3, 22], inspect: [1, 1], prepare: [1, 1], review: [1, 1], apply: [2, 2], recover: [2, 2], storage: [0, 0], "prune-review": [1, 100], "prune-apply": [2, 101] };
|
|
825
|
+
if (!command2 || !Object.hasOwn(counts, command2))
|
|
826
|
+
throw new CliUsageError("checkpoints requires list, capture, inspect, prepare, review, apply, recover, storage, prune-review or prune-apply.");
|
|
827
|
+
const [min, max] = counts[command2];
|
|
828
|
+
if (positional.length < min || positional.length > max)
|
|
829
|
+
throw new CliUsageError(`Invalid arguments for checkpoints ${command2}; use --help.`);
|
|
830
|
+
options.checkpointsCommand = command2;
|
|
831
|
+
options.checkpointArguments = positional.splice(0);
|
|
796
832
|
} else if (options.command === "changes") {
|
|
797
833
|
const changesCommand = positional.shift();
|
|
798
834
|
if (!changesCommand || !CHANGES_COMMANDS.has(changesCommand)) {
|
|
@@ -846,7 +882,7 @@ var parseCliArgs = (argv) => {
|
|
|
846
882
|
} else if (["run", "resume"].includes(options.command) && optionCounts.has("--session")) {
|
|
847
883
|
throw new CliUsageError("--session for run/resume requires --service.");
|
|
848
884
|
}
|
|
849
|
-
const commandKey = options.command === "runs" ? `runs:${options.runsCommand}` : options.command === "sessions" ? `sessions:${options.sessionsCommand}` : options.command === "changes" ? `changes:${options.changesCommand}` : options.command === "state" ? `state:${options.stateCommand}` : options.command;
|
|
885
|
+
const commandKey = options.command === "checkpoints" ? `checkpoints:${options.checkpointsCommand}` : options.command === "runs" ? `runs:${options.runsCommand}` : options.command === "sessions" ? `sessions:${options.sessionsCommand}` : options.command === "changes" ? `changes:${options.changesCommand}` : options.command === "state" ? `state:${options.stateCommand}` : options.command;
|
|
850
886
|
try {
|
|
851
887
|
validateCliCommandOptions(commandKey, optionCounts);
|
|
852
888
|
} catch (error) {
|
|
@@ -863,7 +899,7 @@ var parseCliArgs = (argv) => {
|
|
|
863
899
|
|
|
864
900
|
// src/cli/cli-credentials.ts
|
|
865
901
|
async function credentialModel(config, env, modelFactory) {
|
|
866
|
-
const { createProviderModel: createProviderModel2 } = await import("./config-
|
|
902
|
+
const { createProviderModel: createProviderModel2 } = await import("./config-j3jga5wh.js");
|
|
867
903
|
const { wrapLanguageModel } = await import("@zhivex-ai/core");
|
|
868
904
|
const secrets = providerDescriptor(config.provider).credentialNames.map((name) => env[name]).filter((value) => !!value);
|
|
869
905
|
const safeError = (error) => {
|
|
@@ -3,6 +3,17 @@ import type { AgentRunState, AgentToolCallJournalEntry } from "@zhivex-ai/core";
|
|
|
3
3
|
import type { AppliedDiff } from "./approval-diff.js";
|
|
4
4
|
export declare const APPROVAL_HISTORY_KEY = "clientApprovalDecisionsV1";
|
|
5
5
|
export declare const approvalInputDigest: (value: unknown) => string;
|
|
6
|
+
export declare const approvalProvenanceSchema: z.ZodObject<{
|
|
7
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
8
|
+
origin: z.ZodEnum<{
|
|
9
|
+
application: "application";
|
|
10
|
+
automatic: "automatic";
|
|
11
|
+
interactive: "interactive";
|
|
12
|
+
unknown: "unknown";
|
|
13
|
+
}>;
|
|
14
|
+
channel: z.ZodString;
|
|
15
|
+
policyDigest: z.ZodNullable<z.ZodString>;
|
|
16
|
+
}, z.core.$strict>;
|
|
6
17
|
declare const rowSchema: z.ZodObject<{
|
|
7
18
|
approvalId: z.ZodString;
|
|
8
19
|
digest: z.ZodString;
|
|
@@ -12,6 +23,17 @@ declare const rowSchema: z.ZodObject<{
|
|
|
12
23
|
approved: z.ZodBoolean;
|
|
13
24
|
decidedAt: z.ZodNumber;
|
|
14
25
|
reviewedRevision: z.ZodNumber;
|
|
26
|
+
provenance: z.ZodOptional<z.ZodObject<{
|
|
27
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
28
|
+
origin: z.ZodEnum<{
|
|
29
|
+
application: "application";
|
|
30
|
+
automatic: "automatic";
|
|
31
|
+
interactive: "interactive";
|
|
32
|
+
unknown: "unknown";
|
|
33
|
+
}>;
|
|
34
|
+
channel: z.ZodString;
|
|
35
|
+
policyDigest: z.ZodNullable<z.ZodString>;
|
|
36
|
+
}, z.core.$strict>>;
|
|
15
37
|
}, z.core.$strict>;
|
|
16
38
|
export type ApprovalDecisionRecord = z.infer<typeof rowSchema>;
|
|
17
39
|
export interface ApprovalDecisionView extends ApprovalDecisionRecord {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AgentApprovalResponse, AgentRunState } from '@zhivex-ai/core';
|
|
2
|
+
import type { AgentRunStore } from '@zhivex-ai/agents/ops';
|
|
3
|
+
type DecisionOrigin = 'interactive' | 'automatic' | 'application';
|
|
4
|
+
/** Presence only; admission still validates and consumes the receipt against durable state. */
|
|
5
|
+
export declare const hasHostApprovalReceipt: (responses: readonly AgentApprovalResponse[]) => boolean;
|
|
6
|
+
/** Trusted host only: call after its review UI confirms the complete snapshot.
|
|
7
|
+
* No renderer/client flag creates evidence. Cloning or serializing loses authority.
|
|
8
|
+
* This attests a local channel, not a person's legal or corporate identity. */
|
|
9
|
+
export declare const issueExplicitReviewResponses: (host: object, state: AgentRunState, responses: readonly AgentApprovalResponse[], channel: string, now?: number, reviewedRevision?: number) => AgentApprovalResponse[];
|
|
10
|
+
/** Observed provenance is separate from evidence of complete explicit review. */
|
|
11
|
+
export declare const issueObservedApprovalResponses: (host: object, state: AgentRunState, responses: readonly AgentApprovalResponse[], channel: string, origins: readonly DecisionOrigin[], now?: number) => AgentApprovalResponse[];
|
|
12
|
+
export declare const issueAutomaticApprovalResponses: (host: object, state: AgentRunState, responses: readonly AgentApprovalResponse[], channel: string) => AgentApprovalResponse[];
|
|
13
|
+
/** Internal adapter handoff after its durable intent write; not a protocol field. */
|
|
14
|
+
export declare const issueRecordedApprovalResponses: (host: object, state: AgentRunState, responses: readonly AgentApprovalResponse[]) => AgentApprovalResponse[];
|
|
15
|
+
export declare const consumeExplicitReviewResponses: (host: object, state: AgentRunState, responses: readonly AgentApprovalResponse[], now?: number) => {
|
|
16
|
+
alreadyRecorded?: boolean;
|
|
17
|
+
origins: DecisionOrigin[];
|
|
18
|
+
channel: string;
|
|
19
|
+
policyDigest: string | null;
|
|
20
|
+
reviewedRevision: number;
|
|
21
|
+
};
|
|
22
|
+
/** Save review intent before effects; acknowledgement loss does not authorize retry. */
|
|
23
|
+
export declare const admitExplicitReviewResponses: (host: object, store: AgentRunStore, state: AgentRunState, responses: readonly AgentApprovalResponse[]) => Promise<AgentRunState>;
|
|
24
|
+
export {};
|
package/dist/cli/arguments.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { type HarnessReasoningEffort } from "../providers/reasoning.js";
|
|
|
2
2
|
import { type AgentStatus } from "@zhivex-ai/agents";
|
|
3
3
|
import { type HarnessSubagentProfile } from "../runtime/config.js";
|
|
4
4
|
import { HarnessError } from "../runtime/errors.js";
|
|
5
|
-
export declare const CLI_COMMANDS: readonly ["init", "run", "review", "chat", "providers", "doctor", "resume", "runs", "sessions", "changes", "state", "help", "version"];
|
|
6
|
-
export declare const CLI_RUNS_COMMANDS: readonly ["list", "inspect", "cancel", "cleanup", "export"];
|
|
5
|
+
export declare const CLI_COMMANDS: readonly ["init", "run", "review", "chat", "providers", "doctor", "policy", "resume", "runs", "sessions", "checkpoints", "changes", "state", "help", "version"];
|
|
6
|
+
export declare const CLI_RUNS_COMMANDS: readonly ["list", "inspect", "cancel", "cleanup", "export", "report"];
|
|
7
7
|
export declare const CLI_SESSIONS_COMMANDS: readonly ["list", "inspect", "rename", "fork", "archive"];
|
|
8
8
|
export declare const CLI_CHANGES_COMMANDS: readonly ["create", "verify"];
|
|
9
9
|
export declare const CLI_STATE_COMMANDS: readonly ["status", "export", "import"];
|
|
@@ -75,7 +75,10 @@ export interface CliOptions {
|
|
|
75
75
|
runId?: string;
|
|
76
76
|
idempotencyKey?: string;
|
|
77
77
|
runsCommand?: RunsCommand;
|
|
78
|
+
reportEnvelopePath?: string;
|
|
78
79
|
sessionsCommand?: SessionsCommand;
|
|
80
|
+
checkpointsCommand?: "list" | "capture" | "inspect" | "prepare" | "review" | "apply" | "recover" | "storage" | "prune-review" | "prune-apply";
|
|
81
|
+
checkpointArguments?: string[];
|
|
79
82
|
changesCommand?: ChangesCommand;
|
|
80
83
|
stateCommand?: StateCommand;
|
|
81
84
|
artifactPath?: string;
|
|
@@ -87,6 +90,7 @@ export interface CliOptions {
|
|
|
87
90
|
sessionTitle?: string;
|
|
88
91
|
sessionSearch?: string;
|
|
89
92
|
pricingFile?: string;
|
|
93
|
+
toolPolicyFile?: string;
|
|
90
94
|
usageLimitUsd?: number;
|
|
91
95
|
continueSession: boolean;
|
|
92
96
|
implicitCommand: boolean;
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { type CliSession } from '../persistence/sessions.js';
|
|
2
|
+
import { type CliOptions } from './arguments.js';
|
|
3
|
+
/** Operator CLI over the existing checkpoint API; never constructs a model. */
|
|
4
|
+
export declare function checkpointCliDocument(options: CliOptions): Promise<{
|
|
5
|
+
policy: 'explicit-reviewed-removal';
|
|
6
|
+
automaticEviction: false;
|
|
7
|
+
maxRecords: number;
|
|
8
|
+
maxRecordBytes: number;
|
|
9
|
+
maxFilesPerCheckpoint: number;
|
|
10
|
+
maxFileBytes: number;
|
|
11
|
+
records: number;
|
|
12
|
+
availableRecords: number;
|
|
13
|
+
serializedBytes: number;
|
|
14
|
+
pendingRestores: number;
|
|
15
|
+
checkpoints: {
|
|
16
|
+
id: string;
|
|
17
|
+
referenced: boolean;
|
|
18
|
+
}[];
|
|
19
|
+
kind: string;
|
|
20
|
+
restores?: never;
|
|
21
|
+
inspection?: never;
|
|
22
|
+
reviewedProposalId?: never;
|
|
23
|
+
diff?: never;
|
|
24
|
+
coverage?: never;
|
|
25
|
+
forkSessionId?: never;
|
|
26
|
+
operationId?: never;
|
|
27
|
+
stage?: never;
|
|
28
|
+
session?: never;
|
|
29
|
+
} | {
|
|
30
|
+
planId: string;
|
|
31
|
+
selection: {
|
|
32
|
+
checkpointIds: string[];
|
|
33
|
+
completedRestoreIds: string[];
|
|
34
|
+
};
|
|
35
|
+
records: {
|
|
36
|
+
id: string;
|
|
37
|
+
kind: string;
|
|
38
|
+
sessionId: string;
|
|
39
|
+
bytes: number;
|
|
40
|
+
}[];
|
|
41
|
+
recordsBefore: number;
|
|
42
|
+
recordsAfter: number;
|
|
43
|
+
bytesRemoved: number;
|
|
44
|
+
workspaceFilesChanged: false;
|
|
45
|
+
conversationsChanged: false;
|
|
46
|
+
kind: string;
|
|
47
|
+
checkpoints?: never;
|
|
48
|
+
restores?: never;
|
|
49
|
+
inspection?: never;
|
|
50
|
+
reviewedProposalId?: never;
|
|
51
|
+
diff?: never;
|
|
52
|
+
coverage?: never;
|
|
53
|
+
forkSessionId?: never;
|
|
54
|
+
operationId?: never;
|
|
55
|
+
stage?: never;
|
|
56
|
+
session?: never;
|
|
57
|
+
} | {
|
|
58
|
+
kind: string;
|
|
59
|
+
checkpoints: {
|
|
60
|
+
id: string;
|
|
61
|
+
sessionId: string;
|
|
62
|
+
turnId: string;
|
|
63
|
+
files: {
|
|
64
|
+
path: string;
|
|
65
|
+
digest: string;
|
|
66
|
+
bytes: number;
|
|
67
|
+
mode: number;
|
|
68
|
+
}[];
|
|
69
|
+
}[];
|
|
70
|
+
restores: {
|
|
71
|
+
id: string;
|
|
72
|
+
checkpointId: string;
|
|
73
|
+
proposalId: string;
|
|
74
|
+
stage: "applied" | "applying" | "completed" | "forked" | "forking" | "prepared";
|
|
75
|
+
forkSessionId?: string;
|
|
76
|
+
}[];
|
|
77
|
+
inspection?: never;
|
|
78
|
+
reviewedProposalId?: never;
|
|
79
|
+
diff?: never;
|
|
80
|
+
coverage?: never;
|
|
81
|
+
forkSessionId?: never;
|
|
82
|
+
operationId?: never;
|
|
83
|
+
stage?: never;
|
|
84
|
+
session?: never;
|
|
85
|
+
} | {
|
|
86
|
+
checkpoints?: never;
|
|
87
|
+
restores?: never;
|
|
88
|
+
kind: string;
|
|
89
|
+
inspection: {
|
|
90
|
+
checkpoint: {
|
|
91
|
+
id: string;
|
|
92
|
+
sessionId: string;
|
|
93
|
+
turnId: string;
|
|
94
|
+
files: {
|
|
95
|
+
path: string;
|
|
96
|
+
digest: string;
|
|
97
|
+
bytes: number;
|
|
98
|
+
mode: number;
|
|
99
|
+
}[];
|
|
100
|
+
};
|
|
101
|
+
files: ({
|
|
102
|
+
path: string;
|
|
103
|
+
status: "mode-conflict";
|
|
104
|
+
before?: never;
|
|
105
|
+
after?: never;
|
|
106
|
+
expectedDigest?: never;
|
|
107
|
+
afterDigest?: never;
|
|
108
|
+
mode?: never;
|
|
109
|
+
} | {
|
|
110
|
+
path: string;
|
|
111
|
+
status: "available";
|
|
112
|
+
before: string;
|
|
113
|
+
after: string;
|
|
114
|
+
expectedDigest: string;
|
|
115
|
+
afterDigest: string;
|
|
116
|
+
mode: number;
|
|
117
|
+
} | {
|
|
118
|
+
before?: never;
|
|
119
|
+
after?: never;
|
|
120
|
+
expectedDigest?: never;
|
|
121
|
+
afterDigest?: never;
|
|
122
|
+
mode?: never;
|
|
123
|
+
path: string;
|
|
124
|
+
status: "unavailable";
|
|
125
|
+
})[];
|
|
126
|
+
coverage: {
|
|
127
|
+
existingTextOnly: true;
|
|
128
|
+
maxFiles: number;
|
|
129
|
+
maxFileBytes: number;
|
|
130
|
+
creation: false;
|
|
131
|
+
deletion: false;
|
|
132
|
+
binary: false;
|
|
133
|
+
modeRollback: false;
|
|
134
|
+
fullWorkspaceSnapshot: false;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
reviewedProposalId?: never;
|
|
138
|
+
diff?: never;
|
|
139
|
+
coverage?: never;
|
|
140
|
+
forkSessionId?: never;
|
|
141
|
+
operationId?: never;
|
|
142
|
+
stage?: never;
|
|
143
|
+
session?: never;
|
|
144
|
+
} | {
|
|
145
|
+
checkpoints?: never;
|
|
146
|
+
restores?: never;
|
|
147
|
+
inspection?: never;
|
|
148
|
+
kind: string;
|
|
149
|
+
operationId: string;
|
|
150
|
+
stage: "applied" | "applying" | "completed" | "forked" | "forking" | "prepared";
|
|
151
|
+
reviewedProposalId: string;
|
|
152
|
+
diff: {
|
|
153
|
+
proposalId: string;
|
|
154
|
+
files: {
|
|
155
|
+
path: string;
|
|
156
|
+
expectedDigest: import("../index.js").FileDigest | null;
|
|
157
|
+
before: string | null;
|
|
158
|
+
after: string;
|
|
159
|
+
afterDigest: import("../index.js").FileDigest;
|
|
160
|
+
}[];
|
|
161
|
+
};
|
|
162
|
+
coverage: {
|
|
163
|
+
existingTextOnly: true;
|
|
164
|
+
maxFiles: number;
|
|
165
|
+
maxFileBytes: number;
|
|
166
|
+
creation: false;
|
|
167
|
+
deletion: false;
|
|
168
|
+
binary: false;
|
|
169
|
+
modeRollback: false;
|
|
170
|
+
fullWorkspaceSnapshot: false;
|
|
171
|
+
};
|
|
172
|
+
forkSessionId?: never;
|
|
173
|
+
session?: never;
|
|
174
|
+
} | {
|
|
175
|
+
checkpoints?: never;
|
|
176
|
+
restores?: never;
|
|
177
|
+
inspection?: never;
|
|
178
|
+
kind: string;
|
|
179
|
+
operationId: string;
|
|
180
|
+
stage: "applied" | "applying" | "completed" | "forked" | "forking" | "prepared";
|
|
181
|
+
reviewedProposalId: string;
|
|
182
|
+
forkSessionId: string | undefined;
|
|
183
|
+
previewStatus: string;
|
|
184
|
+
diff?: {
|
|
185
|
+
proposalId: string;
|
|
186
|
+
files: {
|
|
187
|
+
path: string;
|
|
188
|
+
expectedDigest: import("../index.js").FileDigest | null;
|
|
189
|
+
before: string | null;
|
|
190
|
+
after: string;
|
|
191
|
+
afterDigest: import("../index.js").FileDigest;
|
|
192
|
+
}[];
|
|
193
|
+
};
|
|
194
|
+
coverage: {
|
|
195
|
+
existingTextOnly: true;
|
|
196
|
+
maxFiles: number;
|
|
197
|
+
maxFileBytes: number;
|
|
198
|
+
creation: false;
|
|
199
|
+
deletion: false;
|
|
200
|
+
binary: false;
|
|
201
|
+
modeRollback: false;
|
|
202
|
+
fullWorkspaceSnapshot: false;
|
|
203
|
+
};
|
|
204
|
+
session?: never;
|
|
205
|
+
} | {
|
|
206
|
+
checkpoints?: never;
|
|
207
|
+
restores?: never;
|
|
208
|
+
inspection?: never;
|
|
209
|
+
reviewedProposalId?: never;
|
|
210
|
+
diff?: never;
|
|
211
|
+
coverage?: never;
|
|
212
|
+
kind: string;
|
|
213
|
+
operationId: string;
|
|
214
|
+
stage: "applied" | "applying" | "completed" | "forked" | "forking" | "prepared";
|
|
215
|
+
forkSessionId: string | undefined;
|
|
216
|
+
session?: never;
|
|
217
|
+
} | {
|
|
218
|
+
checkpoints?: never;
|
|
219
|
+
restores?: never;
|
|
220
|
+
inspection?: never;
|
|
221
|
+
reviewedProposalId?: never;
|
|
222
|
+
diff?: never;
|
|
223
|
+
coverage?: never;
|
|
224
|
+
forkSessionId?: never;
|
|
225
|
+
kind: string;
|
|
226
|
+
operationId: string;
|
|
227
|
+
stage: "applied" | "applying" | "completed" | "forked" | "forking" | "prepared";
|
|
228
|
+
session: CliSession;
|
|
229
|
+
}>;
|
|
230
|
+
export declare function manageCheckpoints(options: CliOptions): Promise<CliSession | undefined>;
|
|
@@ -7,10 +7,12 @@ export declare const MAX_CLI_PROFILE_BYTES: number;
|
|
|
7
7
|
export declare const cliProfileSchema: z.ZodObject<{
|
|
8
8
|
schemaVersion: z.ZodLiteral<1>;
|
|
9
9
|
provider: z.ZodEnum<{
|
|
10
|
+
anthropic: "anthropic";
|
|
10
11
|
gemini: "gemini";
|
|
11
12
|
meta: "meta";
|
|
12
13
|
openai: "openai";
|
|
13
14
|
qwen: "qwen";
|
|
15
|
+
vertex: "vertex";
|
|
14
16
|
}>;
|
|
15
17
|
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
16
18
|
default: "default";
|
|
@@ -42,7 +44,7 @@ export declare const createCliProfile: (name: string, input: {
|
|
|
42
44
|
path: string;
|
|
43
45
|
profile: {
|
|
44
46
|
schemaVersion: 1;
|
|
45
|
-
provider: "gemini" | "meta" | "openai" | "qwen";
|
|
47
|
+
provider: "anthropic" | "gemini" | "meta" | "openai" | "qwen" | "vertex";
|
|
46
48
|
reasoningEffort?: "default" | "high" | "low" | "max" | "medium" | "minimal" | "none" | "xhigh" | undefined;
|
|
47
49
|
model: string;
|
|
48
50
|
};
|
|
@@ -56,7 +58,7 @@ export declare const updateCliProfile: (name: string, input: {
|
|
|
56
58
|
path: string;
|
|
57
59
|
profile: {
|
|
58
60
|
schemaVersion: 1;
|
|
59
|
-
provider: "gemini" | "meta" | "openai" | "qwen";
|
|
61
|
+
provider: "anthropic" | "gemini" | "meta" | "openai" | "qwen" | "vertex";
|
|
60
62
|
reasoningEffort?: "default" | "high" | "low" | "max" | "medium" | "minimal" | "none" | "xhigh" | undefined;
|
|
61
63
|
model: string;
|
|
62
64
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AgentRunStore } from '@zhivex-ai/core';
|
|
2
|
+
import type { HarnessConfig } from '../runtime/config.js';
|
|
3
|
+
import type { CliOptions } from './arguments.js';
|
|
4
|
+
/** Provider-free report command; the optional envelope is bounded data, never a command. */
|
|
5
|
+
export declare function governanceReportCli(options: CliOptions, config: HarnessConfig, store: AgentRunStore): Promise<string>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type HarnessPolicyDecisionEvent, type PolicyDecisionEvidence } from '../runtime/policy-decisions.js';
|
|
2
|
+
export declare const formatPolicyDecision: (event: HarnessPolicyDecisionEvent) => string;
|
|
3
|
+
export declare function observeCliPolicy<T>(options: {
|
|
4
|
+
json?: boolean;
|
|
5
|
+
jsonl?: boolean;
|
|
6
|
+
}, tracker: {
|
|
7
|
+
sequence?: number;
|
|
8
|
+
policyEvidence?: PolicyDecisionEvidence;
|
|
9
|
+
}, work: () => Promise<T>): Promise<T>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type HarnessPolicyInspection } from '../runtime/policy-inspection.js';
|
|
2
|
+
import type { CliOptions } from './arguments.js';
|
|
3
|
+
export declare function formatPolicyInspection(policy: HarnessPolicyInspection): string;
|
|
4
|
+
export declare function printPolicyInspection(policy: HarnessPolicyInspection, json: boolean | undefined): void;
|
|
5
|
+
export declare function inspectCliPolicy(options: CliOptions): Promise<void>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PolicyDecisionEvidence } from "../runtime/policy-decisions.js";
|
|
1
2
|
import type { ActivityHistory } from "./terminal/activity-history.js";
|
|
2
3
|
import { TerminalMarkdown } from "./terminal/terminal-markdown.js";
|
|
3
4
|
import { type AgentApprovalRequest, type AgentApprovalResponse, type AgentRunOutput, type AgentStreamEvent } from "@zhivex-ai/agents";
|
|
@@ -13,11 +14,12 @@ export declare const terminalApprovalResolver: (automaticallyApprove: boolean |
|
|
|
13
14
|
select: import("./cli-credentials.js").CredentialInput["select"];
|
|
14
15
|
workspace: string;
|
|
15
16
|
sessionGrants?: Set<string>;
|
|
16
|
-
}) => NonNullable<HarnessRunOptions["resolveApprovals"]>;
|
|
17
|
+
}, reviewHost?: ZhivexHarness) => NonNullable<HarnessRunOptions["resolveApprovals"]>;
|
|
17
18
|
export declare const printTerminalResult: (result: AgentRunOutput, harness: ZhivexHarness, output: Pick<CliOptions, "json" | "jsonl">, tracker: {
|
|
18
19
|
streamedText: boolean;
|
|
19
20
|
sequence?: number;
|
|
20
21
|
markdown?: TerminalMarkdown;
|
|
22
|
+
policyEvidence?: PolicyDecisionEvidence;
|
|
21
23
|
}) => void;
|
|
22
24
|
export declare const flushToolActivity: (tracker: object) => void | undefined;
|
|
23
25
|
export declare const streamSink: (output: Pick<CliOptions, "json" | "jsonl">, tracker: {
|
|
@@ -25,6 +25,10 @@ export interface TerminalApprovalResolverOptions {
|
|
|
25
25
|
maxSummaryCharacters?: number;
|
|
26
26
|
approvedReason?: string;
|
|
27
27
|
deniedReason?: string;
|
|
28
|
+
/** Host policy: complete bounded payload, no cached session grants. */
|
|
29
|
+
requireCompleteReview?: boolean;
|
|
30
|
+
/** Host-only observation; never determines approval or grants explicit review. */
|
|
31
|
+
onDecisionOrigin?: (origin: 'interactive' | 'automatic') => void;
|
|
28
32
|
}
|
|
29
33
|
/**
|
|
30
34
|
* Resolve approvals one at a time. Returning undefined deliberately leaves the
|