@tekmidian/pai 0.66.1 → 0.66.3
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/dist/{aibroker-client-B8c42Lh8.mjs → aibroker-client-Ck3p3k_-.mjs} +2 -2
- package/dist/{aibroker-client-C5Fw7DNz.mjs → aibroker-client-WCZi_tn-.mjs} +3 -3
- package/dist/{aibroker-client-C5Fw7DNz.mjs.map → aibroker-client-WCZi_tn-.mjs.map} +1 -1
- package/dist/{auto-route-o0BOsXn7.mjs → auto-route-BnizyALK.mjs} +65 -4
- package/dist/auto-route-BnizyALK.mjs.map +1 -0
- package/dist/auto-route-D6fW1Q8z.mjs +3 -0
- package/dist/{chain-CZfKIEq9.mjs → chain-Fz4NLm4D.mjs} +3 -4
- package/dist/{chain-CZfKIEq9.mjs.map → chain-Fz4NLm4D.mjs.map} +1 -1
- package/dist/cli/index.mjs +18 -23
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/program.mjs +17 -22
- package/dist/{config-YinjgXEJ.mjs → config-CnsDMETf.mjs} +1 -1
- package/dist/{config-BbLFD7Uf.mjs → config-Ddc4DIPk.mjs} +5 -3
- package/dist/config-Ddc4DIPk.mjs.map +1 -0
- package/dist/{context-handover-cache-pkHzmL3c.mjs → context-handover-cache-DcPEW6vf.mjs} +1221 -13
- package/dist/context-handover-cache-DcPEW6vf.mjs.map +1 -0
- package/dist/daemon/index.mjs +17 -19
- package/dist/daemon/index.mjs.map +1 -1
- package/dist/daemon-Bl8TpHdM.mjs +5048 -0
- package/dist/daemon-Bl8TpHdM.mjs.map +1 -0
- package/dist/daemon-ZhHU6D0i.mjs +18 -0
- package/dist/daemon-mcp/index.mjs +12 -9
- package/dist/daemon-mcp/index.mjs.map +1 -1
- package/dist/{embeddings-CcscYWwk.mjs → embeddings-D0WOQpYR.mjs} +1 -1
- package/dist/{embeddings-Bx3q0QOY.mjs → embeddings-DMVzpvRZ.mjs} +18 -9
- package/dist/embeddings-DMVzpvRZ.mjs.map +1 -0
- package/dist/{env-JNEIrQWg.mjs → env-DiolswKQ.mjs} +1 -1
- package/dist/{env-JNEIrQWg.mjs.map → env-DiolswKQ.mjs.map} +1 -1
- package/dist/factory-BUnZgnKW.mjs +2892 -0
- package/dist/factory-BUnZgnKW.mjs.map +1 -0
- package/dist/factory-CrVlo2hY.mjs +8 -0
- package/dist/{fallback-CIiq2Raw.mjs → fallback-awOmq_9A.mjs} +23 -11
- package/dist/fallback-awOmq_9A.mjs.map +1 -0
- package/dist/{chunker-BH4i-F2b.mjs → helpers-CZsi_49C.mjs} +221 -2
- package/dist/helpers-CZsi_49C.mjs.map +1 -0
- package/dist/hooks/block-sleep-poll.mjs +6 -5
- package/dist/hooks/block-sleep-poll.mjs.map +3 -3
- package/dist/hooks/context-compression-hook.mjs +1 -0
- package/dist/hooks/context-compression-hook.mjs.map +2 -2
- package/dist/hooks/load-project-context.mjs +6 -5
- package/dist/hooks/load-project-context.mjs.map +3 -3
- package/dist/hooks/post-compact-inject.mjs +6 -5
- package/dist/hooks/post-compact-inject.mjs.map +3 -3
- package/dist/hooks/route-agents-to-worker.mjs +6 -5
- package/dist/hooks/route-agents-to-worker.mjs.map +3 -3
- package/dist/hooks/security-validator.mjs +1 -0
- package/dist/hooks/security-validator.mjs.map +2 -2
- package/dist/hooks/whisper-rules.mjs +1 -0
- package/dist/hooks/whisper-rules.mjs.map +2 -2
- package/dist/hooks/worker-guard.mjs +6 -5
- package/dist/hooks/worker-guard.mjs.map +3 -3
- package/dist/hooks/worker-proxy.mjs +6 -5
- package/dist/hooks/worker-proxy.mjs.map +3 -3
- package/dist/hooks/worker-status-line.mjs +6 -5
- package/dist/hooks/worker-status-line.mjs.map +3 -3
- package/dist/hooks/worker-supervision.mjs +6 -5
- package/dist/hooks/worker-supervision.mjs.map +3 -3
- package/dist/index.mjs +6 -7
- package/dist/{ipc-client-D16Xw6Uo.mjs → ipc-client-DkxRay-o.mjs} +2 -2
- package/dist/{ipc-client-D16Xw6Uo.mjs.map → ipc-client-DkxRay-o.mjs.map} +1 -1
- package/dist/{main-resolver-DPPwHNtn.mjs → main-resolver-CVGPICy-.mjs} +7 -7
- package/dist/{main-resolver-DPPwHNtn.mjs.map → main-resolver-CVGPICy-.mjs.map} +1 -1
- package/dist/main-resolver-DDShdDBm.mjs +7 -0
- package/dist/{migrate-BD7D8EEh.mjs → migrate-Bq0esMOa.mjs} +2 -2
- package/dist/{migrate-BD7D8EEh.mjs.map → migrate-Bq0esMOa.mjs.map} +1 -1
- package/dist/{pai-home-Cm9rcJgX.mjs → pai-home-UncxWxlX.mjs} +1 -1
- package/dist/{pai-home-Cm9rcJgX.mjs.map → pai-home-UncxWxlX.mjs.map} +1 -1
- package/dist/{pai-marker-D1MMswkz.mjs → pai-marker-DXVpFsYz.mjs} +1 -1
- package/dist/{pai-marker-D1MMswkz.mjs.map → pai-marker-DXVpFsYz.mjs.map} +1 -1
- package/dist/{planner-Dm5Acyo1.mjs → planner-GdiYe2FO.mjs} +10 -7
- package/dist/{planner-Dm5Acyo1.mjs.map → planner-GdiYe2FO.mjs.map} +1 -1
- package/dist/postgres-DKyiCA5V.mjs +5 -0
- package/dist/{postgres-Ceqsa64C.mjs → postgres-H85VSYHI.mjs} +364 -9
- package/dist/postgres-H85VSYHI.mjs.map +1 -0
- package/dist/{program-JJ0TwSHI.mjs → program-D3MSfx86.mjs} +142 -100
- package/dist/program-D3MSfx86.mjs.map +1 -0
- package/dist/{query-feedback-BIaZTTFO.mjs → query-feedback-BPdapXKd.mjs} +2 -2
- package/dist/{query-feedback-BIaZTTFO.mjs.map → query-feedback-BPdapXKd.mjs.map} +1 -1
- package/dist/{reranker-DKv80KO5.mjs → reranker-3lnggwgq.mjs} +1 -1
- package/dist/{reranker-DKv80KO5.mjs.map → reranker-3lnggwgq.mjs.map} +1 -1
- package/dist/{reranker-CFiEzHQu.mjs → reranker-CZ2mP4cf.mjs} +1 -1
- package/dist/router-BK-hFeQ6.mjs +3 -0
- package/dist/{router-a5G7q8_3.mjs → router-BaTbc9VX.mjs} +2 -2
- package/dist/{router-a5G7q8_3.mjs.map → router-BaTbc9VX.mjs.map} +1 -1
- package/dist/{run-BCpbxqA5.mjs → run-D9YbWsnL.mjs} +599 -22
- package/dist/run-D9YbWsnL.mjs.map +1 -0
- package/dist/{run-env-DRcp7A8K.mjs → run-env-CQRnxNht.mjs} +3 -3
- package/dist/{run-env-DRcp7A8K.mjs.map → run-env-CQRnxNht.mjs.map} +1 -1
- package/dist/{runtime-paths-CHTg3ywb.mjs → runtime-paths-Bw3Jk8qJ.mjs} +4 -2
- package/dist/runtime-paths-Bw3Jk8qJ.mjs.map +1 -0
- package/dist/{search-BOSphCJ1.mjs → search-CNAGTiJP.mjs} +2 -2
- package/dist/{search-BOSphCJ1.mjs.map → search-CNAGTiJP.mjs.map} +1 -1
- package/dist/{sources-CijVso3n.mjs → sources-CM2g-CLT.mjs} +2 -2
- package/dist/{sources-CijVso3n.mjs.map → sources-CM2g-CLT.mjs.map} +1 -1
- package/dist/{stop-words-BdQuaE9K.mjs → stop-words-DtxaTWU_.mjs} +1 -1
- package/dist/{stop-words-BdQuaE9K.mjs.map → stop-words-DtxaTWU_.mjs.map} +1 -1
- package/dist/{utils-C9HsYDpO.mjs → utils-DddRwMsG.mjs} +2 -2
- package/dist/{utils-C9HsYDpO.mjs.map → utils-DddRwMsG.mjs.map} +1 -1
- package/dist/{zettelkasten-CtGHQWPU.mjs → zettelkasten-BRIaHzFm.mjs} +149 -7
- package/dist/zettelkasten-BRIaHzFm.mjs.map +1 -0
- package/dist/zettelkasten-G0-ZTybr.mjs +5 -0
- package/docs/commands/memory.md +2 -0
- package/docs/commands/worker.md +2 -0
- package/package.json +1 -1
- package/dist/async-C2Bm_Lal.mjs +0 -300
- package/dist/async-C2Bm_Lal.mjs.map +0 -1
- package/dist/auto-route-o0BOsXn7.mjs.map +0 -1
- package/dist/chunker-BH4i-F2b.mjs.map +0 -1
- package/dist/clusters-BCtD3fbe.mjs +0 -169
- package/dist/clusters-BCtD3fbe.mjs.map +0 -1
- package/dist/config-BbLFD7Uf.mjs.map +0 -1
- package/dist/context-handover-cache-pkHzmL3c.mjs.map +0 -1
- package/dist/daemon-DXlaVCkw.mjs +0 -1741
- package/dist/daemon-DXlaVCkw.mjs.map +0 -1
- package/dist/daemon-DyORmxZu.mjs +0 -19
- package/dist/detector-BEPFsINR.mjs +0 -3
- package/dist/detector-BRTtAWrM.mjs +0 -65
- package/dist/detector-BRTtAWrM.mjs.map +0 -1
- package/dist/embeddings-Bx3q0QOY.mjs.map +0 -1
- package/dist/factory-CNpPQQ-5.mjs +0 -249
- package/dist/factory-CNpPQQ-5.mjs.map +0 -1
- package/dist/factory-DY7x73mE.mjs +0 -3
- package/dist/fallback-CIiq2Raw.mjs.map +0 -1
- package/dist/federation-db-BTyoufBh.mjs +0 -139
- package/dist/federation-db-BTyoufBh.mjs.map +0 -1
- package/dist/federation-db-HfIFc7FG.mjs +0 -3
- package/dist/helpers-BRCJg0G3.mjs +0 -223
- package/dist/helpers-BRCJg0G3.mjs.map +0 -1
- package/dist/indexer-backend-DFF2FrYx.mjs +0 -5
- package/dist/indexer-backend-isSLg6yE.mjs +0 -1
- package/dist/kg-entity-DCOcsVFD.mjs +0 -29
- package/dist/kg-entity-DCOcsVFD.mjs.map +0 -1
- package/dist/latent-ideas-wwAXquGe.mjs +0 -191
- package/dist/latent-ideas-wwAXquGe.mjs.map +0 -1
- package/dist/link-boost-CnI7UVMJ.mjs +0 -34
- package/dist/link-boost-CnI7UVMJ.mjs.map +0 -1
- package/dist/main-resolver-BKz_OuEh.mjs +0 -7
- package/dist/merge-2gqRPFu2.mjs +0 -3
- package/dist/merge-DgU9OgZy.mjs +0 -6
- package/dist/merge-DgU9OgZy.mjs.map +0 -1
- package/dist/module-paths-DdRzbkUI.mjs +0 -44
- package/dist/module-paths-DdRzbkUI.mjs.map +0 -1
- package/dist/neighborhood-2FsmzoxG.mjs +0 -114
- package/dist/neighborhood-2FsmzoxG.mjs.map +0 -1
- package/dist/note-context-De63k8na.mjs +0 -106
- package/dist/note-context-De63k8na.mjs.map +0 -1
- package/dist/postgres-Ceqsa64C.mjs.map +0 -1
- package/dist/program-JJ0TwSHI.mjs.map +0 -1
- package/dist/query-feedback-B_iigYj-.mjs +0 -3
- package/dist/registry-db-C7voqML9.mjs +0 -213
- package/dist/registry-db-C7voqML9.mjs.map +0 -1
- package/dist/registry-db-JHPhA8vF.mjs +0 -3
- package/dist/registry-postgres-nOfyBSIW.mjs +0 -795
- package/dist/registry-postgres-nOfyBSIW.mjs.map +0 -1
- package/dist/registry-sqlite-DrCW1aRK.mjs +0 -593
- package/dist/registry-sqlite-DrCW1aRK.mjs.map +0 -1
- package/dist/router-CXUGsv85.mjs +0 -3
- package/dist/run-BCpbxqA5.mjs.map +0 -1
- package/dist/runtime-paths-CHTg3ywb.mjs.map +0 -1
- package/dist/search-Bf3Kub3F.mjs +0 -3
- package/dist/server-DgmAHyFK.mjs +0 -403
- package/dist/server-DgmAHyFK.mjs.map +0 -1
- package/dist/session-keepalive-DxjTHGcK.mjs +0 -582
- package/dist/session-keepalive-DxjTHGcK.mjs.map +0 -1
- package/dist/sqlite-CqsTy6xo.mjs +0 -936
- package/dist/sqlite-CqsTy6xo.mjs.map +0 -1
- package/dist/state-DW8zdweW.mjs +0 -3
- package/dist/state-HyjqTihC.mjs +0 -76
- package/dist/state-HyjqTihC.mjs.map +0 -1
- package/dist/themes-CTaOj3e1.mjs +0 -148
- package/dist/themes-CTaOj3e1.mjs.map +0 -1
- package/dist/tools-BcOKPBtg.mjs +0 -1489
- package/dist/tools-BcOKPBtg.mjs.map +0 -1
- package/dist/tools-C-_l0o8Z.mjs +0 -6
- package/dist/trace-CtV0RO6n.mjs +0 -137
- package/dist/trace-CtV0RO6n.mjs.map +0 -1
- package/dist/utils-BrX9FLeK.mjs +0 -3
- package/dist/vault-indexer-BG1sEVyM.mjs +0 -537
- package/dist/vault-indexer-BG1sEVyM.mjs.map +0 -1
- package/dist/wakeup-D8n33hYV.mjs +0 -335
- package/dist/wakeup-D8n33hYV.mjs.map +0 -1
- package/dist/work-queue-worker-4tLa5gpQ.mjs +0 -567
- package/dist/work-queue-worker-4tLa5gpQ.mjs.map +0 -1
- package/dist/work-queue-worker-rFZvTO3p.mjs +0 -11
- package/dist/zettelkasten-CtGHQWPU.mjs.map +0 -1
|
@@ -1,29 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as slugify$1, i as parseSessionFilename } from "./migrate-
|
|
3
|
-
import { n as ensurePaiMarker } from "./pai-marker-
|
|
4
|
-
import { t as STOP_WORDS } from "./stop-words-
|
|
5
|
-
import { t as applyRecencyBoost } from "./search-
|
|
6
|
-
import { n as
|
|
7
|
-
import { a as getStorageBackend, i as getRegistryBackend, r as createStorageBackend, s as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { a as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { t as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { i as
|
|
19
|
-
import { t as
|
|
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-CIiq2Raw.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-DPPwHNtn.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-DgmAHyFK.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-DxjTHGcK.mjs";
|
|
26
|
-
import { t as runChain } from "./chain-CZfKIEq9.mjs";
|
|
1
|
+
import { a as fmtDate, c as ok$1, d as scaffoldProjectDirs, f as shortenPath, g as warn$1, h as smartDecodeDir, i as err, l as renderTable, m as slugify, n as dim$1, o as header, p as slugFromPath, r as encodeDir, s as now, t as bold$1, u as resolvePath } from "./utils-DddRwMsG.mjs";
|
|
2
|
+
import { a as slugify$1, i as parseSessionFilename } from "./migrate-Bq0esMOa.mjs";
|
|
3
|
+
import { n as ensurePaiMarker } from "./pai-marker-DXVpFsYz.mjs";
|
|
4
|
+
import { t as STOP_WORDS } from "./stop-words-DtxaTWU_.mjs";
|
|
5
|
+
import { t as applyRecencyBoost } from "./search-CNAGTiJP.mjs";
|
|
6
|
+
import { n as embedChunksWithBackend, o as packageRoot, r as indexProjectWithBackend, s as resolveFromModule } from "./postgres-H85VSYHI.mjs";
|
|
7
|
+
import { a as getStorageBackend, c as MergeError, f as humanDuration, i as getRegistryBackend, l as federationDbPath, o as oldRegistryPath, r as createStorageBackend, s as registryDbPath, u as oldFederationPath } from "./factory-BUnZgnKW.mjs";
|
|
8
|
+
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-Ddc4DIPk.mjs";
|
|
9
|
+
import { a as paiHomePath, i as paiHomeDir, n as migratePaiDir, o as resolvePaiFile, r as migratePaiFile, t as PaiFileMigrationError } from "./pai-home-UncxWxlX.mjs";
|
|
10
|
+
import { a as schedulerLogPath, i as paiSocketPath, n as daemonLogPath } from "./runtime-paths-Bw3Jk8qJ.mjs";
|
|
11
|
+
import { At as claudeProjectsDir, Ct as loadScanConfig, Dt as saveScanConfig, Et as resolveHome, Ft as formatDetection, It as formatDetectionJson, Mt as scanTranscriptFolders, Nt as transcriptFiles, Ot as upsertProject, Pt as detectProject, St as cmdScan, a as sessionKeepaliveLedgerSummary, bt as reexecBackground, ct as findLatestNote, jt as findMovedProjects, kt as upsertSession, l as resolveDaemonPid, lt as findNotesDir$1, o as parseSessionUsage, ot as appendCheckpointToNote, r as loadSessionKeepaliveState, rt as extractAndStoreTriples, s as totalUsageTokens, st as applyContinue, t as readContextHandoverCache, ut as readBodyFile, vt as migrateIdentityFile, w as migrateSummaryCooldowns, wt as migrateScanConfig, y as migrateWorkQueue } from "./context-handover-cache-DcPEW6vf.mjs";
|
|
12
|
+
import { B as DEFAULT_CONTEXT_WINDOW, C as maskKey, D as readWorkersSection, F as needsWorkersYamlRelocation, H as stripModelVariant, I as parseWorkersYamlDocument, L as relocateWorkersYaml, M as initWorkersYaml, N as inlineWorkersYamlKeys, P as migrateWorkersToYaml, R as workersYamlLegacyNotice, V as contextWindowFromModelId, b as getProviderOrNative, d as MODEL_CAPABILITIES, h as WorkersConfigError, p as PROVIDER_TAGS, r as ANTHROPIC_NATIVE, t as buildRunEnv, w as nativeAnthropicProvider, x as isModelCapability, y as expandHome$1, z as workersYamlPath } from "./run-env-CQRnxNht.mjs";
|
|
13
|
+
import { $ as longInlinePromptHint, A as git, F as appendLedger, G as loadStatus, K as loadStatuses, L as UNLABELED, M as uncommittedPaths, N as verifyWorker, O as discardWorker, Q as waitForTerminalStatus, U as isChatPane, W as isLive, X as saveStatus, Y as ownsPid, Z as setWorkerLabel, _ as markControlsHeld, _t as expandMcpNames, b as requestKill, c as handoffFromInside, dt as ledgerPath, et as parseRunnerArgs, f as checkPaneForWorker, ft as statusPath, g as clickrControlsArgv, gt as describeMcp, h as openPaneForWorker, ht as projectLaunchConfig, i as usageContextTokens, it as stopProxy, j as mergeWorker, k as gcWorktrees, lt as ensureNoMcpConfig, m as openFollowPane, mt as pinNotices, n as runWorker, nt as DEFAULT_PROXY_PORT, o as parseWorkerReport, p as closeEndedPanes, pt as workersLogDir, r as testProvider, rt as ensureProxyRunning, u as sayToWorker, ut as eventsPath, v as callerDescription } from "./run-D9YbWsnL.mjs";
|
|
14
|
+
import { t as PaiClient } from "./ipc-client-DkxRay-o.mjs";
|
|
15
|
+
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-awOmq_9A.mjs";
|
|
16
|
+
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-CVGPICy-.mjs";
|
|
17
|
+
import { n as queriesDirPath, t as migrateQueriesDir } from "./query-feedback-BPdapXKd.mjs";
|
|
18
|
+
import { i as sendToSession, n as fetchLiveSessions, r as revealItermSession, t as callAiBroker } from "./aibroker-client-WCZi_tn-.mjs";
|
|
19
|
+
import { t as runChain } from "./chain-Fz4NLm4D.mjs";
|
|
27
20
|
import { appendFileSync, chmodSync, closeSync, copyFileSync, cpSync, createReadStream, existsSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, statSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
|
|
28
21
|
import { homedir, platform, tmpdir, userInfo } from "node:os";
|
|
29
22
|
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
@@ -31,6 +24,7 @@ import chalk from "chalk";
|
|
|
31
24
|
import { createHash, randomUUID } from "node:crypto";
|
|
32
25
|
import { Command, InvalidArgumentError } from "commander";
|
|
33
26
|
import { fileURLToPath } from "node:url";
|
|
27
|
+
import pg from "pg";
|
|
34
28
|
import { execFile, execFileSync, execSync, spawn, spawnSync } from "node:child_process";
|
|
35
29
|
import { parseDocument } from "yaml";
|
|
36
30
|
import BetterSqlite3 from "better-sqlite3";
|
|
@@ -38,7 +32,6 @@ import { createInterface } from "node:readline";
|
|
|
38
32
|
import { createConnection } from "net";
|
|
39
33
|
import { getEncoding } from "js-tiktoken";
|
|
40
34
|
import { promisify } from "node:util";
|
|
41
|
-
import pg from "pg";
|
|
42
35
|
|
|
43
36
|
//#region src/registry/registrable.ts
|
|
44
37
|
/**
|
|
@@ -162,7 +155,7 @@ async function cmdPromote(opts) {
|
|
|
162
155
|
console.error(dim$1(` Pick a durable location for the new project.`));
|
|
163
156
|
process.exit(1);
|
|
164
157
|
}
|
|
165
|
-
const { getRegistryBackend } = await import("./factory-
|
|
158
|
+
const { getRegistryBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
166
159
|
const registryBackend = await getRegistryBackend();
|
|
167
160
|
const encodedDir = encodeDir(targetPath);
|
|
168
161
|
if (await registryBackend.getProjectBySlug(slug) ?? await registryBackend.getProjectByRootPath(targetPath) ?? await registryBackend.getProjectByEncodedDir(encodedDir)) {
|
|
@@ -2046,7 +2039,7 @@ async function cmdUnregister(slug, opts = {}) {
|
|
|
2046
2039
|
//#region src/cli/commands/project/projects-index.ts
|
|
2047
2040
|
function registerProjectsCommands(projectsCmd) {
|
|
2048
2041
|
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) => {
|
|
2049
|
-
const { cmdMain } = await import("./main-resolver-
|
|
2042
|
+
const { cmdMain } = await import("./main-resolver-DDShdDBm.mjs");
|
|
2050
2043
|
await cmdMain(void 0, void 0, opts);
|
|
2051
2044
|
});
|
|
2052
2045
|
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) => {
|
|
@@ -2912,7 +2905,7 @@ const DEFAULT_PAGE_SIZE = 500;
|
|
|
2912
2905
|
async function runEmbed(backend, projectId, projectSlug, batchSize = 50, pageSize = DEFAULT_PAGE_SIZE) {
|
|
2913
2906
|
const label = projectSlug ? `project ${projectSlug}` : "all projects";
|
|
2914
2907
|
console.log(dim$1(`Generating embeddings for ${label} (this may take a while on first run)...`));
|
|
2915
|
-
const { generateEmbeddings, serializeEmbedding } = await import("./embeddings-
|
|
2908
|
+
const { generateEmbeddings, serializeEmbedding } = await import("./embeddings-D0WOQpYR.mjs");
|
|
2916
2909
|
const { chunks: totalEstimate } = projectId !== void 0 ? await backend.getProjectStats(projectId) : await backend.getStats();
|
|
2917
2910
|
let done = 0;
|
|
2918
2911
|
let after = null;
|
|
@@ -2936,7 +2929,8 @@ async function runEmbed(backend, projectId, projectSlug, batchSize = 50, pageSiz
|
|
|
2936
2929
|
console.log(ok$1(`Done.`) + ` ${bold$1(String(done))} chunks embedded`);
|
|
2937
2930
|
}
|
|
2938
2931
|
function registerEmbedCommand(memoryCmd) {
|
|
2939
|
-
memoryCmd.command("embed [project-slug]").description("Generate embeddings for un-embedded chunks (Phase 2.5)").option("--batch-size <n>", "Chunks to embed per batch", "50").action(async (projectSlug, opts) => {
|
|
2932
|
+
memoryCmd.command("embed [project-slug]").description("Generate embeddings for un-embedded chunks (Phase 2.5)").option("--batch-size <n>", "Chunks to embed per batch", "50").option("--background", "Run at background priority (taskpolicy -b + nice)").action(async (projectSlug, opts) => {
|
|
2933
|
+
if (opts.background) reexecBackground();
|
|
2940
2934
|
let backend;
|
|
2941
2935
|
try {
|
|
2942
2936
|
backend = await getStorageBackend();
|
|
@@ -2983,7 +2977,11 @@ async function indexAllProjects(backend) {
|
|
|
2983
2977
|
};
|
|
2984
2978
|
}
|
|
2985
2979
|
function registerIndexCommand(memoryCmd) {
|
|
2986
|
-
memoryCmd.command("index [project-slug]").description("Index memory files for one project or all projects").option("--all", "Index all active projects (default when no slug given)").option("--embed", "Also generate embeddings for newly indexed chunks (Phase 2.5)").option("--direct", "Skip daemon IPC and run index directly (for debugging)").action(async (projectSlug, opts) => {
|
|
2980
|
+
memoryCmd.command("index [project-slug]").description("Index memory files for one project or all projects").option("--all", "Index all active projects (default when no slug given)").option("--embed", "Also generate embeddings for newly indexed chunks (Phase 2.5)").option("--direct", "Skip daemon IPC and run index directly (for debugging)").option("--background", "Run at background priority (taskpolicy -b + nice); implies --direct").action(async (projectSlug, opts) => {
|
|
2981
|
+
if (opts.background) {
|
|
2982
|
+
opts.direct = true;
|
|
2983
|
+
reexecBackground();
|
|
2984
|
+
}
|
|
2987
2985
|
if (!opts.direct && !projectSlug) try {
|
|
2988
2986
|
await new PaiClient(loadConfig().socketPath).triggerIndex();
|
|
2989
2987
|
console.log(ok$1("Index triggered in daemon.") + dim$1(" Check daemon logs for progress."));
|
|
@@ -3076,7 +3074,7 @@ function registerSearchCommand(memoryCmd) {
|
|
|
3076
3074
|
let results;
|
|
3077
3075
|
if (mode === "keyword") results = await backend.searchKeyword(query, searchOpts);
|
|
3078
3076
|
else {
|
|
3079
|
-
const { generateEmbedding } = await import("./embeddings-
|
|
3077
|
+
const { generateEmbedding } = await import("./embeddings-D0WOQpYR.mjs");
|
|
3080
3078
|
console.log(dim$1("Generating query embedding..."));
|
|
3081
3079
|
const queryEmbedding = await generateEmbedding(query, true);
|
|
3082
3080
|
if (mode === "semantic") results = await backend.searchSemantic(queryEmbedding, searchOpts);
|
|
@@ -3122,7 +3120,7 @@ function registerSearchCommand(memoryCmd) {
|
|
|
3122
3120
|
return;
|
|
3123
3121
|
}
|
|
3124
3122
|
if (opts.rerank !== false) {
|
|
3125
|
-
const { rerankResults } = await import("./reranker-
|
|
3123
|
+
const { rerankResults } = await import("./reranker-CZ2mP4cf.mjs");
|
|
3126
3124
|
console.log(dim$1("Reranking with cross-encoder..."));
|
|
3127
3125
|
results = await rerankResults(query, results, { topK: maxResults });
|
|
3128
3126
|
}
|
|
@@ -3261,9 +3259,9 @@ function registerStatsCommands(memoryCmd) {
|
|
|
3261
3259
|
//#region src/cli/commands/memory/sources-cmd.ts
|
|
3262
3260
|
function registerSourcesCommand(memoryCmd) {
|
|
3263
3261
|
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) => {
|
|
3264
|
-
const { createStorageBackend } = await import("./factory-
|
|
3265
|
-
const { loadConfig } = await import("./config-
|
|
3266
|
-
const { cmdMemorySources } = await import("./sources-
|
|
3262
|
+
const { createStorageBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
3263
|
+
const { loadConfig } = await import("./config-CnsDMETf.mjs");
|
|
3264
|
+
const { cmdMemorySources } = await import("./sources-CM2g-CLT.mjs");
|
|
3267
3265
|
let backend;
|
|
3268
3266
|
try {
|
|
3269
3267
|
backend = await createStorageBackend(loadConfig());
|
|
@@ -3281,6 +3279,45 @@ function registerSourcesCommand(memoryCmd) {
|
|
|
3281
3279
|
});
|
|
3282
3280
|
}
|
|
3283
3281
|
|
|
3282
|
+
//#endregion
|
|
3283
|
+
//#region src/cli/commands/memory/pass.ts
|
|
3284
|
+
/** Budget for one embed pass; mirrors the daemon's in-process budget. */
|
|
3285
|
+
const EMBED_MAX_MILLIS = 24e4;
|
|
3286
|
+
async function runPass(name, sleepMs) {
|
|
3287
|
+
if (name === "noop") {
|
|
3288
|
+
await new Promise((r) => setTimeout(r, sleepMs));
|
|
3289
|
+
return { pid: process.pid };
|
|
3290
|
+
}
|
|
3291
|
+
const storage = await getStorageBackend();
|
|
3292
|
+
const registry = await getRegistryBackend();
|
|
3293
|
+
if (name === "index") return await storage.indexAll(registry);
|
|
3294
|
+
const projectNames = /* @__PURE__ */ new Map();
|
|
3295
|
+
try {
|
|
3296
|
+
for (const r of await registry.listProjects({ status: "active" })) projectNames.set(r.id, r.slug);
|
|
3297
|
+
} catch {}
|
|
3298
|
+
return { count: await embedChunksWithBackend(storage, () => false, projectNames, { maxMillis: EMBED_MAX_MILLIS }) };
|
|
3299
|
+
}
|
|
3300
|
+
function registerPassCommand(memoryCmd) {
|
|
3301
|
+
memoryCmd.command("pass <name>", { hidden: true }).option("--sleep <ms>", "noop pass: sleep this long", "0").action(async (name, opts) => {
|
|
3302
|
+
reexecBackground();
|
|
3303
|
+
try {
|
|
3304
|
+
const result = await runPass(name, parseInt(opts.sleep, 10));
|
|
3305
|
+
process.stdout.write(JSON.stringify({
|
|
3306
|
+
ok: true,
|
|
3307
|
+
result
|
|
3308
|
+
}) + "\n");
|
|
3309
|
+
process.exitCode = 0;
|
|
3310
|
+
} catch (e) {
|
|
3311
|
+
process.stdout.write(JSON.stringify({
|
|
3312
|
+
ok: false,
|
|
3313
|
+
error: e instanceof Error ? e.message : String(e)
|
|
3314
|
+
}) + "\n");
|
|
3315
|
+
process.exitCode = 1;
|
|
3316
|
+
}
|
|
3317
|
+
process.exit();
|
|
3318
|
+
});
|
|
3319
|
+
}
|
|
3320
|
+
|
|
3284
3321
|
//#endregion
|
|
3285
3322
|
//#region src/cli/commands/memory/index.ts
|
|
3286
3323
|
function registerMemoryCommands(memoryCmd) {
|
|
@@ -3289,6 +3326,7 @@ function registerMemoryCommands(memoryCmd) {
|
|
|
3289
3326
|
registerSearchCommand(memoryCmd);
|
|
3290
3327
|
registerStatsCommands(memoryCmd);
|
|
3291
3328
|
registerSourcesCommand(memoryCmd);
|
|
3329
|
+
registerPassCommand(memoryCmd);
|
|
3292
3330
|
}
|
|
3293
3331
|
|
|
3294
3332
|
//#endregion
|
|
@@ -3963,8 +4001,8 @@ async function escalate(task, headline, detail, state, now, opts) {
|
|
|
3963
4001
|
state.alarmedAt[task.id] = now;
|
|
3964
4002
|
let delivered = false;
|
|
3965
4003
|
try {
|
|
3966
|
-
const { routeNotification } = await import("./router-
|
|
3967
|
-
const { loadConfig } = await import("./config-
|
|
4004
|
+
const { routeNotification } = await import("./router-BK-hFeQ6.mjs");
|
|
4005
|
+
const { loadConfig } = await import("./config-CnsDMETf.mjs");
|
|
3968
4006
|
delivered = (await routeNotification({
|
|
3969
4007
|
event: "error",
|
|
3970
4008
|
title: `PAI: ${headline}`,
|
|
@@ -3999,7 +4037,7 @@ async function escalate(task, headline, detail, state, now, opts) {
|
|
|
3999
4037
|
async function alertParked(task, reason) {
|
|
4000
4038
|
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").`;
|
|
4001
4039
|
try {
|
|
4002
|
-
const { callAiBroker } = await import("./aibroker-client-
|
|
4040
|
+
const { callAiBroker } = await import("./aibroker-client-Ck3p3k_-.mjs");
|
|
4003
4041
|
await callAiBroker("pailot_send", { text }, 8e3);
|
|
4004
4042
|
} catch (e) {
|
|
4005
4043
|
console.error(`[pai-poller] parked-task alert not delivered to PAILot (${e instanceof Error ? e.message : String(e)}): ${text}`);
|
|
@@ -6621,6 +6659,10 @@ function formatStorageHealth(s, now = Date.now()) {
|
|
|
6621
6659
|
text: `${outage.attempts} attempts — ${outage.lastError}`
|
|
6622
6660
|
});
|
|
6623
6661
|
}
|
|
6662
|
+
for (const [name, f] of Object.entries(s.passFailures ?? {})) lines.push({
|
|
6663
|
+
severity: "error",
|
|
6664
|
+
text: `last ${name}: FAILED ${f.at} ${f.error}` + (f.gaveUp ? " (retries exhausted)" : ` (attempt ${f.attempts}, retrying)`)
|
|
6665
|
+
});
|
|
6624
6666
|
const queue = queueLine(s.workQueue, outage !== null);
|
|
6625
6667
|
if (queue) lines.push(queue);
|
|
6626
6668
|
if (outage) lines.push({
|
|
@@ -6781,6 +6823,7 @@ async function cmdStatus$1() {
|
|
|
6781
6823
|
console.log(bold$1(" PAI Daemon Status"));
|
|
6782
6824
|
console.log();
|
|
6783
6825
|
console.log(ok$1(` Daemon running`));
|
|
6826
|
+
console.log(dim$1(` PID: ${resolveDaemonPid() ?? "unknown"}`));
|
|
6784
6827
|
console.log(dim$1(` Uptime: ${s["uptime"]}s`));
|
|
6785
6828
|
console.log(dim$1(` Socket: ${s["socketPath"]}`));
|
|
6786
6829
|
const health = formatStorageHealth(s);
|
|
@@ -6814,12 +6857,13 @@ async function cmdStatus$1() {
|
|
|
6814
6857
|
function cmdRestart() {
|
|
6815
6858
|
if (!serviceManagerAllowed("pai daemon restart")) return;
|
|
6816
6859
|
if (process.platform === "linux") {
|
|
6860
|
+
const before = resolveDaemonPid();
|
|
6817
6861
|
const result = spawnSync("systemctl", [
|
|
6818
6862
|
"--user",
|
|
6819
6863
|
"restart",
|
|
6820
6864
|
SYSTEMD_UNIT_NAME
|
|
6821
6865
|
], { encoding: "utf8" });
|
|
6822
|
-
if (result.status === 0) console.log(ok$1(
|
|
6866
|
+
if (result.status === 0) console.log(ok$1(`Restarted daemon pid ${before ?? "?"} -> ${resolveDaemonPid() ?? "?"}`));
|
|
6823
6867
|
else {
|
|
6824
6868
|
console.error(err(`systemctl restart failed: ${(result.stderr || "").trim()}`));
|
|
6825
6869
|
process.exitCode = 1;
|
|
@@ -6832,25 +6876,16 @@ function cmdRestart() {
|
|
|
6832
6876
|
return;
|
|
6833
6877
|
}
|
|
6834
6878
|
try {
|
|
6835
|
-
const
|
|
6836
|
-
if (
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
], { encoding: "utf8" }).status === 0) console.log(ok$1("Sent kickstart to launchd."));
|
|
6843
|
-
else console.log(dim$1("Not managed by launchd either. Run: pai daemon serve"));
|
|
6879
|
+
const before = resolveDaemonPid();
|
|
6880
|
+
if (spawnSync("launchctl", [
|
|
6881
|
+
"kickstart",
|
|
6882
|
+
"-k",
|
|
6883
|
+
`gui/${process.getuid?.() ?? 501}/${PLIST_LABEL}`
|
|
6884
|
+
], { encoding: "utf8" }).status !== 0) {
|
|
6885
|
+
console.log(dim$1("Not managed by launchd. Run: pai daemon serve"));
|
|
6844
6886
|
return;
|
|
6845
6887
|
}
|
|
6846
|
-
|
|
6847
|
-
for (const pid of pids) try {
|
|
6848
|
-
process.kill(parseInt(pid, 10), "SIGTERM");
|
|
6849
|
-
console.log(ok$1(`Sent SIGTERM to pid ${pid}.`));
|
|
6850
|
-
} catch {
|
|
6851
|
-
console.log(warn$1(`Could not signal pid ${pid}.`));
|
|
6852
|
-
}
|
|
6853
|
-
console.log(dim$1("launchd will restart the daemon automatically."));
|
|
6888
|
+
console.log(ok$1(`Restarted daemon pid ${before ?? "?"} -> ${resolveDaemonPid() ?? "?"}`));
|
|
6854
6889
|
} catch (e) {
|
|
6855
6890
|
const msg = e instanceof Error ? e.message : String(e);
|
|
6856
6891
|
console.error(err(`restart error: ${msg}`));
|
|
@@ -7097,8 +7132,8 @@ function cmdLogs(opts) {
|
|
|
7097
7132
|
}
|
|
7098
7133
|
function registerDaemonCommands(daemonCmd) {
|
|
7099
7134
|
daemonCmd.command("serve").description("Start the PAI daemon in the foreground").action(async () => {
|
|
7100
|
-
const { serve } = await import("./daemon-
|
|
7101
|
-
const { loadConfig: lc, ensureConfigDir } = await import("./config-
|
|
7135
|
+
const { serve } = await import("./daemon-ZhHU6D0i.mjs");
|
|
7136
|
+
const { loadConfig: lc, ensureConfigDir } = await import("./config-CnsDMETf.mjs");
|
|
7102
7137
|
ensureConfigDir();
|
|
7103
7138
|
await serve(lc());
|
|
7104
7139
|
});
|
|
@@ -9724,7 +9759,7 @@ async function cmdExplore(note, opts) {
|
|
|
9724
9759
|
const depth = parseInt(opts.depth ?? "3", 10);
|
|
9725
9760
|
const direction = opts.direction ?? "both";
|
|
9726
9761
|
const mode = opts.mode ?? "all";
|
|
9727
|
-
const { zettelExplore } = await import("./zettelkasten-
|
|
9762
|
+
const { zettelExplore } = await import("./zettelkasten-G0-ZTybr.mjs");
|
|
9728
9763
|
const result = await zettelExplore(await getFedBackend(), {
|
|
9729
9764
|
startNote: note,
|
|
9730
9765
|
depth,
|
|
@@ -9789,7 +9824,7 @@ async function cmdHealth(opts) {
|
|
|
9789
9824
|
const projectPath = opts.project;
|
|
9790
9825
|
const recentDays = parseInt(opts.days ?? "30", 10);
|
|
9791
9826
|
const includeTypes = opts.include ? opts.include.split(",").map((s) => s.trim()) : void 0;
|
|
9792
|
-
const { zettelHealth } = await import("./zettelkasten-
|
|
9827
|
+
const { zettelHealth } = await import("./zettelkasten-G0-ZTybr.mjs");
|
|
9793
9828
|
const result = await zettelHealth(await getFedBackend(), {
|
|
9794
9829
|
scope,
|
|
9795
9830
|
projectPath,
|
|
@@ -9860,7 +9895,7 @@ async function cmdSurprise(note, opts) {
|
|
|
9860
9895
|
const limit = parseInt(opts.limit ?? "10", 10);
|
|
9861
9896
|
const minSimilarity = parseFloat(opts.minSimilarity ?? "0.3");
|
|
9862
9897
|
const minGraphDistance = parseInt(opts.minDistance ?? "3", 10);
|
|
9863
|
-
const { zettelSurprise } = await import("./zettelkasten-
|
|
9898
|
+
const { zettelSurprise } = await import("./zettelkasten-G0-ZTybr.mjs");
|
|
9864
9899
|
const backend = await getFedBackend();
|
|
9865
9900
|
console.log();
|
|
9866
9901
|
console.log(header(" PAI Zettel Surprise"));
|
|
@@ -9915,7 +9950,7 @@ async function cmdSuggest(note, opts) {
|
|
|
9915
9950
|
const vaultProjectId = parseInt(opts.vaultProjectId, 10);
|
|
9916
9951
|
const limit = parseInt(opts.limit ?? "5", 10);
|
|
9917
9952
|
const excludeLinked = opts.excludeLinked !== false;
|
|
9918
|
-
const { zettelSuggest } = await import("./zettelkasten-
|
|
9953
|
+
const { zettelSuggest } = await import("./zettelkasten-G0-ZTybr.mjs");
|
|
9919
9954
|
const backend = await getFedBackend();
|
|
9920
9955
|
console.log();
|
|
9921
9956
|
console.log(header(" PAI Zettel Suggest"));
|
|
@@ -9968,7 +10003,7 @@ async function cmdConverse(question, opts) {
|
|
|
9968
10003
|
const vaultProjectId = parseInt(opts.vaultProjectId, 10);
|
|
9969
10004
|
const depth = parseInt(opts.depth ?? "2", 10);
|
|
9970
10005
|
const limit = parseInt(opts.limit ?? "15", 10);
|
|
9971
|
-
const { zettelConverse } = await import("./zettelkasten-
|
|
10006
|
+
const { zettelConverse } = await import("./zettelkasten-G0-ZTybr.mjs");
|
|
9972
10007
|
const backend = await getFedBackend();
|
|
9973
10008
|
console.log();
|
|
9974
10009
|
console.log(header(" PAI Zettel Converse"));
|
|
@@ -10031,7 +10066,7 @@ async function cmdThemes(opts) {
|
|
|
10031
10066
|
const minClusterSize = parseInt(opts.minSize ?? "3", 10);
|
|
10032
10067
|
const maxThemes = parseInt(opts.maxThemes ?? "10", 10);
|
|
10033
10068
|
const similarityThreshold = parseFloat(opts.threshold ?? "0.65");
|
|
10034
|
-
const { zettelThemes } = await import("./zettelkasten-
|
|
10069
|
+
const { zettelThemes } = await import("./zettelkasten-G0-ZTybr.mjs");
|
|
10035
10070
|
const backend = await getFedBackend();
|
|
10036
10071
|
console.log();
|
|
10037
10072
|
console.log(header(" PAI Zettel Themes"));
|
|
@@ -13993,16 +14028,13 @@ function stepBuild(repoDir) {
|
|
|
13993
14028
|
*/
|
|
13994
14029
|
function stepRestartDaemon(repoDir) {
|
|
13995
14030
|
step("Restarting PAI daemon...");
|
|
13996
|
-
const
|
|
13997
|
-
if (
|
|
13998
|
-
|
|
13999
|
-
|
|
14000
|
-
|
|
14001
|
-
success(`Sent SIGHUP to daemon (PID ${pid}).`);
|
|
14002
|
-
return;
|
|
14003
|
-
}
|
|
14031
|
+
const pid = resolveDaemonPid();
|
|
14032
|
+
if (pid) {
|
|
14033
|
+
if (capture(`kill -HUP ${pid}`) !== null) {
|
|
14034
|
+
success(`Sent SIGHUP to daemon (PID ${pid}).`);
|
|
14035
|
+
return;
|
|
14004
14036
|
}
|
|
14005
|
-
}
|
|
14037
|
+
}
|
|
14006
14038
|
if (spawnSync("pai", ["daemon", "restart"], {
|
|
14007
14039
|
cwd: repoDir,
|
|
14008
14040
|
stdio: "pipe",
|
|
@@ -16106,7 +16138,7 @@ async function migrateToPostgres(opts = {}) {
|
|
|
16106
16138
|
const dump = pgDump(container, pgConfig, dumpPath);
|
|
16107
16139
|
if (!dump.ok) return refused(dump.reason, dryRun);
|
|
16108
16140
|
}
|
|
16109
|
-
const { PostgresBackend } = await import("./postgres-
|
|
16141
|
+
const { PostgresBackend } = await import("./postgres-DKyiCA5V.mjs");
|
|
16110
16142
|
await PostgresBackend.ensureDatabase(pgConfig);
|
|
16111
16143
|
const sqlite = new BetterSqlite3(sqliteFederationPath, { readonly: true });
|
|
16112
16144
|
const registrySqlite = sqliteRegistryPath === sqliteFederationPath ? sqlite : new BetterSqlite3(sqliteRegistryPath, { readonly: true });
|
|
@@ -16677,7 +16709,7 @@ async function getSessionTags(registryBackend, sessionId) {
|
|
|
16677
16709
|
* Session CRUD commands: list, info, rename, slug, tag, route, active, auto-route.
|
|
16678
16710
|
*/
|
|
16679
16711
|
async function cmdList(projectSlug, opts) {
|
|
16680
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16712
|
+
const { getRegistryBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
16681
16713
|
const registryBackend = await getRegistryBackend();
|
|
16682
16714
|
const limit = parseInt(opts.limit ?? "20", 10);
|
|
16683
16715
|
let project;
|
|
@@ -16742,7 +16774,7 @@ async function cmdList(projectSlug, opts) {
|
|
|
16742
16774
|
console.log(dim$1(` ${rows.length} session(s) shown (limit: ${limit})`));
|
|
16743
16775
|
}
|
|
16744
16776
|
async function cmdInfo(projectSlug, sessionNumber) {
|
|
16745
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16777
|
+
const { getRegistryBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
16746
16778
|
const registryBackend = await getRegistryBackend();
|
|
16747
16779
|
const project = await getProject$1(registryBackend, projectSlug);
|
|
16748
16780
|
if (!project) {
|
|
@@ -16766,7 +16798,7 @@ async function cmdInfo(projectSlug, sessionNumber) {
|
|
|
16766
16798
|
console.log();
|
|
16767
16799
|
}
|
|
16768
16800
|
async function cmdRename(projectSlug, numberOrLatest, newSlug) {
|
|
16769
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16801
|
+
const { getRegistryBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
16770
16802
|
await cmdRenameWith(await getRegistryBackend(), projectSlug, numberOrLatest, newSlug);
|
|
16771
16803
|
}
|
|
16772
16804
|
async function cmdRenameWith(registryBackend, projectSlug, numberOrLatest, newSlug) {
|
|
@@ -16829,7 +16861,7 @@ async function cmdRenameWith(registryBackend, projectSlug, numberOrLatest, newSl
|
|
|
16829
16861
|
console.log();
|
|
16830
16862
|
}
|
|
16831
16863
|
async function cmdSlug(projectSlug, numberOrLatest, opts) {
|
|
16832
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16864
|
+
const { getRegistryBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
16833
16865
|
const registryBackend = await getRegistryBackend();
|
|
16834
16866
|
const project = await getProject$1(registryBackend, projectSlug);
|
|
16835
16867
|
if (!project) {
|
|
@@ -16859,7 +16891,7 @@ async function cmdSlug(projectSlug, numberOrLatest, opts) {
|
|
|
16859
16891
|
}
|
|
16860
16892
|
}
|
|
16861
16893
|
async function cmdTag(projectSlug, sessionNumber, rawTags) {
|
|
16862
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16894
|
+
const { getRegistryBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
16863
16895
|
const registryBackend = await getRegistryBackend();
|
|
16864
16896
|
const project = await getProject$1(registryBackend, projectSlug);
|
|
16865
16897
|
if (!project) {
|
|
@@ -16899,7 +16931,7 @@ async function cmdTag(projectSlug, sessionNumber, rawTags) {
|
|
|
16899
16931
|
console.log();
|
|
16900
16932
|
}
|
|
16901
16933
|
async function cmdRoute(projectSlug, sessionNumber, targetProjectSlug, opts) {
|
|
16902
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16934
|
+
const { getRegistryBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
16903
16935
|
const registryBackend = await getRegistryBackend();
|
|
16904
16936
|
const project = await getProject$1(registryBackend, projectSlug);
|
|
16905
16937
|
if (!project) {
|
|
@@ -16941,7 +16973,7 @@ async function cmdRoute(projectSlug, sessionNumber, targetProjectSlug, opts) {
|
|
|
16941
16973
|
console.log();
|
|
16942
16974
|
}
|
|
16943
16975
|
async function cmdActive(opts) {
|
|
16944
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16976
|
+
const { getRegistryBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
16945
16977
|
const registryBackend = await getRegistryBackend();
|
|
16946
16978
|
const minutes = parseInt(opts.minutes ?? "60", 10);
|
|
16947
16979
|
const cutoff = Date.now() - minutes * 60 * 1e3;
|
|
@@ -17028,9 +17060,9 @@ async function cmdActive(opts) {
|
|
|
17028
17060
|
], rows));
|
|
17029
17061
|
}
|
|
17030
17062
|
async function cmdAutoRoute(opts) {
|
|
17031
|
-
const { autoRoute, formatAutoRouteJson } = await import("./auto-route-
|
|
17032
|
-
const { getRegistryBackend, createStorageBackend } = await import("./factory-
|
|
17033
|
-
const { loadConfig } = await import("./config-
|
|
17063
|
+
const { autoRoute, formatAutoRouteJson } = await import("./auto-route-D6fW1Q8z.mjs");
|
|
17064
|
+
const { getRegistryBackend, createStorageBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
17065
|
+
const { loadConfig } = await import("./config-CnsDMETf.mjs");
|
|
17034
17066
|
const config = loadConfig();
|
|
17035
17067
|
const registryBackend = await getRegistryBackend();
|
|
17036
17068
|
const federation = await createStorageBackend(config);
|
|
@@ -17266,7 +17298,7 @@ async function cmdPause(opts) {
|
|
|
17266
17298
|
process.exitCode = 1;
|
|
17267
17299
|
return;
|
|
17268
17300
|
}
|
|
17269
|
-
const { getRegistryBackend } = await import("./factory-
|
|
17301
|
+
const { getRegistryBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
17270
17302
|
const registryBackend = await getRegistryBackend();
|
|
17271
17303
|
const cwd = process.cwd();
|
|
17272
17304
|
const project = await resolveProjectByCwd(registryBackend, cwd);
|
|
@@ -17661,7 +17693,7 @@ function buildStopBody(project, sessionId) {
|
|
|
17661
17693
|
}
|
|
17662
17694
|
}
|
|
17663
17695
|
async function cmdHandover(projectSlug, numberOrLatest, sessionId) {
|
|
17664
|
-
const { getRegistryBackend } = await import("./factory-
|
|
17696
|
+
const { getRegistryBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
17665
17697
|
const registryBackend = await getRegistryBackend();
|
|
17666
17698
|
let project;
|
|
17667
17699
|
if (projectSlug) {
|
|
@@ -17957,7 +17989,7 @@ function touchSentinel(rootPath) {
|
|
|
17957
17989
|
async function cmdAutosave(opts) {
|
|
17958
17990
|
const minGap = parseInt(opts.minGap ?? String(DEFAULT_MIN_GAP), 10);
|
|
17959
17991
|
const cwd = process.cwd();
|
|
17960
|
-
const { getRegistryBackend } = await import("./factory-
|
|
17992
|
+
const { getRegistryBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
17961
17993
|
const registryBackend = await getRegistryBackend();
|
|
17962
17994
|
const project = await resolveProjectByCwd(registryBackend, cwd);
|
|
17963
17995
|
if (!project) return;
|
|
@@ -19365,10 +19397,20 @@ function registerWorkerCommands(workerCmd) {
|
|
|
19365
19397
|
process.exitCode = code ?? 1;
|
|
19366
19398
|
});
|
|
19367
19399
|
});
|
|
19368
|
-
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) => {
|
|
19400
|
+
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").option("--close-ended", "Close every open follow pane whose worker has ended (registry, then iTerm/tmux discovery)").option("--dry-run", "With --close-ended: only list what would be closed").action(async (id, opts) => {
|
|
19369
19401
|
try {
|
|
19370
19402
|
const { workers } = readWorkersSection();
|
|
19371
19403
|
const logDir = currentLogDir();
|
|
19404
|
+
if (opts.closeEnded) {
|
|
19405
|
+
const r = await closeEndedPanes(logDir, (wid) => {
|
|
19406
|
+
const st = loadStatus(logDir, wid);
|
|
19407
|
+
return st !== null && st.state !== "running";
|
|
19408
|
+
}, opts.dryRun === true);
|
|
19409
|
+
for (const l of r.closed) console.log(`${opts.dryRun ? "would close" : "closed"} ${l}`);
|
|
19410
|
+
for (const l of r.kept) console.log(`kept ${l}`);
|
|
19411
|
+
if (!r.closed.length) console.log("no ended worker panes open");
|
|
19412
|
+
return;
|
|
19413
|
+
}
|
|
19372
19414
|
const term = process.env.ITERM_SESSION_ID ?? "";
|
|
19373
19415
|
if (id) {
|
|
19374
19416
|
const msg = opts.check ? await checkPaneForWorker(id, workers.pane.fontSize, term) : (await openPaneForWorker(logDir, workers, id, term)).message;
|
|
@@ -20394,8 +20436,8 @@ async function analyzeProject(registryBackend, project) {
|
|
|
20394
20436
|
async function countVectorDbPaths(oldPaths) {
|
|
20395
20437
|
if (oldPaths.length === 0) return 0;
|
|
20396
20438
|
try {
|
|
20397
|
-
const { loadConfig } = await import("./config-
|
|
20398
|
-
const { createStorageBackend } = await import("./factory-
|
|
20439
|
+
const { loadConfig } = await import("./config-CnsDMETf.mjs");
|
|
20440
|
+
const { createStorageBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
20399
20441
|
const config = loadConfig();
|
|
20400
20442
|
if (config.storageBackend !== "postgres") return 0;
|
|
20401
20443
|
const backend = await createStorageBackend(config);
|
|
@@ -20412,8 +20454,8 @@ async function countVectorDbPaths(oldPaths) {
|
|
|
20412
20454
|
async function updateVectorDbPaths(moves) {
|
|
20413
20455
|
if (moves.length === 0) return 0;
|
|
20414
20456
|
try {
|
|
20415
|
-
const { loadConfig } = await import("./config-
|
|
20416
|
-
const { createStorageBackend } = await import("./factory-
|
|
20457
|
+
const { loadConfig } = await import("./config-CnsDMETf.mjs");
|
|
20458
|
+
const { createStorageBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
20417
20459
|
const config = loadConfig();
|
|
20418
20460
|
if (config.storageBackend !== "postgres") return 0;
|
|
20419
20461
|
const backend = await createStorageBackend(config);
|
|
@@ -20500,7 +20542,7 @@ async function displayDryRun(plans) {
|
|
|
20500
20542
|
console.log();
|
|
20501
20543
|
}
|
|
20502
20544
|
async function executeCleanup(plans, skipReindex) {
|
|
20503
|
-
const { getRegistryBackend } = await import("./factory-
|
|
20545
|
+
const { getRegistryBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
20504
20546
|
const registryBackend = await getRegistryBackend();
|
|
20505
20547
|
let deleted = 0;
|
|
20506
20548
|
let renamed = 0;
|
|
@@ -20697,7 +20739,7 @@ async function executeCleanup(plans, skipReindex) {
|
|
|
20697
20739
|
//#region src/cli/commands/session-cleanup/index.ts
|
|
20698
20740
|
function registerSessionCleanupCommand(sessionCmd) {
|
|
20699
20741
|
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) => {
|
|
20700
|
-
const { getRegistryBackend } = await import("./factory-
|
|
20742
|
+
const { getRegistryBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
20701
20743
|
const registryBackend = await getRegistryBackend();
|
|
20702
20744
|
const dryRun = !opts.execute;
|
|
20703
20745
|
const skipReindex = opts.reindex === false;
|
|
@@ -20767,7 +20809,7 @@ function finalizeNote(notePath) {
|
|
|
20767
20809
|
}
|
|
20768
20810
|
async function cmdEnd(opts) {
|
|
20769
20811
|
await cmdPause(opts);
|
|
20770
|
-
const { getRegistryBackend } = await import("./factory-
|
|
20812
|
+
const { getRegistryBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
20771
20813
|
const registryBackend = await getRegistryBackend();
|
|
20772
20814
|
const cwd = process.cwd();
|
|
20773
20815
|
const project = await registryBackend.findProjectByCwdPrefix(cwd);
|
|
@@ -21215,7 +21257,7 @@ async function cmdFind(query, opts) {
|
|
|
21215
21257
|
*/
|
|
21216
21258
|
async function getProjects(includeArchived) {
|
|
21217
21259
|
try {
|
|
21218
|
-
const { getRegistryBackend } = await import("./factory-
|
|
21260
|
+
const { getRegistryBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
21219
21261
|
const rows = await (await getRegistryBackend()).listProjectsWithSessionStats();
|
|
21220
21262
|
return includeArchived ? rows : rows.filter((p) => p.status === "active");
|
|
21221
21263
|
} catch {
|
|
@@ -21689,7 +21731,7 @@ async function cmdPick(opts = {}) {
|
|
|
21689
21731
|
const onRemove = async (rec) => {
|
|
21690
21732
|
if (!rec.slug) return false;
|
|
21691
21733
|
try {
|
|
21692
|
-
const { getRegistryBackend } = await import("./factory-
|
|
21734
|
+
const { getRegistryBackend } = await import("./factory-CrVlo2hY.mjs");
|
|
21693
21735
|
const registryBackend = await getRegistryBackend();
|
|
21694
21736
|
const project = await registryBackend.getProjectBySlug(rec.slug);
|
|
21695
21737
|
if (!project || project.status !== "active") return false;
|
|
@@ -21974,4 +22016,4 @@ claude() {
|
|
|
21974
22016
|
|
|
21975
22017
|
//#endregion
|
|
21976
22018
|
export { drainStdio as n, buildProgram as t };
|
|
21977
|
-
//# sourceMappingURL=program-
|
|
22019
|
+
//# sourceMappingURL=program-D3MSfx86.mjs.map
|