@tekmidian/pai 0.33.1 → 0.33.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/cli/index.mjs +2 -2
- package/dist/cli/program.mjs +2 -2
- package/dist/{main-resolver-qIjvdJsb.mjs → main-resolver-CNSqU8wo.mjs} +65 -25
- package/dist/{main-resolver-qIjvdJsb.mjs.map → main-resolver-CNSqU8wo.mjs.map} +1 -1
- package/dist/{pick-CX1A7ffC.mjs → pick-bRiW6Dkp.mjs} +3 -3
- package/dist/{pick-CX1A7ffC.mjs.map → pick-bRiW6Dkp.mjs.map} +1 -1
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -7,13 +7,13 @@ import "../helpers-crDEr6S2.mjs";
|
|
|
7
7
|
import "../sync--BoxBBok.mjs";
|
|
8
8
|
import "../embeddings-Bn86ssxR.mjs";
|
|
9
9
|
import "../search-C32zQ0V0.mjs";
|
|
10
|
-
import "../pick-
|
|
10
|
+
import "../pick-bRiW6Dkp.mjs";
|
|
11
11
|
import "../checkpoint-block-D3rm4dAJ.mjs";
|
|
12
12
|
import "../indexer-AEcT8wHf.mjs";
|
|
13
13
|
import "../ipc-client-aVKVERjJ.mjs";
|
|
14
14
|
import "../config-CcdkNSWa.mjs";
|
|
15
15
|
import "../factory-Cd94gzNz.mjs";
|
|
16
|
-
import "../main-resolver-
|
|
16
|
+
import "../main-resolver-CNSqU8wo.mjs";
|
|
17
17
|
import { buildProgram } from "./program.mjs";
|
|
18
18
|
|
|
19
19
|
//#region src/cli/index.ts
|
package/dist/cli/program.mjs
CHANGED
|
@@ -6,13 +6,13 @@ import "../helpers-crDEr6S2.mjs";
|
|
|
6
6
|
import "../sync--BoxBBok.mjs";
|
|
7
7
|
import "../embeddings-Bn86ssxR.mjs";
|
|
8
8
|
import "../search-C32zQ0V0.mjs";
|
|
9
|
-
import { A as registerProjectsCommands, C as registerRestoreCommands, D as registerIdentityCommands, E as registerMcpCommands, M as resolveIdentifier, O as registerMemoryCommands, S as registerSetupCommand, T as registerDaemonCommands, _ as registerUpdateCommand, a as cmdEnd, b as registerZettelCommands, c as cmdGoto, d as registerHelpCommand, f as registerDbCommands, g as registerNotifyCommands, h as registerTaskCommands, i as cmdPauseAll, j as findMovedPath, k as registerRegistryCommands, l as cmdPause, m as registerTopicCommands, n as cmdFind, o as registerSessionCleanupCommand, p as registerKgCommands, r as cmdClearNames, s as registerSessionCommands, t as cmdPick, u as cmdList, v as registerSkillCommands, w as registerBackupCommands, x as registerObsidianCommands, y as registerObservationCommands } from "../pick-
|
|
9
|
+
import { A as registerProjectsCommands, C as registerRestoreCommands, D as registerIdentityCommands, E as registerMcpCommands, M as resolveIdentifier, O as registerMemoryCommands, S as registerSetupCommand, T as registerDaemonCommands, _ as registerUpdateCommand, a as cmdEnd, b as registerZettelCommands, c as cmdGoto, d as registerHelpCommand, f as registerDbCommands, g as registerNotifyCommands, h as registerTaskCommands, i as cmdPauseAll, j as findMovedPath, k as registerRegistryCommands, l as cmdPause, m as registerTopicCommands, n as cmdFind, o as registerSessionCleanupCommand, p as registerKgCommands, r as cmdClearNames, s as registerSessionCommands, t as cmdPick, u as cmdList, v as registerSkillCommands, w as registerBackupCommands, x as registerObsidianCommands, y as registerObservationCommands } from "../pick-bRiW6Dkp.mjs";
|
|
10
10
|
import "../checkpoint-block-D3rm4dAJ.mjs";
|
|
11
11
|
import "../indexer-AEcT8wHf.mjs";
|
|
12
12
|
import "../ipc-client-aVKVERjJ.mjs";
|
|
13
13
|
import "../config-CcdkNSWa.mjs";
|
|
14
14
|
import "../factory-Cd94gzNz.mjs";
|
|
15
|
-
import { t as cmdMain } from "../main-resolver-
|
|
15
|
+
import { t as cmdMain } from "../main-resolver-CNSqU8wo.mjs";
|
|
16
16
|
import { existsSync, readFileSync } from "node:fs";
|
|
17
17
|
import { basename, dirname, join } from "node:path";
|
|
18
18
|
import { Command } from "commander";
|
|
@@ -1369,7 +1369,53 @@ function renderDedupedSessions(entries, maxRows) {
|
|
|
1369
1369
|
|
|
1370
1370
|
//#endregion
|
|
1371
1371
|
//#region src/cli/commands/main-resolver.ts
|
|
1372
|
-
var main_resolver_exports = /* @__PURE__ */ __exportAll({
|
|
1372
|
+
var main_resolver_exports = /* @__PURE__ */ __exportAll({
|
|
1373
|
+
cmdMain: () => cmdMain,
|
|
1374
|
+
resolveSessionDir: () => resolveSessionDir
|
|
1375
|
+
});
|
|
1376
|
+
/**
|
|
1377
|
+
* Which directory should we open for this session?
|
|
1378
|
+
*
|
|
1379
|
+
* A session carries up to three ideas of where it lives, they disagree in
|
|
1380
|
+
* practice, and the FIRST is the least trustworthy. `clcDirectory` and
|
|
1381
|
+
* `decodedPath` are recorded per session and go stale the moment a project
|
|
1382
|
+
* directory is renamed; `registryRootPath` is kept current by the registry.
|
|
1383
|
+
*
|
|
1384
|
+
* This used to take the preferred value and, if it did not resolve, print an
|
|
1385
|
+
* error and exit — so a live project became unopenable by its own name. The
|
|
1386
|
+
* session had been started when its directory had a different name, so the
|
|
1387
|
+
* stale per-session value pointed at a path that no longer existed while the
|
|
1388
|
+
* registry held the right one, untried.
|
|
1389
|
+
*
|
|
1390
|
+
* The order is unchanged, because the per-session value IS more specific when
|
|
1391
|
+
* valid — it can name a subdirectory the session actually ran in. What changed
|
|
1392
|
+
* is that a candidate which fails no longer ends the attempt.
|
|
1393
|
+
*
|
|
1394
|
+
* realpath, not resolve: a directory reached through a symlinked parent has
|
|
1395
|
+
* several valid spellings, and comparing or storing the unresolved one is how
|
|
1396
|
+
* the same directory ends up with two identities.
|
|
1397
|
+
*
|
|
1398
|
+
* Returns the resolved directory plus every candidate tried, so a total failure
|
|
1399
|
+
* can report what it looked at instead of naming one path and leaving the user
|
|
1400
|
+
* to guess whether the others were even considered.
|
|
1401
|
+
*/
|
|
1402
|
+
function resolveSessionDir(session) {
|
|
1403
|
+
const tried = [
|
|
1404
|
+
session.clcDirectory,
|
|
1405
|
+
session.registryRootPath,
|
|
1406
|
+
session.decodedPath
|
|
1407
|
+
].filter((d) => typeof d === "string" && d.length > 0);
|
|
1408
|
+
for (const candidate of tried) try {
|
|
1409
|
+
return {
|
|
1410
|
+
dir: realpathSync(candidate),
|
|
1411
|
+
tried
|
|
1412
|
+
};
|
|
1413
|
+
} catch {}
|
|
1414
|
+
return {
|
|
1415
|
+
dir: void 0,
|
|
1416
|
+
tried
|
|
1417
|
+
};
|
|
1418
|
+
}
|
|
1373
1419
|
function launchSession(session, allSessions, dryRun) {
|
|
1374
1420
|
let resumableUuid;
|
|
1375
1421
|
if (session.resumable) resumableUuid = session.uuid;
|
|
@@ -1378,21 +1424,8 @@ function launchSession(session, allSessions, dryRun) {
|
|
|
1378
1424
|
sameProject.sort((a, b) => b.mtime - a.mtime);
|
|
1379
1425
|
if (sameProject.length > 0) resumableUuid = sameProject[0].uuid;
|
|
1380
1426
|
}
|
|
1381
|
-
const
|
|
1382
|
-
|
|
1383
|
-
session.registryRootPath,
|
|
1384
|
-
session.decodedPath
|
|
1385
|
-
].filter((d) => typeof d === "string" && d.length > 0);
|
|
1386
|
-
let projectDir;
|
|
1387
|
-
for (const candidate of candidates) try {
|
|
1388
|
-
projectDir = realpathSync(candidate);
|
|
1389
|
-
break;
|
|
1390
|
-
} catch {}
|
|
1391
|
-
if (projectDir === void 0) {
|
|
1392
|
-
console.error(err(`Session directory does not exist or cannot be resolved.\n` + candidates.map((c) => ` tried: ${c}\n`).join("") + ` The directory may have moved or been deleted.`));
|
|
1393
|
-
process.exit(1);
|
|
1394
|
-
return;
|
|
1395
|
-
}
|
|
1427
|
+
const { dir: projectDir } = resolveSessionDir(session);
|
|
1428
|
+
if (projectDir === void 0) return false;
|
|
1396
1429
|
const name = session.friendlyName ?? (basename(projectDir) || session.shortId);
|
|
1397
1430
|
const promptArg = `/Name ${name}\ngo`;
|
|
1398
1431
|
if (dryRun) {
|
|
@@ -1408,7 +1441,7 @@ function launchSession(session, allSessions, dryRun) {
|
|
|
1408
1441
|
console.log(` argv: claude --name "${name}" "/Name ${name}\\ngo"`);
|
|
1409
1442
|
}
|
|
1410
1443
|
console.log();
|
|
1411
|
-
return;
|
|
1444
|
+
return true;
|
|
1412
1445
|
}
|
|
1413
1446
|
if (resumableUuid) {
|
|
1414
1447
|
const probe = probeResume(resumableUuid, projectDir);
|
|
@@ -1549,10 +1582,7 @@ async function openMatch(entry, allSessions, dryRun) {
|
|
|
1549
1582
|
if (entry.status === "live") {
|
|
1550
1583
|
if (await doSwitch(entry, dryRun)) return true;
|
|
1551
1584
|
}
|
|
1552
|
-
if (entry.diskSession)
|
|
1553
|
-
launchSession(entry.diskSession, allSessions, dryRun);
|
|
1554
|
-
return true;
|
|
1555
|
-
}
|
|
1585
|
+
if (entry.diskSession && launchSession(entry.diskSession, allSessions, dryRun)) return true;
|
|
1556
1586
|
if (entry.project && existsSync(entry.project)) {
|
|
1557
1587
|
launchInDir(entry.project, entry.name, { dryRun });
|
|
1558
1588
|
return true;
|
|
@@ -1617,9 +1647,7 @@ async function cmdMain(db, query, pickN, opts) {
|
|
|
1617
1647
|
const nameIncludes = (e, q) => e.name.toLowerCase().includes(q) || e.slug !== void 0 && e.slug.toLowerCase().includes(qSlug);
|
|
1618
1648
|
const newestFirst = (a, b) => b.lastActivity - a.lastActivity;
|
|
1619
1649
|
const exactMatches = deduped.filter((e) => nameMatches(e, qNorm)).sort(newestFirst);
|
|
1620
|
-
if (
|
|
1621
|
-
if (await openMatch(exactMatches[0], allSessions, opts.dryRun ?? false)) return;
|
|
1622
|
-
}
|
|
1650
|
+
for (const match of exactMatches) if (await openMatch(match, allSessions, opts.dryRun ?? false)) return;
|
|
1623
1651
|
let partialMatches = deduped.filter((e) => nameIncludes(e, qNorm));
|
|
1624
1652
|
if (partialMatches.length === 0) {
|
|
1625
1653
|
const qWords = qNorm.split(/\s+/).filter(Boolean);
|
|
@@ -1678,6 +1706,18 @@ async function cmdMain(db, query, pickN, opts) {
|
|
|
1678
1706
|
return;
|
|
1679
1707
|
}
|
|
1680
1708
|
}
|
|
1709
|
+
{
|
|
1710
|
+
const q = query.toLowerCase().replace(/[-_]+/g, " ").replace(/\s+/g, " ").trim();
|
|
1711
|
+
const byName = registeredProjects.filter((p) => {
|
|
1712
|
+
const name = (p.display_name ?? "").toLowerCase().replace(/[-_]+/g, " ").trim();
|
|
1713
|
+
const slug = (p.slug ?? "").toLowerCase().replace(/[-_]+/g, " ").trim();
|
|
1714
|
+
return name === q || slug === q;
|
|
1715
|
+
});
|
|
1716
|
+
for (const p of byName) if (p.root_path && existsSync(p.root_path)) {
|
|
1717
|
+
launchInDir(p.root_path, p.display_name ?? query, { dryRun: opts.dryRun ?? false });
|
|
1718
|
+
return;
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1681
1721
|
if (!existsSync(HISTORY_FILE)) {
|
|
1682
1722
|
console.error(err("~/.claude/history.jsonl not found."));
|
|
1683
1723
|
console.error(dim(" No prompt history available for search."));
|
|
@@ -1747,4 +1787,4 @@ async function cmdMain(db, query, pickN, opts) {
|
|
|
1747
1787
|
|
|
1748
1788
|
//#endregion
|
|
1749
1789
|
export { scanSessions as _, renderDedupedSessions as a, probeResume as c, callAiBroker as d, fetchLiveSessions as f, resolveSessionByNameOrId as g, fmtAge as h, normalizeName as i, restoreTopLevel as l, sendToSession as m, main_resolver_exports as n, hasConversation as o, revealItermSession as p, buildDeduped as r, launchInDir as s, cmdMain as t, printExitDir as u };
|
|
1750
|
-
//# sourceMappingURL=main-resolver-
|
|
1790
|
+
//# sourceMappingURL=main-resolver-CNSqU8wo.mjs.map
|