@zhivex-ai/harness 1.4.0 → 1.4.1
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 +29 -10
- package/README.md +7 -5
- package/SUPPORT.md +2 -2
- package/contracts/client-protocol-v1.schema.json +593 -0
- package/contracts/engine-api.json +156 -0
- package/contracts/public-api.json +12 -0
- package/contracts/stable-api-signatures.json +33 -33
- package/dist/acp-cli.js +54 -20
- package/dist/audit/index.d.ts +3 -0
- package/dist/audit/index.js +482 -0
- package/dist/audit/pack.d.ts +72 -0
- package/dist/audit-pack-e4vaq7np.js +532 -0
- package/dist/cli/arguments.d.ts +3 -1
- package/dist/cli/audit-pack.d.ts +24 -0
- package/dist/cli/cli-credentials.d.ts +6 -0
- package/dist/cli/cli-profiles.d.ts +4 -2
- package/dist/cli/node-engine.d.ts +2 -0
- package/dist/{cli-2h37qyvg.js → cli-1cf4dcnj.js} +245 -642
- package/dist/{cli-entry-w0hterjs.js → cli-entry-3s63zn4w.js} +40 -13
- package/dist/cli-entry-7f0cen32.js +9990 -0
- package/dist/cli-entry-a890x3kq.js +10348 -0
- package/dist/{cli-entry-20w6nh0k.js → cli-entry-hdtfef27.js} +439 -19
- package/dist/cli-entry-rgs6bxmy.js +484 -0
- package/dist/cli.js +27 -2
- package/dist/client/json-contracts.d.ts +4 -0
- package/dist/client/protocol.d.ts +133 -0
- package/dist/client/task-control-host.d.ts +400 -0
- package/dist/client/task-projection-host.d.ts +12 -0
- package/dist/client/task-projection.d.ts +168 -0
- package/dist/compat/code-support.js +28 -22
- package/dist/{config-qt69hkqj.js → config-r9fdhce6.js} +3 -3
- package/dist/{config-j9624t6t.js → config-vyajmksy.js} +1 -1
- package/dist/engine/acp.js +15 -11
- package/dist/engine/client.js +14 -10
- package/dist/engine/desktop-providers-v1.d.ts +2 -0
- package/dist/engine/desktop-providers-v1.js +23 -3
- package/dist/engine/desktop-state-v1.js +11 -8
- package/dist/engine/index.d.ts +3 -0
- package/dist/engine/index.js +101 -554
- package/dist/engine/mcp-stdio-v1.js +8 -6
- package/dist/engine/models.js +76 -4
- package/dist/engine/protocol.d.ts +2 -0
- package/dist/engine/protocol.js +110 -0
- package/dist/engine/service.js +15 -11
- package/dist/hostile-repository-demo.js +1095 -505
- package/dist/{index-937cb7y8.js → index-02pqtbbg.js} +559 -33
- package/dist/{index-pp474137.js → index-0zs2dz26.js} +766 -931
- package/dist/{index-8zjmnyw5.js → index-1265j7t2.js} +73 -6
- package/dist/index-4fx5f3k5.js +269 -0
- package/dist/{index-nmjdwd4p.js → index-4gt045j0.js} +109 -1
- package/dist/{index-6dft2vev.js → index-6599mpmy.js} +5 -3
- package/dist/{index-tfzta544.js → index-74kkpyqk.js} +9 -7
- package/dist/{index-61gthdz6.js → index-8sm2a1wa.js} +1 -1
- package/dist/index-c39197wq.js +552 -0
- package/dist/{index-5jhgatga.js → index-crta5wzv.js} +7 -6
- package/dist/{index-m34q25jj.js → index-d9zkmhz3.js} +143 -824
- package/dist/{index-pdmevfxv.js → index-dtb2c6ds.js} +5 -259
- package/dist/index-f6mqa5gk.js +1535 -0
- package/dist/index-j6zxnc8m.js +490 -0
- package/dist/{index-rkbf7dqg.js → index-mv8sb1ns.js} +5 -3
- package/dist/{index-xqxeypt5.js → index-mzydbzp8.js} +76 -4
- package/dist/{index-wg1sd3at.js → index-qfsrrnz6.js} +1 -1
- package/dist/{index-m82cfspw.js → index-sk3cap35.js} +877 -963
- package/dist/index-sstgcsr0.js +511 -0
- package/dist/index-wm9xeq1n.js +329 -0
- package/dist/index-xdbkcccf.js +719 -0
- package/dist/{index-s2k2edts.js → index-zxg4ve4j.js} +41 -1548
- package/dist/index.d.ts +3 -0
- package/dist/index.js +93 -77
- package/dist/internal/desktop/providers.d.ts +2 -0
- package/dist/models/catalog.d.ts +2 -0
- package/dist/persistence/sqlite-database.d.ts +1 -0
- package/dist/providers/azure-openai.d.ts +14 -0
- package/dist/providers/bedrock.d.ts +23 -0
- package/dist/providers/providers.d.ts +1 -1
- package/dist/runtime/durable-review-group.d.ts +33 -0
- package/dist/runtime/harness.d.ts +11 -0
- package/dist/runtime/run-interruption.d.ts +7 -0
- package/dist/runtime/shared-budget.d.ts +30 -0
- package/dist/runtime/task-continuity.d.ts +300 -77
- package/dist/service-cli.js +15 -11
- package/dist/{service-client-cli-fn54ev6w.js → service-client-cli-eqrdc9zq.js} +400 -305
- package/dist/verify-historical-migrations.js +1095 -505
- package/dist/zhx.js +27 -2
- package/docs/AUDIT_PACK.md +99 -0
- package/docs/AZURE_OPENAI.md +53 -0
- package/docs/BEDROCK.md +56 -0
- package/docs/CLI.md +15 -0
- package/docs/CLIENT_PROTOCOL.md +178 -0
- package/docs/CODE_RELEASE.md +31 -1
- package/docs/CODE_WEB_TASKS.md +116 -0
- package/docs/CONTEXT_ENGINEERING.md +59 -0
- package/docs/CREDENTIALS.md +21 -0
- package/docs/DURABLE_OPERATIONS.md +93 -1
- package/docs/ENGINE_API.md +5 -2
- package/docs/EXTENSIBILITY.md +2 -2
- package/docs/FIRST_USE.md +6 -6
- package/docs/MINIMUM_TASK_AUTHORITY.md +3 -3
- package/docs/PROJECT_MEMORY.md +1 -1
- package/docs/README.md +6 -1
- package/docs/STABILITY.md +3 -1
- package/docs/SUPPORT_MATRIX.md +1 -1
- package/docs/SUPPORT_MATRIX_1_1.md +1 -1
- package/docs/USAGE.md +3 -1
- package/docs/VERTEX.md +2 -2
- package/docs/WEB_LIMITS.md +4 -3
- package/docs/adr/0002-isolated-mcp-stdio.md +6 -3
- package/docs/support-matrix-1.1.json +3 -1
- package/docs/support-matrix.json +6 -4
- package/evaluations/code-task-ui.json +20 -0
- package/evaluations/representative-assembly-matrix.json +10 -1
- package/evaluations/task-projection.json +10 -0
- package/evaluations/task-recovery-lab.json +60 -0
- package/examples/README.md +3 -3
- package/package.json +23 -13
- package/dist/cli-entry-4ngptr62.js +0 -19900
- package/dist/index-m49jx72n.js +0 -220
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ActivityHistory,
|
|
3
|
-
CLI_EVENT_SCHEMA_VERSION,
|
|
4
|
-
CLI_JSON_SCHEMA_VERSION,
|
|
5
3
|
ConsoleInput,
|
|
6
4
|
ToolActivity,
|
|
7
|
-
changeEnvelopeSchema,
|
|
8
5
|
formatAppliedFiles,
|
|
9
6
|
formatConsoleHelp,
|
|
10
7
|
formatConsoleWelcome,
|
|
11
8
|
formatPolicyDecision,
|
|
12
|
-
harnessPolicyDecisionEventSchema,
|
|
13
9
|
navigateConsole,
|
|
14
10
|
printPolicyInspection,
|
|
15
|
-
sanitizeTerminalText
|
|
11
|
+
sanitizeTerminalText
|
|
12
|
+
} from "./cli-entry-a890x3kq.js";
|
|
13
|
+
import {
|
|
14
|
+
CLI_EVENT_SCHEMA_VERSION,
|
|
15
|
+
CLI_JSON_SCHEMA_VERSION,
|
|
16
|
+
changeEnvelopeSchema,
|
|
17
|
+
harnessPolicyDecisionEventSchema,
|
|
16
18
|
serializeStreamResult
|
|
17
|
-
} from "./cli-entry-
|
|
19
|
+
} from "./cli-entry-7f0cen32.js";
|
|
18
20
|
import {
|
|
19
21
|
HARNESS_VERSION
|
|
20
|
-
} from "./cli-entry-
|
|
22
|
+
} from "./cli-entry-3s63zn4w.js";
|
|
21
23
|
import {
|
|
22
24
|
HARNESS_ERROR_CODES,
|
|
23
25
|
HARNESS_ERROR_SCHEMA_VERSION,
|
|
@@ -25,7 +27,7 @@ import {
|
|
|
25
27
|
HarnessStateConflictError,
|
|
26
28
|
PROVIDERS,
|
|
27
29
|
reasoningEffortSchema
|
|
28
|
-
} from "./cli-entry-
|
|
30
|
+
} from "./cli-entry-hdtfef27.js";
|
|
29
31
|
import {
|
|
30
32
|
__require
|
|
31
33
|
} from "./cli-entry-1bx83sw4.js";
|
|
@@ -38,7 +40,7 @@ import { setTimeout as delay } from "node:timers/promises";
|
|
|
38
40
|
import { createServer, request as httpRequest } from "node:http";
|
|
39
41
|
import { mkdir, lstat, realpath, open, unlink, chmod } from "node:fs/promises";
|
|
40
42
|
import path from "node:path";
|
|
41
|
-
import { z as
|
|
43
|
+
import { z as z5 } from "zod";
|
|
42
44
|
|
|
43
45
|
// src/client/protocol.ts
|
|
44
46
|
import { z } from "zod";
|
|
@@ -80,6 +82,24 @@ var harnessClientCommandSchema = z.discriminatedUnion("method", [
|
|
|
80
82
|
z.object({ method: z.literal("restore.apply"), ...restore, ...mutation, expectedRevision: revision, reviewedProposalId: fileDigest }).strict(),
|
|
81
83
|
z.object({ method: z.literal("restore.recoverFork"), ...restore, ...mutation, expectedRevision: revision, forkSessionId: id }).strict(),
|
|
82
84
|
z.object({ method: z.literal("run.start"), ...session, ...mutation, expectedRevision: revision, prompt: z.string().min(1).max(64 * 1024) }).strict(),
|
|
85
|
+
z.object({
|
|
86
|
+
method: z.literal("task.start"),
|
|
87
|
+
...session,
|
|
88
|
+
...mutation,
|
|
89
|
+
expectedRevision: revision,
|
|
90
|
+
brief: z.strictObject({
|
|
91
|
+
goal: z.string().trim().min(1).max(2000),
|
|
92
|
+
paths: z.array(z.string().min(1).max(1024)).min(1).max(20),
|
|
93
|
+
checks: z.array(id).min(1).max(8),
|
|
94
|
+
constraints: z.array(z.string().trim().min(1).max(500)).max(8),
|
|
95
|
+
budget: z.strictObject({ inputTokens: z.number().int().positive().safe(), outputTokens: z.number().int().positive().safe(), totalTokens: z.number().int().positive().safe() })
|
|
96
|
+
})
|
|
97
|
+
}).strict(),
|
|
98
|
+
z.object({ method: z.literal("task.review"), ...run }).strict(),
|
|
99
|
+
z.object({ method: z.literal("task.keep"), ...run, ...mutation, reviewId: z.string().uuid() }).strict(),
|
|
100
|
+
z.object({ method: z.literal("task.revise"), ...run, ...mutation, reviewId: z.string().uuid(), correction: z.string().trim().min(1).max(500) }).strict(),
|
|
101
|
+
z.object({ method: z.literal("task.continue"), ...run, ...mutation, reviewId: z.string().uuid(), prompt: z.string().trim().min(1).max(2000) }).strict(),
|
|
102
|
+
z.object({ method: z.literal("task.get"), ...run, projectionVersion: z.number().int().nonnegative().safe() }).strict(),
|
|
83
103
|
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(),
|
|
84
104
|
z.object({
|
|
85
105
|
method: z.literal("approval.resolve"),
|
|
@@ -97,19 +117,94 @@ var harnessClientRequestSchema = z.object({
|
|
|
97
117
|
command: harnessClientCommandSchema
|
|
98
118
|
}).strict();
|
|
99
119
|
|
|
100
|
-
// src/
|
|
120
|
+
// src/client/task-control-host.ts
|
|
121
|
+
import { execFile } from "node:child_process";
|
|
122
|
+
import { promisify } from "node:util";
|
|
123
|
+
var exec = promisify(execFile);
|
|
124
|
+
|
|
125
|
+
// src/client/task-projection-host.ts
|
|
126
|
+
import { createRedactionPolicy } from "@zhivex-ai/agents";
|
|
127
|
+
|
|
128
|
+
// src/client/task-projection.ts
|
|
101
129
|
import { z as z2 } from "zod";
|
|
102
|
-
var
|
|
103
|
-
var
|
|
104
|
-
var
|
|
105
|
-
var
|
|
130
|
+
var id2 = z2.string().regex(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/);
|
|
131
|
+
var count = z2.number().int().nonnegative().safe();
|
|
132
|
+
var digest = z2.string().regex(/^sha256:[a-f0-9]{64}$/);
|
|
133
|
+
var text = z2.string().max(2048);
|
|
134
|
+
var tokens = z2.strictObject({ inputTokens: count, outputTokens: count, totalTokens: count });
|
|
135
|
+
var harnessTaskProjectionSchema = z2.strictObject({
|
|
136
|
+
schemaVersion: z2.literal(1),
|
|
137
|
+
connectionId: id2,
|
|
138
|
+
sequence: count,
|
|
139
|
+
projectId: id2,
|
|
140
|
+
sessionId: id2,
|
|
141
|
+
runId: id2,
|
|
142
|
+
task: z2.strictObject({
|
|
143
|
+
reference: digest,
|
|
144
|
+
contractRevision: count,
|
|
145
|
+
contractDigest: digest,
|
|
146
|
+
runRevision: count,
|
|
147
|
+
objective: text.nullable(),
|
|
148
|
+
objectiveSource: z2.enum(["operator_brief", "retained_operator_source", "unavailable"]),
|
|
149
|
+
observedRunId: id2,
|
|
150
|
+
historicalRequest: z2.boolean(),
|
|
151
|
+
execution: z2.enum(["created", "queued", "running", "waiting_approval", "cancel_requested", "completed", "failed", "cancelled", "timed_out", "unknown"]),
|
|
152
|
+
artifact: z2.strictObject({
|
|
153
|
+
observedDigest: digest.nullable(),
|
|
154
|
+
deliveredDigest: digest.nullable(),
|
|
155
|
+
correspondence: z2.enum(["current", "stale", "missing"]),
|
|
156
|
+
paths: z2.array(text).max(256),
|
|
157
|
+
contents: z2.literal("not_included")
|
|
158
|
+
}),
|
|
159
|
+
review: z2.strictObject({
|
|
160
|
+
structure: z2.enum(["verified", "incomplete"]),
|
|
161
|
+
semantic: z2.literal("pending"),
|
|
162
|
+
acceptance: z2.literal("not_recorded"),
|
|
163
|
+
human: z2.array(z2.strictObject({ id: text, requirement: text, status: z2.literal("pending") })).max(32),
|
|
164
|
+
checks: z2.array(z2.strictObject({ id: text, status: z2.enum(["confirmed", "missing", "missing_or_stale", "host_policy_changed"]), provenance: z2.literal("contract_snapshot_and_tool_journal") })).max(32)
|
|
165
|
+
}),
|
|
166
|
+
budget: z2.strictObject({
|
|
167
|
+
availability: z2.enum(["authoritative", "legacy_not_enabled"]),
|
|
168
|
+
revision: count.nullable(),
|
|
169
|
+
confirmed: tokens.nullable(),
|
|
170
|
+
reserved: tokens.nullable(),
|
|
171
|
+
unknown: tokens.nullable(),
|
|
172
|
+
remaining: tokens.nullable(),
|
|
173
|
+
limits: tokens.nullable(),
|
|
174
|
+
estimated: z2.null(),
|
|
175
|
+
estimation: z2.literal("not_separately_recorded"),
|
|
176
|
+
usageComplete: z2.boolean().nullable(),
|
|
177
|
+
admissionsClosed: z2.boolean().nullable(),
|
|
178
|
+
monetary: z2.strictObject({ estimatedConfirmedUsd: z2.number().finite().nonnegative().nullable(), reservedUsd: z2.number().finite().nonnegative().nullable(), unknownHeldUsd: z2.number().finite().nonnegative().nullable(), remainingUsd: z2.number().finite().nonnegative().nullable(), unknown: z2.boolean(), costKind: z2.literal("estimate-not-invoice") })
|
|
179
|
+
}),
|
|
180
|
+
effects: z2.strictObject({ readOnly: count, recorded: count, unknown: count, missingEvidence: z2.boolean(), automaticReplay: z2.literal(false), providerStopped: z2.literal("unconfirmed") }),
|
|
181
|
+
nextAction: z2.strictObject({
|
|
182
|
+
kind: z2.enum(["wait", "reconcile", "review_approval", "review_delivery", "explicit_continuation"]),
|
|
183
|
+
permitted: z2.literal("read_only"),
|
|
184
|
+
authorization: z2.literal("required_for_execution"),
|
|
185
|
+
preserves: z2.literal("contract_receipts_budget_and_effects"),
|
|
186
|
+
automaticReplay: z2.literal(false)
|
|
187
|
+
}),
|
|
188
|
+
diagnostic: z2.strictObject({ code: z2.enum(["EXECUTION_FAILED", "EXECUTION_CANCELLED", "EXECUTION_TIMED_OUT", "EVIDENCE_INCOMPLETE"]), cause: z2.enum(["execution_terminal_failure", "operator_or_runtime_cancellation", "execution_deadline", "receipts_missing_or_stale"]), impact: z2.literal("acceptance_not_established"), safeAction: z2.enum(["review_configuration", "reconcile", "review_delivery"]) }).nullable(),
|
|
189
|
+
reasons: z2.array(z2.string().regex(/^[A-Z][A-Z0-9_]{0,95}$/)).max(32),
|
|
190
|
+
provenance: z2.literal("host_durable_contract_journal_budget_and_fresh_native_snapshot"),
|
|
191
|
+
textTruncated: z2.boolean()
|
|
192
|
+
})
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
// src/approvals/approval-diff.ts
|
|
196
|
+
import { z as z3 } from "zod";
|
|
197
|
+
var sha = z3.string().regex(/^sha256:[a-f0-9]{64}$/);
|
|
198
|
+
var file = z3.object({ path: z3.string().max(1024), expectedDigest: sha.nullable(), before: z3.string().nullable(), after: z3.string().nullable(), afterDigest: sha.nullable(), beforeMode: z3.number().int().optional(), afterMode: z3.number().int().optional(), operation: z3.enum(["create", "update", "delete"]).optional() }).strict();
|
|
199
|
+
var archive = z3.object({ approvalId: z3.string().max(256), digest: z3.string().regex(/^[a-f0-9]{64}$/), proposalId: sha, files: z3.array(file).min(1).max(50) }).strict();
|
|
200
|
+
var archives = z3.array(archive).max(512);
|
|
106
201
|
var maxBytes = 2 * 1024 * 1024;
|
|
107
202
|
|
|
108
203
|
// src/approvals/approval-preview.ts
|
|
109
|
-
import { z as
|
|
204
|
+
import { z as z4 } from "zod";
|
|
110
205
|
|
|
111
206
|
// src/client/local-service.ts
|
|
112
|
-
var harnessLocalCredentialsSchema =
|
|
207
|
+
var harnessLocalCredentialsSchema = z5.object({ schemaVersion: z5.literal(1), socketPath: z5.string().min(1), token: z5.string().regex(/^[a-f0-9]{64}$/) }).strict();
|
|
113
208
|
var readHarnessLocalCredentials = async (filename) => {
|
|
114
209
|
const { constants } = await import("node:fs");
|
|
115
210
|
const file2 = await open(filename, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
@@ -161,26 +256,26 @@ var requestHarnessLocalService = async (credentials, endpoint, payload) => {
|
|
|
161
256
|
};
|
|
162
257
|
|
|
163
258
|
// src/client/json-contracts.ts
|
|
164
|
-
import { z as
|
|
165
|
-
var observationalDocument = (shape) =>
|
|
166
|
-
var jsonBase = { schemaVersion:
|
|
259
|
+
import { z as z6 } from "zod";
|
|
260
|
+
var observationalDocument = (shape) => z6.object(shape).passthrough();
|
|
261
|
+
var jsonBase = { schemaVersion: z6.literal(CLI_JSON_SCHEMA_VERSION) };
|
|
167
262
|
var eventBase = {
|
|
168
|
-
schemaVersion:
|
|
169
|
-
sequence:
|
|
263
|
+
schemaVersion: z6.literal(CLI_EVENT_SCHEMA_VERSION),
|
|
264
|
+
sequence: z6.number().int().nonnegative()
|
|
170
265
|
};
|
|
171
|
-
var nonnegativeInteger =
|
|
172
|
-
var digestSchema =
|
|
266
|
+
var nonnegativeInteger = z6.number().int().nonnegative();
|
|
267
|
+
var digestSchema = z6.string().regex(/^sha256:[a-f0-9]{64}$/);
|
|
173
268
|
var jsonObjectSchema = observationalDocument({});
|
|
174
269
|
var scopeSchema = observationalDocument({
|
|
175
|
-
tenantId:
|
|
176
|
-
userId:
|
|
177
|
-
namespace:
|
|
270
|
+
tenantId: z6.string().min(1),
|
|
271
|
+
userId: z6.string().min(1).optional(),
|
|
272
|
+
namespace: z6.string().min(1).optional()
|
|
178
273
|
});
|
|
179
274
|
var runIdentity = {
|
|
180
|
-
runId:
|
|
181
|
-
status:
|
|
182
|
-
provider:
|
|
183
|
-
model:
|
|
275
|
+
runId: z6.string().min(1),
|
|
276
|
+
status: z6.string().min(1),
|
|
277
|
+
provider: z6.string().min(1),
|
|
278
|
+
model: z6.string().min(1)
|
|
184
279
|
};
|
|
185
280
|
var runSummarySchema = observationalDocument({
|
|
186
281
|
...runIdentity,
|
|
@@ -196,24 +291,24 @@ var runSummarySchema = observationalDocument({
|
|
|
196
291
|
updatedAt: nonnegativeInteger
|
|
197
292
|
});
|
|
198
293
|
var sessionRunSchema = observationalDocument({
|
|
199
|
-
turnId:
|
|
294
|
+
turnId: z6.string().min(1),
|
|
200
295
|
sequence: nonnegativeInteger,
|
|
201
|
-
runId:
|
|
202
|
-
provider:
|
|
203
|
-
model:
|
|
204
|
-
status:
|
|
296
|
+
runId: z6.string().min(1),
|
|
297
|
+
provider: z6.string().min(1),
|
|
298
|
+
model: z6.string().min(1),
|
|
299
|
+
status: z6.string().min(1),
|
|
205
300
|
createdAt: nonnegativeInteger,
|
|
206
301
|
updatedAt: nonnegativeInteger
|
|
207
302
|
});
|
|
208
303
|
var sessionSchema = observationalDocument({
|
|
209
|
-
schemaVersion:
|
|
210
|
-
sessionId:
|
|
211
|
-
workspaceKey:
|
|
212
|
-
scopeKey:
|
|
304
|
+
schemaVersion: z6.literal(1),
|
|
305
|
+
sessionId: z6.string().min(1),
|
|
306
|
+
workspaceKey: z6.string().min(1),
|
|
307
|
+
scopeKey: z6.string().min(1),
|
|
213
308
|
revision: nonnegativeInteger,
|
|
214
309
|
createdAt: nonnegativeInteger,
|
|
215
310
|
updatedAt: nonnegativeInteger,
|
|
216
|
-
runs:
|
|
311
|
+
runs: z6.array(sessionRunSchema)
|
|
217
312
|
});
|
|
218
313
|
var tokenUsageSchema = observationalDocument({
|
|
219
314
|
inputTokens: nonnegativeInteger.optional(),
|
|
@@ -222,19 +317,19 @@ var tokenUsageSchema = observationalDocument({
|
|
|
222
317
|
outputTokens: nonnegativeInteger.optional(),
|
|
223
318
|
reasoningTokens: nonnegativeInteger.optional(),
|
|
224
319
|
totalTokens: nonnegativeInteger.optional(),
|
|
225
|
-
speed:
|
|
320
|
+
speed: z6.enum(["standard", "fast"]).optional()
|
|
226
321
|
});
|
|
227
322
|
var budgetConfigSchema = observationalDocument({
|
|
228
|
-
unlimitedTokens:
|
|
229
|
-
unlimitedSteps:
|
|
230
|
-
unlimitedToolCalls:
|
|
323
|
+
unlimitedTokens: z6.boolean().optional(),
|
|
324
|
+
unlimitedSteps: z6.boolean().optional(),
|
|
325
|
+
unlimitedToolCalls: z6.boolean().optional(),
|
|
231
326
|
maxSteps: nonnegativeInteger,
|
|
232
327
|
maxToolCalls: nonnegativeInteger,
|
|
233
328
|
maxToolErrors: nonnegativeInteger,
|
|
234
329
|
maxInputTokens: nonnegativeInteger,
|
|
235
330
|
maxOutputTokens: nonnegativeInteger,
|
|
236
331
|
maxTotalTokens: nonnegativeInteger,
|
|
237
|
-
includeChildRuns:
|
|
332
|
+
includeChildRuns: z6.boolean()
|
|
238
333
|
});
|
|
239
334
|
var budgetConsumptionSchema = observationalDocument({
|
|
240
335
|
steps: nonnegativeInteger,
|
|
@@ -255,117 +350,117 @@ var budgetRemainingSchema = observationalDocument({
|
|
|
255
350
|
var budgetStatusSchema = observationalDocument({
|
|
256
351
|
consumption: budgetConsumptionSchema,
|
|
257
352
|
remaining: budgetRemainingSchema,
|
|
258
|
-
includeChildRuns:
|
|
353
|
+
includeChildRuns: z6.boolean()
|
|
259
354
|
});
|
|
260
355
|
var costEstimateSchema = observationalDocument({
|
|
261
|
-
inputCost:
|
|
262
|
-
outputCost:
|
|
263
|
-
totalCost:
|
|
264
|
-
currency:
|
|
356
|
+
inputCost: z6.number().nonnegative().optional(),
|
|
357
|
+
outputCost: z6.number().nonnegative().optional(),
|
|
358
|
+
totalCost: z6.number().nonnegative().optional(),
|
|
359
|
+
currency: z6.string().min(1).optional(),
|
|
265
360
|
usage: tokenUsageSchema.optional()
|
|
266
361
|
});
|
|
267
362
|
var mutationAuditSchema = observationalDocument({
|
|
268
|
-
id:
|
|
269
|
-
operation:
|
|
270
|
-
path:
|
|
271
|
-
destination:
|
|
363
|
+
id: z6.string().min(1),
|
|
364
|
+
operation: z6.enum(["create", "update", "move", "quarantine", "restore"]),
|
|
365
|
+
path: z6.string().min(1),
|
|
366
|
+
destination: z6.string().min(1).optional(),
|
|
272
367
|
beforeDigest: digestSchema.optional(),
|
|
273
368
|
afterDigest: digestSchema.optional(),
|
|
274
|
-
timestamp:
|
|
275
|
-
quarantineId:
|
|
369
|
+
timestamp: z6.iso.datetime(),
|
|
370
|
+
quarantineId: z6.string().min(1).optional()
|
|
276
371
|
});
|
|
277
372
|
var approvalSummarySchema = observationalDocument({
|
|
278
|
-
id:
|
|
279
|
-
kind:
|
|
280
|
-
name:
|
|
281
|
-
arguments:
|
|
282
|
-
childRunId:
|
|
283
|
-
childAgentId:
|
|
373
|
+
id: z6.string().min(1),
|
|
374
|
+
kind: z6.string().min(1),
|
|
375
|
+
name: z6.string().min(1),
|
|
376
|
+
arguments: z6.json(),
|
|
377
|
+
childRunId: z6.string().min(1).optional(),
|
|
378
|
+
childAgentId: z6.string().min(1).optional()
|
|
284
379
|
});
|
|
285
380
|
var childRunSummarySchema = observationalDocument({
|
|
286
|
-
runId:
|
|
287
|
-
agentId:
|
|
288
|
-
toolName:
|
|
289
|
-
status:
|
|
381
|
+
runId: z6.string().min(1),
|
|
382
|
+
agentId: z6.string().min(1).optional(),
|
|
383
|
+
toolName: z6.string().min(1).optional(),
|
|
384
|
+
status: z6.string().min(1),
|
|
290
385
|
steps: nonnegativeInteger,
|
|
291
386
|
toolCalls: nonnegativeInteger,
|
|
292
387
|
toolErrors: nonnegativeInteger,
|
|
293
388
|
usage: tokenUsageSchema.optional()
|
|
294
389
|
});
|
|
295
390
|
var capabilityReportSchema = observationalDocument({
|
|
296
|
-
provider:
|
|
297
|
-
model:
|
|
298
|
-
supportTier:
|
|
391
|
+
provider: z6.string().min(1),
|
|
392
|
+
model: z6.string().min(1),
|
|
393
|
+
supportTier: z6.string().min(1).optional(),
|
|
299
394
|
capabilities: observationalDocument({
|
|
300
|
-
streaming:
|
|
301
|
-
tools:
|
|
302
|
-
"structured-output":
|
|
303
|
-
"parallel-tools":
|
|
304
|
-
reasoning:
|
|
305
|
-
"web-search":
|
|
395
|
+
streaming: z6.boolean(),
|
|
396
|
+
tools: z6.boolean(),
|
|
397
|
+
"structured-output": z6.boolean(),
|
|
398
|
+
"parallel-tools": z6.boolean(),
|
|
399
|
+
reasoning: z6.boolean(),
|
|
400
|
+
"web-search": z6.boolean()
|
|
306
401
|
})
|
|
307
402
|
});
|
|
308
|
-
var providerConfigurationSchema =
|
|
309
|
-
customEndpoint:
|
|
310
|
-
endpointValid:
|
|
311
|
-
endpointSecure:
|
|
312
|
-
}).catchall(
|
|
403
|
+
var providerConfigurationSchema = z6.object({
|
|
404
|
+
customEndpoint: z6.boolean(),
|
|
405
|
+
endpointValid: z6.boolean(),
|
|
406
|
+
endpointSecure: z6.boolean()
|
|
407
|
+
}).catchall(z6.boolean());
|
|
313
408
|
var providerAvailabilitySchema = observationalDocument({
|
|
314
|
-
id:
|
|
315
|
-
name:
|
|
316
|
-
defaultModel:
|
|
317
|
-
credentialNames:
|
|
318
|
-
capabilities:
|
|
319
|
-
support:
|
|
320
|
-
configured:
|
|
321
|
-
credentials:
|
|
322
|
-
name:
|
|
323
|
-
present:
|
|
409
|
+
id: z6.string().min(1),
|
|
410
|
+
name: z6.string().min(1),
|
|
411
|
+
defaultModel: z6.string().min(1),
|
|
412
|
+
credentialNames: z6.array(z6.string().min(1)),
|
|
413
|
+
capabilities: z6.array(z6.enum(["streaming", "tool-calling", "approval-resume"])),
|
|
414
|
+
support: z6.enum(["certified", "provisional"]),
|
|
415
|
+
configured: z6.boolean(),
|
|
416
|
+
credentials: z6.array(observationalDocument({
|
|
417
|
+
name: z6.string().min(1),
|
|
418
|
+
present: z6.boolean()
|
|
324
419
|
})),
|
|
325
420
|
configuration: providerConfigurationSchema
|
|
326
421
|
});
|
|
327
422
|
var orchestrationConfigSchema = observationalDocument({
|
|
328
|
-
profiles:
|
|
423
|
+
profiles: z6.array(z6.enum(["explorer", "implementer", "tester", "reviewer"])),
|
|
329
424
|
childBudget: budgetConfigSchema,
|
|
330
425
|
childTimeoutMs: nonnegativeInteger,
|
|
331
426
|
maxParallelReviews: nonnegativeInteger
|
|
332
427
|
});
|
|
333
|
-
var executionConfigSchema =
|
|
334
|
-
observationalDocument({ backend:
|
|
428
|
+
var executionConfigSchema = z6.discriminatedUnion("backend", [
|
|
429
|
+
observationalDocument({ backend: z6.literal("none") }),
|
|
335
430
|
observationalDocument({
|
|
336
|
-
backend:
|
|
337
|
-
policyVersion:
|
|
338
|
-
runtime:
|
|
339
|
-
image:
|
|
340
|
-
allowedCommands:
|
|
341
|
-
shellMode:
|
|
431
|
+
backend: z6.literal("oci"),
|
|
432
|
+
policyVersion: z6.string().min(1),
|
|
433
|
+
runtime: z6.enum(["docker", "podman"]),
|
|
434
|
+
image: z6.string().min(1),
|
|
435
|
+
allowedCommands: z6.array(z6.string().min(1)),
|
|
436
|
+
shellMode: z6.enum(["deny", "ask"]),
|
|
342
437
|
maxProcessRuntimeMs: nonnegativeInteger,
|
|
343
438
|
maxProcessOutputBytes: nonnegativeInteger,
|
|
344
439
|
maxMemoryMb: nonnegativeInteger,
|
|
345
440
|
maxPids: nonnegativeInteger,
|
|
346
|
-
maxCpus:
|
|
441
|
+
maxCpus: z6.number().positive(),
|
|
347
442
|
maxWorkspaceBytes: nonnegativeInteger,
|
|
348
443
|
maxFileWriteBytes: nonnegativeInteger,
|
|
349
444
|
tmpfsMb: nonnegativeInteger
|
|
350
445
|
})
|
|
351
446
|
]);
|
|
352
447
|
var executionBindingSchema = observationalDocument({
|
|
353
|
-
environmentId:
|
|
354
|
-
environmentVersion:
|
|
355
|
-
fingerprint:
|
|
356
|
-
workspaceId:
|
|
448
|
+
environmentId: z6.string().min(1),
|
|
449
|
+
environmentVersion: z6.string().min(1).optional(),
|
|
450
|
+
fingerprint: z6.string().min(1),
|
|
451
|
+
workspaceId: z6.string().min(1).optional()
|
|
357
452
|
});
|
|
358
453
|
var ociImageSchema = observationalDocument({
|
|
359
|
-
runtime:
|
|
360
|
-
runtimeVersion:
|
|
361
|
-
imageReference:
|
|
362
|
-
imageId:
|
|
363
|
-
imageDigest:
|
|
454
|
+
runtime: z6.enum(["docker", "podman"]),
|
|
455
|
+
runtimeVersion: z6.string().min(1),
|
|
456
|
+
imageReference: z6.string().min(1),
|
|
457
|
+
imageId: z6.string().min(1),
|
|
458
|
+
imageDigest: z6.string().min(1)
|
|
364
459
|
});
|
|
365
|
-
var runExecutionSchema =
|
|
366
|
-
observationalDocument({ backend:
|
|
460
|
+
var runExecutionSchema = z6.discriminatedUnion("backend", [
|
|
461
|
+
observationalDocument({ backend: z6.literal("none") }),
|
|
367
462
|
observationalDocument({
|
|
368
|
-
backend:
|
|
463
|
+
backend: z6.literal("oci"),
|
|
369
464
|
binding: executionBindingSchema,
|
|
370
465
|
image: ociImageSchema
|
|
371
466
|
})
|
|
@@ -376,45 +471,45 @@ var migrationResultSchema = observationalDocument({
|
|
|
376
471
|
migratedToolCalls: nonnegativeInteger
|
|
377
472
|
});
|
|
378
473
|
var runStoreSchema = observationalDocument({
|
|
379
|
-
backend:
|
|
380
|
-
stateDirectory:
|
|
474
|
+
backend: z6.enum(["sqlite", "file"]),
|
|
475
|
+
stateDirectory: z6.string().min(1),
|
|
381
476
|
migration: migrationResultSchema.optional()
|
|
382
477
|
});
|
|
383
478
|
var doctorCheckSchema = observationalDocument({
|
|
384
|
-
id:
|
|
385
|
-
status:
|
|
386
|
-
message:
|
|
387
|
-
details:
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
479
|
+
id: z6.string().min(1),
|
|
480
|
+
status: z6.enum(["pass", "warn", "fail"]),
|
|
481
|
+
message: z6.string(),
|
|
482
|
+
details: z6.record(z6.string(), z6.union([
|
|
483
|
+
z6.boolean(),
|
|
484
|
+
z6.number(),
|
|
485
|
+
z6.string(),
|
|
486
|
+
z6.array(z6.string())
|
|
392
487
|
]))
|
|
393
488
|
});
|
|
394
489
|
var doctorConfigurationSchema = observationalDocument({
|
|
395
|
-
requireVerifiedDelivery:
|
|
396
|
-
provider:
|
|
397
|
-
model:
|
|
398
|
-
workspace:
|
|
399
|
-
stateDirectory:
|
|
400
|
-
storeBackend:
|
|
490
|
+
requireVerifiedDelivery: z6.boolean().optional(),
|
|
491
|
+
provider: z6.string().min(1),
|
|
492
|
+
model: z6.string().min(1),
|
|
493
|
+
workspace: z6.string().min(1),
|
|
494
|
+
stateDirectory: z6.string().min(1),
|
|
495
|
+
storeBackend: z6.enum(["sqlite", "file"]),
|
|
401
496
|
scope: scopeSchema,
|
|
402
497
|
maxSteps: nonnegativeInteger,
|
|
403
498
|
timeoutMs: nonnegativeInteger,
|
|
404
|
-
unlimitedDuration:
|
|
499
|
+
unlimitedDuration: z6.boolean().optional(),
|
|
405
500
|
budget: budgetConfigSchema,
|
|
406
501
|
costBudget: observationalDocument({
|
|
407
|
-
maxCostUsd:
|
|
408
|
-
inputCostPer1kTokens:
|
|
409
|
-
outputCostPer1kTokens:
|
|
502
|
+
maxCostUsd: z6.number().nonnegative(),
|
|
503
|
+
inputCostPer1kTokens: z6.number().nonnegative(),
|
|
504
|
+
outputCostPer1kTokens: z6.number().nonnegative()
|
|
410
505
|
}).optional(),
|
|
411
506
|
compaction: observationalDocument({
|
|
412
507
|
maxMessages: nonnegativeInteger,
|
|
413
508
|
maxEstimatedInputTokens: nonnegativeInteger,
|
|
414
509
|
keepRecentMessages: nonnegativeInteger
|
|
415
510
|
}),
|
|
416
|
-
allowedChecks:
|
|
417
|
-
requiredCapabilities:
|
|
511
|
+
allowedChecks: z6.array(z6.string().min(1)),
|
|
512
|
+
requiredCapabilities: z6.array(z6.enum([
|
|
418
513
|
"streaming",
|
|
419
514
|
"tools",
|
|
420
515
|
"structured-output",
|
|
@@ -423,24 +518,24 @@ var doctorConfigurationSchema = observationalDocument({
|
|
|
423
518
|
"web-search"
|
|
424
519
|
])),
|
|
425
520
|
orchestration: orchestrationConfigSchema,
|
|
426
|
-
context: observationalDocument({ enabled:
|
|
521
|
+
context: observationalDocument({ enabled: z6.boolean(), configPath: z6.string().min(1) }),
|
|
427
522
|
execution: executionConfigSchema,
|
|
428
|
-
mcpConfigPath:
|
|
523
|
+
mcpConfigPath: z6.string().min(1).optional()
|
|
429
524
|
});
|
|
430
525
|
var cliRunResultDocumentSchema = observationalDocument({
|
|
431
526
|
...jsonBase,
|
|
432
|
-
kind:
|
|
527
|
+
kind: z6.literal("run-result"),
|
|
433
528
|
...runIdentity,
|
|
434
|
-
output:
|
|
529
|
+
output: z6.string(),
|
|
435
530
|
steps: nonnegativeInteger,
|
|
436
531
|
toolCalls: nonnegativeInteger,
|
|
437
|
-
mutations:
|
|
438
|
-
pendingApprovals:
|
|
439
|
-
children:
|
|
532
|
+
mutations: z6.array(mutationAuditSchema),
|
|
533
|
+
pendingApprovals: z6.array(approvalSummarySchema),
|
|
534
|
+
children: z6.array(childRunSummarySchema),
|
|
440
535
|
usage: tokenUsageSchema.optional(),
|
|
441
536
|
budget: budgetStatusSchema,
|
|
442
537
|
costBudget: observationalDocument({
|
|
443
|
-
limitUsd:
|
|
538
|
+
limitUsd: z6.number().nonnegative(),
|
|
444
539
|
estimate: costEstimateSchema
|
|
445
540
|
}).optional(),
|
|
446
541
|
scope: scopeSchema,
|
|
@@ -448,65 +543,65 @@ var cliRunResultDocumentSchema = observationalDocument({
|
|
|
448
543
|
orchestration: observationalDocument({
|
|
449
544
|
profiles: orchestrationConfigSchema.shape.profiles,
|
|
450
545
|
childBudget: budgetConfigSchema,
|
|
451
|
-
mcpServers:
|
|
546
|
+
mcpServers: z6.array(z6.string().min(1))
|
|
452
547
|
}),
|
|
453
548
|
execution: runExecutionSchema,
|
|
454
549
|
store: runStoreSchema,
|
|
455
|
-
stateDirectory:
|
|
550
|
+
stateDirectory: z6.string()
|
|
456
551
|
});
|
|
457
552
|
var cliProviderDocumentSchema = observationalDocument({
|
|
458
553
|
...jsonBase,
|
|
459
|
-
kind:
|
|
460
|
-
providers:
|
|
554
|
+
kind: z6.literal("providers"),
|
|
555
|
+
providers: z6.array(providerAvailabilitySchema)
|
|
461
556
|
});
|
|
462
557
|
var cliInitDocumentSchema = observationalDocument({
|
|
463
558
|
...jsonBase,
|
|
464
|
-
kind:
|
|
559
|
+
kind: z6.literal("init"),
|
|
465
560
|
profile: observationalDocument({
|
|
466
|
-
name:
|
|
467
|
-
path:
|
|
561
|
+
name: z6.string().min(1),
|
|
562
|
+
path: z6.string().min(1),
|
|
468
563
|
schemaVersion: nonnegativeInteger,
|
|
469
|
-
provider:
|
|
470
|
-
model:
|
|
564
|
+
provider: z6.enum(PROVIDERS),
|
|
565
|
+
model: z6.string().min(1),
|
|
471
566
|
reasoningEffort: reasoningEffortSchema.optional()
|
|
472
567
|
}),
|
|
473
568
|
credential: observationalDocument({
|
|
474
|
-
configured:
|
|
475
|
-
names:
|
|
569
|
+
configured: z6.boolean(),
|
|
570
|
+
names: z6.array(z6.string().min(1))
|
|
476
571
|
}),
|
|
477
572
|
next: observationalDocument({
|
|
478
|
-
doctor:
|
|
479
|
-
run:
|
|
573
|
+
doctor: z6.string().min(1),
|
|
574
|
+
run: z6.string().min(1)
|
|
480
575
|
})
|
|
481
576
|
});
|
|
482
577
|
var cliDoctorDocumentSchema = observationalDocument({
|
|
483
578
|
...jsonBase,
|
|
484
|
-
kind:
|
|
485
|
-
ok:
|
|
486
|
-
harnessVersion:
|
|
579
|
+
kind: z6.literal("doctor"),
|
|
580
|
+
ok: z6.boolean(),
|
|
581
|
+
harnessVersion: z6.string().min(1),
|
|
487
582
|
configSchemaVersion: nonnegativeInteger,
|
|
488
583
|
configuration: doctorConfigurationSchema,
|
|
489
|
-
checks:
|
|
490
|
-
providers:
|
|
584
|
+
checks: z6.array(doctorCheckSchema),
|
|
585
|
+
providers: z6.array(providerAvailabilitySchema)
|
|
491
586
|
});
|
|
492
587
|
var cliReviewGroupDocumentSchema = observationalDocument({
|
|
493
588
|
...jsonBase,
|
|
494
|
-
kind:
|
|
495
|
-
groupId:
|
|
496
|
-
status:
|
|
497
|
-
profiles:
|
|
498
|
-
outputs:
|
|
499
|
-
status:
|
|
500
|
-
name:
|
|
501
|
-
agentId:
|
|
502
|
-
runId:
|
|
503
|
-
runStatus:
|
|
504
|
-
output:
|
|
589
|
+
kind: z6.literal("review-group"),
|
|
590
|
+
groupId: z6.string().min(1),
|
|
591
|
+
status: z6.enum(["completed", "failed"]),
|
|
592
|
+
profiles: z6.array(z6.string().min(1)).min(1),
|
|
593
|
+
outputs: z6.array(observationalDocument({
|
|
594
|
+
status: z6.enum(["fulfilled", "rejected"]),
|
|
595
|
+
name: z6.string().min(1).optional(),
|
|
596
|
+
agentId: z6.string().min(1).optional(),
|
|
597
|
+
runId: z6.string().min(1).optional(),
|
|
598
|
+
runStatus: z6.string().min(1).optional(),
|
|
599
|
+
output: z6.string().optional(),
|
|
505
600
|
steps: nonnegativeInteger.optional(),
|
|
506
601
|
usage: tokenUsageSchema.optional(),
|
|
507
602
|
error: observationalDocument({
|
|
508
|
-
code:
|
|
509
|
-
category:
|
|
603
|
+
code: z6.enum(HARNESS_ERROR_CODES),
|
|
604
|
+
category: z6.enum([
|
|
510
605
|
"configuration",
|
|
511
606
|
"usage",
|
|
512
607
|
"workspace",
|
|
@@ -515,16 +610,16 @@ var cliReviewGroupDocumentSchema = observationalDocument({
|
|
|
515
610
|
"approval",
|
|
516
611
|
"execution"
|
|
517
612
|
]),
|
|
518
|
-
retryable:
|
|
613
|
+
retryable: z6.boolean()
|
|
519
614
|
}).optional()
|
|
520
615
|
}))
|
|
521
616
|
});
|
|
522
617
|
var cliRunListDocumentSchema = observationalDocument({
|
|
523
618
|
...jsonBase,
|
|
524
|
-
kind:
|
|
619
|
+
kind: z6.literal("run-list"),
|
|
525
620
|
scope: scopeSchema,
|
|
526
|
-
backend:
|
|
527
|
-
runs:
|
|
621
|
+
backend: z6.string().min(1),
|
|
622
|
+
runs: z6.array(runSummarySchema)
|
|
528
623
|
});
|
|
529
624
|
var runInspectionShape = {
|
|
530
625
|
run: runSummarySchema,
|
|
@@ -533,25 +628,25 @@ var runInspectionShape = {
|
|
|
533
628
|
trace: jsonObjectSchema,
|
|
534
629
|
hierarchy: jsonObjectSchema,
|
|
535
630
|
ledger: jsonObjectSchema,
|
|
536
|
-
toolJournal:
|
|
631
|
+
toolJournal: z6.array(jsonObjectSchema)
|
|
537
632
|
};
|
|
538
633
|
var cliRunInspectionDocumentSchema = observationalDocument({
|
|
539
634
|
...jsonBase,
|
|
540
|
-
kind:
|
|
635
|
+
kind: z6.literal("run-inspection"),
|
|
541
636
|
...runInspectionShape
|
|
542
637
|
});
|
|
543
638
|
var cliRunExportDocumentSchema = observationalDocument({
|
|
544
639
|
...jsonBase,
|
|
545
|
-
kind:
|
|
640
|
+
kind: z6.literal("run-export"),
|
|
546
641
|
...runInspectionShape
|
|
547
642
|
});
|
|
548
643
|
var cliRunCancellationDocumentSchema = observationalDocument({
|
|
549
644
|
...jsonBase,
|
|
550
|
-
kind:
|
|
551
|
-
cascade:
|
|
645
|
+
kind: z6.literal("run-cancellation"),
|
|
646
|
+
cascade: z6.boolean(),
|
|
552
647
|
run: runSummarySchema.optional(),
|
|
553
648
|
parent: runSummarySchema.optional(),
|
|
554
|
-
children:
|
|
649
|
+
children: z6.array(runSummarySchema).optional()
|
|
555
650
|
}).superRefine((document, context) => {
|
|
556
651
|
if (!document.cascade && !document.run || document.cascade && (!document.parent || !document.children)) {
|
|
557
652
|
context.addIssue({ code: "custom", message: "Cancellation payload does not match cascade mode." });
|
|
@@ -559,27 +654,27 @@ var cliRunCancellationDocumentSchema = observationalDocument({
|
|
|
559
654
|
});
|
|
560
655
|
var cliRunCleanupDocumentSchema = observationalDocument({
|
|
561
656
|
...jsonBase,
|
|
562
|
-
kind:
|
|
657
|
+
kind: z6.literal("run-cleanup"),
|
|
563
658
|
before: nonnegativeInteger,
|
|
564
|
-
statuses:
|
|
659
|
+
statuses: z6.array(z6.string().min(1)),
|
|
565
660
|
deleted: nonnegativeInteger
|
|
566
661
|
});
|
|
567
662
|
var cliSessionListDocumentSchema = observationalDocument({
|
|
568
663
|
...jsonBase,
|
|
569
|
-
kind:
|
|
570
|
-
sessions:
|
|
664
|
+
kind: z6.literal("session-list"),
|
|
665
|
+
sessions: z6.array(sessionSchema)
|
|
571
666
|
});
|
|
572
667
|
var cliSessionDocumentSchema = observationalDocument({
|
|
573
668
|
...jsonBase,
|
|
574
|
-
kind:
|
|
669
|
+
kind: z6.literal("session"),
|
|
575
670
|
session: sessionSchema
|
|
576
671
|
});
|
|
577
672
|
var cliChangeEnvelopeVerificationDocumentSchema = observationalDocument({
|
|
578
673
|
...jsonBase,
|
|
579
|
-
kind:
|
|
580
|
-
valid:
|
|
581
|
-
verificationScope:
|
|
582
|
-
issues:
|
|
674
|
+
kind: z6.literal("change-envelope-verification"),
|
|
675
|
+
valid: z6.boolean(),
|
|
676
|
+
verificationScope: z6.literal("integrity-expiration-and-preconditions-only"),
|
|
677
|
+
issues: z6.array(jsonObjectSchema),
|
|
583
678
|
integrity: jsonObjectSchema,
|
|
584
679
|
expiration: jsonObjectSchema,
|
|
585
680
|
checks: jsonObjectSchema,
|
|
@@ -588,39 +683,39 @@ var cliChangeEnvelopeVerificationDocumentSchema = observationalDocument({
|
|
|
588
683
|
});
|
|
589
684
|
var cliStateStatusDocumentSchema = observationalDocument({
|
|
590
685
|
...jsonBase,
|
|
591
|
-
kind:
|
|
592
|
-
compatible:
|
|
686
|
+
kind: z6.literal("state-status"),
|
|
687
|
+
compatible: z6.boolean(),
|
|
593
688
|
schemas: jsonObjectSchema,
|
|
594
|
-
counts:
|
|
689
|
+
counts: z6.record(z6.string(), nonnegativeInteger)
|
|
595
690
|
});
|
|
596
691
|
var cliStateExportDocumentSchema = observationalDocument({
|
|
597
692
|
...jsonBase,
|
|
598
|
-
kind:
|
|
599
|
-
path:
|
|
693
|
+
kind: z6.literal("state-export"),
|
|
694
|
+
path: z6.string().min(1),
|
|
600
695
|
checksum: digestSchema,
|
|
601
|
-
counts:
|
|
696
|
+
counts: z6.record(z6.string(), nonnegativeInteger)
|
|
602
697
|
});
|
|
603
698
|
var cliStateImportDocumentSchema = observationalDocument({
|
|
604
699
|
...jsonBase,
|
|
605
|
-
kind:
|
|
606
|
-
dryRun:
|
|
700
|
+
kind: z6.literal("state-import"),
|
|
701
|
+
dryRun: z6.boolean(),
|
|
607
702
|
checksum: digestSchema,
|
|
608
|
-
inserted:
|
|
703
|
+
inserted: z6.record(z6.string(), nonnegativeInteger),
|
|
609
704
|
identical: nonnegativeInteger
|
|
610
705
|
});
|
|
611
|
-
var providerStreamDiagnosticSchema =
|
|
612
|
-
provider:
|
|
613
|
-
transport:
|
|
614
|
-
diagnosticCode:
|
|
615
|
-
reason:
|
|
616
|
-
retryable:
|
|
706
|
+
var providerStreamDiagnosticSchema = z6.strictObject({
|
|
707
|
+
provider: z6.literal("qwen"),
|
|
708
|
+
transport: z6.enum(["chat", "responses"]),
|
|
709
|
+
diagnosticCode: z6.literal("QWEN_SSE_EVENT_INVALID"),
|
|
710
|
+
reason: z6.enum(["invalid_json", "invalid_event"]),
|
|
711
|
+
retryable: z6.literal(false)
|
|
617
712
|
});
|
|
618
713
|
var cliErrorDocumentSchema = observationalDocument({
|
|
619
|
-
schemaVersion:
|
|
620
|
-
kind:
|
|
714
|
+
schemaVersion: z6.literal(HARNESS_ERROR_SCHEMA_VERSION),
|
|
715
|
+
kind: z6.literal("error"),
|
|
621
716
|
error: observationalDocument({
|
|
622
|
-
code:
|
|
623
|
-
category:
|
|
717
|
+
code: z6.enum(HARNESS_ERROR_CODES),
|
|
718
|
+
category: z6.enum([
|
|
624
719
|
"configuration",
|
|
625
720
|
"usage",
|
|
626
721
|
"workspace",
|
|
@@ -629,22 +724,22 @@ var cliErrorDocumentSchema = observationalDocument({
|
|
|
629
724
|
"approval",
|
|
630
725
|
"execution"
|
|
631
726
|
]),
|
|
632
|
-
retryable:
|
|
727
|
+
retryable: z6.boolean(),
|
|
633
728
|
providerDiagnostic: providerStreamDiagnosticSchema.optional()
|
|
634
729
|
})
|
|
635
730
|
});
|
|
636
731
|
var cliPolicyInspectionSchema = observationalDocument({
|
|
637
732
|
...jsonBase,
|
|
638
|
-
kind:
|
|
733
|
+
kind: z6.literal("policy-inspection"),
|
|
639
734
|
digest: digestSchema.nullable(),
|
|
640
|
-
source:
|
|
641
|
-
explicitReviewRequired:
|
|
642
|
-
tools:
|
|
643
|
-
restrictions:
|
|
644
|
-
execution: observationalDocument({ configuredBackend:
|
|
645
|
-
limits: observationalDocument({ maxSteps: nonnegativeInteger, timeoutMs: nonnegativeInteger, unlimitedDuration:
|
|
735
|
+
source: z6.enum(["operator-file", "application", "baseline"]),
|
|
736
|
+
explicitReviewRequired: z6.boolean(),
|
|
737
|
+
tools: z6.array(observationalDocument({ name: z6.string(), requiresApproval: z6.boolean() })),
|
|
738
|
+
restrictions: z6.array(observationalDocument({ ruleId: z6.string(), tools: z6.array(z6.string()), decision: z6.enum(["allow", "ask_user", "deny"]), reason: z6.string(), pathCount: nonnegativeInteger })),
|
|
739
|
+
execution: observationalDocument({ configuredBackend: z6.enum(["none", "oci"]), activeBackend: z6.enum(["none", "oci"]), evidence: z6.literal("configuration-only") }),
|
|
740
|
+
limits: observationalDocument({ maxSteps: nonnegativeInteger, timeoutMs: nonnegativeInteger, unlimitedDuration: z6.boolean().optional(), budget: jsonObjectSchema })
|
|
646
741
|
});
|
|
647
|
-
var cliJsonDocumentSchema =
|
|
742
|
+
var cliJsonDocumentSchema = z6.union([
|
|
648
743
|
cliPolicyInspectionSchema,
|
|
649
744
|
cliRunResultDocumentSchema,
|
|
650
745
|
cliInitDocumentSchema,
|
|
@@ -667,108 +762,108 @@ var cliJsonDocumentSchema = z5.union([
|
|
|
667
762
|
]);
|
|
668
763
|
var runEvent = (type, shape) => observationalDocument({
|
|
669
764
|
...eventBase,
|
|
670
|
-
kind:
|
|
671
|
-
type:
|
|
765
|
+
kind: z6.literal("run-event"),
|
|
766
|
+
type: z6.literal(type),
|
|
672
767
|
...shape
|
|
673
768
|
});
|
|
674
|
-
var cliRunEventDocumentSchema =
|
|
769
|
+
var cliRunEventDocumentSchema = z6.discriminatedUnion("type", [
|
|
675
770
|
runEvent("policy-decision", {
|
|
676
|
-
phase:
|
|
677
|
-
toolName:
|
|
678
|
-
decision:
|
|
679
|
-
ruleIds:
|
|
680
|
-
reason:
|
|
681
|
-
reasonTruncated:
|
|
771
|
+
phase: z6.enum(["approval-request", "tool-entry"]),
|
|
772
|
+
toolName: z6.string(),
|
|
773
|
+
decision: z6.enum(["allow", "ask_user", "deny"]),
|
|
774
|
+
ruleIds: z6.array(z6.string()),
|
|
775
|
+
reason: z6.string(),
|
|
776
|
+
reasonTruncated: z6.boolean(),
|
|
682
777
|
policyDigest: digestSchema.nullable(),
|
|
683
|
-
source:
|
|
684
|
-
approvalRequired:
|
|
685
|
-
explicitReviewRequired:
|
|
686
|
-
executionBackend:
|
|
687
|
-
evidence:
|
|
778
|
+
source: z6.enum(["operator-file", "application", "baseline"]),
|
|
779
|
+
approvalRequired: z6.boolean(),
|
|
780
|
+
explicitReviewRequired: z6.boolean(),
|
|
781
|
+
executionBackend: z6.enum(["none", "oci"]),
|
|
782
|
+
evidence: z6.literal("policy-evaluation")
|
|
688
783
|
}),
|
|
689
|
-
runEvent("text-delta", { textDelta:
|
|
784
|
+
runEvent("text-delta", { textDelta: z6.string() }),
|
|
690
785
|
runEvent("tool-call", {
|
|
691
|
-
toolCallId:
|
|
692
|
-
toolName:
|
|
786
|
+
toolCallId: z6.string().min(1),
|
|
787
|
+
toolName: z6.string().min(1)
|
|
693
788
|
}),
|
|
694
789
|
runEvent("tool-result", {
|
|
695
|
-
toolCallId:
|
|
696
|
-
toolName:
|
|
697
|
-
isError:
|
|
790
|
+
toolCallId: z6.string().min(1),
|
|
791
|
+
toolName: z6.string().min(1),
|
|
792
|
+
isError: z6.boolean()
|
|
698
793
|
}),
|
|
699
794
|
runEvent("tool-approval-request", {
|
|
700
|
-
approvalRequestId:
|
|
701
|
-
approvalKind:
|
|
702
|
-
toolName:
|
|
795
|
+
approvalRequestId: z6.string().min(1),
|
|
796
|
+
approvalKind: z6.string().min(1),
|
|
797
|
+
toolName: z6.string().min(1)
|
|
703
798
|
}),
|
|
704
799
|
runEvent("agent-approval-request", {
|
|
705
|
-
approvalRequestId:
|
|
706
|
-
approvalKind:
|
|
707
|
-
toolName:
|
|
800
|
+
approvalRequestId: z6.string().min(1),
|
|
801
|
+
approvalKind: z6.string().min(1),
|
|
802
|
+
toolName: z6.string().min(1)
|
|
708
803
|
}),
|
|
709
804
|
runEvent("agent-approval-resolved", {
|
|
710
|
-
approvalRequestId:
|
|
711
|
-
approved:
|
|
805
|
+
approvalRequestId: z6.string().min(1),
|
|
806
|
+
approved: z6.boolean()
|
|
712
807
|
}),
|
|
713
|
-
runEvent("provider-data", { provider:
|
|
808
|
+
runEvent("provider-data", { provider: z6.string().min(1) }),
|
|
714
809
|
runEvent("image-generation", {
|
|
715
|
-
provider:
|
|
716
|
-
partial:
|
|
717
|
-
id:
|
|
810
|
+
provider: z6.string().min(1),
|
|
811
|
+
partial: z6.boolean(),
|
|
812
|
+
id: z6.string().min(1).optional(),
|
|
718
813
|
index: nonnegativeInteger.optional()
|
|
719
814
|
}),
|
|
720
815
|
runEvent("finish", {
|
|
721
|
-
finishReason:
|
|
816
|
+
finishReason: z6.string().min(1).optional(),
|
|
722
817
|
usage: jsonObjectSchema.optional()
|
|
723
818
|
}),
|
|
724
|
-
runEvent("error", { error:
|
|
819
|
+
runEvent("error", { error: z6.literal("Provider stream failed."), providerDiagnostic: providerStreamDiagnosticSchema.optional() }),
|
|
725
820
|
runEvent("agent-run-start", {
|
|
726
821
|
currentStep: nonnegativeInteger,
|
|
727
|
-
maxSteps:
|
|
822
|
+
maxSteps: z6.union([nonnegativeInteger, z6.literal("unlimited")])
|
|
728
823
|
}),
|
|
729
824
|
runEvent("agent-step-start", { stepIndex: nonnegativeInteger }),
|
|
730
825
|
runEvent("agent-step-finish", {
|
|
731
826
|
stepIndex: nonnegativeInteger,
|
|
732
|
-
status:
|
|
827
|
+
status: z6.string().min(1),
|
|
733
828
|
toolCalls: nonnegativeInteger
|
|
734
829
|
}),
|
|
735
830
|
runEvent("agent-compaction", {
|
|
736
|
-
compactionId:
|
|
737
|
-
reasons:
|
|
831
|
+
compactionId: z6.string().min(1),
|
|
832
|
+
reasons: z6.array(z6.string().min(1)),
|
|
738
833
|
messageCountBefore: nonnegativeInteger,
|
|
739
834
|
messageCountAfter: nonnegativeInteger
|
|
740
835
|
}),
|
|
741
836
|
runEvent("agent-run-finish", {
|
|
742
|
-
runId:
|
|
743
|
-
status:
|
|
744
|
-
provider:
|
|
745
|
-
model:
|
|
837
|
+
runId: z6.string().min(1),
|
|
838
|
+
status: z6.string().min(1),
|
|
839
|
+
provider: z6.string().min(1),
|
|
840
|
+
model: z6.string().min(1)
|
|
746
841
|
})
|
|
747
842
|
]);
|
|
748
843
|
var cliStreamResultDocumentSchema = observationalDocument({
|
|
749
844
|
...eventBase,
|
|
750
|
-
kind:
|
|
845
|
+
kind: z6.literal("run-stream-result"),
|
|
751
846
|
...runIdentity,
|
|
752
847
|
steps: nonnegativeInteger,
|
|
753
848
|
toolCalls: nonnegativeInteger,
|
|
754
|
-
pendingApprovals:
|
|
755
|
-
id:
|
|
756
|
-
kind:
|
|
757
|
-
name:
|
|
758
|
-
childRunId:
|
|
759
|
-
childAgentId:
|
|
849
|
+
pendingApprovals: z6.array(observationalDocument({
|
|
850
|
+
id: z6.string().min(1),
|
|
851
|
+
kind: z6.string().min(1),
|
|
852
|
+
name: z6.string().min(1),
|
|
853
|
+
childRunId: z6.string().min(1).optional(),
|
|
854
|
+
childAgentId: z6.string().min(1).optional()
|
|
760
855
|
})),
|
|
761
|
-
children:
|
|
762
|
-
runId:
|
|
763
|
-
status:
|
|
856
|
+
children: z6.array(observationalDocument({
|
|
857
|
+
runId: z6.string().min(1),
|
|
858
|
+
status: z6.string().min(1)
|
|
764
859
|
}))
|
|
765
860
|
});
|
|
766
861
|
var cliStreamErrorDocumentSchema = observationalDocument({
|
|
767
862
|
...eventBase,
|
|
768
|
-
kind:
|
|
863
|
+
kind: z6.literal("run-stream-error"),
|
|
769
864
|
error: cliErrorDocumentSchema.shape.error
|
|
770
865
|
});
|
|
771
|
-
var cliJsonLineDocumentSchema =
|
|
866
|
+
var cliJsonLineDocumentSchema = z6.union([
|
|
772
867
|
cliRunEventDocumentSchema,
|
|
773
868
|
cliStreamResultDocumentSchema,
|
|
774
869
|
cliStreamErrorDocumentSchema
|
|
@@ -880,8 +975,8 @@ var runServiceCli = async (options, annotate) => {
|
|
|
880
975
|
let cursor = await cursorAtEnd();
|
|
881
976
|
let finished = false, streamed = false;
|
|
882
977
|
consoleInput?.startBackground();
|
|
883
|
-
const activity = new ToolActivity((
|
|
884
|
-
process.stderr.write(
|
|
978
|
+
const activity = new ToolActivity((text2) => {
|
|
979
|
+
process.stderr.write(text2);
|
|
885
980
|
}, Boolean(consoleInput && process.stdout.isTTY), () => process.stdout.columns || 80, () => consoleInput?.backgroundStatus ?? "");
|
|
886
981
|
const observe = (a) => {
|
|
887
982
|
if (options.json || options.jsonl)
|
|
@@ -1060,60 +1155,60 @@ Run ${run2.runId} · ${run2.status} · session ${session2.sessionId}
|
|
|
1060
1155
|
});
|
|
1061
1156
|
const literal = input.lastSubmissionWasPaste || raw.includes(`
|
|
1062
1157
|
`);
|
|
1063
|
-
let
|
|
1064
|
-
if (!
|
|
1158
|
+
let text2 = literal ? raw : raw.trim();
|
|
1159
|
+
if (!text2)
|
|
1065
1160
|
continue;
|
|
1066
|
-
if (!literal && ["/exit", "/quit"].includes(
|
|
1161
|
+
if (!literal && ["/exit", "/quit"].includes(text2))
|
|
1067
1162
|
break;
|
|
1068
1163
|
try {
|
|
1069
|
-
if (!literal &&
|
|
1070
|
-
if (
|
|
1164
|
+
if (!literal && text2.startsWith("/")) {
|
|
1165
|
+
if (text2 === "/menu") {
|
|
1071
1166
|
const selected = await navigateConsole(input, { entry: "menu", current: { provider: "service", model: "host" }, providers: [], service: true, sessions: async () => (await list()).map((s) => ({ value: s.sessionId, label: s.title ?? "Untitled conversation", detail: s.sessionId })) });
|
|
1072
1167
|
if (!selected || !("command" in selected))
|
|
1073
1168
|
continue;
|
|
1074
|
-
|
|
1169
|
+
text2 = selected.command;
|
|
1075
1170
|
}
|
|
1076
|
-
if (
|
|
1077
|
-
process.stdout.write(formatConsoleHelp("service",
|
|
1078
|
-
else if (
|
|
1079
|
-
if (
|
|
1171
|
+
if (text2 === "/help" || text2 === "/help all")
|
|
1172
|
+
process.stdout.write(formatConsoleHelp("service", text2 === "/help all"));
|
|
1173
|
+
else if (text2 === "/activity" || text2 === "/activity clear") {
|
|
1174
|
+
if (text2.endsWith(" clear"))
|
|
1080
1175
|
history.clear();
|
|
1081
1176
|
process.stdout.write(history.render());
|
|
1082
|
-
} else if (
|
|
1177
|
+
} else if (text2 === "/queue clear") {
|
|
1083
1178
|
input.clearQueue();
|
|
1084
1179
|
process.stdout.write(`Queued tasks cleared.
|
|
1085
1180
|
`);
|
|
1086
|
-
} else if (
|
|
1181
|
+
} else if (text2 === "/queue")
|
|
1087
1182
|
process.stdout.write(input.queueSummary());
|
|
1088
|
-
else if (
|
|
1089
|
-
print(await list(
|
|
1090
|
-
else if (
|
|
1183
|
+
else if (text2 === "/sessions" || text2.startsWith("/sessions "))
|
|
1184
|
+
print(await list(text2.slice(9).trim() || undefined));
|
|
1185
|
+
else if (text2 === "/new") {
|
|
1091
1186
|
session2 = await create();
|
|
1092
1187
|
input.clearHistory();
|
|
1093
1188
|
history.clear();
|
|
1094
1189
|
seenMutations.clear();
|
|
1095
1190
|
process.stdout.write(`Session ${session2.sessionId}.
|
|
1096
1191
|
`);
|
|
1097
|
-
} else if (
|
|
1098
|
-
let
|
|
1099
|
-
if (!
|
|
1192
|
+
} else if (text2 === "/resume" || text2.startsWith("/resume ")) {
|
|
1193
|
+
let id3 = text2.slice(7).trim();
|
|
1194
|
+
if (!id3) {
|
|
1100
1195
|
const selected = await input.select("Zhivex / Conversations", (await list()).map((s) => ({ value: s.sessionId, label: s.title ?? "Untitled conversation", detail: s.sessionId })));
|
|
1101
1196
|
if (!selected)
|
|
1102
1197
|
continue;
|
|
1103
|
-
|
|
1198
|
+
id3 = selected;
|
|
1104
1199
|
}
|
|
1105
|
-
session2 = await getSession(
|
|
1200
|
+
session2 = await getSession(id3);
|
|
1106
1201
|
input.clearHistory();
|
|
1107
1202
|
history.clear();
|
|
1108
1203
|
seenMutations.clear();
|
|
1109
1204
|
print(await currentRun());
|
|
1110
|
-
} else if (
|
|
1111
|
-
const r = await call({ method: "session.rename", sessionId: session2.sessionId, expectedRevision: session2.revision, idempotencyKey: key("rename"), title:
|
|
1205
|
+
} else if (text2.startsWith("/rename ")) {
|
|
1206
|
+
const r = await call({ method: "session.rename", sessionId: session2.sessionId, expectedRevision: session2.revision, idempotencyKey: key("rename"), title: text2.slice(8) });
|
|
1112
1207
|
if (r.kind === "session")
|
|
1113
1208
|
session2 = r.session;
|
|
1114
|
-
} else if (["/status", "/pending"].includes(
|
|
1209
|
+
} else if (["/status", "/pending"].includes(text2))
|
|
1115
1210
|
print(await currentRun() ?? { message: "No run yet." });
|
|
1116
|
-
else if (
|
|
1211
|
+
else if (text2 === "/paste") {
|
|
1117
1212
|
const draft = await input.multiline();
|
|
1118
1213
|
process.stdout.write(`Draft preview:
|
|
1119
1214
|
${sanitizeTerminalText(draft)}
|
|
@@ -1122,20 +1217,20 @@ ${sanitizeTerminalText(draft)}
|
|
|
1122
1217
|
input.rememberPrompt(draft, true);
|
|
1123
1218
|
await start(draft);
|
|
1124
1219
|
}
|
|
1125
|
-
} else if (
|
|
1220
|
+
} else if (text2 === "/cancel")
|
|
1126
1221
|
await cancel();
|
|
1127
|
-
else if (["/approve", "/deny"].includes(
|
|
1222
|
+
else if (["/approve", "/deny"].includes(text2)) {
|
|
1128
1223
|
const run2 = await currentRun();
|
|
1129
1224
|
if (run2) {
|
|
1130
|
-
const r = await decision(run2,
|
|
1225
|
+
const r = await decision(run2, text2 === "/approve");
|
|
1131
1226
|
finish(r.run, r.streamed);
|
|
1132
1227
|
}
|
|
1133
1228
|
} else
|
|
1134
1229
|
process.stdout.write(`Unsupported service command. Use /help.
|
|
1135
1230
|
`);
|
|
1136
1231
|
} else {
|
|
1137
|
-
input.rememberPrompt(
|
|
1138
|
-
await start(
|
|
1232
|
+
input.rememberPrompt(text2, literal);
|
|
1233
|
+
await start(text2);
|
|
1139
1234
|
}
|
|
1140
1235
|
} catch {
|
|
1141
1236
|
if (input.isClosed)
|