@tekmidian/pai 0.60.0 → 0.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chain-DFlzAfDE.mjs → chain-C5oeyUg4.mjs} +4 -4
- package/dist/{chain-DFlzAfDE.mjs.map → chain-C5oeyUg4.mjs.map} +1 -1
- package/dist/cli/index.mjs +12 -12
- package/dist/cli/program.mjs +12 -12
- package/dist/{config-msER8xj_.mjs → config-CQCmH_gV.mjs} +2 -1
- package/dist/config-CQCmH_gV.mjs.map +1 -0
- package/dist/{config-GceCMUxa.mjs → config-DjXq_W42.mjs} +1 -1
- package/dist/{context-handover-cache-DF0xWVB0.mjs → context-handover-cache-BdtJZpgv.mjs} +4 -4
- package/dist/{context-handover-cache-DF0xWVB0.mjs.map → context-handover-cache-BdtJZpgv.mjs.map} +1 -1
- package/dist/daemon/index.mjs +11 -11
- package/dist/{daemon-DArRKBlk.mjs → daemon-DSsIEqzW.mjs} +26 -19
- package/dist/{daemon-DArRKBlk.mjs.map → daemon-DSsIEqzW.mjs.map} +1 -1
- package/dist/daemon-MoFF4oeg.mjs +19 -0
- package/dist/daemon-mcp/index.mjs +9 -11
- package/dist/daemon-mcp/index.mjs.map +1 -1
- package/dist/{factory-D6I2jmjQ.mjs → factory-DW7BCJJT.mjs} +1 -1
- package/dist/{factory-ChfAvCzO.mjs → factory-EUUhSSoq.mjs} +5 -6
- package/dist/factory-EUUhSSoq.mjs.map +1 -0
- package/dist/{fallback-B7VEMMRn.mjs → fallback-DDbJVaR8.mjs} +12 -14
- package/dist/{fallback-B7VEMMRn.mjs.map → fallback-DDbJVaR8.mjs.map} +1 -1
- package/dist/hooks/block-sleep-poll.mjs.map +2 -2
- package/dist/hooks/context-compression-hook.mjs.map +1 -1
- package/dist/hooks/post-compact-inject.mjs.map +1 -1
- package/dist/hooks/route-agents-to-worker.mjs +5 -5
- package/dist/hooks/route-agents-to-worker.mjs.map +3 -3
- package/dist/hooks/security-validator.mjs +60 -60
- package/dist/hooks/security-validator.mjs.map +3 -3
- package/dist/hooks/stop-hook.mjs +15 -15
- package/dist/hooks/stop-hook.mjs.map +3 -3
- package/dist/hooks/update-tab-on-action.mjs +14 -12
- package/dist/hooks/update-tab-on-action.mjs.map +3 -3
- package/dist/hooks/update-tab-titles.mjs +13 -9
- package/dist/hooks/update-tab-titles.mjs.map +3 -3
- package/dist/hooks/whisper-rules.mjs +2 -2
- package/dist/hooks/whisper-rules.mjs.map +3 -3
- package/dist/hooks/worker-proxy.mjs +5 -5
- package/dist/hooks/worker-proxy.mjs.map +3 -3
- package/dist/hooks/worker-status-line.mjs +5 -5
- package/dist/hooks/worker-status-line.mjs.map +3 -3
- package/dist/hooks/worker-supervision.mjs +5 -5
- package/dist/hooks/worker-supervision.mjs.map +3 -3
- package/dist/main-resolver-CxOsxtOr.mjs +7 -0
- package/dist/{main-resolver-BqTjt-GL.mjs → main-resolver-DIQ6m_RA.mjs} +4 -4
- package/dist/{main-resolver-BqTjt-GL.mjs.map → main-resolver-DIQ6m_RA.mjs.map} +1 -1
- package/dist/{planner-DbpsMZqY.mjs → planner-D8jAr_sx.mjs} +7 -7
- package/dist/{planner-DbpsMZqY.mjs.map → planner-D8jAr_sx.mjs.map} +1 -1
- package/dist/{program-QSuci3RH.mjs → program-BTdspOOa.mjs} +131 -81
- package/dist/program-BTdspOOa.mjs.map +1 -0
- package/dist/{run-BFxuNnIJ.mjs → run-CxxZKEZw.mjs} +336 -174
- package/dist/run-CxxZKEZw.mjs.map +1 -0
- package/dist/{run-env-kbWVwUvU.mjs → run-env-BE5xyCwy.mjs} +26 -7
- package/dist/run-env-BE5xyCwy.mjs.map +1 -0
- package/dist/{server-B0vBmfJt.mjs → server-BY6AedmC.mjs} +2 -2
- package/dist/{server-B0vBmfJt.mjs.map → server-BY6AedmC.mjs.map} +1 -1
- package/dist/{session-keepalive-CUcFa8ld.mjs → session-keepalive-urk--pfa.mjs} +5 -5
- package/dist/{session-keepalive-CUcFa8ld.mjs.map → session-keepalive-urk--pfa.mjs.map} +1 -1
- package/dist/{tools-CaTZnIau.mjs → tools-qXyHFwNj.mjs} +2 -2
- package/dist/{tools-CaTZnIau.mjs.map → tools-qXyHFwNj.mjs.map} +1 -1
- package/dist/{tools-_7MF8Ebb.mjs → tools-r-7ZG8B5.mjs} +3 -3
- package/dist/{wakeup-CTX3rlz-.mjs → wakeup-C48hcN6O.mjs} +2 -2
- package/dist/{wakeup-CTX3rlz-.mjs.map → wakeup-C48hcN6O.mjs.map} +1 -1
- package/dist/work-queue-worker-1_VBfI_k.mjs +11 -0
- package/dist/{work-queue-worker-B4eZGy5n.mjs → work-queue-worker-DUvPiwGO.mjs} +2 -2
- package/dist/{work-queue-worker-B4eZGy5n.mjs.map → work-queue-worker-DUvPiwGO.mjs.map} +1 -1
- package/docs/commands/worker.md +1 -0
- package/package.json +1 -1
- package/src/hooks/ts/lib/tab-title.ts +18 -0
- package/src/hooks/ts/post-tool-use/update-tab-on-action.ts +3 -20
- package/src/hooks/ts/stop/stop-hook.ts +4 -15
- package/src/hooks/ts/user-prompt/update-tab-titles.ts +2 -10
- package/dist/config-msER8xj_.mjs.map +0 -1
- package/dist/daemon-BppwJtrH.mjs +0 -19
- package/dist/factory-ChfAvCzO.mjs.map +0 -1
- package/dist/main-resolver-CCojcYr2.mjs +0 -7
- package/dist/program-QSuci3RH.mjs.map +0 -1
- package/dist/run-BFxuNnIJ.mjs.map +0 -1
- package/dist/run-env-kbWVwUvU.mjs.map +0 -1
- package/dist/work-queue-worker-DuhZmfDB.mjs +0 -11
package/dist/daemon/index.mjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "../utils-C9HsYDpO.mjs";
|
|
3
3
|
import "../migrate-BD7D8EEh.mjs";
|
|
4
|
-
import "../factory-
|
|
5
|
-
import "../wakeup-
|
|
6
|
-
import "../context-handover-cache-
|
|
7
|
-
import { a as ensureConfigDir, s as loadConfig } from "../config-
|
|
8
|
-
import "../run-env-
|
|
9
|
-
import "../run-
|
|
4
|
+
import "../factory-EUUhSSoq.mjs";
|
|
5
|
+
import "../wakeup-C48hcN6O.mjs";
|
|
6
|
+
import "../context-handover-cache-BdtJZpgv.mjs";
|
|
7
|
+
import { a as ensureConfigDir, s as loadConfig } from "../config-CQCmH_gV.mjs";
|
|
8
|
+
import "../run-env-BE5xyCwy.mjs";
|
|
9
|
+
import "../run-CxxZKEZw.mjs";
|
|
10
10
|
import { t as PaiClient } from "../ipc-client-Dasm515c.mjs";
|
|
11
|
-
import "../server-
|
|
11
|
+
import "../server-BY6AedmC.mjs";
|
|
12
12
|
import "../state-n13uPK5B.mjs";
|
|
13
13
|
import "../aibroker-client-BK1h--W_.mjs";
|
|
14
|
-
import "../session-keepalive-
|
|
14
|
+
import "../session-keepalive-urk--pfa.mjs";
|
|
15
15
|
import "../embeddings-DfrYNIng.mjs";
|
|
16
|
-
import { t as serve } from "../daemon-
|
|
16
|
+
import { t as serve } from "../daemon-DSsIEqzW.mjs";
|
|
17
17
|
import "../router-DjFZIoDl.mjs";
|
|
18
|
-
import "../tools-
|
|
19
|
-
import "../work-queue-worker-
|
|
18
|
+
import "../tools-qXyHFwNj.mjs";
|
|
19
|
+
import "../work-queue-worker-DUvPiwGO.mjs";
|
|
20
20
|
import { Command } from "commander";
|
|
21
21
|
|
|
22
22
|
//#region src/daemon/index.ts
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { n as createRegistryBackend, o as getBackendOutage, r as createStorageBackend } from "./factory-
|
|
2
|
-
import { a as enqueue, c as loadQueue, o as getStats } from "./context-handover-cache-
|
|
3
|
-
import { S as DEFAULT_NOTIFICATION_CONFIG, d as readMainConfigRaw, f as writeMainConfigRaw } from "./config-
|
|
4
|
-
import {
|
|
5
|
-
import { I as isChatPane, M as alive, O as appendLedger, R as loadStatus, V as nowStamp, n as runWorker, v as itermForClaudeSession, z as loadStatuses } from "./run-
|
|
6
|
-
import { h as ledgerPath, m as eventsPath, v as workersLogDir } from "./server-
|
|
1
|
+
import { n as createRegistryBackend, o as getBackendOutage, r as createStorageBackend } from "./factory-EUUhSSoq.mjs";
|
|
2
|
+
import { a as enqueue, c as loadQueue, o as getStats } from "./context-handover-cache-BdtJZpgv.mjs";
|
|
3
|
+
import { S as DEFAULT_NOTIFICATION_CONFIG, d as readMainConfigRaw, f as writeMainConfigRaw } from "./config-CQCmH_gV.mjs";
|
|
4
|
+
import { E as readWorkersSection } from "./run-env-BE5xyCwy.mjs";
|
|
5
|
+
import { I as isChatPane, M as alive, O as appendLedger, R as loadStatus, V as nowStamp, n as runWorker, v as itermForClaudeSession, z as loadStatuses } from "./run-CxxZKEZw.mjs";
|
|
6
|
+
import { h as ledgerPath, m as eventsPath, v as workersLogDir } from "./server-BY6AedmC.mjs";
|
|
7
7
|
import { A as vaultIndexInProgress, C as setShutdownRequested, D as shutdownRequested, E as setVaultIndexInProgress, O as startTime, S as setRegistryBackend, T as setStorageBackend, _ as setIndexSchedulerTimer, a as indexInProgress, b as setLastVaultIndexTime, c as lastIndexTime, d as registryBackend, f as setCacheKeepaliveTimer, g as setIndexInProgress, h as setEmbedSchedulerTimer, i as embedSchedulerTimer, k as storageBackend, l as lastVaultIndexTime, m as setEmbedInProgress, n as daemonConfig, o as indexSchedulerTimer, p as setDaemonConfig, r as embedInProgress, s as lastEmbedTime, t as cacheKeepaliveTimer, u as notificationConfig, v as setLastEmbedTime, w as setStartTime, x as setNotificationConfig, y as setLastIndexTime } from "./state-n13uPK5B.mjs";
|
|
8
|
-
import { n as runSessionKeepaliveTick } from "./session-keepalive-
|
|
8
|
+
import { n as runSessionKeepaliveTick } from "./session-keepalive-urk--pfa.mjs";
|
|
9
9
|
import { t as configureEmbeddingModel } from "./embeddings-DfrYNIng.mjs";
|
|
10
10
|
import { t as routeNotification } from "./router-DjFZIoDl.mjs";
|
|
11
|
-
import { C as toolProjectInfo, D as toolMemoryGet, O as toolMemorySearch, S as toolProjectHealth, T as toolProjectTodo, a as toolMemoryWakeup, b as toolSessionRoute, i as toolMemoryTaxonomy, n as toolMemoryFeedback, t as toolMemoryKgSearch, v as toolRegistrySearch, w as toolProjectList, x as toolProjectDetect, y as toolSessionList } from "./tools-
|
|
11
|
+
import { C as toolProjectInfo, D as toolMemoryGet, O as toolMemorySearch, S as toolProjectHealth, T as toolProjectTodo, a as toolMemoryWakeup, b as toolSessionRoute, i as toolMemoryTaxonomy, n as toolMemoryFeedback, t as toolMemoryKgSearch, v as toolRegistrySearch, w as toolProjectList, x as toolProjectDetect, y as toolSessionList } from "./tools-qXyHFwNj.mjs";
|
|
12
12
|
import { t as detectTopicShift } from "./detector-3g7XuU1r.mjs";
|
|
13
|
-
import { i as stopWorker, n as notifyNewWork, r as startWorker } from "./work-queue-worker-
|
|
13
|
+
import { i as stopWorker, n as notifyNewWork, r as startWorker } from "./work-queue-worker-DUvPiwGO.mjs";
|
|
14
14
|
import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
15
15
|
import { setPriority } from "node:os";
|
|
16
16
|
import { dirname, join } from "node:path";
|
|
@@ -770,12 +770,12 @@ const REGISTRY_SCAN_STARTUP_DELAY_MS = 1e4;
|
|
|
770
770
|
function startRegistryScanScheduler() {
|
|
771
771
|
process.stderr.write("[pai-daemon] Registry scan scheduler: every 30min (first in 10s)\n");
|
|
772
772
|
setTimeout(() => {
|
|
773
|
-
import("./work-queue-worker-
|
|
773
|
+
import("./work-queue-worker-1_VBfI_k.mjs").then(({ enqueueRegistryScan }) => enqueueRegistryScan()).catch((e) => {
|
|
774
774
|
process.stderr.write(`[pai-daemon] Startup registry scan error: ${e}\n`);
|
|
775
775
|
});
|
|
776
776
|
}, REGISTRY_SCAN_STARTUP_DELAY_MS);
|
|
777
777
|
const timer = setInterval(() => {
|
|
778
|
-
import("./work-queue-worker-
|
|
778
|
+
import("./work-queue-worker-1_VBfI_k.mjs").then(({ enqueueRegistryScan }) => enqueueRegistryScan()).catch((e) => {
|
|
779
779
|
process.stderr.write(`[pai-daemon] Scheduled registry scan error: ${e}\n`);
|
|
780
780
|
});
|
|
781
781
|
}, REGISTRY_SCAN_INTERVAL_MS);
|
|
@@ -949,7 +949,7 @@ async function dispatchTool(method, params) {
|
|
|
949
949
|
case "zettel_themes":
|
|
950
950
|
case "zettel_god_notes":
|
|
951
951
|
case "zettel_communities": {
|
|
952
|
-
const { toolZettelExplore, toolZettelHealth, toolZettelSurprise, toolZettelSuggest, toolZettelConverse, toolZettelThemes, toolZettelGodNotes, toolZettelCommunities } = await import("./tools-
|
|
952
|
+
const { toolZettelExplore, toolZettelHealth, toolZettelSurprise, toolZettelSuggest, toolZettelConverse, toolZettelThemes, toolZettelGodNotes, toolZettelCommunities } = await import("./tools-r-7ZG8B5.mjs");
|
|
953
953
|
switch (method) {
|
|
954
954
|
case "zettel_explore": return toolZettelExplore(storageBackend, p);
|
|
955
955
|
case "zettel_health": return toolZettelHealth(storageBackend, p);
|
|
@@ -991,7 +991,7 @@ async function dispatchTool(method, params) {
|
|
|
991
991
|
case "kg_query":
|
|
992
992
|
case "kg_invalidate":
|
|
993
993
|
case "kg_contradictions": {
|
|
994
|
-
const { toolKgAdd, toolKgQuery, toolKgInvalidate, toolKgContradictions } = await import("./tools-
|
|
994
|
+
const { toolKgAdd, toolKgQuery, toolKgInvalidate, toolKgContradictions } = await import("./tools-r-7ZG8B5.mjs");
|
|
995
995
|
if (!storageBackend.supportsPostgresFeatures) throw new Error(`${method} requires a Postgres storage backend`);
|
|
996
996
|
switch (method) {
|
|
997
997
|
case "kg_add": return toolKgAdd(storageBackend, p);
|
|
@@ -1002,7 +1002,7 @@ async function dispatchTool(method, params) {
|
|
|
1002
1002
|
break;
|
|
1003
1003
|
}
|
|
1004
1004
|
case "memory_tunnels": {
|
|
1005
|
-
const { toolMemoryTunnels } = await import("./tools-
|
|
1005
|
+
const { toolMemoryTunnels } = await import("./tools-r-7ZG8B5.mjs");
|
|
1006
1006
|
return toolMemoryTunnels(registryBackend, storageBackend, p);
|
|
1007
1007
|
}
|
|
1008
1008
|
case "memory_feedback": return await toolMemoryFeedback(storageBackend, p);
|
|
@@ -1515,13 +1515,16 @@ async function handleRequest(request, socket) {
|
|
|
1515
1515
|
//#endregion
|
|
1516
1516
|
//#region src/storage/postgres/fts-migration.ts
|
|
1517
1517
|
const DONE_MARKER = "fts:simple";
|
|
1518
|
+
const PROGRESS_PREFIX = "fts:simple:inprogress:";
|
|
1518
1519
|
const BATCH_SIZE = 5e3;
|
|
1519
1520
|
async function migrateFtsConfig(backend) {
|
|
1520
1521
|
const pool = backend.getPool();
|
|
1521
1522
|
if ((await pool.query(`SELECT 1 FROM information_schema.tables WHERE table_name = 'pai_chunks'`)).rowCount === 0) return;
|
|
1522
|
-
|
|
1523
|
+
const comment = (await pool.query(`SELECT col_description('pai_chunks'::regclass, ordinal_position) AS comment
|
|
1523
1524
|
FROM information_schema.columns
|
|
1524
|
-
WHERE table_name = 'pai_chunks' AND column_name = 'fts_vector'`)).rows[0]?.comment
|
|
1525
|
+
WHERE table_name = 'pai_chunks' AND column_name = 'fts_vector'`)).rows[0]?.comment ?? null;
|
|
1526
|
+
if (comment === DONE_MARKER) return;
|
|
1527
|
+
const resumeId = comment?.startsWith(PROGRESS_PREFIX) ? comment.slice(22) : "";
|
|
1525
1528
|
process.stderr.write("[pai-postgres] FTS config migration: starting (english -> simple)\n");
|
|
1526
1529
|
if ((await pool.query(`SELECT 1 FROM pg_proc WHERE proname = 'pai_chunks_fts_update'`)).rowCount !== 0) {
|
|
1527
1530
|
await pool.query(`
|
|
@@ -1535,7 +1538,8 @@ async function migrateFtsConfig(backend) {
|
|
|
1535
1538
|
`);
|
|
1536
1539
|
process.stderr.write("[pai-postgres] FTS config migration: trigger function now uses 'simple'\n");
|
|
1537
1540
|
}
|
|
1538
|
-
let lastId = null;
|
|
1541
|
+
let lastId = resumeId || null;
|
|
1542
|
+
if (lastId !== null) process.stderr.write(`[pai-postgres] FTS config migration: resuming from ${lastId}\n`);
|
|
1539
1543
|
let totalUpdated = 0;
|
|
1540
1544
|
let batchN = 0;
|
|
1541
1545
|
while (true) {
|
|
@@ -1549,7 +1553,10 @@ async function migrateFtsConfig(backend) {
|
|
|
1549
1553
|
totalUpdated += ids.length;
|
|
1550
1554
|
lastId = ids[ids.length - 1];
|
|
1551
1555
|
batchN++;
|
|
1552
|
-
if (batchN % 20 === 0)
|
|
1556
|
+
if (batchN % 20 === 0) {
|
|
1557
|
+
await pool.query(`COMMENT ON COLUMN pai_chunks.fts_vector IS '${PROGRESS_PREFIX}${lastId.replace(/'/g, "''")}'`);
|
|
1558
|
+
process.stderr.write(`[pai-postgres] FTS config migration: ${totalUpdated} chunks rebuilt so far...\n`);
|
|
1559
|
+
}
|
|
1553
1560
|
if (idRows.rows.length < BATCH_SIZE) break;
|
|
1554
1561
|
}
|
|
1555
1562
|
await pool.query(`COMMENT ON COLUMN pai_chunks.fts_vector IS '${DONE_MARKER}'`);
|
|
@@ -1716,4 +1723,4 @@ async function serve(config) {
|
|
|
1716
1723
|
|
|
1717
1724
|
//#endregion
|
|
1718
1725
|
export { serve as t };
|
|
1719
|
-
//# sourceMappingURL=daemon-
|
|
1726
|
+
//# sourceMappingURL=daemon-DSsIEqzW.mjs.map
|