@zhivex-ai/harness 1.2.0 → 1.3.0-rc.7
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 +64 -0
- package/README.md +9 -10
- package/contracts/engine-api.json +2921 -0
- package/contracts/public-api.json +267 -1
- package/contracts/stable-api-signatures.json +43 -43
- package/dist/acp-cli.js +137 -15002
- 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-options.d.ts +2 -41
- package/dist/cli/cli-profiles.d.ts +4 -2
- package/dist/cli/cli-stream.d.ts +2 -167
- 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/run-document.d.ts +2 -91
- package/dist/cli/terminal/terminal-continuation.d.ts +2 -3
- package/dist/cli/terminal/terminal-ui.d.ts +4 -0
- package/dist/{cli-entry-c2f58zj2.js → cli-entry-ae7x44d4.js} +14969 -10731
- package/dist/{cli-entry-427869g9.js → cli-entry-d5788aay.js} +388 -47
- package/dist/cli-entry-ev76ezcd.js +656 -0
- package/dist/{cli-3jmy4h5h.js → cli-t7hrhayq.js} +918 -2223
- 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/continuation.d.ts +3 -0
- 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/run-document.d.ts +91 -0
- package/dist/client/service-events.d.ts +4 -0
- package/dist/client/stream.d.ts +167 -0
- package/dist/compat/cli-options.d.ts +53 -0
- package/dist/compat/code-support.d.ts +22 -0
- package/dist/compat/code-support.js +74 -0
- package/dist/{config-1k9t4jhh.js → config-c002f06f.js} +1 -1
- package/dist/config-j3jga5wh.js +61 -0
- 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 +6 -0
- package/dist/engine/acp.js +205 -0
- package/dist/engine/client.d.ts +6 -0
- package/dist/engine/client.js +28 -0
- 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 +73 -0
- package/dist/engine/index.js +977 -0
- 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 +7 -0
- package/dist/engine/protocol.js +182 -0
- package/dist/engine/service.d.ts +5 -0
- package/dist/engine/service.js +28 -0
- 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 +3368 -1304
- package/dist/index-1bx83sw4.js +4 -0
- package/dist/index-2gz7jv7g.js +549 -0
- package/dist/{cli-entry-b1mfvmxe.js → index-2jrdcj6b.js} +72 -115
- package/dist/index-3ah1f369.js +356 -0
- package/dist/index-42gp2hy8.js +1555 -0
- package/dist/index-4jw3tvy8.js +301 -0
- package/dist/index-8705zxpr.js +145 -0
- package/dist/index-8vm2m34s.js +2080 -0
- package/dist/index-8zzhggxv.js +477 -0
- package/dist/index-a97bezbz.js +1073 -0
- package/dist/index-gq9xagx2.js +1343 -0
- package/dist/index-h0mqx2ed.js +1373 -0
- package/dist/index-jgrx804e.js +5589 -0
- package/dist/index-qfpz5y2v.js +174 -0
- package/dist/index-t60rva31.js +1004 -0
- 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-z4e8d0ph.js +1768 -0
- package/dist/index.js +251 -18649
- 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 +19 -14504
- package/dist/{service-client-cli-yx56n0hc.js → service-client-cli-kns4mf57.js} +307 -248
- package/dist/verify-historical-migrations.js +3314 -1251
- 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 +93 -0
- package/docs/ENGINE_API.md +319 -0
- 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 +6 -0
- package/docs/STABILITY.md +9 -1
- 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 +64 -1
- package/evaluations/task-acceptance-routes.json +7 -0
- package/examples/README.md +1 -1
- package/package.json +74 -12
- package/dist/cli-entry-64pdp3k5.js +0 -17
|
@@ -8,13 +8,16 @@ import {
|
|
|
8
8
|
formatAppliedFiles,
|
|
9
9
|
formatConsoleHelp,
|
|
10
10
|
formatConsoleWelcome,
|
|
11
|
+
formatPolicyDecision,
|
|
12
|
+
harnessPolicyDecisionEventSchema,
|
|
11
13
|
navigateConsole,
|
|
14
|
+
printPolicyInspection,
|
|
12
15
|
sanitizeTerminalText,
|
|
13
16
|
serializeStreamResult
|
|
14
|
-
} from "./cli-entry-
|
|
17
|
+
} from "./cli-entry-ae7x44d4.js";
|
|
15
18
|
import {
|
|
16
19
|
HARNESS_VERSION
|
|
17
|
-
} from "./cli-entry-
|
|
20
|
+
} from "./cli-entry-ev76ezcd.js";
|
|
18
21
|
import {
|
|
19
22
|
HARNESS_ERROR_CODES,
|
|
20
23
|
HARNESS_ERROR_SCHEMA_VERSION,
|
|
@@ -22,7 +25,7 @@ import {
|
|
|
22
25
|
HarnessStateConflictError,
|
|
23
26
|
PROVIDERS,
|
|
24
27
|
reasoningEffortSchema
|
|
25
|
-
} from "./cli-entry-
|
|
28
|
+
} from "./cli-entry-d5788aay.js";
|
|
26
29
|
import {
|
|
27
30
|
__require
|
|
28
31
|
} from "./cli-entry-1bx83sw4.js";
|
|
@@ -35,7 +38,7 @@ import { setTimeout as delay } from "node:timers/promises";
|
|
|
35
38
|
import { createServer, request as httpRequest } from "node:http";
|
|
36
39
|
import { mkdir, lstat, realpath, open, unlink, chmod } from "node:fs/promises";
|
|
37
40
|
import path from "node:path";
|
|
38
|
-
import { z as
|
|
41
|
+
import { z as z4 } from "zod";
|
|
39
42
|
|
|
40
43
|
// src/client/protocol.ts
|
|
41
44
|
import { z } from "zod";
|
|
@@ -46,12 +49,36 @@ var scoped = { projectId: id };
|
|
|
46
49
|
var session = { ...scoped, sessionId: id };
|
|
47
50
|
var run = { ...session, runId: id };
|
|
48
51
|
var mutation = { idempotencyKey: id };
|
|
52
|
+
var checkpoint = { ...session, checkpointId: z.string().uuid() };
|
|
53
|
+
var restore = { ...session, operationId: z.string().uuid() };
|
|
54
|
+
var fileDigest = z.string().regex(/^sha256:[a-f0-9]{64}$/);
|
|
49
55
|
var harnessClientCommandSchema = z.discriminatedUnion("method", [
|
|
50
56
|
z.object({ method: z.literal("project.get"), ...scoped }).strict(),
|
|
57
|
+
z.object({ method: z.literal("policy.get"), ...scoped }).strict(),
|
|
51
58
|
z.object({ method: z.literal("session.list"), ...scoped, search: z.string().max(256).optional() }).strict(),
|
|
52
59
|
z.object({ method: z.literal("session.create"), ...scoped, ...mutation, title: z.string().max(256).optional() }).strict(),
|
|
53
60
|
z.object({ method: z.literal("session.get"), ...session }).strict(),
|
|
54
61
|
z.object({ method: z.literal("session.rename"), ...session, ...mutation, expectedRevision: revision, title: z.string().max(256) }).strict(),
|
|
62
|
+
z.object({ method: z.literal("checkpoint.list"), ...session }).strict(),
|
|
63
|
+
z.object({ method: z.literal("checkpoint.inspect"), ...checkpoint }).strict(),
|
|
64
|
+
z.object({
|
|
65
|
+
method: z.literal("checkpoint.capture"),
|
|
66
|
+
...session,
|
|
67
|
+
...mutation,
|
|
68
|
+
expectedRevision: revision,
|
|
69
|
+
turnId: id,
|
|
70
|
+
paths: z.array(z.string().min(1).max(1024)).min(1).max(20)
|
|
71
|
+
}).strict(),
|
|
72
|
+
z.object({
|
|
73
|
+
method: z.literal("restore.prepare"),
|
|
74
|
+
...checkpoint,
|
|
75
|
+
...mutation,
|
|
76
|
+
expectedRevision: revision,
|
|
77
|
+
expected: z.record(z.string().min(1).max(1024), fileDigest).refine((value) => Object.keys(value).length >= 1 && Object.keys(value).length <= 20)
|
|
78
|
+
}).strict(),
|
|
79
|
+
z.object({ method: z.literal("restore.get"), ...restore }).strict(),
|
|
80
|
+
z.object({ method: z.literal("restore.apply"), ...restore, ...mutation, expectedRevision: revision, reviewedProposalId: fileDigest }).strict(),
|
|
81
|
+
z.object({ method: z.literal("restore.recoverFork"), ...restore, ...mutation, expectedRevision: revision, forkSessionId: id }).strict(),
|
|
55
82
|
z.object({ method: z.literal("run.start"), ...session, ...mutation, expectedRevision: revision, prompt: z.string().min(1).max(64 * 1024) }).strict(),
|
|
56
83
|
z.object({ method: z.literal("run.get"), ...run, includeReview: z.boolean().optional(), includeDiff: z.boolean().optional(), decisionOffset: z.number().int().min(0).max(512).optional() }).strict(),
|
|
57
84
|
z.object({
|
|
@@ -70,26 +97,19 @@ var harnessClientRequestSchema = z.object({
|
|
|
70
97
|
command: harnessClientCommandSchema
|
|
71
98
|
}).strict();
|
|
72
99
|
|
|
73
|
-
// src/approvals/approval-history.ts
|
|
74
|
-
import { z as z2 } from "zod";
|
|
75
|
-
var rowSchema = z2.object({ approvalId: z2.string().max(256), digest: z2.string().regex(/^[a-f0-9]{64}$/), toolCallId: z2.string().max(256).optional(), name: z2.string().max(256), inputDigest: z2.string().regex(/^[a-f0-9]{64}$/).optional(), approved: z2.boolean(), decidedAt: z2.number().int().nonnegative(), reviewedRevision: z2.number().int().nonnegative() }).strict();
|
|
76
|
-
|
|
77
100
|
// src/approvals/approval-diff.ts
|
|
78
|
-
import { z as
|
|
79
|
-
var sha =
|
|
80
|
-
var file =
|
|
81
|
-
var archive =
|
|
82
|
-
var archives =
|
|
101
|
+
import { z as z2 } from "zod";
|
|
102
|
+
var sha = z2.string().regex(/^sha256:[a-f0-9]{64}$/);
|
|
103
|
+
var file = z2.object({ path: z2.string().max(1024), expectedDigest: sha.nullable(), before: z2.string().nullable(), after: z2.string().nullable(), afterDigest: sha.nullable(), beforeMode: z2.number().int().optional(), afterMode: z2.number().int().optional(), operation: z2.enum(["create", "update", "delete"]).optional() }).strict();
|
|
104
|
+
var archive = z2.object({ approvalId: z2.string().max(256), digest: z2.string().regex(/^[a-f0-9]{64}$/), proposalId: sha, files: z2.array(file).min(1).max(50) }).strict();
|
|
105
|
+
var archives = z2.array(archive).max(512);
|
|
83
106
|
var maxBytes = 2 * 1024 * 1024;
|
|
84
107
|
|
|
85
108
|
// src/approvals/approval-preview.ts
|
|
86
|
-
import { z as
|
|
87
|
-
|
|
88
|
-
// src/client/service-events.ts
|
|
89
|
-
import { createRedactionPolicy } from "@zhivex-ai/agents";
|
|
109
|
+
import { z as z3 } from "zod";
|
|
90
110
|
|
|
91
111
|
// src/client/local-service.ts
|
|
92
|
-
var harnessLocalCredentialsSchema =
|
|
112
|
+
var harnessLocalCredentialsSchema = z4.object({ schemaVersion: z4.literal(1), socketPath: z4.string().min(1), token: z4.string().regex(/^[a-f0-9]{64}$/) }).strict();
|
|
93
113
|
var readHarnessLocalCredentials = async (filename) => {
|
|
94
114
|
const { constants } = await import("node:fs");
|
|
95
115
|
const file2 = await open(filename, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
@@ -141,26 +161,26 @@ var requestHarnessLocalService = async (credentials, endpoint, payload) => {
|
|
|
141
161
|
};
|
|
142
162
|
|
|
143
163
|
// src/client/json-contracts.ts
|
|
144
|
-
import { z as
|
|
145
|
-
var observationalDocument = (shape) =>
|
|
146
|
-
var jsonBase = { schemaVersion:
|
|
164
|
+
import { z as z5 } from "zod";
|
|
165
|
+
var observationalDocument = (shape) => z5.object(shape).passthrough();
|
|
166
|
+
var jsonBase = { schemaVersion: z5.literal(CLI_JSON_SCHEMA_VERSION) };
|
|
147
167
|
var eventBase = {
|
|
148
|
-
schemaVersion:
|
|
149
|
-
sequence:
|
|
168
|
+
schemaVersion: z5.literal(CLI_EVENT_SCHEMA_VERSION),
|
|
169
|
+
sequence: z5.number().int().nonnegative()
|
|
150
170
|
};
|
|
151
|
-
var nonnegativeInteger =
|
|
152
|
-
var digestSchema =
|
|
171
|
+
var nonnegativeInteger = z5.number().int().nonnegative();
|
|
172
|
+
var digestSchema = z5.string().regex(/^sha256:[a-f0-9]{64}$/);
|
|
153
173
|
var jsonObjectSchema = observationalDocument({});
|
|
154
174
|
var scopeSchema = observationalDocument({
|
|
155
|
-
tenantId:
|
|
156
|
-
userId:
|
|
157
|
-
namespace:
|
|
175
|
+
tenantId: z5.string().min(1),
|
|
176
|
+
userId: z5.string().min(1).optional(),
|
|
177
|
+
namespace: z5.string().min(1).optional()
|
|
158
178
|
});
|
|
159
179
|
var runIdentity = {
|
|
160
|
-
runId:
|
|
161
|
-
status:
|
|
162
|
-
provider:
|
|
163
|
-
model:
|
|
180
|
+
runId: z5.string().min(1),
|
|
181
|
+
status: z5.string().min(1),
|
|
182
|
+
provider: z5.string().min(1),
|
|
183
|
+
model: z5.string().min(1)
|
|
164
184
|
};
|
|
165
185
|
var runSummarySchema = observationalDocument({
|
|
166
186
|
...runIdentity,
|
|
@@ -176,24 +196,24 @@ var runSummarySchema = observationalDocument({
|
|
|
176
196
|
updatedAt: nonnegativeInteger
|
|
177
197
|
});
|
|
178
198
|
var sessionRunSchema = observationalDocument({
|
|
179
|
-
turnId:
|
|
199
|
+
turnId: z5.string().min(1),
|
|
180
200
|
sequence: nonnegativeInteger,
|
|
181
|
-
runId:
|
|
182
|
-
provider:
|
|
183
|
-
model:
|
|
184
|
-
status:
|
|
201
|
+
runId: z5.string().min(1),
|
|
202
|
+
provider: z5.string().min(1),
|
|
203
|
+
model: z5.string().min(1),
|
|
204
|
+
status: z5.string().min(1),
|
|
185
205
|
createdAt: nonnegativeInteger,
|
|
186
206
|
updatedAt: nonnegativeInteger
|
|
187
207
|
});
|
|
188
208
|
var sessionSchema = observationalDocument({
|
|
189
|
-
schemaVersion:
|
|
190
|
-
sessionId:
|
|
191
|
-
workspaceKey:
|
|
192
|
-
scopeKey:
|
|
209
|
+
schemaVersion: z5.literal(1),
|
|
210
|
+
sessionId: z5.string().min(1),
|
|
211
|
+
workspaceKey: z5.string().min(1),
|
|
212
|
+
scopeKey: z5.string().min(1),
|
|
193
213
|
revision: nonnegativeInteger,
|
|
194
214
|
createdAt: nonnegativeInteger,
|
|
195
215
|
updatedAt: nonnegativeInteger,
|
|
196
|
-
runs:
|
|
216
|
+
runs: z5.array(sessionRunSchema)
|
|
197
217
|
});
|
|
198
218
|
var tokenUsageSchema = observationalDocument({
|
|
199
219
|
inputTokens: nonnegativeInteger.optional(),
|
|
@@ -202,17 +222,17 @@ var tokenUsageSchema = observationalDocument({
|
|
|
202
222
|
outputTokens: nonnegativeInteger.optional(),
|
|
203
223
|
reasoningTokens: nonnegativeInteger.optional(),
|
|
204
224
|
totalTokens: nonnegativeInteger.optional(),
|
|
205
|
-
speed:
|
|
225
|
+
speed: z5.enum(["standard", "fast"]).optional()
|
|
206
226
|
});
|
|
207
227
|
var budgetConfigSchema = observationalDocument({
|
|
208
|
-
unlimitedTokens:
|
|
228
|
+
unlimitedTokens: z5.boolean().optional(),
|
|
209
229
|
maxSteps: nonnegativeInteger,
|
|
210
230
|
maxToolCalls: nonnegativeInteger,
|
|
211
231
|
maxToolErrors: nonnegativeInteger,
|
|
212
232
|
maxInputTokens: nonnegativeInteger,
|
|
213
233
|
maxOutputTokens: nonnegativeInteger,
|
|
214
234
|
maxTotalTokens: nonnegativeInteger,
|
|
215
|
-
includeChildRuns:
|
|
235
|
+
includeChildRuns: z5.boolean()
|
|
216
236
|
});
|
|
217
237
|
var budgetConsumptionSchema = observationalDocument({
|
|
218
238
|
steps: nonnegativeInteger,
|
|
@@ -233,117 +253,117 @@ var budgetRemainingSchema = observationalDocument({
|
|
|
233
253
|
var budgetStatusSchema = observationalDocument({
|
|
234
254
|
consumption: budgetConsumptionSchema,
|
|
235
255
|
remaining: budgetRemainingSchema,
|
|
236
|
-
includeChildRuns:
|
|
256
|
+
includeChildRuns: z5.boolean()
|
|
237
257
|
});
|
|
238
258
|
var costEstimateSchema = observationalDocument({
|
|
239
|
-
inputCost:
|
|
240
|
-
outputCost:
|
|
241
|
-
totalCost:
|
|
242
|
-
currency:
|
|
259
|
+
inputCost: z5.number().nonnegative().optional(),
|
|
260
|
+
outputCost: z5.number().nonnegative().optional(),
|
|
261
|
+
totalCost: z5.number().nonnegative().optional(),
|
|
262
|
+
currency: z5.string().min(1).optional(),
|
|
243
263
|
usage: tokenUsageSchema.optional()
|
|
244
264
|
});
|
|
245
265
|
var mutationAuditSchema = observationalDocument({
|
|
246
|
-
id:
|
|
247
|
-
operation:
|
|
248
|
-
path:
|
|
249
|
-
destination:
|
|
266
|
+
id: z5.string().min(1),
|
|
267
|
+
operation: z5.enum(["create", "update", "move", "quarantine", "restore"]),
|
|
268
|
+
path: z5.string().min(1),
|
|
269
|
+
destination: z5.string().min(1).optional(),
|
|
250
270
|
beforeDigest: digestSchema.optional(),
|
|
251
271
|
afterDigest: digestSchema.optional(),
|
|
252
|
-
timestamp:
|
|
253
|
-
quarantineId:
|
|
272
|
+
timestamp: z5.iso.datetime(),
|
|
273
|
+
quarantineId: z5.string().min(1).optional()
|
|
254
274
|
});
|
|
255
275
|
var approvalSummarySchema = observationalDocument({
|
|
256
|
-
id:
|
|
257
|
-
kind:
|
|
258
|
-
name:
|
|
259
|
-
arguments:
|
|
260
|
-
childRunId:
|
|
261
|
-
childAgentId:
|
|
276
|
+
id: z5.string().min(1),
|
|
277
|
+
kind: z5.string().min(1),
|
|
278
|
+
name: z5.string().min(1),
|
|
279
|
+
arguments: z5.json(),
|
|
280
|
+
childRunId: z5.string().min(1).optional(),
|
|
281
|
+
childAgentId: z5.string().min(1).optional()
|
|
262
282
|
});
|
|
263
283
|
var childRunSummarySchema = observationalDocument({
|
|
264
|
-
runId:
|
|
265
|
-
agentId:
|
|
266
|
-
toolName:
|
|
267
|
-
status:
|
|
284
|
+
runId: z5.string().min(1),
|
|
285
|
+
agentId: z5.string().min(1).optional(),
|
|
286
|
+
toolName: z5.string().min(1).optional(),
|
|
287
|
+
status: z5.string().min(1),
|
|
268
288
|
steps: nonnegativeInteger,
|
|
269
289
|
toolCalls: nonnegativeInteger,
|
|
270
290
|
toolErrors: nonnegativeInteger,
|
|
271
291
|
usage: tokenUsageSchema.optional()
|
|
272
292
|
});
|
|
273
293
|
var capabilityReportSchema = observationalDocument({
|
|
274
|
-
provider:
|
|
275
|
-
model:
|
|
276
|
-
supportTier:
|
|
294
|
+
provider: z5.string().min(1),
|
|
295
|
+
model: z5.string().min(1),
|
|
296
|
+
supportTier: z5.string().min(1).optional(),
|
|
277
297
|
capabilities: observationalDocument({
|
|
278
|
-
streaming:
|
|
279
|
-
tools:
|
|
280
|
-
"structured-output":
|
|
281
|
-
"parallel-tools":
|
|
282
|
-
reasoning:
|
|
283
|
-
"web-search":
|
|
298
|
+
streaming: z5.boolean(),
|
|
299
|
+
tools: z5.boolean(),
|
|
300
|
+
"structured-output": z5.boolean(),
|
|
301
|
+
"parallel-tools": z5.boolean(),
|
|
302
|
+
reasoning: z5.boolean(),
|
|
303
|
+
"web-search": z5.boolean()
|
|
284
304
|
})
|
|
285
305
|
});
|
|
286
|
-
var providerConfigurationSchema =
|
|
287
|
-
customEndpoint:
|
|
288
|
-
endpointValid:
|
|
289
|
-
endpointSecure:
|
|
290
|
-
}).catchall(
|
|
306
|
+
var providerConfigurationSchema = z5.object({
|
|
307
|
+
customEndpoint: z5.boolean(),
|
|
308
|
+
endpointValid: z5.boolean(),
|
|
309
|
+
endpointSecure: z5.boolean()
|
|
310
|
+
}).catchall(z5.boolean());
|
|
291
311
|
var providerAvailabilitySchema = observationalDocument({
|
|
292
|
-
id:
|
|
293
|
-
name:
|
|
294
|
-
defaultModel:
|
|
295
|
-
credentialNames:
|
|
296
|
-
capabilities:
|
|
297
|
-
support:
|
|
298
|
-
configured:
|
|
299
|
-
credentials:
|
|
300
|
-
name:
|
|
301
|
-
present:
|
|
312
|
+
id: z5.string().min(1),
|
|
313
|
+
name: z5.string().min(1),
|
|
314
|
+
defaultModel: z5.string().min(1),
|
|
315
|
+
credentialNames: z5.array(z5.string().min(1)),
|
|
316
|
+
capabilities: z5.array(z5.enum(["streaming", "tool-calling", "approval-resume"])),
|
|
317
|
+
support: z5.enum(["certified", "provisional"]),
|
|
318
|
+
configured: z5.boolean(),
|
|
319
|
+
credentials: z5.array(observationalDocument({
|
|
320
|
+
name: z5.string().min(1),
|
|
321
|
+
present: z5.boolean()
|
|
302
322
|
})),
|
|
303
323
|
configuration: providerConfigurationSchema
|
|
304
324
|
});
|
|
305
325
|
var orchestrationConfigSchema = observationalDocument({
|
|
306
|
-
profiles:
|
|
326
|
+
profiles: z5.array(z5.enum(["explorer", "implementer", "tester", "reviewer"])),
|
|
307
327
|
childBudget: budgetConfigSchema,
|
|
308
328
|
childTimeoutMs: nonnegativeInteger,
|
|
309
329
|
maxParallelReviews: nonnegativeInteger
|
|
310
330
|
});
|
|
311
|
-
var executionConfigSchema =
|
|
312
|
-
observationalDocument({ backend:
|
|
331
|
+
var executionConfigSchema = z5.discriminatedUnion("backend", [
|
|
332
|
+
observationalDocument({ backend: z5.literal("none") }),
|
|
313
333
|
observationalDocument({
|
|
314
|
-
backend:
|
|
315
|
-
policyVersion:
|
|
316
|
-
runtime:
|
|
317
|
-
image:
|
|
318
|
-
allowedCommands:
|
|
319
|
-
shellMode:
|
|
334
|
+
backend: z5.literal("oci"),
|
|
335
|
+
policyVersion: z5.string().min(1),
|
|
336
|
+
runtime: z5.enum(["docker", "podman"]),
|
|
337
|
+
image: z5.string().min(1),
|
|
338
|
+
allowedCommands: z5.array(z5.string().min(1)),
|
|
339
|
+
shellMode: z5.enum(["deny", "ask"]),
|
|
320
340
|
maxProcessRuntimeMs: nonnegativeInteger,
|
|
321
341
|
maxProcessOutputBytes: nonnegativeInteger,
|
|
322
342
|
maxMemoryMb: nonnegativeInteger,
|
|
323
343
|
maxPids: nonnegativeInteger,
|
|
324
|
-
maxCpus:
|
|
344
|
+
maxCpus: z5.number().positive(),
|
|
325
345
|
maxWorkspaceBytes: nonnegativeInteger,
|
|
326
346
|
maxFileWriteBytes: nonnegativeInteger,
|
|
327
347
|
tmpfsMb: nonnegativeInteger
|
|
328
348
|
})
|
|
329
349
|
]);
|
|
330
350
|
var executionBindingSchema = observationalDocument({
|
|
331
|
-
environmentId:
|
|
332
|
-
environmentVersion:
|
|
333
|
-
fingerprint:
|
|
334
|
-
workspaceId:
|
|
351
|
+
environmentId: z5.string().min(1),
|
|
352
|
+
environmentVersion: z5.string().min(1).optional(),
|
|
353
|
+
fingerprint: z5.string().min(1),
|
|
354
|
+
workspaceId: z5.string().min(1).optional()
|
|
335
355
|
});
|
|
336
356
|
var ociImageSchema = observationalDocument({
|
|
337
|
-
runtime:
|
|
338
|
-
runtimeVersion:
|
|
339
|
-
imageReference:
|
|
340
|
-
imageId:
|
|
341
|
-
imageDigest:
|
|
357
|
+
runtime: z5.enum(["docker", "podman"]),
|
|
358
|
+
runtimeVersion: z5.string().min(1),
|
|
359
|
+
imageReference: z5.string().min(1),
|
|
360
|
+
imageId: z5.string().min(1),
|
|
361
|
+
imageDigest: z5.string().min(1)
|
|
342
362
|
});
|
|
343
|
-
var runExecutionSchema =
|
|
344
|
-
observationalDocument({ backend:
|
|
363
|
+
var runExecutionSchema = z5.discriminatedUnion("backend", [
|
|
364
|
+
observationalDocument({ backend: z5.literal("none") }),
|
|
345
365
|
observationalDocument({
|
|
346
|
-
backend:
|
|
366
|
+
backend: z5.literal("oci"),
|
|
347
367
|
binding: executionBindingSchema,
|
|
348
368
|
image: ociImageSchema
|
|
349
369
|
})
|
|
@@ -354,44 +374,44 @@ var migrationResultSchema = observationalDocument({
|
|
|
354
374
|
migratedToolCalls: nonnegativeInteger
|
|
355
375
|
});
|
|
356
376
|
var runStoreSchema = observationalDocument({
|
|
357
|
-
backend:
|
|
358
|
-
stateDirectory:
|
|
377
|
+
backend: z5.enum(["sqlite", "file"]),
|
|
378
|
+
stateDirectory: z5.string().min(1),
|
|
359
379
|
migration: migrationResultSchema.optional()
|
|
360
380
|
});
|
|
361
381
|
var doctorCheckSchema = observationalDocument({
|
|
362
|
-
id:
|
|
363
|
-
status:
|
|
364
|
-
message:
|
|
365
|
-
details:
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
382
|
+
id: z5.string().min(1),
|
|
383
|
+
status: z5.enum(["pass", "warn", "fail"]),
|
|
384
|
+
message: z5.string(),
|
|
385
|
+
details: z5.record(z5.string(), z5.union([
|
|
386
|
+
z5.boolean(),
|
|
387
|
+
z5.number(),
|
|
388
|
+
z5.string(),
|
|
389
|
+
z5.array(z5.string())
|
|
370
390
|
]))
|
|
371
391
|
});
|
|
372
392
|
var doctorConfigurationSchema = observationalDocument({
|
|
373
|
-
requireVerifiedDelivery:
|
|
374
|
-
provider:
|
|
375
|
-
model:
|
|
376
|
-
workspace:
|
|
377
|
-
stateDirectory:
|
|
378
|
-
storeBackend:
|
|
393
|
+
requireVerifiedDelivery: z5.boolean().optional(),
|
|
394
|
+
provider: z5.string().min(1),
|
|
395
|
+
model: z5.string().min(1),
|
|
396
|
+
workspace: z5.string().min(1),
|
|
397
|
+
stateDirectory: z5.string().min(1),
|
|
398
|
+
storeBackend: z5.enum(["sqlite", "file"]),
|
|
379
399
|
scope: scopeSchema,
|
|
380
400
|
maxSteps: nonnegativeInteger,
|
|
381
401
|
timeoutMs: nonnegativeInteger,
|
|
382
402
|
budget: budgetConfigSchema,
|
|
383
403
|
costBudget: observationalDocument({
|
|
384
|
-
maxCostUsd:
|
|
385
|
-
inputCostPer1kTokens:
|
|
386
|
-
outputCostPer1kTokens:
|
|
404
|
+
maxCostUsd: z5.number().nonnegative(),
|
|
405
|
+
inputCostPer1kTokens: z5.number().nonnegative(),
|
|
406
|
+
outputCostPer1kTokens: z5.number().nonnegative()
|
|
387
407
|
}).optional(),
|
|
388
408
|
compaction: observationalDocument({
|
|
389
409
|
maxMessages: nonnegativeInteger,
|
|
390
410
|
maxEstimatedInputTokens: nonnegativeInteger,
|
|
391
411
|
keepRecentMessages: nonnegativeInteger
|
|
392
412
|
}),
|
|
393
|
-
allowedChecks:
|
|
394
|
-
requiredCapabilities:
|
|
413
|
+
allowedChecks: z5.array(z5.string().min(1)),
|
|
414
|
+
requiredCapabilities: z5.array(z5.enum([
|
|
395
415
|
"streaming",
|
|
396
416
|
"tools",
|
|
397
417
|
"structured-output",
|
|
@@ -400,24 +420,24 @@ var doctorConfigurationSchema = observationalDocument({
|
|
|
400
420
|
"web-search"
|
|
401
421
|
])),
|
|
402
422
|
orchestration: orchestrationConfigSchema,
|
|
403
|
-
context: observationalDocument({ enabled:
|
|
423
|
+
context: observationalDocument({ enabled: z5.boolean(), configPath: z5.string().min(1) }),
|
|
404
424
|
execution: executionConfigSchema,
|
|
405
|
-
mcpConfigPath:
|
|
425
|
+
mcpConfigPath: z5.string().min(1).optional()
|
|
406
426
|
});
|
|
407
427
|
var cliRunResultDocumentSchema = observationalDocument({
|
|
408
428
|
...jsonBase,
|
|
409
|
-
kind:
|
|
429
|
+
kind: z5.literal("run-result"),
|
|
410
430
|
...runIdentity,
|
|
411
|
-
output:
|
|
431
|
+
output: z5.string(),
|
|
412
432
|
steps: nonnegativeInteger,
|
|
413
433
|
toolCalls: nonnegativeInteger,
|
|
414
|
-
mutations:
|
|
415
|
-
pendingApprovals:
|
|
416
|
-
children:
|
|
434
|
+
mutations: z5.array(mutationAuditSchema),
|
|
435
|
+
pendingApprovals: z5.array(approvalSummarySchema),
|
|
436
|
+
children: z5.array(childRunSummarySchema),
|
|
417
437
|
usage: tokenUsageSchema.optional(),
|
|
418
438
|
budget: budgetStatusSchema,
|
|
419
439
|
costBudget: observationalDocument({
|
|
420
|
-
limitUsd:
|
|
440
|
+
limitUsd: z5.number().nonnegative(),
|
|
421
441
|
estimate: costEstimateSchema
|
|
422
442
|
}).optional(),
|
|
423
443
|
scope: scopeSchema,
|
|
@@ -425,65 +445,65 @@ var cliRunResultDocumentSchema = observationalDocument({
|
|
|
425
445
|
orchestration: observationalDocument({
|
|
426
446
|
profiles: orchestrationConfigSchema.shape.profiles,
|
|
427
447
|
childBudget: budgetConfigSchema,
|
|
428
|
-
mcpServers:
|
|
448
|
+
mcpServers: z5.array(z5.string().min(1))
|
|
429
449
|
}),
|
|
430
450
|
execution: runExecutionSchema,
|
|
431
451
|
store: runStoreSchema,
|
|
432
|
-
stateDirectory:
|
|
452
|
+
stateDirectory: z5.string()
|
|
433
453
|
});
|
|
434
454
|
var cliProviderDocumentSchema = observationalDocument({
|
|
435
455
|
...jsonBase,
|
|
436
|
-
kind:
|
|
437
|
-
providers:
|
|
456
|
+
kind: z5.literal("providers"),
|
|
457
|
+
providers: z5.array(providerAvailabilitySchema)
|
|
438
458
|
});
|
|
439
459
|
var cliInitDocumentSchema = observationalDocument({
|
|
440
460
|
...jsonBase,
|
|
441
|
-
kind:
|
|
461
|
+
kind: z5.literal("init"),
|
|
442
462
|
profile: observationalDocument({
|
|
443
|
-
name:
|
|
444
|
-
path:
|
|
463
|
+
name: z5.string().min(1),
|
|
464
|
+
path: z5.string().min(1),
|
|
445
465
|
schemaVersion: nonnegativeInteger,
|
|
446
|
-
provider:
|
|
447
|
-
model:
|
|
466
|
+
provider: z5.enum(PROVIDERS),
|
|
467
|
+
model: z5.string().min(1),
|
|
448
468
|
reasoningEffort: reasoningEffortSchema.optional()
|
|
449
469
|
}),
|
|
450
470
|
credential: observationalDocument({
|
|
451
|
-
configured:
|
|
452
|
-
names:
|
|
471
|
+
configured: z5.boolean(),
|
|
472
|
+
names: z5.array(z5.string().min(1))
|
|
453
473
|
}),
|
|
454
474
|
next: observationalDocument({
|
|
455
|
-
doctor:
|
|
456
|
-
run:
|
|
475
|
+
doctor: z5.string().min(1),
|
|
476
|
+
run: z5.string().min(1)
|
|
457
477
|
})
|
|
458
478
|
});
|
|
459
479
|
var cliDoctorDocumentSchema = observationalDocument({
|
|
460
480
|
...jsonBase,
|
|
461
|
-
kind:
|
|
462
|
-
ok:
|
|
463
|
-
harnessVersion:
|
|
481
|
+
kind: z5.literal("doctor"),
|
|
482
|
+
ok: z5.boolean(),
|
|
483
|
+
harnessVersion: z5.string().min(1),
|
|
464
484
|
configSchemaVersion: nonnegativeInteger,
|
|
465
485
|
configuration: doctorConfigurationSchema,
|
|
466
|
-
checks:
|
|
467
|
-
providers:
|
|
486
|
+
checks: z5.array(doctorCheckSchema),
|
|
487
|
+
providers: z5.array(providerAvailabilitySchema)
|
|
468
488
|
});
|
|
469
489
|
var cliReviewGroupDocumentSchema = observationalDocument({
|
|
470
490
|
...jsonBase,
|
|
471
|
-
kind:
|
|
472
|
-
groupId:
|
|
473
|
-
status:
|
|
474
|
-
profiles:
|
|
475
|
-
outputs:
|
|
476
|
-
status:
|
|
477
|
-
name:
|
|
478
|
-
agentId:
|
|
479
|
-
runId:
|
|
480
|
-
runStatus:
|
|
481
|
-
output:
|
|
491
|
+
kind: z5.literal("review-group"),
|
|
492
|
+
groupId: z5.string().min(1),
|
|
493
|
+
status: z5.enum(["completed", "failed"]),
|
|
494
|
+
profiles: z5.array(z5.string().min(1)).min(1),
|
|
495
|
+
outputs: z5.array(observationalDocument({
|
|
496
|
+
status: z5.enum(["fulfilled", "rejected"]),
|
|
497
|
+
name: z5.string().min(1).optional(),
|
|
498
|
+
agentId: z5.string().min(1).optional(),
|
|
499
|
+
runId: z5.string().min(1).optional(),
|
|
500
|
+
runStatus: z5.string().min(1).optional(),
|
|
501
|
+
output: z5.string().optional(),
|
|
482
502
|
steps: nonnegativeInteger.optional(),
|
|
483
503
|
usage: tokenUsageSchema.optional(),
|
|
484
504
|
error: observationalDocument({
|
|
485
|
-
code:
|
|
486
|
-
category:
|
|
505
|
+
code: z5.enum(HARNESS_ERROR_CODES),
|
|
506
|
+
category: z5.enum([
|
|
487
507
|
"configuration",
|
|
488
508
|
"usage",
|
|
489
509
|
"workspace",
|
|
@@ -492,16 +512,16 @@ var cliReviewGroupDocumentSchema = observationalDocument({
|
|
|
492
512
|
"approval",
|
|
493
513
|
"execution"
|
|
494
514
|
]),
|
|
495
|
-
retryable:
|
|
515
|
+
retryable: z5.boolean()
|
|
496
516
|
}).optional()
|
|
497
517
|
}))
|
|
498
518
|
});
|
|
499
519
|
var cliRunListDocumentSchema = observationalDocument({
|
|
500
520
|
...jsonBase,
|
|
501
|
-
kind:
|
|
521
|
+
kind: z5.literal("run-list"),
|
|
502
522
|
scope: scopeSchema,
|
|
503
|
-
backend:
|
|
504
|
-
runs:
|
|
523
|
+
backend: z5.string().min(1),
|
|
524
|
+
runs: z5.array(runSummarySchema)
|
|
505
525
|
});
|
|
506
526
|
var runInspectionShape = {
|
|
507
527
|
run: runSummarySchema,
|
|
@@ -510,25 +530,25 @@ var runInspectionShape = {
|
|
|
510
530
|
trace: jsonObjectSchema,
|
|
511
531
|
hierarchy: jsonObjectSchema,
|
|
512
532
|
ledger: jsonObjectSchema,
|
|
513
|
-
toolJournal:
|
|
533
|
+
toolJournal: z5.array(jsonObjectSchema)
|
|
514
534
|
};
|
|
515
535
|
var cliRunInspectionDocumentSchema = observationalDocument({
|
|
516
536
|
...jsonBase,
|
|
517
|
-
kind:
|
|
537
|
+
kind: z5.literal("run-inspection"),
|
|
518
538
|
...runInspectionShape
|
|
519
539
|
});
|
|
520
540
|
var cliRunExportDocumentSchema = observationalDocument({
|
|
521
541
|
...jsonBase,
|
|
522
|
-
kind:
|
|
542
|
+
kind: z5.literal("run-export"),
|
|
523
543
|
...runInspectionShape
|
|
524
544
|
});
|
|
525
545
|
var cliRunCancellationDocumentSchema = observationalDocument({
|
|
526
546
|
...jsonBase,
|
|
527
|
-
kind:
|
|
528
|
-
cascade:
|
|
547
|
+
kind: z5.literal("run-cancellation"),
|
|
548
|
+
cascade: z5.boolean(),
|
|
529
549
|
run: runSummarySchema.optional(),
|
|
530
550
|
parent: runSummarySchema.optional(),
|
|
531
|
-
children:
|
|
551
|
+
children: z5.array(runSummarySchema).optional()
|
|
532
552
|
}).superRefine((document, context) => {
|
|
533
553
|
if (!document.cascade && !document.run || document.cascade && (!document.parent || !document.children)) {
|
|
534
554
|
context.addIssue({ code: "custom", message: "Cancellation payload does not match cascade mode." });
|
|
@@ -536,27 +556,27 @@ var cliRunCancellationDocumentSchema = observationalDocument({
|
|
|
536
556
|
});
|
|
537
557
|
var cliRunCleanupDocumentSchema = observationalDocument({
|
|
538
558
|
...jsonBase,
|
|
539
|
-
kind:
|
|
559
|
+
kind: z5.literal("run-cleanup"),
|
|
540
560
|
before: nonnegativeInteger,
|
|
541
|
-
statuses:
|
|
561
|
+
statuses: z5.array(z5.string().min(1)),
|
|
542
562
|
deleted: nonnegativeInteger
|
|
543
563
|
});
|
|
544
564
|
var cliSessionListDocumentSchema = observationalDocument({
|
|
545
565
|
...jsonBase,
|
|
546
|
-
kind:
|
|
547
|
-
sessions:
|
|
566
|
+
kind: z5.literal("session-list"),
|
|
567
|
+
sessions: z5.array(sessionSchema)
|
|
548
568
|
});
|
|
549
569
|
var cliSessionDocumentSchema = observationalDocument({
|
|
550
570
|
...jsonBase,
|
|
551
|
-
kind:
|
|
571
|
+
kind: z5.literal("session"),
|
|
552
572
|
session: sessionSchema
|
|
553
573
|
});
|
|
554
574
|
var cliChangeEnvelopeVerificationDocumentSchema = observationalDocument({
|
|
555
575
|
...jsonBase,
|
|
556
|
-
kind:
|
|
557
|
-
valid:
|
|
558
|
-
verificationScope:
|
|
559
|
-
issues:
|
|
576
|
+
kind: z5.literal("change-envelope-verification"),
|
|
577
|
+
valid: z5.boolean(),
|
|
578
|
+
verificationScope: z5.literal("integrity-expiration-and-preconditions-only"),
|
|
579
|
+
issues: z5.array(jsonObjectSchema),
|
|
560
580
|
integrity: jsonObjectSchema,
|
|
561
581
|
expiration: jsonObjectSchema,
|
|
562
582
|
checks: jsonObjectSchema,
|
|
@@ -565,32 +585,32 @@ var cliChangeEnvelopeVerificationDocumentSchema = observationalDocument({
|
|
|
565
585
|
});
|
|
566
586
|
var cliStateStatusDocumentSchema = observationalDocument({
|
|
567
587
|
...jsonBase,
|
|
568
|
-
kind:
|
|
569
|
-
compatible:
|
|
588
|
+
kind: z5.literal("state-status"),
|
|
589
|
+
compatible: z5.boolean(),
|
|
570
590
|
schemas: jsonObjectSchema,
|
|
571
|
-
counts:
|
|
591
|
+
counts: z5.record(z5.string(), nonnegativeInteger)
|
|
572
592
|
});
|
|
573
593
|
var cliStateExportDocumentSchema = observationalDocument({
|
|
574
594
|
...jsonBase,
|
|
575
|
-
kind:
|
|
576
|
-
path:
|
|
595
|
+
kind: z5.literal("state-export"),
|
|
596
|
+
path: z5.string().min(1),
|
|
577
597
|
checksum: digestSchema,
|
|
578
|
-
counts:
|
|
598
|
+
counts: z5.record(z5.string(), nonnegativeInteger)
|
|
579
599
|
});
|
|
580
600
|
var cliStateImportDocumentSchema = observationalDocument({
|
|
581
601
|
...jsonBase,
|
|
582
|
-
kind:
|
|
583
|
-
dryRun:
|
|
602
|
+
kind: z5.literal("state-import"),
|
|
603
|
+
dryRun: z5.boolean(),
|
|
584
604
|
checksum: digestSchema,
|
|
585
|
-
inserted:
|
|
605
|
+
inserted: z5.record(z5.string(), nonnegativeInteger),
|
|
586
606
|
identical: nonnegativeInteger
|
|
587
607
|
});
|
|
588
608
|
var cliErrorDocumentSchema = observationalDocument({
|
|
589
|
-
schemaVersion:
|
|
590
|
-
kind:
|
|
609
|
+
schemaVersion: z5.literal(HARNESS_ERROR_SCHEMA_VERSION),
|
|
610
|
+
kind: z5.literal("error"),
|
|
591
611
|
error: observationalDocument({
|
|
592
|
-
code:
|
|
593
|
-
category:
|
|
612
|
+
code: z5.enum(HARNESS_ERROR_CODES),
|
|
613
|
+
category: z5.enum([
|
|
594
614
|
"configuration",
|
|
595
615
|
"usage",
|
|
596
616
|
"workspace",
|
|
@@ -599,10 +619,22 @@ var cliErrorDocumentSchema = observationalDocument({
|
|
|
599
619
|
"approval",
|
|
600
620
|
"execution"
|
|
601
621
|
]),
|
|
602
|
-
retryable:
|
|
622
|
+
retryable: z5.boolean()
|
|
603
623
|
})
|
|
604
624
|
});
|
|
605
|
-
var
|
|
625
|
+
var cliPolicyInspectionSchema = observationalDocument({
|
|
626
|
+
...jsonBase,
|
|
627
|
+
kind: z5.literal("policy-inspection"),
|
|
628
|
+
digest: digestSchema.nullable(),
|
|
629
|
+
source: z5.enum(["operator-file", "application", "baseline"]),
|
|
630
|
+
explicitReviewRequired: z5.boolean(),
|
|
631
|
+
tools: z5.array(observationalDocument({ name: z5.string(), requiresApproval: z5.boolean() })),
|
|
632
|
+
restrictions: z5.array(observationalDocument({ ruleId: z5.string(), tools: z5.array(z5.string()), decision: z5.enum(["allow", "ask_user", "deny"]), reason: z5.string(), pathCount: nonnegativeInteger })),
|
|
633
|
+
execution: observationalDocument({ configuredBackend: z5.enum(["none", "oci"]), activeBackend: z5.enum(["none", "oci"]), evidence: z5.literal("configuration-only") }),
|
|
634
|
+
limits: observationalDocument({ maxSteps: nonnegativeInteger, timeoutMs: nonnegativeInteger, budget: jsonObjectSchema })
|
|
635
|
+
});
|
|
636
|
+
var cliJsonDocumentSchema = z5.union([
|
|
637
|
+
cliPolicyInspectionSchema,
|
|
606
638
|
cliRunResultDocumentSchema,
|
|
607
639
|
cliInitDocumentSchema,
|
|
608
640
|
cliProviderDocumentSchema,
|
|
@@ -624,47 +656,61 @@ var cliJsonDocumentSchema = z6.union([
|
|
|
624
656
|
]);
|
|
625
657
|
var runEvent = (type, shape) => observationalDocument({
|
|
626
658
|
...eventBase,
|
|
627
|
-
kind:
|
|
628
|
-
type:
|
|
659
|
+
kind: z5.literal("run-event"),
|
|
660
|
+
type: z5.literal(type),
|
|
629
661
|
...shape
|
|
630
662
|
});
|
|
631
|
-
var cliRunEventDocumentSchema =
|
|
632
|
-
runEvent("
|
|
663
|
+
var cliRunEventDocumentSchema = z5.discriminatedUnion("type", [
|
|
664
|
+
runEvent("policy-decision", {
|
|
665
|
+
phase: z5.enum(["approval-request", "tool-entry"]),
|
|
666
|
+
toolName: z5.string(),
|
|
667
|
+
decision: z5.enum(["allow", "ask_user", "deny"]),
|
|
668
|
+
ruleIds: z5.array(z5.string()),
|
|
669
|
+
reason: z5.string(),
|
|
670
|
+
reasonTruncated: z5.boolean(),
|
|
671
|
+
policyDigest: digestSchema.nullable(),
|
|
672
|
+
source: z5.enum(["operator-file", "application", "baseline"]),
|
|
673
|
+
approvalRequired: z5.boolean(),
|
|
674
|
+
explicitReviewRequired: z5.boolean(),
|
|
675
|
+
executionBackend: z5.enum(["none", "oci"]),
|
|
676
|
+
evidence: z5.literal("policy-evaluation")
|
|
677
|
+
}),
|
|
678
|
+
runEvent("text-delta", { textDelta: z5.string() }),
|
|
633
679
|
runEvent("tool-call", {
|
|
634
|
-
toolCallId:
|
|
635
|
-
toolName:
|
|
680
|
+
toolCallId: z5.string().min(1),
|
|
681
|
+
toolName: z5.string().min(1)
|
|
636
682
|
}),
|
|
637
683
|
runEvent("tool-result", {
|
|
638
|
-
toolCallId:
|
|
639
|
-
toolName:
|
|
640
|
-
isError:
|
|
684
|
+
toolCallId: z5.string().min(1),
|
|
685
|
+
toolName: z5.string().min(1),
|
|
686
|
+
isError: z5.boolean()
|
|
641
687
|
}),
|
|
642
688
|
runEvent("tool-approval-request", {
|
|
643
|
-
approvalRequestId:
|
|
644
|
-
approvalKind:
|
|
645
|
-
toolName:
|
|
689
|
+
approvalRequestId: z5.string().min(1),
|
|
690
|
+
approvalKind: z5.string().min(1),
|
|
691
|
+
toolName: z5.string().min(1)
|
|
646
692
|
}),
|
|
647
693
|
runEvent("agent-approval-request", {
|
|
648
|
-
approvalRequestId:
|
|
649
|
-
approvalKind:
|
|
650
|
-
toolName:
|
|
694
|
+
approvalRequestId: z5.string().min(1),
|
|
695
|
+
approvalKind: z5.string().min(1),
|
|
696
|
+
toolName: z5.string().min(1)
|
|
651
697
|
}),
|
|
652
698
|
runEvent("agent-approval-resolved", {
|
|
653
|
-
approvalRequestId:
|
|
654
|
-
approved:
|
|
699
|
+
approvalRequestId: z5.string().min(1),
|
|
700
|
+
approved: z5.boolean()
|
|
655
701
|
}),
|
|
656
|
-
runEvent("provider-data", { provider:
|
|
702
|
+
runEvent("provider-data", { provider: z5.string().min(1) }),
|
|
657
703
|
runEvent("image-generation", {
|
|
658
|
-
provider:
|
|
659
|
-
partial:
|
|
660
|
-
id:
|
|
704
|
+
provider: z5.string().min(1),
|
|
705
|
+
partial: z5.boolean(),
|
|
706
|
+
id: z5.string().min(1).optional(),
|
|
661
707
|
index: nonnegativeInteger.optional()
|
|
662
708
|
}),
|
|
663
709
|
runEvent("finish", {
|
|
664
|
-
finishReason:
|
|
710
|
+
finishReason: z5.string().min(1).optional(),
|
|
665
711
|
usage: jsonObjectSchema.optional()
|
|
666
712
|
}),
|
|
667
|
-
runEvent("error", { error:
|
|
713
|
+
runEvent("error", { error: z5.literal("Provider stream failed.") }),
|
|
668
714
|
runEvent("agent-run-start", {
|
|
669
715
|
currentStep: nonnegativeInteger,
|
|
670
716
|
maxSteps: nonnegativeInteger
|
|
@@ -672,46 +718,46 @@ var cliRunEventDocumentSchema = z6.discriminatedUnion("type", [
|
|
|
672
718
|
runEvent("agent-step-start", { stepIndex: nonnegativeInteger }),
|
|
673
719
|
runEvent("agent-step-finish", {
|
|
674
720
|
stepIndex: nonnegativeInteger,
|
|
675
|
-
status:
|
|
721
|
+
status: z5.string().min(1),
|
|
676
722
|
toolCalls: nonnegativeInteger
|
|
677
723
|
}),
|
|
678
724
|
runEvent("agent-compaction", {
|
|
679
|
-
compactionId:
|
|
680
|
-
reasons:
|
|
725
|
+
compactionId: z5.string().min(1),
|
|
726
|
+
reasons: z5.array(z5.string().min(1)),
|
|
681
727
|
messageCountBefore: nonnegativeInteger,
|
|
682
728
|
messageCountAfter: nonnegativeInteger
|
|
683
729
|
}),
|
|
684
730
|
runEvent("agent-run-finish", {
|
|
685
|
-
runId:
|
|
686
|
-
status:
|
|
687
|
-
provider:
|
|
688
|
-
model:
|
|
731
|
+
runId: z5.string().min(1),
|
|
732
|
+
status: z5.string().min(1),
|
|
733
|
+
provider: z5.string().min(1),
|
|
734
|
+
model: z5.string().min(1)
|
|
689
735
|
})
|
|
690
736
|
]);
|
|
691
737
|
var cliStreamResultDocumentSchema = observationalDocument({
|
|
692
738
|
...eventBase,
|
|
693
|
-
kind:
|
|
739
|
+
kind: z5.literal("run-stream-result"),
|
|
694
740
|
...runIdentity,
|
|
695
741
|
steps: nonnegativeInteger,
|
|
696
742
|
toolCalls: nonnegativeInteger,
|
|
697
|
-
pendingApprovals:
|
|
698
|
-
id:
|
|
699
|
-
kind:
|
|
700
|
-
name:
|
|
701
|
-
childRunId:
|
|
702
|
-
childAgentId:
|
|
743
|
+
pendingApprovals: z5.array(observationalDocument({
|
|
744
|
+
id: z5.string().min(1),
|
|
745
|
+
kind: z5.string().min(1),
|
|
746
|
+
name: z5.string().min(1),
|
|
747
|
+
childRunId: z5.string().min(1).optional(),
|
|
748
|
+
childAgentId: z5.string().min(1).optional()
|
|
703
749
|
})),
|
|
704
|
-
children:
|
|
705
|
-
runId:
|
|
706
|
-
status:
|
|
750
|
+
children: z5.array(observationalDocument({
|
|
751
|
+
runId: z5.string().min(1),
|
|
752
|
+
status: z5.string().min(1)
|
|
707
753
|
}))
|
|
708
754
|
});
|
|
709
755
|
var cliStreamErrorDocumentSchema = observationalDocument({
|
|
710
756
|
...eventBase,
|
|
711
|
-
kind:
|
|
757
|
+
kind: z5.literal("run-stream-error"),
|
|
712
758
|
error: cliErrorDocumentSchema.shape.error
|
|
713
759
|
});
|
|
714
|
-
var cliJsonLineDocumentSchema =
|
|
760
|
+
var cliJsonLineDocumentSchema = z5.union([
|
|
715
761
|
cliRunEventDocumentSchema,
|
|
716
762
|
cliStreamResultDocumentSchema,
|
|
717
763
|
cliStreamErrorDocumentSchema
|
|
@@ -752,6 +798,13 @@ var runServiceCli = async (options, annotate) => {
|
|
|
752
798
|
};
|
|
753
799
|
const print = (document) => process.stdout.write((options.json ? JSON.stringify(document, null, 2) : sanitizeTerminalText(JSON.stringify(document, null, 2))) + `
|
|
754
800
|
`);
|
|
801
|
+
if (options.command === "policy") {
|
|
802
|
+
const result = await call({ method: "policy.get" });
|
|
803
|
+
if (result.kind !== "policy")
|
|
804
|
+
throw new HarnessStateConflictError("Unexpected service policy response.");
|
|
805
|
+
printPolicyInspection(result.policy, options.json);
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
755
808
|
if (options.command === "sessions") {
|
|
756
809
|
if (options.sessionsCommand === "list") {
|
|
757
810
|
const sessions = await list(options.sessionSearch);
|
|
@@ -822,6 +875,12 @@ var runServiceCli = async (options, annotate) => {
|
|
|
822
875
|
const observe = (a) => {
|
|
823
876
|
if (options.json || options.jsonl)
|
|
824
877
|
return;
|
|
878
|
+
if (a.type === "policy-decision") {
|
|
879
|
+
const decision2 = harnessPolicyDecisionEventSchema.safeParse(a);
|
|
880
|
+
if (decision2.success)
|
|
881
|
+
process.stderr.write(formatPolicyDecision(decision2.data) + `
|
|
882
|
+
`);
|
|
883
|
+
}
|
|
825
884
|
history.observeService(a);
|
|
826
885
|
if (a.type === "agent-step-start" || a.type === "agent-run-start")
|
|
827
886
|
activity.phase("Waiting for model response");
|