@tekmidian/pai 0.42.5 → 0.42.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.
- package/ARCHITECTURE.md +9 -9
- package/README.md +26 -8
- package/dist/{aibroker-client-BP74gGwD.mjs → aibroker-client-Bn9SnGMa.mjs} +3 -3
- package/dist/{aibroker-client-BP74gGwD.mjs.map → aibroker-client-Bn9SnGMa.mjs.map} +1 -1
- package/dist/{aibroker-client-C6m71p6O.mjs → aibroker-client-D5NT0S1N.mjs} +1 -1
- package/dist/{auto-route-_5zzJz5q.mjs → auto-route-CcD0OWWB.mjs} +4 -4
- package/dist/{auto-route-_5zzJz5q.mjs.map → auto-route-CcD0OWWB.mjs.map} +1 -1
- package/dist/{chain-DTII7xeL.mjs → chain-BbcfP77K.mjs} +5 -4
- package/dist/{chain-DTII7xeL.mjs.map → chain-BbcfP77K.mjs.map} +1 -1
- package/dist/cli/index.mjs +23 -21
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/program.d.mts.map +1 -1
- package/dist/cli/program.mjs +23 -21
- package/dist/{clusters-j0ZuNYp9.mjs → clusters-Cw_P6lO-.mjs} +2 -2
- package/dist/{clusters-j0ZuNYp9.mjs.map → clusters-Cw_P6lO-.mjs.map} +1 -1
- package/dist/{config-B64vFg14.mjs → config-DCu8THKi.mjs} +41 -9
- package/dist/{config-B64vFg14.mjs.map → config-DCu8THKi.mjs.map} +1 -1
- package/dist/config-DeqFqa1N.mjs +3 -0
- package/dist/config-DxMZjpvY.mjs +1289 -0
- package/dist/config-DxMZjpvY.mjs.map +1 -0
- package/dist/context-handover-cache-B9NKSjwR.mjs +3242 -0
- package/dist/context-handover-cache-B9NKSjwR.mjs.map +1 -0
- package/dist/daemon/index.mjs +23 -22
- package/dist/daemon/index.mjs.map +1 -1
- package/dist/daemon-BNjbVsQU.mjs +24 -0
- package/dist/{daemon-B8N1egl0.mjs → daemon-BppziPi6.mjs} +52 -38
- package/dist/daemon-BppziPi6.mjs.map +1 -0
- package/dist/daemon-mcp/index.mjs +144 -117
- package/dist/daemon-mcp/index.mjs.map +1 -1
- package/dist/db-BOBfewFH.mjs +3 -0
- package/dist/{db-a1ixZQjr.mjs → db-DJ8rk0VM.mjs} +15 -6
- package/dist/{db-a1ixZQjr.mjs.map → db-DJ8rk0VM.mjs.map} +1 -1
- package/dist/db-DbY2O8QO.mjs +3 -0
- package/dist/{db-Ca5qfsMC.mjs → db-Ddns80yf.mjs} +15 -6
- package/dist/{db-Ca5qfsMC.mjs.map → db-Ddns80yf.mjs.map} +1 -1
- package/dist/{detect-CdaA48EI.mjs → detect-Bf2z-oKB.mjs} +1 -1
- package/dist/{detect-CdaA48EI.mjs.map → detect-Bf2z-oKB.mjs.map} +1 -1
- package/dist/detector-CkwkXuGh.mjs +5 -0
- package/dist/{detector-C73Nxm94.mjs → detector-DWXkeTlk.mjs} +2 -2
- package/dist/{detector-C73Nxm94.mjs.map → detector-DWXkeTlk.mjs.map} +1 -1
- package/dist/{embeddings-CEBGrzwu.mjs → embeddings-ClqKtLZ8.mjs} +1 -1
- package/dist/{embeddings-DOLZnT1X.mjs → embeddings-DvRKcQyt.mjs} +1 -1
- package/dist/{embeddings-DOLZnT1X.mjs.map → embeddings-DvRKcQyt.mjs.map} +1 -1
- package/dist/factory-47Qf_df7.mjs +3 -0
- package/dist/{factory-DEb9NmHJ.mjs → factory-DNYAqjH0.mjs} +8 -8
- package/dist/{factory-DEb9NmHJ.mjs.map → factory-DNYAqjH0.mjs.map} +1 -1
- package/dist/{fallback-oJl3BaIN.mjs → fallback-Cwt4hmh5.mjs} +182 -122
- package/dist/fallback-Cwt4hmh5.mjs.map +1 -0
- package/dist/{helpers-IjZkXBhj.mjs → helpers-crDEr6S2.mjs} +1 -1
- package/dist/{helpers-IjZkXBhj.mjs.map → helpers-crDEr6S2.mjs.map} +1 -1
- package/dist/hooks/capture-all-events.mjs +117 -34
- package/dist/hooks/capture-all-events.mjs.map +4 -4
- package/dist/hooks/capture-session-summary.mjs +110 -33
- package/dist/hooks/capture-session-summary.mjs.map +4 -4
- package/dist/hooks/capture-tool-output.mjs +105 -28
- package/dist/hooks/capture-tool-output.mjs.map +4 -4
- package/dist/hooks/cleanup-session-files.mjs +54 -13
- package/dist/hooks/cleanup-session-files.mjs.map +2 -2
- package/dist/hooks/context-compression-hook.mjs +7565 -122
- package/dist/hooks/context-compression-hook.mjs.map +4 -4
- package/dist/hooks/initialize-session.mjs +55 -14
- package/dist/hooks/initialize-session.mjs.map +2 -2
- package/dist/hooks/inject-observations.mjs +79 -18
- package/dist/hooks/inject-observations.mjs.map +3 -3
- package/dist/hooks/load-core-context.mjs +55 -14
- package/dist/hooks/load-core-context.mjs.map +2 -2
- package/dist/hooks/load-project-context.mjs +185 -103
- package/dist/hooks/load-project-context.mjs.map +4 -4
- package/dist/hooks/mcp-deferred-gate.mjs +54 -13
- package/dist/hooks/mcp-deferred-gate.mjs.map +2 -2
- package/dist/hooks/mcp-deferred-reminder.mjs +9 -0
- package/dist/hooks/mcp-deferred-reminder.mjs.map +3 -3
- package/dist/hooks/observe.mjs +54 -13
- package/dist/hooks/observe.mjs.map +2 -2
- package/dist/hooks/post-compact-inject.mjs +7419 -16
- package/dist/hooks/post-compact-inject.mjs.map +4 -4
- package/dist/hooks/route-agents-to-worker.mjs +7778 -171
- package/dist/hooks/route-agents-to-worker.mjs.map +4 -4
- package/dist/hooks/route-edits-to-worker.mjs +90 -0
- package/dist/hooks/route-edits-to-worker.mjs.map +7 -0
- package/dist/hooks/security-validator.mjs +147 -6
- package/dist/hooks/security-validator.mjs.map +4 -4
- package/dist/hooks/session-commands.mjs +9 -0
- package/dist/hooks/session-commands.mjs.map +3 -3
- package/dist/hooks/stop-hook.mjs +182 -105
- package/dist/hooks/stop-hook.mjs.map +4 -4
- package/dist/hooks/subagent-stop-hook.mjs +3 -0
- package/dist/hooks/subagent-stop-hook.mjs.map +1 -1
- package/dist/hooks/sync-todo-to-md.mjs +54 -13
- package/dist/hooks/sync-todo-to-md.mjs.map +2 -2
- package/dist/hooks/update-tab-on-action.mjs +3 -0
- package/dist/hooks/update-tab-on-action.mjs.map +1 -1
- package/dist/hooks/update-tab-titles.mjs +3 -0
- package/dist/hooks/update-tab-titles.mjs.map +1 -1
- package/dist/hooks/whisper-reinject.mjs +3 -0
- package/dist/hooks/whisper-reinject.mjs.map +1 -1
- package/dist/hooks/whisper-rules.mjs +134 -29
- package/dist/hooks/whisper-rules.mjs.map +4 -4
- package/dist/hooks/worker-proxy.mjs +7737 -117
- package/dist/hooks/worker-proxy.mjs.map +4 -4
- package/dist/hooks/worker-status-line.mjs +7791 -144
- package/dist/hooks/worker-status-line.mjs.map +4 -4
- package/dist/hooks/worker-supervision.mjs +7721 -115
- package/dist/hooks/worker-supervision.mjs.map +4 -4
- package/dist/index.d.mts +4 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/{indexer-backend-BPTzKFZU.mjs → indexer-backend-CdvCJCkD.mjs} +3 -3
- package/dist/{indexer-backend-BPTzKFZU.mjs.map → indexer-backend-CdvCJCkD.mjs.map} +1 -1
- package/dist/{ipc-client-BmypMNYk.mjs → ipc-client-C6NryMMb.mjs} +2 -2
- package/dist/{ipc-client-BmypMNYk.mjs.map → ipc-client-C6NryMMb.mjs.map} +1 -1
- package/dist/{kg-entity-r8duqhi9.mjs → kg-entity-BSjM5xZh.mjs} +1 -1
- package/dist/{kg-entity-r8duqhi9.mjs.map → kg-entity-BSjM5xZh.mjs.map} +1 -1
- package/dist/{latent-ideas-CtSca4qG.mjs → latent-ideas-BfL4nCQ3.mjs} +4 -4
- package/dist/{latent-ideas-CtSca4qG.mjs.map → latent-ideas-BfL4nCQ3.mjs.map} +1 -1
- package/dist/{link-boost-Bucnz3n8.mjs → link-boost-C5PaNdzm.mjs} +1 -1
- package/dist/{link-boost-Bucnz3n8.mjs.map → link-boost-C5PaNdzm.mjs.map} +1 -1
- package/dist/main-resolver-CnfnWa8C.mjs +7 -0
- package/dist/{main-resolver-DnkxPYkr.mjs → main-resolver-DvYu9jbl.mjs} +21 -11
- package/dist/main-resolver-DvYu9jbl.mjs.map +1 -0
- package/dist/{migrate-Cjzeefn9.mjs → migrate-CfERwXhY.mjs} +2 -2
- package/dist/{migrate-Cjzeefn9.mjs.map → migrate-CfERwXhY.mjs.map} +1 -1
- package/dist/{neighborhood-CM7Jgb51.mjs → neighborhood-CETR_P4y.mjs} +2 -2
- package/dist/{neighborhood-CM7Jgb51.mjs.map → neighborhood-CETR_P4y.mjs.map} +1 -1
- package/dist/{note-context-DCwE2A-M.mjs → note-context-DCcRWBoN.mjs} +1 -1
- package/dist/{note-context-DCwE2A-M.mjs.map → note-context-DCcRWBoN.mjs.map} +1 -1
- package/dist/pai-home-ChAOupZc.mjs +164 -0
- package/dist/pai-home-ChAOupZc.mjs.map +1 -0
- package/dist/{pai-marker-CHtbJMwJ.mjs → pai-marker-B20KqhA8.mjs} +1 -1
- package/dist/{pai-marker-CHtbJMwJ.mjs.map → pai-marker-B20KqhA8.mjs.map} +1 -1
- package/dist/{planner-D5Ui7DAm.mjs → planner-pXRc-8yt.mjs} +7 -6
- package/dist/{planner-D5Ui7DAm.mjs.map → planner-pXRc-8yt.mjs.map} +1 -1
- package/dist/{postgres-CtOzfoQU.mjs → postgres-CUSXWgTG.mjs} +2 -2
- package/dist/{postgres-CtOzfoQU.mjs.map → postgres-CUSXWgTG.mjs.map} +1 -1
- package/dist/{program-zpoYnJGz.mjs → program-LLNPpxlj.mjs} +8308 -6065
- package/dist/program-LLNPpxlj.mjs.map +1 -0
- package/dist/query-feedback-C7rSfiXU.mjs +3 -0
- package/dist/{query-feedback-Dqz-HC__.mjs → query-feedback-CYyOGi3y.mjs} +20 -6
- package/dist/query-feedback-CYyOGi3y.mjs.map +1 -0
- package/dist/{reranker-CwTCNsgA.mjs → reranker-B5qUTamW.mjs} +1 -1
- package/dist/{reranker-xPm04PXx.mjs → reranker-HHmhZk6v.mjs} +1 -1
- package/dist/{reranker-xPm04PXx.mjs.map → reranker-HHmhZk6v.mjs.map} +1 -1
- package/dist/router-CremHKTI.mjs +3 -0
- package/dist/{router-DD6D4j31.mjs → router-DBAZfE7X.mjs} +2 -2
- package/dist/{router-DD6D4j31.mjs.map → router-DBAZfE7X.mjs.map} +1 -1
- package/dist/{run-D7K5UALn.mjs → run-DDdT9teG.mjs} +530 -210
- package/dist/run-DDdT9teG.mjs.map +1 -0
- package/dist/{runtime-paths-rni52zHX.mjs → runtime-paths-B0P1TvUr.mjs} +1 -1
- package/dist/{runtime-paths-rni52zHX.mjs.map → runtime-paths-B0P1TvUr.mjs.map} +1 -1
- package/dist/{search-Rpk1cSBC.mjs → search-B69cQwDB.mjs} +3 -3
- package/dist/{search-Rpk1cSBC.mjs.map → search-B69cQwDB.mjs.map} +1 -1
- package/dist/{search-CfPpJAWQ.mjs → search-fb-5ovj4.mjs} +2 -2
- package/dist/{server-D4vAieF4.mjs → server-Ch99xt5K.mjs} +15 -14
- package/dist/server-Ch99xt5K.mjs.map +1 -0
- package/dist/skills/Advisor/SKILL.md +3 -3
- package/dist/skills/Providers/SKILL.md +30 -0
- package/dist/skills/Reconstruct/SKILL.md +1 -1
- package/dist/skills/VaultContext/SKILL.md +1 -1
- package/dist/skills/Whisper/SKILL.md +3 -3
- package/dist/skills/Worker/SKILL.md +1 -1
- package/dist/{sources-CS43CpuS.mjs → sources-KBGEA_E6.mjs} +2 -2
- package/dist/{sources-CS43CpuS.mjs.map → sources-KBGEA_E6.mjs.map} +1 -1
- package/dist/{sqlite-Cq3gJcq9.mjs → sqlite-By6r2YhZ.mjs} +3 -3
- package/dist/{sqlite-Cq3gJcq9.mjs.map → sqlite-By6r2YhZ.mjs.map} +1 -1
- package/dist/{state-CY6I-Hnc.mjs → state-DnYGRmS7.mjs} +1 -1
- package/dist/{state-BRdB-Bf1.mjs → state-PJrgfDLW.mjs} +1 -1
- package/dist/{state-BRdB-Bf1.mjs.map → state-PJrgfDLW.mjs.map} +1 -1
- package/dist/{stop-words-Hfu8u22w.mjs → stop-words-BaMEGVeY.mjs} +1 -1
- package/dist/{stop-words-Hfu8u22w.mjs.map → stop-words-BaMEGVeY.mjs.map} +1 -1
- package/dist/{sync-BWbe8JTg.mjs → sync-Btcb6xA4.mjs} +3 -3
- package/dist/{sync-BWbe8JTg.mjs.map → sync-Btcb6xA4.mjs.map} +1 -1
- package/dist/{themes-B7h9YDiy.mjs → themes-BVoAnLZj.mjs} +3 -3
- package/dist/{themes-B7h9YDiy.mjs.map → themes-BVoAnLZj.mjs.map} +1 -1
- package/dist/{tools-BW3NLMPk.mjs → tools-BradfQk7.mjs} +4 -3
- package/dist/{tools-LlzcV_eK.mjs → tools-UrSHIe29.mjs} +30 -233
- package/dist/tools-UrSHIe29.mjs.map +1 -0
- package/dist/{trace-u4hT-pLD.mjs → trace-Cy8quQTm.mjs} +1 -1
- package/dist/{trace-u4hT-pLD.mjs.map → trace-Cy8quQTm.mjs.map} +1 -1
- package/dist/{utils-DhMex3Ox.mjs → utils-BD8g8oSf.mjs} +1 -1
- package/dist/{utils-9Err2RBW.mjs → utils-CJymHkYm.mjs} +1 -1
- package/dist/{utils-9Err2RBW.mjs.map → utils-CJymHkYm.mjs.map} +1 -1
- package/dist/{vault-indexer-mata9S7b.mjs → vault-indexer-C5i-OAyr.mjs} +2 -2
- package/dist/{vault-indexer-mata9S7b.mjs.map → vault-indexer-C5i-OAyr.mjs.map} +1 -1
- package/dist/wakeup-TnGjJY3I.mjs +218 -0
- package/dist/wakeup-TnGjJY3I.mjs.map +1 -0
- package/dist/work-queue-worker-BA5IDBwQ.mjs +567 -0
- package/dist/work-queue-worker-BA5IDBwQ.mjs.map +1 -0
- package/dist/work-queue-worker-DLM2wlqM.mjs +14 -0
- package/dist/{zettelkasten-F0D_XfQ4.mjs → zettelkasten-BBjA7GcP.mjs} +4 -4
- package/dist/{zettelkasten-F0D_XfQ4.mjs.map → zettelkasten-BBjA7GcP.mjs.map} +1 -1
- package/docs/commands/README.md +30 -3
- package/docs/commands/audit.md +88 -0
- package/docs/commands/backup.md +2 -2
- package/docs/commands/clear-names.md +1 -1
- package/docs/commands/config.md +59 -0
- package/docs/commands/daemon.md +1 -1
- package/docs/commands/db.md +1 -1
- package/docs/commands/end.md +1 -1
- package/docs/commands/help.md +1 -1
- package/docs/commands/identity.md +1 -1
- package/docs/commands/kg.md +1 -1
- package/docs/commands/launch.md +45 -0
- package/docs/commands/mcp.md +1 -1
- package/docs/commands/memory.md +3 -3
- package/docs/commands/notify.md +1 -1
- package/docs/commands/observation.md +1 -1
- package/docs/commands/obsidian.md +1 -1
- package/docs/commands/pause.md +1 -1
- package/docs/commands/project.md +46 -1
- package/docs/commands/projects.md +46 -1
- package/docs/commands/registry.md +1 -1
- package/docs/commands/restore.md +1 -1
- package/docs/commands/session.md +1 -1
- package/docs/commands/sessions.md +1 -1
- package/docs/commands/setup.md +1 -1
- package/docs/commands/shell-init.md +1 -1
- package/docs/commands/skill.md +1 -1
- package/docs/commands/task.md +1 -1
- package/docs/commands/topic.md +1 -1
- package/docs/commands/update.md +1 -1
- package/docs/commands/worker.md +95 -6
- package/docs/commands/zettel.md +1 -1
- package/docs/provider-abstraction.md +1 -1
- package/docs/provider-independence-details.md +8 -5
- package/docs/task-bus.md +1 -1
- package/docs/worker.md +136 -83
- package/docs/workers-config.md +446 -0
- package/package.json +4 -2
- package/scripts/build-hooks.mjs +56 -3
- package/src/hooks/pre-compact.sh +5 -2
- package/src/hooks/session-stop.sh +29 -4
- package/src/hooks/ts/capture-all-events.ts +3 -3
- package/src/hooks/ts/lib/advisor-budget.test.ts +98 -0
- package/src/hooks/ts/lib/advisor-budget.ts +90 -0
- package/src/hooks/ts/lib/agent-gate.test.ts +101 -0
- package/src/hooks/ts/lib/agent-gate.ts +112 -0
- package/src/hooks/ts/lib/context-fill.ts +2 -2
- package/src/hooks/ts/lib/edit-gate.test.ts +52 -0
- package/src/hooks/ts/lib/edit-gate.ts +51 -0
- package/src/hooks/ts/lib/mcp-deferred-reminder.test.ts +8 -0
- package/src/hooks/ts/lib/pai-paths.test.ts +93 -0
- package/src/hooks/ts/lib/pai-paths.ts +168 -24
- package/src/hooks/ts/lib/project-utils/index.ts +1 -0
- package/src/hooks/ts/lib/project-utils/paths.ts +5 -4
- package/src/hooks/ts/lib/project-utils.ts +1 -0
- package/src/hooks/ts/post-tool-use/capture-tool-output.ts +2 -2
- package/src/hooks/ts/pre-compact/context-compression-hook.ts +1 -1
- package/src/hooks/ts/pre-tool-use/route-agents-to-worker.ts +46 -99
- package/src/hooks/ts/pre-tool-use/route-edits-to-worker.test.ts +47 -0
- package/src/hooks/ts/pre-tool-use/route-edits-to-worker.ts +96 -0
- package/src/hooks/ts/pre-tool-use/security-validator.ts +2 -1
- package/src/hooks/ts/session-end/capture-session-summary.ts +4 -4
- package/src/hooks/ts/session-start/initialize-session.ts +3 -3
- package/src/hooks/ts/session-start/inject-observations.test.ts +56 -0
- package/src/hooks/ts/session-start/inject-observations.ts +28 -8
- package/src/hooks/ts/session-start/load-core-context.ts +4 -4
- package/src/hooks/ts/session-start/load-project-context.ts +2 -2
- package/src/hooks/ts/session-start/mcp-deferred-reminder.ts +2 -0
- package/src/hooks/ts/session-start/session-commands.ts +4 -0
- package/src/hooks/ts/session-start/session-start-worker-guard.test.ts +36 -0
- package/src/hooks/ts/stop/stop-hook.ts +6 -11
- package/src/hooks/ts/user-prompt/whisper-rules.test.ts +49 -0
- package/src/hooks/ts/user-prompt/whisper-rules.ts +88 -47
- package/statusline-command.sh +277 -116
- package/templates/agent-prefs.example.md +8 -8
- package/templates/claude-md.template.md +1 -1
- package/templates/voices.example.json +3 -3
- package/dist/config-C_ErGddD.mjs +0 -3
- package/dist/config-_lQI_W08.mjs +0 -640
- package/dist/config-_lQI_W08.mjs.map +0 -1
- package/dist/context-handover-cache-pNFdBNrU.mjs +0 -1548
- package/dist/context-handover-cache-pNFdBNrU.mjs.map +0 -1
- package/dist/daemon-B8N1egl0.mjs.map +0 -1
- package/dist/daemon-DHfyoTlk.mjs +0 -23
- package/dist/db-O-cyAPfS.mjs +0 -3
- package/dist/db-XEwJbuGO.mjs +0 -3
- package/dist/detector-C-7KRi42.mjs +0 -5
- package/dist/factory-Dbo8yNPi.mjs +0 -3
- package/dist/fallback-oJl3BaIN.mjs.map +0 -1
- package/dist/main-resolver-BAfOMppW.mjs +0 -7
- package/dist/main-resolver-DnkxPYkr.mjs.map +0 -1
- package/dist/program-zpoYnJGz.mjs.map +0 -1
- package/dist/query-feedback-DGoVRaWD.mjs +0 -3
- package/dist/query-feedback-Dqz-HC__.mjs.map +0 -1
- package/dist/router-BTIGZR2_.mjs +0 -3
- package/dist/run-D7K5UALn.mjs.map +0 -1
- package/dist/server-D4vAieF4.mjs.map +0 -1
- package/dist/tools-LlzcV_eK.mjs.map +0 -1
- package/dist/work-queue-worker-AEmfVE0F.mjs +0 -14
- package/dist/work-queue-worker-DIT-VLSh.mjs +0 -2136
- package/dist/work-queue-worker-DIT-VLSh.mjs.map +0 -1
- /package/dist/{indexer-D7MvSQPY.mjs → indexer-C5Le7XE7.mjs} +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import { o as loadConfig } from "../config-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
2
|
+
import "../db-Ddns80yf.mjs";
|
|
3
|
+
import { o as loadConfig } from "../config-DCu8THKi.mjs";
|
|
4
|
+
import { r as MODEL_CAPABILITIES, v as readWorkersSection } from "../config-DxMZjpvY.mjs";
|
|
5
|
+
import { N as setWorkerLabel, O as loadStatus, c as handoffFromInside, k as loadStatuses, l as readInbox, n as runWorker, r as testProvider, u as sayToWorker, w as alive, x as ledgerSummary } from "../run-DDdT9teG.mjs";
|
|
6
|
+
import { t as PaiClient } from "../ipc-client-C6NryMMb.mjs";
|
|
7
|
+
import { _ as workersLogDir, m as ledgerPath } from "../server-Ch99xt5K.mjs";
|
|
8
|
+
import { t as runChain } from "../chain-BbcfP77K.mjs";
|
|
9
|
+
import { C as readSpecPrompt, _ as updateProvider, a as addProvider, b as psOutput, c as describeProviders, d as resolveProviderName, f as setClass, g as unsetClass, h as setWorkersEnabled, i as fallbackStatusText, l as modelPrefsText, m as setProviderModel, n as fallbackOn, o as classTargetText, p as setProviderEnabled, r as fallbackStatus, s as describeModels, t as fallbackOff, u as removeProvider, v as useProvider, w as resolveSpecPath, x as replayOutput } from "../fallback-Cwt4hmh5.mjs";
|
|
9
10
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
10
11
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
11
12
|
|
|
@@ -3415,79 +3416,35 @@ const meta = meta$1;
|
|
|
3415
3416
|
//#region src/daemon-mcp/instructions.ts
|
|
3416
3417
|
const PAI_INSTRUCTIONS = `## PAI — Personal AI Infrastructure
|
|
3417
3418
|
|
|
3418
|
-
Federated memory, project registry, session management,
|
|
3419
|
-
|
|
3420
|
-
###
|
|
3421
|
-
|
|
3422
|
-
Before answering
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
### Session
|
|
3426
|
-
|
|
3427
|
-
- go / continue / weiter → read TODO.md
|
|
3428
|
-
- pause session →
|
|
3429
|
-
- end session → pause procedure + rename session note (
|
|
3430
|
-
- cpp →
|
|
3431
|
-
|
|
3432
|
-
###
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
| plan, what should I focus on, priorities | plan |
|
|
3448
|
-
| share on linkedin, post about, tweet this | share |
|
|
3449
|
-
| list sessions, where was I working | sessions |
|
|
3450
|
-
| route, what project is this | route |
|
|
3451
|
-
| search history, find past, when did we | search-history |
|
|
3452
|
-
| /name, name this session | name |
|
|
3453
|
-
| observability, monitor agents, show dashboard | observability |
|
|
3454
|
-
| research, extract wisdom, analyze content | research |
|
|
3455
|
-
| visualize, create diagram, flowchart, image | art |
|
|
3456
|
-
| create skill, validate skill, update skill | createskill |
|
|
3457
|
-
| /story, story explanation, explain as story | story-explanation |
|
|
3458
|
-
| load vault context, morning briefing | vault-context |
|
|
3459
|
-
| connect X and Y, how does X relate to Y | vault-connect |
|
|
3460
|
-
| what's emerging, find patterns in vault | vault-emerge |
|
|
3461
|
-
| find orphans, orphaned notes | vault-orphans |
|
|
3462
|
-
| trace idea, how did X evolve | vault-trace |
|
|
3463
|
-
| run a worker, check workers, worker providers | worker |
|
|
3464
|
-
|
|
3465
|
-
### Reference Resources
|
|
3466
|
-
|
|
3467
|
-
Fetch with: resources/read { uri: "pai://<name>" }
|
|
3468
|
-
|
|
3469
|
-
| Resource | URI |
|
|
3470
|
-
|----------|-----|
|
|
3471
|
-
| Aesthetic guide (visual style) | pai://aesthetic |
|
|
3472
|
-
| Constitution (philosophy, architecture, directory structure) | pai://constitution |
|
|
3473
|
-
| Prompt engineering standards | pai://prompting |
|
|
3474
|
-
| Voice prosody guide | pai://prosody-guide |
|
|
3475
|
-
| Prosody agent template | pai://prosody-agent-template |
|
|
3476
|
-
| Voice system reference | pai://voice |
|
|
3477
|
-
| Skill system spec (TitleCase, SKILL.md structure) | pai://skill-system |
|
|
3478
|
-
| Hook system reference (events, patterns) | pai://hook-system |
|
|
3479
|
-
| History system — UOCS (capture, directories) | pai://history-system |
|
|
3480
|
-
| Terminal tab title system | pai://terminal-tabs |
|
|
3481
|
-
| MCP development guide (three-tier architecture) | pai://mcp-dev-guide |
|
|
3482
|
-
|
|
3483
|
-
### Core Rules
|
|
3484
|
-
|
|
3485
|
-
- Git commits: NO AI signatures, NO Co-Authored-By lines, format: type: description
|
|
3486
|
-
- Stack: TypeScript > Python, bun for JS/TS, uv for Python
|
|
3487
|
-
- Security: run git remote -v before every push; never commit private data
|
|
3488
|
-
- Fact-checking: mark unverified AI claims with ⚠️ Unverified
|
|
3489
|
-
- History lookup: search \${PAI_DIR}/History/ before answering about past work
|
|
3490
|
-
- WhatsApp routing: [Whazaa] prefix → reply via whatsapp_send; [Whazaa:voice] → whatsapp_tts
|
|
3419
|
+
Federated memory, project registry, session management, skills.
|
|
3420
|
+
|
|
3421
|
+
### Search first
|
|
3422
|
+
|
|
3423
|
+
Before answering about past work, decisions, people, or project status: use memory_search.
|
|
3424
|
+
Run project_detect at session start.
|
|
3425
|
+
|
|
3426
|
+
### Session commands
|
|
3427
|
+
|
|
3428
|
+
- go / continue / weiter → read TODO.md "## Continue" section, resume there
|
|
3429
|
+
- pause session → update TODO.md "## Continue" section, stop
|
|
3430
|
+
- end session → pause procedure + rename session note (never leave as "New Session")
|
|
3431
|
+
- cpp → release order is in CLAUDE.md
|
|
3432
|
+
|
|
3433
|
+
### Skills
|
|
3434
|
+
|
|
3435
|
+
Fetch full instructions with prompts/get { name }. Skills are already listed with USE WHEN descriptions.
|
|
3436
|
+
|
|
3437
|
+
### Reference resources
|
|
3438
|
+
|
|
3439
|
+
Fetch with resources/read { uri }. Available: pai://aesthetic, pai://constitution, pai://prompting,
|
|
3440
|
+
pai://prosody-guide, pai://prosody-agent-template, pai://voice, pai://skill-system, pai://hook-system,
|
|
3441
|
+
pai://history-system, pai://terminal-tabs, pai://mcp-dev-guide
|
|
3442
|
+
|
|
3443
|
+
### Core rules
|
|
3444
|
+
|
|
3445
|
+
Git: no AI signatures, commit format "type: description", run git remote -v before pushing, never commit
|
|
3446
|
+
private data. Stack: TypeScript > Python (bun/uv). Mark unverified AI claims with ⚠️ Unverified.
|
|
3447
|
+
WhatsApp: [Whazaa] → whatsapp_send; [Whazaa:voice] → whatsapp_tts.
|
|
3491
3448
|
`;
|
|
3492
3449
|
|
|
3493
3450
|
//#endregion
|
|
@@ -3882,7 +3839,7 @@ USE WHEN user says 'load vault context', 'brief me from Obsidian', 'morning brie
|
|
|
3882
3839
|
|
|
3883
3840
|
Reads: daily note → open TODOs → PAI index (active projects) → HOME.md (focus areas) → recent insights. Synthesizes into morning briefing with Suggested First Action.
|
|
3884
3841
|
|
|
3885
|
-
All vault skills work with the vault configured in \`~/.
|
|
3842
|
+
All vault skills work with the vault configured in \`~/.claude/pai/config.json\` (\`vaultPath\` key).`
|
|
3886
3843
|
};
|
|
3887
3844
|
|
|
3888
3845
|
//#endregion
|
|
@@ -4178,7 +4135,7 @@ For each reconstructed note, call \`kg_add\` to store key facts. Examples of fac
|
|
|
4178
4135
|
- Maximum **15 triples per note** — pick the most important.
|
|
4179
4136
|
- Never invent project names, versions, or paths. Copy them verbatim.
|
|
4180
4137
|
|
|
4181
|
-
**Alternative (batch mode):** If reconstructing many notes at once, instead of calling \`kg_add\` interactively you may run \`pai kg backfill --project <slug>\` from the terminal after the notes are written. The backfill walks every note in \`Notes/YYYY/MM/\`, runs the same extractor the session-summary-worker uses, and is idempotent (state file at \`~/.
|
|
4138
|
+
**Alternative (batch mode):** If reconstructing many notes at once, instead of calling \`kg_add\` interactively you may run \`pai kg backfill --project <slug>\` from the terminal after the notes are written. The backfill walks every note in \`Notes/YYYY/MM/\`, runs the same extractor the session-summary-worker uses, and is idempotent (state file at \`~/.claude/pai/kg-backfill-state.json\`).
|
|
4182
4139
|
|
|
4183
4140
|
After extraction, append a one-line note to the summary output:
|
|
4184
4141
|
\`\`\`
|
|
@@ -4208,7 +4165,7 @@ USE WHEN user says 'whisper', 'add whisper rule', 'remove whisper rule', 'list w
|
|
|
4208
4165
|
|
|
4209
4166
|
Manage the rules that PAI injects into every prompt via the whisper-rules hook.
|
|
4210
4167
|
|
|
4211
|
-
Rules are stored in \`~/.claude/whisper-rules.md\` — one rule per line, plain text.
|
|
4168
|
+
Rules are stored in \`~/.claude/pai/whisper-rules.md\` — one rule per line, plain text.
|
|
4212
4169
|
The hook reads this file on every UserPromptSubmit and injects it as a \`<system-reminder>\`.
|
|
4213
4170
|
Rules survive compaction, /clear, and session restarts.
|
|
4214
4171
|
|
|
@@ -4223,11 +4180,11 @@ Rules survive compaction, /clear, and session restarts.
|
|
|
4223
4180
|
### Workflow
|
|
4224
4181
|
|
|
4225
4182
|
**Show current rules:**
|
|
4226
|
-
Read \`~/.claude/whisper-rules.md\` and display each rule with a line number.
|
|
4183
|
+
Read \`~/.claude/pai/whisper-rules.md\` and display each rule with a line number.
|
|
4227
4184
|
If the file doesn't exist, say "No whisper rules configured."
|
|
4228
4185
|
|
|
4229
4186
|
**Add a rule:**
|
|
4230
|
-
Append the rule as a new line to \`~/.claude/whisper-rules.md\`.
|
|
4187
|
+
Append the rule as a new line to \`~/.claude/pai/whisper-rules.md\`.
|
|
4231
4188
|
Create the file if it doesn't exist.
|
|
4232
4189
|
Do NOT add duplicate rules — check if a similar rule already exists.
|
|
4233
4190
|
|
|
@@ -4357,13 +4314,13 @@ ALSO USE WHEN user says plain-language budget/mode phrases like:
|
|
|
4357
4314
|
- "go full power", "use whatever model", "no budget constraints", "normal mode", "unrestricted" → set mode to normal
|
|
4358
4315
|
- "back to auto", "reset advisor", "let the budget decide" → set mode to auto
|
|
4359
4316
|
|
|
4360
|
-
When you detect these, write the appropriate mode to \`~/.claude/advisor-mode.json\` and confirm what you did.
|
|
4317
|
+
When you detect these, write the appropriate mode to \`~/.claude/pai/advisor-mode.json\` and confirm what you did.
|
|
4361
4318
|
|
|
4362
4319
|
Advisor mode controls which models subagents use, based on weekly budget consumption.
|
|
4363
4320
|
|
|
4364
4321
|
### Configuration
|
|
4365
4322
|
|
|
4366
|
-
The config file is at \`~/.claude/advisor-mode.json\`:
|
|
4323
|
+
The config file is at \`~/.claude/pai/advisor-mode.json\`:
|
|
4367
4324
|
\`\`\`json
|
|
4368
4325
|
{
|
|
4369
4326
|
"weeklyBudgetPercent": 90,
|
|
@@ -4393,7 +4350,7 @@ The config file is at \`~/.claude/advisor-mode.json\`:
|
|
|
4393
4350
|
### Workflow
|
|
4394
4351
|
|
|
4395
4352
|
**Show current status:**
|
|
4396
|
-
Read \`~/.claude/advisor-mode.json\`. Display the mode, budget percentage, and what model constraints are active.
|
|
4353
|
+
Read \`~/.claude/pai/advisor-mode.json\`. Display the mode, budget percentage, and what model constraints are active.
|
|
4397
4354
|
|
|
4398
4355
|
**Update budget percentage:**
|
|
4399
4356
|
The user reads their weekly budget from the statusline (e.g., "7d: 63% → Fr. 08:00").
|
|
@@ -4595,7 +4552,7 @@ pai worker run --label "short task label" --class research \\
|
|
|
4595
4552
|
- \`worker_status\` — on/off, active provider, providers, run tally.
|
|
4596
4553
|
- \`worker_providers\` — list/add/update/remove/use/enable/disable/test. Adding
|
|
4597
4554
|
needs name, base_url, model and a key (key file path, or a raw key which is
|
|
4598
|
-
parked in ~/.
|
|
4555
|
+
parked in ~/.claude/pai/keys/<name>, mode 0600). update changes cost_tier
|
|
4599
4556
|
(1 cheapest … 5 most expensive) and tags (code, vision, image-gen,
|
|
4600
4557
|
long-context, fast, reasoning).
|
|
4601
4558
|
- \`worker_classes\` — list/set/unset class → provider[/<capability>], or constraints
|
|
@@ -4634,6 +4591,37 @@ pai worker run --label "short task label" --class research \\
|
|
|
4634
4591
|
- Never tell the user to edit a config file — the tools do it.`
|
|
4635
4592
|
};
|
|
4636
4593
|
|
|
4594
|
+
//#endregion
|
|
4595
|
+
//#region src/daemon-mcp/prompts/providers.ts
|
|
4596
|
+
const providers = {
|
|
4597
|
+
description: "List every configured provider and model, mark the one this session runs on, and explain how to switch",
|
|
4598
|
+
content: `## Providers Skill
|
|
4599
|
+
|
|
4600
|
+
USE WHEN user says /providers, /models, /provider, what providers exist, which models are configured, show providers, what model this session is on, switch provider, OR asks which provider or model this session or the harness is currently running on.
|
|
4601
|
+
|
|
4602
|
+
### The constraint that matters
|
|
4603
|
+
|
|
4604
|
+
A running \`claude\` process cannot switch provider — its base URL and auth are fixed for the life of the process. Claude Code's own \`/model\` command only ever lists the models of whatever endpoint THIS process was started against (plain Anthropic if started plainly, a provider's models if started through it). Switching provider always means starting a NEW session, with \`pai launch\`.
|
|
4605
|
+
|
|
4606
|
+
### Procedure
|
|
4607
|
+
|
|
4608
|
+
1. Run:
|
|
4609
|
+
|
|
4610
|
+
\`\`\`bash
|
|
4611
|
+
pai launch --list --current
|
|
4612
|
+
\`\`\`
|
|
4613
|
+
|
|
4614
|
+
2. Print its output to the user **verbatim** — it already lists every enabled provider (built-in \`anthropic\` first) with its default/fast/image models, numbered, marks the workers.yaml \`active\` provider, marks the row matching THIS session own provider/model when it can be determined (falls back to (session default) rather than guessing), and ends with a line explaining how to switch.
|
|
4615
|
+
|
|
4616
|
+
3. Do not add a summary of the table — the command output is the answer.
|
|
4617
|
+
|
|
4618
|
+
### Notes
|
|
4619
|
+
|
|
4620
|
+
- Provider/model detection is env-based (\`ANTHROPIC_BASE_URL\` against workers.yaml, and \`ANTHROPIC_DEFAULT_SONNET_MODEL\` when set) — a best-effort read of THIS process own environment, not a live API call.
|
|
4621
|
+
- To actually start on a different provider: \`pai launch --provider <name> --model <model>\` (model defaults to that provider default). \`pai launch\` alone, in a terminal, offers a numbered picker instead.
|
|
4622
|
+
- \`pai worker providers\` is the config-management surface (add, remove, enable, disable, use) — this skill is read-only, for what is configured and what this session is on.`
|
|
4623
|
+
};
|
|
4624
|
+
|
|
4637
4625
|
//#endregion
|
|
4638
4626
|
//#region src/daemon-mcp/resources/aesthetic.ts
|
|
4639
4627
|
const aesthetic = {
|
|
@@ -4700,7 +4688,7 @@ The foundational philosophy, architecture, and operations of PAI (Personal AI In
|
|
|
4700
4688
|
4. **Skills as Containers** — Each skill is a self-contained unit with SKILL.md, workflows/, and tools/.
|
|
4701
4689
|
5. **CLI-First** — Every capability should be accessible from the command line before being wrapped in prompts.
|
|
4702
4690
|
6. **Two-Tier MCP** — Thin routing shim (daemon-mcp) + full capability daemon. Never merge them.
|
|
4703
|
-
7. **History as Memory** — All work is captured automatically to \${
|
|
4691
|
+
7. **History as Memory** — All work is captured automatically to \${PAI_HOME}/History/. Work normally, docs handle themselves.
|
|
4704
4692
|
8. **Fail Gracefully** — Hooks and automations must never block the AI. Always exit 0.
|
|
4705
4693
|
|
|
4706
4694
|
## Architecture Layers
|
|
@@ -4720,8 +4708,8 @@ User
|
|
|
4720
4708
|
|-----------|----------|---------|
|
|
4721
4709
|
| Memory | \${PAI_DIR}/projects/*/Notes/ | Session notes, todos |
|
|
4722
4710
|
| Skills | ~/.claude/Skills/ | Workflow instructions |
|
|
4723
|
-
| History | \${
|
|
4724
|
-
| Config | ~/.
|
|
4711
|
+
| History | \${PAI_HOME}/History/ | Automated capture |
|
|
4712
|
+
| Config | ~/.claude/pai/ | Agent preferences (config.json, workers.yaml) |
|
|
4725
4713
|
|
|
4726
4714
|
## Two-Tier MCP Strategy
|
|
4727
4715
|
|
|
@@ -5117,7 +5105,7 @@ Automated documentation of ALL work performed by PAI and specialized agents.
|
|
|
5117
5105
|
## Directory Structure
|
|
5118
5106
|
|
|
5119
5107
|
\`\`\`
|
|
5120
|
-
\${
|
|
5108
|
+
\${PAI_HOME}/History/
|
|
5121
5109
|
├── Sessions/YYYY-MM/ # Session summaries
|
|
5122
5110
|
├── Learnings/YYYY-MM/ # Problem-solving narratives
|
|
5123
5111
|
├── Research/YYYY-MM/ # Investigation reports
|
|
@@ -5146,13 +5134,13 @@ YYYY-MM-DD-HHMMSS_[PROJECT]_[TYPE]_[HIERARCHY]_[DESCRIPTION].md
|
|
|
5146
5134
|
|
|
5147
5135
|
\`\`\`bash
|
|
5148
5136
|
# Quick keyword search
|
|
5149
|
-
rg -i "keyword" \${
|
|
5137
|
+
rg -i "keyword" \${PAI_HOME}/History/
|
|
5150
5138
|
|
|
5151
5139
|
# Search sessions
|
|
5152
|
-
rg -i "keyword" \${
|
|
5140
|
+
rg -i "keyword" \${PAI_HOME}/History/sessions/
|
|
5153
5141
|
|
|
5154
5142
|
# Recent files
|
|
5155
|
-
ls -lt \${
|
|
5143
|
+
ls -lt \${PAI_HOME}/History/sessions/\$(date +%Y-%m)/ | head -20
|
|
5156
5144
|
\`\`\`
|
|
5157
5145
|
`
|
|
5158
5146
|
};
|
|
@@ -5442,6 +5430,37 @@ At 200 message sessions, that is 1.3MB of context saved — equivalent to 5-10 e
|
|
|
5442
5430
|
`
|
|
5443
5431
|
};
|
|
5444
5432
|
|
|
5433
|
+
//#endregion
|
|
5434
|
+
//#region src/daemon-mcp/tools/worker-run-args.ts
|
|
5435
|
+
/**
|
|
5436
|
+
* worker_run's input schema and prompt resolution, extracted so both can be
|
|
5437
|
+
* imported and tested without starting the shim's stdio transport.
|
|
5438
|
+
*/
|
|
5439
|
+
const workerRunShape = {
|
|
5440
|
+
prompt: string().min(1).optional().describe("The task (the -p value). Mutually exclusive with specPath."),
|
|
5441
|
+
specPath: string().min(1).optional().describe("Path to a file (or \"-\" for stdin) whose contents become the prompt. Mutually exclusive with prompt."),
|
|
5442
|
+
chain: string().optional().describe("Comma-separated stages, e.g. draft,implement or draft,implement,review."),
|
|
5443
|
+
class: string().optional().describe("Task class (draft, implement, review, research, spotcheck, simple, complex, image)."),
|
|
5444
|
+
label: string().min(1).describe("Short task label shown in worker_ps / the status line and worker pane."),
|
|
5445
|
+
cwd: string().optional().describe("Working directory (default: here)."),
|
|
5446
|
+
allowed_tools: string().optional().describe("Comma-separated tool allowlist passed to the worker."),
|
|
5447
|
+
mcp: string().optional().describe("MCP servers/sets the worker may use (comma-separated).")
|
|
5448
|
+
};
|
|
5449
|
+
/**
|
|
5450
|
+
* The prompt text and resolved --spec path (for status recording) a
|
|
5451
|
+
* worker_run call resolves to. Throws when prompt/specPath are both given or
|
|
5452
|
+
* both missing (mutually exclusive, exactly one required) — the same rule
|
|
5453
|
+
* `pai worker run` enforces between -p and --spec.
|
|
5454
|
+
*/
|
|
5455
|
+
function resolveWorkerRunPrompt(args, cwd) {
|
|
5456
|
+
if (Boolean(args.prompt) === Boolean(args.specPath)) throw new Error("exactly one of prompt or specPath is required (they are mutually exclusive)");
|
|
5457
|
+
if (args.specPath) return {
|
|
5458
|
+
promptText: readSpecPrompt(args.specPath, cwd),
|
|
5459
|
+
specPath: resolveSpecPath(args.specPath, cwd)
|
|
5460
|
+
};
|
|
5461
|
+
return { promptText: args.prompt };
|
|
5462
|
+
}
|
|
5463
|
+
|
|
5445
5464
|
//#endregion
|
|
5446
5465
|
//#region src/daemon-mcp/tools/worker-model.ts
|
|
5447
5466
|
/**
|
|
@@ -5569,7 +5588,8 @@ async function startShim() {
|
|
|
5569
5588
|
"consolidate": consolidate,
|
|
5570
5589
|
"advisor": advisor,
|
|
5571
5590
|
"tasks": tasks,
|
|
5572
|
-
"worker": worker
|
|
5591
|
+
"worker": worker,
|
|
5592
|
+
"providers": providers
|
|
5573
5593
|
};
|
|
5574
5594
|
for (const [promptName, skill] of Object.entries(SKILL_PROMPTS)) server.prompt(promptName, skill.description, () => ({ messages: [{
|
|
5575
5595
|
role: "user",
|
|
@@ -5616,7 +5636,7 @@ async function startShim() {
|
|
|
5616
5636
|
"",
|
|
5617
5637
|
"Recency boost optionally down-weights older results (recency_boost=90 means scores halve every 90 days).",
|
|
5618
5638
|
"",
|
|
5619
|
-
"Defaults come from ~/.
|
|
5639
|
+
"Defaults come from ~/.claude/pai/config.json (search section). Per-call parameters override config defaults.",
|
|
5620
5640
|
"",
|
|
5621
5641
|
"Returns ranked snippets with project slug, file path, line range, and score.",
|
|
5622
5642
|
"Higher score = more relevant.",
|
|
@@ -5877,7 +5897,7 @@ async function startShim() {
|
|
|
5877
5897
|
"action=add needs name, model — and either key_file or key, plus:",
|
|
5878
5898
|
" base_url (anthropic protocol) or upstream_url (protocol=openai, runs",
|
|
5879
5899
|
" through the local PAI proxy). A raw key is written to",
|
|
5880
|
-
" ~/.
|
|
5900
|
+
" ~/.claude/pai/keys/<name> (mode 0600); only the path lands in the config.",
|
|
5881
5901
|
" engine=codex runs the Codex CLI instead of Claude Code.",
|
|
5882
5902
|
"action=update changes cost_tier / tags of an existing provider.",
|
|
5883
5903
|
"action=test runs a one-word pong probe through the provider",
|
|
@@ -5900,7 +5920,7 @@ async function startShim() {
|
|
|
5900
5920
|
engine: _enum(["claude", "codex"]).optional().describe("Runner engine (add). Default: claude."),
|
|
5901
5921
|
context_window: number().int().positive().optional().describe("Context window for the meter (add). No default: unset hides the meter unless the init event announces one."),
|
|
5902
5922
|
key_file: string().optional().describe("File holding the API token, 0600 (add)."),
|
|
5903
|
-
key: string().optional().describe("Raw API token (add) — parked in ~/.
|
|
5923
|
+
key: string().optional().describe("Raw API token (add) — parked in ~/.claude/pai/keys/<name>."),
|
|
5904
5924
|
model: string().optional().describe("Default model id (add)."),
|
|
5905
5925
|
fast_model: string().optional().describe("Cheaper model for spotchecks (add, optional)."),
|
|
5906
5926
|
env: record(string(), string()).optional().describe("Extra env for runs (add, optional)."),
|
|
@@ -6077,23 +6097,25 @@ async function startShim() {
|
|
|
6077
6097
|
server.tool("worker_run", [
|
|
6078
6098
|
"Start a worker (or a chain) and return its id immediately.",
|
|
6079
6099
|
"",
|
|
6080
|
-
"This is the chat-side face of `pai worker run`:
|
|
6081
|
-
"
|
|
6082
|
-
"
|
|
6083
|
-
"
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
class: string().optional().describe("Task class (draft, implement, review, research, spotcheck, simple, complex, image)."),
|
|
6088
|
-
label: string().optional().describe("Short task label shown in worker_ps."),
|
|
6089
|
-
cwd: string().optional().describe("Working directory (default: here)."),
|
|
6090
|
-
allowed_tools: string().optional().describe("Comma-separated tool allowlist passed to the worker."),
|
|
6091
|
-
mcp: string().optional().describe("MCP servers/sets the worker may use (comma-separated).")
|
|
6092
|
-
}, async (args) => {
|
|
6100
|
+
"This is the chat-side face of `pai worker run`: label is required, and",
|
|
6101
|
+
"exactly one of prompt/specPath (the -p value, or a file/stdin '-' to read",
|
|
6102
|
+
"it from — avoids quoting long prompts through JSON-RPC). chain (e.g.",
|
|
6103
|
+
"\"draft,implement\") runs spec-first stages, class picks the provider",
|
|
6104
|
+
"(default: active). Check on it with worker_ps / worker_replay, talk to",
|
|
6105
|
+
"it with worker_say."
|
|
6106
|
+
].join("\n"), workerRunShape, async (args) => {
|
|
6093
6107
|
try {
|
|
6108
|
+
const cwd = args.cwd ?? process.cwd();
|
|
6109
|
+
let promptText;
|
|
6110
|
+
let specPath;
|
|
6111
|
+
try {
|
|
6112
|
+
({promptText, specPath} = resolveWorkerRunPrompt(args, cwd));
|
|
6113
|
+
} catch (e) {
|
|
6114
|
+
return workerError(e);
|
|
6115
|
+
}
|
|
6094
6116
|
const claudeArgs = [
|
|
6095
6117
|
"-p",
|
|
6096
|
-
|
|
6118
|
+
promptText,
|
|
6097
6119
|
...args.allowed_tools ? ["--allowedTools", args.allowed_tools] : []
|
|
6098
6120
|
];
|
|
6099
6121
|
let startedIdResolve;
|
|
@@ -6108,7 +6130,8 @@ async function startShim() {
|
|
|
6108
6130
|
label: args.label,
|
|
6109
6131
|
noPane: false,
|
|
6110
6132
|
mcpFlag: args.mcp,
|
|
6111
|
-
|
|
6133
|
+
specPath,
|
|
6134
|
+
brief: promptText,
|
|
6112
6135
|
claudeArgs,
|
|
6113
6136
|
...args.cwd ? { cwd: args.cwd } : {},
|
|
6114
6137
|
onChainStart: (id) => startedIdResolve(id),
|
|
@@ -6119,6 +6142,7 @@ async function startShim() {
|
|
|
6119
6142
|
label: args.label,
|
|
6120
6143
|
noPane: false,
|
|
6121
6144
|
mcpFlag: args.mcp,
|
|
6145
|
+
specPath,
|
|
6122
6146
|
claudeArgs,
|
|
6123
6147
|
...args.cwd ? { cwd: args.cwd } : {},
|
|
6124
6148
|
onWorkerStart: (wid) => startedIdResolve(wid),
|
|
@@ -6210,11 +6234,14 @@ async function startShim() {
|
|
|
6210
6234
|
"worker_resume (or `pai worker resume <id> \"text\"`) instead."
|
|
6211
6235
|
].join("\n"), {
|
|
6212
6236
|
id: string().describe("Worker id (as shown by worker_ps)."),
|
|
6213
|
-
text: string().min(1).describe("The message to send (one line).")
|
|
6237
|
+
text: string().min(1).describe("The message to send (one line)."),
|
|
6238
|
+
goal: string().optional().describe("Relabel the worker (its ps / pane goal) before sending the message.")
|
|
6214
6239
|
}, async (args) => {
|
|
6215
6240
|
try {
|
|
6216
6241
|
const { workers } = readWorkersSection();
|
|
6217
|
-
|
|
6242
|
+
const logDir = workersLogDir(workers);
|
|
6243
|
+
if (args.goal !== void 0) setWorkerLabel(logDir, args.id, args.goal);
|
|
6244
|
+
await sayToWorker(logDir, args.id, args.text);
|
|
6218
6245
|
return workerText(`sent to ${args.id}`);
|
|
6219
6246
|
} catch (e) {
|
|
6220
6247
|
return workerError(e);
|