@bunny-agent/daemon 0.9.29-beta.12 → 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 -87
- package/dist/index.js +13 -87
- package/dist/nextjs.d.ts.map +1 -1
- package/dist/nextjs.js +12 -86
- 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 +0 -5
- package/dist/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/bundle.mjs
CHANGED
|
@@ -206363,35 +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 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
|
-
}
|
|
206395
206366
|
function resolveVolumeRoot(state, volume) {
|
|
206396
206367
|
const normalizedRoot = path.resolve(state.root);
|
|
206397
206368
|
if (!volume) return state.root;
|
|
@@ -206816,9 +206787,7 @@ var DaemonRouter = class {
|
|
|
206816
206787
|
}
|
|
206817
206788
|
return {
|
|
206818
206789
|
status: 500,
|
|
206819
|
-
body: fail(
|
|
206820
|
-
err instanceof Error ? err.message : formatUnknownError(err)
|
|
206821
|
-
)
|
|
206790
|
+
body: fail(err instanceof Error ? err.message : String(err))
|
|
206822
206791
|
};
|
|
206823
206792
|
}
|
|
206824
206793
|
}
|
|
@@ -206896,26 +206865,6 @@ function loadSystemPrompt(cwd) {
|
|
|
206896
206865
|
// ../../packages/runner-claude/dist/ai-sdk-stream.js
|
|
206897
206866
|
import { appendFileSync, existsSync as existsSync3, unlinkSync } from "node:fs";
|
|
206898
206867
|
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
|
-
}
|
|
206919
206868
|
function trace(data, reset = false) {
|
|
206920
206869
|
if (process.env.DEBUG !== "true")
|
|
206921
206870
|
return;
|
|
@@ -207163,8 +207112,7 @@ var AISDKStreamConverter = class {
|
|
|
207163
207112
|
const resultMsg = message;
|
|
207164
207113
|
if (resultMsg.is_error) {
|
|
207165
207114
|
this.errorEmitted = true;
|
|
207166
|
-
const
|
|
207167
|
-
const errorText = formatUnknownError2(rawResult) || "Unknown error";
|
|
207115
|
+
const errorText = resultMsg.result || "Unknown error";
|
|
207168
207116
|
yield this.emit({
|
|
207169
207117
|
type: "error",
|
|
207170
207118
|
errorText
|
|
@@ -207181,10 +207129,9 @@ var AISDKStreamConverter = class {
|
|
|
207181
207129
|
}
|
|
207182
207130
|
}
|
|
207183
207131
|
} catch (error) {
|
|
207184
|
-
const formattedError = formatUnknownError2(error);
|
|
207185
207132
|
if (process.env.DEBUG === "true") {
|
|
207186
207133
|
const errPayload = {
|
|
207187
|
-
error:
|
|
207134
|
+
error: error instanceof Error ? error.message : String(error)
|
|
207188
207135
|
};
|
|
207189
207136
|
if (error instanceof Error) {
|
|
207190
207137
|
if (error.stack)
|
|
@@ -207193,17 +207140,17 @@ var AISDKStreamConverter = class {
|
|
|
207193
207140
|
errPayload.cause = error.cause instanceof Error ? {
|
|
207194
207141
|
message: error.cause.message,
|
|
207195
207142
|
stack: error.cause.stack
|
|
207196
|
-
} :
|
|
207143
|
+
} : String(error.cause);
|
|
207197
207144
|
}
|
|
207198
207145
|
}
|
|
207199
207146
|
trace(errPayload);
|
|
207200
207147
|
} else {
|
|
207201
|
-
trace({ error:
|
|
207148
|
+
trace({ error: String(error) });
|
|
207202
207149
|
}
|
|
207203
207150
|
if (isAbortError(error)) {
|
|
207204
207151
|
console.error("[AISDKStream] Operation aborted");
|
|
207205
207152
|
} else {
|
|
207206
|
-
const errorMessage =
|
|
207153
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
207207
207154
|
console.error("[AISDKStream] Error:", errorMessage);
|
|
207208
207155
|
if (process.env.DEBUG === "true") {
|
|
207209
207156
|
if (error instanceof Error && error.stack) {
|
|
@@ -207474,7 +207421,7 @@ Documentation: https://platform.claude.com/docs/en/agent-sdk/typescript-v2-previ
|
|
|
207474
207421
|
|
|
207475
207422
|
`;
|
|
207476
207423
|
} catch (error) {
|
|
207477
|
-
const errorMessage =
|
|
207424
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
207478
207425
|
console.error("[ClaudeRunner] Mock agent error:", errorMessage);
|
|
207479
207426
|
yield formatDataStream({ type: "error", errorText: errorMessage });
|
|
207480
207427
|
yield formatDataStream({
|
|
@@ -264535,26 +264482,6 @@ function buildSecretAwareTools(cwd, secrets) {
|
|
|
264535
264482
|
|
|
264536
264483
|
// ../../packages/runner-pi/dist/pi-runner.js
|
|
264537
264484
|
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
|
-
}
|
|
264558
264485
|
function parseModelSpec(model) {
|
|
264559
264486
|
const trimmed = model.trim();
|
|
264560
264487
|
const separator = trimmed.indexOf(":");
|
|
@@ -264794,7 +264721,7 @@ function createPiRunner(options2 = {}) {
|
|
|
264794
264721
|
await promptPromise;
|
|
264795
264722
|
} catch (error) {
|
|
264796
264723
|
if (!streamConverter.finished) {
|
|
264797
|
-
const message =
|
|
264724
|
+
const message = error instanceof Error ? error.message : "Pi agent run failed.";
|
|
264798
264725
|
for (const chunk of streamConverter.forceError(message)) {
|
|
264799
264726
|
yield chunk;
|
|
264800
264727
|
}
|
|
@@ -264802,8 +264729,7 @@ function createPiRunner(options2 = {}) {
|
|
|
264802
264729
|
return;
|
|
264803
264730
|
}
|
|
264804
264731
|
if (!streamConverter.finished && session.agent.state.error) {
|
|
264805
|
-
const
|
|
264806
|
-
for (const chunk of streamConverter.forceError(errorText)) {
|
|
264732
|
+
for (const chunk of streamConverter.forceError(session.agent.state.error)) {
|
|
264807
264733
|
yield chunk;
|
|
264808
264734
|
}
|
|
264809
264735
|
}
|
|
@@ -264995,7 +264921,7 @@ async function bunnyAgentRun(req, res, env2) {
|
|
|
264995
264921
|
res.write(chunk);
|
|
264996
264922
|
}
|
|
264997
264923
|
} catch (err) {
|
|
264998
|
-
const msg = err instanceof Error ? err.message :
|
|
264924
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
264999
264925
|
res.write(`data: ${JSON.stringify({ type: "error", errorText: msg })}
|
|
265000
264926
|
|
|
265001
264927
|
`);
|
|
@@ -265055,7 +264981,7 @@ function createDaemon(config) {
|
|
|
265055
264981
|
res.end(JSON.stringify(result2));
|
|
265056
264982
|
} catch (err) {
|
|
265057
264983
|
const status2 = err instanceof AppError ? err.status : 500;
|
|
265058
|
-
const msg = err instanceof Error ? err.message :
|
|
264984
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265059
264985
|
res.writeHead(status2, { "Content-Type": "application/json" });
|
|
265060
264986
|
res.end(JSON.stringify(fail(msg)));
|
|
265061
264987
|
}
|
|
@@ -265082,7 +265008,7 @@ function createDaemon(config) {
|
|
|
265082
265008
|
res.end(buffer);
|
|
265083
265009
|
} catch (err) {
|
|
265084
265010
|
const status2 = err instanceof AppError ? err.status : 500;
|
|
265085
|
-
const msg = err instanceof Error ? err.message :
|
|
265011
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265086
265012
|
res.writeHead(status2, { "Content-Type": "application/json" });
|
|
265087
265013
|
res.end(JSON.stringify(fail(msg)));
|
|
265088
265014
|
}
|
|
@@ -265115,7 +265041,7 @@ function createDaemon(config) {
|
|
|
265115
265041
|
sendJson(res, err.status, fail(err.message));
|
|
265116
265042
|
} else {
|
|
265117
265043
|
console.error("Unhandled request error:", err);
|
|
265118
|
-
const msg = err instanceof Error ? err.message :
|
|
265044
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265119
265045
|
sendJson(res, 500, fail(`Internal server error: ${msg}`));
|
|
265120
265046
|
}
|
|
265121
265047
|
} else {
|
package/dist/index.js
CHANGED
|
@@ -206297,35 +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 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
|
-
}
|
|
206329
206300
|
function resolveVolumeRoot(state, volume) {
|
|
206330
206301
|
const normalizedRoot = path.resolve(state.root);
|
|
206331
206302
|
if (!volume) return state.root;
|
|
@@ -206750,9 +206721,7 @@ var DaemonRouter = class {
|
|
|
206750
206721
|
}
|
|
206751
206722
|
return {
|
|
206752
206723
|
status: 500,
|
|
206753
|
-
body: fail(
|
|
206754
|
-
err instanceof Error ? err.message : formatUnknownError(err)
|
|
206755
|
-
)
|
|
206724
|
+
body: fail(err instanceof Error ? err.message : String(err))
|
|
206756
206725
|
};
|
|
206757
206726
|
}
|
|
206758
206727
|
}
|
|
@@ -206892,26 +206861,6 @@ function loadSystemPrompt(cwd) {
|
|
|
206892
206861
|
// ../../packages/runner-claude/dist/ai-sdk-stream.js
|
|
206893
206862
|
import { appendFileSync, existsSync as existsSync3, unlinkSync } from "node:fs";
|
|
206894
206863
|
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
|
-
}
|
|
206915
206864
|
function trace(data, reset = false) {
|
|
206916
206865
|
if (process.env.DEBUG !== "true")
|
|
206917
206866
|
return;
|
|
@@ -207159,8 +207108,7 @@ var AISDKStreamConverter = class {
|
|
|
207159
207108
|
const resultMsg = message;
|
|
207160
207109
|
if (resultMsg.is_error) {
|
|
207161
207110
|
this.errorEmitted = true;
|
|
207162
|
-
const
|
|
207163
|
-
const errorText = formatUnknownError2(rawResult) || "Unknown error";
|
|
207111
|
+
const errorText = resultMsg.result || "Unknown error";
|
|
207164
207112
|
yield this.emit({
|
|
207165
207113
|
type: "error",
|
|
207166
207114
|
errorText
|
|
@@ -207177,10 +207125,9 @@ var AISDKStreamConverter = class {
|
|
|
207177
207125
|
}
|
|
207178
207126
|
}
|
|
207179
207127
|
} catch (error) {
|
|
207180
|
-
const formattedError = formatUnknownError2(error);
|
|
207181
207128
|
if (process.env.DEBUG === "true") {
|
|
207182
207129
|
const errPayload = {
|
|
207183
|
-
error:
|
|
207130
|
+
error: error instanceof Error ? error.message : String(error)
|
|
207184
207131
|
};
|
|
207185
207132
|
if (error instanceof Error) {
|
|
207186
207133
|
if (error.stack)
|
|
@@ -207189,17 +207136,17 @@ var AISDKStreamConverter = class {
|
|
|
207189
207136
|
errPayload.cause = error.cause instanceof Error ? {
|
|
207190
207137
|
message: error.cause.message,
|
|
207191
207138
|
stack: error.cause.stack
|
|
207192
|
-
} :
|
|
207139
|
+
} : String(error.cause);
|
|
207193
207140
|
}
|
|
207194
207141
|
}
|
|
207195
207142
|
trace(errPayload);
|
|
207196
207143
|
} else {
|
|
207197
|
-
trace({ error:
|
|
207144
|
+
trace({ error: String(error) });
|
|
207198
207145
|
}
|
|
207199
207146
|
if (isAbortError(error)) {
|
|
207200
207147
|
console.error("[AISDKStream] Operation aborted");
|
|
207201
207148
|
} else {
|
|
207202
|
-
const errorMessage =
|
|
207149
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
207203
207150
|
console.error("[AISDKStream] Error:", errorMessage);
|
|
207204
207151
|
if (process.env.DEBUG === "true") {
|
|
207205
207152
|
if (error instanceof Error && error.stack) {
|
|
@@ -207470,7 +207417,7 @@ Documentation: https://platform.claude.com/docs/en/agent-sdk/typescript-v2-previ
|
|
|
207470
207417
|
|
|
207471
207418
|
`;
|
|
207472
207419
|
} catch (error) {
|
|
207473
|
-
const errorMessage =
|
|
207420
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
207474
207421
|
console.error("[ClaudeRunner] Mock agent error:", errorMessage);
|
|
207475
207422
|
yield formatDataStream({ type: "error", errorText: errorMessage });
|
|
207476
207423
|
yield formatDataStream({
|
|
@@ -264531,26 +264478,6 @@ function buildSecretAwareTools(cwd, secrets) {
|
|
|
264531
264478
|
|
|
264532
264479
|
// ../../packages/runner-pi/dist/pi-runner.js
|
|
264533
264480
|
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
|
-
}
|
|
264554
264481
|
function parseModelSpec(model) {
|
|
264555
264482
|
const trimmed = model.trim();
|
|
264556
264483
|
const separator = trimmed.indexOf(":");
|
|
@@ -264790,7 +264717,7 @@ function createPiRunner(options2 = {}) {
|
|
|
264790
264717
|
await promptPromise;
|
|
264791
264718
|
} catch (error) {
|
|
264792
264719
|
if (!streamConverter.finished) {
|
|
264793
|
-
const message =
|
|
264720
|
+
const message = error instanceof Error ? error.message : "Pi agent run failed.";
|
|
264794
264721
|
for (const chunk of streamConverter.forceError(message)) {
|
|
264795
264722
|
yield chunk;
|
|
264796
264723
|
}
|
|
@@ -264798,8 +264725,7 @@ function createPiRunner(options2 = {}) {
|
|
|
264798
264725
|
return;
|
|
264799
264726
|
}
|
|
264800
264727
|
if (!streamConverter.finished && session.agent.state.error) {
|
|
264801
|
-
const
|
|
264802
|
-
for (const chunk of streamConverter.forceError(errorText)) {
|
|
264728
|
+
for (const chunk of streamConverter.forceError(session.agent.state.error)) {
|
|
264803
264729
|
yield chunk;
|
|
264804
264730
|
}
|
|
264805
264731
|
}
|
|
@@ -264991,7 +264917,7 @@ async function bunnyAgentRun(req, res, env2) {
|
|
|
264991
264917
|
res.write(chunk);
|
|
264992
264918
|
}
|
|
264993
264919
|
} catch (err) {
|
|
264994
|
-
const msg = err instanceof Error ? err.message :
|
|
264920
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
264995
264921
|
res.write(`data: ${JSON.stringify({ type: "error", errorText: msg })}
|
|
264996
264922
|
|
|
264997
264923
|
`);
|
|
@@ -265051,7 +264977,7 @@ function createDaemon(config) {
|
|
|
265051
264977
|
res.end(JSON.stringify(result2));
|
|
265052
264978
|
} catch (err) {
|
|
265053
264979
|
const status2 = err instanceof AppError ? err.status : 500;
|
|
265054
|
-
const msg = err instanceof Error ? err.message :
|
|
264980
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265055
264981
|
res.writeHead(status2, { "Content-Type": "application/json" });
|
|
265056
264982
|
res.end(JSON.stringify(fail(msg)));
|
|
265057
264983
|
}
|
|
@@ -265078,7 +265004,7 @@ function createDaemon(config) {
|
|
|
265078
265004
|
res.end(buffer);
|
|
265079
265005
|
} catch (err) {
|
|
265080
265006
|
const status2 = err instanceof AppError ? err.status : 500;
|
|
265081
|
-
const msg = err instanceof Error ? err.message :
|
|
265007
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265082
265008
|
res.writeHead(status2, { "Content-Type": "application/json" });
|
|
265083
265009
|
res.end(JSON.stringify(fail(msg)));
|
|
265084
265010
|
}
|
|
@@ -265111,7 +265037,7 @@ function createDaemon(config) {
|
|
|
265111
265037
|
sendJson(res, err.status, fail(err.message));
|
|
265112
265038
|
} else {
|
|
265113
265039
|
console.error("Unhandled request error:", err);
|
|
265114
|
-
const msg = err instanceof Error ? err.message :
|
|
265040
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265115
265041
|
sendJson(res, 500, fail(`Internal server error: ${msg}`));
|
|
265116
265042
|
}
|
|
265117
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,35 +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 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
|
-
}
|
|
206387
206358
|
function resolveVolumeRoot(state, volume) {
|
|
206388
206359
|
const normalizedRoot = path.resolve(state.root);
|
|
206389
206360
|
if (!volume) return state.root;
|
|
@@ -206808,9 +206779,7 @@ var DaemonRouter = class {
|
|
|
206808
206779
|
}
|
|
206809
206780
|
return {
|
|
206810
206781
|
status: 500,
|
|
206811
|
-
body: fail(
|
|
206812
|
-
err instanceof Error ? err.message : formatUnknownError(err)
|
|
206813
|
-
)
|
|
206782
|
+
body: fail(err instanceof Error ? err.message : String(err))
|
|
206814
206783
|
};
|
|
206815
206784
|
}
|
|
206816
206785
|
}
|
|
@@ -206888,26 +206857,6 @@ function loadSystemPrompt(cwd) {
|
|
|
206888
206857
|
// ../../packages/runner-claude/dist/ai-sdk-stream.js
|
|
206889
206858
|
import { appendFileSync, existsSync as existsSync3, unlinkSync } from "node:fs";
|
|
206890
206859
|
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
|
-
}
|
|
206911
206860
|
function trace(data, reset = false) {
|
|
206912
206861
|
if (process.env.DEBUG !== "true")
|
|
206913
206862
|
return;
|
|
@@ -207155,8 +207104,7 @@ var AISDKStreamConverter = class {
|
|
|
207155
207104
|
const resultMsg = message;
|
|
207156
207105
|
if (resultMsg.is_error) {
|
|
207157
207106
|
this.errorEmitted = true;
|
|
207158
|
-
const
|
|
207159
|
-
const errorText = formatUnknownError2(rawResult) || "Unknown error";
|
|
207107
|
+
const errorText = resultMsg.result || "Unknown error";
|
|
207160
207108
|
yield this.emit({
|
|
207161
207109
|
type: "error",
|
|
207162
207110
|
errorText
|
|
@@ -207173,10 +207121,9 @@ var AISDKStreamConverter = class {
|
|
|
207173
207121
|
}
|
|
207174
207122
|
}
|
|
207175
207123
|
} catch (error) {
|
|
207176
|
-
const formattedError = formatUnknownError2(error);
|
|
207177
207124
|
if (process.env.DEBUG === "true") {
|
|
207178
207125
|
const errPayload = {
|
|
207179
|
-
error:
|
|
207126
|
+
error: error instanceof Error ? error.message : String(error)
|
|
207180
207127
|
};
|
|
207181
207128
|
if (error instanceof Error) {
|
|
207182
207129
|
if (error.stack)
|
|
@@ -207185,17 +207132,17 @@ var AISDKStreamConverter = class {
|
|
|
207185
207132
|
errPayload.cause = error.cause instanceof Error ? {
|
|
207186
207133
|
message: error.cause.message,
|
|
207187
207134
|
stack: error.cause.stack
|
|
207188
|
-
} :
|
|
207135
|
+
} : String(error.cause);
|
|
207189
207136
|
}
|
|
207190
207137
|
}
|
|
207191
207138
|
trace(errPayload);
|
|
207192
207139
|
} else {
|
|
207193
|
-
trace({ error:
|
|
207140
|
+
trace({ error: String(error) });
|
|
207194
207141
|
}
|
|
207195
207142
|
if (isAbortError(error)) {
|
|
207196
207143
|
console.error("[AISDKStream] Operation aborted");
|
|
207197
207144
|
} else {
|
|
207198
|
-
const errorMessage =
|
|
207145
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
207199
207146
|
console.error("[AISDKStream] Error:", errorMessage);
|
|
207200
207147
|
if (process.env.DEBUG === "true") {
|
|
207201
207148
|
if (error instanceof Error && error.stack) {
|
|
@@ -207466,7 +207413,7 @@ Documentation: https://platform.claude.com/docs/en/agent-sdk/typescript-v2-previ
|
|
|
207466
207413
|
|
|
207467
207414
|
`;
|
|
207468
207415
|
} catch (error) {
|
|
207469
|
-
const errorMessage =
|
|
207416
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
207470
207417
|
console.error("[ClaudeRunner] Mock agent error:", errorMessage);
|
|
207471
207418
|
yield formatDataStream({ type: "error", errorText: errorMessage });
|
|
207472
207419
|
yield formatDataStream({
|
|
@@ -264527,26 +264474,6 @@ function buildSecretAwareTools(cwd, secrets) {
|
|
|
264527
264474
|
|
|
264528
264475
|
// ../../packages/runner-pi/dist/pi-runner.js
|
|
264529
264476
|
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
|
-
}
|
|
264550
264477
|
function parseModelSpec(model) {
|
|
264551
264478
|
const trimmed = model.trim();
|
|
264552
264479
|
const separator = trimmed.indexOf(":");
|
|
@@ -264786,7 +264713,7 @@ function createPiRunner(options2 = {}) {
|
|
|
264786
264713
|
await promptPromise;
|
|
264787
264714
|
} catch (error) {
|
|
264788
264715
|
if (!streamConverter.finished) {
|
|
264789
|
-
const message =
|
|
264716
|
+
const message = error instanceof Error ? error.message : "Pi agent run failed.";
|
|
264790
264717
|
for (const chunk of streamConverter.forceError(message)) {
|
|
264791
264718
|
yield chunk;
|
|
264792
264719
|
}
|
|
@@ -264794,8 +264721,7 @@ function createPiRunner(options2 = {}) {
|
|
|
264794
264721
|
return;
|
|
264795
264722
|
}
|
|
264796
264723
|
if (!streamConverter.finished && session.agent.state.error) {
|
|
264797
|
-
const
|
|
264798
|
-
for (const chunk of streamConverter.forceError(errorText)) {
|
|
264724
|
+
for (const chunk of streamConverter.forceError(session.agent.state.error)) {
|
|
264799
264725
|
yield chunk;
|
|
264800
264726
|
}
|
|
264801
264727
|
}
|
|
@@ -264984,7 +264910,7 @@ function codingRunStream(req, env2) {
|
|
|
264984
264910
|
controller.enqueue(encoder.encode(chunk));
|
|
264985
264911
|
}
|
|
264986
264912
|
} catch (err) {
|
|
264987
|
-
const msg = err instanceof Error ? err.message :
|
|
264913
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
264988
264914
|
controller.enqueue(
|
|
264989
264915
|
encoder.encode(
|
|
264990
264916
|
`data: ${JSON.stringify({ type: "error", errorText: msg })}
|
|
@@ -265046,7 +264972,7 @@ function createNextHandler(opts) {
|
|
|
265046
264972
|
return Response.json(result2);
|
|
265047
264973
|
} catch (err) {
|
|
265048
264974
|
const status = err instanceof AppError ? err.status : 500;
|
|
265049
|
-
const msg = err instanceof Error ? err.message :
|
|
264975
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265050
264976
|
return Response.json(fail(msg), { status });
|
|
265051
264977
|
}
|
|
265052
264978
|
}
|
|
@@ -265073,7 +264999,7 @@ function createNextHandler(opts) {
|
|
|
265073
264999
|
});
|
|
265074
265000
|
} catch (err) {
|
|
265075
265001
|
const status = err instanceof AppError ? err.status : 500;
|
|
265076
|
-
const msg = err instanceof Error ? err.message :
|
|
265002
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265077
265003
|
return Response.json(fail(msg), { status });
|
|
265078
265004
|
}
|
|
265079
265005
|
}
|
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;CAqBzD"}
|
|
@@ -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"}
|