@tekmidian/pai 0.64.0 → 0.65.1
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/README.md +60 -1051
- package/dist/{aibroker-client-BpfuGPe5.mjs → aibroker-client-B8c42Lh8.mjs} +1 -1
- package/dist/{aibroker-client-DRld7g6z.mjs → aibroker-client-C5Fw7DNz.mjs} +10 -4
- package/dist/{aibroker-client-DRld7g6z.mjs.map → aibroker-client-C5Fw7DNz.mjs.map} +1 -1
- package/dist/{async-CY_cd_8j.mjs → async-CNn36gm4.mjs} +2 -2
- package/dist/{async-CY_cd_8j.mjs.map → async-CNn36gm4.mjs.map} +1 -1
- package/dist/{auto-route-CPlam4iv.mjs → auto-route-sLMU-NnM.mjs} +2 -2
- package/dist/{auto-route-CPlam4iv.mjs.map → auto-route-sLMU-NnM.mjs.map} +1 -1
- package/dist/{chain-o-g8AgE3.mjs → chain-CLb6hbFS.mjs} +4 -4
- package/dist/{chain-o-g8AgE3.mjs.map → chain-CLb6hbFS.mjs.map} +1 -1
- package/dist/cli/index.mjs +19 -19
- package/dist/cli/program.d.mts.map +1 -1
- package/dist/cli/program.mjs +19 -19
- package/dist/{clusters-DsMf20PP.mjs → clusters-PgIUYT_v.mjs} +1 -1
- package/dist/{clusters-DsMf20PP.mjs.map → clusters-PgIUYT_v.mjs.map} +1 -1
- package/dist/{config-2wkz744W.mjs → config-BbLFD7Uf.mjs} +3 -3
- package/dist/config-BbLFD7Uf.mjs.map +1 -0
- package/dist/{config-CUTg6VDq.mjs → config-YinjgXEJ.mjs} +1 -1
- package/dist/{context-handover-cache-BOpjLsKe.mjs → context-handover-cache-mGxq2-8f.mjs} +11 -29
- package/dist/context-handover-cache-mGxq2-8f.mjs.map +1 -0
- package/dist/daemon/index.mjs +16 -16
- package/dist/daemon-BjaPR39W.mjs +19 -0
- package/dist/{daemon-BYieXduQ.mjs → daemon-DqCB3fO-.mjs} +30 -30
- package/dist/{daemon-BYieXduQ.mjs.map → daemon-DqCB3fO-.mjs.map} +1 -1
- package/dist/daemon-mcp/index.mjs +18 -18
- package/dist/daemon-mcp/index.mjs.map +1 -1
- package/dist/detector-C3Q7mxQU.mjs +3 -0
- package/dist/{detector-BAlmrLQ0.mjs → detector-CIHEXKsV.mjs} +1 -1
- package/dist/{detector-BAlmrLQ0.mjs.map → detector-CIHEXKsV.mjs.map} +1 -1
- package/dist/{embeddings-DK9XfQic.mjs → embeddings-BbNVXa_0.mjs} +1 -1
- package/dist/{embeddings-DK9XfQic.mjs.map → embeddings-BbNVXa_0.mjs.map} +1 -1
- package/dist/{embeddings-Xg8XLf2K.mjs → embeddings-CDfM63uC.mjs} +1 -1
- package/dist/{factory-BMK0tC1b.mjs → factory-CaswxuJ0.mjs} +1 -1
- package/dist/{factory-C4We3xR_.mjs → factory-y36qGegI.mjs} +13 -13
- package/dist/{factory-C4We3xR_.mjs.map → factory-y36qGegI.mjs.map} +1 -1
- package/dist/{fallback-ECiqCuh6.mjs → fallback-CupzGkuJ.mjs} +1205 -1204
- package/dist/fallback-CupzGkuJ.mjs.map +1 -0
- package/dist/{federation-db-CUgy0WYs.mjs → federation-db-BTyoufBh.mjs} +2 -2
- package/dist/{federation-db-CUgy0WYs.mjs.map → federation-db-BTyoufBh.mjs.map} +1 -1
- package/dist/federation-db-HfIFc7FG.mjs +3 -0
- package/dist/hooks/block-sleep-poll.mjs +36 -11
- package/dist/hooks/block-sleep-poll.mjs.map +2 -2
- package/dist/hooks/capture-all-events.mjs +3 -17
- package/dist/hooks/capture-all-events.mjs.map +3 -3
- package/dist/hooks/capture-session-summary.mjs +3 -17
- package/dist/hooks/capture-session-summary.mjs.map +3 -3
- package/dist/hooks/capture-tool-output.mjs +3 -17
- package/dist/hooks/capture-tool-output.mjs.map +3 -3
- package/dist/hooks/cleanup-session-files.mjs +3 -17
- package/dist/hooks/cleanup-session-files.mjs.map +2 -2
- package/dist/hooks/context-compression-hook.mjs +3 -17
- package/dist/hooks/context-compression-hook.mjs.map +3 -3
- package/dist/hooks/initialize-session.mjs +3 -17
- package/dist/hooks/initialize-session.mjs.map +2 -2
- package/dist/hooks/inject-observations.mjs +3 -17
- package/dist/hooks/inject-observations.mjs.map +2 -2
- package/dist/hooks/load-core-context.mjs +4 -22
- package/dist/hooks/load-core-context.mjs.map +2 -2
- package/dist/hooks/load-project-context.mjs +3 -17
- package/dist/hooks/load-project-context.mjs.map +3 -3
- package/dist/hooks/mcp-deferred-gate.mjs +3 -17
- package/dist/hooks/mcp-deferred-gate.mjs.map +2 -2
- package/dist/hooks/observe.mjs +3 -17
- package/dist/hooks/observe.mjs.map +2 -2
- package/dist/hooks/post-compact-inject.mjs.map +1 -1
- package/dist/hooks/route-agents-to-worker.mjs.map +1 -1
- package/dist/hooks/security-validator.mjs +5 -19
- package/dist/hooks/security-validator.mjs.map +3 -3
- package/dist/hooks/stop-hook.mjs +3 -17
- package/dist/hooks/stop-hook.mjs.map +3 -3
- package/dist/hooks/sync-todo-to-md.mjs +3 -17
- package/dist/hooks/sync-todo-to-md.mjs.map +2 -2
- package/dist/hooks/whisper-rules.mjs.map +1 -1
- package/dist/hooks/worker-guard.mjs.map +2 -2
- package/dist/hooks/worker-proxy.mjs.map +1 -1
- package/dist/hooks/worker-status-line.mjs +4 -4
- package/dist/hooks/worker-status-line.mjs.map +2 -2
- package/dist/hooks/worker-supervision.mjs.map +1 -1
- package/dist/{indexer-backend-CJ0RGgMz.mjs → indexer-backend-Cnc7Tf5C.mjs} +2 -2
- package/dist/{ipc-client-EhWY8XL0.mjs → ipc-client-D16Xw6Uo.mjs} +2 -2
- package/dist/{ipc-client-EhWY8XL0.mjs.map → ipc-client-D16Xw6Uo.mjs.map} +1 -1
- package/dist/{kg-entity-1uqCnk4u.mjs → kg-entity-COTUj1ZC.mjs} +1 -1
- package/dist/{kg-entity-1uqCnk4u.mjs.map → kg-entity-COTUj1ZC.mjs.map} +1 -1
- package/dist/{latent-ideas-CSuKfiq3.mjs → latent-ideas-ByvMjVcb.mjs} +3 -3
- package/dist/{latent-ideas-CSuKfiq3.mjs.map → latent-ideas-ByvMjVcb.mjs.map} +1 -1
- package/dist/{link-boost-BtjzfE3c.mjs → link-boost-UiE-uooT.mjs} +1 -1
- package/dist/{link-boost-BtjzfE3c.mjs.map → link-boost-UiE-uooT.mjs.map} +1 -1
- package/dist/{main-resolver-DyOrwNYw.mjs → main-resolver-BeYWNzrt.mjs} +11 -11
- package/dist/{main-resolver-DyOrwNYw.mjs.map → main-resolver-BeYWNzrt.mjs.map} +1 -1
- package/dist/main-resolver-kHW6FewU.mjs +7 -0
- package/dist/merge-2gqRPFu2.mjs +3 -0
- package/dist/{merge-D58n_-LZ.mjs → merge-DgU9OgZy.mjs} +1 -1
- package/dist/{merge-D58n_-LZ.mjs.map → merge-DgU9OgZy.mjs.map} +1 -1
- package/dist/module-paths-DdRzbkUI.mjs +44 -0
- package/dist/module-paths-DdRzbkUI.mjs.map +1 -0
- package/dist/{neighborhood-DNuRelRB.mjs → neighborhood-CvRHlqdR.mjs} +2 -2
- package/dist/{neighborhood-DNuRelRB.mjs.map → neighborhood-CvRHlqdR.mjs.map} +1 -1
- package/dist/{note-context-D9JZ4-7o.mjs → note-context-BrbfUIoP.mjs} +1 -1
- package/dist/{note-context-D9JZ4-7o.mjs.map → note-context-BrbfUIoP.mjs.map} +1 -1
- package/dist/{pai-home-UncxWxlX.mjs → pai-home-Cm9rcJgX.mjs} +1 -1
- package/dist/{pai-home-UncxWxlX.mjs.map → pai-home-Cm9rcJgX.mjs.map} +1 -1
- package/dist/{planner-DgC3oSvb.mjs → planner-DAq4Yx-H.mjs} +7 -7
- package/dist/{planner-DgC3oSvb.mjs.map → planner-DAq4Yx-H.mjs.map} +1 -1
- package/dist/{postgres-CcsRKir-.mjs → postgres-DYtZg7J7.mjs} +5 -13
- package/dist/{postgres-CcsRKir-.mjs.map → postgres-DYtZg7J7.mjs.map} +1 -1
- package/dist/{program-JhF2GgJY.mjs → program-CWf9mT7Z.mjs} +262 -260
- package/dist/program-CWf9mT7Z.mjs.map +1 -0
- package/dist/{query-feedback-BPa0dISE.mjs → query-feedback-BIaZTTFO.mjs} +2 -2
- package/dist/{query-feedback-BPa0dISE.mjs.map → query-feedback-BIaZTTFO.mjs.map} +1 -1
- package/dist/query-feedback-B_iigYj-.mjs +3 -0
- package/dist/{registry-db-DCzdI4sC.mjs → registry-db-C7voqML9.mjs} +2 -2
- package/dist/{registry-db-DCzdI4sC.mjs.map → registry-db-C7voqML9.mjs.map} +1 -1
- package/dist/registry-db-JHPhA8vF.mjs +3 -0
- package/dist/{registry-postgres-BUnkHKYs.mjs → registry-postgres-DSrkxqfF.mjs} +2 -2
- package/dist/{registry-postgres-BUnkHKYs.mjs.map → registry-postgres-DSrkxqfF.mjs.map} +1 -1
- package/dist/{registry-sqlite-CKYNwkUv.mjs → registry-sqlite-B2436JgX.mjs} +2 -2
- package/dist/{registry-sqlite-CKYNwkUv.mjs.map → registry-sqlite-B2436JgX.mjs.map} +1 -1
- package/dist/router-S6C5BxzZ.mjs +3 -0
- package/dist/{router-CGZATlvm.mjs → router-aqLMvNMg.mjs} +1 -1
- package/dist/{router-CGZATlvm.mjs.map → router-aqLMvNMg.mjs.map} +1 -1
- package/dist/{run-env-Br4Bc7Vz.mjs → run-env-BHWnXqle.mjs} +3 -3
- package/dist/{run-env-Br4Bc7Vz.mjs.map → run-env-BHWnXqle.mjs.map} +1 -1
- package/dist/{run-W2rV_9j0.mjs → run-uAkNItb6.mjs} +140 -44
- package/dist/run-uAkNItb6.mjs.map +1 -0
- package/dist/{runtime-paths-QGQJAekd.mjs → runtime-paths-CHTg3ywb.mjs} +1 -1
- package/dist/{runtime-paths-QGQJAekd.mjs.map → runtime-paths-CHTg3ywb.mjs.map} +1 -1
- package/dist/{server-B71rem4q.mjs → server-DlL1QI2k.mjs} +4 -5
- package/dist/server-DlL1QI2k.mjs.map +1 -0
- package/dist/{session-keepalive-Dgil9hjw.mjs → session-keepalive-BWEjcRrh.mjs} +7 -7
- package/dist/{session-keepalive-Dgil9hjw.mjs.map → session-keepalive-BWEjcRrh.mjs.map} +1 -1
- package/dist/skills/Art/SKILL.md +1 -1
- package/dist/skills/Observability/SKILL.md +4 -4
- package/dist/skills/Research/SKILL.md +1 -1
- package/dist/skills/Tasks/SKILL.md +1 -1
- package/dist/{sources-LcGptLA-.mjs → sources-DX4ElmrE.mjs} +1 -1
- package/dist/{sources-LcGptLA-.mjs.map → sources-DX4ElmrE.mjs.map} +1 -1
- package/dist/{sqlite-CAJcw2zL.mjs → sqlite-BrEu3avy.mjs} +3 -3
- package/dist/{sqlite-CAJcw2zL.mjs.map → sqlite-BrEu3avy.mjs.map} +1 -1
- package/dist/{state-S9wlKarB.mjs → state-DW8zdweW.mjs} +1 -1
- package/dist/{state-CHltNjXI.mjs → state-HyjqTihC.mjs} +1 -1
- package/dist/{state-CHltNjXI.mjs.map → state-HyjqTihC.mjs.map} +1 -1
- package/dist/{themes-D1FQFthd.mjs → themes-BgqahYVM.mjs} +2 -2
- package/dist/{themes-D1FQFthd.mjs.map → themes-BgqahYVM.mjs.map} +1 -1
- package/dist/{tools-BW7OXf-N.mjs → tools-BbqQIHPe.mjs} +4 -4
- package/dist/{tools-BFC-113F.mjs → tools-gMGDIpJ9.mjs} +18 -18
- package/dist/{tools-BFC-113F.mjs.map → tools-gMGDIpJ9.mjs.map} +1 -1
- package/dist/{trace-IDKK1VFs.mjs → trace-CmAB7iJZ.mjs} +1 -1
- package/dist/{trace-IDKK1VFs.mjs.map → trace-CmAB7iJZ.mjs.map} +1 -1
- package/dist/{vault-indexer-y6YC2-mh.mjs → vault-indexer-Ddq51X20.mjs} +1 -1
- package/dist/{vault-indexer-y6YC2-mh.mjs.map → vault-indexer-Ddq51X20.mjs.map} +1 -1
- package/dist/{wakeup-CNZQZzsY.mjs → wakeup-CZw88uXf.mjs} +3 -3
- package/dist/{wakeup-CNZQZzsY.mjs.map → wakeup-CZw88uXf.mjs.map} +1 -1
- package/dist/{work-queue-worker-Dy5FT2ak.mjs → work-queue-worker-DCzfH0d1.mjs} +4 -4
- package/dist/{work-queue-worker-Dy5FT2ak.mjs.map → work-queue-worker-DCzfH0d1.mjs.map} +1 -1
- package/dist/work-queue-worker-Taba_vcA.mjs +11 -0
- package/dist/{zettelkasten-Dx-63BEk.mjs → zettelkasten-Dwj67e4p.mjs} +4 -4
- package/dist/{zettelkasten-Dx-63BEk.mjs.map → zettelkasten-Dwj67e4p.mjs.map} +1 -1
- package/docker/docker-compose.yml +39 -0
- package/docs/auto-compact.md +31 -0
- package/docs/budget-advisor.md +48 -0
- package/docs/command-reference.md +25 -0
- package/docs/commands/README.md +3 -3
- package/docs/commands/config.md +3 -3
- package/docs/commands/setup.md +9 -2
- package/docs/commands/worker.md +2 -2
- package/docs/companion-projects.md +9 -0
- package/docs/context-preservation.md +43 -0
- package/docs/how-it-works.md +25 -0
- package/docs/install-linux.md +32 -0
- package/docs/install.md +56 -0
- package/docs/memory.md +96 -0
- package/docs/observations.md +58 -0
- package/docs/release-history.md +42 -0
- package/docs/rules-and-privacy.md +37 -0
- package/docs/search.md +169 -0
- package/docs/session-management.md +153 -0
- package/docs/session-notes.md +64 -0
- package/docs/skills.md +45 -0
- package/docs/task-bus.md +1 -2
- package/docs/use-cases.md +194 -0
- package/docs/what-you-can-ask.md +78 -0
- package/docs/worker-providers.md +58 -0
- package/docs/zettelkasten.md +37 -0
- package/package.json +3 -2
- package/plugins/productivity/skills/Tasks/SKILL.md +1 -1
- package/scripts/build-hooks.mjs +6 -6
- package/src/hooks/ts/lib/pai-paths-case.test.ts +12 -0
- package/src/hooks/ts/lib/pai-paths-import.test.ts +25 -0
- package/src/hooks/ts/lib/pai-paths.ts +5 -28
- package/src/hooks/ts/lib/sleep-poll-gate.test.ts +17 -1
- package/src/hooks/ts/lib/sleep-poll-gate.ts +21 -9
- package/src/hooks/ts/pre-tool-use/security-validator.test.ts +23 -0
- package/src/hooks/ts/pre-tool-use/security-validator.ts +1 -1
- package/src/hooks/ts/session-start/load-core-context.ts +2 -6
- package/src/hooks/ts/session-start/load-project-context.ts +1 -1
- package/src/hooks/ts/session-start/session-start-worker-guard.test.ts +24 -1
- package/dist/config-2wkz744W.mjs.map +0 -1
- package/dist/context-handover-cache-BOpjLsKe.mjs.map +0 -1
- package/dist/daemon-q3xjHwa4.mjs +0 -19
- package/dist/detector-C-YmZsOi.mjs +0 -3
- package/dist/fallback-ECiqCuh6.mjs.map +0 -1
- package/dist/federation-db-BZ8PyxFe.mjs +0 -3
- package/dist/main-resolver-vN09bkXv.mjs +0 -7
- package/dist/merge-CXGz5wXz.mjs +0 -3
- package/dist/program-JhF2GgJY.mjs.map +0 -1
- package/dist/query-feedback-BPHFFSu1.mjs +0 -3
- package/dist/registry-db-Hphlj3H4.mjs +0 -3
- package/dist/router-CoA8Uy1m.mjs +0 -3
- package/dist/run-W2rV_9j0.mjs.map +0 -1
- package/dist/server-B71rem4q.mjs.map +0 -1
- package/dist/work-queue-worker-CkShUa0z.mjs +0 -11
- /package/dist/{indexer-backend-DotpxHJd.mjs → indexer-backend-isSLg6yE.mjs} +0 -0
|
@@ -3,26 +3,27 @@ import { a as slugify$1, i as parseSessionFilename } from "./migrate-BD7D8EEh.mj
|
|
|
3
3
|
import { n as ensurePaiMarker } from "./pai-marker-D1MMswkz.mjs";
|
|
4
4
|
import { t as STOP_WORDS } from "./stop-words-BdQuaE9K.mjs";
|
|
5
5
|
import { t as applyRecencyBoost } from "./search-BOSphCJ1.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import { a as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { _ as
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import { t as
|
|
6
|
+
import { n as resolveFromModule, t as packageRoot } from "./module-paths-DdRzbkUI.mjs";
|
|
7
|
+
import { a as getStorageBackend, i as getRegistryBackend, r as createStorageBackend, s as humanDuration } from "./factory-y36qGegI.mjs";
|
|
8
|
+
import { a as formatDetectionJson, i as formatDetection, n as migrateIdentityFile, r as detectProject } from "./wakeup-CZw88uXf.mjs";
|
|
9
|
+
import { B as claudeProjectsDir, C as findLatestNote, H as scanTranscriptFolders, I as resolveHome, L as saveScanConfig, M as cmdScan, N as loadScanConfig, P as migrateScanConfig, R as upsertProject, S as applyContinue, T as readBodyFile, U as transcriptFiles, V as findMovedProjects, d as migrateWorkQueue, g as migrateSummaryCooldowns, t as readContextHandoverCache, v as extractAndStoreTriples, w as findNotesDir$1, x as appendCheckpointToNote, z as upsertSession } from "./context-handover-cache-mGxq2-8f.mjs";
|
|
10
|
+
import { a as paiHomePath, i as paiHomeDir, n as migratePaiDir, o as resolvePaiFile, r as migratePaiFile, t as PaiFileMigrationError } from "./pai-home-Cm9rcJgX.mjs";
|
|
11
|
+
import { b as OWNER_LABEL_PREFIX, c as migrateConfigFile, d as readMainConfigRaw, f as writeMainConfigRaw, h as resolvedMainConfigPath, l as paiConfigFilePath, m as migrateMainConfigToYaml, n as CONFIG_FILE$2, o as expandHome, p as MainConfigError, s as loadConfig, t as CONFIG_DIR, u as paiConfigYamlFilePath, v as readJsonStrict, x as UNROUTED, y as writeJsonAtomic } from "./config-BbLFD7Uf.mjs";
|
|
12
|
+
import { a as schedulerLogPath, i as paiSocketPath, n as daemonLogPath, r as daemonPidPath } from "./runtime-paths-CHTg3ywb.mjs";
|
|
13
|
+
import { B as contextWindowFromModelId, C as nativeAnthropicProvider, E as readWorkersSection, F as parseWorkersYamlDocument, I as relocateWorkersYaml, L as workersYamlLegacyNotice, M as inlineWorkersYamlKeys, N as migrateWorkersToYaml, P as needsWorkersYamlRelocation, R as workersYamlPath, S as maskKey, V as stripModelVariant, b as isModelCapability, f as PROVIDER_TAGS, j as initWorkersYaml, m as WorkersConfigError, r as ANTHROPIC_NATIVE, t as buildRunEnv, u as MODEL_CAPABILITIES, v as expandHome$1, y as getProviderOrNative, z as DEFAULT_CONTEXT_WINDOW } from "./run-env-BHWnXqle.mjs";
|
|
14
|
+
import { $ as expandMcpNames, B as loadStatuses, C as discardWorker, D as uncommittedPaths, E as mergeWorker, G as setWorkerLabel, J as parseRunnerArgs, K as waitForTerminalStatus, L as isChatPane, Q as describeMcp, R as isLive, T as git, U as ownsPid, W as saveStatus, X as pinNotices, Z as projectLaunchConfig, a as parseWorkerReport, d as checkPaneForWorker, f as openFollowPane, h as markControlsHeld, i as usageContextTokens, j as UNLABELED, k as appendLedger, l as sayToWorker, m as clickrControlsArgv, n as runWorker, p as openPaneForWorker, q as longInlinePromptHint, r as testProvider, s as handoffFromInside, w as gcWorktrees, z as loadStatus } from "./run-uAkNItb6.mjs";
|
|
15
|
+
import { t as MergeError } from "./merge-DgU9OgZy.mjs";
|
|
16
|
+
import { n as oldFederationPath, t as federationDbPath } from "./federation-db-BTyoufBh.mjs";
|
|
17
|
+
import { r as registryDbPath, t as oldRegistryPath } from "./registry-db-C7voqML9.mjs";
|
|
18
|
+
import { i as indexProjectWithBackend } from "./async-CNn36gm4.mjs";
|
|
19
|
+
import { t as PaiClient } from "./ipc-client-D16Xw6Uo.mjs";
|
|
20
|
+
import { A as getConfigValueOp, C as setWorkersEnabled, D as useProvider, E as updateProvider, M as setConfigValueOp, N as unsetConfigValueOp, O as MainConfigOpsError, S as setProviderModel, T as unsetClass, _ as removeProvider, a as followWorkers, b as setClass, c as statusLineOutput, d as addProvider, f as classTargetText, g as modelPrefsText, h as describeProviders, i as fallbackStatusText, j as listConfigOp, k as formatConfigGetOutput, l as readSpecPrompt, m as describeModels, n as fallbackOn, o as psOutput, p as describeCapabilities, r as fallbackStatus, s as replayOutput, t as fallbackOff, u as resolveSpecPath, v as resolveProviderName, w as unsetCapabilityPreference, x as setProviderEnabled, y as setCapabilityPreference } from "./fallback-CupzGkuJ.mjs";
|
|
21
|
+
import { _ as resolveSessionByNameOrId, a as buildDeduped, c as hasConversation, d as providerResumePlan, f as restoreTopLevel, g as migrateSessionScanCache, h as fmtAge$1, l as launchInDir, m as printExitDir, o as normalizeName$2, p as resumeArgvText, s as renderDedupedSessions, t as cmdMain, u as launchPrompt, v as scanCacheFilePath, y as scanSessions } from "./main-resolver-BeYWNzrt.mjs";
|
|
22
|
+
import { n as queriesDirPath, t as migrateQueriesDir } from "./query-feedback-BIaZTTFO.mjs";
|
|
23
|
+
import { _ as statusPath, h as ledgerPath, m as eventsPath, n as ensureProxyRunning, p as ensureNoMcpConfig, r as stopProxy, t as DEFAULT_PROXY_PORT, v as workersLogDir } from "./server-DlL1QI2k.mjs";
|
|
24
|
+
import { i as sendToSession, n as fetchLiveSessions, r as revealItermSession, t as callAiBroker } from "./aibroker-client-C5Fw7DNz.mjs";
|
|
25
|
+
import { a as totalUsageTokens, i as parseSessionUsage, r as sessionKeepaliveLedgerSummary, t as loadSessionKeepaliveState } from "./session-keepalive-BWEjcRrh.mjs";
|
|
26
|
+
import { t as runChain } from "./chain-CLb6hbFS.mjs";
|
|
26
27
|
import { appendFileSync, chmodSync, closeSync, copyFileSync, cpSync, createReadStream, existsSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, statSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
|
|
27
28
|
import { homedir, platform, tmpdir, userInfo } from "node:os";
|
|
28
29
|
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
@@ -161,7 +162,7 @@ async function cmdPromote(opts) {
|
|
|
161
162
|
console.error(dim$1(` Pick a durable location for the new project.`));
|
|
162
163
|
process.exit(1);
|
|
163
164
|
}
|
|
164
|
-
const { getRegistryBackend } = await import("./factory-
|
|
165
|
+
const { getRegistryBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
165
166
|
const registryBackend = await getRegistryBackend();
|
|
166
167
|
const encodedDir = encodeDir(targetPath);
|
|
167
168
|
if (await registryBackend.getProjectBySlug(slug) ?? await registryBackend.getProjectByRootPath(targetPath) ?? await registryBackend.getProjectByEncodedDir(encodedDir)) {
|
|
@@ -2045,7 +2046,7 @@ async function cmdUnregister(slug, opts = {}) {
|
|
|
2045
2046
|
//#region src/cli/commands/project/projects-index.ts
|
|
2046
2047
|
function registerProjectsCommands(projectsCmd) {
|
|
2047
2048
|
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) => {
|
|
2048
|
-
const { cmdMain } = await import("./main-resolver-
|
|
2049
|
+
const { cmdMain } = await import("./main-resolver-kHW6FewU.mjs");
|
|
2049
2050
|
await cmdMain(void 0, void 0, opts);
|
|
2050
2051
|
});
|
|
2051
2052
|
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(async (opts) => {
|
|
@@ -2911,7 +2912,7 @@ const DEFAULT_PAGE_SIZE = 500;
|
|
|
2911
2912
|
async function runEmbed(backend, projectId, projectSlug, batchSize = 50, pageSize = DEFAULT_PAGE_SIZE) {
|
|
2912
2913
|
const label = projectSlug ? `project ${projectSlug}` : "all projects";
|
|
2913
2914
|
console.log(dim$1(`Generating embeddings for ${label} (this may take a while on first run)...`));
|
|
2914
|
-
const { generateEmbeddings, serializeEmbedding } = await import("./embeddings-
|
|
2915
|
+
const { generateEmbeddings, serializeEmbedding } = await import("./embeddings-CDfM63uC.mjs");
|
|
2915
2916
|
const { chunks: totalEstimate } = projectId !== void 0 ? await backend.getProjectStats(projectId) : await backend.getStats();
|
|
2916
2917
|
let done = 0;
|
|
2917
2918
|
let after = null;
|
|
@@ -3075,7 +3076,7 @@ function registerSearchCommand(memoryCmd) {
|
|
|
3075
3076
|
let results;
|
|
3076
3077
|
if (mode === "keyword") results = await backend.searchKeyword(query, searchOpts);
|
|
3077
3078
|
else {
|
|
3078
|
-
const { generateEmbedding } = await import("./embeddings-
|
|
3079
|
+
const { generateEmbedding } = await import("./embeddings-CDfM63uC.mjs");
|
|
3079
3080
|
console.log(dim$1("Generating query embedding..."));
|
|
3080
3081
|
const queryEmbedding = await generateEmbedding(query, true);
|
|
3081
3082
|
if (mode === "semantic") results = await backend.searchSemantic(queryEmbedding, searchOpts);
|
|
@@ -3260,9 +3261,9 @@ function registerStatsCommands(memoryCmd) {
|
|
|
3260
3261
|
//#region src/cli/commands/memory/sources-cmd.ts
|
|
3261
3262
|
function registerSourcesCommand(memoryCmd) {
|
|
3262
3263
|
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) => {
|
|
3263
|
-
const { createStorageBackend } = await import("./factory-
|
|
3264
|
-
const { loadConfig } = await import("./config-
|
|
3265
|
-
const { cmdMemorySources } = await import("./sources-
|
|
3264
|
+
const { createStorageBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
3265
|
+
const { loadConfig } = await import("./config-YinjgXEJ.mjs");
|
|
3266
|
+
const { cmdMemorySources } = await import("./sources-DX4ElmrE.mjs");
|
|
3266
3267
|
let backend;
|
|
3267
3268
|
try {
|
|
3268
3269
|
backend = await createStorageBackend(loadConfig());
|
|
@@ -3962,8 +3963,8 @@ async function escalate(task, headline, detail, state, now, opts) {
|
|
|
3962
3963
|
state.alarmedAt[task.id] = now;
|
|
3963
3964
|
let delivered = false;
|
|
3964
3965
|
try {
|
|
3965
|
-
const { routeNotification } = await import("./router-
|
|
3966
|
-
const { loadConfig } = await import("./config-
|
|
3966
|
+
const { routeNotification } = await import("./router-S6C5BxzZ.mjs");
|
|
3967
|
+
const { loadConfig } = await import("./config-YinjgXEJ.mjs");
|
|
3967
3968
|
delivered = (await routeNotification({
|
|
3968
3969
|
event: "error",
|
|
3969
3970
|
title: `PAI: ${headline}`,
|
|
@@ -3998,7 +3999,7 @@ async function escalate(task, headline, detail, state, now, opts) {
|
|
|
3998
3999
|
async function alertParked(task, reason) {
|
|
3999
4000
|
const text = `PAI parked "${task.title}" (${task.id}) — the scheduler will not retry it.\nReason: ${reason}\nTo release it: fix the cause, then move the due date — due_string, natural language only (e.g. "tomorrow 9am").`;
|
|
4000
4001
|
try {
|
|
4001
|
-
const { callAiBroker } = await import("./aibroker-client-
|
|
4002
|
+
const { callAiBroker } = await import("./aibroker-client-B8c42Lh8.mjs");
|
|
4002
4003
|
await callAiBroker("pailot_send", { text }, 8e3);
|
|
4003
4004
|
} catch (e) {
|
|
4004
4005
|
console.error(`[pai-poller] parked-task alert not delivered to PAILot (${e instanceof Error ? e.message : String(e)}): ${text}`);
|
|
@@ -5703,18 +5704,18 @@ function registerObsidianCommands(obsidianCmd) {
|
|
|
5703
5704
|
/**
|
|
5704
5705
|
* adapter-content.ts — PAI_HOME/agents and PAI_HOME/commands: the operator's
|
|
5705
5706
|
* authored Agent/Command .md content, made PAI-owned with an adapter symlink
|
|
5706
|
-
* back at ~/.claude/
|
|
5707
|
+
* back at ~/.claude/agents and ~/.claude/commands so Claude Code still loads
|
|
5707
5708
|
* them from its fixed harness paths (confirmed empirically: Claude Code
|
|
5708
5709
|
* follows a directory symlink for .claude/agents/ — see docs/workers-config.md,
|
|
5709
|
-
* "Where PAI lives"). Unlike Hooks/
|
|
5710
|
+
* "Where PAI lives"). Unlike Hooks/skills (individual files symlinked by the
|
|
5710
5711
|
* build's --sync step), these were real, un-owned files with no PAI copy to
|
|
5711
5712
|
* symlink from — this module is what gives them one.
|
|
5712
5713
|
*/
|
|
5713
5714
|
function oldAgentsDir() {
|
|
5714
|
-
return join(homedir(), ".claude", "
|
|
5715
|
+
return join(homedir(), ".claude", "agents");
|
|
5715
5716
|
}
|
|
5716
5717
|
function oldCommandsDir() {
|
|
5717
|
-
return join(homedir(), ".claude", "
|
|
5718
|
+
return join(homedir(), ".claude", "commands");
|
|
5718
5719
|
}
|
|
5719
5720
|
function migrateContentDirWithSymlink(newDir, oldDir, opts = {}) {
|
|
5720
5721
|
if (existsSync(oldDir) && lstatSync(oldDir).isSymbolicLink()) return {
|
|
@@ -5748,11 +5749,11 @@ function migrateContentDirWithSymlink(newDir, oldDir, opts = {}) {
|
|
|
5748
5749
|
};
|
|
5749
5750
|
}
|
|
5750
5751
|
}
|
|
5751
|
-
/** Move ~/.claude/
|
|
5752
|
+
/** Move ~/.claude/agents/*.md into PAI_HOME/agents/, then symlink it back. */
|
|
5752
5753
|
function migrateAgentsDir(opts = {}) {
|
|
5753
5754
|
return migrateContentDirWithSymlink(paiHomePath("agents"), oldAgentsDir(), opts);
|
|
5754
5755
|
}
|
|
5755
|
-
/** Move ~/.claude/
|
|
5756
|
+
/** Move ~/.claude/commands/*.md into PAI_HOME/commands/, then symlink it back. */
|
|
5756
5757
|
function migrateCommandsDir(opts = {}) {
|
|
5757
5758
|
return migrateContentDirWithSymlink(paiHomePath("commands"), oldCommandsDir(), opts);
|
|
5758
5759
|
}
|
|
@@ -6227,8 +6228,8 @@ function registerConfigCommands(configCmd) {
|
|
|
6227
6228
|
console.log(` scheduler-state.json: ${STATE_FILE}`);
|
|
6228
6229
|
console.log(` identity.txt: ${paiHomePath("identity.txt")} (L0 wake-up identity, optional)`);
|
|
6229
6230
|
console.log(` registry-scan.json: ${paiHomePath("registry-scan.json")}`);
|
|
6230
|
-
console.log(` agents/: ${paiHomePath("agents")} (~/.claude/
|
|
6231
|
-
console.log(` commands/: ${paiHomePath("commands")} (~/.claude/
|
|
6231
|
+
console.log(` agents/: ${paiHomePath("agents")} (~/.claude/agents symlinks here after migrate)`);
|
|
6232
|
+
console.log(` commands/: ${paiHomePath("commands")} (~/.claude/commands symlinks here after migrate)`);
|
|
6232
6233
|
});
|
|
6233
6234
|
configCmd.command("yaml").description("Convert config.json → config.yaml (and voices.json → voices.yaml), with a short\n # comment above every top-level section and any \"_comment\"/\"_...Note\" JSON-\n workaround key re-attached as a real comment. Verifies the generated YAML\n re-parses to the exact same data before writing anything; the JSON is then\n renamed to <name>.migrated-<YYYY-MM-DD> (never deleted). Every writer keeps\n working unmodified afterwards — see docs/config.md.").option("--dry-run", "Print the plan without writing anything").option("--force", "Regenerate config.yaml (or voices.yaml) even if it already exists").action((opts) => {
|
|
6234
6235
|
let hadError = false;
|
|
@@ -6289,7 +6290,7 @@ function registerConfigCommands(configCmd) {
|
|
|
6289
6290
|
process.exitCode = 1;
|
|
6290
6291
|
}
|
|
6291
6292
|
});
|
|
6292
|
-
configCmd.command("migrate").description("Move config.json, workers.yaml, whisper-rules.md, advisor-mode.json, session-state/,\nsession-scan-cache.json, queries/, summary-cooldowns.json, work-queue.json,\nkg-backfill-state.json, voices.json, the orphaned legacy federation database,\nthe legacy registry database, the legacy live federation database, ~/.pai/backups/,\n~/.pai/obsidian-vault/, ~/.pai/scheduler-state.json, and ~/.claude/
|
|
6293
|
+
configCmd.command("migrate").description("Move config.json, workers.yaml, whisper-rules.md, advisor-mode.json, session-state/,\nsession-scan-cache.json, queries/, summary-cooldowns.json, work-queue.json,\nkg-backfill-state.json, voices.json, the orphaned legacy federation database,\nthe legacy registry database, the legacy live federation database, ~/.pai/backups/,\n~/.pai/obsidian-vault/, ~/.pai/scheduler-state.json, and ~/.claude/agents/,\n~/.claude/commands/ into PAI_HOME.\nThe registry and federation databases each get an extra WAL checkpoint and PRAGMA\nintegrity_check (sqlite3 CLI, if present) on top of the byte-identical copy.\nbackups/ is copied and sha256-verified file-by-file into\nbackups/legacy-pai-backups/ rather than merged in place. agents/ and commands/ each\nget a symlink left at the old ~/.claude path once their content has moved, so\nClaude Code still finds them at its fixed harness paths.\nEach file is copied, verified byte-identical, then the old file is renamed to\n<name>.migrated-<YYYYMMDD> (never deleted); directories move their contents, then\nthe emptied old directory is renamed the same way. Idempotent — entries already at\nthe new location, or with nothing old to migrate, are skipped.").option("--dry-run", "Print the plan without writing anything").option("--logs", "Also move ~/.claude/logs/workers into PAI_HOME: an atomic rename plus a\n symlink left at the old path, so any worker still writing there\n keeps landing in the new directory (falls back to copy+verify\n across volumes, refusing while a worker is RUNNING — see\n `pai worker ps` — only in that fallback case)").option("--history", "Also move ~/.claude/History/, agent-sessions.json, session-routing.json\n and history/security/security-events.jsonl into PAI_HOME. These are\n written by hooks on EVERY session's every turn, not just spawned\n workers — refuses while any worker other than the interactive\n session is RUNNING (see `pai worker ps`), but that guard cannot see\n OTHER interactive `claude` sessions on this machine. Confirm none\n are active (`ps aux | grep claude`, `aibroker sessions list`) before\n passing this flag.").action((opts) => {
|
|
6293
6294
|
const dryRun = !!opts.dryRun;
|
|
6294
6295
|
let hadError = false;
|
|
6295
6296
|
const report = (label, fn) => {
|
|
@@ -6379,8 +6380,8 @@ function registerConfigCommands(configCmd) {
|
|
|
6379
6380
|
console.error(err(` ${label}: `) + (e instanceof Error ? e.message : String(e)));
|
|
6380
6381
|
}
|
|
6381
6382
|
};
|
|
6382
|
-
reportContentDir("
|
|
6383
|
-
reportContentDir("
|
|
6383
|
+
reportContentDir("agents/", () => migrateAgentsDir({ dryRun }));
|
|
6384
|
+
reportContentDir("commands/", () => migrateCommandsDir({ dryRun }));
|
|
6384
6385
|
if (opts.logs) try {
|
|
6385
6386
|
const { workers } = readWorkersSection();
|
|
6386
6387
|
const r = migrateWorkerLogs(expandHome$1(workers.logDir), paiHomePath("logs", "workers"), { dryRun });
|
|
@@ -6493,19 +6494,13 @@ function writeClaudeJson(data) {
|
|
|
6493
6494
|
|
|
6494
6495
|
//#endregion
|
|
6495
6496
|
//#region src/cli/commands/mcp.ts
|
|
6496
|
-
/**
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
* tsdown bundles all CLI commands into a single dist/cli/index.mjs file, so
|
|
6500
|
-
* import.meta.url always resolves to dist/cli/index.mjs at runtime.
|
|
6501
|
-
* From dist/cli/ we go up one level to dist/ and then into the entry.
|
|
6502
|
-
*/
|
|
6503
|
-
function distDir() {
|
|
6504
|
-
return join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
6497
|
+
/** Absolute path of a built entry under dist/ (chunk depth varies, so walk up — see module-paths). */
|
|
6498
|
+
function distEntry(entry) {
|
|
6499
|
+
return resolveFromModule(import.meta.url, `dist/${entry}`);
|
|
6505
6500
|
}
|
|
6506
6501
|
const SERVERS = [{
|
|
6507
6502
|
name: "pai",
|
|
6508
|
-
entry: "mcp/index.mjs",
|
|
6503
|
+
entry: "daemon-mcp/index.mjs",
|
|
6509
6504
|
label: "PAI MCP server",
|
|
6510
6505
|
tools: "memory_search, memory_get, memory_outline, project_info, project_list, session_list, registry_search"
|
|
6511
6506
|
}];
|
|
@@ -6515,7 +6510,7 @@ function cmdInstall$1() {
|
|
|
6515
6510
|
const servers = config.mcpServers;
|
|
6516
6511
|
let changed = false;
|
|
6517
6512
|
for (const spec of SERVERS) {
|
|
6518
|
-
const bin =
|
|
6513
|
+
const bin = distEntry(spec.entry);
|
|
6519
6514
|
if (spec.name in servers) {
|
|
6520
6515
|
console.log(warn$1(`${spec.label} is already registered in ~/.claude.json as "${spec.name}".`));
|
|
6521
6516
|
console.log(dim$1(` Entry: ${JSON.stringify(servers[spec.name])}`));
|
|
@@ -6556,7 +6551,7 @@ function cmdStatus$2() {
|
|
|
6556
6551
|
console.log();
|
|
6557
6552
|
let allReady = true;
|
|
6558
6553
|
for (const spec of SERVERS) {
|
|
6559
|
-
const bin =
|
|
6554
|
+
const bin = distEntry(spec.entry);
|
|
6560
6555
|
const registered = spec.name in servers;
|
|
6561
6556
|
const binExists = existsSync(bin);
|
|
6562
6557
|
if (registered) {
|
|
@@ -6587,37 +6582,21 @@ function registerMcpCommands(mcpCmd) {
|
|
|
6587
6582
|
}
|
|
6588
6583
|
|
|
6589
6584
|
//#endregion
|
|
6590
|
-
//#region src/
|
|
6591
|
-
/**
|
|
6592
|
-
* module-paths.ts — locate a file relative to the package root from a running module.
|
|
6593
|
-
*
|
|
6594
|
-
* tsdown bundles shared code into chunks emitted directly under dist/ (e.g.
|
|
6595
|
-
* dist/program-*.mjs) rather than always alongside the entry that needs them
|
|
6596
|
-
* (dist/cli/index.mjs, dist/daemon/index.mjs, ...). A fixed "../daemon/index.mjs"
|
|
6597
|
-
* relative to import.meta.url assumes one specific chunk depth and silently
|
|
6598
|
-
* resolves to the wrong file — or a file under the source tree instead of
|
|
6599
|
-
* dist — whenever the bundler's chunking changes. Walking up from the running
|
|
6600
|
-
* module's own directory until `dir/rel` exists is depth-independent, and works
|
|
6601
|
-
* whether `rel` lives under dist/ (built entries) or is a sibling of dist/ at
|
|
6602
|
-
* the package root (files excluded from the bundle, like docker/migrate-sqlite.ts).
|
|
6603
|
-
*/
|
|
6585
|
+
//#region src/service-manager.ts
|
|
6604
6586
|
/**
|
|
6605
|
-
*
|
|
6606
|
-
* returning the first `dir/rel` that exists on disk.
|
|
6587
|
+
* service-manager.ts — the one guard in front of every launchctl / systemctl call.
|
|
6607
6588
|
*
|
|
6608
|
-
*
|
|
6609
|
-
*
|
|
6589
|
+
* Unit and plist files land under $HOME, but launchctl and systemctl --user act
|
|
6590
|
+
* on the real account's session whatever HOME says. Run under a foreign HOME
|
|
6591
|
+
* (a temp dir, a test, a sandbox) they rewire the live service to that HOME's
|
|
6592
|
+
* files. So when HOME is not the account home the files are still written and
|
|
6593
|
+
* the service manager is left alone.
|
|
6610
6594
|
*/
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
const parent = dirname(dir);
|
|
6617
|
-
if (parent === dir) break;
|
|
6618
|
-
dir = parent;
|
|
6619
|
-
}
|
|
6620
|
-
throw new Error(`cannot locate "${rel}" above ${dirname(fileURLToPath(moduleUrl))} — is the project built? (bun run build)`);
|
|
6595
|
+
/** True when it is safe to call launchctl/systemctl; otherwise prints why not and how to finish by hand. */
|
|
6596
|
+
function serviceManagerAllowed(manualCommand) {
|
|
6597
|
+
if (homedir() === userInfo().homedir) return true;
|
|
6598
|
+
console.log(` service not (re)loaded because HOME is not the account home; as the real user run: ${manualCommand}`);
|
|
6599
|
+
return false;
|
|
6621
6600
|
}
|
|
6622
6601
|
|
|
6623
6602
|
//#endregion
|
|
@@ -6689,6 +6668,10 @@ const DAEMON_LOG = daemonLogPath();
|
|
|
6689
6668
|
const SYSTEMD_UNIT_NAME = "pai-daemon.service";
|
|
6690
6669
|
const SYSTEMD_USER_DIR = join(HOME$1, ".config", "systemd", "user");
|
|
6691
6670
|
const SYSTEMD_UNIT_PATH = join(SYSTEMD_USER_DIR, SYSTEMD_UNIT_NAME);
|
|
6671
|
+
/** Service name `daemon install` registers on this platform: systemd unit on Linux, launchd label elsewhere. */
|
|
6672
|
+
function daemonServiceName(plat = process.platform) {
|
|
6673
|
+
return plat === "linux" ? SYSTEMD_UNIT_NAME : PLIST_LABEL;
|
|
6674
|
+
}
|
|
6692
6675
|
/**
|
|
6693
6676
|
* Resolve the absolute path to the built daemon entry point.
|
|
6694
6677
|
* tsdown may emit this module's own chunk directly under dist/ rather than
|
|
@@ -6754,19 +6737,41 @@ Restart=on-failure
|
|
|
6754
6737
|
WantedBy=default.target
|
|
6755
6738
|
`;
|
|
6756
6739
|
}
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
"
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6740
|
+
const runLoginctl = (args) => {
|
|
6741
|
+
const r = spawnSync("loginctl", args, { encoding: "utf8" });
|
|
6742
|
+
return {
|
|
6743
|
+
status: r.status,
|
|
6744
|
+
stdout: r.stdout ?? ""
|
|
6745
|
+
};
|
|
6746
|
+
};
|
|
6747
|
+
/**
|
|
6748
|
+
* Turns on systemd linger for the user (so the user unit survives logout) without sudo
|
|
6749
|
+
* or a prompt; prints the sudo command only when the system refuses. Linux only.
|
|
6750
|
+
*/
|
|
6751
|
+
function ensureLinger(plat = process.platform, username = userInfo().username, loginctl = runLoginctl, log = console.log) {
|
|
6752
|
+
if (plat !== "linux") return;
|
|
6753
|
+
const linger = () => {
|
|
6754
|
+
const r = loginctl([
|
|
6755
|
+
"show-user",
|
|
6756
|
+
username,
|
|
6757
|
+
"-p",
|
|
6758
|
+
"Linger"
|
|
6759
|
+
]);
|
|
6760
|
+
return r.status === 0 ? r.stdout.trim() : null;
|
|
6761
|
+
};
|
|
6762
|
+
const before = linger();
|
|
6763
|
+
if (before === null || before === "Linger=yes") return;
|
|
6764
|
+
loginctl([
|
|
6765
|
+
"--no-ask-password",
|
|
6766
|
+
"enable-linger",
|
|
6767
|
+
username
|
|
6768
|
+
]);
|
|
6769
|
+
if (linger() === "Linger=yes") {
|
|
6770
|
+
log(ok$1(" linger: on (daemon survives logout)"));
|
|
6771
|
+
return;
|
|
6769
6772
|
}
|
|
6773
|
+
log(warn$1(` Linger is off for ${username} — the daemon stops when you log out.`));
|
|
6774
|
+
log(dim$1(` Enable it: sudo loginctl enable-linger ${username}`));
|
|
6770
6775
|
}
|
|
6771
6776
|
async function cmdStatus$1() {
|
|
6772
6777
|
const client = new PaiClient(loadConfig().socketPath);
|
|
@@ -6807,6 +6812,7 @@ async function cmdStatus$1() {
|
|
|
6807
6812
|
}
|
|
6808
6813
|
}
|
|
6809
6814
|
function cmdRestart() {
|
|
6815
|
+
if (!serviceManagerAllowed("pai daemon restart")) return;
|
|
6810
6816
|
if (process.platform === "linux") {
|
|
6811
6817
|
const result = spawnSync("systemctl", [
|
|
6812
6818
|
"--user",
|
|
@@ -6862,6 +6868,7 @@ function installServiceDarwin(daemonBin) {
|
|
|
6862
6868
|
process.exitCode = 1;
|
|
6863
6869
|
return false;
|
|
6864
6870
|
}
|
|
6871
|
+
if (!serviceManagerAllowed(`launchctl load ${PLIST_PATH$1}`)) return true;
|
|
6865
6872
|
try {
|
|
6866
6873
|
spawnSync("launchctl", ["unload", PLIST_PATH$1], { encoding: "utf8" });
|
|
6867
6874
|
const loadResult = spawnSync("launchctl", ["load", PLIST_PATH$1], { encoding: "utf8" });
|
|
@@ -6884,6 +6891,7 @@ function installServiceLinux(daemonBin) {
|
|
|
6884
6891
|
process.exitCode = 1;
|
|
6885
6892
|
return false;
|
|
6886
6893
|
}
|
|
6894
|
+
if (!serviceManagerAllowed(`systemctl --user daemon-reload && systemctl --user enable --now ${SYSTEMD_UNIT_NAME}`)) return true;
|
|
6887
6895
|
spawnSync("systemctl", ["--user", "daemon-reload"], { encoding: "utf8" });
|
|
6888
6896
|
const enableResult = spawnSync("systemctl", [
|
|
6889
6897
|
"--user",
|
|
@@ -6893,7 +6901,7 @@ function installServiceLinux(daemonBin) {
|
|
|
6893
6901
|
], { encoding: "utf8" });
|
|
6894
6902
|
if (enableResult.status === 0) console.log(ok$1(" Enabled and started via systemd."));
|
|
6895
6903
|
else console.log(warn$1(` systemctl enable --now: ${(enableResult.stderr || "").trim()}`));
|
|
6896
|
-
|
|
6904
|
+
ensureLinger();
|
|
6897
6905
|
return true;
|
|
6898
6906
|
}
|
|
6899
6907
|
function cmdInstall() {
|
|
@@ -6949,7 +6957,7 @@ function cmdInstall() {
|
|
|
6949
6957
|
}
|
|
6950
6958
|
function uninstallServiceDarwin() {
|
|
6951
6959
|
if (existsSync(PLIST_PATH$1)) {
|
|
6952
|
-
try {
|
|
6960
|
+
if (serviceManagerAllowed(`launchctl unload ${PLIST_PATH$1}`)) try {
|
|
6953
6961
|
spawnSync("launchctl", ["unload", PLIST_PATH$1], { encoding: "utf8" });
|
|
6954
6962
|
console.log(ok$1(" Unloaded launchd plist."));
|
|
6955
6963
|
} catch {
|
|
@@ -6965,20 +6973,23 @@ function uninstallServiceDarwin() {
|
|
|
6965
6973
|
}
|
|
6966
6974
|
function uninstallServiceLinux() {
|
|
6967
6975
|
if (existsSync(SYSTEMD_UNIT_PATH)) {
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
"
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6976
|
+
const managed = serviceManagerAllowed(`systemctl --user disable --now ${SYSTEMD_UNIT_NAME}`);
|
|
6977
|
+
if (managed) {
|
|
6978
|
+
spawnSync("systemctl", [
|
|
6979
|
+
"--user",
|
|
6980
|
+
"disable",
|
|
6981
|
+
"--now",
|
|
6982
|
+
SYSTEMD_UNIT_NAME
|
|
6983
|
+
], { encoding: "utf8" });
|
|
6984
|
+
console.log(ok$1(" Disabled and stopped via systemd."));
|
|
6985
|
+
}
|
|
6975
6986
|
try {
|
|
6976
6987
|
unlinkSync(SYSTEMD_UNIT_PATH);
|
|
6977
6988
|
console.log(ok$1(` Removed unit: ${SYSTEMD_UNIT_PATH}`));
|
|
6978
6989
|
} catch (e) {
|
|
6979
6990
|
console.log(warn$1(` Could not remove unit: ${e}`));
|
|
6980
6991
|
}
|
|
6981
|
-
spawnSync("systemctl", ["--user", "daemon-reload"], { encoding: "utf8" });
|
|
6992
|
+
if (managed) spawnSync("systemctl", ["--user", "daemon-reload"], { encoding: "utf8" });
|
|
6982
6993
|
} else console.log(dim$1(" No systemd unit found."));
|
|
6983
6994
|
}
|
|
6984
6995
|
function cmdUninstall() {
|
|
@@ -7086,8 +7097,8 @@ function cmdLogs(opts) {
|
|
|
7086
7097
|
}
|
|
7087
7098
|
function registerDaemonCommands(daemonCmd) {
|
|
7088
7099
|
daemonCmd.command("serve").description("Start the PAI daemon in the foreground").action(async () => {
|
|
7089
|
-
const { serve } = await import("./daemon-
|
|
7090
|
-
const { loadConfig: lc, ensureConfigDir } = await import("./config-
|
|
7100
|
+
const { serve } = await import("./daemon-BjaPR39W.mjs");
|
|
7101
|
+
const { loadConfig: lc, ensureConfigDir } = await import("./config-YinjgXEJ.mjs");
|
|
7091
7102
|
ensureConfigDir();
|
|
7092
7103
|
await serve(lc());
|
|
7093
7104
|
});
|
|
@@ -7433,7 +7444,19 @@ function createRl() {
|
|
|
7433
7444
|
});
|
|
7434
7445
|
return rl;
|
|
7435
7446
|
}
|
|
7436
|
-
|
|
7447
|
+
/** Unattended-mode switches (`pai setup --yes --storage …`), set once by the command. */
|
|
7448
|
+
const setupOptions = { yes: false };
|
|
7449
|
+
/**
|
|
7450
|
+
* The one place every wizard question passes through. Under --yes it answers
|
|
7451
|
+
* `defaultValue` without touching stdin; a question with no default cannot be
|
|
7452
|
+
* answered unattended, so it fails naming the flag instead of returning "".
|
|
7453
|
+
*/
|
|
7454
|
+
async function prompt$1(rl, question, defaultValue) {
|
|
7455
|
+
if (setupOptions.yes) {
|
|
7456
|
+
if (defaultValue === void 0) throw new Error(`"${question.trim()}" has no default; cannot answer it with --yes. Run without --yes, or skip the feature that asks it.`);
|
|
7457
|
+
console.log(chalk.dim(` ${question.trim()} -> ${defaultValue || "(default)"}`));
|
|
7458
|
+
return defaultValue;
|
|
7459
|
+
}
|
|
7437
7460
|
return new Promise((resolve) => {
|
|
7438
7461
|
rl.question(question, (answer) => {
|
|
7439
7462
|
resolve(answer.trim());
|
|
@@ -7451,7 +7474,7 @@ async function promptMenu(rl, options, defaultIdx = 0) {
|
|
|
7451
7474
|
}
|
|
7452
7475
|
line$1();
|
|
7453
7476
|
while (true) {
|
|
7454
|
-
const answer = await prompt$1(rl, chalk.bold(` Enter number [1-${options.length}] (default: ${defaultIdx + 1}): `));
|
|
7477
|
+
const answer = await prompt$1(rl, chalk.bold(` Enter number [1-${options.length}] (default: ${defaultIdx + 1}): `), "");
|
|
7455
7478
|
if (answer === "") return defaultIdx;
|
|
7456
7479
|
const n = parseInt(answer, 10);
|
|
7457
7480
|
if (!isNaN(n) && n >= 1 && n <= options.length) return n - 1;
|
|
@@ -7461,7 +7484,7 @@ async function promptMenu(rl, options, defaultIdx = 0) {
|
|
|
7461
7484
|
/** Prompt for a yes/no answer. Returns true for yes. */
|
|
7462
7485
|
async function promptYesNo(rl, question, defaultYes = true) {
|
|
7463
7486
|
const hint = defaultYes ? "[Y/n]" : "[y/N]";
|
|
7464
|
-
const answer = await prompt$1(rl, ` ${question} ${chalk.dim(hint)}:
|
|
7487
|
+
const answer = await prompt$1(rl, ` ${question} ${chalk.dim(hint)}: `, "");
|
|
7465
7488
|
if (answer === "") return defaultYes;
|
|
7466
7489
|
return answer.toLowerCase().startsWith("y");
|
|
7467
7490
|
}
|
|
@@ -7498,13 +7521,7 @@ function hasDocker() {
|
|
|
7498
7521
|
}
|
|
7499
7522
|
}
|
|
7500
7523
|
function getDockerDir() {
|
|
7501
|
-
|
|
7502
|
-
join(process.cwd(), "docker"),
|
|
7503
|
-
join(homedir(), "dev", "ai", "PAI", "docker"),
|
|
7504
|
-
join("/", "usr", "local", "lib", "node_modules", "@tekmidian", "pai", "docker")
|
|
7505
|
-
];
|
|
7506
|
-
for (const candidate of candidates) if (existsSync(join(candidate, "docker-compose.yml"))) return candidate;
|
|
7507
|
-
return join(process.cwd(), "docker");
|
|
7524
|
+
return join(packageRoot(import.meta.url), "docker");
|
|
7508
7525
|
}
|
|
7509
7526
|
async function testPostgresConnection(connectionString) {
|
|
7510
7527
|
try {
|
|
@@ -7518,64 +7535,24 @@ async function testPostgresConnection(connectionString) {
|
|
|
7518
7535
|
}
|
|
7519
7536
|
}
|
|
7520
7537
|
function getTemplatesDir$1() {
|
|
7521
|
-
|
|
7522
|
-
join(process.cwd(), "templates"),
|
|
7523
|
-
join(homedir(), "dev", "ai", "PAI", "templates"),
|
|
7524
|
-
join("/", "usr", "local", "lib", "node_modules", "@tekmidian", "pai", "templates")
|
|
7525
|
-
];
|
|
7526
|
-
for (const candidate of candidates) if (existsSync(join(candidate, "claude-md.template.md"))) return candidate;
|
|
7527
|
-
return join(process.cwd(), "templates");
|
|
7538
|
+
return join(packageRoot(import.meta.url), "templates");
|
|
7528
7539
|
}
|
|
7529
7540
|
function getHooksDir() {
|
|
7530
|
-
|
|
7531
|
-
join(process.cwd(), "src", "hooks"),
|
|
7532
|
-
join(homedir(), "dev", "ai", "PAI", "src", "hooks"),
|
|
7533
|
-
join("/", "usr", "local", "lib", "node_modules", "@tekmidian", "pai", "src", "hooks")
|
|
7534
|
-
];
|
|
7535
|
-
for (const candidate of candidates) if (existsSync(join(candidate, "session-stop.sh"))) return candidate;
|
|
7536
|
-
return join(process.cwd(), "src", "hooks");
|
|
7541
|
+
return join(packageRoot(import.meta.url), "src", "hooks");
|
|
7537
7542
|
}
|
|
7538
7543
|
function getDistHooksDir() {
|
|
7539
|
-
|
|
7540
|
-
const fromModule = join(moduleDir, "..", "..", "hooks");
|
|
7541
|
-
const candidates = [
|
|
7542
|
-
fromModule,
|
|
7543
|
-
join(process.cwd(), "dist", "hooks"),
|
|
7544
|
-
join(homedir(), "dev", "ai", "PAI", "dist", "hooks"),
|
|
7545
|
-
join("/", "usr", "local", "lib", "node_modules", "@tekmidian", "pai", "dist", "hooks")
|
|
7546
|
-
];
|
|
7547
|
-
for (const candidate of candidates) if (existsSync(join(candidate, "stop-hook.mjs"))) return candidate;
|
|
7548
|
-
return fromModule;
|
|
7544
|
+
return join(getDistDir(), "hooks");
|
|
7549
7545
|
}
|
|
7550
7546
|
function getDistDir() {
|
|
7551
|
-
|
|
7552
|
-
const fromModule = join(moduleDir, "..", "..", "..");
|
|
7553
|
-
const candidates = [
|
|
7554
|
-
fromModule,
|
|
7555
|
-
join(process.cwd(), "dist"),
|
|
7556
|
-
join(homedir(), "dev", "ai", "PAI", "dist"),
|
|
7557
|
-
join("/", "usr", "local", "lib", "node_modules", "@tekmidian", "pai", "dist")
|
|
7558
|
-
];
|
|
7559
|
-
for (const candidate of candidates) if (existsSync(join(candidate, "skills"))) return candidate;
|
|
7560
|
-
return fromModule;
|
|
7547
|
+
return join(packageRoot(import.meta.url), "dist");
|
|
7561
7548
|
}
|
|
7562
7549
|
function getStatuslineScript() {
|
|
7563
|
-
const
|
|
7564
|
-
|
|
7565
|
-
join(homedir(), "dev", "ai", "PAI", "statusline-command.sh"),
|
|
7566
|
-
join("/", "usr", "local", "lib", "node_modules", "@tekmidian", "pai", "statusline-command.sh")
|
|
7567
|
-
];
|
|
7568
|
-
for (const candidate of candidates) if (existsSync(candidate)) return candidate;
|
|
7569
|
-
return null;
|
|
7550
|
+
const p = join(packageRoot(import.meta.url), "statusline-command.sh");
|
|
7551
|
+
return existsSync(p) ? p : null;
|
|
7570
7552
|
}
|
|
7571
7553
|
function getTabColorScript() {
|
|
7572
|
-
const
|
|
7573
|
-
|
|
7574
|
-
join(homedir(), "dev", "ai", "PAI", "tab-color-command.sh"),
|
|
7575
|
-
join("/", "usr", "local", "lib", "node_modules", "@tekmidian", "pai", "tab-color-command.sh")
|
|
7576
|
-
];
|
|
7577
|
-
for (const candidate of candidates) if (existsSync(candidate)) return candidate;
|
|
7578
|
-
return null;
|
|
7554
|
+
const p = join(packageRoot(import.meta.url), "tab-color-command.sh");
|
|
7555
|
+
return existsSync(p) ? p : null;
|
|
7579
7556
|
}
|
|
7580
7557
|
|
|
7581
7558
|
//#endregion
|
|
@@ -7661,13 +7638,14 @@ async function stepStorage(rl) {
|
|
|
7661
7638
|
line$1();
|
|
7662
7639
|
line$1(" Choose how PAI stores your indexed knowledge:");
|
|
7663
7640
|
line$1();
|
|
7664
|
-
|
|
7641
|
+
const forced = setupOptions.storage ?? (setupOptions.yes ? await testPostgresConnection("postgresql://pai:pai@localhost:5432/pai") ? "postgres" : "sqlite" : void 0);
|
|
7642
|
+
if ((forced ? forced === "sqlite" ? 1 : 0 : await promptMenu(rl, [{
|
|
7665
7643
|
label: "PostgreSQL with pgvector",
|
|
7666
7644
|
description: "Best for large collections, semantic search, and production use. Requires Docker or a Postgres server."
|
|
7667
7645
|
}, {
|
|
7668
7646
|
label: "SQLite",
|
|
7669
7647
|
description: "Simple, no dependencies, zero configuration. Good for trying PAI out. Keyword search only."
|
|
7670
|
-
}]) === 1) {
|
|
7648
|
+
}])) === 1) {
|
|
7671
7649
|
line$1();
|
|
7672
7650
|
console.log(c.ok("SQLite selected. No additional setup needed."));
|
|
7673
7651
|
return { storageBackend: "sqlite" };
|
|
@@ -7701,7 +7679,7 @@ async function stepStorage(rl) {
|
|
|
7701
7679
|
line$1(" Enter your PostgreSQL connection details:");
|
|
7702
7680
|
line$1();
|
|
7703
7681
|
if (await promptYesNo(rl, "Use a full connection string? (e.g. postgresql://user:pass@host:5432/dbname)", true)) {
|
|
7704
|
-
const connStr = await prompt$1(rl, chalk.bold(" Connection string: "));
|
|
7682
|
+
const connStr = await prompt$1(rl, chalk.bold(" Connection string: "), "");
|
|
7705
7683
|
if (connStr) {
|
|
7706
7684
|
console.log(c.dim(" Testing connection..."));
|
|
7707
7685
|
if (await testPostgresConnection(connStr)) console.log(c.ok("Connection successful!"));
|
|
@@ -7712,10 +7690,10 @@ async function stepStorage(rl) {
|
|
|
7712
7690
|
};
|
|
7713
7691
|
}
|
|
7714
7692
|
}
|
|
7715
|
-
const host = await prompt$1(rl, chalk.bold(" Host [localhost]: ")) || "localhost";
|
|
7716
|
-
const portStr = await prompt$1(rl, chalk.bold(" Port [5432]: ")) || "5432";
|
|
7717
|
-
const database = await prompt$1(rl, chalk.bold(" Database [pai]: ")) || "pai";
|
|
7718
|
-
const connStr = `postgresql://${await prompt$1(rl, chalk.bold(" User [pai]: ")) || "pai"}:${await prompt$1(rl, chalk.bold(" Password [pai]: ")) || "pai"}@${host}:${portStr}/${database}`;
|
|
7693
|
+
const host = await prompt$1(rl, chalk.bold(" Host [localhost]: "), "") || "localhost";
|
|
7694
|
+
const portStr = await prompt$1(rl, chalk.bold(" Port [5432]: "), "") || "5432";
|
|
7695
|
+
const database = await prompt$1(rl, chalk.bold(" Database [pai]: "), "") || "pai";
|
|
7696
|
+
const connStr = `postgresql://${await prompt$1(rl, chalk.bold(" User [pai]: "), "") || "pai"}:${await prompt$1(rl, chalk.bold(" Password [pai]: "), "") || "pai"}@${host}:${portStr}/${database}`;
|
|
7719
7697
|
console.log(c.dim(` Connection string: ${connStr}`));
|
|
7720
7698
|
console.log(c.dim(" Testing connection..."));
|
|
7721
7699
|
if (await testPostgresConnection(connStr)) console.log(c.ok("Connection successful!"));
|
|
@@ -8072,7 +8050,8 @@ async function stepHooks(rl) {
|
|
|
8072
8050
|
installLink(join(hooksDir, "session-autosave.sh"), join(hooksTarget, "pai-session-autosave.sh"), "pai-session-autosave.sh");
|
|
8073
8051
|
if (statuslineSrc) installLink(statuslineSrc, join(claudeDir, "statusline-command.sh"), "statusline-command.sh");
|
|
8074
8052
|
else console.log(c.warn(" statusline-command.sh not found — skipping statusline."));
|
|
8075
|
-
if (
|
|
8053
|
+
if (platform() !== "darwin") console.log(c.dim(" Skipping tab-color-command.sh (iTerm2 only)."));
|
|
8054
|
+
else if (tabColorSrc) installLink(tabColorSrc, join(claudeDir, "tab-color-command.sh"), "tab-color-command.sh");
|
|
8076
8055
|
else console.log(c.warn(" tab-color-command.sh not found — skipping tab color."));
|
|
8077
8056
|
return anyInstalled;
|
|
8078
8057
|
}
|
|
@@ -8356,7 +8335,7 @@ async function stepDaName(rl) {
|
|
|
8356
8335
|
line$1(" Choose a name for your AI assistant. This name appears in tab titles");
|
|
8357
8336
|
line$1(" and session notes when hooks are active.");
|
|
8358
8337
|
line$1();
|
|
8359
|
-
const daName = await prompt$1(rl, chalk.bold(" Assistant name [PAI]: ")) || "PAI";
|
|
8338
|
+
const daName = await prompt$1(rl, chalk.bold(" Assistant name [PAI]: "), "") || "PAI";
|
|
8360
8339
|
line$1();
|
|
8361
8340
|
console.log(c.ok(`Assistant name set to: ${daName}`));
|
|
8362
8341
|
return daName;
|
|
@@ -8536,16 +8515,23 @@ async function stepSettings(rl, daName) {
|
|
|
8536
8515
|
|
|
8537
8516
|
//#endregion
|
|
8538
8517
|
//#region src/cli/commands/setup/steps/11-daemon.ts
|
|
8539
|
-
/** Step 9: PAI daemon installation
|
|
8518
|
+
/** Step 9: PAI daemon installation (launchd plist on macOS, systemd user unit on Linux). */
|
|
8540
8519
|
async function stepDaemon(rl) {
|
|
8541
8520
|
section("Step 9: Daemon Install");
|
|
8542
8521
|
line$1();
|
|
8543
8522
|
line$1(" The PAI daemon indexes your projects every 5 minutes in the background.");
|
|
8544
8523
|
line$1();
|
|
8545
|
-
|
|
8546
|
-
|
|
8524
|
+
const linux = platform() === "linux";
|
|
8525
|
+
if (linux && !existsSync("/run/systemd/system")) {
|
|
8526
|
+
console.log(c.dim(" systemd is not running here (container?). Skipping service install; start the daemon with: pai daemon serve"));
|
|
8527
|
+
return false;
|
|
8528
|
+
}
|
|
8529
|
+
const plistPath = linux ? join(homedir(), ".config", "systemd", "user", "pai-daemon.service") : join(homedir(), "Library", "LaunchAgents", "com.pai.pai-daemon.plist");
|
|
8530
|
+
const unit = linux ? "systemd user unit" : "launchd plist";
|
|
8531
|
+
if (existsSync(plistPath)) {
|
|
8532
|
+
console.log(c.dim(` PAI daemon ${unit} already installed.`));
|
|
8547
8533
|
line$1();
|
|
8548
|
-
if (!await promptYesNo(rl,
|
|
8534
|
+
if (!await promptYesNo(rl, `Reinstall the PAI daemon ${unit}?`, false)) {
|
|
8549
8535
|
console.log(c.dim(" Keeping existing daemon installation."));
|
|
8550
8536
|
return false;
|
|
8551
8537
|
}
|
|
@@ -8558,7 +8544,7 @@ async function stepDaemon(rl) {
|
|
|
8558
8544
|
console.log(c.warn(" Daemon install failed. Run manually: pai daemon install"));
|
|
8559
8545
|
return false;
|
|
8560
8546
|
}
|
|
8561
|
-
console.log(c.ok(
|
|
8547
|
+
console.log(c.ok(`Daemon installed as ${daemonServiceName()}.`));
|
|
8562
8548
|
return true;
|
|
8563
8549
|
}
|
|
8564
8550
|
|
|
@@ -8674,7 +8660,7 @@ async function stepInitialIndex(rl) {
|
|
|
8674
8660
|
//#endregion
|
|
8675
8661
|
//#region src/cli/commands/setup/steps/15-verify.ts
|
|
8676
8662
|
/** Step 13: Setup summary — displays all configuration choices made during setup. */
|
|
8677
|
-
function stepSummary(configUpdates, claudeMdGenerated, paiSkillInstalled, aiSteeringRulesInstalled, skillStubsInstalled, hooksInstalled, tsHooksInstalled, settingsPatched, daName, daemonInstalled, mcpRegistered) {
|
|
8663
|
+
function stepSummary(configUpdates, claudeMdGenerated, paiSkillInstalled, aiSteeringRulesInstalled, skillStubsInstalled, hooksInstalled, tsHooksInstalled, settingsPatched, daName, daemonInstalled, mcpRegistered, plat = process.platform) {
|
|
8678
8664
|
section("Setup Complete");
|
|
8679
8665
|
line$1();
|
|
8680
8666
|
console.log(chalk.green(" PAI Knowledge OS is configured!"));
|
|
@@ -8693,7 +8679,7 @@ function stepSummary(configUpdates, claudeMdGenerated, paiSkillInstalled, aiStee
|
|
|
8693
8679
|
console.log(chalk.dim(" Hooks (TS): ") + chalk.cyan(tsHooksInstalled ? "14 .mjs hooks installed to ~/.claude/Hooks/" : "(unchanged)"));
|
|
8694
8680
|
console.log(chalk.dim(" Assistant name: ") + chalk.cyan(daName));
|
|
8695
8681
|
console.log(chalk.dim(" Settings: ") + chalk.cyan(settingsPatched ? "env vars, hooks, permissions, flags (patched)" : "(unchanged)"));
|
|
8696
|
-
console.log(chalk.dim(" Daemon: ") + chalk.cyan(daemonInstalled ?
|
|
8682
|
+
console.log(chalk.dim(" Daemon: ") + chalk.cyan(daemonInstalled ? `${daemonServiceName(plat)} (installed)` : "(not installed by setup)"));
|
|
8697
8683
|
console.log(chalk.dim(" MCP: ") + chalk.cyan(mcpRegistered ? "registered in ~/.claude.json" : "(unchanged)"));
|
|
8698
8684
|
line$1();
|
|
8699
8685
|
console.log(chalk.bold.yellow(" → RESTART Claude Code to activate all changes."));
|
|
@@ -8739,7 +8725,7 @@ function stepSummary(configUpdates, claudeMdGenerated, paiSkillInstalled, aiStee
|
|
|
8739
8725
|
* Label wins because labels survive a task being moved between containers, and
|
|
8740
8726
|
* because a task parked in the findings inbox has no meaningful container yet.
|
|
8741
8727
|
*
|
|
8742
|
-
* See
|
|
8728
|
+
* See docs/task-bus.md.
|
|
8743
8729
|
*/
|
|
8744
8730
|
/**
|
|
8745
8731
|
* Fold a tracker-supplied string onto its comparable form.
|
|
@@ -9565,7 +9551,9 @@ function installShims(lines) {
|
|
|
9565
9551
|
lines.push(`${name}: shim already current`);
|
|
9566
9552
|
continue;
|
|
9567
9553
|
}
|
|
9568
|
-
|
|
9554
|
+
const body = shim(name, pai);
|
|
9555
|
+
mkdirSync(LOCAL_BIN, { recursive: true });
|
|
9556
|
+
writeFileSync(path, body, {
|
|
9569
9557
|
encoding: "utf8",
|
|
9570
9558
|
mode: 493
|
|
9571
9559
|
});
|
|
@@ -9610,46 +9598,42 @@ async function stepWorkers(rl) {
|
|
|
9610
9598
|
return { workers: current };
|
|
9611
9599
|
}
|
|
9612
9600
|
line$1();
|
|
9613
|
-
line$1(" PAI can run every subagent (worker) on a provider
|
|
9614
|
-
line$1("
|
|
9601
|
+
line$1(" PAI can run every subagent (worker) on a provider: the built-in");
|
|
9602
|
+
line$1(" `anthropic` one (your logged-in claude CLI, Max plan, no API key) or any");
|
|
9603
|
+
line$1(" Anthropic-compatible endpoint you add later.");
|
|
9615
9604
|
line$1();
|
|
9616
9605
|
line$1(" `pai worker run` is the runner; ps / follow / replay watch the runs;");
|
|
9617
|
-
line$1(" the Agent tool is denied and rewritten to it
|
|
9606
|
+
line$1(" the Agent tool is denied and rewritten to it while workers are on.");
|
|
9618
9607
|
line$1();
|
|
9619
|
-
|
|
9620
|
-
line$1();
|
|
9621
|
-
if (!await promptYesNo(rl, "Configure a worker provider now?", false)) {
|
|
9608
|
+
if (!await promptYesNo(rl, "Turn workers on now with the built-in anthropic provider?", true)) {
|
|
9622
9609
|
line$1();
|
|
9623
|
-
console.log(c.ok("Skipping
|
|
9624
|
-
console.log(c.dim("
|
|
9610
|
+
console.log(c.ok("Skipping workers."));
|
|
9611
|
+
console.log(c.dim(" Later: pai worker on (other providers: pai worker providers add <name> … — see docs/worker.md)"));
|
|
9625
9612
|
return { workers: {
|
|
9626
9613
|
enabled: false,
|
|
9627
9614
|
providers: {},
|
|
9628
9615
|
classes: {}
|
|
9629
9616
|
} };
|
|
9630
9617
|
}
|
|
9631
|
-
|
|
9632
|
-
line$1(" Add the provider after setup finishes (this step only prepares the");
|
|
9633
|
-
line$1(" wiring — shims, hook registration, log dir):");
|
|
9634
|
-
line$1();
|
|
9635
|
-
line$1(c.dim(" pai worker providers add glm \\"));
|
|
9636
|
-
line$1(c.dim(" --base-url https://api.example.com/api/anthropic \\"));
|
|
9637
|
-
line$1(c.dim(" --key-file ~/.config/example/api_key \\"));
|
|
9638
|
-
line$1(c.dim(" --model example-4.7 --fast-model example-4.7-flash"));
|
|
9639
|
-
line$1();
|
|
9640
|
-
line$1(" The first provider turns workers on and seeds the classes.");
|
|
9641
|
-
line$1();
|
|
9618
|
+
setWorkersEnabled(true);
|
|
9642
9619
|
const r = installWorkers();
|
|
9643
9620
|
for (const l of r.lines) line$1(` ${l}`);
|
|
9644
|
-
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
|
|
9648
|
-
} };
|
|
9621
|
+
const { workers } = readWorkersSection();
|
|
9622
|
+
console.log(c.ok("Workers on — provider: anthropic (built-in, no API key written)."));
|
|
9623
|
+
for (const l of describeProviders(workers)) line$1(c.dim(` ${l}`));
|
|
9624
|
+
return {};
|
|
9649
9625
|
}
|
|
9650
9626
|
|
|
9651
9627
|
//#endregion
|
|
9652
9628
|
//#region src/cli/commands/setup/index.ts
|
|
9629
|
+
/** Runs one wizard step; a throw is re-raised naming the step so unattended runs say where they died. */
|
|
9630
|
+
async function step$1(name, fn) {
|
|
9631
|
+
try {
|
|
9632
|
+
return await fn();
|
|
9633
|
+
} catch (e) {
|
|
9634
|
+
throw new Error(`setup step "${name}" failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
9635
|
+
}
|
|
9636
|
+
}
|
|
9653
9637
|
async function runSetup() {
|
|
9654
9638
|
const rl = createRl();
|
|
9655
9639
|
try {
|
|
@@ -9669,22 +9653,22 @@ async function runSetup() {
|
|
|
9669
9653
|
}
|
|
9670
9654
|
stepWelcome();
|
|
9671
9655
|
line$1();
|
|
9672
|
-
await prompt$1(rl, chalk.dim(" Press Enter to begin setup..."));
|
|
9673
|
-
const storageConfig = await stepStorage(rl);
|
|
9674
|
-
const embeddingConfig = await stepEmbedding(rl);
|
|
9675
|
-
const claudeMdGenerated = await stepClaudeMd(rl);
|
|
9676
|
-
const paiSkillInstalled = await stepPaiSkill(rl);
|
|
9677
|
-
const aiSteeringRulesInstalled = await stepAiSteeringRules(rl);
|
|
9678
|
-
const skillStubsInstalled = await stepSkillStubs(rl);
|
|
9679
|
-
const hooksInstalled = await stepHooks(rl);
|
|
9680
|
-
const tsHooksInstalled = await stepTsHooks(rl);
|
|
9681
|
-
const daName = await stepDaName(rl);
|
|
9682
|
-
const settingsPatched = await stepSettings(rl, daName);
|
|
9683
|
-
const daemonInstalled = await stepDaemon(rl);
|
|
9684
|
-
const mcpRegistered = await stepMcp(rl);
|
|
9685
|
-
await stepDirectories(rl);
|
|
9686
|
-
const taskConfig = await stepTaskBus(rl);
|
|
9687
|
-
const workersConfig = await stepWorkers(rl);
|
|
9656
|
+
await prompt$1(rl, chalk.dim(" Press Enter to begin setup..."), "");
|
|
9657
|
+
const storageConfig = await step$1("stepStorage", () => stepStorage(rl));
|
|
9658
|
+
const embeddingConfig = await step$1("stepEmbedding", () => stepEmbedding(rl));
|
|
9659
|
+
const claudeMdGenerated = await step$1("stepClaudeMd", () => stepClaudeMd(rl));
|
|
9660
|
+
const paiSkillInstalled = await step$1("stepPaiSkill", () => stepPaiSkill(rl));
|
|
9661
|
+
const aiSteeringRulesInstalled = await step$1("stepAiSteeringRules", () => stepAiSteeringRules(rl));
|
|
9662
|
+
const skillStubsInstalled = await step$1("stepSkillStubs", () => stepSkillStubs(rl));
|
|
9663
|
+
const hooksInstalled = await step$1("stepHooks", () => stepHooks(rl));
|
|
9664
|
+
const tsHooksInstalled = await step$1("stepTsHooks", () => stepTsHooks(rl));
|
|
9665
|
+
const daName = await step$1("stepDaName", () => stepDaName(rl));
|
|
9666
|
+
const settingsPatched = await step$1("stepSettings", () => stepSettings(rl, daName));
|
|
9667
|
+
const daemonInstalled = await step$1("stepDaemon", () => stepDaemon(rl));
|
|
9668
|
+
const mcpRegistered = await step$1("stepMcp", () => stepMcp(rl));
|
|
9669
|
+
await step$1("stepDirectories", () => stepDirectories(rl));
|
|
9670
|
+
const taskConfig = await step$1("stepTaskBus", () => stepTaskBus(rl));
|
|
9671
|
+
const workersConfig = await step$1("stepWorkers", () => stepWorkers(rl));
|
|
9688
9672
|
const allUpdates = {
|
|
9689
9673
|
...storageConfig,
|
|
9690
9674
|
...embeddingConfig,
|
|
@@ -9694,15 +9678,27 @@ async function runSetup() {
|
|
|
9694
9678
|
mergeConfig(allUpdates);
|
|
9695
9679
|
line$1();
|
|
9696
9680
|
console.log(chalk.green(" Configuration saved."));
|
|
9697
|
-
await stepInitialIndex(rl);
|
|
9681
|
+
await step$1("stepInitialIndex", () => stepInitialIndex(rl));
|
|
9698
9682
|
stepSummary(allUpdates, claudeMdGenerated, paiSkillInstalled, aiSteeringRulesInstalled, skillStubsInstalled, hooksInstalled, tsHooksInstalled, settingsPatched, daName, daemonInstalled, mcpRegistered);
|
|
9699
9683
|
} finally {
|
|
9700
9684
|
rl.close();
|
|
9701
9685
|
}
|
|
9702
9686
|
}
|
|
9703
9687
|
function registerSetupCommand(program) {
|
|
9704
|
-
program.command("setup").alias("install").description("
|
|
9705
|
-
|
|
9688
|
+
program.command("setup").alias("install").description("Setup wizard — configure storage, embeddings, agent config, and indexing (--yes for unattended)").option("-y, --yes", "Unattended: take every default, read no input").option("--storage <backend>", "Storage backend: sqlite | postgres (default under --yes: sqlite unless local Postgres answers)").action(async (opts) => {
|
|
9689
|
+
if (opts.storage && opts.storage !== "sqlite" && opts.storage !== "postgres") {
|
|
9690
|
+
console.error(`pai setup: --storage must be sqlite or postgres, got "${opts.storage}"`);
|
|
9691
|
+
process.exitCode = 1;
|
|
9692
|
+
return;
|
|
9693
|
+
}
|
|
9694
|
+
setupOptions.yes = opts.yes === true;
|
|
9695
|
+
setupOptions.storage = opts.storage;
|
|
9696
|
+
try {
|
|
9697
|
+
await runSetup();
|
|
9698
|
+
} catch (e) {
|
|
9699
|
+
console.error(chalk.red(`pai setup: ${e instanceof Error ? e.message : String(e)}`));
|
|
9700
|
+
process.exitCode = 1;
|
|
9701
|
+
}
|
|
9706
9702
|
});
|
|
9707
9703
|
}
|
|
9708
9704
|
|
|
@@ -9728,7 +9724,7 @@ async function cmdExplore(note, opts) {
|
|
|
9728
9724
|
const depth = parseInt(opts.depth ?? "3", 10);
|
|
9729
9725
|
const direction = opts.direction ?? "both";
|
|
9730
9726
|
const mode = opts.mode ?? "all";
|
|
9731
|
-
const { zettelExplore } = await import("./zettelkasten-
|
|
9727
|
+
const { zettelExplore } = await import("./zettelkasten-Dwj67e4p.mjs");
|
|
9732
9728
|
const result = await zettelExplore(await getFedBackend(), {
|
|
9733
9729
|
startNote: note,
|
|
9734
9730
|
depth,
|
|
@@ -9793,7 +9789,7 @@ async function cmdHealth(opts) {
|
|
|
9793
9789
|
const projectPath = opts.project;
|
|
9794
9790
|
const recentDays = parseInt(opts.days ?? "30", 10);
|
|
9795
9791
|
const includeTypes = opts.include ? opts.include.split(",").map((s) => s.trim()) : void 0;
|
|
9796
|
-
const { zettelHealth } = await import("./zettelkasten-
|
|
9792
|
+
const { zettelHealth } = await import("./zettelkasten-Dwj67e4p.mjs");
|
|
9797
9793
|
const result = await zettelHealth(await getFedBackend(), {
|
|
9798
9794
|
scope,
|
|
9799
9795
|
projectPath,
|
|
@@ -9864,7 +9860,7 @@ async function cmdSurprise(note, opts) {
|
|
|
9864
9860
|
const limit = parseInt(opts.limit ?? "10", 10);
|
|
9865
9861
|
const minSimilarity = parseFloat(opts.minSimilarity ?? "0.3");
|
|
9866
9862
|
const minGraphDistance = parseInt(opts.minDistance ?? "3", 10);
|
|
9867
|
-
const { zettelSurprise } = await import("./zettelkasten-
|
|
9863
|
+
const { zettelSurprise } = await import("./zettelkasten-Dwj67e4p.mjs");
|
|
9868
9864
|
const backend = await getFedBackend();
|
|
9869
9865
|
console.log();
|
|
9870
9866
|
console.log(header(" PAI Zettel Surprise"));
|
|
@@ -9919,7 +9915,7 @@ async function cmdSuggest(note, opts) {
|
|
|
9919
9915
|
const vaultProjectId = parseInt(opts.vaultProjectId, 10);
|
|
9920
9916
|
const limit = parseInt(opts.limit ?? "5", 10);
|
|
9921
9917
|
const excludeLinked = opts.excludeLinked !== false;
|
|
9922
|
-
const { zettelSuggest } = await import("./zettelkasten-
|
|
9918
|
+
const { zettelSuggest } = await import("./zettelkasten-Dwj67e4p.mjs");
|
|
9923
9919
|
const backend = await getFedBackend();
|
|
9924
9920
|
console.log();
|
|
9925
9921
|
console.log(header(" PAI Zettel Suggest"));
|
|
@@ -9972,7 +9968,7 @@ async function cmdConverse(question, opts) {
|
|
|
9972
9968
|
const vaultProjectId = parseInt(opts.vaultProjectId, 10);
|
|
9973
9969
|
const depth = parseInt(opts.depth ?? "2", 10);
|
|
9974
9970
|
const limit = parseInt(opts.limit ?? "15", 10);
|
|
9975
|
-
const { zettelConverse } = await import("./zettelkasten-
|
|
9971
|
+
const { zettelConverse } = await import("./zettelkasten-Dwj67e4p.mjs");
|
|
9976
9972
|
const backend = await getFedBackend();
|
|
9977
9973
|
console.log();
|
|
9978
9974
|
console.log(header(" PAI Zettel Converse"));
|
|
@@ -10035,7 +10031,7 @@ async function cmdThemes(opts) {
|
|
|
10035
10031
|
const minClusterSize = parseInt(opts.minSize ?? "3", 10);
|
|
10036
10032
|
const maxThemes = parseInt(opts.maxThemes ?? "10", 10);
|
|
10037
10033
|
const similarityThreshold = parseFloat(opts.threshold ?? "0.65");
|
|
10038
|
-
const { zettelThemes } = await import("./zettelkasten-
|
|
10034
|
+
const { zettelThemes } = await import("./zettelkasten-Dwj67e4p.mjs");
|
|
10039
10035
|
const backend = await getFedBackend();
|
|
10040
10036
|
console.log();
|
|
10041
10037
|
console.log(header(" PAI Zettel Themes"));
|
|
@@ -10414,7 +10410,7 @@ function defaultFileSet(cwd) {
|
|
|
10414
10410
|
join(cwd, "CLAUDE.md"),
|
|
10415
10411
|
join(cwd, ".claude", "CLAUDE.md"),
|
|
10416
10412
|
...parentClaudeMdFiles(dirname(cwd)),
|
|
10417
|
-
join(homedir(), ".claude", "
|
|
10413
|
+
join(homedir(), ".claude", "skills", "CORE", "SKILL.md"),
|
|
10418
10414
|
whisperRulesPath(),
|
|
10419
10415
|
join(homedir(), ".claude", "projects", encodeDir(cwd), "memory", "MEMORY.md")
|
|
10420
10416
|
];
|
|
@@ -13861,7 +13857,7 @@ function capture(cmd, cwd) {
|
|
|
13861
13857
|
* package root where package.json lives.
|
|
13862
13858
|
*/
|
|
13863
13859
|
function getPaiSrcDir() {
|
|
13864
|
-
return
|
|
13860
|
+
return packageRoot(import.meta.url);
|
|
13865
13861
|
}
|
|
13866
13862
|
/**
|
|
13867
13863
|
* Locate the templates directory relative to the installed package.
|
|
@@ -14311,7 +14307,7 @@ function registerNotifyCommands(notifyCmd) {
|
|
|
14311
14307
|
* and the bus reports ownership instead of delivering. PAI must stay useful on
|
|
14312
14308
|
* machines that do not run iTerm2.
|
|
14313
14309
|
*
|
|
14314
|
-
* See
|
|
14310
|
+
* See docs/task-bus.md.
|
|
14315
14311
|
*/
|
|
14316
14312
|
/**
|
|
14317
14313
|
* How long AIBroker may spend on one dispatch, in seconds.
|
|
@@ -14577,6 +14573,12 @@ function installSchedule(intervalSecs = DEFAULT_INTERVAL_SECS) {
|
|
|
14577
14573
|
};
|
|
14578
14574
|
if (!existsSync(LAUNCH_AGENTS)) mkdirSync(LAUNCH_AGENTS, { recursive: true });
|
|
14579
14575
|
writeFileSync(SCHEDULE_PLIST, generateSchedulePlist(intervalSecs, cliPath()), "utf8");
|
|
14576
|
+
if (!serviceManagerAllowed(`launchctl load ${SCHEDULE_PLIST}`)) return {
|
|
14577
|
+
plistPath: SCHEDULE_PLIST,
|
|
14578
|
+
intervalSecs,
|
|
14579
|
+
loaded: false,
|
|
14580
|
+
message: "Plist written; not loaded (HOME is not the account home)."
|
|
14581
|
+
};
|
|
14580
14582
|
spawnSync("launchctl", ["unload", SCHEDULE_PLIST], { encoding: "utf8" });
|
|
14581
14583
|
const load = spawnSync("launchctl", ["load", SCHEDULE_PLIST], { encoding: "utf8" });
|
|
14582
14584
|
return {
|
|
@@ -14588,7 +14590,7 @@ function installSchedule(intervalSecs = DEFAULT_INTERVAL_SECS) {
|
|
|
14588
14590
|
}
|
|
14589
14591
|
function uninstallSchedule() {
|
|
14590
14592
|
if (!existsSync(SCHEDULE_PLIST)) return "Scheduler is not installed.";
|
|
14591
|
-
spawnSync("launchctl", ["unload", SCHEDULE_PLIST], { encoding: "utf8" });
|
|
14593
|
+
if (serviceManagerAllowed(`launchctl unload ${SCHEDULE_PLIST}`)) spawnSync("launchctl", ["unload", SCHEDULE_PLIST], { encoding: "utf8" });
|
|
14592
14594
|
unlinkSync(SCHEDULE_PLIST);
|
|
14593
14595
|
return "Scheduler uninstalled.";
|
|
14594
14596
|
}
|
|
@@ -16104,7 +16106,7 @@ async function migrateToPostgres(opts = {}) {
|
|
|
16104
16106
|
const dump = pgDump(container, pgConfig, dumpPath);
|
|
16105
16107
|
if (!dump.ok) return refused(dump.reason, dryRun);
|
|
16106
16108
|
}
|
|
16107
|
-
const { PostgresBackend } = await import("./postgres-
|
|
16109
|
+
const { PostgresBackend } = await import("./postgres-DYtZg7J7.mjs");
|
|
16108
16110
|
await PostgresBackend.ensureDatabase(pgConfig);
|
|
16109
16111
|
const sqlite = new BetterSqlite3(sqliteFederationPath, { readonly: true });
|
|
16110
16112
|
const registrySqlite = sqliteRegistryPath === sqliteFederationPath ? sqlite : new BetterSqlite3(sqliteRegistryPath, { readonly: true });
|
|
@@ -16675,7 +16677,7 @@ async function getSessionTags(registryBackend, sessionId) {
|
|
|
16675
16677
|
* Session CRUD commands: list, info, rename, slug, tag, route, active, auto-route.
|
|
16676
16678
|
*/
|
|
16677
16679
|
async function cmdList(projectSlug, opts) {
|
|
16678
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16680
|
+
const { getRegistryBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
16679
16681
|
const registryBackend = await getRegistryBackend();
|
|
16680
16682
|
const limit = parseInt(opts.limit ?? "20", 10);
|
|
16681
16683
|
let project;
|
|
@@ -16740,7 +16742,7 @@ async function cmdList(projectSlug, opts) {
|
|
|
16740
16742
|
console.log(dim$1(` ${rows.length} session(s) shown (limit: ${limit})`));
|
|
16741
16743
|
}
|
|
16742
16744
|
async function cmdInfo(projectSlug, sessionNumber) {
|
|
16743
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16745
|
+
const { getRegistryBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
16744
16746
|
const registryBackend = await getRegistryBackend();
|
|
16745
16747
|
const project = await getProject$1(registryBackend, projectSlug);
|
|
16746
16748
|
if (!project) {
|
|
@@ -16764,7 +16766,7 @@ async function cmdInfo(projectSlug, sessionNumber) {
|
|
|
16764
16766
|
console.log();
|
|
16765
16767
|
}
|
|
16766
16768
|
async function cmdRename(projectSlug, numberOrLatest, newSlug) {
|
|
16767
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16769
|
+
const { getRegistryBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
16768
16770
|
await cmdRenameWith(await getRegistryBackend(), projectSlug, numberOrLatest, newSlug);
|
|
16769
16771
|
}
|
|
16770
16772
|
async function cmdRenameWith(registryBackend, projectSlug, numberOrLatest, newSlug) {
|
|
@@ -16827,7 +16829,7 @@ async function cmdRenameWith(registryBackend, projectSlug, numberOrLatest, newSl
|
|
|
16827
16829
|
console.log();
|
|
16828
16830
|
}
|
|
16829
16831
|
async function cmdSlug(projectSlug, numberOrLatest, opts) {
|
|
16830
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16832
|
+
const { getRegistryBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
16831
16833
|
const registryBackend = await getRegistryBackend();
|
|
16832
16834
|
const project = await getProject$1(registryBackend, projectSlug);
|
|
16833
16835
|
if (!project) {
|
|
@@ -16857,7 +16859,7 @@ async function cmdSlug(projectSlug, numberOrLatest, opts) {
|
|
|
16857
16859
|
}
|
|
16858
16860
|
}
|
|
16859
16861
|
async function cmdTag(projectSlug, sessionNumber, rawTags) {
|
|
16860
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16862
|
+
const { getRegistryBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
16861
16863
|
const registryBackend = await getRegistryBackend();
|
|
16862
16864
|
const project = await getProject$1(registryBackend, projectSlug);
|
|
16863
16865
|
if (!project) {
|
|
@@ -16897,7 +16899,7 @@ async function cmdTag(projectSlug, sessionNumber, rawTags) {
|
|
|
16897
16899
|
console.log();
|
|
16898
16900
|
}
|
|
16899
16901
|
async function cmdRoute(projectSlug, sessionNumber, targetProjectSlug, opts) {
|
|
16900
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16902
|
+
const { getRegistryBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
16901
16903
|
const registryBackend = await getRegistryBackend();
|
|
16902
16904
|
const project = await getProject$1(registryBackend, projectSlug);
|
|
16903
16905
|
if (!project) {
|
|
@@ -16939,7 +16941,7 @@ async function cmdRoute(projectSlug, sessionNumber, targetProjectSlug, opts) {
|
|
|
16939
16941
|
console.log();
|
|
16940
16942
|
}
|
|
16941
16943
|
async function cmdActive(opts) {
|
|
16942
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16944
|
+
const { getRegistryBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
16943
16945
|
const registryBackend = await getRegistryBackend();
|
|
16944
16946
|
const minutes = parseInt(opts.minutes ?? "60", 10);
|
|
16945
16947
|
const cutoff = Date.now() - minutes * 60 * 1e3;
|
|
@@ -17026,9 +17028,9 @@ async function cmdActive(opts) {
|
|
|
17026
17028
|
], rows));
|
|
17027
17029
|
}
|
|
17028
17030
|
async function cmdAutoRoute(opts) {
|
|
17029
|
-
const { autoRoute, formatAutoRouteJson } = await import("./auto-route-
|
|
17030
|
-
const { getRegistryBackend, createStorageBackend } = await import("./factory-
|
|
17031
|
-
const { loadConfig } = await import("./config-
|
|
17031
|
+
const { autoRoute, formatAutoRouteJson } = await import("./auto-route-sLMU-NnM.mjs");
|
|
17032
|
+
const { getRegistryBackend, createStorageBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
17033
|
+
const { loadConfig } = await import("./config-YinjgXEJ.mjs");
|
|
17032
17034
|
const config = loadConfig();
|
|
17033
17035
|
const registryBackend = await getRegistryBackend();
|
|
17034
17036
|
const federation = await createStorageBackend(config);
|
|
@@ -17264,7 +17266,7 @@ async function cmdPause(opts) {
|
|
|
17264
17266
|
process.exitCode = 1;
|
|
17265
17267
|
return;
|
|
17266
17268
|
}
|
|
17267
|
-
const { getRegistryBackend } = await import("./factory-
|
|
17269
|
+
const { getRegistryBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
17268
17270
|
const registryBackend = await getRegistryBackend();
|
|
17269
17271
|
const cwd = process.cwd();
|
|
17270
17272
|
const project = await resolveProjectByCwd(registryBackend, cwd);
|
|
@@ -17659,7 +17661,7 @@ function buildStopBody(project, sessionId) {
|
|
|
17659
17661
|
}
|
|
17660
17662
|
}
|
|
17661
17663
|
async function cmdHandover(projectSlug, numberOrLatest, sessionId) {
|
|
17662
|
-
const { getRegistryBackend } = await import("./factory-
|
|
17664
|
+
const { getRegistryBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
17663
17665
|
const registryBackend = await getRegistryBackend();
|
|
17664
17666
|
let project;
|
|
17665
17667
|
if (projectSlug) {
|
|
@@ -17955,7 +17957,7 @@ function touchSentinel(rootPath) {
|
|
|
17955
17957
|
async function cmdAutosave(opts) {
|
|
17956
17958
|
const minGap = parseInt(opts.minGap ?? String(DEFAULT_MIN_GAP), 10);
|
|
17957
17959
|
const cwd = process.cwd();
|
|
17958
|
-
const { getRegistryBackend } = await import("./factory-
|
|
17960
|
+
const { getRegistryBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
17959
17961
|
const registryBackend = await getRegistryBackend();
|
|
17960
17962
|
const project = await resolveProjectByCwd(registryBackend, cwd);
|
|
17961
17963
|
if (!project) return;
|
|
@@ -19341,7 +19343,7 @@ function registerWorkerCommands(workerCmd) {
|
|
|
19341
19343
|
process.exitCode = code ?? 1;
|
|
19342
19344
|
});
|
|
19343
19345
|
});
|
|
19344
|
-
workerCmd.command("pane [id]").description("Open the follow pane for a worker (
|
|
19346
|
+
workerCmd.command("pane [id]").description("Open the follow pane for a worker (tmux split when $TMUX is set, else iTerm2 on macOS, else prints the follow command)").option("--check", "Only report whether the pane is open, plus the profile file's path, font, and the hosting window's bounds").action(async (id, opts) => {
|
|
19345
19347
|
try {
|
|
19346
19348
|
const { workers } = readWorkersSection();
|
|
19347
19349
|
const logDir = currentLogDir();
|
|
@@ -20349,8 +20351,8 @@ async function analyzeProject(registryBackend, project) {
|
|
|
20349
20351
|
async function countVectorDbPaths(oldPaths) {
|
|
20350
20352
|
if (oldPaths.length === 0) return 0;
|
|
20351
20353
|
try {
|
|
20352
|
-
const { loadConfig } = await import("./config-
|
|
20353
|
-
const { createStorageBackend } = await import("./factory-
|
|
20354
|
+
const { loadConfig } = await import("./config-YinjgXEJ.mjs");
|
|
20355
|
+
const { createStorageBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
20354
20356
|
const config = loadConfig();
|
|
20355
20357
|
if (config.storageBackend !== "postgres") return 0;
|
|
20356
20358
|
const backend = await createStorageBackend(config);
|
|
@@ -20367,8 +20369,8 @@ async function countVectorDbPaths(oldPaths) {
|
|
|
20367
20369
|
async function updateVectorDbPaths(moves) {
|
|
20368
20370
|
if (moves.length === 0) return 0;
|
|
20369
20371
|
try {
|
|
20370
|
-
const { loadConfig } = await import("./config-
|
|
20371
|
-
const { createStorageBackend } = await import("./factory-
|
|
20372
|
+
const { loadConfig } = await import("./config-YinjgXEJ.mjs");
|
|
20373
|
+
const { createStorageBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
20372
20374
|
const config = loadConfig();
|
|
20373
20375
|
if (config.storageBackend !== "postgres") return 0;
|
|
20374
20376
|
const backend = await createStorageBackend(config);
|
|
@@ -20455,7 +20457,7 @@ async function displayDryRun(plans) {
|
|
|
20455
20457
|
console.log();
|
|
20456
20458
|
}
|
|
20457
20459
|
async function executeCleanup(plans, skipReindex) {
|
|
20458
|
-
const { getRegistryBackend } = await import("./factory-
|
|
20460
|
+
const { getRegistryBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
20459
20461
|
const registryBackend = await getRegistryBackend();
|
|
20460
20462
|
let deleted = 0;
|
|
20461
20463
|
let renamed = 0;
|
|
@@ -20652,7 +20654,7 @@ async function executeCleanup(plans, skipReindex) {
|
|
|
20652
20654
|
//#region src/cli/commands/session-cleanup/index.ts
|
|
20653
20655
|
function registerSessionCleanupCommand(sessionCmd) {
|
|
20654
20656
|
sessionCmd.command("cleanup [project-slug]").description("Clean up session notes: delete empties, auto-name unnamed, move into YYYY/MM/ hierarchy, renumber").option("--execute", "Actually perform the cleanup (default is dry-run)").option("--no-renumber", "Skip renumbering sessions after deletions").option("--no-reindex", "Skip triggering memory re-index after moves").action(async (projectSlug, opts) => {
|
|
20655
|
-
const { getRegistryBackend } = await import("./factory-
|
|
20657
|
+
const { getRegistryBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
20656
20658
|
const registryBackend = await getRegistryBackend();
|
|
20657
20659
|
const dryRun = !opts.execute;
|
|
20658
20660
|
const skipReindex = opts.reindex === false;
|
|
@@ -20722,7 +20724,7 @@ function finalizeNote(notePath) {
|
|
|
20722
20724
|
}
|
|
20723
20725
|
async function cmdEnd(opts) {
|
|
20724
20726
|
await cmdPause(opts);
|
|
20725
|
-
const { getRegistryBackend } = await import("./factory-
|
|
20727
|
+
const { getRegistryBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
20726
20728
|
const registryBackend = await getRegistryBackend();
|
|
20727
20729
|
const cwd = process.cwd();
|
|
20728
20730
|
const project = await registryBackend.findProjectByCwdPrefix(cwd);
|
|
@@ -21170,7 +21172,7 @@ async function cmdFind(query, opts) {
|
|
|
21170
21172
|
*/
|
|
21171
21173
|
async function getProjects(includeArchived) {
|
|
21172
21174
|
try {
|
|
21173
|
-
const { getRegistryBackend } = await import("./factory-
|
|
21175
|
+
const { getRegistryBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
21174
21176
|
const rows = await (await getRegistryBackend()).listProjectsWithSessionStats();
|
|
21175
21177
|
return includeArchived ? rows : rows.filter((p) => p.status === "active");
|
|
21176
21178
|
} catch {
|
|
@@ -21644,7 +21646,7 @@ async function cmdPick(opts = {}) {
|
|
|
21644
21646
|
const onRemove = async (rec) => {
|
|
21645
21647
|
if (!rec.slug) return false;
|
|
21646
21648
|
try {
|
|
21647
|
-
const { getRegistryBackend } = await import("./factory-
|
|
21649
|
+
const { getRegistryBackend } = await import("./factory-CaswxuJ0.mjs");
|
|
21648
21650
|
const registryBackend = await getRegistryBackend();
|
|
21649
21651
|
const project = await registryBackend.getProjectBySlug(rec.slug);
|
|
21650
21652
|
if (!project || project.status !== "active") return false;
|
|
@@ -21704,7 +21706,7 @@ async function cmdPick(opts = {}) {
|
|
|
21704
21706
|
*/
|
|
21705
21707
|
function getVersion() {
|
|
21706
21708
|
try {
|
|
21707
|
-
const pkgPath =
|
|
21709
|
+
const pkgPath = resolveFromModule(import.meta.url, "package.json");
|
|
21708
21710
|
return JSON.parse(readFileSync(pkgPath, "utf8")).version ?? "0.0.0";
|
|
21709
21711
|
} catch {
|
|
21710
21712
|
return "0.0.0";
|
|
@@ -21929,4 +21931,4 @@ claude() {
|
|
|
21929
21931
|
|
|
21930
21932
|
//#endregion
|
|
21931
21933
|
export { drainStdio as n, buildProgram as t };
|
|
21932
|
-
//# sourceMappingURL=program-
|
|
21934
|
+
//# sourceMappingURL=program-CWf9mT7Z.mjs.map
|