@tekmidian/pai 0.43.0 → 0.44.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.
Files changed (30) hide show
  1. package/dist/{chain-CEC1a5mX.mjs → chain-DAEC9AU7.mjs} +2 -2
  2. package/dist/{chain-CEC1a5mX.mjs.map → chain-DAEC9AU7.mjs.map} +1 -1
  3. package/dist/cli/index.mjs +4 -4
  4. package/dist/cli/program.mjs +4 -4
  5. package/dist/daemon/index.mjs +2 -2
  6. package/dist/{daemon-QIvCXB5f.mjs → daemon-BVbvL8IA.mjs} +2 -2
  7. package/dist/{daemon-BhldpFvO.mjs → daemon-ebLDoKM3.mjs} +2 -2
  8. package/dist/{daemon-BhldpFvO.mjs.map → daemon-ebLDoKM3.mjs.map} +1 -1
  9. package/dist/daemon-mcp/index.mjs +3 -3
  10. package/dist/{fallback-BQJ8PbCK.mjs → fallback-CxGDTXWt.mjs} +2 -2
  11. package/dist/{fallback-BQJ8PbCK.mjs.map → fallback-CxGDTXWt.mjs.map} +1 -1
  12. package/dist/hooks/load-project-context.mjs.map +1 -1
  13. package/dist/hooks/mcp-deferred-reminder.mjs.map +1 -1
  14. package/dist/{planner-BlKGgpWI.mjs → planner-B4DvNpXd.mjs} +3 -3
  15. package/dist/{planner-BlKGgpWI.mjs.map → planner-B4DvNpXd.mjs.map} +1 -1
  16. package/dist/{program-C5jRQ1kg.mjs → program-cr5U1-DK.mjs} +612 -54
  17. package/dist/program-cr5U1-DK.mjs.map +1 -0
  18. package/dist/{run-ByBKowN5.mjs → run-BgExF8Xg.mjs} +16 -4
  19. package/dist/{run-ByBKowN5.mjs.map → run-BgExF8Xg.mjs.map} +1 -1
  20. package/docs/commands/README.md +3 -1
  21. package/docs/commands/audit.md +25 -2
  22. package/package.json +1 -1
  23. package/src/hooks/ts/lib/context-fill.test.ts +40 -0
  24. package/src/hooks/ts/session-start/load-project-context.ts +3 -3
  25. package/src/hooks/ts/session-start/mcp-deferred-reminder.ts +2 -2
  26. package/src/hooks/ts/session-start/session-start-worker-guard.test.ts +0 -1
  27. package/dist/hooks/session-commands.mjs +0 -26
  28. package/dist/hooks/session-commands.mjs.map +0 -7
  29. package/dist/program-C5jRQ1kg.mjs.map +0 -1
  30. package/src/hooks/ts/session-start/session-commands.ts +0 -30
@@ -2612,6 +2612,18 @@ function shouldRetryReport(validation, noReportRetry, hasSession) {
2612
2612
  return !validation.ok && validation.validator === "aibroker" && !noReportRetry && hasSession;
2613
2613
  }
2614
2614
  /** Context window announced by the init event, when the endpoint sends one. */
2615
+ /**
2616
+ * Did the run end well? A headless run must have produced a stream-json
2617
+ * result event that is not an error; an interactive launch IS the chat pane
2618
+ * and never emits one, so its clean exit (rc 0) is the whole verdict —
2619
+ * without this every interactive session that ends normally was recorded
2620
+ * as `failed rc=0` and supervision pinged the spawner about a non-failure.
2621
+ */
2622
+ function runSucceeded(headless, rc, resultEvent) {
2623
+ if (rc !== 0) return false;
2624
+ if (!headless) return true;
2625
+ return resultEvent !== null && !resultEvent.is_error;
2626
+ }
2615
2627
  function initContextWindow(e) {
2616
2628
  if (typeof e.context_window === "number" && e.context_window > 0) return e.context_window;
2617
2629
  if (e.model_info && typeof e.model_info.context_window === "number" && e.model_info.context_window > 0) return e.model_info.context_window;
@@ -2628,7 +2640,7 @@ async function runWorker(opts) {
2628
2640
  const logDir = workersLogDir(config);
2629
2641
  mkdirSync(logDir, { recursive: true });
2630
2642
  if (opts.className === "plan" && !opts._planner) {
2631
- const { runPlanner } = await import("./planner-BlKGgpWI.mjs");
2643
+ const { runPlanner } = await import("./planner-B4DvNpXd.mjs");
2632
2644
  return runPlanner(opts);
2633
2645
  }
2634
2646
  const parent = launchParent(opts.parent);
@@ -3057,7 +3069,7 @@ async function executeRun(a) {
3057
3069
  cleanup();
3058
3070
  const secs = Math.floor((Date.now() - t0) / 1e3);
3059
3071
  const resultEvent = ctx.resultEvent;
3060
- const ok = rc === 0 && resultEvent !== null && !resultEvent.is_error;
3072
+ const ok = runSucceeded(headless, rc, resultEvent);
3061
3073
  status.state = ok ? "done" : "failed";
3062
3074
  status.rc = rc;
3063
3075
  status.secs = secs;
@@ -3526,5 +3538,5 @@ function resultFromOutput(out) {
3526
3538
  }
3527
3539
 
3528
3540
  //#endregion
3529
- export { loadStatuses as A, expandMcpNames as B, UNLABELED as C, contextPercent as D, contextLabel as E, waitForTerminalStatus as F, longInlinePromptHint as I, parseRunnerArgs as L, nowStamp as M, saveStatus as N, isChatPane as O, setWorkerLabel as P, shortText as R, ledgerSummary as S, alive as T, itermForClaudeSession as _, parseWorkerReport as a, workerInScope as b, mergeWorker as c, sayToWorker as d, workerDepth as f, currentTabKey as g, openPaneForWorker as h, usageContextTokens as i, newWorkerId as j, loadStatus as k, handoffFromInside as l, openFollowPane as m, runWorker as n, renderReport as o, checkPaneForWorker as p, testProvider as r, discardWorker as s, printResult as t, readInbox as u, resolveSession as v, ageOf as w, appendLedger as x, sessionTag as y, describeMcp as z };
3530
- //# sourceMappingURL=run-ByBKowN5.mjs.map
3541
+ export { loadStatus as A, describeMcp as B, ledgerSummary as C, contextLabel as D, alive as E, setWorkerLabel as F, waitForTerminalStatus as I, longInlinePromptHint as L, newWorkerId as M, nowStamp as N, contextPercent as O, saveStatus as P, parseRunnerArgs as R, appendLedger as S, ageOf as T, expandMcpNames as V, currentTabKey as _, projectLaunchConfig as a, sessionTag as b, discardWorker as c, readInbox as d, sayToWorker as f, openPaneForWorker as g, openFollowPane as h, usageContextTokens as i, loadStatuses as j, isChatPane as k, mergeWorker as l, checkPaneForWorker as m, runWorker as n, parseWorkerReport as o, workerDepth as p, testProvider as r, renderReport as s, printResult as t, handoffFromInside as u, itermForClaudeSession as v, UNLABELED as w, workerInScope as x, resolveSession as y, shortText as z };
3542
+ //# sourceMappingURL=run-BgExF8Xg.mjs.map