@goondocks/myco 0.19.4 → 0.19.6

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 (116) hide show
  1. package/dist/{agent-run-OGWPNU43.js → agent-run-WK5NKBYA.js} +9 -5
  2. package/dist/{agent-run-OGWPNU43.js.map → agent-run-WK5NKBYA.js.map} +1 -1
  3. package/dist/{agent-tasks-XWMDAEPG.js → agent-tasks-2E73GG3A.js} +9 -5
  4. package/dist/{agent-tasks-XWMDAEPG.js.map → agent-tasks-2E73GG3A.js.map} +1 -1
  5. package/dist/{chunk-QLCD77AN.js → chunk-6RFZWV4R.js} +18 -1
  6. package/dist/chunk-6RFZWV4R.js.map +1 -0
  7. package/dist/{chunk-PLYWR5D7.js → chunk-FKBPXCH3.js} +2 -2
  8. package/dist/{chunk-5B2ORGTF.js → chunk-NCBLB2C6.js} +3 -3
  9. package/dist/{chunk-3C4LT4BW.js → chunk-NKQZ73LL.js} +3 -2
  10. package/dist/chunk-NKQZ73LL.js.map +1 -0
  11. package/dist/{chunk-RTNLDAIC.js → chunk-P5VNHGVZ.js} +3 -3
  12. package/dist/chunk-P5VNHGVZ.js.map +1 -0
  13. package/dist/{chunk-W3P6MHLQ.js → chunk-QH5HS54N.js} +2 -2
  14. package/dist/{chunk-NTWJR6KH.js → chunk-ST2D3SGM.js} +2 -2
  15. package/dist/{chunk-WYOE4IAX.js → chunk-TMNFCUAD.js} +81 -8
  16. package/dist/chunk-TMNFCUAD.js.map +1 -0
  17. package/dist/{chunk-YDCGI3CS.js → chunk-VLGBWOBY.js} +3 -3
  18. package/dist/{chunk-Y3IJFUVX.js → chunk-W3JUH5S3.js} +2 -2
  19. package/dist/{cli-XDG624PV.js → cli-LCTXK7N6.js} +41 -37
  20. package/dist/{cli-XDG624PV.js.map → cli-LCTXK7N6.js.map} +1 -1
  21. package/dist/{client-EEPUQVMX.js → client-S47ENM76.js} +3 -3
  22. package/dist/{config-2KQ45OC5.js → config-IO5WALOD.js} +2 -2
  23. package/dist/{doctor-L4LWMJYH.js → doctor-EE6GAC54.js} +11 -7
  24. package/dist/{doctor-L4LWMJYH.js.map → doctor-EE6GAC54.js.map} +1 -1
  25. package/dist/{executor-4TJOZN32.js → executor-NXNSUEMQ.js} +102 -63
  26. package/dist/executor-NXNSUEMQ.js.map +1 -0
  27. package/dist/{init-U2SG2IOC.js → init-IPL3XV6F.js} +9 -9
  28. package/dist/{installer-BWJED3ED.js → installer-WMTB4NCX.js} +8 -2
  29. package/dist/{loader-JG5OBPB6.js → loader-V774GZU4.js} +2 -2
  30. package/dist/{main-EVS3FXDJ.js → main-RPJSS7PT.js} +284 -117
  31. package/dist/main-RPJSS7PT.js.map +1 -0
  32. package/dist/{open-TEQZXO4A.js → open-OYBKVBYX.js} +9 -5
  33. package/dist/{open-TEQZXO4A.js.map → open-OYBKVBYX.js.map} +1 -1
  34. package/dist/{post-compact-POSTGJEV.js → post-compact-E2OVMNGQ.js} +4 -4
  35. package/dist/{post-tool-use-VE6YPEY2.js → post-tool-use-FGQE26GJ.js} +3 -3
  36. package/dist/{post-tool-use-failure-LUFD62SB.js → post-tool-use-failure-3CITJYQK.js} +4 -4
  37. package/dist/{pre-compact-7QGJYRJF.js → pre-compact-GYMHCXII.js} +4 -4
  38. package/dist/{remove-4UZXDSVY.js → remove-72ER3TG5.js} +6 -6
  39. package/dist/{restart-HLXD4ZGX.js → restart-EQHEJCGT.js} +10 -6
  40. package/dist/{restart-HLXD4ZGX.js.map → restart-EQHEJCGT.js.map} +1 -1
  41. package/dist/{search-MWXY3GTI.js → search-JOBYIW43.js} +9 -5
  42. package/dist/{search-MWXY3GTI.js.map → search-JOBYIW43.js.map} +1 -1
  43. package/dist/{server-TQY7CYOS.js → server-PZCWYWZL.js} +3 -3
  44. package/dist/{session-P2POKO22.js → session-APO4A2C7.js} +9 -5
  45. package/dist/{session-P2POKO22.js.map → session-APO4A2C7.js.map} +1 -1
  46. package/dist/{session-end-DZNJHGQB.js → session-end-4V4VHAOQ.js} +3 -3
  47. package/dist/{session-start-JNNJTP3C.js → session-start-K6ESRZU7.js} +4 -4
  48. package/dist/{setup-llm-UQO2INBY.js → setup-llm-QUWOSB7A.js} +6 -6
  49. package/dist/src/agent/definitions/tasks/full-intelligence.yaml +37 -8
  50. package/dist/src/agent/prompts/agent.md +2 -2
  51. package/dist/src/cli.js +1 -1
  52. package/dist/src/daemon/main.js +1 -1
  53. package/dist/src/hooks/post-tool-use.js +1 -1
  54. package/dist/src/hooks/session-end.js +1 -1
  55. package/dist/src/hooks/session-start.js +1 -1
  56. package/dist/src/hooks/stop.js +1 -1
  57. package/dist/src/hooks/user-prompt-submit.js +1 -1
  58. package/dist/src/mcp/server.js +1 -1
  59. package/dist/{stats-DJYTDCUE.js → stats-TYOZAOP2.js} +7 -7
  60. package/dist/{stop-VBA4RMQM.js → stop-2COOWEYG.js} +3 -3
  61. package/dist/{stop-failure-54Z2HSU4.js → stop-failure-UQ33GZLE.js} +4 -4
  62. package/dist/{subagent-start-XL773ZID.js → subagent-start-YENEY6VF.js} +4 -4
  63. package/dist/{subagent-stop-HJVSYNII.js → subagent-stop-W2757YDB.js} +4 -4
  64. package/dist/{task-completed-GLNYNBYP.js → task-completed-KU6GWMWV.js} +4 -4
  65. package/dist/{team-M6TC4TFC.js → team-SNLC6FZM.js} +3 -3
  66. package/dist/{turns-3ZQAF6HF.js → turns-YFNI5CQC.js} +6 -4
  67. package/dist/ui/assets/index-816yFmz_.js +842 -0
  68. package/dist/ui/assets/index-Dj6vQpFd.css +1 -0
  69. package/dist/ui/index.html +2 -2
  70. package/dist/{update-JZV2K4YG.js → update-5VYNQZJ4.js} +6 -6
  71. package/dist/update-5VYNQZJ4.js.map +1 -0
  72. package/dist/{user-prompt-submit-6KMTMHKW.js → user-prompt-submit-KATLHAKA.js} +3 -3
  73. package/dist/{verify-CJHF23QH.js → verify-BGJVB3K2.js} +2 -2
  74. package/dist/{version-KS3UADP5.js → version-MKNN5GYM.js} +2 -2
  75. package/package.json +1 -1
  76. package/skills/rules/SKILL.md +6 -0
  77. package/dist/chunk-3C4LT4BW.js.map +0 -1
  78. package/dist/chunk-QLCD77AN.js.map +0 -1
  79. package/dist/chunk-RTNLDAIC.js.map +0 -1
  80. package/dist/chunk-WYOE4IAX.js.map +0 -1
  81. package/dist/executor-4TJOZN32.js.map +0 -1
  82. package/dist/main-EVS3FXDJ.js.map +0 -1
  83. package/dist/ui/assets/index-CRmkSi63.css +0 -1
  84. package/dist/ui/assets/index-CwPuGRsJ.js +0 -842
  85. package/dist/update-JZV2K4YG.js.map +0 -1
  86. /package/dist/{chunk-PLYWR5D7.js.map → chunk-FKBPXCH3.js.map} +0 -0
  87. /package/dist/{chunk-5B2ORGTF.js.map → chunk-NCBLB2C6.js.map} +0 -0
  88. /package/dist/{chunk-W3P6MHLQ.js.map → chunk-QH5HS54N.js.map} +0 -0
  89. /package/dist/{chunk-NTWJR6KH.js.map → chunk-ST2D3SGM.js.map} +0 -0
  90. /package/dist/{chunk-YDCGI3CS.js.map → chunk-VLGBWOBY.js.map} +0 -0
  91. /package/dist/{chunk-Y3IJFUVX.js.map → chunk-W3JUH5S3.js.map} +0 -0
  92. /package/dist/{client-EEPUQVMX.js.map → client-S47ENM76.js.map} +0 -0
  93. /package/dist/{config-2KQ45OC5.js.map → config-IO5WALOD.js.map} +0 -0
  94. /package/dist/{init-U2SG2IOC.js.map → init-IPL3XV6F.js.map} +0 -0
  95. /package/dist/{installer-BWJED3ED.js.map → installer-WMTB4NCX.js.map} +0 -0
  96. /package/dist/{loader-JG5OBPB6.js.map → loader-V774GZU4.js.map} +0 -0
  97. /package/dist/{post-compact-POSTGJEV.js.map → post-compact-E2OVMNGQ.js.map} +0 -0
  98. /package/dist/{post-tool-use-VE6YPEY2.js.map → post-tool-use-FGQE26GJ.js.map} +0 -0
  99. /package/dist/{post-tool-use-failure-LUFD62SB.js.map → post-tool-use-failure-3CITJYQK.js.map} +0 -0
  100. /package/dist/{pre-compact-7QGJYRJF.js.map → pre-compact-GYMHCXII.js.map} +0 -0
  101. /package/dist/{remove-4UZXDSVY.js.map → remove-72ER3TG5.js.map} +0 -0
  102. /package/dist/{server-TQY7CYOS.js.map → server-PZCWYWZL.js.map} +0 -0
  103. /package/dist/{session-end-DZNJHGQB.js.map → session-end-4V4VHAOQ.js.map} +0 -0
  104. /package/dist/{session-start-JNNJTP3C.js.map → session-start-K6ESRZU7.js.map} +0 -0
  105. /package/dist/{setup-llm-UQO2INBY.js.map → setup-llm-QUWOSB7A.js.map} +0 -0
  106. /package/dist/{stats-DJYTDCUE.js.map → stats-TYOZAOP2.js.map} +0 -0
  107. /package/dist/{stop-VBA4RMQM.js.map → stop-2COOWEYG.js.map} +0 -0
  108. /package/dist/{stop-failure-54Z2HSU4.js.map → stop-failure-UQ33GZLE.js.map} +0 -0
  109. /package/dist/{subagent-start-XL773ZID.js.map → subagent-start-YENEY6VF.js.map} +0 -0
  110. /package/dist/{subagent-stop-HJVSYNII.js.map → subagent-stop-W2757YDB.js.map} +0 -0
  111. /package/dist/{task-completed-GLNYNBYP.js.map → task-completed-KU6GWMWV.js.map} +0 -0
  112. /package/dist/{team-M6TC4TFC.js.map → team-SNLC6FZM.js.map} +0 -0
  113. /package/dist/{turns-3ZQAF6HF.js.map → turns-YFNI5CQC.js.map} +0 -0
  114. /package/dist/{user-prompt-submit-6KMTMHKW.js.map → user-prompt-submit-KATLHAKA.js.map} +0 -0
  115. /package/dist/{verify-CJHF23QH.js.map → verify-BGJVB3K2.js.map} +0 -0
  116. /package/dist/{version-KS3UADP5.js.map → version-MKNN5GYM.js.map} +0 -0
@@ -40,9 +40,10 @@ import {
40
40
  updateSkillRecord,
41
41
  upsertDigestExtract,
42
42
  validateSkillContent
43
- } from "./chunk-RTNLDAIC.js";
43
+ } from "./chunk-P5VNHGVZ.js";
44
44
  import {
45
- fullTextSearch
45
+ fullTextSearch,
46
+ hydrateSearchResults
46
47
  } from "./chunk-7ONVLO43.js";
47
48
  import "./chunk-KYH4V4ML.js";
48
49
  import {
@@ -50,8 +51,9 @@ import {
50
51
  loadSystemPrompt
51
52
  } from "./chunk-Q4QD6LJT.js";
52
53
  import {
53
- insertTurn
54
- } from "./chunk-QLCD77AN.js";
54
+ insertTurn,
55
+ updateTurn
56
+ } from "./chunk-6RFZWV4R.js";
55
57
  import {
56
58
  insertResolutionEvent
57
59
  } from "./chunk-VQF5E4ZX.js";
@@ -65,6 +67,7 @@ import {
65
67
  import "./chunk-POEPHBQK.js";
66
68
  import {
67
69
  DEFAULT_IMPORTANCE,
70
+ getSpore,
68
71
  insertSpore,
69
72
  listSpores,
70
73
  updateSporeStatus
@@ -80,7 +83,7 @@ import {
80
83
  CANDIDATE_STATUS,
81
84
  createSchema
82
85
  } from "./chunk-6DDRJQ4X.js";
83
- import "./chunk-3C4LT4BW.js";
86
+ import "./chunk-NKQZ73LL.js";
84
87
  import {
85
88
  getDatabase,
86
89
  initDatabase,
@@ -88,7 +91,7 @@ import {
88
91
  } from "./chunk-MYX5NCRH.js";
89
92
  import {
90
93
  getPluginVersion
91
- } from "./chunk-NTWJR6KH.js";
94
+ } from "./chunk-ST2D3SGM.js";
92
95
  import {
93
96
  findPackageRoot
94
97
  } from "./chunk-LPUQPDC2.js";
@@ -132,7 +135,7 @@ var DEFAULT_SEARCH_LIMIT = 10;
132
135
  var DEFAULT_ENTITIES_LIMIT = 50;
133
136
  var DEFAULT_EDGES_LIMIT = 50;
134
137
  function createReadTools(deps) {
135
- const { agentId, embeddingManager, teamClient, machineId, recordTurn } = deps;
138
+ const { agentId, embeddingManager, teamClient, machineId } = deps;
136
139
  const vaultUnprocessed = tool(
137
140
  "vault_unprocessed",
138
141
  "Get unprocessed prompt batches, ordered by id ASC. Supports cursor-based pagination. Batches from in-flight sessions are excluded by default so intelligence tasks only process settled work; pass include_active=true only if you specifically need live data (e.g., title-summary).",
@@ -142,7 +145,6 @@ function createReadTools(deps) {
142
145
  include_active: external_exports.boolean().optional().describe("Include batches from sessions still in active status (default: false)")
143
146
  },
144
147
  async (args) => {
145
- recordTurn("vault_unprocessed", args);
146
148
  const batches = getUnprocessedBatches({
147
149
  after_id: args.after_id,
148
150
  limit: args.limit ?? DEFAULT_UNPROCESSED_LIMIT,
@@ -154,8 +156,9 @@ function createReadTools(deps) {
154
156
  );
155
157
  const vaultSpores = tool(
156
158
  "vault_spores",
157
- "List spores with optional filters (agent, observation type, status, session). Spores from in-flight sessions are excluded by default; passing a specific session_id bypasses this filter. Pass include_active=true to bulk-read live work.",
159
+ "List spores with optional filters (agent, observation type, status, session), or fetch exact spores by id for full-content inspection after a semantic shortlist. Spores from in-flight sessions are excluded by default; passing a specific session_id or ids bypasses this filter. Pass include_active=true to bulk-read live work.",
158
160
  {
161
+ ids: external_exports.array(external_exports.string()).optional().describe("Fetch exact spores by id in the given order; bypasses active-session gating"),
159
162
  agent_id: external_exports.string().optional().describe("Filter by agent ID"),
160
163
  observation_type: external_exports.string().optional().describe("Filter by observation type (e.g., gotcha, decision)"),
161
164
  status: external_exports.enum(["active", "superseded", "archived"]).optional().describe("Filter by status"),
@@ -164,7 +167,10 @@ function createReadTools(deps) {
164
167
  include_active: external_exports.boolean().optional().describe("Include spores from sessions still in active status (default: false)")
165
168
  },
166
169
  async (args) => {
167
- recordTurn("vault_spores", args);
170
+ if (args.ids && args.ids.length > 0) {
171
+ const spores2 = args.ids.map((id) => getSpore(id)).filter((spore) => spore !== null);
172
+ return textResult(spores2);
173
+ }
168
174
  const spores = listSpores({
169
175
  agent_id: args.agent_id,
170
176
  observation_type: args.observation_type,
@@ -186,7 +192,6 @@ function createReadTools(deps) {
186
192
  include_active: external_exports.boolean().optional().describe("Include sessions still in active status (default: false)")
187
193
  },
188
194
  async (args) => {
189
- recordTurn("vault_sessions", args);
190
195
  const sessions = listSessions({
191
196
  limit: args.limit ?? DEFAULT_SESSIONS_LIMIT,
192
197
  status: args.status,
@@ -206,7 +211,6 @@ function createReadTools(deps) {
206
211
  include_active: external_exports.boolean().optional().describe("Include results from sessions still in active status (default: false)")
207
212
  },
208
213
  async (args) => {
209
- recordTurn("vault_search_fts", args);
210
214
  try {
211
215
  const results = fullTextSearch(args.query, {
212
216
  type: args.type,
@@ -230,7 +234,6 @@ function createReadTools(deps) {
230
234
  include_active: external_exports.boolean().optional().describe("Include results from sessions still in active status (default: false)")
231
235
  },
232
236
  async (args) => {
233
- recordTurn("vault_search_semantic", args);
234
237
  if (!embeddingManager) {
235
238
  return textResult({ results: [], message: "Embedding provider unavailable" });
236
239
  }
@@ -241,7 +244,8 @@ function createReadTools(deps) {
241
244
  }
242
245
  const searchLimit = args.limit ?? DEFAULT_SEARCH_LIMIT;
243
246
  const excludeActive = args.include_active !== true;
244
- const [localResults, teamResults] = await Promise.all([
247
+ const activeIds = excludeActive ? getActiveSessionIds() : /* @__PURE__ */ new Set();
248
+ const [rawLocalResults, teamResults] = await Promise.all([
245
249
  Promise.resolve(
246
250
  embeddingManager.searchVectors(queryVector, {
247
251
  namespace: args.namespace,
@@ -251,21 +255,26 @@ function createReadTools(deps) {
251
255
  ),
252
256
  teamClient ? teamClient.search(args.query, { limit: searchLimit }).then((res) => res.results.map((r) => ({ ...r, source: `${TEAM_SOURCE_PREFIX}${r.machine_id}` }))).catch(() => []) : Promise.resolve([])
253
257
  ]);
254
- const dedupedTeam = machineId ? teamResults.filter((r) => r.machine_id !== machineId) : teamResults;
255
- let merged = [
256
- ...localResults.map((r) => ({ ...r, score: r.similarity })),
257
- ...dedupedTeam
258
- ].sort((a, b) => (b.score ?? 0) - (a.score ?? 0));
259
- if (excludeActive) {
260
- const activeIds = getActiveSessionIds();
261
- if (activeIds.size > 0) {
262
- merged = merged.filter((r) => {
263
- const sid = r.metadata?.session_id;
264
- return typeof sid !== "string" || !activeIds.has(sid);
265
- });
266
- }
258
+ const localResults = activeIds.size > 0 ? rawLocalResults.filter((r) => {
259
+ const sid = r.metadata?.session_id;
260
+ return typeof sid !== "string" || !activeIds.has(sid);
261
+ }) : rawLocalResults;
262
+ const hydratedLocalResults = hydrateSearchResults(localResults).map((r) => ({
263
+ ...r,
264
+ source: "local"
265
+ }));
266
+ let dedupedTeam = machineId ? teamResults.filter((r) => r.machine_id !== machineId) : teamResults;
267
+ if (activeIds.size > 0) {
268
+ dedupedTeam = dedupedTeam.filter((r) => {
269
+ const sid = r.metadata?.session_id;
270
+ return typeof sid !== "string" || !activeIds.has(sid);
271
+ });
267
272
  }
268
- return textResult({ results: merged.slice(0, searchLimit) });
273
+ const merged = [
274
+ ...hydratedLocalResults,
275
+ ...dedupedTeam
276
+ ].sort((a, b) => (b.score ?? 0) - (a.score ?? 0)).slice(0, searchLimit);
277
+ return textResult({ results: merged });
269
278
  } catch {
270
279
  return textResult({ results: [], message: "Semantic search unavailable" });
271
280
  }
@@ -277,7 +286,6 @@ function createReadTools(deps) {
277
286
  "Get all state key-value pairs for the current agent.",
278
287
  {},
279
288
  async () => {
280
- recordTurn("vault_state", {});
281
289
  const states = getStatesForAgent(agentId);
282
290
  return textResult(states);
283
291
  },
@@ -292,7 +300,6 @@ function createReadTools(deps) {
292
300
  limit: external_exports.number().optional().describe("Maximum entities to return")
293
301
  },
294
302
  async (args) => {
295
- recordTurn("vault_entities", args);
296
303
  const entities = listEntities({
297
304
  agent_id: agentId,
298
305
  type: args.type,
@@ -313,7 +320,6 @@ function createReadTools(deps) {
313
320
  limit: external_exports.number().optional().describe("Maximum edges to return")
314
321
  },
315
322
  async (args) => {
316
- recordTurn("vault_edges", args);
317
323
  const edges = listGraphEdges({
318
324
  sourceId: args.source_id,
319
325
  targetId: args.target_id,
@@ -341,7 +347,7 @@ function createReadTools(deps) {
341
347
  import crypto from "crypto";
342
348
  import { tool as tool2 } from "@anthropic-ai/claude-agent-sdk";
343
349
  function createWriteTools(deps) {
344
- const { agentId, embeddingManager, machineId, recordTurn } = deps;
350
+ const { agentId, embeddingManager, machineId } = deps;
345
351
  const vaultCreateSpore = tool2(
346
352
  "vault_create_spore",
347
353
  "Create a new spore (observation) in the vault. The agent_id is set automatically.",
@@ -384,7 +390,6 @@ function createWriteTools(deps) {
384
390
  session_id: args.session_id
385
391
  }).catch(() => {
386
392
  });
387
- recordTurn("vault_create_spore", args);
388
393
  return textResult(spore);
389
394
  },
390
395
  { annotations: { openWorldHint: true } }
@@ -411,7 +416,6 @@ function createWriteTools(deps) {
411
416
  first_seen: now,
412
417
  last_seen: now
413
418
  });
414
- recordTurn("vault_create_entity", args);
415
419
  return textResult(entity);
416
420
  },
417
421
  { annotations: { idempotentHint: true } }
@@ -445,7 +449,6 @@ function createWriteTools(deps) {
445
449
  properties: props,
446
450
  created_at: now
447
451
  });
448
- recordTurn("vault_create_edge", args);
449
452
  return textResult(edge);
450
453
  },
451
454
  { annotations: { idempotentHint: true } }
@@ -489,7 +492,6 @@ function createWriteTools(deps) {
489
492
  } catch {
490
493
  }
491
494
  }
492
- recordTurn("vault_resolve_spore", args);
493
495
  return textResult({ spore: updatedSpore, resolution_event_id: eventId });
494
496
  },
495
497
  { annotations: { destructiveHint: true } }
@@ -511,7 +513,6 @@ function createWriteTools(deps) {
511
513
  embeddingManager?.onContentWritten("sessions", args.session_id, args.summary, {}).catch(() => {
512
514
  });
513
515
  }
514
- recordTurn("vault_update_session", args);
515
516
  return textResult(session);
516
517
  },
517
518
  { annotations: { idempotentHint: true } }
@@ -526,7 +527,6 @@ function createWriteTools(deps) {
526
527
  async (args) => {
527
528
  const now = epochSeconds();
528
529
  const state = setState(agentId, args.key, args.value, now);
529
- recordTurn("vault_set_state", args);
530
530
  return textResult(state);
531
531
  },
532
532
  { annotations: { idempotentHint: true } }
@@ -538,7 +538,6 @@ function createWriteTools(deps) {
538
538
  tier: external_exports.number().optional().describe("Specific tier to read in full (e.g., 1500, 5000, 10000). Omit to get summary of all tiers.")
539
539
  },
540
540
  async (args) => {
541
- recordTurn("vault_read_digest", args);
542
541
  const extracts = listDigestExtracts(agentId);
543
542
  if (args.tier !== void 0) {
544
543
  const extract = extracts.find((e) => e.tier === args.tier);
@@ -568,7 +567,6 @@ function createWriteTools(deps) {
568
567
  content: args.content,
569
568
  generated_at: now
570
569
  });
571
- recordTurn("vault_write_digest", args);
572
570
  return textResult(extract);
573
571
  },
574
572
  { annotations: { idempotentHint: true } }
@@ -581,7 +579,6 @@ function createWriteTools(deps) {
581
579
  },
582
580
  async (args) => {
583
581
  const batch = markBatchProcessed(args.batch_id);
584
- recordTurn("vault_mark_processed", args);
585
582
  return textResult(batch);
586
583
  },
587
584
  { annotations: { destructiveHint: true } }
@@ -602,7 +599,7 @@ function createWriteTools(deps) {
602
599
  // src/agent/tools/observability-tools.ts
603
600
  import { tool as tool3 } from "@anthropic-ai/claude-agent-sdk";
604
601
  function createObservabilityTools(deps) {
605
- const { runId, agentId, recordTurn } = deps;
602
+ const { runId, agentId } = deps;
606
603
  const vaultReport = tool3(
607
604
  "vault_report",
608
605
  'Record an observability report for the current run. Use action "skip" when skipping expected operations (e.g., not updating a session summary) with reasoning in the summary field.',
@@ -612,7 +609,6 @@ function createObservabilityTools(deps) {
612
609
  details: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("Structured details as key-value pairs")
613
610
  },
614
611
  async (args) => {
615
- recordTurn("vault_report", args);
616
612
  const now = epochSeconds();
617
613
  const report = insertReport({
618
614
  run_id: runId,
@@ -635,7 +631,7 @@ import { readFileSync, writeFileSync, mkdirSync, rmSync, existsSync } from "fs";
635
631
  import { resolve } from "path";
636
632
  import { tool as tool4 } from "@anthropic-ai/claude-agent-sdk";
637
633
  function createSkillTools(deps) {
638
- const { agentId, machineId, projectRoot, vaultDir, recordTurn, embeddingManager } = deps;
634
+ const { agentId, machineId, projectRoot, vaultDir, embeddingManager } = deps;
639
635
  function findOverlappingCandidate(newTopic, existing) {
640
636
  let best = null;
641
637
  for (const candidate of existing) {
@@ -754,7 +750,7 @@ function createSkillTools(deps) {
754
750
  );
755
751
  }
756
752
  try {
757
- const { syncSkillSymlinks } = await import("./installer-BWJED3ED.js");
753
+ const { syncSkillSymlinks } = await import("./installer-WMTB4NCX.js");
758
754
  syncSkillSymlinks(root, params.name, { remove: true });
759
755
  } catch (rollbackErr) {
760
756
  console.warn(
@@ -772,7 +768,7 @@ function createSkillTools(deps) {
772
768
  };
773
769
  }
774
770
  try {
775
- const { syncSkillSymlinks } = await import("./installer-BWJED3ED.js");
771
+ const { syncSkillSymlinks } = await import("./installer-WMTB4NCX.js");
776
772
  syncSkillSymlinks(root, params.name);
777
773
  } catch (err) {
778
774
  console.warn(
@@ -853,7 +849,6 @@ function createSkillTools(deps) {
853
849
  limit: external_exports.number().optional().describe("Maximum candidates to return (for list)")
854
850
  },
855
851
  async (args) => {
856
- recordTurn("vault_skill_candidates", args);
857
852
  switch (args.action) {
858
853
  case "list": {
859
854
  const candidates = listCandidates({
@@ -986,7 +981,6 @@ function createSkillTools(deps) {
986
981
  limit: external_exports.number().optional().describe("Maximum records to return (for list)")
987
982
  },
988
983
  async (args) => {
989
- recordTurn("vault_skill_records", args);
990
984
  switch (args.action) {
991
985
  case "list": {
992
986
  const records = listSkillRecords({
@@ -1041,7 +1035,7 @@ function createSkillTools(deps) {
1041
1035
  console.warn("[vault_skill_records] Failed to remove skill directory:", err instanceof Error ? err.message : err);
1042
1036
  }
1043
1037
  try {
1044
- const { syncSkillSymlinks } = await import("./installer-BWJED3ED.js");
1038
+ const { syncSkillSymlinks } = await import("./installer-WMTB4NCX.js");
1045
1039
  syncSkillSymlinks(root, result.name, { remove: true });
1046
1040
  } catch (err) {
1047
1041
  console.warn("[vault_skill_records] Failed to remove symlinks:", err instanceof Error ? err.message : err);
@@ -1070,14 +1064,12 @@ function createSkillTools(deps) {
1070
1064
  async (args) => {
1071
1065
  const validationErrors = validateSkillContent(args.content, args.name);
1072
1066
  if (validationErrors.length > 0) {
1073
- recordTurn("vault_write_skill", args);
1074
1067
  return textResult({
1075
1068
  error: "Skill validation failed. Fix these issues and try again.",
1076
1069
  issues: validationErrors
1077
1070
  });
1078
1071
  }
1079
1072
  if (!args.name || /[/\\]|\.\./.test(args.name)) {
1080
- recordTurn("vault_write_skill", args);
1081
1073
  return textResult({
1082
1074
  error: 'Invalid skill name: must be a simple directory name without path separators or ".."'
1083
1075
  });
@@ -1088,7 +1080,6 @@ function createSkillTools(deps) {
1088
1080
  description: args.description
1089
1081
  });
1090
1082
  if (dedupError) {
1091
- recordTurn("vault_write_skill", args);
1092
1083
  return textResult(dedupError);
1093
1084
  }
1094
1085
  const existing = getSkillRecordByName(args.name);
@@ -1098,7 +1089,6 @@ function createSkillTools(deps) {
1098
1089
  const existingContent = readFileSync(skillPath, "utf-8");
1099
1090
  const violations = checkFrontmatterPreservation(existingContent, args.content);
1100
1091
  if (violations.length > 0) {
1101
- recordTurn("vault_write_skill", args);
1102
1092
  return textResult({
1103
1093
  error: "Skill update rejected: protected frontmatter fields were changed. Read the existing skill and preserve these values exactly.",
1104
1094
  violations
@@ -1109,7 +1099,6 @@ function createSkillTools(deps) {
1109
1099
  if (args.candidate_id) {
1110
1100
  const candidateError = requireApprovedCandidate(args.candidate_id);
1111
1101
  if (candidateError) {
1112
- recordTurn("vault_write_skill", args);
1113
1102
  return textResult(candidateError);
1114
1103
  }
1115
1104
  }
@@ -1142,7 +1131,6 @@ function createSkillTools(deps) {
1142
1131
  linkCandidate,
1143
1132
  label: "vault_write_skill"
1144
1133
  });
1145
- recordTurn("vault_write_skill", args);
1146
1134
  if ("error" in result) return textResult(result);
1147
1135
  emitSkillNotification("created", {
1148
1136
  name: result.name,
@@ -1165,7 +1153,7 @@ function createSkillTools(deps) {
1165
1153
  return textResult({ error: `Failed to write skill file: ${err instanceof Error ? err.message : String(err)}` });
1166
1154
  }
1167
1155
  try {
1168
- const { syncSkillSymlinks } = await import("./installer-BWJED3ED.js");
1156
+ const { syncSkillSymlinks } = await import("./installer-WMTB4NCX.js");
1169
1157
  syncSkillSymlinks(root, args.name);
1170
1158
  } catch (err) {
1171
1159
  console.warn("[vault_write_skill] syncSkillSymlinks failed:", err instanceof Error ? err.message : err);
@@ -1205,7 +1193,6 @@ function createSkillTools(deps) {
1205
1193
  rollbackErr instanceof Error ? rollbackErr.message : rollbackErr
1206
1194
  );
1207
1195
  }
1208
- recordTurn("vault_write_skill", args);
1209
1196
  return textResult({
1210
1197
  error: `Skill write aborted: database transaction failed and on-disk state was rolled back. ${err instanceof Error ? err.message : String(err)}`
1211
1198
  });
@@ -1222,7 +1209,6 @@ function createSkillTools(deps) {
1222
1209
  name: args.name
1223
1210
  }).catch(() => {
1224
1211
  });
1225
- recordTurn("vault_write_skill", args);
1226
1212
  return textResult({
1227
1213
  id: recordId,
1228
1214
  name: args.name,
@@ -1247,7 +1233,6 @@ function createSkillTools(deps) {
1247
1233
  rationale: external_exports.string().optional().describe("Why this skill is being created \u2014 stored in lineage after finalize")
1248
1234
  },
1249
1235
  async (args) => {
1250
- recordTurn("vault_stage_skill", args);
1251
1236
  if (!vaultDir) {
1252
1237
  return textResult({
1253
1238
  error: "vault_stage_skill requires vaultDir on the tool deps \u2014 staging has no location otherwise"
@@ -1306,7 +1291,6 @@ function createSkillTools(deps) {
1306
1291
  candidate_id: external_exports.string().describe("Candidate ID whose staged skill should be promoted. Must match a previous vault_stage_skill call.")
1307
1292
  },
1308
1293
  async (args) => {
1309
- recordTurn("vault_finalize_skill", args);
1310
1294
  if (!vaultDir) {
1311
1295
  return textResult({
1312
1296
  error: "vault_finalize_skill requires vaultDir on the tool deps"
@@ -1409,6 +1393,7 @@ var SKILL_TOOL_NAMES = /* @__PURE__ */ new Set([
1409
1393
  "vault_stage_skill",
1410
1394
  "vault_finalize_skill"
1411
1395
  ]);
1396
+ var TOOL_OUTPUT_SUMMARY_LIMIT = 240;
1412
1397
  var VAULT_TOOL_COUNT = READ_TOOL_NAMES.size + WRITE_TOOL_NAMES.size + OBSERVABILITY_TOOL_NAMES.size + SKILL_TOOL_NAMES.size;
1413
1398
  function setsOverlap(a, b) {
1414
1399
  for (const item of a) {
@@ -1416,13 +1401,31 @@ function setsOverlap(a, b) {
1416
1401
  }
1417
1402
  return false;
1418
1403
  }
1404
+ function truncateSummary(text) {
1405
+ if (!text) return null;
1406
+ return text.length > TOOL_OUTPUT_SUMMARY_LIMIT ? `${text.slice(0, TOOL_OUTPUT_SUMMARY_LIMIT - 1)}\u2026` : text;
1407
+ }
1408
+ function summarizeToolResult(result) {
1409
+ if (!result || typeof result !== "object") return null;
1410
+ const content = result.content;
1411
+ if (!Array.isArray(content) || content.length === 0) return null;
1412
+ const first = content[0];
1413
+ if (!first || first.type !== "text" || typeof first.text !== "string") return null;
1414
+ return truncateSummary(first.text.replace(/\s+/g, " ").trim());
1415
+ }
1416
+ function summarizeToolError(error) {
1417
+ if (error instanceof Error && error.message) {
1418
+ return truncateSummary(error.message) ?? "Tool failed";
1419
+ }
1420
+ return truncateSummary(String(error)) ?? "Tool failed";
1421
+ }
1419
1422
  function createVaultTools(agentId, runId, options) {
1420
1423
  const { turnOffset = 0, embeddingManager, teamClient, machineId, projectRoot, vaultDir, onlyNames } = options ?? {};
1421
1424
  let turnCounter = turnOffset;
1422
1425
  function recordTurn(toolName, toolInput) {
1423
1426
  turnCounter++;
1424
1427
  try {
1425
- insertTurn({
1428
+ const turn = insertTurn({
1426
1429
  run_id: runId,
1427
1430
  agent_id: agentId,
1428
1431
  turn_number: turnCounter,
@@ -1430,7 +1433,9 @@ function createVaultTools(agentId, runId, options) {
1430
1433
  tool_input: JSON.stringify(toolInput),
1431
1434
  started_at: epochSeconds()
1432
1435
  });
1436
+ return turn.id;
1433
1437
  } catch {
1438
+ return null;
1434
1439
  }
1435
1440
  }
1436
1441
  const deps = {
@@ -1444,12 +1449,46 @@ function createVaultTools(agentId, runId, options) {
1444
1449
  recordTurn
1445
1450
  };
1446
1451
  const needsAll = !onlyNames;
1447
- return [
1452
+ const tools = [
1448
1453
  ...needsAll || setsOverlap(onlyNames, READ_TOOL_NAMES) ? createReadTools(deps) : [],
1449
1454
  ...needsAll || setsOverlap(onlyNames, WRITE_TOOL_NAMES) ? createWriteTools(deps) : [],
1450
1455
  ...needsAll || setsOverlap(onlyNames, OBSERVABILITY_TOOL_NAMES) ? createObservabilityTools(deps) : [],
1451
1456
  ...needsAll || setsOverlap(onlyNames, SKILL_TOOL_NAMES) ? createSkillTools(deps) : []
1452
1457
  ];
1458
+ return tools.map((toolDef) => wrapToolWithAudit(toolDef));
1459
+ function wrapToolWithAudit(toolDef) {
1460
+ const originalHandler = toolDef.handler;
1461
+ return {
1462
+ ...toolDef,
1463
+ handler: async (args, extra) => {
1464
+ const turnId = recordTurn(toolDef.name, args);
1465
+ try {
1466
+ const result = await originalHandler(args, extra);
1467
+ if (turnId !== null) {
1468
+ try {
1469
+ updateTurn(turnId, {
1470
+ tool_output_summary: summarizeToolResult(result),
1471
+ completed_at: epochSeconds()
1472
+ });
1473
+ } catch {
1474
+ }
1475
+ }
1476
+ return result;
1477
+ } catch (error) {
1478
+ if (turnId !== null) {
1479
+ try {
1480
+ updateTurn(turnId, {
1481
+ tool_output_summary: summarizeToolError(error),
1482
+ completed_at: epochSeconds()
1483
+ });
1484
+ } catch {
1485
+ }
1486
+ }
1487
+ throw error;
1488
+ }
1489
+ }
1490
+ };
1491
+ }
1453
1492
  }
1454
1493
  function createVaultToolServer(agentId, runId, options) {
1455
1494
  const tools = createVaultTools(agentId, runId, options);
@@ -2431,4 +2470,4 @@ export {
2431
2470
  computeWaves,
2432
2471
  runAgent
2433
2472
  };
2434
- //# sourceMappingURL=executor-4TJOZN32.js.map
2473
+ //# sourceMappingURL=executor-NXNSUEMQ.js.map