signetai 0.78.2 → 0.78.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dashboard/_app/immutable/assets/0.CU0K3a5Q.css +1 -0
  2. package/dashboard/_app/immutable/assets/AuditTab.DfUZSCcu.css +1 -0
  3. package/dashboard/_app/immutable/assets/CortexTab.DM0MR2Ew.css +1 -0
  4. package/dashboard/_app/immutable/assets/{TaskDetail.YLB6Rg4e.css → CortexTasksPanel.C4153GOT.css} +1 -1
  5. package/dashboard/_app/immutable/assets/TroubleshooterPanel.Bj27xjMc.css +1 -0
  6. package/dashboard/_app/immutable/chunks/{gnFq108l.js → 4OFjJRk5.js} +1 -1
  7. package/dashboard/_app/immutable/chunks/6IlFmGYo.js +1 -0
  8. package/dashboard/_app/immutable/chunks/{BMHg4p9s.js → B-iOxx46.js} +1 -1
  9. package/dashboard/_app/immutable/chunks/{TDeGgAzG.js → B28gXCMO.js} +1 -1
  10. package/dashboard/_app/immutable/chunks/B2uxnyHj.js +26 -0
  11. package/dashboard/_app/immutable/chunks/{C6Ut0qMj.js → B3yLh2lK.js} +1 -1
  12. package/dashboard/_app/immutable/chunks/{BHvXyetp.js → BPMWaFgS.js} +1 -1
  13. package/dashboard/_app/immutable/chunks/BTrKIkw6.js +32 -0
  14. package/dashboard/_app/immutable/chunks/BeX46SAq.js +1 -0
  15. package/dashboard/_app/immutable/chunks/{D7ozeA5b.js → BhwUca23.js} +1 -1
  16. package/dashboard/_app/immutable/chunks/{ycjTzGx9.js → BozKxR4_.js} +1 -1
  17. package/dashboard/_app/immutable/chunks/Bq9EnmJU.js +2 -0
  18. package/dashboard/_app/immutable/chunks/BxUaP0Uk.js +3 -0
  19. package/dashboard/_app/immutable/chunks/{Sbdhs5rk.js → CCwAj_4N.js} +1 -1
  20. package/dashboard/_app/immutable/chunks/{D4fMMG5j.js → CDXig48B.js} +1 -1
  21. package/dashboard/_app/immutable/chunks/CIHz-nmm.js +1 -0
  22. package/dashboard/_app/immutable/chunks/{DMYKaFD3.js → CJHEd6lV.js} +1 -1
  23. package/dashboard/_app/immutable/chunks/CKdPqqEf.js +2 -0
  24. package/dashboard/_app/immutable/chunks/{Bf45f0Vp.js → CkiDow6-.js} +1 -1
  25. package/dashboard/_app/immutable/chunks/CoqoG-Qm.js +5 -0
  26. package/dashboard/_app/immutable/chunks/CozIvyls.js +3 -0
  27. package/dashboard/_app/immutable/chunks/CvqfCNzT.js +15 -0
  28. package/dashboard/_app/immutable/chunks/CzObihAo.js +1 -0
  29. package/dashboard/_app/immutable/chunks/CziGSIXa.js +1 -0
  30. package/dashboard/_app/immutable/chunks/D5LqYj6U.js +1 -0
  31. package/dashboard/_app/immutable/chunks/{BLrn3yUI.js → D8cjqpAz.js} +1 -1
  32. package/dashboard/_app/immutable/chunks/D8vxGWhG.js +64 -0
  33. package/dashboard/_app/immutable/chunks/{DP2Cqb23.js → D9qnsTed.js} +1 -1
  34. package/dashboard/_app/immutable/chunks/{CjrslgAi.js → DOaCXx_K.js} +1 -1
  35. package/dashboard/_app/immutable/chunks/{BjFLqtWT.js → DQBIpD1y.js} +1 -1
  36. package/dashboard/_app/immutable/chunks/{2MfvoDg1.js → DVXNr7Gr.js} +1 -1
  37. package/dashboard/_app/immutable/chunks/{8qq9odk9.js → DYAkyFtd.js} +1 -1
  38. package/dashboard/_app/immutable/chunks/Ddm7yfuh.js +7 -0
  39. package/dashboard/_app/immutable/chunks/Dl17g0t7.js +1 -0
  40. package/dashboard/_app/immutable/chunks/DnbnGNqe.js +1 -0
  41. package/dashboard/_app/immutable/chunks/DsTr_p2O.js +36 -0
  42. package/dashboard/_app/immutable/chunks/{DWi5AdTB.js → DsV6lLvt.js} +2 -2
  43. package/dashboard/_app/immutable/chunks/{CCS36Mqc.js → DwjCaKjO.js} +1 -1
  44. package/dashboard/_app/immutable/chunks/{CYGmkkOT.js → F5DwOJ2g.js} +1 -1
  45. package/dashboard/_app/immutable/chunks/{otBz_bAw.js → K1xwM2X8.js} +1 -1
  46. package/dashboard/_app/immutable/chunks/{BnRD8JUX.js → KdOGaVQj.js} +1 -1
  47. package/dashboard/_app/immutable/chunks/{Dg17Auac.js → VEqOhpAn.js} +1 -1
  48. package/dashboard/_app/immutable/chunks/X7Rjd7lu.js +1 -0
  49. package/dashboard/_app/immutable/chunks/__qUQEel.js +1 -0
  50. package/dashboard/_app/immutable/chunks/{Bfse3fCo.js → anLJSqtR.js} +1 -1
  51. package/dashboard/_app/immutable/chunks/{BX1Yz7rd.js → hA-fm8f1.js} +1 -1
  52. package/dashboard/_app/immutable/chunks/iANPTFiS.js +264 -0
  53. package/dashboard/_app/immutable/chunks/ioDy-juS.js +2 -0
  54. package/dashboard/_app/immutable/chunks/{CH07uMzE.js → pmor88d5.js} +1 -1
  55. package/dashboard/_app/immutable/chunks/{DP3h6pcQ.js → sWUrUOkc.js} +1 -1
  56. package/dashboard/_app/immutable/chunks/sk9ZjQ-A.js +4 -0
  57. package/dashboard/_app/immutable/chunks/w-DiZTv-.js +27 -0
  58. package/dashboard/_app/immutable/entry/app.Ek9gmi4S.js +2 -0
  59. package/dashboard/_app/immutable/entry/start.NDDhLFbg.js +1 -0
  60. package/dashboard/_app/immutable/nodes/{0.jIuPfYNn.js → 0.B0A_vgr9.js} +1 -1
  61. package/dashboard/_app/immutable/nodes/1.BOoVU0k6.js +1 -0
  62. package/dashboard/_app/immutable/nodes/2.BOA53_3P.js +1 -0
  63. package/dashboard/_app/version.json +1 -1
  64. package/dashboard/index.html +7 -7
  65. package/dist/cli.js +147 -25
  66. package/dist/daemon.js +464 -231
  67. package/package.json +1 -1
  68. package/dashboard/_app/immutable/assets/0.CJqciL3X.css +0 -1
  69. package/dashboard/_app/immutable/assets/CortexTab.CbEfH7Fd.css +0 -1
  70. package/dashboard/_app/immutable/assets/CortexTasksPanel.Ds5n7IaC.css +0 -1
  71. package/dashboard/_app/immutable/assets/TasksTab.Bok2ZX0D.css +0 -1
  72. package/dashboard/_app/immutable/assets/TroubleshooterPanel.Dw-L2Im3.css +0 -1
  73. package/dashboard/_app/immutable/chunks/2MRzfVP3.js +0 -1
  74. package/dashboard/_app/immutable/chunks/3MTuhkkM.js +0 -1
  75. package/dashboard/_app/immutable/chunks/7pObTy5Z.js +0 -27
  76. package/dashboard/_app/immutable/chunks/B82MekTh.js +0 -4
  77. package/dashboard/_app/immutable/chunks/BXXcrVDk.js +0 -1
  78. package/dashboard/_app/immutable/chunks/Bh3nIh1p.js +0 -7
  79. package/dashboard/_app/immutable/chunks/Bo0KuYql.js +0 -26
  80. package/dashboard/_app/immutable/chunks/C2EsmaBq.js +0 -32
  81. package/dashboard/_app/immutable/chunks/CAzEUj7-.js +0 -3
  82. package/dashboard/_app/immutable/chunks/CQlsEtmr.js +0 -2
  83. package/dashboard/_app/immutable/chunks/CRs_2u26.js +0 -39
  84. package/dashboard/_app/immutable/chunks/Ca7ofCGO.js +0 -264
  85. package/dashboard/_app/immutable/chunks/CaQOFuOW.js +0 -1
  86. package/dashboard/_app/immutable/chunks/Cfzanl-M.js +0 -1
  87. package/dashboard/_app/immutable/chunks/Cvtb1Uv1.js +0 -5
  88. package/dashboard/_app/immutable/chunks/D2L-5-73.js +0 -61
  89. package/dashboard/_app/immutable/chunks/D4j6_yDm.js +0 -1
  90. package/dashboard/_app/immutable/chunks/D7-Y1GbH.js +0 -1
  91. package/dashboard/_app/immutable/chunks/D7kvLQQv.js +0 -1
  92. package/dashboard/_app/immutable/chunks/D9AMLR_o.js +0 -1
  93. package/dashboard/_app/immutable/chunks/DPqWqYTP.js +0 -15
  94. package/dashboard/_app/immutable/chunks/DW-0HYki.js +0 -3
  95. package/dashboard/_app/immutable/chunks/cLV2Mo98.js +0 -2
  96. package/dashboard/_app/immutable/chunks/pP_VsnEc.js +0 -1
  97. package/dashboard/_app/immutable/chunks/u_Tqmrjo.js +0 -1
  98. package/dashboard/_app/immutable/entry/app.D33Fg_EX.js +0 -2
  99. package/dashboard/_app/immutable/entry/start.CKfFW3OZ.js +0 -1
  100. package/dashboard/_app/immutable/nodes/1.CixhrL0r.js +0 -1
  101. package/dashboard/_app/immutable/nodes/2.BF93CE4w.js +0 -1
package/dist/daemon.js CHANGED
@@ -2575,6 +2575,17 @@ function up48(db) {
2575
2575
  WHERE excluded.latest_at >= memory_thread_heads.latest_at;
2576
2576
  `);
2577
2577
  }
2578
+ function up49(db) {
2579
+ db.exec(`
2580
+ CREATE TABLE IF NOT EXISTS session_extract_cursors (
2581
+ session_key TEXT NOT NULL,
2582
+ agent_id TEXT NOT NULL DEFAULT 'default',
2583
+ last_offset INTEGER NOT NULL DEFAULT 0,
2584
+ last_extract_at TEXT NOT NULL,
2585
+ PRIMARY KEY (session_key, agent_id)
2586
+ );
2587
+ `);
2588
+ }
2578
2589
  function checksum(m) {
2579
2590
  let h = 0;
2580
2591
  const s = `${m.version}:${m.name}`;
@@ -10734,6 +10745,14 @@ ${end.comment}` : end.comment;
10734
10745
  artifacts: {
10735
10746
  tables: ["memory_thread_heads"]
10736
10747
  }
10748
+ },
10749
+ {
10750
+ version: 49,
10751
+ name: "session-extract-cursors",
10752
+ up: up49,
10753
+ artifacts: {
10754
+ tables: ["session_extract_cursors"]
10755
+ }
10737
10756
  }
10738
10757
  ];
10739
10758
  LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
@@ -29039,6 +29058,17 @@ var init_agent_id = __esm(() => {
29039
29058
  init_db_accessor();
29040
29059
  });
29041
29060
 
29061
+ // ../daemon/src/file-sync.ts
29062
+ import { existsSync as existsSync15, readFileSync as readFileSync14, writeFileSync as writeFileSync5 } from "fs";
29063
+ function writeFileIfChanged(path, content) {
29064
+ const existing = existsSync15(path) ? readFileSync14(path, "utf-8") : null;
29065
+ if (existing === content)
29066
+ return false;
29067
+ writeFileSync5(path, content);
29068
+ return true;
29069
+ }
29070
+ var init_file_sync = () => {};
29071
+
29042
29072
  // ../daemon/src/temporal-expand.ts
29043
29073
  function mapNode(row) {
29044
29074
  return {
@@ -29183,9 +29213,7 @@ function projectTag(project) {
29183
29213
  if (!project)
29184
29214
  return null;
29185
29215
  const trimmed = project.trim();
29186
- if (trimmed.length === 0)
29187
- return null;
29188
- return trimmed;
29216
+ return trimmed.length === 0 ? null : trimmed;
29189
29217
  }
29190
29218
  function deriveThreadKey(input) {
29191
29219
  const project = input.project?.trim();
@@ -33966,7 +33994,7 @@ var init_continuity_state = __esm(() => {
33966
33994
 
33967
33995
  // ../daemon/src/memory-head.ts
33968
33996
  import { createHash as createHash2, randomUUID as randomUUID3 } from "crypto";
33969
- import { existsSync as existsSync15, mkdirSync as mkdirSync6, readFileSync as readFileSync14, writeFileSync as writeFileSync5 } from "fs";
33997
+ import { existsSync as existsSync16, mkdirSync as mkdirSync6, readFileSync as readFileSync15, writeFileSync as writeFileSync7 } from "fs";
33970
33998
  import { homedir as homedir11 } from "os";
33971
33999
  import { join as join19 } from "path";
33972
34000
  function hashContent(content) {
@@ -34044,13 +34072,13 @@ function releaseHeadLease(agentId, token) {
34044
34072
  }
34045
34073
  function writeProjection(content) {
34046
34074
  const path = join19(AGENTS_DIR2, "MEMORY.md");
34047
- if (existsSync15(path)) {
34075
+ if (existsSync16(path)) {
34048
34076
  const stamp = new Date().toISOString().replace(/[:.]/g, "-").slice(0, 19);
34049
34077
  const backup = join19(AGENTS_DIR2, "memory", `MEMORY.backup-${stamp}.md`);
34050
34078
  mkdirSync6(join19(AGENTS_DIR2, "memory"), { recursive: true });
34051
- writeFileSync5(backup, readFileSync14(path, "utf-8"));
34079
+ writeFileSync7(backup, readFileSync15(path, "utf-8"));
34052
34080
  }
34053
- writeFileSync5(path, projectMemoryMd(content));
34081
+ writeFileSync7(path, projectMemoryMd(content));
34054
34082
  }
34055
34083
  function writeMemoryHead(content, opts) {
34056
34084
  const trimmed = content.trim();
@@ -34113,7 +34141,7 @@ __export(exports_predictor_state, {
34113
34141
  getAlphaFloor: () => getAlphaFloor,
34114
34142
  computeEffectiveAlpha: () => computeEffectiveAlpha
34115
34143
  });
34116
- import { existsSync as existsSync16, mkdirSync as mkdirSync7, readFileSync as readFileSync15, writeFileSync as writeFileSync7 } from "fs";
34144
+ import { existsSync as existsSync17, mkdirSync as mkdirSync7, readFileSync as readFileSync16, writeFileSync as writeFileSync8 } from "fs";
34117
34145
  import { homedir as homedir12 } from "os";
34118
34146
  import { dirname as dirname8, join as join20 } from "path";
34119
34147
  function statePath(agentId) {
@@ -34138,10 +34166,10 @@ function parseState(raw2) {
34138
34166
  }
34139
34167
  function getPredictorState(agentId) {
34140
34168
  const path = statePath(agentId);
34141
- if (!existsSync16(path))
34169
+ if (!existsSync17(path))
34142
34170
  return { ...DEFAULT_STATE };
34143
34171
  try {
34144
- const content = readFileSync15(path, "utf-8");
34172
+ const content = readFileSync16(path, "utf-8");
34145
34173
  return parseState(JSON.parse(content));
34146
34174
  } catch {
34147
34175
  logger.warn("predictor", "Failed to read predictor state, using defaults");
@@ -34161,10 +34189,10 @@ function updatePredictorState(agentId, update) {
34161
34189
  const path = statePath(agentId);
34162
34190
  try {
34163
34191
  const dir = dirname8(path);
34164
- if (!existsSync16(dir)) {
34192
+ if (!existsSync17(dir)) {
34165
34193
  mkdirSync7(dir, { recursive: true });
34166
34194
  }
34167
- writeFileSync7(path, JSON.stringify(next, null, 2), "utf-8");
34195
+ writeFileSync8(path, JSON.stringify(next, null, 2), "utf-8");
34168
34196
  } catch (err) {
34169
34197
  logger.warn("predictor", "Failed to write predictor state", {
34170
34198
  error: err instanceof Error ? err.message : String(err)
@@ -35010,7 +35038,7 @@ var init_session_checkpoints = __esm(() => {
35010
35038
  });
35011
35039
 
35012
35040
  // ../daemon/src/session-memories.ts
35013
- import { existsSync as existsSync17 } from "fs";
35041
+ import { existsSync as existsSync18 } from "fs";
35014
35042
  import { homedir as homedir13 } from "os";
35015
35043
  import { join as join21 } from "path";
35016
35044
  function getMemoryDbPath() {
@@ -35018,7 +35046,7 @@ function getMemoryDbPath() {
35018
35046
  return join21(agentsDir, "memory", "memories.db");
35019
35047
  }
35020
35048
  function recordSessionCandidates(sessionKey, candidates, injectedIds, agentId = "default") {
35021
- if (!sessionKey || candidates.length === 0 || !existsSync17(getMemoryDbPath()))
35049
+ if (!sessionKey || candidates.length === 0 || !existsSync18(getMemoryDbPath()))
35022
35050
  return;
35023
35051
  try {
35024
35052
  getDbAccessor().withWriteTx((db) => {
@@ -35058,7 +35086,7 @@ function recordSessionCandidates(sessionKey, candidates, injectedIds, agentId =
35058
35086
  }
35059
35087
  }
35060
35088
  function trackFtsHits(sessionKey, matchedIds, agentId = "default") {
35061
- if (!sessionKey || matchedIds.length === 0 || !existsSync17(getMemoryDbPath()))
35089
+ if (!sessionKey || matchedIds.length === 0 || !existsSync18(getMemoryDbPath()))
35062
35090
  return;
35063
35091
  try {
35064
35092
  getDbAccessor().withWriteTx((db) => {
@@ -35120,7 +35148,7 @@ function recordAgentFeedbackInner(db, sessionKey, feedback, agentId = "default")
35120
35148
  }
35121
35149
  }
35122
35150
  function recordAgentFeedback(sessionKey, feedback, agentId = "default") {
35123
- if (!sessionKey || Object.keys(feedback).length === 0 || !existsSync17(getMemoryDbPath()))
35151
+ if (!sessionKey || Object.keys(feedback).length === 0 || !existsSync18(getMemoryDbPath()))
35124
35152
  return;
35125
35153
  try {
35126
35154
  getDbAccessor().withWriteTx((db) => {
@@ -35413,6 +35441,18 @@ function upsertSessionTranscript(sessionKey, transcript, harness, project, agent
35413
35441
  });
35414
35442
  }
35415
35443
  }
35444
+ function getSessionTranscriptContent(sessionKey, agentId) {
35445
+ if (!tableExists3("session_transcripts"))
35446
+ return;
35447
+ try {
35448
+ return getDbAccessor().withReadDb((db) => {
35449
+ const row = db.prepare("SELECT content FROM session_transcripts WHERE session_key = ? AND agent_id = ?").get(sessionKey, agentId);
35450
+ return row?.content;
35451
+ });
35452
+ } catch {
35453
+ return;
35454
+ }
35455
+ }
35416
35456
  function searchTranscriptFallback(params) {
35417
35457
  const limit = Math.max(1, Math.min(8, Math.trunc(params.limit)));
35418
35458
  if (!tableExists3("session_transcripts"))
@@ -35801,7 +35841,7 @@ function isMajorUpgrade(current, candidate) {
35801
35841
 
35802
35842
  // ../daemon/src/update-system.ts
35803
35843
  import { spawn as spawn2 } from "child_process";
35804
- import { existsSync as existsSync18, readFileSync as readFileSync16, writeFileSync as writeFileSync8 } from "fs";
35844
+ import { existsSync as existsSync19, readFileSync as readFileSync17, writeFileSync as writeFileSync9 } from "fs";
35805
35845
  import { join as join23 } from "path";
35806
35846
  function initUpdateSystem(version, dir, onRestartNeeded) {
35807
35847
  currentVersion2 = version;
@@ -35924,10 +35964,10 @@ function loadUpdateConfig() {
35924
35964
  join23(agentsDir, "AGENT.yaml")
35925
35965
  ];
35926
35966
  for (const p2 of paths) {
35927
- if (!existsSync18(p2))
35967
+ if (!existsSync19(p2))
35928
35968
  continue;
35929
35969
  try {
35930
- const yaml = parseSimpleYaml(readFileSync16(p2, "utf-8"));
35970
+ const yaml = parseSimpleYaml(readFileSync17(p2, "utf-8"));
35931
35971
  const updates = yaml.updates || yaml.update;
35932
35972
  if (updates) {
35933
35973
  const autoInstallRaw = updates.autoInstall ?? updates.auto_install;
@@ -35967,10 +36007,10 @@ function persistUpdateConfig(config) {
35967
36007
  join23(agentsDir, "AGENT.yaml")
35968
36008
  ];
35969
36009
  for (const p2 of paths) {
35970
- if (!existsSync18(p2))
36010
+ if (!existsSync19(p2))
35971
36011
  continue;
35972
36012
  try {
35973
- const current = readFileSync16(p2, "utf-8");
36013
+ const current = readFileSync17(p2, "utf-8");
35974
36014
  const updatesSection = formatUpdatesSection(config);
35975
36015
  const updatesPattern = /^updates:\n(?:[ \t].*(?:\n|$))*/m;
35976
36016
  const trimmedCurrent = current.trimEnd();
@@ -35978,7 +36018,7 @@ function persistUpdateConfig(config) {
35978
36018
 
35979
36019
  ${updatesSection}` : updatesSection;
35980
36020
  if (updated !== current) {
35981
- writeFileSync8(p2, updated);
36021
+ writeFileSync9(p2, updated);
35982
36022
  }
35983
36023
  return true;
35984
36024
  } catch (e) {
@@ -36099,8 +36139,8 @@ function parseInstalledPackageVersion(packageJsonContent) {
36099
36139
  }
36100
36140
  function verifyInstalledVersion(family, packageName, expectedVersion, deps = {
36101
36141
  resolveGlobalPackagePath: (family2, packageName2) => resolveGlobalPackagePath(family2, packageName2),
36102
- existsSync: (path) => existsSync18(path),
36103
- readFileSync: (path, encoding) => readFileSync16(path, { encoding })
36142
+ existsSync: (path) => existsSync19(path),
36143
+ readFileSync: (path, encoding) => readFileSync17(path, { encoding })
36104
36144
  }) {
36105
36145
  try {
36106
36146
  const packagePath = deps.resolveGlobalPackagePath(family, packageName);
@@ -36348,7 +36388,7 @@ var init_update_system = __esm(() => {
36348
36388
  });
36349
36389
 
36350
36390
  // ../daemon/src/hooks.ts
36351
- import { existsSync as existsSync19, readFileSync as readFileSync17, realpathSync as realpathSync2 } from "fs";
36391
+ import { existsSync as existsSync20, readFileSync as readFileSync18, realpathSync as realpathSync2 } from "fs";
36352
36392
  import { homedir as homedir14 } from "os";
36353
36393
  import { join as join25 } from "path";
36354
36394
  function resetPromptDedup(sessionKey) {
@@ -36423,6 +36463,8 @@ function temporalBaseScore(kind, sourceType) {
36423
36463
  return 0.95;
36424
36464
  if (sourceType === "summary")
36425
36465
  return 0.9;
36466
+ if (sourceType === "checkpoint")
36467
+ return 0.85;
36426
36468
  if (sourceType === "chunk")
36427
36469
  return 0.55;
36428
36470
  if (kind === "arc")
@@ -36446,7 +36488,9 @@ function buildSynthesisIndexBlock(nodes) {
36446
36488
  const session = node.sessionKey ?? "none";
36447
36489
  const ref = node.sourceRef ?? "none";
36448
36490
  const project = node.project ?? "none";
36449
- return `- id=${node.id} kind=${node.kind} source=${source} depth=${node.depth} session=${session} project=${project} ref=${ref} latest=${node.latestAt}`;
36491
+ const preview = trimContent(node.content, 120);
36492
+ return `- id=${node.id} kind=${node.kind} source=${source} depth=${node.depth} session=${session} project=${project} ref=${ref} latest=${node.latestAt}
36493
+ summary: ${preview}`;
36450
36494
  });
36451
36495
  return `## Temporal Index
36452
36496
 
@@ -36490,7 +36534,7 @@ function collectThreadHeads(nodes, limit) {
36490
36534
  return selected;
36491
36535
  }
36492
36536
  function readPersistedThreadHeads(agentId, limit) {
36493
- if (!existsSync19(MEMORY_DB))
36537
+ if (!existsSync20(MEMORY_DB))
36494
36538
  return [];
36495
36539
  try {
36496
36540
  return getDbAccessor().withReadDb((db) => {
@@ -36547,7 +36591,7 @@ function collectSynthesisMaterial(charBudget, agentId) {
36547
36591
  const nodeBudget = Math.max(1200, Math.floor(charBudget * 0.45));
36548
36592
  const scope = getAgentScope(agentId);
36549
36593
  const memories = selectWithBudget(getAllScoredCandidates(undefined, 120, agentId, scope.readPolicy, scope.policyGroup), memoryBudget);
36550
- if (!existsSync19(MEMORY_DB)) {
36594
+ if (!existsSync20(MEMORY_DB)) {
36551
36595
  return {
36552
36596
  nodes: [],
36553
36597
  memories,
@@ -36664,7 +36708,7 @@ function selectWithBudget(rows, charBudget) {
36664
36708
  return selected;
36665
36709
  }
36666
36710
  function getSessionGapSummary() {
36667
- if (!existsSync19(MEMORY_DB))
36711
+ if (!existsSync20(MEMORY_DB))
36668
36712
  return;
36669
36713
  try {
36670
36714
  return getDbAccessor().withReadDb((db) => {
@@ -36717,10 +36761,10 @@ function isDuplicate(db, content) {
36717
36761
  }
36718
36762
  function readIdentityFile(fileName, charBudget) {
36719
36763
  const filePath = join25(AGENTS_DIR3, fileName);
36720
- if (!existsSync19(filePath))
36764
+ if (!existsSync20(filePath))
36721
36765
  return;
36722
36766
  try {
36723
- const content = readFileSync17(filePath, "utf-8").trim();
36767
+ const content = readFileSync18(filePath, "utf-8").trim();
36724
36768
  if (!content)
36725
36769
  return;
36726
36770
  if (content.length <= charBudget)
@@ -36736,10 +36780,10 @@ function readMemoryMd(charBudget) {
36736
36780
  }
36737
36781
  function readAgentsMd(charBudget) {
36738
36782
  const agentsMd = join25(AGENTS_DIR3, "AGENTS.md");
36739
- if (!existsSync19(agentsMd))
36783
+ if (!existsSync20(agentsMd))
36740
36784
  return;
36741
36785
  try {
36742
- const content = readFileSync17(agentsMd, "utf-8").trim();
36786
+ const content = readFileSync18(agentsMd, "utf-8").trim();
36743
36787
  if (!content)
36744
36788
  return;
36745
36789
  if (content.length <= charBudget)
@@ -36756,7 +36800,7 @@ function clampScore01(value) {
36756
36800
  return Math.max(0, Math.min(1, value));
36757
36801
  }
36758
36802
  function fetchTraversalCandidates(memoryIds, agentId) {
36759
- if (memoryIds.length === 0 || !existsSync19(MEMORY_DB))
36803
+ if (memoryIds.length === 0 || !existsSync20(MEMORY_DB))
36760
36804
  return [];
36761
36805
  try {
36762
36806
  const placeholders = memoryIds.map(() => "?").join(", ");
@@ -36827,7 +36871,7 @@ Constraints for entities in scope. These always apply.
36827
36871
  return compressedSection;
36828
36872
  }
36829
36873
  function getAllScoredCandidates(project, limit, agentId = "default", readPolicy = "isolated", policyGroup = null) {
36830
- if (!existsSync19(MEMORY_DB))
36874
+ if (!existsSync20(MEMORY_DB))
36831
36875
  return [];
36832
36876
  try {
36833
36877
  const scope = buildAgentScopeClause(agentId, readPolicy, policyGroup);
@@ -36856,7 +36900,7 @@ function getAllScoredCandidates(project, limit, agentId = "default", readPolicy
36856
36900
  }
36857
36901
  }
36858
36902
  function getPredictedContextMemories(project, limit, charBudget, excludeIds, agentId, readPolicy = "isolated", policyGroup = null) {
36859
- if (!existsSync19(MEMORY_DB))
36903
+ if (!existsSync20(MEMORY_DB))
36860
36904
  return [];
36861
36905
  try {
36862
36906
  const summaryRows = getDbAccessor().withReadDb((db) => {
@@ -36922,7 +36966,7 @@ function getPredictedContextMemories(project, limit, charBudget, excludeIds, age
36922
36966
  }
36923
36967
  }
36924
36968
  function updateAccessTracking(ids) {
36925
- if (ids.length === 0 || !existsSync19(MEMORY_DB))
36969
+ if (ids.length === 0 || !existsSync20(MEMORY_DB))
36926
36970
  return;
36927
36971
  try {
36928
36972
  getDbAccessor().withWriteTx((db) => {
@@ -36939,11 +36983,11 @@ function updateAccessTracking(ids) {
36939
36983
  }
36940
36984
  function loadHooksConfig() {
36941
36985
  const configPath = join25(AGENTS_DIR3, "agent.yaml");
36942
- if (!existsSync19(configPath)) {
36986
+ if (!existsSync20(configPath)) {
36943
36987
  return getDefaultConfig();
36944
36988
  }
36945
36989
  try {
36946
- const content = readFileSync17(configPath, "utf-8");
36990
+ const content = readFileSync18(configPath, "utf-8");
36947
36991
  const parsed = parseSimpleYaml(content);
36948
36992
  const hooks = parsed.hooks;
36949
36993
  if (!hooks || typeof hooks !== "object") {
@@ -36999,9 +37043,9 @@ function isAgentConfig(value) {
36999
37043
  }
37000
37044
  function loadIdentity() {
37001
37045
  const agentYaml = join25(AGENTS_DIR3, "agent.yaml");
37002
- if (existsSync19(agentYaml)) {
37046
+ if (existsSync20(agentYaml)) {
37003
37047
  try {
37004
- const content = readFileSync17(agentYaml, "utf-8");
37048
+ const content = readFileSync18(agentYaml, "utf-8");
37005
37049
  const config = parseSimpleYaml(content);
37006
37050
  const agent = config.agent;
37007
37051
  if (isAgentConfig(agent) && agent.name) {
@@ -37013,9 +37057,9 @@ function loadIdentity() {
37013
37057
  } catch {}
37014
37058
  }
37015
37059
  const identityMd = join25(AGENTS_DIR3, "IDENTITY.md");
37016
- if (existsSync19(identityMd)) {
37060
+ if (existsSync20(identityMd)) {
37017
37061
  try {
37018
- const content = readFileSync17(identityMd, "utf-8");
37062
+ const content = readFileSync18(identityMd, "utf-8");
37019
37063
  const nameMatch = content.match(/name:\s*(.+)/i);
37020
37064
  const descMatch = content.match(/creature:\s*(.+)/i) || content.match(/role:\s*(.+)/i);
37021
37065
  return {
@@ -37027,7 +37071,7 @@ function loadIdentity() {
37027
37071
  return { name: "Agent" };
37028
37072
  }
37029
37073
  function getRecentMemories(limit, recencyBias = 0.7) {
37030
- if (!existsSync19(MEMORY_DB))
37074
+ if (!existsSync20(MEMORY_DB))
37031
37075
  return [];
37032
37076
  try {
37033
37077
  const rows = getDbAccessor().withReadDb((db) => {
@@ -37789,9 +37833,9 @@ async function handleUserPromptSubmit(req) {
37789
37833
  }
37790
37834
  if (req.sessionKey) {
37791
37835
  let transcript = "";
37792
- if (req.transcriptPath && existsSync19(req.transcriptPath)) {
37836
+ if (req.transcriptPath && existsSync20(req.transcriptPath)) {
37793
37837
  try {
37794
- const raw2 = readFileSync17(req.transcriptPath, "utf-8");
37838
+ const raw2 = readFileSync18(req.transcriptPath, "utf-8");
37795
37839
  transcript = normalizeSessionTranscript(req.harness, raw2);
37796
37840
  } catch {
37797
37841
  logger.warn("hooks", "Could not read prompt transcript", {
@@ -37829,7 +37873,7 @@ ${now4} (${tz})
37829
37873
  warnings
37830
37874
  }, "disabled");
37831
37875
  }
37832
- if (keywordTerms.length < 1 || vectorQuery.length === 0 || !existsSync19(MEMORY_DB)) {
37876
+ if (keywordTerms.length < 1 || vectorQuery.length === 0 || !existsSync20(MEMORY_DB)) {
37833
37877
  return finalizeUserPromptSubmitSuccess(req, userMessage, start, {
37834
37878
  inject: metadataHeader,
37835
37879
  memoryCount: 0,
@@ -38004,9 +38048,9 @@ function handleSessionEnd(req) {
38004
38048
  return { memoriesSaved: 0 };
38005
38049
  }
38006
38050
  let transcript = "";
38007
- if (req.transcriptPath && existsSync19(req.transcriptPath)) {
38051
+ if (req.transcriptPath && existsSync20(req.transcriptPath)) {
38008
38052
  try {
38009
- const rawTranscript = readFileSync17(req.transcriptPath, "utf-8");
38053
+ const rawTranscript = readFileSync18(req.transcriptPath, "utf-8");
38010
38054
  transcript = normalizeSessionTranscript(req.harness, rawTranscript);
38011
38055
  } catch {
38012
38056
  logger.warn("hooks", "Could not read transcript", {
@@ -38100,6 +38144,136 @@ function handleSessionEnd(req) {
38100
38144
  });
38101
38145
  return { memoriesSaved: 0, queued: true, jobId };
38102
38146
  }
38147
+ function readExtractCursor(sessionKey, agentId) {
38148
+ try {
38149
+ return getDbAccessor().withReadDb((db) => {
38150
+ const row = db.prepare("SELECT last_offset FROM session_extract_cursors WHERE session_key = ? AND agent_id = ?").get(sessionKey, agentId);
38151
+ return row?.last_offset ?? 0;
38152
+ });
38153
+ } catch {
38154
+ return 0;
38155
+ }
38156
+ }
38157
+ function advanceExtractCursor(sessionKey, agentId, offset) {
38158
+ const now4 = new Date().toISOString();
38159
+ try {
38160
+ getDbAccessor().withWriteTx((db) => {
38161
+ db.prepare(`INSERT INTO session_extract_cursors (session_key, agent_id, last_offset, last_extract_at)
38162
+ VALUES (?, ?, ?, ?)
38163
+ ON CONFLICT(session_key, agent_id) DO UPDATE SET
38164
+ last_offset = excluded.last_offset,
38165
+ last_extract_at = excluded.last_extract_at`).run(sessionKey, agentId, offset, now4);
38166
+ });
38167
+ } catch (e) {
38168
+ logger.warn("hooks", "advanceExtractCursor failed (non-fatal)", {
38169
+ error: e instanceof Error ? e.message : String(e)
38170
+ });
38171
+ }
38172
+ }
38173
+ function handleCheckpointExtract(req) {
38174
+ const agentId = resolveAgentId({ agentId: req.agentId, sessionKey: req.sessionKey });
38175
+ const memoryCfg = loadMemoryConfig(AGENTS_DIR3);
38176
+ if (!memoryCfg.pipelineV2.enabled && !memoryCfg.pipelineV2.shadowMode) {
38177
+ logger.info("hooks", "Checkpoint extract skipped \u2014 pipeline disabled");
38178
+ return { skipped: true };
38179
+ }
38180
+ let transcript = "";
38181
+ let fromStore = false;
38182
+ if (req.transcript) {
38183
+ transcript = normalizeSessionTranscript(req.harness, req.transcript);
38184
+ } else if (req.transcriptPath && existsSync20(req.transcriptPath)) {
38185
+ try {
38186
+ const raw2 = readFileSync18(req.transcriptPath, "utf-8");
38187
+ transcript = normalizeSessionTranscript(req.harness, raw2);
38188
+ } catch {
38189
+ logger.warn("hooks", "Could not read checkpoint transcript", {
38190
+ path: req.transcriptPath
38191
+ });
38192
+ }
38193
+ }
38194
+ if (!transcript) {
38195
+ transcript = getSessionTranscriptContent(req.sessionKey, agentId) ?? "";
38196
+ fromStore = true;
38197
+ }
38198
+ if (!transcript) {
38199
+ logger.info("hooks", "Checkpoint extract skipped \u2014 no transcript available", {
38200
+ sessionKey: req.sessionKey
38201
+ });
38202
+ return { skipped: true };
38203
+ }
38204
+ if (!fromStore) {
38205
+ const prev = getSessionTranscriptContent(req.sessionKey, agentId);
38206
+ if (!prev || transcript.length >= prev.length) {
38207
+ try {
38208
+ upsertSessionTranscript(req.sessionKey, transcript, req.harness, req.project ?? null, agentId);
38209
+ } catch (e) {
38210
+ logger.warn("hooks", "Checkpoint transcript upsert failed (non-fatal)", {
38211
+ error: e instanceof Error ? e.message : String(e)
38212
+ });
38213
+ }
38214
+ }
38215
+ }
38216
+ const cursor = readExtractCursor(req.sessionKey, agentId);
38217
+ const transcriptBuf = Buffer.from(transcript, "utf8");
38218
+ const deltaBuf = transcriptBuf.subarray(cursor);
38219
+ if (deltaBuf.byteLength < 500) {
38220
+ logger.info("hooks", "Checkpoint extract skipped \u2014 delta too small", {
38221
+ sessionKey: req.sessionKey,
38222
+ deltaBytes: deltaBuf.byteLength,
38223
+ cursor
38224
+ });
38225
+ return { skipped: true };
38226
+ }
38227
+ const delta = deltaBuf.toString("utf8");
38228
+ const MAX_DELTA_CHARS = 1e5;
38229
+ const capped = delta.length > MAX_DELTA_CHARS ? `${delta.slice(0, MAX_DELTA_CHARS)}
38230
+ [truncated]` : delta;
38231
+ try {
38232
+ const snap = consumeState(req.sessionKey);
38233
+ if (snap && snap.totalPromptCount > 0) {
38234
+ const cfg2 = loadMemoryConfig(AGENTS_DIR3).pipelineV2.continuity;
38235
+ writeCheckpoint(getDbAccessor(), {
38236
+ sessionKey: snap.sessionKey,
38237
+ harness: snap.harness,
38238
+ project: snap.project,
38239
+ projectNormalized: snap.projectNormalized,
38240
+ trigger: "mid_session_extract",
38241
+ digest: formatPeriodicDigest(snap),
38242
+ promptCount: snap.totalPromptCount,
38243
+ memoryQueries: snap.pendingQueries,
38244
+ recentRemembers: snap.pendingRemembers,
38245
+ focalEntityIds: snap.structuralSnapshot?.focalEntityIds,
38246
+ focalEntityNames: snap.structuralSnapshot?.focalEntityNames,
38247
+ activeAspectIds: snap.structuralSnapshot?.activeAspectIds,
38248
+ surfacedConstraintCount: snap.structuralSnapshot?.surfacedConstraintCount,
38249
+ traversalMemoryCount: snap.structuralSnapshot?.traversalMemoryCount
38250
+ }, cfg2.maxCheckpointsPerSession);
38251
+ }
38252
+ } catch (err) {
38253
+ logger.warn("hooks", "Checkpoint extract checkpoint write failed", {
38254
+ error: err instanceof Error ? err.message : String(err)
38255
+ });
38256
+ }
38257
+ try {
38258
+ initContinuity(req.sessionKey, req.harness, req.project);
38259
+ } catch {}
38260
+ const jobId = enqueueSummaryJob(getDbAccessor(), {
38261
+ harness: req.harness,
38262
+ transcript: capped,
38263
+ sessionKey: req.sessionKey,
38264
+ project: req.project,
38265
+ agentId
38266
+ });
38267
+ advanceExtractCursor(req.sessionKey, agentId, Buffer.byteLength(transcript, "utf8"));
38268
+ logger.info("hooks", "Checkpoint extract queued", {
38269
+ jobId,
38270
+ sessionKey: req.sessionKey,
38271
+ deltaChars: capped.length,
38272
+ cursor,
38273
+ newCursor: Buffer.byteLength(transcript, "utf8")
38274
+ });
38275
+ return { queued: true, jobId };
38276
+ }
38103
38277
  function normalizeSessionTranscript(harness, raw2) {
38104
38278
  if (harness.trim().toLowerCase() === "codex") {
38105
38279
  return normalizeCodexTranscript(raw2);
@@ -38326,8 +38500,8 @@ Use these top-level headings exactly:
38326
38500
  ## Tier 3 rules
38327
38501
 
38328
38502
  - After the human-readable summary, append the exact Temporal Index block provided below
38329
- - Do not rewrite the Temporal Index block
38330
- - Do not invent node IDs, sessions, or lineage
38503
+ - Do not rewrite the Temporal Index block; each entry has a metadata line and a summary line
38504
+ - Do not invent node IDs, sessions, summaries, or lineage
38331
38505
 
38332
38506
  ## Decay-ranked memories
38333
38507
 
@@ -38528,7 +38702,7 @@ function trimTrailingSlash(url) {
38528
38702
 
38529
38703
  // ../daemon/src/pipeline/provider.ts
38530
38704
  import { spawn as nodeSpawn } from "child_process";
38531
- import { existsSync as existsSync20 } from "fs";
38705
+ import { existsSync as existsSync21 } from "fs";
38532
38706
  import { homedir as homedir15 } from "os";
38533
38707
  import { Readable as Readable4 } from "stream";
38534
38708
 
@@ -39385,7 +39559,7 @@ function resolveOpenCodeBin() {
39385
39559
  if (found)
39386
39560
  return found;
39387
39561
  const fallback = `${homedir15()}/.opencode/bin/opencode`;
39388
- if (existsSync20(fallback))
39562
+ if (existsSync21(fallback))
39389
39563
  return fallback;
39390
39564
  return null;
39391
39565
  }
@@ -40466,7 +40640,7 @@ var init_predictor_comparison = __esm(() => {
40466
40640
  });
40467
40641
 
40468
40642
  // ../daemon/src/pipeline/summary-worker.ts
40469
- import { existsSync as existsSync21, mkdirSync as mkdirSync8, writeFileSync as writeFileSync9 } from "fs";
40643
+ import { existsSync as existsSync22, mkdirSync as mkdirSync8, writeFileSync as writeFileSync10 } from "fs";
40470
40644
  import { homedir as homedir16 } from "os";
40471
40645
  import { join as join26 } from "path";
40472
40646
  function buildPrompt3(transcript, date) {
@@ -40607,11 +40781,11 @@ function deriveSlug(summary, project) {
40607
40781
  }
40608
40782
  function uniqueFilename(dir, base, ext) {
40609
40783
  const first = join26(dir, `${base}${ext}`);
40610
- if (!existsSync21(first))
40784
+ if (!existsSync22(first))
40611
40785
  return first;
40612
40786
  for (let i3 = 2;i3 <= 20; i3++) {
40613
40787
  const path = join26(dir, `${base}-${i3}${ext}`);
40614
- if (!existsSync21(path))
40788
+ if (!existsSync22(path))
40615
40789
  return path;
40616
40790
  }
40617
40791
  return join26(dir, `${base}-${Date.now()}${ext}`);
@@ -40668,7 +40842,7 @@ async function processJob(accessor2, provider2, job, memoryCfg) {
40668
40842
  mkdirSync8(MEMORY_DIR, { recursive: true });
40669
40843
  const slug = deriveSlug(result.summary, job.project);
40670
40844
  const filename = uniqueFilename(MEMORY_DIR, `${today}-${slug}`, ".md");
40671
- writeFileSync9(filename, result.summary, "utf-8");
40845
+ writeFileSync10(filename, result.summary, "utf-8");
40672
40846
  logger.info("summary-worker", "Wrote session summary", {
40673
40847
  path: filename,
40674
40848
  sessionKey: job.session_key,
@@ -41391,7 +41565,7 @@ var init_synthesis_llm = __esm(() => {
41391
41565
  });
41392
41566
 
41393
41567
  // ../daemon/src/pipeline/synthesis-worker.ts
41394
- import { existsSync as existsSync22, mkdirSync as mkdirSync9, readFileSync as readFileSync18, writeFileSync as writeFileSync10 } from "fs";
41568
+ import { existsSync as existsSync23, mkdirSync as mkdirSync9, readFileSync as readFileSync19, writeFileSync as writeFileSync11 } from "fs";
41395
41569
  import { homedir as homedir17 } from "os";
41396
41570
  import { join as join27 } from "path";
41397
41571
  function getAgentsDir() {
@@ -41409,9 +41583,9 @@ function getLastSynthesisPath(agentId) {
41409
41583
  function readLastSynthesisTime(agentId) {
41410
41584
  try {
41411
41585
  const path = getLastSynthesisPath(agentId);
41412
- if (!existsSync22(path))
41586
+ if (!existsSync23(path))
41413
41587
  return 0;
41414
- const data = JSON.parse(readFileSync18(path, "utf-8"));
41588
+ const data = JSON.parse(readFileSync19(path, "utf-8"));
41415
41589
  return typeof data.lastRunAt === "number" ? data.lastRunAt : 0;
41416
41590
  } catch {
41417
41591
  return 0;
@@ -41421,7 +41595,7 @@ function writeLastSynthesisTime(timestamp, agentId) {
41421
41595
  try {
41422
41596
  const path = getLastSynthesisPath(agentId);
41423
41597
  mkdirSync9(join27(getAgentsDir(), ".daemon"), { recursive: true });
41424
- writeFileSync10(path, JSON.stringify({ lastRunAt: timestamp }));
41598
+ writeFileSync11(path, JSON.stringify({ lastRunAt: timestamp }));
41425
41599
  } catch (e) {
41426
41600
  logger.warn("synthesis", "Failed to persist synthesis timestamp", {
41427
41601
  error: e instanceof Error ? e.message : String(e)
@@ -55392,7 +55566,7 @@ var init_cron = __esm(() => {
55392
55566
  });
55393
55567
 
55394
55568
  // ../daemon/src/scheduler/skill-resolver.ts
55395
- import { readFileSync as readFileSync19 } from "fs";
55569
+ import { readFileSync as readFileSync20 } from "fs";
55396
55570
  import { homedir as homedir19 } from "os";
55397
55571
  import { join as join29 } from "path";
55398
55572
  function stripFrontmatter(content) {
@@ -55412,7 +55586,7 @@ function resolveSkillPrompt(basePrompt, skillName, skillMode) {
55412
55586
  }
55413
55587
  const skillPath = join29(AGENTS_DIR5, "skills", skillName, "SKILL.md");
55414
55588
  try {
55415
- const raw2 = readFileSync19(skillPath, "utf-8");
55589
+ const raw2 = readFileSync20(skillPath, "utf-8");
55416
55590
  const content = stripFrontmatter(raw2);
55417
55591
  return `${content}
55418
55592
 
@@ -64152,20 +64326,32 @@ var init_umap_projection = __esm(() => {
64152
64326
  });
64153
64327
 
64154
64328
  // ../daemon/src/watcher-ignore.ts
64155
- import { isAbsolute as isAbsolute3, join as join31, normalize as normalize3, resolve as resolve5 } from "path";
64329
+ import { isAbsolute as isAbsolute3, join as join31, normalize as normalize3, relative as relative3, resolve as resolve5 } from "path";
64156
64330
  function normalizePath4(path) {
64157
64331
  return normalize3(path);
64158
64332
  }
64159
64333
  function resolveForComparison(path) {
64160
64334
  return normalizePath4(isAbsolute3(path) ? path : resolve5(path));
64161
64335
  }
64336
+ function relativePathWithin(root, target) {
64337
+ const rel = normalizePath4(relative3(root, target));
64338
+ if (rel === "" || rel === ".")
64339
+ return "";
64340
+ if (rel.startsWith("..") || isAbsolute3(rel))
64341
+ return null;
64342
+ return rel;
64343
+ }
64162
64344
  function createAgentsWatcherIgnoreMatcher(agentsDir2) {
64163
64345
  const defaultPredictorCheckpoint = normalizePath4(join31(agentsDir2, "memory", "predictor", "model.bin"));
64164
64346
  const configuredPredictorCheckpoint = resolveForComparison(resolvePredictorCheckpointPath(loadMemoryConfig(agentsDir2).pipelineV2.predictor));
64347
+ const agentRoot = resolveForComparison(join31(agentsDir2, "agents"));
64165
64348
  const ignoredPaths = new Set([defaultPredictorCheckpoint, configuredPredictorCheckpoint]);
64166
64349
  return (path) => {
64167
64350
  const normalizedPath = resolveForComparison(path);
64168
- return ignoredPaths.has(normalizedPath) || normalizedPath.endsWith(".db-wal") || normalizedPath.endsWith(".db-shm") || normalizedPath.endsWith(".db-journal");
64351
+ const relativeToAgentsRoot = relativePathWithin(agentRoot, normalizedPath);
64352
+ const agentSegments = relativeToAgentsRoot === null ? [] : relativeToAgentsRoot.split(/[\\/]+/).filter(Boolean);
64353
+ const isGeneratedWorkspacePath = agentSegments.length === 3 && agentSegments[1] === "workspace" && agentSegments[2] === "AGENTS.md";
64354
+ return isGeneratedWorkspacePath || ignoredPaths.has(normalizedPath) || normalizedPath.endsWith(".db-wal") || normalizedPath.endsWith(".db-shm") || normalizedPath.endsWith(".db-journal");
64169
64355
  };
64170
64356
  }
64171
64357
  var init_watcher_ignore = __esm(() => {
@@ -88449,16 +88635,16 @@ var require_validate = __commonJS((exports) => {
88449
88635
  const matches = RELATIVE_JSON_POINTER.exec($data);
88450
88636
  if (!matches)
88451
88637
  throw new Error(`Invalid JSON-pointer: ${$data}`);
88452
- const up49 = +matches[1];
88638
+ const up50 = +matches[1];
88453
88639
  jsonPointer = matches[2];
88454
88640
  if (jsonPointer === "#") {
88455
- if (up49 >= dataLevel)
88456
- throw new Error(errorMsg("property/index", up49));
88457
- return dataPathArr[dataLevel - up49];
88641
+ if (up50 >= dataLevel)
88642
+ throw new Error(errorMsg("property/index", up50));
88643
+ return dataPathArr[dataLevel - up50];
88458
88644
  }
88459
- if (up49 > dataLevel)
88460
- throw new Error(errorMsg("data", up49));
88461
- data = dataNames[dataLevel - up49];
88645
+ if (up50 > dataLevel)
88646
+ throw new Error(errorMsg("data", up50));
88647
+ data = dataNames[dataLevel - up50];
88462
88648
  if (!jsonPointer)
88463
88649
  return data;
88464
88650
  }
@@ -88471,8 +88657,8 @@ var require_validate = __commonJS((exports) => {
88471
88657
  }
88472
88658
  }
88473
88659
  return expr;
88474
- function errorMsg(pointerType, up49) {
88475
- return `Cannot access ${pointerType} ${up49} levels up, current level is ${dataLevel}`;
88660
+ function errorMsg(pointerType, up50) {
88661
+ return `Cannot access ${pointerType} ${up50} levels up, current level is ${dataLevel}`;
88476
88662
  }
88477
88663
  }
88478
88664
  exports.getData = getData;
@@ -89192,49 +89378,49 @@ var require_fast_uri = __commonJS((exports, module) => {
89192
89378
  schemelessOptions.skipEscape = true;
89193
89379
  return serialize(resolved, schemelessOptions);
89194
89380
  }
89195
- function resolveComponent(base, relative3, options, skipNormalization) {
89381
+ function resolveComponent(base, relative4, options, skipNormalization) {
89196
89382
  const target = {};
89197
89383
  if (!skipNormalization) {
89198
89384
  base = parse6(serialize(base, options), options);
89199
- relative3 = parse6(serialize(relative3, options), options);
89385
+ relative4 = parse6(serialize(relative4, options), options);
89200
89386
  }
89201
89387
  options = options || {};
89202
- if (!options.tolerant && relative3.scheme) {
89203
- target.scheme = relative3.scheme;
89204
- target.userinfo = relative3.userinfo;
89205
- target.host = relative3.host;
89206
- target.port = relative3.port;
89207
- target.path = removeDotSegments(relative3.path || "");
89208
- target.query = relative3.query;
89388
+ if (!options.tolerant && relative4.scheme) {
89389
+ target.scheme = relative4.scheme;
89390
+ target.userinfo = relative4.userinfo;
89391
+ target.host = relative4.host;
89392
+ target.port = relative4.port;
89393
+ target.path = removeDotSegments(relative4.path || "");
89394
+ target.query = relative4.query;
89209
89395
  } else {
89210
- if (relative3.userinfo !== undefined || relative3.host !== undefined || relative3.port !== undefined) {
89211
- target.userinfo = relative3.userinfo;
89212
- target.host = relative3.host;
89213
- target.port = relative3.port;
89214
- target.path = removeDotSegments(relative3.path || "");
89215
- target.query = relative3.query;
89396
+ if (relative4.userinfo !== undefined || relative4.host !== undefined || relative4.port !== undefined) {
89397
+ target.userinfo = relative4.userinfo;
89398
+ target.host = relative4.host;
89399
+ target.port = relative4.port;
89400
+ target.path = removeDotSegments(relative4.path || "");
89401
+ target.query = relative4.query;
89216
89402
  } else {
89217
- if (!relative3.path) {
89403
+ if (!relative4.path) {
89218
89404
  target.path = base.path;
89219
- if (relative3.query !== undefined) {
89220
- target.query = relative3.query;
89405
+ if (relative4.query !== undefined) {
89406
+ target.query = relative4.query;
89221
89407
  } else {
89222
89408
  target.query = base.query;
89223
89409
  }
89224
89410
  } else {
89225
- if (relative3.path[0] === "/") {
89226
- target.path = removeDotSegments(relative3.path);
89411
+ if (relative4.path[0] === "/") {
89412
+ target.path = removeDotSegments(relative4.path);
89227
89413
  } else {
89228
89414
  if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
89229
- target.path = "/" + relative3.path;
89415
+ target.path = "/" + relative4.path;
89230
89416
  } else if (!base.path) {
89231
- target.path = relative3.path;
89417
+ target.path = relative4.path;
89232
89418
  } else {
89233
- target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative3.path;
89419
+ target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative4.path;
89234
89420
  }
89235
89421
  target.path = removeDotSegments(target.path);
89236
89422
  }
89237
- target.query = relative3.query;
89423
+ target.query = relative4.query;
89238
89424
  }
89239
89425
  target.userinfo = base.userinfo;
89240
89426
  target.host = base.host;
@@ -89242,7 +89428,7 @@ var require_fast_uri = __commonJS((exports, module) => {
89242
89428
  }
89243
89429
  target.scheme = base.scheme;
89244
89430
  }
89245
- target.fragment = relative3.fragment;
89431
+ target.fragment = relative4.fragment;
89246
89432
  return target;
89247
89433
  }
89248
89434
  function equal(uriA, uriB, options) {
@@ -101740,7 +101926,7 @@ var init_skill_graph = __esm(() => {
101740
101926
  });
101741
101927
 
101742
101928
  // ../daemon/src/pipeline/skill-reconciler.ts
101743
- import { existsSync as existsSync23, readdirSync as readdirSync5, readFileSync as readFileSync20 } from "fs";
101929
+ import { existsSync as existsSync24, readdirSync as readdirSync5, readFileSync as readFileSync21 } from "fs";
101744
101930
  import { join as join32, basename as basename6, dirname as dirname9 } from "path";
101745
101931
  function skillsDir(agentsDir2) {
101746
101932
  return join32(agentsDir2, "skills");
@@ -101750,7 +101936,7 @@ async function reconcileOnce(deps) {
101750
101936
  let installed = 0;
101751
101937
  let updated = 0;
101752
101938
  let removed = 0;
101753
- if (!existsSync23(dir)) {
101939
+ if (!existsSync24(dir)) {
101754
101940
  return { installed, updated, removed };
101755
101941
  }
101756
101942
  const diskSkills = new Map;
@@ -101759,13 +101945,13 @@ async function reconcileOnce(deps) {
101759
101945
  if (!entry.isDirectory())
101760
101946
  continue;
101761
101947
  const skillMdPath = join32(dir, entry.name, "SKILL.md");
101762
- if (existsSync23(skillMdPath)) {
101948
+ if (existsSync24(skillMdPath)) {
101763
101949
  diskSkills.set(entry.name, skillMdPath);
101764
101950
  }
101765
101951
  }
101766
101952
  for (const [name, mdPath] of diskSkills) {
101767
101953
  try {
101768
- const content = readFileSync20(mdPath, "utf-8");
101954
+ const content = readFileSync21(mdPath, "utf-8");
101769
101955
  const parsed = parseSkillFile(content);
101770
101956
  if (!parsed)
101771
101957
  continue;
@@ -101809,7 +101995,7 @@ async function reconcileOnce(deps) {
101809
101995
  }
101810
101996
  const graphSkills = deps.accessor.withReadDb((db) => db.prepare("SELECT entity_id, fs_path FROM skill_meta WHERE agent_id = 'default' AND uninstalled_at IS NULL").all());
101811
101997
  for (const row of graphSkills) {
101812
- if (!existsSync23(row.fs_path)) {
101998
+ if (!existsSync24(row.fs_path)) {
101813
101999
  const parts = row.entity_id.split(":");
101814
102000
  const skillName = parts.slice(2).join(":");
101815
102001
  if (skillName) {
@@ -101853,7 +102039,7 @@ function startReconciler(deps) {
101853
102039
  });
101854
102040
  }, intervalMs);
101855
102041
  let watcher = null;
101856
- if (existsSync23(dir)) {
102042
+ if (existsSync24(dir)) {
101857
102043
  watcher = watch(join32(dir, "*", "SKILL.md"), {
101858
102044
  ignoreInitial: true,
101859
102045
  awaitWriteFinish: { stabilityThreshold: 500 }
@@ -101892,11 +102078,11 @@ function startReconciler(deps) {
101892
102078
  }
101893
102079
  async function reconcileSkill(skillName, mdPath, deps) {
101894
102080
  try {
101895
- if (!existsSync23(mdPath)) {
102081
+ if (!existsSync24(mdPath)) {
101896
102082
  uninstallSkillNode({ skillName }, deps.accessor);
101897
102083
  return;
101898
102084
  }
101899
- const content = readFileSync20(mdPath, "utf-8");
102085
+ const content = readFileSync21(mdPath, "utf-8");
101900
102086
  const parsed = parseSkillFile(content);
101901
102087
  if (!parsed)
101902
102088
  return;
@@ -101936,7 +102122,7 @@ var init_skill_reconciler = __esm(() => {
101936
102122
 
101937
102123
  // ../daemon/src/routes/skills.ts
101938
102124
  import { spawn as spawn4 } from "child_process";
101939
- import { existsSync as existsSync24, readFileSync as readFileSync21, readdirSync as readdirSync6, rmSync, writeFileSync as writeFileSync11 } from "fs";
102125
+ import { existsSync as existsSync25, readFileSync as readFileSync22, readdirSync as readdirSync6, rmSync, writeFileSync as writeFileSync12 } from "fs";
101940
102126
  import { homedir as homedir21 } from "os";
101941
102127
  import { join as join33 } from "path";
101942
102128
  function getAgentsDir2() {
@@ -101979,14 +102165,14 @@ function parseSkillFrontmatter(content) {
101979
102165
  };
101980
102166
  }
101981
102167
  function listInstalledSkills() {
101982
- if (!existsSync24(getSkillsDir()))
102168
+ if (!existsSync25(getSkillsDir()))
101983
102169
  return [];
101984
102170
  return readdirSync6(getSkillsDir(), { withFileTypes: true }).filter((d2) => d2.isDirectory()).flatMap((d2) => {
101985
102171
  const skillMdPath = join33(getSkillsDir(), d2.name, "SKILL.md");
101986
- if (!existsSync24(skillMdPath))
102172
+ if (!existsSync25(skillMdPath))
101987
102173
  return [];
101988
102174
  try {
101989
- const content = readFileSync21(skillMdPath, "utf-8");
102175
+ const content = readFileSync22(skillMdPath, "utf-8");
101990
102176
  const meta3 = parseSkillFrontmatter(content);
101991
102177
  return [{ name: d2.name, ...meta3, path: join33(getSkillsDir(), d2.name) }];
101992
102178
  } catch {
@@ -102135,10 +102321,10 @@ async function onSkillInstalledInner(skillName) {
102135
102321
  if (!accessor2)
102136
102322
  return;
102137
102323
  const skillMdPath = join33(getSkillsDir(), skillName, "SKILL.md");
102138
- if (!existsSync24(skillMdPath))
102324
+ if (!existsSync25(skillMdPath))
102139
102325
  return;
102140
102326
  try {
102141
- const content = readFileSync21(skillMdPath, "utf-8");
102327
+ const content = readFileSync22(skillMdPath, "utf-8");
102142
102328
  const parsed = parseSkillFile(content);
102143
102329
  if (!parsed) {
102144
102330
  logger.warn("skills", "Failed to parse SKILL.md frontmatter for graph", { skill: skillName });
@@ -102156,7 +102342,7 @@ async function onSkillInstalledInner(skillName) {
102156
102342
  fsPath: skillMdPath
102157
102343
  }, accessor2, memoryCfg.pipelineV2, memoryCfg.embedding, fetchEmbeddingFn, getProviderSafe());
102158
102344
  if (result.enriched) {
102159
- const freshContent = readFileSync21(skillMdPath, "utf-8");
102345
+ const freshContent = readFileSync22(skillMdPath, "utf-8");
102160
102346
  const freshParsed = parseSkillFile(freshContent);
102161
102347
  if (freshParsed) {
102162
102348
  const enrichedFm = accessor2.withReadDb((db) => db.prepare("SELECT triggers, tags FROM skill_meta WHERE entity_id = ?").get(result.entityId));
@@ -102187,7 +102373,7 @@ async function onSkillInstalledInner(skillName) {
102187
102373
  tags: patchTags
102188
102374
  });
102189
102375
  if (patched) {
102190
- writeFileSync11(skillMdPath, patched, "utf-8");
102376
+ writeFileSync12(skillMdPath, patched, "utf-8");
102191
102377
  logger.info("skills", "Wrote enrichment back to SKILL.md", { skill: skillName });
102192
102378
  }
102193
102379
  }
@@ -102342,9 +102528,9 @@ function mountSkillsRoutes(app) {
102342
102528
  return c2.json({ error: "Invalid skill name" }, 400);
102343
102529
  }
102344
102530
  const skillMdPath = join33(getSkillsDir(), name, "SKILL.md");
102345
- if (existsSync24(skillMdPath)) {
102531
+ if (existsSync25(skillMdPath)) {
102346
102532
  try {
102347
- const content = readFileSync21(skillMdPath, "utf-8");
102533
+ const content = readFileSync22(skillMdPath, "utf-8");
102348
102534
  const meta3 = parseSkillFrontmatter(content);
102349
102535
  return c2.json({
102350
102536
  name,
@@ -102454,7 +102640,7 @@ function mountSkillsRoutes(app) {
102454
102640
  return c2.json({ error: "Invalid skill name" }, 400);
102455
102641
  }
102456
102642
  const skillDir = join33(getSkillsDir(), name);
102457
- if (!existsSync24(skillDir)) {
102643
+ if (!existsSync25(skillDir)) {
102458
102644
  return c2.json({ error: `Skill '${name}' not found` }, 404);
102459
102645
  }
102460
102646
  try {
@@ -105127,7 +105313,7 @@ var init_event_bus = __esm(() => {
105127
105313
  });
105128
105314
 
105129
105315
  // ../daemon/src/widget-gen.ts
105130
- import { existsSync as existsSync25, mkdirSync as mkdirSync10, readFileSync as readFileSync22, unlinkSync as unlinkSync3 } from "fs";
105316
+ import { existsSync as existsSync26, mkdirSync as mkdirSync10, readFileSync as readFileSync23, unlinkSync as unlinkSync3 } from "fs";
105131
105317
  import { homedir as homedir22 } from "os";
105132
105318
  import { join as join34 } from "path";
105133
105319
  function agentsDir2() {
@@ -105141,7 +105327,7 @@ function widgetPath(serverId) {
105141
105327
  }
105142
105328
  function ensureWidgetDir() {
105143
105329
  const dir = widgetDir();
105144
- if (!existsSync25(dir)) {
105330
+ if (!existsSync26(dir)) {
105145
105331
  mkdirSync10(dir, { recursive: true });
105146
105332
  }
105147
105333
  }
@@ -105189,10 +105375,10 @@ function extractHtml(raw2) {
105189
105375
  }
105190
105376
  function loadCachedWidget(serverId) {
105191
105377
  const path = widgetPath(serverId);
105192
- if (!existsSync25(path))
105378
+ if (!existsSync26(path))
105193
105379
  return null;
105194
105380
  try {
105195
- const content = readFileSync22(path, "utf-8");
105381
+ const content = readFileSync23(path, "utf-8");
105196
105382
  return content.length > 0 ? content : null;
105197
105383
  } catch {
105198
105384
  return null;
@@ -105200,7 +105386,7 @@ function loadCachedWidget(serverId) {
105200
105386
  }
105201
105387
  function deleteCachedWidget(serverId) {
105202
105388
  const path = widgetPath(serverId);
105203
- if (!existsSync25(path))
105389
+ if (!existsSync26(path))
105204
105390
  return false;
105205
105391
  try {
105206
105392
  unlinkSync3(path);
@@ -105391,7 +105577,7 @@ var init_widget_gen = __esm(() => {
105391
105577
  });
105392
105578
 
105393
105579
  // ../daemon/src/mcp-probe.ts
105394
- import { existsSync as existsSync26, mkdirSync as mkdirSync11, readFileSync as readFileSync23, unlinkSync as unlinkSync4, writeFileSync as writeFileSync12 } from "fs";
105580
+ import { existsSync as existsSync27, mkdirSync as mkdirSync11, readFileSync as readFileSync24, unlinkSync as unlinkSync4, writeFileSync as writeFileSync13 } from "fs";
105395
105581
  import { homedir as homedir23 } from "os";
105396
105582
  import { join as join35 } from "path";
105397
105583
  function getAgentsDir3() {
@@ -105405,7 +105591,7 @@ function getAppTrayPath() {
105405
105591
  }
105406
105592
  function ensureManifestsDir() {
105407
105593
  const dir = getManifestsDir();
105408
- if (!existsSync26(dir)) {
105594
+ if (!existsSync27(dir)) {
105409
105595
  mkdirSync11(dir, { recursive: true });
105410
105596
  }
105411
105597
  }
@@ -105658,7 +105844,7 @@ async function probeServer(server) {
105658
105844
  function storeProbeResult(result) {
105659
105845
  ensureManifestsDir();
105660
105846
  const manifestPath = join35(getManifestsDir(), `${result.serverId}.json`);
105661
- writeFileSync12(manifestPath, JSON.stringify(result, null, 2));
105847
+ writeFileSync13(manifestPath, JSON.stringify(result, null, 2));
105662
105848
  const tray = loadAppTray();
105663
105849
  const now4 = new Date().toISOString();
105664
105850
  const existingIndex = tray.findIndex((e) => e.id === result.serverId);
@@ -105684,7 +105870,7 @@ function storeProbeResult(result) {
105684
105870
  } else {
105685
105871
  tray.push(entry);
105686
105872
  }
105687
- writeFileSync12(getAppTrayPath(), JSON.stringify(tray, null, 2));
105873
+ writeFileSync13(getAppTrayPath(), JSON.stringify(tray, null, 2));
105688
105874
  logger.info("probe", `Stored probe result for ${result.serverId}`, {
105689
105875
  hasDeclaredManifest: !!result.declaredManifest,
105690
105876
  state: entry.state,
@@ -105703,10 +105889,10 @@ function storeProbeResult(result) {
105703
105889
  }
105704
105890
  function loadAppTray() {
105705
105891
  const path = getAppTrayPath();
105706
- if (!existsSync26(path))
105892
+ if (!existsSync27(path))
105707
105893
  return [];
105708
105894
  try {
105709
- const raw2 = JSON.parse(readFileSync23(path, "utf-8"));
105895
+ const raw2 = JSON.parse(readFileSync24(path, "utf-8"));
105710
105896
  if (!Array.isArray(raw2))
105711
105897
  return [];
105712
105898
  return raw2.filter((item) => isRecord10(item) && typeof item.id === "string" && typeof item.name === "string" && typeof item.state === "string");
@@ -105716,10 +105902,10 @@ function loadAppTray() {
105716
105902
  }
105717
105903
  function loadProbeResult(serverId) {
105718
105904
  const path = join35(getManifestsDir(), `${serverId}.json`);
105719
- if (!existsSync26(path))
105905
+ if (!existsSync27(path))
105720
105906
  return null;
105721
105907
  try {
105722
- const raw2 = JSON.parse(readFileSync23(path, "utf-8"));
105908
+ const raw2 = JSON.parse(readFileSync24(path, "utf-8"));
105723
105909
  if (!isRecord10(raw2) || typeof raw2.serverId !== "string")
105724
105910
  return null;
105725
105911
  return raw2;
@@ -105730,7 +105916,7 @@ function loadProbeResult(serverId) {
105730
105916
  function removeProbeResult(serverId) {
105731
105917
  const manifestPath = join35(getManifestsDir(), `${serverId}.json`);
105732
105918
  try {
105733
- if (existsSync26(manifestPath)) {
105919
+ if (existsSync27(manifestPath)) {
105734
105920
  unlinkSync4(manifestPath);
105735
105921
  }
105736
105922
  } catch {
@@ -105739,7 +105925,7 @@ function removeProbeResult(serverId) {
105739
105925
  const tray = loadAppTray();
105740
105926
  const filtered = tray.filter((e) => e.id !== serverId);
105741
105927
  if (filtered.length !== tray.length) {
105742
- writeFileSync12(getAppTrayPath(), JSON.stringify(filtered, null, 2));
105928
+ writeFileSync13(getAppTrayPath(), JSON.stringify(filtered, null, 2));
105743
105929
  }
105744
105930
  }
105745
105931
  async function reprobeServer(server) {
@@ -105766,7 +105952,7 @@ __export(exports_marketplace, {
105766
105952
  mountMarketplaceRoutes: () => mountMarketplaceRoutes,
105767
105953
  extractStandardMcpConfig: () => extractStandardMcpConfig
105768
105954
  });
105769
- import { existsSync as existsSync27, mkdirSync as mkdirSync12, readFileSync as readFileSync24, writeFileSync as writeFileSync13 } from "fs";
105955
+ import { existsSync as existsSync28, mkdirSync as mkdirSync12, readFileSync as readFileSync25, writeFileSync as writeFileSync14 } from "fs";
105770
105956
  import { homedir as homedir24 } from "os";
105771
105957
  import { join as join36 } from "path";
105772
105958
  function getAgentsDir4() {
@@ -105783,7 +105969,7 @@ function getExposurePolicyPath() {
105783
105969
  }
105784
105970
  function ensureMarketplaceDir() {
105785
105971
  const dir = getMarketplaceDir();
105786
- if (!existsSync27(dir)) {
105972
+ if (!existsSync28(dir)) {
105787
105973
  mkdirSync12(dir, { recursive: true });
105788
105974
  }
105789
105975
  }
@@ -105911,11 +106097,11 @@ function parseExposurePolicy(value) {
105911
106097
  }
105912
106098
  function readExposurePolicy() {
105913
106099
  const path = getExposurePolicyPath();
105914
- if (!existsSync27(path)) {
106100
+ if (!existsSync28(path)) {
105915
106101
  return DEFAULT_EXPOSURE_POLICY;
105916
106102
  }
105917
106103
  try {
105918
- const raw2 = JSON.parse(readFileSync24(path, "utf-8"));
106104
+ const raw2 = JSON.parse(readFileSync25(path, "utf-8"));
105919
106105
  return parseExposurePolicy(raw2) ?? DEFAULT_EXPOSURE_POLICY;
105920
106106
  } catch {
105921
106107
  return DEFAULT_EXPOSURE_POLICY;
@@ -105923,7 +106109,7 @@ function readExposurePolicy() {
105923
106109
  }
105924
106110
  function writeExposurePolicy(policy) {
105925
106111
  ensureMarketplaceDir();
105926
- writeFileSync13(getExposurePolicyPath(), JSON.stringify(policy, null, 2));
106112
+ writeFileSync14(getExposurePolicyPath(), JSON.stringify(policy, null, 2));
105927
106113
  }
105928
106114
  function extractContextFromRequest(c2) {
105929
106115
  return extractScopeContext({
@@ -106335,10 +106521,10 @@ function parseInstalledServer(value) {
106335
106521
  }
106336
106522
  function readInstalledServers() {
106337
106523
  const path = getInstalledMcpPath();
106338
- if (!existsSync27(path))
106524
+ if (!existsSync28(path))
106339
106525
  return [];
106340
106526
  try {
106341
- const raw2 = JSON.parse(readFileSync24(path, "utf-8"));
106527
+ const raw2 = JSON.parse(readFileSync25(path, "utf-8"));
106342
106528
  if (!Array.isArray(raw2))
106343
106529
  return [];
106344
106530
  return raw2.map((item) => parseInstalledServer(item)).filter((item) => item !== null);
@@ -106348,7 +106534,7 @@ function readInstalledServers() {
106348
106534
  }
106349
106535
  function writeInstalledServers(servers) {
106350
106536
  ensureMarketplaceDir();
106351
- writeFileSync13(getInstalledMcpPath(), JSON.stringify(servers, null, 2));
106537
+ writeFileSync14(getInstalledMcpPath(), JSON.stringify(servers, null, 2));
106352
106538
  }
106353
106539
  async function fetchMcpServersOrgDetail(catalogId) {
106354
106540
  const url2 = `https://r.jina.ai/http://mcpservers.org/${MCPSERVERS_LOCALE}/servers/${catalogId}`;
@@ -107035,7 +107221,7 @@ var exports_marketplace_helpers = {};
107035
107221
  __export(exports_marketplace_helpers, {
107036
107222
  readInstalledServersPublic: () => readInstalledServersPublic
107037
107223
  });
107038
- import { existsSync as existsSync28, readFileSync as readFileSync25 } from "fs";
107224
+ import { existsSync as existsSync29, readFileSync as readFileSync26 } from "fs";
107039
107225
  import { homedir as homedir25 } from "os";
107040
107226
  import { join as join37 } from "path";
107041
107227
  function getAgentsDir5() {
@@ -107049,10 +107235,10 @@ function isRecord12(value) {
107049
107235
  }
107050
107236
  function readInstalledServersPublic() {
107051
107237
  const path = getInstalledMcpPath2();
107052
- if (!existsSync28(path))
107238
+ if (!existsSync29(path))
107053
107239
  return [];
107054
107240
  try {
107055
- const raw2 = JSON.parse(readFileSync25(path, "utf-8"));
107241
+ const raw2 = JSON.parse(readFileSync26(path, "utf-8"));
107056
107242
  if (!Array.isArray(raw2))
107057
107243
  return [];
107058
107244
  return raw2.filter((item) => isRecord12(item) && typeof item.id === "string" && typeof item.name === "string" && typeof item.enabled === "boolean");
@@ -107063,7 +107249,7 @@ function readInstalledServersPublic() {
107063
107249
  var init_marketplace_helpers = () => {};
107064
107250
 
107065
107251
  // ../daemon/src/routes/app-tray.ts
107066
- import { existsSync as existsSync29, mkdirSync as mkdirSync13, readFileSync as readFileSync26, writeFileSync as writeFileSync14 } from "fs";
107252
+ import { existsSync as existsSync30, mkdirSync as mkdirSync13, readFileSync as readFileSync27, writeFileSync as writeFileSync15 } from "fs";
107067
107253
  import { join as join38 } from "path";
107068
107254
  import { homedir as homedir26 } from "os";
107069
107255
  function isValidState(s2) {
@@ -107141,7 +107327,7 @@ function mountAppTrayRoutes(app) {
107141
107327
  const freshIds = new Set(fresh.map((e) => e.id));
107142
107328
  const toAdd = stubs.filter((s2) => !freshIds.has(s2.id));
107143
107329
  if (toAdd.length > 0) {
107144
- writeFileSync14(join38(getMarketplaceDir2(), "app-tray.json"), JSON.stringify([...fresh, ...toAdd], null, 2));
107330
+ writeFileSync15(join38(getMarketplaceDir2(), "app-tray.json"), JSON.stringify([...fresh, ...toAdd], null, 2));
107145
107331
  }
107146
107332
  logger.info("os", `Synced ${toAdd.length} installed server(s) to app tray`);
107147
107333
  } catch (err) {
@@ -107217,7 +107403,7 @@ function mountAppTrayRoutes(app) {
107217
107403
  tray[index] = updated;
107218
107404
  const agentsDir3 = process.env.SIGNET_PATH || join38(homedir26(), ".agents");
107219
107405
  const trayPath = join38(agentsDir3, "marketplace", "app-tray.json");
107220
- writeFileSync14(trayPath, JSON.stringify(tray, null, 2));
107406
+ writeFileSync15(trayPath, JSON.stringify(tray, null, 2));
107221
107407
  return c2.json({ success: true, entry: updated });
107222
107408
  });
107223
107409
  app.post("/api/os/install", async (c2) => {
@@ -107276,7 +107462,7 @@ function mountAppTrayRoutes(app) {
107276
107462
  };
107277
107463
  const agentsDir3 = process.env.SIGNET_PATH || join38(homedir26(), ".agents");
107278
107464
  const trayPath = join38(agentsDir3, "marketplace", "app-tray.json");
107279
- writeFileSync14(trayPath, JSON.stringify(tray, null, 2));
107465
+ writeFileSync15(trayPath, JSON.stringify(tray, null, 2));
107280
107466
  }
107281
107467
  }
107282
107468
  }
@@ -107303,7 +107489,7 @@ function getInstalledMcpPath3() {
107303
107489
  }
107304
107490
  function ensureMarketplaceDir2() {
107305
107491
  const dir = getMarketplaceDir2();
107306
- if (!existsSync29(dir)) {
107492
+ if (!existsSync30(dir)) {
107307
107493
  mkdirSync13(dir, { recursive: true });
107308
107494
  }
107309
107495
  }
@@ -107346,10 +107532,10 @@ function inferCategory2(text) {
107346
107532
  }
107347
107533
  function readInstalledServersRaw() {
107348
107534
  const path = getInstalledMcpPath3();
107349
- if (!existsSync29(path))
107535
+ if (!existsSync30(path))
107350
107536
  return [];
107351
107537
  try {
107352
- const raw2 = JSON.parse(readFileSync26(path, "utf-8"));
107538
+ const raw2 = JSON.parse(readFileSync27(path, "utf-8"));
107353
107539
  if (!Array.isArray(raw2))
107354
107540
  return [];
107355
107541
  return raw2;
@@ -107359,7 +107545,7 @@ function readInstalledServersRaw() {
107359
107545
  }
107360
107546
  function writeInstalledServersRaw(servers) {
107361
107547
  ensureMarketplaceDir2();
107362
- writeFileSync14(getInstalledMcpPath3(), JSON.stringify(servers, null, 2));
107548
+ writeFileSync15(getInstalledMcpPath3(), JSON.stringify(servers, null, 2));
107363
107549
  }
107364
107550
  function makeUniqueServerId2(baseId, installed) {
107365
107551
  if (!installed.some((s2) => s2.id === baseId))
@@ -107434,7 +107620,7 @@ var init_app_tray = __esm(() => {
107434
107620
  });
107435
107621
 
107436
107622
  // ../daemon/src/routes/widget.ts
107437
- import { existsSync as existsSync30, statSync as statSync7 } from "fs";
107623
+ import { existsSync as existsSync31, statSync as statSync7 } from "fs";
107438
107624
  import { join as join39 } from "path";
107439
107625
  function mountWidgetRoutes(app) {
107440
107626
  app.post("/api/os/widget/generate", async (c2) => {
@@ -107477,7 +107663,7 @@ function mountWidgetRoutes(app) {
107477
107663
  const path = join39(widgetDir(), `${id}.html`);
107478
107664
  let generatedAt = null;
107479
107665
  try {
107480
- if (existsSync30(path)) {
107666
+ if (existsSync31(path)) {
107481
107667
  const stat5 = statSync7(path);
107482
107668
  generatedAt = stat5.mtime.toISOString();
107483
107669
  }
@@ -107565,7 +107751,7 @@ var init_event_bus2 = __esm(() => {
107565
107751
 
107566
107752
  // ../daemon/src/routes/marketplace-reviews.ts
107567
107753
  import { randomUUID as randomUUID4 } from "crypto";
107568
- import { existsSync as existsSync31, mkdirSync as mkdirSync14, readFileSync as readFileSync27, writeFileSync as writeFileSync15 } from "fs";
107754
+ import { existsSync as existsSync32, mkdirSync as mkdirSync14, readFileSync as readFileSync28, writeFileSync as writeFileSync16 } from "fs";
107569
107755
  import { homedir as homedir27 } from "os";
107570
107756
  import { join as join40 } from "path";
107571
107757
  function getAgentsDir7() {
@@ -107582,7 +107768,7 @@ function getReviewsConfigPath() {
107582
107768
  }
107583
107769
  function ensureMarketplaceDir3() {
107584
107770
  const dir = getMarketplaceDir3();
107585
- if (!existsSync31(dir)) {
107771
+ if (!existsSync32(dir)) {
107586
107772
  mkdirSync14(dir, { recursive: true });
107587
107773
  }
107588
107774
  }
@@ -107644,10 +107830,10 @@ function normalizeReview(value) {
107644
107830
  }
107645
107831
  function readReviews() {
107646
107832
  const path = getReviewsPath();
107647
- if (!existsSync31(path))
107833
+ if (!existsSync32(path))
107648
107834
  return [];
107649
107835
  try {
107650
- const raw2 = JSON.parse(readFileSync27(path, "utf-8"));
107836
+ const raw2 = JSON.parse(readFileSync28(path, "utf-8"));
107651
107837
  if (!Array.isArray(raw2))
107652
107838
  return [];
107653
107839
  return raw2.map(normalizeReview).filter((item) => item !== null);
@@ -107657,14 +107843,14 @@ function readReviews() {
107657
107843
  }
107658
107844
  function writeReviews(reviews) {
107659
107845
  ensureMarketplaceDir3();
107660
- writeFileSync15(getReviewsPath(), JSON.stringify(reviews, null, 2), "utf-8");
107846
+ writeFileSync16(getReviewsPath(), JSON.stringify(reviews, null, 2), "utf-8");
107661
107847
  }
107662
107848
  function readConfig() {
107663
107849
  const path = getReviewsConfigPath();
107664
- if (!existsSync31(path))
107850
+ if (!existsSync32(path))
107665
107851
  return DEFAULT_CONFIG3;
107666
107852
  try {
107667
- const raw2 = JSON.parse(readFileSync27(path, "utf-8"));
107853
+ const raw2 = JSON.parse(readFileSync28(path, "utf-8"));
107668
107854
  if (!isRecord13(raw2))
107669
107855
  return DEFAULT_CONFIG3;
107670
107856
  return {
@@ -107679,7 +107865,7 @@ function readConfig() {
107679
107865
  }
107680
107866
  function writeConfig(config2) {
107681
107867
  ensureMarketplaceDir3();
107682
- writeFileSync15(getReviewsConfigPath(), JSON.stringify(config2, null, 2), "utf-8");
107868
+ writeFileSync16(getReviewsConfigPath(), JSON.stringify(config2, null, 2), "utf-8");
107683
107869
  }
107684
107870
  function parseLimit(raw2) {
107685
107871
  if (!raw2)
@@ -107876,7 +108062,7 @@ var init_marketplace_reviews = __esm(() => {
107876
108062
  });
107877
108063
 
107878
108064
  // ../daemon/src/routes/changelog.ts
107879
- import { existsSync as existsSync32, readFileSync as readFileSync28 } from "fs";
108065
+ import { existsSync as existsSync33, readFileSync as readFileSync29 } from "fs";
107880
108066
  import { fileURLToPath as fileURLToPath3 } from "url";
107881
108067
  import { join as join41 } from "path";
107882
108068
  function truncateChangelog(content, max = CHANGELOG_MAX_RELEASES) {
@@ -108002,9 +108188,9 @@ async function fetchAndRender(filename) {
108002
108188
  }
108003
108189
  if (!raw2) {
108004
108190
  const localPath = join41(REPO_ROOT, filename);
108005
- if (existsSync32(localPath)) {
108191
+ if (existsSync33(localPath)) {
108006
108192
  try {
108007
- raw2 = readFileSync28(localPath, "utf-8");
108193
+ raw2 = readFileSync29(localPath, "utf-8");
108008
108194
  source = "local";
108009
108195
  } catch (err) {
108010
108196
  logger.warn("changelog", `Local read failed for ${filename}`, err);
@@ -108746,14 +108932,14 @@ import { createHash as createHash4 } from "crypto";
108746
108932
  import { copyFileSync as copyFileSync2 } from "fs";
108747
108933
  import {
108748
108934
  appendFileSync as appendFileSync2,
108749
- existsSync as existsSync33,
108935
+ existsSync as existsSync34,
108750
108936
  mkdirSync as mkdirSync15,
108751
- readFileSync as readFileSync29,
108937
+ readFileSync as readFileSync30,
108752
108938
  readdirSync as readdirSync7,
108753
108939
  realpathSync as realpathSync3,
108754
108940
  statSync as statSync8,
108755
108941
  unlinkSync as unlinkSync5,
108756
- writeFileSync as writeFileSync16
108942
+ writeFileSync as writeFileSync17
108757
108943
  } from "fs";
108758
108944
  import { homedir as homedir28 } from "os";
108759
108945
  import { basename as basename7, dirname as dirname10, join as join42 } from "path";
@@ -108827,10 +109013,10 @@ function isAllowedOrigin(origin) {
108827
109013
  function readConfiguredNetworkBinding(agentsDir3) {
108828
109014
  for (const name of ["agent.yaml", "AGENT.yaml"]) {
108829
109015
  const path = join42(agentsDir3, name);
108830
- if (!existsSync33(path))
109016
+ if (!existsSync34(path))
108831
109017
  continue;
108832
109018
  try {
108833
- return resolveNetworkBinding(readNetworkMode(parseSimpleYaml(readFileSync29(path, "utf-8"))));
109019
+ return resolveNetworkBinding(readNetworkMode(parseSimpleYaml(readFileSync30(path, "utf-8"))));
108834
109020
  } catch {}
108835
109021
  }
108836
109022
  return resolveNetworkBinding("localhost");
@@ -108946,12 +109132,12 @@ function resolveDaemonBinary() {
108946
109132
  join42(process.cwd(), "packages", "daemon-rs", "target", "release", `signet-daemon${ext}`)
108947
109133
  ];
108948
109134
  for (const p2 of devPaths) {
108949
- if (existsSync33(p2))
109135
+ if (existsSync34(p2))
108950
109136
  return p2;
108951
109137
  }
108952
109138
  const name = `signet-daemon-${plat}-${arch2}${ext}`;
108953
109139
  const npmPath = join42(import.meta.dir, "..", "bin", name);
108954
- if (existsSync33(npmPath))
109140
+ if (existsSync34(npmPath))
108955
109141
  return npmPath;
108956
109142
  return null;
108957
109143
  }
@@ -108961,19 +109147,19 @@ function setupShadowDb(agentsDir3) {
108961
109147
  mkdirSync15(shadowMemDir, { recursive: true });
108962
109148
  const mainDb = join42(agentsDir3, "memory", "memories.db");
108963
109149
  const shadowDb = join42(shadowMemDir, "memories.db");
108964
- const stale = !existsSync33(shadowDb) || Date.now() - statSync8(shadowDb).mtimeMs > 24 * 60 * 60 * 1000;
108965
- if (stale && existsSync33(mainDb)) {
109150
+ const stale = !existsSync34(shadowDb) || Date.now() - statSync8(shadowDb).mtimeMs > 24 * 60 * 60 * 1000;
109151
+ if (stale && existsSync34(mainDb)) {
108966
109152
  copyFileSync2(mainDb, shadowDb);
108967
109153
  for (const ext of ["-wal", "-shm"]) {
108968
109154
  const src = mainDb + ext;
108969
- if (existsSync33(src))
109155
+ if (existsSync34(src))
108970
109156
  copyFileSync2(src, shadowDb + ext);
108971
109157
  }
108972
109158
  logger.info("shadow", "Shadow DB refreshed");
108973
109159
  }
108974
109160
  const mainCfg = join42(agentsDir3, "agent.yaml");
108975
109161
  const shadowCfg = join42(shadowRoot, "agent.yaml");
108976
- if (existsSync33(mainCfg))
109162
+ if (existsSync34(mainCfg))
108977
109163
  copyFileSync2(mainCfg, shadowCfg);
108978
109164
  return shadowRoot;
108979
109165
  }
@@ -109037,11 +109223,11 @@ function buildPredictorHealthParams() {
109037
109223
  };
109038
109224
  }
109039
109225
  function getVersionFromPackageJson(packageJsonPath) {
109040
- if (!existsSync33(packageJsonPath)) {
109226
+ if (!existsSync34(packageJsonPath)) {
109041
109227
  return null;
109042
109228
  }
109043
109229
  try {
109044
- const raw2 = readFileSync29(packageJsonPath, "utf8");
109230
+ const raw2 = readFileSync30(packageJsonPath, "utf8");
109045
109231
  const parsed = JSON.parse(raw2);
109046
109232
  return typeof parsed.version === "string" ? parsed.version : null;
109047
109233
  } catch {
@@ -109168,10 +109354,10 @@ function getConfiguredProviderHints(agentsDir3) {
109168
109354
  let extraction = null;
109169
109355
  let synthesis = null;
109170
109356
  for (const path of paths) {
109171
- if (!existsSync33(path))
109357
+ if (!existsSync34(path))
109172
109358
  continue;
109173
109359
  try {
109174
- const yaml = toRecord2(parseSimpleYaml(readFileSync29(path, "utf-8")));
109360
+ const yaml = toRecord2(parseSimpleYaml(readFileSync30(path, "utf-8")));
109175
109361
  const mem = toRecord2(yaml?.memory);
109176
109362
  const pipeline3 = toRecord2(mem?.pipelineV2);
109177
109363
  const extractionObj = toRecord2(pipeline3?.extraction);
@@ -109296,7 +109482,7 @@ function isMissingEmbeddingsTableError(error48) {
109296
109482
  }
109297
109483
  async function runLegacyEmbeddingsExport(withVectors, limit, offset) {
109298
109484
  const scriptPath = join42(AGENTS_DIR7, "memory", "scripts", "export_embeddings.py");
109299
- if (!existsSync33(scriptPath)) {
109485
+ if (!existsSync34(scriptPath)) {
109300
109486
  return null;
109301
109487
  }
109302
109488
  const args = [scriptPath, "--limit", String(limit), "--offset", String(offset)];
@@ -109475,7 +109661,7 @@ function getDashboardPath() {
109475
109661
  join42(__dirname3, "dashboard")
109476
109662
  ];
109477
109663
  for (const candidate of candidates) {
109478
- if (existsSync33(join42(candidate, "index.html"))) {
109664
+ if (existsSync34(join42(candidate, "index.html"))) {
109479
109665
  return candidate;
109480
109666
  }
109481
109667
  }
@@ -110086,10 +110272,10 @@ function loadGitConfig() {
110086
110272
  };
110087
110273
  const paths = [join42(AGENTS_DIR7, "agent.yaml"), join42(AGENTS_DIR7, "AGENT.yaml")];
110088
110274
  for (const p2 of paths) {
110089
- if (!existsSync33(p2))
110275
+ if (!existsSync34(p2))
110090
110276
  continue;
110091
110277
  try {
110092
- const yaml = parseSimpleYaml(readFileSync29(p2, "utf-8"));
110278
+ const yaml = parseSimpleYaml(readFileSync30(p2, "utf-8"));
110093
110279
  const git = yaml.git;
110094
110280
  if (git) {
110095
110281
  if (git.enabled !== undefined)
@@ -110114,7 +110300,7 @@ function loadGitConfig() {
110114
110300
  return defaults;
110115
110301
  }
110116
110302
  function isGitRepo(dir) {
110117
- return existsSync33(join42(dir, ".git"));
110303
+ return existsSync34(join42(dir, ".git"));
110118
110304
  }
110119
110305
  async function runCommand(cmd, args, options) {
110120
110306
  return new Promise((resolve7) => {
@@ -110497,10 +110683,10 @@ async function getGitStatus() {
110497
110683
  }
110498
110684
  function ensureProtectedGitignore(dir) {
110499
110685
  const gitignorePath = join42(dir, ".gitignore");
110500
- const existingContent = existsSync33(gitignorePath) ? readFileSync29(gitignorePath, "utf-8") : "";
110686
+ const existingContent = existsSync34(gitignorePath) ? readFileSync30(gitignorePath, "utf-8") : "";
110501
110687
  const nextContent = mergeSignetGitignoreEntries(existingContent);
110502
110688
  if (nextContent !== existingContent) {
110503
- writeFileSync16(gitignorePath, nextContent, "utf-8");
110689
+ writeFileSync17(gitignorePath, nextContent, "utf-8");
110504
110690
  }
110505
110691
  }
110506
110692
  async function gitUntrackProtectedFiles(dir) {
@@ -110603,9 +110789,9 @@ function scheduleAutoCommit(changedPath) {
110603
110789
  }
110604
110790
  async function syncHarnessConfigs() {
110605
110791
  const agentsMdPath = join42(AGENTS_DIR7, "AGENTS.md");
110606
- if (!existsSync33(agentsMdPath))
110792
+ if (!existsSync34(agentsMdPath))
110607
110793
  return;
110608
- const rawContent = readFileSync29(agentsMdPath, "utf-8");
110794
+ const rawContent = readFileSync30(agentsMdPath, "utf-8");
110609
110795
  const content = stripSignetBlock(rawContent);
110610
110796
  const withBlock = buildSignetBlock() + content;
110611
110797
  const buildHeader = (targetName) => {
@@ -110616,7 +110802,7 @@ async function syncHarnessConfigs() {
110616
110802
  { name: "MEMORY.md", desc: "Working memory context" },
110617
110803
  { name: "agent.yaml", desc: "Configuration & settings" }
110618
110804
  ];
110619
- const existingFiles = files.filter((f2) => existsSync33(join42(AGENTS_DIR7, f2.name)));
110805
+ const existingFiles = files.filter((f2) => existsSync34(join42(AGENTS_DIR7, f2.name)));
110620
110806
  const fileList = existingFiles.map((f2) => `# - ~/.agents/${f2.name} (${f2.desc})`).join(`
110621
110807
  `);
110622
110808
  return `# ${targetName}
@@ -110641,10 +110827,10 @@ ${fileList}
110641
110827
  };
110642
110828
  const identityExtras = ["SOUL.md", "IDENTITY.md", "USER.md", "MEMORY.md"].map((name) => {
110643
110829
  const p2 = join42(AGENTS_DIR7, name);
110644
- if (!existsSync33(p2))
110830
+ if (!existsSync34(p2))
110645
110831
  return "";
110646
110832
  try {
110647
- const c2 = readFileSync29(p2, "utf-8").trim();
110833
+ const c2 = readFileSync30(p2, "utf-8").trim();
110648
110834
  if (!c2)
110649
110835
  return "";
110650
110836
  const header = name.replace(".md", "");
@@ -110659,9 +110845,9 @@ ${c2}`;
110659
110845
  `);
110660
110846
  const composed = withBlock + identityExtras;
110661
110847
  const opencodeDir = join42(homedir28(), ".config", "opencode");
110662
- if (existsSync33(opencodeDir)) {
110848
+ if (existsSync34(opencodeDir)) {
110663
110849
  try {
110664
- writeFileSync16(join42(opencodeDir, "AGENTS.md"), buildHeader("AGENTS.md") + composed);
110850
+ writeFileSync17(join42(opencodeDir, "AGENTS.md"), buildHeader("AGENTS.md") + composed);
110665
110851
  logger.sync.harness("opencode", "~/.config/opencode/AGENTS.md");
110666
110852
  } catch (e) {
110667
110853
  logger.sync.failed("opencode", e);
@@ -110672,7 +110858,7 @@ ${c2}`;
110672
110858
  }
110673
110859
  function syncAgentWorkspaces(agentsDir3) {
110674
110860
  const agentsRoot = join42(agentsDir3, "agents");
110675
- if (!existsSync33(agentsRoot))
110861
+ if (!existsSync34(agentsRoot))
110676
110862
  return;
110677
110863
  let entries;
110678
110864
  try {
@@ -110684,17 +110870,17 @@ function syncAgentWorkspaces(agentsDir3) {
110684
110870
  const agentDir = join42(agentsRoot, name);
110685
110871
  const workspaceDir = join42(agentDir, "workspace");
110686
110872
  const agentsMdPath = join42(agentsDir3, "AGENTS.md");
110687
- if (!existsSync33(agentsMdPath))
110873
+ if (!existsSync34(agentsMdPath))
110688
110874
  continue;
110689
110875
  try {
110690
- const base = readFileSync29(agentsMdPath, "utf-8");
110876
+ const base = readFileSync30(agentsMdPath, "utf-8");
110691
110877
  const agentIdentity = ["SOUL.md", "IDENTITY.md"].map((f2) => {
110692
110878
  const override = join42(agentDir, f2);
110693
110879
  const root = join42(agentsDir3, f2);
110694
- const p2 = existsSync33(override) ? override : existsSync33(root) ? root : null;
110880
+ const p2 = existsSync34(override) ? override : existsSync34(root) ? root : null;
110695
110881
  if (!p2)
110696
110882
  return "";
110697
- const c2 = readFileSync29(p2, "utf-8").trim();
110883
+ const c2 = readFileSync30(p2, "utf-8").trim();
110698
110884
  return c2 ? `
110699
110885
  ## ${f2.replace(".md", "")}
110700
110886
 
@@ -110703,9 +110889,9 @@ ${c2}` : "";
110703
110889
  `);
110704
110890
  const sharedIdentity = ["USER.md", "MEMORY.md"].map((f2) => {
110705
110891
  const p2 = join42(agentsDir3, f2);
110706
- if (!existsSync33(p2))
110892
+ if (!existsSync34(p2))
110707
110893
  return "";
110708
- const c2 = readFileSync29(p2, "utf-8").trim();
110894
+ const c2 = readFileSync30(p2, "utf-8").trim();
110709
110895
  return c2 ? `
110710
110896
  ## ${f2.replace(".md", "")}
110711
110897
 
@@ -110714,8 +110900,10 @@ ${c2}` : "";
110714
110900
  `);
110715
110901
  const composed = base + agentIdentity + sharedIdentity;
110716
110902
  mkdirSync15(workspaceDir, { recursive: true });
110717
- writeFileSync16(join42(workspaceDir, "AGENTS.md"), composed);
110718
- logger.sync.harness(`openclaw:${name}`, join42(workspaceDir, "AGENTS.md"));
110903
+ const workspaceAgentsPath = join42(workspaceDir, "AGENTS.md");
110904
+ if (writeFileIfChanged(workspaceAgentsPath, composed)) {
110905
+ logger.sync.harness(`openclaw:${name}`, workspaceAgentsPath);
110906
+ }
110719
110907
  } catch (e) {
110720
110908
  logger.error("sync", `Failed to sync agent workspace: ${name}`, e);
110721
110909
  }
@@ -110725,9 +110913,7 @@ function ensureArchitectureDoc() {
110725
110913
  const archPath = join42(AGENTS_DIR7, "SIGNET-ARCHITECTURE.md");
110726
110914
  try {
110727
110915
  const archContent = buildArchitectureDoc();
110728
- const existing = existsSync33(archPath) ? readFileSync29(archPath, "utf-8") : "";
110729
- if (existing !== archContent) {
110730
- writeFileSync16(archPath, archContent);
110916
+ if (writeFileIfChanged(archPath, archContent)) {
110731
110917
  logger.info("sync", "SIGNET-ARCHITECTURE.md updated");
110732
110918
  }
110733
110919
  } catch (e) {
@@ -110820,7 +111006,7 @@ function startFileWatcher() {
110820
111006
  }
110821
111007
  function startClaudeMemoryWatcher() {
110822
111008
  const claudeProjectsDir = join42(homedir28(), ".claude", "projects");
110823
- if (!existsSync33(claudeProjectsDir))
111009
+ if (!existsSync34(claudeProjectsDir))
110824
111010
  return;
110825
111011
  const claudeWatcher = watch(join42(claudeProjectsDir, "**", "memory", "MEMORY.md"), {
110826
111012
  persistent: true,
@@ -110841,7 +111027,7 @@ async function syncExistingClaudeMemories(claudeProjectsDir) {
110841
111027
  let totalSynced = 0;
110842
111028
  for (const project of projects) {
110843
111029
  const memoryFile = join42(claudeProjectsDir, project, "memory", "MEMORY.md");
110844
- if (existsSync33(memoryFile)) {
111030
+ if (existsSync34(memoryFile)) {
110845
111031
  const count2 = await syncClaudeMemoryFile(memoryFile);
110846
111032
  totalSynced += count2;
110847
111033
  }
@@ -110857,7 +111043,7 @@ async function syncExistingClaudeMemories(claudeProjectsDir) {
110857
111043
  }
110858
111044
  async function syncClaudeMemoryFile(filePath) {
110859
111045
  try {
110860
- const content = readFileSync29(filePath, "utf-8");
111046
+ const content = readFileSync30(filePath, "utf-8");
110861
111047
  if (!content.trim())
110862
111048
  return 0;
110863
111049
  const match2 = filePath.match(/projects\/([^/]+)\/memory/);
@@ -111062,7 +111248,7 @@ async function ingestMemoryMarkdown(filePath) {
111062
111248
  return 0;
111063
111249
  let content;
111064
111250
  try {
111065
- content = readFileSync29(filePath, "utf-8");
111251
+ content = readFileSync30(filePath, "utf-8");
111066
111252
  } catch (e) {
111067
111253
  logger.error("watcher", "Failed to read memory file", undefined, {
111068
111254
  path: filePath,
@@ -111137,7 +111323,7 @@ async function ingestMemoryMarkdown(filePath) {
111137
111323
  }
111138
111324
  async function importExistingMemoryFiles() {
111139
111325
  const memoryDir = join42(AGENTS_DIR7, "memory");
111140
- if (!existsSync33(memoryDir)) {
111326
+ if (!existsSync34(memoryDir)) {
111141
111327
  logger.debug("daemon", "Memory directory does not exist, skipping initial import");
111142
111328
  return 0;
111143
111329
  }
@@ -111226,7 +111412,7 @@ async function cleanup() {
111226
111412
  if (watcher) {
111227
111413
  watcher.close();
111228
111414
  }
111229
- if (existsSync33(PID_FILE)) {
111415
+ if (existsSync34(PID_FILE)) {
111230
111416
  try {
111231
111417
  unlinkSync5(PID_FILE);
111232
111418
  } catch {}
@@ -111236,10 +111422,10 @@ function syncAgentRoster(agentsDir3) {
111236
111422
  const paths = [join42(agentsDir3, "agent.yaml"), join42(agentsDir3, "AGENT.yaml")];
111237
111423
  let roster = [];
111238
111424
  for (const p2 of paths) {
111239
- if (!existsSync33(p2))
111425
+ if (!existsSync34(p2))
111240
111426
  continue;
111241
111427
  try {
111242
- const yaml = parseSimpleYaml(readFileSync29(p2, "utf-8"));
111428
+ const yaml = parseSimpleYaml(readFileSync30(p2, "utf-8"));
111243
111429
  const agents = yaml.agents;
111244
111430
  const raw2 = agents?.roster;
111245
111431
  if (Array.isArray(raw2)) {
@@ -111810,7 +111996,7 @@ async function main() {
111810
111996
  initDbAccessor(MEMORY_DB2, { agentsDir: AGENTS_DIR7 });
111811
111997
  syncAgentRoster(AGENTS_DIR7);
111812
111998
  invalidateTraversalCache();
111813
- writeFileSync16(PID_FILE, process.pid.toString());
111999
+ writeFileSync17(PID_FILE, process.pid.toString());
111814
112000
  logger.info("daemon", "Process ID", { pid: process.pid });
111815
112001
  try {
111816
112002
  migrateConfig(AGENTS_DIR7);
@@ -111950,11 +112136,11 @@ async function main() {
111950
112136
  const healthStampPath = join42(DAEMON_DIR, "last-healthy-start");
111951
112137
  try {
111952
112138
  let previousVersion = null;
111953
- if (existsSync33(healthStampPath)) {
111954
- const prev = JSON.parse(readFileSync29(healthStampPath, "utf-8"));
112139
+ if (existsSync34(healthStampPath)) {
112140
+ const prev = JSON.parse(readFileSync30(healthStampPath, "utf-8"));
111955
112141
  previousVersion = typeof prev.version === "string" ? prev.version : null;
111956
112142
  }
111957
- writeFileSync16(healthStampPath, JSON.stringify({
112143
+ writeFileSync17(healthStampPath, JSON.stringify({
111958
112144
  version: CURRENT_VERSION,
111959
112145
  startedAt: new Date().toISOString(),
111960
112146
  pid: process.pid
@@ -111972,7 +112158,7 @@ async function main() {
111972
112158
  logger.error("daemon", "Failed to import existing memory files", undefined, errDetails);
111973
112159
  });
111974
112160
  const claudeProjectsDir = join42(homedir28(), ".claude", "projects");
111975
- if (existsSync33(claudeProjectsDir)) {
112161
+ if (existsSync34(claudeProjectsDir)) {
111976
112162
  syncExistingClaudeMemories(claudeProjectsDir);
111977
112163
  }
111978
112164
  });
@@ -112010,6 +112196,7 @@ var init_daemon = __esm(() => {
112010
112196
  init_memory_timeline();
112011
112197
  init_memory_search();
112012
112198
  init_agent_id();
112199
+ init_file_sync();
112013
112200
  init_onepassword();
112014
112201
  init_temporal_expand();
112015
112202
  init_pipeline();
@@ -112470,7 +112657,7 @@ var init_daemon = __esm(() => {
112470
112657
  const filePath = join42(AGENTS_DIR7, fileName);
112471
112658
  const fileStat = statSync8(filePath);
112472
112659
  if (fileStat.isFile()) {
112473
- const content = readFileSync29(filePath, "utf-8");
112660
+ const content = readFileSync30(filePath, "utf-8");
112474
112661
  files.push({ name: fileName, content, size: fileStat.size });
112475
112662
  }
112476
112663
  }
@@ -112507,7 +112694,7 @@ var init_daemon = __esm(() => {
112507
112694
  if (!file2.endsWith(".md") && !file2.endsWith(".yaml")) {
112508
112695
  return c2.json({ error: "Invalid file type" }, 400);
112509
112696
  }
112510
- writeFileSync16(join42(AGENTS_DIR7, file2), content, "utf-8");
112697
+ writeFileSync17(join42(AGENTS_DIR7, file2), content, "utf-8");
112511
112698
  logger.info("api", "Config file updated", { file: file2 });
112512
112699
  return c2.json({ success: true });
112513
112700
  } catch (e) {
@@ -112517,7 +112704,7 @@ var init_daemon = __esm(() => {
112517
112704
  });
112518
112705
  app.get("/api/identity", (c2) => {
112519
112706
  try {
112520
- const content = readFileSync29(join42(AGENTS_DIR7, "IDENTITY.md"), "utf-8");
112707
+ const content = readFileSync30(join42(AGENTS_DIR7, "IDENTITY.md"), "utf-8");
112521
112708
  const lines = content.split(`
112522
112709
  `);
112523
112710
  const identity3 = {
@@ -114528,19 +114715,19 @@ var init_daemon = __esm(() => {
114528
114715
  name: "Claude Code",
114529
114716
  id: "claude-code",
114530
114717
  path: join42(homedir28(), ".claude", "settings.json"),
114531
- exists: existsSync33(join42(homedir28(), ".claude", "settings.json"))
114718
+ exists: existsSync34(join42(homedir28(), ".claude", "settings.json"))
114532
114719
  },
114533
114720
  {
114534
114721
  name: "OpenCode",
114535
114722
  id: "opencode",
114536
114723
  path: join42(homedir28(), ".config", "opencode", "AGENTS.md"),
114537
- exists: existsSync33(join42(homedir28(), ".config", "opencode", "AGENTS.md"))
114724
+ exists: existsSync34(join42(homedir28(), ".config", "opencode", "AGENTS.md"))
114538
114725
  },
114539
114726
  {
114540
114727
  name: "OpenClaw",
114541
114728
  id: "openclaw",
114542
114729
  path: join42(AGENTS_DIR7, "AGENTS.md"),
114543
- exists: existsSync33(join42(AGENTS_DIR7, "AGENTS.md"))
114730
+ exists: existsSync34(join42(AGENTS_DIR7, "AGENTS.md"))
114544
114731
  },
114545
114732
  {
114546
114733
  name: "Forge",
@@ -114561,7 +114748,7 @@ var init_daemon = __esm(() => {
114561
114748
  app.post("/api/harnesses/regenerate", async (c2) => {
114562
114749
  return new Promise((resolve7) => {
114563
114750
  const script = join42(SCRIPTS_DIR, "generate-harness-configs.py");
114564
- if (!existsSync33(script)) {
114751
+ if (!existsSync34(script)) {
114565
114752
  resolve7(c2.json({ success: false, error: "Regeneration script not found" }, 404));
114566
114753
  return;
114567
114754
  }
@@ -114907,6 +115094,33 @@ var init_daemon = __esm(() => {
114907
115094
  return c2.json({ error: "Hook execution failed" }, 500);
114908
115095
  }
114909
115096
  });
115097
+ app.post("/api/hooks/session-checkpoint-extract", async (c2) => {
115098
+ if (isInternalCall(c2)) {
115099
+ return c2.json({ skipped: true });
115100
+ }
115101
+ try {
115102
+ const body = await c2.req.json();
115103
+ if (!body.harness || !body.sessionKey) {
115104
+ return c2.json({ error: "harness and sessionKey are required" }, 400);
115105
+ }
115106
+ const runtimePath = resolveRuntimePath(c2, body);
115107
+ if (runtimePath)
115108
+ body.runtimePath = runtimePath;
115109
+ const conflict = checkSessionClaim(c2, body.sessionKey, runtimePath);
115110
+ if (conflict)
115111
+ return conflict;
115112
+ stampHarness(body.harness);
115113
+ if (isSessionBypassed(body.sessionKey)) {
115114
+ return c2.json({ skipped: true });
115115
+ }
115116
+ renewSession(body.sessionKey);
115117
+ const result = handleCheckpointExtract(body);
115118
+ return c2.json(result);
115119
+ } catch (e) {
115120
+ logger.error("hooks", "Checkpoint extract hook failed", e);
115121
+ return c2.json({ error: "Hook execution failed" }, 500);
115122
+ }
115123
+ });
114910
115124
  app.post("/api/hooks/remember", async (c2) => {
114911
115125
  if (isInternalCall(c2)) {
114912
115126
  return c2.json({ success: true, memories: [] });
@@ -115009,7 +115223,7 @@ var init_daemon = __esm(() => {
115009
115223
  if (checkBypass(body)) {
115010
115224
  return c2.json({ success: true, bypassed: true });
115011
115225
  }
115012
- if (!existsSync33(MEMORY_DB2)) {
115226
+ if (!existsSync34(MEMORY_DB2)) {
115013
115227
  return c2.json({ error: "Memory database not found" }, 500);
115014
115228
  }
115015
115229
  const now4 = new Date().toISOString();
@@ -115062,6 +115276,25 @@ var init_daemon = __esm(() => {
115062
115276
  if (body.sessionKey) {
115063
115277
  resetPromptDedup(body.sessionKey);
115064
115278
  }
115279
+ if (body.sessionKey) {
115280
+ try {
115281
+ getDbAccessor().withWriteTx((db) => {
115282
+ const hasTx = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='session_transcripts'").get();
115283
+ if (hasTx) {
115284
+ db.prepare("DELETE FROM session_transcripts WHERE session_key = ? AND agent_id = ?").run(body.sessionKey, agentId);
115285
+ }
115286
+ const hasCur = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='session_extract_cursors'").get();
115287
+ if (hasCur) {
115288
+ db.prepare("DELETE FROM session_extract_cursors WHERE session_key = ? AND agent_id = ?").run(body.sessionKey, agentId);
115289
+ }
115290
+ });
115291
+ } catch (err) {
115292
+ logger.warn("hooks", "Failed to reset checkpoint state after compaction (non-fatal)", {
115293
+ error: err instanceof Error ? err.message : String(err),
115294
+ sessionKey: body.sessionKey
115295
+ });
115296
+ }
115297
+ }
115065
115298
  getSynthesisWorker()?.triggerNow({
115066
115299
  force: true,
115067
115300
  source: "compaction-complete",
@@ -116063,8 +116296,8 @@ var init_daemon = __esm(() => {
116063
116296
  let agentCreatedAt = null;
116064
116297
  try {
116065
116298
  for (const p2 of [join42(AGENTS_DIR7, "agent.yaml"), join42(AGENTS_DIR7, "AGENT.yaml")]) {
116066
- if (existsSync33(p2)) {
116067
- const yaml = parseSimpleYaml(readFileSync29(p2, "utf-8"));
116299
+ if (existsSync34(p2)) {
116300
+ const yaml = parseSimpleYaml(readFileSync30(p2, "utf-8"));
116068
116301
  const agent = yaml.agent;
116069
116302
  if (agent?.created) {
116070
116303
  agentCreatedAt = String(agent.created);
@@ -116084,7 +116317,7 @@ var init_daemon = __esm(() => {
116084
116317
  bindHost: BIND_HOST,
116085
116318
  networkMode: NETWORK_MODE,
116086
116319
  agentsDir: AGENTS_DIR7,
116087
- memoryDb: existsSync33(MEMORY_DB2),
116320
+ memoryDb: existsSync34(MEMORY_DB2),
116088
116321
  pipelineV2: config2.pipelineV2,
116089
116322
  providerResolution: providerRuntimeResolution,
116090
116323
  logging: {
@@ -116121,7 +116354,7 @@ var init_daemon = __esm(() => {
116121
116354
  const soulPath = join42(AGENTS_DIR7, "SOUL.md");
116122
116355
  let soulContent = "";
116123
116356
  try {
116124
- soulContent = readFileSync29(soulPath, "utf-8").slice(0, 500);
116357
+ soulContent = readFileSync30(soulPath, "utf-8").slice(0, 500);
116125
116358
  } catch {}
116126
116359
  const hour = new Date().getHours();
116127
116360
  const timeOfDay = hour < 12 ? "morning" : hour < 17 ? "afternoon" : "evening";