@zhivex-ai/harness 1.4.0-rc.6 → 1.4.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 +31 -0
- package/README.md +124 -71
- package/SECURITY.md +1 -1
- package/SUPPORT.md +2 -2
- package/contracts/engine-api.json +55 -0
- package/contracts/stable-api-signatures.json +33 -33
- package/dist/acp-cli.js +18 -15
- package/dist/cli/arguments.d.ts +3 -0
- package/dist/cli/console/console-budget.d.ts +8 -2
- package/dist/{cli-s1rs15vv.js → cli-2h37qyvg.js} +34 -15
- package/dist/{cli-entry-d5788aay.js → cli-entry-20w6nh0k.js} +359 -21
- package/dist/{cli-entry-9c2k0zwz.js → cli-entry-4ngptr62.js} +2902 -1482
- package/dist/{cli-entry-4k1cf0m3.js → cli-entry-w0hterjs.js} +8 -5
- package/dist/cli.js +2 -2
- package/dist/client/json-contracts.d.ts +95 -2
- package/dist/client/local-service.d.ts +2 -2
- package/dist/client/protocol.d.ts +3 -0
- package/dist/client/stream.d.ts +2 -1
- package/dist/compat/code-support.d.ts +6 -0
- package/dist/compat/code-support.js +29 -6
- package/dist/{config-c002f06f.js → config-j9624t6t.js} +1 -1
- package/dist/{config-j3jga5wh.js → config-qt69hkqj.js} +4 -2
- package/dist/engine/acp.js +14 -12
- package/dist/engine/client.js +11 -10
- package/dist/engine/desktop-providers-v1.js +2 -1
- package/dist/engine/desktop-state-v1.js +9 -9
- package/dist/engine/index.js +48 -46
- package/dist/engine/mcp-stdio-v1.js +7 -6
- package/dist/engine/protocol.js +30 -2
- package/dist/engine/service.js +12 -11
- package/dist/hostile-repository-demo.js +4773 -3027
- package/dist/{index-49ys3s4q.js → index-5jhgatga.js} +35 -16
- package/dist/{index-wq2tax80.js → index-61gthdz6.js} +1 -1
- package/dist/index-6dft2vev.js +343 -0
- package/dist/{index-gq9xagx2.js → index-8zjmnyw5.js} +25 -138
- package/dist/index-937cb7y8.js +705 -0
- package/dist/index-bpc596v3.js +154 -0
- package/dist/index-fm84men1.js +239 -0
- package/dist/{index-e6r04a18.js → index-m34q25jj.js} +1127 -170
- package/dist/index-m49jx72n.js +220 -0
- package/dist/{index-dj5z774k.js → index-m82cfspw.js} +35 -16
- package/dist/{index-qfpz5y2v.js → index-nmjdwd4p.js} +8 -2
- package/dist/{index-0g939pfs.js → index-pdmevfxv.js} +10 -7
- package/dist/{index-4j1h4j8c.js → index-pp474137.js} +1598 -973
- package/dist/{index-2tgb2b4e.js → index-rkbf7dqg.js} +3 -5
- package/dist/index-s2k2edts.js +3778 -0
- package/dist/{index-z6br6qdn.js → index-tfzta544.js} +28 -11
- package/dist/index.js +44 -42
- package/dist/persistence/operations.d.ts +3 -0
- package/dist/providers/vertex-auth.d.ts +5 -1
- package/dist/runtime/config.d.ts +8 -0
- package/dist/runtime/context-runtime.d.ts +1 -0
- package/dist/runtime/error-diagnostics.d.ts +8 -0
- package/dist/runtime/errors.d.ts +10 -0
- package/dist/runtime/harness.d.ts +9 -0
- package/dist/runtime/policy-inspection.d.ts +1 -0
- package/dist/runtime/provider-transient.d.ts +33 -0
- package/dist/runtime/runtime-diagnostics.d.ts +3 -0
- package/dist/runtime/runtime-policy.d.ts +8 -10
- package/dist/runtime/task-acceptance-host.d.ts +1 -1
- package/dist/runtime/task-budget-host.d.ts +217 -0
- package/dist/runtime/task-budget.d.ts +147 -0
- package/dist/runtime/task-continuity.d.ts +434 -0
- package/dist/runtime/task-telemetry.d.ts +63 -0
- package/dist/runtime/task-transport.d.ts +3 -0
- package/dist/runtime/task-usage-context.d.ts +13 -0
- package/dist/runtime/time-to-safe-fix.d.ts +8 -0
- package/dist/runtime/usage-ledger.d.ts +17 -0
- package/dist/service-cli.js +12 -11
- package/dist/{service-client-cli-b52c67hx.js → service-client-cli-fn54ev6w.js} +18 -7
- package/dist/verify-historical-migrations.js +2426 -652
- package/dist/zhx.js +2 -2
- package/docs/CLI.md +38 -8
- package/docs/CLIENT_PROTOCOL.md +9 -1
- package/docs/CODE_RELEASE.md +118 -1
- package/docs/DURABLE_OPERATIONS.md +1 -1
- package/docs/EXTENSIBILITY.md +1 -1
- package/docs/FIRST_USE.md +6 -6
- package/docs/MINIMUM_OFFLINE_EVALS.md +31 -0
- package/docs/MINIMUM_TASK_AUTHORITY.md +395 -0
- package/docs/PROJECT_MEMORY.md +1 -1
- package/docs/README.md +2 -0
- package/docs/STABILITY.md +1 -1
- package/docs/WEB_LIMITS.md +117 -0
- package/evaluations/representative-assembly-matrix.json +28 -1
- package/examples/README.md +5 -5
- package/package.json +8 -5
- package/dist/index-8705zxpr.js +0 -145
- package/dist/index-a1q355va.js +0 -600
- package/dist/index-r0tdj04h.js +0 -976
- package/dist/index-rd0s3gqj.js +0 -1669
- package/dist/index-vtqfjnab.js +0 -1626
|
@@ -2,10 +2,14 @@ import {
|
|
|
2
2
|
VERTEX_ENVIRONMENT,
|
|
3
3
|
createVertexModel,
|
|
4
4
|
vertexConfigured
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-m49jx72n.js";
|
|
6
6
|
import {
|
|
7
7
|
bundledDefaultModel
|
|
8
8
|
} from "./index-xqxeypt5.js";
|
|
9
|
+
import {
|
|
10
|
+
HarnessConfigError,
|
|
11
|
+
HarnessProviderError
|
|
12
|
+
} from "./index-bpc596v3.js";
|
|
9
13
|
|
|
10
14
|
// src/providers/reasoning.ts
|
|
11
15
|
import { z } from "zod";
|
|
@@ -826,143 +830,21 @@ function withReasoningEffort(model, value) {
|
|
|
826
830
|
}]);
|
|
827
831
|
}
|
|
828
832
|
|
|
829
|
-
// src/runtime/
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
var HARNESS_ERROR_CODES = [
|
|
836
|
-
"CONFIG_INVALID",
|
|
837
|
-
"CLI_USAGE_INVALID",
|
|
838
|
-
"WORKSPACE_UNSAFE",
|
|
839
|
-
"STATE_CONFLICT",
|
|
840
|
-
"PROVIDER_UNAVAILABLE",
|
|
841
|
-
"APPROVAL_REQUIRED",
|
|
842
|
-
"EXECUTION_FAILED"
|
|
843
|
-
];
|
|
844
|
-
var HARNESS_ERROR_SCHEMA_VERSION = 1;
|
|
845
|
-
|
|
846
|
-
class HarnessError extends Error {
|
|
847
|
-
code;
|
|
848
|
-
category;
|
|
849
|
-
retryable;
|
|
850
|
-
constructor(message, options) {
|
|
851
|
-
super(message, options.cause === undefined ? undefined : { cause: options.cause });
|
|
852
|
-
this.name = "HarnessError";
|
|
853
|
-
this.code = options.code;
|
|
854
|
-
this.category = options.category;
|
|
855
|
-
this.retryable = options.retryable ?? false;
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
class HarnessConfigError extends HarnessError {
|
|
860
|
-
constructor(message, options = {}) {
|
|
861
|
-
super(message, {
|
|
862
|
-
code: "CONFIG_INVALID",
|
|
863
|
-
category: "configuration",
|
|
864
|
-
...options.cause === undefined ? {} : { cause: options.cause }
|
|
865
|
-
});
|
|
866
|
-
this.name = "HarnessConfigError";
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
class HarnessWorkspaceError extends HarnessError {
|
|
871
|
-
constructor(message, options = {}) {
|
|
872
|
-
super(message, {
|
|
873
|
-
code: "WORKSPACE_UNSAFE",
|
|
874
|
-
category: "workspace",
|
|
875
|
-
...options.cause === undefined ? {} : { cause: options.cause }
|
|
876
|
-
});
|
|
877
|
-
this.name = "HarnessWorkspaceError";
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
class HarnessStateConflictError extends HarnessError {
|
|
882
|
-
constructor(message, options = {}) {
|
|
883
|
-
super(message, {
|
|
884
|
-
code: "STATE_CONFLICT",
|
|
885
|
-
category: "state",
|
|
886
|
-
retryable: options.retryable ?? false,
|
|
887
|
-
...options.cause === undefined ? {} : { cause: options.cause }
|
|
888
|
-
});
|
|
889
|
-
this.name = "HarnessStateConflictError";
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
class HarnessProviderError extends HarnessError {
|
|
894
|
-
constructor(message, options = {}) {
|
|
895
|
-
super(message, {
|
|
896
|
-
code: "PROVIDER_UNAVAILABLE",
|
|
897
|
-
category: "provider",
|
|
898
|
-
retryable: options.retryable ?? true,
|
|
899
|
-
...options.cause === undefined ? {} : { cause: options.cause }
|
|
900
|
-
});
|
|
901
|
-
this.name = "HarnessProviderError";
|
|
902
|
-
}
|
|
833
|
+
// src/runtime/task-transport.ts
|
|
834
|
+
var provenance = Symbol("harness-vetted-task-transport");
|
|
835
|
+
var capability = Object.freeze({ version: 1 });
|
|
836
|
+
function markTaskTransportModel(model) {
|
|
837
|
+
Object.defineProperty(model, provenance, { value: capability, enumerable: true });
|
|
838
|
+
return model;
|
|
903
839
|
}
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
constructor(message, options = {}) {
|
|
907
|
-
super(message, {
|
|
908
|
-
code: "APPROVAL_REQUIRED",
|
|
909
|
-
category: "approval",
|
|
910
|
-
...options.cause === undefined ? {} : { cause: options.cause }
|
|
911
|
-
});
|
|
912
|
-
this.name = "HarnessApprovalError";
|
|
913
|
-
}
|
|
840
|
+
function isTaskTransportModel(model) {
|
|
841
|
+
return Reflect.get(model, provenance) === capability;
|
|
914
842
|
}
|
|
915
843
|
|
|
916
|
-
class HarnessExecutionError extends HarnessError {
|
|
917
|
-
constructor(message, options = {}) {
|
|
918
|
-
super(message, {
|
|
919
|
-
code: "EXECUTION_FAILED",
|
|
920
|
-
category: "execution",
|
|
921
|
-
retryable: options.retryable ?? false,
|
|
922
|
-
...options.cause === undefined ? {} : { cause: options.cause }
|
|
923
|
-
});
|
|
924
|
-
this.name = "HarnessExecutionError";
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
var harnessErrorDocument = (error) => {
|
|
928
|
-
const normalized = normalizeHarnessError(error);
|
|
929
|
-
return {
|
|
930
|
-
schemaVersion: HARNESS_ERROR_SCHEMA_VERSION,
|
|
931
|
-
kind: "error",
|
|
932
|
-
error: {
|
|
933
|
-
code: normalized.code,
|
|
934
|
-
category: normalized.category,
|
|
935
|
-
retryable: normalized.retryable
|
|
936
|
-
}
|
|
937
|
-
};
|
|
938
|
-
};
|
|
939
|
-
var numericStatuses = (error) => {
|
|
940
|
-
if (!error || typeof error !== "object")
|
|
941
|
-
return;
|
|
942
|
-
const record = error;
|
|
943
|
-
const values = [record.status, record.statusCode].filter((value) => typeof value === "number" && Number.isSafeInteger(value));
|
|
944
|
-
return values.length > 0 ? values : undefined;
|
|
945
|
-
};
|
|
946
|
-
var normalizeHarnessError = (error) => {
|
|
947
|
-
if (error instanceof HarnessError)
|
|
948
|
-
return error;
|
|
949
|
-
const message = error instanceof Error ? error.message : "Harness execution failed.";
|
|
950
|
-
const statuses = numericStatuses(error) ?? [];
|
|
951
|
-
if (statuses.some((status) => status === 429 || status >= 500 && status <= 599)) {
|
|
952
|
-
return new HarnessProviderError(message, { cause: error, retryable: true });
|
|
953
|
-
}
|
|
954
|
-
const name = error && typeof error === "object" && typeof error.name === "string" ? error.name : "";
|
|
955
|
-
const code = error && typeof error === "object" && typeof error.code === "string" ? error.code : "";
|
|
956
|
-
if (name === "ConflictError" || code === "SQLITE_BUSY" || code === "SQLITE_LOCKED") {
|
|
957
|
-
return new HarnessStateConflictError(message, {
|
|
958
|
-
cause: error,
|
|
959
|
-
retryable: code === "SQLITE_BUSY" || code === "SQLITE_LOCKED"
|
|
960
|
-
});
|
|
961
|
-
}
|
|
962
|
-
return new HarnessExecutionError(message, { cause: error });
|
|
963
|
-
};
|
|
964
|
-
|
|
965
844
|
// src/runtime/config.ts
|
|
845
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
846
|
+
import { realpathSync } from "node:fs";
|
|
847
|
+
import path from "node:path";
|
|
966
848
|
var DEFAULT_ALLOWED_CHECKS = ["test", "typecheck", "lint", "build"];
|
|
967
849
|
var HARNESS_CONFIG_SCHEMA_VERSION = 5;
|
|
968
850
|
var HARNESS_CONFIG_MIGRATABLE_SCHEMA_VERSIONS = [4, 5];
|
|
@@ -1229,12 +1111,15 @@ var resolveHarnessConfig = (input = {}, registry = DEFAULT_PROVIDER_REGISTRY) =>
|
|
|
1229
1111
|
const userId = scopeValue("userId", input.userId ?? process.env.ZHIVEX_HARNESS_USER_ID);
|
|
1230
1112
|
const namespace = scopeValue("namespace", input.namespace ?? process.env.ZHIVEX_HARNESS_NAMESPACE, defaultHarnessNamespace(workspace));
|
|
1231
1113
|
const timeoutMs = integerOption("timeoutMs", input.timeoutMs, process.env.ZHIVEX_HARNESS_TIMEOUT_MS, 15 * 60000, 1000, 24 * 60 * 60000);
|
|
1232
|
-
|
|
1233
|
-
|
|
1114
|
+
for (const key of ["unlimitedTokens", "unlimitedSteps", "unlimitedToolCalls", "unlimitedDuration"]) {
|
|
1115
|
+
if (input[key] !== undefined && typeof input[key] !== "boolean")
|
|
1116
|
+
throw new HarnessConfigError(`${key} must be a boolean.`);
|
|
1234
1117
|
}
|
|
1235
1118
|
const tokenMode = input.unlimitedTokens === undefined ? {} : { unlimitedTokens: input.unlimitedTokens };
|
|
1236
1119
|
const budget = {
|
|
1237
1120
|
...tokenMode,
|
|
1121
|
+
...input.unlimitedSteps === undefined ? {} : { unlimitedSteps: input.unlimitedSteps },
|
|
1122
|
+
...input.unlimitedToolCalls === undefined ? {} : { unlimitedToolCalls: input.unlimitedToolCalls },
|
|
1238
1123
|
maxSteps,
|
|
1239
1124
|
maxToolCalls: integerOption("maxToolCalls", input.maxToolCalls, process.env.ZHIVEX_HARNESS_MAX_TOOL_CALLS, DEFAULT_HARNESS_BUDGET.maxToolCalls, 0, Number.MAX_SAFE_INTEGER),
|
|
1240
1125
|
maxToolErrors: integerOption("maxToolErrors", input.maxToolErrors, process.env.ZHIVEX_HARNESS_MAX_TOOL_ERRORS, DEFAULT_HARNESS_BUDGET.maxToolErrors, 0, 100),
|
|
@@ -1308,6 +1193,7 @@ var resolveHarnessConfig = (input = {}, registry = DEFAULT_PROVIDER_REGISTRY) =>
|
|
|
1308
1193
|
},
|
|
1309
1194
|
maxSteps,
|
|
1310
1195
|
timeoutMs,
|
|
1196
|
+
...input.unlimitedDuration === undefined ? {} : { unlimitedDuration: input.unlimitedDuration },
|
|
1311
1197
|
requireVerifiedDelivery: input.requireVerifiedDelivery ?? false,
|
|
1312
1198
|
budget,
|
|
1313
1199
|
...maxCostUsd === undefined ? {} : {
|
|
@@ -1331,7 +1217,8 @@ var resolveHarnessConfig = (input = {}, registry = DEFAULT_PROVIDER_REGISTRY) =>
|
|
|
1331
1217
|
};
|
|
1332
1218
|
var createProviderModel = (config, env = process.env, registry = DEFAULT_PROVIDER_REGISTRY) => {
|
|
1333
1219
|
try {
|
|
1334
|
-
|
|
1220
|
+
const model = registry.createModel(config, env);
|
|
1221
|
+
return registry === DEFAULT_PROVIDER_REGISTRY && ["anthropic", "openai", "gemini", "vertex", "qwen"].includes(config.provider) ? markTaskTransportModel(model) : model;
|
|
1335
1222
|
} catch (error) {
|
|
1336
1223
|
throw new HarnessProviderError(`Provider ${config.provider} could not be initialized.`, {
|
|
1337
1224
|
cause: error,
|
|
@@ -1340,4 +1227,4 @@ var createProviderModel = (config, env = process.env, registry = DEFAULT_PROVIDE
|
|
|
1340
1227
|
}
|
|
1341
1228
|
};
|
|
1342
1229
|
var providerAvailability = (env = process.env, registry = DEFAULT_PROVIDER_REGISTRY) => registry.availability(env);
|
|
1343
|
-
export { PROVIDERS, createProviderRegistry, BUILTIN_PROVIDER_REGISTRATIONS, DEFAULT_PROVIDER_REGISTRY, PROVIDER_DESCRIPTORS, reasoningEffortSchema, modelReasoningEfforts, withReasoningEffort,
|
|
1230
|
+
export { PROVIDERS, createProviderRegistry, BUILTIN_PROVIDER_REGISTRATIONS, DEFAULT_PROVIDER_REGISTRY, PROVIDER_DESCRIPTORS, reasoningEffortSchema, modelReasoningEfforts, withReasoningEffort, isTaskTransportModel, DEFAULT_ALLOWED_CHECKS, HARNESS_CONFIG_SCHEMA_VERSION, HARNESS_CONFIG_MIGRATABLE_SCHEMA_VERSIONS, HARNESS_STORE_BACKENDS, HARNESS_EXECUTION_BACKENDS, HARNESS_OCI_RUNTIMES, HARNESS_OCI_SHELL_MODES, HARNESS_EXECUTION_POLICY_VERSION, DEFAULT_OCI_EXECUTION, HARNESS_REQUIRED_CAPABILITIES, HARNESS_SUBAGENT_PROFILES, DEFAULT_HARNESS_MAX_STEPS, DEFAULT_HARNESS_BUDGET, DEFAULT_HARNESS_COMPACTION, DEFAULT_SUBAGENT_BUDGET, migrateHarnessConfigInput, defaultHarnessNamespace, parseProvider, providerDescriptor, resolveHarnessConfig, createProviderModel, providerAvailability };
|