@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
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import {
|
|
2
|
+
VERTEX_TRANSIENT_ATTEMPTS,
|
|
3
|
+
classifyProviderFailure,
|
|
4
|
+
isEmptyModelTurn,
|
|
5
|
+
isRetryableProviderFailure,
|
|
6
|
+
providerDiagnostic,
|
|
7
|
+
providerDiagnosticSchema,
|
|
8
|
+
transientBackoffMs
|
|
9
|
+
} from "./index-fm84men1.js";
|
|
10
|
+
|
|
11
|
+
// src/providers/vertex-auth.ts
|
|
12
|
+
import { GoogleAuth } from "google-auth-library";
|
|
13
|
+
import { createVertex } from "@zhivex-ai/vertex";
|
|
14
|
+
import { wrapLanguageModel } from "@zhivex-ai/core";
|
|
15
|
+
var CLOUD_PLATFORM_SCOPE = "https://www.googleapis.com/auth/cloud-platform";
|
|
16
|
+
function vertexRoute(env) {
|
|
17
|
+
const projectId = (env.GOOGLE_CLOUD_PROJECT ?? "").trim();
|
|
18
|
+
const location = (env.VERTEX_LOCATION ?? "").trim();
|
|
19
|
+
if (!/^(?:[a-z][a-z0-9-]{4,61}[a-z0-9]|[0-9]{6,20})$/.test(projectId)) {
|
|
20
|
+
throw new Error("Vertex requires a valid GOOGLE_CLOUD_PROJECT.");
|
|
21
|
+
}
|
|
22
|
+
if (!/^(?:global|us|eu|[a-z]+-[a-z]+[0-9]+)$/.test(location)) {
|
|
23
|
+
throw new Error("Vertex requires an explicit valid VERTEX_LOCATION.");
|
|
24
|
+
}
|
|
25
|
+
return Object.freeze({ projectId, location });
|
|
26
|
+
}
|
|
27
|
+
function vertexConfigured(env) {
|
|
28
|
+
try {
|
|
29
|
+
vertexRoute(env);
|
|
30
|
+
return true;
|
|
31
|
+
} catch {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
var VERTEX_ENVIRONMENT = ["GOOGLE_CLOUD_PROJECT", "VERTEX_LOCATION", "GOOGLE_APPLICATION_CREDENTIALS"];
|
|
36
|
+
function vertexEnvironment(env) {
|
|
37
|
+
return Object.fromEntries(VERTEX_ENVIRONMENT.flatMap((name) => env[name] ? [[name, env[name]]] : []));
|
|
38
|
+
}
|
|
39
|
+
function vertexTokenSource(env, route, createAuth = (options) => new GoogleAuth(options)) {
|
|
40
|
+
const keyFilename = env.GOOGLE_APPLICATION_CREDENTIALS?.trim();
|
|
41
|
+
const auth = createAuth({
|
|
42
|
+
projectId: route.projectId,
|
|
43
|
+
scopes: [CLOUD_PLATFORM_SCOPE],
|
|
44
|
+
...keyFilename ? { keyFilename } : {}
|
|
45
|
+
});
|
|
46
|
+
return async () => {
|
|
47
|
+
try {
|
|
48
|
+
const token = await auth.getAccessToken();
|
|
49
|
+
if (!token)
|
|
50
|
+
throw new Error("Empty ADC token");
|
|
51
|
+
return token;
|
|
52
|
+
} catch {
|
|
53
|
+
throw new VertexAuthenticationError;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
class VertexAuthenticationError extends Error {
|
|
59
|
+
status = 401;
|
|
60
|
+
retryable = false;
|
|
61
|
+
constructor() {
|
|
62
|
+
super("Vertex ADC credentials are unavailable or could not be refreshed. Configure Application Default Credentials and retry.");
|
|
63
|
+
this.name = "VertexAuthenticationError";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function createVertexModel(model, env, createAuth, retry) {
|
|
67
|
+
const route = vertexRoute(env);
|
|
68
|
+
const adapter = createVertex({
|
|
69
|
+
...route,
|
|
70
|
+
getAccessToken: vertexTokenSource(env, route, createAuth)
|
|
71
|
+
})(model);
|
|
72
|
+
const attempts = retry?.attempts ?? VERTEX_TRANSIENT_ATTEMPTS;
|
|
73
|
+
const delayFor = (input) => retry?.delayMs ?? ((attempt) => input.retryBackoffMs === 0 ? 0 : transientBackoffMs(attempt, input.retryBackoffMs ?? 250));
|
|
74
|
+
const generate = async (input) => withVertexAttempts(input.abortSignal, vertexAttemptBudget(input, attempts), delayFor(input), async () => {
|
|
75
|
+
try {
|
|
76
|
+
return await adapter.generate({ ...input, maxRetries: 0 });
|
|
77
|
+
} catch (error) {
|
|
78
|
+
throw safeVertexError(error);
|
|
79
|
+
}
|
|
80
|
+
}, (result) => !isEmptyModelTurn(result));
|
|
81
|
+
const innerStream = adapter.stream?.bind(adapter);
|
|
82
|
+
const retrying = innerStream ? {
|
|
83
|
+
...adapter,
|
|
84
|
+
generate,
|
|
85
|
+
async stream(input) {
|
|
86
|
+
const events = await withVertexAttempts(input.abortSignal, vertexAttemptBudget(input, attempts), delayFor(input), () => collectVertexStream(() => innerStream({ ...input, maxRetries: 0 })), (events2) => !isEmptyVertexStream(events2));
|
|
87
|
+
return replayVertexStream(events);
|
|
88
|
+
}
|
|
89
|
+
} : { ...adapter, generate };
|
|
90
|
+
return wrapLanguageModel(retrying, [{
|
|
91
|
+
name: "harness-vertex-sanitized-errors",
|
|
92
|
+
async wrapGenerate(_context, next) {
|
|
93
|
+
try {
|
|
94
|
+
return await next();
|
|
95
|
+
} catch (error) {
|
|
96
|
+
throw safeVertexError(error);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
async wrapStream(_context, next) {
|
|
100
|
+
let stream;
|
|
101
|
+
try {
|
|
102
|
+
stream = await next();
|
|
103
|
+
} catch (error) {
|
|
104
|
+
throw safeVertexError(error);
|
|
105
|
+
}
|
|
106
|
+
return async function* () {
|
|
107
|
+
try {
|
|
108
|
+
yield* stream;
|
|
109
|
+
} catch (error) {
|
|
110
|
+
throw safeVertexError(error);
|
|
111
|
+
}
|
|
112
|
+
}();
|
|
113
|
+
}
|
|
114
|
+
}]);
|
|
115
|
+
}
|
|
116
|
+
async function collectVertexStream(next) {
|
|
117
|
+
let stream;
|
|
118
|
+
try {
|
|
119
|
+
stream = await next();
|
|
120
|
+
} catch (error) {
|
|
121
|
+
throw safeVertexError(error);
|
|
122
|
+
}
|
|
123
|
+
const events = [];
|
|
124
|
+
try {
|
|
125
|
+
for await (const event of stream) {
|
|
126
|
+
if (event.type === "error")
|
|
127
|
+
throw safeVertexError(event.error);
|
|
128
|
+
events.push(event);
|
|
129
|
+
}
|
|
130
|
+
} catch (error) {
|
|
131
|
+
throw error instanceof Error && error.message.startsWith("Vertex request failed.") ? error : safeVertexError(error);
|
|
132
|
+
}
|
|
133
|
+
return events;
|
|
134
|
+
}
|
|
135
|
+
function isEmptyVertexStream(events) {
|
|
136
|
+
let text = "";
|
|
137
|
+
let finishReason;
|
|
138
|
+
let tools = false;
|
|
139
|
+
let media = false;
|
|
140
|
+
for (const event of events) {
|
|
141
|
+
if (event.type === "text-delta")
|
|
142
|
+
text += event.textDelta;
|
|
143
|
+
else if (event.type === "tool-call" || event.type === "tool-approval-request")
|
|
144
|
+
tools = true;
|
|
145
|
+
else if (event.type === "image-generation")
|
|
146
|
+
media = true;
|
|
147
|
+
else if (event.type === "finish")
|
|
148
|
+
finishReason = event.finishReason;
|
|
149
|
+
}
|
|
150
|
+
return isEmptyModelTurn({
|
|
151
|
+
text,
|
|
152
|
+
finishReason,
|
|
153
|
+
...tools ? { messages: [{ parts: [{ type: "tool-call" }] }] } : {},
|
|
154
|
+
...media ? { images: [{}] } : {}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function replayVertexStream(events) {
|
|
158
|
+
return async function* () {
|
|
159
|
+
yield* events;
|
|
160
|
+
}();
|
|
161
|
+
}
|
|
162
|
+
async function withVertexAttempts(abortSignal, attempts, delayMs, run, accept) {
|
|
163
|
+
let last;
|
|
164
|
+
for (let attempt = 0;attempt < attempts; attempt += 1) {
|
|
165
|
+
if (abortSignal?.aborted)
|
|
166
|
+
throw new DOMException("Vertex request cancelled.", "AbortError");
|
|
167
|
+
try {
|
|
168
|
+
const value = await run();
|
|
169
|
+
if (accept(value) || attempt === attempts - 1)
|
|
170
|
+
return value;
|
|
171
|
+
last = value;
|
|
172
|
+
} catch (error) {
|
|
173
|
+
const safe = error instanceof Error && (error.name === "AbortError" || error.message.startsWith("Vertex request failed.")) ? error : safeVertexError(error);
|
|
174
|
+
if (safe.name === "AbortError" || abortSignal?.aborted || attempt === attempts - 1 || !isRetryableProviderFailure(safe))
|
|
175
|
+
throw safe;
|
|
176
|
+
}
|
|
177
|
+
await sleep(delayMs(attempt));
|
|
178
|
+
}
|
|
179
|
+
return last;
|
|
180
|
+
}
|
|
181
|
+
var sleep = (ms) => ms > 0 ? new Promise((resolve) => setTimeout(resolve, ms)) : Promise.resolve();
|
|
182
|
+
function vertexAttemptBudget(input, fallback) {
|
|
183
|
+
const requested = [
|
|
184
|
+
typeof input.maxProviderRequests === "number" ? input.maxProviderRequests : undefined,
|
|
185
|
+
typeof input.maxRetries === "number" ? input.maxRetries + 1 : undefined
|
|
186
|
+
].filter((value) => value !== undefined);
|
|
187
|
+
if (requested.length === 0)
|
|
188
|
+
return Math.max(1, fallback);
|
|
189
|
+
return Math.max(1, Math.min(...requested));
|
|
190
|
+
}
|
|
191
|
+
function safeVertexError(error) {
|
|
192
|
+
if (error instanceof VertexAuthenticationError)
|
|
193
|
+
return error;
|
|
194
|
+
const record = error && typeof error === "object" ? error : {};
|
|
195
|
+
if (record.name === "AbortError")
|
|
196
|
+
return new DOMException("Vertex request cancelled.", "AbortError");
|
|
197
|
+
const failure = classifyProviderFailure(error);
|
|
198
|
+
const body = providerBody(record.responseBody) ?? providerBody(record.body);
|
|
199
|
+
const preserved = providerDiagnosticSchema.safeParse(record.provider);
|
|
200
|
+
const provider = body !== undefined ? providerDiagnostic(body, failure.httpStatus) : preserved.success ? preserved.data : providerDiagnostic(undefined, failure.httpStatus);
|
|
201
|
+
return Object.assign(new Error("Vertex request failed. Check the sanitized provider diagnosis."), {
|
|
202
|
+
...failure.httpStatus !== undefined ? { status: failure.httpStatus } : {},
|
|
203
|
+
...failure.providerStatus ? { providerStatus: failure.providerStatus } : {},
|
|
204
|
+
provider,
|
|
205
|
+
retryable: failure.retryable
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
function providerBody(value) {
|
|
209
|
+
if (typeof value === "string")
|
|
210
|
+
return value;
|
|
211
|
+
if (!value || typeof value !== "object")
|
|
212
|
+
return;
|
|
213
|
+
try {
|
|
214
|
+
return JSON.stringify(value).slice(0, 8192);
|
|
215
|
+
} catch {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export { vertexRoute, vertexConfigured, VERTEX_ENVIRONMENT, vertexEnvironment, vertexTokenSource, createVertexModel };
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fileDigestSchema
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-m34q25jj.js";
|
|
4
4
|
import {
|
|
5
|
-
HARNESS_ERROR_CODES,
|
|
6
|
-
HARNESS_ERROR_SCHEMA_VERSION,
|
|
7
|
-
HarnessError,
|
|
8
5
|
PROVIDERS,
|
|
9
6
|
reasoningEffortSchema
|
|
10
|
-
} from "./index-
|
|
11
|
-
import {
|
|
12
|
-
providerDiagnostic,
|
|
13
|
-
providerDiagnosticSchema
|
|
14
|
-
} from "./index-8705zxpr.js";
|
|
7
|
+
} from "./index-8zjmnyw5.js";
|
|
15
8
|
import {
|
|
16
9
|
CLI_EVENT_SCHEMA_VERSION,
|
|
17
10
|
CLI_JSON_SCHEMA_VERSION
|
|
18
|
-
} from "./index-
|
|
11
|
+
} from "./index-nmjdwd4p.js";
|
|
12
|
+
import {
|
|
13
|
+
HARNESS_ERROR_CODES,
|
|
14
|
+
HARNESS_ERROR_SCHEMA_VERSION,
|
|
15
|
+
HarnessError
|
|
16
|
+
} from "./index-bpc596v3.js";
|
|
17
|
+
import {
|
|
18
|
+
PROVIDER_STATUS_CATEGORIES,
|
|
19
|
+
providerDiagnostic,
|
|
20
|
+
providerDiagnosticSchema,
|
|
21
|
+
readProviderFailureRecord
|
|
22
|
+
} from "./index-fm84men1.js";
|
|
19
23
|
|
|
20
24
|
// src/workspace/change-envelope.ts
|
|
21
25
|
import { createHash } from "node:crypto";
|
|
@@ -589,6 +593,8 @@ var tokenUsageSchema = observationalDocument({
|
|
|
589
593
|
});
|
|
590
594
|
var budgetConfigSchema = observationalDocument({
|
|
591
595
|
unlimitedTokens: z2.boolean().optional(),
|
|
596
|
+
unlimitedSteps: z2.boolean().optional(),
|
|
597
|
+
unlimitedToolCalls: z2.boolean().optional(),
|
|
592
598
|
maxSteps: nonnegativeInteger,
|
|
593
599
|
maxToolCalls: nonnegativeInteger,
|
|
594
600
|
maxToolErrors: nonnegativeInteger,
|
|
@@ -762,6 +768,7 @@ var doctorConfigurationSchema = observationalDocument({
|
|
|
762
768
|
scope: scopeSchema,
|
|
763
769
|
maxSteps: nonnegativeInteger,
|
|
764
770
|
timeoutMs: nonnegativeInteger,
|
|
771
|
+
unlimitedDuration: z2.boolean().optional(),
|
|
765
772
|
budget: budgetConfigSchema,
|
|
766
773
|
costBudget: observationalDocument({
|
|
767
774
|
maxCostUsd: z2.number().nonnegative(),
|
|
@@ -968,6 +975,13 @@ var cliStateImportDocumentSchema = observationalDocument({
|
|
|
968
975
|
inserted: z2.record(z2.string(), nonnegativeInteger),
|
|
969
976
|
identical: nonnegativeInteger
|
|
970
977
|
});
|
|
978
|
+
var providerStreamDiagnosticSchema = z2.strictObject({
|
|
979
|
+
provider: z2.literal("qwen"),
|
|
980
|
+
transport: z2.enum(["chat", "responses"]),
|
|
981
|
+
diagnosticCode: z2.literal("QWEN_SSE_EVENT_INVALID"),
|
|
982
|
+
reason: z2.enum(["invalid_json", "invalid_event"]),
|
|
983
|
+
retryable: z2.literal(false)
|
|
984
|
+
});
|
|
971
985
|
var cliErrorDocumentSchema = observationalDocument({
|
|
972
986
|
schemaVersion: z2.literal(HARNESS_ERROR_SCHEMA_VERSION),
|
|
973
987
|
kind: z2.literal("error"),
|
|
@@ -982,7 +996,8 @@ var cliErrorDocumentSchema = observationalDocument({
|
|
|
982
996
|
"approval",
|
|
983
997
|
"execution"
|
|
984
998
|
]),
|
|
985
|
-
retryable: z2.boolean()
|
|
999
|
+
retryable: z2.boolean(),
|
|
1000
|
+
providerDiagnostic: providerStreamDiagnosticSchema.optional()
|
|
986
1001
|
})
|
|
987
1002
|
});
|
|
988
1003
|
var cliPolicyInspectionSchema = observationalDocument({
|
|
@@ -994,7 +1009,7 @@ var cliPolicyInspectionSchema = observationalDocument({
|
|
|
994
1009
|
tools: z2.array(observationalDocument({ name: z2.string(), requiresApproval: z2.boolean() })),
|
|
995
1010
|
restrictions: z2.array(observationalDocument({ ruleId: z2.string(), tools: z2.array(z2.string()), decision: z2.enum(["allow", "ask_user", "deny"]), reason: z2.string(), pathCount: nonnegativeInteger })),
|
|
996
1011
|
execution: observationalDocument({ configuredBackend: z2.enum(["none", "oci"]), activeBackend: z2.enum(["none", "oci"]), evidence: z2.literal("configuration-only") }),
|
|
997
|
-
limits: observationalDocument({ maxSteps: nonnegativeInteger, timeoutMs: nonnegativeInteger, budget: jsonObjectSchema })
|
|
1012
|
+
limits: observationalDocument({ maxSteps: nonnegativeInteger, timeoutMs: nonnegativeInteger, unlimitedDuration: z2.boolean().optional(), budget: jsonObjectSchema })
|
|
998
1013
|
});
|
|
999
1014
|
var cliJsonDocumentSchema = z2.union([
|
|
1000
1015
|
cliPolicyInspectionSchema,
|
|
@@ -1073,10 +1088,10 @@ var cliRunEventDocumentSchema = z2.discriminatedUnion("type", [
|
|
|
1073
1088
|
finishReason: z2.string().min(1).optional(),
|
|
1074
1089
|
usage: jsonObjectSchema.optional()
|
|
1075
1090
|
}),
|
|
1076
|
-
runEvent("error", { error: z2.literal("Provider stream failed.") }),
|
|
1091
|
+
runEvent("error", { error: z2.literal("Provider stream failed."), providerDiagnostic: providerStreamDiagnosticSchema.optional() }),
|
|
1077
1092
|
runEvent("agent-run-start", {
|
|
1078
1093
|
currentStep: nonnegativeInteger,
|
|
1079
|
-
maxSteps: nonnegativeInteger
|
|
1094
|
+
maxSteps: z2.union([nonnegativeInteger, z2.literal("unlimited")])
|
|
1080
1095
|
}),
|
|
1081
1096
|
runEvent("agent-step-start", { stepIndex: nonnegativeInteger }),
|
|
1082
1097
|
runEvent("agent-step-finish", {
|
|
@@ -1232,6 +1247,7 @@ var errorDetailsSchema = z3.strictObject({
|
|
|
1232
1247
|
checkpoint: z3.enum(checkpoints).optional(),
|
|
1233
1248
|
code: z3.enum([...HARNESS_ERROR_CODES, ...systemCodes]).optional(),
|
|
1234
1249
|
provider: providerDiagnosticSchema.optional(),
|
|
1250
|
+
providerStatus: z3.enum(PROVIDER_STATUS_CATEGORIES).optional(),
|
|
1235
1251
|
status: z3.number().int().min(100).max(599).optional(),
|
|
1236
1252
|
retryable: z3.boolean().optional(),
|
|
1237
1253
|
acceptanceReason: z3.enum(acceptanceReasons).optional(),
|
|
@@ -1322,11 +1338,14 @@ var sanitizedErrorDetails = (error) => {
|
|
|
1322
1338
|
const allowedCodes = [...HARNESS_ERROR_CODES, ...systemCodes];
|
|
1323
1339
|
if (allowedCodes.includes(record.code))
|
|
1324
1340
|
entry.code = record.code;
|
|
1325
|
-
const
|
|
1341
|
+
const signals = readProviderFailureRecord(record);
|
|
1342
|
+
const status = [record.status, record.statusCode, record.httpStatusCode, signals.httpStatus].find((value) => typeof value === "number" && Number.isInteger(value) && value >= 100 && value <= 599);
|
|
1326
1343
|
if (typeof status === "number") {
|
|
1327
1344
|
entry.status = status;
|
|
1328
|
-
entry.provider = providerDiagnostic(record.responseBody ?? record.body, status);
|
|
1345
|
+
entry.provider = providerDiagnostic(typeof record.responseBody === "string" || typeof record.body === "string" ? record.responseBody ?? record.body : undefined, status);
|
|
1329
1346
|
}
|
|
1347
|
+
if (signals.providerStatus)
|
|
1348
|
+
entry.providerStatus = signals.providerStatus;
|
|
1330
1349
|
const provider = providerDiagnosticSchema.safeParse(record.provider);
|
|
1331
1350
|
if (provider.success)
|
|
1332
1351
|
entry.provider = provider.data;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
providerStreamDiagnostic
|
|
3
|
+
} from "./index-bpc596v3.js";
|
|
4
|
+
|
|
1
5
|
// src/client/stream.ts
|
|
2
6
|
var CLI_JSON_SCHEMA_VERSION = 1;
|
|
3
7
|
var CLI_EVENT_SCHEMA_VERSION = 1;
|
|
@@ -53,8 +57,10 @@ var streamEventDocument = (event, sequence = 0) => {
|
|
|
53
57
|
...event.finishReason ? { finishReason: event.finishReason } : {},
|
|
54
58
|
...event.usage ? { usage: event.usage } : {}
|
|
55
59
|
};
|
|
56
|
-
case "error":
|
|
57
|
-
|
|
60
|
+
case "error": {
|
|
61
|
+
const diagnostic = providerStreamDiagnostic(event.error);
|
|
62
|
+
return { ...base, error: "Provider stream failed.", ...diagnostic ? { providerDiagnostic: diagnostic } : {} };
|
|
63
|
+
}
|
|
58
64
|
case "agent-run-start":
|
|
59
65
|
return { ...base, currentStep: event.currentStep, maxSteps: event.maxSteps };
|
|
60
66
|
case "agent-step-start":
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readRegularFileNoFollow
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-m34q25jj.js";
|
|
4
4
|
import {
|
|
5
5
|
HarnessConfigError,
|
|
6
6
|
HarnessError,
|
|
7
7
|
HarnessExecutionError,
|
|
8
8
|
HarnessProviderError,
|
|
9
9
|
HarnessWorkspaceError
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-bpc596v3.js";
|
|
11
11
|
// package.json
|
|
12
12
|
var package_default = {
|
|
13
13
|
name: "@zhivex-ai/harness",
|
|
14
|
-
version: "1.4.0
|
|
14
|
+
version: "1.4.0",
|
|
15
15
|
description: "Governed, provider-portable runtime for coding agents with durable approvals and isolated repository execution.",
|
|
16
16
|
type: "module",
|
|
17
17
|
license: "MIT",
|
|
@@ -107,6 +107,7 @@ var package_default = {
|
|
|
107
107
|
"LICENSE",
|
|
108
108
|
"docs/CHANGE_ENVELOPES.md",
|
|
109
109
|
"docs/CLI.md",
|
|
110
|
+
"docs/WEB_LIMITS.md",
|
|
110
111
|
"docs/CODE_RELEASE.md",
|
|
111
112
|
"docs/images/cli-conversation.png",
|
|
112
113
|
"docs/CLIENT_PROTOCOL.md",
|
|
@@ -147,7 +148,9 @@ var package_default = {
|
|
|
147
148
|
"docs/VERTEX.md",
|
|
148
149
|
"docs/TOOL_POLICY.md",
|
|
149
150
|
"docs/fixtures/mcp-stdio-contract-v1.json",
|
|
150
|
-
"docs/PROJECT_MEMORY.md"
|
|
151
|
+
"docs/PROJECT_MEMORY.md",
|
|
152
|
+
"docs/MINIMUM_TASK_AUTHORITY.md",
|
|
153
|
+
"docs/MINIMUM_OFFLINE_EVALS.md"
|
|
151
154
|
],
|
|
152
155
|
scripts: {
|
|
153
156
|
"models:check": "bun run scripts/validate-model-catalog.ts",
|
|
@@ -216,9 +219,9 @@ var package_default = {
|
|
|
216
219
|
"smoke:mcp:installed": "bun run build && bun scripts/mcp-installed-smoke.ts"
|
|
217
220
|
},
|
|
218
221
|
dependencies: {
|
|
219
|
-
"@zhivex-ai/agents": "1.
|
|
222
|
+
"@zhivex-ai/agents": "1.11.0",
|
|
220
223
|
"@zhivex-ai/anthropic": "0.13.2",
|
|
221
|
-
"@zhivex-ai/core": "1.
|
|
224
|
+
"@zhivex-ai/core": "1.31.0",
|
|
222
225
|
"@zhivex-ai/gemini": "0.13.0",
|
|
223
226
|
"@zhivex-ai/meta": "0.2.9",
|
|
224
227
|
"@zhivex-ai/openai": "0.14.1",
|
|
@@ -228,7 +231,7 @@ var package_default = {
|
|
|
228
231
|
zod: "4.6.5"
|
|
229
232
|
},
|
|
230
233
|
overrides: {
|
|
231
|
-
"@zhivex-ai/core": "1.
|
|
234
|
+
"@zhivex-ai/core": "1.31.0"
|
|
232
235
|
},
|
|
233
236
|
devDependencies: {
|
|
234
237
|
"@agentclientprotocol/sdk": "1.7.0",
|