@karowanorg/orc-harness-claude 0.1.1 → 0.1.3
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/dist/index.js +25 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -194,6 +194,9 @@ async function* invokeSdk(req, ctx) {
|
|
|
194
194
|
enabled: true,
|
|
195
195
|
failIfUnavailable: true,
|
|
196
196
|
allowUnsandboxedCommands: false,
|
|
197
|
+
...(req.networkAccess
|
|
198
|
+
? { network: { allowedDomains: ["*"], allowLocalBinding: true } }
|
|
199
|
+
: {}),
|
|
197
200
|
filesystem: { allowWrite: roots },
|
|
198
201
|
},
|
|
199
202
|
}
|
|
@@ -205,6 +208,7 @@ async function* invokeSdk(req, ctx) {
|
|
|
205
208
|
// from the first frame; refine `model` to the SDK's resolved id when it arrives.
|
|
206
209
|
yield { kind: "model", model: req.model, reasoningEffort: req.reasoningEffort };
|
|
207
210
|
let reportedModel = req.model;
|
|
211
|
+
let syntheticFailure;
|
|
208
212
|
try {
|
|
209
213
|
for await (const message of query({ prompt: req.prompt, options })) {
|
|
210
214
|
const m = message.message?.model ??
|
|
@@ -213,6 +217,16 @@ async function* invokeSdk(req, ctx) {
|
|
|
213
217
|
reportedModel = m;
|
|
214
218
|
yield { kind: "model", model: m, reasoningEffort: req.reasoningEffort };
|
|
215
219
|
}
|
|
220
|
+
if (m === "<synthetic>") {
|
|
221
|
+
syntheticFailure = assistantText(message) || "Claude Code returned a synthetic local failure";
|
|
222
|
+
yield { kind: "error", message: `claude unavailable: ${syntheticFailure}` };
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
// Claude Code emits a nominal success result after local auth/quota
|
|
226
|
+
// failures. Do not turn that status prose into `{text: ...}` and then
|
|
227
|
+
// misreport it as an output-schema defect.
|
|
228
|
+
if (syntheticFailure && message.type === "result")
|
|
229
|
+
continue;
|
|
216
230
|
for (const ev of mapSdkMessage(message))
|
|
217
231
|
yield ev;
|
|
218
232
|
}
|
|
@@ -229,6 +243,17 @@ async function* invokeSdk(req, ctx) {
|
|
|
229
243
|
ctx.signal.removeEventListener("abort", onAbort);
|
|
230
244
|
}
|
|
231
245
|
}
|
|
246
|
+
function assistantText(message) {
|
|
247
|
+
if (message.type !== "assistant")
|
|
248
|
+
return "";
|
|
249
|
+
return (message.message.content ?? [])
|
|
250
|
+
.flatMap((block) => {
|
|
251
|
+
const candidate = block;
|
|
252
|
+
return candidate.type === "text" && typeof candidate.text === "string" ? [candidate.text] : [];
|
|
253
|
+
})
|
|
254
|
+
.join("\n")
|
|
255
|
+
.trim();
|
|
256
|
+
}
|
|
232
257
|
function* mapSdkMessage(message) {
|
|
233
258
|
const now = Date.now();
|
|
234
259
|
if (message.type === "system" && message.subtype === "init") {
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@karowanorg/orc-harness-claude",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"license": "0BSD",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@karowanorg/orc-core": "^0.1.
|
|
8
|
+
"@karowanorg/orc-core": "^0.1.2",
|
|
9
9
|
"@karowanorg/orc-executors": "^0.1.1",
|
|
10
10
|
"@anthropic-ai/claude-agent-sdk": "^0.3.0",
|
|
11
11
|
"zod": "^4.1.0"
|