@goondocks/myco 0.13.0 → 0.14.1

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 (121) hide show
  1. package/dist/{agent-run-YBASQHC7.js → agent-run-VX5MAPRN.js} +4 -4
  2. package/dist/{agent-tasks-WBQFDHWC.js → agent-tasks-FJOBYYC5.js} +4 -4
  3. package/dist/{chunk-NCVR636M.js → chunk-4VF6KQ2Z.js} +55 -4
  4. package/dist/chunk-4VF6KQ2Z.js.map +1 -0
  5. package/dist/{chunk-EUQQVKGQ.js → chunk-CCKPBAKJ.js} +2 -2
  6. package/dist/{chunk-5BK6M6X5.js → chunk-JJXVDCEX.js} +160 -95
  7. package/dist/chunk-JJXVDCEX.js.map +1 -0
  8. package/dist/{chunk-VQEXXS56.js → chunk-NYTEHLVI.js} +2 -2
  9. package/dist/{chunk-W3T3QDBN.js → chunk-PSYLKCWQ.js} +17 -2
  10. package/dist/chunk-PSYLKCWQ.js.map +1 -0
  11. package/dist/{chunk-LPISXFM4.js → chunk-PX5KIOKY.js} +2 -2
  12. package/dist/{chunk-T77674VB.js → chunk-QB2UTRQE.js} +3 -3
  13. package/dist/chunk-QLCD77AN.js +93 -0
  14. package/dist/chunk-QLCD77AN.js.map +1 -0
  15. package/dist/{chunk-TFGGH6UB.js → chunk-RUDOGKWF.js} +2 -2
  16. package/dist/{chunk-NRT2ZRUG.js → chunk-S66YG6QK.js} +19 -1
  17. package/dist/{chunk-NRT2ZRUG.js.map → chunk-S66YG6QK.js.map} +1 -1
  18. package/dist/{chunk-2PWO3WPS.js → chunk-TVV6PZOC.js} +2 -2
  19. package/dist/{chunk-JBFFAGJK.js → chunk-X34OFKYU.js} +2 -2
  20. package/dist/{chunk-YYQWCTF6.js → chunk-XNHHADBK.js} +2 -2
  21. package/dist/{cli-WCBTILMW.js → cli-Z7VO7LIL.js} +36 -36
  22. package/dist/{client-MJUZJ5MC.js → client-CECN26WV.js} +3 -3
  23. package/dist/{config-WBCOTJUE.js → config-H657SF6B.js} +2 -2
  24. package/dist/{doctor-GDCLRJOF.js → doctor-TYMLSW5K.js} +5 -5
  25. package/dist/{executor-TCAXFOIS.js → executor-4DKCQN3A.js} +64 -23
  26. package/dist/executor-4DKCQN3A.js.map +1 -0
  27. package/dist/{init-ZSDMXY4T.js → init-W6VRN5ZZ.js} +10 -10
  28. package/dist/{init-wizard-6LDUVR7C.js → init-wizard-3RJFKAGM.js} +2 -2
  29. package/dist/{loader-L2TCAYCT.js → loader-JQLO6K44.js} +2 -2
  30. package/dist/{main-25MKYYKO.js → main-XUQRWNJ7.js} +255 -39
  31. package/dist/main-XUQRWNJ7.js.map +1 -0
  32. package/dist/{open-4YTUNIP3.js → open-6EC54JEU.js} +4 -4
  33. package/dist/{post-compact-E5V4OZJB.js → post-compact-55ISYIPY.js} +4 -4
  34. package/dist/{post-tool-use-Y6UWKCVD.js → post-tool-use-KNOFQNVX.js} +3 -3
  35. package/dist/{post-tool-use-failure-AHFXMNHX.js → post-tool-use-failure-UIRHWELN.js} +4 -4
  36. package/dist/{pre-compact-EI5EV3N7.js → pre-compact-T3CR4C3Q.js} +4 -4
  37. package/dist/{remove-F63WBELE.js → remove-HIIXTVAK.js} +4 -4
  38. package/dist/{resolution-events-BZYMUQ53.js → resolution-events-5EVUEWHS.js} +3 -3
  39. package/dist/{restart-GULUNCMX.js → restart-5FJYFNIR.js} +5 -5
  40. package/dist/{search-NLZMCEAG.js → search-C3CIHCMP.js} +4 -4
  41. package/dist/{server-CXPWUO6H.js → server-XJTAWCHN.js} +3 -3
  42. package/dist/{session-XXVEDIQZ.js → session-CUGCZWCY.js} +6 -6
  43. package/dist/{session-end-6DP6VTZV.js → session-end-5AI4U3KC.js} +3 -3
  44. package/dist/{session-start-QNAQDF5M.js → session-start-XHH6RN7T.js} +8 -8
  45. package/dist/{setup-llm-ER3B7AZ2.js → setup-llm-3LYRV4KB.js} +5 -5
  46. package/dist/src/agent/definitions/tasks/skill-evolve.yaml +40 -8
  47. package/dist/src/agent/definitions/tasks/skill-generate.yaml +8 -3
  48. package/dist/src/cli.js +1 -1
  49. package/dist/src/daemon/main.js +1 -1
  50. package/dist/src/hooks/post-tool-use.js +1 -1
  51. package/dist/src/hooks/session-end.js +1 -1
  52. package/dist/src/hooks/session-start.js +1 -1
  53. package/dist/src/hooks/stop.js +1 -1
  54. package/dist/src/hooks/user-prompt-submit.js +1 -1
  55. package/dist/src/mcp/server.js +1 -1
  56. package/dist/{stats-VQ7XMOCU.js → stats-BDE5FTO6.js} +6 -6
  57. package/dist/{stop-VTO2KIRG.js → stop-ZIKA2LGJ.js} +3 -3
  58. package/dist/{stop-failure-C5T6LJQR.js → stop-failure-MF22OJ7R.js} +4 -4
  59. package/dist/{subagent-start-NZF42NKF.js → subagent-start-XNAZKYVD.js} +4 -4
  60. package/dist/{subagent-stop-UV5ECFVU.js → subagent-stop-QTJSJYIT.js} +4 -4
  61. package/dist/{task-completed-3SV6TL3V.js → task-completed-24BVLKOC.js} +4 -4
  62. package/dist/{team-XSJXLBZX.js → team-SJPDXELY.js} +2 -2
  63. package/dist/turns-3ZQAF6HF.js +16 -0
  64. package/dist/ui/assets/index-BmsHIwjl.css +1 -0
  65. package/dist/ui/assets/index-Cn6cQwJy.js +842 -0
  66. package/dist/ui/index.html +2 -2
  67. package/dist/{update-5GXOQIY5.js → update-LRPXOWMZ.js} +4 -4
  68. package/dist/{user-prompt-submit-VLQG77A6.js → user-prompt-submit-HPBZOZHM.js} +3 -3
  69. package/dist/{verify-WF7U3NQW.js → verify-JHIMXTY5.js} +2 -2
  70. package/dist/{version-RGX7TZ7V.js → version-ELM3BK4H.js} +2 -2
  71. package/dist/version-ELM3BK4H.js.map +1 -0
  72. package/package.json +1 -1
  73. package/dist/chunk-5BK6M6X5.js.map +0 -1
  74. package/dist/chunk-NCVR636M.js.map +0 -1
  75. package/dist/chunk-W3T3QDBN.js.map +0 -1
  76. package/dist/executor-TCAXFOIS.js.map +0 -1
  77. package/dist/main-25MKYYKO.js.map +0 -1
  78. package/dist/ui/assets/index-BeygBZGu.css +0 -1
  79. package/dist/ui/assets/index-CbGC0T_o.js +0 -822
  80. /package/dist/{agent-run-YBASQHC7.js.map → agent-run-VX5MAPRN.js.map} +0 -0
  81. /package/dist/{agent-tasks-WBQFDHWC.js.map → agent-tasks-FJOBYYC5.js.map} +0 -0
  82. /package/dist/{chunk-EUQQVKGQ.js.map → chunk-CCKPBAKJ.js.map} +0 -0
  83. /package/dist/{chunk-VQEXXS56.js.map → chunk-NYTEHLVI.js.map} +0 -0
  84. /package/dist/{chunk-LPISXFM4.js.map → chunk-PX5KIOKY.js.map} +0 -0
  85. /package/dist/{chunk-T77674VB.js.map → chunk-QB2UTRQE.js.map} +0 -0
  86. /package/dist/{chunk-TFGGH6UB.js.map → chunk-RUDOGKWF.js.map} +0 -0
  87. /package/dist/{chunk-2PWO3WPS.js.map → chunk-TVV6PZOC.js.map} +0 -0
  88. /package/dist/{chunk-JBFFAGJK.js.map → chunk-X34OFKYU.js.map} +0 -0
  89. /package/dist/{chunk-YYQWCTF6.js.map → chunk-XNHHADBK.js.map} +0 -0
  90. /package/dist/{cli-WCBTILMW.js.map → cli-Z7VO7LIL.js.map} +0 -0
  91. /package/dist/{client-MJUZJ5MC.js.map → client-CECN26WV.js.map} +0 -0
  92. /package/dist/{config-WBCOTJUE.js.map → config-H657SF6B.js.map} +0 -0
  93. /package/dist/{doctor-GDCLRJOF.js.map → doctor-TYMLSW5K.js.map} +0 -0
  94. /package/dist/{init-ZSDMXY4T.js.map → init-W6VRN5ZZ.js.map} +0 -0
  95. /package/dist/{init-wizard-6LDUVR7C.js.map → init-wizard-3RJFKAGM.js.map} +0 -0
  96. /package/dist/{loader-L2TCAYCT.js.map → loader-JQLO6K44.js.map} +0 -0
  97. /package/dist/{open-4YTUNIP3.js.map → open-6EC54JEU.js.map} +0 -0
  98. /package/dist/{post-compact-E5V4OZJB.js.map → post-compact-55ISYIPY.js.map} +0 -0
  99. /package/dist/{post-tool-use-Y6UWKCVD.js.map → post-tool-use-KNOFQNVX.js.map} +0 -0
  100. /package/dist/{post-tool-use-failure-AHFXMNHX.js.map → post-tool-use-failure-UIRHWELN.js.map} +0 -0
  101. /package/dist/{pre-compact-EI5EV3N7.js.map → pre-compact-T3CR4C3Q.js.map} +0 -0
  102. /package/dist/{remove-F63WBELE.js.map → remove-HIIXTVAK.js.map} +0 -0
  103. /package/dist/{resolution-events-BZYMUQ53.js.map → resolution-events-5EVUEWHS.js.map} +0 -0
  104. /package/dist/{restart-GULUNCMX.js.map → restart-5FJYFNIR.js.map} +0 -0
  105. /package/dist/{search-NLZMCEAG.js.map → search-C3CIHCMP.js.map} +0 -0
  106. /package/dist/{server-CXPWUO6H.js.map → server-XJTAWCHN.js.map} +0 -0
  107. /package/dist/{session-XXVEDIQZ.js.map → session-CUGCZWCY.js.map} +0 -0
  108. /package/dist/{session-end-6DP6VTZV.js.map → session-end-5AI4U3KC.js.map} +0 -0
  109. /package/dist/{session-start-QNAQDF5M.js.map → session-start-XHH6RN7T.js.map} +0 -0
  110. /package/dist/{setup-llm-ER3B7AZ2.js.map → setup-llm-3LYRV4KB.js.map} +0 -0
  111. /package/dist/{stats-VQ7XMOCU.js.map → stats-BDE5FTO6.js.map} +0 -0
  112. /package/dist/{stop-VTO2KIRG.js.map → stop-ZIKA2LGJ.js.map} +0 -0
  113. /package/dist/{stop-failure-C5T6LJQR.js.map → stop-failure-MF22OJ7R.js.map} +0 -0
  114. /package/dist/{subagent-start-NZF42NKF.js.map → subagent-start-XNAZKYVD.js.map} +0 -0
  115. /package/dist/{subagent-stop-UV5ECFVU.js.map → subagent-stop-QTJSJYIT.js.map} +0 -0
  116. /package/dist/{task-completed-3SV6TL3V.js.map → task-completed-24BVLKOC.js.map} +0 -0
  117. /package/dist/{team-XSJXLBZX.js.map → team-SJPDXELY.js.map} +0 -0
  118. /package/dist/{version-RGX7TZ7V.js.map → turns-3ZQAF6HF.js.map} +0 -0
  119. /package/dist/{update-5GXOQIY5.js.map → update-LRPXOWMZ.js.map} +0 -0
  120. /package/dist/{user-prompt-submit-VLQG77A6.js.map → user-prompt-submit-HPBZOZHM.js.map} +0 -0
  121. /package/dist/{verify-WF7U3NQW.js.map → verify-JHIMXTY5.js.map} +0 -0
@@ -3,42 +3,27 @@ import {
3
3
  DaemonLogger,
4
4
  LEVEL_ORDER
5
5
  } from "./chunk-ZESTWGJT.js";
6
- import {
7
- withTaskConfig
8
- } from "./chunk-SODRR3HE.js";
9
- import {
10
- EMBEDDABLE_TABLES,
11
- EMBEDDABLE_TEXT_COLUMNS,
12
- assertValidTable,
13
- clearEmbedded,
14
- gatherStats,
15
- getEmbeddingQueueDepth,
16
- getUnembedded,
17
- markEmbedded
18
- } from "./chunk-T77674VB.js";
19
- import {
20
- getMachineId
21
- } from "./chunk-ENWBFX7F.js";
22
- import {
23
- createEmbeddingProvider
24
- } from "./chunk-LD6U3L6O.js";
25
6
  import {
26
7
  closeOpenBatches,
27
8
  countBatchesBySession,
28
9
  countCandidates,
10
+ countNotifications,
29
11
  countRuns,
30
12
  countSkillRecords,
31
13
  createBatchLineage,
32
14
  deleteCandidate,
33
15
  deleteSkillRecordCascade,
16
+ dismissAllNotifications,
34
17
  errorMessage,
35
18
  findBatchByPromptPrefix,
19
+ getAllDomains,
36
20
  getCandidate,
37
21
  getDigestExtract,
38
22
  getEntity,
39
23
  getGraphForNode,
40
24
  getLatestBatch,
41
25
  getLatestRunId,
26
+ getNotification,
42
27
  getRun,
43
28
  getSkillRecord,
44
29
  getSkillRecordByName,
@@ -51,19 +36,42 @@ import {
51
36
  listDigestExtracts,
52
37
  listEntities,
53
38
  listLineageForSkill,
39
+ listNotifications,
54
40
  listReports,
55
41
  listRuns,
56
42
  listSkillRecords,
57
43
  listSkillRecordsWithCount,
58
- listTurnsByRun,
44
+ markAllRead,
45
+ notify,
59
46
  populateBatchResponses,
47
+ register,
60
48
  setResponseSummary,
61
- updateCandidate
62
- } from "./chunk-5BK6M6X5.js";
49
+ updateCandidate,
50
+ updateNotificationStatus
51
+ } from "./chunk-JJXVDCEX.js";
63
52
  import {
64
53
  fullTextSearch,
65
54
  hydrateSearchResults
66
55
  } from "./chunk-DTE3SHYK.js";
56
+ import {
57
+ withTaskConfig
58
+ } from "./chunk-SODRR3HE.js";
59
+ import {
60
+ EMBEDDABLE_TABLES,
61
+ EMBEDDABLE_TEXT_COLUMNS,
62
+ assertValidTable,
63
+ clearEmbedded,
64
+ gatherStats,
65
+ getEmbeddingQueueDepth,
66
+ getUnembedded,
67
+ markEmbedded
68
+ } from "./chunk-QB2UTRQE.js";
69
+ import {
70
+ getMachineId
71
+ } from "./chunk-ENWBFX7F.js";
72
+ import {
73
+ createEmbeddingProvider
74
+ } from "./chunk-LD6U3L6O.js";
67
75
  import {
68
76
  copyTaskToUser,
69
77
  deleteUserTask,
@@ -77,12 +85,15 @@ import {
77
85
  resolveDefinitionsDir,
78
86
  taskFromParsed
79
87
  } from "./chunk-NVCGF2DS.js";
88
+ import {
89
+ listTurnsByRun
90
+ } from "./chunk-QLCD77AN.js";
80
91
  import {
81
92
  loadSecrets,
82
93
  readSecrets,
83
94
  writeSecret
84
95
  } from "./chunk-RJMXDUMA.js";
85
- import "./chunk-TFGGH6UB.js";
96
+ import "./chunk-RUDOGKWF.js";
86
97
  import "./chunk-SAKJMNSR.js";
87
98
  import {
88
99
  checkLocalProvider
@@ -107,7 +118,7 @@ import {
107
118
  insertSpore,
108
119
  listSpores,
109
120
  updateSporeStatus
110
- } from "./chunk-LPISXFM4.js";
121
+ } from "./chunk-PX5KIOKY.js";
111
122
  import {
112
123
  closeSession,
113
124
  countSessions,
@@ -118,7 +129,7 @@ import {
118
129
  listSessions,
119
130
  updateSession,
120
131
  upsertSession
121
- } from "./chunk-JBFFAGJK.js";
132
+ } from "./chunk-X34OFKYU.js";
122
133
  import {
123
134
  backfillUnsynced,
124
135
  countPending,
@@ -128,14 +139,15 @@ import {
128
139
  isTeamSyncEnabled,
129
140
  listPending,
130
141
  markSent,
142
+ markSourceRowsSynced,
131
143
  pruneOld,
132
144
  syncRow
133
- } from "./chunk-NRT2ZRUG.js";
145
+ } from "./chunk-S66YG6QK.js";
134
146
  import {
135
147
  EMBEDDING_DIMENSIONS,
136
148
  SCHEMA_VERSION,
137
149
  createSchema
138
- } from "./chunk-NCVR636M.js";
150
+ } from "./chunk-4VF6KQ2Z.js";
139
151
  import {
140
152
  CONFIG_FILENAME,
141
153
  MycoConfigSchema,
@@ -143,7 +155,7 @@ import {
143
155
  updateBackupConfig,
144
156
  updateConfig,
145
157
  updateTeamConfig
146
- } from "./chunk-W3T3QDBN.js";
158
+ } from "./chunk-PSYLKCWQ.js";
147
159
  import {
148
160
  closeDatabase,
149
161
  getDatabase,
@@ -152,10 +164,10 @@ import {
152
164
  } from "./chunk-MYX5NCRH.js";
153
165
  import {
154
166
  resolveCliEntryPath
155
- } from "./chunk-VQEXXS56.js";
167
+ } from "./chunk-NYTEHLVI.js";
156
168
  import {
157
169
  getPluginVersion
158
- } from "./chunk-EUQQVKGQ.js";
170
+ } from "./chunk-CCKPBAKJ.js";
159
171
  import {
160
172
  loadManifests
161
173
  } from "./chunk-QFMBZ72S.js";
@@ -390,7 +402,7 @@ var DaemonServer = class {
390
402
  if (match) {
391
403
  this.onRequest?.();
392
404
  try {
393
- const body = req.method === "POST" || req.method === "PUT" ? await readBody(req) : void 0;
405
+ const body = req.method === "POST" || req.method === "PUT" || req.method === "PATCH" ? await readBody(req) : void 0;
394
406
  const result = await match.handler({
395
407
  body,
396
408
  query: match.query,
@@ -1439,7 +1451,8 @@ function mergeConfigSections(current, incoming) {
1439
1451
  agent: { ...current.agent, ...incoming.agent },
1440
1452
  context: { ...current.context, ...incoming.context },
1441
1453
  backup: { ...current.backup, ...incoming.backup },
1442
- team: { ...current.team, ...incoming.team }
1454
+ team: { ...current.team, ...incoming.team },
1455
+ notifications: { ...current.notifications, ...incoming.notifications }
1443
1456
  };
1444
1457
  }
1445
1458
  async function handleGetConfig(vaultDir) {
@@ -4143,6 +4156,142 @@ var SqliteRecordSource = class {
4143
4156
  }
4144
4157
  };
4145
4158
 
4159
+ // src/notifications/domains.ts
4160
+ function registerBuiltinDomains() {
4161
+ register({
4162
+ domain: "agents",
4163
+ label: "Agent Tasks",
4164
+ types: [
4165
+ { id: "agent.task.success", label: "Task completed", defaultMode: "banner", defaultLevel: "success" },
4166
+ { id: "agent.task.failure", label: "Task failed", defaultMode: "banner", defaultLevel: "error" }
4167
+ ]
4168
+ });
4169
+ register({
4170
+ domain: "sessions",
4171
+ label: "Sessions",
4172
+ types: [
4173
+ { id: "session.started", label: "Session started", defaultMode: "summary", defaultLevel: "info" },
4174
+ { id: "session.ended", label: "Session ended", defaultMode: "summary", defaultLevel: "info" }
4175
+ ]
4176
+ });
4177
+ register({
4178
+ domain: "skills",
4179
+ label: "Skills",
4180
+ types: [
4181
+ { id: "skill.surveyed", label: "Skill candidate surveyed", defaultMode: "summary", defaultLevel: "info" },
4182
+ { id: "skill.created", label: "Skill created", defaultMode: "banner", defaultLevel: "success" },
4183
+ { id: "skill.evolved", label: "Skill evolved", defaultMode: "banner", defaultLevel: "info" }
4184
+ ]
4185
+ });
4186
+ register({
4187
+ domain: "mycelium",
4188
+ label: "Mycelium",
4189
+ types: [
4190
+ { id: "mycelium.digest.completed", label: "Digest cycle completed", defaultMode: "summary", defaultLevel: "info" },
4191
+ { id: "mycelium.spore.created", label: "New spore extracted", defaultMode: "summary", defaultLevel: "info" }
4192
+ ]
4193
+ });
4194
+ }
4195
+
4196
+ // src/daemon/api/notifications.ts
4197
+ var CreateNotificationBody = external_exports.object({
4198
+ domain: external_exports.string().min(1),
4199
+ type: external_exports.string().min(1),
4200
+ level: external_exports.enum(["info", "success", "warning", "error"]).optional(),
4201
+ title: external_exports.string().min(1),
4202
+ message: external_exports.string().optional(),
4203
+ mode: external_exports.enum(["banner", "summary"]).optional(),
4204
+ link: external_exports.string().optional(),
4205
+ metadata: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
4206
+ });
4207
+ var UpdateStatusBody = external_exports.object({
4208
+ status: external_exports.enum(["read", "dismissed"])
4209
+ });
4210
+ async function handleListNotifications(_vaultDir, query) {
4211
+ const status = query.status;
4212
+ const domain = query.domain;
4213
+ const mode = query.mode;
4214
+ const limit = query.limit ? Number(query.limit) : void 0;
4215
+ const offset = query.offset ? Number(query.offset) : void 0;
4216
+ const items = listNotifications({ status, domain, mode, limit, offset });
4217
+ const unreadCount = countNotifications("unread");
4218
+ return {
4219
+ body: {
4220
+ items: items.map(parseNotificationRow),
4221
+ unread_count: unreadCount
4222
+ }
4223
+ };
4224
+ }
4225
+ async function handleCreateNotification(vaultDir, body) {
4226
+ const parsed = CreateNotificationBody.safeParse(body);
4227
+ if (!parsed.success) {
4228
+ return { status: 400, body: { error: "validation_failed", issues: parsed.error.issues } };
4229
+ }
4230
+ const { domain, type, title, message, link, metadata } = parsed.data;
4231
+ const config = loadConfig(vaultDir);
4232
+ if (!config.notifications.enabled) {
4233
+ return { body: { ok: true, suppressed: true, reason: "notifications_disabled" } };
4234
+ }
4235
+ const domainConfig = config.notifications.domains[domain];
4236
+ if (domainConfig && !domainConfig.enabled) {
4237
+ return { body: { ok: true, suppressed: true, reason: "domain_disabled" } };
4238
+ }
4239
+ const id = notify(vaultDir, {
4240
+ domain,
4241
+ type,
4242
+ title,
4243
+ message,
4244
+ link,
4245
+ metadata,
4246
+ level: parsed.data.level,
4247
+ mode: parsed.data.mode
4248
+ }, config);
4249
+ if (!id) {
4250
+ return { body: { ok: true, suppressed: true, reason: "unknown" } };
4251
+ }
4252
+ return {
4253
+ body: {
4254
+ ok: true,
4255
+ id,
4256
+ notification: parseNotificationRow(getNotification(id))
4257
+ }
4258
+ };
4259
+ }
4260
+ async function handleUpdateNotification(_vaultDir, id, body) {
4261
+ const parsed = UpdateStatusBody.safeParse(body);
4262
+ if (!parsed.success) {
4263
+ return { status: 400, body: { error: "validation_failed", issues: parsed.error.issues } };
4264
+ }
4265
+ const updated = updateNotificationStatus(id, parsed.data.status);
4266
+ if (!updated) {
4267
+ return { status: 404, body: { error: "not_found" } };
4268
+ }
4269
+ return { body: { ok: true } };
4270
+ }
4271
+ async function handleDismissAll(_vaultDir, body) {
4272
+ const domain = body?.domain;
4273
+ const count = dismissAllNotifications(domain);
4274
+ return { body: { ok: true, dismissed: count } };
4275
+ }
4276
+ async function handleMarkAllRead(_vaultDir, body) {
4277
+ const domain = body?.domain;
4278
+ const count = markAllRead(domain);
4279
+ return { body: { ok: true, marked: count } };
4280
+ }
4281
+ async function handleGetRegistry() {
4282
+ return { body: { domains: getAllDomains() } };
4283
+ }
4284
+ async function handleUnreadCount() {
4285
+ return { body: { count: countNotifications("unread") } };
4286
+ }
4287
+ function parseNotificationRow(row) {
4288
+ if (!row) return null;
4289
+ return {
4290
+ ...row,
4291
+ metadata: row.metadata ? JSON.parse(row.metadata) : null
4292
+ };
4293
+ }
4294
+
4146
4295
  // src/daemon/api/agent-tasks.ts
4147
4296
  var import_yaml2 = __toESM(require_dist(), 1);
4148
4297
  var HTTP_OK = 200;
@@ -4993,6 +5142,7 @@ async function main() {
4993
5142
  logger.info(LOG_KINDS.DAEMON_START, "Machine ID resolved", { machine_id: machineId });
4994
5143
  const db = initDatabase(vaultDbPath(vaultDir));
4995
5144
  createSchema(db, machineId);
5145
+ registerBuiltinDomains();
4996
5146
  logger.info(LOG_KINDS.DAEMON_START, "SQLite initialized", { vault: vaultDir });
4997
5147
  initTeamContext(config.team.enabled, machineId);
4998
5148
  logger.setPersistFn((entry) => {
@@ -5091,7 +5241,7 @@ async function main() {
5091
5241
  async function triggerTitleSummary(sessionId) {
5092
5242
  if (config.agent.summary_batch_interval <= 0) return;
5093
5243
  try {
5094
- const { runAgent } = await import("./executor-TCAXFOIS.js");
5244
+ const { runAgent } = await import("./executor-4DKCQN3A.js");
5095
5245
  runAgent(vaultDir, {
5096
5246
  task: "title-summary",
5097
5247
  instruction: `Process session ${sessionId} only`,
@@ -5228,6 +5378,14 @@ async function main() {
5228
5378
  updateSession(session_id, { ended_at: null, status: "active" });
5229
5379
  reconcileSession(session_id);
5230
5380
  logger.info(LOG_KINDS.LIFECYCLE_REGISTER, "Session registered", { session_id, branch, started_at: started_at ?? null });
5381
+ notify(vaultDir, {
5382
+ domain: "sessions",
5383
+ type: "session.started",
5384
+ title: "Session started",
5385
+ message: branch ? `Branch: ${branch}` : void 0,
5386
+ link: `/sessions/${session_id}`,
5387
+ metadata: { sessionId: session_id, agent: agent ?? "claude-code", branch }
5388
+ }, config);
5231
5389
  return { body: { ok: true, sessions: registry.sessions } };
5232
5390
  });
5233
5391
  server.registerRoute("POST", "/sessions/unregister", async (req) => {
@@ -5240,6 +5398,13 @@ async function main() {
5240
5398
  reconciledSessions.delete(session_id);
5241
5399
  server.updateDaemonJsonSessions(registry.sessions);
5242
5400
  logger.info(LOG_KINDS.LIFECYCLE_UNREGISTER, "Session unregistered", { session_id });
5401
+ notify(vaultDir, {
5402
+ domain: "sessions",
5403
+ type: "session.ended",
5404
+ title: "Session ended",
5405
+ link: `/sessions/${session_id}`,
5406
+ metadata: { sessionId: session_id }
5407
+ }, config);
5243
5408
  return { body: { ok: true, sessions: registry.sessions } };
5244
5409
  });
5245
5410
  server.registerRoute("POST", "/events", async (req) => {
@@ -5836,7 +6001,7 @@ async function main() {
5836
6001
  if (task === "skill-generate" && !instruction) {
5837
6002
  instruction = buildSkillGenerateInstruction();
5838
6003
  }
5839
- const { runAgent } = await import("./executor-TCAXFOIS.js");
6004
+ const { runAgent } = await import("./executor-4DKCQN3A.js");
5840
6005
  const resultPromise = runAgent(vaultDir, { task, instruction, agentId, embeddingManager });
5841
6006
  const effectiveAgentId = agentId ?? "myco-agent";
5842
6007
  const runId = getLatestRunId(effectiveAgentId, task);
@@ -6017,7 +6182,7 @@ async function main() {
6017
6182
  name: USER_AGENT_NAME,
6018
6183
  created_at: now
6019
6184
  });
6020
- const { insertResolutionEvent } = await import("./resolution-events-BZYMUQ53.js");
6185
+ const { insertResolutionEvent } = await import("./resolution-events-5EVUEWHS.js");
6021
6186
  const resolutionId = `res-${randomBytes(RESOLUTION_ID_RANDOM_BYTES).toString("hex")}`;
6022
6187
  insertResolutionEvent({
6023
6188
  id: resolutionId,
@@ -6108,6 +6273,13 @@ async function main() {
6108
6273
  server.registerRoute("POST", "/api/embedding/reconcile", async () => handleEmbeddingReconcile(embeddingManager));
6109
6274
  server.registerRoute("POST", "/api/embedding/clean-orphans", async () => handleEmbeddingCleanOrphans(embeddingManager));
6110
6275
  server.registerRoute("POST", "/api/embedding/reembed-stale", async () => handleEmbeddingReembedStale(embeddingManager));
6276
+ server.registerRoute("GET", "/api/notifications", async (req) => handleListNotifications(vaultDir, req.query));
6277
+ server.registerRoute("POST", "/api/notifications", async (req) => handleCreateNotification(vaultDir, req.body));
6278
+ server.registerRoute("PATCH", "/api/notifications/:id", async (req) => handleUpdateNotification(vaultDir, req.params.id, req.body));
6279
+ server.registerRoute("POST", "/api/notifications/dismiss-all", async (req) => handleDismissAll(vaultDir, req.body));
6280
+ server.registerRoute("POST", "/api/notifications/mark-all-read", async (req) => handleMarkAllRead(vaultDir, req.body));
6281
+ server.registerRoute("GET", "/api/notifications/registry", async () => handleGetRegistry());
6282
+ server.registerRoute("GET", "/api/notifications/unread-count", async () => handleUnreadCount());
6111
6283
  await server.evictExistingDaemon();
6112
6284
  const resolvedPort = await resolvePort(config.daemon.port, vaultDir);
6113
6285
  if (resolvedPort === 0) {
@@ -6189,9 +6361,12 @@ async function main() {
6189
6361
  const result = await client.pushBatch(pending);
6190
6362
  if (result.synced > 0 || result.skipped > 0) {
6191
6363
  const failedIds = new Set(result.errors.map((e) => e.id));
6192
- const sentIds = pending.filter((r) => !failedIds.has(String(r.row_id))).map((r) => r.id);
6364
+ const sentRecords = pending.filter((r) => !failedIds.has(String(r.row_id)));
6365
+ const sentIds = sentRecords.map((r) => r.id);
6193
6366
  if (sentIds.length > 0) {
6194
- markSent(sentIds, epochSeconds());
6367
+ const now = epochSeconds();
6368
+ markSent(sentIds, now);
6369
+ markSourceRowsSynced(sentRecords, now);
6195
6370
  }
6196
6371
  }
6197
6372
  if (result.errors.length > 0) {
@@ -6237,13 +6412,54 @@ async function main() {
6237
6412
  else runningTasks.delete(name);
6238
6413
  },
6239
6414
  runTask: async (taskName) => {
6240
- const { runAgent } = await import("./executor-TCAXFOIS.js");
6415
+ const { runAgent } = await import("./executor-4DKCQN3A.js");
6241
6416
  const instruction = taskName === "skill-generate" ? buildSkillGenerateInstruction() : void 0;
6242
6417
  const result = await runAgent(vaultDir, { task: taskName, instruction, embeddingManager });
6243
6418
  logger.info(LOG_KINDS.AGENT_RUN, `Scheduled task ${taskName} completed`, {
6244
6419
  status: result.status,
6245
6420
  runId: result.runId
6246
6421
  });
6422
+ if (result.status === "failed") {
6423
+ notify(vaultDir, {
6424
+ domain: "agents",
6425
+ type: "agent.task.failure",
6426
+ title: `Task failed: ${taskName}`,
6427
+ message: result.error ?? "Unknown error",
6428
+ link: `/agent?run=${result.runId}`,
6429
+ metadata: { taskName, runId: result.runId }
6430
+ }, config);
6431
+ } else if (result.status === "completed") {
6432
+ notify(vaultDir, {
6433
+ domain: "agents",
6434
+ type: "agent.task.success",
6435
+ title: `Task completed: ${taskName}`,
6436
+ link: `/agent?run=${result.runId}`,
6437
+ metadata: { taskName, runId: result.runId }
6438
+ }, config);
6439
+ const { countToolCallsByRun } = await import("./turns-3ZQAF6HF.js");
6440
+ const counts = countToolCallsByRun(result.runId, ["vault_create_spore", "vault_write_digest"]);
6441
+ const sporeCount = counts["vault_create_spore"] ?? 0;
6442
+ const digestCount = counts["vault_write_digest"] ?? 0;
6443
+ if (sporeCount > 0) {
6444
+ notify(vaultDir, {
6445
+ domain: "mycelium",
6446
+ type: "mycelium.spore.created",
6447
+ title: sporeCount === 1 ? "Extracted 1 observation" : `Extracted ${sporeCount} observations`,
6448
+ message: `From ${taskName} run`,
6449
+ link: "/mycelium?tab=spores",
6450
+ metadata: { count: sporeCount, taskName, runId: result.runId }
6451
+ }, config);
6452
+ }
6453
+ if (digestCount > 0) {
6454
+ notify(vaultDir, {
6455
+ domain: "mycelium",
6456
+ type: "mycelium.digest.completed",
6457
+ title: `Digest updated (${digestCount} ${digestCount === 1 ? "tier" : "tiers"})`,
6458
+ link: "/mycelium?tab=digest",
6459
+ metadata: { tierCount: digestCount, taskName, runId: result.runId }
6460
+ }, config);
6461
+ }
6462
+ }
6247
6463
  },
6248
6464
  preConditions: {
6249
6465
  "has-unprocessed-batches": () => {
@@ -6306,4 +6522,4 @@ export {
6306
6522
  handleUserPrompt,
6307
6523
  main
6308
6524
  };
6309
- //# sourceMappingURL=main-25MKYYKO.js.map
6525
+ //# sourceMappingURL=main-XUQRWNJ7.js.map