@tekmidian/pai 0.66.3 → 0.66.4
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-Fz4NLm4D.mjs → chain-BhPwBDXB.mjs} +2 -2
- package/dist/{chain-Fz4NLm4D.mjs.map → chain-BhPwBDXB.mjs.map} +1 -1
- package/dist/cli/index.mjs +8 -8
- package/dist/cli/program.mjs +8 -8
- package/dist/{context-handover-cache-DcPEW6vf.mjs → context-handover-cache-BbCYQUGo.mjs} +3 -3
- package/dist/{context-handover-cache-DcPEW6vf.mjs.map → context-handover-cache-BbCYQUGo.mjs.map} +1 -1
- package/dist/daemon/index.mjs +5 -5
- package/dist/{daemon-Bl8TpHdM.mjs → daemon-DzXOfieK.mjs} +5 -5
- package/dist/{daemon-Bl8TpHdM.mjs.map → daemon-DzXOfieK.mjs.map} +1 -1
- package/dist/{daemon-ZhHU6D0i.mjs → daemon-UJtRscyO.mjs} +5 -5
- package/dist/daemon-mcp/index.mjs +5 -5
- package/dist/{factory-BUnZgnKW.mjs → factory-CXFHwvcv.mjs} +2 -2
- package/dist/{factory-BUnZgnKW.mjs.map → factory-CXFHwvcv.mjs.map} +1 -1
- package/dist/{factory-CrVlo2hY.mjs → factory-CnKsU6zX.mjs} +2 -2
- package/dist/{fallback-awOmq_9A.mjs → fallback-CoooFqyA.mjs} +2 -2
- package/dist/{fallback-awOmq_9A.mjs.map → fallback-CoooFqyA.mjs.map} +1 -1
- package/dist/hooks/load-project-context.mjs.map +2 -2
- package/dist/hooks/security-validator.mjs.map +2 -2
- package/dist/hooks/worker-status-line.mjs.map +2 -2
- package/dist/{main-resolver-DDShdDBm.mjs → main-resolver-DrHtx8iW.mjs} +1 -1
- package/dist/{main-resolver-CVGPICy-.mjs → main-resolver-SfGGg1DB.mjs} +3 -3
- package/dist/{main-resolver-CVGPICy-.mjs.map → main-resolver-SfGGg1DB.mjs.map} +1 -1
- package/dist/{planner-GdiYe2FO.mjs → planner-C43lzcw5.mjs} +5 -5
- package/dist/{planner-GdiYe2FO.mjs.map → planner-C43lzcw5.mjs.map} +1 -1
- package/dist/postgres-B2BEBT-J.mjs +5 -0
- package/dist/{postgres-H85VSYHI.mjs → postgres-BxmyQHoA.mjs} +52 -4
- package/dist/postgres-BxmyQHoA.mjs.map +1 -0
- package/dist/{program-D3MSfx86.mjs → program-DB-hoyfW.mjs} +38 -121
- package/dist/program-DB-hoyfW.mjs.map +1 -0
- package/dist/{run-D9YbWsnL.mjs → run-wi5NEkJd.mjs} +116 -7
- package/dist/run-wi5NEkJd.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/postgres-DKyiCA5V.mjs +0 -5
- package/dist/postgres-H85VSYHI.mjs.map +0 -1
- package/dist/program-D3MSfx86.mjs.map +0 -1
- package/dist/run-D9YbWsnL.mjs.map +0 -1
|
@@ -3,20 +3,20 @@ import { a as slugify$1, i as parseSessionFilename } from "./migrate-Bq0esMOa.mj
|
|
|
3
3
|
import { n as ensurePaiMarker } from "./pai-marker-DXVpFsYz.mjs";
|
|
4
4
|
import { t as STOP_WORDS } from "./stop-words-DtxaTWU_.mjs";
|
|
5
5
|
import { t as applyRecencyBoost } from "./search-CNAGTiJP.mjs";
|
|
6
|
-
import {
|
|
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-
|
|
6
|
+
import { c as resolveFromModule, i as retryTransient, n as embedChunksWithBackend, r as indexProjectWithBackend, s as packageRoot } from "./postgres-BxmyQHoA.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-CXFHwvcv.mjs";
|
|
8
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
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
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-
|
|
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-BbCYQUGo.mjs";
|
|
12
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
|
|
13
|
+
import { $ as setWorkerLabel, F as pendingGate, G as isChatPane, I as pendingResults, J as loadStatuses, K as isLive, L as appendLedger, M as verifyWorker, O as discardWorker, P as formatPending, Q as saveStatus, Z as ownsPid, _ as markControlsHeld, _t as describeMcp, at as ensureProxyRunning, b as requestKill, c as handoffFromInside, dt as ensureNoMcpConfig, et as waitForTerminalStatus, f as checkPaneForWorker, ft as eventsPath, g as clickrControlsArgv, gt as projectLaunchConfig, h as openPaneForWorker, ht as pinNotices, i as usageContextTokens, it as DEFAULT_PROXY_PORT, j as mergeWorker, k as gcWorktrees, m as openFollowPane, mt as workersLogDir, n as runWorker, nt as parseRunnerArgs, o as parseWorkerReport, ot as stopProxy, p as closeEndedPanes, pt as ledgerPath, q as loadStatus, r as testProvider, tt as longInlinePromptHint, u as sayToWorker, v as callerDescription, vt as expandMcpNames, z as UNLABELED } from "./run-wi5NEkJd.mjs";
|
|
14
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-
|
|
16
|
-
import { _ as resolveSessionByNameOrId, a as buildDeduped, c as hasConversation, d as providerResumePlan, f as restoreTopLevel, g as migrateSessionScanCache, h as fmtAge
|
|
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-CoooFqyA.mjs";
|
|
16
|
+
import { _ as resolveSessionByNameOrId, a as buildDeduped, c as hasConversation, d as providerResumePlan, f as restoreTopLevel, g as migrateSessionScanCache, h as fmtAge, 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-SfGGg1DB.mjs";
|
|
17
17
|
import { n as queriesDirPath, t as migrateQueriesDir } from "./query-feedback-BPdapXKd.mjs";
|
|
18
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-
|
|
19
|
+
import { t as runChain } from "./chain-BhPwBDXB.mjs";
|
|
20
20
|
import { appendFileSync, chmodSync, closeSync, copyFileSync, cpSync, createReadStream, existsSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, statSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
|
|
21
21
|
import { homedir, platform, tmpdir, userInfo } from "node:os";
|
|
22
22
|
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
@@ -155,7 +155,7 @@ async function cmdPromote(opts) {
|
|
|
155
155
|
console.error(dim$1(` Pick a durable location for the new project.`));
|
|
156
156
|
process.exit(1);
|
|
157
157
|
}
|
|
158
|
-
const { getRegistryBackend } = await import("./factory-
|
|
158
|
+
const { getRegistryBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
159
159
|
const registryBackend = await getRegistryBackend();
|
|
160
160
|
const encodedDir = encodeDir(targetPath);
|
|
161
161
|
if (await registryBackend.getProjectBySlug(slug) ?? await registryBackend.getProjectByRootPath(targetPath) ?? await registryBackend.getProjectByEncodedDir(encodedDir)) {
|
|
@@ -2039,7 +2039,7 @@ async function cmdUnregister(slug, opts = {}) {
|
|
|
2039
2039
|
//#region src/cli/commands/project/projects-index.ts
|
|
2040
2040
|
function registerProjectsCommands(projectsCmd) {
|
|
2041
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) => {
|
|
2042
|
-
const { cmdMain } = await import("./main-resolver-
|
|
2042
|
+
const { cmdMain } = await import("./main-resolver-DrHtx8iW.mjs");
|
|
2043
2043
|
await cmdMain(void 0, void 0, opts);
|
|
2044
2044
|
});
|
|
2045
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) => {
|
|
@@ -2910,12 +2910,12 @@ async function runEmbed(backend, projectId, projectSlug, batchSize = 50, pageSiz
|
|
|
2910
2910
|
let done = 0;
|
|
2911
2911
|
let after = null;
|
|
2912
2912
|
while (true) {
|
|
2913
|
-
const page = await backend.getUnembeddedChunkIds(projectId, pageSize, after);
|
|
2913
|
+
const page = await retryTransient(() => backend.getUnembeddedChunkIds(projectId, pageSize, after));
|
|
2914
2914
|
if (page.length === 0) break;
|
|
2915
2915
|
for (let i = 0; i < page.length; i += batchSize) {
|
|
2916
2916
|
const batch = page.slice(i, i + batchSize);
|
|
2917
2917
|
const vecs = await generateEmbeddings(batch.map((r) => r.text));
|
|
2918
|
-
await Promise.all(batch.map((row, j) => backend.updateEmbedding(row.id, serializeEmbedding(vecs[j]))));
|
|
2918
|
+
await Promise.all(batch.map((row, j) => retryTransient(() => backend.updateEmbedding(row.id, serializeEmbedding(vecs[j])))));
|
|
2919
2919
|
done += batch.length;
|
|
2920
2920
|
process.stdout.write(`\r ${done} / ~${totalEstimate} chunks embedded...`);
|
|
2921
2921
|
}
|
|
@@ -3259,7 +3259,7 @@ function registerStatsCommands(memoryCmd) {
|
|
|
3259
3259
|
//#region src/cli/commands/memory/sources-cmd.ts
|
|
3260
3260
|
function registerSourcesCommand(memoryCmd) {
|
|
3261
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) => {
|
|
3262
|
-
const { createStorageBackend } = await import("./factory-
|
|
3262
|
+
const { createStorageBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
3263
3263
|
const { loadConfig } = await import("./config-CnsDMETf.mjs");
|
|
3264
3264
|
const { cmdMemorySources } = await import("./sources-CM2g-CLT.mjs");
|
|
3265
3265
|
let backend;
|
|
@@ -7132,7 +7132,7 @@ function cmdLogs(opts) {
|
|
|
7132
7132
|
}
|
|
7133
7133
|
function registerDaemonCommands(daemonCmd) {
|
|
7134
7134
|
daemonCmd.command("serve").description("Start the PAI daemon in the foreground").action(async () => {
|
|
7135
|
-
const { serve } = await import("./daemon-
|
|
7135
|
+
const { serve } = await import("./daemon-UJtRscyO.mjs");
|
|
7136
7136
|
const { loadConfig: lc, ensureConfigDir } = await import("./config-CnsDMETf.mjs");
|
|
7137
7137
|
ensureConfigDir();
|
|
7138
7138
|
await serve(lc());
|
|
@@ -16138,7 +16138,7 @@ async function migrateToPostgres(opts = {}) {
|
|
|
16138
16138
|
const dump = pgDump(container, pgConfig, dumpPath);
|
|
16139
16139
|
if (!dump.ok) return refused(dump.reason, dryRun);
|
|
16140
16140
|
}
|
|
16141
|
-
const { PostgresBackend } = await import("./postgres-
|
|
16141
|
+
const { PostgresBackend } = await import("./postgres-B2BEBT-J.mjs");
|
|
16142
16142
|
await PostgresBackend.ensureDatabase(pgConfig);
|
|
16143
16143
|
const sqlite = new BetterSqlite3(sqliteFederationPath, { readonly: true });
|
|
16144
16144
|
const registrySqlite = sqliteRegistryPath === sqliteFederationPath ? sqlite : new BetterSqlite3(sqliteRegistryPath, { readonly: true });
|
|
@@ -16709,7 +16709,7 @@ async function getSessionTags(registryBackend, sessionId) {
|
|
|
16709
16709
|
* Session CRUD commands: list, info, rename, slug, tag, route, active, auto-route.
|
|
16710
16710
|
*/
|
|
16711
16711
|
async function cmdList(projectSlug, opts) {
|
|
16712
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16712
|
+
const { getRegistryBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
16713
16713
|
const registryBackend = await getRegistryBackend();
|
|
16714
16714
|
const limit = parseInt(opts.limit ?? "20", 10);
|
|
16715
16715
|
let project;
|
|
@@ -16774,7 +16774,7 @@ async function cmdList(projectSlug, opts) {
|
|
|
16774
16774
|
console.log(dim$1(` ${rows.length} session(s) shown (limit: ${limit})`));
|
|
16775
16775
|
}
|
|
16776
16776
|
async function cmdInfo(projectSlug, sessionNumber) {
|
|
16777
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16777
|
+
const { getRegistryBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
16778
16778
|
const registryBackend = await getRegistryBackend();
|
|
16779
16779
|
const project = await getProject$1(registryBackend, projectSlug);
|
|
16780
16780
|
if (!project) {
|
|
@@ -16798,7 +16798,7 @@ async function cmdInfo(projectSlug, sessionNumber) {
|
|
|
16798
16798
|
console.log();
|
|
16799
16799
|
}
|
|
16800
16800
|
async function cmdRename(projectSlug, numberOrLatest, newSlug) {
|
|
16801
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16801
|
+
const { getRegistryBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
16802
16802
|
await cmdRenameWith(await getRegistryBackend(), projectSlug, numberOrLatest, newSlug);
|
|
16803
16803
|
}
|
|
16804
16804
|
async function cmdRenameWith(registryBackend, projectSlug, numberOrLatest, newSlug) {
|
|
@@ -16861,7 +16861,7 @@ async function cmdRenameWith(registryBackend, projectSlug, numberOrLatest, newSl
|
|
|
16861
16861
|
console.log();
|
|
16862
16862
|
}
|
|
16863
16863
|
async function cmdSlug(projectSlug, numberOrLatest, opts) {
|
|
16864
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16864
|
+
const { getRegistryBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
16865
16865
|
const registryBackend = await getRegistryBackend();
|
|
16866
16866
|
const project = await getProject$1(registryBackend, projectSlug);
|
|
16867
16867
|
if (!project) {
|
|
@@ -16891,7 +16891,7 @@ async function cmdSlug(projectSlug, numberOrLatest, opts) {
|
|
|
16891
16891
|
}
|
|
16892
16892
|
}
|
|
16893
16893
|
async function cmdTag(projectSlug, sessionNumber, rawTags) {
|
|
16894
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16894
|
+
const { getRegistryBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
16895
16895
|
const registryBackend = await getRegistryBackend();
|
|
16896
16896
|
const project = await getProject$1(registryBackend, projectSlug);
|
|
16897
16897
|
if (!project) {
|
|
@@ -16931,7 +16931,7 @@ async function cmdTag(projectSlug, sessionNumber, rawTags) {
|
|
|
16931
16931
|
console.log();
|
|
16932
16932
|
}
|
|
16933
16933
|
async function cmdRoute(projectSlug, sessionNumber, targetProjectSlug, opts) {
|
|
16934
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16934
|
+
const { getRegistryBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
16935
16935
|
const registryBackend = await getRegistryBackend();
|
|
16936
16936
|
const project = await getProject$1(registryBackend, projectSlug);
|
|
16937
16937
|
if (!project) {
|
|
@@ -16973,7 +16973,7 @@ async function cmdRoute(projectSlug, sessionNumber, targetProjectSlug, opts) {
|
|
|
16973
16973
|
console.log();
|
|
16974
16974
|
}
|
|
16975
16975
|
async function cmdActive(opts) {
|
|
16976
|
-
const { getRegistryBackend } = await import("./factory-
|
|
16976
|
+
const { getRegistryBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
16977
16977
|
const registryBackend = await getRegistryBackend();
|
|
16978
16978
|
const minutes = parseInt(opts.minutes ?? "60", 10);
|
|
16979
16979
|
const cutoff = Date.now() - minutes * 60 * 1e3;
|
|
@@ -17061,7 +17061,7 @@ async function cmdActive(opts) {
|
|
|
17061
17061
|
}
|
|
17062
17062
|
async function cmdAutoRoute(opts) {
|
|
17063
17063
|
const { autoRoute, formatAutoRouteJson } = await import("./auto-route-D6fW1Q8z.mjs");
|
|
17064
|
-
const { getRegistryBackend, createStorageBackend } = await import("./factory-
|
|
17064
|
+
const { getRegistryBackend, createStorageBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
17065
17065
|
const { loadConfig } = await import("./config-CnsDMETf.mjs");
|
|
17066
17066
|
const config = loadConfig();
|
|
17067
17067
|
const registryBackend = await getRegistryBackend();
|
|
@@ -17298,7 +17298,7 @@ async function cmdPause(opts) {
|
|
|
17298
17298
|
process.exitCode = 1;
|
|
17299
17299
|
return;
|
|
17300
17300
|
}
|
|
17301
|
-
const { getRegistryBackend } = await import("./factory-
|
|
17301
|
+
const { getRegistryBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
17302
17302
|
const registryBackend = await getRegistryBackend();
|
|
17303
17303
|
const cwd = process.cwd();
|
|
17304
17304
|
const project = await resolveProjectByCwd(registryBackend, cwd);
|
|
@@ -17693,7 +17693,7 @@ function buildStopBody(project, sessionId) {
|
|
|
17693
17693
|
}
|
|
17694
17694
|
}
|
|
17695
17695
|
async function cmdHandover(projectSlug, numberOrLatest, sessionId) {
|
|
17696
|
-
const { getRegistryBackend } = await import("./factory-
|
|
17696
|
+
const { getRegistryBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
17697
17697
|
const registryBackend = await getRegistryBackend();
|
|
17698
17698
|
let project;
|
|
17699
17699
|
if (projectSlug) {
|
|
@@ -17989,7 +17989,7 @@ function touchSentinel(rootPath) {
|
|
|
17989
17989
|
async function cmdAutosave(opts) {
|
|
17990
17990
|
const minGap = parseInt(opts.minGap ?? String(DEFAULT_MIN_GAP), 10);
|
|
17991
17991
|
const cwd = process.cwd();
|
|
17992
|
-
const { getRegistryBackend } = await import("./factory-
|
|
17992
|
+
const { getRegistryBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
17993
17993
|
const registryBackend = await getRegistryBackend();
|
|
17994
17994
|
const project = await resolveProjectByCwd(registryBackend, cwd);
|
|
17995
17995
|
if (!project) return;
|
|
@@ -18114,7 +18114,7 @@ async function cmdRecent(opts) {
|
|
|
18114
18114
|
shortId: s.shortId,
|
|
18115
18115
|
resumable: s.resumable,
|
|
18116
18116
|
sessionStatus: s.sessionStatus,
|
|
18117
|
-
age: fmtAge
|
|
18117
|
+
age: fmtAge(s.mtime),
|
|
18118
18118
|
mtime: s.mtime,
|
|
18119
18119
|
name: s.friendlyName,
|
|
18120
18120
|
lastUserPrompt: s.lastUserPrompt,
|
|
@@ -18152,7 +18152,7 @@ async function cmdRecent(opts) {
|
|
|
18152
18152
|
return [
|
|
18153
18153
|
chalk.dim(String(idx + 1)),
|
|
18154
18154
|
chalk.cyan(s.shortId),
|
|
18155
|
-
dim$1(fmtAge
|
|
18155
|
+
dim$1(fmtAge(s.mtime)),
|
|
18156
18156
|
name.length > 26 ? name.slice(0, 25) + "…" : name,
|
|
18157
18157
|
prompt,
|
|
18158
18158
|
s.userLines > 0 ? String(s.userLines) : dim$1("—"),
|
|
@@ -18252,7 +18252,7 @@ async function cmdGoto(query, opts) {
|
|
|
18252
18252
|
console.log(` fallback: ${chalk.yellow(argvFresh)}`);
|
|
18253
18253
|
if (resumableSession) {
|
|
18254
18254
|
console.log(`\n uuid: ${resumableSession.uuid}`);
|
|
18255
|
-
console.log(` age: ${fmtAge
|
|
18255
|
+
console.log(` age: ${fmtAge(resumableSession.mtime)}`);
|
|
18256
18256
|
console.log(` status: ${resumableSession.sessionStatus}`);
|
|
18257
18257
|
console.log(` sys: ${resumableSession.topLevelSystemLines} system lines`);
|
|
18258
18258
|
}
|
|
@@ -19062,89 +19062,6 @@ function registerWorkerConfigCommands(workerCmd) {
|
|
|
19062
19062
|
});
|
|
19063
19063
|
}
|
|
19064
19064
|
|
|
19065
|
-
//#endregion
|
|
19066
|
-
//#region src/workers/pending.ts
|
|
19067
|
-
/**
|
|
19068
|
-
* Pending worker results: finished workers whose worktree branch still holds
|
|
19069
|
-
* work that never reached the repo (commits not in HEAD, or uncommitted
|
|
19070
|
-
* files). Surfaced by `pai worker ps/pending`, the SessionStart hook, the
|
|
19071
|
-
* status line and the prepublish gate so an unmerged fix cannot be forgotten.
|
|
19072
|
-
*/
|
|
19073
|
-
/** Stale after this long: `pai worker gc` (archive) instead of merge. */
|
|
19074
|
-
const STALE_HOURS = 24;
|
|
19075
|
-
function toplevel(dir) {
|
|
19076
|
-
try {
|
|
19077
|
-
return git(dir, ["rev-parse", "--show-toplevel"]);
|
|
19078
|
-
} catch {
|
|
19079
|
-
return null;
|
|
19080
|
-
}
|
|
19081
|
-
}
|
|
19082
|
-
function fmtAge(ms) {
|
|
19083
|
-
const h = Math.floor(ms / 36e5);
|
|
19084
|
-
return h >= 48 ? `${Math.floor(h / 24)}d` : h >= 1 ? `${h}h` : `${Math.floor(ms / 6e4)}m`;
|
|
19085
|
-
}
|
|
19086
|
-
/** Finished workers with unmerged work; `repoRoot` limits to one repo, else every repo. */
|
|
19087
|
-
function pendingResults(logDir, repoRoot, now = Date.now()) {
|
|
19088
|
-
const want = repoRoot ? toplevel(repoRoot) : null;
|
|
19089
|
-
if (repoRoot && !want) return [];
|
|
19090
|
-
const out = [];
|
|
19091
|
-
for (const st of loadStatuses(logDir)) {
|
|
19092
|
-
if (st.archived || st.merged || isLive(st)) continue;
|
|
19093
|
-
if (!st.worktreeDir || !existsSync(st.worktreeDir)) continue;
|
|
19094
|
-
const repo = toplevel(st.cwd);
|
|
19095
|
-
if (!repo || want && repo !== want) continue;
|
|
19096
|
-
let commits = 0;
|
|
19097
|
-
let dirty = 0;
|
|
19098
|
-
try {
|
|
19099
|
-
if (st.branch) commits = git(repo, [
|
|
19100
|
-
"cherry",
|
|
19101
|
-
"HEAD",
|
|
19102
|
-
`refs/heads/${st.branch}`
|
|
19103
|
-
]).split("\n").filter((l) => l.startsWith("+")).length;
|
|
19104
|
-
dirty = uncommittedPaths(st.worktreeDir).filter((p) => !/(^|\/)node_modules(\/|$)/.test(p)).length;
|
|
19105
|
-
} catch {
|
|
19106
|
-
continue;
|
|
19107
|
-
}
|
|
19108
|
-
if (!commits && !dirty) continue;
|
|
19109
|
-
let ageMs = 0;
|
|
19110
|
-
try {
|
|
19111
|
-
ageMs = Math.max(0, now - statSync(statusPath(logDir, st.id)).mtimeMs);
|
|
19112
|
-
} catch {}
|
|
19113
|
-
out.push({
|
|
19114
|
-
id: st.id,
|
|
19115
|
-
label: st.label,
|
|
19116
|
-
repo,
|
|
19117
|
-
ageMs,
|
|
19118
|
-
age: fmtAge(ageMs),
|
|
19119
|
-
commits,
|
|
19120
|
-
dirty
|
|
19121
|
-
});
|
|
19122
|
-
}
|
|
19123
|
-
return out;
|
|
19124
|
-
}
|
|
19125
|
-
/** One human line per result, with the exact next command. */
|
|
19126
|
-
function formatPending(results, showRepo = false) {
|
|
19127
|
-
return results.map((r) => {
|
|
19128
|
-
const next = r.ageMs > STALE_HOURS * 36e5 ? "pai worker gc" : `pai worker merge ${r.id}`;
|
|
19129
|
-
const repo = showRepo ? ` ${r.repo}` : "";
|
|
19130
|
-
return `${r.id} ${r.age} ${r.commits} commit(s), ${r.dirty} dirty ${r.label}${repo} -> ${next}`;
|
|
19131
|
-
}).join("\n");
|
|
19132
|
-
}
|
|
19133
|
-
/**
|
|
19134
|
-
* Release gate: exit code and message for `pai worker pending --gate`.
|
|
19135
|
-
* PAI_ALLOW_PENDING=1 overrides.
|
|
19136
|
-
*/
|
|
19137
|
-
function pendingGate(results, env = process.env) {
|
|
19138
|
-
if (!results.length || env.PAI_ALLOW_PENDING === "1") return {
|
|
19139
|
-
code: 0,
|
|
19140
|
-
message: ""
|
|
19141
|
-
};
|
|
19142
|
-
return {
|
|
19143
|
-
code: 1,
|
|
19144
|
-
message: `${results.length} unmerged worker result(s) in this repo — merge or discard before publishing:\n${formatPending(results)}\nOverride deliberately with PAI_ALLOW_PENDING=1.`
|
|
19145
|
-
};
|
|
19146
|
-
}
|
|
19147
|
-
|
|
19148
19065
|
//#endregion
|
|
19149
19066
|
//#region src/workers/wait.ts
|
|
19150
19067
|
/**
|
|
@@ -20437,7 +20354,7 @@ async function countVectorDbPaths(oldPaths) {
|
|
|
20437
20354
|
if (oldPaths.length === 0) return 0;
|
|
20438
20355
|
try {
|
|
20439
20356
|
const { loadConfig } = await import("./config-CnsDMETf.mjs");
|
|
20440
|
-
const { createStorageBackend } = await import("./factory-
|
|
20357
|
+
const { createStorageBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
20441
20358
|
const config = loadConfig();
|
|
20442
20359
|
if (config.storageBackend !== "postgres") return 0;
|
|
20443
20360
|
const backend = await createStorageBackend(config);
|
|
@@ -20455,7 +20372,7 @@ async function updateVectorDbPaths(moves) {
|
|
|
20455
20372
|
if (moves.length === 0) return 0;
|
|
20456
20373
|
try {
|
|
20457
20374
|
const { loadConfig } = await import("./config-CnsDMETf.mjs");
|
|
20458
|
-
const { createStorageBackend } = await import("./factory-
|
|
20375
|
+
const { createStorageBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
20459
20376
|
const config = loadConfig();
|
|
20460
20377
|
if (config.storageBackend !== "postgres") return 0;
|
|
20461
20378
|
const backend = await createStorageBackend(config);
|
|
@@ -20542,7 +20459,7 @@ async function displayDryRun(plans) {
|
|
|
20542
20459
|
console.log();
|
|
20543
20460
|
}
|
|
20544
20461
|
async function executeCleanup(plans, skipReindex) {
|
|
20545
|
-
const { getRegistryBackend } = await import("./factory-
|
|
20462
|
+
const { getRegistryBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
20546
20463
|
const registryBackend = await getRegistryBackend();
|
|
20547
20464
|
let deleted = 0;
|
|
20548
20465
|
let renamed = 0;
|
|
@@ -20739,7 +20656,7 @@ async function executeCleanup(plans, skipReindex) {
|
|
|
20739
20656
|
//#region src/cli/commands/session-cleanup/index.ts
|
|
20740
20657
|
function registerSessionCleanupCommand(sessionCmd) {
|
|
20741
20658
|
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) => {
|
|
20742
|
-
const { getRegistryBackend } = await import("./factory-
|
|
20659
|
+
const { getRegistryBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
20743
20660
|
const registryBackend = await getRegistryBackend();
|
|
20744
20661
|
const dryRun = !opts.execute;
|
|
20745
20662
|
const skipReindex = opts.reindex === false;
|
|
@@ -20809,7 +20726,7 @@ function finalizeNote(notePath) {
|
|
|
20809
20726
|
}
|
|
20810
20727
|
async function cmdEnd(opts) {
|
|
20811
20728
|
await cmdPause(opts);
|
|
20812
|
-
const { getRegistryBackend } = await import("./factory-
|
|
20729
|
+
const { getRegistryBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
20813
20730
|
const registryBackend = await getRegistryBackend();
|
|
20814
20731
|
const cwd = process.cwd();
|
|
20815
20732
|
const project = await registryBackend.findProjectByCwdPrefix(cwd);
|
|
@@ -21257,7 +21174,7 @@ async function cmdFind(query, opts) {
|
|
|
21257
21174
|
*/
|
|
21258
21175
|
async function getProjects(includeArchived) {
|
|
21259
21176
|
try {
|
|
21260
|
-
const { getRegistryBackend } = await import("./factory-
|
|
21177
|
+
const { getRegistryBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
21261
21178
|
const rows = await (await getRegistryBackend()).listProjectsWithSessionStats();
|
|
21262
21179
|
return includeArchived ? rows : rows.filter((p) => p.status === "active");
|
|
21263
21180
|
} catch {
|
|
@@ -21398,7 +21315,7 @@ function buildFeedFrom(allSessions, projects, liveSessions, allProjects) {
|
|
|
21398
21315
|
const tag = tagFor(e.status);
|
|
21399
21316
|
const name = chalk.white(pad(e.name, 22));
|
|
21400
21317
|
const where = dir ? dim$1(shorten(dir, 40)) : chalk.green("(running in another tab)");
|
|
21401
|
-
const age = e.status === "live" ? chalk.green("now") : e.lastActivity > 0 ? dim$1(fmtAge
|
|
21318
|
+
const age = e.status === "live" ? chalk.green("now") : e.lastActivity > 0 ? dim$1(fmtAge(e.lastActivity)) : dim$1("—");
|
|
21402
21319
|
const kwDisp = kw ? dim$1(" " + kw) : "";
|
|
21403
21320
|
const display = `${tag} ${name} ${pad(age, 5)} ${where}${kwDisp}`;
|
|
21404
21321
|
const search = `${e.name} ${dir ?? ""} ${kw}`.toLowerCase();
|
|
@@ -21464,7 +21381,7 @@ function contextFor(rec) {
|
|
|
21464
21381
|
const notes = recentMarkdown(rec.dir, 4);
|
|
21465
21382
|
if (notes.length) {
|
|
21466
21383
|
lines.push(dim$1("recent notes:"));
|
|
21467
|
-
for (const n of notes) lines.push(" " + dim$1(n.rel.slice(0, 60)) + " " + dim$1(fmtAge
|
|
21384
|
+
for (const n of notes) lines.push(" " + dim$1(n.rel.slice(0, 60)) + " " + dim$1(fmtAge(n.mtime)));
|
|
21468
21385
|
} else lines.push(dim$1("(no notes here yet)"));
|
|
21469
21386
|
ctxCache.set(rec.dir, lines);
|
|
21470
21387
|
return lines;
|
|
@@ -21731,7 +21648,7 @@ async function cmdPick(opts = {}) {
|
|
|
21731
21648
|
const onRemove = async (rec) => {
|
|
21732
21649
|
if (!rec.slug) return false;
|
|
21733
21650
|
try {
|
|
21734
|
-
const { getRegistryBackend } = await import("./factory-
|
|
21651
|
+
const { getRegistryBackend } = await import("./factory-CnKsU6zX.mjs");
|
|
21735
21652
|
const registryBackend = await getRegistryBackend();
|
|
21736
21653
|
const project = await registryBackend.getProjectBySlug(rec.slug);
|
|
21737
21654
|
if (!project || project.status !== "active") return false;
|
|
@@ -22016,4 +21933,4 @@ claude() {
|
|
|
22016
21933
|
|
|
22017
21934
|
//#endregion
|
|
22018
21935
|
export { drainStdio as n, buildProgram as t };
|
|
22019
|
-
//# sourceMappingURL=program-
|
|
21936
|
+
//# sourceMappingURL=program-DB-hoyfW.mjs.map
|