@tekmidian/pai 0.56.0 → 0.58.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-Cltx0NjY.mjs} +4 -4
- package/dist/{chain-26f7uGUs.mjs.map → chain-Cltx0NjY.mjs.map} +1 -1
- package/dist/cli/index.mjs +9 -9
- package/dist/cli/program.mjs +9 -9
- package/dist/{context-handover-cache-k2kWbE6G.mjs → context-handover-cache-Dt4HW1Ro.mjs} +3 -3
- package/dist/{context-handover-cache-k2kWbE6G.mjs.map → context-handover-cache-Dt4HW1Ro.mjs.map} +1 -1
- package/dist/daemon/index.mjs +7 -7
- package/dist/{daemon-BOWol-LF.mjs → daemon-B6hx1Ysz.mjs} +7 -7
- package/dist/{daemon-BsuM0UdV.mjs → daemon-CmqJfeb9.mjs} +75 -28
- package/dist/daemon-CmqJfeb9.mjs.map +1 -0
- package/dist/daemon-mcp/index.mjs +5 -5
- package/dist/{fallback-CVe3sb94.mjs → fallback-B_2ozQHw.mjs} +4 -4
- package/dist/{fallback-CVe3sb94.mjs.map → fallback-B_2ozQHw.mjs.map} +1 -1
- package/dist/hooks/worker-status-line.mjs +3 -0
- package/dist/hooks/worker-status-line.mjs.map +2 -2
- package/dist/{main-resolver-Dx-pxic1.mjs → main-resolver-DYNxxNwJ.mjs} +166 -12
- package/dist/main-resolver-DYNxxNwJ.mjs.map +1 -0
- package/dist/{main-resolver-uDtK9p6e.mjs → main-resolver-Df65bPAi.mjs} +2 -2
- package/dist/{planner-ye7wrrfB.mjs → planner-DsZZEZCA.mjs} +5 -5
- package/dist/{planner-ye7wrrfB.mjs.map → planner-DsZZEZCA.mjs.map} +1 -1
- package/dist/{program-DuC1RcaO.mjs → program-D-WkmvuQ.mjs} +23 -73
- package/dist/{program-DuC1RcaO.mjs.map → program-D-WkmvuQ.mjs.map} +1 -1
- package/dist/{run-CqRvXGjd.mjs → run-XaA-UPdW.mjs} +59 -4
- package/dist/run-XaA-UPdW.mjs.map +1 -0
- package/dist/{config-B93YS8tP.mjs → run-env-DyTWgZC9.mjs} +112 -3
- package/dist/run-env-DyTWgZC9.mjs.map +1 -0
- package/dist/{server-CGuZFOeR.mjs → server-CzqHGbKt.mjs} +4 -113
- package/dist/server-CzqHGbKt.mjs.map +1 -0
- package/dist/{session-keepalive-BQ6AQ9ez.mjs → session-keepalive-DDsEo81Q.mjs} +4 -4
- package/dist/{session-keepalive-BQ6AQ9ez.mjs.map → session-keepalive-DDsEo81Q.mjs.map} +1 -1
- package/dist/{work-queue-worker-DEbWsrDQ.mjs → work-queue-worker-BY7xn4pw.mjs} +4 -4
- package/dist/{work-queue-worker-DufMOtrL.mjs → work-queue-worker-DL9lu8sN.mjs} +2 -2
- package/dist/{work-queue-worker-DufMOtrL.mjs.map → work-queue-worker-DL9lu8sN.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/config-B93YS8tP.mjs.map +0 -1
- package/dist/daemon-BsuM0UdV.mjs.map +0 -1
- package/dist/main-resolver-Dx-pxic1.mjs.map +0 -1
- package/dist/run-CqRvXGjd.mjs.map +0 -1
- package/dist/server-CGuZFOeR.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as getRegistryBackend } from "./factory-DiuntvwG.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { _ as
|
|
2
|
+
import { D as resolveModelCapability, O as resolveProviderKey, T as readWorkersSection, h as classModelCapability, m as assertProviderRunnable, n as claudeCommand, p as WorkersConfigError, t as buildRunEnv, w as providerKeyPath, y as isModelCapability } from "./run-env-DyTWgZC9.mjs";
|
|
3
|
+
import { _ as statusPath, d as resolveTarget, f as setCooldown, g as panesDir, h as ledgerPath, i as capabilityForRun, m as eventsPath, n as ensureProxyRunning, o as isQuotaFailure, p as ensureNoMcpConfig, s as nextAutoProvider, t as DEFAULT_PROXY_PORT, u as resolveCapabilityRun, v as workersLogDir } from "./server-CzqHGbKt.mjs";
|
|
4
4
|
import { appendFileSync, closeSync, existsSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
5
5
|
import { homedir, tmpdir } from "node:os";
|
|
6
6
|
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
@@ -466,6 +466,24 @@ 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 `sleep N` (N plain or with an s/m/h/d suffix) that stands alone
|
|
474
|
+
* or leads a compound command (`sleep 150; cat f`, `sleep 2m && tail f`,
|
|
475
|
+
* `sleep 90 || true`, `sleep 60 &`), or null when no long sleep leads: anchored
|
|
476
|
+
* to the start of the command, so a filename containing "sleep" or an
|
|
477
|
+
* `echo sleep 500` never trips it, and floored at SLEEP_FLOOR_SECS so ordinary
|
|
478
|
+
* polling stays invisible.
|
|
479
|
+
*/
|
|
480
|
+
function parseSleepSecs(command) {
|
|
481
|
+
const m = command.match(SLEEP_RE);
|
|
482
|
+
if (!m) return null;
|
|
483
|
+
const mult = m[2] === "m" ? 60 : m[2] === "h" ? 3600 : m[2] === "d" ? 86400 : 1;
|
|
484
|
+
const secs = Number(m[1]) * mult;
|
|
485
|
+
return Number.isFinite(secs) && secs >= SLEEP_FLOOR_SECS ? secs : null;
|
|
486
|
+
}
|
|
469
487
|
/** One-line description of a tool call, e.g. "Bash: npm test". */
|
|
470
488
|
function describeTool(name, inp) {
|
|
471
489
|
if (typeof inp !== "object" || inp === null) return name;
|
|
@@ -2410,6 +2428,9 @@ function fullContractPrompt(format) {
|
|
|
2410
2428
|
"will pick something up later, never leave a background command as your final action. Finish, then",
|
|
2411
2429
|
"report.",
|
|
2412
2430
|
"No narration, no timestamps, no greetings, no summaries of what you read; act, verify, then stop.",
|
|
2431
|
+
"Never sleep-poll: no `sleep N` over 60 seconds, standalone or leading a compound command.",
|
|
2432
|
+
"Long builds and tests run in background with no arbitrary `timeout` — the task notification",
|
|
2433
|
+
"wakes you; read the output then. Wait on a bounded timeout or event instead.",
|
|
2413
2434
|
...fileNotInlineBlock(),
|
|
2414
2435
|
"",
|
|
2415
2436
|
`Operator messages: a user turn starting with ${OPERATOR_MARK} was typed by the operator while you`,
|
|
@@ -2895,6 +2916,27 @@ function resetContextTokensOnCompact(status, e) {
|
|
|
2895
2916
|
function isCompactBoundary(e) {
|
|
2896
2917
|
return e.type === "system" && (e.subtype === "compact_boundary" || e.subtype === "compact");
|
|
2897
2918
|
}
|
|
2919
|
+
/** The command string of a Bash tool_use input, "" when there is none. */
|
|
2920
|
+
function bashCommand(input) {
|
|
2921
|
+
if (typeof input === "object" && input !== null && typeof input.command === "string") return input.command;
|
|
2922
|
+
return "";
|
|
2923
|
+
}
|
|
2924
|
+
function toolResultText(content) {
|
|
2925
|
+
if (typeof content === "string") return content;
|
|
2926
|
+
if (Array.isArray(content)) return content.map((c) => typeof c === "object" && c !== null && typeof c.text === "string" ? c.text : "").join("\n");
|
|
2927
|
+
return "";
|
|
2928
|
+
}
|
|
2929
|
+
/**
|
|
2930
|
+
* Whether a tool_result block is a failed execution: the harness's own
|
|
2931
|
+
* is_error flag, or — the older Bash spelling — an "Exit code N" line with a
|
|
2932
|
+
* non-zero N in the result text. Feeds the consecFails counter supervision's
|
|
2933
|
+
* thrashing detector reads.
|
|
2934
|
+
*/
|
|
2935
|
+
function toolResultFailed(block) {
|
|
2936
|
+
if (block.is_error === true) return true;
|
|
2937
|
+
const m = toolResultText(block.content).match(/Exit code (\d+)/);
|
|
2938
|
+
return m !== null && Number(m[1]) !== 0;
|
|
2939
|
+
}
|
|
2898
2940
|
/**
|
|
2899
2941
|
* The model the init event announces, adopted into the status when the spawn
|
|
2900
2942
|
* could not name one (a caller that passed `--model` itself in the claude
|
|
@@ -2999,7 +3041,7 @@ async function runWorker(opts) {
|
|
|
2999
3041
|
const logDir = workersLogDir(config);
|
|
3000
3042
|
mkdirSync(logDir, { recursive: true });
|
|
3001
3043
|
if (opts.className === "plan" && !opts._planner) {
|
|
3002
|
-
const { runPlanner } = await import("./planner-
|
|
3044
|
+
const { runPlanner } = await import("./planner-DsZZEZCA.mjs");
|
|
3003
3045
|
return runPlanner(opts);
|
|
3004
3046
|
}
|
|
3005
3047
|
const parent = launchParent(opts.parent);
|
|
@@ -3542,8 +3584,21 @@ async function executeRun(a) {
|
|
|
3542
3584
|
for (const block of e.message?.content ?? []) if (block.type === "tool_use") {
|
|
3543
3585
|
status.tools += 1;
|
|
3544
3586
|
status.last = describeTool(block.name ?? "?", block.input);
|
|
3587
|
+
if (block.name === "Bash") status.sleepSec = parseSleepSecs(bashCommand(block.input));
|
|
3545
3588
|
} else if (block.type === "text" && (block.text ?? "").trim()) status.last = "says: " + shortText(block.text, 70);
|
|
3546
3589
|
saveStatus(logDir, status);
|
|
3590
|
+
} else if (e.type === "user") {
|
|
3591
|
+
const blocks = e.message?.content;
|
|
3592
|
+
if (Array.isArray(blocks)) {
|
|
3593
|
+
let sawResult = false;
|
|
3594
|
+
for (const block of blocks) {
|
|
3595
|
+
if (block.type !== "tool_result") continue;
|
|
3596
|
+
sawResult = true;
|
|
3597
|
+
status.consecFails = toolResultFailed(block) ? (status.consecFails ?? 0) + 1 : 0;
|
|
3598
|
+
status.sleepSec = null;
|
|
3599
|
+
}
|
|
3600
|
+
if (sawResult) saveStatus(logDir, status);
|
|
3601
|
+
}
|
|
3547
3602
|
} else if (e.type === "result") {
|
|
3548
3603
|
const tokens = usageContextTokens(e.usage);
|
|
3549
3604
|
if (e.is_compact) status.contextTokens = tokens ?? status.contextTokens;
|
|
@@ -4075,4 +4130,4 @@ function resultFromOutput(out) {
|
|
|
4075
4130
|
|
|
4076
4131
|
//#endregion
|
|
4077
4132
|
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-
|
|
4133
|
+
//# sourceMappingURL=run-XaA-UPdW.mjs.map
|