volute 0.46.0 → 0.47.0

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 (136) hide show
  1. package/README.md +1 -1
  2. package/dist/{activity-events-NF6VWTJQ.js → activity-events-MIOK3IOU.js} +3 -3
  3. package/dist/{ai-service-UODCCE4O.js → ai-service-CVZEYKTK.js} +4 -4
  4. package/dist/{archive-WS2L2VIQ.js → archive-6Z4GFQPH.js} +3 -3
  5. package/dist/{auth-CCFAU4GQ.js → auth-A4VGHADI.js} +4 -4
  6. package/dist/avatar-image-7S3WA77A.js +22 -0
  7. package/dist/{backup-TST5C2YN.js → backup-IIAFOW2L.js} +13 -13
  8. package/dist/channels-ITE4YC57.js +89 -0
  9. package/dist/{chat-ZIQQS25U.js → chat-AJLJCQ3M.js} +12 -8
  10. package/dist/{chunk-ZV7MFISX.js → chunk-2MJ7EOMT.js} +20 -2
  11. package/dist/{chunk-R77O2WMK.js → chunk-2OIYNHWO.js} +1 -1
  12. package/dist/{chunk-QCN24XEN.js → chunk-3YUBFTDN.js} +1 -1
  13. package/dist/{chunk-E3DA4HYV.js → chunk-4I72V3E5.js} +10 -10
  14. package/dist/{chunk-K6T43YBD.js → chunk-5IERLDUS.js} +3 -3
  15. package/dist/{chunk-FXORA5JG.js → chunk-5NN2VHJV.js} +3 -3
  16. package/dist/chunk-7KRIHYLR.js +124 -0
  17. package/dist/{chunk-RRNXJOKB.js → chunk-BGYHLR54.js} +2 -2
  18. package/dist/{chunk-QMJCNZ6C.js → chunk-C3KLHJDB.js} +1 -1
  19. package/dist/{chunk-TQJ6ZYVY.js → chunk-CBOIHNMR.js} +2 -2
  20. package/dist/{chunk-H2X54EHC.js → chunk-DGGZVZTM.js} +1 -1
  21. package/dist/{chunk-4JOQZPCE.js → chunk-EIQDZC43.js} +1 -1
  22. package/dist/{chunk-JO5IO4FH.js → chunk-F55GRIEK.js} +243 -121
  23. package/dist/{chunk-5ZQZDDIK.js → chunk-HPGN6XRT.js} +3 -3
  24. package/dist/{chunk-KGIXX4NM.js → chunk-IWJSNMSY.js} +5 -5
  25. package/dist/{chunk-ZDZISKCL.js → chunk-IYG4FBMP.js} +1 -1
  26. package/dist/{chunk-4YU7HF4L.js → chunk-JCMGDCGX.js} +4 -4
  27. package/dist/{chunk-PJ45FQPT.js → chunk-JSVHH32K.js} +6 -6
  28. package/dist/{chunk-YXSUMLTC.js → chunk-K23P5Q5N.js} +301 -77
  29. package/dist/{chunk-ZNMCCHCP.js → chunk-LTLFOSA4.js} +2 -2
  30. package/dist/{chunk-IHKGWTGT.js → chunk-LWDTP6DH.js} +1 -1
  31. package/dist/{chunk-JZ62SYWR.js → chunk-M3XDVS5Q.js} +1 -1
  32. package/dist/{chunk-BJZ4PV7R.js → chunk-M6TTZRGH.js} +9 -9
  33. package/dist/{chunk-KQSFTPIM.js → chunk-MTRMQFCQ.js} +1 -1
  34. package/dist/{chunk-OV7ZQ2GH.js → chunk-ODDGGLM6.js} +3 -3
  35. package/dist/{chunk-QLWG3C2Z.js → chunk-RRZ4RQQU.js} +2 -2
  36. package/dist/{chunk-CDPBTTZO.js → chunk-RUFLGTOT.js} +2 -2
  37. package/dist/{chunk-F7H6ATM4.js → chunk-SKNXMUIU.js} +1 -1
  38. package/dist/{chunk-RXEEYDIB.js → chunk-SZJCJVXV.js} +1 -1
  39. package/dist/{chunk-DRJ24GXK.js → chunk-VMCZBXF2.js} +52 -8
  40. package/dist/{chunk-ALKYQULU.js → chunk-WW6C3PLV.js} +1 -1
  41. package/dist/{chunk-A7WQZKOU.js → chunk-XHN6XBWV.js} +2 -2
  42. package/dist/{chunk-6EMWJZBK.js → chunk-YKA7DCVW.js} +1 -1
  43. package/dist/cli.js +21 -21
  44. package/dist/{clock-RHS2JEDL.js → clock-E6N5Y3YW.js} +3 -3
  45. package/dist/{cloud-sync-46RS4SDA.js → cloud-sync-LQTVDTQ3.js} +19 -18
  46. package/dist/{conversations-CJOOCGNW.js → conversations-C7IKYSHD.js} +4 -4
  47. package/dist/{create-IOV4GCRX.js → create-PQQXKTJK.js} +1 -1
  48. package/dist/{daemon-restart-VFEI57UO.js → daemon-restart-5F3YTLZK.js} +7 -7
  49. package/dist/daemon.js +217 -151
  50. package/dist/{db-MF2JNRUW.js → db-FO6LXYCW.js} +2 -2
  51. package/dist/delivery-manager-TN5KK2AP.js +34 -0
  52. package/dist/{delivery-router-N4A7ZC5T.js → delivery-router-3QFG2ZEX.js} +3 -3
  53. package/dist/{down-U2CZ23M4.js → down-ZI4S6265.js} +5 -5
  54. package/dist/echo-text-SEQCLGAT.js +34 -0
  55. package/dist/{exec-G3ZRST4Z.js → exec-QIFYZG4C.js} +3 -3
  56. package/dist/{export-LY723I3Z.js → export-4GVGNW54.js} +3 -3
  57. package/dist/{extensions-ZELQLTSR.js → extensions-PIMIQ7J3.js} +21 -18
  58. package/dist/{files-4LN3EN7Q.js → files-FEFZKMNM.js} +6 -6
  59. package/dist/{import-42YNQBF4.js → import-7MO3YTRE.js} +6 -6
  60. package/dist/{isolation-YMGZZ4E5.js → isolation-MCT4ZYLT.js} +3 -3
  61. package/dist/{login-M6OJUPQ2.js → login-OF4WXDAN.js} +5 -5
  62. package/dist/{logout-WQBWO77G.js → logout-ERE2BGA3.js} +5 -5
  63. package/dist/message-delivery-ZE3YGJDD.js +38 -0
  64. package/dist/{mind-LHKS55DI.js → mind-POOHFZHP.js} +13 -13
  65. package/dist/{mind-activity-tracker-3QRNJVR4.js → mind-activity-tracker-YVZPC4A5.js} +4 -4
  66. package/dist/{mind-list-4D7J4CHD.js → mind-list-KEGRGQEQ.js} +5 -4
  67. package/dist/mind-service-JFY7UG5E.js +40 -0
  68. package/dist/{mind-sleep-74TGOQBC.js → mind-sleep-IN3WPA76.js} +5 -5
  69. package/dist/{mind-status-UO34ASXZ.js → mind-status-SMUWJKGV.js} +20 -3
  70. package/dist/{package-DOD6CPO6.js → package-WPEE2HVJ.js} +2 -2
  71. package/dist/{registry-OUZBZ3Q4.js → registry-UMMDRPRM.js} +2 -2
  72. package/dist/{sandbox-ZJ7QA6Z6.js → sandbox-G4X4K3UN.js} +4 -4
  73. package/dist/scheduler-HQSDYJFY.js +32 -0
  74. package/dist/{schema-PVNG3PQM.js → schema-VEVO7HG6.js} +3 -1
  75. package/dist/{seed-CNYIHPOH.js → seed-VANPU43L.js} +1 -1
  76. package/dist/{seed-cmd-AVNUNLZV.js → seed-cmd-SYVDZKM4.js} +2 -2
  77. package/dist/{seed-create-ANXGYSCC.js → seed-create-3FGZPS6C.js} +3 -3
  78. package/dist/{seed-sprout-NIUFTX32.js → seed-sprout-H7QLFPFM.js} +12 -12
  79. package/dist/{send-SPE6DVNJ.js → send-HYDFGC6G.js} +7 -7
  80. package/dist/{service-UOCLXDWR.js → service-SYJ5G6LP.js} +4 -4
  81. package/dist/{service-install-4HHFDDWY.js → service-install-FQ43Z4DF.js} +5 -5
  82. package/dist/{setup-Y2EJI3GG.js → setup-KFYVWTXG.js} +3 -3
  83. package/dist/{setup-QT2A25SY.js → setup-QJHGMGSN.js} +7 -7
  84. package/dist/{skills-AKCFA7BN.js → skills-L2CMTW7A.js} +5 -5
  85. package/dist/sleep-manager-3NA7ZJP3.js +36 -0
  86. package/dist/{spirit-RPBLLUQ5.js → spirit-WXN4IDBF.js} +8 -8
  87. package/dist/{sprout-SMX42ZBP.js → sprout-LTL5P36T.js} +1 -1
  88. package/dist/{status-SWRVGXBI.js → status-V4RJMHJ4.js} +19 -9
  89. package/dist/system-chat-N2F7HVY3.js +38 -0
  90. package/dist/{systems-VNB5WKSS.js → systems-B5YJKMW4.js} +6 -6
  91. package/dist/{tailscale-3XOKOW7T.js → tailscale-MCLY5GYE.js} +2 -2
  92. package/dist/{template-hash-446HHH5V.js → template-hash-GSOUARW4.js} +2 -2
  93. package/dist/template-staleness-EMQORSGG.js +15 -0
  94. package/dist/{turn-tracker-FOIBNUUA.js → turn-tracker-JZRZDFWV.js} +6 -6
  95. package/dist/{up-PS6PFS75.js → up-J2PBPOZL.js} +6 -6
  96. package/dist/{update-SWAYZRWJ.js → update-ACV4SAY3.js} +5 -5
  97. package/dist/{update-check-PQ2MZ47K.js → update-check-266R4ZSY.js} +3 -3
  98. package/dist/{version-notify-C5CH7CVP.js → version-notify-XRGTEEDK.js} +37 -23
  99. package/dist/web-assets/assets/index-DtctoDXY.css +1 -0
  100. package/dist/web-assets/assets/index-Wpyb2CML.js +86 -0
  101. package/dist/web-assets/index.html +2 -2
  102. package/drizzle/0011_drop_turn_summary_event_id.sql +3 -0
  103. package/drizzle/0012_channel_gates.sql +17 -0
  104. package/drizzle/meta/_journal.json +14 -0
  105. package/package.json +2 -2
  106. package/templates/_base/src/lib/startup.ts +43 -2
  107. package/templates/claude/src/agent.ts +28 -2
  108. package/templates/claude/src/lib/session-reaper.ts +32 -0
  109. package/templates/claude/src/server.ts +10 -1
  110. package/dist/avatar-image-6KY6UU4D.js +0 -16
  111. package/dist/delivery-manager-JINZRG2W.js +0 -33
  112. package/dist/echo-text-VQPB5L2X.js +0 -33
  113. package/dist/message-delivery-R7JSQGYX.js +0 -37
  114. package/dist/mind-service-NB2JMWQZ.js +0 -39
  115. package/dist/scheduler-WVKII3LA.js +0 -31
  116. package/dist/sleep-manager-G6TXSDP7.js +0 -35
  117. package/dist/system-chat-NDAW6YP7.js +0 -37
  118. package/dist/web-assets/assets/index-B1JBQv2m.css +0 -1
  119. package/dist/web-assets/assets/index-CU6XWICM.js +0 -86
  120. package/dist/{accept-N5XULCXK.js → accept-YAFP5JFJ.js} +3 -3
  121. package/dist/{bridge-2PO3AI5D.js → bridge-TIZGSXOD.js} +3 -3
  122. package/dist/{create-DF3KISTW.js → create-A7PDHIIL.js} +3 -3
  123. package/dist/{env-VZ4MLFQW.js → env-HRL2PWAT.js} +5 -5
  124. package/dist/{extension-SEID47SR.js → extension-QBY4C44L.js} +3 -3
  125. package/dist/{list-OXIAY3W7.js → list-LQO2DCIK.js} +3 -3
  126. package/dist/{login-MY6ETFYB.js → login-6TLMI2TQ.js} +3 -3
  127. package/dist/{logout-NCG3TMDL.js → logout-BK53HXNY.js} +3 -3
  128. package/dist/{mind-history-VRO5A76U.js → mind-history-47DN6ILW.js} +4 -4
  129. package/dist/{mind-wake-LCLGTXA2.js → mind-wake-R54BPESY.js} +3 -3
  130. package/dist/{read-QVAXMTPV.js → read-PWAJOQIQ.js} +3 -3
  131. package/dist/{register-Y2H4PY5R.js → register-7SZJFHU6.js} +3 -3
  132. package/dist/{reject-EV35X64Y.js → reject-6VH7N2A4.js} +3 -3
  133. package/dist/{restart-FJQ662XJ.js → restart-H5WJDMA7.js} +4 -4
  134. package/dist/{skill-FKFHIJRR.js → skill-GUKG2YVH.js} +5 -5
  135. package/dist/{start-5JE3TV66.js → start-X46I3GXB.js} +4 -4
  136. package/dist/{stop-AAMTG3TU.js → stop-HJQV4YSM.js} +4 -4
package/dist/daemon.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  readBackupState,
7
7
  resticVersion,
8
8
  runBackup
9
- } from "./chunk-FXORA5JG.js";
9
+ } from "./chunk-5NN2VHJV.js";
10
10
  import {
11
11
  acceptPending,
12
12
  formatFileSize,
@@ -14,35 +14,34 @@ import {
14
14
  rejectPending,
15
15
  stageFile,
16
16
  validateFilePath
17
- } from "./chunk-R77O2WMK.js";
17
+ } from "./chunk-2OIYNHWO.js";
18
18
  import {
19
19
  findOpenClawSession,
20
20
  importOpenClawConnectors,
21
21
  importPiSession,
22
22
  parseNameFromIdentity
23
- } from "./chunk-A7WQZKOU.js";
23
+ } from "./chunk-XHN6XBWV.js";
24
+ import {
25
+ isTemplateStale
26
+ } from "./chunk-7KRIHYLR.js";
24
27
  import {
25
28
  checkForUpdate,
26
29
  checkForUpdateCached,
27
30
  getCurrentVersion
28
- } from "./chunk-6EMWJZBK.js";
29
- import {
30
- normalizeAvatar,
31
- safeResolveWithinBase
32
- } from "./chunk-DRJ24GXK.js";
31
+ } from "./chunk-YKA7DCVW.js";
33
32
  import {
34
33
  isHomeOnlyArchive
35
- } from "./chunk-QCN24XEN.js";
34
+ } from "./chunk-3YUBFTDN.js";
36
35
  import {
37
36
  computeTemplateHash
38
- } from "./chunk-QMJCNZ6C.js";
37
+ } from "./chunk-C3KLHJDB.js";
39
38
  import {
40
39
  PLATFORMS,
41
40
  echoTextToChannel,
42
41
  fixModelEscapes,
43
42
  getPlatformDriver,
44
43
  routeOutboundBridge
45
- } from "./chunk-E3DA4HYV.js";
44
+ } from "./chunk-4I72V3E5.js";
46
45
  import {
47
46
  getBridgeConfig,
48
47
  readBridgesConfig,
@@ -51,7 +50,7 @@ import {
51
50
  resolveChannelMapping,
52
51
  setBridgeConfig,
53
52
  setChannelMapping
54
- } from "./chunk-RXEEYDIB.js";
53
+ } from "./chunk-SZJCJVXV.js";
55
54
  import {
56
55
  MindStartupError,
57
56
  RestartTracker,
@@ -113,15 +112,15 @@ import {
113
112
  syncProviderToMinds,
114
113
  uninstallNpmExtension,
115
114
  writeSystemsConfig
116
- } from "./chunk-JO5IO4FH.js";
115
+ } from "./chunk-F55GRIEK.js";
117
116
  import {
118
117
  loadMergedEnv,
119
118
  mindEnvPath,
120
119
  readEnv,
121
120
  sharedEnvPath,
122
121
  writeEnv
123
- } from "./chunk-ZDZISKCL.js";
124
- import "./chunk-BJZ4PV7R.js";
122
+ } from "./chunk-IYG4FBMP.js";
123
+ import "./chunk-M6TTZRGH.js";
125
124
  import {
126
125
  applyInitFiles,
127
126
  applyTemplateHomeFiles,
@@ -130,7 +129,34 @@ import {
130
129
  findTemplatesRoot,
131
130
  isKnownTemplate,
132
131
  listFiles
133
- } from "./chunk-QLWG3C2Z.js";
132
+ } from "./chunk-RRZ4RQQU.js";
133
+ import {
134
+ assignSession,
135
+ completeOrphanedTurns,
136
+ completeTurn,
137
+ createTurn,
138
+ getActiveTurnId,
139
+ getToolUseEventId,
140
+ initSummarizer,
141
+ isoWeekKeyForDateStr,
142
+ markErrored,
143
+ publish as publish3,
144
+ subscribe as subscribe3,
145
+ subscribeAll,
146
+ summarizeOrphanedTurns,
147
+ summarizeTurn,
148
+ takeErrored,
149
+ trackToolUse
150
+ } from "./chunk-K23P5Q5N.js";
151
+ import {
152
+ ORIENTATION_MARKER,
153
+ PROMPT_DEFAULTS,
154
+ PROMPT_KEYS,
155
+ getMindPromptDefaults,
156
+ getPrompt,
157
+ getPromptIfCustom,
158
+ substitute
159
+ } from "./chunk-JCMGDCGX.js";
134
160
  import {
135
161
  SEED_SKILLS,
136
162
  STANDARD_SKILLS,
@@ -150,7 +176,7 @@ import {
150
176
  syncBuiltinSkills,
151
177
  uninstallSkill,
152
178
  updateSkill
153
- } from "./chunk-KGIXX4NM.js";
179
+ } from "./chunk-IWJSNMSY.js";
154
180
  import {
155
181
  addMessage,
156
182
  createChannel,
@@ -182,50 +208,28 @@ import {
182
208
  setConversationPrivate,
183
209
  subscribe as subscribe2,
184
210
  updateChannelSettings
185
- } from "./chunk-5ZQZDDIK.js";
186
- import {
187
- readVoluteConfig,
188
- writeVoluteConfig
189
- } from "./chunk-PFZBNKUH.js";
211
+ } from "./chunk-HPGN6XRT.js";
190
212
  import {
191
213
  isSandboxEnabled,
192
214
  wrapForSandbox
193
- } from "./chunk-JZ62SYWR.js";
215
+ } from "./chunk-M3XDVS5Q.js";
194
216
  import {
195
217
  getActiveMinds,
196
218
  onMindEvent,
197
219
  stopAll
198
- } from "./chunk-KQSFTPIM.js";
220
+ } from "./chunk-MTRMQFCQ.js";
199
221
  import {
200
- extractTextContent
201
- } from "./chunk-4JOQZPCE.js";
222
+ normalizeAvatar,
223
+ safeResolveWithinBase
224
+ } from "./chunk-VMCZBXF2.js";
202
225
  import {
203
- assignSession,
204
- completeOrphanedTurns,
205
- completeTurn,
206
- createTurn,
207
- getActiveTurnId,
208
- getToolUseEventId,
209
- initSummarizer,
210
- markErrored,
211
- publish as publish3,
212
- subscribe as subscribe3,
213
- subscribeAll,
214
- summarizeOrphanedTurns,
215
- summarizeTurn,
216
- takeErrored,
217
- trackToolUse
218
- } from "./chunk-YXSUMLTC.js";
226
+ readVoluteConfig,
227
+ writeVoluteConfig
228
+ } from "./chunk-PFZBNKUH.js";
219
229
  import {
220
- ORIENTATION_MARKER,
221
- PROMPT_DEFAULTS,
222
- PROMPT_KEYS,
223
- getMindPromptDefaults,
224
- getPrompt,
225
- getPromptIfCustom,
226
- substitute
227
- } from "./chunk-4YU7HF4L.js";
228
- import "./chunk-TQJ6ZYVY.js";
230
+ extractTextContent
231
+ } from "./chunk-EIQDZC43.js";
232
+ import "./chunk-CBOIHNMR.js";
229
233
  import {
230
234
  chownMindDir,
231
235
  createMindUser,
@@ -236,7 +240,7 @@ import {
236
240
  isIsolationEnabled,
237
241
  resolveVoluteBin,
238
242
  wrapForIsolation
239
- } from "./chunk-H2X54EHC.js";
243
+ } from "./chunk-DGGZVZTM.js";
240
244
  import {
241
245
  addCustomModel,
242
246
  aiCompleteUtility,
@@ -258,12 +262,12 @@ import {
258
262
  setProviderRefreshHook,
259
263
  setUtilityModel,
260
264
  unqualifyModelId
261
- } from "./chunk-IHKGWTGT.js";
265
+ } from "./chunk-LWDTP6DH.js";
262
266
  import {
263
267
  isSetupComplete,
264
268
  readGlobalConfig,
265
269
  writeGlobalConfig
266
- } from "./chunk-F7H6ATM4.js";
270
+ } from "./chunk-SKNXMUIU.js";
267
271
  import {
268
272
  approveUser,
269
273
  changePassword,
@@ -282,14 +286,14 @@ import {
282
286
  syncMindProfile,
283
287
  updateUserProfile,
284
288
  verifyUser
285
- } from "./chunk-OV7ZQ2GH.js";
289
+ } from "./chunk-ODDGGLM6.js";
286
290
  import {
287
291
  broadcast,
288
292
  getEventsSince,
289
293
  nextEventId,
290
294
  publish,
291
295
  subscribe
292
- } from "./chunk-ZNMCCHCP.js";
296
+ } from "./chunk-LTLFOSA4.js";
293
297
  import {
294
298
  logBuffer,
295
299
  logger_default
@@ -323,7 +327,7 @@ import {
323
327
  validateMindName,
324
328
  voluteHome,
325
329
  voluteSystemDir
326
- } from "./chunk-ALKYQULU.js";
330
+ } from "./chunk-WW6C3PLV.js";
327
331
  import {
328
332
  activity,
329
333
  channels,
@@ -334,7 +338,7 @@ import {
334
338
  systemPrompts,
335
339
  turns,
336
340
  users
337
- } from "./chunk-ZV7MFISX.js";
341
+ } from "./chunk-2MJ7EOMT.js";
338
342
  import "./chunk-K3NQKI34.js";
339
343
 
340
344
  // packages/daemon/src/daemon.ts
@@ -453,7 +457,7 @@ var BackupManager = class {
453
457
  blog.error("failed to publish backup-failure activity", logger_default.errorData(pubErr));
454
458
  }
455
459
  try {
456
- const { sendSystemMessage } = await import("./system-chat-NDAW6YP7.js");
460
+ const { sendSystemMessage } = await import("./system-chat-N2F7HVY3.js");
457
461
  await sendSystemMessage(
458
462
  SPIRIT_NAME,
459
463
  `${summary}
@@ -1052,7 +1056,12 @@ var app = new Hono().post("/restart", requireAdmin, (c) => {
1052
1056
  }).get("/info", (c) => {
1053
1057
  const config2 = readSystemsConfig();
1054
1058
  const globalConfig = readGlobalConfig();
1055
- return c.json({ system: config2?.system ?? null, name: globalConfig.name ?? null });
1059
+ const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone ?? null;
1060
+ return c.json({
1061
+ system: config2?.system ?? null,
1062
+ name: globalConfig.name ?? null,
1063
+ timezone
1064
+ });
1056
1065
  }).put("/info", requireAdmin, zValidator("json", z.object({ name: z.string() })), (c) => {
1057
1066
  const { name } = c.req.valid("json");
1058
1067
  const config2 = readGlobalConfig();
@@ -2259,7 +2268,7 @@ var app4 = new Hono5().post("/:platform/inbound", zValidator4("json", inboundSch
2259
2268
  }
2260
2269
  const participants = await getParticipants(channel.id);
2261
2270
  if (!participants.some((p) => p.userId === puppet.id)) {
2262
- const { addParticipant } = await import("./conversations-CJOOCGNW.js");
2271
+ const { addParticipant } = await import("./conversations-C7IKYSHD.js");
2263
2272
  await addParticipant(channel.id, puppet.id);
2264
2273
  }
2265
2274
  const contentBlocks = body.content;
@@ -2543,7 +2552,7 @@ async function notifyMind(mindName, message) {
2543
2552
  const entry = await findMind(mindName);
2544
2553
  if (!entry) return;
2545
2554
  try {
2546
- const { sendSystemMessage } = await import("./system-chat-NDAW6YP7.js");
2555
+ const { sendSystemMessage } = await import("./system-chat-N2F7HVY3.js");
2547
2556
  await sendSystemMessage(mindName, message);
2548
2557
  } catch (err) {
2549
2558
  logger_default.warn(`[file-sharing] notify mind ${mindName} failed`, logger_default.errorData(err));
@@ -2844,13 +2853,14 @@ import { and as and3, desc as desc2, eq as eq3, gte, inArray, sql } from "drizzl
2844
2853
  import { Hono as Hono12 } from "hono";
2845
2854
  async function resolveMindFilter(c) {
2846
2855
  const user = c.get("user");
2847
- if (user.role === "admin" || user.role === "system") {
2848
- return c.req.query("mind") ?? void 0;
2849
- }
2850
- return getBaseName(user.username);
2856
+ const privileged = user.role === "admin" || user.role === "system";
2857
+ return privileged ? c.req.query("mind") ?? void 0 : getBaseName(user.username);
2851
2858
  }
2852
- var history = new Hono12().get("/turns", async (c) => {
2853
- const mindFilter = await resolveMindFilter(c);
2859
+ var history = new Hono12().use("*", async (c, next) => {
2860
+ c.set("mindFilter", await resolveMindFilter(c));
2861
+ await next();
2862
+ }).get("/turns", async (c) => {
2863
+ const mindFilter = c.get("mindFilter");
2854
2864
  const turnIdFilter = c.req.query("turnId");
2855
2865
  const turnIdsFilter = c.req.query("turnIds");
2856
2866
  const limit = Math.min(Math.max(parseInt(c.req.query("limit") ?? "50", 10) || 50, 1), 200);
@@ -2885,7 +2895,7 @@ var history = new Hono12().get("/turns", async (c) => {
2885
2895
  inArray(mindHistory.turn_id, turnIds),
2886
2896
  sql`${mindHistory.type} IN ('inbound', 'outbound')`
2887
2897
  )
2888
- ).orderBy(mindHistory.created_at);
2898
+ ).orderBy(mindHistory.created_at, mindHistory.id);
2889
2899
  const msgsByTurnChannel = /* @__PURE__ */ new Map();
2890
2900
  function addToTurnChannel(turnId, channel, event) {
2891
2901
  let byChannel = msgsByTurnChannel.get(turnId);
@@ -2920,7 +2930,7 @@ var history = new Hono12().get("/turns", async (c) => {
2920
2930
  const label = isDM ? raw : raw.startsWith("#") ? raw : `#${raw}`;
2921
2931
  return { label, type: isDM ? "dm" : "channel" };
2922
2932
  }
2923
- const activityRows = await db.select().from(activity).where(inArray(activity.turn_id, turnIds)).orderBy(activity.created_at);
2933
+ const activityRows = await db.select().from(activity).where(inArray(activity.turn_id, turnIds)).orderBy(activity.created_at, activity.id);
2924
2934
  const activitiesByTurn = /* @__PURE__ */ new Map();
2925
2935
  for (const a of activityRows) {
2926
2936
  if (!a.turn_id) continue;
@@ -3092,7 +3102,7 @@ var history = new Hono12().get("/turns", async (c) => {
3092
3102
  });
3093
3103
  return c.json(result);
3094
3104
  }).get("/events", async (c) => {
3095
- const mindFilter = await resolveMindFilter(c);
3105
+ const mindFilter = c.get("mindFilter");
3096
3106
  const stream = new ReadableStream({
3097
3107
  start(controller) {
3098
3108
  const encoder = new TextEncoder();
@@ -3149,7 +3159,7 @@ var history = new Hono12().get("/turns", async (c) => {
3149
3159
  }).get("/summaries", async (c) => {
3150
3160
  const user = c.get("user");
3151
3161
  const privileged = user.role === "admin" || user.role === "system";
3152
- const mind = privileged ? c.req.query("mind") ?? "_system" : await getBaseName(user.username);
3162
+ const mind = c.get("mindFilter") ?? "_system";
3153
3163
  const period = c.req.query("period");
3154
3164
  const ids = c.req.query("ids");
3155
3165
  const from = c.req.query("from");
@@ -3180,8 +3190,9 @@ var history = new Hono12().get("/turns", async (c) => {
3180
3190
  }
3181
3191
  const db = await getDb();
3182
3192
  const conditions = [eq3(summaries.mind, mind), eq3(summaries.period, period)];
3183
- if (from) conditions.push(gte(summaries.period_key, from));
3184
- if (to) conditions.push(sql`${summaries.period_key} <= ${to}`);
3193
+ const normalizeBound = (bound) => period === "week" ? isoWeekKeyForDateStr(bound) : bound;
3194
+ if (from) conditions.push(gte(summaries.period_key, normalizeBound(from)));
3195
+ if (to) conditions.push(sql`${summaries.period_key} <= ${normalizeBound(to)}`);
3185
3196
  const rows = await db.select({
3186
3197
  id: summaries.id,
3187
3198
  mind: summaries.mind,
@@ -3204,7 +3215,7 @@ var history = new Hono12().get("/turns", async (c) => {
3204
3215
  });
3205
3216
  return c.json(result);
3206
3217
  }).get("/activity", async (c) => {
3207
- const mind = await resolveMindFilter(c);
3218
+ const mind = c.get("mindFilter");
3208
3219
  const from = c.req.query("from");
3209
3220
  const to = c.req.query("to");
3210
3221
  const limit = Math.min(Math.max(parseInt(c.req.query("limit") ?? "100", 10) || 100, 1), 500);
@@ -3468,12 +3479,12 @@ import {
3468
3479
  } from "fs";
3469
3480
  import { relative, resolve as resolve10 } from "path";
3470
3481
  import { zValidator as zValidator6 } from "@hono/zod-validator";
3471
- import { and as and5, desc as desc4, eq as eq5, sql as sql3 } from "drizzle-orm";
3482
+ import { and as and5, desc as desc3, eq as eq5, sql as sql3 } from "drizzle-orm";
3472
3483
  import { Hono as Hono16 } from "hono";
3473
3484
  import { z as z6 } from "zod";
3474
3485
 
3475
3486
  // packages/daemon/src/lib/daemon/turn-lifecycle.ts
3476
- import { and as and4, desc as desc3, eq as eq4, inArray as inArray2, sql as sql2 } from "drizzle-orm";
3487
+ import { and as and4, eq as eq4, gte as gte2, inArray as inArray2, sql as sql2 } from "drizzle-orm";
3477
3488
 
3478
3489
  // packages/daemon/src/lib/daemon/error-classify.ts
3479
3490
  function classify(raw) {
@@ -3532,21 +3543,27 @@ function markDeliveredOnCleanTurn(mind, session) {
3532
3543
  );
3533
3544
  }
3534
3545
  }
3535
- async function linkPendingInbound(mind, turnId, channel) {
3536
- if (!channel) return;
3546
+ async function linkPendingInbound(mind, turnId, channel, session) {
3547
+ const scopeChannel = channel ?? session;
3548
+ if (!scopeChannel) return;
3537
3549
  const db = await getDb();
3538
- const recent = await db.select({ id: mindHistory.id }).from(mindHistory).where(
3539
- and4(
3540
- eq4(mindHistory.mind, mind),
3541
- eq4(mindHistory.type, "inbound"),
3542
- sql2`${mindHistory.turn_id} IS NULL`,
3543
- eq4(mindHistory.channel, channel)
3544
- )
3545
- ).orderBy(desc3(mindHistory.id)).limit(5);
3546
- if (recent.length === 0) return;
3547
- const ids = recent.map((r) => r.id);
3550
+ let lowerBound;
3551
+ if (session) {
3552
+ const prev = await db.select({ max: sql2`max(${turns.created_at})` }).from(turns).where(and4(eq4(turns.mind, mind), eq4(turns.session, session), sql2`${turns.id} != ${turnId}`)).get();
3553
+ lowerBound = prev?.max ?? void 0;
3554
+ }
3555
+ const conditions = [
3556
+ eq4(mindHistory.mind, mind),
3557
+ eq4(mindHistory.type, "inbound"),
3558
+ sql2`${mindHistory.turn_id} IS NULL`,
3559
+ eq4(mindHistory.channel, scopeChannel)
3560
+ ];
3561
+ if (lowerBound) conditions.push(gte2(mindHistory.created_at, lowerBound));
3562
+ const pending = await db.select({ id: mindHistory.id }).from(mindHistory).where(and4(...conditions)).orderBy(mindHistory.id);
3563
+ if (pending.length === 0) return;
3564
+ const ids = pending.map((r) => r.id);
3548
3565
  await db.update(mindHistory).set({ turn_id: turnId }).where(inArray2(mindHistory.id, ids));
3549
- await db.update(turns).set({ trigger_event_id: recent[0].id }).where(eq4(turns.id, turnId));
3566
+ await db.update(turns).set({ trigger_event_id: ids[0] }).where(eq4(turns.id, turnId));
3550
3567
  }
3551
3568
  async function handleMindEvent(mind, event) {
3552
3569
  if (event.type === "session_start" && event.session) {
@@ -3562,7 +3579,7 @@ async function handleMindEvent(mind, event) {
3562
3579
  publish3(mind, { mind, type: "turn_created", turnId });
3563
3580
  if (event.session) await assignSession(mind, turnId, event.session);
3564
3581
  try {
3565
- await linkPendingInbound(mind, turnId, event.channel);
3582
+ await linkPendingInbound(mind, turnId, event.channel, event.session);
3566
3583
  } catch (err) {
3567
3584
  llog.warn(
3568
3585
  `failed to link trigger inbound for turn ${turnId} (mind: ${mind})`,
@@ -3798,7 +3815,7 @@ async function cleanupVariant(variantName, projectRoot, variantPath, opts) {
3798
3815
  logger_default.warn(`failed to stop variant ${variantName}`, logger_default.errorData(err));
3799
3816
  }
3800
3817
  }
3801
- const { findMind: findMind2 } = await import("./registry-OUZBZ3Q4.js");
3818
+ const { findMind: findMind2 } = await import("./registry-UMMDRPRM.js");
3802
3819
  const variantEntry = await findMind2(variantName);
3803
3820
  const branchName = variantEntry?.branch ?? variantName;
3804
3821
  if (existsSync6(variantPath)) {
@@ -4027,7 +4044,7 @@ async function getMindStatus(name, port, registryRunning) {
4027
4044
  const manager = getMindManager();
4028
4045
  let status = "stopped";
4029
4046
  try {
4030
- const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-G6TXSDP7.js");
4047
+ const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-3NA7ZJP3.js");
4031
4048
  if (getSleepManagerIfReady2()?.isSleeping(name)) {
4032
4049
  status = "sleeping";
4033
4050
  }
@@ -4055,6 +4072,25 @@ async function getMindStatus(name, port, registryRunning) {
4055
4072
  avatar: config2?.profile?.avatar
4056
4073
  };
4057
4074
  }
4075
+ function isPrivileged(c) {
4076
+ const role = c.get("user").role;
4077
+ return role === "admin" || role === "system";
4078
+ }
4079
+ function toPublicMind(entry, status, extras) {
4080
+ return {
4081
+ name: entry.name,
4082
+ created: entry.created,
4083
+ stage: entry.stage,
4084
+ mindType: entry.mindType,
4085
+ status: status.status,
4086
+ channels: status.channels,
4087
+ displayName: status.displayName,
4088
+ description: status.description,
4089
+ avatar: status.avatar,
4090
+ hasPages: extras.hasPages,
4091
+ lastActiveAt: extras.lastActiveAt ?? null
4092
+ };
4093
+ }
4058
4094
  var TEMPLATE_BRANCH = "volute/template";
4059
4095
  async function configureGitIdentity(mindName, opts) {
4060
4096
  const systemsConfig = readSystemsConfig();
@@ -4522,7 +4558,7 @@ var app13 = new Hono16().post("/", requireAdminOrSystem, zValidator6("json", cre
4522
4558
  applyInitFiles(dest);
4523
4559
  const { publicKeyPem } = generateIdentity(dest);
4524
4560
  {
4525
- const { readGlobalConfig: readGlobal } = await import("./setup-Y2EJI3GG.js");
4561
+ const { readGlobalConfig: readGlobal } = await import("./setup-KFYVWTXG.js");
4526
4562
  const mindDefaults = readGlobal().mindDefaults;
4527
4563
  const config2 = readVoluteConfig(dest);
4528
4564
  if (!config2) throw new Error("Failed to read volute.json after identity generation");
@@ -4612,7 +4648,7 @@ Your creator described you as: "${body.description}"
4612
4648
  }
4613
4649
  let skillSet = body.skills ?? (body.stage === "seed" ? SEED_SKILLS : getStandardSkillsWithExtensions());
4614
4650
  if (body.stage === "seed" && !body.skills) {
4615
- const { isImagegenEnabled } = await import("./setup-Y2EJI3GG.js");
4651
+ const { isImagegenEnabled } = await import("./setup-KFYVWTXG.js");
4616
4652
  if (isImagegenEnabled()) {
4617
4653
  skillSet = [...skillSet, "imagegen"];
4618
4654
  }
@@ -4630,7 +4666,7 @@ Your creator described you as: "${body.description}"
4630
4666
  try {
4631
4667
  const spiritEntry = await findMind("volute");
4632
4668
  if (spiritEntry) {
4633
- const { spiritDir } = await import("./spirit-RPBLLUQ5.js");
4669
+ const { spiritDir } = await import("./spirit-WXN4IDBF.js");
4634
4670
  const sDir = spiritEntry.dir ?? spiritDir();
4635
4671
  const spiritConfig = readVoluteConfig(sDir) ?? {};
4636
4672
  const schedules = spiritConfig.schedules ?? [];
@@ -4645,7 +4681,7 @@ Your creator described you as: "${body.description}"
4645
4681
  });
4646
4682
  spiritConfig.schedules = schedules;
4647
4683
  writeVoluteConfig(sDir, spiritConfig);
4648
- const { getScheduler: getScheduler2 } = await import("./scheduler-WVKII3LA.js");
4684
+ const { getScheduler: getScheduler2 } = await import("./scheduler-HQSDYJFY.js");
4649
4685
  getScheduler2().loadSchedules("volute", sDir);
4650
4686
  }
4651
4687
  }
@@ -4832,15 +4868,19 @@ ${user.trimEnd()}
4832
4868
  } catch {
4833
4869
  }
4834
4870
  }
4871
+ const privileged = isPrivileged(c);
4835
4872
  const minds = await Promise.all(
4836
4873
  entries.map(async (entry) => {
4837
4874
  const mindStatus = await getMindStatus(entry.name, entry.port, entry.running);
4838
4875
  const hasPages = existsSync7(resolve10(mindDir(entry.name), "home", "pages"));
4876
+ const lastActiveAt = lastActiveMap.get(entry.name) ?? null;
4877
+ if (!privileged) return toPublicMind(entry, mindStatus, { hasPages, lastActiveAt });
4839
4878
  return {
4840
4879
  ...entry,
4841
4880
  ...mindStatus,
4842
4881
  hasPages,
4843
- lastActiveAt: lastActiveMap.get(entry.name) ?? null
4882
+ templateStale: isTemplateStale(entry),
4883
+ lastActiveAt
4844
4884
  };
4845
4885
  })
4846
4886
  );
@@ -4852,6 +4892,10 @@ ${user.trimEnd()}
4852
4892
  const dir = entry.dir ?? mindDir(entry.parent ?? name);
4853
4893
  if (!existsSync7(dir)) return c.json({ error: "Mind directory missing" }, 404);
4854
4894
  const mindStatus = await getMindStatus(name, entry.port);
4895
+ const hasPages = existsSync7(resolve10(mindDir(name), "home", "pages"));
4896
+ if (!isPrivileged(c)) {
4897
+ return c.json(toPublicMind(entry, mindStatus, { hasPages }));
4898
+ }
4855
4899
  const variants = await findVariants(name);
4856
4900
  const manager = getMindManager();
4857
4901
  const variantStatuses = await Promise.all(
@@ -4864,8 +4908,13 @@ ${user.trimEnd()}
4864
4908
  return { name: s.name, port: s.port, status: variantStatus };
4865
4909
  })
4866
4910
  );
4867
- const hasPages = existsSync7(resolve10(mindDir(name), "home", "pages"));
4868
- return c.json({ ...entry, ...mindStatus, variants: variantStatuses, hasPages });
4911
+ return c.json({
4912
+ ...entry,
4913
+ ...mindStatus,
4914
+ variants: variantStatuses,
4915
+ hasPages,
4916
+ templateStale: isTemplateStale(entry)
4917
+ });
4869
4918
  }).get("/:name/context", requireSelf(), async (c) => proxyToMind(c, "context")).get("/:name/context/messages", requireSelf(), async (c) => proxyToMind(c, "context/messages")).post("/:name/start", requireSelf(), async (c) => {
4870
4919
  const name = c.req.param("name");
4871
4920
  const entry = await findMind(name);
@@ -4911,7 +4960,7 @@ ${user.trimEnd()}
4911
4960
  const manager = getMindManager();
4912
4961
  try {
4913
4962
  if (context?.type === "reload") {
4914
- const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-G6TXSDP7.js");
4963
+ const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-3NA7ZJP3.js");
4915
4964
  const sleepState = getSleepManagerIfReady2()?.getState(name);
4916
4965
  if (sleepState?.sleeping) {
4917
4966
  logger_default.info(`skipping reload for ${name} during sleep \u2014 will apply on next wake`);
@@ -5038,7 +5087,7 @@ ${user.trimEnd()}
5038
5087
  const name = c.req.param("name");
5039
5088
  const entry = await findMind(name);
5040
5089
  if (!entry) return c.json({ error: "Mind not found" }, 404);
5041
- const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-G6TXSDP7.js");
5090
+ const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-3NA7ZJP3.js");
5042
5091
  const sm = getSleepManagerIfReady2();
5043
5092
  if (!sm) return c.json({ error: "Sleep manager not initialized" }, 503);
5044
5093
  return c.json(sm.getState(name));
@@ -5046,7 +5095,7 @@ ${user.trimEnd()}
5046
5095
  const name = c.req.param("name");
5047
5096
  const entry = await findMind(name);
5048
5097
  if (!entry) return c.json({ error: "Mind not found" }, 404);
5049
- const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-G6TXSDP7.js");
5098
+ const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-3NA7ZJP3.js");
5050
5099
  const sm = getSleepManagerIfReady2();
5051
5100
  if (!sm) return c.json({ error: "Sleep manager not initialized" }, 503);
5052
5101
  if (sm.isSleeping(name)) return c.json({ error: "Mind is already sleeping" }, 409);
@@ -5066,7 +5115,7 @@ ${user.trimEnd()}
5066
5115
  const name = c.req.param("name");
5067
5116
  const entry = await findMind(name);
5068
5117
  if (!entry) return c.json({ error: "Mind not found" }, 404);
5069
- const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-G6TXSDP7.js");
5118
+ const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-3NA7ZJP3.js");
5070
5119
  const sm = getSleepManagerIfReady2();
5071
5120
  if (!sm) return c.json({ error: "Sleep manager not initialized" }, 503);
5072
5121
  const sleepState = sm.getState(name);
@@ -5081,7 +5130,7 @@ ${user.trimEnd()}
5081
5130
  const name = c.req.param("name");
5082
5131
  const entry = await findMind(name);
5083
5132
  if (!entry) return c.json({ error: "Mind not found" }, 404);
5084
- const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-G6TXSDP7.js");
5133
+ const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-3NA7ZJP3.js");
5085
5134
  const sm = getSleepManagerIfReady2();
5086
5135
  if (!sm) return c.json({ error: "Sleep manager not initialized" }, 503);
5087
5136
  const flushed = await sm.flushQueuedMessages(name);
@@ -5109,7 +5158,7 @@ ${user.trimEnd()}
5109
5158
  }
5110
5159
  config2.profile = profile;
5111
5160
  writeVoluteConfig(dir, config2);
5112
- const { syncMindProfile: syncMindProfile2 } = await import("./auth-CCFAU4GQ.js");
5161
+ const { syncMindProfile: syncMindProfile2 } = await import("./auth-A4VGHADI.js");
5113
5162
  await syncMindProfile2(name, profile);
5114
5163
  broadcast({ type: "profile_updated", mind: name, summary: `${name} profile updated` });
5115
5164
  return c.json({ ok: true });
@@ -5131,14 +5180,14 @@ ${user.trimEnd()}
5131
5180
  sql3`${mindHistory.sender} != ${name}`,
5132
5181
  sql3`${mindHistory.sender} IS NOT NULL`
5133
5182
  )
5134
- ).orderBy(desc4(mindHistory.created_at)).limit(1);
5183
+ ).orderBy(desc3(mindHistory.created_at)).limit(1);
5135
5184
  const lastSpiritMsg = await db.select({ created_at: mindHistory.created_at }).from(mindHistory).where(
5136
5185
  and5(
5137
5186
  eq5(mindHistory.mind, name),
5138
5187
  eq5(mindHistory.type, "inbound"),
5139
5188
  eq5(mindHistory.sender, "volute")
5140
5189
  )
5141
- ).orderBy(desc4(mindHistory.created_at)).limit(1);
5190
+ ).orderBy(desc3(mindHistory.created_at)).limit(1);
5142
5191
  const now = Date.now();
5143
5192
  const creatorTime = lastCreatorMsg[0] ? new Date(lastCreatorMsg[0].created_at).getTime() : 0;
5144
5193
  const spiritTime = lastSpiritMsg[0] ? new Date(lastSpiritMsg[0].created_at).getTime() : 0;
@@ -5155,7 +5204,7 @@ ${user.trimEnd()}
5155
5204
  const config2 = readVoluteConfig(dir);
5156
5205
  const displayNameSet = !!config2?.profile?.displayName;
5157
5206
  const avatarSet = !!config2?.profile?.avatar;
5158
- const { isImagegenEnabled } = await import("./setup-Y2EJI3GG.js");
5207
+ const { isImagegenEnabled } = await import("./setup-KFYVWTXG.js");
5159
5208
  const imagegenEnabled = isImagegenEnabled();
5160
5209
  const done = [];
5161
5210
  const remaining = [];
@@ -5193,7 +5242,7 @@ ${user.trimEnd()}
5193
5242
  try {
5194
5243
  const spiritEntry = await findMind("volute");
5195
5244
  if (spiritEntry) {
5196
- const { spiritDir } = await import("./spirit-RPBLLUQ5.js");
5245
+ const { spiritDir } = await import("./spirit-WXN4IDBF.js");
5197
5246
  const sDir = spiritEntry.dir ?? spiritDir();
5198
5247
  const spiritConfig = readVoluteConfig(sDir);
5199
5248
  if (spiritConfig?.schedules) {
@@ -5201,7 +5250,7 @@ ${user.trimEnd()}
5201
5250
  spiritConfig.schedules = spiritConfig.schedules.filter((s) => s.id !== nurtureId);
5202
5251
  if (spiritConfig.schedules.length === 0) spiritConfig.schedules = void 0;
5203
5252
  writeVoluteConfig(sDir, spiritConfig);
5204
- const { getScheduler: getScheduler2 } = await import("./scheduler-WVKII3LA.js");
5253
+ const { getScheduler: getScheduler2 } = await import("./scheduler-HQSDYJFY.js");
5205
5254
  getScheduler2().loadSchedules("volute", sDir);
5206
5255
  }
5207
5256
  }
@@ -5636,7 +5685,7 @@ ${user.trimEnd()}
5636
5685
  }
5637
5686
  writeVoluteConfig(dir, existing);
5638
5687
  if (body.unescapeNewlines !== void 0) {
5639
- const { clearEchoTextCache } = await import("./echo-text-VQPB5L2X.js");
5688
+ const { clearEchoTextCache } = await import("./echo-text-SEQCLGAT.js");
5640
5689
  clearEchoTextCache(name);
5641
5690
  }
5642
5691
  const needsConfigJson = body.model !== void 0 || body.thinkingLevel !== void 0 || body.maxThinkingTokens !== void 0 || body.compaction !== void 0;
@@ -5713,7 +5762,7 @@ ${user.trimEnd()}
5713
5762
  }
5714
5763
  if (entry.mindType === "spirit" && body.model !== void 0) {
5715
5764
  try {
5716
- const { readGlobalConfig: readGlobalConfig2, writeGlobalConfig: writeGlobalConfig2 } = await import("./setup-Y2EJI3GG.js");
5765
+ const { readGlobalConfig: readGlobalConfig2, writeGlobalConfig: writeGlobalConfig2 } = await import("./setup-KFYVWTXG.js");
5717
5766
  const globalConfig = readGlobalConfig2();
5718
5767
  globalConfig.spiritModel = body.model;
5719
5768
  writeGlobalConfig2(globalConfig);
@@ -5736,12 +5785,27 @@ ${user.trimEnd()}
5736
5785
  logger_default.error(`failed to get pending deliveries for ${baseName}`, logger_default.errorData(err));
5737
5786
  return c.json({ error: "Failed to retrieve pending messages" }, 500);
5738
5787
  }
5788
+ }).post("/:name/gates/decline", requireSelf(), async (c) => {
5789
+ const name = c.req.param("name");
5790
+ const body = await c.req.json().catch(() => ({}));
5791
+ const channel = body.channel?.trim();
5792
+ if (!channel) return c.json({ error: "channel required" }, 400);
5793
+ try {
5794
+ const archived = await getDeliveryManager().declineChannel(name, channel);
5795
+ return c.json({ ok: true, channel, archived });
5796
+ } catch (err) {
5797
+ if (err instanceof Error && err.message.includes("not initialized")) {
5798
+ return c.json({ error: "Delivery manager not available" }, 503);
5799
+ }
5800
+ logger_default.error(`failed to decline channel ${channel} for ${name}`, logger_default.errorData(err));
5801
+ return c.json({ error: "Failed to decline channel" }, 500);
5802
+ }
5739
5803
  }).post("/:name/ai/complete", requireSelf(), async (c) => {
5740
5804
  const body = await c.req.json();
5741
5805
  if (!body.systemPrompt || !body.message) {
5742
5806
  return c.json({ error: "systemPrompt and message required" }, 400);
5743
5807
  }
5744
- const { aiComplete: aiCompleteFn, isAiConfigured } = await import("./ai-service-UODCCE4O.js");
5808
+ const { aiComplete: aiCompleteFn, isAiConfigured } = await import("./ai-service-CVZEYKTK.js");
5745
5809
  if (!isAiConfigured()) {
5746
5810
  return c.json({ error: "AI service not configured" }, 503);
5747
5811
  }
@@ -5907,7 +5971,7 @@ ${user.trimEnd()}
5907
5971
  eq5(mindHistory.session, currentSession),
5908
5972
  sql3`${mindHistory.turn_id} IS NOT NULL`
5909
5973
  )
5910
- ).orderBy(desc4(mindHistory.created_at)).limit(1);
5974
+ ).orderBy(desc3(mindHistory.created_at)).limit(1);
5911
5975
  if (lastTurn.length > 0 && lastTurn[0].turn_id) {
5912
5976
  const firstEvent = await db.select({ created_at: mindHistory.created_at }).from(mindHistory).where(eq5(mindHistory.turn_id, lastTurn[0].turn_id)).orderBy(mindHistory.created_at).limit(1);
5913
5977
  if (firstEvent.length > 0) {
@@ -5930,7 +5994,7 @@ ${user.trimEnd()}
5930
5994
  session: turns.session,
5931
5995
  content: summaries.content,
5932
5996
  created_at: summaries.created_at
5933
- }).from(summaries).innerJoin(turns, eq5(turns.id, summaries.period_key)).where(and5(...conditions)).orderBy(desc4(summaries.created_at)).limit(50);
5997
+ }).from(summaries).innerJoin(turns, eq5(turns.id, summaries.period_key)).where(and5(...conditions)).orderBy(desc3(summaries.created_at)).limit(50);
5934
5998
  if (rows.length === 0) {
5935
5999
  return c.json({ context: null });
5936
6000
  }
@@ -5981,7 +6045,7 @@ ${lines.join("\n")}` });
5981
6045
  metadata: summaries.metadata,
5982
6046
  created_at: summaries.created_at,
5983
6047
  session: turns.session
5984
- }).from(summaries).innerJoin(turns, eq5(turns.id, summaries.period_key)).where(and5(...sumConditions)).orderBy(desc4(summaries.created_at)).limit(limit).offset(offset);
6048
+ }).from(summaries).innerJoin(turns, eq5(turns.id, summaries.period_key)).where(and5(...sumConditions)).orderBy(desc3(summaries.created_at)).limit(limit).offset(offset);
5985
6049
  return c.json(
5986
6050
  sumRows2.map((r) => ({
5987
6051
  id: r.id,
@@ -5998,7 +6062,7 @@ ${lines.join("\n")}` });
5998
6062
  }))
5999
6063
  );
6000
6064
  }
6001
- const sumRows = await db.select().from(summaries).where(and5(...sumConditions)).orderBy(desc4(summaries.created_at)).limit(limit).offset(offset);
6065
+ const sumRows = await db.select().from(summaries).where(and5(...sumConditions)).orderBy(desc3(summaries.created_at)).limit(limit).offset(offset);
6002
6066
  return c.json(
6003
6067
  sumRows.map((r) => ({
6004
6068
  id: r.id,
@@ -6027,7 +6091,7 @@ ${lines.join("\n")}` });
6027
6091
  );
6028
6092
  break;
6029
6093
  }
6030
- const rows = await db.select().from(mindHistory).where(and5(...conditions)).orderBy(desc4(mindHistory.created_at)).limit(limit).offset(offset);
6094
+ const rows = await db.select().from(mindHistory).where(and5(...conditions)).orderBy(desc3(mindHistory.created_at)).limit(limit).offset(offset);
6031
6095
  return c.json(rows);
6032
6096
  });
6033
6097
  var minds_default = app13;
@@ -6343,7 +6407,7 @@ var app15 = new Hono18().get("/:name/clock/status", requireSelf(), async (c) =>
6343
6407
  const body = await c.req.text();
6344
6408
  const message = `[webhook: ${event}] ${body}`;
6345
6409
  try {
6346
- const { sendSystemMessage } = await import("./system-chat-NDAW6YP7.js");
6410
+ const { sendSystemMessage } = await import("./system-chat-N2F7HVY3.js");
6347
6411
  await sendSystemMessage(name, message);
6348
6412
  return c.json({ ok: true });
6349
6413
  } catch (err) {
@@ -6397,7 +6461,7 @@ setup.get("/status", async (c) => {
6397
6461
  let hasAccount = false;
6398
6462
  if (hasSystem) {
6399
6463
  try {
6400
- const { listUsersByType: listUsersByType2 } = await import("./auth-CCFAU4GQ.js");
6464
+ const { listUsersByType: listUsersByType2 } = await import("./auth-A4VGHADI.js");
6401
6465
  const brains = await listUsersByType2("brain");
6402
6466
  hasAccount = brains.length > 0;
6403
6467
  } catch (err) {
@@ -6608,7 +6672,7 @@ setup.post("/account", async (c) => {
6608
6672
  }
6609
6673
  }
6610
6674
  try {
6611
- const { createUser: createUser2, updateUserProfile: updateUserProfile2 } = await import("./auth-CCFAU4GQ.js");
6675
+ const { createUser: createUser2, updateUserProfile: updateUserProfile2 } = await import("./auth-A4VGHADI.js");
6612
6676
  const user = await createUser2(body.username.trim(), body.password);
6613
6677
  if (body.displayName?.trim()) {
6614
6678
  await updateUserProfile2(user.id, { display_name: body.displayName.trim() });
@@ -6654,7 +6718,7 @@ setup.post("/models", async (c) => {
6654
6718
  return c.json({ error: "Spirit model is required" }, 400);
6655
6719
  }
6656
6720
  try {
6657
- const { setEnabledModels: setEnabledModels3, setUtilityModel: setUtilityModel2 } = await import("./ai-service-UODCCE4O.js");
6721
+ const { setEnabledModels: setEnabledModels3, setUtilityModel: setUtilityModel2 } = await import("./ai-service-CVZEYKTK.js");
6658
6722
  setEnabledModels3(body.models);
6659
6723
  const config2 = readGlobalConfig();
6660
6724
  config2.spiritModel = body.spiritModel.trim();
@@ -6672,15 +6736,15 @@ setup.post("/complete", async (c) => {
6672
6736
  return c.json({ error: "Setup already complete" }, 400);
6673
6737
  }
6674
6738
  try {
6675
- const { ensureSpiritProject, syncSpiritTemplate } = await import("./spirit-RPBLLUQ5.js");
6676
- const { startSpiritFull } = await import("./mind-service-NB2JMWQZ.js");
6739
+ const { ensureSpiritProject, syncSpiritTemplate } = await import("./spirit-WXN4IDBF.js");
6740
+ const { startSpiritFull } = await import("./mind-service-JFY7UG5E.js");
6677
6741
  await ensureSpiritProject();
6678
6742
  await syncSpiritTemplate();
6679
6743
  const warnings = [];
6680
6744
  const config2 = readGlobalConfig();
6681
6745
  if (config2.setup?.service && config2.setup?.type === "local") {
6682
6746
  try {
6683
- const { installUserService } = await import("./service-install-4HHFDDWY.js");
6747
+ const { installUserService } = await import("./service-install-FQ43Z4DF.js");
6684
6748
  const installed = await installUserService(config2.port, config2.hostname);
6685
6749
  if (!installed) {
6686
6750
  warnings.push("Service installation is not supported on this platform.");
@@ -6708,8 +6772,8 @@ setup.post("/complete", async (c) => {
6708
6772
  }
6709
6773
  let spiritConversationId;
6710
6774
  try {
6711
- const { getOrCreateMindUser: getOrCreateMindUser2, listUsersByType: listUsersByType2 } = await import("./auth-CCFAU4GQ.js");
6712
- const { createConversation: createConversation2, findDMConversation: findDMConversation2 } = await import("./conversations-CJOOCGNW.js");
6775
+ const { getOrCreateMindUser: getOrCreateMindUser2, listUsersByType: listUsersByType2 } = await import("./auth-A4VGHADI.js");
6776
+ const { createConversation: createConversation2, findDMConversation: findDMConversation2 } = await import("./conversations-C7IKYSHD.js");
6713
6777
  const spiritUser = await getOrCreateMindUser2("volute");
6714
6778
  const brains = await listUsersByType2("brain");
6715
6779
  const admin2 = brains.find((u) => u.role === "admin");
@@ -6731,8 +6795,8 @@ setup.post("/complete", async (c) => {
6731
6795
  logger_default.info("setup complete state", { spiritConversationId, spiritStarted });
6732
6796
  if (spiritConversationId && spiritStarted) {
6733
6797
  try {
6734
- const { deliverMessage: deliverMessage2 } = await import("./message-delivery-R7JSQGYX.js");
6735
- const { listUsersByType: listUsers2 } = await import("./auth-CCFAU4GQ.js");
6798
+ const { deliverMessage: deliverMessage2 } = await import("./message-delivery-ZE3YGJDD.js");
6799
+ const { listUsersByType: listUsers2 } = await import("./auth-A4VGHADI.js");
6736
6800
  const admins = await listUsers2("brain");
6737
6801
  const admin2 = admins.find((u) => u.role === "admin");
6738
6802
  if (admin2) {
@@ -7053,7 +7117,7 @@ var app19 = new Hono23().use("*", authMiddleware).get("/", async (c) => {
7053
7117
  var conversations_default = app19;
7054
7118
 
7055
7119
  // packages/daemon/src/web/api/v1/events.ts
7056
- import { desc as desc5, eq as eq7 } from "drizzle-orm";
7120
+ import { desc as desc4, eq as eq7 } from "drizzle-orm";
7057
7121
  import { Hono as Hono24 } from "hono";
7058
7122
  import { streamSSE as streamSSE4 } from "hono/streaming";
7059
7123
 
@@ -7120,7 +7184,7 @@ var app20 = new Hono24().use("*", authMiddleware).get("/", async (c) => {
7120
7184
  let recentActivity = [];
7121
7185
  try {
7122
7186
  const db = await getDb();
7123
- recentActivity = await db.select().from(activity).where(activityMind ? eq7(activity.mind, activityMind) : void 0).orderBy(desc5(activity.created_at)).limit(50);
7187
+ recentActivity = await db.select().from(activity).where(activityMind ? eq7(activity.mind, activityMind) : void 0).orderBy(desc4(activity.created_at)).limit(50);
7124
7188
  recentActivity = recentActivity.map((row) => ({
7125
7189
  ...row,
7126
7190
  metadata: row.metadata ? JSON.parse(row.metadata) : null
@@ -7526,8 +7590,8 @@ var app21 = new Hono25().get("/:name/variants", async (c) => {
7526
7590
  await chownMindDir(projectRoot, mindName);
7527
7591
  if (variantName.endsWith("-upgrade") || variantName === "upgrade") {
7528
7592
  try {
7529
- const { computeTemplateHash: computeTemplateHash2 } = await import("./template-hash-446HHH5V.js");
7530
- const { setMindTemplateHash: setMindTemplateHash2 } = await import("./registry-OUZBZ3Q4.js");
7593
+ const { computeTemplateHash: computeTemplateHash2 } = await import("./template-hash-GSOUARW4.js");
7594
+ const { setMindTemplateHash: setMindTemplateHash2 } = await import("./registry-UMMDRPRM.js");
7531
7595
  const tmpl = parentEntry.template ?? "claude";
7532
7596
  await setMindTemplateHash2(mindName, computeTemplateHash2(tmpl));
7533
7597
  } catch (err) {
@@ -8316,27 +8380,27 @@ async function startDaemon(opts) {
8316
8380
  const DAEMON_TOKEN_PATH = resolve16(systemDir, "daemon-token");
8317
8381
  mkdirSync10(home, { recursive: true });
8318
8382
  ensureSystemDir();
8319
- const { migrateConfigSecrets, migrateSetupCompleted } = await import("./setup-Y2EJI3GG.js");
8383
+ const { migrateConfigSecrets, migrateSetupCompleted } = await import("./setup-KFYVWTXG.js");
8320
8384
  migrateConfigSecrets();
8321
8385
  migrateSetupCompleted();
8322
- const { migrateAiModelQualification } = await import("./ai-service-UODCCE4O.js");
8386
+ const { migrateAiModelQualification } = await import("./ai-service-CVZEYKTK.js");
8323
8387
  migrateAiModelQualification();
8324
- await (await import("./db-MF2JNRUW.js")).getDb();
8388
+ await (await import("./db-FO6LXYCW.js")).getDb();
8325
8389
  try {
8326
8390
  const { eq: eq8, and: and6 } = await import("drizzle-orm");
8327
- const { users: users2 } = await import("./schema-PVNG3PQM.js");
8328
- const db = await (await import("./db-MF2JNRUW.js")).getDb();
8391
+ const { users: users2 } = await import("./schema-VEVO7HG6.js");
8392
+ const db = await (await import("./db-FO6LXYCW.js")).getDb();
8329
8393
  await db.update(users2).set({ role: "system" }).where(and6(eq8(users2.user_type, "system"), eq8(users2.role, "user")));
8330
8394
  } catch (err) {
8331
8395
  logger_default.warn("failed to migrate system user role", logger_default.errorData(err));
8332
8396
  }
8333
8397
  try {
8334
- const { migrateAvatarSizes } = await import("./avatar-image-6KY6UU4D.js");
8398
+ const { migrateAvatarSizes } = await import("./avatar-image-7S3WA77A.js");
8335
8399
  await migrateAvatarSizes();
8336
8400
  } catch (err) {
8337
8401
  logger_default.warn("avatar size migration failed", logger_default.errorData(err));
8338
8402
  }
8339
- const { initSandbox } = await import("./sandbox-ZJ7QA6Z6.js");
8403
+ const { initSandbox } = await import("./sandbox-G4X4K3UN.js");
8340
8404
  await initSandbox();
8341
8405
  try {
8342
8406
  await syncBuiltinSkills();
@@ -8363,7 +8427,7 @@ async function startDaemon(opts) {
8363
8427
  logger_default.warn("failed to ensure #system channel", logger_default.errorData(err));
8364
8428
  }
8365
8429
  try {
8366
- const { getOrCreateSystemUser: getOrCreateSystemUser2 } = await import("./auth-CCFAU4GQ.js");
8430
+ const { getOrCreateSystemUser: getOrCreateSystemUser2 } = await import("./auth-A4VGHADI.js");
8367
8431
  await getOrCreateSystemUser2();
8368
8432
  } catch (err) {
8369
8433
  logger_default.warn(
@@ -8372,12 +8436,12 @@ async function startDaemon(opts) {
8372
8436
  );
8373
8437
  }
8374
8438
  const token = process.env.VOLUTE_DAEMON_TOKEN || randomBytes3(32).toString("hex");
8375
- const { readGlobalConfig: readGlobalConfig2 } = await import("./setup-Y2EJI3GG.js");
8439
+ const { readGlobalConfig: readGlobalConfig2 } = await import("./setup-KFYVWTXG.js");
8376
8440
  const globalCfg = readGlobalConfig2();
8377
8441
  let tls;
8378
8442
  if (opts.tailscale || globalCfg.tailscale) {
8379
8443
  try {
8380
- const { getTailscaleTls } = await import("./tailscale-3XOKOW7T.js");
8444
+ const { getTailscaleTls } = await import("./tailscale-MCLY5GYE.js");
8381
8445
  const tlsConfig = await getTailscaleTls();
8382
8446
  tls = { key: tlsConfig.key, cert: tlsConfig.cert };
8383
8447
  logger_default.info("Tailscale HTTPS enabled", { hostname: tlsConfig.hostname });
@@ -8457,14 +8521,14 @@ async function startDaemon(opts) {
8457
8521
  await Promise.all(workers);
8458
8522
  }
8459
8523
  try {
8460
- const { isSetupComplete: isSetupComplete2 } = await import("./setup-Y2EJI3GG.js");
8524
+ const { isSetupComplete: isSetupComplete2 } = await import("./setup-KFYVWTXG.js");
8461
8525
  if (isSetupComplete2()) {
8462
- const { ensureSpiritProject, syncSpiritTemplate } = await import("./spirit-RPBLLUQ5.js");
8463
- const { startSpiritFull } = await import("./mind-service-NB2JMWQZ.js");
8526
+ const { ensureSpiritProject, syncSpiritTemplate } = await import("./spirit-WXN4IDBF.js");
8527
+ const { startSpiritFull } = await import("./mind-service-JFY7UG5E.js");
8464
8528
  await ensureSpiritProject();
8465
8529
  const spiritEntry = await findMind(SPIRIT_NAME);
8466
8530
  if (spiritEntry?.dir) {
8467
- const { registerMindDir } = await import("./delivery-router-N4A7ZC5T.js");
8531
+ const { registerMindDir } = await import("./delivery-router-3QFG2ZEX.js");
8468
8532
  registerMindDir(SPIRIT_NAME, spiritEntry.dir);
8469
8533
  }
8470
8534
  await syncSpiritTemplate();
@@ -8481,7 +8545,7 @@ async function startDaemon(opts) {
8481
8545
  bridgeManager.startBridges(daemonPort).catch((err) => {
8482
8546
  logger_default.warn("failed to start bridges", logger_default.errorData(err));
8483
8547
  });
8484
- import("./cloud-sync-46RS4SDA.js").then(
8548
+ import("./cloud-sync-LQTVDTQ3.js").then(
8485
8549
  ({ consumeQueuedMessages }) => consumeQueuedMessages().catch((err) => {
8486
8550
  logger_default.warn("failed to consume queued cloud messages", logger_default.errorData(err));
8487
8551
  })
@@ -8489,8 +8553,10 @@ async function startDaemon(opts) {
8489
8553
  logger_default.warn("failed to load cloud-sync module", logger_default.errorData(err));
8490
8554
  });
8491
8555
  try {
8492
- const { backfillTemplateHashes, notifyVersionUpdate } = await import("./version-notify-C5CH7CVP.js");
8493
- backfillTemplateHashes();
8556
+ const { backfillTemplateHashes, notifyVersionUpdate, warnStaleTemplates } = await import("./version-notify-XRGTEEDK.js");
8557
+ backfillTemplateHashes().then(() => warnStaleTemplates()).catch((err) => {
8558
+ logger_default.warn("failed to check template staleness", logger_default.errorData(err));
8559
+ });
8494
8560
  notifyVersionUpdate().catch((err) => {
8495
8561
  logger_default.warn("failed to send version update notifications", logger_default.errorData(err));
8496
8562
  });