@tekmidian/pai 0.56.0 → 0.57.0
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/{chain-26f7uGUs.mjs → chain-OzYgALdx.mjs} +2 -2
- package/dist/{chain-26f7uGUs.mjs.map → chain-OzYgALdx.mjs.map} +1 -1
- package/dist/cli/index.mjs +5 -5
- package/dist/cli/program.mjs +5 -5
- package/dist/daemon/index.mjs +3 -3
- package/dist/{daemon-BsuM0UdV.mjs → daemon-Caxrq2iQ.mjs} +54 -17
- package/dist/daemon-Caxrq2iQ.mjs.map +1 -0
- package/dist/{daemon-BOWol-LF.mjs → daemon-D8zXReoA.mjs} +3 -3
- package/dist/daemon-mcp/index.mjs +3 -3
- package/dist/{fallback-CVe3sb94.mjs → fallback-CiG573uw.mjs} +2 -2
- package/dist/{fallback-CVe3sb94.mjs.map → fallback-CiG573uw.mjs.map} +1 -1
- package/dist/hooks/worker-status-line.mjs +1 -0
- package/dist/hooks/worker-status-line.mjs.map +2 -2
- package/dist/{planner-ye7wrrfB.mjs → planner-s1iQQsjj.mjs} +3 -3
- package/dist/{planner-ye7wrrfB.mjs.map → planner-s1iQQsjj.mjs.map} +1 -1
- package/dist/{program-DuC1RcaO.mjs → program-COHW5ZtV.mjs} +6 -6
- package/dist/{program-DuC1RcaO.mjs.map → program-COHW5ZtV.mjs.map} +1 -1
- package/dist/{run-CqRvXGjd.mjs → run-9HbO1gTM.mjs} +53 -2
- package/dist/run-9HbO1gTM.mjs.map +1 -0
- package/dist/{session-keepalive-BQ6AQ9ez.mjs → session-keepalive-Dg3wiiFJ.mjs} +2 -2
- package/dist/{session-keepalive-BQ6AQ9ez.mjs.map → session-keepalive-Dg3wiiFJ.mjs.map} +1 -1
- package/package.json +1 -1
- package/src/hooks/ztk-passthrough.mjs +3 -0
- package/statusline-command.sh +3 -1
- package/dist/daemon-BsuM0UdV.mjs.map +0 -1
- package/dist/run-CqRvXGjd.mjs.map +0 -1
|
@@ -466,6 +466,22 @@ function elapsedOf(ts, now = /* @__PURE__ */ new Date()) {
|
|
|
466
466
|
if (mins > 0) return `${mins}m ${String(sec).padStart(2, "0")}s`;
|
|
467
467
|
return `${sec}s`;
|
|
468
468
|
}
|
|
469
|
+
/** Shorter sleeps are legitimate polling — not worth a supervision event. */
|
|
470
|
+
const SLEEP_FLOOR_SECS = 60;
|
|
471
|
+
const SLEEP_RE = /^\s*sleep\s+([0-9]+(?:\.[0-9]+)?)([smhd]?)\s*$/;
|
|
472
|
+
/**
|
|
473
|
+
* Seconds of a standalone `sleep N` (N plain or with an s/m/h/d suffix), or
|
|
474
|
+
* null when the command is not one long sleep: anchored to the whole command,
|
|
475
|
+
* so a filename containing "sleep" or an `echo sleep 500` never trips it, and
|
|
476
|
+
* floored at SLEEP_FLOOR_SECS so ordinary polling stays invisible.
|
|
477
|
+
*/
|
|
478
|
+
function parseSleepSecs(command) {
|
|
479
|
+
const m = command.match(SLEEP_RE);
|
|
480
|
+
if (!m) return null;
|
|
481
|
+
const mult = m[2] === "m" ? 60 : m[2] === "h" ? 3600 : m[2] === "d" ? 86400 : 1;
|
|
482
|
+
const secs = Number(m[1]) * mult;
|
|
483
|
+
return Number.isFinite(secs) && secs >= SLEEP_FLOOR_SECS ? secs : null;
|
|
484
|
+
}
|
|
469
485
|
/** One-line description of a tool call, e.g. "Bash: npm test". */
|
|
470
486
|
function describeTool(name, inp) {
|
|
471
487
|
if (typeof inp !== "object" || inp === null) return name;
|
|
@@ -2410,6 +2426,7 @@ function fullContractPrompt(format) {
|
|
|
2410
2426
|
"will pick something up later, never leave a background command as your final action. Finish, then",
|
|
2411
2427
|
"report.",
|
|
2412
2428
|
"No narration, no timestamps, no greetings, no summaries of what you read; act, verify, then stop.",
|
|
2429
|
+
"Never sleep longer than 60 seconds in one command; wait on a bounded timeout or event instead.",
|
|
2413
2430
|
...fileNotInlineBlock(),
|
|
2414
2431
|
"",
|
|
2415
2432
|
`Operator messages: a user turn starting with ${OPERATOR_MARK} was typed by the operator while you`,
|
|
@@ -2895,6 +2912,27 @@ function resetContextTokensOnCompact(status, e) {
|
|
|
2895
2912
|
function isCompactBoundary(e) {
|
|
2896
2913
|
return e.type === "system" && (e.subtype === "compact_boundary" || e.subtype === "compact");
|
|
2897
2914
|
}
|
|
2915
|
+
/** The command string of a Bash tool_use input, "" when there is none. */
|
|
2916
|
+
function bashCommand(input) {
|
|
2917
|
+
if (typeof input === "object" && input !== null && typeof input.command === "string") return input.command;
|
|
2918
|
+
return "";
|
|
2919
|
+
}
|
|
2920
|
+
function toolResultText(content) {
|
|
2921
|
+
if (typeof content === "string") return content;
|
|
2922
|
+
if (Array.isArray(content)) return content.map((c) => typeof c === "object" && c !== null && typeof c.text === "string" ? c.text : "").join("\n");
|
|
2923
|
+
return "";
|
|
2924
|
+
}
|
|
2925
|
+
/**
|
|
2926
|
+
* Whether a tool_result block is a failed execution: the harness's own
|
|
2927
|
+
* is_error flag, or — the older Bash spelling — an "Exit code N" line with a
|
|
2928
|
+
* non-zero N in the result text. Feeds the consecFails counter supervision's
|
|
2929
|
+
* thrashing detector reads.
|
|
2930
|
+
*/
|
|
2931
|
+
function toolResultFailed(block) {
|
|
2932
|
+
if (block.is_error === true) return true;
|
|
2933
|
+
const m = toolResultText(block.content).match(/Exit code (\d+)/);
|
|
2934
|
+
return m !== null && Number(m[1]) !== 0;
|
|
2935
|
+
}
|
|
2898
2936
|
/**
|
|
2899
2937
|
* The model the init event announces, adopted into the status when the spawn
|
|
2900
2938
|
* could not name one (a caller that passed `--model` itself in the claude
|
|
@@ -2999,7 +3037,7 @@ async function runWorker(opts) {
|
|
|
2999
3037
|
const logDir = workersLogDir(config);
|
|
3000
3038
|
mkdirSync(logDir, { recursive: true });
|
|
3001
3039
|
if (opts.className === "plan" && !opts._planner) {
|
|
3002
|
-
const { runPlanner } = await import("./planner-
|
|
3040
|
+
const { runPlanner } = await import("./planner-s1iQQsjj.mjs");
|
|
3003
3041
|
return runPlanner(opts);
|
|
3004
3042
|
}
|
|
3005
3043
|
const parent = launchParent(opts.parent);
|
|
@@ -3542,8 +3580,21 @@ async function executeRun(a) {
|
|
|
3542
3580
|
for (const block of e.message?.content ?? []) if (block.type === "tool_use") {
|
|
3543
3581
|
status.tools += 1;
|
|
3544
3582
|
status.last = describeTool(block.name ?? "?", block.input);
|
|
3583
|
+
if (block.name === "Bash") status.sleepSec = parseSleepSecs(bashCommand(block.input));
|
|
3545
3584
|
} else if (block.type === "text" && (block.text ?? "").trim()) status.last = "says: " + shortText(block.text, 70);
|
|
3546
3585
|
saveStatus(logDir, status);
|
|
3586
|
+
} else if (e.type === "user") {
|
|
3587
|
+
const blocks = e.message?.content;
|
|
3588
|
+
if (Array.isArray(blocks)) {
|
|
3589
|
+
let sawResult = false;
|
|
3590
|
+
for (const block of blocks) {
|
|
3591
|
+
if (block.type !== "tool_result") continue;
|
|
3592
|
+
sawResult = true;
|
|
3593
|
+
status.consecFails = toolResultFailed(block) ? (status.consecFails ?? 0) + 1 : 0;
|
|
3594
|
+
status.sleepSec = null;
|
|
3595
|
+
}
|
|
3596
|
+
if (sawResult) saveStatus(logDir, status);
|
|
3597
|
+
}
|
|
3547
3598
|
} else if (e.type === "result") {
|
|
3548
3599
|
const tokens = usageContextTokens(e.usage);
|
|
3549
3600
|
if (e.is_compact) status.contextTokens = tokens ?? status.contextTokens;
|
|
@@ -4075,4 +4126,4 @@ function resultFromOutput(out) {
|
|
|
4075
4126
|
|
|
4076
4127
|
//#endregion
|
|
4077
4128
|
export { contextLabel as A, saveStatus as B, mergeWorker as C, UNLABELED as D, ledgerSummary as E, loadStatus as F, shortText as G, waitForTerminalStatus as H, loadStatuses as I, describeMcp as K, newWorkerId as L, elapsedOf as M, isChatPane as N, ageOf as O, isLive as P, nowStamp as R, discardWorker as S, appendLedger as T, longInlinePromptHint as U, setWorkerLabel as V, parseRunnerArgs as W, itermUuid as _, projectLaunchConfig as a, sessionTag as b, handoffFromInside as c, workerDepth as d, checkPaneForWorker as f, itermForClaudeSession as g, currentTabKey as h, usageContextTokens as i, contextPercent as j, alive as k, readInbox as l, openPaneForWorker as m, runWorker as n, parseWorkerReport as o, openFollowPane as p, expandMcpNames as q, testProvider as r, renderReport as s, printResult as t, sayToWorker as u, resolveSession as v, worktreesDir as w, workerInScope as x, sessionMapPath as y, ownsPid as z };
|
|
4078
|
-
//# sourceMappingURL=run-
|
|
4129
|
+
//# sourceMappingURL=run-9HbO1gTM.mjs.map
|