@bunny-agent/daemon 0.9.29-beta.13 → 0.9.29-beta.14
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/bundle.mjs +13 -103
- package/dist/index.js +13 -103
- package/dist/nextjs.d.ts.map +1 -1
- package/dist/nextjs.js +12 -102
- package/dist/routes/coding.d.ts.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/utils.d.ts +0 -5
- package/dist/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/bundle.mjs
CHANGED
|
@@ -206363,53 +206363,6 @@ function ok(data) {
|
|
|
206363
206363
|
function fail(error) {
|
|
206364
206364
|
return { ok: false, data: null, error };
|
|
206365
206365
|
}
|
|
206366
|
-
function formatUnknownError(err) {
|
|
206367
|
-
const isObjectToStringMessage = (msg) => /^\[object [^\]]+\]$/.test(msg.trim());
|
|
206368
|
-
const collectErrorExtras = (e2) => {
|
|
206369
|
-
const extra = {};
|
|
206370
|
-
for (const key of Object.getOwnPropertyNames(e2)) {
|
|
206371
|
-
if (key === "name" || key === "message" || key === "stack") continue;
|
|
206372
|
-
extra[key] = e2[key];
|
|
206373
|
-
}
|
|
206374
|
-
for (const key of ["code", "status", "response", "body", "data"]) {
|
|
206375
|
-
if (key in e2 && !(key in extra)) {
|
|
206376
|
-
extra[key] = e2[key];
|
|
206377
|
-
}
|
|
206378
|
-
}
|
|
206379
|
-
return extra;
|
|
206380
|
-
};
|
|
206381
|
-
const errorRecord = (e2) => ({
|
|
206382
|
-
name: e2.name,
|
|
206383
|
-
message: e2.message,
|
|
206384
|
-
...isObjectToStringMessage(e2.message) ? {
|
|
206385
|
-
note: "Upstream error message was stringified object"
|
|
206386
|
-
} : {},
|
|
206387
|
-
...e2.cause !== void 0 ? { cause: formatUnknownError(e2.cause) } : {},
|
|
206388
|
-
...Object.keys(collectErrorExtras(e2)).length > 0 ? { extra: collectErrorExtras(e2) } : {}
|
|
206389
|
-
});
|
|
206390
|
-
if (err == null) return String(err);
|
|
206391
|
-
if (typeof err === "string") return err;
|
|
206392
|
-
if (typeof err === "number" || typeof err === "boolean") return String(err);
|
|
206393
|
-
if (err instanceof Error) {
|
|
206394
|
-
try {
|
|
206395
|
-
return JSON.stringify(errorRecord(err));
|
|
206396
|
-
} catch {
|
|
206397
|
-
const message = err.message?.trim() ?? "";
|
|
206398
|
-
return `${err.name}: ${message || "(no message)"}`;
|
|
206399
|
-
}
|
|
206400
|
-
}
|
|
206401
|
-
if (typeof err === "object") {
|
|
206402
|
-
try {
|
|
206403
|
-
return JSON.stringify(err, (_key, value2) => {
|
|
206404
|
-
if (value2 instanceof Error) return errorRecord(value2);
|
|
206405
|
-
return value2;
|
|
206406
|
-
});
|
|
206407
|
-
} catch {
|
|
206408
|
-
return "Unserializable object error";
|
|
206409
|
-
}
|
|
206410
|
-
}
|
|
206411
|
-
return String(err);
|
|
206412
|
-
}
|
|
206413
206366
|
function resolveVolumeRoot(state, volume) {
|
|
206414
206367
|
const normalizedRoot = path.resolve(state.root);
|
|
206415
206368
|
if (!volume) return state.root;
|
|
@@ -206834,7 +206787,7 @@ var DaemonRouter = class {
|
|
|
206834
206787
|
}
|
|
206835
206788
|
return {
|
|
206836
206789
|
status: 500,
|
|
206837
|
-
body: fail(
|
|
206790
|
+
body: fail(err instanceof Error ? err.message : String(err))
|
|
206838
206791
|
};
|
|
206839
206792
|
}
|
|
206840
206793
|
}
|
|
@@ -206912,26 +206865,6 @@ function loadSystemPrompt(cwd) {
|
|
|
206912
206865
|
// ../../packages/runner-claude/dist/ai-sdk-stream.js
|
|
206913
206866
|
import { appendFileSync, existsSync as existsSync3, unlinkSync } from "node:fs";
|
|
206914
206867
|
import { join as join3 } from "node:path";
|
|
206915
|
-
function formatUnknownError2(error) {
|
|
206916
|
-
if (error == null)
|
|
206917
|
-
return String(error);
|
|
206918
|
-
if (typeof error === "string")
|
|
206919
|
-
return error;
|
|
206920
|
-
if (typeof error === "number" || typeof error === "boolean") {
|
|
206921
|
-
return String(error);
|
|
206922
|
-
}
|
|
206923
|
-
if (error instanceof Error) {
|
|
206924
|
-
return error.message || error.name || "Error";
|
|
206925
|
-
}
|
|
206926
|
-
if (typeof error === "object") {
|
|
206927
|
-
try {
|
|
206928
|
-
return JSON.stringify(error);
|
|
206929
|
-
} catch {
|
|
206930
|
-
return "Unserializable object error";
|
|
206931
|
-
}
|
|
206932
|
-
}
|
|
206933
|
-
return String(error);
|
|
206934
|
-
}
|
|
206935
206868
|
function trace(data, reset = false) {
|
|
206936
206869
|
if (process.env.DEBUG !== "true")
|
|
206937
206870
|
return;
|
|
@@ -207179,8 +207112,7 @@ var AISDKStreamConverter = class {
|
|
|
207179
207112
|
const resultMsg = message;
|
|
207180
207113
|
if (resultMsg.is_error) {
|
|
207181
207114
|
this.errorEmitted = true;
|
|
207182
|
-
const
|
|
207183
|
-
const errorText = formatUnknownError2(rawResult) || "Unknown error";
|
|
207115
|
+
const errorText = resultMsg.result || "Unknown error";
|
|
207184
207116
|
yield this.emit({
|
|
207185
207117
|
type: "error",
|
|
207186
207118
|
errorText
|
|
@@ -207197,10 +207129,9 @@ var AISDKStreamConverter = class {
|
|
|
207197
207129
|
}
|
|
207198
207130
|
}
|
|
207199
207131
|
} catch (error) {
|
|
207200
|
-
const formattedError = formatUnknownError2(error);
|
|
207201
207132
|
if (process.env.DEBUG === "true") {
|
|
207202
207133
|
const errPayload = {
|
|
207203
|
-
error:
|
|
207134
|
+
error: error instanceof Error ? error.message : String(error)
|
|
207204
207135
|
};
|
|
207205
207136
|
if (error instanceof Error) {
|
|
207206
207137
|
if (error.stack)
|
|
@@ -207209,17 +207140,17 @@ var AISDKStreamConverter = class {
|
|
|
207209
207140
|
errPayload.cause = error.cause instanceof Error ? {
|
|
207210
207141
|
message: error.cause.message,
|
|
207211
207142
|
stack: error.cause.stack
|
|
207212
|
-
} :
|
|
207143
|
+
} : String(error.cause);
|
|
207213
207144
|
}
|
|
207214
207145
|
}
|
|
207215
207146
|
trace(errPayload);
|
|
207216
207147
|
} else {
|
|
207217
|
-
trace({ error:
|
|
207148
|
+
trace({ error: String(error) });
|
|
207218
207149
|
}
|
|
207219
207150
|
if (isAbortError(error)) {
|
|
207220
207151
|
console.error("[AISDKStream] Operation aborted");
|
|
207221
207152
|
} else {
|
|
207222
|
-
const errorMessage =
|
|
207153
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
207223
207154
|
console.error("[AISDKStream] Error:", errorMessage);
|
|
207224
207155
|
if (process.env.DEBUG === "true") {
|
|
207225
207156
|
if (error instanceof Error && error.stack) {
|
|
@@ -207490,7 +207421,7 @@ Documentation: https://platform.claude.com/docs/en/agent-sdk/typescript-v2-previ
|
|
|
207490
207421
|
|
|
207491
207422
|
`;
|
|
207492
207423
|
} catch (error) {
|
|
207493
|
-
const errorMessage =
|
|
207424
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
207494
207425
|
console.error("[ClaudeRunner] Mock agent error:", errorMessage);
|
|
207495
207426
|
yield formatDataStream({ type: "error", errorText: errorMessage });
|
|
207496
207427
|
yield formatDataStream({
|
|
@@ -264551,26 +264482,6 @@ function buildSecretAwareTools(cwd, secrets) {
|
|
|
264551
264482
|
|
|
264552
264483
|
// ../../packages/runner-pi/dist/pi-runner.js
|
|
264553
264484
|
var LOG_PREFIX2 = "[bunny-agent:pi]";
|
|
264554
|
-
function formatUnknownError3(error) {
|
|
264555
|
-
if (error == null)
|
|
264556
|
-
return String(error);
|
|
264557
|
-
if (typeof error === "string")
|
|
264558
|
-
return error;
|
|
264559
|
-
if (typeof error === "number" || typeof error === "boolean") {
|
|
264560
|
-
return String(error);
|
|
264561
|
-
}
|
|
264562
|
-
if (error instanceof Error) {
|
|
264563
|
-
return error.message || error.name || "Error";
|
|
264564
|
-
}
|
|
264565
|
-
if (typeof error === "object") {
|
|
264566
|
-
try {
|
|
264567
|
-
return JSON.stringify(error);
|
|
264568
|
-
} catch {
|
|
264569
|
-
return "Unserializable object error";
|
|
264570
|
-
}
|
|
264571
|
-
}
|
|
264572
|
-
return String(error);
|
|
264573
|
-
}
|
|
264574
264485
|
function parseModelSpec(model) {
|
|
264575
264486
|
const trimmed = model.trim();
|
|
264576
264487
|
const separator = trimmed.indexOf(":");
|
|
@@ -264810,7 +264721,7 @@ function createPiRunner(options2 = {}) {
|
|
|
264810
264721
|
await promptPromise;
|
|
264811
264722
|
} catch (error) {
|
|
264812
264723
|
if (!streamConverter.finished) {
|
|
264813
|
-
const message =
|
|
264724
|
+
const message = error instanceof Error ? error.message : "Pi agent run failed.";
|
|
264814
264725
|
for (const chunk of streamConverter.forceError(message)) {
|
|
264815
264726
|
yield chunk;
|
|
264816
264727
|
}
|
|
@@ -264818,8 +264729,7 @@ function createPiRunner(options2 = {}) {
|
|
|
264818
264729
|
return;
|
|
264819
264730
|
}
|
|
264820
264731
|
if (!streamConverter.finished && session.agent.state.error) {
|
|
264821
|
-
const
|
|
264822
|
-
for (const chunk of streamConverter.forceError(errorText)) {
|
|
264732
|
+
for (const chunk of streamConverter.forceError(session.agent.state.error)) {
|
|
264823
264733
|
yield chunk;
|
|
264824
264734
|
}
|
|
264825
264735
|
}
|
|
@@ -265011,7 +264921,7 @@ async function bunnyAgentRun(req, res, env2) {
|
|
|
265011
264921
|
res.write(chunk);
|
|
265012
264922
|
}
|
|
265013
264923
|
} catch (err) {
|
|
265014
|
-
const msg =
|
|
264924
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265015
264925
|
res.write(`data: ${JSON.stringify({ type: "error", errorText: msg })}
|
|
265016
264926
|
|
|
265017
264927
|
`);
|
|
@@ -265071,7 +264981,7 @@ function createDaemon(config) {
|
|
|
265071
264981
|
res.end(JSON.stringify(result2));
|
|
265072
264982
|
} catch (err) {
|
|
265073
264983
|
const status2 = err instanceof AppError ? err.status : 500;
|
|
265074
|
-
const msg =
|
|
264984
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265075
264985
|
res.writeHead(status2, { "Content-Type": "application/json" });
|
|
265076
264986
|
res.end(JSON.stringify(fail(msg)));
|
|
265077
264987
|
}
|
|
@@ -265098,7 +265008,7 @@ function createDaemon(config) {
|
|
|
265098
265008
|
res.end(buffer);
|
|
265099
265009
|
} catch (err) {
|
|
265100
265010
|
const status2 = err instanceof AppError ? err.status : 500;
|
|
265101
|
-
const msg =
|
|
265011
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265102
265012
|
res.writeHead(status2, { "Content-Type": "application/json" });
|
|
265103
265013
|
res.end(JSON.stringify(fail(msg)));
|
|
265104
265014
|
}
|
|
@@ -265131,7 +265041,7 @@ function createDaemon(config) {
|
|
|
265131
265041
|
sendJson(res, err.status, fail(err.message));
|
|
265132
265042
|
} else {
|
|
265133
265043
|
console.error("Unhandled request error:", err);
|
|
265134
|
-
const msg =
|
|
265044
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265135
265045
|
sendJson(res, 500, fail(`Internal server error: ${msg}`));
|
|
265136
265046
|
}
|
|
265137
265047
|
} else {
|
package/dist/index.js
CHANGED
|
@@ -206297,53 +206297,6 @@ function ok(data) {
|
|
|
206297
206297
|
function fail(error) {
|
|
206298
206298
|
return { ok: false, data: null, error };
|
|
206299
206299
|
}
|
|
206300
|
-
function formatUnknownError(err) {
|
|
206301
|
-
const isObjectToStringMessage = (msg) => /^\[object [^\]]+\]$/.test(msg.trim());
|
|
206302
|
-
const collectErrorExtras = (e2) => {
|
|
206303
|
-
const extra = {};
|
|
206304
|
-
for (const key of Object.getOwnPropertyNames(e2)) {
|
|
206305
|
-
if (key === "name" || key === "message" || key === "stack") continue;
|
|
206306
|
-
extra[key] = e2[key];
|
|
206307
|
-
}
|
|
206308
|
-
for (const key of ["code", "status", "response", "body", "data"]) {
|
|
206309
|
-
if (key in e2 && !(key in extra)) {
|
|
206310
|
-
extra[key] = e2[key];
|
|
206311
|
-
}
|
|
206312
|
-
}
|
|
206313
|
-
return extra;
|
|
206314
|
-
};
|
|
206315
|
-
const errorRecord = (e2) => ({
|
|
206316
|
-
name: e2.name,
|
|
206317
|
-
message: e2.message,
|
|
206318
|
-
...isObjectToStringMessage(e2.message) ? {
|
|
206319
|
-
note: "Upstream error message was stringified object"
|
|
206320
|
-
} : {},
|
|
206321
|
-
...e2.cause !== void 0 ? { cause: formatUnknownError(e2.cause) } : {},
|
|
206322
|
-
...Object.keys(collectErrorExtras(e2)).length > 0 ? { extra: collectErrorExtras(e2) } : {}
|
|
206323
|
-
});
|
|
206324
|
-
if (err == null) return String(err);
|
|
206325
|
-
if (typeof err === "string") return err;
|
|
206326
|
-
if (typeof err === "number" || typeof err === "boolean") return String(err);
|
|
206327
|
-
if (err instanceof Error) {
|
|
206328
|
-
try {
|
|
206329
|
-
return JSON.stringify(errorRecord(err));
|
|
206330
|
-
} catch {
|
|
206331
|
-
const message = err.message?.trim() ?? "";
|
|
206332
|
-
return `${err.name}: ${message || "(no message)"}`;
|
|
206333
|
-
}
|
|
206334
|
-
}
|
|
206335
|
-
if (typeof err === "object") {
|
|
206336
|
-
try {
|
|
206337
|
-
return JSON.stringify(err, (_key, value2) => {
|
|
206338
|
-
if (value2 instanceof Error) return errorRecord(value2);
|
|
206339
|
-
return value2;
|
|
206340
|
-
});
|
|
206341
|
-
} catch {
|
|
206342
|
-
return "Unserializable object error";
|
|
206343
|
-
}
|
|
206344
|
-
}
|
|
206345
|
-
return String(err);
|
|
206346
|
-
}
|
|
206347
206300
|
function resolveVolumeRoot(state, volume) {
|
|
206348
206301
|
const normalizedRoot = path.resolve(state.root);
|
|
206349
206302
|
if (!volume) return state.root;
|
|
@@ -206768,7 +206721,7 @@ var DaemonRouter = class {
|
|
|
206768
206721
|
}
|
|
206769
206722
|
return {
|
|
206770
206723
|
status: 500,
|
|
206771
|
-
body: fail(
|
|
206724
|
+
body: fail(err instanceof Error ? err.message : String(err))
|
|
206772
206725
|
};
|
|
206773
206726
|
}
|
|
206774
206727
|
}
|
|
@@ -206908,26 +206861,6 @@ function loadSystemPrompt(cwd) {
|
|
|
206908
206861
|
// ../../packages/runner-claude/dist/ai-sdk-stream.js
|
|
206909
206862
|
import { appendFileSync, existsSync as existsSync3, unlinkSync } from "node:fs";
|
|
206910
206863
|
import { join as join3 } from "node:path";
|
|
206911
|
-
function formatUnknownError2(error) {
|
|
206912
|
-
if (error == null)
|
|
206913
|
-
return String(error);
|
|
206914
|
-
if (typeof error === "string")
|
|
206915
|
-
return error;
|
|
206916
|
-
if (typeof error === "number" || typeof error === "boolean") {
|
|
206917
|
-
return String(error);
|
|
206918
|
-
}
|
|
206919
|
-
if (error instanceof Error) {
|
|
206920
|
-
return error.message || error.name || "Error";
|
|
206921
|
-
}
|
|
206922
|
-
if (typeof error === "object") {
|
|
206923
|
-
try {
|
|
206924
|
-
return JSON.stringify(error);
|
|
206925
|
-
} catch {
|
|
206926
|
-
return "Unserializable object error";
|
|
206927
|
-
}
|
|
206928
|
-
}
|
|
206929
|
-
return String(error);
|
|
206930
|
-
}
|
|
206931
206864
|
function trace(data, reset = false) {
|
|
206932
206865
|
if (process.env.DEBUG !== "true")
|
|
206933
206866
|
return;
|
|
@@ -207175,8 +207108,7 @@ var AISDKStreamConverter = class {
|
|
|
207175
207108
|
const resultMsg = message;
|
|
207176
207109
|
if (resultMsg.is_error) {
|
|
207177
207110
|
this.errorEmitted = true;
|
|
207178
|
-
const
|
|
207179
|
-
const errorText = formatUnknownError2(rawResult) || "Unknown error";
|
|
207111
|
+
const errorText = resultMsg.result || "Unknown error";
|
|
207180
207112
|
yield this.emit({
|
|
207181
207113
|
type: "error",
|
|
207182
207114
|
errorText
|
|
@@ -207193,10 +207125,9 @@ var AISDKStreamConverter = class {
|
|
|
207193
207125
|
}
|
|
207194
207126
|
}
|
|
207195
207127
|
} catch (error) {
|
|
207196
|
-
const formattedError = formatUnknownError2(error);
|
|
207197
207128
|
if (process.env.DEBUG === "true") {
|
|
207198
207129
|
const errPayload = {
|
|
207199
|
-
error:
|
|
207130
|
+
error: error instanceof Error ? error.message : String(error)
|
|
207200
207131
|
};
|
|
207201
207132
|
if (error instanceof Error) {
|
|
207202
207133
|
if (error.stack)
|
|
@@ -207205,17 +207136,17 @@ var AISDKStreamConverter = class {
|
|
|
207205
207136
|
errPayload.cause = error.cause instanceof Error ? {
|
|
207206
207137
|
message: error.cause.message,
|
|
207207
207138
|
stack: error.cause.stack
|
|
207208
|
-
} :
|
|
207139
|
+
} : String(error.cause);
|
|
207209
207140
|
}
|
|
207210
207141
|
}
|
|
207211
207142
|
trace(errPayload);
|
|
207212
207143
|
} else {
|
|
207213
|
-
trace({ error:
|
|
207144
|
+
trace({ error: String(error) });
|
|
207214
207145
|
}
|
|
207215
207146
|
if (isAbortError(error)) {
|
|
207216
207147
|
console.error("[AISDKStream] Operation aborted");
|
|
207217
207148
|
} else {
|
|
207218
|
-
const errorMessage =
|
|
207149
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
207219
207150
|
console.error("[AISDKStream] Error:", errorMessage);
|
|
207220
207151
|
if (process.env.DEBUG === "true") {
|
|
207221
207152
|
if (error instanceof Error && error.stack) {
|
|
@@ -207486,7 +207417,7 @@ Documentation: https://platform.claude.com/docs/en/agent-sdk/typescript-v2-previ
|
|
|
207486
207417
|
|
|
207487
207418
|
`;
|
|
207488
207419
|
} catch (error) {
|
|
207489
|
-
const errorMessage =
|
|
207420
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
207490
207421
|
console.error("[ClaudeRunner] Mock agent error:", errorMessage);
|
|
207491
207422
|
yield formatDataStream({ type: "error", errorText: errorMessage });
|
|
207492
207423
|
yield formatDataStream({
|
|
@@ -264547,26 +264478,6 @@ function buildSecretAwareTools(cwd, secrets) {
|
|
|
264547
264478
|
|
|
264548
264479
|
// ../../packages/runner-pi/dist/pi-runner.js
|
|
264549
264480
|
var LOG_PREFIX2 = "[bunny-agent:pi]";
|
|
264550
|
-
function formatUnknownError3(error) {
|
|
264551
|
-
if (error == null)
|
|
264552
|
-
return String(error);
|
|
264553
|
-
if (typeof error === "string")
|
|
264554
|
-
return error;
|
|
264555
|
-
if (typeof error === "number" || typeof error === "boolean") {
|
|
264556
|
-
return String(error);
|
|
264557
|
-
}
|
|
264558
|
-
if (error instanceof Error) {
|
|
264559
|
-
return error.message || error.name || "Error";
|
|
264560
|
-
}
|
|
264561
|
-
if (typeof error === "object") {
|
|
264562
|
-
try {
|
|
264563
|
-
return JSON.stringify(error);
|
|
264564
|
-
} catch {
|
|
264565
|
-
return "Unserializable object error";
|
|
264566
|
-
}
|
|
264567
|
-
}
|
|
264568
|
-
return String(error);
|
|
264569
|
-
}
|
|
264570
264481
|
function parseModelSpec(model) {
|
|
264571
264482
|
const trimmed = model.trim();
|
|
264572
264483
|
const separator = trimmed.indexOf(":");
|
|
@@ -264806,7 +264717,7 @@ function createPiRunner(options2 = {}) {
|
|
|
264806
264717
|
await promptPromise;
|
|
264807
264718
|
} catch (error) {
|
|
264808
264719
|
if (!streamConverter.finished) {
|
|
264809
|
-
const message =
|
|
264720
|
+
const message = error instanceof Error ? error.message : "Pi agent run failed.";
|
|
264810
264721
|
for (const chunk of streamConverter.forceError(message)) {
|
|
264811
264722
|
yield chunk;
|
|
264812
264723
|
}
|
|
@@ -264814,8 +264725,7 @@ function createPiRunner(options2 = {}) {
|
|
|
264814
264725
|
return;
|
|
264815
264726
|
}
|
|
264816
264727
|
if (!streamConverter.finished && session.agent.state.error) {
|
|
264817
|
-
const
|
|
264818
|
-
for (const chunk of streamConverter.forceError(errorText)) {
|
|
264728
|
+
for (const chunk of streamConverter.forceError(session.agent.state.error)) {
|
|
264819
264729
|
yield chunk;
|
|
264820
264730
|
}
|
|
264821
264731
|
}
|
|
@@ -265007,7 +264917,7 @@ async function bunnyAgentRun(req, res, env2) {
|
|
|
265007
264917
|
res.write(chunk);
|
|
265008
264918
|
}
|
|
265009
264919
|
} catch (err) {
|
|
265010
|
-
const msg =
|
|
264920
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265011
264921
|
res.write(`data: ${JSON.stringify({ type: "error", errorText: msg })}
|
|
265012
264922
|
|
|
265013
264923
|
`);
|
|
@@ -265067,7 +264977,7 @@ function createDaemon(config) {
|
|
|
265067
264977
|
res.end(JSON.stringify(result2));
|
|
265068
264978
|
} catch (err) {
|
|
265069
264979
|
const status2 = err instanceof AppError ? err.status : 500;
|
|
265070
|
-
const msg =
|
|
264980
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265071
264981
|
res.writeHead(status2, { "Content-Type": "application/json" });
|
|
265072
264982
|
res.end(JSON.stringify(fail(msg)));
|
|
265073
264983
|
}
|
|
@@ -265094,7 +265004,7 @@ function createDaemon(config) {
|
|
|
265094
265004
|
res.end(buffer);
|
|
265095
265005
|
} catch (err) {
|
|
265096
265006
|
const status2 = err instanceof AppError ? err.status : 500;
|
|
265097
|
-
const msg =
|
|
265007
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265098
265008
|
res.writeHead(status2, { "Content-Type": "application/json" });
|
|
265099
265009
|
res.end(JSON.stringify(fail(msg)));
|
|
265100
265010
|
}
|
|
@@ -265127,7 +265037,7 @@ function createDaemon(config) {
|
|
|
265127
265037
|
sendJson(res, err.status, fail(err.message));
|
|
265128
265038
|
} else {
|
|
265129
265039
|
console.error("Unhandled request error:", err);
|
|
265130
|
-
const msg =
|
|
265040
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265131
265041
|
sendJson(res, 500, fail(`Internal server error: ${msg}`));
|
|
265132
265042
|
}
|
|
265133
265043
|
} else {
|
package/dist/nextjs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextjs.d.ts","sourceRoot":"","sources":["../src/nextjs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"nextjs.d.ts","sourceRoot":"","sources":["../src/nextjs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AASH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,IASzD,KAAK,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC,CAgF/C"}
|
package/dist/nextjs.js
CHANGED
|
@@ -206355,53 +206355,6 @@ function ok(data) {
|
|
|
206355
206355
|
function fail(error) {
|
|
206356
206356
|
return { ok: false, data: null, error };
|
|
206357
206357
|
}
|
|
206358
|
-
function formatUnknownError(err) {
|
|
206359
|
-
const isObjectToStringMessage = (msg) => /^\[object [^\]]+\]$/.test(msg.trim());
|
|
206360
|
-
const collectErrorExtras = (e2) => {
|
|
206361
|
-
const extra = {};
|
|
206362
|
-
for (const key of Object.getOwnPropertyNames(e2)) {
|
|
206363
|
-
if (key === "name" || key === "message" || key === "stack") continue;
|
|
206364
|
-
extra[key] = e2[key];
|
|
206365
|
-
}
|
|
206366
|
-
for (const key of ["code", "status", "response", "body", "data"]) {
|
|
206367
|
-
if (key in e2 && !(key in extra)) {
|
|
206368
|
-
extra[key] = e2[key];
|
|
206369
|
-
}
|
|
206370
|
-
}
|
|
206371
|
-
return extra;
|
|
206372
|
-
};
|
|
206373
|
-
const errorRecord = (e2) => ({
|
|
206374
|
-
name: e2.name,
|
|
206375
|
-
message: e2.message,
|
|
206376
|
-
...isObjectToStringMessage(e2.message) ? {
|
|
206377
|
-
note: "Upstream error message was stringified object"
|
|
206378
|
-
} : {},
|
|
206379
|
-
...e2.cause !== void 0 ? { cause: formatUnknownError(e2.cause) } : {},
|
|
206380
|
-
...Object.keys(collectErrorExtras(e2)).length > 0 ? { extra: collectErrorExtras(e2) } : {}
|
|
206381
|
-
});
|
|
206382
|
-
if (err == null) return String(err);
|
|
206383
|
-
if (typeof err === "string") return err;
|
|
206384
|
-
if (typeof err === "number" || typeof err === "boolean") return String(err);
|
|
206385
|
-
if (err instanceof Error) {
|
|
206386
|
-
try {
|
|
206387
|
-
return JSON.stringify(errorRecord(err));
|
|
206388
|
-
} catch {
|
|
206389
|
-
const message = err.message?.trim() ?? "";
|
|
206390
|
-
return `${err.name}: ${message || "(no message)"}`;
|
|
206391
|
-
}
|
|
206392
|
-
}
|
|
206393
|
-
if (typeof err === "object") {
|
|
206394
|
-
try {
|
|
206395
|
-
return JSON.stringify(err, (_key, value2) => {
|
|
206396
|
-
if (value2 instanceof Error) return errorRecord(value2);
|
|
206397
|
-
return value2;
|
|
206398
|
-
});
|
|
206399
|
-
} catch {
|
|
206400
|
-
return "Unserializable object error";
|
|
206401
|
-
}
|
|
206402
|
-
}
|
|
206403
|
-
return String(err);
|
|
206404
|
-
}
|
|
206405
206358
|
function resolveVolumeRoot(state, volume) {
|
|
206406
206359
|
const normalizedRoot = path.resolve(state.root);
|
|
206407
206360
|
if (!volume) return state.root;
|
|
@@ -206826,7 +206779,7 @@ var DaemonRouter = class {
|
|
|
206826
206779
|
}
|
|
206827
206780
|
return {
|
|
206828
206781
|
status: 500,
|
|
206829
|
-
body: fail(
|
|
206782
|
+
body: fail(err instanceof Error ? err.message : String(err))
|
|
206830
206783
|
};
|
|
206831
206784
|
}
|
|
206832
206785
|
}
|
|
@@ -206904,26 +206857,6 @@ function loadSystemPrompt(cwd) {
|
|
|
206904
206857
|
// ../../packages/runner-claude/dist/ai-sdk-stream.js
|
|
206905
206858
|
import { appendFileSync, existsSync as existsSync3, unlinkSync } from "node:fs";
|
|
206906
206859
|
import { join as join3 } from "node:path";
|
|
206907
|
-
function formatUnknownError2(error) {
|
|
206908
|
-
if (error == null)
|
|
206909
|
-
return String(error);
|
|
206910
|
-
if (typeof error === "string")
|
|
206911
|
-
return error;
|
|
206912
|
-
if (typeof error === "number" || typeof error === "boolean") {
|
|
206913
|
-
return String(error);
|
|
206914
|
-
}
|
|
206915
|
-
if (error instanceof Error) {
|
|
206916
|
-
return error.message || error.name || "Error";
|
|
206917
|
-
}
|
|
206918
|
-
if (typeof error === "object") {
|
|
206919
|
-
try {
|
|
206920
|
-
return JSON.stringify(error);
|
|
206921
|
-
} catch {
|
|
206922
|
-
return "Unserializable object error";
|
|
206923
|
-
}
|
|
206924
|
-
}
|
|
206925
|
-
return String(error);
|
|
206926
|
-
}
|
|
206927
206860
|
function trace(data, reset = false) {
|
|
206928
206861
|
if (process.env.DEBUG !== "true")
|
|
206929
206862
|
return;
|
|
@@ -207171,8 +207104,7 @@ var AISDKStreamConverter = class {
|
|
|
207171
207104
|
const resultMsg = message;
|
|
207172
207105
|
if (resultMsg.is_error) {
|
|
207173
207106
|
this.errorEmitted = true;
|
|
207174
|
-
const
|
|
207175
|
-
const errorText = formatUnknownError2(rawResult) || "Unknown error";
|
|
207107
|
+
const errorText = resultMsg.result || "Unknown error";
|
|
207176
207108
|
yield this.emit({
|
|
207177
207109
|
type: "error",
|
|
207178
207110
|
errorText
|
|
@@ -207189,10 +207121,9 @@ var AISDKStreamConverter = class {
|
|
|
207189
207121
|
}
|
|
207190
207122
|
}
|
|
207191
207123
|
} catch (error) {
|
|
207192
|
-
const formattedError = formatUnknownError2(error);
|
|
207193
207124
|
if (process.env.DEBUG === "true") {
|
|
207194
207125
|
const errPayload = {
|
|
207195
|
-
error:
|
|
207126
|
+
error: error instanceof Error ? error.message : String(error)
|
|
207196
207127
|
};
|
|
207197
207128
|
if (error instanceof Error) {
|
|
207198
207129
|
if (error.stack)
|
|
@@ -207201,17 +207132,17 @@ var AISDKStreamConverter = class {
|
|
|
207201
207132
|
errPayload.cause = error.cause instanceof Error ? {
|
|
207202
207133
|
message: error.cause.message,
|
|
207203
207134
|
stack: error.cause.stack
|
|
207204
|
-
} :
|
|
207135
|
+
} : String(error.cause);
|
|
207205
207136
|
}
|
|
207206
207137
|
}
|
|
207207
207138
|
trace(errPayload);
|
|
207208
207139
|
} else {
|
|
207209
|
-
trace({ error:
|
|
207140
|
+
trace({ error: String(error) });
|
|
207210
207141
|
}
|
|
207211
207142
|
if (isAbortError(error)) {
|
|
207212
207143
|
console.error("[AISDKStream] Operation aborted");
|
|
207213
207144
|
} else {
|
|
207214
|
-
const errorMessage =
|
|
207145
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
207215
207146
|
console.error("[AISDKStream] Error:", errorMessage);
|
|
207216
207147
|
if (process.env.DEBUG === "true") {
|
|
207217
207148
|
if (error instanceof Error && error.stack) {
|
|
@@ -207482,7 +207413,7 @@ Documentation: https://platform.claude.com/docs/en/agent-sdk/typescript-v2-previ
|
|
|
207482
207413
|
|
|
207483
207414
|
`;
|
|
207484
207415
|
} catch (error) {
|
|
207485
|
-
const errorMessage =
|
|
207416
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
207486
207417
|
console.error("[ClaudeRunner] Mock agent error:", errorMessage);
|
|
207487
207418
|
yield formatDataStream({ type: "error", errorText: errorMessage });
|
|
207488
207419
|
yield formatDataStream({
|
|
@@ -264543,26 +264474,6 @@ function buildSecretAwareTools(cwd, secrets) {
|
|
|
264543
264474
|
|
|
264544
264475
|
// ../../packages/runner-pi/dist/pi-runner.js
|
|
264545
264476
|
var LOG_PREFIX2 = "[bunny-agent:pi]";
|
|
264546
|
-
function formatUnknownError3(error) {
|
|
264547
|
-
if (error == null)
|
|
264548
|
-
return String(error);
|
|
264549
|
-
if (typeof error === "string")
|
|
264550
|
-
return error;
|
|
264551
|
-
if (typeof error === "number" || typeof error === "boolean") {
|
|
264552
|
-
return String(error);
|
|
264553
|
-
}
|
|
264554
|
-
if (error instanceof Error) {
|
|
264555
|
-
return error.message || error.name || "Error";
|
|
264556
|
-
}
|
|
264557
|
-
if (typeof error === "object") {
|
|
264558
|
-
try {
|
|
264559
|
-
return JSON.stringify(error);
|
|
264560
|
-
} catch {
|
|
264561
|
-
return "Unserializable object error";
|
|
264562
|
-
}
|
|
264563
|
-
}
|
|
264564
|
-
return String(error);
|
|
264565
|
-
}
|
|
264566
264477
|
function parseModelSpec(model) {
|
|
264567
264478
|
const trimmed = model.trim();
|
|
264568
264479
|
const separator = trimmed.indexOf(":");
|
|
@@ -264802,7 +264713,7 @@ function createPiRunner(options2 = {}) {
|
|
|
264802
264713
|
await promptPromise;
|
|
264803
264714
|
} catch (error) {
|
|
264804
264715
|
if (!streamConverter.finished) {
|
|
264805
|
-
const message =
|
|
264716
|
+
const message = error instanceof Error ? error.message : "Pi agent run failed.";
|
|
264806
264717
|
for (const chunk of streamConverter.forceError(message)) {
|
|
264807
264718
|
yield chunk;
|
|
264808
264719
|
}
|
|
@@ -264810,8 +264721,7 @@ function createPiRunner(options2 = {}) {
|
|
|
264810
264721
|
return;
|
|
264811
264722
|
}
|
|
264812
264723
|
if (!streamConverter.finished && session.agent.state.error) {
|
|
264813
|
-
const
|
|
264814
|
-
for (const chunk of streamConverter.forceError(errorText)) {
|
|
264724
|
+
for (const chunk of streamConverter.forceError(session.agent.state.error)) {
|
|
264815
264725
|
yield chunk;
|
|
264816
264726
|
}
|
|
264817
264727
|
}
|
|
@@ -265000,7 +264910,7 @@ function codingRunStream(req, env2) {
|
|
|
265000
264910
|
controller.enqueue(encoder.encode(chunk));
|
|
265001
264911
|
}
|
|
265002
264912
|
} catch (err) {
|
|
265003
|
-
const msg =
|
|
264913
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265004
264914
|
controller.enqueue(
|
|
265005
264915
|
encoder.encode(
|
|
265006
264916
|
`data: ${JSON.stringify({ type: "error", errorText: msg })}
|
|
@@ -265062,7 +264972,7 @@ function createNextHandler(opts) {
|
|
|
265062
264972
|
return Response.json(result2);
|
|
265063
264973
|
} catch (err) {
|
|
265064
264974
|
const status = err instanceof AppError ? err.status : 500;
|
|
265065
|
-
const msg =
|
|
264975
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265066
264976
|
return Response.json(fail(msg), { status });
|
|
265067
264977
|
}
|
|
265068
264978
|
}
|
|
@@ -265089,7 +264999,7 @@ function createNextHandler(opts) {
|
|
|
265089
264999
|
});
|
|
265090
265000
|
} catch (err) {
|
|
265091
265001
|
const status = err instanceof AppError ? err.status : 500;
|
|
265092
|
-
const msg =
|
|
265002
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265093
265003
|
return Response.json(fail(msg), { status });
|
|
265094
265004
|
}
|
|
265095
265005
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coding.d.ts","sourceRoot":"","sources":["../../src/routes/coding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"coding.d.ts","sourceRoot":"","sources":["../../src/routes/coding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AAGvC,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAKD,eAAO,MAAM,iBAAiB,oBAAoB,CAAC;AAEnD,sCAAsC;AACtC,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED,8DAA8D;AAC9D,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAEvD;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,UAAU,EACf,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1B,OAAO,CAAC,IAAI,CAAC,CAoDf;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,UAAU,EACf,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1B,QAAQ,CA6DV"}
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AASlC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC,MAAM,CA8H9D"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -5,11 +5,6 @@ export interface ApiEnvelope<T = unknown> {
|
|
|
5
5
|
}
|
|
6
6
|
export declare function ok<T>(data: T): ApiEnvelope<T>;
|
|
7
7
|
export declare function fail(error: string): ApiEnvelope<null>;
|
|
8
|
-
/**
|
|
9
|
-
* Format unknown thrown values into a readable message.
|
|
10
|
-
* Avoids noisy "[object Object]" in logs and API error payloads.
|
|
11
|
-
*/
|
|
12
|
-
export declare function formatUnknownError(err: unknown): string;
|
|
13
8
|
export interface AppState {
|
|
14
9
|
root: string;
|
|
15
10
|
volumesRoot: string;
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO;IACtC,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,wBAAgB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAE7C;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,CAErD;AAED
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO;IACtC,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,wBAAgB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAE7C;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,CAErD;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CA2B1E;AAUD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAqBlE;AAQD,qBAAa,QAAS,SAAQ,KAAK;IAExB,MAAM,EAAE,MAAM;gBAAd,MAAM,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM;CAIlB;AAED,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE1D;AAwCD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGtD"}
|