@bunny-agent/daemon 0.9.29-beta.11 → 0.9.29-beta.12
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 +87 -13
- package/dist/index.js +87 -13
- package/dist/nextjs.d.ts.map +1 -1
- package/dist/nextjs.js +86 -12
- package/dist/router.d.ts.map +1 -1
- package/dist/routes/coding.d.ts.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/utils.d.ts +5 -0
- package/dist/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/bundle.mjs
CHANGED
|
@@ -206363,6 +206363,35 @@ function ok(data) {
|
|
|
206363
206363
|
function fail(error) {
|
|
206364
206364
|
return { ok: false, data: null, error };
|
|
206365
206365
|
}
|
|
206366
|
+
function formatUnknownError(err) {
|
|
206367
|
+
const errorRecord = (e2) => ({
|
|
206368
|
+
name: e2.name,
|
|
206369
|
+
message: e2.message,
|
|
206370
|
+
...e2.cause !== void 0 ? { cause: formatUnknownError(e2.cause) } : {}
|
|
206371
|
+
});
|
|
206372
|
+
if (err == null) return String(err);
|
|
206373
|
+
if (typeof err === "string") return err;
|
|
206374
|
+
if (typeof err === "number" || typeof err === "boolean") return String(err);
|
|
206375
|
+
if (err instanceof Error) {
|
|
206376
|
+
try {
|
|
206377
|
+
return JSON.stringify(errorRecord(err));
|
|
206378
|
+
} catch {
|
|
206379
|
+
const message = err.message?.trim() ?? "";
|
|
206380
|
+
return `${err.name}: ${message || "(no message)"}`;
|
|
206381
|
+
}
|
|
206382
|
+
}
|
|
206383
|
+
if (typeof err === "object") {
|
|
206384
|
+
try {
|
|
206385
|
+
return JSON.stringify(err, (_key, value2) => {
|
|
206386
|
+
if (value2 instanceof Error) return errorRecord(value2);
|
|
206387
|
+
return value2;
|
|
206388
|
+
});
|
|
206389
|
+
} catch {
|
|
206390
|
+
return "Unserializable object error";
|
|
206391
|
+
}
|
|
206392
|
+
}
|
|
206393
|
+
return String(err);
|
|
206394
|
+
}
|
|
206366
206395
|
function resolveVolumeRoot(state, volume) {
|
|
206367
206396
|
const normalizedRoot = path.resolve(state.root);
|
|
206368
206397
|
if (!volume) return state.root;
|
|
@@ -206787,7 +206816,9 @@ var DaemonRouter = class {
|
|
|
206787
206816
|
}
|
|
206788
206817
|
return {
|
|
206789
206818
|
status: 500,
|
|
206790
|
-
body: fail(
|
|
206819
|
+
body: fail(
|
|
206820
|
+
err instanceof Error ? err.message : formatUnknownError(err)
|
|
206821
|
+
)
|
|
206791
206822
|
};
|
|
206792
206823
|
}
|
|
206793
206824
|
}
|
|
@@ -206865,6 +206896,26 @@ function loadSystemPrompt(cwd) {
|
|
|
206865
206896
|
// ../../packages/runner-claude/dist/ai-sdk-stream.js
|
|
206866
206897
|
import { appendFileSync, existsSync as existsSync3, unlinkSync } from "node:fs";
|
|
206867
206898
|
import { join as join3 } from "node:path";
|
|
206899
|
+
function formatUnknownError2(error) {
|
|
206900
|
+
if (error == null)
|
|
206901
|
+
return String(error);
|
|
206902
|
+
if (typeof error === "string")
|
|
206903
|
+
return error;
|
|
206904
|
+
if (typeof error === "number" || typeof error === "boolean") {
|
|
206905
|
+
return String(error);
|
|
206906
|
+
}
|
|
206907
|
+
if (error instanceof Error) {
|
|
206908
|
+
return error.message || error.name || "Error";
|
|
206909
|
+
}
|
|
206910
|
+
if (typeof error === "object") {
|
|
206911
|
+
try {
|
|
206912
|
+
return JSON.stringify(error);
|
|
206913
|
+
} catch {
|
|
206914
|
+
return "Unserializable object error";
|
|
206915
|
+
}
|
|
206916
|
+
}
|
|
206917
|
+
return String(error);
|
|
206918
|
+
}
|
|
206868
206919
|
function trace(data, reset = false) {
|
|
206869
206920
|
if (process.env.DEBUG !== "true")
|
|
206870
206921
|
return;
|
|
@@ -207112,7 +207163,8 @@ var AISDKStreamConverter = class {
|
|
|
207112
207163
|
const resultMsg = message;
|
|
207113
207164
|
if (resultMsg.is_error) {
|
|
207114
207165
|
this.errorEmitted = true;
|
|
207115
|
-
const
|
|
207166
|
+
const rawResult = resultMsg.result;
|
|
207167
|
+
const errorText = formatUnknownError2(rawResult) || "Unknown error";
|
|
207116
207168
|
yield this.emit({
|
|
207117
207169
|
type: "error",
|
|
207118
207170
|
errorText
|
|
@@ -207129,9 +207181,10 @@ var AISDKStreamConverter = class {
|
|
|
207129
207181
|
}
|
|
207130
207182
|
}
|
|
207131
207183
|
} catch (error) {
|
|
207184
|
+
const formattedError = formatUnknownError2(error);
|
|
207132
207185
|
if (process.env.DEBUG === "true") {
|
|
207133
207186
|
const errPayload = {
|
|
207134
|
-
error:
|
|
207187
|
+
error: formattedError
|
|
207135
207188
|
};
|
|
207136
207189
|
if (error instanceof Error) {
|
|
207137
207190
|
if (error.stack)
|
|
@@ -207140,17 +207193,17 @@ var AISDKStreamConverter = class {
|
|
|
207140
207193
|
errPayload.cause = error.cause instanceof Error ? {
|
|
207141
207194
|
message: error.cause.message,
|
|
207142
207195
|
stack: error.cause.stack
|
|
207143
|
-
} :
|
|
207196
|
+
} : formatUnknownError2(error.cause);
|
|
207144
207197
|
}
|
|
207145
207198
|
}
|
|
207146
207199
|
trace(errPayload);
|
|
207147
207200
|
} else {
|
|
207148
|
-
trace({ error:
|
|
207201
|
+
trace({ error: formattedError });
|
|
207149
207202
|
}
|
|
207150
207203
|
if (isAbortError(error)) {
|
|
207151
207204
|
console.error("[AISDKStream] Operation aborted");
|
|
207152
207205
|
} else {
|
|
207153
|
-
const errorMessage =
|
|
207206
|
+
const errorMessage = formattedError;
|
|
207154
207207
|
console.error("[AISDKStream] Error:", errorMessage);
|
|
207155
207208
|
if (process.env.DEBUG === "true") {
|
|
207156
207209
|
if (error instanceof Error && error.stack) {
|
|
@@ -207421,7 +207474,7 @@ Documentation: https://platform.claude.com/docs/en/agent-sdk/typescript-v2-previ
|
|
|
207421
207474
|
|
|
207422
207475
|
`;
|
|
207423
207476
|
} catch (error) {
|
|
207424
|
-
const errorMessage = error
|
|
207477
|
+
const errorMessage = formatUnknownError2(error);
|
|
207425
207478
|
console.error("[ClaudeRunner] Mock agent error:", errorMessage);
|
|
207426
207479
|
yield formatDataStream({ type: "error", errorText: errorMessage });
|
|
207427
207480
|
yield formatDataStream({
|
|
@@ -264482,6 +264535,26 @@ function buildSecretAwareTools(cwd, secrets) {
|
|
|
264482
264535
|
|
|
264483
264536
|
// ../../packages/runner-pi/dist/pi-runner.js
|
|
264484
264537
|
var LOG_PREFIX2 = "[bunny-agent:pi]";
|
|
264538
|
+
function formatUnknownError3(error) {
|
|
264539
|
+
if (error == null)
|
|
264540
|
+
return String(error);
|
|
264541
|
+
if (typeof error === "string")
|
|
264542
|
+
return error;
|
|
264543
|
+
if (typeof error === "number" || typeof error === "boolean") {
|
|
264544
|
+
return String(error);
|
|
264545
|
+
}
|
|
264546
|
+
if (error instanceof Error) {
|
|
264547
|
+
return error.message || error.name || "Error";
|
|
264548
|
+
}
|
|
264549
|
+
if (typeof error === "object") {
|
|
264550
|
+
try {
|
|
264551
|
+
return JSON.stringify(error);
|
|
264552
|
+
} catch {
|
|
264553
|
+
return "Unserializable object error";
|
|
264554
|
+
}
|
|
264555
|
+
}
|
|
264556
|
+
return String(error);
|
|
264557
|
+
}
|
|
264485
264558
|
function parseModelSpec(model) {
|
|
264486
264559
|
const trimmed = model.trim();
|
|
264487
264560
|
const separator = trimmed.indexOf(":");
|
|
@@ -264721,7 +264794,7 @@ function createPiRunner(options2 = {}) {
|
|
|
264721
264794
|
await promptPromise;
|
|
264722
264795
|
} catch (error) {
|
|
264723
264796
|
if (!streamConverter.finished) {
|
|
264724
|
-
const message = error
|
|
264797
|
+
const message = formatUnknownError3(error);
|
|
264725
264798
|
for (const chunk of streamConverter.forceError(message)) {
|
|
264726
264799
|
yield chunk;
|
|
264727
264800
|
}
|
|
@@ -264729,7 +264802,8 @@ function createPiRunner(options2 = {}) {
|
|
|
264729
264802
|
return;
|
|
264730
264803
|
}
|
|
264731
264804
|
if (!streamConverter.finished && session.agent.state.error) {
|
|
264732
|
-
|
|
264805
|
+
const errorText = formatUnknownError3(session.agent.state.error);
|
|
264806
|
+
for (const chunk of streamConverter.forceError(errorText)) {
|
|
264733
264807
|
yield chunk;
|
|
264734
264808
|
}
|
|
264735
264809
|
}
|
|
@@ -264921,7 +264995,7 @@ async function bunnyAgentRun(req, res, env2) {
|
|
|
264921
264995
|
res.write(chunk);
|
|
264922
264996
|
}
|
|
264923
264997
|
} catch (err) {
|
|
264924
|
-
const msg = err instanceof Error ? err.message :
|
|
264998
|
+
const msg = err instanceof Error ? err.message : formatUnknownError(err);
|
|
264925
264999
|
res.write(`data: ${JSON.stringify({ type: "error", errorText: msg })}
|
|
264926
265000
|
|
|
264927
265001
|
`);
|
|
@@ -264981,7 +265055,7 @@ function createDaemon(config) {
|
|
|
264981
265055
|
res.end(JSON.stringify(result2));
|
|
264982
265056
|
} catch (err) {
|
|
264983
265057
|
const status2 = err instanceof AppError ? err.status : 500;
|
|
264984
|
-
const msg = err instanceof Error ? err.message :
|
|
265058
|
+
const msg = err instanceof Error ? err.message : formatUnknownError(err);
|
|
264985
265059
|
res.writeHead(status2, { "Content-Type": "application/json" });
|
|
264986
265060
|
res.end(JSON.stringify(fail(msg)));
|
|
264987
265061
|
}
|
|
@@ -265008,7 +265082,7 @@ function createDaemon(config) {
|
|
|
265008
265082
|
res.end(buffer);
|
|
265009
265083
|
} catch (err) {
|
|
265010
265084
|
const status2 = err instanceof AppError ? err.status : 500;
|
|
265011
|
-
const msg = err instanceof Error ? err.message :
|
|
265085
|
+
const msg = err instanceof Error ? err.message : formatUnknownError(err);
|
|
265012
265086
|
res.writeHead(status2, { "Content-Type": "application/json" });
|
|
265013
265087
|
res.end(JSON.stringify(fail(msg)));
|
|
265014
265088
|
}
|
|
@@ -265041,7 +265115,7 @@ function createDaemon(config) {
|
|
|
265041
265115
|
sendJson(res, err.status, fail(err.message));
|
|
265042
265116
|
} else {
|
|
265043
265117
|
console.error("Unhandled request error:", err);
|
|
265044
|
-
const msg = err instanceof Error ? err.message :
|
|
265118
|
+
const msg = err instanceof Error ? err.message : formatUnknownError(err);
|
|
265045
265119
|
sendJson(res, 500, fail(`Internal server error: ${msg}`));
|
|
265046
265120
|
}
|
|
265047
265121
|
} else {
|
package/dist/index.js
CHANGED
|
@@ -206297,6 +206297,35 @@ function ok(data) {
|
|
|
206297
206297
|
function fail(error) {
|
|
206298
206298
|
return { ok: false, data: null, error };
|
|
206299
206299
|
}
|
|
206300
|
+
function formatUnknownError(err) {
|
|
206301
|
+
const errorRecord = (e2) => ({
|
|
206302
|
+
name: e2.name,
|
|
206303
|
+
message: e2.message,
|
|
206304
|
+
...e2.cause !== void 0 ? { cause: formatUnknownError(e2.cause) } : {}
|
|
206305
|
+
});
|
|
206306
|
+
if (err == null) return String(err);
|
|
206307
|
+
if (typeof err === "string") return err;
|
|
206308
|
+
if (typeof err === "number" || typeof err === "boolean") return String(err);
|
|
206309
|
+
if (err instanceof Error) {
|
|
206310
|
+
try {
|
|
206311
|
+
return JSON.stringify(errorRecord(err));
|
|
206312
|
+
} catch {
|
|
206313
|
+
const message = err.message?.trim() ?? "";
|
|
206314
|
+
return `${err.name}: ${message || "(no message)"}`;
|
|
206315
|
+
}
|
|
206316
|
+
}
|
|
206317
|
+
if (typeof err === "object") {
|
|
206318
|
+
try {
|
|
206319
|
+
return JSON.stringify(err, (_key, value2) => {
|
|
206320
|
+
if (value2 instanceof Error) return errorRecord(value2);
|
|
206321
|
+
return value2;
|
|
206322
|
+
});
|
|
206323
|
+
} catch {
|
|
206324
|
+
return "Unserializable object error";
|
|
206325
|
+
}
|
|
206326
|
+
}
|
|
206327
|
+
return String(err);
|
|
206328
|
+
}
|
|
206300
206329
|
function resolveVolumeRoot(state, volume) {
|
|
206301
206330
|
const normalizedRoot = path.resolve(state.root);
|
|
206302
206331
|
if (!volume) return state.root;
|
|
@@ -206721,7 +206750,9 @@ var DaemonRouter = class {
|
|
|
206721
206750
|
}
|
|
206722
206751
|
return {
|
|
206723
206752
|
status: 500,
|
|
206724
|
-
body: fail(
|
|
206753
|
+
body: fail(
|
|
206754
|
+
err instanceof Error ? err.message : formatUnknownError(err)
|
|
206755
|
+
)
|
|
206725
206756
|
};
|
|
206726
206757
|
}
|
|
206727
206758
|
}
|
|
@@ -206861,6 +206892,26 @@ function loadSystemPrompt(cwd) {
|
|
|
206861
206892
|
// ../../packages/runner-claude/dist/ai-sdk-stream.js
|
|
206862
206893
|
import { appendFileSync, existsSync as existsSync3, unlinkSync } from "node:fs";
|
|
206863
206894
|
import { join as join3 } from "node:path";
|
|
206895
|
+
function formatUnknownError2(error) {
|
|
206896
|
+
if (error == null)
|
|
206897
|
+
return String(error);
|
|
206898
|
+
if (typeof error === "string")
|
|
206899
|
+
return error;
|
|
206900
|
+
if (typeof error === "number" || typeof error === "boolean") {
|
|
206901
|
+
return String(error);
|
|
206902
|
+
}
|
|
206903
|
+
if (error instanceof Error) {
|
|
206904
|
+
return error.message || error.name || "Error";
|
|
206905
|
+
}
|
|
206906
|
+
if (typeof error === "object") {
|
|
206907
|
+
try {
|
|
206908
|
+
return JSON.stringify(error);
|
|
206909
|
+
} catch {
|
|
206910
|
+
return "Unserializable object error";
|
|
206911
|
+
}
|
|
206912
|
+
}
|
|
206913
|
+
return String(error);
|
|
206914
|
+
}
|
|
206864
206915
|
function trace(data, reset = false) {
|
|
206865
206916
|
if (process.env.DEBUG !== "true")
|
|
206866
206917
|
return;
|
|
@@ -207108,7 +207159,8 @@ var AISDKStreamConverter = class {
|
|
|
207108
207159
|
const resultMsg = message;
|
|
207109
207160
|
if (resultMsg.is_error) {
|
|
207110
207161
|
this.errorEmitted = true;
|
|
207111
|
-
const
|
|
207162
|
+
const rawResult = resultMsg.result;
|
|
207163
|
+
const errorText = formatUnknownError2(rawResult) || "Unknown error";
|
|
207112
207164
|
yield this.emit({
|
|
207113
207165
|
type: "error",
|
|
207114
207166
|
errorText
|
|
@@ -207125,9 +207177,10 @@ var AISDKStreamConverter = class {
|
|
|
207125
207177
|
}
|
|
207126
207178
|
}
|
|
207127
207179
|
} catch (error) {
|
|
207180
|
+
const formattedError = formatUnknownError2(error);
|
|
207128
207181
|
if (process.env.DEBUG === "true") {
|
|
207129
207182
|
const errPayload = {
|
|
207130
|
-
error:
|
|
207183
|
+
error: formattedError
|
|
207131
207184
|
};
|
|
207132
207185
|
if (error instanceof Error) {
|
|
207133
207186
|
if (error.stack)
|
|
@@ -207136,17 +207189,17 @@ var AISDKStreamConverter = class {
|
|
|
207136
207189
|
errPayload.cause = error.cause instanceof Error ? {
|
|
207137
207190
|
message: error.cause.message,
|
|
207138
207191
|
stack: error.cause.stack
|
|
207139
|
-
} :
|
|
207192
|
+
} : formatUnknownError2(error.cause);
|
|
207140
207193
|
}
|
|
207141
207194
|
}
|
|
207142
207195
|
trace(errPayload);
|
|
207143
207196
|
} else {
|
|
207144
|
-
trace({ error:
|
|
207197
|
+
trace({ error: formattedError });
|
|
207145
207198
|
}
|
|
207146
207199
|
if (isAbortError(error)) {
|
|
207147
207200
|
console.error("[AISDKStream] Operation aborted");
|
|
207148
207201
|
} else {
|
|
207149
|
-
const errorMessage =
|
|
207202
|
+
const errorMessage = formattedError;
|
|
207150
207203
|
console.error("[AISDKStream] Error:", errorMessage);
|
|
207151
207204
|
if (process.env.DEBUG === "true") {
|
|
207152
207205
|
if (error instanceof Error && error.stack) {
|
|
@@ -207417,7 +207470,7 @@ Documentation: https://platform.claude.com/docs/en/agent-sdk/typescript-v2-previ
|
|
|
207417
207470
|
|
|
207418
207471
|
`;
|
|
207419
207472
|
} catch (error) {
|
|
207420
|
-
const errorMessage = error
|
|
207473
|
+
const errorMessage = formatUnknownError2(error);
|
|
207421
207474
|
console.error("[ClaudeRunner] Mock agent error:", errorMessage);
|
|
207422
207475
|
yield formatDataStream({ type: "error", errorText: errorMessage });
|
|
207423
207476
|
yield formatDataStream({
|
|
@@ -264478,6 +264531,26 @@ function buildSecretAwareTools(cwd, secrets) {
|
|
|
264478
264531
|
|
|
264479
264532
|
// ../../packages/runner-pi/dist/pi-runner.js
|
|
264480
264533
|
var LOG_PREFIX2 = "[bunny-agent:pi]";
|
|
264534
|
+
function formatUnknownError3(error) {
|
|
264535
|
+
if (error == null)
|
|
264536
|
+
return String(error);
|
|
264537
|
+
if (typeof error === "string")
|
|
264538
|
+
return error;
|
|
264539
|
+
if (typeof error === "number" || typeof error === "boolean") {
|
|
264540
|
+
return String(error);
|
|
264541
|
+
}
|
|
264542
|
+
if (error instanceof Error) {
|
|
264543
|
+
return error.message || error.name || "Error";
|
|
264544
|
+
}
|
|
264545
|
+
if (typeof error === "object") {
|
|
264546
|
+
try {
|
|
264547
|
+
return JSON.stringify(error);
|
|
264548
|
+
} catch {
|
|
264549
|
+
return "Unserializable object error";
|
|
264550
|
+
}
|
|
264551
|
+
}
|
|
264552
|
+
return String(error);
|
|
264553
|
+
}
|
|
264481
264554
|
function parseModelSpec(model) {
|
|
264482
264555
|
const trimmed = model.trim();
|
|
264483
264556
|
const separator = trimmed.indexOf(":");
|
|
@@ -264717,7 +264790,7 @@ function createPiRunner(options2 = {}) {
|
|
|
264717
264790
|
await promptPromise;
|
|
264718
264791
|
} catch (error) {
|
|
264719
264792
|
if (!streamConverter.finished) {
|
|
264720
|
-
const message = error
|
|
264793
|
+
const message = formatUnknownError3(error);
|
|
264721
264794
|
for (const chunk of streamConverter.forceError(message)) {
|
|
264722
264795
|
yield chunk;
|
|
264723
264796
|
}
|
|
@@ -264725,7 +264798,8 @@ function createPiRunner(options2 = {}) {
|
|
|
264725
264798
|
return;
|
|
264726
264799
|
}
|
|
264727
264800
|
if (!streamConverter.finished && session.agent.state.error) {
|
|
264728
|
-
|
|
264801
|
+
const errorText = formatUnknownError3(session.agent.state.error);
|
|
264802
|
+
for (const chunk of streamConverter.forceError(errorText)) {
|
|
264729
264803
|
yield chunk;
|
|
264730
264804
|
}
|
|
264731
264805
|
}
|
|
@@ -264917,7 +264991,7 @@ async function bunnyAgentRun(req, res, env2) {
|
|
|
264917
264991
|
res.write(chunk);
|
|
264918
264992
|
}
|
|
264919
264993
|
} catch (err) {
|
|
264920
|
-
const msg = err instanceof Error ? err.message :
|
|
264994
|
+
const msg = err instanceof Error ? err.message : formatUnknownError(err);
|
|
264921
264995
|
res.write(`data: ${JSON.stringify({ type: "error", errorText: msg })}
|
|
264922
264996
|
|
|
264923
264997
|
`);
|
|
@@ -264977,7 +265051,7 @@ function createDaemon(config) {
|
|
|
264977
265051
|
res.end(JSON.stringify(result2));
|
|
264978
265052
|
} catch (err) {
|
|
264979
265053
|
const status2 = err instanceof AppError ? err.status : 500;
|
|
264980
|
-
const msg = err instanceof Error ? err.message :
|
|
265054
|
+
const msg = err instanceof Error ? err.message : formatUnknownError(err);
|
|
264981
265055
|
res.writeHead(status2, { "Content-Type": "application/json" });
|
|
264982
265056
|
res.end(JSON.stringify(fail(msg)));
|
|
264983
265057
|
}
|
|
@@ -265004,7 +265078,7 @@ function createDaemon(config) {
|
|
|
265004
265078
|
res.end(buffer);
|
|
265005
265079
|
} catch (err) {
|
|
265006
265080
|
const status2 = err instanceof AppError ? err.status : 500;
|
|
265007
|
-
const msg = err instanceof Error ? err.message :
|
|
265081
|
+
const msg = err instanceof Error ? err.message : formatUnknownError(err);
|
|
265008
265082
|
res.writeHead(status2, { "Content-Type": "application/json" });
|
|
265009
265083
|
res.end(JSON.stringify(fail(msg)));
|
|
265010
265084
|
}
|
|
@@ -265037,7 +265111,7 @@ function createDaemon(config) {
|
|
|
265037
265111
|
sendJson(res, err.status, fail(err.message));
|
|
265038
265112
|
} else {
|
|
265039
265113
|
console.error("Unhandled request error:", err);
|
|
265040
|
-
const msg = err instanceof Error ? err.message :
|
|
265114
|
+
const msg = err instanceof Error ? err.message : formatUnknownError(err);
|
|
265041
265115
|
sendJson(res, 500, fail(`Internal server error: ${msg}`));
|
|
265042
265116
|
}
|
|
265043
265117
|
} 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;AAeH,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,CAkF/C"}
|
package/dist/nextjs.js
CHANGED
|
@@ -206355,6 +206355,35 @@ function ok(data) {
|
|
|
206355
206355
|
function fail(error) {
|
|
206356
206356
|
return { ok: false, data: null, error };
|
|
206357
206357
|
}
|
|
206358
|
+
function formatUnknownError(err) {
|
|
206359
|
+
const errorRecord = (e2) => ({
|
|
206360
|
+
name: e2.name,
|
|
206361
|
+
message: e2.message,
|
|
206362
|
+
...e2.cause !== void 0 ? { cause: formatUnknownError(e2.cause) } : {}
|
|
206363
|
+
});
|
|
206364
|
+
if (err == null) return String(err);
|
|
206365
|
+
if (typeof err === "string") return err;
|
|
206366
|
+
if (typeof err === "number" || typeof err === "boolean") return String(err);
|
|
206367
|
+
if (err instanceof Error) {
|
|
206368
|
+
try {
|
|
206369
|
+
return JSON.stringify(errorRecord(err));
|
|
206370
|
+
} catch {
|
|
206371
|
+
const message = err.message?.trim() ?? "";
|
|
206372
|
+
return `${err.name}: ${message || "(no message)"}`;
|
|
206373
|
+
}
|
|
206374
|
+
}
|
|
206375
|
+
if (typeof err === "object") {
|
|
206376
|
+
try {
|
|
206377
|
+
return JSON.stringify(err, (_key, value2) => {
|
|
206378
|
+
if (value2 instanceof Error) return errorRecord(value2);
|
|
206379
|
+
return value2;
|
|
206380
|
+
});
|
|
206381
|
+
} catch {
|
|
206382
|
+
return "Unserializable object error";
|
|
206383
|
+
}
|
|
206384
|
+
}
|
|
206385
|
+
return String(err);
|
|
206386
|
+
}
|
|
206358
206387
|
function resolveVolumeRoot(state, volume) {
|
|
206359
206388
|
const normalizedRoot = path.resolve(state.root);
|
|
206360
206389
|
if (!volume) return state.root;
|
|
@@ -206779,7 +206808,9 @@ var DaemonRouter = class {
|
|
|
206779
206808
|
}
|
|
206780
206809
|
return {
|
|
206781
206810
|
status: 500,
|
|
206782
|
-
body: fail(
|
|
206811
|
+
body: fail(
|
|
206812
|
+
err instanceof Error ? err.message : formatUnknownError(err)
|
|
206813
|
+
)
|
|
206783
206814
|
};
|
|
206784
206815
|
}
|
|
206785
206816
|
}
|
|
@@ -206857,6 +206888,26 @@ function loadSystemPrompt(cwd) {
|
|
|
206857
206888
|
// ../../packages/runner-claude/dist/ai-sdk-stream.js
|
|
206858
206889
|
import { appendFileSync, existsSync as existsSync3, unlinkSync } from "node:fs";
|
|
206859
206890
|
import { join as join3 } from "node:path";
|
|
206891
|
+
function formatUnknownError2(error) {
|
|
206892
|
+
if (error == null)
|
|
206893
|
+
return String(error);
|
|
206894
|
+
if (typeof error === "string")
|
|
206895
|
+
return error;
|
|
206896
|
+
if (typeof error === "number" || typeof error === "boolean") {
|
|
206897
|
+
return String(error);
|
|
206898
|
+
}
|
|
206899
|
+
if (error instanceof Error) {
|
|
206900
|
+
return error.message || error.name || "Error";
|
|
206901
|
+
}
|
|
206902
|
+
if (typeof error === "object") {
|
|
206903
|
+
try {
|
|
206904
|
+
return JSON.stringify(error);
|
|
206905
|
+
} catch {
|
|
206906
|
+
return "Unserializable object error";
|
|
206907
|
+
}
|
|
206908
|
+
}
|
|
206909
|
+
return String(error);
|
|
206910
|
+
}
|
|
206860
206911
|
function trace(data, reset = false) {
|
|
206861
206912
|
if (process.env.DEBUG !== "true")
|
|
206862
206913
|
return;
|
|
@@ -207104,7 +207155,8 @@ var AISDKStreamConverter = class {
|
|
|
207104
207155
|
const resultMsg = message;
|
|
207105
207156
|
if (resultMsg.is_error) {
|
|
207106
207157
|
this.errorEmitted = true;
|
|
207107
|
-
const
|
|
207158
|
+
const rawResult = resultMsg.result;
|
|
207159
|
+
const errorText = formatUnknownError2(rawResult) || "Unknown error";
|
|
207108
207160
|
yield this.emit({
|
|
207109
207161
|
type: "error",
|
|
207110
207162
|
errorText
|
|
@@ -207121,9 +207173,10 @@ var AISDKStreamConverter = class {
|
|
|
207121
207173
|
}
|
|
207122
207174
|
}
|
|
207123
207175
|
} catch (error) {
|
|
207176
|
+
const formattedError = formatUnknownError2(error);
|
|
207124
207177
|
if (process.env.DEBUG === "true") {
|
|
207125
207178
|
const errPayload = {
|
|
207126
|
-
error:
|
|
207179
|
+
error: formattedError
|
|
207127
207180
|
};
|
|
207128
207181
|
if (error instanceof Error) {
|
|
207129
207182
|
if (error.stack)
|
|
@@ -207132,17 +207185,17 @@ var AISDKStreamConverter = class {
|
|
|
207132
207185
|
errPayload.cause = error.cause instanceof Error ? {
|
|
207133
207186
|
message: error.cause.message,
|
|
207134
207187
|
stack: error.cause.stack
|
|
207135
|
-
} :
|
|
207188
|
+
} : formatUnknownError2(error.cause);
|
|
207136
207189
|
}
|
|
207137
207190
|
}
|
|
207138
207191
|
trace(errPayload);
|
|
207139
207192
|
} else {
|
|
207140
|
-
trace({ error:
|
|
207193
|
+
trace({ error: formattedError });
|
|
207141
207194
|
}
|
|
207142
207195
|
if (isAbortError(error)) {
|
|
207143
207196
|
console.error("[AISDKStream] Operation aborted");
|
|
207144
207197
|
} else {
|
|
207145
|
-
const errorMessage =
|
|
207198
|
+
const errorMessage = formattedError;
|
|
207146
207199
|
console.error("[AISDKStream] Error:", errorMessage);
|
|
207147
207200
|
if (process.env.DEBUG === "true") {
|
|
207148
207201
|
if (error instanceof Error && error.stack) {
|
|
@@ -207413,7 +207466,7 @@ Documentation: https://platform.claude.com/docs/en/agent-sdk/typescript-v2-previ
|
|
|
207413
207466
|
|
|
207414
207467
|
`;
|
|
207415
207468
|
} catch (error) {
|
|
207416
|
-
const errorMessage = error
|
|
207469
|
+
const errorMessage = formatUnknownError2(error);
|
|
207417
207470
|
console.error("[ClaudeRunner] Mock agent error:", errorMessage);
|
|
207418
207471
|
yield formatDataStream({ type: "error", errorText: errorMessage });
|
|
207419
207472
|
yield formatDataStream({
|
|
@@ -264474,6 +264527,26 @@ function buildSecretAwareTools(cwd, secrets) {
|
|
|
264474
264527
|
|
|
264475
264528
|
// ../../packages/runner-pi/dist/pi-runner.js
|
|
264476
264529
|
var LOG_PREFIX2 = "[bunny-agent:pi]";
|
|
264530
|
+
function formatUnknownError3(error) {
|
|
264531
|
+
if (error == null)
|
|
264532
|
+
return String(error);
|
|
264533
|
+
if (typeof error === "string")
|
|
264534
|
+
return error;
|
|
264535
|
+
if (typeof error === "number" || typeof error === "boolean") {
|
|
264536
|
+
return String(error);
|
|
264537
|
+
}
|
|
264538
|
+
if (error instanceof Error) {
|
|
264539
|
+
return error.message || error.name || "Error";
|
|
264540
|
+
}
|
|
264541
|
+
if (typeof error === "object") {
|
|
264542
|
+
try {
|
|
264543
|
+
return JSON.stringify(error);
|
|
264544
|
+
} catch {
|
|
264545
|
+
return "Unserializable object error";
|
|
264546
|
+
}
|
|
264547
|
+
}
|
|
264548
|
+
return String(error);
|
|
264549
|
+
}
|
|
264477
264550
|
function parseModelSpec(model) {
|
|
264478
264551
|
const trimmed = model.trim();
|
|
264479
264552
|
const separator = trimmed.indexOf(":");
|
|
@@ -264713,7 +264786,7 @@ function createPiRunner(options2 = {}) {
|
|
|
264713
264786
|
await promptPromise;
|
|
264714
264787
|
} catch (error) {
|
|
264715
264788
|
if (!streamConverter.finished) {
|
|
264716
|
-
const message = error
|
|
264789
|
+
const message = formatUnknownError3(error);
|
|
264717
264790
|
for (const chunk of streamConverter.forceError(message)) {
|
|
264718
264791
|
yield chunk;
|
|
264719
264792
|
}
|
|
@@ -264721,7 +264794,8 @@ function createPiRunner(options2 = {}) {
|
|
|
264721
264794
|
return;
|
|
264722
264795
|
}
|
|
264723
264796
|
if (!streamConverter.finished && session.agent.state.error) {
|
|
264724
|
-
|
|
264797
|
+
const errorText = formatUnknownError3(session.agent.state.error);
|
|
264798
|
+
for (const chunk of streamConverter.forceError(errorText)) {
|
|
264725
264799
|
yield chunk;
|
|
264726
264800
|
}
|
|
264727
264801
|
}
|
|
@@ -264910,7 +264984,7 @@ function codingRunStream(req, env2) {
|
|
|
264910
264984
|
controller.enqueue(encoder.encode(chunk));
|
|
264911
264985
|
}
|
|
264912
264986
|
} catch (err) {
|
|
264913
|
-
const msg = err instanceof Error ? err.message :
|
|
264987
|
+
const msg = err instanceof Error ? err.message : formatUnknownError(err);
|
|
264914
264988
|
controller.enqueue(
|
|
264915
264989
|
encoder.encode(
|
|
264916
264990
|
`data: ${JSON.stringify({ type: "error", errorText: msg })}
|
|
@@ -264972,7 +265046,7 @@ function createNextHandler(opts) {
|
|
|
264972
265046
|
return Response.json(result2);
|
|
264973
265047
|
} catch (err) {
|
|
264974
265048
|
const status = err instanceof AppError ? err.status : 500;
|
|
264975
|
-
const msg = err instanceof Error ? err.message :
|
|
265049
|
+
const msg = err instanceof Error ? err.message : formatUnknownError(err);
|
|
264976
265050
|
return Response.json(fail(msg), { status });
|
|
264977
265051
|
}
|
|
264978
265052
|
}
|
|
@@ -264999,7 +265073,7 @@ function createNextHandler(opts) {
|
|
|
264999
265073
|
});
|
|
265000
265074
|
} catch (err) {
|
|
265001
265075
|
const status = err instanceof AppError ? err.status : 500;
|
|
265002
|
-
const msg = err instanceof Error ? err.message :
|
|
265076
|
+
const msg = err instanceof Error ? err.message : formatUnknownError(err);
|
|
265003
265077
|
return Response.json(fail(msg), { status });
|
|
265004
265078
|
}
|
|
265005
265079
|
}
|
package/dist/router.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAY,MAAM,YAAY,CAAC;AAMxD,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,MAAM,CAAmC;gBAErC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;IA2B5B,MAAM,CACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,WAAW,CAAA;KAAE,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAY,MAAM,YAAY,CAAC;AAMxD,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,MAAM,CAAmC;gBAErC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;IA2B5B,MAAM,CACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,WAAW,CAAA;KAAE,GAAG,IAAI,CAAC;CAuBzD"}
|
|
@@ -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;AAIvC,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,CA8DV"}
|
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;AAelC,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,CAiI9D"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ 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;
|
|
8
13
|
export interface AppState {
|
|
9
14
|
root: string;
|
|
10
15
|
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,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"}
|
|
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;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CA6BvD;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"}
|