@tekmidian/pai 1.0.4 → 1.0.6

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 (248) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/dist/{aibroker-client-CQPGqLxL.mjs → aibroker-client-CXsyC7A8.mjs} +2 -2
  3. package/dist/aibroker-client-ChB7gSxV.mjs +3 -0
  4. package/dist/auto-route-Bc8xP6TQ.mjs +11 -0
  5. package/dist/{auto-route-21GdHL70.mjs → auto-route-YaEGVrFl.mjs} +2 -2
  6. package/dist/budget-DEiebT2A.mjs +15 -0
  7. package/dist/{caller-identity-yLFb7CKq.mjs → caller-identity-C6Nc96iM.mjs} +4 -4
  8. package/dist/{capacity-DEveQdFV.mjs → capacity-B2PgKAg4.mjs} +69 -6
  9. package/dist/{chain-D7PFur8Y.mjs → chain-CtK49-Ma.mjs} +5 -5
  10. package/dist/cli/index.mjs +2126 -290
  11. package/dist/{cockpit-actions-BfRMr2sm.mjs → cockpit-actions-C73mJAJ8.mjs} +18 -18
  12. package/dist/{cockpit-actions-OodH_vx_.mjs → cockpit-actions-D1OPP6Es.mjs} +30 -26
  13. package/dist/cockpit-memory-CLHZD64W.mjs +20 -0
  14. package/dist/config/defaults/config.yaml +21 -1
  15. package/dist/{config-XpZWOYOG.mjs → config-Bz8pAU5Q.mjs} +30 -5
  16. package/dist/{config-DtENJ6cL.mjs → config-DHgPx3ER.mjs} +1 -1
  17. package/dist/config-DLmyEK2q.mjs +4 -0
  18. package/dist/{config-Bu1_vbY8.mjs → config-SlZ-Z52i.mjs} +4 -3
  19. package/dist/{controls-JLm6g0yP.mjs → controls-rIItFeIJ.mjs} +59 -66
  20. package/dist/daemon/index.mjs +40 -39
  21. package/dist/daemon-176qA79N.mjs +46 -0
  22. package/dist/{daemon-nXanenDM.mjs → daemon-SoUvPUOf.mjs} +80 -30
  23. package/dist/daemon-mcp/index.mjs +49 -38
  24. package/dist/detect-C8nFP-kR.mjs +10 -0
  25. package/dist/{detect-BLKsUOgG.mjs → detect-DLjeYwnt.mjs} +2 -2
  26. package/dist/{embed-pass-e64AwDCa.mjs → embed-pass-CN1D8MXl.mjs} +5 -5
  27. package/dist/{embedding-gate-Cnk4YCyX.mjs → embedding-gate-BVQvUmox.mjs} +2 -2
  28. package/dist/{embedding-gate-6rZrWRXa.mjs → embedding-gate-iq0oQEkF.mjs} +3 -3
  29. package/dist/{endreason-BC-v05H_.mjs → endreason-C2-hYK0_.mjs} +4 -4
  30. package/dist/{factory-B7nv75rC.mjs → factory-CYwa0jYj.mjs} +6 -6
  31. package/dist/factory-DFwez99M.mjs +9 -0
  32. package/dist/{fallback-CBWpp2F2.mjs → fallback-CwPSCrX8.mjs} +9 -231
  33. package/dist/{health-C4FQmkJn.mjs → health-D0mUAVdw.mjs} +5 -5
  34. package/dist/{helpers-DSNK_1KP.mjs → helpers-Dj2nY56t.mjs} +2 -2
  35. package/dist/{helpers-Dz7mjTSw.mjs → helpers-DyHKAwrW.mjs} +6 -6
  36. package/dist/hooks/block-sleep-poll.mjs +1 -1
  37. package/dist/hooks/capture-all-events.mjs +68 -3
  38. package/dist/hooks/capture-tool-output.mjs +68 -3
  39. package/dist/hooks/handoff-link.mjs +128 -0
  40. package/dist/hooks/load-project-context.mjs +8 -8
  41. package/dist/hooks/local-model-hint.mjs +1 -1
  42. package/dist/hooks/route-agents-to-worker.mjs +1 -1
  43. package/dist/hooks/security-validator.mjs +842 -90
  44. package/dist/hooks/supervision-banner.mjs +186 -48
  45. package/dist/hooks/worker-edit-repair.mjs +2 -2
  46. package/dist/hooks/worker-guard.mjs +65 -9
  47. package/dist/hooks/worker-note.mjs +70 -5
  48. package/dist/hooks/worker-pool-host.mjs +1518 -265
  49. package/dist/hooks/worker-proxy.mjs +1 -1
  50. package/dist/hooks/worker-status-line.mjs +225 -86
  51. package/dist/hooks/worker-supervision.mjs +1 -1
  52. package/dist/hooks/worker-tool-name-repair.mjs +2 -2
  53. package/dist/index.mjs +9 -9
  54. package/dist/{ipc-client-CnYEF31R.mjs → ipc-client-CmagIFLh.mjs} +2 -2
  55. package/dist/{ipc-client-DN7EvoVo.mjs → ipc-client-DmbSIBUK.mjs} +1 -1
  56. package/dist/{kill-tree-DleMNZX3.mjs → kill-tree-DPiMscaY.mjs} +8 -8
  57. package/dist/kill-tree-Dxei6qlR.mjs +10 -0
  58. package/dist/{launch-DlZTKE3u.mjs → launch-BZT3JDoZ.mjs} +3 -3
  59. package/dist/{launch-Di7N-J5X.mjs → launch-Bn2Zf90h.mjs} +3 -3
  60. package/dist/{indexer-backend-BdjeL4P8.mjs → lessons-CFVU0cwA.mjs} +262 -43
  61. package/dist/{local-candidate-DLdwQt0s.mjs → local-candidate-DFd4pp-w.mjs} +3 -3
  62. package/dist/{local-instances-DOxSgT_L.mjs → local-instances-DhF4_sV2.mjs} +2 -2
  63. package/dist/{local-instances-ZeRkkuS5.mjs → local-instances-KTh8IeOT.mjs} +4 -4
  64. package/dist/{local-tiers-BE4jGaMa.mjs → local-tiers-CqwGUcEn.mjs} +3 -3
  65. package/dist/{local-tiers-DNMI5W86.mjs → local-tiers-DSlIYvvm.mjs} +3 -3
  66. package/dist/{main-config-ops-kTXR8Pyv.mjs → main-config-ops-rda08BCD.mjs} +3 -3
  67. package/dist/{main-resolver-yp_puSSb.mjs → main-resolver-BKwI0I6H.mjs} +18 -18
  68. package/dist/{migrate-DrA_OwlZ.mjs → migrate-C2z1YmWC.mjs} +2 -2
  69. package/dist/{model-inventory-h6Z9fN_o.mjs → model-inventory-BXv15B0d.mjs} +13 -13
  70. package/dist/{models-add-TVni3A7V.mjs → models-add-5yXTyz3g.mjs} +38 -37
  71. package/dist/operator-Bmv5tiHQ.mjs +7 -0
  72. package/dist/{operator-CyuB3aVw.mjs → operator-Br6GeswF.mjs} +2 -2
  73. package/dist/{pai-marker-BcZyJguM.mjs → pai-marker-D6OoVbM_.mjs} +2 -2
  74. package/dist/{pane-audit-Lqy9N_Ki.mjs → pane-audit-DLYy9-4g.mjs} +13 -23
  75. package/dist/{paths-CHifubDh.mjs → paths-CypxFTfn.mjs} +4 -4
  76. package/dist/{paths-CFHTloSe.mjs → paths-DIOwNcj-.mjs} +3 -3
  77. package/dist/{planner-j77ndkBf.mjs → planner-BzZ_2lc-.mjs} +29 -29
  78. package/dist/{pool-Dh-q3iJi.mjs → pool-9EsbKD-U.mjs} +2 -2
  79. package/dist/{pool-cli-DQ6OzRy2.mjs → pool-cli-Cy5mlycP.mjs} +6 -6
  80. package/dist/{pool-cli-BggU8GRp.mjs → pool-cli-Db0uDwB9.mjs} +5 -5
  81. package/dist/{postgres-BK4FP9Zg.mjs → postgres-B1B80bcj.mjs} +3 -3
  82. package/dist/{postgres-DNIOQijl.mjs → postgres-BL5oBBgY.mjs} +3 -3
  83. package/dist/{project-setup-CBRtFFh0.mjs → project-setup-DHxdJjEc.mjs} +24 -25
  84. package/dist/providers-BH6hQYbU.mjs +16 -0
  85. package/dist/{providers-C9QC0TtO.mjs → providers-BNV7CzC-.mjs} +6 -6
  86. package/dist/{query-feedback-DN52N9C5.mjs → query-feedback-BWl2HRwN.mjs} +2 -2
  87. package/dist/registrable-BwFiqazy.mjs +9 -0
  88. package/dist/{registrable-DpyTtajg.mjs → registrable-Dxs4oKIj.mjs} +4 -4
  89. package/dist/render-DVGXpfaT.mjs +13 -0
  90. package/dist/render-jPpMrudf.mjs +2240 -0
  91. package/dist/root-C8cxhdn9.mjs +36 -0
  92. package/dist/{root-C4oXlXS_.mjs → root-DmOzMeSv.mjs} +10 -10
  93. package/dist/route-table-COAmc1nB.mjs +15 -0
  94. package/dist/{router-CQSc3lk3.mjs → router-D2476pOp.mjs} +2 -2
  95. package/dist/{router-DwHJRgG9.mjs → router-ghujlEFb.mjs} +1 -1
  96. package/dist/{routing-f2zulGwD.mjs → routing-B_cg1_Xx.mjs} +13 -13
  97. package/dist/{routing-DmkheCRH.mjs → routing-aJKMIagQ.mjs} +16 -16
  98. package/dist/{run-BwZKBJZZ.mjs → run-DE9Q0ldN.mjs} +55 -31
  99. package/dist/{runtime-paths-WsO9sJFc.mjs → runtime-paths-twfV23YL.mjs} +2 -2
  100. package/dist/{scan-BBGvU5EB.mjs → scan-CNMcltOX.mjs} +7 -7
  101. package/dist/{scope-D-h6F6DN.mjs → scope-BTWstJ1B.mjs} +4 -4
  102. package/dist/session-DgZifjLx.mjs +35 -0
  103. package/dist/{session-Dn5OJXlg.mjs → session-HBYOABWU.mjs} +28 -28
  104. package/dist/session-scan-BZxnYN1v.mjs +9 -0
  105. package/dist/{session-scan-DUn10MBd.mjs → session-scan-CX3MKCNg.mjs} +6 -6
  106. package/dist/{session-usage-CPvXvSkw.mjs → session-usage-CCmPFFa6.mjs} +117 -2
  107. package/dist/{status-ggJ7lgVg.mjs → status-Cecau8Ps.mjs} +9 -5
  108. package/dist/status-D52xC_i0.mjs +6 -0
  109. package/dist/{tool-errors-7E13StWd.mjs → tool-errors-BFw1gv-z.mjs} +2 -2
  110. package/dist/{tool-errors-CJWODvlo.mjs → tool-errors-COM2JGEr.mjs} +6 -6
  111. package/dist/viewer-Ce-Xa9L3.mjs +22 -0
  112. package/dist/{viewer-wfKnvnrI.mjs → viewer-DvBg6N22.mjs} +16 -14
  113. package/dist/{wait-ByV0OyMZ.mjs → wait-C5iWILj_.mjs} +3 -3
  114. package/dist/worker-config-BmcJ9R0U.mjs +42 -0
  115. package/dist/{worker-config-eY5Qy4vl.mjs → worker-config-DkONNk_H.mjs} +164 -107
  116. package/dist/workers-config-DwzrtdYu.mjs +4 -0
  117. package/dist/{worktree-CRs2gyg0.mjs → worktree-O_kU6Q3y.mjs} +164 -8
  118. package/dist/{zettelkasten-tpCRBYvH.mjs → zettelkasten-BH8AdNh8.mjs} +4 -4
  119. package/dist/{zettelkasten-_h_tUm2T.mjs → zettelkasten-FFhQFESJ.mjs} +2 -2
  120. package/docs/commands/README.md +33 -2
  121. package/docs/commands/audit.md +34 -3
  122. package/docs/commands/backup.md +1 -1
  123. package/docs/commands/build.md +4 -4
  124. package/docs/commands/cd.md +1 -1
  125. package/docs/commands/clear-names.md +1 -1
  126. package/docs/commands/cockpit.md +1 -1
  127. package/docs/commands/config.md +21 -1
  128. package/docs/commands/daemon.md +1 -1
  129. package/docs/commands/db.md +1 -1
  130. package/docs/commands/doc.md +1 -1
  131. package/docs/commands/end.md +1 -1
  132. package/docs/commands/find.md +1 -1
  133. package/docs/commands/git.md +110 -0
  134. package/docs/commands/handoff.md +70 -0
  135. package/docs/commands/harness.md +74 -0
  136. package/docs/commands/help.md +1 -1
  137. package/docs/commands/home.md +1 -1
  138. package/docs/commands/hooks-db.md +1 -1
  139. package/docs/commands/identity.md +1 -1
  140. package/docs/commands/install.md +1 -1
  141. package/docs/commands/issue.md +1 -1
  142. package/docs/commands/kg.md +1 -1
  143. package/docs/commands/launch.md +1 -1
  144. package/docs/commands/lessons.md +201 -0
  145. package/docs/commands/list.md +1 -1
  146. package/docs/commands/ls.md +1 -1
  147. package/docs/commands/mcp.md +1 -1
  148. package/docs/commands/memory.md +1 -1
  149. package/docs/commands/models.md +1 -1
  150. package/docs/commands/more.md +1 -1
  151. package/docs/commands/new.md +1 -1
  152. package/docs/commands/notes.md +1 -1
  153. package/docs/commands/notify.md +1 -1
  154. package/docs/commands/observation.md +1 -1
  155. package/docs/commands/obsidian.md +1 -1
  156. package/docs/commands/open.md +1 -1
  157. package/docs/commands/pane.md +1 -1
  158. package/docs/commands/pause.md +1 -1
  159. package/docs/commands/plan.md +1 -1
  160. package/docs/commands/project.md +1 -1
  161. package/docs/commands/projects.md +1 -1
  162. package/docs/commands/providers.md +1 -1
  163. package/docs/commands/queue.md +1 -1
  164. package/docs/commands/registry.md +1 -1
  165. package/docs/commands/reload.md +1 -1
  166. package/docs/commands/rename.md +1 -1
  167. package/docs/commands/restore.md +1 -1
  168. package/docs/commands/resume.md +1 -1
  169. package/docs/commands/router.md +1 -1
  170. package/docs/commands/rules.md +70 -0
  171. package/docs/commands/session.md +1 -1
  172. package/docs/commands/sessions.md +1 -1
  173. package/docs/commands/setup.md +1 -1
  174. package/docs/commands/setups.md +1 -1
  175. package/docs/commands/shell-init.md +1 -1
  176. package/docs/commands/skill.md +1 -1
  177. package/docs/commands/task.md +1 -1
  178. package/docs/commands/tasks.md +1 -1
  179. package/docs/commands/topic.md +1 -1
  180. package/docs/commands/update.md +1 -1
  181. package/docs/commands/worker.md +1 -1
  182. package/docs/commands/zettel.md +1 -1
  183. package/docs/concepts/panes.md +3 -2
  184. package/gemini-extension.json +1 -1
  185. package/package.json +2 -2
  186. package/pai-plugin.json +1 -1
  187. package/plugins/context-preservation/plugin.json +1 -1
  188. package/plugins/core/plugin.json +1 -1
  189. package/plugins/creative/plugin.json +1 -1
  190. package/plugins/observability/plugin.json +1 -1
  191. package/plugins/productivity/plugin.json +1 -1
  192. package/plugins/semantic-search/plugin.json +1 -1
  193. package/plugins/ui/plugin.json +1 -1
  194. package/plugins/zettelkasten/plugin.json +1 -1
  195. package/src/hooks/ts/lib/loop-guard.ts +3 -5
  196. package/src/hooks/ts/lib/rules/builtin/base64-decode-to-shell.rule.yaml +13 -0
  197. package/src/hooks/ts/lib/rules/builtin/chmod-world-writable.rule.yaml +13 -0
  198. package/src/hooks/ts/lib/rules/builtin/chmod-zero.rule.yaml +11 -0
  199. package/src/hooks/ts/lib/rules/builtin/credential-file-read.rule.yaml +13 -0
  200. package/src/hooks/ts/lib/rules/builtin/credential-read-then-network.rule.yaml +29 -0
  201. package/src/hooks/ts/lib/rules/builtin/crontab-persistence.rule.yaml +10 -0
  202. package/src/hooks/ts/lib/rules/builtin/curl-piped-to-shell.rule.yaml +15 -0
  203. package/src/hooks/ts/lib/rules/builtin/download-then-execute.rule.yaml +30 -0
  204. package/src/hooks/ts/lib/rules/builtin/find-root-delete.rule.yaml +11 -0
  205. package/src/hooks/ts/lib/rules/builtin/git-push-force.rule.yaml +24 -0
  206. package/src/hooks/ts/lib/rules/builtin/git-push-plus-refspec.rule.yaml +12 -0
  207. package/src/hooks/ts/lib/rules/builtin/git-reset-hard.rule.yaml +12 -0
  208. package/src/hooks/ts/lib/rules/builtin/injection-then-tool.rule.yaml +30 -0
  209. package/src/hooks/ts/lib/rules/builtin/instruction-override-disregard.rule.yaml +12 -0
  210. package/src/hooks/ts/lib/rules/builtin/instruction-override-ignore.rule.yaml +13 -0
  211. package/src/hooks/ts/lib/rules/builtin/launchagents-write-persistence.rule.yaml +12 -0
  212. package/src/hooks/ts/lib/rules/builtin/launchctl-load-persistence.rule.yaml +10 -0
  213. package/src/hooks/ts/lib/rules/builtin/reverse-shell-dev-tcp.rule.yaml +11 -0
  214. package/src/hooks/ts/lib/rules/builtin/reverse-shell-interactive-bash.rule.yaml +11 -0
  215. package/src/hooks/ts/lib/rules/builtin/rm-recursive-parent.rule.yaml +11 -0
  216. package/src/hooks/ts/lib/rules/builtin/rm-recursive-relative.rule.yaml +11 -0
  217. package/src/hooks/ts/lib/rules/builtin/rm-recursive-root.rule.yaml +24 -0
  218. package/src/hooks/ts/lib/rules/builtin/rm-trailing-tilde.rule.yaml +11 -0
  219. package/src/hooks/ts/lib/rules/builtin/sudoers-nopasswd.rule.yaml +15 -0
  220. package/src/hooks/ts/lib/rules/builtin.generated.ts +530 -0
  221. package/src/hooks/ts/lib/rules/eval.ts +74 -0
  222. package/src/hooks/ts/lib/rules/lint.ts +102 -0
  223. package/src/hooks/ts/lib/rules/load.ts +229 -0
  224. package/src/hooks/ts/lib/rules/types.ts +56 -0
  225. package/src/hooks/ts/pre-tool-use/security-validator.ts +27 -96
  226. package/src/hooks/ts/user-prompt/handoff-link.ts +34 -0
  227. package/dist/aibroker-client-BxzeEHPF.mjs +0 -3
  228. package/dist/auto-route-C3S2W3Bc.mjs +0 -11
  229. package/dist/budget-BrloTOZW.mjs +0 -15
  230. package/dist/cockpit-memory-teG9M8bG.mjs +0 -20
  231. package/dist/config-Cxi-aBf4.mjs +0 -4
  232. package/dist/daemon-DeYImF1F.mjs +0 -45
  233. package/dist/detect-Rrimh0xc.mjs +0 -10
  234. package/dist/factory-Bs9imVMq.mjs +0 -9
  235. package/dist/kill-tree-SV6hrIa3.mjs +0 -10
  236. package/dist/operator-BTqvTIc8.mjs +0 -7
  237. package/dist/providers-FvCLzFge.mjs +0 -16
  238. package/dist/registrable-BzH4TObg.mjs +0 -9
  239. package/dist/render-B35bQTE-.mjs +0 -13
  240. package/dist/render-C84BqQRC.mjs +0 -903
  241. package/dist/root-DD1xx_Vu.mjs +0 -36
  242. package/dist/route-table-FEfDuhIV.mjs +0 -15
  243. package/dist/session-BAhtXdxj.mjs +0 -35
  244. package/dist/session-scan-B57dNuA4.mjs +0 -9
  245. package/dist/status-Dm4dYciN.mjs +0 -6
  246. package/dist/viewer-DEySE4c_.mjs +0 -22
  247. package/dist/worker-config-CO5FXLAT.mjs +0 -41
  248. package/dist/workers-config-f8KrkY4L.mjs +0 -4
@@ -1,36 +1,36 @@
1
1
  import { _ as warn, c as ok, i as err, n as dim } from "./utils-J2b9y8PC.mjs";
2
- import { g as paiHomePath, h as paiHomeDir, l as claudeHomeDir, t as aibrokerHomeDir, u as claudeProjectsDir } from "./runtime-paths-WsO9sJFc.mjs";
3
- import { Et as parseLedger, G as inlineWorkersYamlKeys, J as parseBuiltinAnthropic, K as migrateWorkersToYaml, Q as relocateWorkersYaml, R as isLoopbackUrl, T as parseProvider, W as initWorkersYaml, Y as parseWorkersYamlDocument, c as WorkersConfigError, et as workersYamlLegacyNotice, ft as parseEntry, it as yamlProviderToRaw, j as readWorkersSection, lt as findTier, m as isLocalProvider, o as PROVIDER_TAGS, p as getProviderOrNative, q as needsWorkersYamlRelocation, t as ANTHROPIC_NATIVE, tt as workersYamlPath, wt as appendLedger, y as nativeAnthropicProvider, z as loopbackUrl } from "./config-XpZWOYOG.mjs";
4
- import { D as readJsonStrict, O as writeJsonAtomic, f as readMainConfigRaw, m as deepMergeConfig, n as CONFIG_FILE, o as expandHome, u as paiConfigFilePath, v as shippedDefaultsDir, y as shippedMainDefaults } from "./config-Bu1_vbY8.mjs";
5
- import { i as ledgerPath, t as WORKER_ID_RE, u as workersLogDir } from "./paths-CHifubDh.mjs";
6
- import { E as worktreesStatsCached, l as formatWorktreesStats } from "./worktree-CRs2gyg0.mjs";
7
- import { T as ownsPidCached, b as loadStatusesCached, g as isLive, v as loadStatus } from "./status-ggJ7lgVg.mjs";
8
- import { C as describeMcp, _ as readPoolMetrics, f as poolMetricsPath, h as poolSettings, i as bundleBuildStamp, l as poolHostProbe, o as poolCarry, u as poolHostStale, v as readPoolState, x as warmOrCold } from "./pool-Dh-q3iJi.mjs";
9
- import { a as ownerSessionName } from "./scope-D-h6F6DN.mjs";
10
- import { $n as splitBySessionKind, $t as POLICY_MODES, E as budgetCache, Ft as applyPolicyToRoutes, Gt as routeText, Ht as resolveSessionArg, I as buildSpeed, It as clearSessionRoute, Kt as servingChip, L as percentile, Mt as isTailnetOrLocalName, Nt as loopbackRefusal, Sn as probeLoopback, Tt as duplicateModelIds, Ut as routeChoices, W as currentInventory, Wt as routeRows, Xn as markTimeOrdered, Xt as setSessionRoute, Yn as isTimeOrdered, Yt as setRoute, an as parseDuration, at as readInventoryInput, bn as localTierOrder, cn as writePolicy, en as clearPolicy, er as usageLogFile, fn as getProfile, in as onBattery, it as readInventory, mn as readProfiles, on as readPolicy, rn as findLocal, rt as processTreeRssMb, sn as routeRun, vn as currentLocalStatus, xn as pickLocal, zt as flowText } from "./routing-DmkheCRH.mjs";
11
- import { C as stopLines, T as tierButtons, _ as readLocalConfig, a as LocalTierError, c as fetchServedModels, f as listensOnPort, g as planStart, h as parseServers, l as fmtRss, m as parseLocalConfig, u as healthUrl, v as resolveModelPath, x as stopCommandFor } from "./local-tiers-BE4jGaMa.mjs";
12
- import { _ as buildSlots, a as buildsDir, g as waitReason, l as listBuildsSync, m as ticketKind, n as breakStaleMutex, x as testSlots } from "./caller-identity-yLFb7CKq.mjs";
2
+ import { _ as paiHomePath, g as paiHomeDir, l as claudeHomeDir, t as aibrokerHomeDir, u as claudeProjectsDir } from "./runtime-paths-twfV23YL.mjs";
3
+ import { B as isLoopbackUrl, Et as appendLedger, J as migrateWorkersToYaml, K as initWorkersYaml, M as readWorkersSection, Ot as parseLedger, T as parseProvider, V as loopbackUrl, X as parseBuiltinAnthropic, Y as needsWorkersYamlRelocation, Z as parseWorkersYamlDocument, c as WorkersConfigError, dt as findTier, et as relocateWorkersYaml, m as isLocalProvider, mt as parseEntry, nt as workersYamlLegacyNotice, o as PROVIDER_TAGS, ot as yamlProviderToRaw, p as getProviderOrNative, q as inlineWorkersYamlKeys, rt as workersYamlPath, t as ANTHROPIC_NATIVE, y as nativeAnthropicProvider } from "./config-Bz8pAU5Q.mjs";
4
+ import { O as readJsonStrict, f as readMainConfigRaw, k as writeJsonAtomic, m as deepMergeConfig, n as CONFIG_FILE, o as expandHome, u as paiConfigFilePath, v as shippedDefaultsDir, w as readDualFormatConfigRaw, y as shippedMainDefaults } from "./config-SlZ-Z52i.mjs";
5
+ import { i as ledgerPath, t as WORKER_ID_RE, u as workersLogDir } from "./paths-CypxFTfn.mjs";
6
+ import { E as worktreesStatsCached, l as formatWorktreesStats } from "./worktree-O_kU6Q3y.mjs";
7
+ import { T as ownsPidCached, b as loadStatusesCached, g as isLive, v as loadStatus } from "./status-Cecau8Ps.mjs";
8
+ import { C as describeMcp, _ as readPoolMetrics, f as poolMetricsPath, h as poolSettings, i as bundleBuildStamp, l as poolHostProbe, o as poolCarry, u as poolHostStale, v as readPoolState, x as warmOrCold } from "./pool-9EsbKD-U.mjs";
9
+ import { a as ownerSessionName } from "./scope-BTWstJ1B.mjs";
10
+ import { $n as usageLogFile, $t as clearPolicy, E as budgetCache, Ft as clearSessionRoute, Gt as servingChip, Ht as routeChoices, I as buildSpeed, Jn as isTimeOrdered, Jt as setRoute, L as percentile, Mt as loopbackRefusal, Pt as applyPolicyToRoutes, Qn as splitBySessionKind, Qt as POLICY_MODES, Rt as flowText, Tt as duplicateModelIds, Ut as routeRows, Vt as resolveSessionArg, W as currentInventory, Wt as routeText, Yn as markTimeOrdered, Yt as setSessionRoute, _n as currentLocalStatus, an as readPolicy, at as readInventoryInput, bn as pickLocal, dn as getProfile, in as parseDuration, it as readInventory, jt as isTailnetOrLocalName, nn as findLocal, on as routeRun, pn as readProfiles, rn as onBattery, rt as processTreeRssMb, sn as writePolicy, xn as probeLoopback, yn as localTierOrder } from "./routing-aJKMIagQ.mjs";
11
+ import { C as stopLines, T as tierButtons, _ as readLocalConfig, a as LocalTierError, c as fetchServedModels, f as listensOnPort, g as planStart, h as parseServers, l as fmtRss, m as parseLocalConfig, u as healthUrl, v as resolveModelPath, x as stopCommandFor } from "./local-tiers-CqwGUcEn.mjs";
12
+ import { _ as buildSlots, a as buildsDir, g as waitReason, l as listBuildsSync, m as ticketKind, n as breakStaleMutex, x as testSlots } from "./caller-identity-C6Nc96iM.mjs";
13
13
  import { f as sharedScheduler, o as readSchedFile, u as schedPlain } from "./scheduler-CtUyWJ3O.mjs";
14
- import { l as reorderQueue, o as providerCap, s as queueRows, u as reorderQueueTo } from "./capacity-DEveQdFV.mjs";
15
- import { a as instancesFromProcesses, d as reconcileInstances, i as instanceNumber, l as readInstances, p as writeInstances, r as instanceEngineKey, u as readLiveInstances } from "./local-instances-DOxSgT_L.mjs";
16
- import { i as localStatusLine, s as readLocalStatus } from "./local-candidate-DLdwQt0s.mjs";
14
+ import { m as reorderQueueTo, o as providerCap, p as reorderQueue, s as queueRows } from "./capacity-B2PgKAg4.mjs";
15
+ import { a as instancesFromProcesses, d as reconcileInstances, i as instanceNumber, l as readInstances, p as writeInstances, r as instanceEngineKey, u as readLiveInstances } from "./local-instances-DhF4_sV2.mjs";
16
+ import { i as localStatusLine, s as readLocalStatus } from "./local-candidate-DFd4pp-w.mjs";
17
17
  import { t as LOCAL_PROBE_TIMEOUT_MS } from "./timeouts-1MLooEBB.mjs";
18
18
  import { n as OPT, t as CliError } from "./define-CjJsmq-6.mjs";
19
- import { c as resolveFromModule } from "./postgres-DNIOQijl.mjs";
20
- import { c as ensureProxyRunning, l as proxyPort, u as stopProxy } from "./launch-Di7N-J5X.mjs";
21
- import { a as colorEnabled, f as renderTable, n as readBudget, o as makeStyle } from "./health-C4FQmkJn.mjs";
22
- import { H as testProvider, o as sessionWorkersLine } from "./run-BwZKBJZZ.mjs";
23
- import { U as planRows, V as loadPlanStatuses, i as localIdleLine, n as markControlsHeld, s as readLocalIdle, t as clickrControlsArgv, yt as psTable } from "./controls-JLm6g0yP.mjs";
24
- import { w as parseDenialText } from "./render-C84BqQRC.mjs";
25
- import { n as diskBundleMtime, r as ensurePoolHost } from "./pool-cli-BggU8GRp.mjs";
26
- import { a as readAudit, d as loadPaneRunStatuses, f as paneRunRows } from "./pane-audit-Lqy9N_Ki.mjs";
27
- import { i as fallbackStatusText, n as fallbackOn, r as fallbackStatus, t as fallbackOff } from "./fallback-CBWpp2F2.mjs";
28
- import { b as useProvider, f as setClass, g as setWorkersEnabled, l as removeProvider, m as setProviderEnabled, p as setProviderCap, r as classTargetText, s as describeProviders, t as addProvider, v as unsetClass, y as updateProvider } from "./providers-C9QC0TtO.mjs";
29
- import { A as cockpitMemoryPayload, B as cockpitLayout, N as liveMemoryDeps, O as embeddingRuntimeName, P as memoryJobProgress, S as runtimeJobProgress, V as cockpitProbeSettings, c as defaultDeps, g as readLabels, h as readCockpitJob, k as readRuntimeCommands, t as COCKPIT_ACTION_EVENT, v as runCockpitAction, x as runningRuntimeJobs } from "./cockpit-actions-OodH_vx_.mjs";
30
- import { n as isRealUserPrompt, t as extractUserPromptText } from "./session-usage-CPvXvSkw.mjs";
31
- import { appendFileSync, chmodSync, closeSync, copyFileSync, createReadStream, existsSync, fstatSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, realpathSync, renameSync, rmSync, rmdirSync, statSync, unlinkSync, writeFileSync } from "node:fs";
19
+ import { c as resolveFromModule } from "./postgres-BL5oBBgY.mjs";
20
+ import { c as ensureProxyRunning, l as proxyPort, u as stopProxy } from "./launch-Bn2Zf90h.mjs";
21
+ import { a as colorEnabled, f as renderTable, n as readBudget, o as makeStyle } from "./health-D0mUAVdw.mjs";
22
+ import { H as testProvider, o as sessionWorkersLine } from "./run-DE9Q0ldN.mjs";
23
+ import { U as planRows, V as loadPlanStatuses, i as localIdleLine, n as markControlsHeld, s as readLocalIdle, t as clickrControlsArgv } from "./controls-rIItFeIJ.mjs";
24
+ import { V as maskSecrets, q as psTable, w as parseDenialText } from "./render-jPpMrudf.mjs";
25
+ import { n as diskBundleMtime, r as ensurePoolHost } from "./pool-cli-Db0uDwB9.mjs";
26
+ import { a as readAudit, d as loadPaneRunStatuses, f as paneRunRows } from "./pane-audit-DLYy9-4g.mjs";
27
+ import { b as useProvider, f as setClass, g as setWorkersEnabled, l as removeProvider, m as setProviderEnabled, p as setProviderCap, r as classTargetText, s as describeProviders, t as addProvider, v as unsetClass, y as updateProvider } from "./providers-BNV7CzC-.mjs";
28
+ import { A as cockpitMemoryPayload, B as cockpitLayout, N as liveMemoryDeps, O as embeddingRuntimeName, P as memoryJobProgress, S as runtimeJobProgress, V as cockpitProbeSettings, c as defaultDeps, g as readLabels, h as readCockpitJob, k as readRuntimeCommands, t as COCKPIT_ACTION_EVENT, v as runCockpitAction, x as runningRuntimeJobs } from "./cockpit-actions-D1OPP6Es.mjs";
29
+ import { n as isRealUserPrompt, s as workersConfigShadows, t as extractUserPromptText } from "./session-usage-CCmPFFa6.mjs";
30
+ import { i as fallbackStatusText, n as fallbackOn, r as fallbackStatus, t as fallbackOff } from "./fallback-CwPSCrX8.mjs";
31
+ import { appendFileSync, chmodSync, closeSync, copyFileSync, createReadStream, existsSync, fstatSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, renameSync, rmSync, rmdirSync, statSync, unlinkSync, writeFileSync } from "node:fs";
32
32
  import { createHash } from "node:crypto";
33
- import { basename, dirname, isAbsolute, join, normalize, relative, resolve } from "node:path";
33
+ import { basename, dirname, join, resolve } from "node:path";
34
34
  import chalk from "chalk";
35
35
  import { homedir, loadavg } from "node:os";
36
36
  import { execFile, execFileSync, spawn } from "node:child_process";
@@ -231,6 +231,37 @@ function pathFromMessage(msg) {
231
231
  text: m[2]
232
232
  };
233
233
  }
234
+ /** Shadowed/unused keys of `text` against config.yaml: unchanged ones warn, a new or changed one is refused (the effective value lives elsewhere). */
235
+ function shadowFindings(text, current, ctx, at) {
236
+ const out = {
237
+ errors: [],
238
+ warnings: []
239
+ };
240
+ const parse = (t) => {
241
+ const v = parseDocument(t, { uniqueKeys: false }).toJS() ?? {};
242
+ return typeof v === "object" && v !== null && !Array.isArray(v) ? v : {};
243
+ };
244
+ let main = {};
245
+ try {
246
+ main = readDualFormatConfigRaw(ctx.mainConfigPath ?? paiConfigFilePath());
247
+ } catch {}
248
+ const before = new Map(workersConfigShadows(main, parse(current)).filter((s) => s.file === "workers.yaml").map((s) => [s.key, JSON.stringify(s.value)]));
249
+ for (const s of workersConfigShadows(main, parse(text))) {
250
+ if (s.file !== "workers.yaml") continue;
251
+ const path = s.key.split(".");
252
+ if (before.get(s.key) === JSON.stringify(s.value)) out.warnings.push({
253
+ path: s.key,
254
+ line: at(path),
255
+ message: s.message
256
+ });
257
+ else out.errors.push({
258
+ path: s.key,
259
+ line: at(path),
260
+ message: `${s.message}; not saved here`
261
+ });
262
+ }
263
+ return out;
264
+ }
234
265
  /**
235
266
  * Validate registry YAML text. `current` (the text on disk) scopes the
236
267
  * port-in-use and removal checks to what the edit changes.
@@ -332,6 +363,8 @@ function validateRegistry(yamlText, ctx, current = "") {
332
363
  "model"
333
364
  ], `model file not found: ${t.model}`);
334
365
  }
366
+ const shadow = shadowFindings(yamlText, current, ctx, at);
367
+ errors.push(...shadow.errors);
335
368
  const running = (ctx.running?.() ?? []).filter((i) => i.state === "starting" || i.state === "ready");
336
369
  for (const name of Object.keys(before)) {
337
370
  if (tiers[name]) continue;
@@ -340,7 +373,10 @@ function validateRegistry(yamlText, ctx, current = "") {
340
373
  }
341
374
  const provNames = new Set(Object.keys(providers));
342
375
  for (const inst of running) if (inst.origin === "registered" && !provNames.has(inst.provider)) add(["providers"], `cannot remove provider "${inst.provider}": instance ${inst.id} is running`);
343
- return { errors };
376
+ return {
377
+ errors,
378
+ warnings: shadow.warnings
379
+ };
344
380
  }
345
381
  /**
346
382
  * Every providers.<name> entry carries an explicit `enabled:` so a search for `enabled: true` finds
@@ -419,7 +455,7 @@ function validateRequest(yamlText, baseHash, ctx) {
419
455
  }],
420
456
  diff: []
421
457
  };
422
- const { errors } = validateRegistry(yamlText, ctx, cur);
458
+ const { errors, warnings } = validateRegistry(yamlText, ctx, cur);
423
459
  let shown = yamlText;
424
460
  if (!errors.length) {
425
461
  if (ctx.explicitEnabled) shown = withExplicitEnabled(shown);
@@ -428,6 +464,7 @@ function validateRequest(yamlText, baseHash, ctx) {
428
464
  return {
429
465
  ok: errors.length === 0,
430
466
  errors,
467
+ warnings,
431
468
  diff: diffLines(cur, shown)
432
469
  };
433
470
  }
@@ -909,7 +946,7 @@ const shellHead = (L, n, q, hex) => String.raw(_templateObject$1 || (_templateOb
909
946
  const shellBody = (L, n, q, hex) => String.raw`</style><style>
910
947
  #legend>.lgline{gap:2px 8px;font-size:11px}#legend>.lgline span{white-space:nowrap}
911
948
  </style></head><body>
912
- <header><div class="hl"><h1>PAI<span class="hc"> Cockpit</span></h1><span id="ver" title="PAI __COCKPIT_VERSION__ · build __COCKPIT_BUILD__"><span class="vm">v__COCKPIT_VERSION_SHORT__</span><span class="vp">__COCKPIT_VERSION_PATCH__</span></span></div>
949
+ <header><div class="hl"><h1>__COCKPIT_HOMEPAGE__</h1><span id="ver" title="PAI __COCKPIT_VERSION__ · build __COCKPIT_BUILD__"><span class="vm">v__COCKPIT_VERSION_SHORT__</span><span class="vp">__COCKPIT_VERSION_PATCH__</span></span></div>
913
950
  <div class="tabs" id="tabs"><button data-w="1h">1 hour</button><button data-w="24h">Today</button><button data-w="7d">Week</button></div>
914
951
  <div class="hr"><span id="stamp">loading...</span><span id="ask" hidden><span class="aq"></span> <button id="askyes" type="button" aria-label="confirm">✓</button><button id="askno" type="button" aria-label="cancel">✕</button></span><button id="reset" type="button" title="reset to the default layout" aria-label="reset to the default layout">⟲</button><button id="savedef" type="button" title="save this layout as the default for all devices" aria-label="save layout as default">☆</button><button id="lock" type="button" title="lock layout" aria-label="layout unlocked" aria-pressed="false"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="7" width="10" height="7" rx="1.5"/><path d="M5 7V5a3 3 0 0 1 6 0"/></svg></button><button id="theme" type="button" title="Dark mode" aria-label="Dark mode"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path class="ic-moon" d="M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8Z"/><g class="ic-sun"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></g></svg></button></div></header><a id="newer" href="#" hidden title="The router now serves a newer cockpit build than this open page; reload to get it.">newer cockpit available — reload</a><a id="newdef" href="#" hidden title="A newer default layout was saved on another device; your layout here was edited after it.">newer default available · use it</a>
915
952
  <div id="toast" role="status" hidden></div>
@@ -1226,6 +1263,7 @@ const css = (L, n, q, hex) => String.raw`:root{--bg:#f6f7f9;--card:#fff;--fg:#1d
1226
1263
  *{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--fg);font:13px/1.45 -apple-system,BlinkMacSystemFont,"SF Pro Text",sans-serif}
1227
1264
  header{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:16px;padding:8px 14px;border-bottom:1px solid var(--line);position:sticky;top:0;background:var(--bg);z-index:2}
1228
1265
  h1{font-size:15px;margin:0;font-weight:600}
1266
+ h1 .home{color:inherit;text-decoration:none}h1 .home:hover,h1 .home:focus-visible{text-decoration:underline}
1229
1267
  .hl{display:flex;align-items:baseline;min-width:0}.hr{display:flex;align-items:center;justify-content:flex-end;gap:16px;min-width:0}
1230
1268
  #ver{display:flex;flex:0 100 auto;min-width:0;overflow:hidden;font-size:11px;color:var(--dim,#888);opacity:.7;margin-left:6px;white-space:nowrap;cursor:default}
1231
1269
  .tabs button{background:var(--card);color:var(--fg);border:1px solid var(--line);padding:3px 12px;cursor:pointer;font:inherit}
@@ -4181,11 +4219,25 @@ function wmdModelActs(id){
4181
4219
  run:function(){var m=wmdModel(id);runIt("more","local.scale",{target:m.tier,count:m.instances.length+1})}}
4182
4220
  ];
4183
4221
  }
4222
+ /** "parallel N" with -/+ for a provider that has a concurrency cap; over the server's slot count a warning tooltip. */
4223
+ function wmdParallel(m){
4224
+ if(!m.maxConcurrent||!m.provider)return"";
4225
+ var over=m.slots&&m.maxConcurrent>m.slots,min=m.capMin||1,max=m.capMax||16;
4226
+ return' <span class="num wmd-par'+(over?" warn":"")+'"'+(over?' title="above the server\'s '+m.slots+' slots: extra runs queue at the server"':' title="runs the provider admits in parallel"')+'>parallel '+m.maxConcurrent+(m.slots?" / "+m.slots+" slots":"")+
4227
+ ' <button type="button" class="b wmd-par-b" data-p="'+esc(m.provider)+'" data-d="-1"'+(m.maxConcurrent<=min?" disabled":"")+' title="one parallel run fewer">\u2212</button>'+
4228
+ '<button type="button" class="b wmd-par-b" data-p="'+esc(m.provider)+'" data-d="1"'+(m.maxConcurrent>=max?" disabled":"")+' title="one parallel run more">+</button></span>';
4229
+ }
4184
4230
  Win.registerType("model",{minW:300,minH:90,defaultH:120,
4185
4231
  mount:function(ctx){
4186
4232
  ctx.body.innerHTML='<div class="wmd"><div class="wmd-top" data-k="badges"></div><div class="dim wmd-n" data-k="note"></div><div class="wmd-i" data-k="inst"></div></div>';
4187
4233
  ctx.body.addEventListener("click",function(ev){
4188
4234
  var b=ev.target;
4235
+ if(b&&b.classList&&b.classList.contains("wmd-par-b")){
4236
+ b.disabled=true;
4237
+ winHost().fetch("/cockpit/providers/"+encodeURIComponent(b.getAttribute("data-p"))+"/concurrency",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({delta:Number(b.getAttribute("data-d"))}),cache:"no-store"})
4238
+ .then(function(){if(typeof loadModels==="function")loadModels()},function(){b.disabled=false});
4239
+ return;
4240
+ }
4189
4241
  if(!b||!b.classList||!b.classList.contains("wmd-stop"))return;
4190
4242
  WinA.winClick(b,ctx.id,"local.stop",{target:b.getAttribute("data-id"),value:b.getAttribute("data-busy")!=="0"?"confirm":undefined},winHost());
4191
4243
  });
@@ -4194,7 +4246,7 @@ Win.registerType("model",{minW:300,minH:90,defaultH:120,
4194
4246
  var m=wmdModel(ctx.id);
4195
4247
  if(!m){ctx.status("stale","no longer reported");return}
4196
4248
  var n=m.instances.length;
4197
- ctx.html("badges",'<span class="badge">'+esc(m.engine)+'</span> <span class="badge mstate">'+esc(m.state)+'</span> '+(WMD&&WMD.inv&&WMD.inv.localDefaultTier===m.tier?'<span class="badge ok" title="the running model local work goes to (pai worker run --local)">local default</span> ':"")+'<span class="num" title="running instances / max instances">instances '+n+" / "+m.maxInstances+'</span> <span class="num" title="requests in flight / the provider maxConcurrent (none = no cap)">requests '+m.instances.reduce(function(a,x){return a+(x.inflight||0)},0)+(m.maxConcurrent?" / "+m.maxConcurrent:"")+"</span>");
4249
+ ctx.html("badges",'<span class="badge">'+esc(m.engine)+'</span> <span class="badge mstate">'+esc(m.state)+'</span> '+(WMD&&WMD.inv&&WMD.inv.localDefaultTier===m.tier?'<span class="badge ok" title="the running model local work goes to (pai worker run --local)">local default</span> ':"")+'<span class="num" title="running instances / max instances">instances '+n+" / "+m.maxInstances+'</span> <span class="num" title="requests in flight / the provider maxConcurrent (none = no cap)">requests '+m.instances.reduce(function(a,x){return a+(x.inflight||0)},0)+(m.maxConcurrent?" / "+m.maxConcurrent:"")+"</span>"+wmdParallel(m));
4198
4250
  ctx.html("note",(m.weightsBytes?'<span class="num" title="weight size on disk">'+gbm(m.weightsBytes/1048576)+" GB</span> · ":"")+'<span title="'+esc(m.file)+'">'+esc(String(m.file).replace(/^.*\//,""))+"</span> · :"+m.port);
4199
4251
  ctx.list("inst",m.instances,function(i){return i.id},function(){var d=document.createElement("div");d.className="linst";return d},function(d,i){
4200
4252
  var h='<span class="ok">'+esc(i.id)+'</span> <span class="dim">:'+i.port+(i.pid!=null?" · pid "+i.pid:"")+" · "+(i.inflight||0)+' in flight</span> <button type="button" class="b wmd-stop" data-act="local.stop" data-id="'+esc(i.id)+'" data-busy="'+(i.inflight||0)+'" title="stop instance '+esc(i.id)+' (asks to confirm when requests are in flight)">stop</button>';
@@ -6523,74 +6575,6 @@ function selectorChoices(workers, endpoints) {
6523
6575
  ];
6524
6576
  }
6525
6577
 
6526
- //#endregion
6527
- //#region src/hooks/ts/lib/build-gate.ts
6528
- /** Tiny reader for the two keys of builds.yaml: flow `[a, b]` or block `- a` lists. */
6529
- function parseBuildsYaml(text) {
6530
- const res = {
6531
- doors: [],
6532
- patterns: []
6533
- };
6534
- let key = null;
6535
- const unq = (s) => s.trim().replace(/^(['"])(.*)\1$/, "$2");
6536
- for (const raw of text.split("\n")) {
6537
- const line = raw.replace(/(^|\s)#.*$/, "");
6538
- if (!line.trim()) continue;
6539
- const m = /^(doors|patterns)\s*:\s*(.*)$/.exec(line);
6540
- if (m) {
6541
- key = m[1];
6542
- const rest = m[2].trim();
6543
- if (rest.startsWith("[")) {
6544
- res[key].push(...rest.replace(/^\[|\]$/g, "").split(",").map(unq).filter(Boolean));
6545
- key = null;
6546
- }
6547
- continue;
6548
- }
6549
- const li = /^\s*-\s+(.*)$/.exec(line);
6550
- if (li && key) res[key].push(unq(li[1]));
6551
- else if (!/^\s/.test(line)) key = null;
6552
- }
6553
- return res;
6554
- }
6555
- /** The nearest `.pai/builds.yaml` at or above `cwd`. */
6556
- function loadBuildsConfig(cwd) {
6557
- let dir = resolve(cwd);
6558
- for (;;) {
6559
- const f = join(dir, ".pai", "builds.yaml");
6560
- if (existsSync(f)) try {
6561
- return {
6562
- root: dir,
6563
- ...parseBuildsYaml(readFileSync(f, "utf8"))
6564
- };
6565
- } catch {
6566
- return null;
6567
- }
6568
- const up = dirname(dir);
6569
- if (up === dir) return null;
6570
- dir = up;
6571
- }
6572
- }
6573
-
6574
- //#endregion
6575
- //#region src/hooks/ts/lib/loop-guard.ts
6576
- const LOOP_MAX_REPEATS = 4;
6577
- /** Consecutive same-template read-only Bash calls without a worktree change after which the next one is denied (env PAI_LOOP_READ_STREAK overrides). */
6578
- const LOOP_READ_STREAK = Number(process.env.PAI_LOOP_READ_STREAK) > 0 ? Number(process.env.PAI_LOOP_READ_STREAK) : 15;
6579
- const SELF = "If your part is done, commit and write your R report. If you are stuck, report the blocker in R x= (or use pai worker help if available).";
6580
- const LOOP_DENY_REASON = `loop guard: you ran this command ${LOOP_MAX_REPEATS} times with the same result and nothing changed. Stop repeating it. ${SELF}`;
6581
- /** Total polling time per command key after which a "still running" helper is treated as an ordinary repeat again. */
6582
- const WAIT_CAP_MS = 45 * 6e4;
6583
- /** Untracked files up to this size are hashed by content; larger ones by size + mtime. */
6584
- const FP_FULL_READ_BYTES = 256 * 1024;
6585
- /** Content bytes read per fingerprint across all untracked files; past it files are hashed by size + mtime. */
6586
- const FP_TOTAL_BYTES = 4 * 1024 * 1024;
6587
- const SECRET_LINE = /pass(?:word|wd)|secret|token|api[_-]?key|credential|authorization|bearer|private key|^\s*(?:export\s+)?[A-Z][A-Z0-9_]*(?:KEY|SECRET|TOKEN|PASS\w*|CRED\w*|AUTH\w*)\s*=|\b(?:sk|ghp|gho|xox[bap])[-_][A-Za-z0-9_-]{16,}|\b[A-Za-z0-9+]{40,}={0,2}(?![\w/])|\b[a-z][a-z0-9+.-]*:\/\/[^\s\/:@]+:[^\s\/@]+@|\b(?:AKIA|ASIA|AGPA|AIDA|AROA)[A-Z0-9]{16}\b|\bgh[pousr]_[A-Za-z0-9]{20,}/i;
6588
- const MASKED_LINE = "[line masked: looks like a secret]";
6589
- /** Result text with lines that look like secrets replaced by a marker. */
6590
- function maskSecrets(text) {
6591
- return text.split("\n").map((l) => SECRET_LINE.test(l) ? MASKED_LINE : l).join("\n");
6592
- }
6593
-
6594
6578
  //#endregion
6595
6579
  //#region src/router/session-detail.ts
6596
6580
  /**
@@ -7625,7 +7609,20 @@ async function cockpitModelsPayload() {
7625
7609
  function registryModelsNow() {
7626
7610
  try {
7627
7611
  const providers = readWorkersSection().workers.providers;
7628
- return registryModels(readLocalConfig(workersYamlPath()), localInstanceRows(), weightsBytes, (t) => providers[t.provider]?.maxConcurrent);
7612
+ const { concurrencyMin, concurrencyMax } = cockpitLayout();
7613
+ const cfg = readLocalConfig(workersYamlPath());
7614
+ return registryModels(cfg, localInstanceRows(), weightsBytes, (t) => providers[t.provider]?.maxConcurrent).map((m) => {
7615
+ const provider = cfg.tiers[m.tier]?.provider;
7616
+ const p = provider ? providers[provider] : void 0;
7617
+ if (m.maxConcurrent === void 0 || !provider || !p) return m;
7618
+ return {
7619
+ ...m,
7620
+ provider,
7621
+ ...p.conversationSlots !== void 0 ? { slots: p.conversationSlots } : {},
7622
+ capMin: concurrencyMin,
7623
+ capMax: concurrencyMax
7624
+ };
7625
+ });
7629
7626
  } catch {
7630
7627
  return [];
7631
7628
  }
@@ -8116,6 +8113,9 @@ const BUILD_PLACEHOLDER = /__COCKPIT_BUILD__/g;
8116
8113
  const VERSION_PLACEHOLDER = /__COCKPIT_VERSION__/g;
8117
8114
  const VERSION_SHORT_PLACEHOLDER = /__COCKPIT_VERSION_SHORT__/g;
8118
8115
  const VERSION_PATCH_PLACEHOLDER = /__COCKPIT_VERSION_PATCH__/g;
8116
+ const HOMEPAGE_PLACEHOLDER = /__COCKPIT_HOMEPAGE__/g;
8117
+ /** The header title markup, spelled once: the link's inner content and the no-homepage fallback. */
8118
+ const TITLE_MARKUP = "PAI<span class=\"hc\"> Cockpit</span>";
8119
8119
  let pkgVersion = null;
8120
8120
  /** The version this router runs: package.json, read once at startup (the one owner of the header's "v<version>"). */
8121
8121
  function cockpitVersion() {
@@ -8127,6 +8127,17 @@ function cockpitVersion() {
8127
8127
  }
8128
8128
  return pkgVersion;
8129
8129
  }
8130
+ /** The project homepage from package.json, read once at startup; null when absent (the header title then stays plain text).
8131
+ * The placeholder stands in for the whole h1 content, so no URL literal is in the page source. */
8132
+ let pkgHomepage;
8133
+ function cockpitHomepage() {
8134
+ if (pkgHomepage === void 0) try {
8135
+ pkgHomepage = JSON.parse(readFileSync(resolveFromModule(import.meta.url, "package.json"), "utf8")).homepage ?? null;
8136
+ } catch {
8137
+ pkgHomepage = null;
8138
+ }
8139
+ return pkgHomepage;
8140
+ }
8130
8141
  /** Where the page gets the default layout this install serves (null = compose its own). */
8131
8142
  const SAVED_AT_PLACEHOLDER = "0/*__COCKPIT_LAYOUT_SAVED_AT__*/";
8132
8143
  const LAYOUT_PLACEHOLDER = "null/*__COCKPIT_LAYOUT__*/";
@@ -8214,6 +8225,48 @@ function handleCockpit(req, res, limits, readRows = cachedRows(), sessionMap = l
8214
8225
  })));
8215
8226
  return true;
8216
8227
  }
8228
+ const concurrency = req.method === "POST" ? /^\/cockpit\/providers\/([^/]+)\/concurrency$/.exec(url.pathname) : null;
8229
+ if (concurrency) {
8230
+ if (!sameOriginAction(req)) return send(403, "application/json", JSON.stringify({
8231
+ ok: false,
8232
+ message: "cross-origin action refused"
8233
+ })), true;
8234
+ const name = decodeURIComponent(concurrency[1]);
8235
+ readJsonObject(readBody, req).then((b) => {
8236
+ const { delta } = b;
8237
+ if (delta !== 1 && delta !== -1) return send(400, "application/json", JSON.stringify({
8238
+ ok: false,
8239
+ message: "delta must be +1 or -1"
8240
+ }));
8241
+ try {
8242
+ const cur = readWorkersSection().workers.providers[name]?.maxConcurrent;
8243
+ if (cur === void 0) return send(404, "application/json", JSON.stringify({
8244
+ ok: false,
8245
+ message: `provider "${name}" has no concurrency cap`
8246
+ }));
8247
+ const { concurrencyMin, concurrencyMax } = cockpitLayout();
8248
+ const next = Math.min(concurrencyMax, Math.max(concurrencyMin, cur + delta));
8249
+ if (next !== cur) setProviderCap(name, next);
8250
+ send(200, "application/json", JSON.stringify({
8251
+ ok: true,
8252
+ provider: name,
8253
+ maxConcurrent: next,
8254
+ min: concurrencyMin,
8255
+ max: concurrencyMax,
8256
+ clamped: next !== cur + delta
8257
+ }));
8258
+ } catch (e) {
8259
+ send(409, "application/json", JSON.stringify({
8260
+ ok: false,
8261
+ message: e.message
8262
+ }));
8263
+ }
8264
+ }).catch((e) => send(bodyErrorStatus(e), "application/json", JSON.stringify({
8265
+ ok: false,
8266
+ message: e.message
8267
+ })));
8268
+ return true;
8269
+ }
8217
8270
  if (req.method === "POST" && url.pathname === "/cockpit/action") {
8218
8271
  if (!sameOriginAction(req)) return send(403, "application/json", JSON.stringify({
8219
8272
  ok: false,
@@ -8267,7 +8320,11 @@ function handleCockpit(req, res, limits, readRows = cachedRows(), sessionMap = l
8267
8320
  if (url.pathname === "/cockpit") {
8268
8321
  let html = "";
8269
8322
  try {
8270
- html = cockpitHtml().replace(BUILD_PLACEHOLDER, cockpitBuildId()).replace(VERSION_SHORT_PLACEHOLDER, cockpitVersion().split(".").slice(0, 2).join(".")).replace(VERSION_PATCH_PLACEHOLDER, cockpitVersion().split(".").slice(2).map((p) => "." + p).join("")).replace(VERSION_PLACEHOLDER, cockpitVersion()).replace(LAYOUT_PLACEHOLDER, () => JSON.stringify(readDefaultLayout()).replace(/</g, "\\u003c")).replace(SAVED_AT_PLACEHOLDER, String(defaultSavedAt()));
8323
+ html = cockpitHtml().replace(BUILD_PLACEHOLDER, cockpitBuildId()).replace(VERSION_SHORT_PLACEHOLDER, cockpitVersion().split(".").slice(0, 2).join(".")).replace(VERSION_PATCH_PLACEHOLDER, cockpitVersion().split(".").slice(2).map((p) => "." + p).join("")).replace(VERSION_PLACEHOLDER, cockpitVersion()).replace(HOMEPAGE_PLACEHOLDER, () => {
8324
+ const home = cockpitHomepage();
8325
+ if (!home) return TITLE_MARKUP;
8326
+ return `<a class="home" href="${home.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;")}" target="_blank" rel="noopener">${TITLE_MARKUP}</a>`;
8327
+ }).replace(LAYOUT_PLACEHOLDER, () => JSON.stringify(readDefaultLayout()).replace(/</g, "\\u003c")).replace(SAVED_AT_PLACEHOLDER, String(defaultSavedAt()));
8271
8328
  } catch {}
8272
8329
  if (html) send(200, "text/html; charset=utf-8", html);
8273
8330
  else {
@@ -10568,9 +10625,9 @@ async function stopInstance(cfg, target, opts = {}, deps = {}) {
10568
10625
  */
10569
10626
  async function cliInflight(cfg, deps = {}) {
10570
10627
  const [{ engineInflight }, { readSchedFile }, { instanceEngineKey }] = await Promise.all([
10571
- import("./cockpit-actions-BfRMr2sm.mjs"),
10628
+ import("./cockpit-actions-C73mJAJ8.mjs"),
10572
10629
  import("./scheduler-dmHXoRvm.mjs"),
10573
- import("./local-instances-ZeRkkuS5.mjs")
10630
+ import("./local-instances-KTh8IeOT.mjs")
10574
10631
  ]);
10575
10632
  const now = deps.now ?? Date.now();
10576
10633
  const snap = readSchedFile(deps.startDir ?? logDir(), now);
@@ -10988,7 +11045,7 @@ const workerPoolCommand = {
10988
11045
  async run(ctx) {
10989
11046
  try {
10990
11047
  const action = ctx.args.ACTION;
10991
- const { poolOn, poolOff, poolStatusText } = await import("./pool-cli-DQ6OzRy2.mjs");
11048
+ const { poolOn, poolOff, poolStatusText } = await import("./pool-cli-Cy5mlycP.mjs");
10992
11049
  if (action === void 0 || action === "status") return void out(await poolStatusText(logDir()));
10993
11050
  if (action === "on") return void (await poolOn(logDir())).forEach((l) => out(l));
10994
11051
  if (action === "off") return void (await poolOff(logDir())).forEach((l) => out(l));
@@ -11164,5 +11221,5 @@ const WORKER_CONFIG_COMMANDS = [
11164
11221
  ];
11165
11222
 
11166
11223
  //#endregion
11167
- export { exportDefaultLayout as $, workerMcpCommand as A, mergeSettings as B, workerBenchCommand as C, workerFallbackCommand as D, workerControlsCommand as E, workerProvidersCommand as F, cachedRows as G, canBind as H, workerProxyCommand as I, handleCockpit as J, cachedSessionMap as K, workerRolesCommand as L, workerOnCommand as M, workerPolicyCommand as N, workerInstallCommand as O, workerPoolCommand as P, warmCockpit as Q, workerRouteCommand as R, stopInstance as S, workerConfigCommand as T, sizeOnDiskGb as U, allocatePort as V, SystemMonitor as W, setEndpointHealth as X, setActionHooks as Y, setRuntimeSampler as Z, portOpen as _, collectEnv as a, withWorkerAttribution as at, startTier as b, currentInstances as c, saveRegistry as ct, isUp as d, loadBuildsConfig as et, killInstance as f, portListeners as g, parseCostTier as h, cliInflight as i, sessionDisplayName as it, workerOffCommand as j, workerLocalCommand as k, fail as l, providersCommand as lt, listServers as m, WORKER_CONFIG_COMMANDS as n, loadSessionMap as nt, collectTags as o, defaultRegistryCtx as ot, launchDetached as p, cachedWorkerWindows as q, buildClassTarget as r, loadWorkerWindows as rt, controlsArgv as s, hashText as st, PROVIDER_EDIT_COMMANDS as t, createEndpointHealth as tt, healthOk as u, serverLine as v, workerClassesCommand as w, stopAll as x, startInstance as y, installWorkers as z };
11168
- //# sourceMappingURL=worker-config-eY5Qy4vl.mjs.map
11224
+ export { exportDefaultLayout as $, workerMcpCommand as A, mergeSettings as B, workerBenchCommand as C, workerFallbackCommand as D, workerControlsCommand as E, workerProvidersCommand as F, cachedRows as G, canBind as H, workerProxyCommand as I, handleCockpit as J, cachedSessionMap as K, workerRolesCommand as L, workerOnCommand as M, workerPolicyCommand as N, workerInstallCommand as O, workerPoolCommand as P, warmCockpit as Q, workerRouteCommand as R, stopInstance as S, workerConfigCommand as T, sizeOnDiskGb as U, allocatePort as V, SystemMonitor as W, setEndpointHealth as X, setActionHooks as Y, setRuntimeSampler as Z, portOpen as _, collectEnv as a, defaultRegistryCtx as at, startTier as b, currentInstances as c, providersCommand as ct, isUp as d, createEndpointHealth as et, killInstance as f, portListeners as g, parseCostTier as h, cliInflight as i, withWorkerAttribution as it, workerOffCommand as j, workerLocalCommand as k, fail as l, listServers as m, WORKER_CONFIG_COMMANDS as n, loadWorkerWindows as nt, collectTags as o, hashText as ot, launchDetached as p, cachedWorkerWindows as q, buildClassTarget as r, sessionDisplayName as rt, controlsArgv as s, saveRegistry as st, PROVIDER_EDIT_COMMANDS as t, loadSessionMap as tt, healthOk as u, serverLine as v, workerClassesCommand as w, stopAll as x, startInstance as y, installWorkers as z };
11225
+ //# sourceMappingURL=worker-config-DkONNk_H.mjs.map
@@ -0,0 +1,4 @@
1
+ import { $ as readWorkersYaml, G as effectiveWorkersYamlData, H as WORKERS_YAML_FILENAME, J as migrateWorkersToYaml, K as initWorkersYaml, Q as readMergeVerify, U as buildWorkersYamlText, W as defaultWorkersYamlPath, X as parseBuiltinAnthropic, Y as needsWorkersYamlRelocation, Z as parseWorkersYamlDocument, at as writeWorkersYamlText, et as relocateWorkersYaml, it as writeWorkersYaml, nt as workersYamlLegacyNotice, ot as yamlProviderToRaw, q as inlineWorkersYamlKeys, rt as workersYamlPath, tt as starterWorkersYamlText } from "./config-Bz8pAU5Q.mjs";
2
+ import "./config-SlZ-Z52i.mjs";
3
+
4
+ export { workersYamlPath };