@cydm/pie 2.7.12 → 2.7.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/README.md +13 -14
- package/dist/builtin/extensions/ask-user/index.js +3 -3
- package/dist/builtin/extensions/document-attachments/index.js +3 -0
- package/dist/builtin/extensions/im-forward/index.js +980 -0
- package/dist/builtin/extensions/im-forward/package.json +11 -0
- package/dist/builtin/extensions/pie-ipc/index.js +1671 -0
- package/dist/builtin/extensions/pie-ipc/package.json +11 -0
- package/dist/builtin/extensions/plan-mode/index.js +3 -3
- package/dist/builtin/extensions/subagent/index.js +4 -4
- package/dist/builtin/extensions/todo/index.js +3 -3
- package/dist/builtin/skills/computer-use-axi/computer-use-axi-broker.js +13 -11
- package/dist/builtin/skills/computer-use-axi/computer-use-axi-runtime.js +1 -1
- package/dist/chunks/{chunk-2NBUFVUQ.js → chunk-5YU6MU2N.js} +24 -1
- package/dist/chunks/chunk-F7EBZTZO.js +26 -0
- package/dist/chunks/{chunk-YI3CSQGD.js → chunk-FOE2AW4L.js} +2 -2
- package/dist/chunks/{chunk-EN47TIBG.js → chunk-N4252GH3.js} +126 -99
- package/dist/chunks/{chunk-AFPRX5XI.js → chunk-VPTLDLI6.js} +38 -18
- package/dist/chunks/{src-XDNJ3PHL.js → src-4PG3KZUS.js} +6 -2
- package/dist/chunks/{test-stream-LUUGOJMP.js → test-stream-OTKTTZ72.js} +1 -1
- package/dist/cli.js +400 -125
- package/package.json +3 -2
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
extractPlanTodoItems,
|
|
7
7
|
markCompletedPlanSteps,
|
|
8
8
|
restoreExecutionState
|
|
9
|
-
} from "../../../chunks/chunk-
|
|
10
|
-
import "../../../chunks/chunk-
|
|
11
|
-
import "../../../chunks/chunk-
|
|
9
|
+
} from "../../../chunks/chunk-VPTLDLI6.js";
|
|
10
|
+
import "../../../chunks/chunk-5YU6MU2N.js";
|
|
11
|
+
import "../../../chunks/chunk-N4252GH3.js";
|
|
12
12
|
import {
|
|
13
13
|
Type
|
|
14
14
|
} from "../../../chunks/chunk-XXGYUYXI.js";
|
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
formatTransportLifecycle,
|
|
7
7
|
getConfigDir,
|
|
8
8
|
logTransportLifecycle
|
|
9
|
-
} from "../../../chunks/chunk-
|
|
9
|
+
} from "../../../chunks/chunk-FOE2AW4L.js";
|
|
10
10
|
import {
|
|
11
11
|
SUBAGENT_SESSION_RECORD_VERSION,
|
|
12
12
|
createPolicyEnforcedTools,
|
|
13
13
|
createSharedFileSystemTools,
|
|
14
14
|
createSubagentCapability
|
|
15
|
-
} from "../../../chunks/chunk-
|
|
16
|
-
import "../../../chunks/chunk-
|
|
17
|
-
import "../../../chunks/chunk-
|
|
15
|
+
} from "../../../chunks/chunk-VPTLDLI6.js";
|
|
16
|
+
import "../../../chunks/chunk-5YU6MU2N.js";
|
|
17
|
+
import "../../../chunks/chunk-N4252GH3.js";
|
|
18
18
|
import "../../../chunks/chunk-XXGYUYXI.js";
|
|
19
19
|
import "../../../chunks/chunk-LZQXQOPJ.js";
|
|
20
20
|
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
executeManageTodoList,
|
|
9
9
|
executionStateToTodos,
|
|
10
10
|
restoreExecutionState
|
|
11
|
-
} from "../../../chunks/chunk-
|
|
12
|
-
import "../../../chunks/chunk-
|
|
13
|
-
import "../../../chunks/chunk-
|
|
11
|
+
} from "../../../chunks/chunk-VPTLDLI6.js";
|
|
12
|
+
import "../../../chunks/chunk-5YU6MU2N.js";
|
|
13
|
+
import "../../../chunks/chunk-N4252GH3.js";
|
|
14
14
|
import "../../../chunks/chunk-XXGYUYXI.js";
|
|
15
15
|
import "../../../chunks/chunk-LZQXQOPJ.js";
|
|
16
16
|
|
|
@@ -5022,17 +5022,19 @@ function validateRequest(value) {
|
|
|
5022
5022
|
const params = validateCommandParams(command, value.params);
|
|
5023
5023
|
const cwd = value.cwd === void 0 ? process.cwd() : boundedString(value.cwd, "cwd", 4096);
|
|
5024
5024
|
if (!path3.isAbsolute(cwd)) throw new BrokerProtocolError("invalid_request", "cwd must be absolute.");
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5025
|
+
let environment = {};
|
|
5026
|
+
if (command !== "stop") {
|
|
5027
|
+
const rawEnvironment = value.environment ?? {};
|
|
5028
|
+
assertPlainRecord(rawEnvironment, "environment");
|
|
5029
|
+
assertKeys(rawEnvironment, "environment", REQUEST_ENV_KEYS);
|
|
5030
|
+
for (const entry of Object.values(rawEnvironment)) {
|
|
5031
|
+
if (typeof entry !== "string") throw new BrokerProtocolError("invalid_request", "environment values must be strings.");
|
|
5032
|
+
}
|
|
5033
|
+
try {
|
|
5034
|
+
environment = captureComputerUseEnvironment(rawEnvironment);
|
|
5035
|
+
} catch (error) {
|
|
5036
|
+
throw new BrokerProtocolError("invalid_request", String(error));
|
|
5037
|
+
}
|
|
5036
5038
|
}
|
|
5037
5039
|
const budgetMs = value.budgetMs === void 0 ? BROKER_DEFAULT_REQUEST_BUDGET_MS : Math.trunc(boundedNumber(value.budgetMs, "budgetMs", BROKER_MIN_REQUEST_BUDGET_MS, BROKER_MAX_REQUEST_BUDGET_MS));
|
|
5038
5040
|
return {
|
|
@@ -378,7 +378,7 @@ function isBrokerResponse(value) {
|
|
|
378
378
|
}
|
|
379
379
|
async function callBroker(options) {
|
|
380
380
|
if (options.command !== "stop") resolveTestOnlyBackend();
|
|
381
|
-
const environment = captureComputerUseEnvironment();
|
|
381
|
+
const environment = options.command === "stop" ? {} : captureComputerUseEnvironment();
|
|
382
382
|
const endpoint = resolveBrokerEndpoint();
|
|
383
383
|
const budgetMs = Math.min(Math.max(options.budgetMs ?? BROKER_DEFAULT_REQUEST_BUDGET_MS, 100), 15 * 6e4);
|
|
384
384
|
const spawnState = { spawned: false };
|
|
@@ -4,7 +4,27 @@ import {
|
|
|
4
4
|
disposeModelTransports,
|
|
5
5
|
streamSimple,
|
|
6
6
|
validateToolArguments
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-N4252GH3.js";
|
|
8
|
+
|
|
9
|
+
// ../../packages/agent-core/src/failure.ts
|
|
10
|
+
function getAgentFailureMetadata(error) {
|
|
11
|
+
if (!error || typeof error !== "object") return {};
|
|
12
|
+
const source = error;
|
|
13
|
+
return {
|
|
14
|
+
...source.retryable === false ? { retryable: false } : {},
|
|
15
|
+
...source.remoteFailure ? { remoteFailure: source.remoteFailure } : {},
|
|
16
|
+
...source.replayEligible === true ? { replayEligible: true } : {},
|
|
17
|
+
...typeof source.replayClass === "string" ? { replayClass: source.replayClass } : {},
|
|
18
|
+
...source.operationFailure ? { operationFailure: source.operationFailure } : {}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function createAgentOperationError(error, failure) {
|
|
22
|
+
return Object.assign(
|
|
23
|
+
new Error(error instanceof Error ? error.message : String(error), { cause: error }),
|
|
24
|
+
getAgentFailureMetadata(error),
|
|
25
|
+
{ operationFailure: failure }
|
|
26
|
+
);
|
|
27
|
+
}
|
|
8
28
|
|
|
9
29
|
// ../../packages/agent-core/src/agent-loop.ts
|
|
10
30
|
function createLoopErrorMessage(error, config, signal) {
|
|
@@ -25,6 +45,7 @@ function createLoopErrorMessage(error, config, signal) {
|
|
|
25
45
|
},
|
|
26
46
|
stopReason: signal?.aborted ? "aborted" : "error",
|
|
27
47
|
errorMessage: message,
|
|
48
|
+
...getAgentFailureMetadata(error),
|
|
28
49
|
timestamp: Date.now()
|
|
29
50
|
};
|
|
30
51
|
}
|
|
@@ -1132,6 +1153,8 @@ var Agent = class {
|
|
|
1132
1153
|
};
|
|
1133
1154
|
|
|
1134
1155
|
export {
|
|
1156
|
+
getAgentFailureMetadata,
|
|
1157
|
+
createAgentOperationError,
|
|
1135
1158
|
agentLoop,
|
|
1136
1159
|
agentLoopContinue,
|
|
1137
1160
|
createToolCallerIdentity,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/files/image-format.ts
|
|
4
|
+
import * as fs from "node:fs";
|
|
5
|
+
function detectImageMime(bytes) {
|
|
6
|
+
if (bytes.length >= 3 && bytes[0] === 255 && bytes[1] === 216 && bytes[2] === 255) return { mime: "image/jpeg", ext: ".jpg" };
|
|
7
|
+
if (bytes.length >= 8 && bytes.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]))) return { mime: "image/png", ext: ".png" };
|
|
8
|
+
if (bytes.length >= 6 && (bytes.subarray(0, 6).equals(Buffer.from("GIF87a")) || bytes.subarray(0, 6).equals(Buffer.from("GIF89a")))) return { mime: "image/gif", ext: ".gif" };
|
|
9
|
+
if (bytes.length >= 12 && bytes.subarray(0, 4).equals(Buffer.from("RIFF")) && bytes.subarray(8, 12).equals(Buffer.from("WEBP"))) return { mime: "image/webp", ext: ".webp" };
|
|
10
|
+
return { mime: "application/octet-stream", ext: ".bin" };
|
|
11
|
+
}
|
|
12
|
+
function readImageFormat(filePath) {
|
|
13
|
+
const fd = fs.openSync(filePath, "r");
|
|
14
|
+
try {
|
|
15
|
+
const header = Buffer.alloc(16);
|
|
16
|
+
const count = fs.readSync(fd, header, 0, header.length, 0);
|
|
17
|
+
return detectImageMime(header.subarray(0, count));
|
|
18
|
+
} finally {
|
|
19
|
+
fs.closeSync(fd);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
detectImageMime,
|
|
25
|
+
readImageFormat
|
|
26
|
+
};
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
defaultShellKindForPlatform,
|
|
8
8
|
interpretShellExit,
|
|
9
9
|
requestInteraction
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VPTLDLI6.js";
|
|
11
11
|
import {
|
|
12
12
|
EMPTY_ASSISTANT_CONTENT_ERROR,
|
|
13
13
|
OPENAI_COMPAT_PROTOCOL_ERROR_CODE,
|
|
14
14
|
getLogger
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-N4252GH3.js";
|
|
16
16
|
import {
|
|
17
17
|
Type
|
|
18
18
|
} from "./chunk-XXGYUYXI.js";
|
|
@@ -829,6 +829,14 @@ var SHA256 = class extends HashMD {
|
|
|
829
829
|
var sha256 = /* @__PURE__ */ createHasher(() => new SHA256());
|
|
830
830
|
|
|
831
831
|
// ../../packages/platform/src/sha256.ts
|
|
832
|
+
var utf8Owner;
|
|
833
|
+
function tryCreateUtf8Sha256Hasher() {
|
|
834
|
+
try {
|
|
835
|
+
return utf8Owner?.factory();
|
|
836
|
+
} catch {
|
|
837
|
+
return void 0;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
832
840
|
function createSha256Hasher() {
|
|
833
841
|
const hash = sha256.create();
|
|
834
842
|
return {
|
|
@@ -3408,33 +3416,33 @@ function isPuertsReparsePoint(path) {
|
|
|
3408
3416
|
}
|
|
3409
3417
|
function containsPuertsReparsePoint(directory) {
|
|
3410
3418
|
const slashed = directory.replace(/\\/g, "/");
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
const unc = /^\/\/([^/]+)\/([^/]+)/.exec(trimmed);
|
|
3419
|
+
if (!slashed) return false;
|
|
3420
|
+
const unc = /^\/\/([^/]+)\/([^/]+)/.exec(slashed);
|
|
3414
3421
|
let prefix;
|
|
3415
3422
|
let rest;
|
|
3416
3423
|
if (unc) {
|
|
3417
3424
|
prefix = unc[0];
|
|
3418
|
-
rest =
|
|
3425
|
+
rest = slashed.slice(prefix.length);
|
|
3419
3426
|
} else {
|
|
3420
|
-
const driveRoot = /^([a-zA-Z]:)\//.exec(
|
|
3427
|
+
const driveRoot = /^([a-zA-Z]:)\//.exec(slashed);
|
|
3421
3428
|
if (driveRoot) {
|
|
3422
3429
|
prefix = `${driveRoot[1]}/`;
|
|
3423
|
-
rest =
|
|
3430
|
+
rest = slashed.slice(prefix.length);
|
|
3424
3431
|
} else {
|
|
3425
|
-
const bareDrive = /^[a-zA-Z]:$/.test(
|
|
3432
|
+
const bareDrive = /^[a-zA-Z]:$/.test(slashed);
|
|
3426
3433
|
if (bareDrive) {
|
|
3427
|
-
return isPuertsReparsePoint(
|
|
3434
|
+
return isPuertsReparsePoint(slashed);
|
|
3428
3435
|
}
|
|
3429
|
-
if (
|
|
3436
|
+
if (slashed.startsWith("/")) {
|
|
3430
3437
|
prefix = "/";
|
|
3431
|
-
rest =
|
|
3438
|
+
rest = slashed.slice(1);
|
|
3432
3439
|
} else {
|
|
3433
3440
|
prefix = "";
|
|
3434
|
-
rest =
|
|
3441
|
+
rest = slashed;
|
|
3435
3442
|
}
|
|
3436
3443
|
}
|
|
3437
3444
|
}
|
|
3445
|
+
if (prefix && isPuertsReparsePoint(prefix)) return true;
|
|
3438
3446
|
let current = prefix;
|
|
3439
3447
|
for (const part of rest.split("/").filter((segment) => segment.length > 0 && segment !== ".")) {
|
|
3440
3448
|
current = current ? current.endsWith("/") ? `${current}${part}` : `${current}/${part}` : part;
|
|
@@ -6462,100 +6470,119 @@ function jsonSha256(value) {
|
|
|
6462
6470
|
return hashJson(value);
|
|
6463
6471
|
}
|
|
6464
6472
|
function hashJson(value, parts) {
|
|
6465
|
-
const
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
used =
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6473
|
+
const utf8 = tryCreateUtf8Sha256Hasher();
|
|
6474
|
+
try {
|
|
6475
|
+
const hash = utf8 ? void 0 : createSha256Hasher();
|
|
6476
|
+
const bytes = new Uint8Array(utf8 ? 0 : 8192);
|
|
6477
|
+
let fragments = "";
|
|
6478
|
+
let used = 0;
|
|
6479
|
+
const byte = (n) => {
|
|
6480
|
+
bytes[used++] = n;
|
|
6481
|
+
if (used === bytes.length) {
|
|
6482
|
+
hash.update(bytes);
|
|
6483
|
+
used = 0;
|
|
6484
|
+
}
|
|
6485
|
+
};
|
|
6486
|
+
const emit = (text) => {
|
|
6487
|
+
if (utf8) {
|
|
6488
|
+
if (fragments.length + text.length > 8192) {
|
|
6489
|
+
if (fragments) utf8.updateUtf8(fragments);
|
|
6490
|
+
fragments = "";
|
|
6491
|
+
}
|
|
6492
|
+
if (text.length >= 8192) utf8.updateUtf8(text);
|
|
6493
|
+
else fragments += text;
|
|
6494
|
+
return;
|
|
6495
|
+
}
|
|
6496
|
+
for (let i = 0; i < text.length; i++) {
|
|
6497
|
+
const cp = text.codePointAt(i);
|
|
6498
|
+
if (cp < 128) byte(cp);
|
|
6499
|
+
else if (cp < 2048) {
|
|
6500
|
+
byte(192 | cp >> 6);
|
|
6501
|
+
byte(128 | cp & 63);
|
|
6502
|
+
} else if (cp < 65536) {
|
|
6503
|
+
byte(224 | cp >> 12);
|
|
6504
|
+
byte(128 | cp >> 6 & 63);
|
|
6505
|
+
byte(128 | cp & 63);
|
|
6506
|
+
} else {
|
|
6507
|
+
byte(240 | cp >> 18);
|
|
6508
|
+
byte(128 | cp >> 12 & 63);
|
|
6509
|
+
byte(128 | cp >> 6 & 63);
|
|
6510
|
+
byte(128 | cp & 63);
|
|
6511
|
+
i++;
|
|
6512
|
+
}
|
|
6513
|
+
}
|
|
6514
|
+
};
|
|
6515
|
+
const string = (text) => {
|
|
6516
|
+
emit('"');
|
|
6517
|
+
for (let start = 0; start < text.length; ) {
|
|
6518
|
+
let end = Math.min(start + 2048, text.length);
|
|
6519
|
+
if (end < text.length && text.charCodeAt(end - 1) >= 55296 && text.charCodeAt(end - 1) <= 56319) end--;
|
|
6520
|
+
const escaped = JSON.stringify(text.slice(start, end));
|
|
6521
|
+
emit(escaped.slice(1, -1));
|
|
6522
|
+
start = end;
|
|
6523
|
+
}
|
|
6524
|
+
emit('"');
|
|
6525
|
+
};
|
|
6526
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
6527
|
+
const omitted = (v) => v === void 0 || typeof v === "function" || typeof v === "symbol";
|
|
6528
|
+
const visit = (v) => {
|
|
6529
|
+
if (typeof v === "string") {
|
|
6530
|
+
string(v);
|
|
6531
|
+
return;
|
|
6532
|
+
}
|
|
6533
|
+
if (v === null || typeof v !== "object") {
|
|
6534
|
+
const encoded = JSON.stringify(v);
|
|
6535
|
+
if (encoded === void 0) throw new TypeError("Not a JSON value");
|
|
6536
|
+
emit(encoded);
|
|
6537
|
+
return;
|
|
6538
|
+
}
|
|
6539
|
+
const prototype = Object.getPrototypeOf(v);
|
|
6540
|
+
if (!Array.isArray(v) && prototype !== Object.prototype && prototype !== null || typeof v.toJSON === "function") throw new TypeError("Not a JSON snapshot");
|
|
6541
|
+
if (ancestors.has(v)) throw new TypeError("Circular JSON snapshot");
|
|
6542
|
+
ancestors.add(v);
|
|
6543
|
+
if (Array.isArray(v)) {
|
|
6544
|
+
emit("[");
|
|
6545
|
+
for (let i = 0; i < v.length; i++) {
|
|
6546
|
+
if (Object.getOwnPropertyDescriptor(v, i)?.get) throw new TypeError("Not a JSON snapshot");
|
|
6547
|
+
if (i) emit(",");
|
|
6548
|
+
visit(omitted(v[i]) ? null : v[i]);
|
|
6549
|
+
}
|
|
6550
|
+
emit("]");
|
|
6486
6551
|
} else {
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6552
|
+
emit("{");
|
|
6553
|
+
let first = true;
|
|
6554
|
+
for (const key of Object.keys(v)) {
|
|
6555
|
+
if (Object.getOwnPropertyDescriptor(v, key)?.get) throw new TypeError("Not a JSON snapshot");
|
|
6556
|
+
const entry = v[key];
|
|
6557
|
+
if (omitted(entry)) continue;
|
|
6558
|
+
if (!first) emit(",");
|
|
6559
|
+
first = false;
|
|
6560
|
+
string(key);
|
|
6561
|
+
emit(":");
|
|
6562
|
+
visit(entry);
|
|
6563
|
+
}
|
|
6564
|
+
emit("}");
|
|
6492
6565
|
}
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
emit('"');
|
|
6497
|
-
for (let start = 0; start < text.length; ) {
|
|
6498
|
-
let end = Math.min(start + 2048, text.length);
|
|
6499
|
-
if (end < text.length && text.charCodeAt(end - 1) >= 55296 && text.charCodeAt(end - 1) <= 56319) end--;
|
|
6500
|
-
const escaped = JSON.stringify(text.slice(start, end));
|
|
6501
|
-
emit(escaped.slice(1, -1));
|
|
6502
|
-
start = end;
|
|
6503
|
-
}
|
|
6504
|
-
emit('"');
|
|
6505
|
-
};
|
|
6506
|
-
const ancestors = /* @__PURE__ */ new Set();
|
|
6507
|
-
const omitted = (v) => v === void 0 || typeof v === "function" || typeof v === "symbol";
|
|
6508
|
-
const visit = (v) => {
|
|
6509
|
-
if (typeof v === "string") {
|
|
6510
|
-
string(v);
|
|
6511
|
-
return;
|
|
6512
|
-
}
|
|
6513
|
-
if (v === null || typeof v !== "object") {
|
|
6514
|
-
const encoded = JSON.stringify(v);
|
|
6515
|
-
if (encoded === void 0) throw new TypeError("Not a JSON value");
|
|
6516
|
-
emit(encoded);
|
|
6517
|
-
return;
|
|
6518
|
-
}
|
|
6519
|
-
const prototype = Object.getPrototypeOf(v);
|
|
6520
|
-
if (!Array.isArray(v) && prototype !== Object.prototype && prototype !== null || typeof v.toJSON === "function") throw new TypeError("Not a JSON snapshot");
|
|
6521
|
-
if (ancestors.has(v)) throw new TypeError("Circular JSON snapshot");
|
|
6522
|
-
ancestors.add(v);
|
|
6523
|
-
if (Array.isArray(v)) {
|
|
6566
|
+
ancestors.delete(v);
|
|
6567
|
+
};
|
|
6568
|
+
if (parts) {
|
|
6524
6569
|
emit("[");
|
|
6525
|
-
for (let i = 0; i <
|
|
6526
|
-
if (Object.getOwnPropertyDescriptor(v, i)?.get) throw new TypeError("Not a JSON snapshot");
|
|
6570
|
+
for (let i = 0; i < parts.count + parts.output.length; i++) {
|
|
6527
6571
|
if (i) emit(",");
|
|
6528
|
-
|
|
6572
|
+
const item = i < parts.count ? parts.input[i] : parts.output[i - parts.count];
|
|
6573
|
+
visit(omitted(item) ? null : item);
|
|
6529
6574
|
}
|
|
6530
6575
|
emit("]");
|
|
6531
|
-
} else
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
emit(":");
|
|
6542
|
-
visit(entry);
|
|
6543
|
-
}
|
|
6544
|
-
emit("}");
|
|
6545
|
-
}
|
|
6546
|
-
ancestors.delete(v);
|
|
6547
|
-
};
|
|
6548
|
-
if (parts) {
|
|
6549
|
-
emit("[");
|
|
6550
|
-
for (let i = 0; i < parts.count + parts.output.length; i++) {
|
|
6551
|
-
if (i) emit(",");
|
|
6552
|
-
const item = i < parts.count ? parts.input[i] : parts.output[i - parts.count];
|
|
6553
|
-
visit(omitted(item) ? null : item);
|
|
6554
|
-
}
|
|
6555
|
-
emit("]");
|
|
6556
|
-
} else visit(value);
|
|
6557
|
-
if (used) hash.update(bytes.subarray(0, used));
|
|
6558
|
-
return hash.digestHex();
|
|
6576
|
+
} else visit(value);
|
|
6577
|
+
if (utf8) {
|
|
6578
|
+
if (fragments) utf8.updateUtf8(fragments);
|
|
6579
|
+
return utf8.digestHex();
|
|
6580
|
+
}
|
|
6581
|
+
if (used) hash.update(bytes.subarray(0, used));
|
|
6582
|
+
return hash.digestHex();
|
|
6583
|
+
} finally {
|
|
6584
|
+
utf8?.dispose();
|
|
6585
|
+
}
|
|
6559
6586
|
}
|
|
6560
6587
|
function inputSha256(input, count = input.length, output = []) {
|
|
6561
6588
|
return hashJson(void 0, { input, count, output });
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
Agent,
|
|
4
|
+
createAgentOperationError,
|
|
5
|
+
getAgentFailureMetadata,
|
|
4
6
|
getToolCallerIdentity
|
|
5
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5YU6MU2N.js";
|
|
6
8
|
import {
|
|
7
9
|
AssistantMessageEventStream,
|
|
8
10
|
FileSystemGateway,
|
|
@@ -12,7 +14,7 @@ import {
|
|
|
12
14
|
getPlatformConfig,
|
|
13
15
|
hashText,
|
|
14
16
|
streamSimple
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-N4252GH3.js";
|
|
16
18
|
import {
|
|
17
19
|
Type
|
|
18
20
|
} from "./chunk-XXGYUYXI.js";
|
|
@@ -1001,7 +1003,7 @@ var PLAN_POWERSHELL_READ_COMMANDS = new Set([
|
|
|
1001
1003
|
"Compare-Object",
|
|
1002
1004
|
"Test-Path"
|
|
1003
1005
|
].map((name) => name.toLowerCase()));
|
|
1004
|
-
var PLAN_POWERSHELL_READ_ALIASES = /* @__PURE__ */ new Set(["cat", "ls", "pwd", "echo"
|
|
1006
|
+
var PLAN_POWERSHELL_READ_ALIASES = /* @__PURE__ */ new Set(["cat", "ls", "pwd", "echo"]);
|
|
1005
1007
|
var PLAN_POWERSHELL_SAFE_PARAMETERS = /^(?:-(?:Raw|TotalCount|Head|Tail|First|Last|Wait|LiteralPath|Path|Name|Pattern|Recurse|Filter|Include|Exclude|SimpleMatch|CaseSensitive|Quiet|Word|Line|Character|Encoding|ErrorAction|WarningAction))$/i;
|
|
1006
1008
|
var PLAN_POWERSHELL_SEPARATORS = /[;\n\r\t&<>|]/;
|
|
1007
1009
|
var PLAN_POWERSHELL_NON_ASCII = /[^\x20-\x7E]/;
|
|
@@ -1698,12 +1700,7 @@ Return a text-only successor handoff. Do not call any tools.` }],
|
|
|
1698
1700
|
).result();
|
|
1699
1701
|
throwIfAborted();
|
|
1700
1702
|
if (response.stopReason === "error" && (!response.content.some((block) => block.type === "toolCall") || classifyRemoteFailure(response.remoteFailure, response.errorMessage ?? "") !== void 0)) {
|
|
1701
|
-
|
|
1702
|
-
const explicitRetryable = response.retryable;
|
|
1703
|
-
if (typeof explicitRetryable === "boolean") providerError.retryable = explicitRetryable;
|
|
1704
|
-
if (response.replayEligible === true) providerError.replayEligible = true;
|
|
1705
|
-
providerError.remoteFailure = response.remoteFailure;
|
|
1706
|
-
throw providerError;
|
|
1703
|
+
throw Object.assign(new Error(response.errorMessage || "Compaction provider error"), getAgentFailureMetadata(response));
|
|
1707
1704
|
}
|
|
1708
1705
|
} catch (error) {
|
|
1709
1706
|
throwIfAborted();
|
|
@@ -5208,7 +5205,11 @@ async function runPreRequestAutoCompact(params) {
|
|
|
5208
5205
|
try {
|
|
5209
5206
|
await params.runAutoCompact();
|
|
5210
5207
|
} catch (error) {
|
|
5211
|
-
if (boundary) throw error
|
|
5208
|
+
if (boundary) throw createAgentOperationError(error, {
|
|
5209
|
+
origin: "tool-continuation",
|
|
5210
|
+
operation: "compaction",
|
|
5211
|
+
terminal: true
|
|
5212
|
+
});
|
|
5212
5213
|
if (params.isCurrent?.() !== false) params.setRecoveryState("none");
|
|
5213
5214
|
}
|
|
5214
5215
|
}
|
|
@@ -5517,7 +5518,8 @@ function isAssistantTerminalCompletion(message) {
|
|
|
5517
5518
|
return !message.content.some((block) => block.type === "toolCall");
|
|
5518
5519
|
}
|
|
5519
5520
|
function createFailureClassification(context, retry, classifyFailure) {
|
|
5520
|
-
|
|
5521
|
+
const terminalOperation = context.message?.role === "assistant" && context.message.operationFailure?.terminal === true;
|
|
5522
|
+
if (!terminalOperation && context.message?.role === "assistant" && context.message.replayEligible === true && context.message.stopReason === "error") {
|
|
5521
5523
|
return {
|
|
5522
5524
|
kind: "provider_transient",
|
|
5523
5525
|
retryable: true,
|
|
@@ -5528,7 +5530,7 @@ function createFailureClassification(context, retry, classifyFailure) {
|
|
|
5528
5530
|
replayExempt: true
|
|
5529
5531
|
};
|
|
5530
5532
|
}
|
|
5531
|
-
if (context.message?.role === "assistant" && context.message.retryable === false) {
|
|
5533
|
+
if (context.message?.role === "assistant" && (terminalOperation || context.message.retryable === false)) {
|
|
5532
5534
|
return { kind: "unknown", retryable: false, compactable: false, userAbort: context.message.stopReason === "aborted", terminal: true, message: context.errorMessage };
|
|
5533
5535
|
}
|
|
5534
5536
|
const remote = context.message?.role === "assistant" && context.message.stopReason === "error" ? classifyRemoteFailure(context.message.remoteFailure, context.errorMessage) : void 0;
|
|
@@ -6311,7 +6313,8 @@ async function handleAgentSessionTurnEndRuntimePolicies(params) {
|
|
|
6311
6313
|
params.emit({ type: "turn_settled" });
|
|
6312
6314
|
return;
|
|
6313
6315
|
}
|
|
6314
|
-
const
|
|
6316
|
+
const recoveryClosed = failure?.terminal && params.message?.role === "assistant" && (params.message.retryable === false || params.message.operationFailure?.terminal === true);
|
|
6317
|
+
const compactDecision = recoveryClosed ? void 0 : params.getAutoCompactDecision?.({
|
|
6315
6318
|
agent: params.agent,
|
|
6316
6319
|
sessionManager: params.sessionManager,
|
|
6317
6320
|
cwd: params.cwd,
|
|
@@ -8215,7 +8218,7 @@ var SessionTraceSnapshotWriter = class {
|
|
|
8215
8218
|
|
|
8216
8219
|
// ../../packages/agent-framework/src/delegation.ts
|
|
8217
8220
|
var DELEGATION_REPORT_MAX_CHARS = 24e3;
|
|
8218
|
-
var DELEGATION_REPORT_INSTRUCTION = 'Return your final response once as a JSON object: {"summary":string,"result":string,"remainingWork"?:string[],"evidenceRefs"?:string[]}. Keep the entire JSON response within 24,000 characters: give concise conclusions and bounded evidence references, not repeated drafting notes. Do not make an extra tool call to report. Evidence references are your claims, not runtime verification.';
|
|
8221
|
+
var DELEGATION_REPORT_INSTRUCTION = 'Return your final response once as a JSON object: {"summary":string,"result":string,"remainingWork"?:string[],"evidenceRefs"?:string[]}. Keep the entire JSON response within 24,000 characters: give concise conclusions and bounded evidence references, not repeated drafting notes. Do not make an extra tool call to report. Evidence references are your claims, not runtime verification. Emit the raw JSON object only \u2014 no markdown code fences around it, and no raw line breaks inside JSON string values (escape them as \\n); anything JSON.parse rejects is treated as no report.';
|
|
8219
8222
|
function parseDelegationReport(text, runId, truncated = false) {
|
|
8220
8223
|
const raw = (text ?? "").slice(0, DELEGATION_REPORT_MAX_CHARS);
|
|
8221
8224
|
const base = { version: 1, runId: runId.slice(0, 160), raw };
|
|
@@ -9565,6 +9568,22 @@ function createAgentInstance(deps, systemPrompt, tools, model, apiKey, thinkingL
|
|
|
9565
9568
|
agentRunHooks.set(agent, hooks);
|
|
9566
9569
|
return agent;
|
|
9567
9570
|
}
|
|
9571
|
+
function inFlightRequestSummary(observation, now) {
|
|
9572
|
+
const transport = observation?.transport;
|
|
9573
|
+
if (!transport || transport.length === 0) return void 0;
|
|
9574
|
+
const lastStartIndex = transport.map((event) => event.phase).lastIndexOf("request_start");
|
|
9575
|
+
if (lastStartIndex < 0) return void 0;
|
|
9576
|
+
const start = transport[lastStartIndex];
|
|
9577
|
+
const after = transport.slice(lastStartIndex + 1);
|
|
9578
|
+
const terminal = after.find((event) => event.phase === "terminal_accepted");
|
|
9579
|
+
if (terminal) {
|
|
9580
|
+
const gapMs = Math.max(0, now - terminal.at);
|
|
9581
|
+
return `last model response completed ${Math.round(gapMs / 100) / 10}s before the deadline; no request in flight at abort`;
|
|
9582
|
+
}
|
|
9583
|
+
const sawFirst = after.some((event) => event.phase === "first_application_message");
|
|
9584
|
+
const ageMs = Math.max(0, now - start.at);
|
|
9585
|
+
return `a model request was still in flight at abort (${Math.round(ageMs / 100) / 10}s old, ${sawFirst ? "receiving stream events" : "no application message yet"}) \u2014 the deadline cut an unfinished response, which usually means the budget is too small for this reasoning level, not a transport stall`;
|
|
9586
|
+
}
|
|
9568
9587
|
function isParentHandoffRequired(task) {
|
|
9569
9588
|
return task.report?.availability !== "available" || task.mode === "edit" || task.status === "timeout" || task.status === "failed" || task.confidenceSignals.some((signal) => signal.type === "tool_error" || signal.type === "no_tool_use" || signal.type === "no_text_report");
|
|
9570
9589
|
}
|
|
@@ -10069,7 +10088,8 @@ ${DELEGATION_REPORT_INSTRUCTION}`;
|
|
|
10069
10088
|
task.status = timedOut ? "timeout" : signal?.aborted ? "cancelled" : "failed";
|
|
10070
10089
|
observeDelegationPhase(task.observation, timedOut ? "deadline" : signal?.aborted ? "cancelled" : "failed");
|
|
10071
10090
|
phaseProgress(task.observation.phase);
|
|
10072
|
-
|
|
10091
|
+
const deadlineDetail = timedOut ? inFlightRequestSummary(task.observation, Date.now()) : void 0;
|
|
10092
|
+
task.error = `${errorMessage.slice(0, 2e3)}${deadlineDetail ? `; ${deadlineDetail}` : ""}`.slice(0, 2e3);
|
|
10073
10093
|
const failureCarrier = error;
|
|
10074
10094
|
if (failureCarrier?.subagentFailure) {
|
|
10075
10095
|
task.failure = failureCarrier.subagentFailure;
|
|
@@ -10086,7 +10106,7 @@ ${DELEGATION_REPORT_INSTRUCTION}`;
|
|
|
10086
10106
|
task.report ??= parseDelegationReport(void 0, task.id);
|
|
10087
10107
|
task.parentHandoffRequired = isParentHandoffRequired(task);
|
|
10088
10108
|
task.completedAt = Date.now();
|
|
10089
|
-
report({ message: `[${task.name}] Failed: ${errorMessage.slice(0,
|
|
10109
|
+
report({ message: `[${task.name}] Failed: ${(errorMessage + (deadlineDetail ? `; ${deadlineDetail}` : "")).slice(0, 160)}`, increment: 100 });
|
|
10090
10110
|
} finally {
|
|
10091
10111
|
if (heartbeat) {
|
|
10092
10112
|
clearInterval(heartbeat);
|
|
@@ -10181,7 +10201,7 @@ function buildParallelResult(tasks, totalDuration) {
|
|
|
10181
10201
|
`;
|
|
10182
10202
|
}
|
|
10183
10203
|
if (task.sessionId) {
|
|
10184
|
-
resultText += task.sessionBusy ? `Session: ${task.sessionId} (busy \u2014 previous run is still settling; recall will fail until it settles` : `Session: ${task.sessionId} (resumable \u2014 pass as "sessionId" in a later spawn to continue this subagent with its accumulated context`;
|
|
10204
|
+
resultText += task.sessionBusy ? `Session: ${task.sessionId} (busy \u2014 previous run is still settling; recall will fail until it settles` : `Session: ${task.sessionId} (resumable \u2014 pass as "sessionId" in a later spawn to continue this subagent with its accumulated context; add resumeMode:"report" to reuse only its last report`;
|
|
10185
10205
|
if (task.sessionRunCount) resultText += `; run ${task.sessionRunCount}`;
|
|
10186
10206
|
if (task.sessionPersisted) resultText += "; persisted to disk, survives restarts";
|
|
10187
10207
|
resultText += ")\n";
|
|
@@ -10357,7 +10377,7 @@ Default mode="read" is for investigation, search, review, or triage and cannot e
|
|
|
10357
10377
|
priority: Type.Optional(Type.Union([Type.Literal("fast"), Type.Literal("thorough")], { description: "fast uses lower-cost defaults; thorough raises model class when needed." })),
|
|
10358
10378
|
model: Type.Optional(Type.String({ description: 'Explicit model override, e.g. "provider/model-id". Only when the user names a specific model; otherwise automatic.' })),
|
|
10359
10379
|
thinkingLevel: Type.Optional(Type.Union([Type.Literal("off"), Type.Literal("minimal"), Type.Literal("low"), Type.Literal("medium"), Type.Literal("high"), Type.Literal("xhigh")], { description: "off|minimal|low|medium|high|xhigh. Default medium; override only when the user asks or for cheap lookups (off)." })),
|
|
10360
|
-
timeout: Type.Optional(Type.Number({ description: "Seconds. Default 1200; set higher for long tasks." })),
|
|
10380
|
+
timeout: Type.Optional(Type.Number({ description: "Seconds. Default 1200; set higher for long tasks. Note: high/xhigh reasoning tasks can spend minutes per response on thinking alone \u2014 budget accordingly or the deadline will cut an in-flight response mid-thought." })),
|
|
10361
10381
|
resumeMode: Type.Optional(Type.Union([Type.Literal("full"), Type.Literal("report")], { description: "Default full retains prior transcript. Explicit report rebuilds with current tools/model/credentials and only the latest valid historical report as data plus the new task; fails if unavailable." })),
|
|
10362
10382
|
sessionId: Type.Optional(Type.String({ description: "Continue a previous subagent session by id (from an earlier result's Session line); full mode retains historical input with unknown cost. Optional mode/model/thinkingLevel reconfigure it; one task at a time; recalls never replay on failure and must target an idle session; prefer a fresh task for independent reviews." }))
|
|
10363
10383
|
}
|
|
@@ -4,10 +4,12 @@ import {
|
|
|
4
4
|
agentLoop,
|
|
5
5
|
agentLoopContinue,
|
|
6
6
|
bindToolCallerIdentity,
|
|
7
|
+
createAgentOperationError,
|
|
7
8
|
createToolCallerIdentity,
|
|
9
|
+
getAgentFailureMetadata,
|
|
8
10
|
getToolCallerIdentity
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-5YU6MU2N.js";
|
|
12
|
+
import "./chunk-N4252GH3.js";
|
|
11
13
|
import "./chunk-XXGYUYXI.js";
|
|
12
14
|
import "./chunk-LZQXQOPJ.js";
|
|
13
15
|
export {
|
|
@@ -15,6 +17,8 @@ export {
|
|
|
15
17
|
agentLoop,
|
|
16
18
|
agentLoopContinue,
|
|
17
19
|
bindToolCallerIdentity,
|
|
20
|
+
createAgentOperationError,
|
|
18
21
|
createToolCallerIdentity,
|
|
22
|
+
getAgentFailureMetadata,
|
|
19
23
|
getToolCallerIdentity
|
|
20
24
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
EventStream
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-N4252GH3.js";
|
|
5
5
|
import "./chunk-XXGYUYXI.js";
|
|
6
6
|
import "./chunk-LZQXQOPJ.js";
|
|
7
7
|
|