@zhivex-ai/harness 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -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 +36 -36
- package/dist/acp-cli.js +54 -20
- package/dist/approvals/approval-diff.d.ts +2 -1
- package/dist/approvals/approval-preview.d.ts +1 -1
- 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-kvw7ng34.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-entry-75j3r49b.js +484 -0
- package/dist/cli-entry-928p8h41.js +10067 -0
- package/dist/cli-entry-h2yc9x37.js +10350 -0
- package/dist/{cli-entry-20w6nh0k.js → cli-entry-hdtfef27.js} +439 -19
- package/dist/{cli-entry-w0hterjs.js → cli-entry-q8bgkn9m.js} +40 -13
- package/dist/{cli-2h37qyvg.js → cli-vyrytn3m.js} +253 -644
- 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 +1232 -564
- package/dist/{index-8zjmnyw5.js → index-1265j7t2.js} +73 -6
- package/dist/{index-nmjdwd4p.js → index-4gt045j0.js} +109 -1
- package/dist/{index-pdmevfxv.js → index-5zbq9ztj.js} +5 -259
- package/dist/{index-6dft2vev.js → index-63gbp0cz.js} +5 -3
- package/dist/index-6dxrbnxm.js +719 -0
- package/dist/{index-pp474137.js → index-6fp7kdpx.js} +769 -933
- package/dist/{index-61gthdz6.js → index-8sm2a1wa.js} +1 -1
- package/dist/{index-rkbf7dqg.js → index-96ezrvg2.js} +57 -13
- package/dist/index-bt2p8x7r.js +329 -0
- package/dist/index-c39197wq.js +552 -0
- package/dist/{index-m82cfspw.js → index-eps3c3g6.js} +877 -963
- package/dist/{index-s2k2edts.js → index-fqqz1yt8.js} +110 -1544
- package/dist/{index-m34q25jj.js → index-ggstwr0v.js} +192 -838
- package/dist/index-jpdvn09j.js +490 -0
- package/dist/{index-xqxeypt5.js → index-mzydbzp8.js} +76 -4
- package/dist/index-pq3kz1r8.js +269 -0
- package/dist/{index-wg1sd3at.js → index-qfsrrnz6.js} +1 -1
- package/dist/{index-937cb7y8.js → index-vc7yxz50.js} +561 -35
- package/dist/{index-5jhgatga.js → index-vvzc5ezz.js} +7 -6
- package/dist/index-wwthv10a.js +1507 -0
- package/dist/{index-tfzta544.js → index-xfedewpt.js} +17 -9
- package/dist/index-yx52bt4a.js +511 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +93 -77
- package/dist/integrations/mcp-stdio-tools.d.ts +4 -1
- 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/budget-ledger-scope.d.ts +14 -0
- 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-v6qptg9x.js} +400 -305
- package/dist/tools/workspace.d.ts +2 -2
- package/dist/verify-historical-migrations.js +1237 -566
- package/dist/workspace/edit-contracts.d.ts +2 -2
- package/dist/workspace/path-policy.d.ts +2 -1
- package/dist/workspace/workspace.d.ts +13 -0
- 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 +59 -7
- 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 +8 -4
- package/docs/FIRST_USE.md +6 -6
- package/docs/MINIMUM_TASK_AUTHORITY.md +3 -3
- package/docs/PROJECT_MEMORY.md +1 -1
- package/docs/PUBLIC_SECURITY.md +14 -1
- package/docs/README.md +6 -1
- package/docs/REPOSITORY_EDITING.md +1 -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/TOOL_POLICY.md +4 -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 +7 -4
- 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 +19 -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,11 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
VERTEX_ENVIRONMENT,
|
|
3
|
+
azureOpenAIConfigured,
|
|
4
|
+
bedrockConfigured,
|
|
5
|
+
createAzureOpenAIModel,
|
|
6
|
+
createBedrockModel,
|
|
3
7
|
createVertexModel,
|
|
4
8
|
vertexConfigured
|
|
5
|
-
} from "./index-
|
|
9
|
+
} from "./index-c39197wq.js";
|
|
6
10
|
import {
|
|
7
11
|
bundledDefaultModel
|
|
8
|
-
} from "./index-
|
|
12
|
+
} from "./index-mzydbzp8.js";
|
|
9
13
|
import {
|
|
10
14
|
HarnessConfigError,
|
|
11
15
|
HarnessProviderError
|
|
@@ -323,7 +327,7 @@ import { createAnthropic } from "@zhivex-ai/anthropic";
|
|
|
323
327
|
import { createGemini } from "@zhivex-ai/gemini";
|
|
324
328
|
import { createOpenAI } from "@zhivex-ai/openai";
|
|
325
329
|
import { createQwen } from "@zhivex-ai/qwen";
|
|
326
|
-
var PROVIDERS = ["meta", "qwen", "openai", "gemini", "anthropic", "vertex"];
|
|
330
|
+
var PROVIDERS = ["meta", "qwen", "openai", "gemini", "anthropic", "vertex", "bedrock", "azure-openai"];
|
|
327
331
|
var HARNESS_PROVIDER_CAPABILITIES = [
|
|
328
332
|
"streaming",
|
|
329
333
|
"tool-calling",
|
|
@@ -542,13 +546,13 @@ var createProviderRegistry = (registrations) => {
|
|
|
542
546
|
const credentials = Object.freeze(registration.descriptor.credentialNames.map((name) => Object.freeze({ name, present: Boolean(env[name]?.trim()) })));
|
|
543
547
|
return Object.freeze({
|
|
544
548
|
...registration.descriptor,
|
|
545
|
-
configured: registration.descriptor.id
|
|
549
|
+
configured: builtinConfigured(registration.descriptor.id, env, credentials),
|
|
546
550
|
credentials,
|
|
547
551
|
configuration: providerConfiguration(registration.diagnostics, env)
|
|
548
552
|
});
|
|
549
553
|
})),
|
|
550
554
|
transportFingerprint: (env = process.env) => {
|
|
551
|
-
const transport = frozenRegistrations.filter((registration) => (registration.descriptor.id
|
|
555
|
+
const transport = frozenRegistrations.filter((registration) => includeTransport(registration.descriptor.id, env)).map((registration) => {
|
|
552
556
|
const names = [
|
|
553
557
|
registration.diagnostics.endpointEnvironmentVariable,
|
|
554
558
|
...(registration.diagnostics.presence ?? []).map((entry) => entry.environmentVariable),
|
|
@@ -568,6 +572,27 @@ var createProviderRegistry = (registrations) => {
|
|
|
568
572
|
});
|
|
569
573
|
return registry;
|
|
570
574
|
};
|
|
575
|
+
var environmentPresent = (env, names) => names.some((name) => Boolean(env[name]?.trim()));
|
|
576
|
+
var builtinConfigured = (id, env, credentials) => {
|
|
577
|
+
if (id === "vertex")
|
|
578
|
+
return vertexConfigured(env);
|
|
579
|
+
if (id === "bedrock")
|
|
580
|
+
return bedrockConfigured(env);
|
|
581
|
+
if (id === "azure-openai")
|
|
582
|
+
return azureOpenAIConfigured(env);
|
|
583
|
+
return credentials.length === 0 || credentials.some((credential) => credential.present);
|
|
584
|
+
};
|
|
585
|
+
var includeTransport = (id, env) => {
|
|
586
|
+
if (id === "anthropic")
|
|
587
|
+
return Boolean(env.ANTHROPIC_BASE_URL?.trim());
|
|
588
|
+
if (id === "vertex")
|
|
589
|
+
return environmentPresent(env, VERTEX_ENVIRONMENT);
|
|
590
|
+
if (id === "bedrock")
|
|
591
|
+
return bedrockConfigured(env);
|
|
592
|
+
if (id === "azure-openai")
|
|
593
|
+
return azureOpenAIConfigured(env);
|
|
594
|
+
return true;
|
|
595
|
+
};
|
|
571
596
|
var optionalQwenRegion = (value) => {
|
|
572
597
|
if (!value) {
|
|
573
598
|
return;
|
|
@@ -797,6 +822,48 @@ var BUILTIN_PROVIDER_REGISTRATIONS = Object.freeze([
|
|
|
797
822
|
...baseURL ? { baseURL } : {}
|
|
798
823
|
})(model);
|
|
799
824
|
}
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
descriptor: {
|
|
828
|
+
id: "bedrock",
|
|
829
|
+
name: "Amazon Bedrock",
|
|
830
|
+
defaultModel: bundledDefaultModel("bedrock"),
|
|
831
|
+
credentialNames: ["BEDROCK_API_KEY", "AWS_BEARER_TOKEN_BEDROCK"],
|
|
832
|
+
capabilities: HARNESS_PROVIDER_CAPABILITIES,
|
|
833
|
+
support: "provisional"
|
|
834
|
+
},
|
|
835
|
+
diagnostics: {
|
|
836
|
+
endpointEnvironmentVariable: "BEDROCK_OPENAI_BASE_URL",
|
|
837
|
+
presence: [
|
|
838
|
+
{ key: "region", environmentVariable: "AWS_REGION" },
|
|
839
|
+
{ key: "defaultRegion", environmentVariable: "AWS_DEFAULT_REGION" },
|
|
840
|
+
{ key: "profile", environmentVariable: "AWS_PROFILE" }
|
|
841
|
+
],
|
|
842
|
+
enums: [{
|
|
843
|
+
key: "runtime",
|
|
844
|
+
environmentVariable: "BEDROCK_RUNTIME",
|
|
845
|
+
allowedValues: ["converse", "openai"]
|
|
846
|
+
}]
|
|
847
|
+
},
|
|
848
|
+
factory: ({ model, env }) => createBedrockModel(model, env)
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
descriptor: {
|
|
852
|
+
id: "azure-openai",
|
|
853
|
+
name: "Azure OpenAI",
|
|
854
|
+
defaultModel: bundledDefaultModel("azure-openai"),
|
|
855
|
+
credentialNames: ["AZURE_OPENAI_API_KEY"],
|
|
856
|
+
capabilities: HARNESS_PROVIDER_CAPABILITIES,
|
|
857
|
+
support: "provisional"
|
|
858
|
+
},
|
|
859
|
+
diagnostics: {
|
|
860
|
+
endpointEnvironmentVariable: "AZURE_OPENAI_ENDPOINT",
|
|
861
|
+
presence: [
|
|
862
|
+
{ key: "apiVersion", environmentVariable: "AZURE_OPENAI_API_VERSION" },
|
|
863
|
+
{ key: "deployments", environmentVariable: "AZURE_OPENAI_DEPLOYMENTS" }
|
|
864
|
+
]
|
|
865
|
+
},
|
|
866
|
+
factory: ({ model, env }) => createAzureOpenAIModel(model, env)
|
|
800
867
|
}
|
|
801
868
|
]);
|
|
802
869
|
var DEFAULT_PROVIDER_REGISTRY = createProviderRegistry(BUILTIN_PROVIDER_REGISTRATIONS);
|
|
@@ -1218,7 +1285,7 @@ var resolveHarnessConfig = (input = {}, registry = DEFAULT_PROVIDER_REGISTRY) =>
|
|
|
1218
1285
|
var createProviderModel = (config, env = process.env, registry = DEFAULT_PROVIDER_REGISTRY) => {
|
|
1219
1286
|
try {
|
|
1220
1287
|
const model = registry.createModel(config, env);
|
|
1221
|
-
return registry === DEFAULT_PROVIDER_REGISTRY && ["anthropic", "openai", "gemini", "vertex", "qwen"].includes(config.provider) ? markTaskTransportModel(model) : model;
|
|
1288
|
+
return registry === DEFAULT_PROVIDER_REGISTRY && ["anthropic", "openai", "gemini", "vertex", "qwen", "bedrock", "azure-openai"].includes(config.provider) ? markTaskTransportModel(model) : model;
|
|
1222
1289
|
} catch (error) {
|
|
1223
1290
|
throw new HarnessProviderError(`Provider ${config.provider} could not be initialized.`, {
|
|
1224
1291
|
cause: error,
|
|
@@ -160,6 +160,24 @@ var harnessClientCommandSchema = z.discriminatedUnion("method", [
|
|
|
160
160
|
z.object({ method: z.literal("restore.apply"), ...restore, ...mutation, expectedRevision: revision, reviewedProposalId: fileDigest }).strict(),
|
|
161
161
|
z.object({ method: z.literal("restore.recoverFork"), ...restore, ...mutation, expectedRevision: revision, forkSessionId: id }).strict(),
|
|
162
162
|
z.object({ method: z.literal("run.start"), ...session, ...mutation, expectedRevision: revision, prompt: z.string().min(1).max(64 * 1024) }).strict(),
|
|
163
|
+
z.object({
|
|
164
|
+
method: z.literal("task.start"),
|
|
165
|
+
...session,
|
|
166
|
+
...mutation,
|
|
167
|
+
expectedRevision: revision,
|
|
168
|
+
brief: z.strictObject({
|
|
169
|
+
goal: z.string().trim().min(1).max(2000),
|
|
170
|
+
paths: z.array(z.string().min(1).max(1024)).min(1).max(20),
|
|
171
|
+
checks: z.array(id).min(1).max(8),
|
|
172
|
+
constraints: z.array(z.string().trim().min(1).max(500)).max(8),
|
|
173
|
+
budget: z.strictObject({ inputTokens: z.number().int().positive().safe(), outputTokens: z.number().int().positive().safe(), totalTokens: z.number().int().positive().safe() })
|
|
174
|
+
})
|
|
175
|
+
}).strict(),
|
|
176
|
+
z.object({ method: z.literal("task.review"), ...run }).strict(),
|
|
177
|
+
z.object({ method: z.literal("task.keep"), ...run, ...mutation, reviewId: z.string().uuid() }).strict(),
|
|
178
|
+
z.object({ method: z.literal("task.revise"), ...run, ...mutation, reviewId: z.string().uuid(), correction: z.string().trim().min(1).max(500) }).strict(),
|
|
179
|
+
z.object({ method: z.literal("task.continue"), ...run, ...mutation, reviewId: z.string().uuid(), prompt: z.string().trim().min(1).max(2000) }).strict(),
|
|
180
|
+
z.object({ method: z.literal("task.get"), ...run, projectionVersion: z.number().int().nonnegative().safe() }).strict(),
|
|
163
181
|
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(),
|
|
164
182
|
z.object({
|
|
165
183
|
method: z.literal("approval.resolve"),
|
|
@@ -177,4 +195,94 @@ var harnessClientRequestSchema = z.object({
|
|
|
177
195
|
command: harnessClientCommandSchema
|
|
178
196
|
}).strict();
|
|
179
197
|
|
|
180
|
-
|
|
198
|
+
// src/client/task-projection.ts
|
|
199
|
+
import { z as z2 } from "zod";
|
|
200
|
+
var HARNESS_TASK_PROJECTION_VERSION = 1;
|
|
201
|
+
var id2 = z2.string().regex(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/);
|
|
202
|
+
var count = z2.number().int().nonnegative().safe();
|
|
203
|
+
var digest = z2.string().regex(/^sha256:[a-f0-9]{64}$/);
|
|
204
|
+
var text = z2.string().max(2048);
|
|
205
|
+
var tokens = z2.strictObject({ inputTokens: count, outputTokens: count, totalTokens: count });
|
|
206
|
+
var harnessTaskProjectionSchema = z2.strictObject({
|
|
207
|
+
schemaVersion: z2.literal(1),
|
|
208
|
+
connectionId: id2,
|
|
209
|
+
sequence: count,
|
|
210
|
+
projectId: id2,
|
|
211
|
+
sessionId: id2,
|
|
212
|
+
runId: id2,
|
|
213
|
+
task: z2.strictObject({
|
|
214
|
+
reference: digest,
|
|
215
|
+
contractRevision: count,
|
|
216
|
+
contractDigest: digest,
|
|
217
|
+
runRevision: count,
|
|
218
|
+
objective: text.nullable(),
|
|
219
|
+
objectiveSource: z2.enum(["operator_brief", "retained_operator_source", "unavailable"]),
|
|
220
|
+
observedRunId: id2,
|
|
221
|
+
historicalRequest: z2.boolean(),
|
|
222
|
+
execution: z2.enum(["created", "queued", "running", "waiting_approval", "cancel_requested", "completed", "failed", "cancelled", "timed_out", "unknown"]),
|
|
223
|
+
artifact: z2.strictObject({
|
|
224
|
+
observedDigest: digest.nullable(),
|
|
225
|
+
deliveredDigest: digest.nullable(),
|
|
226
|
+
correspondence: z2.enum(["current", "stale", "missing"]),
|
|
227
|
+
paths: z2.array(text).max(256),
|
|
228
|
+
contents: z2.literal("not_included")
|
|
229
|
+
}),
|
|
230
|
+
review: z2.strictObject({
|
|
231
|
+
structure: z2.enum(["verified", "incomplete"]),
|
|
232
|
+
semantic: z2.literal("pending"),
|
|
233
|
+
acceptance: z2.literal("not_recorded"),
|
|
234
|
+
human: z2.array(z2.strictObject({ id: text, requirement: text, status: z2.literal("pending") })).max(32),
|
|
235
|
+
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)
|
|
236
|
+
}),
|
|
237
|
+
budget: z2.strictObject({
|
|
238
|
+
availability: z2.enum(["authoritative", "legacy_not_enabled"]),
|
|
239
|
+
revision: count.nullable(),
|
|
240
|
+
confirmed: tokens.nullable(),
|
|
241
|
+
reserved: tokens.nullable(),
|
|
242
|
+
unknown: tokens.nullable(),
|
|
243
|
+
remaining: tokens.nullable(),
|
|
244
|
+
limits: tokens.nullable(),
|
|
245
|
+
estimated: z2.null(),
|
|
246
|
+
estimation: z2.literal("not_separately_recorded"),
|
|
247
|
+
usageComplete: z2.boolean().nullable(),
|
|
248
|
+
admissionsClosed: z2.boolean().nullable(),
|
|
249
|
+
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") })
|
|
250
|
+
}),
|
|
251
|
+
effects: z2.strictObject({ readOnly: count, recorded: count, unknown: count, missingEvidence: z2.boolean(), automaticReplay: z2.literal(false), providerStopped: z2.literal("unconfirmed") }),
|
|
252
|
+
nextAction: z2.strictObject({
|
|
253
|
+
kind: z2.enum(["wait", "reconcile", "review_approval", "review_delivery", "explicit_continuation"]),
|
|
254
|
+
permitted: z2.literal("read_only"),
|
|
255
|
+
authorization: z2.literal("required_for_execution"),
|
|
256
|
+
preserves: z2.literal("contract_receipts_budget_and_effects"),
|
|
257
|
+
automaticReplay: z2.literal(false)
|
|
258
|
+
}),
|
|
259
|
+
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(),
|
|
260
|
+
reasons: z2.array(z2.string().regex(/^[A-Z][A-Z0-9_]{0,95}$/)).max(32),
|
|
261
|
+
provenance: z2.literal("host_durable_contract_journal_budget_and_fresh_native_snapshot"),
|
|
262
|
+
textTruncated: z2.boolean()
|
|
263
|
+
})
|
|
264
|
+
});
|
|
265
|
+
function reduceHarnessTaskProjection(current, incoming, expected) {
|
|
266
|
+
const inScope = (value) => ["connectionId", "projectId", "sessionId", "runId"].every((key) => value[key] === expected[key]);
|
|
267
|
+
const previous = harnessTaskProjectionSchema.safeParse(current);
|
|
268
|
+
const retained = previous.success && inScope(previous.data) ? previous.data : null;
|
|
269
|
+
let encoded;
|
|
270
|
+
try {
|
|
271
|
+
encoded = JSON.stringify(incoming);
|
|
272
|
+
} catch {
|
|
273
|
+
return { status: "refresh_required", snapshot: retained };
|
|
274
|
+
}
|
|
275
|
+
if (new TextEncoder().encode(encoded).length > 64 * 1024)
|
|
276
|
+
return { status: "refresh_required", snapshot: retained };
|
|
277
|
+
const parsed = harnessTaskProjectionSchema.safeParse(incoming);
|
|
278
|
+
if (!parsed.success || !inScope(parsed.data))
|
|
279
|
+
return { status: "refresh_required", snapshot: retained };
|
|
280
|
+
if (retained && parsed.data.sequence <= retained.sequence) {
|
|
281
|
+
if (parsed.data.sequence === retained.sequence && JSON.stringify(parsed.data) !== JSON.stringify(retained))
|
|
282
|
+
return { status: "refresh_required", snapshot: retained };
|
|
283
|
+
return { status: "ignored", snapshot: retained };
|
|
284
|
+
}
|
|
285
|
+
return { status: "applied", snapshot: parsed.data };
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export { CLI_JSON_SCHEMA_VERSION, CLI_EVENT_SCHEMA_VERSION, streamEventDocument, serializeStreamEvent, streamResultDocument, serializeStreamResult, HARNESS_CLIENT_PROTOCOL_VERSION, harnessClientCommandSchema, harnessClientRequestSchema, HARNESS_TASK_PROJECTION_VERSION, harnessTaskProjectionSchema, reduceHarnessTaskProjection };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HARNESS_VERSION
|
|
3
|
+
} from "./index-pq3kz1r8.js";
|
|
1
4
|
import {
|
|
2
5
|
readRegularFileNoFollow
|
|
3
|
-
} from "./index-
|
|
6
|
+
} from "./index-6dxrbnxm.js";
|
|
4
7
|
import {
|
|
5
8
|
HarnessConfigError,
|
|
6
9
|
HarnessError,
|
|
@@ -8,263 +11,6 @@ import {
|
|
|
8
11
|
HarnessProviderError,
|
|
9
12
|
HarnessWorkspaceError
|
|
10
13
|
} from "./index-bpc596v3.js";
|
|
11
|
-
// package.json
|
|
12
|
-
var package_default = {
|
|
13
|
-
name: "@zhivex-ai/harness",
|
|
14
|
-
version: "1.4.0",
|
|
15
|
-
description: "Governed, provider-portable runtime for coding agents with durable approvals and isolated repository execution.",
|
|
16
|
-
type: "module",
|
|
17
|
-
license: "MIT",
|
|
18
|
-
repository: {
|
|
19
|
-
type: "git",
|
|
20
|
-
url: "git+https://github.com/Zhivex/zhivex-harness.git"
|
|
21
|
-
},
|
|
22
|
-
bugs: {
|
|
23
|
-
url: "https://github.com/Zhivex/zhivex-harness/issues"
|
|
24
|
-
},
|
|
25
|
-
homepage: "https://github.com/Zhivex/zhivex-harness#readme",
|
|
26
|
-
publishConfig: {
|
|
27
|
-
access: "public",
|
|
28
|
-
provenance: true,
|
|
29
|
-
registry: "https://registry.npmjs.org/"
|
|
30
|
-
},
|
|
31
|
-
keywords: [
|
|
32
|
-
"ai",
|
|
33
|
-
"agents",
|
|
34
|
-
"coding-agent",
|
|
35
|
-
"agent-runtime",
|
|
36
|
-
"agent-governance",
|
|
37
|
-
"change-control",
|
|
38
|
-
"policy-as-code",
|
|
39
|
-
"software-supply-chain",
|
|
40
|
-
"sandbox",
|
|
41
|
-
"durable-workflows",
|
|
42
|
-
"mcp",
|
|
43
|
-
"docker",
|
|
44
|
-
"typescript",
|
|
45
|
-
"node",
|
|
46
|
-
"bun",
|
|
47
|
-
"harness",
|
|
48
|
-
"zhivex"
|
|
49
|
-
],
|
|
50
|
-
bin: {
|
|
51
|
-
"zhivex-harness": "./dist/cli.js",
|
|
52
|
-
zhx: "./dist/zhx.js",
|
|
53
|
-
"zhx-acp": "./dist/acp-cli.js"
|
|
54
|
-
},
|
|
55
|
-
exports: {
|
|
56
|
-
".": {
|
|
57
|
-
types: "./dist/index.d.ts",
|
|
58
|
-
import: "./dist/index.js"
|
|
59
|
-
},
|
|
60
|
-
"./engine": {
|
|
61
|
-
types: "./dist/engine/index.d.ts",
|
|
62
|
-
import: "./dist/engine/index.js"
|
|
63
|
-
},
|
|
64
|
-
"./protocol": {
|
|
65
|
-
types: "./dist/engine/protocol.d.ts",
|
|
66
|
-
import: "./dist/engine/protocol.js"
|
|
67
|
-
},
|
|
68
|
-
"./client": {
|
|
69
|
-
types: "./dist/engine/client.d.ts",
|
|
70
|
-
import: "./dist/engine/client.js"
|
|
71
|
-
},
|
|
72
|
-
"./service": {
|
|
73
|
-
types: "./dist/engine/service.d.ts",
|
|
74
|
-
import: "./dist/engine/service.js"
|
|
75
|
-
},
|
|
76
|
-
"./acp": {
|
|
77
|
-
types: "./dist/engine/acp.d.ts",
|
|
78
|
-
import: "./dist/engine/acp.js"
|
|
79
|
-
},
|
|
80
|
-
"./code-support": {
|
|
81
|
-
types: "./dist/compat/code-support.d.ts",
|
|
82
|
-
import: "./dist/compat/code-support.js"
|
|
83
|
-
},
|
|
84
|
-
"./models": {
|
|
85
|
-
types: "./dist/engine/models.d.ts",
|
|
86
|
-
import: "./dist/engine/models.js"
|
|
87
|
-
},
|
|
88
|
-
"./desktop/v1/state": {
|
|
89
|
-
types: "./dist/engine/desktop-state-v1.d.ts",
|
|
90
|
-
import: "./dist/engine/desktop-state-v1.js"
|
|
91
|
-
},
|
|
92
|
-
"./desktop/v1/providers": {
|
|
93
|
-
types: "./dist/engine/desktop-providers-v1.d.ts",
|
|
94
|
-
import: "./dist/engine/desktop-providers-v1.js"
|
|
95
|
-
},
|
|
96
|
-
"./mcp/stdio/v1": {
|
|
97
|
-
types: "./dist/engine/mcp-stdio-v1.d.ts",
|
|
98
|
-
import: "./dist/engine/mcp-stdio-v1.js"
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
files: [
|
|
102
|
-
"dist",
|
|
103
|
-
"README.md",
|
|
104
|
-
"CHANGELOG.md",
|
|
105
|
-
"SECURITY.md",
|
|
106
|
-
"SUPPORT.md",
|
|
107
|
-
"LICENSE",
|
|
108
|
-
"docs/CHANGE_ENVELOPES.md",
|
|
109
|
-
"docs/CLI.md",
|
|
110
|
-
"docs/WEB_LIMITS.md",
|
|
111
|
-
"docs/CODE_RELEASE.md",
|
|
112
|
-
"docs/images/cli-conversation.png",
|
|
113
|
-
"docs/CLIENT_PROTOCOL.md",
|
|
114
|
-
"docs/CONTEXT_ENGINEERING.md",
|
|
115
|
-
"docs/CREDENTIALS.md",
|
|
116
|
-
"docs/MODEL_CATALOG.md",
|
|
117
|
-
"docs/DEPRECATIONS.md",
|
|
118
|
-
"docs/DURABLE_OPERATIONS.md",
|
|
119
|
-
"docs/EXECUTION_ENVIRONMENTS.md",
|
|
120
|
-
"docs/EXTENSIBILITY.md",
|
|
121
|
-
"docs/FIRST_USE.md",
|
|
122
|
-
"docs/FIRST_USE_EXAMPLE.md",
|
|
123
|
-
"docs/HOSTILE_REPOSITORY_DEMO.md",
|
|
124
|
-
"docs/LOCAL_SERVICE.md",
|
|
125
|
-
"docs/PUBLIC_SECURITY.md",
|
|
126
|
-
"docs/README.md",
|
|
127
|
-
"docs/REPOSITORY_EDITING.md",
|
|
128
|
-
"docs/STABILITY.md",
|
|
129
|
-
"docs/SUPPORT_MATRIX.md",
|
|
130
|
-
"docs/SUPPORT_MATRIX_1_1.md",
|
|
131
|
-
"docs/THREAT_MODEL.md",
|
|
132
|
-
"docs/TIME_TO_SAFE_FIX.md",
|
|
133
|
-
"docs/USAGE.md",
|
|
134
|
-
"docs/support-matrix.json",
|
|
135
|
-
"docs/support-matrix-1.1.json",
|
|
136
|
-
"contracts",
|
|
137
|
-
"examples",
|
|
138
|
-
"fixtures",
|
|
139
|
-
"evaluations/*.json",
|
|
140
|
-
"evaluations/*.jsonl",
|
|
141
|
-
"benchmarks/README.md",
|
|
142
|
-
"docs/ACP.md",
|
|
143
|
-
"docs/WORKSPACE_CHECKPOINTS.md",
|
|
144
|
-
"docs/ENGINE_API.md",
|
|
145
|
-
"docs/ANTHROPIC.md",
|
|
146
|
-
"docs/MCP_STDIO.md",
|
|
147
|
-
"docs/adr/0002-isolated-mcp-stdio.md",
|
|
148
|
-
"docs/VERTEX.md",
|
|
149
|
-
"docs/TOOL_POLICY.md",
|
|
150
|
-
"docs/fixtures/mcp-stdio-contract-v1.json",
|
|
151
|
-
"docs/PROJECT_MEMORY.md",
|
|
152
|
-
"docs/MINIMUM_TASK_AUTHORITY.md",
|
|
153
|
-
"docs/MINIMUM_OFFLINE_EVALS.md"
|
|
154
|
-
],
|
|
155
|
-
scripts: {
|
|
156
|
-
"models:check": "bun run scripts/validate-model-catalog.ts",
|
|
157
|
-
"models:import": "bun run scripts/generate-console-models.ts",
|
|
158
|
-
dev: "bun run build && node --env-file-if-exists=.env dist/cli.js",
|
|
159
|
-
start: "node dist/cli.js",
|
|
160
|
-
build: "bun run scripts/clean-dist.ts && bun build ./src/index.ts ./src/service-cli.ts ./src/acp-cli.ts ./src/engine/index.ts ./src/engine/protocol.ts ./src/engine/client.ts ./src/engine/service.ts ./src/engine/acp.ts ./src/engine/models.ts ./src/engine/desktop-state-v1.ts ./src/engine/desktop-providers-v1.ts ./src/compat/code-support.ts ./src/engine/mcp-stdio-v1.ts --root ./src --outdir ./dist --target node --packages external --splitting && bun build ./src/engine/protocol.ts ./src/engine/models.ts --outdir ./dist/engine --target browser --packages external && bun build ./src/cli-entry.ts --outdir ./dist --target node --packages external --splitting && mv ./dist/cli-entry.js ./dist/cli.js && cp ./dist/cli.js ./dist/zhx.js && bun build ./scripts/verify-historical-migrations.ts --outfile ./dist/verify-historical-migrations.js --target node --packages external && bun build ./scripts/hostile-repository-demo.ts --outfile ./dist/hostile-repository-demo.js --target node --packages external && tsc --emitDeclarationOnly",
|
|
161
|
-
prepack: "bun run build",
|
|
162
|
-
"architecture:check": "bun run scripts/check-architecture.ts",
|
|
163
|
-
"docs:check": "bun run scripts/check-docs.ts",
|
|
164
|
-
"contract:check": "bun run scripts/check-1-0-readiness.ts",
|
|
165
|
-
"contract:signatures:update": "bun run scripts/generate-stable-api-signatures.ts --write",
|
|
166
|
-
"migration:check": "bun run scripts/verify-historical-migrations.ts",
|
|
167
|
-
"readiness:1.0": "bun run scripts/check-1-0-readiness.ts",
|
|
168
|
-
"readiness:1.0:release": "bun run scripts/check-1-0-readiness.ts --release",
|
|
169
|
-
typecheck: "tsc --noEmit",
|
|
170
|
-
test: "bun test ./tests ./desktop/tests",
|
|
171
|
-
evaluate: "bun run scripts/evaluate.ts",
|
|
172
|
-
"benchmark:workspace": "bun run scripts/benchmark-workspace.ts",
|
|
173
|
-
"benchmark:workspace:ci": "bun run scripts/benchmark-workspace.ts --files 1000 --page-size 100 --repetitions 3 --warmups 0",
|
|
174
|
-
"benchmark:oci": "bun run scripts/benchmark-oci.ts",
|
|
175
|
-
"benchmark:safe-fix": "bun run scripts/benchmark-time-to-safe-fix.ts",
|
|
176
|
-
"benchmark:safe-fix:ci": "bun run scripts/benchmark-time-to-safe-fix.ts --tasks 2 --repetitions 1 --profiles direct,governed,optimized --carriers rule_file --summary",
|
|
177
|
-
"benchmark:safe-fix:live": "bun --env-file=.env run scripts/benchmark-time-to-safe-fix.ts --driver-zhivex",
|
|
178
|
-
"benchmark:safe-fix:live:smoke": "bun --env-file=.env run scripts/benchmark-time-to-safe-fix.ts --tasks 2 --repetitions 1 --profiles direct,governed,optimized --carriers rule_file --driver-zhivex --summary",
|
|
179
|
-
"benchmark:safe-fix:live:expanded": "bun --env-file=.env run scripts/benchmark-time-to-safe-fix.ts --dataset evaluations/time-to-safe-fix-expanded.jsonl --dataset-name zhivex-time-to-safe-fix-expanded --tasks 12 --repetitions 3 --profiles direct,governed,optimized --carriers rule_file --driver-zhivex --driver-timeout-ms 300000 --summary",
|
|
180
|
-
"benchmark:safe-fix:baseline": "bun run scripts/create-time-to-safe-fix-baseline.ts",
|
|
181
|
-
"benchmark:safe-fix:image:check": "bun run scripts/build-time-to-safe-fix-image.ts --validate-only",
|
|
182
|
-
"benchmark:safe-fix:image:build": "bun run scripts/build-time-to-safe-fix-image.ts",
|
|
183
|
-
"smoke:package": "bun run build && bun run scripts/package-smoke.ts",
|
|
184
|
-
"smoke:artifact": "bun run scripts/package-smoke.ts",
|
|
185
|
-
"smoke:mcp": "bun run scripts/mcp-interoperability-smoke.ts",
|
|
186
|
-
"smoke:mcp:official": "bun run scripts/mcp-official-sdk-smoke.ts",
|
|
187
|
-
"smoke:oci": "bun run scripts/oci-execution-smoke.ts",
|
|
188
|
-
"smoke:live": "bun --env-file=.env run scripts/live-provider-smoke.ts",
|
|
189
|
-
"smoke:live:orchestration": "bun --env-file=.env run scripts/live-orchestration-smoke.ts",
|
|
190
|
-
"smoke:live:routing": "bun --env-file=.env run scripts/live-routing-smoke.ts",
|
|
191
|
-
"smoke:live:execution": "bun --env-file=.env run scripts/live-execution-smoke.ts",
|
|
192
|
-
"demo:hostile": "bun run dist/hostile-repository-demo.js",
|
|
193
|
-
"artifact:check": "bun run scripts/check-release-artifact.ts",
|
|
194
|
-
"pack:inspect": "bun run build && bun pm pack --dry-run --ignore-scripts",
|
|
195
|
-
check: "bun run architecture:check && bun run docs:check && bun run contract:check && bun run typecheck && bun run typecheck:tooling && bun run test && bun run migration:check && bun run evaluate && bun run benchmark:workspace:ci && bun run benchmark:safe-fix:image:check && bun run benchmark:safe-fix:ci && bun run smoke:mcp && bun run smoke:mcp:official && bun run smoke:oci && bun run smoke:package",
|
|
196
|
-
"check:sdk-redaction": "bun run scripts/diagnostics/reproduce-redaction-state-divergence.ts --require-fixed",
|
|
197
|
-
"release:check": "bun run release:preflight && bun run check:sdk-redaction && bun run check && bun run scripts/audit-dependencies.ts && bun pm untrusted && bun run pack:inspect && bun run scripts/check-release-readiness.ts",
|
|
198
|
-
"release:status": "bun run scripts/check-registry-release-status.ts",
|
|
199
|
-
"release:verify": "bun run scripts/verify-registry-release.ts",
|
|
200
|
-
"benchmark:workspace:scale": "bun run scripts/benchmark-workspace.ts --files 10000 --directories 100 --file-bytes 4096 --page-size 100 --repetitions 5 --warmups 1",
|
|
201
|
-
"evaluate:continuity": "bun test tests/compaction.test.ts tests/harness.test.ts",
|
|
202
|
-
"benchmark:swebench": "bun run scripts/benchmark-swebench.ts",
|
|
203
|
-
"benchmark:swebench:test": "bun test tests/swebench.test.ts",
|
|
204
|
-
"typecheck:tooling": "tsc -p tsconfig.tooling.json",
|
|
205
|
-
service: "node dist/service-cli.js",
|
|
206
|
-
"smoke:console": "bun run build && python3 scripts/console-pty-smoke.py && python3 scripts/console-entry-smoke.py",
|
|
207
|
-
"smoke:credentials": "node --experimental-strip-types scripts/credential-store-smoke.ts",
|
|
208
|
-
"release:preflight": "bun run scripts/release-preflight.ts",
|
|
209
|
-
"release:prepare": "bun run scripts/prepare-release.ts",
|
|
210
|
-
"build:code": "bun run --cwd packages/code build",
|
|
211
|
-
"test:code": "bun run --cwd packages/code test",
|
|
212
|
-
"smoke:engine-code": "bun run scripts/smoke-engine-code.ts",
|
|
213
|
-
"smoke:state-upgrade": "bun run scripts/smoke-state-upgrade.ts",
|
|
214
|
-
"smoke:global-code": "node scripts/smoke-global-code.mjs",
|
|
215
|
-
"dev:code": "bun run build && bun run packages/code/scripts/link-local-engine.ts && bun run build:code",
|
|
216
|
-
"typecheck:code": "bun run --cwd packages/code typecheck",
|
|
217
|
-
"evaluate:tasks": "bun run scripts/task-acceptance.ts",
|
|
218
|
-
"prepare:desktop": "bun run build && bun pm pack --ignore-scripts --quiet --filename desktop/.harness-candidate.tgz && bun run desktop/scripts/prepare-harness.ts desktop/.harness-candidate.tgz",
|
|
219
|
-
"smoke:mcp:installed": "bun run build && bun scripts/mcp-installed-smoke.ts"
|
|
220
|
-
},
|
|
221
|
-
dependencies: {
|
|
222
|
-
"@zhivex-ai/agents": "1.11.0",
|
|
223
|
-
"@zhivex-ai/anthropic": "0.13.2",
|
|
224
|
-
"@zhivex-ai/core": "1.31.0",
|
|
225
|
-
"@zhivex-ai/gemini": "0.13.0",
|
|
226
|
-
"@zhivex-ai/meta": "0.2.9",
|
|
227
|
-
"@zhivex-ai/openai": "0.14.1",
|
|
228
|
-
"@zhivex-ai/qwen": "0.16.4",
|
|
229
|
-
"@zhivex-ai/vertex": "1.2.4",
|
|
230
|
-
"google-auth-library": "11.1.0",
|
|
231
|
-
zod: "4.6.5"
|
|
232
|
-
},
|
|
233
|
-
overrides: {
|
|
234
|
-
"@zhivex-ai/core": "1.31.0"
|
|
235
|
-
},
|
|
236
|
-
devDependencies: {
|
|
237
|
-
"@agentclientprotocol/sdk": "1.7.0",
|
|
238
|
-
"@modelcontextprotocol/server": "2.2.0",
|
|
239
|
-
"@types/bun": "1.4.2",
|
|
240
|
-
"@types/node": "^26.6.3",
|
|
241
|
-
typescript: "7.0.2",
|
|
242
|
-
"typescript-compiler-api": "npm:typescript@6.0.3"
|
|
243
|
-
},
|
|
244
|
-
engines: {
|
|
245
|
-
node: ">=22.13.0",
|
|
246
|
-
bun: ">=1.4.0"
|
|
247
|
-
},
|
|
248
|
-
packageManager: "bun@1.4.0",
|
|
249
|
-
optionalDependencies: {
|
|
250
|
-
"@napi-rs/keyring": "2.1.0"
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
// src/version.ts
|
|
255
|
-
var packageMetadata = package_default;
|
|
256
|
-
if (typeof packageMetadata.version !== "string" || packageMetadata.version.length === 0) {
|
|
257
|
-
throw new Error("package.json must contain a non-empty version.");
|
|
258
|
-
}
|
|
259
|
-
if (typeof packageMetadata.engines?.node !== "string" || packageMetadata.engines.node.length === 0) {
|
|
260
|
-
throw new Error("package.json must contain a non-empty engines.node requirement.");
|
|
261
|
-
}
|
|
262
|
-
if (typeof packageMetadata.engines?.bun !== "string" || packageMetadata.engines.bun.length === 0) {
|
|
263
|
-
throw new Error("package.json must contain a non-empty engines.bun requirement.");
|
|
264
|
-
}
|
|
265
|
-
var HARNESS_VERSION = packageMetadata.version;
|
|
266
|
-
var NODE_ENGINE_RANGE = packageMetadata.engines.node;
|
|
267
|
-
var BUN_ENGINE_RANGE = packageMetadata.engines.bun;
|
|
268
14
|
|
|
269
15
|
// src/integrations/mcp.ts
|
|
270
16
|
import { lstat, realpath } from "node:fs/promises";
|
|
@@ -1005,4 +751,4 @@ function combineMcpHostSessions(tokens) {
|
|
|
1005
751
|
return token;
|
|
1006
752
|
}
|
|
1007
753
|
|
|
1008
|
-
export {
|
|
754
|
+
export { HARNESS_MCP_CONFIG_SCHEMA_VERSION, HARNESS_MCP_PERMISSIONS, normalizeHarnessMcpConfiguration, loadHarnessMcpConfiguration, createHttpMcpClient, createHarnessMcpTools, mcpConfigurationFingerprintInput, issueMcpHostSession, resolveMcpHostSession, closeMcpHostSession, combineMcpHostSessions };
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
withWorkspaceMutation
|
|
3
|
+
} from "./index-ggstwr0v.js";
|
|
1
4
|
import {
|
|
2
5
|
TERMINAL_SESSION_RUN_STATUSES
|
|
3
|
-
} from "./index-
|
|
6
|
+
} from "./index-fqqz1yt8.js";
|
|
4
7
|
import {
|
|
5
8
|
SqliteDatabase,
|
|
6
9
|
createEditProposal,
|
|
7
10
|
fileDigestSchema,
|
|
8
11
|
readRegularFileNoFollow,
|
|
9
12
|
statRegularFileNoFollow,
|
|
10
|
-
withWorkspaceMutation,
|
|
11
13
|
workspaceFilePathSchema
|
|
12
|
-
} from "./index-
|
|
14
|
+
} from "./index-6dxrbnxm.js";
|
|
13
15
|
|
|
14
16
|
// src/persistence/workspace-checkpoints.ts
|
|
15
17
|
import { createHash, randomUUID } from "node:crypto";
|