@tekmidian/pai 0.40.1 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/README.md +1 -0
  2. package/dist/aibroker-client-BP74gGwD.mjs +215 -0
  3. package/dist/aibroker-client-BP74gGwD.mjs.map +1 -0
  4. package/dist/aibroker-client-C6m71p6O.mjs +3 -0
  5. package/dist/{auto-route-BwzmlW3W.mjs → auto-route-_5zzJz5q.mjs} +2 -2
  6. package/dist/{auto-route-BwzmlW3W.mjs.map → auto-route-_5zzJz5q.mjs.map} +1 -1
  7. package/dist/browser-mcp/index.d.mts +1 -0
  8. package/dist/browser-mcp/index.mjs +352 -0
  9. package/dist/browser-mcp/index.mjs.map +1 -0
  10. package/dist/{chain-DhVHVnmT.mjs → chain-DGXNoTwc.mjs} +93 -320
  11. package/dist/chain-DGXNoTwc.mjs.map +1 -0
  12. package/dist/cli/index.mjs +12 -10
  13. package/dist/cli/index.mjs.map +1 -1
  14. package/dist/cli/program.mjs +12 -10
  15. package/dist/{clusters-DRHhfli9.mjs → clusters-j0ZuNYp9.mjs} +1 -1
  16. package/dist/{clusters-DRHhfli9.mjs.map → clusters-j0ZuNYp9.mjs.map} +1 -1
  17. package/dist/{config-D1G9IFpn.mjs → config-B64vFg14.mjs} +3 -50
  18. package/dist/config-B64vFg14.mjs.map +1 -0
  19. package/dist/{config-DD52BPB-.mjs → config-C_ErGddD.mjs} +1 -1
  20. package/dist/{config-Dl8lT4Lu.mjs → config-DgzR5sfb.mjs} +2 -2
  21. package/dist/{config-Dl8lT4Lu.mjs.map → config-DgzR5sfb.mjs.map} +1 -1
  22. package/dist/{context-handover-cache-C6_rs7JT.mjs → context-handover-cache-dUnSZwaA.mjs} +4 -4
  23. package/dist/{context-handover-cache-C6_rs7JT.mjs.map → context-handover-cache-dUnSZwaA.mjs.map} +1 -1
  24. package/dist/daemon/index.mjs +13 -12
  25. package/dist/daemon/index.mjs.map +1 -1
  26. package/dist/daemon-CKBkhOsZ.mjs +23 -0
  27. package/dist/{daemon-CpdVUnl_.mjs → daemon-DsvP8KMy.mjs} +357 -27
  28. package/dist/daemon-DsvP8KMy.mjs.map +1 -0
  29. package/dist/daemon-mcp/index.mjs +20 -6
  30. package/dist/daemon-mcp/index.mjs.map +1 -1
  31. package/dist/detector-C-7KRi42.mjs +5 -0
  32. package/dist/{detector-smpCm7ku.mjs → detector-C73Nxm94.mjs} +1 -1
  33. package/dist/{detector-smpCm7ku.mjs.map → detector-C73Nxm94.mjs.map} +1 -1
  34. package/dist/{factory-Bc5EyN54.mjs → factory-DEb9NmHJ.mjs} +7 -7
  35. package/dist/{factory-Bc5EyN54.mjs.map → factory-DEb9NmHJ.mjs.map} +1 -1
  36. package/dist/factory-Dbo8yNPi.mjs +3 -0
  37. package/dist/{fallback-CdXv-Np0.mjs → fallback-5UJO-RyX.mjs} +5 -4
  38. package/dist/{fallback-CdXv-Np0.mjs.map → fallback-5UJO-RyX.mjs.map} +1 -1
  39. package/dist/hooks/worker-status-line.mjs +9 -4
  40. package/dist/hooks/worker-status-line.mjs.map +3 -3
  41. package/dist/hooks/worker-supervision.mjs +593 -0
  42. package/dist/hooks/worker-supervision.mjs.map +7 -0
  43. package/dist/{indexer-backend-rohVVKrA.mjs → indexer-backend-BPTzKFZU.mjs} +1 -1
  44. package/dist/{indexer-backend-rohVVKrA.mjs.map → indexer-backend-BPTzKFZU.mjs.map} +1 -1
  45. package/dist/{ipc-client-C7AVpsyv.mjs → ipc-client-BmypMNYk.mjs} +2 -2
  46. package/dist/{ipc-client-C7AVpsyv.mjs.map → ipc-client-BmypMNYk.mjs.map} +1 -1
  47. package/dist/{kg-entity-DbOMPdF9.mjs → kg-entity-r8duqhi9.mjs} +1 -1
  48. package/dist/{kg-entity-DbOMPdF9.mjs.map → kg-entity-r8duqhi9.mjs.map} +1 -1
  49. package/dist/{latent-ideas-iNp5s55R.mjs → latent-ideas-CtSca4qG.mjs} +2 -2
  50. package/dist/{latent-ideas-iNp5s55R.mjs.map → latent-ideas-CtSca4qG.mjs.map} +1 -1
  51. package/dist/{link-boost-NNzADHX_.mjs → link-boost-Bucnz3n8.mjs} +1 -1
  52. package/dist/{link-boost-NNzADHX_.mjs.map → link-boost-Bucnz3n8.mjs.map} +1 -1
  53. package/dist/{main-resolver-CM1IHbuu.mjs → main-resolver-BgIrC-D9.mjs} +4 -214
  54. package/dist/main-resolver-BgIrC-D9.mjs.map +1 -0
  55. package/dist/main-resolver-DXGuygFG.mjs +7 -0
  56. package/dist/{neighborhood-AGL7oXQ2.mjs → neighborhood-CM7Jgb51.mjs} +1 -1
  57. package/dist/{neighborhood-AGL7oXQ2.mjs.map → neighborhood-CM7Jgb51.mjs.map} +1 -1
  58. package/dist/{note-context-BHwYpSFf.mjs → note-context-DCwE2A-M.mjs} +1 -1
  59. package/dist/{note-context-BHwYpSFf.mjs.map → note-context-DCwE2A-M.mjs.map} +1 -1
  60. package/dist/{planner-Cm3g6fWH.mjs → planner-BLDJt3ZS.mjs} +6 -5
  61. package/dist/{planner-Cm3g6fWH.mjs.map → planner-BLDJt3ZS.mjs.map} +1 -1
  62. package/dist/{postgres-Dwxe290H.mjs → postgres-CtOzfoQU.mjs} +1 -1
  63. package/dist/{postgres-Dwxe290H.mjs.map → postgres-CtOzfoQU.mjs.map} +1 -1
  64. package/dist/{program-AR0qlYRg.mjs → program-CruRnLtc.mjs} +99 -84
  65. package/dist/program-CruRnLtc.mjs.map +1 -0
  66. package/dist/query-feedback-DGoVRaWD.mjs +3 -0
  67. package/dist/{query-feedback-DZfjI34w.mjs → query-feedback-Dqz-HC__.mjs} +1 -1
  68. package/dist/{query-feedback-DZfjI34w.mjs.map → query-feedback-Dqz-HC__.mjs.map} +1 -1
  69. package/dist/router-BTIGZR2_.mjs +3 -0
  70. package/dist/{router-DHracTUC.mjs → router-DD6D4j31.mjs} +1 -1
  71. package/dist/{router-DHracTUC.mjs.map → router-DD6D4j31.mjs.map} +1 -1
  72. package/dist/runtime-paths-rni52zHX.mjs +50 -0
  73. package/dist/runtime-paths-rni52zHX.mjs.map +1 -0
  74. package/dist/scope-NIwCGxRI.mjs +351 -0
  75. package/dist/scope-NIwCGxRI.mjs.map +1 -0
  76. package/dist/{server-BOuAOj9b.mjs → server-Cp7tNzNC.mjs} +19 -2
  77. package/dist/server-Cp7tNzNC.mjs.map +1 -0
  78. package/dist/skills/Worker/SKILL.md +13 -0
  79. package/dist/{sources-ju6AA7lL.mjs → sources-CS43CpuS.mjs} +1 -1
  80. package/dist/{sources-ju6AA7lL.mjs.map → sources-CS43CpuS.mjs.map} +1 -1
  81. package/dist/{sqlite-kFZeWCJ2.mjs → sqlite-Cq3gJcq9.mjs} +1 -1
  82. package/dist/{sqlite-kFZeWCJ2.mjs.map → sqlite-Cq3gJcq9.mjs.map} +1 -1
  83. package/dist/{state-ahFAbD8b.mjs → state-BTa10SOM.mjs} +1 -1
  84. package/dist/{state-ahFAbD8b.mjs.map → state-BTa10SOM.mjs.map} +1 -1
  85. package/dist/{state-DH_mp5Xe.mjs → state-RXepvbnO.mjs} +1 -1
  86. package/dist/{themes-DqhNUUQk.mjs → themes-B7h9YDiy.mjs} +1 -1
  87. package/dist/{themes-DqhNUUQk.mjs.map → themes-B7h9YDiy.mjs.map} +1 -1
  88. package/dist/{tools-COna9vZR.mjs → tools-BW3NLMPk.mjs} +1 -1
  89. package/dist/{tools-CMlHa9lZ.mjs → tools-LlzcV_eK.mjs} +14 -14
  90. package/dist/{tools-CMlHa9lZ.mjs.map → tools-LlzcV_eK.mjs.map} +1 -1
  91. package/dist/{trace-DTP6k4B_.mjs → trace-u4hT-pLD.mjs} +1 -1
  92. package/dist/{trace-DTP6k4B_.mjs.map → trace-u4hT-pLD.mjs.map} +1 -1
  93. package/dist/{vault-indexer-YMH22mLU.mjs → vault-indexer-mata9S7b.mjs} +1 -1
  94. package/dist/{vault-indexer-YMH22mLU.mjs.map → vault-indexer-mata9S7b.mjs.map} +1 -1
  95. package/dist/{work-queue-worker-B3nl8yyn.mjs → work-queue-worker-7Vkli4Yh.mjs} +4 -4
  96. package/dist/{work-queue-worker-B3nl8yyn.mjs.map → work-queue-worker-7Vkli4Yh.mjs.map} +1 -1
  97. package/dist/work-queue-worker-D1p2V-ae.mjs +14 -0
  98. package/dist/{zettelkasten-DDvKRm2V.mjs → zettelkasten-F0D_XfQ4.mjs} +3 -3
  99. package/dist/{zettelkasten-DDvKRm2V.mjs.map → zettelkasten-F0D_XfQ4.mjs.map} +1 -1
  100. package/docs/commands/README.md +2 -2
  101. package/docs/commands/mcp.md +4 -4
  102. package/docs/commands/worker.md +3 -0
  103. package/docs/worker.md +40 -0
  104. package/package.json +1 -1
  105. package/plugins/productivity/hooks/hooks.json +5 -0
  106. package/src/hooks/ts/user-prompt/worker-supervision.ts +123 -0
  107. package/statusline-command.sh +65 -73
  108. package/dist/chain-DhVHVnmT.mjs.map +0 -1
  109. package/dist/config-D1G9IFpn.mjs.map +0 -1
  110. package/dist/daemon-BSL9sXxm.mjs +0 -22
  111. package/dist/daemon-CpdVUnl_.mjs.map +0 -1
  112. package/dist/detector-BLVOCiJ_.mjs +0 -5
  113. package/dist/factory-C7ua_3ik.mjs +0 -3
  114. package/dist/main-resolver-CM1IHbuu.mjs.map +0 -1
  115. package/dist/main-resolver-E5WlilhM.mjs +0 -6
  116. package/dist/program-AR0qlYRg.mjs.map +0 -1
  117. package/dist/query-feedback-CGcEiGtY.mjs +0 -3
  118. package/dist/router-CAtyVQud.mjs +0 -3
  119. package/dist/server-BOuAOj9b.mjs.map +0 -1
  120. package/dist/work-queue-worker-BM1GcAAq.mjs +0 -14
@@ -7,16 +7,19 @@ import { i as indexProject, n as indexAll, t as embedChunks } from "./sync-BWbe8
7
7
  import { t as STOP_WORDS } from "./stop-words-Hfu8u22w.mjs";
8
8
  import { a as searchMemory, i as populateSlugs } from "./search-Rpk1cSBC.mjs";
9
9
  import { n as formatDetection, r as formatDetectionJson, t as detectProject } from "./detect-CdaA48EI.mjs";
10
- import { _ as claudeProjectsDir, a as findLatestNote, b as transcriptFiles, c as extractAndStoreTriples, d as loadScanConfig, g as upsertSession, h as upsertProject, i as applyContinue, m as saveScanConfig, o as findNotesDir$1, p as resolveHome, r as appendCheckpointToNote, s as readBodyFile, t as readContextHandoverCache, u as cmdScan, v as findMovedProjects, y as scanTranscriptFolders } from "./context-handover-cache-C6_rs7JT.mjs";
11
- import { a as expandHome, c as UNROUTED, d as daemonLogPath, f as daemonPidPath, i as ensureConfigDir, m as schedulerLogPath, n as CONFIG_FILE$2, o as loadConfig, p as paiSocketPath, s as OWNER_LABEL_PREFIX, t as CONFIG_DIR } from "./config-D1G9IFpn.mjs";
12
- import { t as PaiClient } from "./ipc-client-C7AVpsyv.mjs";
13
- import { r as humanDuration, t as createStorageBackend } from "./factory-Bc5EyN54.mjs";
14
- import { _ as DEFAULT_CONTEXT_WINDOW, a as WorkersConfigError, b as readJsonStrict, l as isModelCapability, m as readWorkersSection, r as PROVIDER_TAGS, v as contextWindowFromModelId, x as writeJsonAtomic, y as stripModelVariant } from "./config-Dl8lT4Lu.mjs";
15
- import { s as kgQuery } from "./kg-entity-DbOMPdF9.mjs";
16
- import { _ as workersLogDir, f as eventsPath, n as ensureProxyRunning, p as ledgerPath, r as stopProxy, t as DEFAULT_PROXY_PORT } from "./server-BOuAOj9b.mjs";
17
- import { _ as scanSessions, a as renderDedupedSessions, c as probeResume, d as callAiBroker, f as fetchLiveSessions, g as resolveSessionByNameOrId, h as fmtAge, i as normalizeName$2, l as restoreTopLevel, m as sendToSession, o as hasConversation, p as revealItermSession, r as buildDeduped, s as launchInDir, t as cmdMain, u as printExitDir } from "./main-resolver-CM1IHbuu.mjs";
18
- import { D as loadStatus, M as parseRunnerArgs, S as UNLABELED, _ as openPaneForWorker, a as testProvider, d as handoffFromInside, g as openFollowPane, h as checkPaneForWorker, i as runWorker, l as discardWorker, o as describeMcp, p as sayToWorker, s as parseWorkerReport, t as runChain, u as mergeWorker } from "./chain-DhVHVnmT.mjs";
19
- import { S as statusLineOutput, _ 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, x as replayOutput, y as followWorkers } from "./fallback-CdXv-Np0.mjs";
10
+ import { _ as claudeProjectsDir, a as findLatestNote, b as transcriptFiles, c as extractAndStoreTriples, d as loadScanConfig, g as upsertSession, h as upsertProject, i as applyContinue, m as saveScanConfig, o as findNotesDir$1, p as resolveHome, r as appendCheckpointToNote, s as readBodyFile, t as readContextHandoverCache, u as cmdScan, v as findMovedProjects, y as scanTranscriptFolders } from "./context-handover-cache-dUnSZwaA.mjs";
11
+ import { a as schedulerLogPath, i as paiSocketPath, n as daemonLogPath, r as daemonPidPath } from "./runtime-paths-rni52zHX.mjs";
12
+ import { t as PaiClient } from "./ipc-client-BmypMNYk.mjs";
13
+ import { a as expandHome, c as UNROUTED, i as ensureConfigDir, n as CONFIG_FILE$2, o as loadConfig, s as OWNER_LABEL_PREFIX, t as CONFIG_DIR } from "./config-B64vFg14.mjs";
14
+ import { r as humanDuration, t as createStorageBackend } from "./factory-DEb9NmHJ.mjs";
15
+ import { _ as DEFAULT_CONTEXT_WINDOW, a as WorkersConfigError, b as readJsonStrict, l as isModelCapability, m as readWorkersSection, r as PROVIDER_TAGS, v as contextWindowFromModelId, x as writeJsonAtomic, y as stripModelVariant } from "./config-DgzR5sfb.mjs";
16
+ import { s as kgQuery } from "./kg-entity-r8duqhi9.mjs";
17
+ import { _ as workersLogDir, f as eventsPath, n as ensureProxyRunning, p as ledgerPath, r as stopProxy, t as DEFAULT_PROXY_PORT } from "./server-Cp7tNzNC.mjs";
18
+ import { a as renderDedupedSessions, c as probeResume, d as fmtAge, f as resolveSessionByNameOrId, i as normalizeName$2, l as restoreTopLevel, o as hasConversation, p as scanSessions, r as buildDeduped, s as launchInDir, t as cmdMain, u as printExitDir } from "./main-resolver-BgIrC-D9.mjs";
19
+ import { i as sendToSession, n as fetchLiveSessions, r as revealItermSession, t as callAiBroker } from "./aibroker-client-BP74gGwD.mjs";
20
+ import { b as parseRunnerArgs, h as loadStatus, l as UNLABELED } from "./scope-NIwCGxRI.mjs";
21
+ import { _ as openPaneForWorker, a as testProvider, d as handoffFromInside, g as openFollowPane, h as checkPaneForWorker, i as runWorker, l as discardWorker, o as describeMcp, p as sayToWorker, s as parseWorkerReport, t as runChain, u as mergeWorker } from "./chain-DGXNoTwc.mjs";
22
+ import { S as statusLineOutput, _ 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, x as replayOutput, y as followWorkers } from "./fallback-5UJO-RyX.mjs";
20
23
  import { appendFileSync, chmodSync, copyFileSync, createReadStream, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, statSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
21
24
  import { homedir, platform, tmpdir } from "node:os";
22
25
  import { basename, dirname, join, relative, resolve, sep } from "node:path";
@@ -1891,7 +1894,7 @@ function cmdUnregister(db, slug, opts = {}) {
1891
1894
  //#region src/cli/commands/project/projects-index.ts
1892
1895
  function registerProjectsCommands(projectsCmd, getDb) {
1893
1896
  projectsCmd.command("list", { isDefault: true }).description("Show the unified deduped listing (same as `pai`).\nUse --all to include cold / zero-session / archived projects.").option("--all", "Show all entries including cold / zero-session / archived projects").option("-n, --n <count>", "Max rows to show", "20").action(async (opts) => {
1894
- const { cmdMain } = await import("./main-resolver-E5WlilhM.mjs");
1897
+ const { cmdMain } = await import("./main-resolver-DXGuygFG.mjs");
1895
1898
  await cmdMain(getDb(), void 0, void 0, opts);
1896
1899
  });
1897
1900
  projectsCmd.command("list-raw").description("Raw registry listing with slug, path, status, last_active columns").option("--all", "Include archived projects (default: active only)").option("--status <status>", "Filter by status: active | archived").option("--tag <tag>", "Filter by tag").option("--type <type>", "Filter by type").action((opts) => {
@@ -2963,9 +2966,9 @@ function registerStatsCommands(memoryCmd, getDb) {
2963
2966
  //#region src/cli/commands/memory/sources-cmd.ts
2964
2967
  function registerSourcesCommand(memoryCmd) {
2965
2968
  memoryCmd.command("sources").description("Show what the indexer has taken in: composition by source, which roots\ncontent enters from, the heaviest single files, and how many chunks are\nrewritten per day (which distinguishes a finite backlog from a treadmill).").option("--limit <n>", "Rows per section (default 8)", "8").action(async (opts) => {
2966
- const { createStorageBackend } = await import("./factory-C7ua_3ik.mjs");
2967
- const { loadConfig } = await import("./config-DD52BPB-.mjs");
2968
- const { cmdMemorySources } = await import("./sources-ju6AA7lL.mjs");
2969
+ const { createStorageBackend } = await import("./factory-Dbo8yNPi.mjs");
2970
+ const { loadConfig } = await import("./config-C_ErGddD.mjs");
2971
+ const { cmdMemorySources } = await import("./sources-CS43CpuS.mjs");
2969
2972
  let backend;
2970
2973
  try {
2971
2974
  backend = await createStorageBackend(loadConfig());
@@ -3249,83 +3252,94 @@ function writeClaudeJson(data) {
3249
3252
  //#endregion
3250
3253
  //#region src/cli/commands/mcp.ts
3251
3254
  /**
3252
- * Resolve the absolute path to the built MCP entry point.
3255
+ * Resolve the absolute path to a built MCP entry point.
3253
3256
  *
3254
3257
  * tsdown bundles all CLI commands into a single dist/cli/index.mjs file, so
3255
3258
  * import.meta.url always resolves to dist/cli/index.mjs at runtime.
3256
- * From dist/cli/ we go up one level to dist/ and then into mcp/index.mjs.
3259
+ * From dist/cli/ we go up one level to dist/ and then into the entry.
3257
3260
  */
3258
- function getMcpBinPath() {
3259
- return join(dirname(fileURLToPath(import.meta.url)), "../mcp/index.mjs");
3261
+ function distDir() {
3262
+ return join(dirname(fileURLToPath(import.meta.url)), "..");
3260
3263
  }
3264
+ const SERVERS = [{
3265
+ name: "pai",
3266
+ entry: "mcp/index.mjs",
3267
+ label: "PAI MCP server",
3268
+ tools: "memory_search, memory_get, project_info, project_list, session_list, registry_search"
3269
+ }];
3261
3270
  function cmdInstall$1() {
3262
- const mcpBin = getMcpBinPath();
3263
3271
  const config = readClaudeJson();
3264
3272
  if (typeof config.mcpServers !== "object" || config.mcpServers === null) config.mcpServers = {};
3265
3273
  const servers = config.mcpServers;
3266
- if ("pai" in servers) {
3267
- console.log(warn$1("PAI MCP server is already registered in ~/.claude.json."));
3268
- console.log(dim$1(` Entry: ${JSON.stringify(servers["pai"])}`));
3274
+ let changed = false;
3275
+ for (const spec of SERVERS) {
3276
+ const bin = join(distDir(), spec.entry);
3277
+ if (spec.name in servers) {
3278
+ console.log(warn$1(`${spec.label} is already registered in ~/.claude.json as "${spec.name}".`));
3279
+ console.log(dim$1(` Entry: ${JSON.stringify(servers[spec.name])}`));
3280
+ continue;
3281
+ }
3282
+ servers[spec.name] = {
3283
+ command: "node",
3284
+ args: [bin]
3285
+ };
3286
+ changed = true;
3287
+ console.log(ok$1(`${spec.label} registered in ~/.claude.json as "${spec.name}".`));
3288
+ console.log(dim$1(` Binary: ${bin}`));
3289
+ console.log(dim$1(""));
3290
+ console.log(dim$1(" Restart Claude Code to activate the tools:"));
3291
+ console.log(dim$1(` ${spec.tools}`));
3292
+ if (!existsSync(bin)) {
3293
+ console.log();
3294
+ console.log(warn$1(` Note: MCP binary not found at ${bin}`));
3295
+ console.log(dim$1(" Run `bun run build` to compile it first."));
3296
+ }
3297
+ }
3298
+ if (!changed) {
3269
3299
  console.log(dim$1(" Use `pai mcp status` to verify the configuration."));
3270
3300
  return;
3271
3301
  }
3272
- servers["pai"] = {
3273
- command: "node",
3274
- args: [mcpBin]
3275
- };
3276
3302
  try {
3277
3303
  writeClaudeJson(config);
3278
3304
  } catch (e) {
3279
3305
  console.error(err(`Failed to write ~/.claude.json: ${e}`));
3280
3306
  process.exitCode = 1;
3281
- return;
3282
- }
3283
- console.log(ok$1("PAI MCP server registered in ~/.claude.json."));
3284
- console.log(dim$1(` Binary: ${mcpBin}`));
3285
- console.log(dim$1(""));
3286
- console.log(dim$1(" Restart Claude Code to activate the PAI MCP tools:"));
3287
- console.log(dim$1(" memory_search, memory_get, project_info,"));
3288
- console.log(dim$1(" project_list, session_list, registry_search"));
3289
- if (!existsSync(mcpBin)) {
3290
- console.log();
3291
- console.log(warn$1(` Note: MCP binary not found at ${mcpBin}`));
3292
- console.log(dim$1(" Run `bun run build` to compile it first."));
3293
3307
  }
3294
3308
  }
3295
3309
  function cmdStatus$3() {
3296
- const mcpBin = getMcpBinPath();
3297
3310
  const config = readClaudeJson();
3298
3311
  const servers = typeof config.mcpServers === "object" && config.mcpServers !== null ? config.mcpServers : {};
3299
- const registered = "pai" in servers;
3300
- const binExists = existsSync(mcpBin);
3301
3312
  console.log();
3302
3313
  console.log(bold$1(" PAI MCP Server Status"));
3303
3314
  console.log();
3304
- if (registered) {
3305
- const entry = servers["pai"];
3306
- console.log(ok$1(` Registered in ~/.claude.json`));
3307
- console.log(dim$1(` Config: ${JSON.stringify(entry)}`));
3308
- } else {
3309
- console.log(warn$1(` NOT registered in ~/.claude.json`));
3310
- console.log(dim$1(` Run: pai mcp install`));
3311
- }
3312
- console.log();
3313
- if (binExists) console.log(ok$1(` MCP binary found: ${mcpBin}`));
3314
- else {
3315
- console.log(warn$1(` MCP binary NOT found: ${mcpBin}`));
3316
- console.log(dim$1(" Run: bun run build"));
3315
+ let allReady = true;
3316
+ for (const spec of SERVERS) {
3317
+ const bin = join(distDir(), spec.entry);
3318
+ const registered = spec.name in servers;
3319
+ const binExists = existsSync(bin);
3320
+ if (registered) {
3321
+ console.log(ok$1(` ${spec.name}: registered in ~/.claude.json`));
3322
+ console.log(dim$1(` Config: ${JSON.stringify(servers[spec.name])}`));
3323
+ } else {
3324
+ console.log(warn$1(` ${spec.name}: NOT registered in ~/.claude.json`));
3325
+ console.log(dim$1(` Run: pai mcp install`));
3326
+ }
3327
+ if (binExists) console.log(ok$1(` Binary found: ${bin}`));
3328
+ else {
3329
+ console.log(warn$1(` Binary NOT found: ${bin}`));
3330
+ console.log(dim$1(` Run: bun run build`));
3331
+ }
3332
+ if (!registered || !binExists) allReady = false;
3333
+ console.log();
3317
3334
  }
3318
- console.log();
3319
- if (registered && binExists) console.log(dim$1(" Status: READY — restart Claude Code to use PAI tools"));
3320
- else if (registered && !binExists) console.log(warn$1(" Status: NEEDS BUILD — run `bun run build`"));
3321
- else console.log(dim$1(" Status: NOT INSTALLED — run `pai mcp install`"));
3335
+ console.log(allReady ? dim$1(" Status: READY — restart Claude Code to use the PAI tools") : warn$1(" Status: INCOMPLETE — run `pai mcp install` and/or `bun run build`"));
3322
3336
  console.log();
3323
3337
  }
3324
3338
  function registerMcpCommands(mcpCmd) {
3325
- mcpCmd.command("install").description("Register the PAI MCP server in ~/.claude.json (restart Claude Code to activate)").action(() => {
3339
+ mcpCmd.command("install").description("Register the PAI MCP server (pai) in ~/.claude.json (restart Claude Code to activate)").action(() => {
3326
3340
  cmdInstall$1();
3327
3341
  });
3328
- mcpCmd.command("status").description("Show whether the PAI MCP server is registered and the binary exists").action(() => {
3342
+ mcpCmd.command("status").description("Show whether the PAI MCP server (pai) is registered and the binary exists").action(() => {
3329
3343
  cmdStatus$3();
3330
3344
  });
3331
3345
  }
@@ -3652,8 +3666,8 @@ function cmdLogs(opts) {
3652
3666
  }
3653
3667
  function registerDaemonCommands(daemonCmd) {
3654
3668
  daemonCmd.command("serve").description("Start the PAI daemon in the foreground").action(async () => {
3655
- const { serve } = await import("./daemon-BSL9sXxm.mjs");
3656
- const { loadConfig: lc, ensureConfigDir } = await import("./config-DD52BPB-.mjs");
3669
+ const { serve } = await import("./daemon-CKBkhOsZ.mjs");
3670
+ const { loadConfig: lc, ensureConfigDir } = await import("./config-C_ErGddD.mjs");
3657
3671
  ensureConfigDir();
3658
3672
  await serve(lc());
3659
3673
  });
@@ -5252,19 +5266,20 @@ async function stepDaemon(rl) {
5252
5266
  async function stepMcp(rl) {
5253
5267
  section("Step 10: MCP Registration");
5254
5268
  line$1();
5255
- line$1(" Registering the PAI MCP server lets Claude Code call PAI tools directly.");
5269
+ line$1(" Registering the PAI MCP server (pai) lets Claude Code");
5270
+ line$1(" call PAI tools directly.");
5256
5271
  line$1();
5257
5272
  const claudeJsonPath = join(homedir(), ".claude.json");
5258
5273
  if (existsSync(claudeJsonPath)) try {
5259
5274
  const raw = readFileSync(claudeJsonPath, "utf-8");
5260
5275
  const mcpServers = JSON.parse(raw)["mcpServers"];
5261
5276
  if (mcpServers && Object.prototype.hasOwnProperty.call(mcpServers, "pai")) {
5262
- console.log(c.ok("PAI MCP server already registered in ~/.claude.json."));
5277
+ console.log(c.ok("PAI MCP server (pai) already registered in ~/.claude.json."));
5263
5278
  console.log(c.dim(" Skipping MCP registration."));
5264
5279
  return false;
5265
5280
  }
5266
5281
  } catch {}
5267
- if (!await promptYesNo(rl, "Register the PAI MCP server in ~/.claude.json?", true)) {
5282
+ if (!await promptYesNo(rl, "Register the PAI MCP server (pai) in ~/.claude.json?", true)) {
5268
5283
  console.log(c.dim(" Skipping MCP registration. Run manually: pai mcp install"));
5269
5284
  return false;
5270
5285
  }
@@ -5273,7 +5288,7 @@ async function stepMcp(rl) {
5273
5288
  console.log(c.warn(" MCP registration failed. Run manually: pai mcp install"));
5274
5289
  return false;
5275
5290
  }
5276
- console.log(c.ok("PAI MCP server registered in ~/.claude.json."));
5291
+ console.log(c.ok("PAI MCP server (pai) registered in ~/.claude.json."));
5277
5292
  return true;
5278
5293
  }
5279
5294
 
@@ -7230,7 +7245,7 @@ async function cmdExplore(note, opts) {
7230
7245
  const depth = parseInt(opts.depth ?? "3", 10);
7231
7246
  const direction = opts.direction ?? "both";
7232
7247
  const mode = opts.mode ?? "all";
7233
- const { zettelExplore } = await import("./zettelkasten-DDvKRm2V.mjs");
7248
+ const { zettelExplore } = await import("./zettelkasten-F0D_XfQ4.mjs");
7234
7249
  const result = zettelExplore(getFedDb(), {
7235
7250
  startNote: note,
7236
7251
  depth,
@@ -7295,7 +7310,7 @@ async function cmdHealth(opts) {
7295
7310
  const projectPath = opts.project;
7296
7311
  const recentDays = parseInt(opts.days ?? "30", 10);
7297
7312
  const includeTypes = opts.include ? opts.include.split(",").map((s) => s.trim()) : void 0;
7298
- const { zettelHealth } = await import("./zettelkasten-DDvKRm2V.mjs");
7313
+ const { zettelHealth } = await import("./zettelkasten-F0D_XfQ4.mjs");
7299
7314
  const result = zettelHealth(getFedDb(), {
7300
7315
  scope,
7301
7316
  projectPath,
@@ -7366,7 +7381,7 @@ async function cmdSurprise(note, opts) {
7366
7381
  const limit = parseInt(opts.limit ?? "10", 10);
7367
7382
  const minSimilarity = parseFloat(opts.minSimilarity ?? "0.3");
7368
7383
  const minGraphDistance = parseInt(opts.minDistance ?? "3", 10);
7369
- const { zettelSurprise } = await import("./zettelkasten-DDvKRm2V.mjs");
7384
+ const { zettelSurprise } = await import("./zettelkasten-F0D_XfQ4.mjs");
7370
7385
  const db = getFedDb();
7371
7386
  console.log();
7372
7387
  console.log(header(" PAI Zettel Surprise"));
@@ -7421,7 +7436,7 @@ async function cmdSuggest(note, opts) {
7421
7436
  const vaultProjectId = parseInt(opts.vaultProjectId, 10);
7422
7437
  const limit = parseInt(opts.limit ?? "5", 10);
7423
7438
  const excludeLinked = opts.excludeLinked !== false;
7424
- const { zettelSuggest } = await import("./zettelkasten-DDvKRm2V.mjs");
7439
+ const { zettelSuggest } = await import("./zettelkasten-F0D_XfQ4.mjs");
7425
7440
  const db = getFedDb();
7426
7441
  console.log();
7427
7442
  console.log(header(" PAI Zettel Suggest"));
@@ -7474,7 +7489,7 @@ async function cmdConverse(question, opts) {
7474
7489
  const vaultProjectId = parseInt(opts.vaultProjectId, 10);
7475
7490
  const depth = parseInt(opts.depth ?? "2", 10);
7476
7491
  const limit = parseInt(opts.limit ?? "15", 10);
7477
- const { zettelConverse } = await import("./zettelkasten-DDvKRm2V.mjs");
7492
+ const { zettelConverse } = await import("./zettelkasten-F0D_XfQ4.mjs");
7478
7493
  const db = getFedDb();
7479
7494
  console.log();
7480
7495
  console.log(header(" PAI Zettel Converse"));
@@ -7537,7 +7552,7 @@ async function cmdThemes(opts) {
7537
7552
  const minClusterSize = parseInt(opts.minSize ?? "3", 10);
7538
7553
  const maxThemes = parseInt(opts.maxThemes ?? "10", 10);
7539
7554
  const similarityThreshold = parseFloat(opts.threshold ?? "0.65");
7540
- const { zettelThemes } = await import("./zettelkasten-DDvKRm2V.mjs");
7555
+ const { zettelThemes } = await import("./zettelkasten-F0D_XfQ4.mjs");
7541
7556
  const db = getFedDb();
7542
7557
  console.log();
7543
7558
  console.log(header(" PAI Zettel Themes"));
@@ -9112,8 +9127,8 @@ async function escalate(task, headline, detail, state, now, opts) {
9112
9127
  state.alarmedAt[task.id] = now;
9113
9128
  let delivered = false;
9114
9129
  try {
9115
- const { routeNotification } = await import("./router-CAtyVQud.mjs");
9116
- const { loadConfig } = await import("./config-DD52BPB-.mjs");
9130
+ const { routeNotification } = await import("./router-BTIGZR2_.mjs");
9131
+ const { loadConfig } = await import("./config-C_ErGddD.mjs");
9117
9132
  delivered = (await routeNotification({
9118
9133
  event: "error",
9119
9134
  title: `PAI: ${headline}`,
@@ -11729,10 +11744,10 @@ function cmdActive(db, opts) {
11729
11744
  ], rows));
11730
11745
  }
11731
11746
  async function cmdAutoRoute(opts) {
11732
- const { autoRoute, formatAutoRoute, formatAutoRouteJson } = await import("./auto-route-BwzmlW3W.mjs");
11747
+ const { autoRoute, formatAutoRoute, formatAutoRouteJson } = await import("./auto-route-_5zzJz5q.mjs");
11733
11748
  const { openRegistry } = await import("./db-XEwJbuGO.mjs");
11734
- const { createStorageBackend } = await import("./factory-C7ua_3ik.mjs");
11735
- const { loadConfig } = await import("./config-DD52BPB-.mjs");
11749
+ const { createStorageBackend } = await import("./factory-Dbo8yNPi.mjs");
11750
+ const { loadConfig } = await import("./config-C_ErGddD.mjs");
11736
11751
  const config = loadConfig();
11737
11752
  const registryDb = openRegistry();
11738
11753
  const federation = await createStorageBackend(config);
@@ -14075,7 +14090,7 @@ function fail(e) {
14075
14090
  process.exitCode = 1;
14076
14091
  }
14077
14092
  function registerWorkerCommands(workerCmd) {
14078
- workerCmd.command("run").description("Run one claude-code worker through the configured provider.\nUnknown options are passed to claude verbatim (e.g. -p, --allowedTools);\n--output-format/--verbose are handled here.\n--chain draft,implement[,review] runs a spec-first pipeline;\n--agent <name> runs an agent definition from ~/.claude/agents.").allowUnknownOption(true).option("--provider <name>", "Provider to run on (default: active, else routing order)").option("--class <name>", "Use the provider of this class (draft, implement, review, research, spotcheck, simple, complex, image)").option("--role <name>", "Alias of --class (roles were renamed to classes)").option("--chain <stages>", "Comma-separated stage classes, e.g. draft,implement or draft,implement,review").option("--agent <name>", "Run the agent definition ~/.claude/agents/<name>.md on a worker").option("--model <model>", "Override the provider's model for this run").option("--label <text>", "Short task label shown in ps / follow / status line").option("--mcp <names>", "MCP servers/sets this worker may use (comma-separated; see `pai worker mcp`)").option("--no-pane", "Do not open a follow pane for this worker").option("--worktree", "Run in a git worktree on branch worker/<id> (default for implement/complex/plan in a git repo)").option("--no-worktree", "Run in place, no worktree").argument("[args...]", "claude arguments, e.g. -p '<task>' --allowedTools 'Read,Edit,Bash'").action(async (args, opts) => {
14093
+ workerCmd.command("run").description("Run one claude-code worker through the configured provider.\nUnknown options are passed to claude verbatim (e.g. -p, --allowedTools);\n--output-format/--verbose are handled here.\nGrant MCP tools by naming mcp__server__tool in --allowedTools (the server loads automatically);\n--chain draft,implement[,review] runs a spec-first pipeline;\n--agent <name> runs an agent definition from ~/.claude/agents.").allowUnknownOption(true).option("--provider <name>", "Provider to run on (default: active, else routing order)").option("--class <name>", "Use the provider of this class (draft, implement, review, research, spotcheck, simple, complex, image)").option("--role <name>", "Alias of --class (roles were renamed to classes)").option("--chain <stages>", "Comma-separated stage classes, e.g. draft,implement or draft,implement,review").option("--agent <name>", "Run the agent definition ~/.claude/agents/<name>.md on a worker").option("--model <model>", "Override the provider's model for this run").option("--label <text>", "Short task label shown in ps / follow / status line").option("--mcp <names>", "MCP servers/sets this worker may use (comma-separated; see `pai worker mcp`)").option("--no-pane", "Do not open a follow pane for this worker").option("--worktree", "Run in a git worktree on branch worker/<id> (default for implement/complex/plan in a git repo)").option("--no-worktree", "Run in place, no worktree").argument("[args...]", "claude arguments, e.g. -p '<task>' --allowedTools 'Read,Edit,Bash'").action(async (args, opts) => {
14079
14094
  try {
14080
14095
  const className = opts.class ?? opts.role;
14081
14096
  let claudeArgs = args;
@@ -14242,7 +14257,7 @@ function registerWorkerCommands(workerCmd) {
14242
14257
  fail(e);
14243
14258
  }
14244
14259
  });
14245
- workerCmd.command("wait <ids...>").description("Poll workers until they finish; prints each result as one JSON line, exit 1 on failure or timeout").option("--timeout <secs>", "Give up after this many seconds (default 900)", parseIntArg).action(async (ids, opts) => {
14260
+ workerCmd.command("wait <ids...>").description("Poll workers until they finish; prints each result as one JSON line, exit 1 on failure or timeout\nNever busy-wait for a worker: no sleep loops, no sleep-then-`pai worker ps` polling, no manual retry loops. Two sanctioned waits: run workers as background Bash tasks (the harness notifies on completion), or call `pai worker wait`, which blocks until they finish and prints each result. If you catch yourself sleeping to re-check a worker, stop — you already get notified. Supervision events arrive automatically — no polling, no sleeps: the daemon watches your workers and tells you when one finishes, fails or stalls (docs/worker.md, Supervision).").option("--timeout <secs>", "Give up after this many seconds (default 900)", parseIntArg).action(async (ids, opts) => {
14246
14261
  try {
14247
14262
  const { results, timedOut } = await waitWorkers(currentLogDir(), ids, { timeoutMs: (opts.timeout ?? 900) * 1e3 });
14248
14263
  for (const r of results) console.log(JSON.stringify(r));
@@ -14778,8 +14793,8 @@ function analyzeProject(db, project) {
14778
14793
  async function countVectorDbPaths(oldPaths) {
14779
14794
  if (oldPaths.length === 0) return 0;
14780
14795
  try {
14781
- const { loadConfig } = await import("./config-DD52BPB-.mjs");
14782
- const { PostgresBackend } = await import("./postgres-Dwxe290H.mjs");
14796
+ const { loadConfig } = await import("./config-C_ErGddD.mjs");
14797
+ const { PostgresBackend } = await import("./postgres-CtOzfoQU.mjs");
14783
14798
  const config = loadConfig();
14784
14799
  if (config.storageBackend !== "postgres") return 0;
14785
14800
  const pgBackend = new PostgresBackend(config.postgres ?? {});
@@ -14799,8 +14814,8 @@ async function countVectorDbPaths(oldPaths) {
14799
14814
  async function updateVectorDbPaths(moves) {
14800
14815
  if (moves.length === 0) return 0;
14801
14816
  try {
14802
- const { loadConfig } = await import("./config-DD52BPB-.mjs");
14803
- const { PostgresBackend } = await import("./postgres-Dwxe290H.mjs");
14817
+ const { loadConfig } = await import("./config-C_ErGddD.mjs");
14818
+ const { PostgresBackend } = await import("./postgres-CtOzfoQU.mjs");
14804
14819
  const config = loadConfig();
14805
14820
  if (config.storageBackend !== "postgres") return 0;
14806
14821
  const pgBackend = new PostgresBackend(config.postgres ?? {});
@@ -16337,4 +16352,4 @@ claude() {
16337
16352
 
16338
16353
  //#endregion
16339
16354
  export { drainStdio as n, buildProgram as t };
16340
- //# sourceMappingURL=program-AR0qlYRg.mjs.map
16355
+ //# sourceMappingURL=program-CruRnLtc.mjs.map