memorix 1.6.2 → 1.6.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/index.js CHANGED
@@ -197,9 +197,98 @@ var init_bun_sqlite_compat = __esm({
197
197
  }
198
198
  });
199
199
 
200
+ // src/project/launch-root.ts
201
+ var launch_root_exports = {};
202
+ __export(launch_root_exports, {
203
+ LAST_PROJECT_ROOT_FILENAME: () => LAST_PROJECT_ROOT_FILENAME,
204
+ assertNotHomeDataDir: () => assertNotHomeDataDir,
205
+ effectiveHomeDirectory: () => effectiveHomeDirectory,
206
+ homeProjectRootError: () => homeProjectRootError,
207
+ inheritProjectRootFromHome: () => inheritProjectRootFromHome,
208
+ isHomeDirectory: () => isHomeDirectory,
209
+ lastProjectRootPath: () => lastProjectRootPath,
210
+ readLastProjectRoot: () => readLastProjectRoot,
211
+ resolveControlPlaneDataDir: () => resolveControlPlaneDataDir,
212
+ writeLastProjectRoot: () => writeLastProjectRoot
213
+ });
214
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
215
+ import os from "os";
216
+ import path2 from "path";
217
+ function effectiveHomeDirectory() {
218
+ const configuredHome = process.platform === "win32" ? process.env.USERPROFILE?.trim() || process.env.HOME?.trim() : process.env.HOME?.trim() || process.env.USERPROFILE?.trim();
219
+ return path2.resolve(configuredHome || os.homedir());
220
+ }
221
+ function isHomeDirectory(candidate, homeDir = effectiveHomeDirectory()) {
222
+ try {
223
+ return path2.resolve(candidate) === path2.resolve(homeDir);
224
+ } catch {
225
+ return false;
226
+ }
227
+ }
228
+ function lastProjectRootPath(homeDir = effectiveHomeDirectory()) {
229
+ return path2.join(homeDir, ".memorix", LAST_PROJECT_ROOT_FILENAME);
230
+ }
231
+ function readLastProjectRoot(homeDir = effectiveHomeDirectory()) {
232
+ try {
233
+ const raw = readFileSync(lastProjectRootPath(homeDir), "utf8").trim();
234
+ if (!raw) return null;
235
+ const resolved = path2.resolve(raw);
236
+ if (isHomeDirectory(resolved, homeDir)) return null;
237
+ if (!existsSync(resolved)) return null;
238
+ return resolved;
239
+ } catch {
240
+ return null;
241
+ }
242
+ }
243
+ function writeLastProjectRoot(projectRoot, homeDir) {
244
+ if (process.env.VITEST && homeDir === void 0) return;
245
+ const resolvedHome = homeDir ?? effectiveHomeDirectory();
246
+ const resolved = path2.resolve(projectRoot);
247
+ if (isHomeDirectory(resolved, resolvedHome)) return;
248
+ if (!existsSync(resolved)) return;
249
+ const memorixDir = path2.join(resolvedHome, ".memorix");
250
+ mkdirSync(memorixDir, { recursive: true });
251
+ writeFileSync(lastProjectRootPath(resolvedHome), `${resolved}
252
+ `, "utf8");
253
+ }
254
+ function homeProjectRootError(candidate) {
255
+ return `Refusing to bind $HOME as a project root (${candidate}). Pass a git project via --cwd, MEMORIX_PROJECT_ROOT, or memorix_session_start({ projectRoot }). Memorix will not create ~/memorix.db.`;
256
+ }
257
+ function inheritProjectRootFromHome(options) {
258
+ const envRoot = options.envProjectRoot?.trim();
259
+ if (envRoot && !isHomeDirectory(envRoot, options.homeDir) && existsSync(envRoot)) {
260
+ return path2.resolve(envRoot);
261
+ }
262
+ const lastRoot = (options.readLastRoot ?? (() => readLastProjectRoot(options.homeDir)))();
263
+ if (lastRoot && !isHomeDirectory(lastRoot, options.homeDir) && existsSync(lastRoot)) {
264
+ return lastRoot;
265
+ }
266
+ return null;
267
+ }
268
+ function resolveControlPlaneDataDir(options) {
269
+ const homeDir = options.homeDir ?? effectiveHomeDirectory();
270
+ if (options.requestedDataDir && !isHomeDirectory(options.requestedDataDir, homeDir)) {
271
+ return options.requestedDataDir;
272
+ }
273
+ return options.globalDataDir;
274
+ }
275
+ function assertNotHomeDataDir(dataDir, homeDir = effectiveHomeDirectory()) {
276
+ if (isHomeDirectory(dataDir, homeDir)) {
277
+ throw new Error(homeProjectRootError(dataDir));
278
+ }
279
+ }
280
+ var LAST_PROJECT_ROOT_FILENAME;
281
+ var init_launch_root = __esm({
282
+ "src/project/launch-root.ts"() {
283
+ "use strict";
284
+ init_esm_shims();
285
+ LAST_PROJECT_ROOT_FILENAME = "last-project-root";
286
+ }
287
+ });
288
+
200
289
  // src/store/sqlite-db.ts
201
290
  import "module";
202
- import path2 from "path";
291
+ import path3 from "path";
203
292
  import fs from "fs";
204
293
  function loadBetterSqlite3() {
205
294
  if (BetterSqlite3) return BetterSqlite3;
@@ -233,12 +322,13 @@ function applySchemaMigrations(db2) {
233
322
  }
234
323
  }
235
324
  function getDatabase(dataDir) {
236
- const normalized = path2.resolve(dataDir);
325
+ const normalized = path3.resolve(dataDir);
326
+ assertNotHomeDataDir(normalized);
237
327
  const existing = _dbCache.get(normalized);
238
328
  if (existing) return existing;
239
329
  loadBetterSqlite3();
240
330
  fs.mkdirSync(dataDir, { recursive: true });
241
- const dbPath = path2.join(dataDir, "memorix.db");
331
+ const dbPath = path3.join(dataDir, "memorix.db");
242
332
  const db2 = createDatabase(dbPath);
243
333
  db2.pragma("journal_mode = WAL");
244
334
  db2.pragma("busy_timeout = 5000");
@@ -318,6 +408,7 @@ var init_sqlite_db = __esm({
318
408
  "use strict";
319
409
  init_esm_shims();
320
410
  init_bun_sqlite_compat();
411
+ init_launch_root();
321
412
  CREATE_OBSERVATIONS_TABLE = `
322
413
  CREATE TABLE IF NOT EXISTS observations (
323
414
  id INTEGER PRIMARY KEY,
@@ -1183,7 +1274,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS idx_maintenance_jobs_active_dedupe
1183
1274
  // src/store/file-lock.ts
1184
1275
  import { promises as fs2 } from "fs";
1185
1276
  import { randomUUID } from "crypto";
1186
- import path3 from "path";
1277
+ import path4 from "path";
1187
1278
  async function acquireLock(lockPath) {
1188
1279
  for (let i2 = 0; i2 < MAX_RETRIES; i2++) {
1189
1280
  try {
@@ -1226,7 +1317,7 @@ async function releaseLock(lockPath) {
1226
1317
  });
1227
1318
  }
1228
1319
  async function withFileLock(projectDir2, fn) {
1229
- const lockPath = path3.join(projectDir2, ".memorix.lock");
1320
+ const lockPath = path4.join(projectDir2, ".memorix.lock");
1230
1321
  await acquireLock(lockPath);
1231
1322
  try {
1232
1323
  return await fn();
@@ -1267,9 +1358,9 @@ var init_file_lock = __esm({
1267
1358
 
1268
1359
  // src/store/persistence-json.ts
1269
1360
  import { promises as fs3 } from "fs";
1270
- import path4 from "path";
1361
+ import path5 from "path";
1271
1362
  function getGraphFilePath(projectDir2) {
1272
- return path4.join(projectDir2, "graph.jsonl");
1363
+ return path5.join(projectDir2, "graph.jsonl");
1273
1364
  }
1274
1365
  async function saveGraphJsonl(projectDir2, entities, relations) {
1275
1366
  const lines = [
@@ -1319,11 +1410,11 @@ async function loadGraphJsonl(projectDir2) {
1319
1410
  }
1320
1411
  }
1321
1412
  async function saveObservationsJson(projectDir2, observations2) {
1322
- const filePath = path4.join(projectDir2, "observations.json");
1413
+ const filePath = path5.join(projectDir2, "observations.json");
1323
1414
  await atomicWriteFile(filePath, JSON.stringify(observations2, null, 2));
1324
1415
  }
1325
1416
  async function loadObservationsJson(projectDir2) {
1326
- const filePath = path4.join(projectDir2, "observations.json");
1417
+ const filePath = path5.join(projectDir2, "observations.json");
1327
1418
  try {
1328
1419
  const data = await fs3.readFile(filePath, "utf-8");
1329
1420
  return JSON.parse(data);
@@ -1335,11 +1426,11 @@ async function loadObservationsJson(projectDir2) {
1335
1426
  }
1336
1427
  }
1337
1428
  async function saveIdCounter(projectDir2, nextId2) {
1338
- const filePath = path4.join(projectDir2, "counter.json");
1429
+ const filePath = path5.join(projectDir2, "counter.json");
1339
1430
  await atomicWriteFile(filePath, JSON.stringify({ nextId: nextId2 }));
1340
1431
  }
1341
1432
  async function loadIdCounter(projectDir2) {
1342
- const filePath = path4.join(projectDir2, "counter.json");
1433
+ const filePath = path5.join(projectDir2, "counter.json");
1343
1434
  try {
1344
1435
  const data = await fs3.readFile(filePath, "utf-8");
1345
1436
  return JSON.parse(data).nextId ?? 1;
@@ -1348,11 +1439,11 @@ async function loadIdCounter(projectDir2) {
1348
1439
  }
1349
1440
  }
1350
1441
  async function saveMiniSkillsJson(projectDir2, skills) {
1351
- const filePath = path4.join(projectDir2, "mini-skills.json");
1442
+ const filePath = path5.join(projectDir2, "mini-skills.json");
1352
1443
  await atomicWriteFile(filePath, JSON.stringify(skills, null, 2));
1353
1444
  }
1354
1445
  async function loadMiniSkillsJson(projectDir2) {
1355
- const filePath = path4.join(projectDir2, "mini-skills.json");
1446
+ const filePath = path5.join(projectDir2, "mini-skills.json");
1356
1447
  try {
1357
1448
  const data = await fs3.readFile(filePath, "utf-8");
1358
1449
  const parsed = JSON.parse(data);
@@ -1365,7 +1456,7 @@ async function loadMiniSkillsJson(projectDir2) {
1365
1456
  }
1366
1457
  }
1367
1458
  async function loadMiniSkillsCounter(projectDir2) {
1368
- const filePath = path4.join(projectDir2, "mini-skills-counter.json");
1459
+ const filePath = path5.join(projectDir2, "mini-skills-counter.json");
1369
1460
  try {
1370
1461
  const data = await fs3.readFile(filePath, "utf-8");
1371
1462
  return JSON.parse(data).nextId ?? 1;
@@ -1374,15 +1465,15 @@ async function loadMiniSkillsCounter(projectDir2) {
1374
1465
  }
1375
1466
  }
1376
1467
  async function saveMiniSkillsCounter(projectDir2, nextId2) {
1377
- const filePath = path4.join(projectDir2, "mini-skills-counter.json");
1468
+ const filePath = path5.join(projectDir2, "mini-skills-counter.json");
1378
1469
  await atomicWriteFile(filePath, JSON.stringify({ nextId: nextId2 }));
1379
1470
  }
1380
1471
  async function saveSessionsJson(projectDir2, sessions) {
1381
- const filePath = path4.join(projectDir2, "sessions.json");
1472
+ const filePath = path5.join(projectDir2, "sessions.json");
1382
1473
  await atomicWriteFile(filePath, JSON.stringify(sessions, null, 2));
1383
1474
  }
1384
1475
  async function loadSessionsJson(projectDir2) {
1385
- const filePath = path4.join(projectDir2, "sessions.json");
1476
+ const filePath = path5.join(projectDir2, "sessions.json");
1386
1477
  try {
1387
1478
  const data = await fs3.readFile(filePath, "utf-8");
1388
1479
  return JSON.parse(data);
@@ -1425,10 +1516,10 @@ __export(persistence_exports, {
1425
1516
  saveSessionsJson: () => saveSessionsJson
1426
1517
  });
1427
1518
  import { promises as fs4 } from "fs";
1428
- import path5 from "path";
1429
- import os from "os";
1519
+ import path6 from "path";
1520
+ import os2 from "os";
1430
1521
  function resolveDefaultDataDir() {
1431
- return process.env.MEMORIX_DATA_DIR || path5.join(os.homedir(), ".memorix", "data");
1522
+ return process.env.MEMORIX_DATA_DIR || path6.join(os2.homedir(), ".memorix", "data");
1432
1523
  }
1433
1524
  async function getProjectDataDir(_projectId, baseDir) {
1434
1525
  const base = baseDir ?? resolveDefaultDataDir();
@@ -1442,7 +1533,7 @@ async function listProjectDirs(baseDir) {
1442
1533
  const base = baseDir ?? resolveDefaultDataDir();
1443
1534
  try {
1444
1535
  const entries = await fs4.readdir(base, { withFileTypes: true });
1445
- return entries.filter((e2) => e2.isDirectory()).map((e2) => path5.join(base, e2.name));
1536
+ return entries.filter((e2) => e2.isDirectory()).map((e2) => path6.join(base, e2.name));
1446
1537
  } catch {
1447
1538
  return [];
1448
1539
  }
@@ -1456,18 +1547,18 @@ async function migrateSubdirsToFlat(baseDir) {
1456
1547
  } catch {
1457
1548
  return false;
1458
1549
  }
1459
- const dataDirs = entries.filter((e2) => e2.isDirectory() && !e2.name.startsWith(".")).map((e2) => path5.join(base, e2.name));
1550
+ const dataDirs = entries.filter((e2) => e2.isDirectory() && !e2.name.startsWith(".")).map((e2) => path6.join(base, e2.name));
1460
1551
  if (dataDirs.length === 0) return false;
1461
1552
  const subdirData = [];
1462
1553
  for (const dir of dataDirs) {
1463
- const obsPath = path5.join(dir, "observations.json");
1554
+ const obsPath = path6.join(dir, "observations.json");
1464
1555
  try {
1465
1556
  const data = await fs4.readFile(obsPath, "utf-8");
1466
1557
  const obs = JSON.parse(data);
1467
1558
  if (Array.isArray(obs) && obs.length > 0) {
1468
1559
  let graph = { entities: [], relations: [] };
1469
1560
  try {
1470
- const graphData = await fs4.readFile(path5.join(dir, "graph.jsonl"), "utf-8");
1561
+ const graphData = await fs4.readFile(path6.join(dir, "graph.jsonl"), "utf-8");
1471
1562
  const lines = graphData.split("\n").filter((l) => l.trim());
1472
1563
  for (const line of lines) {
1473
1564
  const item = JSON.parse(line);
@@ -1484,14 +1575,14 @@ async function migrateSubdirsToFlat(baseDir) {
1484
1575
  if (subdirData.length === 0) return false;
1485
1576
  let baseObs = [];
1486
1577
  try {
1487
- const data = await fs4.readFile(path5.join(base, "observations.json"), "utf-8");
1578
+ const data = await fs4.readFile(path6.join(base, "observations.json"), "utf-8");
1488
1579
  baseObs = JSON.parse(data);
1489
1580
  if (!Array.isArray(baseObs)) baseObs = [];
1490
1581
  } catch {
1491
1582
  }
1492
1583
  let baseGraph = { entities: [], relations: [] };
1493
1584
  try {
1494
- const graphData = await fs4.readFile(path5.join(base, "graph.jsonl"), "utf-8");
1585
+ const graphData = await fs4.readFile(path6.join(base, "graph.jsonl"), "utf-8");
1495
1586
  const lines = graphData.split("\n").filter((l) => l.trim());
1496
1587
  for (const line of lines) {
1497
1588
  const item = JSON.parse(line);
@@ -1537,9 +1628,9 @@ async function migrateSubdirsToFlat(baseDir) {
1537
1628
  mergedRelations.push(rel);
1538
1629
  }
1539
1630
  }
1540
- await fs4.writeFile(path5.join(base, "observations.json"), JSON.stringify(allObs, null, 2), "utf-8");
1631
+ await fs4.writeFile(path6.join(base, "observations.json"), JSON.stringify(allObs, null, 2), "utf-8");
1541
1632
  await fs4.writeFile(
1542
- path5.join(base, "counter.json"),
1633
+ path6.join(base, "counter.json"),
1543
1634
  JSON.stringify({ nextId: allObs.length + 1 }),
1544
1635
  "utf-8"
1545
1636
  );
@@ -1548,47 +1639,47 @@ async function migrateSubdirsToFlat(baseDir) {
1548
1639
  ...mergedRelations.map((r2) => JSON.stringify({ type: "relation", from: r2.from, to: r2.to, relationType: r2.relationType }))
1549
1640
  ];
1550
1641
  if (graphLines.length > 0) {
1551
- await fs4.writeFile(path5.join(base, "graph.jsonl"), graphLines.join("\n"), "utf-8");
1642
+ await fs4.writeFile(path6.join(base, "graph.jsonl"), graphLines.join("\n"), "utf-8");
1552
1643
  }
1553
1644
  let allSessions = [];
1554
1645
  try {
1555
- const data = await fs4.readFile(path5.join(base, "sessions.json"), "utf-8");
1646
+ const data = await fs4.readFile(path6.join(base, "sessions.json"), "utf-8");
1556
1647
  allSessions = JSON.parse(data);
1557
1648
  if (!Array.isArray(allSessions)) allSessions = [];
1558
1649
  } catch {
1559
1650
  }
1560
1651
  for (const { dir } of subdirData) {
1561
1652
  try {
1562
- const data = await fs4.readFile(path5.join(dir, "sessions.json"), "utf-8");
1653
+ const data = await fs4.readFile(path6.join(dir, "sessions.json"), "utf-8");
1563
1654
  const sessions = JSON.parse(data);
1564
1655
  if (Array.isArray(sessions)) allSessions.push(...sessions);
1565
1656
  } catch {
1566
1657
  }
1567
1658
  }
1568
1659
  if (allSessions.length > 0) {
1569
- await fs4.writeFile(path5.join(base, "sessions.json"), JSON.stringify(allSessions, null, 2), "utf-8");
1660
+ await fs4.writeFile(path6.join(base, "sessions.json"), JSON.stringify(allSessions, null, 2), "utf-8");
1570
1661
  }
1571
- const backupDir = path5.join(base, ".migrated-subdirs");
1662
+ const backupDir = path6.join(base, ".migrated-subdirs");
1572
1663
  await fs4.mkdir(backupDir, { recursive: true });
1573
1664
  for (const { dir } of subdirData) {
1574
- const dirName = path5.basename(dir);
1665
+ const dirName = path6.basename(dir);
1575
1666
  try {
1576
- await fs4.rename(dir, path5.join(backupDir, dirName));
1667
+ await fs4.rename(dir, path6.join(backupDir, dirName));
1577
1668
  } catch {
1578
1669
  }
1579
1670
  }
1580
1671
  for (const dir of dataDirs) {
1581
- const dirName = path5.basename(dir);
1672
+ const dirName = path6.basename(dir);
1582
1673
  try {
1583
1674
  await fs4.access(dir);
1584
- await fs4.rename(dir, path5.join(backupDir, dirName));
1675
+ await fs4.rename(dir, path6.join(backupDir, dirName));
1585
1676
  } catch {
1586
1677
  }
1587
1678
  }
1588
1679
  return true;
1589
1680
  }
1590
1681
  function getDbFilePath(projectDir2) {
1591
- return path5.join(projectDir2, "memorix.msp");
1682
+ return path6.join(projectDir2, "memorix.msp");
1592
1683
  }
1593
1684
  async function hasExistingData(projectDir2) {
1594
1685
  try {
@@ -1614,7 +1705,7 @@ __export(graph_store_exports, {
1614
1705
  initGraphStore: () => initGraphStore,
1615
1706
  resetGraphStore: () => resetGraphStore
1616
1707
  });
1617
- import path6 from "path";
1708
+ import path7 from "path";
1618
1709
  import fs5 from "fs";
1619
1710
  function safeJsonParse(val, fallback) {
1620
1711
  if (val == null || val === "") return fallback;
@@ -1705,7 +1796,7 @@ var init_graph_store = __esm({
1705
1796
  async migrateFromJsonlIfNeeded() {
1706
1797
  const count2 = this.db.prepare(`SELECT COUNT(*) AS cnt FROM graph_entities`).get();
1707
1798
  if (count2.cnt > 0) return;
1708
- const jsonlPath = path6.join(this.dataDir, "graph.jsonl");
1799
+ const jsonlPath = path7.join(this.dataDir, "graph.jsonl");
1709
1800
  if (!fs5.existsSync(jsonlPath)) return;
1710
1801
  try {
1711
1802
  const data = await loadGraphJsonl(this.dataDir);
@@ -2014,7 +2105,7 @@ __export(mini_skill_store_exports, {
2014
2105
  isMiniSkillStoreInitialized: () => isMiniSkillStoreInitialized,
2015
2106
  resetMiniSkillStore: () => resetMiniSkillStore
2016
2107
  });
2017
- import path7 from "path";
2108
+ import path8 from "path";
2018
2109
  import fs6 from "fs";
2019
2110
  function skillToRow(skill2) {
2020
2111
  return {
@@ -2141,7 +2232,7 @@ var init_mini_skill_store = __esm({
2141
2232
  async migrateFromJsonIfNeeded() {
2142
2233
  const count2 = this.db.prepare(`SELECT COUNT(*) AS cnt FROM mini_skills`).get();
2143
2234
  if (count2.cnt > 0) return;
2144
- const jsonPath = path7.join(this.dataDir, "mini-skills.json");
2235
+ const jsonPath = path8.join(this.dataDir, "mini-skills.json");
2145
2236
  if (!fs6.existsSync(jsonPath)) return;
2146
2237
  try {
2147
2238
  const raw = fs6.readFileSync(jsonPath, "utf-8");
@@ -2154,7 +2245,7 @@ var init_mini_skill_store = __esm({
2154
2245
  }
2155
2246
  });
2156
2247
  insertMany(skills);
2157
- const counterPath = path7.join(this.dataDir, "mini-skills-counter.json");
2248
+ const counterPath = path8.join(this.dataDir, "mini-skills-counter.json");
2158
2249
  if (fs6.existsSync(counterPath)) {
2159
2250
  try {
2160
2251
  const counterData = JSON.parse(fs6.readFileSync(counterPath, "utf-8"));
@@ -2663,7 +2754,7 @@ __export(yaml_loader_exports, {
2663
2754
  loadYamlConfig: () => loadYamlConfig,
2664
2755
  resetYamlConfigCache: () => resetYamlConfigCache
2665
2756
  });
2666
- import { existsSync, readFileSync } from "fs";
2757
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
2667
2758
  import { homedir } from "os";
2668
2759
  import { parse as parseYamlDocument } from "yaml";
2669
2760
  function initProjectRoot(root) {
@@ -2681,16 +2772,16 @@ function loadYamlConfig(projectRoot) {
2681
2772
  const projectYaml = resolvedRoot ? getProjectYamlPath(resolvedRoot) : null;
2682
2773
  let userConfig = {};
2683
2774
  let projectConfig = {};
2684
- if (existsSync(userYaml)) {
2775
+ if (existsSync2(userYaml)) {
2685
2776
  try {
2686
- userConfig = parseYaml(readFileSync(userYaml, "utf-8"));
2777
+ userConfig = parseYaml(readFileSync2(userYaml, "utf-8"));
2687
2778
  } catch (err) {
2688
2779
  console.error(`[memorix] Warning: Failed to parse ${userYaml}: ${err}`);
2689
2780
  }
2690
2781
  }
2691
- if (projectYaml && existsSync(projectYaml)) {
2782
+ if (projectYaml && existsSync2(projectYaml)) {
2692
2783
  try {
2693
- projectConfig = parseYaml(readFileSync(projectYaml, "utf-8"));
2784
+ projectConfig = parseYaml(readFileSync2(projectYaml, "utf-8"));
2694
2785
  } catch (err) {
2695
2786
  console.error(`[memorix] Warning: Failed to parse ${projectYaml}: ${err}`);
2696
2787
  }
@@ -2747,14 +2838,14 @@ __export(detector_exports, {
2747
2838
  isSystemDirectory: () => isSystemDirectory
2748
2839
  });
2749
2840
  import { execSync } from "child_process";
2750
- import { existsSync as existsSync2, readFileSync as readFileSync2, readdirSync, statSync } from "fs";
2751
- import path8 from "path";
2841
+ import { existsSync as existsSync3, readFileSync as readFileSync3, readdirSync, statSync } from "fs";
2842
+ import path9 from "path";
2752
2843
  function detectProject(cwd) {
2753
2844
  return detectProjectWithDiagnostics(cwd).project;
2754
2845
  }
2755
2846
  function detectProjectWithDiagnostics(cwd) {
2756
2847
  const basePath = cwd ?? process.cwd();
2757
- if (!existsSync2(basePath)) {
2848
+ if (!existsSync3(basePath)) {
2758
2849
  return {
2759
2850
  project: null,
2760
2851
  failure: { reason: "path_not_found", path: basePath, detail: `Path does not exist: "${basePath}"` }
@@ -2788,19 +2879,19 @@ function detectProjectWithDiagnostics(cwd) {
2788
2879
  const gitRemote = getGitRemote(gitRoot);
2789
2880
  if (gitRemote) {
2790
2881
  const id2 = normalizeGitRemote(gitRemote);
2791
- const name2 = id2.split("/").pop() ?? path8.basename(gitRoot);
2882
+ const name2 = id2.split("/").pop() ?? path9.basename(gitRoot);
2792
2883
  return { project: { id: id2, name: name2, gitRemote, rootPath: gitRoot }, failure: null };
2793
2884
  }
2794
- const name = path8.basename(gitRoot);
2885
+ const name = path9.basename(gitRoot);
2795
2886
  const id = `local/${name}`;
2796
2887
  return { project: { id, name, rootPath: gitRoot }, failure: null };
2797
2888
  }
2798
2889
  function getGitRootWithDiagnostics(cwd) {
2799
- let dir = path8.resolve(cwd);
2800
- const fsRoot = path8.parse(dir).root;
2890
+ let dir = path9.resolve(cwd);
2891
+ const fsRoot = path9.parse(dir).root;
2801
2892
  while (dir !== fsRoot) {
2802
- const gitPath = path8.join(dir, ".git");
2803
- if (existsSync2(gitPath)) {
2893
+ const gitPath = path9.join(dir, ".git");
2894
+ if (existsSync3(gitPath)) {
2804
2895
  try {
2805
2896
  const st = statSync(gitPath);
2806
2897
  if (st.isDirectory() || st.isFile()) return { root: dir, failure: null };
@@ -2815,7 +2906,7 @@ function getGitRootWithDiagnostics(cwd) {
2815
2906
  };
2816
2907
  }
2817
2908
  }
2818
- dir = path8.dirname(dir);
2909
+ dir = path9.dirname(dir);
2819
2910
  }
2820
2911
  try {
2821
2912
  const root = execSync("git -c safe.directory=* rev-parse --show-toplevel", {
@@ -2862,9 +2953,9 @@ function getGitRemote(cwd) {
2862
2953
  }
2863
2954
  function readGitConfigRemote(cwd) {
2864
2955
  try {
2865
- const configPath = path8.join(cwd, ".git", "config");
2866
- if (!existsSync2(configPath)) return null;
2867
- const content = readFileSync2(configPath, "utf-8");
2956
+ const configPath = path9.join(cwd, ".git", "config");
2957
+ if (!existsSync3(configPath)) return null;
2958
+ const content = readFileSync3(configPath, "utf-8");
2868
2959
  const remoteMatch = content.match(/\[remote\s+"origin"\]([\s\S]*?)(?=\n\[|$)/);
2869
2960
  if (!remoteMatch) return null;
2870
2961
  const urlMatch = remoteMatch[1].match(/^\s*url\s*=\s*(.+)$/m);
@@ -2882,13 +2973,13 @@ function isSystemDirectory(dir) {
2882
2973
  }
2883
2974
  function findGitInSubdirs(dir) {
2884
2975
  try {
2885
- const resolved = path8.resolve(dir);
2976
+ const resolved = path9.resolve(dir);
2886
2977
  const entries = readdirSync(resolved);
2887
2978
  for (const entry of entries) {
2888
2979
  if (entry.startsWith(".")) continue;
2889
- const fullPath = path8.join(resolved, entry);
2980
+ const fullPath = path9.join(resolved, entry);
2890
2981
  try {
2891
- if (statSync(fullPath).isDirectory() && existsSync2(path8.join(fullPath, ".git"))) {
2982
+ if (statSync(fullPath).isDirectory() && existsSync3(path9.join(fullPath, ".git"))) {
2892
2983
  return fullPath;
2893
2984
  }
2894
2985
  } catch {
@@ -2921,14 +3012,14 @@ var init_detector = __esm({
2921
3012
  });
2922
3013
 
2923
3014
  // src/config/legacy-loader.ts
2924
- import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
3015
+ import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
2925
3016
  import { homedir as homedir2 } from "os";
2926
3017
  function loadFileConfig() {
2927
3018
  if (cachedConfig !== null) return cachedConfig;
2928
3019
  const configPath = getLegacyConfigJsonPath(homedir2());
2929
3020
  try {
2930
- if (existsSync3(configPath)) {
2931
- cachedConfig = JSON.parse(readFileSync3(configPath, "utf-8"));
3021
+ if (existsSync4(configPath)) {
3022
+ cachedConfig = JSON.parse(readFileSync4(configPath, "utf-8"));
2932
3023
  return cachedConfig;
2933
3024
  }
2934
3025
  } catch {
@@ -2950,7 +3041,7 @@ var init_legacy_loader = __esm({
2950
3041
  });
2951
3042
 
2952
3043
  // src/config/toml-loader.ts
2953
- import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
3044
+ import { existsSync as existsSync5, readFileSync as readFileSync5 } from "fs";
2954
3045
  import { homedir as homedir3 } from "os";
2955
3046
  function loadTomlConfig(options = {}) {
2956
3047
  const homeDir = options.homeDir ?? homedir3();
@@ -2960,8 +3051,8 @@ function loadTomlConfig(options = {}) {
2960
3051
  if (cached) return cached;
2961
3052
  const userToml = getGlobalConfigTomlPath(homeDir);
2962
3053
  const projectToml = projectRoot ? getProjectConfigTomlPath(projectRoot) : null;
2963
- const userConfig = existsSync4(userToml) ? parseTomlConfig(readFileSync4(userToml, "utf8"), userToml) : {};
2964
- const projectConfig = projectToml && existsSync4(projectToml) ? parseTomlConfig(readFileSync4(projectToml, "utf8"), projectToml) : {};
3054
+ const userConfig = existsSync5(userToml) ? parseTomlConfig(readFileSync5(userToml, "utf8"), userToml) : {};
3055
+ const projectConfig = projectToml && existsSync5(projectToml) ? parseTomlConfig(readFileSync5(projectToml, "utf8"), projectToml) : {};
2965
3056
  const merged = mergeTomlConfig(userConfig, projectConfig);
2966
3057
  configCache2.set(cacheKey, merged);
2967
3058
  return merged;
@@ -3072,12 +3163,12 @@ __export(dotenv_loader_exports, {
3072
3163
  loadDotenv: () => loadDotenv,
3073
3164
  resetDotenv: () => resetDotenv
3074
3165
  });
3075
- import { existsSync as existsSync5, readFileSync as readFileSync5 } from "fs";
3166
+ import { existsSync as existsSync6, readFileSync as readFileSync6 } from "fs";
3076
3167
  import { homedir as homedir4 } from "os";
3077
3168
  import { parse } from "dotenv";
3078
3169
  function loadEnvFile(filePath) {
3079
- if (!existsSync5(filePath)) return;
3080
- const parsed = parse(readFileSync5(filePath, "utf-8"));
3170
+ if (!existsSync6(filePath)) return;
3171
+ const parsed = parse(readFileSync6(filePath, "utf-8"));
3081
3172
  for (const [key, value] of Object.entries(parsed)) {
3082
3173
  if (!(key in process.env)) {
3083
3174
  process.env[key] = value;
@@ -3135,7 +3226,7 @@ __export(resolved_config_exports, {
3135
3226
  resetResolvedConfigCache: () => resetResolvedConfigCache
3136
3227
  });
3137
3228
  import { homedir as homedir5 } from "os";
3138
- import { existsSync as existsSync6 } from "fs";
3229
+ import { existsSync as existsSync7 } from "fs";
3139
3230
  function getResolvedConfig(options = {}) {
3140
3231
  const homeDir = options.homeDir ?? homedir5();
3141
3232
  const projectRoot = options.projectRoot === void 0 ? detectProject()?.rootPath ?? null : options.projectRoot;
@@ -3312,7 +3403,7 @@ function parseNumber(value) {
3312
3403
  return Number.isFinite(parsed) ? parsed : void 0;
3313
3404
  }
3314
3405
  function getExistingConfigSources(paths) {
3315
- return paths.filter((filePath) => existsSync6(filePath));
3406
+ return paths.filter((filePath) => existsSync7(filePath));
3316
3407
  }
3317
3408
  function getEnvSourceNames() {
3318
3409
  return [
@@ -6333,8 +6424,8 @@ __export(aliases_exports, {
6333
6424
  resolveAliases: () => resolveAliases
6334
6425
  });
6335
6426
  import { promises as fs7 } from "fs";
6336
- import path9 from "path";
6337
- import os2 from "os";
6427
+ import path10 from "path";
6428
+ import os3 from "os";
6338
6429
  function normalizePath(p) {
6339
6430
  let normalized = p.replace(/\\/g, "/").replace(/\/+$/, "");
6340
6431
  if (process.platform === "win32") {
@@ -6348,7 +6439,7 @@ function idPriority(id) {
6348
6439
  return 2;
6349
6440
  }
6350
6441
  function getRegistryPath(baseDir) {
6351
- return path9.join(baseDir ?? registryDir ?? DEFAULT_DATA_DIR, ALIAS_FILE);
6442
+ return path10.join(baseDir ?? registryDir ?? DEFAULT_DATA_DIR, ALIAS_FILE);
6352
6443
  }
6353
6444
  async function loadRegistry(baseDir) {
6354
6445
  if (registryCache) return registryCache;
@@ -6367,7 +6458,7 @@ async function loadRegistry(baseDir) {
6367
6458
  async function saveRegistry(baseDir) {
6368
6459
  if (!registryCache) return;
6369
6460
  const filePath = getRegistryPath(baseDir);
6370
- await fs7.mkdir(path9.dirname(filePath), { recursive: true });
6461
+ await fs7.mkdir(path10.dirname(filePath), { recursive: true });
6371
6462
  await fs7.writeFile(filePath, JSON.stringify(registryCache, null, 2), "utf-8");
6372
6463
  }
6373
6464
  function findMatchingGroup(registry2, projectInfo) {
@@ -6525,7 +6616,7 @@ var init_aliases = __esm({
6525
6616
  "src/project/aliases.ts"() {
6526
6617
  "use strict";
6527
6618
  init_esm_shims();
6528
- DEFAULT_DATA_DIR = process.env.MEMORIX_DATA_DIR || path9.join(os2.homedir(), ".memorix", "data");
6619
+ DEFAULT_DATA_DIR = process.env.MEMORIX_DATA_DIR || path10.join(os3.homedir(), ".memorix", "data");
6529
6620
  ALIAS_FILE = ".project-aliases.json";
6530
6621
  registryCache = null;
6531
6622
  registryDir = null;
@@ -7694,7 +7785,7 @@ var sqlite_store_exports = {};
7694
7785
  __export(sqlite_store_exports, {
7695
7786
  SqliteBackend: () => SqliteBackend
7696
7787
  });
7697
- import path10 from "path";
7788
+ import path11 from "path";
7698
7789
  import fs8 from "fs";
7699
7790
  function obsToRow(obs) {
7700
7791
  return {
@@ -7798,6 +7889,8 @@ var init_sqlite_store = __esm({
7798
7889
  stmtSelectByProjectStatus = null;
7799
7890
  stmtSelectByProjectAfterId = null;
7800
7891
  stmtSelectByProjectStatusAfterId = null;
7892
+ stmtSelectByProjectNewest = null;
7893
+ stmtSelectByProjectStatusNewest = null;
7801
7894
  stmtCountByProject = null;
7802
7895
  stmtCountByProjectStatus = null;
7803
7896
  stmtSelectByTopicKey = null;
@@ -7845,6 +7938,14 @@ var init_sqlite_store = __esm({
7845
7938
  this.stmtSelectByProjectStatusAfterId = this.db.prepare(`
7846
7939
  SELECT * FROM observations WHERE projectId = ? AND status = ? AND id > ?
7847
7940
  ORDER BY id ASC LIMIT ?
7941
+ `);
7942
+ this.stmtSelectByProjectNewest = this.db.prepare(`
7943
+ SELECT * FROM observations WHERE projectId = ?
7944
+ ORDER BY createdAt DESC, id DESC LIMIT ? OFFSET ?
7945
+ `);
7946
+ this.stmtSelectByProjectStatusNewest = this.db.prepare(`
7947
+ SELECT * FROM observations WHERE projectId = ? AND status = ?
7948
+ ORDER BY createdAt DESC, id DESC LIMIT ? OFFSET ?
7848
7949
  `);
7849
7950
  this.stmtCountByProject = this.db.prepare(
7850
7951
  `SELECT COUNT(*) AS count FROM observations WHERE projectId = ?`
@@ -7894,7 +7995,7 @@ var init_sqlite_store = __esm({
7894
7995
  async migrateFromJsonIfNeeded() {
7895
7996
  const count2 = this.db.prepare(`SELECT COUNT(*) AS cnt FROM observations`).get();
7896
7997
  if (count2.cnt > 0) return;
7897
- const jsonPath = path10.join(this.dataDir, "observations.json");
7998
+ const jsonPath = path11.join(this.dataDir, "observations.json");
7898
7999
  if (!fs8.existsSync(jsonPath)) return;
7899
8000
  try {
7900
8001
  const raw = fs8.readFileSync(jsonPath, "utf-8");
@@ -7907,7 +8008,7 @@ var init_sqlite_store = __esm({
7907
8008
  }
7908
8009
  });
7909
8010
  insertMany(observations2);
7910
- const counterPath = path10.join(this.dataDir, "counter.json");
8011
+ const counterPath = path11.join(this.dataDir, "counter.json");
7911
8012
  if (fs8.existsSync(counterPath)) {
7912
8013
  try {
7913
8014
  const counterData = JSON.parse(fs8.readFileSync(counterPath, "utf-8"));
@@ -7933,7 +8034,8 @@ var init_sqlite_store = __esm({
7933
8034
  const limit2 = options.limit == null ? -1 : Math.max(1, Math.floor(options.limit));
7934
8035
  const offset = options.offset == null ? 0 : Math.max(0, Math.floor(options.offset));
7935
8036
  const afterId = options.afterId == null ? null : Math.max(0, Math.floor(options.afterId));
7936
- const rows = afterId === null ? options.status ? this.stmtSelectByProjectStatus.all(projectId, options.status, limit2, offset) : this.stmtSelectByProject.all(projectId, limit2, offset) : options.status ? this.stmtSelectByProjectStatusAfterId.all(projectId, options.status, afterId, limit2) : this.stmtSelectByProjectAfterId.all(projectId, afterId, limit2);
8037
+ const newestFirst = options.newestFirst === true && afterId === null;
8038
+ const rows = afterId === null ? newestFirst ? options.status ? this.stmtSelectByProjectStatusNewest.all(projectId, options.status, limit2, offset) : this.stmtSelectByProjectNewest.all(projectId, limit2, offset) : options.status ? this.stmtSelectByProjectStatus.all(projectId, options.status, limit2, offset) : this.stmtSelectByProject.all(projectId, limit2, offset) : options.status ? this.stmtSelectByProjectStatusAfterId.all(projectId, options.status, afterId, limit2) : this.stmtSelectByProjectAfterId.all(projectId, afterId, limit2);
7937
8039
  return rows.map(rowToObs);
7938
8040
  }
7939
8041
  async getById(id) {
@@ -8879,8 +8981,9 @@ var init_lifecycle = __esm({
8879
8981
 
8880
8982
  // src/runtime/isolated-maintenance.ts
8881
8983
  import { spawn } from "child_process";
8882
- import { existsSync as existsSync7 } from "fs";
8883
- import path11 from "path";
8984
+ import { existsSync as existsSync8 } from "fs";
8985
+ import os4 from "os";
8986
+ import path12 from "path";
8884
8987
  import { fileURLToPath as fileURLToPath2 } from "url";
8885
8988
  function isRecord(value) {
8886
8989
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -8894,10 +8997,14 @@ function childError(prefix, detail) {
8894
8997
  const cleaned = sanitizeCredentials(detail.trim()).slice(0, 4e3);
8895
8998
  return new Error(cleaned ? `${prefix}: ${cleaned}` : prefix);
8896
8999
  }
9000
+ function isolatedMaintenanceCwd() {
9001
+ const tmp = os4.tmpdir();
9002
+ return existsSync8(tmp) ? tmp : process.cwd();
9003
+ }
8897
9004
  function resolveMaintenanceRunnerPath(moduleUrl = import.meta.url) {
8898
- const moduleDir = path11.dirname(fileURLToPath2(moduleUrl));
8899
- const distDir = path11.basename(moduleDir) === "cli" ? path11.dirname(moduleDir) : path11.basename(moduleDir) === "runtime" && path11.basename(path11.dirname(moduleDir)) === "src" ? path11.join(path11.dirname(path11.dirname(moduleDir)), "dist") : moduleDir;
8900
- return path11.join(distDir, "maintenance-runner.js");
9005
+ const moduleDir = path12.dirname(fileURLToPath2(moduleUrl));
9006
+ const distDir = path12.basename(moduleDir) === "cli" ? path12.dirname(moduleDir) : path12.basename(moduleDir) === "runtime" && path12.basename(path12.dirname(moduleDir)) === "src" ? path12.join(path12.dirname(path12.dirname(moduleDir)), "dist") : moduleDir;
9007
+ return path12.join(distDir, "maintenance-runner.js");
8901
9008
  }
8902
9009
  function parseMaintenanceRunnerOutput(output) {
8903
9010
  const line = output.split(/\r?\n/).reverse().find((candidate) => candidate.startsWith(MAINTENANCE_RESULT_PREFIX));
@@ -8921,10 +9028,10 @@ function validateRequest(request) {
8921
9028
  if (!ISOLATED_MAINTENANCE_JOB_KINDS.includes(request.job.kind)) {
8922
9029
  throw new Error(`Maintenance job ${request.job.kind} cannot run in an isolated worker`);
8923
9030
  }
8924
- if (!path11.isAbsolute(request.projectRoot)) {
9031
+ if (!path12.isAbsolute(request.projectRoot)) {
8925
9032
  throw new Error("Maintenance runner requires an absolute project root");
8926
9033
  }
8927
- if (!path11.isAbsolute(request.dataDir)) {
9034
+ if (!path12.isAbsolute(request.dataDir)) {
8928
9035
  throw new Error("Maintenance runner requires an absolute data directory");
8929
9036
  }
8930
9037
  }
@@ -8949,7 +9056,7 @@ function collectOutput(stream2, limit2, onOverflow) {
8949
9056
  async function runMaintenanceInChildProcess(request, options = {}) {
8950
9057
  validateRequest(request);
8951
9058
  const runnerPath = options.runnerPath ?? resolveMaintenanceRunnerPath();
8952
- if (!existsSync7(runnerPath)) {
9059
+ if (!existsSync8(runnerPath)) {
8953
9060
  throw new Error(`Maintenance runner is unavailable at ${runnerPath}. Reinstall or rebuild Memorix.`);
8954
9061
  }
8955
9062
  const timeoutMs = Number.isFinite(options.timeoutMs) ? Math.max(1e3, Math.floor(options.timeoutMs)) : DEFAULT_TIMEOUT_MS;
@@ -8959,7 +9066,7 @@ async function runMaintenanceInChildProcess(request, options = {}) {
8959
9066
  let child;
8960
9067
  try {
8961
9068
  child = spawn(process.execPath, [runnerPath], {
8962
- cwd: request.projectRoot,
9069
+ cwd: isolatedMaintenanceCwd(),
8963
9070
  env: env2,
8964
9071
  stdio: ["pipe", "pipe", "pipe"],
8965
9072
  windowsHide: true
@@ -9230,7 +9337,7 @@ __export(workspace_exports, {
9230
9337
  import { createHash as createHash3 } from "crypto";
9231
9338
  import { execFile } from "child_process";
9232
9339
  import { promises as fs9 } from "fs";
9233
- import path12 from "path";
9340
+ import path13 from "path";
9234
9341
  import { promisify } from "util";
9235
9342
  function hash(value) {
9236
9343
  return createHash3("sha256").update(value).digest("hex");
@@ -9239,29 +9346,29 @@ function workspaceId(projectId, mode) {
9239
9346
  return "workspace:" + hash(projectId + ":" + mode).slice(0, 24);
9240
9347
  }
9241
9348
  function localWorkspacePath(dataDir, projectId) {
9242
- return path12.join(path12.resolve(dataDir), "knowledge-workspaces", hash(projectId).slice(0, 24));
9349
+ return path13.join(path13.resolve(dataDir), "knowledge-workspaces", hash(projectId).slice(0, 24));
9243
9350
  }
9244
9351
  function isWithin(root, candidate) {
9245
- const relative3 = path12.relative(root, candidate);
9246
- return relative3 !== "" && !relative3.startsWith(".." + path12.sep) && relative3 !== ".." && !path12.isAbsolute(relative3);
9352
+ const relative3 = path13.relative(root, candidate);
9353
+ return relative3 !== "" && !relative3.startsWith(".." + path13.sep) && relative3 !== ".." && !path13.isAbsolute(relative3);
9247
9354
  }
9248
9355
  function ensureVersionedPath(projectRoot, rootPath) {
9249
- if (!path12.isAbsolute(rootPath)) {
9356
+ if (!path13.isAbsolute(rootPath)) {
9250
9357
  throw new Error("A versioned knowledge workspace requires an explicit absolute path");
9251
9358
  }
9252
- const resolvedProject = path12.resolve(projectRoot);
9253
- const resolvedWorkspace = path12.resolve(rootPath);
9359
+ const resolvedProject = path13.resolve(projectRoot);
9360
+ const resolvedWorkspace = path13.resolve(rootPath);
9254
9361
  if (!isWithin(resolvedProject, resolvedWorkspace)) {
9255
9362
  throw new Error("A versioned knowledge workspace must live inside the Git project");
9256
9363
  }
9257
- const segments = path12.relative(resolvedProject, resolvedWorkspace).split(path12.sep);
9364
+ const segments = path13.relative(resolvedProject, resolvedWorkspace).split(path13.sep);
9258
9365
  if (segments.includes(".git") || segments.includes("node_modules") || segments.includes("dist")) {
9259
9366
  throw new Error("The selected knowledge workspace path is not safe for project artifacts");
9260
9367
  }
9261
9368
  return resolvedWorkspace;
9262
9369
  }
9263
9370
  async function isIgnoredByGit(projectRoot, workspaceRoot) {
9264
- const relative3 = path12.relative(projectRoot, workspaceRoot).split(path12.sep).join("/");
9371
+ const relative3 = path13.relative(projectRoot, workspaceRoot).split(path13.sep).join("/");
9265
9372
  const probes = [relative3, relative3.replace(/\/+$/, "") + "/.memorix-workspace-probe"];
9266
9373
  for (const probe of probes) {
9267
9374
  try {
@@ -9288,23 +9395,23 @@ async function assertNoSymlinkEscape(projectRoot, workspaceRoot) {
9288
9395
  }
9289
9396
  }
9290
9397
  function getKnowledgeWorkspacePaths(workspace) {
9291
- const root = path12.resolve(workspace.rootPath);
9398
+ const root = path13.resolve(workspace.rootPath);
9292
9399
  return {
9293
9400
  root,
9294
- pages: path12.join(root, "pages"),
9295
- proposals: path12.join(root, "proposals"),
9296
- workflows: path12.join(root, "workflows"),
9297
- index: path12.join(root, "index.md"),
9298
- log: path12.join(root, "log.md"),
9299
- schema: path12.join(root, "schema.md")
9401
+ pages: path13.join(root, "pages"),
9402
+ proposals: path13.join(root, "proposals"),
9403
+ workflows: path13.join(root, "workflows"),
9404
+ index: path13.join(root, "index.md"),
9405
+ log: path13.join(root, "log.md"),
9406
+ schema: path13.join(root, "schema.md")
9300
9407
  };
9301
9408
  }
9302
9409
  function resolveKnowledgeWorkspaceFile(workspace, relativePath) {
9303
- if (!relativePath || path12.isAbsolute(relativePath)) {
9410
+ if (!relativePath || path13.isAbsolute(relativePath)) {
9304
9411
  throw new Error("Knowledge workspace paths must be relative");
9305
9412
  }
9306
- const root = path12.resolve(workspace.rootPath);
9307
- const candidate = path12.resolve(root, relativePath);
9413
+ const root = path13.resolve(workspace.rootPath);
9414
+ const candidate = path13.resolve(root, relativePath);
9308
9415
  if (candidate === root || !isWithin(root, candidate)) {
9309
9416
  throw new Error("Knowledge workspace path escapes its root");
9310
9417
  }
@@ -9359,7 +9466,7 @@ async function initializeKnowledgeWorkspace(input) {
9359
9466
  if (!input.projectRoot || !input.rootPath) {
9360
9467
  throw new Error("A versioned knowledge workspace requires projectRoot and rootPath");
9361
9468
  }
9362
- projectRoot = path12.resolve(input.projectRoot);
9469
+ projectRoot = path13.resolve(input.projectRoot);
9363
9470
  rootPath = ensureVersionedPath(projectRoot, input.rootPath);
9364
9471
  if (await isIgnoredByGit(projectRoot, rootPath)) {
9365
9472
  throw new Error("The selected versioned knowledge workspace is ignored by Git");
@@ -9375,7 +9482,7 @@ async function initializeKnowledgeWorkspace(input) {
9375
9482
  const workspace = {
9376
9483
  id: workspaceId(input.projectId, input.mode),
9377
9484
  projectId: input.projectId,
9378
- dataDir: path12.resolve(input.dataDir),
9485
+ dataDir: path13.resolve(input.dataDir),
9379
9486
  mode: input.mode,
9380
9487
  rootPath: paths.root,
9381
9488
  ...projectRoot ? { projectRoot } : {},
@@ -9396,7 +9503,7 @@ async function loadKnowledgeWorkspace(input) {
9396
9503
  const store = new KnowledgeWorkspaceStore();
9397
9504
  await store.init(input.dataDir);
9398
9505
  const workspace = store.findWorkspace(input.projectId, input.mode ?? "local");
9399
- return workspace ? { ...workspace, dataDir: path12.resolve(input.dataDir) } : void 0;
9506
+ return workspace ? { ...workspace, dataDir: path13.resolve(input.dataDir) } : void 0;
9400
9507
  }
9401
9508
  var execFileAsync;
9402
9509
  var init_workspace = __esm({
@@ -10387,24 +10494,24 @@ __export(asset_store_exports, {
10387
10494
  });
10388
10495
  import { createHash as createHash4, randomUUID as randomUUID5 } from "crypto";
10389
10496
  import { copyFile, lstat, mkdir as mkdir3, open, readFile as readFile3, readdir, rename as rename2, rm, stat as stat2, writeFile as writeFile3 } from "fs/promises";
10390
- import path13 from "path";
10497
+ import path14 from "path";
10391
10498
  function mediaRoot(dataDir) {
10392
- return path13.resolve(dataDir, "media");
10499
+ return path14.resolve(dataDir, "media");
10393
10500
  }
10394
10501
  function projectStorageKey(projectId) {
10395
10502
  return createHash4("sha256").update(projectId).digest("hex").slice(0, 16);
10396
10503
  }
10397
10504
  function validateUnderRoot(root, candidate) {
10398
- const resolved = path13.resolve(candidate);
10399
- const relative3 = path13.relative(root, resolved);
10400
- if (relative3.startsWith("..") || path13.isAbsolute(relative3)) {
10505
+ const resolved = path14.resolve(candidate);
10506
+ const relative3 = path14.relative(root, resolved);
10507
+ if (relative3.startsWith("..") || path14.isAbsolute(relative3)) {
10401
10508
  throw new Error("Media storage path escaped the Memorix data directory");
10402
10509
  }
10403
10510
  return resolved;
10404
10511
  }
10405
10512
  function sanitizeLabel(value) {
10406
10513
  if (!value) return void 0;
10407
- const basename5 = sanitizeCredentials(path13.basename(value)).replace(/[\u0000-\u001f<>:"|?*]/g, "_").trim();
10514
+ const basename5 = sanitizeCredentials(path14.basename(value)).replace(/[\u0000-\u001f<>:"|?*]/g, "_").trim();
10408
10515
  return basename5 ? basename5.slice(0, 180) : void 0;
10409
10516
  }
10410
10517
  function matchesPrefix(bytes, prefix) {
@@ -10455,11 +10562,11 @@ async function sha256File(filePath) {
10455
10562
  return createHash4("sha256").update(bytes).digest("hex");
10456
10563
  }
10457
10564
  function destinationFor(root, projectId, sha256, extension3) {
10458
- const relative3 = path13.join("assets", projectStorageKey(projectId), sha256.slice(0, 2), `${sha256}${extension3}`);
10459
- return { relative: relative3, absolute: validateUnderRoot(root, path13.join(root, relative3)) };
10565
+ const relative3 = path14.join("assets", projectStorageKey(projectId), sha256.slice(0, 2), `${sha256}${extension3}`);
10566
+ return { relative: relative3, absolute: validateUnderRoot(root, path14.join(root, relative3)) };
10460
10567
  }
10461
10568
  function deletionStagingPath(root, assetId) {
10462
- return validateUnderRoot(root, path13.join(root, ".trash", `${assetId}.${randomUUID5()}.pending-delete`));
10569
+ return validateUnderRoot(root, path14.join(root, ".trash", `${assetId}.${randomUUID5()}.pending-delete`));
10463
10570
  }
10464
10571
  async function destinationExists(destination) {
10465
10572
  try {
@@ -10471,7 +10578,7 @@ async function destinationExists(destination) {
10471
10578
  }
10472
10579
  }
10473
10580
  async function persistFile(source, destination) {
10474
- await mkdir3(path13.dirname(destination), { recursive: true });
10581
+ await mkdir3(path14.dirname(destination), { recursive: true });
10475
10582
  if (await destinationExists(destination)) return false;
10476
10583
  const temporary = `${destination}.${randomUUID5()}.tmp`;
10477
10584
  try {
@@ -10487,7 +10594,7 @@ async function persistFile(source, destination) {
10487
10594
  }
10488
10595
  }
10489
10596
  async function persistBuffer(bytes, destination) {
10490
- await mkdir3(path13.dirname(destination), { recursive: true });
10597
+ await mkdir3(path14.dirname(destination), { recursive: true });
10491
10598
  if (await destinationExists(destination)) return false;
10492
10599
  const temporary = `${destination}.${randomUUID5()}.tmp`;
10493
10600
  try {
@@ -10503,7 +10610,7 @@ async function persistBuffer(bytes, destination) {
10503
10610
  }
10504
10611
  }
10505
10612
  function getMediaAssetPath(dataDir, asset) {
10506
- return validateUnderRoot(mediaRoot(dataDir), path13.join(mediaRoot(dataDir), asset.storageRelPath));
10613
+ return validateUnderRoot(mediaRoot(dataDir), path14.join(mediaRoot(dataDir), asset.storageRelPath));
10507
10614
  }
10508
10615
  async function importKnownMedia(input) {
10509
10616
  const root = mediaRoot(input.dataDir);
@@ -10531,7 +10638,7 @@ async function importKnownMedia(input) {
10531
10638
  }
10532
10639
  async function importMediaFile(input) {
10533
10640
  const maxBytes = input.maxBytes ?? DEFAULT_MAX_MEDIA_BYTES;
10534
- const source = path13.resolve(input.filePath);
10641
+ const source = path14.resolve(input.filePath);
10535
10642
  const stat5 = await lstat(source);
10536
10643
  if (stat5.isSymbolicLink()) throw new Error("Media import does not follow symbolic links");
10537
10644
  if (!stat5.isFile()) throw new Error("Media import accepts regular files only");
@@ -10548,7 +10655,7 @@ async function importMediaFile(input) {
10548
10655
  detected,
10549
10656
  persist: (destination) => persistFile(source, destination),
10550
10657
  sourceKind: input.sourceKind ?? "import",
10551
- sourceLabel: input.sourceLabel ?? path13.basename(source),
10658
+ sourceLabel: input.sourceLabel ?? path14.basename(source),
10552
10659
  provider: input.provider,
10553
10660
  model: input.model
10554
10661
  });
@@ -10590,7 +10697,7 @@ async function removeMediaAsset(input) {
10590
10697
  }
10591
10698
  const assetPath = getMediaAssetPath(input.dataDir, asset);
10592
10699
  const stagedPath = deletionStagingPath(mediaRoot(input.dataDir), asset.id);
10593
- await mkdir3(path13.dirname(stagedPath), { recursive: true });
10700
+ await mkdir3(path14.dirname(stagedPath), { recursive: true });
10594
10701
  await rename2(assetPath, stagedPath);
10595
10702
  let detachedLinks;
10596
10703
  try {
@@ -10611,7 +10718,7 @@ async function removeMediaAsset(input) {
10611
10718
  }
10612
10719
  async function cleanupMediaTrash(dataDir) {
10613
10720
  const root = mediaRoot(dataDir);
10614
- const trashDir = validateUnderRoot(root, path13.join(root, ".trash"));
10721
+ const trashDir = validateUnderRoot(root, path14.join(root, ".trash"));
10615
10722
  let entries;
10616
10723
  try {
10617
10724
  entries = await readdir(trashDir);
@@ -10624,7 +10731,7 @@ async function cleanupMediaTrash(dataDir) {
10624
10731
  let pendingFiles = 0;
10625
10732
  for (const name of entries) {
10626
10733
  if (!name.endsWith(".pending-delete")) continue;
10627
- const candidate = validateUnderRoot(trashDir, path13.join(trashDir, name));
10734
+ const candidate = validateUnderRoot(trashDir, path14.join(trashDir, name));
10628
10735
  try {
10629
10736
  const metadata = await lstat(candidate);
10630
10737
  if (!metadata.isFile()) continue;
@@ -20716,7 +20823,7 @@ var init_resource = __esm({
20716
20823
  function encodeURIPath(str2) {
20717
20824
  return str2.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
20718
20825
  }
20719
- var EMPTY, createPathTagFunction, path14;
20826
+ var EMPTY, createPathTagFunction, path15;
20720
20827
  var init_path = __esm({
20721
20828
  "node_modules/openai/internal/utils/path.mjs"() {
20722
20829
  "use strict";
@@ -20771,7 +20878,7 @@ ${underline}`);
20771
20878
  }
20772
20879
  return path38;
20773
20880
  };
20774
- path14 = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
20881
+ path15 = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
20775
20882
  }
20776
20883
  });
20777
20884
 
@@ -20800,7 +20907,7 @@ var init_messages = __esm({
20800
20907
  * ```
20801
20908
  */
20802
20909
  list(completionID, query = {}, options) {
20803
- return this._client.getAPIList(path14`/chat/completions/${completionID}/messages`, CursorPage, { query, ...options });
20910
+ return this._client.getAPIList(path15`/chat/completions/${completionID}/messages`, CursorPage, { query, ...options });
20804
20911
  }
20805
20912
  };
20806
20913
  }
@@ -22219,7 +22326,7 @@ var init_completions = __esm({
22219
22326
  * ```
22220
22327
  */
22221
22328
  retrieve(completionID, options) {
22222
- return this._client.get(path14`/chat/completions/${completionID}`, options);
22329
+ return this._client.get(path15`/chat/completions/${completionID}`, options);
22223
22330
  }
22224
22331
  /**
22225
22332
  * Modify a stored chat completion. Only Chat Completions that have been created
@@ -22235,7 +22342,7 @@ var init_completions = __esm({
22235
22342
  * ```
22236
22343
  */
22237
22344
  update(completionID, body, options) {
22238
- return this._client.post(path14`/chat/completions/${completionID}`, { body, ...options });
22345
+ return this._client.post(path15`/chat/completions/${completionID}`, { body, ...options });
22239
22346
  }
22240
22347
  /**
22241
22348
  * List stored Chat Completions. Only Chat Completions that have been stored with
@@ -22263,7 +22370,7 @@ var init_completions = __esm({
22263
22370
  * ```
22264
22371
  */
22265
22372
  delete(completionID, options) {
22266
- return this._client.delete(path14`/chat/completions/${completionID}`, options);
22373
+ return this._client.delete(path15`/chat/completions/${completionID}`, options);
22267
22374
  }
22268
22375
  parse(body, options) {
22269
22376
  validateInputTools(body.tools);
@@ -22533,7 +22640,7 @@ var init_batches = __esm({
22533
22640
  * Retrieves a batch.
22534
22641
  */
22535
22642
  retrieve(batchID, options) {
22536
- return this._client.get(path14`/batches/${batchID}`, options);
22643
+ return this._client.get(path15`/batches/${batchID}`, options);
22537
22644
  }
22538
22645
  /**
22539
22646
  * List your organization's batches.
@@ -22547,7 +22654,7 @@ var init_batches = __esm({
22547
22654
  * (if any) available in the output file.
22548
22655
  */
22549
22656
  cancel(batchID, options) {
22550
- return this._client.post(path14`/batches/${batchID}/cancel`, options);
22657
+ return this._client.post(path15`/batches/${batchID}/cancel`, options);
22551
22658
  }
22552
22659
  };
22553
22660
  }
@@ -22582,7 +22689,7 @@ var init_assistants = __esm({
22582
22689
  * @deprecated
22583
22690
  */
22584
22691
  retrieve(assistantID, options) {
22585
- return this._client.get(path14`/assistants/${assistantID}`, {
22692
+ return this._client.get(path15`/assistants/${assistantID}`, {
22586
22693
  ...options,
22587
22694
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
22588
22695
  });
@@ -22593,7 +22700,7 @@ var init_assistants = __esm({
22593
22700
  * @deprecated
22594
22701
  */
22595
22702
  update(assistantID, body, options) {
22596
- return this._client.post(path14`/assistants/${assistantID}`, {
22703
+ return this._client.post(path15`/assistants/${assistantID}`, {
22597
22704
  body,
22598
22705
  ...options,
22599
22706
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
@@ -22617,7 +22724,7 @@ var init_assistants = __esm({
22617
22724
  * @deprecated
22618
22725
  */
22619
22726
  delete(assistantID, options) {
22620
- return this._client.delete(path14`/assistants/${assistantID}`, {
22727
+ return this._client.delete(path15`/assistants/${assistantID}`, {
22621
22728
  ...options,
22622
22729
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
22623
22730
  });
@@ -22760,7 +22867,7 @@ var init_sessions2 = __esm({
22760
22867
  * ```
22761
22868
  */
22762
22869
  cancel(sessionID, options) {
22763
- return this._client.post(path14`/chatkit/sessions/${sessionID}/cancel`, {
22870
+ return this._client.post(path15`/chatkit/sessions/${sessionID}/cancel`, {
22764
22871
  ...options,
22765
22872
  headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
22766
22873
  });
@@ -22790,7 +22897,7 @@ var init_threads = __esm({
22790
22897
  * ```
22791
22898
  */
22792
22899
  retrieve(threadID, options) {
22793
- return this._client.get(path14`/chatkit/threads/${threadID}`, {
22900
+ return this._client.get(path15`/chatkit/threads/${threadID}`, {
22794
22901
  ...options,
22795
22902
  headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
22796
22903
  });
@@ -22824,7 +22931,7 @@ var init_threads = __esm({
22824
22931
  * ```
22825
22932
  */
22826
22933
  delete(threadID, options) {
22827
- return this._client.delete(path14`/chatkit/threads/${threadID}`, {
22934
+ return this._client.delete(path15`/chatkit/threads/${threadID}`, {
22828
22935
  ...options,
22829
22936
  headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
22830
22937
  });
@@ -22843,7 +22950,7 @@ var init_threads = __esm({
22843
22950
  * ```
22844
22951
  */
22845
22952
  listItems(threadID, query = {}, options) {
22846
- return this._client.getAPIList(path14`/chatkit/threads/${threadID}/items`, ConversationCursorPage, { query, ...options, headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]) });
22953
+ return this._client.getAPIList(path15`/chatkit/threads/${threadID}/items`, ConversationCursorPage, { query, ...options, headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]) });
22847
22954
  }
22848
22955
  };
22849
22956
  }
@@ -22889,7 +22996,7 @@ var init_messages2 = __esm({
22889
22996
  * @deprecated The Assistants API is deprecated in favor of the Responses API
22890
22997
  */
22891
22998
  create(threadID, body, options) {
22892
- return this._client.post(path14`/threads/${threadID}/messages`, {
22999
+ return this._client.post(path15`/threads/${threadID}/messages`, {
22893
23000
  body,
22894
23001
  ...options,
22895
23002
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
@@ -22902,7 +23009,7 @@ var init_messages2 = __esm({
22902
23009
  */
22903
23010
  retrieve(messageID, params, options) {
22904
23011
  const { thread_id } = params;
22905
- return this._client.get(path14`/threads/${thread_id}/messages/${messageID}`, {
23012
+ return this._client.get(path15`/threads/${thread_id}/messages/${messageID}`, {
22906
23013
  ...options,
22907
23014
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
22908
23015
  });
@@ -22914,7 +23021,7 @@ var init_messages2 = __esm({
22914
23021
  */
22915
23022
  update(messageID, params, options) {
22916
23023
  const { thread_id, ...body } = params;
22917
- return this._client.post(path14`/threads/${thread_id}/messages/${messageID}`, {
23024
+ return this._client.post(path15`/threads/${thread_id}/messages/${messageID}`, {
22918
23025
  body,
22919
23026
  ...options,
22920
23027
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
@@ -22926,7 +23033,7 @@ var init_messages2 = __esm({
22926
23033
  * @deprecated The Assistants API is deprecated in favor of the Responses API
22927
23034
  */
22928
23035
  list(threadID, query = {}, options) {
22929
- return this._client.getAPIList(path14`/threads/${threadID}/messages`, CursorPage, {
23036
+ return this._client.getAPIList(path15`/threads/${threadID}/messages`, CursorPage, {
22930
23037
  query,
22931
23038
  ...options,
22932
23039
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
@@ -22939,7 +23046,7 @@ var init_messages2 = __esm({
22939
23046
  */
22940
23047
  delete(messageID, params, options) {
22941
23048
  const { thread_id } = params;
22942
- return this._client.delete(path14`/threads/${thread_id}/messages/${messageID}`, {
23049
+ return this._client.delete(path15`/threads/${thread_id}/messages/${messageID}`, {
22943
23050
  ...options,
22944
23051
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
22945
23052
  });
@@ -22966,7 +23073,7 @@ var init_steps = __esm({
22966
23073
  */
22967
23074
  retrieve(stepID, params, options) {
22968
23075
  const { thread_id, run_id, ...query } = params;
22969
- return this._client.get(path14`/threads/${thread_id}/runs/${run_id}/steps/${stepID}`, {
23076
+ return this._client.get(path15`/threads/${thread_id}/runs/${run_id}/steps/${stepID}`, {
22970
23077
  query,
22971
23078
  ...options,
22972
23079
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
@@ -22979,7 +23086,7 @@ var init_steps = __esm({
22979
23086
  */
22980
23087
  list(runID, params, options) {
22981
23088
  const { thread_id, ...query } = params;
22982
- return this._client.getAPIList(path14`/threads/${thread_id}/runs/${runID}/steps`, CursorPage, {
23089
+ return this._client.getAPIList(path15`/threads/${thread_id}/runs/${runID}/steps`, CursorPage, {
22983
23090
  query,
22984
23091
  ...options,
22985
23092
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
@@ -23596,7 +23703,7 @@ var init_runs = __esm({
23596
23703
  }
23597
23704
  create(threadID, params, options) {
23598
23705
  const { include, ...body } = params;
23599
- return this._client.post(path14`/threads/${threadID}/runs`, {
23706
+ return this._client.post(path15`/threads/${threadID}/runs`, {
23600
23707
  query: { include },
23601
23708
  body,
23602
23709
  ...options,
@@ -23612,7 +23719,7 @@ var init_runs = __esm({
23612
23719
  */
23613
23720
  retrieve(runID, params, options) {
23614
23721
  const { thread_id } = params;
23615
- return this._client.get(path14`/threads/${thread_id}/runs/${runID}`, {
23722
+ return this._client.get(path15`/threads/${thread_id}/runs/${runID}`, {
23616
23723
  ...options,
23617
23724
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
23618
23725
  });
@@ -23624,7 +23731,7 @@ var init_runs = __esm({
23624
23731
  */
23625
23732
  update(runID, params, options) {
23626
23733
  const { thread_id, ...body } = params;
23627
- return this._client.post(path14`/threads/${thread_id}/runs/${runID}`, {
23734
+ return this._client.post(path15`/threads/${thread_id}/runs/${runID}`, {
23628
23735
  body,
23629
23736
  ...options,
23630
23737
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
@@ -23636,7 +23743,7 @@ var init_runs = __esm({
23636
23743
  * @deprecated The Assistants API is deprecated in favor of the Responses API
23637
23744
  */
23638
23745
  list(threadID, query = {}, options) {
23639
- return this._client.getAPIList(path14`/threads/${threadID}/runs`, CursorPage, {
23746
+ return this._client.getAPIList(path15`/threads/${threadID}/runs`, CursorPage, {
23640
23747
  query,
23641
23748
  ...options,
23642
23749
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
@@ -23649,7 +23756,7 @@ var init_runs = __esm({
23649
23756
  */
23650
23757
  cancel(runID, params, options) {
23651
23758
  const { thread_id } = params;
23652
- return this._client.post(path14`/threads/${thread_id}/runs/${runID}/cancel`, {
23759
+ return this._client.post(path15`/threads/${thread_id}/runs/${runID}/cancel`, {
23653
23760
  ...options,
23654
23761
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
23655
23762
  });
@@ -23727,7 +23834,7 @@ var init_runs = __esm({
23727
23834
  }
23728
23835
  submitToolOutputs(runID, params, options) {
23729
23836
  const { thread_id, ...body } = params;
23730
- return this._client.post(path14`/threads/${thread_id}/runs/${runID}/submit_tool_outputs`, {
23837
+ return this._client.post(path15`/threads/${thread_id}/runs/${runID}/submit_tool_outputs`, {
23731
23838
  body,
23732
23839
  ...options,
23733
23840
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
@@ -23795,7 +23902,7 @@ var init_threads2 = __esm({
23795
23902
  * @deprecated The Assistants API is deprecated in favor of the Responses API
23796
23903
  */
23797
23904
  retrieve(threadID, options) {
23798
- return this._client.get(path14`/threads/${threadID}`, {
23905
+ return this._client.get(path15`/threads/${threadID}`, {
23799
23906
  ...options,
23800
23907
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
23801
23908
  });
@@ -23806,7 +23913,7 @@ var init_threads2 = __esm({
23806
23913
  * @deprecated The Assistants API is deprecated in favor of the Responses API
23807
23914
  */
23808
23915
  update(threadID, body, options) {
23809
- return this._client.post(path14`/threads/${threadID}`, {
23916
+ return this._client.post(path15`/threads/${threadID}`, {
23810
23917
  body,
23811
23918
  ...options,
23812
23919
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
@@ -23818,7 +23925,7 @@ var init_threads2 = __esm({
23818
23925
  * @deprecated The Assistants API is deprecated in favor of the Responses API
23819
23926
  */
23820
23927
  delete(threadID, options) {
23821
- return this._client.delete(path14`/threads/${threadID}`, {
23928
+ return this._client.delete(path15`/threads/${threadID}`, {
23822
23929
  ...options,
23823
23930
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
23824
23931
  });
@@ -23914,7 +24021,7 @@ var init_content = __esm({
23914
24021
  */
23915
24022
  retrieve(fileID, params, options) {
23916
24023
  const { container_id } = params;
23917
- return this._client.get(path14`/containers/${container_id}/files/${fileID}/content`, {
24024
+ return this._client.get(path15`/containers/${container_id}/files/${fileID}/content`, {
23918
24025
  ...options,
23919
24026
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
23920
24027
  __binaryResponse: true
@@ -23949,20 +24056,20 @@ var init_files = __esm({
23949
24056
  * a JSON request with a file ID.
23950
24057
  */
23951
24058
  create(containerID, body, options) {
23952
- return this._client.post(path14`/containers/${containerID}/files`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
24059
+ return this._client.post(path15`/containers/${containerID}/files`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
23953
24060
  }
23954
24061
  /**
23955
24062
  * Retrieve Container File
23956
24063
  */
23957
24064
  retrieve(fileID, params, options) {
23958
24065
  const { container_id } = params;
23959
- return this._client.get(path14`/containers/${container_id}/files/${fileID}`, options);
24066
+ return this._client.get(path15`/containers/${container_id}/files/${fileID}`, options);
23960
24067
  }
23961
24068
  /**
23962
24069
  * List Container files
23963
24070
  */
23964
24071
  list(containerID, query = {}, options) {
23965
- return this._client.getAPIList(path14`/containers/${containerID}/files`, CursorPage, {
24072
+ return this._client.getAPIList(path15`/containers/${containerID}/files`, CursorPage, {
23966
24073
  query,
23967
24074
  ...options
23968
24075
  });
@@ -23972,7 +24079,7 @@ var init_files = __esm({
23972
24079
  */
23973
24080
  delete(fileID, params, options) {
23974
24081
  const { container_id } = params;
23975
- return this._client.delete(path14`/containers/${container_id}/files/${fileID}`, {
24082
+ return this._client.delete(path15`/containers/${container_id}/files/${fileID}`, {
23976
24083
  ...options,
23977
24084
  headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
23978
24085
  });
@@ -24009,7 +24116,7 @@ var init_containers = __esm({
24009
24116
  * Retrieve Container
24010
24117
  */
24011
24118
  retrieve(containerID, options) {
24012
- return this._client.get(path14`/containers/${containerID}`, options);
24119
+ return this._client.get(path15`/containers/${containerID}`, options);
24013
24120
  }
24014
24121
  /**
24015
24122
  * List Containers
@@ -24021,7 +24128,7 @@ var init_containers = __esm({
24021
24128
  * Delete Container
24022
24129
  */
24023
24130
  delete(containerID, options) {
24024
- return this._client.delete(path14`/containers/${containerID}`, {
24131
+ return this._client.delete(path15`/containers/${containerID}`, {
24025
24132
  ...options,
24026
24133
  headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
24027
24134
  });
@@ -24046,7 +24153,7 @@ var init_items = __esm({
24046
24153
  */
24047
24154
  create(conversationID, params, options) {
24048
24155
  const { include, ...body } = params;
24049
- return this._client.post(path14`/conversations/${conversationID}/items`, {
24156
+ return this._client.post(path15`/conversations/${conversationID}/items`, {
24050
24157
  query: { include },
24051
24158
  body,
24052
24159
  ...options
@@ -24057,20 +24164,20 @@ var init_items = __esm({
24057
24164
  */
24058
24165
  retrieve(itemID, params, options) {
24059
24166
  const { conversation_id, ...query } = params;
24060
- return this._client.get(path14`/conversations/${conversation_id}/items/${itemID}`, { query, ...options });
24167
+ return this._client.get(path15`/conversations/${conversation_id}/items/${itemID}`, { query, ...options });
24061
24168
  }
24062
24169
  /**
24063
24170
  * List all items for a conversation with the given ID.
24064
24171
  */
24065
24172
  list(conversationID, query = {}, options) {
24066
- return this._client.getAPIList(path14`/conversations/${conversationID}/items`, ConversationCursorPage, { query, ...options });
24173
+ return this._client.getAPIList(path15`/conversations/${conversationID}/items`, ConversationCursorPage, { query, ...options });
24067
24174
  }
24068
24175
  /**
24069
24176
  * Delete an item from a conversation with the given IDs.
24070
24177
  */
24071
24178
  delete(itemID, params, options) {
24072
24179
  const { conversation_id } = params;
24073
- return this._client.delete(path14`/conversations/${conversation_id}/items/${itemID}`, options);
24180
+ return this._client.delete(path15`/conversations/${conversation_id}/items/${itemID}`, options);
24074
24181
  }
24075
24182
  };
24076
24183
  }
@@ -24101,19 +24208,19 @@ var init_conversations = __esm({
24101
24208
  * Get a conversation
24102
24209
  */
24103
24210
  retrieve(conversationID, options) {
24104
- return this._client.get(path14`/conversations/${conversationID}`, options);
24211
+ return this._client.get(path15`/conversations/${conversationID}`, options);
24105
24212
  }
24106
24213
  /**
24107
24214
  * Update a conversation
24108
24215
  */
24109
24216
  update(conversationID, body, options) {
24110
- return this._client.post(path14`/conversations/${conversationID}`, { body, ...options });
24217
+ return this._client.post(path15`/conversations/${conversationID}`, { body, ...options });
24111
24218
  }
24112
24219
  /**
24113
24220
  * Delete a conversation. Items in the conversation will not be deleted.
24114
24221
  */
24115
24222
  delete(conversationID, options) {
24116
- return this._client.delete(path14`/conversations/${conversationID}`, options);
24223
+ return this._client.delete(path15`/conversations/${conversationID}`, options);
24117
24224
  }
24118
24225
  };
24119
24226
  Conversations.Items = Items;
@@ -24187,14 +24294,14 @@ var init_output_items = __esm({
24187
24294
  */
24188
24295
  retrieve(outputItemID, params, options) {
24189
24296
  const { eval_id, run_id } = params;
24190
- return this._client.get(path14`/evals/${eval_id}/runs/${run_id}/output_items/${outputItemID}`, options);
24297
+ return this._client.get(path15`/evals/${eval_id}/runs/${run_id}/output_items/${outputItemID}`, options);
24191
24298
  }
24192
24299
  /**
24193
24300
  * Get a list of output items for an evaluation run.
24194
24301
  */
24195
24302
  list(runID, params, options) {
24196
24303
  const { eval_id, ...query } = params;
24197
- return this._client.getAPIList(path14`/evals/${eval_id}/runs/${runID}/output_items`, CursorPage, { query, ...options });
24304
+ return this._client.getAPIList(path15`/evals/${eval_id}/runs/${runID}/output_items`, CursorPage, { query, ...options });
24198
24305
  }
24199
24306
  };
24200
24307
  }
@@ -24222,20 +24329,20 @@ var init_runs2 = __esm({
24222
24329
  * schema specified in the config of the evaluation.
24223
24330
  */
24224
24331
  create(evalID, body, options) {
24225
- return this._client.post(path14`/evals/${evalID}/runs`, { body, ...options });
24332
+ return this._client.post(path15`/evals/${evalID}/runs`, { body, ...options });
24226
24333
  }
24227
24334
  /**
24228
24335
  * Get an evaluation run by ID.
24229
24336
  */
24230
24337
  retrieve(runID, params, options) {
24231
24338
  const { eval_id } = params;
24232
- return this._client.get(path14`/evals/${eval_id}/runs/${runID}`, options);
24339
+ return this._client.get(path15`/evals/${eval_id}/runs/${runID}`, options);
24233
24340
  }
24234
24341
  /**
24235
24342
  * Get a list of runs for an evaluation.
24236
24343
  */
24237
24344
  list(evalID, query = {}, options) {
24238
- return this._client.getAPIList(path14`/evals/${evalID}/runs`, CursorPage, {
24345
+ return this._client.getAPIList(path15`/evals/${evalID}/runs`, CursorPage, {
24239
24346
  query,
24240
24347
  ...options
24241
24348
  });
@@ -24245,14 +24352,14 @@ var init_runs2 = __esm({
24245
24352
  */
24246
24353
  delete(runID, params, options) {
24247
24354
  const { eval_id } = params;
24248
- return this._client.delete(path14`/evals/${eval_id}/runs/${runID}`, options);
24355
+ return this._client.delete(path15`/evals/${eval_id}/runs/${runID}`, options);
24249
24356
  }
24250
24357
  /**
24251
24358
  * Cancel an ongoing evaluation run.
24252
24359
  */
24253
24360
  cancel(runID, params, options) {
24254
24361
  const { eval_id } = params;
24255
- return this._client.post(path14`/evals/${eval_id}/runs/${runID}`, options);
24362
+ return this._client.post(path15`/evals/${eval_id}/runs/${runID}`, options);
24256
24363
  }
24257
24364
  };
24258
24365
  Runs2.OutputItems = OutputItems;
@@ -24290,13 +24397,13 @@ var init_evals = __esm({
24290
24397
  * Get an evaluation by ID.
24291
24398
  */
24292
24399
  retrieve(evalID, options) {
24293
- return this._client.get(path14`/evals/${evalID}`, options);
24400
+ return this._client.get(path15`/evals/${evalID}`, options);
24294
24401
  }
24295
24402
  /**
24296
24403
  * Update certain properties of an evaluation.
24297
24404
  */
24298
24405
  update(evalID, body, options) {
24299
- return this._client.post(path14`/evals/${evalID}`, { body, ...options });
24406
+ return this._client.post(path15`/evals/${evalID}`, { body, ...options });
24300
24407
  }
24301
24408
  /**
24302
24409
  * List evaluations for a project.
@@ -24308,7 +24415,7 @@ var init_evals = __esm({
24308
24415
  * Delete an evaluation.
24309
24416
  */
24310
24417
  delete(evalID, options) {
24311
- return this._client.delete(path14`/evals/${evalID}`, options);
24418
+ return this._client.delete(path15`/evals/${evalID}`, options);
24312
24419
  }
24313
24420
  };
24314
24421
  Evals.Runs = Runs2;
@@ -24358,7 +24465,7 @@ var init_files2 = __esm({
24358
24465
  * Returns information about a specific file.
24359
24466
  */
24360
24467
  retrieve(fileID, options) {
24361
- return this._client.get(path14`/files/${fileID}`, options);
24468
+ return this._client.get(path15`/files/${fileID}`, options);
24362
24469
  }
24363
24470
  /**
24364
24471
  * Returns a list of files.
@@ -24370,13 +24477,13 @@ var init_files2 = __esm({
24370
24477
  * Delete a file and remove it from all vector stores.
24371
24478
  */
24372
24479
  delete(fileID, options) {
24373
- return this._client.delete(path14`/files/${fileID}`, options);
24480
+ return this._client.delete(path15`/files/${fileID}`, options);
24374
24481
  }
24375
24482
  /**
24376
24483
  * Returns the contents of the specified file.
24377
24484
  */
24378
24485
  content(fileID, options) {
24379
- return this._client.get(path14`/files/${fileID}/content`, {
24486
+ return this._client.get(path15`/files/${fileID}/content`, {
24380
24487
  ...options,
24381
24488
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
24382
24489
  __binaryResponse: true
@@ -24515,7 +24622,7 @@ var init_permissions = __esm({
24515
24622
  * ```
24516
24623
  */
24517
24624
  create(fineTunedModelCheckpoint, body, options) {
24518
- return this._client.getAPIList(path14`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, Page, { body, method: "post", ...options });
24625
+ return this._client.getAPIList(path15`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, Page, { body, method: "post", ...options });
24519
24626
  }
24520
24627
  /**
24521
24628
  * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
@@ -24526,7 +24633,7 @@ var init_permissions = __esm({
24526
24633
  * @deprecated Retrieve is deprecated. Please swap to the paginated list method instead.
24527
24634
  */
24528
24635
  retrieve(fineTunedModelCheckpoint, query = {}, options) {
24529
- return this._client.get(path14`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, {
24636
+ return this._client.get(path15`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, {
24530
24637
  query,
24531
24638
  ...options
24532
24639
  });
@@ -24548,7 +24655,7 @@ var init_permissions = __esm({
24548
24655
  * ```
24549
24656
  */
24550
24657
  list(fineTunedModelCheckpoint, query = {}, options) {
24551
- return this._client.getAPIList(path14`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, ConversationCursorPage, { query, ...options });
24658
+ return this._client.getAPIList(path15`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, ConversationCursorPage, { query, ...options });
24552
24659
  }
24553
24660
  /**
24554
24661
  * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
@@ -24570,7 +24677,7 @@ var init_permissions = __esm({
24570
24677
  */
24571
24678
  delete(permissionID, params, options) {
24572
24679
  const { fine_tuned_model_checkpoint } = params;
24573
- return this._client.delete(path14`/fine_tuning/checkpoints/${fine_tuned_model_checkpoint}/permissions/${permissionID}`, options);
24680
+ return this._client.delete(path15`/fine_tuning/checkpoints/${fine_tuned_model_checkpoint}/permissions/${permissionID}`, options);
24574
24681
  }
24575
24682
  };
24576
24683
  }
@@ -24619,7 +24726,7 @@ var init_checkpoints2 = __esm({
24619
24726
  * ```
24620
24727
  */
24621
24728
  list(fineTuningJobID, query = {}, options) {
24622
- return this._client.getAPIList(path14`/fine_tuning/jobs/${fineTuningJobID}/checkpoints`, CursorPage, { query, ...options });
24729
+ return this._client.getAPIList(path15`/fine_tuning/jobs/${fineTuningJobID}/checkpoints`, CursorPage, { query, ...options });
24623
24730
  }
24624
24731
  };
24625
24732
  }
@@ -24674,7 +24781,7 @@ var init_jobs = __esm({
24674
24781
  * ```
24675
24782
  */
24676
24783
  retrieve(fineTuningJobID, options) {
24677
- return this._client.get(path14`/fine_tuning/jobs/${fineTuningJobID}`, options);
24784
+ return this._client.get(path15`/fine_tuning/jobs/${fineTuningJobID}`, options);
24678
24785
  }
24679
24786
  /**
24680
24787
  * List your organization's fine-tuning jobs
@@ -24701,7 +24808,7 @@ var init_jobs = __esm({
24701
24808
  * ```
24702
24809
  */
24703
24810
  cancel(fineTuningJobID, options) {
24704
- return this._client.post(path14`/fine_tuning/jobs/${fineTuningJobID}/cancel`, options);
24811
+ return this._client.post(path15`/fine_tuning/jobs/${fineTuningJobID}/cancel`, options);
24705
24812
  }
24706
24813
  /**
24707
24814
  * Get status updates for a fine-tuning job.
@@ -24717,7 +24824,7 @@ var init_jobs = __esm({
24717
24824
  * ```
24718
24825
  */
24719
24826
  listEvents(fineTuningJobID, query = {}, options) {
24720
- return this._client.getAPIList(path14`/fine_tuning/jobs/${fineTuningJobID}/events`, CursorPage, { query, ...options });
24827
+ return this._client.getAPIList(path15`/fine_tuning/jobs/${fineTuningJobID}/events`, CursorPage, { query, ...options });
24721
24828
  }
24722
24829
  /**
24723
24830
  * Pause a fine-tune job.
@@ -24730,7 +24837,7 @@ var init_jobs = __esm({
24730
24837
  * ```
24731
24838
  */
24732
24839
  pause(fineTuningJobID, options) {
24733
- return this._client.post(path14`/fine_tuning/jobs/${fineTuningJobID}/pause`, options);
24840
+ return this._client.post(path15`/fine_tuning/jobs/${fineTuningJobID}/pause`, options);
24734
24841
  }
24735
24842
  /**
24736
24843
  * Resume a fine-tune job.
@@ -24743,7 +24850,7 @@ var init_jobs = __esm({
24743
24850
  * ```
24744
24851
  */
24745
24852
  resume(fineTuningJobID, options) {
24746
- return this._client.post(path14`/fine_tuning/jobs/${fineTuningJobID}/resume`, options);
24853
+ return this._client.post(path15`/fine_tuning/jobs/${fineTuningJobID}/resume`, options);
24747
24854
  }
24748
24855
  };
24749
24856
  Jobs.Checkpoints = Checkpoints2;
@@ -24859,7 +24966,7 @@ var init_models = __esm({
24859
24966
  * the owner and permissioning.
24860
24967
  */
24861
24968
  retrieve(model, options) {
24862
- return this._client.get(path14`/models/${model}`, options);
24969
+ return this._client.get(path15`/models/${model}`, options);
24863
24970
  }
24864
24971
  /**
24865
24972
  * Lists the currently available models, and provides basic information about each
@@ -24873,7 +24980,7 @@ var init_models = __esm({
24873
24980
  * delete a model.
24874
24981
  */
24875
24982
  delete(model, options) {
24876
- return this._client.delete(path14`/models/${model}`, options);
24983
+ return this._client.delete(path15`/models/${model}`, options);
24877
24984
  }
24878
24985
  };
24879
24986
  }
@@ -24920,7 +25027,7 @@ var init_calls = __esm({
24920
25027
  * ```
24921
25028
  */
24922
25029
  accept(callID, body, options) {
24923
- return this._client.post(path14`/realtime/calls/${callID}/accept`, {
25030
+ return this._client.post(path15`/realtime/calls/${callID}/accept`, {
24924
25031
  body,
24925
25032
  ...options,
24926
25033
  headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
@@ -24935,7 +25042,7 @@ var init_calls = __esm({
24935
25042
  * ```
24936
25043
  */
24937
25044
  hangup(callID, options) {
24938
- return this._client.post(path14`/realtime/calls/${callID}/hangup`, {
25045
+ return this._client.post(path15`/realtime/calls/${callID}/hangup`, {
24939
25046
  ...options,
24940
25047
  headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
24941
25048
  });
@@ -24951,7 +25058,7 @@ var init_calls = __esm({
24951
25058
  * ```
24952
25059
  */
24953
25060
  refer(callID, body, options) {
24954
- return this._client.post(path14`/realtime/calls/${callID}/refer`, {
25061
+ return this._client.post(path15`/realtime/calls/${callID}/refer`, {
24955
25062
  body,
24956
25063
  ...options,
24957
25064
  headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
@@ -24966,7 +25073,7 @@ var init_calls = __esm({
24966
25073
  * ```
24967
25074
  */
24968
25075
  reject(callID, body = {}, options) {
24969
- return this._client.post(path14`/realtime/calls/${callID}/reject`, {
25076
+ return this._client.post(path15`/realtime/calls/${callID}/reject`, {
24970
25077
  body,
24971
25078
  ...options,
24972
25079
  headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
@@ -25455,7 +25562,7 @@ var init_input_items = __esm({
25455
25562
  * ```
25456
25563
  */
25457
25564
  list(responseID, query = {}, options) {
25458
- return this._client.getAPIList(path14`/responses/${responseID}/input_items`, CursorPage, { query, ...options });
25565
+ return this._client.getAPIList(path15`/responses/${responseID}/input_items`, CursorPage, { query, ...options });
25459
25566
  }
25460
25567
  };
25461
25568
  }
@@ -25517,7 +25624,7 @@ var init_responses = __esm({
25517
25624
  });
25518
25625
  }
25519
25626
  retrieve(responseID, query = {}, options) {
25520
- return this._client.get(path14`/responses/${responseID}`, {
25627
+ return this._client.get(path15`/responses/${responseID}`, {
25521
25628
  query,
25522
25629
  ...options,
25523
25630
  stream: query?.stream ?? false
@@ -25539,7 +25646,7 @@ var init_responses = __esm({
25539
25646
  * ```
25540
25647
  */
25541
25648
  delete(responseID, options) {
25542
- return this._client.delete(path14`/responses/${responseID}`, {
25649
+ return this._client.delete(path15`/responses/${responseID}`, {
25543
25650
  ...options,
25544
25651
  headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
25545
25652
  });
@@ -25566,7 +25673,7 @@ var init_responses = __esm({
25566
25673
  * ```
25567
25674
  */
25568
25675
  cancel(responseID, options) {
25569
- return this._client.post(path14`/responses/${responseID}/cancel`, options);
25676
+ return this._client.post(path15`/responses/${responseID}/cancel`, options);
25570
25677
  }
25571
25678
  /**
25572
25679
  * Compact a conversation. Returns a compacted response object.
@@ -25606,7 +25713,7 @@ var init_content2 = __esm({
25606
25713
  * Download a skill zip bundle by its ID.
25607
25714
  */
25608
25715
  retrieve(skillID, options) {
25609
- return this._client.get(path14`/skills/${skillID}/content`, {
25716
+ return this._client.get(path15`/skills/${skillID}/content`, {
25610
25717
  ...options,
25611
25718
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
25612
25719
  __binaryResponse: true
@@ -25631,7 +25738,7 @@ var init_content3 = __esm({
25631
25738
  */
25632
25739
  retrieve(version, params, options) {
25633
25740
  const { skill_id } = params;
25634
- return this._client.get(path14`/skills/${skill_id}/versions/${version}/content`, {
25741
+ return this._client.get(path15`/skills/${skill_id}/versions/${version}/content`, {
25635
25742
  ...options,
25636
25743
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
25637
25744
  __binaryResponse: true
@@ -25662,20 +25769,20 @@ var init_versions = __esm({
25662
25769
  * Create a new immutable skill version.
25663
25770
  */
25664
25771
  create(skillID, body = {}, options) {
25665
- return this._client.post(path14`/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
25772
+ return this._client.post(path15`/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
25666
25773
  }
25667
25774
  /**
25668
25775
  * Get a specific skill version.
25669
25776
  */
25670
25777
  retrieve(version, params, options) {
25671
25778
  const { skill_id } = params;
25672
- return this._client.get(path14`/skills/${skill_id}/versions/${version}`, options);
25779
+ return this._client.get(path15`/skills/${skill_id}/versions/${version}`, options);
25673
25780
  }
25674
25781
  /**
25675
25782
  * List skill versions for a skill.
25676
25783
  */
25677
25784
  list(skillID, query = {}, options) {
25678
- return this._client.getAPIList(path14`/skills/${skillID}/versions`, CursorPage, {
25785
+ return this._client.getAPIList(path15`/skills/${skillID}/versions`, CursorPage, {
25679
25786
  query,
25680
25787
  ...options
25681
25788
  });
@@ -25685,7 +25792,7 @@ var init_versions = __esm({
25685
25792
  */
25686
25793
  delete(version, params, options) {
25687
25794
  const { skill_id } = params;
25688
- return this._client.delete(path14`/skills/${skill_id}/versions/${version}`, options);
25795
+ return this._client.delete(path15`/skills/${skill_id}/versions/${version}`, options);
25689
25796
  }
25690
25797
  };
25691
25798
  Versions.Content = Content3;
@@ -25722,13 +25829,13 @@ var init_skills = __esm({
25722
25829
  * Get a skill by its ID.
25723
25830
  */
25724
25831
  retrieve(skillID, options) {
25725
- return this._client.get(path14`/skills/${skillID}`, options);
25832
+ return this._client.get(path15`/skills/${skillID}`, options);
25726
25833
  }
25727
25834
  /**
25728
25835
  * Update the default version pointer for a skill.
25729
25836
  */
25730
25837
  update(skillID, body, options) {
25731
- return this._client.post(path14`/skills/${skillID}`, { body, ...options });
25838
+ return this._client.post(path15`/skills/${skillID}`, { body, ...options });
25732
25839
  }
25733
25840
  /**
25734
25841
  * List all skills for the current project.
@@ -25740,7 +25847,7 @@ var init_skills = __esm({
25740
25847
  * Delete a skill by its ID.
25741
25848
  */
25742
25849
  delete(skillID, options) {
25743
- return this._client.delete(path14`/skills/${skillID}`, options);
25850
+ return this._client.delete(path15`/skills/${skillID}`, options);
25744
25851
  }
25745
25852
  };
25746
25853
  Skills.Content = Content2;
@@ -25772,7 +25879,7 @@ var init_parts = __esm({
25772
25879
  * [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete).
25773
25880
  */
25774
25881
  create(uploadID, body, options) {
25775
- return this._client.post(path14`/uploads/${uploadID}/parts`, multipartFormRequestOptions({ body, ...options }, this._client));
25882
+ return this._client.post(path15`/uploads/${uploadID}/parts`, multipartFormRequestOptions({ body, ...options }, this._client));
25776
25883
  }
25777
25884
  };
25778
25885
  }
@@ -25825,7 +25932,7 @@ var init_uploads3 = __esm({
25825
25932
  * Returns the Upload object with status `cancelled`.
25826
25933
  */
25827
25934
  cancel(uploadID, options) {
25828
- return this._client.post(path14`/uploads/${uploadID}/cancel`, options);
25935
+ return this._client.post(path15`/uploads/${uploadID}/cancel`, options);
25829
25936
  }
25830
25937
  /**
25831
25938
  * Completes the
@@ -25845,7 +25952,7 @@ var init_uploads3 = __esm({
25845
25952
  * object.
25846
25953
  */
25847
25954
  complete(uploadID, body, options) {
25848
- return this._client.post(path14`/uploads/${uploadID}/complete`, { body, ...options });
25955
+ return this._client.post(path15`/uploads/${uploadID}/complete`, { body, ...options });
25849
25956
  }
25850
25957
  };
25851
25958
  Uploads.Parts = Parts;
@@ -25895,7 +26002,7 @@ var init_file_batches = __esm({
25895
26002
  * Create a vector store file batch.
25896
26003
  */
25897
26004
  create(vectorStoreID, body, options) {
25898
- return this._client.post(path14`/vector_stores/${vectorStoreID}/file_batches`, {
26005
+ return this._client.post(path15`/vector_stores/${vectorStoreID}/file_batches`, {
25899
26006
  body,
25900
26007
  ...options,
25901
26008
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
@@ -25906,7 +26013,7 @@ var init_file_batches = __esm({
25906
26013
  */
25907
26014
  retrieve(batchID, params, options) {
25908
26015
  const { vector_store_id } = params;
25909
- return this._client.get(path14`/vector_stores/${vector_store_id}/file_batches/${batchID}`, {
26016
+ return this._client.get(path15`/vector_stores/${vector_store_id}/file_batches/${batchID}`, {
25910
26017
  ...options,
25911
26018
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
25912
26019
  });
@@ -25917,7 +26024,7 @@ var init_file_batches = __esm({
25917
26024
  */
25918
26025
  cancel(batchID, params, options) {
25919
26026
  const { vector_store_id } = params;
25920
- return this._client.post(path14`/vector_stores/${vector_store_id}/file_batches/${batchID}/cancel`, {
26027
+ return this._client.post(path15`/vector_stores/${vector_store_id}/file_batches/${batchID}/cancel`, {
25921
26028
  ...options,
25922
26029
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
25923
26030
  });
@@ -25934,7 +26041,7 @@ var init_file_batches = __esm({
25934
26041
  */
25935
26042
  listFiles(batchID, params, options) {
25936
26043
  const { vector_store_id, ...query } = params;
25937
- return this._client.getAPIList(path14`/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, CursorPage, { query, ...options, headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]) });
26044
+ return this._client.getAPIList(path15`/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, CursorPage, { query, ...options, headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]) });
25938
26045
  }
25939
26046
  /**
25940
26047
  * Wait for the given file batch to be processed.
@@ -26026,7 +26133,7 @@ var init_files3 = __esm({
26026
26133
  * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object).
26027
26134
  */
26028
26135
  create(vectorStoreID, body, options) {
26029
- return this._client.post(path14`/vector_stores/${vectorStoreID}/files`, {
26136
+ return this._client.post(path15`/vector_stores/${vectorStoreID}/files`, {
26030
26137
  body,
26031
26138
  ...options,
26032
26139
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
@@ -26037,7 +26144,7 @@ var init_files3 = __esm({
26037
26144
  */
26038
26145
  retrieve(fileID, params, options) {
26039
26146
  const { vector_store_id } = params;
26040
- return this._client.get(path14`/vector_stores/${vector_store_id}/files/${fileID}`, {
26147
+ return this._client.get(path15`/vector_stores/${vector_store_id}/files/${fileID}`, {
26041
26148
  ...options,
26042
26149
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
26043
26150
  });
@@ -26047,7 +26154,7 @@ var init_files3 = __esm({
26047
26154
  */
26048
26155
  update(fileID, params, options) {
26049
26156
  const { vector_store_id, ...body } = params;
26050
- return this._client.post(path14`/vector_stores/${vector_store_id}/files/${fileID}`, {
26157
+ return this._client.post(path15`/vector_stores/${vector_store_id}/files/${fileID}`, {
26051
26158
  body,
26052
26159
  ...options,
26053
26160
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
@@ -26057,7 +26164,7 @@ var init_files3 = __esm({
26057
26164
  * Returns a list of vector store files.
26058
26165
  */
26059
26166
  list(vectorStoreID, query = {}, options) {
26060
- return this._client.getAPIList(path14`/vector_stores/${vectorStoreID}/files`, CursorPage, {
26167
+ return this._client.getAPIList(path15`/vector_stores/${vectorStoreID}/files`, CursorPage, {
26061
26168
  query,
26062
26169
  ...options,
26063
26170
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
@@ -26071,7 +26178,7 @@ var init_files3 = __esm({
26071
26178
  */
26072
26179
  delete(fileID, params, options) {
26073
26180
  const { vector_store_id } = params;
26074
- return this._client.delete(path14`/vector_stores/${vector_store_id}/files/${fileID}`, {
26181
+ return this._client.delete(path15`/vector_stores/${vector_store_id}/files/${fileID}`, {
26075
26182
  ...options,
26076
26183
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
26077
26184
  });
@@ -26146,7 +26253,7 @@ var init_files3 = __esm({
26146
26253
  */
26147
26254
  content(fileID, params, options) {
26148
26255
  const { vector_store_id } = params;
26149
- return this._client.getAPIList(path14`/vector_stores/${vector_store_id}/files/${fileID}/content`, Page, { ...options, headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]) });
26256
+ return this._client.getAPIList(path15`/vector_stores/${vector_store_id}/files/${fileID}/content`, Page, { ...options, headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]) });
26150
26257
  }
26151
26258
  };
26152
26259
  }
@@ -26186,7 +26293,7 @@ var init_vector_stores = __esm({
26186
26293
  * Retrieves a vector store.
26187
26294
  */
26188
26295
  retrieve(vectorStoreID, options) {
26189
- return this._client.get(path14`/vector_stores/${vectorStoreID}`, {
26296
+ return this._client.get(path15`/vector_stores/${vectorStoreID}`, {
26190
26297
  ...options,
26191
26298
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
26192
26299
  });
@@ -26195,7 +26302,7 @@ var init_vector_stores = __esm({
26195
26302
  * Modifies a vector store.
26196
26303
  */
26197
26304
  update(vectorStoreID, body, options) {
26198
- return this._client.post(path14`/vector_stores/${vectorStoreID}`, {
26305
+ return this._client.post(path15`/vector_stores/${vectorStoreID}`, {
26199
26306
  body,
26200
26307
  ...options,
26201
26308
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
@@ -26215,7 +26322,7 @@ var init_vector_stores = __esm({
26215
26322
  * Delete a vector store.
26216
26323
  */
26217
26324
  delete(vectorStoreID, options) {
26218
- return this._client.delete(path14`/vector_stores/${vectorStoreID}`, {
26325
+ return this._client.delete(path15`/vector_stores/${vectorStoreID}`, {
26219
26326
  ...options,
26220
26327
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
26221
26328
  });
@@ -26225,7 +26332,7 @@ var init_vector_stores = __esm({
26225
26332
  * filter.
26226
26333
  */
26227
26334
  search(vectorStoreID, body, options) {
26228
- return this._client.getAPIList(path14`/vector_stores/${vectorStoreID}/search`, Page, {
26335
+ return this._client.getAPIList(path15`/vector_stores/${vectorStoreID}/search`, Page, {
26229
26336
  body,
26230
26337
  method: "post",
26231
26338
  ...options,
@@ -26260,7 +26367,7 @@ var init_videos = __esm({
26260
26367
  * Fetch the latest metadata for a generated video.
26261
26368
  */
26262
26369
  retrieve(videoID, options) {
26263
- return this._client.get(path14`/videos/${videoID}`, options);
26370
+ return this._client.get(path15`/videos/${videoID}`, options);
26264
26371
  }
26265
26372
  /**
26266
26373
  * List recently generated videos for the current project.
@@ -26272,7 +26379,7 @@ var init_videos = __esm({
26272
26379
  * Permanently delete a completed or failed video and its stored assets.
26273
26380
  */
26274
26381
  delete(videoID, options) {
26275
- return this._client.delete(path14`/videos/${videoID}`, options);
26382
+ return this._client.delete(path15`/videos/${videoID}`, options);
26276
26383
  }
26277
26384
  /**
26278
26385
  * Download the generated video bytes or a derived preview asset.
@@ -26280,7 +26387,7 @@ var init_videos = __esm({
26280
26387
  * Streams the rendered video content for the specified video job.
26281
26388
  */
26282
26389
  downloadContent(videoID, query = {}, options) {
26283
- return this._client.get(path14`/videos/${videoID}/content`, {
26390
+ return this._client.get(path15`/videos/${videoID}/content`, {
26284
26391
  query,
26285
26392
  ...options,
26286
26393
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
@@ -26291,7 +26398,7 @@ var init_videos = __esm({
26291
26398
  * Create a remix of a completed video using a refreshed prompt.
26292
26399
  */
26293
26400
  remix(videoID, body, options) {
26294
- return this._client.post(path14`/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
26401
+ return this._client.post(path15`/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
26295
26402
  }
26296
26403
  };
26297
26404
  }
@@ -47175,7 +47282,7 @@ var init_headers3 = __esm({
47175
47282
  function encodeURIPath2(str2) {
47176
47283
  return str2.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
47177
47284
  }
47178
- var EMPTY2, createPathTagFunction2, path15;
47285
+ var EMPTY2, createPathTagFunction2, path16;
47179
47286
  var init_path2 = __esm({
47180
47287
  "node_modules/@anthropic-ai/sdk/internal/utils/path.mjs"() {
47181
47288
  "use strict";
@@ -47230,7 +47337,7 @@ ${underline}`);
47230
47337
  }
47231
47338
  return path38;
47232
47339
  };
47233
- path15 = /* @__PURE__ */ createPathTagFunction2(encodeURIPath2);
47340
+ path16 = /* @__PURE__ */ createPathTagFunction2(encodeURIPath2);
47234
47341
  }
47235
47342
  });
47236
47343
 
@@ -47280,7 +47387,7 @@ var init_environments = __esm({
47280
47387
  */
47281
47388
  retrieve(environmentID, params = {}, options) {
47282
47389
  const { betas } = params ?? {};
47283
- return this._client.get(path15`/v1/environments/${environmentID}?beta=true`, {
47390
+ return this._client.get(path16`/v1/environments/${environmentID}?beta=true`, {
47284
47391
  ...options,
47285
47392
  headers: buildHeaders3([
47286
47393
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -47301,7 +47408,7 @@ var init_environments = __esm({
47301
47408
  */
47302
47409
  update(environmentID, params, options) {
47303
47410
  const { betas, ...body } = params;
47304
- return this._client.post(path15`/v1/environments/${environmentID}?beta=true`, {
47411
+ return this._client.post(path16`/v1/environments/${environmentID}?beta=true`, {
47305
47412
  body,
47306
47413
  ...options,
47307
47414
  headers: buildHeaders3([
@@ -47345,7 +47452,7 @@ var init_environments = __esm({
47345
47452
  */
47346
47453
  delete(environmentID, params = {}, options) {
47347
47454
  const { betas } = params ?? {};
47348
- return this._client.delete(path15`/v1/environments/${environmentID}?beta=true`, {
47455
+ return this._client.delete(path16`/v1/environments/${environmentID}?beta=true`, {
47349
47456
  ...options,
47350
47457
  headers: buildHeaders3([
47351
47458
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -47367,7 +47474,7 @@ var init_environments = __esm({
47367
47474
  */
47368
47475
  archive(environmentID, params = {}, options) {
47369
47476
  const { betas } = params ?? {};
47370
- return this._client.post(path15`/v1/environments/${environmentID}/archive?beta=true`, {
47477
+ return this._client.post(path16`/v1/environments/${environmentID}/archive?beta=true`, {
47371
47478
  ...options,
47372
47479
  headers: buildHeaders3([
47373
47480
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -47476,7 +47583,7 @@ var init_files4 = __esm({
47476
47583
  */
47477
47584
  delete(fileID, params = {}, options) {
47478
47585
  const { betas } = params ?? {};
47479
- return this._client.delete(path15`/v1/files/${fileID}?beta=true`, {
47586
+ return this._client.delete(path16`/v1/files/${fileID}?beta=true`, {
47480
47587
  ...options,
47481
47588
  headers: buildHeaders3([
47482
47589
  { "anthropic-beta": [...betas ?? [], "files-api-2025-04-14"].toString() },
@@ -47499,7 +47606,7 @@ var init_files4 = __esm({
47499
47606
  */
47500
47607
  download(fileID, params = {}, options) {
47501
47608
  const { betas } = params ?? {};
47502
- return this._client.get(path15`/v1/files/${fileID}/content?beta=true`, {
47609
+ return this._client.get(path16`/v1/files/${fileID}/content?beta=true`, {
47503
47610
  ...options,
47504
47611
  headers: buildHeaders3([
47505
47612
  {
@@ -47522,7 +47629,7 @@ var init_files4 = __esm({
47522
47629
  */
47523
47630
  retrieveMetadata(fileID, params = {}, options) {
47524
47631
  const { betas } = params ?? {};
47525
- return this._client.get(path15`/v1/files/${fileID}?beta=true`, {
47632
+ return this._client.get(path16`/v1/files/${fileID}?beta=true`, {
47526
47633
  ...options,
47527
47634
  headers: buildHeaders3([
47528
47635
  { "anthropic-beta": [...betas ?? [], "files-api-2025-04-14"].toString() },
@@ -47582,7 +47689,7 @@ var init_models3 = __esm({
47582
47689
  */
47583
47690
  retrieve(modelID, params = {}, options) {
47584
47691
  const { betas } = params ?? {};
47585
- return this._client.get(path15`/v1/models/${modelID}?beta=true`, {
47692
+ return this._client.get(path16`/v1/models/${modelID}?beta=true`, {
47586
47693
  ...options,
47587
47694
  headers: buildHeaders3([
47588
47695
  { ...betas?.toString() != null ? { "anthropic-beta": betas?.toString() } : void 0 },
@@ -47663,7 +47770,7 @@ var init_user_profiles = __esm({
47663
47770
  */
47664
47771
  retrieve(userProfileID, params = {}, options) {
47665
47772
  const { betas } = params ?? {};
47666
- return this._client.get(path15`/v1/user_profiles/${userProfileID}?beta=true`, {
47773
+ return this._client.get(path16`/v1/user_profiles/${userProfileID}?beta=true`, {
47667
47774
  ...options,
47668
47775
  headers: buildHeaders3([
47669
47776
  { "anthropic-beta": [...betas ?? [], "user-profiles-2026-03-24"].toString() },
@@ -47684,7 +47791,7 @@ var init_user_profiles = __esm({
47684
47791
  */
47685
47792
  update(userProfileID, params, options) {
47686
47793
  const { betas, ...body } = params;
47687
- return this._client.post(path15`/v1/user_profiles/${userProfileID}?beta=true`, {
47794
+ return this._client.post(path16`/v1/user_profiles/${userProfileID}?beta=true`, {
47688
47795
  body,
47689
47796
  ...options,
47690
47797
  headers: buildHeaders3([
@@ -47728,7 +47835,7 @@ var init_user_profiles = __esm({
47728
47835
  */
47729
47836
  createEnrollmentURL(userProfileID, params = {}, options) {
47730
47837
  const { betas } = params ?? {};
47731
- return this._client.post(path15`/v1/user_profiles/${userProfileID}/enrollment_url?beta=true`, {
47838
+ return this._client.post(path16`/v1/user_profiles/${userProfileID}/enrollment_url?beta=true`, {
47732
47839
  ...options,
47733
47840
  headers: buildHeaders3([
47734
47841
  { "anthropic-beta": [...betas ?? [], "user-profiles-2026-03-24"].toString() },
@@ -47766,7 +47873,7 @@ var init_versions2 = __esm({
47766
47873
  */
47767
47874
  list(agentID, params = {}, options) {
47768
47875
  const { betas, ...query } = params ?? {};
47769
- return this._client.getAPIList(path15`/v1/agents/${agentID}/versions?beta=true`, PageCursor, {
47876
+ return this._client.getAPIList(path16`/v1/agents/${agentID}/versions?beta=true`, PageCursor, {
47770
47877
  query,
47771
47878
  ...options,
47772
47879
  headers: buildHeaders3([
@@ -47832,7 +47939,7 @@ var init_agents = __esm({
47832
47939
  */
47833
47940
  retrieve(agentID, params = {}, options) {
47834
47941
  const { betas, ...query } = params ?? {};
47835
- return this._client.get(path15`/v1/agents/${agentID}?beta=true`, {
47942
+ return this._client.get(path16`/v1/agents/${agentID}?beta=true`, {
47836
47943
  query,
47837
47944
  ...options,
47838
47945
  headers: buildHeaders3([
@@ -47855,7 +47962,7 @@ var init_agents = __esm({
47855
47962
  */
47856
47963
  update(agentID, params, options) {
47857
47964
  const { betas, ...body } = params;
47858
- return this._client.post(path15`/v1/agents/${agentID}?beta=true`, {
47965
+ return this._client.post(path16`/v1/agents/${agentID}?beta=true`, {
47859
47966
  body,
47860
47967
  ...options,
47861
47968
  headers: buildHeaders3([
@@ -47899,7 +48006,7 @@ var init_agents = __esm({
47899
48006
  */
47900
48007
  archive(agentID, params = {}, options) {
47901
48008
  const { betas } = params ?? {};
47902
- return this._client.post(path15`/v1/agents/${agentID}/archive?beta=true`, {
48009
+ return this._client.post(path16`/v1/agents/${agentID}/archive?beta=true`, {
47903
48010
  ...options,
47904
48011
  headers: buildHeaders3([
47905
48012
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -47937,7 +48044,7 @@ var init_memories = __esm({
47937
48044
  */
47938
48045
  create(memoryStoreID, params, options) {
47939
48046
  const { view, betas, ...body } = params;
47940
- return this._client.post(path15`/v1/memory_stores/${memoryStoreID}/memories?beta=true`, {
48047
+ return this._client.post(path16`/v1/memory_stores/${memoryStoreID}/memories?beta=true`, {
47941
48048
  query: { view },
47942
48049
  body,
47943
48050
  ...options,
@@ -47961,7 +48068,7 @@ var init_memories = __esm({
47961
48068
  */
47962
48069
  retrieve(memoryID, params, options) {
47963
48070
  const { memory_store_id, betas, ...query } = params;
47964
- return this._client.get(path15`/v1/memory_stores/${memory_store_id}/memories/${memoryID}?beta=true`, {
48071
+ return this._client.get(path16`/v1/memory_stores/${memory_store_id}/memories/${memoryID}?beta=true`, {
47965
48072
  query,
47966
48073
  ...options,
47967
48074
  headers: buildHeaders3([
@@ -47984,7 +48091,7 @@ var init_memories = __esm({
47984
48091
  */
47985
48092
  update(memoryID, params, options) {
47986
48093
  const { memory_store_id, view, betas, ...body } = params;
47987
- return this._client.post(path15`/v1/memory_stores/${memory_store_id}/memories/${memoryID}?beta=true`, {
48094
+ return this._client.post(path16`/v1/memory_stores/${memory_store_id}/memories/${memoryID}?beta=true`, {
47988
48095
  query: { view },
47989
48096
  body,
47990
48097
  ...options,
@@ -48009,7 +48116,7 @@ var init_memories = __esm({
48009
48116
  */
48010
48117
  list(memoryStoreID, params = {}, options) {
48011
48118
  const { betas, ...query } = params ?? {};
48012
- return this._client.getAPIList(path15`/v1/memory_stores/${memoryStoreID}/memories?beta=true`, PageCursor, {
48119
+ return this._client.getAPIList(path16`/v1/memory_stores/${memoryStoreID}/memories?beta=true`, PageCursor, {
48013
48120
  query,
48014
48121
  ...options,
48015
48122
  headers: buildHeaders3([
@@ -48032,7 +48139,7 @@ var init_memories = __esm({
48032
48139
  */
48033
48140
  delete(memoryID, params, options) {
48034
48141
  const { memory_store_id, expected_content_sha256, betas } = params;
48035
- return this._client.delete(path15`/v1/memory_stores/${memory_store_id}/memories/${memoryID}?beta=true`, {
48142
+ return this._client.delete(path16`/v1/memory_stores/${memory_store_id}/memories/${memoryID}?beta=true`, {
48036
48143
  query: { expected_content_sha256 },
48037
48144
  ...options,
48038
48145
  headers: buildHeaders3([
@@ -48070,7 +48177,7 @@ var init_memory_versions = __esm({
48070
48177
  */
48071
48178
  retrieve(memoryVersionID, params, options) {
48072
48179
  const { memory_store_id, betas, ...query } = params;
48073
- return this._client.get(path15`/v1/memory_stores/${memory_store_id}/memory_versions/${memoryVersionID}?beta=true`, {
48180
+ return this._client.get(path16`/v1/memory_stores/${memory_store_id}/memory_versions/${memoryVersionID}?beta=true`, {
48074
48181
  query,
48075
48182
  ...options,
48076
48183
  headers: buildHeaders3([
@@ -48094,7 +48201,7 @@ var init_memory_versions = __esm({
48094
48201
  */
48095
48202
  list(memoryStoreID, params = {}, options) {
48096
48203
  const { betas, ...query } = params ?? {};
48097
- return this._client.getAPIList(path15`/v1/memory_stores/${memoryStoreID}/memory_versions?beta=true`, PageCursor, {
48204
+ return this._client.getAPIList(path16`/v1/memory_stores/${memoryStoreID}/memory_versions?beta=true`, PageCursor, {
48098
48205
  query,
48099
48206
  ...options,
48100
48207
  headers: buildHeaders3([
@@ -48117,7 +48224,7 @@ var init_memory_versions = __esm({
48117
48224
  */
48118
48225
  redact(memoryVersionID, params, options) {
48119
48226
  const { memory_store_id, betas } = params;
48120
- return this._client.post(path15`/v1/memory_stores/${memory_store_id}/memory_versions/${memoryVersionID}/redact?beta=true`, {
48227
+ return this._client.post(path16`/v1/memory_stores/${memory_store_id}/memory_versions/${memoryVersionID}/redact?beta=true`, {
48121
48228
  ...options,
48122
48229
  headers: buildHeaders3([
48123
48230
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -48182,7 +48289,7 @@ var init_memory_stores = __esm({
48182
48289
  */
48183
48290
  retrieve(memoryStoreID, params = {}, options) {
48184
48291
  const { betas } = params ?? {};
48185
- return this._client.get(path15`/v1/memory_stores/${memoryStoreID}?beta=true`, {
48292
+ return this._client.get(path16`/v1/memory_stores/${memoryStoreID}?beta=true`, {
48186
48293
  ...options,
48187
48294
  headers: buildHeaders3([
48188
48295
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -48201,7 +48308,7 @@ var init_memory_stores = __esm({
48201
48308
  */
48202
48309
  update(memoryStoreID, params, options) {
48203
48310
  const { betas, ...body } = params;
48204
- return this._client.post(path15`/v1/memory_stores/${memoryStoreID}?beta=true`, {
48311
+ return this._client.post(path16`/v1/memory_stores/${memoryStoreID}?beta=true`, {
48205
48312
  body,
48206
48313
  ...options,
48207
48314
  headers: buildHeaders3([
@@ -48243,7 +48350,7 @@ var init_memory_stores = __esm({
48243
48350
  */
48244
48351
  delete(memoryStoreID, params = {}, options) {
48245
48352
  const { betas } = params ?? {};
48246
- return this._client.delete(path15`/v1/memory_stores/${memoryStoreID}?beta=true`, {
48353
+ return this._client.delete(path16`/v1/memory_stores/${memoryStoreID}?beta=true`, {
48247
48354
  ...options,
48248
48355
  headers: buildHeaders3([
48249
48356
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -48262,7 +48369,7 @@ var init_memory_stores = __esm({
48262
48369
  */
48263
48370
  archive(memoryStoreID, params = {}, options) {
48264
48371
  const { betas } = params ?? {};
48265
- return this._client.post(path15`/v1/memory_stores/${memoryStoreID}/archive?beta=true`, {
48372
+ return this._client.post(path16`/v1/memory_stores/${memoryStoreID}/archive?beta=true`, {
48266
48373
  ...options,
48267
48374
  headers: buildHeaders3([
48268
48375
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -49745,7 +49852,7 @@ var init_batches2 = __esm({
49745
49852
  */
49746
49853
  retrieve(messageBatchID, params = {}, options) {
49747
49854
  const { betas } = params ?? {};
49748
- return this._client.get(path15`/v1/messages/batches/${messageBatchID}?beta=true`, {
49855
+ return this._client.get(path16`/v1/messages/batches/${messageBatchID}?beta=true`, {
49749
49856
  ...options,
49750
49857
  headers: buildHeaders3([
49751
49858
  { "anthropic-beta": [...betas ?? [], "message-batches-2024-09-24"].toString() },
@@ -49798,7 +49905,7 @@ var init_batches2 = __esm({
49798
49905
  */
49799
49906
  delete(messageBatchID, params = {}, options) {
49800
49907
  const { betas } = params ?? {};
49801
- return this._client.delete(path15`/v1/messages/batches/${messageBatchID}?beta=true`, {
49908
+ return this._client.delete(path16`/v1/messages/batches/${messageBatchID}?beta=true`, {
49802
49909
  ...options,
49803
49910
  headers: buildHeaders3([
49804
49911
  { "anthropic-beta": [...betas ?? [], "message-batches-2024-09-24"].toString() },
@@ -49830,7 +49937,7 @@ var init_batches2 = __esm({
49830
49937
  */
49831
49938
  cancel(messageBatchID, params = {}, options) {
49832
49939
  const { betas } = params ?? {};
49833
- return this._client.post(path15`/v1/messages/batches/${messageBatchID}/cancel?beta=true`, {
49940
+ return this._client.post(path16`/v1/messages/batches/${messageBatchID}/cancel?beta=true`, {
49834
49941
  ...options,
49835
49942
  headers: buildHeaders3([
49836
49943
  { "anthropic-beta": [...betas ?? [], "message-batches-2024-09-24"].toString() },
@@ -50059,7 +50166,7 @@ var init_events = __esm({
50059
50166
  */
50060
50167
  list(sessionID, params = {}, options) {
50061
50168
  const { betas, ...query } = params ?? {};
50062
- return this._client.getAPIList(path15`/v1/sessions/${sessionID}/events?beta=true`, PageCursor, {
50169
+ return this._client.getAPIList(path16`/v1/sessions/${sessionID}/events?beta=true`, PageCursor, {
50063
50170
  query,
50064
50171
  ...options,
50065
50172
  headers: buildHeaders3([
@@ -50094,7 +50201,7 @@ var init_events = __esm({
50094
50201
  */
50095
50202
  send(sessionID, params, options) {
50096
50203
  const { betas, ...body } = params;
50097
- return this._client.post(path15`/v1/sessions/${sessionID}/events?beta=true`, {
50204
+ return this._client.post(path16`/v1/sessions/${sessionID}/events?beta=true`, {
50098
50205
  body,
50099
50206
  ...options,
50100
50207
  headers: buildHeaders3([
@@ -50116,7 +50223,7 @@ var init_events = __esm({
50116
50223
  */
50117
50224
  stream(sessionID, params = {}, options) {
50118
50225
  const { betas } = params ?? {};
50119
- return this._client.get(path15`/v1/sessions/${sessionID}/events/stream?beta=true`, {
50226
+ return this._client.get(path16`/v1/sessions/${sessionID}/events/stream?beta=true`, {
50120
50227
  ...options,
50121
50228
  headers: buildHeaders3([
50122
50229
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -50154,7 +50261,7 @@ var init_resources2 = __esm({
50154
50261
  */
50155
50262
  retrieve(resourceID, params, options) {
50156
50263
  const { session_id, betas } = params;
50157
- return this._client.get(path15`/v1/sessions/${session_id}/resources/${resourceID}?beta=true`, {
50264
+ return this._client.get(path16`/v1/sessions/${session_id}/resources/${resourceID}?beta=true`, {
50158
50265
  ...options,
50159
50266
  headers: buildHeaders3([
50160
50267
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -50179,7 +50286,7 @@ var init_resources2 = __esm({
50179
50286
  */
50180
50287
  update(resourceID, params, options) {
50181
50288
  const { session_id, betas, ...body } = params;
50182
- return this._client.post(path15`/v1/sessions/${session_id}/resources/${resourceID}?beta=true`, {
50289
+ return this._client.post(path16`/v1/sessions/${session_id}/resources/${resourceID}?beta=true`, {
50183
50290
  body,
50184
50291
  ...options,
50185
50292
  headers: buildHeaders3([
@@ -50203,7 +50310,7 @@ var init_resources2 = __esm({
50203
50310
  */
50204
50311
  list(sessionID, params = {}, options) {
50205
50312
  const { betas, ...query } = params ?? {};
50206
- return this._client.getAPIList(path15`/v1/sessions/${sessionID}/resources?beta=true`, PageCursor, {
50313
+ return this._client.getAPIList(path16`/v1/sessions/${sessionID}/resources?beta=true`, PageCursor, {
50207
50314
  query,
50208
50315
  ...options,
50209
50316
  headers: buildHeaders3([
@@ -50226,7 +50333,7 @@ var init_resources2 = __esm({
50226
50333
  */
50227
50334
  delete(resourceID, params, options) {
50228
50335
  const { session_id, betas } = params;
50229
- return this._client.delete(path15`/v1/sessions/${session_id}/resources/${resourceID}?beta=true`, {
50336
+ return this._client.delete(path16`/v1/sessions/${session_id}/resources/${resourceID}?beta=true`, {
50230
50337
  ...options,
50231
50338
  headers: buildHeaders3([
50232
50339
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -50251,7 +50358,7 @@ var init_resources2 = __esm({
50251
50358
  */
50252
50359
  add(sessionID, params, options) {
50253
50360
  const { betas, ...body } = params;
50254
- return this._client.post(path15`/v1/sessions/${sessionID}/resources?beta=true`, {
50361
+ return this._client.post(path16`/v1/sessions/${sessionID}/resources?beta=true`, {
50255
50362
  body,
50256
50363
  ...options,
50257
50364
  headers: buildHeaders3([
@@ -50320,7 +50427,7 @@ var init_sessions3 = __esm({
50320
50427
  */
50321
50428
  retrieve(sessionID, params = {}, options) {
50322
50429
  const { betas } = params ?? {};
50323
- return this._client.get(path15`/v1/sessions/${sessionID}?beta=true`, {
50430
+ return this._client.get(path16`/v1/sessions/${sessionID}?beta=true`, {
50324
50431
  ...options,
50325
50432
  headers: buildHeaders3([
50326
50433
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -50341,7 +50448,7 @@ var init_sessions3 = __esm({
50341
50448
  */
50342
50449
  update(sessionID, params, options) {
50343
50450
  const { betas, ...body } = params;
50344
- return this._client.post(path15`/v1/sessions/${sessionID}?beta=true`, {
50451
+ return this._client.post(path16`/v1/sessions/${sessionID}?beta=true`, {
50345
50452
  body,
50346
50453
  ...options,
50347
50454
  headers: buildHeaders3([
@@ -50385,7 +50492,7 @@ var init_sessions3 = __esm({
50385
50492
  */
50386
50493
  delete(sessionID, params = {}, options) {
50387
50494
  const { betas } = params ?? {};
50388
- return this._client.delete(path15`/v1/sessions/${sessionID}?beta=true`, {
50495
+ return this._client.delete(path16`/v1/sessions/${sessionID}?beta=true`, {
50389
50496
  ...options,
50390
50497
  headers: buildHeaders3([
50391
50498
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -50406,7 +50513,7 @@ var init_sessions3 = __esm({
50406
50513
  */
50407
50514
  archive(sessionID, params = {}, options) {
50408
50515
  const { betas } = params ?? {};
50409
- return this._client.post(path15`/v1/sessions/${sessionID}/archive?beta=true`, {
50516
+ return this._client.post(path16`/v1/sessions/${sessionID}/archive?beta=true`, {
50410
50517
  ...options,
50411
50518
  headers: buildHeaders3([
50412
50519
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -50444,7 +50551,7 @@ var init_versions3 = __esm({
50444
50551
  */
50445
50552
  create(skillID, params = {}, options) {
50446
50553
  const { betas, ...body } = params ?? {};
50447
- return this._client.post(path15`/v1/skills/${skillID}/versions?beta=true`, multipartFormRequestOptions2({
50554
+ return this._client.post(path16`/v1/skills/${skillID}/versions?beta=true`, multipartFormRequestOptions2({
50448
50555
  body,
50449
50556
  ...options,
50450
50557
  headers: buildHeaders3([
@@ -50466,7 +50573,7 @@ var init_versions3 = __esm({
50466
50573
  */
50467
50574
  retrieve(version, params, options) {
50468
50575
  const { skill_id, betas } = params;
50469
- return this._client.get(path15`/v1/skills/${skill_id}/versions/${version}?beta=true`, {
50576
+ return this._client.get(path16`/v1/skills/${skill_id}/versions/${version}?beta=true`, {
50470
50577
  ...options,
50471
50578
  headers: buildHeaders3([
50472
50579
  { "anthropic-beta": [...betas ?? [], "skills-2025-10-02"].toString() },
@@ -50489,7 +50596,7 @@ var init_versions3 = __esm({
50489
50596
  */
50490
50597
  list(skillID, params = {}, options) {
50491
50598
  const { betas, ...query } = params ?? {};
50492
- return this._client.getAPIList(path15`/v1/skills/${skillID}/versions?beta=true`, PageCursor, {
50599
+ return this._client.getAPIList(path16`/v1/skills/${skillID}/versions?beta=true`, PageCursor, {
50493
50600
  query,
50494
50601
  ...options,
50495
50602
  headers: buildHeaders3([
@@ -50511,7 +50618,7 @@ var init_versions3 = __esm({
50511
50618
  */
50512
50619
  delete(version, params, options) {
50513
50620
  const { skill_id, betas } = params;
50514
- return this._client.delete(path15`/v1/skills/${skill_id}/versions/${version}?beta=true`, {
50621
+ return this._client.delete(path16`/v1/skills/${skill_id}/versions/${version}?beta=true`, {
50515
50622
  ...options,
50516
50623
  headers: buildHeaders3([
50517
50624
  { "anthropic-beta": [...betas ?? [], "skills-2025-10-02"].toString() },
@@ -50570,7 +50677,7 @@ var init_skills2 = __esm({
50570
50677
  */
50571
50678
  retrieve(skillID, params = {}, options) {
50572
50679
  const { betas } = params ?? {};
50573
- return this._client.get(path15`/v1/skills/${skillID}?beta=true`, {
50680
+ return this._client.get(path16`/v1/skills/${skillID}?beta=true`, {
50574
50681
  ...options,
50575
50682
  headers: buildHeaders3([
50576
50683
  { "anthropic-beta": [...betas ?? [], "skills-2025-10-02"].toString() },
@@ -50610,7 +50717,7 @@ var init_skills2 = __esm({
50610
50717
  */
50611
50718
  delete(skillID, params = {}, options) {
50612
50719
  const { betas } = params ?? {};
50613
- return this._client.delete(path15`/v1/skills/${skillID}?beta=true`, {
50720
+ return this._client.delete(path16`/v1/skills/${skillID}?beta=true`, {
50614
50721
  ...options,
50615
50722
  headers: buildHeaders3([
50616
50723
  { "anthropic-beta": [...betas ?? [], "skills-2025-10-02"].toString() },
@@ -50655,7 +50762,7 @@ var init_credentials = __esm({
50655
50762
  */
50656
50763
  create(vaultID, params, options) {
50657
50764
  const { betas, ...body } = params;
50658
- return this._client.post(path15`/v1/vaults/${vaultID}/credentials?beta=true`, {
50765
+ return this._client.post(path16`/v1/vaults/${vaultID}/credentials?beta=true`, {
50659
50766
  body,
50660
50767
  ...options,
50661
50768
  headers: buildHeaders3([
@@ -50678,7 +50785,7 @@ var init_credentials = __esm({
50678
50785
  */
50679
50786
  retrieve(credentialID, params, options) {
50680
50787
  const { vault_id, betas } = params;
50681
- return this._client.get(path15`/v1/vaults/${vault_id}/credentials/${credentialID}?beta=true`, {
50788
+ return this._client.get(path16`/v1/vaults/${vault_id}/credentials/${credentialID}?beta=true`, {
50682
50789
  ...options,
50683
50790
  headers: buildHeaders3([
50684
50791
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -50700,7 +50807,7 @@ var init_credentials = __esm({
50700
50807
  */
50701
50808
  update(credentialID, params, options) {
50702
50809
  const { vault_id, betas, ...body } = params;
50703
- return this._client.post(path15`/v1/vaults/${vault_id}/credentials/${credentialID}?beta=true`, {
50810
+ return this._client.post(path16`/v1/vaults/${vault_id}/credentials/${credentialID}?beta=true`, {
50704
50811
  body,
50705
50812
  ...options,
50706
50813
  headers: buildHeaders3([
@@ -50724,7 +50831,7 @@ var init_credentials = __esm({
50724
50831
  */
50725
50832
  list(vaultID, params = {}, options) {
50726
50833
  const { betas, ...query } = params ?? {};
50727
- return this._client.getAPIList(path15`/v1/vaults/${vaultID}/credentials?beta=true`, PageCursor, {
50834
+ return this._client.getAPIList(path16`/v1/vaults/${vaultID}/credentials?beta=true`, PageCursor, {
50728
50835
  query,
50729
50836
  ...options,
50730
50837
  headers: buildHeaders3([
@@ -50747,7 +50854,7 @@ var init_credentials = __esm({
50747
50854
  */
50748
50855
  delete(credentialID, params, options) {
50749
50856
  const { vault_id, betas } = params;
50750
- return this._client.delete(path15`/v1/vaults/${vault_id}/credentials/${credentialID}?beta=true`, {
50857
+ return this._client.delete(path16`/v1/vaults/${vault_id}/credentials/${credentialID}?beta=true`, {
50751
50858
  ...options,
50752
50859
  headers: buildHeaders3([
50753
50860
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -50769,7 +50876,7 @@ var init_credentials = __esm({
50769
50876
  */
50770
50877
  archive(credentialID, params, options) {
50771
50878
  const { vault_id, betas } = params;
50772
- return this._client.post(path15`/v1/vaults/${vault_id}/credentials/${credentialID}/archive?beta=true`, {
50879
+ return this._client.post(path16`/v1/vaults/${vault_id}/credentials/${credentialID}/archive?beta=true`, {
50773
50880
  ...options,
50774
50881
  headers: buildHeaders3([
50775
50882
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -50833,7 +50940,7 @@ var init_vaults = __esm({
50833
50940
  */
50834
50941
  retrieve(vaultID, params = {}, options) {
50835
50942
  const { betas } = params ?? {};
50836
- return this._client.get(path15`/v1/vaults/${vaultID}?beta=true`, {
50943
+ return this._client.get(path16`/v1/vaults/${vaultID}?beta=true`, {
50837
50944
  ...options,
50838
50945
  headers: buildHeaders3([
50839
50946
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -50854,7 +50961,7 @@ var init_vaults = __esm({
50854
50961
  */
50855
50962
  update(vaultID, params, options) {
50856
50963
  const { betas, ...body } = params;
50857
- return this._client.post(path15`/v1/vaults/${vaultID}?beta=true`, {
50964
+ return this._client.post(path16`/v1/vaults/${vaultID}?beta=true`, {
50858
50965
  body,
50859
50966
  ...options,
50860
50967
  headers: buildHeaders3([
@@ -50898,7 +51005,7 @@ var init_vaults = __esm({
50898
51005
  */
50899
51006
  delete(vaultID, params = {}, options) {
50900
51007
  const { betas } = params ?? {};
50901
- return this._client.delete(path15`/v1/vaults/${vaultID}?beta=true`, {
51008
+ return this._client.delete(path16`/v1/vaults/${vaultID}?beta=true`, {
50902
51009
  ...options,
50903
51010
  headers: buildHeaders3([
50904
51011
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -50919,7 +51026,7 @@ var init_vaults = __esm({
50919
51026
  */
50920
51027
  archive(vaultID, params = {}, options) {
50921
51028
  const { betas } = params ?? {};
50922
- return this._client.post(path15`/v1/vaults/${vaultID}/archive?beta=true`, {
51029
+ return this._client.post(path16`/v1/vaults/${vaultID}/archive?beta=true`, {
50923
51030
  ...options,
50924
51031
  headers: buildHeaders3([
50925
51032
  { "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
@@ -51720,7 +51827,7 @@ var init_batches3 = __esm({
51720
51827
  * ```
51721
51828
  */
51722
51829
  retrieve(messageBatchID, options) {
51723
- return this._client.get(path15`/v1/messages/batches/${messageBatchID}`, options);
51830
+ return this._client.get(path16`/v1/messages/batches/${messageBatchID}`, options);
51724
51831
  }
51725
51832
  /**
51726
51833
  * List all Message Batches within a Workspace. Most recently created batches are
@@ -51756,7 +51863,7 @@ var init_batches3 = __esm({
51756
51863
  * ```
51757
51864
  */
51758
51865
  delete(messageBatchID, options) {
51759
- return this._client.delete(path15`/v1/messages/batches/${messageBatchID}`, options);
51866
+ return this._client.delete(path16`/v1/messages/batches/${messageBatchID}`, options);
51760
51867
  }
51761
51868
  /**
51762
51869
  * Batches may be canceled any time before processing ends. Once cancellation is
@@ -51780,7 +51887,7 @@ var init_batches3 = __esm({
51780
51887
  * ```
51781
51888
  */
51782
51889
  cancel(messageBatchID, options) {
51783
- return this._client.post(path15`/v1/messages/batches/${messageBatchID}/cancel`, options);
51890
+ return this._client.post(path16`/v1/messages/batches/${messageBatchID}/cancel`, options);
51784
51891
  }
51785
51892
  /**
51786
51893
  * Streams the results of a Message Batch as a `.jsonl` file.
@@ -51965,7 +52072,7 @@ var init_models4 = __esm({
51965
52072
  */
51966
52073
  retrieve(modelID, params = {}, options) {
51967
52074
  const { betas } = params ?? {};
51968
- return this._client.get(path15`/v1/models/${modelID}`, {
52075
+ return this._client.get(path16`/v1/models/${modelID}`, {
51969
52076
  ...options,
51970
52077
  headers: buildHeaders3([
51971
52078
  { ...betas?.toString() != null ? { "anthropic-beta": betas?.toString() } : void 0 },
@@ -56125,7 +56232,7 @@ var require_supports_color = __commonJS({
56125
56232
  "node_modules/supports-color/index.js"(exports, module) {
56126
56233
  "use strict";
56127
56234
  init_esm_shims();
56128
- var os4 = __require("os");
56235
+ var os6 = __require("os");
56129
56236
  var tty = __require("tty");
56130
56237
  var hasFlag = require_has_flag();
56131
56238
  var { env: env2 } = process;
@@ -56182,7 +56289,7 @@ var require_supports_color = __commonJS({
56182
56289
  return min;
56183
56290
  }
56184
56291
  if (process.platform === "win32") {
56185
- const osRelease = os4.release().split(".");
56292
+ const osRelease = os6.release().split(".");
56186
56293
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
56187
56294
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
56188
56295
  }
@@ -66966,7 +67073,7 @@ var require_util2 = __commonJS({
66966
67073
  exports.isValidFile = isValidFile;
66967
67074
  exports.getWellKnownCertificateConfigFileLocation = getWellKnownCertificateConfigFileLocation;
66968
67075
  var fs22 = __require("fs");
66969
- var os4 = __require("os");
67076
+ var os6 = __require("os");
66970
67077
  var path37 = __require("path");
66971
67078
  var WELL_KNOWN_CERTIFICATE_CONFIG_FILE = "certificate_config.json";
66972
67079
  var CLOUDSDK_CONFIG_DIRECTORY = "gcloud";
@@ -67064,7 +67171,7 @@ var require_util2 = __commonJS({
67064
67171
  return path37.join(configDir, WELL_KNOWN_CERTIFICATE_CONFIG_FILE);
67065
67172
  }
67066
67173
  function _isWindows() {
67067
- return os4.platform().startsWith("win");
67174
+ return os6.platform().startsWith("win");
67068
67175
  }
67069
67176
  }
67070
67177
  });
@@ -72495,7 +72602,7 @@ var require_googleauth = __commonJS({
72495
72602
  var fs22 = __require("fs");
72496
72603
  var gaxios_1 = require_src2();
72497
72604
  var gcpMetadata = require_src4();
72498
- var os4 = __require("os");
72605
+ var os6 = __require("os");
72499
72606
  var path37 = __require("path");
72500
72607
  var crypto_1 = require_crypto3();
72501
72608
  var computeclient_1 = require_computeclient();
@@ -73002,7 +73109,7 @@ var require_googleauth = __commonJS({
73002
73109
  * @api private
73003
73110
  */
73004
73111
  _isWindows() {
73005
- const sys = os4.platform();
73112
+ const sys = os6.platform();
73006
73113
  if (sys && sys.length >= 3) {
73007
73114
  if (sys.substring(0, 3).toLowerCase() === "win") {
73008
73115
  return true;
@@ -88122,7 +88229,7 @@ function getApiKeyFromEnv() {
88122
88229
  }
88123
88230
  return envGoogleApiKey || envGeminiApiKey || void 0;
88124
88231
  }
88125
- var import_p_retry, import_google_auth_library, _defaultBaseGeminiUrl, _defaultBaseVertexUrl, BaseModule, Language, Outcome, FunctionResponseScheduling, Type, Environment, AuthType, HttpElementLocation, ApiSpec, PhishBlockThreshold, Behavior, DynamicRetrievalConfigMode, FunctionCallingConfigMode, ThinkingLevel, PersonGeneration, ProminentPeople, HarmCategory, HarmBlockMethod, HarmBlockThreshold, FinishReason, HarmProbability, HarmSeverity, UrlRetrievalStatus, BlockedReason, TrafficType, Modality, ModelStage, MediaResolution, TuningMode, AdapterSize, JobState, TuningJobState, AggregationMetric, PairwiseChoice, TuningTask, DocumentState, PartMediaResolutionLevel, ToolType, ResourceScope, ServiceTier, FeatureSelectionPreference, EmbeddingApiType, SafetyFilterLevel, ImagePromptLanguage, MaskReferenceMode, ControlReferenceType, SubjectReferenceType, EditMode, SegmentMode, VideoGenerationReferenceType, VideoGenerationMaskMode, VideoCompressionQuality, ImageResizeMode, TuningMethod, FileState, FileSource, TurnCompleteReason, MediaModality, VadSignalType, VoiceActivityType, StartSensitivity, EndSensitivity, ActivityHandling, TurnCoverage, Scale, MusicGenerationMode, LiveMusicPlaybackControl, HttpResponse, GenerateContentResponse, EmbedContentResponse, GenerateImagesResponse, EditImageResponse, UpscaleImageResponse, RecontextImageResponse, SegmentImageResponse, ListModelsResponse, DeleteModelResponse, CountTokensResponse, ComputeTokensResponse, GenerateVideosOperation, ListTuningJobsResponse, CancelTuningJobResponse, DeleteCachedContentResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, UploadToFileSearchStoreResumableResponse, ImportFileOperation, ListFilesResponse, CreateFileResponse, DeleteFileResponse, RegisterFilesResponse, ListBatchJobsResponse, LiveServerMessage, LiveMusicServerMessage, UploadToFileSearchStoreOperation, PagedItem, Pager, Batches4, Caches, Chats, Chat2, ApiError, Files5, CONTENT_TYPE_HEADER, SERVER_TIMEOUT_HEADER, USER_AGENT_HEADER, GOOGLE_API_CLIENT_HEADER, SDK_VERSION, LIBRARY_LABEL, VERTEX_AI_API_DEFAULT_VERSION, GOOGLE_AI_API_DEFAULT_VERSION, MULTI_REGIONAL_LOCATIONS, DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_HTTP_STATUS_CODES, ApiClient, MCP_LABEL, hasMcpToolUsageFromMcpToTool, McpCallableTool, LiveMusic, LiveMusicSession, FUNCTION_RESPONSE_REQUIRES_ID, Live, defaultLiveSendClientContentParamerters, Session, DEFAULT_MAX_REMOTE_CALLS, Models4, Operations, Tokens, Documents, FileSearchStores, uuid4Internal, uuid43, castToError3, GeminiNextGenAPIClientError, APIError3, APIUserAbortError3, APIConnectionError3, APIConnectionTimeoutError3, BadRequestError3, AuthenticationError3, PermissionDeniedError3, NotFoundError3, ConflictError3, UnprocessableEntityError3, RateLimitError3, InternalServerError3, startsWithSchemeRegexp3, isAbsoluteURL3, isArrayInternal, isArray3, isReadonlyArrayInternal, isReadonlyArray3, validatePositiveInteger3, safeJSON3, sleep$1, FallbackEncoder3, VERSION3, checkFileSupport3, isAsyncIterable3, isBlobLike3, isFileLike3, isResponseLike3, APIResource3, EMPTY3, createPathTagFunction3, path16, BaseInteractions, Interactions, BaseWebhooks, Webhooks2, encodeUTF8_3, decodeUTF8_3, LineDecoder3, levelNumbers3, parseLogLevel3, noopLogger3, cachedLoggers3, formatRequestDetails3, Stream5, SSEDecoder3, APIPromise3, brand_privateNullableHeaders3, buildHeaders4, readEnv3, _a4, BaseGeminiNextGenAPIClient, GeminiNextGenAPIClient, GOOGLE_API_KEY_HEADER, REQUIRED_VERTEX_AI_SCOPE, NodeAuth, NodeDownloader, NodeWebSocketFactory, NodeWebSocket, Tunings, MAX_CHUNK_SIZE, MAX_RETRY_COUNT, INITIAL_RETRY_DELAY_MS, DELAY_MULTIPLIER, X_GOOG_UPLOAD_STATUS_HEADER_FIELD, NodeUploader, NodeFiles, LANGUAGE_LABEL_PREFIX, GoogleGenAI;
88232
+ var import_p_retry, import_google_auth_library, _defaultBaseGeminiUrl, _defaultBaseVertexUrl, BaseModule, Language, Outcome, FunctionResponseScheduling, Type, Environment, AuthType, HttpElementLocation, ApiSpec, PhishBlockThreshold, Behavior, DynamicRetrievalConfigMode, FunctionCallingConfigMode, ThinkingLevel, PersonGeneration, ProminentPeople, HarmCategory, HarmBlockMethod, HarmBlockThreshold, FinishReason, HarmProbability, HarmSeverity, UrlRetrievalStatus, BlockedReason, TrafficType, Modality, ModelStage, MediaResolution, TuningMode, AdapterSize, JobState, TuningJobState, AggregationMetric, PairwiseChoice, TuningTask, DocumentState, PartMediaResolutionLevel, ToolType, ResourceScope, ServiceTier, FeatureSelectionPreference, EmbeddingApiType, SafetyFilterLevel, ImagePromptLanguage, MaskReferenceMode, ControlReferenceType, SubjectReferenceType, EditMode, SegmentMode, VideoGenerationReferenceType, VideoGenerationMaskMode, VideoCompressionQuality, ImageResizeMode, TuningMethod, FileState, FileSource, TurnCompleteReason, MediaModality, VadSignalType, VoiceActivityType, StartSensitivity, EndSensitivity, ActivityHandling, TurnCoverage, Scale, MusicGenerationMode, LiveMusicPlaybackControl, HttpResponse, GenerateContentResponse, EmbedContentResponse, GenerateImagesResponse, EditImageResponse, UpscaleImageResponse, RecontextImageResponse, SegmentImageResponse, ListModelsResponse, DeleteModelResponse, CountTokensResponse, ComputeTokensResponse, GenerateVideosOperation, ListTuningJobsResponse, CancelTuningJobResponse, DeleteCachedContentResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, UploadToFileSearchStoreResumableResponse, ImportFileOperation, ListFilesResponse, CreateFileResponse, DeleteFileResponse, RegisterFilesResponse, ListBatchJobsResponse, LiveServerMessage, LiveMusicServerMessage, UploadToFileSearchStoreOperation, PagedItem, Pager, Batches4, Caches, Chats, Chat2, ApiError, Files5, CONTENT_TYPE_HEADER, SERVER_TIMEOUT_HEADER, USER_AGENT_HEADER, GOOGLE_API_CLIENT_HEADER, SDK_VERSION, LIBRARY_LABEL, VERTEX_AI_API_DEFAULT_VERSION, GOOGLE_AI_API_DEFAULT_VERSION, MULTI_REGIONAL_LOCATIONS, DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_HTTP_STATUS_CODES, ApiClient, MCP_LABEL, hasMcpToolUsageFromMcpToTool, McpCallableTool, LiveMusic, LiveMusicSession, FUNCTION_RESPONSE_REQUIRES_ID, Live, defaultLiveSendClientContentParamerters, Session, DEFAULT_MAX_REMOTE_CALLS, Models4, Operations, Tokens, Documents, FileSearchStores, uuid4Internal, uuid43, castToError3, GeminiNextGenAPIClientError, APIError3, APIUserAbortError3, APIConnectionError3, APIConnectionTimeoutError3, BadRequestError3, AuthenticationError3, PermissionDeniedError3, NotFoundError3, ConflictError3, UnprocessableEntityError3, RateLimitError3, InternalServerError3, startsWithSchemeRegexp3, isAbsoluteURL3, isArrayInternal, isArray3, isReadonlyArrayInternal, isReadonlyArray3, validatePositiveInteger3, safeJSON3, sleep$1, FallbackEncoder3, VERSION3, checkFileSupport3, isAsyncIterable3, isBlobLike3, isFileLike3, isResponseLike3, APIResource3, EMPTY3, createPathTagFunction3, path17, BaseInteractions, Interactions, BaseWebhooks, Webhooks2, encodeUTF8_3, decodeUTF8_3, LineDecoder3, levelNumbers3, parseLogLevel3, noopLogger3, cachedLoggers3, formatRequestDetails3, Stream5, SSEDecoder3, APIPromise3, brand_privateNullableHeaders3, buildHeaders4, readEnv3, _a4, BaseGeminiNextGenAPIClient, GeminiNextGenAPIClient, GOOGLE_API_KEY_HEADER, REQUIRED_VERTEX_AI_SCOPE, NodeAuth, NodeDownloader, NodeWebSocketFactory, NodeWebSocket, Tunings, MAX_CHUNK_SIZE, MAX_RETRY_COUNT, INITIAL_RETRY_DELAY_MS, DELAY_MULTIPLIER, X_GOOG_UPLOAD_STATUS_HEADER_FIELD, NodeUploader, NodeFiles, LANGUAGE_LABEL_PREFIX, GoogleGenAI;
88126
88233
  var init_node = __esm({
88127
88234
  "node_modules/@google/genai/dist/node/index.mjs"() {
88128
88235
  "use strict";
@@ -93716,7 +93823,7 @@ ${underline}`);
93716
93823
  }
93717
93824
  return path38;
93718
93825
  });
93719
- path16 = /* @__PURE__ */ createPathTagFunction3(encodeURIPath3);
93826
+ path17 = /* @__PURE__ */ createPathTagFunction3(encodeURIPath3);
93720
93827
  BaseInteractions = class extends APIResource3 {
93721
93828
  create(params, options) {
93722
93829
  var _a5;
@@ -93727,7 +93834,7 @@ ${underline}`);
93727
93834
  if ("agent" in body && "generation_config" in body) {
93728
93835
  throw new GeminiNextGenAPIClientError(`Invalid request: specified \`agent\` and \`generation_config\`. If specifying \`agent\`, use \`agent_config\`.`);
93729
93836
  }
93730
- return this._client.post(path16`/${api_version}/interactions`, Object.assign(Object.assign({ body }, options), { stream: (_a5 = params.stream) !== null && _a5 !== void 0 ? _a5 : false }));
93837
+ return this._client.post(path17`/${api_version}/interactions`, Object.assign(Object.assign({ body }, options), { stream: (_a5 = params.stream) !== null && _a5 !== void 0 ? _a5 : false }));
93731
93838
  }
93732
93839
  /**
93733
93840
  * Deletes the interaction by id.
@@ -93741,7 +93848,7 @@ ${underline}`);
93741
93848
  */
93742
93849
  delete(id, params = {}, options) {
93743
93850
  const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
93744
- return this._client.delete(path16`/${api_version}/interactions/${id}`, options);
93851
+ return this._client.delete(path17`/${api_version}/interactions/${id}`, options);
93745
93852
  }
93746
93853
  /**
93747
93854
  * Cancels an interaction by id. This only applies to background interactions that
@@ -93756,12 +93863,12 @@ ${underline}`);
93756
93863
  */
93757
93864
  cancel(id, params = {}, options) {
93758
93865
  const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
93759
- return this._client.post(path16`/${api_version}/interactions/${id}/cancel`, options);
93866
+ return this._client.post(path17`/${api_version}/interactions/${id}/cancel`, options);
93760
93867
  }
93761
93868
  get(id, params = {}, options) {
93762
93869
  var _a5;
93763
93870
  const _b = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _b, query = __rest(_b, ["api_version"]);
93764
- return this._client.get(path16`/${api_version}/interactions/${id}`, Object.assign(Object.assign({ query }, options), { stream: (_a5 = params === null || params === void 0 ? void 0 : params.stream) !== null && _a5 !== void 0 ? _a5 : false }));
93871
+ return this._client.get(path17`/${api_version}/interactions/${id}`, Object.assign(Object.assign({ query }, options), { stream: (_a5 = params === null || params === void 0 ? void 0 : params.stream) !== null && _a5 !== void 0 ? _a5 : false }));
93765
93872
  }
93766
93873
  };
93767
93874
  BaseInteractions._key = Object.freeze(["interactions"]);
@@ -93773,49 +93880,49 @@ ${underline}`);
93773
93880
  */
93774
93881
  create(params, options) {
93775
93882
  const { api_version = this._client.apiVersion } = params, body = __rest(params, ["api_version"]);
93776
- return this._client.post(path16`/${api_version}/webhooks`, Object.assign({ body }, options));
93883
+ return this._client.post(path17`/${api_version}/webhooks`, Object.assign({ body }, options));
93777
93884
  }
93778
93885
  /**
93779
93886
  * Updates an existing Webhook.
93780
93887
  */
93781
93888
  update(id, params = {}, options) {
93782
93889
  const _a5 = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion, update_mask } = _a5, body = __rest(_a5, ["api_version", "update_mask"]);
93783
- return this._client.patch(path16`/${api_version}/webhooks/${id}`, Object.assign({ query: { update_mask }, body }, options));
93890
+ return this._client.patch(path17`/${api_version}/webhooks/${id}`, Object.assign({ query: { update_mask }, body }, options));
93784
93891
  }
93785
93892
  /**
93786
93893
  * Lists all Webhooks.
93787
93894
  */
93788
93895
  list(params = {}, options) {
93789
93896
  const _a5 = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a5, query = __rest(_a5, ["api_version"]);
93790
- return this._client.get(path16`/${api_version}/webhooks`, Object.assign({ query }, options));
93897
+ return this._client.get(path17`/${api_version}/webhooks`, Object.assign({ query }, options));
93791
93898
  }
93792
93899
  /**
93793
93900
  * Deletes a Webhook.
93794
93901
  */
93795
93902
  delete(id, params = {}, options) {
93796
93903
  const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
93797
- return this._client.delete(path16`/${api_version}/webhooks/${id}`, options);
93904
+ return this._client.delete(path17`/${api_version}/webhooks/${id}`, options);
93798
93905
  }
93799
93906
  /**
93800
93907
  * Gets a specific Webhook.
93801
93908
  */
93802
93909
  get(id, params = {}, options) {
93803
93910
  const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
93804
- return this._client.get(path16`/${api_version}/webhooks/${id}`, options);
93911
+ return this._client.get(path17`/${api_version}/webhooks/${id}`, options);
93805
93912
  }
93806
93913
  /**
93807
93914
  * Sends a ping event to a Webhook.
93808
93915
  */
93809
93916
  ping(id, params = void 0, options) {
93810
93917
  const { api_version = this._client.apiVersion, body } = params !== null && params !== void 0 ? params : {};
93811
- return this._client.post(path16`/${api_version}/webhooks/${id}:ping`, Object.assign({ body }, options));
93918
+ return this._client.post(path17`/${api_version}/webhooks/${id}:ping`, Object.assign({ body }, options));
93812
93919
  }
93813
93920
  /**
93814
93921
  * Generates a new signing secret for a Webhook.
93815
93922
  */
93816
93923
  rotateSigningSecret(id, params = {}, options) {
93817
93924
  const _a5 = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a5, body = __rest(_a5, ["api_version"]);
93818
- return this._client.post(path16`/${api_version}/webhooks/${id}:rotateSigningSecret`, Object.assign({ body }, options));
93925
+ return this._client.post(path17`/${api_version}/webhooks/${id}:rotateSigningSecret`, Object.assign({ body }, options));
93819
93926
  }
93820
93927
  };
93821
93928
  BaseWebhooks._key = Object.freeze(["webhooks"]);
@@ -143983,8 +144090,8 @@ __export(video_jobs_exports, {
143983
144090
  runMiniMaxVideoGenerationJob: () => runMiniMaxVideoGenerationJob
143984
144091
  });
143985
144092
  import { spawn as spawn2 } from "child_process";
143986
- import { existsSync as existsSync8 } from "fs";
143987
- import path17 from "path";
144093
+ import { existsSync as existsSync9 } from "fs";
144094
+ import path18 from "path";
143988
144095
  import { fileURLToPath as fileURLToPath3 } from "url";
143989
144096
  function safeError2(error) {
143990
144097
  return sanitizeCredentials(error instanceof Error ? error.message : String(error)).slice(0, 1e3);
@@ -144213,14 +144320,14 @@ async function runMiniMaxVideoGenerationJob(maintenanceJob, context, dependencie
144213
144320
  }
144214
144321
  }
144215
144322
  function resolveMediaVideoRunnerPath(moduleUrl = import.meta.url) {
144216
- const moduleDir = path17.dirname(fileURLToPath3(moduleUrl));
144217
- const parentDir = path17.dirname(moduleDir);
144218
- const distDir = path17.basename(moduleDir) === "cli" ? parentDir : path17.basename(moduleDir) === "media" && path17.basename(parentDir) === "src" ? path17.join(path17.dirname(parentDir), "dist") : moduleDir;
144219
- return path17.join(distDir, "media-video-runner.js");
144323
+ const moduleDir = path18.dirname(fileURLToPath3(moduleUrl));
144324
+ const parentDir = path18.dirname(moduleDir);
144325
+ const distDir = path18.basename(moduleDir) === "cli" ? parentDir : path18.basename(moduleDir) === "media" && path18.basename(parentDir) === "src" ? path18.join(path18.dirname(parentDir), "dist") : moduleDir;
144326
+ return path18.join(distDir, "media-video-runner.js");
144220
144327
  }
144221
144328
  function launchMediaVideoRunner(request, options = {}) {
144222
144329
  const runnerPath = options.runnerPath ?? resolveMediaVideoRunnerPath();
144223
- if (!existsSync8(runnerPath)) {
144330
+ if (!existsSync9(runnerPath)) {
144224
144331
  return { launched: false, reason: "Media video runner is unavailable until Memorix is built or reinstalled." };
144225
144332
  }
144226
144333
  try {
@@ -144265,8 +144372,8 @@ __export(audio_jobs_exports, {
144265
144372
  transcribeAudio: () => transcribeAudio
144266
144373
  });
144267
144374
  import { spawn as spawn3 } from "child_process";
144268
- import { existsSync as existsSync9 } from "fs";
144269
- import path18 from "path";
144375
+ import { existsSync as existsSync10 } from "fs";
144376
+ import path19 from "path";
144270
144377
  import { fileURLToPath as fileURLToPath4 } from "url";
144271
144378
  function safeError3(error) {
144272
144379
  return sanitizeCredentials(error instanceof Error ? error.message : String(error)).slice(0, 1e3);
@@ -144509,14 +144616,14 @@ async function runAudioTranscriptionJob(maintenanceJob, context, dependencies =
144509
144616
  return { action: "complete" };
144510
144617
  }
144511
144618
  function resolveMediaAudioRunnerPath(moduleUrl = import.meta.url) {
144512
- const moduleDir = path18.dirname(fileURLToPath4(moduleUrl));
144513
- const parentDir = path18.dirname(moduleDir);
144514
- const distDir = path18.basename(moduleDir) === "cli" ? parentDir : path18.basename(moduleDir) === "media" && path18.basename(parentDir) === "src" ? path18.join(path18.dirname(parentDir), "dist") : moduleDir;
144515
- return path18.join(distDir, "media-audio-runner.js");
144619
+ const moduleDir = path19.dirname(fileURLToPath4(moduleUrl));
144620
+ const parentDir = path19.dirname(moduleDir);
144621
+ const distDir = path19.basename(moduleDir) === "cli" ? parentDir : path19.basename(moduleDir) === "media" && path19.basename(parentDir) === "src" ? path19.join(path19.dirname(parentDir), "dist") : moduleDir;
144622
+ return path19.join(distDir, "media-audio-runner.js");
144516
144623
  }
144517
144624
  function launchMediaAudioRunner(request, options = {}) {
144518
144625
  const runnerPath = options.runnerPath ?? resolveMediaAudioRunnerPath();
144519
- if (!existsSync9(runnerPath)) return { launched: false, reason: "Audio runner is unavailable until Memorix is built or reinstalled." };
144626
+ if (!existsSync10(runnerPath)) return { launched: false, reason: "Audio runner is unavailable until Memorix is built or reinstalled." };
144520
144627
  try {
144521
144628
  const child = spawn3(process.execPath, [runnerPath, JSON.stringify(request)], {
144522
144629
  cwd: request.projectRoot,
@@ -144875,11 +144982,11 @@ __export(owner_exports, {
144875
144982
  });
144876
144983
  import { randomUUID as randomUUID6 } from "crypto";
144877
144984
  import { promises as fs12 } from "fs";
144878
- import path19 from "path";
144985
+ import path20 from "path";
144879
144986
  function ownerPath(dataDir) {
144880
- const resolved = path19.resolve(dataDir);
144881
- const home = path19.basename(resolved).toLocaleLowerCase("en-US") === "data" ? path19.dirname(resolved) : resolved;
144882
- return path19.join(home, "memorix-user.json");
144987
+ const resolved = path20.resolve(dataDir);
144988
+ const home = path20.basename(resolved).toLocaleLowerCase("en-US") === "data" ? path20.dirname(resolved) : resolved;
144989
+ return path20.join(home, "memorix-user.json");
144883
144990
  }
144884
144991
  function normalizedOwnerId(value) {
144885
144992
  const trimmed = value?.trim();
@@ -144900,7 +145007,7 @@ async function resolveLocalMemoryOwner(dataDir, options = {}) {
144900
145007
  const filePath = ownerPath(dataDir);
144901
145008
  const existing = await readOwnerFile(filePath);
144902
145009
  if (existing || !options.create) return existing;
144903
- await fs12.mkdir(path19.dirname(filePath), { recursive: true });
145010
+ await fs12.mkdir(path20.dirname(filePath), { recursive: true });
144904
145011
  const created = {
144905
145012
  version: 1,
144906
145013
  id: "local-" + randomUUID6(),
@@ -146720,7 +146827,7 @@ __export(lite_provider_exports, {
146720
146827
  refreshProjectLite: () => refreshProjectLite
146721
146828
  });
146722
146829
  import { createHash as createHash7 } from "crypto";
146723
- import { readdirSync as readdirSync2, readFileSync as readFileSync6, statSync as statSync3 } from "fs";
146830
+ import { readdirSync as readdirSync2, readFileSync as readFileSync7, statSync as statSync3 } from "fs";
146724
146831
  import { join as join4, relative } from "path";
146725
146832
  function hashText(text2) {
146726
146833
  return createHash7("sha256").update(text2).digest("hex");
@@ -146840,7 +146947,7 @@ function extractImportEdges(projectId, file, text2, indexedAt) {
146840
146947
  function indexFileLite(projectId, projectRoot, abs, indexedAt, fileStat) {
146841
146948
  const rel = normalizeCodePath(relative(projectRoot, abs));
146842
146949
  try {
146843
- const text2 = readFileSync6(abs, "utf-8");
146950
+ const text2 = readFileSync7(abs, "utf-8");
146844
146951
  const stat5 = fileStat ?? statSync3(abs);
146845
146952
  const file = {
146846
146953
  id: makeCodeFileId(projectId, rel),
@@ -148040,7 +148147,7 @@ var init_frontmatter = __esm({
148040
148147
  // src/knowledge/markdown.ts
148041
148148
  import { createHash as createHash10 } from "crypto";
148042
148149
  import { promises as fs13 } from "fs";
148043
- import path20 from "path";
148150
+ import path21 from "path";
148044
148151
  function hashContent(content) {
148045
148152
  return createHash10("sha256").update(content).digest("hex");
148046
148153
  }
@@ -148098,8 +148205,8 @@ function extractInternalMarkdownLinks(body) {
148098
148205
  return [...links].sort();
148099
148206
  }
148100
148207
  function resolvePageLink(sourceRelativePath, target) {
148101
- const sourceDir = path20.posix.dirname(sourceRelativePath.replace(/\\/g, "/"));
148102
- const normalized = path20.posix.normalize(path20.posix.join(sourceDir, target.replace(/\\/g, "/")));
148208
+ const sourceDir = path21.posix.dirname(sourceRelativePath.replace(/\\/g, "/"));
148209
+ const normalized = path21.posix.normalize(path21.posix.join(sourceDir, target.replace(/\\/g, "/")));
148103
148210
  if (!normalized || normalized === "." || normalized === ".." || normalized.startsWith("../")) return void 0;
148104
148211
  return normalized;
148105
148212
  }
@@ -148127,7 +148234,7 @@ async function readKnowledgePage(absolutePath, workspaceRoot) {
148127
148234
  const frontmatter = validateKnowledgePageFrontmatter(parsed.data);
148128
148235
  return {
148129
148236
  absolutePath,
148130
- relativePath: workspaceRoot ? path20.relative(workspaceRoot, absolutePath).split(path20.sep).join("/") : path20.basename(absolutePath),
148237
+ relativePath: workspaceRoot ? path21.relative(workspaceRoot, absolutePath).split(path21.sep).join("/") : path21.basename(absolutePath),
148131
148238
  frontmatter,
148132
148239
  body: parsed.content.trim(),
148133
148240
  contentHash: hashContent(raw),
@@ -148139,7 +148246,7 @@ async function readKnowledgePage(absolutePath, workspaceRoot) {
148139
148246
  }
148140
148247
  }
148141
148248
  async function writeKnowledgePage(absolutePath, content) {
148142
- await fs13.mkdir(path20.dirname(absolutePath), { recursive: true });
148249
+ await fs13.mkdir(path21.dirname(absolutePath), { recursive: true });
148143
148250
  await atomicWriteFile(absolutePath, content);
148144
148251
  return hashContent(content);
148145
148252
  }
@@ -148170,7 +148277,7 @@ __export(wiki_exports, {
148170
148277
  });
148171
148278
  import { createHash as createHash11 } from "crypto";
148172
148279
  import { promises as fs14 } from "fs";
148173
- import path21 from "path";
148280
+ import path22 from "path";
148174
148281
  function hash2(value) {
148175
148282
  return createHash11("sha256").update(value).digest("hex");
148176
148283
  }
@@ -148326,8 +148433,8 @@ async function writeIndex(workspace, store) {
148326
148433
  lines.push("No pending proposals.");
148327
148434
  } else {
148328
148435
  for (const proposal of pending) {
148329
- const relative3 = path21.relative(paths.root, proposal.proposalPath).split(path21.sep).join("/");
148330
- lines.push("- [" + path21.basename(proposal.proposalPath, ".md") + "](" + relative3 + ")");
148436
+ const relative3 = path22.relative(paths.root, proposal.proposalPath).split(path22.sep).join("/");
148437
+ lines.push("- [" + path22.basename(proposal.proposalPath, ".md") + "](" + relative3 + ")");
148331
148438
  }
148332
148439
  }
148333
148440
  lines.push("");
@@ -148420,9 +148527,9 @@ async function applyKnowledgeProposal(input) {
148420
148527
  }
148421
148528
  if (proposal.status !== "pending") throw new Error("Knowledge proposal is not pending review");
148422
148529
  const root = getKnowledgeWorkspacePaths(input.workspace).root;
148423
- const targetPath = path21.resolve(proposal.targetPath);
148424
- const proposalPath = path21.resolve(proposal.proposalPath);
148425
- if (!targetPath.startsWith(root + path21.sep) || !proposalPath.startsWith(root + path21.sep)) {
148530
+ const targetPath = path22.resolve(proposal.targetPath);
148531
+ const proposalPath = path22.resolve(proposal.proposalPath);
148532
+ if (!targetPath.startsWith(root + path22.sep) || !proposalPath.startsWith(root + path22.sep)) {
148426
148533
  throw new Error("Knowledge proposal path escapes its workspace");
148427
148534
  }
148428
148535
  await withFileLock(root, async () => {
@@ -148465,7 +148572,7 @@ async function markdownFiles(directory) {
148465
148572
  return files;
148466
148573
  }
148467
148574
  for (const entry of entries) {
148468
- const filePath = path21.join(directory, entry.name);
148575
+ const filePath = path22.join(directory, entry.name);
148469
148576
  if (entry.isDirectory()) {
148470
148577
  files.push(...await markdownFiles(filePath));
148471
148578
  } else if (entry.isFile() && entry.name.toLowerCase().endsWith(".md")) {
@@ -148488,7 +148595,7 @@ async function lintKnowledgeWorkspace(input) {
148488
148595
  kind: "malformed-frontmatter",
148489
148596
  severity: "error",
148490
148597
  message: error instanceof Error ? error.message : "Malformed knowledge page.",
148491
- relativePath: path21.relative(paths.root, filePath).split(path21.sep).join("/")
148598
+ relativePath: path22.relative(paths.root, filePath).split(path22.sep).join("/")
148492
148599
  });
148493
148600
  }
148494
148601
  }
@@ -148583,7 +148690,7 @@ async function lintKnowledgeWorkspace(input) {
148583
148690
  kind: "manual-edit-protected",
148584
148691
  severity: "warning",
148585
148692
  message: "A newer proposal was held because the target page has manual edits.",
148586
- relativePath: path21.relative(paths.root, proposal.targetPath).split(path21.sep).join("/")
148693
+ relativePath: path22.relative(paths.root, proposal.targetPath).split(path22.sep).join("/")
148587
148694
  });
148588
148695
  }
148589
148696
  }
@@ -149367,7 +149474,7 @@ __export(workflows_exports, {
149367
149474
  });
149368
149475
  import { createHash as createHash12 } from "crypto";
149369
149476
  import { promises as fs15 } from "fs";
149370
- import path22 from "path";
149477
+ import path23 from "path";
149371
149478
  function hash3(value) {
149372
149479
  return createHash12("sha256").update(value).digest("hex");
149373
149480
  }
@@ -149470,7 +149577,7 @@ function phasesFromBody(body) {
149470
149577
  }
149471
149578
  function normalizeSourcePath(sourcePath) {
149472
149579
  const normalized = sourcePath.replace(/\\/g, "/");
149473
- if (!normalized.startsWith("workflows/") || !normalized.toLowerCase().endsWith(".md") || normalized.includes("../") || path22.posix.normalize(normalized) !== normalized) {
149580
+ if (!normalized.startsWith("workflows/") || !normalized.toLowerCase().endsWith(".md") || normalized.includes("../") || path23.posix.normalize(normalized) !== normalized) {
149474
149581
  throw new Error("workflow source path must be a safe workflows/*.md path");
149475
149582
  }
149476
149583
  return normalized;
@@ -149619,7 +149726,7 @@ async function writeCanonicalWorkflow(input) {
149619
149726
  const filePath = resolveKnowledgeWorkspaceFile(input.workspace, workflow.sourcePath);
149620
149727
  const content = renderWorkflowMarkdown(workflow);
149621
149728
  await withFileLock(paths.root, async () => {
149622
- await fs15.mkdir(path22.dirname(filePath), { recursive: true });
149729
+ await fs15.mkdir(path23.dirname(filePath), { recursive: true });
149623
149730
  await atomicWriteFile(filePath, content);
149624
149731
  });
149625
149732
  const store = await storeFor2(input.workspace);
@@ -149634,7 +149741,7 @@ async function markdownFiles2(directory) {
149634
149741
  }
149635
149742
  const files = [];
149636
149743
  for (const entry of entries) {
149637
- const absolutePath = path22.join(directory, entry.name);
149744
+ const absolutePath = path23.join(directory, entry.name);
149638
149745
  if (entry.isDirectory()) {
149639
149746
  files.push(...await markdownFiles2(absolutePath));
149640
149747
  } else if (entry.isFile() && entry.name.toLowerCase().endsWith(".md")) {
@@ -149649,7 +149756,7 @@ async function syncCanonicalWorkflows(workspace) {
149649
149756
  const workflows = [];
149650
149757
  const errors = [];
149651
149758
  for (const absolutePath of await markdownFiles2(paths.workflows)) {
149652
- const sourcePath = path22.relative(paths.root, absolutePath).split(path22.sep).join("/");
149759
+ const sourcePath = path23.relative(paths.root, absolutePath).split(path23.sep).join("/");
149653
149760
  try {
149654
149761
  const raw = await fs15.readFile(absolutePath, "utf8");
149655
149762
  const workflow = parseWorkflowMarkdown(raw, { workspaceId: workspace.id, sourcePath });
@@ -149763,7 +149870,7 @@ function importedWorkflowSpec(input) {
149763
149870
  return materializeWorkflow(spec);
149764
149871
  }
149765
149872
  async function importWindsurfWorkflows(input) {
149766
- const sourceDirectory = path22.join(path22.resolve(input.projectRoot), ".windsurf", "workflows");
149873
+ const sourceDirectory = path23.join(path23.resolve(input.projectRoot), ".windsurf", "workflows");
149767
149874
  const paths = getKnowledgeWorkspacePaths(input.workspace);
149768
149875
  const imported = [];
149769
149876
  const skipped = [];
@@ -149774,8 +149881,8 @@ async function importWindsurfWorkflows(input) {
149774
149881
  return { imported, skipped };
149775
149882
  }
149776
149883
  for (const entry of entries.filter((item) => item.isFile() && item.name.toLowerCase().endsWith(".md"))) {
149777
- const originalPath = path22.join(sourceDirectory, entry.name);
149778
- const sourcePath = path22.relative(path22.resolve(input.projectRoot), originalPath).split(path22.sep).join("/");
149884
+ const originalPath = path23.join(sourceDirectory, entry.name);
149885
+ const sourcePath = path23.relative(path23.resolve(input.projectRoot), originalPath).split(path23.sep).join("/");
149779
149886
  try {
149780
149887
  const raw = await fs15.readFile(originalPath, "utf8");
149781
149888
  const workflow = importedWorkflowSpec({
@@ -149803,8 +149910,8 @@ async function importWindsurfWorkflows(input) {
149803
149910
  return { imported, skipped };
149804
149911
  }
149805
149912
  function isWithin2(root, candidate) {
149806
- const relative3 = path22.relative(root, candidate);
149807
- return relative3 !== "" && relative3 !== ".." && !relative3.startsWith(".." + path22.sep) && !path22.isAbsolute(relative3);
149913
+ const relative3 = path23.relative(root, candidate);
149914
+ return relative3 !== "" && relative3 !== ".." && !relative3.startsWith(".." + path23.sep) && !path23.isAbsolute(relative3);
149808
149915
  }
149809
149916
  function adapterRelativePath(workflow, agent) {
149810
149917
  const name = "memorix-workflow-" + slug(workflow.id.replace(/^workflow:/, ""));
@@ -149890,8 +149997,8 @@ async function previewWorkflowAdapter(input) {
149890
149997
  reason: "The canonical workflow does not declare compatibility with this agent."
149891
149998
  };
149892
149999
  }
149893
- const projectRoot = path22.resolve(input.projectRoot);
149894
- const targetPath = path22.resolve(projectRoot, adapterRelativePath(input.workflow, input.agent));
150000
+ const projectRoot = path23.resolve(input.projectRoot);
150001
+ const targetPath = path23.resolve(projectRoot, adapterRelativePath(input.workflow, input.agent));
149895
150002
  if (!isWithin2(projectRoot, targetPath)) {
149896
150003
  throw new Error("Workflow adapter target escapes the project root");
149897
150004
  }
@@ -149919,11 +150026,11 @@ async function applyWorkflowAdapter(input) {
149919
150026
  if (initial.status === "unsupported" || initial.status === "conflict" || initial.status === "unchanged") {
149920
150027
  return initial;
149921
150028
  }
149922
- const projectRoot = path22.resolve(input.projectRoot);
150029
+ const projectRoot = path23.resolve(input.projectRoot);
149923
150030
  return withFileLock(projectRoot, async () => {
149924
150031
  const current = await previewWorkflowAdapter(input);
149925
150032
  if (current.status !== "create" && current.status !== "update") return current;
149926
- await fs15.mkdir(path22.dirname(current.targetPath), { recursive: true });
150033
+ await fs15.mkdir(path23.dirname(current.targetPath), { recursive: true });
149927
150034
  await atomicWriteFile(current.targetPath, current.content);
149928
150035
  return current;
149929
150036
  });
@@ -150558,16 +150665,16 @@ __export(vector_backfill_runner_exports, {
150558
150665
  resolveVectorBackfillRunnerPath: () => resolveVectorBackfillRunnerPath
150559
150666
  });
150560
150667
  import { spawn as spawn4 } from "child_process";
150561
- import { existsSync as existsSync10 } from "fs";
150562
- import path23 from "path";
150668
+ import { existsSync as existsSync11 } from "fs";
150669
+ import path24 from "path";
150563
150670
  import { fileURLToPath as fileURLToPath5 } from "url";
150564
150671
  function isNonEmptyString(value) {
150565
150672
  return typeof value === "string" && value.trim().length > 0;
150566
150673
  }
150567
150674
  function resolveVectorBackfillRunnerPath(moduleUrl = import.meta.url) {
150568
- const moduleDir = path23.dirname(fileURLToPath5(moduleUrl));
150569
- const distDir = path23.basename(moduleDir) === "cli" ? path23.dirname(moduleDir) : path23.basename(moduleDir) === "runtime" && path23.basename(path23.dirname(moduleDir)) === "src" ? path23.join(path23.dirname(path23.dirname(moduleDir)), "dist") : moduleDir;
150570
- return path23.join(distDir, "vector-backfill-runner.js");
150675
+ const moduleDir = path24.dirname(fileURLToPath5(moduleUrl));
150676
+ const distDir = path24.basename(moduleDir) === "cli" ? path24.dirname(moduleDir) : path24.basename(moduleDir) === "runtime" && path24.basename(path24.dirname(moduleDir)) === "src" ? path24.join(path24.dirname(path24.dirname(moduleDir)), "dist") : moduleDir;
150677
+ return path24.join(distDir, "vector-backfill-runner.js");
150571
150678
  }
150572
150679
  function parseVectorBackfillRequest(raw) {
150573
150680
  let value;
@@ -150576,7 +150683,7 @@ function parseVectorBackfillRequest(raw) {
150576
150683
  } catch {
150577
150684
  throw new Error("Vector backfill runner received invalid JSON input");
150578
150685
  }
150579
- if (!value || typeof value !== "object" || !isNonEmptyString(value.projectId) || !isNonEmptyString(value.projectRoot) || !isNonEmptyString(value.dataDir) || !path23.isAbsolute(value.projectRoot) || !path23.isAbsolute(value.dataDir)) {
150686
+ if (!value || typeof value !== "object" || !isNonEmptyString(value.projectId) || !isNonEmptyString(value.projectRoot) || !isNonEmptyString(value.dataDir) || !path24.isAbsolute(value.projectRoot) || !path24.isAbsolute(value.dataDir)) {
150580
150687
  throw new Error("Vector backfill runner received an invalid request");
150581
150688
  }
150582
150689
  return {
@@ -150587,7 +150694,7 @@ function parseVectorBackfillRequest(raw) {
150587
150694
  }
150588
150695
  function launchDetachedVectorBackfill(request, options = {}) {
150589
150696
  const runnerPath = options.runnerPath ?? resolveVectorBackfillRunnerPath();
150590
- const exists = options.exists ?? existsSync10;
150697
+ const exists = options.exists ?? existsSync11;
150591
150698
  if (!exists(runnerPath)) return false;
150592
150699
  try {
150593
150700
  const child = (options.spawn ?? spawn4)(process.execPath, [runnerPath], {
@@ -151699,7 +151806,7 @@ __export(session_store_exports, {
151699
151806
  initSessionStore: () => initSessionStore,
151700
151807
  resetSessionStore: () => resetSessionStore
151701
151808
  });
151702
- import path24 from "path";
151809
+ import path25 from "path";
151703
151810
  import fs16 from "fs";
151704
151811
  function sessionToRow(session) {
151705
151812
  return {
@@ -151786,7 +151893,7 @@ var init_session_store = __esm({
151786
151893
  async migrateFromJsonIfNeeded() {
151787
151894
  const count2 = this.db.prepare(`SELECT COUNT(*) AS cnt FROM sessions`).get();
151788
151895
  if (count2.cnt > 0) return;
151789
- const jsonPath = path24.join(this.dataDir, "sessions.json");
151896
+ const jsonPath = path25.join(this.dataDir, "sessions.json");
151790
151897
  if (!fs16.existsSync(jsonPath)) return;
151791
151898
  try {
151792
151899
  const raw = fs16.readFileSync(jsonPath, "utf-8");
@@ -154144,7 +154251,7 @@ var init_trae = __esm({
154144
154251
 
154145
154252
  // src/rules/syncer.ts
154146
154253
  import { promises as fs17 } from "fs";
154147
- import path25 from "path";
154254
+ import path26 from "path";
154148
154255
  var RulesSyncer;
154149
154256
  var init_syncer = __esm({
154150
154257
  "src/rules/syncer.ts"() {
@@ -154190,7 +154297,7 @@ var init_syncer = __esm({
154190
154297
  for (const filePath of found) {
154191
154298
  try {
154192
154299
  const content = await fs17.readFile(filePath, "utf-8");
154193
- const relativePath = path25.relative(this.projectRoot, filePath).replace(/\\/g, "/");
154300
+ const relativePath = path26.relative(this.projectRoot, filePath).replace(/\\/g, "/");
154194
154301
  const parsed = entry.adapter.parse(relativePath, content);
154195
154302
  rules.push(...parsed);
154196
154303
  } catch {
@@ -154258,7 +154365,7 @@ var init_syncer = __esm({
154258
154365
  const entries = [];
154259
154366
  for (const adapter of this.adapters.values()) {
154260
154367
  const absolutePaths = adapter.filePatterns.map(
154261
- (p) => path25.join(this.projectRoot, p)
154368
+ (p) => path26.join(this.projectRoot, p)
154262
154369
  );
154263
154370
  entries.push({ adapter, paths: absolutePaths });
154264
154371
  }
@@ -154266,8 +154373,8 @@ var init_syncer = __esm({
154266
154373
  }
154267
154374
  /** Find files matching a glob-like path (simple implementation) */
154268
154375
  async findFiles(pattern) {
154269
- const dir = path25.dirname(pattern);
154270
- const fileGlob = path25.basename(pattern);
154376
+ const dir = path26.dirname(pattern);
154377
+ const fileGlob = path26.basename(pattern);
154271
154378
  try {
154272
154379
  const stat5 = await fs17.stat(dir);
154273
154380
  if (!stat5.isDirectory()) {
@@ -154290,14 +154397,14 @@ var init_syncer = __esm({
154290
154397
  try {
154291
154398
  const files = await fs17.readdir(dir);
154292
154399
  const ext = fileGlob.replace("*", "");
154293
- return files.filter((f3) => ext ? f3.endsWith(ext) : true).map((f3) => path25.join(dir, f3));
154400
+ return files.filter((f3) => ext ? f3.endsWith(ext) : true).map((f3) => path26.join(dir, f3));
154294
154401
  } catch {
154295
154402
  return [];
154296
154403
  }
154297
154404
  }
154298
154405
  try {
154299
- await fs17.access(path25.join(dir, fileGlob));
154300
- return [path25.join(dir, fileGlob)];
154406
+ await fs17.access(path26.join(dir, fileGlob));
154407
+ return [path26.join(dir, fileGlob)];
154301
154408
  } catch {
154302
154409
  return [];
154303
154410
  }
@@ -155343,7 +155450,7 @@ var init_sanitizer = __esm({
155343
155450
  });
155344
155451
 
155345
155452
  // src/workspace/applier.ts
155346
- import { existsSync as existsSync11, mkdirSync, copyFileSync, writeFileSync, unlinkSync, renameSync } from "fs";
155453
+ import { existsSync as existsSync12, mkdirSync as mkdirSync2, copyFileSync, writeFileSync as writeFileSync2, unlinkSync, renameSync } from "fs";
155347
155454
  import { dirname } from "path";
155348
155455
  var WorkspaceSyncApplier;
155349
155456
  var init_applier = __esm({
@@ -155374,8 +155481,8 @@ var init_applier = __esm({
155374
155481
  for (const file of files) {
155375
155482
  try {
155376
155483
  const dir = dirname(file.filePath);
155377
- if (!existsSync11(dir)) {
155378
- mkdirSync(dir, { recursive: true });
155484
+ if (!existsSync12(dir)) {
155485
+ mkdirSync2(dir, { recursive: true });
155379
155486
  }
155380
155487
  } catch (err) {
155381
155488
  result.errors.push(`Cannot create directory for ${file.filePath}: ${err}`);
@@ -155383,7 +155490,7 @@ var init_applier = __esm({
155383
155490
  }
155384
155491
  }
155385
155492
  for (const file of files) {
155386
- if (existsSync11(file.filePath)) {
155493
+ if (existsSync12(file.filePath)) {
155387
155494
  try {
155388
155495
  const backupPath = file.filePath + `.backup-${Date.now()}`;
155389
155496
  copyFileSync(file.filePath, backupPath);
@@ -155400,7 +155507,7 @@ var init_applier = __esm({
155400
155507
  for (const file of files) {
155401
155508
  try {
155402
155509
  const tempPath = file.filePath + `.tmp-${Date.now()}`;
155403
- writeFileSync(tempPath, file.content, "utf-8");
155510
+ writeFileSync2(tempPath, file.content, "utf-8");
155404
155511
  renameSync(tempPath, file.filePath);
155405
155512
  result.filesWritten.push(file.filePath);
155406
155513
  } catch (err) {
@@ -155434,7 +155541,7 @@ var init_applier = __esm({
155434
155541
  cleanBackups(backups) {
155435
155542
  for (const backup of backups) {
155436
155543
  try {
155437
- if (existsSync11(backup.backupPath)) {
155544
+ if (existsSync12(backup.backupPath)) {
155438
155545
  unlinkSync(backup.backupPath);
155439
155546
  }
155440
155547
  } catch {
@@ -155446,7 +155553,7 @@ var init_applier = __esm({
155446
155553
  });
155447
155554
 
155448
155555
  // src/workspace/engine.ts
155449
- import { readFileSync as readFileSync7, readdirSync as readdirSync3, existsSync as existsSync12, cpSync, mkdirSync as mkdirSync2 } from "fs";
155556
+ import { readFileSync as readFileSync8, readdirSync as readdirSync3, existsSync as existsSync13, cpSync, mkdirSync as mkdirSync3 } from "fs";
155450
155557
  import { join as join19 } from "path";
155451
155558
  import { homedir as homedir21 } from "os";
155452
155559
  var WorkspaceSyncEngine;
@@ -155526,9 +155633,9 @@ var init_engine4 = __esm({
155526
155633
  }
155527
155634
  const merged = /* @__PURE__ */ new Map();
155528
155635
  for (const path37 of pathsToCheck) {
155529
- if (existsSync12(path37)) {
155636
+ if (existsSync13(path37)) {
155530
155637
  try {
155531
- const content = readFileSync7(path37, "utf-8");
155638
+ const content = readFileSync8(path37, "utf-8");
155532
155639
  const servers = adapter.parse(content);
155533
155640
  for (const s2 of servers) {
155534
155641
  if (!merged.has(s2.name)) merged.set(s2.name, s2);
@@ -155580,9 +155687,9 @@ var init_engine4 = __esm({
155580
155687
  const adapter = this.adapters.get(target);
155581
155688
  const configPath = adapter.getConfigPath(this.projectRoot);
155582
155689
  let configContent;
155583
- if (target === "antigravity" && existsSync12(configPath)) {
155690
+ if (target === "antigravity" && existsSync13(configPath)) {
155584
155691
  try {
155585
- const existing = JSON.parse(readFileSync7(configPath, "utf-8"));
155692
+ const existing = JSON.parse(readFileSync8(configPath, "utf-8"));
155586
155693
  const generated = JSON.parse(adapter.generate(result.mcpServers.scanned));
155587
155694
  existing.mcpServers = { ...existing.mcpServers ?? {}, ...generated.mcpServers };
155588
155695
  configContent = JSON.stringify(existing, null, 2);
@@ -155656,16 +155763,16 @@ var init_engine4 = __esm({
155656
155763
  join19(home, dir)
155657
155764
  ];
155658
155765
  for (const skillsRoot of paths) {
155659
- if (!existsSync12(skillsRoot)) continue;
155766
+ if (!existsSync13(skillsRoot)) continue;
155660
155767
  try {
155661
155768
  const entries = readdirSync3(skillsRoot, { withFileTypes: true });
155662
155769
  for (const entry of entries) {
155663
155770
  if (!entry.isDirectory()) continue;
155664
155771
  const skillMd = join19(skillsRoot, entry.name, "SKILL.md");
155665
- if (!existsSync12(skillMd)) continue;
155772
+ if (!existsSync13(skillMd)) continue;
155666
155773
  let description = "";
155667
155774
  try {
155668
- const content = readFileSync7(skillMd, "utf-8");
155775
+ const content = readFileSync8(skillMd, "utf-8");
155669
155776
  const match2 = content.match(/^---[\s\S]*?description:\s*["']?(.+?)["']?\s*$/m);
155670
155777
  if (match2) description = match2[1];
155671
155778
  } catch {
@@ -155711,12 +155818,12 @@ var init_engine4 = __esm({
155711
155818
  for (const skill2 of skills) {
155712
155819
  if (skill2.sourceAgent === target) continue;
155713
155820
  const dest = join19(targetDir, skill2.name);
155714
- if (existsSync12(dest)) {
155821
+ if (existsSync13(dest)) {
155715
155822
  skipped.push(`${skill2.name} (already exists in ${target})`);
155716
155823
  continue;
155717
155824
  }
155718
155825
  try {
155719
- mkdirSync2(targetDir, { recursive: true });
155826
+ mkdirSync3(targetDir, { recursive: true });
155720
155827
  cpSync(skill2.sourcePath, dest, { recursive: true });
155721
155828
  copied.push(skill2.name);
155722
155829
  } catch {
@@ -155727,12 +155834,12 @@ var init_engine4 = __esm({
155727
155834
  scanWorkflows() {
155728
155835
  const workflows = [];
155729
155836
  const wfDir = join19(this.projectRoot, ".windsurf", "workflows");
155730
- if (!existsSync12(wfDir)) return workflows;
155837
+ if (!existsSync13(wfDir)) return workflows;
155731
155838
  try {
155732
155839
  const files = readdirSync3(wfDir).filter((f3) => f3.endsWith(".md"));
155733
155840
  for (const file of files) {
155734
155841
  try {
155735
- const content = readFileSync7(join19(wfDir, file), "utf-8");
155842
+ const content = readFileSync8(join19(wfDir, file), "utf-8");
155736
155843
  workflows.push(this.workflowSyncer.parseWindsurfWorkflow(file, content));
155737
155844
  } catch {
155738
155845
  }
@@ -156921,11 +157028,11 @@ var init_surfaced_registry = __esm({
156921
157028
  });
156922
157029
 
156923
157030
  // src/server/request-context.ts
156924
- import path26 from "path";
157031
+ import path27 from "path";
156925
157032
  function resolveRoot(projectRoot) {
156926
157033
  const value = projectRoot.trim();
156927
157034
  if (!value) throw new Error("Project binding requires a non-empty project root");
156928
- return path26.resolve(value);
157035
+ return path27.resolve(value);
156929
157036
  }
156930
157037
  function createProjectBindingController(projectRoot) {
156931
157038
  return new ProjectBindingController(projectRoot);
@@ -157045,7 +157152,7 @@ __export(behavior_exports, {
157045
157152
  getBehaviorConfig: () => getBehaviorConfig,
157046
157153
  resetBehaviorConfigCache: () => resetBehaviorConfigCache
157047
157154
  });
157048
- import { existsSync as existsSync13, readFileSync as readFileSync8 } from "fs";
157155
+ import { existsSync as existsSync14, readFileSync as readFileSync9 } from "fs";
157049
157156
  import { homedir as homedir22 } from "os";
157050
157157
  function isSessionInject(value) {
157051
157158
  return value === "full" || value === "minimal" || value === "silent";
@@ -157056,8 +157163,8 @@ function isFormationMode(value) {
157056
157163
  function legacyBehavior(homeDir) {
157057
157164
  const configPath = getLegacyConfigJsonPath(homeDir);
157058
157165
  try {
157059
- if (!existsSync13(configPath)) return {};
157060
- const parsed = JSON.parse(readFileSync8(configPath, "utf-8"));
157166
+ if (!existsSync14(configPath)) return {};
157167
+ const parsed = JSON.parse(readFileSync9(configPath, "utf-8"));
157061
157168
  return parsed.behavior && typeof parsed.behavior === "object" && !Array.isArray(parsed.behavior) ? parsed.behavior : {};
157062
157169
  } catch {
157063
157170
  return {};
@@ -157135,10 +157242,14 @@ async function loadAliasActiveSessions(projectIds) {
157135
157242
  const groups = await Promise.all([...projectIds].map((projectId) => store.loadActive(projectId)));
157136
157243
  return groups.flat();
157137
157244
  }
157138
- async function loadAliasActiveObservations(projectIds) {
157245
+ async function loadAliasActiveObservations(projectIds, limit2 = SESSION_RESUME_OBSERVATION_LIMIT) {
157139
157246
  const store = getObservationStore();
157140
157247
  const groups = await Promise.all(
157141
- [...projectIds].map((projectId) => store.loadByProject(projectId, { status: "active" }))
157248
+ [...projectIds].map((projectId) => store.loadByProject(projectId, {
157249
+ status: "active",
157250
+ limit: limit2,
157251
+ newestFirst: true
157252
+ }))
157142
157253
  );
157143
157254
  return groups.flat();
157144
157255
  }
@@ -157327,7 +157438,7 @@ async function getSessionContext(projectDir2, projectId, limit2 = 3, reader) {
157327
157438
  const aliasSet = await resolveProjectIds(projectId);
157328
157439
  const [sessions, allObs] = await Promise.all([
157329
157440
  loadAliasSessions(aliasSet),
157330
- loadAliasActiveObservations(aliasSet)
157441
+ loadAliasActiveObservations(aliasSet, SESSION_CONTEXT_OBSERVATION_LIMIT)
157331
157442
  ]);
157332
157443
  const readableObs = readableAliasObservations(allObs, aliasSet, reader);
157333
157444
  const isNoisySummary = (summary) => {
@@ -157480,7 +157591,7 @@ async function getActiveSession(projectDir2, projectId) {
157480
157591
  const sessions = await loadAliasActiveSessions(aliasSet);
157481
157592
  return sessions.sort((a, b) => new Date(b.startedAt).getTime() - new Date(a.startedAt).getTime())[0] ?? null;
157482
157593
  }
157483
- var PRIORITY_TYPES, RESUME_TYPES, TYPE_EMOJI, TYPE_WEIGHTS2, NOISE_PATTERNS2, COMMAND_TRACE_PATTERNS, SYSTEM_SELF_PATTERNS, AUTO_RESUME_SUMMARY_LIMIT, AUTO_RESUME_TITLE_LIMIT;
157594
+ var PRIORITY_TYPES, RESUME_TYPES, TYPE_EMOJI, TYPE_WEIGHTS2, NOISE_PATTERNS2, COMMAND_TRACE_PATTERNS, SYSTEM_SELF_PATTERNS, SESSION_RESUME_OBSERVATION_LIMIT, SESSION_CONTEXT_OBSERVATION_LIMIT, AUTO_RESUME_SUMMARY_LIMIT, AUTO_RESUME_TITLE_LIMIT;
157484
157595
  var init_session = __esm({
157485
157596
  "src/memory/session.ts"() {
157486
157597
  "use strict";
@@ -157569,6 +157680,8 @@ var init_session = __esm({
157569
157680
  /memorix.*(?:测试|test)/i,
157570
157681
  /memmcp/i
157571
157682
  ];
157683
+ SESSION_RESUME_OBSERVATION_LIMIT = 64;
157684
+ SESSION_CONTEXT_OBSERVATION_LIMIT = 128;
157572
157685
  AUTO_RESUME_SUMMARY_LIMIT = 480;
157573
157686
  AUTO_RESUME_TITLE_LIMIT = 180;
157574
157687
  }
@@ -158404,18 +158517,18 @@ __export(current_facts_exports, {
158404
158517
  formatGitFact: () => formatGitFact
158405
158518
  });
158406
158519
  import { execFileSync } from "child_process";
158407
- import { existsSync as existsSync14, readFileSync as readFileSync9 } from "fs";
158408
- import path27 from "path";
158520
+ import { existsSync as existsSync15, readFileSync as readFileSync10 } from "fs";
158521
+ import path28 from "path";
158409
158522
  function readTextIfExists(filePath) {
158410
158523
  try {
158411
- if (!existsSync14(filePath)) return null;
158412
- return readFileSync9(filePath, "utf8");
158524
+ if (!existsSync15(filePath)) return null;
158525
+ return readFileSync10(filePath, "utf8");
158413
158526
  } catch {
158414
158527
  return null;
158415
158528
  }
158416
158529
  }
158417
158530
  function readPackageVersion(rootPath) {
158418
- const text2 = readTextIfExists(path27.join(rootPath, "package.json"));
158531
+ const text2 = readTextIfExists(path28.join(rootPath, "package.json"));
158419
158532
  if (!text2) return void 0;
158420
158533
  try {
158421
158534
  const parsed = JSON.parse(text2);
@@ -158425,7 +158538,7 @@ function readPackageVersion(rootPath) {
158425
158538
  }
158426
158539
  }
158427
158540
  function readLatestChangelog(rootPath) {
158428
- const text2 = readTextIfExists(path27.join(rootPath, "CHANGELOG.md"));
158541
+ const text2 = readTextIfExists(path28.join(rootPath, "CHANGELOG.md"));
158429
158542
  if (!text2) return void 0;
158430
158543
  const match2 = text2.match(/^##\s+\[?v?([^\]\s]+)\]?\s*(?:-\s*(\d{4}-\d{2}-\d{2}))?/m);
158431
158544
  if (!match2) return void 0;
@@ -158497,7 +158610,7 @@ function detectStaleProgressNotes(input) {
158497
158610
  ];
158498
158611
  const notes = [];
158499
158612
  for (const relPath of candidates) {
158500
- const content = readTextIfExists(path27.join(input.rootPath, relPath));
158613
+ const content = readTextIfExists(path28.join(input.rootPath, relPath));
158501
158614
  if (!content) continue;
158502
158615
  const parsed = parseProgressNote(content);
158503
158616
  const olderThanChangelog = compareDateStrings(parsed.lastUpdated, input.latestChangelog?.date);
@@ -158554,7 +158667,7 @@ __export(external_provider_exports, {
158554
158667
  runExternalCodeGraphLifecycle: () => runExternalCodeGraphLifecycle
158555
158668
  });
158556
158669
  import { spawn as spawn5 } from "child_process";
158557
- import { existsSync as existsSync15, readFileSync as readFileSync10 } from "fs";
158670
+ import { existsSync as existsSync16, readFileSync as readFileSync11 } from "fs";
158558
158671
  import { delimiter, dirname as dirname2, extname, isAbsolute, join as join20, relative as relative2, resolve, sep } from "path";
158559
158672
  function boundedTimeout(value) {
158560
158673
  if (!Number.isFinite(value)) return DEFAULT_EXTERNAL_CODEGRAPH_TIMEOUT_MS;
@@ -158591,22 +158704,22 @@ function resolveCommandCandidates(command) {
158591
158704
  }
158592
158705
  function resolveLaunch(command) {
158593
158706
  for (const candidate of resolveCommandCandidates(command)) {
158594
- if (!existsSync15(candidate)) continue;
158707
+ if (!existsSync16(candidate)) continue;
158595
158708
  const extension3 = extname(candidate).toLowerCase();
158596
158709
  if (extension3 === ".cmd") {
158597
158710
  const bundleRoot = resolve(dirname2(candidate), "..");
158598
158711
  const node = join20(bundleRoot, "node.exe");
158599
158712
  const entry = join20(bundleRoot, "lib", "dist", "bin", "codegraph.js");
158600
- if (existsSync15(node) && existsSync15(entry)) {
158713
+ if (existsSync16(node) && existsSync16(entry)) {
158601
158714
  return { executable: node, prefixArgs: ["--liftoff-only", entry] };
158602
158715
  }
158603
158716
  try {
158604
- const shim = readFileSync10(candidate, "utf8");
158717
+ const shim = readFileSync11(candidate, "utf8");
158605
158718
  const match2 = shim.match(/["']([^"']*%(?:~)?dp0%?[^"']*\.m?js)["']/i);
158606
158719
  if (match2?.[1]) {
158607
158720
  const base = dirname2(candidate).endsWith(sep) ? dirname2(candidate) : dirname2(candidate) + sep;
158608
158721
  const entry2 = resolve(match2[1].replace(/%(?:~)?dp0%?/gi, base));
158609
- if (existsSync15(entry2)) return { executable: process.execPath, prefixArgs: [entry2] };
158722
+ if (existsSync16(entry2)) return { executable: process.execPath, prefixArgs: [entry2] };
158610
158723
  }
158611
158724
  } catch {
158612
158725
  }
@@ -158727,7 +158840,7 @@ async function inspectExternalCodeGraph(input) {
158727
158840
  const health2 = { state: "disabled", reason: "External CodeGraph is disabled by configuration." };
158728
158841
  return { health: health2, quality: providerQuality({ mode, health: health2 }) };
158729
158842
  }
158730
- if (!existsSync15(join20(input.projectRoot, ".codegraph"))) {
158843
+ if (!existsSync16(join20(input.projectRoot, ".codegraph"))) {
158731
158844
  const health2 = { state: "not-detected", reason: "No local .codegraph index is present for this project." };
158732
158845
  return { health: health2, quality: providerQuality({ mode, health: health2 }) };
158733
158846
  }
@@ -158763,7 +158876,7 @@ async function runExternalCodeGraphLifecycle(input) {
158763
158876
  };
158764
158877
  }
158765
158878
  const indexPath = join20(input.projectRoot, ".codegraph");
158766
- if (input.action === "sync" && !existsSync15(indexPath)) {
158879
+ if (input.action === "sync" && !existsSync16(indexPath)) {
158767
158880
  const health = { state: "not-detected", reason: "No local .codegraph index is present for this project." };
158768
158881
  return {
158769
158882
  action: input.action,
@@ -158773,7 +158886,7 @@ async function runExternalCodeGraphLifecycle(input) {
158773
158886
  quality: providerQuality({ mode, health })
158774
158887
  };
158775
158888
  }
158776
- if (input.action === "init" && existsSync15(indexPath)) {
158889
+ if (input.action === "init" && existsSync16(indexPath)) {
158777
158890
  const inspected2 = await inspectExternalCodeGraph(input);
158778
158891
  return {
158779
158892
  action: input.action,
@@ -159522,8 +159635,8 @@ __export(auto_context_exports, {
159522
159635
  formatAutoProjectContextSummary: () => formatAutoProjectContextSummary,
159523
159636
  formatLegacyAutoProjectContextPrompt: () => formatLegacyAutoProjectContextPrompt
159524
159637
  });
159525
- import { existsSync as existsSync16, statSync as statSync4 } from "fs";
159526
- import path28 from "path";
159638
+ import { existsSync as existsSync17, statSync as statSync4 } from "fs";
159639
+ import path29 from "path";
159527
159640
  function activeProjectObservations(observations2, projectId) {
159528
159641
  return observations2.filter((obs) => obs.projectId === projectId && (obs.status ?? "active") === "active");
159529
159642
  }
@@ -159858,9 +159971,9 @@ function dedupeSourcesByObservation(sources) {
159858
159971
  function existingLensCandidates(rootPath, lens) {
159859
159972
  const out = [];
159860
159973
  for (const candidate of lensPathCandidates(lens)) {
159861
- const absolute = path28.join(rootPath, candidate);
159974
+ const absolute = path29.join(rootPath, candidate);
159862
159975
  try {
159863
- if (!existsSync16(absolute)) continue;
159976
+ if (!existsSync17(absolute)) continue;
159864
159977
  const stat5 = statSync4(absolute);
159865
159978
  if (stat5.isFile()) out.push(candidate);
159866
159979
  if (stat5.isDirectory()) out.push(candidate.replace(/\\/g, "/"));
@@ -160381,7 +160494,7 @@ var engine_exports2 = {};
160381
160494
  __export(engine_exports2, {
160382
160495
  SkillsEngine: () => SkillsEngine
160383
160496
  });
160384
- import { existsSync as existsSync17, readFileSync as readFileSync11, writeFileSync as writeFileSync2, mkdirSync as mkdirSync3, readdirSync as readdirSync4 } from "fs";
160497
+ import { existsSync as existsSync18, readFileSync as readFileSync12, writeFileSync as writeFileSync3, mkdirSync as mkdirSync4, readdirSync as readdirSync4 } from "fs";
160385
160498
  import { join as join21 } from "path";
160386
160499
  import { homedir as homedir23 } from "os";
160387
160500
  var SKILLS_DIRS, SKILL_WORTHY_TYPES, MIN_OBS_FOR_SKILL, MIN_SCORE_FOR_SKILL, LOW_SIGNAL_TITLE_PATTERNS, LOW_SIGNAL_ENTITY_PATTERNS, COMMAND_TRACE_PATTERNS2, SkillsEngine;
@@ -160462,7 +160575,7 @@ var init_engine5 = __esm({
160462
160575
  paths.push(join21(home, dir));
160463
160576
  }
160464
160577
  for (const skillsRoot of paths) {
160465
- if (!existsSync17(skillsRoot)) continue;
160578
+ if (!existsSync18(skillsRoot)) continue;
160466
160579
  try {
160467
160580
  const entries = readdirSync4(skillsRoot, { withFileTypes: true });
160468
160581
  for (const entry of entries) {
@@ -160470,9 +160583,9 @@ var init_engine5 = __esm({
160470
160583
  const name = entry.name;
160471
160584
  if (seen.has(name)) continue;
160472
160585
  const skillMd = join21(skillsRoot, name, "SKILL.md");
160473
- if (!existsSync17(skillMd)) continue;
160586
+ if (!existsSync18(skillMd)) continue;
160474
160587
  try {
160475
- const content = readFileSync11(skillMd, "utf-8");
160588
+ const content = readFileSync12(skillMd, "utf-8");
160476
160589
  const description = this.parseDescription(content);
160477
160590
  skills.push({
160478
160591
  name,
@@ -160522,8 +160635,8 @@ var init_engine5 = __esm({
160522
160635
  if (!dirs || dirs.length === 0) return null;
160523
160636
  const targetDir = join21(this.projectRoot, dirs[0], skill2.name);
160524
160637
  try {
160525
- mkdirSync3(targetDir, { recursive: true });
160526
- writeFileSync2(join21(targetDir, "SKILL.md"), skill2.content, "utf-8");
160638
+ mkdirSync4(targetDir, { recursive: true });
160639
+ writeFileSync3(join21(targetDir, "SKILL.md"), skill2.content, "utf-8");
160527
160640
  return join21(dirs[0], skill2.name, "SKILL.md");
160528
160641
  } catch {
160529
160642
  return null;
@@ -160753,7 +160866,7 @@ __export(team_store_exports, {
160753
160866
  resetTeamStore: () => resetTeamStore
160754
160867
  });
160755
160868
  import { randomUUID as randomUUID15 } from "crypto";
160756
- import path29 from "path";
160869
+ import path30 from "path";
160757
160870
  import fs18 from "fs";
160758
160871
  function getTeamStore() {
160759
160872
  if (!_teamStore) {
@@ -161444,8 +161557,8 @@ var init_team_store = __esm({
161444
161557
  const agentCount = this.db.prepare(`SELECT COUNT(*) AS cnt FROM team_agents`).get();
161445
161558
  if (agentCount.cnt > 0) return;
161446
161559
  const candidates = [
161447
- path29.join(this.dataDir, "team-state.json"),
161448
- path29.join(this.dataDir, "..", "team-state.json")
161560
+ path30.join(this.dataDir, "team-state.json"),
161561
+ path30.join(this.dataDir, "..", "team-state.json")
161449
161562
  ];
161450
161563
  let jsonPath = null;
161451
161564
  for (const p of candidates) {
@@ -161585,7 +161698,7 @@ var init_team_store = __esm({
161585
161698
  * Uses projectId derived from the dataDir path.
161586
161699
  */
161587
161700
  seedDefaultRoles(dataDir) {
161588
- const projectId = path29.basename(path29.resolve(dataDir, ".."));
161701
+ const projectId = path30.basename(path30.resolve(dataDir, ".."));
161589
161702
  const count2 = this.stmtRoleCountByProject.get(projectId).cnt;
161590
161703
  if (count2 > 0) return;
161591
161704
  const now3 = Date.now();
@@ -162600,7 +162713,7 @@ __export(server_exports, {
162600
162713
  });
162601
162714
  import { createServer } from "http";
162602
162715
  import { promises as fs19 } from "fs";
162603
- import path30 from "path";
162716
+ import path31 from "path";
162604
162717
  import { exec } from "child_process";
162605
162718
  function sendJson(res, data, status = 200) {
162606
162719
  res.writeHead(status, {
@@ -162944,8 +163057,8 @@ async function handleApi(req, res, dataDir, projectId, projectName, baseDir, pro
162944
163057
  break;
162945
163058
  }
162946
163059
  case "/config": {
162947
- const os4 = await import("os");
162948
- const { existsSync: existsSync20 } = await import("fs");
163060
+ const os6 = await import("os");
163061
+ const { existsSync: existsSync21 } = await import("fs");
162949
163062
  const { join: join26 } = await import("path");
162950
163063
  let yml = {};
162951
163064
  const configProjectRoot = effectiveProjectRoot;
@@ -162969,7 +163082,7 @@ async function handleApi(req, res, dataDir, projectId, projectName, baseDir, pro
162969
163082
  "legacy config.json": { exists: false, path: "" }
162970
163083
  };
162971
163084
  try {
162972
- const home = os4.homedir();
163085
+ const home = os6.homedir();
162973
163086
  const paths = {
162974
163087
  "project memorix.yml": configProjectRoot ? join26(configProjectRoot, "memorix.yml") : null,
162975
163088
  "user memorix.yml": join26(home, ".memorix", "memorix.yml"),
@@ -162981,7 +163094,7 @@ async function handleApi(req, res, dataDir, projectId, projectName, baseDir, pro
162981
163094
  if (fpath === null) {
162982
163095
  files[key] = { exists: false, path: "unavailable", unavailable: true };
162983
163096
  } else {
162984
- files[key] = { exists: existsSync20(fpath), path: fpath };
163097
+ files[key] = { exists: existsSync21(fpath), path: fpath };
162985
163098
  }
162986
163099
  }
162987
163100
  } catch {
@@ -163078,7 +163191,7 @@ async function handleApi(req, res, dataDir, projectId, projectName, baseDir, pro
163078
163191
  const aliasModule = await Promise.resolve().then(() => (init_aliases(), aliases_exports));
163079
163192
  canonicalId = await aliasModule.getCanonicalId(effectiveProjectId);
163080
163193
  const { promises: fsP } = await import("fs");
163081
- const registryPath = path30.join(baseDir, ".project-aliases.json");
163194
+ const registryPath = path31.join(baseDir, ".project-aliases.json");
163082
163195
  const raw = await fsP.readFile(registryPath, "utf-8");
163083
163196
  const registry2 = JSON.parse(raw);
163084
163197
  aliasGroups = registry2.groups || [];
@@ -163193,14 +163306,14 @@ async function serveStatic(req, res, staticDir) {
163193
163306
  if (urlPath === "/" || !urlPath.includes(".")) {
163194
163307
  urlPath = "/index.html";
163195
163308
  }
163196
- const filePath = path30.join(staticDir, urlPath);
163309
+ const filePath = path31.join(staticDir, urlPath);
163197
163310
  if (!filePath.startsWith(staticDir)) {
163198
163311
  sendError(res, "Forbidden", 403);
163199
163312
  return;
163200
163313
  }
163201
163314
  try {
163202
163315
  const data = await fs19.readFile(filePath);
163203
- const ext = path30.extname(filePath);
163316
+ const ext = path31.extname(filePath);
163204
163317
  res.writeHead(200, {
163205
163318
  "Content-Type": MIME_TYPES[ext] || "application/octet-stream",
163206
163319
  "Cache-Control": "no-store, no-cache, must-revalidate, max-age=0",
@@ -163210,7 +163323,7 @@ async function serveStatic(req, res, staticDir) {
163210
163323
  res.end(data);
163211
163324
  } catch {
163212
163325
  try {
163213
- const indexData = await fs19.readFile(path30.join(staticDir, "index.html"));
163326
+ const indexData = await fs19.readFile(path31.join(staticDir, "index.html"));
163214
163327
  res.writeHead(200, {
163215
163328
  "Content-Type": "text/html; charset=utf-8",
163216
163329
  "Cache-Control": "no-store, no-cache, must-revalidate, max-age=0",
@@ -163807,7 +163920,7 @@ var init_task_graph = __esm({
163807
163920
 
163808
163921
  // src/orchestrate/context-collector.ts
163809
163922
  import { execFileSync as execFileSync2 } from "child_process";
163810
- import { readFileSync as readFileSync12, existsSync as existsSync18 } from "fs";
163923
+ import { readFileSync as readFileSync13, existsSync as existsSync19 } from "fs";
163811
163924
  import { join as join22 } from "path";
163812
163925
  function normalizeEntryLimit(value, fallback) {
163813
163926
  if (!Number.isSafeInteger(value) || value < 1) return fallback;
@@ -163884,8 +163997,8 @@ function collectFileTree(projectDir2, maxEntries) {
163884
163997
  function collectDependencies(projectDir2) {
163885
163998
  try {
163886
163999
  const pkgPath = join22(projectDir2, "package.json");
163887
- if (!existsSync18(pkgPath)) return "";
163888
- const pkg = JSON.parse(readFileSync12(pkgPath, "utf-8"));
164000
+ if (!existsSync19(pkgPath)) return "";
164001
+ const pkg = JSON.parse(readFileSync13(pkgPath, "utf-8"));
163889
164002
  const parts = [];
163890
164003
  if (pkg.dependencies && Object.keys(pkg.dependencies).length > 0) {
163891
164004
  parts.push(`dependencies: ${Object.keys(pkg.dependencies).join(", ")}`);
@@ -164918,10 +165031,10 @@ __export(audit_exports, {
164918
165031
  saveAudit: () => saveAudit
164919
165032
  });
164920
165033
  import * as fs20 from "fs/promises";
164921
- import * as path31 from "path";
165034
+ import * as path32 from "path";
164922
165035
  import { homedir as homedir24 } from "os";
164923
165036
  function getAuditFilePath() {
164924
- return process.env.MEMORIX_AUDIT_FILE || path31.join(homedir24(), ".memorix", "audit.json");
165037
+ return process.env.MEMORIX_AUDIT_FILE || path32.join(homedir24(), ".memorix", "audit.json");
164925
165038
  }
164926
165039
  async function loadAudit() {
164927
165040
  try {
@@ -164936,7 +165049,7 @@ async function loadAudit() {
164936
165049
  }
164937
165050
  async function saveAudit(data) {
164938
165051
  const auditFile = getAuditFilePath();
164939
- const dir = path31.dirname(auditFile);
165052
+ const dir = path32.dirname(auditFile);
164940
165053
  await fs20.mkdir(dir, { recursive: true });
164941
165054
  await fs20.writeFile(auditFile, JSON.stringify(data, null, 2), "utf-8");
164942
165055
  }
@@ -165021,8 +165134,8 @@ __export(installers_exports, {
165021
165134
  uninstallHooks: () => uninstallHooks
165022
165135
  });
165023
165136
  import * as fs21 from "fs/promises";
165024
- import * as path32 from "path";
165025
- import * as os3 from "os";
165137
+ import * as path33 from "path";
165138
+ import * as os5 from "os";
165026
165139
  import { execSync as execSync2 } from "child_process";
165027
165140
  function resolveHookCommand() {
165028
165141
  if (process.platform === "win32") {
@@ -165037,7 +165150,7 @@ function resolveWindowsMemorixShim() {
165037
165150
  stdio: ["ignore", "pipe", "ignore"],
165038
165151
  windowsHide: true
165039
165152
  }));
165040
- return output.split(/\r?\n/).map((candidate) => candidate.trim()).find((candidate) => path32.isAbsolute(candidate)) ?? null;
165153
+ return output.split(/\r?\n/).map((candidate) => candidate.trim()).find((candidate) => path33.isAbsolute(candidate)) ?? null;
165041
165154
  } catch {
165042
165155
  return null;
165043
165156
  }
@@ -165234,11 +165347,11 @@ async function installOfficialSkillsForAgent(agent, projectRoot, global2 = false
165234
165347
  const dirs = AGENT_SKILL_DIRS[agent];
165235
165348
  const relativeDir = global2 ? dirs?.global : dirs?.project;
165236
165349
  if (!relativeDir) return [];
165237
- const root = global2 ? agent === "dsh" ? process.env.DSH_HOME?.trim() || path32.join(os3.homedir(), ".dsh") : os3.homedir() : projectRoot;
165350
+ const root = global2 ? agent === "dsh" ? process.env.DSH_HOME?.trim() || path33.join(os5.homedir(), ".dsh") : os5.homedir() : projectRoot;
165238
165351
  const skillPaths = [];
165239
165352
  for (const skillEntry of OFFICIAL_MEMORIX_SKILLS) {
165240
- const skillPath = path32.join(root, relativeDir, skillEntry.name, "SKILL.md");
165241
- await fs21.mkdir(path32.dirname(skillPath), { recursive: true });
165353
+ const skillPath = path33.join(root, relativeDir, skillEntry.name, "SKILL.md");
165354
+ await fs21.mkdir(path33.dirname(skillPath), { recursive: true });
165242
165355
  await fs21.writeFile(skillPath, skillEntry.content, "utf-8");
165243
165356
  skillPaths.push(skillPath);
165244
165357
  try {
@@ -165453,128 +165566,128 @@ async function installOpenCodeSkills(projectRoot, global2 = false) {
165453
165566
  function getProjectConfigPath(agent, projectRoot) {
165454
165567
  switch (agent) {
165455
165568
  case "claude":
165456
- return path32.join(projectRoot, ".claude", "settings.local.json");
165569
+ return path33.join(projectRoot, ".claude", "settings.local.json");
165457
165570
  case "copilot":
165458
- return path32.join(projectRoot, ".github", "hooks", "memorix.json");
165571
+ return path33.join(projectRoot, ".github", "hooks", "memorix.json");
165459
165572
  case "windsurf":
165460
- return path32.join(projectRoot, ".windsurf", "hooks.json");
165573
+ return path33.join(projectRoot, ".windsurf", "hooks.json");
165461
165574
  case "cursor":
165462
- return path32.join(projectRoot, ".cursor", "hooks.json");
165575
+ return path33.join(projectRoot, ".cursor", "hooks.json");
165463
165576
  case "kiro":
165464
- return path32.join(projectRoot, ".kiro", "hooks", "memorix-agent-stop.kiro.hook");
165577
+ return path33.join(projectRoot, ".kiro", "hooks", "memorix-agent-stop.kiro.hook");
165465
165578
  case "codex":
165466
- return path32.join(projectRoot, "AGENTS.md");
165579
+ return path33.join(projectRoot, "AGENTS.md");
165467
165580
  case "trae":
165468
- return path32.join(projectRoot, ".trae", "rules", "project_rules.md");
165581
+ return path33.join(projectRoot, ".trae", "rules", "project_rules.md");
165469
165582
  case "dsh":
165470
- return path32.join(projectRoot, "AGENTS.md");
165583
+ return path33.join(projectRoot, "AGENTS.md");
165471
165584
  case "opencode":
165472
- return path32.join(projectRoot, ".opencode", "plugins", "memorix.js");
165585
+ return path33.join(projectRoot, ".opencode", "plugins", "memorix.js");
165473
165586
  case "pi":
165474
- return path32.join(projectRoot, ".pi", "packages", "memorix", "extensions", "memorix.js");
165587
+ return path33.join(projectRoot, ".pi", "packages", "memorix", "extensions", "memorix.js");
165475
165588
  case "openclaw":
165476
- return path32.join(os3.homedir(), ".openclaw", "extensions", "memorix", "hooks", "memorix", "HOOK.md");
165589
+ return path33.join(os5.homedir(), ".openclaw", "extensions", "memorix", "hooks", "memorix", "HOOK.md");
165477
165590
  case "hermes":
165478
- return path32.join(os3.homedir(), ".hermes", "plugins", "memorix", "plugin.yaml");
165591
+ return path33.join(os5.homedir(), ".hermes", "plugins", "memorix", "plugin.yaml");
165479
165592
  case "omp":
165480
- return path32.join(projectRoot, ".omp", "packages", "memorix", "extensions", "memorix.js");
165593
+ return path33.join(projectRoot, ".omp", "packages", "memorix", "extensions", "memorix.js");
165481
165594
  case "antigravity":
165482
- return path32.join(projectRoot, ".agents", "hooks.json");
165595
+ return path33.join(projectRoot, ".agents", "hooks.json");
165483
165596
  case "gemini-cli":
165484
- return path32.join(projectRoot, ".gemini", "settings.json");
165597
+ return path33.join(projectRoot, ".gemini", "settings.json");
165485
165598
  default:
165486
- return path32.join(projectRoot, ".memorix", "hooks.json");
165599
+ return path33.join(projectRoot, ".memorix", "hooks.json");
165487
165600
  }
165488
165601
  }
165489
165602
  function getGlobalConfigPath(agent) {
165490
- const home = os3.homedir();
165603
+ const home = os5.homedir();
165491
165604
  switch (agent) {
165492
165605
  case "claude":
165493
- return path32.join(home, ".claude", "settings.json");
165606
+ return path33.join(home, ".claude", "settings.json");
165494
165607
  case "copilot":
165495
165608
  return "";
165496
165609
  case "windsurf":
165497
- return path32.join(home, ".codeium", "windsurf", "hooks.json");
165610
+ return path33.join(home, ".codeium", "windsurf", "hooks.json");
165498
165611
  case "cursor":
165499
- return path32.join(home, ".cursor", "hooks.json");
165612
+ return path33.join(home, ".cursor", "hooks.json");
165500
165613
  case "antigravity":
165501
- return path32.join(home, ".gemini", "config", "hooks.json");
165614
+ return path33.join(home, ".gemini", "config", "hooks.json");
165502
165615
  case "gemini-cli":
165503
- return path32.join(home, ".gemini", "settings.json");
165616
+ return path33.join(home, ".gemini", "settings.json");
165504
165617
  case "opencode":
165505
- return path32.join(home, ".config", "opencode", "plugins", "memorix.js");
165618
+ return path33.join(home, ".config", "opencode", "plugins", "memorix.js");
165506
165619
  case "pi":
165507
- return path32.join(home, ".pi", "agent", "packages", "memorix", "extensions", "memorix.js");
165620
+ return path33.join(home, ".pi", "agent", "packages", "memorix", "extensions", "memorix.js");
165508
165621
  case "openclaw":
165509
- return path32.join(home, ".openclaw", "extensions", "memorix", "hooks", "memorix", "HOOK.md");
165622
+ return path33.join(home, ".openclaw", "extensions", "memorix", "hooks", "memorix", "HOOK.md");
165510
165623
  case "hermes":
165511
- return path32.join(home, ".hermes", "plugins", "memorix", "plugin.yaml");
165624
+ return path33.join(home, ".hermes", "plugins", "memorix", "plugin.yaml");
165512
165625
  case "omp":
165513
- return path32.join(home, ".omp", "agent", "packages", "memorix", "extensions", "memorix.js");
165626
+ return path33.join(home, ".omp", "agent", "packages", "memorix", "extensions", "memorix.js");
165514
165627
  case "trae":
165515
- return path32.join(home, ".trae", "rules", "project_rules.md");
165628
+ return path33.join(home, ".trae", "rules", "project_rules.md");
165516
165629
  case "dsh":
165517
- return path32.join(process.env.DSH_HOME?.trim() || path32.join(home, ".dsh"), "AGENTS.md");
165630
+ return path33.join(process.env.DSH_HOME?.trim() || path33.join(home, ".dsh"), "AGENTS.md");
165518
165631
  default:
165519
- return path32.join(home, ".memorix", "hooks.json");
165632
+ return path33.join(home, ".memorix", "hooks.json");
165520
165633
  }
165521
165634
  }
165522
165635
  function getAgentRulesPath(agent, root, global2 = false) {
165523
165636
  if (global2) {
165524
165637
  switch (agent) {
165525
165638
  case "windsurf":
165526
- return path32.join(root, ".codeium", "windsurf", "rules", "memorix.md");
165639
+ return path33.join(root, ".codeium", "windsurf", "rules", "memorix.md");
165527
165640
  case "cursor":
165528
- return path32.join(root, ".cursor", "rules", "memorix.mdc");
165641
+ return path33.join(root, ".cursor", "rules", "memorix.mdc");
165529
165642
  case "claude":
165530
- return path32.join(root, ".claude", "CLAUDE.md");
165643
+ return path33.join(root, ".claude", "CLAUDE.md");
165531
165644
  case "codex":
165532
- return path32.join(root, ".codex", "AGENTS.md");
165645
+ return path33.join(root, ".codex", "AGENTS.md");
165533
165646
  case "kiro":
165534
- return path32.join(root, ".kiro", "steering", "memorix.md");
165647
+ return path33.join(root, ".kiro", "steering", "memorix.md");
165535
165648
  case "opencode":
165536
- return path32.join(root, ".config", "opencode", "AGENTS.md");
165649
+ return path33.join(root, ".config", "opencode", "AGENTS.md");
165537
165650
  case "antigravity":
165538
165651
  case "gemini-cli":
165539
- return path32.join(root, ".gemini", "GEMINI.md");
165652
+ return path33.join(root, ".gemini", "GEMINI.md");
165540
165653
  case "trae":
165541
- return path32.join(root, ".trae", "rules", "project_rules.md");
165654
+ return path33.join(root, ".trae", "rules", "project_rules.md");
165542
165655
  case "dsh":
165543
- return path32.join(process.env.DSH_HOME?.trim() || path32.join(root, ".dsh"), "AGENTS.md");
165656
+ return path33.join(process.env.DSH_HOME?.trim() || path33.join(root, ".dsh"), "AGENTS.md");
165544
165657
  default:
165545
- return path32.join(root, ".agent", "rules", "memorix.md");
165658
+ return path33.join(root, ".agent", "rules", "memorix.md");
165546
165659
  }
165547
165660
  }
165548
165661
  switch (agent) {
165549
165662
  case "windsurf":
165550
- return path32.join(root, ".windsurf", "rules", "memorix.md");
165663
+ return path33.join(root, ".windsurf", "rules", "memorix.md");
165551
165664
  case "cursor":
165552
- return path32.join(root, ".cursor", "rules", "memorix.mdc");
165665
+ return path33.join(root, ".cursor", "rules", "memorix.mdc");
165553
165666
  case "claude":
165554
- return path32.join(root, "CLAUDE.md");
165667
+ return path33.join(root, "CLAUDE.md");
165555
165668
  case "copilot":
165556
- return path32.join(root, ".github", "copilot-instructions.md");
165669
+ return path33.join(root, ".github", "copilot-instructions.md");
165557
165670
  case "codex":
165558
- return path32.join(root, "AGENTS.md");
165671
+ return path33.join(root, "AGENTS.md");
165559
165672
  case "kiro":
165560
- return path32.join(root, ".kiro", "steering", "memorix.md");
165673
+ return path33.join(root, ".kiro", "steering", "memorix.md");
165561
165674
  case "opencode":
165562
- return path32.join(root, "AGENTS.md");
165675
+ return path33.join(root, "AGENTS.md");
165563
165676
  case "antigravity":
165564
165677
  case "gemini-cli":
165565
- return path32.join(root, "GEMINI.md");
165678
+ return path33.join(root, "GEMINI.md");
165566
165679
  case "trae":
165567
- return path32.join(root, ".trae", "rules", "project_rules.md");
165680
+ return path33.join(root, ".trae", "rules", "project_rules.md");
165568
165681
  case "dsh":
165569
- return path32.join(root, "AGENTS.md");
165682
+ return path33.join(root, "AGENTS.md");
165570
165683
  default:
165571
- return path32.join(root, ".agent", "rules", "memorix.md");
165684
+ return path33.join(root, ".agent", "rules", "memorix.md");
165572
165685
  }
165573
165686
  }
165574
165687
  async function detectCopilotExtension(home) {
165575
165688
  const extDirs = [
165576
- path32.join(home, ".vscode", "extensions"),
165577
- path32.join(home, ".vscode-insiders", "extensions")
165689
+ path33.join(home, ".vscode", "extensions"),
165690
+ path33.join(home, ".vscode-insiders", "extensions")
165578
165691
  ];
165579
165692
  for (const extDir of extDirs) {
165580
165693
  try {
@@ -165589,20 +165702,20 @@ async function detectCopilotExtension(home) {
165589
165702
  }
165590
165703
  async function detectInstalledAgents() {
165591
165704
  const agents = [];
165592
- const home = os3.homedir();
165593
- const claudeDir = path32.join(home, ".claude");
165705
+ const home = os5.homedir();
165706
+ const claudeDir = path33.join(home, ".claude");
165594
165707
  try {
165595
165708
  await fs21.access(claudeDir);
165596
165709
  agents.push("claude");
165597
165710
  } catch {
165598
165711
  }
165599
- const windsurfDir = path32.join(home, ".codeium", "windsurf");
165712
+ const windsurfDir = path33.join(home, ".codeium", "windsurf");
165600
165713
  try {
165601
165714
  await fs21.access(windsurfDir);
165602
165715
  agents.push("windsurf");
165603
165716
  } catch {
165604
165717
  }
165605
- const cursorDir = path32.join(home, ".cursor");
165718
+ const cursorDir = path33.join(home, ".cursor");
165606
165719
  try {
165607
165720
  await fs21.access(cursorDir);
165608
165721
  agents.push("cursor");
@@ -165612,19 +165725,19 @@ async function detectInstalledAgents() {
165612
165725
  if (copilotDetected) {
165613
165726
  agents.push("copilot");
165614
165727
  }
165615
- const kiroConfig = path32.join(home, ".kiro");
165728
+ const kiroConfig = path33.join(home, ".kiro");
165616
165729
  try {
165617
165730
  await fs21.access(kiroConfig);
165618
165731
  agents.push("kiro");
165619
165732
  } catch {
165620
165733
  }
165621
- const codexDir = path32.join(home, ".codex");
165734
+ const codexDir = path33.join(home, ".codex");
165622
165735
  try {
165623
165736
  await fs21.access(codexDir);
165624
165737
  agents.push("codex");
165625
165738
  } catch {
165626
165739
  }
165627
- const antigravityDir = path32.join(home, ".gemini", "config");
165740
+ const antigravityDir = path33.join(home, ".gemini", "config");
165628
165741
  try {
165629
165742
  await fs21.access(antigravityDir);
165630
165743
  agents.push("antigravity");
@@ -165637,19 +165750,19 @@ async function detectInstalledAgents() {
165637
165750
  agents.push("gemini-cli");
165638
165751
  } catch {
165639
165752
  }
165640
- const opencodeDir = path32.join(home, ".config", "opencode");
165753
+ const opencodeDir = path33.join(home, ".config", "opencode");
165641
165754
  try {
165642
165755
  await fs21.access(opencodeDir);
165643
165756
  agents.push("opencode");
165644
165757
  } catch {
165645
165758
  }
165646
- const traeDir = path32.join(home, ".trae");
165759
+ const traeDir = path33.join(home, ".trae");
165647
165760
  try {
165648
165761
  await fs21.access(traeDir);
165649
165762
  agents.push("trae");
165650
165763
  } catch {
165651
165764
  }
165652
- const dshDir = process.env.DSH_HOME?.trim() || path32.join(home, ".dsh");
165765
+ const dshDir = process.env.DSH_HOME?.trim() || path33.join(home, ".dsh");
165653
165766
  try {
165654
165767
  await fs21.access(dshDir);
165655
165768
  agents.push("dsh");
@@ -165685,7 +165798,7 @@ async function installHooks(agent, projectRoot, global2 = false) {
165685
165798
  try {
165686
165799
  const { access: access3, unlink: unlink3 } = await import("fs/promises");
165687
165800
  await access3(entry.path);
165688
- const basename5 = path32.basename(entry.path);
165801
+ const basename5 = path33.basename(entry.path);
165689
165802
  if (basename5 === "AGENTS.md" || basename5 === "GEMINI.md" || basename5 === "CONTEXT.md") {
165690
165803
  continue;
165691
165804
  }
@@ -165753,7 +165866,7 @@ async function installHooks(agent, projectRoot, global2 = false) {
165753
165866
  case "opencode": {
165754
165867
  const pluginContent = generateOpenCodePlugin();
165755
165868
  const pluginPath = global2 ? getGlobalConfigPath(agent) : getProjectConfigPath(agent, projectRoot);
165756
- await fs21.mkdir(path32.dirname(pluginPath), { recursive: true });
165869
+ await fs21.mkdir(path33.dirname(pluginPath), { recursive: true });
165757
165870
  await fs21.writeFile(pluginPath, pluginContent, "utf-8");
165758
165871
  try {
165759
165872
  const { recordFile: recordFile2 } = await Promise.resolve().then(() => (init_audit(), audit_exports));
@@ -165783,13 +165896,13 @@ async function installHooks(agent, projectRoot, global2 = false) {
165783
165896
  default:
165784
165897
  generated = generateClaudeConfig();
165785
165898
  }
165786
- await fs21.mkdir(path32.dirname(configPath), { recursive: true });
165899
+ await fs21.mkdir(path33.dirname(configPath), { recursive: true });
165787
165900
  if (agent === "kiro") {
165788
165901
  const hookFiles = generateKiroHookFiles();
165789
- const hooksDir = path32.join(path32.dirname(configPath));
165902
+ const hooksDir = path33.join(path33.dirname(configPath));
165790
165903
  await fs21.mkdir(hooksDir, { recursive: true });
165791
165904
  for (const hf of hookFiles) {
165792
- const hookPath = path32.join(hooksDir, hf.filename);
165905
+ const hookPath = path33.join(hooksDir, hf.filename);
165793
165906
  await fs21.writeFile(hookPath, hf.content, "utf-8");
165794
165907
  try {
165795
165908
  const { recordFile: recordFile2 } = await Promise.resolve().then(() => (init_audit(), audit_exports));
@@ -165880,10 +165993,10 @@ async function installHooks(agent, projectRoot, global2 = false) {
165880
165993
  }
165881
165994
  async function installAgentRules(agent, projectRoot, global2 = false) {
165882
165995
  const rulesContent = getAgentRulesContent(agent, global2 ? "global" : "project");
165883
- const rulesRoot = global2 ? os3.homedir() : projectRoot;
165996
+ const rulesRoot = global2 ? os5.homedir() : projectRoot;
165884
165997
  const rulesPath = getAgentRulesPath(agent, rulesRoot, global2);
165885
165998
  try {
165886
- await fs21.mkdir(path32.dirname(rulesPath), { recursive: true });
165999
+ await fs21.mkdir(path33.dirname(rulesPath), { recursive: true });
165887
166000
  if (agent === "claude" || agent === "codex" || agent === "opencode" || agent === "antigravity" || agent === "gemini-cli" || agent === "dsh") {
165888
166001
  try {
165889
166002
  const existing = await fs21.readFile(rulesPath, "utf-8");
@@ -166070,7 +166183,7 @@ async function uninstallHooks(agent, projectRoot, global2 = false) {
166070
166183
  const agentFiles = prevFiles.filter((e2) => e2.agent === agent);
166071
166184
  for (const entry of agentFiles) {
166072
166185
  try {
166073
- const basename5 = path32.basename(entry.path);
166186
+ const basename5 = path33.basename(entry.path);
166074
166187
  if (basename5 === "AGENTS.md" || basename5 === "GEMINI.md" || basename5 === "CONTEXT.md") {
166075
166188
  try {
166076
166189
  const content = await fs21.readFile(entry.path, "utf-8");
@@ -166108,14 +166221,14 @@ async function uninstallHooks(agent, projectRoot, global2 = false) {
166108
166221
  if (success) {
166109
166222
  try {
166110
166223
  const { rm: rm2 } = await import("fs/promises");
166111
- const dir = path32.dirname(configPath);
166224
+ const dir = path33.dirname(configPath);
166112
166225
  let current = dir;
166113
166226
  for (let i2 = 0; i2 < 3; i2++) {
166114
166227
  try {
166115
166228
  const entries = await fs21.readdir(current);
166116
166229
  if (entries.length === 0) {
166117
166230
  await rm2(current, { recursive: true });
166118
- current = path32.dirname(current);
166231
+ current = path33.dirname(current);
166119
166232
  } else {
166120
166233
  break;
166121
166234
  }
@@ -166184,14 +166297,14 @@ var init_installers = __esm({
166184
166297
  init_official_skills();
166185
166298
  OPENCODE_PLUGIN_VERSION = 7;
166186
166299
  AGENT_SKILL_DIRS = {
166187
- cursor: { project: path32.join(".cursor", "skills"), global: path32.join(".cursor", "skills") },
166188
- windsurf: { project: path32.join(".windsurf", "skills"), global: path32.join(".windsurf", "skills") },
166189
- kiro: { project: path32.join(".kiro", "skills"), global: path32.join(".kiro", "skills") },
166190
- opencode: { project: path32.join(".opencode", "skills"), global: path32.join(".config", "opencode", "skills") },
166191
- trae: { project: path32.join(".trae", "skills"), global: path32.join(".trae", "skills") },
166300
+ cursor: { project: path33.join(".cursor", "skills"), global: path33.join(".cursor", "skills") },
166301
+ windsurf: { project: path33.join(".windsurf", "skills"), global: path33.join(".windsurf", "skills") },
166302
+ kiro: { project: path33.join(".kiro", "skills"), global: path33.join(".kiro", "skills") },
166303
+ opencode: { project: path33.join(".opencode", "skills"), global: path33.join(".config", "opencode", "skills") },
166304
+ trae: { project: path33.join(".trae", "skills"), global: path33.join(".trae", "skills") },
166192
166305
  // DSH's user skill root is <harness home>/skills; the global root below is
166193
166306
  // resolved to $DSH_HOME (or ~/.dsh) for dsh by installOfficialSkillsForAgent.
166194
- dsh: { project: path32.join(".dsh", "skills"), global: "skills" }
166307
+ dsh: { project: path33.join(".dsh", "skills"), global: "skills" }
166195
166308
  };
166196
166309
  PACKAGE_OWNED_HOOK_AGENTS = /* @__PURE__ */ new Set(["openclaw", "hermes", "omp"]);
166197
166310
  }
@@ -166204,23 +166317,23 @@ __export(hooks_path_exports, {
166204
166317
  resolveGitDir: () => resolveGitDir,
166205
166318
  resolveHooksDir: () => resolveHooksDir
166206
166319
  });
166207
- import { existsSync as existsSync19, readFileSync as readFileSync13, statSync as statSync5, mkdirSync as mkdirSync4 } from "fs";
166208
- import path33 from "path";
166320
+ import { existsSync as existsSync20, readFileSync as readFileSync14, statSync as statSync5, mkdirSync as mkdirSync5 } from "fs";
166321
+ import path34 from "path";
166209
166322
  function resolveGitDir(projectRoot) {
166210
- const dotGit = path33.join(projectRoot, ".git");
166211
- if (!existsSync19(dotGit)) return null;
166323
+ const dotGit = path34.join(projectRoot, ".git");
166324
+ if (!existsSync20(dotGit)) return null;
166212
166325
  const stat5 = statSync5(dotGit);
166213
166326
  if (stat5.isDirectory()) {
166214
166327
  return dotGit;
166215
166328
  }
166216
166329
  if (stat5.isFile()) {
166217
166330
  try {
166218
- const content = readFileSync13(dotGit, "utf-8").trim();
166331
+ const content = readFileSync14(dotGit, "utf-8").trim();
166219
166332
  const match2 = content.match(/^gitdir:\s*(.+)$/);
166220
166333
  if (match2) {
166221
166334
  const gitdir = match2[1].trim();
166222
- const resolved = path33.isAbsolute(gitdir) ? gitdir : path33.resolve(projectRoot, gitdir);
166223
- if (existsSync19(resolved)) {
166335
+ const resolved = path34.isAbsolute(gitdir) ? gitdir : path34.resolve(projectRoot, gitdir);
166336
+ if (existsSync20(resolved)) {
166224
166337
  return resolved;
166225
166338
  }
166226
166339
  }
@@ -166232,16 +166345,16 @@ function resolveGitDir(projectRoot) {
166232
166345
  function resolveHooksDir(projectRoot) {
166233
166346
  const gitDir = resolveGitDir(projectRoot);
166234
166347
  if (!gitDir) return null;
166235
- const hooksDir = path33.join(gitDir, "hooks");
166348
+ const hooksDir = path34.join(gitDir, "hooks");
166236
166349
  return {
166237
166350
  hooksDir,
166238
- hookPath: path33.join(hooksDir, "post-commit")
166351
+ hookPath: path34.join(hooksDir, "post-commit")
166239
166352
  };
166240
166353
  }
166241
166354
  function ensureHooksDir(projectRoot) {
166242
166355
  const resolved = resolveHooksDir(projectRoot);
166243
166356
  if (!resolved) return null;
166244
- mkdirSync4(resolved.hooksDir, { recursive: true });
166357
+ mkdirSync5(resolved.hooksDir, { recursive: true });
166245
166358
  return resolved;
166246
166359
  }
166247
166360
  var init_hooks_path = __esm({
@@ -166361,7 +166474,8 @@ async function createMemorixServer(cwd, existingServer, sharedTeam, options = {}
166361
166474
  });
166362
166475
  const teamFeaturesEnabled = isToolInProfile("team_manage", toolProfile);
166363
166476
  const projectBinding = options.projectBinding ?? createProjectBindingController(cwd ?? process.cwd());
166364
- const detectedProject = detectProject(cwd);
166477
+ const detectedProjectRaw = detectProject(cwd);
166478
+ const detectedProject = detectedProjectRaw && !isHomeDirectory(detectedProjectRaw.rootPath) ? detectedProjectRaw : null;
166365
166479
  let rawProject;
166366
166480
  let projectResolved = true;
166367
166481
  let projectResolutionError = null;
@@ -166403,6 +166517,7 @@ async function createMemorixServer(cwd, existingServer, sharedTeam, options = {}
166403
166517
  }
166404
166518
  if (projectResolved) {
166405
166519
  projectBinding.recordResolvedProject(project.id, project.rootPath);
166520
+ writeLastProjectRoot(project.rootPath);
166406
166521
  }
166407
166522
  const registerMaintenanceTarget = async () => {
166408
166523
  if (!projectResolved) return;
@@ -166438,6 +166553,7 @@ async function createMemorixServer(cwd, existingServer, sharedTeam, options = {}
166438
166553
  }
166439
166554
  const lightweightUnresolvedSession = !projectResolved && deferProjectInitUntilBound;
166440
166555
  let projectRuntimeInitPromise = null;
166556
+ let runtimeHydratedForDir = null;
166441
166557
  const initializeProjectRuntime = async (logPrefix) => {
166442
166558
  await initObservationStore(projectDir2);
166443
166559
  await initMiniSkillStore(projectDir2);
@@ -166496,11 +166612,17 @@ async function createMemorixServer(cwd, existingServer, sharedTeam, options = {}
166496
166612
  } catch {
166497
166613
  }
166498
166614
  await initializeProjectRuntime("startup");
166615
+ runtimeHydratedForDir = projectDir2;
166499
166616
  } else {
166500
166617
  }
166501
166618
  const ensureProjectRuntimeInitialized = async () => {
166502
- if (lightweightUnresolvedSession || !deferProjectRuntimeInit) return;
166619
+ if (!projectResolved) return;
166620
+ if (runtimeHydratedForDir === projectDir2) {
166621
+ if (projectRuntimeInitPromise) await projectRuntimeInitPromise;
166622
+ return;
166623
+ }
166503
166624
  if (!projectRuntimeInitPromise) {
166625
+ const targetDir = projectDir2;
166504
166626
  projectRuntimeInitPromise = (async () => {
166505
166627
  try {
166506
166628
  const { getAllObservations: getAllObservations2 } = await Promise.resolve().then(() => (init_observations(), observations_exports));
@@ -166531,7 +166653,8 @@ async function createMemorixServer(cwd, existingServer, sharedTeam, options = {}
166531
166653
  }
166532
166654
  } catch {
166533
166655
  }
166534
- await initializeProjectRuntime("startup");
166656
+ await initializeProjectRuntime(runtimeHydratedForDir ? "switch" : "startup");
166657
+ runtimeHydratedForDir = targetDir;
166535
166658
  })().catch((err) => {
166536
166659
  projectRuntimeInitPromise = null;
166537
166660
  throw err;
@@ -166624,7 +166747,7 @@ The path should point to a directory containing a .git folder.`
166624
166747
  };
166625
166748
  const server = existingServer ?? new McpServer({
166626
166749
  name: "memorix",
166627
- version: true ? "1.6.2" : "1.0.1"
166750
+ version: true ? "1.6.3" : "1.0.1"
166628
166751
  });
166629
166752
  const originalRegisterTool = server.registerTool.bind(server);
166630
166753
  server.registerTool = ((name, ...args) => {
@@ -169308,6 +169431,15 @@ ${skill2.content}` }]
169308
169431
  async ({ sessionId, agent, agentType, instanceId, joinTeam, role, projectRoot: explicitRoot }) => {
169309
169432
  currentAgentId = void 0;
169310
169433
  if (explicitRoot && typeof explicitRoot === "string") {
169434
+ if (isHomeDirectory(explicitRoot)) {
169435
+ return {
169436
+ content: [{
169437
+ type: "text",
169438
+ text: homeProjectRootError(explicitRoot)
169439
+ }],
169440
+ isError: true
169441
+ };
169442
+ }
169311
169443
  let bound = await switchProject(explicitRoot, "explicit-project-root");
169312
169444
  if (!bound) {
169313
169445
  const { detectProjectWithDiagnostics: diagnose } = await Promise.resolve().then(() => (init_detector(), detector_exports));
@@ -170721,10 +170853,10 @@ Preview: ${analysis.description.slice(0, 300)}${analysis.description.length > 30
170721
170853
  const { ensureHooksDir: ensureHooksDir2 } = await Promise.resolve().then(() => (init_hooks_path(), hooks_path_exports));
170722
170854
  const resolved = ensureHooksDir2(project.rootPath);
170723
170855
  if (resolved) {
170724
- const { existsSync: existsSync20, readFileSync: readFileSync14, writeFileSync: writeFileSync3, chmodSync } = await import("fs");
170856
+ const { existsSync: existsSync21, readFileSync: readFileSync15, writeFileSync: writeFileSync4, chmodSync } = await import("fs");
170725
170857
  const { hookPath } = resolved;
170726
170858
  const HOOK_MARKER = "# [memorix-git-hook]";
170727
- const needsInstall = !existsSync20(hookPath) || !readFileSync14(hookPath, "utf-8").includes(HOOK_MARKER);
170859
+ const needsInstall = !existsSync21(hookPath) || !readFileSync15(hookPath, "utf-8").includes(HOOK_MARKER);
170728
170860
  if (needsInstall) {
170729
170861
  const hookScript = `#!/bin/sh
170730
170862
  ${HOOK_MARKER}
@@ -170733,9 +170865,9 @@ if command -v memorix >/dev/null 2>&1; then
170733
170865
  memorix ingest commit --auto >/dev/null 2>&1 &
170734
170866
  fi
170735
170867
  `;
170736
- if (existsSync20(hookPath)) {
170737
- const existing = readFileSync14(hookPath, "utf-8");
170738
- writeFileSync3(hookPath, existing.trimEnd() + `
170868
+ if (existsSync21(hookPath)) {
170869
+ const existing = readFileSync15(hookPath, "utf-8");
170870
+ writeFileSync4(hookPath, existing.trimEnd() + `
170739
170871
 
170740
170872
  ${HOOK_MARKER}
170741
170873
  if command -v memorix >/dev/null 2>&1; then
@@ -170743,7 +170875,7 @@ if command -v memorix >/dev/null 2>&1; then
170743
170875
  fi
170744
170876
  `, "utf-8");
170745
170877
  } else {
170746
- writeFileSync3(hookPath, hookScript, "utf-8");
170878
+ writeFileSync4(hookPath, hookScript, "utf-8");
170747
170879
  }
170748
170880
  try {
170749
170881
  chmodSync(hookPath, 493);
@@ -170785,8 +170917,12 @@ fi
170785
170917
  const switchProject = async (newCwd, source = "mcp-roots") => {
170786
170918
  if (source === "mcp-roots" && projectBinding.isExplicit()) return false;
170787
170919
  const { detectProjectWithDiagnostics: detectProjectWithDiagnostics2 } = await Promise.resolve().then(() => (init_detector(), detector_exports));
170920
+ if (isHomeDirectory(newCwd)) {
170921
+ console.error(`[memorix] Refusing to bind $HOME as a project root: ${newCwd}`);
170922
+ return false;
170923
+ }
170788
170924
  const result = detectProjectWithDiagnostics2(newCwd);
170789
- if (!result.project) {
170925
+ if (!result.project || isHomeDirectory(result.project.rootPath)) {
170790
170926
  if (result.failure) {
170791
170927
  console.error(`[memorix] Project detection failed for "${newCwd}": [${result.failure.reason}] ${result.failure.detail}`);
170792
170928
  }
@@ -170801,6 +170937,7 @@ fi
170801
170937
  else if (source === "mcp-roots") projectBinding.bindFromRoots(newDetected.rootPath);
170802
170938
  else projectBinding.bindStartup(newDetected.rootPath);
170803
170939
  projectBinding.recordResolvedProject(project.id, project.rootPath);
170940
+ writeLastProjectRoot(project.rootPath);
170804
170941
  return false;
170805
170942
  }
170806
170943
  maintenanceWorker?.stop();
@@ -170839,7 +170976,12 @@ fi
170839
170976
  }
170840
170977
  } catch {
170841
170978
  }
170842
- await initializeProjectRuntime("switch");
170979
+ writeLastProjectRoot(project.rootPath);
170980
+ runtimeHydratedForDir = null;
170981
+ projectRuntimeInitPromise = null;
170982
+ void ensureProjectRuntimeInitialized().catch((err) => {
170983
+ console.error(`[memorix] Background project runtime init failed: ${err instanceof Error ? err.message : err}`);
170984
+ });
170843
170985
  try {
170844
170986
  await startProjectMaintenanceWorker();
170845
170987
  } catch {
@@ -170889,6 +171031,7 @@ var init_server2 = __esm({
170889
171031
  init_engine3();
170890
171032
  init_graph_context();
170891
171033
  init_detector();
171034
+ init_launch_root();
170892
171035
  init_aliases();
170893
171036
  init_persistence();
170894
171037
  init_syncer();
@@ -170922,7 +171065,8 @@ var init_server2 = __esm({
170922
171065
  "memorix_project_context",
170923
171066
  "memorix_codegraph_status",
170924
171067
  "memorix_graph_context",
170925
- "memorix_context_pack"
171068
+ "memorix_context_pack",
171069
+ "memorix_session_start"
170926
171070
  ]);
170927
171071
  AUTOPILOT_RETRIEVAL_BOUNDARY_TTL_MS = 2 * 60 * 1e3;
170928
171072
  READ_ONLY_TASK_PATTERN = /\b(?:do not|don't|never)\s+(?:modify|edit|change|write)\b|\bread[- ]only\b|(?:不要|不准|勿|禁止).{0,6}(?:修改|编辑|写入)|只读/i;
@@ -170930,7 +171074,7 @@ var init_server2 = __esm({
170930
171074
  });
170931
171075
 
170932
171076
  // src/cli/mcp-root-path.ts
170933
- import path34 from "path";
171077
+ import path35 from "path";
170934
171078
  function mcpFileUriToPath(uri, platform = process.platform) {
170935
171079
  let parsed;
170936
171080
  try {
@@ -170948,15 +171092,15 @@ function mcpFileUriToPath(uri, platform = process.platform) {
170948
171092
  const hostname = parsed.hostname;
170949
171093
  if (platform === "win32") {
170950
171094
  if (hostname && hostname !== "localhost") {
170951
- return path34.win32.normalize(`\\\\${hostname}${pathname.replace(/\//g, "\\")}`);
171095
+ return path35.win32.normalize(`\\\\${hostname}${pathname.replace(/\//g, "\\")}`);
170952
171096
  }
170953
171097
  if (/^\/[A-Za-z]:/.test(pathname)) pathname = pathname.slice(1);
170954
- return path34.win32.normalize(pathname.replace(/\//g, "\\"));
171098
+ return path35.win32.normalize(pathname.replace(/\//g, "\\"));
170955
171099
  }
170956
171100
  if (hostname && hostname !== "localhost") {
170957
- return path34.posix.normalize(`//${hostname}${pathname}`);
171101
+ return path35.posix.normalize(`//${hostname}${pathname}`);
170958
171102
  }
170959
- return path34.posix.normalize(pathname);
171103
+ return path35.posix.normalize(pathname);
170960
171104
  }
170961
171105
  var init_mcp_root_path = __esm({
170962
171106
  "src/cli/mcp-root-path.ts"() {
@@ -170970,11 +171114,55 @@ var serve_shared_exports = {};
170970
171114
  __export(serve_shared_exports, {
170971
171115
  resolveServeProject: () => resolveServeProject
170972
171116
  });
170973
- import path35 from "path";
170974
171117
  function resolveServeProject(options, deps) {
170975
171118
  let projectRoot = options.cwdArg || options.envProjectRoot || options.initCwd || options.processCwd;
170976
171119
  const messages = [`[memorix] Starting with cwd: ${projectRoot}`];
171120
+ const hasExplicitRoot = Boolean(options.cwdArg || options.envProjectRoot || options.initCwd);
171121
+ const startsAtHome = isHomeDirectory(projectRoot, options.homeDir);
171122
+ if (startsAtHome) {
171123
+ if (hasExplicitRoot) {
171124
+ messages.push(`[memorix] Refusing explicit $HOME project root: ${projectRoot}`);
171125
+ messages.push("[memorix] Memorix will wait for MCP Roots or an explicit memorix_session_start projectRoot.");
171126
+ return {
171127
+ projectRoot,
171128
+ detectedProject: null,
171129
+ source: "unresolved",
171130
+ messages,
171131
+ error: "Refusing to bind $HOME as a project root. Pass a git project path instead of $HOME."
171132
+ };
171133
+ }
171134
+ const inherited = inheritProjectRootFromHome({
171135
+ homeDir: options.homeDir,
171136
+ envProjectRoot: options.envProjectRoot
171137
+ });
171138
+ if (inherited) {
171139
+ const inheritedProject = deps.detectProject(inherited);
171140
+ if (inheritedProject && !isHomeDirectory(inheritedProject.rootPath, options.homeDir)) {
171141
+ messages.push(`[memorix] Unreliable launch directory detected: ${projectRoot}`);
171142
+ messages.push(`[memorix] Inherited last git project: ${inheritedProject.rootPath}`);
171143
+ return {
171144
+ projectRoot: inheritedProject.rootPath,
171145
+ detectedProject: inheritedProject,
171146
+ source: "last-project-root",
171147
+ messages
171148
+ };
171149
+ }
171150
+ }
171151
+ messages.push(`[memorix] Unreliable launch directory detected: ${projectRoot}`);
171152
+ messages.push("[memorix] Memorix will wait for MCP Roots or an explicit memorix_session_start projectRoot.");
171153
+ messages.push("[memorix] It will not create ~/memorix.db or treat $HOME as a project.");
171154
+ return {
171155
+ projectRoot,
171156
+ detectedProject: null,
171157
+ source: "unresolved",
171158
+ messages,
171159
+ error: "No reliable git project was provided by the launcher."
171160
+ };
171161
+ }
170977
171162
  let detected = deps.detectProject(projectRoot);
171163
+ if (detected && isHomeDirectory(detected.rootPath, options.homeDir)) {
171164
+ detected = null;
171165
+ }
170978
171166
  if (detected) {
170979
171167
  return {
170980
171168
  projectRoot,
@@ -170983,9 +171171,7 @@ function resolveServeProject(options, deps) {
170983
171171
  messages
170984
171172
  };
170985
171173
  }
170986
- const hasExplicitRoot = Boolean(options.cwdArg || options.envProjectRoot || options.initCwd);
170987
- const startsAtHome = path35.resolve(projectRoot) === path35.resolve(options.homeDir);
170988
- if (deps.isSystemDirectory(projectRoot) || !hasExplicitRoot && startsAtHome) {
171174
+ if (deps.isSystemDirectory(projectRoot)) {
170989
171175
  messages.push(`[memorix] Unreliable launch directory detected: ${projectRoot}`);
170990
171176
  messages.push("[memorix] Memorix will wait for MCP Roots or an explicit memorix_session_start projectRoot.");
170991
171177
  messages.push("[memorix] It will not restore a previous project automatically, to prevent cross-project memory access.");
@@ -171025,12 +171211,13 @@ var init_serve_shared = __esm({
171025
171211
  "src/cli/commands/serve-shared.ts"() {
171026
171212
  "use strict";
171027
171213
  init_esm_shims();
171214
+ init_launch_root();
171028
171215
  }
171029
171216
  });
171030
171217
 
171031
171218
  // src/cli/version.ts
171032
171219
  function getCliVersion() {
171033
- return true ? "1.6.2" : pkg.version;
171220
+ return true ? "1.6.3" : pkg.version;
171034
171221
  }
171035
171222
  var init_version3 = __esm({
171036
171223
  "src/cli/version.ts"() {
@@ -171319,6 +171506,10 @@ var init_serve = __esm({
171319
171506
  }
171320
171507
  const detected = resolution.detectedProject;
171321
171508
  const projectRoot = resolution.projectRoot;
171509
+ if (detected) {
171510
+ const { writeLastProjectRoot: writeLastProjectRoot2 } = await Promise.resolve().then(() => (init_launch_root(), launch_root_exports));
171511
+ writeLastProjectRoot2(detected.rootPath);
171512
+ }
171322
171513
  const allowUntracked = args["allow-untracked"] ?? false;
171323
171514
  const toolProfile = resolveToolProfile({ explicit: args.mode, envValue: process.env.MEMORIX_MODE, fallback: "micro" });
171324
171515
  const serverOptions = detected ? { toolProfile, deferProjectRuntimeInit: true } : { allowUntrackedFallback: allowUntracked, deferProjectInitUntilBound: !allowUntracked, deferProjectRuntimeInit: true, toolProfile };