@tekmidian/pai 1.0.2 → 1.0.4

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 (96) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/dist/{auto-route-B4azPk4l.mjs → auto-route-21GdHL70.mjs} +2 -2
  3. package/dist/auto-route-C3S2W3Bc.mjs +11 -0
  4. package/dist/{budget-Dod6rnA9.mjs → budget-BrloTOZW.mjs} +1 -1
  5. package/dist/{chain-D-yvET_y.mjs → chain-D7PFur8Y.mjs} +2 -2
  6. package/dist/cli/index.mjs +82 -198
  7. package/dist/{cockpit-actions-BWunx3rY.mjs → cockpit-actions-BfRMr2sm.mjs} +6 -6
  8. package/dist/{cockpit-actions-C8GlTzts.mjs → cockpit-actions-OodH_vx_.mjs} +20 -18
  9. package/dist/{cockpit-memory-vTlFWV7F.mjs → cockpit-memory-teG9M8bG.mjs} +6 -6
  10. package/dist/config/defaults/config.yaml +6 -0
  11. package/dist/{controls-BcKFHeG1.mjs → controls-JLm6g0yP.mjs} +7 -5
  12. package/dist/daemon/index.mjs +23 -23
  13. package/dist/daemon-DeYImF1F.mjs +45 -0
  14. package/dist/daemon-mcp/index.mjs +21 -21
  15. package/dist/{daemon-ColVHwGZ.mjs → daemon-nXanenDM.mjs} +23 -19
  16. package/dist/{detect-9CZNO0yf.mjs → detect-BLKsUOgG.mjs} +2 -2
  17. package/dist/{detect-D1ziFFfA.mjs → detect-Rrimh0xc.mjs} +3 -3
  18. package/dist/{embed-pass-DIWjA68P.mjs → embed-pass-e64AwDCa.mjs} +1 -1
  19. package/dist/{endreason-C577xIQz.mjs → endreason-BC-v05H_.mjs} +17 -3
  20. package/dist/{factory-DjAAsqr_.mjs → factory-B7nv75rC.mjs} +2 -2
  21. package/dist/{factory-Bsib-qDG.mjs → factory-Bs9imVMq.mjs} +2 -2
  22. package/dist/{fallback-DFlItw1Z.mjs → fallback-CBWpp2F2.mjs} +227 -5
  23. package/dist/{health-Dnym-qcT.mjs → health-C4FQmkJn.mjs} +2 -2
  24. package/dist/{helpers-BD6V-p9w.mjs → helpers-DSNK_1KP.mjs} +2 -2
  25. package/dist/{helpers-CMGjy_0N.mjs → helpers-Dz7mjTSw.mjs} +3 -3
  26. package/dist/hooks/capture-all-events.mjs +21 -2
  27. package/dist/hooks/capture-tool-output.mjs +21 -2
  28. package/dist/hooks/worker-pool-host.mjs +167 -124
  29. package/dist/hooks/worker-status-line.mjs +34 -6
  30. package/dist/index.mjs +4 -4
  31. package/dist/{indexer-backend-_a6UNhXJ.mjs → indexer-backend-BdjeL4P8.mjs} +32 -229
  32. package/dist/{ipc-client-CaiGJnSM.mjs → ipc-client-CnYEF31R.mjs} +1 -1
  33. package/dist/{ipc-client-ZRmDKd5Z.mjs → ipc-client-DN7EvoVo.mjs} +1 -1
  34. package/dist/{kill-tree-EWYaEk5v.mjs → kill-tree-DleMNZX3.mjs} +2 -2
  35. package/dist/{kill-tree-BG7dRVtp.mjs → kill-tree-SV6hrIa3.mjs} +2 -2
  36. package/dist/{launch-Jh5NVeNe.mjs → launch-Di7N-J5X.mjs} +2 -2
  37. package/dist/{launch-CXVlZjHt.mjs → launch-DlZTKE3u.mjs} +2 -2
  38. package/dist/{main-config-ops-BEMpuhDz.mjs → main-config-ops-kTXR8Pyv.mjs} +1 -1
  39. package/dist/{main-resolver-3Ns1HPmS.mjs → main-resolver-yp_puSSb.mjs} +5 -5
  40. package/dist/{model-inventory-BFVSNFT3.mjs → model-inventory-h6Z9fN_o.mjs} +1 -1
  41. package/dist/{models-add-BtB3Se6f.mjs → models-add-TVni3A7V.mjs} +22 -22
  42. package/dist/{pai-marker-DurzIbw8.mjs → pai-marker-BcZyJguM.mjs} +2 -2
  43. package/dist/{pane-audit-BQytYa60.mjs → pane-audit-Lqy9N_Ki.mjs} +23 -5
  44. package/dist/{planner-BM27GBfC.mjs → planner-j77ndkBf.mjs} +14 -14
  45. package/dist/{pool-BRvoOkv6.mjs → pool-Dh-q3iJi.mjs} +43 -4
  46. package/dist/{pool-cli-B_YR8_Gl.mjs → pool-cli-BggU8GRp.mjs} +2 -2
  47. package/dist/{pool-cli-DkZTAlSW.mjs → pool-cli-DQ6OzRy2.mjs} +2 -2
  48. package/dist/{postgres-BdBNkL_l.mjs → postgres-BK4FP9Zg.mjs} +1 -1
  49. package/dist/{postgres-C6ti4haA.mjs → postgres-DNIOQijl.mjs} +17 -7
  50. package/dist/{project-setup-CfpApz5o.mjs → project-setup-CBRtFFh0.mjs} +16 -236
  51. package/dist/{providers-CblTFrhz.mjs → providers-C9QC0TtO.mjs} +2 -2
  52. package/dist/{providers-BeDiVEb-.mjs → providers-FvCLzFge.mjs} +2 -2
  53. package/dist/{query-feedback-BRfPtqki.mjs → query-feedback-DN52N9C5.mjs} +1 -1
  54. package/dist/{registrable-C7b6givx.mjs → registrable-BzH4TObg.mjs} +3 -3
  55. package/dist/{registrable-Uzgmfyhz.mjs → registrable-DpyTtajg.mjs} +2 -2
  56. package/dist/{render-Cc2j5QG9.mjs → render-B35bQTE-.mjs} +4 -4
  57. package/dist/{render-CwIrgxLi.mjs → render-C84BqQRC.mjs} +3 -3
  58. package/dist/{root-BWy0c2Lq.mjs → root-C4oXlXS_.mjs} +7 -7
  59. package/dist/{root-wC_6Fx0B.mjs → root-DD1xx_Vu.mjs} +16 -16
  60. package/dist/route-table-FEfDuhIV.mjs +15 -0
  61. package/dist/{routing-BAAST9vT.mjs → routing-DmkheCRH.mjs} +126 -8
  62. package/dist/{routing-CENt4HH1.mjs → routing-f2zulGwD.mjs} +1 -1
  63. package/dist/{run-6Q9kCPem.mjs → run-BwZKBJZZ.mjs} +28 -14
  64. package/dist/{scan-ZQWm-_se.mjs → scan-BBGvU5EB.mjs} +4 -4
  65. package/dist/{session-Bok2PqRS.mjs → session-BAhtXdxj.mjs} +15 -15
  66. package/dist/{session-DVUExUnX.mjs → session-Dn5OJXlg.mjs} +23 -23
  67. package/dist/{session-scan-BJI_ZO8M.mjs → session-scan-B57dNuA4.mjs} +1 -1
  68. package/dist/{session-scan-W-gbwJHM.mjs → session-scan-DUn10MBd.mjs} +2 -2
  69. package/dist/session-usage-CPvXvSkw.mjs +222 -0
  70. package/dist/{sources-ESUkZaWv.mjs → sources-CiE3rZek.mjs} +1 -1
  71. package/dist/{viewer-MWBVJP3u.mjs → viewer-DEySE4c_.mjs} +8 -8
  72. package/dist/{viewer-DcpJwGKE.mjs → viewer-wfKnvnrI.mjs} +6 -6
  73. package/dist/{worker-config-gmAq_-rI.mjs → worker-config-CO5FXLAT.mjs} +21 -21
  74. package/dist/{worker-config-BDYNxbYz.mjs → worker-config-eY5Qy4vl.mjs} +322 -25
  75. package/dist/{worktree-CrnOqTBW.mjs → worktree-CRs2gyg0.mjs} +2 -2
  76. package/dist/{zettelkasten-BzMm8REH.mjs → zettelkasten-_h_tUm2T.mjs} +1 -1
  77. package/dist/{zettelkasten-B_rRRRvD.mjs → zettelkasten-tpCRBYvH.mjs} +2 -2
  78. package/docs/cockpit.md +1 -0
  79. package/docs/images/architecture.png +0 -0
  80. package/gemini-extension.json +1 -1
  81. package/package.json +1 -1
  82. package/pai-plugin.json +1 -1
  83. package/plugins/context-preservation/plugin.json +1 -1
  84. package/plugins/core/plugin.json +1 -1
  85. package/plugins/creative/plugin.json +1 -1
  86. package/plugins/observability/plugin.json +1 -1
  87. package/plugins/productivity/plugin.json +1 -1
  88. package/plugins/semantic-search/plugin.json +1 -1
  89. package/plugins/ui/plugin.json +1 -1
  90. package/plugins/zettelkasten/plugin.json +1 -1
  91. package/src/hooks/ts/capture-all-events.ts +15 -3
  92. package/src/hooks/ts/lib/raw-capture.ts +7 -0
  93. package/src/hooks/ts/post-tool-use/capture-tool-output.ts +13 -3
  94. package/dist/auto-route-BjoMHKyI.mjs +0 -11
  95. package/dist/daemon-N7WhYi6I.mjs +0 -45
  96. package/dist/route-table-B7zpoypi.mjs +0 -15
@@ -1,6 +1,6 @@
1
1
  import { j as readWorkersSection } from "./config-XpZWOYOG.mjs";
2
2
  import { u as workersLogDir } from "./paths-CHifubDh.mjs";
3
- import { w as worktreesDir } from "./worktree-CrnOqTBW.mjs";
3
+ import { w as worktreesDir } from "./worktree-CRs2gyg0.mjs";
4
4
  import { existsSync, readFileSync, statSync } from "node:fs";
5
5
  import { dirname, resolve, sep } from "node:path";
6
6
 
@@ -140,4 +140,4 @@ async function reportUnregistrable(backend, worktreesRoot = workerWorktreesRoot(
140
140
 
141
141
  //#endregion
142
142
  export { unregistrableReason as a, reportUnregistrable as i, mainRepoOf as n, workerWorktreesRoot as o, pruneWorktreeProjects as r, worktreeReason as s, isLinkedWorktree as t };
143
- //# sourceMappingURL=registrable-Uzgmfyhz.mjs.map
143
+ //# sourceMappingURL=registrable-DpyTtajg.mjs.map
@@ -1,13 +1,13 @@
1
1
  import "./config-XpZWOYOG.mjs";
2
2
  import "./config-Bu1_vbY8.mjs";
3
3
  import "./paths-CHifubDh.mjs";
4
- import "./worktree-CrnOqTBW.mjs";
4
+ import "./worktree-CRs2gyg0.mjs";
5
5
  import "./status-ggJ7lgVg.mjs";
6
- import "./pool-BRvoOkv6.mjs";
6
+ import "./pool-Dh-q3iJi.mjs";
7
7
  import "./scope-D-h6F6DN.mjs";
8
8
  import { D as fmtElapsed } from "./wait-ByV0OyMZ.mjs";
9
9
  import "./capacity-DEveQdFV.mjs";
10
- import "./endreason-C577xIQz.mjs";
11
- import { S as warmupText, _ as renderTable, a as fullLines, b as tickerTool, c as headerLine, d as paneRunStatusRow, f as paneStatusRow, g as renderStatusLine, h as renderEvent, i as dayOf, l as intentOf, m as relPath, n as clockOf, o as goalOf, p as providerTag, r as contextMeter, s as gutterFor, t as blankBetween, u as makeColor, v as shortModel, x as unifiedDiffLines, y as tickerText } from "./render-CwIrgxLi.mjs";
10
+ import "./endreason-BC-v05H_.mjs";
11
+ import { S as warmupText, _ as renderTable, a as fullLines, b as tickerTool, c as headerLine, d as paneRunStatusRow, f as paneStatusRow, g as renderStatusLine, h as renderEvent, i as dayOf, l as intentOf, m as relPath, n as clockOf, o as goalOf, p as providerTag, r as contextMeter, s as gutterFor, t as blankBetween, u as makeColor, v as shortModel, x as unifiedDiffLines, y as tickerText } from "./render-C84BqQRC.mjs";
12
12
 
13
13
  export { makeColor };
@@ -1,10 +1,10 @@
1
1
  import { j as readWorkersSection, p as getProviderOrNative, t as ANTHROPIC_NATIVE, v as nativeAnthropicModels } from "./config-XpZWOYOG.mjs";
2
- import { _ as ownedTree } from "./worktree-CrnOqTBW.mjs";
2
+ import { _ as ownedTree } from "./worktree-CRs2gyg0.mjs";
3
3
  import { a as UNLABELED, c as contextFooter, f as elapsedOf, g as isLive, h as isChatPane, k as saveStatus, l as contextLabel, nt as shortText, o as ageOf, u as contextPercent, v as loadStatus, y as loadStatuses } from "./status-ggJ7lgVg.mjs";
4
4
  import { p as currentWorkerId, u as sessionTag } from "./scope-D-h6F6DN.mjs";
5
5
  import { A as waitOnCallLine, E as detachedLine, M as waitingLine, d as parseWorkerReport, j as waitOnResultLine, k as realWaitDeps, n as bashExitCode, p as renderReport, t as WAIT_EXIT_STILL_RUNNING } from "./wait-ByV0OyMZ.mjs";
6
6
  import { c as queuedText, f as sessionOf } from "./capacity-DEveQdFV.mjs";
7
- import { a as endLabel } from "./endreason-C577xIQz.mjs";
7
+ import { a as endLabel } from "./endreason-BC-v05H_.mjs";
8
8
  import { mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
9
9
  import { basename, join, relative } from "node:path";
10
10
 
@@ -900,4 +900,4 @@ function paneRunStatusRow(label, startedMs, now = /* @__PURE__ */ new Date()) {
900
900
 
901
901
  //#endregion
902
902
  export { resolveLimit as A, denialLines as C, deadlineLabel as D, armDeadline as E, checkOrphanedChildren as F, isWorkerId as I, launchParent as L, blockedMsOf as M, endBuildWait as N, deadlinePromptLine as O, assertChildAllowed as P, parentFromEnv as R, warmupText as S, recordDenial as T, renderTable as _, fullLines as a, tickerTool as b, headerLine as c, paneRunStatusRow as d, paneStatusRow as f, renderStatusLine as g, renderEvent as h, dayOf as i, beginBuildWait as j, extendLimit as k, intentOf as l, relPath as m, clockOf as n, goalOf as o, providerTag as p, contextMeter as r, gutterFor as s, blankBetween as t, makeColor as u, shortModel as v, parseDenialText as w, unifiedDiffLines as x, tickerText as y };
903
- //# sourceMappingURL=render-CwIrgxLi.mjs.map
903
+ //# sourceMappingURL=render-C84BqQRC.mjs.map
@@ -1,12 +1,12 @@
1
1
  import { b as nativeOrchestratorModel, j as readWorkersSection, p as getProviderOrNative, t as ANTHROPIC_NATIVE } from "./config-XpZWOYOG.mjs";
2
2
  import { u as workersLogDir } from "./paths-CHifubDh.mjs";
3
3
  import { d as terminalHasName } from "./scope-D-h6F6DN.mjs";
4
- import { Dn as httpModelsCheck, En as findSetup, Fn as workersLabel, Mn as setupWorkersLabel, On as loadSaved, Pn as shortModel, Tn as downLocalProviders, bn as resolveLocalProvider, cn as getProfile, dn as updateProfile, jn as setupProfile, kn as orchestratorLabel, o as cooldownRemaining, sn as SESSION_NAME_ENV, wn as allSetups, x as SESSION_WORKER_PROVIDER_ENV } from "./routing-BAAST9vT.mjs";
4
+ import { An as findSetup, Fn as setupProfile, In as setupWorkersLabel, Mn as loadSaved, Nn as orchestratorLabel, On as allSetups, Rn as shortModel, dn as SESSION_NAME_ENV, fn as getProfile, hn as updateProfile, jn as httpModelsCheck, kn as downLocalProviders, o as cooldownRemaining, wn as resolveLocalProvider, x as SESSION_WORKER_PROVIDER_ENV, zn as workersLabel } from "./routing-DmkheCRH.mjs";
5
5
  import { n as OPT, t as CliError } from "./define-CjJsmq-6.mjs";
6
- import { C as assertAvailable, D as execHarness, E as dryRunText, O as looksLikePath, T as buildHarness, k as prepareDir, r as collectView, w as modelFor } from "./session-DVUExUnX.mjs";
7
- import { o as launchableProviderNames, t as LaunchError } from "./launch-Jh5NVeNe.mjs";
8
- import { a as colorEnabled, f as renderTable, n as readBudget, o as makeStyle, p as suggest, t as providerHealth } from "./health-Dnym-qcT.mjs";
9
- import { i as probeResume } from "./launch-CXVlZjHt.mjs";
6
+ import { C as assertAvailable, D as execHarness, E as dryRunText, O as looksLikePath, T as buildHarness, k as prepareDir, r as collectView, w as modelFor } from "./session-Dn5OJXlg.mjs";
7
+ import { o as launchableProviderNames, t as LaunchError } from "./launch-Di7N-J5X.mjs";
8
+ import { a as colorEnabled, f as renderTable, n as readBudget, o as makeStyle, p as suggest, t as providerHealth } from "./health-C4FQmkJn.mjs";
9
+ import { i as probeResume } from "./launch-DlZTKE3u.mjs";
10
10
  import { writeFileSync } from "node:fs";
11
11
  import { basename } from "node:path";
12
12
  import { emitKeypressEvents } from "node:readline";
@@ -683,7 +683,7 @@ async function runRoot(args, term = systemTerm()) {
683
683
  with: args.with,
684
684
  dryRun: args.dryRun
685
685
  }, term);
686
- return (await import("./session-Bok2PqRS.mjs")).runNewDefault({
686
+ return (await import("./session-BAhtXdxj.mjs")).runNewDefault({
687
687
  dir: args.name,
688
688
  dryRun: args.dryRun
689
689
  });
@@ -791,4 +791,4 @@ const rootCommand = {
791
791
 
792
792
  //#endregion
793
793
  export { setupsTable as _, lastSetup as a, truncate as b, localState as c, pickerOpts as d, plainTable as f, runRoot as g, runNewWith as h, lastOnLabel as i, matchRows as l, rootCommand as m, ago as n, launchKey as o, resolveSetup as p, finishCd as r, launchScreen as s, CANCELLED as t, pickerLayout as u, startSession as v, systemTerm as y };
794
- //# sourceMappingURL=root-BWy0c2Lq.mjs.map
794
+ //# sourceMappingURL=root-C4oXlXS_.mjs.map
@@ -3,14 +3,14 @@ import "./migrate-DrA_OwlZ.mjs";
3
3
  import "./config-XpZWOYOG.mjs";
4
4
  import "./config-Bu1_vbY8.mjs";
5
5
  import "./paths-CHifubDh.mjs";
6
- import "./worktree-CrnOqTBW.mjs";
6
+ import "./worktree-CRs2gyg0.mjs";
7
7
  import "./status-ggJ7lgVg.mjs";
8
- import "./pool-BRvoOkv6.mjs";
9
- import "./registrable-Uzgmfyhz.mjs";
10
- import "./pai-marker-DurzIbw8.mjs";
8
+ import "./pool-Dh-q3iJi.mjs";
9
+ import "./registrable-DpyTtajg.mjs";
10
+ import "./pai-marker-BcZyJguM.mjs";
11
11
  import "./helpers-CRuBUas3.mjs";
12
12
  import "./scope-D-h6F6DN.mjs";
13
- import "./routing-BAAST9vT.mjs";
13
+ import "./routing-DmkheCRH.mjs";
14
14
  import "./tool-errors-7E13StWd.mjs";
15
15
  import "./wait-ByV0OyMZ.mjs";
16
16
  import "./local-tiers-BE4jGaMa.mjs";
@@ -18,19 +18,19 @@ import "./caller-identity-yLFb7CKq.mjs";
18
18
  import "./capacity-DEveQdFV.mjs";
19
19
  import "./local-instances-DOxSgT_L.mjs";
20
20
  import "./local-candidate-DLdwQt0s.mjs";
21
- import "./factory-DjAAsqr_.mjs";
22
- import "./postgres-C6ti4haA.mjs";
21
+ import "./factory-B7nv75rC.mjs";
22
+ import "./postgres-DNIOQijl.mjs";
23
23
  import "./embedding-gate-6rZrWRXa.mjs";
24
24
  import "./embeddings-BVq3esBF.mjs";
25
25
  import "./router-CQSc3lk3.mjs";
26
- import "./detect-9CZNO0yf.mjs";
27
- import "./helpers-BD6V-p9w.mjs";
28
- import "./scan-ZQWm-_se.mjs";
29
- import "./session-DVUExUnX.mjs";
30
- import "./launch-Jh5NVeNe.mjs";
31
- import "./health-Dnym-qcT.mjs";
32
- import "./launch-CXVlZjHt.mjs";
33
- import { _ as setupsTable, a as lastSetup, b as truncate, c as localState, d as pickerOpts, f as plainTable, g as runRoot, h as runNewWith, i as lastOnLabel, l as matchRows, m as rootCommand, n as ago, o as launchKey, p as resolveSetup, r as finishCd, s as launchScreen, t as CANCELLED, u as pickerLayout, v as startSession, y as systemTerm } from "./root-BWy0c2Lq.mjs";
34
- import "./session-scan-W-gbwJHM.mjs";
26
+ import "./detect-BLKsUOgG.mjs";
27
+ import "./helpers-DSNK_1KP.mjs";
28
+ import "./scan-BBGvU5EB.mjs";
29
+ import "./session-Dn5OJXlg.mjs";
30
+ import "./launch-Di7N-J5X.mjs";
31
+ import "./health-C4FQmkJn.mjs";
32
+ import "./launch-DlZTKE3u.mjs";
33
+ import { _ as setupsTable, a as lastSetup, b as truncate, c as localState, d as pickerOpts, f as plainTable, g as runRoot, h as runNewWith, i as lastOnLabel, l as matchRows, m as rootCommand, n as ago, o as launchKey, p as resolveSetup, r as finishCd, s as launchScreen, t as CANCELLED, u as pickerLayout, v as startSession, y as systemTerm } from "./root-C4oXlXS_.mjs";
34
+ import "./session-scan-DUn10MBd.mjs";
35
35
 
36
36
  export { runNewWith };
@@ -0,0 +1,15 @@
1
+ import "./config-XpZWOYOG.mjs";
2
+ import "./config-Bu1_vbY8.mjs";
3
+ import "./paths-CHifubDh.mjs";
4
+ import "./status-ggJ7lgVg.mjs";
5
+ import "./scope-D-h6F6DN.mjs";
6
+ import { Bt as parseSelector, Ft as applyPolicyToRoutes, Gt as routeText, Ht as resolveSessionArg, It as clearSessionRoute, Jt as sessionStartTarget, Kt as servingChip, Lt as configuredLocal, Pt as TIGHT_PERCENT, Qt as validateRoute, Rt as entryLabel, Ut as routeChoices, Vt as resolveSelector, Wt as routeRows, Xt as setSessionRoute, Yt as setRoute, Zt as tierFlow, qt as sessionRoutesPatch, zt as flowText } from "./routing-DmkheCRH.mjs";
7
+ import "./tool-errors-7E13StWd.mjs";
8
+ import "./wait-ByV0OyMZ.mjs";
9
+ import "./local-tiers-BE4jGaMa.mjs";
10
+ import "./caller-identity-yLFb7CKq.mjs";
11
+ import "./capacity-DEveQdFV.mjs";
12
+ import "./local-instances-DOxSgT_L.mjs";
13
+ import "./local-candidate-DLdwQt0s.mjs";
14
+
15
+ export { setRoute };
@@ -1,6 +1,6 @@
1
1
  import { g as paiHomePath, h as paiHomeDir } from "./runtime-paths-WsO9sJFc.mjs";
2
2
  import { t as writeFileAtomic } from "./atomic-file-BorMa4T3.mjs";
3
- import { A as providerQuotaSkipAt, F as writeWorkersSection, L as isLoopbackHostname, M as resolveCapability, N as resolveModelCapability, O as providerCostTier, P as resolveProviderKey, R as isLoopbackUrl$1, at as MAX_ROUTE_MODELS, b as nativeOrchestratorModel, c as WorkersConfigError, ct as entryProvider, dt as migrateSessionRoutes, ft as parseEntry, j as readWorkersSection, lt as findTier, m as isLocalProvider, mt as targetList, p as getProviderOrNative, pt as sessionTier, s as WORKER_CLASSES, st as classRoute, t as ANTHROPIC_NATIVE, tt as workersYamlPath, u as classModelCapability, ut as listForPolicy, vt as stripModelVariant, y as nativeAnthropicProvider, z as loopbackUrl$1 } from "./config-XpZWOYOG.mjs";
3
+ import { A as providerQuotaSkipAt, F as writeWorkersSection, I as LOOPBACK_HOST, L as isLoopbackHostname, M as resolveCapability, N as resolveModelCapability, O as providerCostTier, P as resolveProviderKey, R as isLoopbackUrl$1, at as MAX_ROUTE_MODELS, b as nativeOrchestratorModel, c as WorkersConfigError, ct as entryProvider, dt as migrateSessionRoutes, ft as parseEntry, j as readWorkersSection, lt as findTier, m as isLocalProvider, mt as targetList, p as getProviderOrNative, pt as sessionTier, s as WORKER_CLASSES, st as classRoute, t as ANTHROPIC_NATIVE, tt as workersYamlPath, u as classModelCapability, ut as listForPolicy, vt as stripModelVariant, y as nativeAnthropicProvider, z as loopbackUrl$1 } from "./config-XpZWOYOG.mjs";
4
4
  import { c as loadConfig, f as readMainConfigRaw } from "./config-Bu1_vbY8.mjs";
5
5
  import { s as routingStatePath, u as workersLogDir } from "./paths-CHifubDh.mjs";
6
6
  import { g as isLive, v as loadStatus, y as loadStatuses } from "./status-ggJ7lgVg.mjs";
@@ -12,11 +12,11 @@ import { a as newPrefill, c as schedEnabled, f as sharedScheduler } from "./sche
12
12
  import { i as effectiveCap } from "./capacity-DEveQdFV.mjs";
13
13
  import { i as instanceNumber, l as readInstances, r as instanceEngineKey, s as pickInstance, t as endpointRegistry, u as readLiveInstances } from "./local-instances-DOxSgT_L.mjs";
14
14
  import { c as writeLocalStatus, n as tierProviderNames, r as LOCAL_STATUS_REFRESH_MS, s as readLocalStatus, t as isLocalCandidate } from "./local-candidate-DLdwQt0s.mjs";
15
- import { t as LOCAL_PROBE_TIMEOUT_MS } from "./timeouts-1MLooEBB.mjs";
15
+ import { n as TAILSCALE_STATUS_TIMEOUT_MS, t as LOCAL_PROBE_TIMEOUT_MS } from "./timeouts-1MLooEBB.mjs";
16
16
  import { appendFileSync, chmodSync, closeSync, existsSync, fstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, readdirSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
17
- import { createHash } from "node:crypto";
17
+ import { createHash, randomBytes } from "node:crypto";
18
18
  import { delimiter, dirname, join } from "node:path";
19
- import { homedir, tmpdir } from "node:os";
19
+ import { homedir, networkInterfaces, tmpdir } from "node:os";
20
20
  import { execFile, execFileSync, spawnSync } from "node:child_process";
21
21
  import { parse, stringify } from "yaml";
22
22
  import http from "node:http";
@@ -1664,7 +1664,7 @@ function currentSessionName(env = process.env) {
1664
1664
  */
1665
1665
  async function registryProjectName(cwd) {
1666
1666
  try {
1667
- const { detectProject } = await import("./detect-D1ziFFfA.mjs");
1667
+ const { detectProject } = await import("./detect-Rrimh0xc.mjs");
1668
1668
  return (await detectProject(cwd))?.display_name || void 0;
1669
1669
  } catch {
1670
1670
  return;
@@ -1690,7 +1690,7 @@ async function detectSessionName(env = process.env, deps = {}) {
1690
1690
  let name;
1691
1691
  const registry = deps.registryPath ?? AIBROKER_REGISTRY;
1692
1692
  const claudeId = env.CLAUDE_CODE_SESSION_ID?.trim();
1693
- const { loadBrokerNames, transcriptCustomTitle } = await import("./session-scan-BJI_ZO8M.mjs");
1693
+ const { loadBrokerNames, transcriptCustomTitle } = await import("./session-scan-B57dNuA4.mjs");
1694
1694
  name = resolveSession(env.ITERM_SESSION_ID ?? "", registry)?.name ?? (claudeId ? loadBrokerNames(registry, deps.mapPath).get(claudeId) ?? transcriptCustomTitle(claudeId, deps.projectsDir) : void 0) ?? await (deps.projectName ?? registryProjectName)(cwd);
1695
1695
  cached = {
1696
1696
  key,
@@ -2380,6 +2380,105 @@ function isTailnetOrLocalName(hostname) {
2380
2380
  return hostname.endsWith(".ts.net") || /^[a-z0-9-]+$/i.test(hostname) && !/^\d+$/.test(hostname);
2381
2381
  }
2382
2382
 
2383
+ //#endregion
2384
+ //#region src/router/cockpit-auth.ts
2385
+ /** The /v1 remote rule: loopback (any 127/8, ::1, v4-mapped) or the tailnet. */
2386
+ function defaultV1Guard(remoteAddress) {
2387
+ return isLoopbackAddress(remoteAddress) || inTailscaleRange(remoteAddress);
2388
+ }
2389
+ /** Strip the ::ffff: IPv4-mapped prefix (Node reports v4 peers this way on v6 sockets). */
2390
+ function normalizeIp(ip) {
2391
+ const a = (ip ?? "").trim().toLowerCase();
2392
+ return a.startsWith("::ffff:") ? a.slice(7) : a;
2393
+ }
2394
+ function isLoopbackAddress(ip) {
2395
+ const a = normalizeIp(ip);
2396
+ return a === "::1" || a.startsWith("127.");
2397
+ }
2398
+ function ipv4ToInt(ip) {
2399
+ const parts = ip.split(".");
2400
+ if (parts.length !== 4) return null;
2401
+ let out = 0;
2402
+ for (const p of parts) {
2403
+ if (!/^\d{1,3}$/.test(p)) return null;
2404
+ const n = Number(p);
2405
+ if (n > 255) return null;
2406
+ out = out * 256 + n;
2407
+ }
2408
+ return out;
2409
+ }
2410
+ function inTailscaleRange(ip) {
2411
+ const n = ipv4ToInt(normalizeIp(ip));
2412
+ if (n === null) return false;
2413
+ return (n & 4290772992) === 1681915904;
2414
+ }
2415
+ /**
2416
+ * router.bind → a concrete address. "loopback" (also empty/unset) is
2417
+ * 127.0.0.1; "tailscale" resolves the utun/tailscale interface's IPv4 inside
2418
+ * 100.64.0.0/10 (null when Tailscale is down); anything else must be a dotted
2419
+ * quad — 0.0.0.0 and every non-IPv4 value are refused (null).
2420
+ */
2421
+ function resolveBindAddress(bind, interfaces = networkInterfaces) {
2422
+ const v = (bind ?? "").trim().toLowerCase();
2423
+ if (!v || v === "loopback") return LOOPBACK_HOST;
2424
+ if (v === "tailscale") {
2425
+ let fallback;
2426
+ for (const [name, addrs] of Object.entries(interfaces() ?? {})) for (const a of addrs ?? []) {
2427
+ if (a.family !== "IPv4" && a.family !== 4) continue;
2428
+ if (!inTailscaleRange(a.address)) continue;
2429
+ if (/^(utun|tailscale)/i.test(name)) return a.address;
2430
+ fallback ??= a.address;
2431
+ }
2432
+ return fallback ?? null;
2433
+ }
2434
+ if (v === "0.0.0.0" || v === "::" || v === "*") return null;
2435
+ return ipv4ToInt(v) !== null ? v : null;
2436
+ }
2437
+ function isCockpitPath(path) {
2438
+ return path === "/cockpit" || path.startsWith("/cockpit/") || path.startsWith("/api/session/");
2439
+ }
2440
+ /**
2441
+ * DNS-rebinding check on the Host header. Allowed: `127.0.0.1[:port]`,
2442
+ * `localhost[:port]`, `[::1][:port]`, the bind address itself (loopback when
2443
+ * `bind` is empty/"loopback"), and any entry of `extraHosts` (tailnet names;
2444
+ * router.allowedHosts in config.yaml). A missing or unparsable Host is
2445
+ * rejected — non-browser clients always send one, so accepting its absence
2446
+ * would hand an attacker the whole check.
2447
+ */
2448
+ function hostAllowed(hostHeader, bind, extraHosts) {
2449
+ if (!hostHeader || !URL.canParse(`http://${hostHeader}`)) return false;
2450
+ const hostname = new URL(`http://${hostHeader}`).hostname.replace(/^\[|\]$/g, "");
2451
+ if (hostname === LOOPBACK_HOST || hostname === "localhost" || hostname === "::1") return true;
2452
+ const bindAddr = resolveBindAddress(bind);
2453
+ if (bindAddr && hostname === bindAddr) return true;
2454
+ return extraHosts.some((h) => h.trim().toLowerCase() === hostname);
2455
+ }
2456
+ /**
2457
+ * Cross-site check on the Origin header: no Origin passes (curl, the Claude
2458
+ * client); an Origin present must carry the same host:port as the Host header.
2459
+ */
2460
+ function originAllowed(originHeader, hostHeader) {
2461
+ if (!originHeader) return true;
2462
+ if (!hostHeader || !URL.canParse(`http://${hostHeader}`) || !URL.canParse(originHeader)) return false;
2463
+ return new URL(originHeader).host === new URL(`http://${hostHeader}`).host;
2464
+ }
2465
+ /**
2466
+ * The address to show a human for a bind address: the tailnet hostname
2467
+ * (MagicDNS name, from `tailscale status --json`) when the address is the
2468
+ * machine's own Tailscale IP, else the address itself.
2469
+ */
2470
+ async function displayHost(addr) {
2471
+ if (!inTailscaleRange(addr)) return addr;
2472
+ try {
2473
+ const { execFile } = await import("node:child_process");
2474
+ const { promisify } = await import("node:util");
2475
+ const { stdout } = await promisify(execFile)("tailscale", ["status", "--json"], { timeout: TAILSCALE_STATUS_TIMEOUT_MS });
2476
+ const self = JSON.parse(stdout).Self;
2477
+ if (self?.DNSName && self.TailscaleIPs?.includes(addr)) return self.DNSName.replace(/\.$/, "");
2478
+ } catch {}
2479
+ return addr;
2480
+ }
2481
+
2383
2482
  //#endregion
2384
2483
  //#region src/router/router.ts
2385
2484
  /**
@@ -2821,6 +2920,25 @@ function routerHandler(loadProviders = () => withTierProviders(readWorkersSectio
2821
2920
  log(`${(/* @__PURE__ */ new Date()).toISOString()} warning: model id ${model} is declared by several providers (${cands.join(", ")}); preferring one that is up`);
2822
2921
  };
2823
2922
  return (req, res) => {
2923
+ const hosts = options?.hosts;
2924
+ if (hosts) {
2925
+ const path = (req.url ?? "/").split("?")[0];
2926
+ const mutating = [
2927
+ "POST",
2928
+ "PUT",
2929
+ "PATCH",
2930
+ "DELETE"
2931
+ ].includes((req.method ?? "GET").toUpperCase());
2932
+ if (isCockpitPath(path) || mutating) {
2933
+ const refuse = (error) => {
2934
+ res.writeHead(403, { "content-type": "application/json" });
2935
+ res.end(JSON.stringify({ error }));
2936
+ log(`${(/* @__PURE__ */ new Date()).toISOString()} ${req.method ?? "-"} ${path} 403 ${error}`);
2937
+ };
2938
+ if (!hostAllowed(req.headers.host, hosts.bind, hosts.extraHosts)) return refuse("host not allowed");
2939
+ if (!originAllowed(req.headers.origin, req.headers.host)) return refuse("origin not allowed");
2940
+ }
2941
+ }
2824
2942
  if (extra?.(req, res)) return;
2825
2943
  const guard = options?.remoteAllowed;
2826
2944
  if (guard && !guard(req.socket.remoteAddress ?? void 0)) {
@@ -5907,5 +6025,5 @@ function resolveCapabilityRun(config, capability) {
5907
6025
  }
5908
6026
 
5909
6027
  //#endregion
5910
- export { parseFootprint as $, findLocal as $t, budgetSkipReason as A, saveSetup as An, TIGHT_PERCENT as At, MODEL_INVENTORY_MAX_AGE_MS as B, aggregate as Bn, routeRows as Bt, detectSessionProvider as C, PORT_TIMEOUT_MS as Cn, removeRunSettings as Ct, budgetExceeded as D, httpModelsCheck as Dn, routerPort as Dt, budgetCache as E, findSetup as En, routerHandler as Et, LimitsCache as F, workersLabel as Fn, flowText as Ft, fmtMem as G, isTimeOrdered as Gn, setRoute as Gt, ProbeHold as H, appendUsage as Hn, servingChip as Ht, buildSpeed as I, parkConfigFrom as In, parseSelector as It, inventoryRows as J, readUsage as Jn, validateRoute as Jt, fmtMemMapped as K, markTimeOrdered as Kn, setSessionRoute as Kt, percentile as L, setParkConfigSource as Ln, resolveSelector as Lt, budgetWall as M, setupWorkersLabel as Mn, clearSessionRoute as Mt, fetchBudgetReading as N, setupsPath as Nn, configuredLocal as Nt, budgetFresh as O, loadSaved as On, isTailnetOrLocalName as Ot, pickBudgetWindow as P, shortModel as Pn, entryLabel as Pt, modelLabel as Q, fallThroughReason as Qt, DOWN_AFTER_MISSES as R, sharedParker as Rn, resolveSessionArg as Rt, applySessionProviderEnv as S, startLocalStatusRefresh as Sn, gcSettingsFiles as St, BudgetCache as T, downLocalProviders as Tn, duplicateModelIds as Tt, computeInventory as U, formatSessionStats as Un, sessionRoutesPatch as Ut, MODEL_INVENTORY_REFRESH_MS as V, aggregateBySession as Vn, routeText as Vt, currentInventory as W, formatStats as Wn, sessionStartTarget as Wt, liveDeps as X, usageLogFile as Xn, clearPolicy as Xt, inventoryText as Y, splitBySessionKind as Yn, POLICY_MODES as Yt, modelKind as Z, committedFallThrough as Zt, resolveTarget as _, pickLocal as _n, nativeRoutePreflight as _t, clearCooldown as a, detectSessionName as an, readInventoryInput as at, SESSION_PROVIDER_ENV as b, resolveLocalProvider as bn, routeLoopbackViaRouter as bt, exclusionReason as c, getProfile as cn, writeInventory as ct, probeQuota as d, updateProfile as dn, claudeCommand as dt, onBattery as en, parseSizeMb as et, quotaExceeded as f, LOCAL_MECHANISM_LINE as fn, claudeSettingsExtra as ft, resolveCapabilityRun as g, localTierOrder as gn, nativeLaunchSettingsArgs as gt, recordBudgetCooldowns as h, localProviderForDelegation as hn, nativeLaunchEnv as ht, capabilityForRun as i, writePolicy as in, readInventory as it, budgetUntilLabel as j, setupProfile as jn, applyPolicyToRoutes as jt, budgetFull as k, orchestratorLabel as kn, loopbackRefusal as kt, isQuotaFailure as l, profilesPath as ln, addSchedulingHeaders as lt, readRoutingState as m, currentLocalStatus as mn, loopbackRouterChoice as mt, NoProviderError as n, readPolicy as nn, processTreeMemory as nt, cooldownRemaining as o, BATCH_ENV as on, readModelLabels as ot, quotaSkipThreshold as p, NoLocalServerError as pn, isLoopbackProvider as pt, inventoryPath as q, parseSince as qn, tierFlow as qt, autoOrder as r, routeRun as rn, processTreeRssMb as rt, entryModel as s, SESSION_NAME_ENV as sn, startInventoryRefresh as st, BUDGET_COOLDOWN_MIN as t, parseDuration as tn, parseTable as tt, nextAutoProvider as u, readProfiles as un, buildRunEnv as ut, setCooldown as v, probeLoopback as vn, pinnedSettings as vt, BUDGET_TTL_MS as w, allSetups as wn, writePrivateFile as wt, SESSION_WORKER_PROVIDER_ENV as x, resolveRunnerProvider as xn, routeVerdictLine as xt, writeRoutingState as y, providerHostPort as yn, pinnedSettingsArgs as yt, INVENTORY_HEADERS as z, recordDuration as zn, routeChoices as zt };
5911
- //# sourceMappingURL=routing-BAAST9vT.mjs.map
6028
+ export { parseFootprint as $, splitBySessionKind as $n, POLICY_MODES as $t, budgetSkipReason as A, findSetup as An, hostAllowed as At, MODEL_INVENTORY_MAX_AGE_MS as B, parkConfigFrom as Bn, parseSelector as Bt, detectSessionProvider as C, providerHostPort as Cn, removeRunSettings as Ct, budgetExceeded as D, PORT_TIMEOUT_MS as Dn, routerPort as Dt, budgetCache as E, startLocalStatusRefresh as En, routerHandler as Et, LimitsCache as F, setupProfile as Fn, applyPolicyToRoutes as Ft, fmtMem as G, aggregateBySession as Gn, routeText as Gt, ProbeHold as H, sharedParker as Hn, resolveSessionArg as Ht, buildSpeed as I, setupWorkersLabel as In, clearSessionRoute as It, inventoryRows as J, formatStats as Jn, sessionStartTarget as Jt, fmtMemMapped as K, appendUsage as Kn, servingChip as Kt, percentile as L, setupsPath as Ln, configuredLocal as Lt, budgetWall as M, loadSaved as Mn, isTailnetOrLocalName as Mt, fetchBudgetReading as N, orchestratorLabel as Nn, loopbackRefusal as Nt, budgetFresh as O, allSetups as On, defaultV1Guard as Ot, pickBudgetWindow as P, saveSetup as Pn, TIGHT_PERCENT as Pt, modelLabel as Q, readUsage as Qn, validateRoute as Qt, DOWN_AFTER_MISSES as R, shortModel as Rn, entryLabel as Rt, applySessionProviderEnv as S, probeLoopback as Sn, gcSettingsFiles as St, BudgetCache as T, resolveRunnerProvider as Tn, duplicateModelIds as Tt, computeInventory as U, recordDuration as Un, routeChoices as Ut, MODEL_INVENTORY_REFRESH_MS as V, setParkConfigSource as Vn, resolveSelector as Vt, currentInventory as W, aggregate as Wn, routeRows as Wt, liveDeps as X, markTimeOrdered as Xn, setSessionRoute as Xt, inventoryText as Y, isTimeOrdered as Yn, setRoute as Yt, modelKind as Z, parseSince as Zn, tierFlow as Zt, resolveTarget as _, NoLocalServerError as _n, nativeRoutePreflight as _t, clearCooldown as a, parseDuration as an, readInventoryInput as at, SESSION_PROVIDER_ENV as b, localTierOrder as bn, routeLoopbackViaRouter as bt, exclusionReason as c, writePolicy as cn, writeInventory as ct, probeQuota as d, SESSION_NAME_ENV as dn, claudeCommand as dt, clearPolicy as en, usageLogFile as er, parseSizeMb as et, quotaExceeded as f, getProfile as fn, claudeSettingsExtra as ft, resolveCapabilityRun as g, LOCAL_MECHANISM_LINE as gn, nativeLaunchSettingsArgs as gt, recordBudgetCooldowns as h, updateProfile as hn, nativeLaunchEnv as ht, capabilityForRun as i, onBattery as in, readInventory as it, budgetUntilLabel as j, httpModelsCheck as jn, resolveBindAddress as jt, budgetFull as k, downLocalProviders as kn, displayHost as kt, isQuotaFailure as l, detectSessionName as ln, addSchedulingHeaders as lt, readRoutingState as m, readProfiles as mn, loopbackRouterChoice as mt, NoProviderError as n, fallThroughReason as nn, processTreeMemory as nt, cooldownRemaining as o, readPolicy as on, readModelLabels as ot, quotaSkipThreshold as p, profilesPath as pn, isLoopbackProvider as pt, inventoryPath as q, formatSessionStats as qn, sessionRoutesPatch as qt, autoOrder as r, findLocal as rn, processTreeRssMb as rt, entryModel as s, routeRun as sn, startInventoryRefresh as st, BUDGET_COOLDOWN_MIN as t, committedFallThrough as tn, parseTable as tt, nextAutoProvider as u, BATCH_ENV as un, buildRunEnv as ut, setCooldown as v, currentLocalStatus as vn, pinnedSettings as vt, BUDGET_TTL_MS as w, resolveLocalProvider as wn, writePrivateFile as wt, SESSION_WORKER_PROVIDER_ENV as x, pickLocal as xn, routeVerdictLine as xt, writeRoutingState as y, localProviderForDelegation as yn, pinnedSettingsArgs as yt, INVENTORY_HEADERS as z, workersLabel as zn, flowText as zt };
6029
+ //# sourceMappingURL=routing-DmkheCRH.mjs.map
@@ -3,7 +3,7 @@ import "./config-Bu1_vbY8.mjs";
3
3
  import "./paths-CHifubDh.mjs";
4
4
  import "./status-ggJ7lgVg.mjs";
5
5
  import "./scope-D-h6F6DN.mjs";
6
- import { _ as resolveTarget, a as clearCooldown, c as exclusionReason, d as probeQuota, f as quotaExceeded, g as resolveCapabilityRun, h as recordBudgetCooldowns, i as capabilityForRun, l as isQuotaFailure, m as readRoutingState, n as NoProviderError, o as cooldownRemaining, p as quotaSkipThreshold, r as autoOrder, s as entryModel, t as BUDGET_COOLDOWN_MIN, u as nextAutoProvider, v as setCooldown, y as writeRoutingState } from "./routing-BAAST9vT.mjs";
6
+ import { _ as resolveTarget, a as clearCooldown, c as exclusionReason, d as probeQuota, f as quotaExceeded, g as resolveCapabilityRun, h as recordBudgetCooldowns, i as capabilityForRun, l as isQuotaFailure, m as readRoutingState, n as NoProviderError, o as cooldownRemaining, p as quotaSkipThreshold, r as autoOrder, s as entryModel, t as BUDGET_COOLDOWN_MIN, u as nextAutoProvider, v as setCooldown, y as writeRoutingState } from "./routing-DmkheCRH.mjs";
7
7
  import "./tool-errors-7E13StWd.mjs";
8
8
  import "./wait-ByV0OyMZ.mjs";
9
9
  import "./local-tiers-BE4jGaMa.mjs";
@@ -2,11 +2,11 @@ import { g as paiHomePath, l as claudeHomeDir } from "./runtime-paths-WsO9sJFc.m
2
2
  import { Ct as withSummary, I as LOOPBACK_HOST, N as resolveModelCapability, P as resolveProviderKey, St as sessionNote, bt as ledgerEscalate, c as WorkersConfigError, f as escalationCloud, ft as parseEntry, gt as certainContextWindow, h as isModelCapability, j as readWorkersSection, k as providerKeyPath, l as assertProviderRunnable, m as isLocalProvider, ot as applyRouteOverrides, p as getProviderOrNative, t as ANTHROPIC_NATIVE, tt as workersYamlPath, u as classModelCapability, v as nativeAnthropicModels, wt as appendLedger, xt as planEscalation } from "./config-XpZWOYOG.mjs";
3
3
  import { _ as effectiveWorkersYamlRaw } from "./config-Bu1_vbY8.mjs";
4
4
  import { i as ledgerPath, n as ensureNoMcpConfig, r as eventsPath, u as workersLogDir } from "./paths-CHifubDh.mjs";
5
- import { A as applyScratchEnv, C as worktreeWanted, S as worktreeSystemPrompt, _ as ownedTree, a as archiveEmptyResult, f as gcWorktreesThrottled, h as markResumed, i as adoptTree, j as scratchPromptLine, o as commitLines, p as inPlaceSystemPrompt, r as addWorktree, t as GATE_MARK, v as recordWorktree, w as worktreesDir, x as worktreeRefusesStart, y as salvageOnExit } from "./worktree-CrnOqTBW.mjs";
5
+ import { A as applyScratchEnv, C as worktreeWanted, S as worktreeSystemPrompt, _ as ownedTree, a as archiveEmptyResult, f as gcWorktreesThrottled, h as markResumed, i as adoptTree, j as scratchPromptLine, o as commitLines, p as inPlaceSystemPrompt, r as addWorktree, t as GATE_MARK, v as recordWorktree, w as worktreesDir, x as worktreeRefusesStart, y as salvageOnExit } from "./worktree-CRs2gyg0.mjs";
6
6
  import { C as nowStamp, D as pidAlive, E as parseSleepSecs, J as loadPreamble, Q as appendSystemPromptArgs, S as newWorkerId, X as preambleLine, Y as preambleBlock, Z as projectRoot, a as UNLABELED, d as describeTool, g as isLive, k as saveStatus, nt as shortText, rt as stripPromptValues, tt as parseRunnerArgs, v as loadStatus, x as markStartFailed, y as loadStatuses } from "./status-ggJ7lgVg.mjs";
7
- import { D as readMcpServers, E as mcpServersFromToolGrants, O as writeMcpConfig, S as inputSideTokens, T as grantsChrome, d as poolIneligibleReason, g as postTaskToPool, h as poolSettings, n as SLOT_TOOLS, r as UNIT_MARKER, t as SHARED_MARKER, w as expandMcpNames, y as reloadInProgress } from "./pool-BRvoOkv6.mjs";
7
+ import { D as readMcpServers, E as mcpServersFromToolGrants, O as writeMcpConfig, S as inputSideTokens, T as grantsChrome, d as poolIneligibleReason, g as postTaskToPool, h as poolSettings, n as SLOT_TOOLS, r as UNIT_MARKER, t as SHARED_MARKER, w as expandMcpNames, y as reloadInProgress } from "./pool-Dh-q3iJi.mjs";
8
8
  import { i as itermUuid, o as resolveSession, s as resolveSpawnerSession } from "./scope-D-h6F6DN.mjs";
9
- import { Cn as PORT_TIMEOUT_MS, Ct as removeRunSettings, Dn as httpModelsCheck, Dt as routerPort, E as budgetCache, Qt as fallThroughReason, S as applySessionProviderEnv, Zt as committedFallThrough, _ as resolveTarget, an as detectSessionName, bn as resolveLocalProvider, bt as routeLoopbackViaRouter, cn as getProfile, dt as claudeCommand, fn as LOCAL_MECHANISM_LINE, ft as claudeSettingsExtra, g as resolveCapabilityRun, h as recordBudgetCooldowns, i as capabilityForRun, k as budgetFull, l as isQuotaFailure, lt as addSchedulingHeaders, n as NoProviderError, o as cooldownRemaining, on as BATCH_ENV, pn as NoLocalServerError, pt as isLoopbackProvider, r as autoOrder, rn as routeRun, u as nextAutoProvider, ut as buildRunEnv, v as setCooldown, vn as probeLoopback, vt as pinnedSettings, wt as writePrivateFile, x as SESSION_WORKER_PROVIDER_ENV, xn as resolveRunnerProvider, yn as providerHostPort } from "./routing-BAAST9vT.mjs";
9
+ import { Cn as providerHostPort, Ct as removeRunSettings, Dn as PORT_TIMEOUT_MS, Dt as routerPort, E as budgetCache, S as applySessionProviderEnv, Sn as probeLoopback, Tn as resolveRunnerProvider, _ as resolveTarget, _n as NoLocalServerError, bt as routeLoopbackViaRouter, dt as claudeCommand, fn as getProfile, ft as claudeSettingsExtra, g as resolveCapabilityRun, gn as LOCAL_MECHANISM_LINE, h as recordBudgetCooldowns, i as capabilityForRun, jn as httpModelsCheck, k as budgetFull, l as isQuotaFailure, ln as detectSessionName, lt as addSchedulingHeaders, n as NoProviderError, nn as fallThroughReason, o as cooldownRemaining, pt as isLoopbackProvider, r as autoOrder, sn as routeRun, tn as committedFallThrough, u as nextAutoProvider, un as BATCH_ENV, ut as buildRunEnv, v as setCooldown, vt as pinnedSettings, wn as resolveLocalProvider, wt as writePrivateFile, x as SESSION_WORKER_PROVIDER_ENV } from "./routing-DmkheCRH.mjs";
10
10
  import { t as maxOf } from "./min-max-DrSRUaWQ.mjs";
11
11
  import { b as readToolErrors, h as harnessToolErrorTexts, p as grantedToolNames, x as recordToolError } from "./tool-errors-7E13StWd.mjs";
12
12
  import { _ as workerContractPrompt, b as killProcessTree, c as checkProof, d as parseWorkerReport, f as promptTrailer, g as verifyReportChanges, h as verifyFailNote, l as newUntracked, m as untrackedPaths, o as AG2_REASK_TEXT, s as OPERATOR_MARK, u as noteTokenSentence, v as repairAndValidateAg2, x as processTree, y as validateAg2 } from "./wait-ByV0OyMZ.mjs";
@@ -14,14 +14,14 @@ import { a as buildsDir, d as releaseBuildsOf } from "./caller-identity-yLFb7CKq
14
14
  import { c as queuedText, d as resolveCap, h as staggerGate, m as recordWarmup, n as capacityGate, p as sessionScopeKey, t as admitCap } from "./capacity-DEveQdFV.mjs";
15
15
  import { n as tierProviderNames, t as isLocalCandidate } from "./local-candidate-DLdwQt0s.mjs";
16
16
  import { t as LOCAL_PROBE_TIMEOUT_MS } from "./timeouts-1MLooEBB.mjs";
17
- import { i as getRegistryBackend } from "./factory-DjAAsqr_.mjs";
18
- import { c as ensureProxyRunning, i as detectCurrentModel, l as proxyPort } from "./launch-Jh5NVeNe.mjs";
19
- import { A as tail, Et as openOwnedPane, Kt as isHandoffMessage, Q as NoTerminalError, Wt as deliverHandoff, Xt as localFailures, _ as troublePolicy, _t as paneTitle, at as headlessAllowed, d as aibrokerMessenger, f as detachRun, h as originFromEnv, ht as resolveHostSession, it as followCommand, m as markRunDone, mt as realPaneOps, nt as closePaneForWorker, o as ownerOf, p as eventLine, r as returnControlsIfHeld, ut as openVerifiedPane, v as appendRunLog, z as gatePhaseName } from "./controls-BcKFHeG1.mjs";
20
- import { i as endFields, o as parentInfo, r as decideEndReason } from "./endreason-C577xIQz.mjs";
21
- import { A as resolveLimit, E as armDeadline, F as checkOrphanedChildren, I as isWorkerId, L as launchParent, M as blockedMsOf, O as deadlinePromptLine, P as assertChildAllowed, T as recordDenial, k as extendLimit, w as parseDenialText } from "./render-CwIrgxLi.mjs";
17
+ import { i as getRegistryBackend } from "./factory-B7nv75rC.mjs";
18
+ import { c as ensureProxyRunning, i as detectCurrentModel, l as proxyPort } from "./launch-Di7N-J5X.mjs";
19
+ import { A as tail, Et as openOwnedPane, Kt as isHandoffMessage, Q as NoTerminalError, Wt as deliverHandoff, Xt as localFailures, _ as troublePolicy, _t as paneTitle, at as headlessAllowed, d as aibrokerMessenger, f as detachRun, h as originFromEnv, ht as resolveHostSession, it as followCommand, m as markRunDone, mt as realPaneOps, nt as closePaneForWorker, o as ownerOf, p as eventLine, r as returnControlsIfHeld, ut as openVerifiedPane, v as appendRunLog, z as gatePhaseName } from "./controls-JLm6g0yP.mjs";
20
+ import { i as endFields, o as parentInfo, r as decideEndReason, t as appendStopEvent } from "./endreason-BC-v05H_.mjs";
21
+ import { A as resolveLimit, E as armDeadline, F as checkOrphanedChildren, I as isWorkerId, L as launchParent, M as blockedMsOf, O as deadlinePromptLine, P as assertChildAllowed, T as recordDenial, k as extendLimit, w as parseDenialText } from "./render-C84BqQRC.mjs";
22
22
  import { t as createOperatorServer } from "./operator-CyuB3aVw.mjs";
23
- import { i as killTree } from "./kill-tree-EWYaEk5v.mjs";
24
- import { r as ensurePoolHost } from "./pool-cli-B_YR8_Gl.mjs";
23
+ import { i as killTree } from "./kill-tree-DleMNZX3.mjs";
24
+ import { r as ensurePoolHost } from "./pool-cli-BggU8GRp.mjs";
25
25
  import { closeSync, existsSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, realpathSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
26
26
  import { createHash, randomBytes } from "node:crypto";
27
27
  import { dirname, join, resolve, sep } from "node:path";
@@ -936,6 +936,11 @@ function fireDeadline(logDir, status, ledger, limit) {
936
936
  minutes: limit.minutes,
937
937
  waitedMin: waited
938
938
  });
939
+ appendStopEvent(logDir, status.id, {
940
+ killed_by: "deadline",
941
+ forced: false,
942
+ reason: `${what} (timer: --max-minutes/--deadline, armed at spawn)`
943
+ });
939
944
  killTree(logDir, status.id, {
940
945
  skipRoot: true,
941
946
  by: "deadline",
@@ -1063,6 +1068,15 @@ async function finaliseRun(f) {
1063
1068
  loopStopped: !!loopStop
1064
1069
  });
1065
1070
  status.endReason = end.reason;
1071
+ if (end.reason === "pai-worker-kill" && !f.timedOut && end.killReason && !succeeded) {
1072
+ status.last = shortText(end.killReason, 90);
1073
+ report = {
1074
+ ...report ?? {},
1075
+ result: report?.result ?? "-",
1076
+ why: end.killReason,
1077
+ notes: [end.killReason, report?.notes ?? f.fallbackText].filter(Boolean).join("\n")
1078
+ };
1079
+ }
1066
1080
  status.claimsContinue = report?.result === "~";
1067
1081
  saveStatus(logDir, status);
1068
1082
  appendLedger(ledger, "WORKER-END", {
@@ -3413,8 +3427,8 @@ function resolveWorkers(args, ctx) {
3413
3427
  async function liveResolveCtx(env = process.env, warm = true) {
3414
3428
  const [{ readWorkersSection }, { budgetCache }, { readRoutingState }, { workersLogDir }] = await Promise.all([
3415
3429
  import("./config-Cxi-aBf4.mjs"),
3416
- import("./budget-Dod6rnA9.mjs"),
3417
- import("./routing-CENt4HH1.mjs"),
3430
+ import("./budget-BrloTOZW.mjs"),
3431
+ import("./routing-f2zulGwD.mjs"),
3418
3432
  import("./paths-CFHTloSe.mjs")
3419
3433
  ]);
3420
3434
  const { workers } = readWorkersSection();
@@ -4882,7 +4896,7 @@ async function runWorker(opts) {
4882
4896
  if (gc?.length) process.stderr.write(`pai worker: archived ${gc.length} leftover worktree(s) (pai worker gc)\n`);
4883
4897
  } catch {}
4884
4898
  if (opts.className === "plan" && !opts._planner) {
4885
- const { runPlanner } = await import("./planner-BM27GBfC.mjs");
4899
+ const { runPlanner } = await import("./planner-j77ndkBf.mjs");
4886
4900
  return runPlanner(opts);
4887
4901
  }
4888
4902
  const parent = launchParent(opts.parent);
@@ -5106,4 +5120,4 @@ setRunWorker(runWorker);
5106
5120
 
5107
5121
  //#endregion
5108
5122
  export { routerPidFile as A, usageContextTokens as B, workerUsage as C, routerHandoverFile as D, probeRouter as E, startHandover as F, testProvider as H, paneWaiver as I, launchPane as L, routerSwapArgs as M, runRouterTick as N, routerIsStale as O, spawnRouter as P, noTerminalReasons as R, usageJson as S, projectLaunchConfig as T, endProcesses as U, printResult as V, findWorktreeOrphans as W, stopLaunchedWorkers as _, resolveWorkers as a, renderUsage as b, reportOriginWithHost as c, capture as d, dirtyPaths as f, realRunnerDeps as g, realCommitsAhead as h, liveResolveCtx as i, routerRunningPid as j, routerLogFile as k, runMessenger as l, mergeBranch as m, LocalProviderRefusedError as n, sessionWorkersLine as o, launchWorker as p, PoolRefusedError as r, finishDetached as s, runWorker as t, startDetached as u, parseWhen as v, pinNotices as w, transcriptUsage as x, priceTableText as y, recordSystemJobStart as z };
5109
- //# sourceMappingURL=run-6Q9kCPem.mjs.map
5123
+ //# sourceMappingURL=run-BwZKBJZZ.mjs.map
@@ -2,9 +2,9 @@ import { _ as warn, c as ok, i as err, n as dim, r as encodeDir, s as now, t as
2
2
  import { _ as resolvePaiFile, d as defaultPaiHomeDir, g as paiHomePath, m as migratePaiFile, u as claudeProjectsDir$1 } from "./runtime-paths-WsO9sJFc.mjs";
3
3
  import { a as slugify, i as parseSessionFilename, n as decodeEncodedDir, t as buildEncodedDirMap } from "./migrate-DrA_OwlZ.mjs";
4
4
  import { D as readJsonStrict, O as writeJsonAtomic, o as expandHome } from "./config-Bu1_vbY8.mjs";
5
- import { a as unregistrableReason, o as workerWorktreesRoot, r as pruneWorktreeProjects } from "./registrable-Uzgmfyhz.mjs";
6
- import { n as ensurePaiMarker, t as discoverPaiMarkers } from "./pai-marker-DurzIbw8.mjs";
7
- import { i as getRegistryBackend } from "./factory-DjAAsqr_.mjs";
5
+ import { a as unregistrableReason, o as workerWorktreesRoot, r as pruneWorktreeProjects } from "./registrable-DpyTtajg.mjs";
6
+ import { n as ensurePaiMarker, t as discoverPaiMarkers } from "./pai-marker-BcZyJguM.mjs";
7
+ import { i as getRegistryBackend } from "./factory-B7nv75rC.mjs";
8
8
  import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, statSync, writeFileSync } from "node:fs";
9
9
  import { basename, join, resolve } from "node:path";
10
10
  import { homedir } from "node:os";
@@ -718,4 +718,4 @@ async function cmdScan(opts = {}) {
718
718
 
719
719
  //#endregion
720
720
  export { resolveHome as a, upsertSession as c, scanTranscriptFolders as d, transcriptFiles as f, performScan as i, claudeProjectsDir as l, loadScanConfig as n, saveScanConfig as o, migrateScanConfig as r, upsertProject as s, cmdScan as t, findMovedProjects as u };
721
- //# sourceMappingURL=scan-ZQWm-_se.mjs.map
721
+ //# sourceMappingURL=scan-BBGvU5EB.mjs.map
@@ -3,14 +3,14 @@ import "./migrate-DrA_OwlZ.mjs";
3
3
  import "./config-XpZWOYOG.mjs";
4
4
  import "./config-Bu1_vbY8.mjs";
5
5
  import "./paths-CHifubDh.mjs";
6
- import "./worktree-CrnOqTBW.mjs";
6
+ import "./worktree-CRs2gyg0.mjs";
7
7
  import "./status-ggJ7lgVg.mjs";
8
- import "./pool-BRvoOkv6.mjs";
9
- import "./registrable-Uzgmfyhz.mjs";
10
- import "./pai-marker-DurzIbw8.mjs";
8
+ import "./pool-Dh-q3iJi.mjs";
9
+ import "./registrable-DpyTtajg.mjs";
10
+ import "./pai-marker-BcZyJguM.mjs";
11
11
  import "./helpers-CRuBUas3.mjs";
12
12
  import "./scope-D-h6F6DN.mjs";
13
- import "./routing-BAAST9vT.mjs";
13
+ import "./routing-DmkheCRH.mjs";
14
14
  import "./tool-errors-7E13StWd.mjs";
15
15
  import "./wait-ByV0OyMZ.mjs";
16
16
  import "./local-tiers-BE4jGaMa.mjs";
@@ -18,18 +18,18 @@ import "./caller-identity-yLFb7CKq.mjs";
18
18
  import "./capacity-DEveQdFV.mjs";
19
19
  import "./local-instances-DOxSgT_L.mjs";
20
20
  import "./local-candidate-DLdwQt0s.mjs";
21
- import "./factory-DjAAsqr_.mjs";
22
- import "./postgres-C6ti4haA.mjs";
21
+ import "./factory-B7nv75rC.mjs";
22
+ import "./postgres-DNIOQijl.mjs";
23
23
  import "./embedding-gate-6rZrWRXa.mjs";
24
24
  import "./embeddings-BVq3esBF.mjs";
25
25
  import "./router-CQSc3lk3.mjs";
26
- import "./detect-9CZNO0yf.mjs";
27
- import "./helpers-BD6V-p9w.mjs";
28
- import "./scan-ZQWm-_se.mjs";
29
- import { a as newTop, c as planOpen, d as runNewDefault, f as sessionCommand, i as lsCommand, l as renameTop, n as collectRows, o as oneLine, p as sessionDir, r as collectView, s as openTop, t as applyProfileChat, u as rowsTable } from "./session-DVUExUnX.mjs";
30
- import "./launch-Jh5NVeNe.mjs";
31
- import "./health-Dnym-qcT.mjs";
32
- import "./launch-CXVlZjHt.mjs";
33
- import "./session-scan-W-gbwJHM.mjs";
26
+ import "./detect-BLKsUOgG.mjs";
27
+ import "./helpers-DSNK_1KP.mjs";
28
+ import "./scan-BBGvU5EB.mjs";
29
+ import { a as newTop, c as planOpen, d as runNewDefault, f as sessionCommand, i as lsCommand, l as renameTop, n as collectRows, o as oneLine, p as sessionDir, r as collectView, s as openTop, t as applyProfileChat, u as rowsTable } from "./session-Dn5OJXlg.mjs";
30
+ import "./launch-Di7N-J5X.mjs";
31
+ import "./health-C4FQmkJn.mjs";
32
+ import "./launch-DlZTKE3u.mjs";
33
+ import "./session-scan-DUn10MBd.mjs";
34
34
 
35
35
  export { runNewDefault };