@tekmidian/pai 0.33.1 → 0.33.2

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.
@@ -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-CX1A7ffC.mjs";
10
+ import "../pick-Ccysp-Sb.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-qIjvdJsb.mjs";
16
+ import "../main-resolver-Cc2ohdT4.mjs";
17
17
  import { buildProgram } from "./program.mjs";
18
18
 
19
19
  //#region src/cli/index.ts
@@ -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-CX1A7ffC.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-Ccysp-Sb.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-qIjvdJsb.mjs";
15
+ import { t as cmdMain } from "../main-resolver-Cc2ohdT4.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({ cmdMain: () => cmdMain });
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,18 +1424,9 @@ 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 candidates = [
1382
- session.clcDirectory,
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 {}
1427
+ const { dir: projectDir, tried } = resolveSessionDir(session);
1391
1428
  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.`));
1429
+ console.error(err(`Session directory does not exist or cannot be resolved.\n` + tried.map((c) => ` tried: ${c}\n`).join("") + ` The directory may have moved or been deleted.`));
1393
1430
  process.exit(1);
1394
1431
  return;
1395
1432
  }
@@ -1747,4 +1784,4 @@ async function cmdMain(db, query, pickN, opts) {
1747
1784
 
1748
1785
  //#endregion
1749
1786
  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-qIjvdJsb.mjs.map
1787
+ //# sourceMappingURL=main-resolver-Cc2ohdT4.mjs.map