volute 0.40.0 → 0.40.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.
- package/dist/{accept-AHAOUFBK.js → accept-IVHOHXQS.js} +1 -1
- package/dist/{activity-events-OJZ7G5CG.js → activity-events-DS4QRWBY.js} +4 -4
- package/dist/{ai-service-JMV4KZN4.js → ai-service-AUWIPWLP.js} +5 -5
- package/dist/{api-client-LC5YRA32.js → api-client-NFM6GX2N.js} +1 -1
- package/dist/{archive-BC2MTNPV.js → archive-UDHFZN4G.js} +4 -4
- package/dist/{auth-2IMZ6N5G.js → auth-X6ZITZ7D.js} +5 -5
- package/dist/{bridge-F3ZJEKDN.js → bridge-MSZC4HUT.js} +1 -1
- package/dist/{chat-O5QCGCUG.js → chat-JD3TJINV.js} +9 -9
- package/dist/{chunk-MHFAWJCC.js → chunk-2HZRJ35V.js} +1 -1
- package/dist/{chunk-B7YJUWMM.js → chunk-3Y7UDHO7.js} +3 -3
- package/dist/{chunk-SGC6CDXB.js → chunk-4UMXOMZ6.js} +2 -2
- package/dist/{chunk-43PVCF4V.js → chunk-5EVW4KOD.js} +3 -3
- package/dist/{chunk-FBV22PFY.js → chunk-6SYHHEQ7.js} +1 -1
- package/dist/{chunk-3XSFMN3H.js → chunk-AEAZRTEV.js} +1 -1
- package/dist/{chunk-RMZSICLS.js → chunk-ANSTTB55.js} +1 -1
- package/dist/{chunk-PDSA3ILI.js → chunk-B4WPXYPI.js} +1 -1
- package/dist/{chunk-XUJR6NZW.js → chunk-BLAXARBZ.js} +32 -32
- package/dist/{chunk-2AQCEQYN.js → chunk-DNU6XLE2.js} +1 -1
- package/dist/{chunk-PHR4XQPL.js → chunk-E25SO3QW.js} +3 -3
- package/dist/{chunk-76Q6YLJL.js → chunk-I57LLNAQ.js} +1 -1
- package/dist/{chunk-HAJHDGBV.js → chunk-ITH5ZLZJ.js} +1 -1
- package/dist/{chunk-SOPMVTTW.js → chunk-JYQQDI3M.js} +2 -2
- package/dist/{chunk-PIRL2HAO.js → chunk-KMHC36CA.js} +1 -1
- package/dist/chunk-LMMQX4CK.js +49 -0
- package/dist/{chunk-JSITYTIL.js → chunk-LZ6CQYRO.js} +7 -7
- package/dist/{chunk-FRJ73IWR.js → chunk-MNUXL4XN.js} +67 -3
- package/dist/{chunk-PC55DGNX.js → chunk-NERYUSER.js} +1 -1
- package/dist/{chunk-S4YO5OWV.js → chunk-PKGA23XM.js} +1 -1
- package/dist/{chunk-T26YLQPU.js → chunk-QV7P3TYO.js} +5 -5
- package/dist/{chunk-5VBXKFPO.js → chunk-QYI65HCL.js} +2 -2
- package/dist/{chunk-PGX52NFO.js → chunk-S4SXBQ7F.js} +1 -1
- package/dist/{chunk-HEZM5GCV.js → chunk-SVXOBKQY.js} +2 -2
- package/dist/{chunk-PZTVQL3J.js → chunk-TOANT6FD.js} +2 -2
- package/dist/{chunk-DNQPHLGM.js → chunk-YHWGN4FX.js} +1 -1
- package/dist/{chunk-WGRMLXTH.js → chunk-YTNBO7S6.js} +8 -8
- package/dist/cli.js +24 -24
- package/dist/{clock-BMLJ2TR6.js → clock-YLDJUKBW.js} +3 -3
- package/dist/{cloud-sync-5JF2Z7VM.js → cloud-sync-MAQCJEFJ.js} +17 -17
- package/dist/{config-QB7W3Z7P.js → config-PO4EZLIK.js} +4 -4
- package/dist/connectors/discord-bridge.js +1 -1
- package/dist/connectors/slack-bridge.js +1 -1
- package/dist/connectors/telegram-bridge.js +1 -1
- package/dist/{conversations-LUVHGQSS.js → conversations-AYLXPOGC.js} +5 -5
- package/dist/{create-TDQM3SHV.js → create-T4UJ64WB.js} +4 -4
- package/dist/{create-C3BBFYV7.js → create-ZMTGINV3.js} +1 -1
- package/dist/{daemon-client-2MIPKY3E.js → daemon-client-H6MEKK2W.js} +1 -1
- package/dist/{daemon-restart-XHDJDOPQ.js → daemon-restart-LP2DR24J.js} +9 -9
- package/dist/daemon.js +275 -248
- package/dist/{db-IJL6B26S.js → db-FSYOTHSN.js} +1 -1
- package/dist/db-ZEPKEJJD.js +9 -0
- package/dist/{delete-NLXES2C7.js → delete-TXVOH2OC.js} +3 -3
- package/dist/delivery-manager-VNHLQTTO.js +30 -0
- package/dist/{delivery-router-IU4OMVKZ.js → delivery-router-T6CYTS3M.js} +4 -4
- package/dist/down-6DYO2QV7.js +17 -0
- package/dist/echo-text-QFCH3H6G.js +31 -0
- package/dist/{env-IQ6Q2333.js → env-77IOWG4U.js} +1 -1
- package/dist/exec-5DGKQ5V3.js +17 -0
- package/dist/{export-RKUWSQSG.js → export-TZKOCSCE.js} +6 -6
- package/dist/{extension-LZYHBNLV.js → extension-35NB6GHW.js} +1 -1
- package/dist/{extensions-VN5SEVRP.js → extensions-LQX2N7TI.js} +17 -17
- package/dist/{files-J2CKZ6PK.js → files-WNNVJWJB.js} +4 -4
- package/dist/{import-KVY6BYXG.js → import-BNNFCQ7U.js} +11 -11
- package/dist/{isolation-MM7YHK6J.js → isolation-4Q4P7HRV.js} +4 -4
- package/dist/{join-6SZCA5FX.js → join-E2EJEXZO.js} +3 -3
- package/dist/{list-KHJZJPEJ.js → list-BYCEDASJ.js} +1 -1
- package/dist/{login-GYTH67ES.js → login-JNSIYFVH.js} +1 -1
- package/dist/{login-OHM32QVD.js → login-Y6UAYQVO.js} +3 -3
- package/dist/{logout-YHQLOFLR.js → logout-M6FI62BL.js} +1 -1
- package/dist/{logout-74WBDMOE.js → logout-VHGWVH63.js} +3 -3
- package/dist/message-delivery-7BCYJLH2.js +40 -0
- package/dist/{mind-PUPXDIYQ.js → mind-ELPD6VBP.js} +19 -19
- package/dist/{mind-activity-tracker-7GE24YZE.js → mind-activity-tracker-XFRVGXFS.js} +5 -5
- package/dist/{mind-history-WHCNZ6I5.js → mind-history-W4JPTPTV.js} +1 -1
- package/dist/{mind-list-H3HC2ZRG.js → mind-list-QROHCLGT.js} +1 -1
- package/dist/mind-manager-EDCLALBF.js +30 -0
- package/dist/{mind-profile-7VYRJGFZ.js → mind-profile-3LNKXNPA.js} +2 -2
- package/dist/mind-service-WTOFVNLW.js +36 -0
- package/dist/{mind-sleep-ZL5ZXFTM.js → mind-sleep-PVCMLTAH.js} +1 -1
- package/dist/{mind-status-ZWULKOUO.js → mind-status-RAJFLRCN.js} +1 -1
- package/dist/{mind-wake-HK5ORGUK.js → mind-wake-HZUOVE7J.js} +1 -1
- package/dist/{package-6YPVWGD3.js → package-GO3PHHUF.js} +28 -27
- package/dist/{read-CP7MYMJQ.js → read-OOINVR2H.js} +1 -1
- package/dist/{read-stdin-4B5UYPPM.js → read-stdin-P6HCZUAA.js} +1 -1
- package/dist/{register-XOBFEMI4.js → register-ISOH34RF.js} +1 -1
- package/dist/{registry-L272BZJR.js → registry-GV35XFT7.js} +3 -3
- package/dist/{reject-43AGXB6B.js → reject-ZBWP62X5.js} +1 -1
- package/dist/{restart-O5QIYQJT.js → restart-QBJV5455.js} +1 -1
- package/dist/{sandbox-BQAFYHLE.js → sandbox-5R32QKWQ.js} +5 -5
- package/dist/scheduler-GQBDCGLU.js +30 -0
- package/dist/{schema-HHYJDG7B.js → schema-LYQUDL7G.js} +2 -2
- package/dist/{seed-4V2O7FQE.js → seed-MO2C7CWC.js} +2 -2
- package/dist/{seed-check-HZPVFJKZ.js → seed-check-3WXXRHTC.js} +2 -2
- package/dist/{seed-cmd-JKDEW4MP.js → seed-cmd-ETIF4WD6.js} +4 -4
- package/dist/{seed-create-EPAO3H5F.js → seed-create-BPQC2IOR.js} +6 -6
- package/dist/{seed-sprout-EONCL4DU.js → seed-sprout-TX72K33T.js} +11 -11
- package/dist/{send-232RAHPX.js → send-WO3CVG73.js} +4 -4
- package/dist/{service-AG5BKRUV.js → service-WMV6R6VJ.js} +6 -6
- package/dist/service-install-W3FQXJKB.js +17 -0
- package/dist/{setup-IL7QJZN4.js → setup-OTEC3ZPM.js} +4 -4
- package/dist/{setup-PSA7LJ5U.js → setup-ZTW4FVMQ.js} +9 -9
- package/dist/{skill-ICN6Y2ZF.js → skill-QHACP7EU.js} +1 -1
- package/dist/{skills-SLEY5X6W.js → skills-JEWMHIIE.js} +7 -7
- package/dist/sleep-manager-5277OBHI.js +34 -0
- package/dist/{spirit-7BUHSEO2.js → spirit-NVXWSVKM.js} +9 -9
- package/dist/{split-5YBEQTBF.js → split-7AO4IO42.js} +3 -3
- package/dist/{sprout-JWQ57KF3.js → sprout-NFJZKYEW.js} +2 -2
- package/dist/{src-OYWRPLC6.js → src-2IMB3V27.js} +1 -1
- package/dist/src-OS75U2O7.js +241910 -0
- package/dist/{src-O4PRLMKM.js → src-XNUXP2FP.js} +1 -1
- package/dist/{start-LMXXRR3X.js → start-2U57BBK7.js} +1 -1
- package/dist/{status-6GSOSYOD.js → status-BRYYYO7C.js} +7 -7
- package/dist/{stop-TWDKVEUX.js → stop-QILBDUAR.js} +1 -1
- package/dist/system-chat-LQSJVY55.js +34 -0
- package/dist/{systems-Y2WZV2K4.js → systems-3XTAHA35.js} +4 -4
- package/dist/{tailscale-6MHNLBAX.js → tailscale-X4HRKRTW.js} +3 -3
- package/dist/{template-hash-SSIBEEYK.js → template-hash-DMHSLRDX.js} +1 -1
- package/dist/up-4H7TL6WB.js +19 -0
- package/dist/{update-BT2PY73H.js → update-OY2JYXYK.js} +61 -14
- package/dist/update-check-IUB7QHAF.js +24 -0
- package/dist/{upgrade-RXFZR5FI.js → upgrade-25J6AE47.js} +3 -3
- package/dist/{variant-HHDTW74J.js → variant-5LQOPCQA.js} +1 -1
- package/dist/{version-notify-NFQMI5IY.js → version-notify-N37N2C4G.js} +18 -18
- package/dist/{volute-config-TS62GS6A.js → volute-config-7FO6QKWU.js} +1 -1
- package/dist/web-assets/assets/index-DaUp9iE2.js +79 -0
- package/dist/web-assets/index.html +1 -1
- package/package.json +27 -26
- package/packages/extensions/notes/dist/ui/assets/index-BbgANhFm.js +67 -0
- package/packages/extensions/notes/dist/ui/index.html +1 -1
- package/packages/extensions/pages/dist/ui/assets/index-Dxk-DYrf.js +2 -0
- package/packages/extensions/pages/dist/ui/index.html +1 -1
- package/packages/extensions/plan/dist/ui/assets/index-Cfzs-0G9.js +67 -0
- package/packages/extensions/plan/dist/ui/index.html +1 -1
- package/templates/claude/package.json.tmpl +5 -5
- package/templates/codex/package.json.tmpl +5 -5
- package/templates/pi/package.json.tmpl +6 -6
- package/templates/pi/src/agent.ts +2 -0
- package/templates/pi/src/lib/subagents.ts +19 -17
- package/dist/chunk-K3NQKI34.js +0 -10
- package/dist/db-2GIS7HSG.js +0 -9
- package/dist/delivery-manager-L5WFP2ND.js +0 -30
- package/dist/down-KIJVZ3OC.js +0 -17
- package/dist/echo-text-TJWCUBPB.js +0 -31
- package/dist/exec-BGMU7VXR.js +0 -17
- package/dist/message-delivery-VBBAJX3J.js +0 -40
- package/dist/mind-manager-4Q6KGZHL.js +0 -30
- package/dist/mind-service-7OD4PRO5.js +0 -36
- package/dist/scheduler-7E22Q7IC.js +0 -30
- package/dist/service-install-HVAEUBAH.js +0 -17
- package/dist/sleep-manager-27S7MKJO.js +0 -34
- package/dist/src-6Z4XYDH5.js +0 -2164
- package/dist/system-chat-EIINIHFB.js +0 -34
- package/dist/up-4XS3RCPP.js +0 -19
- package/dist/update-check-Y3HBEMF2.js +0 -18
- package/dist/web-assets/assets/index-Jluza4c-.js +0 -73
- package/packages/extensions/notes/dist/ui/assets/index-Dsua7alJ.js +0 -61
- package/packages/extensions/pages/dist/ui/assets/index-BM7gRdg7.js +0 -2
- package/packages/extensions/plan/dist/ui/assets/index-DWiqtzBv.js +0 -61
package/dist/daemon.js
CHANGED
|
@@ -6,21 +6,21 @@ import {
|
|
|
6
6
|
rejectPending,
|
|
7
7
|
stageFile,
|
|
8
8
|
validateFilePath
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YHWGN4FX.js";
|
|
10
10
|
import {
|
|
11
11
|
findOpenClawSession,
|
|
12
12
|
importOpenClawConnectors,
|
|
13
13
|
importPiSession,
|
|
14
14
|
parseNameFromIdentity
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-SVXOBKQY.js";
|
|
16
16
|
import {
|
|
17
17
|
checkForUpdate,
|
|
18
18
|
checkForUpdateCached,
|
|
19
19
|
getCurrentVersion
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-MNUXL4XN.js";
|
|
21
21
|
import {
|
|
22
22
|
isHomeOnlyArchive
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-I57LLNAQ.js";
|
|
24
24
|
import {
|
|
25
25
|
computeTemplateHash
|
|
26
26
|
} from "./chunk-KAB6UGOL.js";
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
fixModelEscapes,
|
|
31
31
|
getPlatformDriver,
|
|
32
32
|
routeOutboundBridge
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-LZ6CQYRO.js";
|
|
34
34
|
import {
|
|
35
35
|
getBridgeConfig,
|
|
36
36
|
readBridgesConfig,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
resolveChannelMapping,
|
|
40
40
|
setBridgeConfig,
|
|
41
41
|
setChannelMapping
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-PKGA23XM.js";
|
|
43
43
|
import {
|
|
44
44
|
PROMPT_DEFAULTS,
|
|
45
45
|
PROMPT_KEYS,
|
|
@@ -109,15 +109,15 @@ import {
|
|
|
109
109
|
trackToolUse,
|
|
110
110
|
uninstallNpmExtension,
|
|
111
111
|
writeSystemsConfig
|
|
112
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-BLAXARBZ.js";
|
|
113
113
|
import {
|
|
114
114
|
loadMergedEnv,
|
|
115
115
|
mindEnvPath,
|
|
116
116
|
readEnv,
|
|
117
117
|
sharedEnvPath,
|
|
118
118
|
writeEnv
|
|
119
|
-
} from "./chunk-
|
|
120
|
-
import "./chunk-
|
|
119
|
+
} from "./chunk-ITH5ZLZJ.js";
|
|
120
|
+
import "./chunk-YTNBO7S6.js";
|
|
121
121
|
import {
|
|
122
122
|
applyInitFiles,
|
|
123
123
|
composeTemplate,
|
|
@@ -144,7 +144,7 @@ import {
|
|
|
144
144
|
syncBuiltinSkills,
|
|
145
145
|
uninstallSkill,
|
|
146
146
|
updateSkill
|
|
147
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-QV7P3TYO.js";
|
|
148
148
|
import {
|
|
149
149
|
addMessage,
|
|
150
150
|
createChannel,
|
|
@@ -176,25 +176,25 @@ import {
|
|
|
176
176
|
setConversationPrivate,
|
|
177
177
|
subscribe as subscribe2,
|
|
178
178
|
updateChannelSettings
|
|
179
|
-
} from "./chunk-
|
|
179
|
+
} from "./chunk-3Y7UDHO7.js";
|
|
180
180
|
import {
|
|
181
181
|
readVoluteConfig,
|
|
182
182
|
writeVoluteConfig
|
|
183
183
|
} from "./chunk-CU6OFXMM.js";
|
|
184
|
-
import "./chunk-
|
|
184
|
+
import "./chunk-KMHC36CA.js";
|
|
185
185
|
import {
|
|
186
186
|
getActiveMinds,
|
|
187
187
|
onMindEvent,
|
|
188
188
|
stopAll
|
|
189
|
-
} from "./chunk-
|
|
189
|
+
} from "./chunk-ANSTTB55.js";
|
|
190
190
|
import {
|
|
191
191
|
extractTextContent
|
|
192
|
-
} from "./chunk-
|
|
192
|
+
} from "./chunk-NERYUSER.js";
|
|
193
193
|
import {
|
|
194
194
|
exec,
|
|
195
195
|
gitExec,
|
|
196
196
|
resolveVoluteBin
|
|
197
|
-
} from "./chunk-
|
|
197
|
+
} from "./chunk-AEAZRTEV.js";
|
|
198
198
|
import {
|
|
199
199
|
chownMindDir,
|
|
200
200
|
createMindUser,
|
|
@@ -202,7 +202,7 @@ import {
|
|
|
202
202
|
ensureVoluteGroup,
|
|
203
203
|
isIsolationEnabled,
|
|
204
204
|
wrapForIsolation
|
|
205
|
-
} from "./chunk-
|
|
205
|
+
} from "./chunk-6SYHHEQ7.js";
|
|
206
206
|
import {
|
|
207
207
|
getAiConfig,
|
|
208
208
|
getAvailableModels,
|
|
@@ -219,12 +219,12 @@ import {
|
|
|
219
219
|
setProviderRefreshHook,
|
|
220
220
|
setUtilityModel,
|
|
221
221
|
unqualifyModelId
|
|
222
|
-
} from "./chunk-
|
|
222
|
+
} from "./chunk-S4SXBQ7F.js";
|
|
223
223
|
import {
|
|
224
224
|
isSetupComplete,
|
|
225
225
|
readGlobalConfig,
|
|
226
226
|
writeGlobalConfig
|
|
227
|
-
} from "./chunk-
|
|
227
|
+
} from "./chunk-DNU6XLE2.js";
|
|
228
228
|
import {
|
|
229
229
|
approveUser,
|
|
230
230
|
changePassword,
|
|
@@ -243,11 +243,11 @@ import {
|
|
|
243
243
|
syncMindProfile,
|
|
244
244
|
updateUserProfile,
|
|
245
245
|
verifyUser
|
|
246
|
-
} from "./chunk-
|
|
246
|
+
} from "./chunk-E25SO3QW.js";
|
|
247
247
|
import {
|
|
248
248
|
broadcast,
|
|
249
249
|
subscribe
|
|
250
|
-
} from "./chunk-
|
|
250
|
+
} from "./chunk-QYI65HCL.js";
|
|
251
251
|
import {
|
|
252
252
|
logBuffer,
|
|
253
253
|
logger_default
|
|
@@ -277,7 +277,7 @@ import {
|
|
|
277
277
|
validateMindName,
|
|
278
278
|
voluteHome,
|
|
279
279
|
voluteSystemDir
|
|
280
|
-
} from "./chunk-
|
|
280
|
+
} from "./chunk-B4WPXYPI.js";
|
|
281
281
|
import {
|
|
282
282
|
activity,
|
|
283
283
|
channels,
|
|
@@ -289,14 +289,14 @@ import {
|
|
|
289
289
|
systemPrompts,
|
|
290
290
|
turns,
|
|
291
291
|
users
|
|
292
|
-
} from "./chunk-
|
|
293
|
-
import "./chunk-
|
|
292
|
+
} from "./chunk-2HZRJ35V.js";
|
|
293
|
+
import "./chunk-LMMQX4CK.js";
|
|
294
294
|
|
|
295
295
|
// packages/daemon/src/daemon.ts
|
|
296
296
|
import { randomBytes } from "crypto";
|
|
297
297
|
import { mkdirSync as mkdirSync10, readFileSync as readFileSync10, unlinkSync as unlinkSync2, writeFileSync as writeFileSync9 } from "fs";
|
|
298
298
|
import { homedir as homedir3 } from "os";
|
|
299
|
-
import { resolve as
|
|
299
|
+
import { resolve as resolve17 } from "path";
|
|
300
300
|
import { format } from "util";
|
|
301
301
|
|
|
302
302
|
// packages/daemon/src/lib/daemon/bridge-manager.ts
|
|
@@ -506,8 +506,8 @@ var BridgeManager = class {
|
|
|
506
506
|
if (!tracked) return;
|
|
507
507
|
this.stopping.add(platform);
|
|
508
508
|
this.bridges.delete(platform);
|
|
509
|
-
await new Promise((
|
|
510
|
-
tracked.child.on("exit", () =>
|
|
509
|
+
await new Promise((resolve18) => {
|
|
510
|
+
tracked.child.on("exit", () => resolve18());
|
|
511
511
|
try {
|
|
512
512
|
if (tracked.child.pid) {
|
|
513
513
|
process.kill(-tracked.child.pid, "SIGTERM");
|
|
@@ -518,7 +518,7 @@ var BridgeManager = class {
|
|
|
518
518
|
if (err instanceof Error && err.code !== "ESRCH") {
|
|
519
519
|
blog.warn(`failed to stop bridge ${platform}`, logger_default.errorData(err));
|
|
520
520
|
}
|
|
521
|
-
|
|
521
|
+
resolve18();
|
|
522
522
|
}
|
|
523
523
|
setTimeout(() => {
|
|
524
524
|
try {
|
|
@@ -529,7 +529,7 @@ var BridgeManager = class {
|
|
|
529
529
|
}
|
|
530
530
|
} catch {
|
|
531
531
|
}
|
|
532
|
-
|
|
532
|
+
resolve18();
|
|
533
533
|
}, 5e3);
|
|
534
534
|
});
|
|
535
535
|
this.stopping.delete(platform);
|
|
@@ -993,10 +993,10 @@ var app = new Hono().post("/restart", requireAdmin, (c) => {
|
|
|
993
993
|
stream.writeSSE({ data: JSON.stringify(entry) }).catch(() => {
|
|
994
994
|
});
|
|
995
995
|
});
|
|
996
|
-
await new Promise((
|
|
996
|
+
await new Promise((resolve18) => {
|
|
997
997
|
stream.onAbort(() => {
|
|
998
998
|
unsubscribe();
|
|
999
|
-
|
|
999
|
+
resolve18();
|
|
1000
1000
|
});
|
|
1001
1001
|
});
|
|
1002
1002
|
});
|
|
@@ -1309,8 +1309,8 @@ var app = new Hono().post("/restart", requireAdmin, (c) => {
|
|
|
1309
1309
|
createdAt: Date.now()
|
|
1310
1310
|
};
|
|
1311
1311
|
oauthFlows.set(flowId, flow);
|
|
1312
|
-
const promptPromise = needsManualCode ? new Promise((
|
|
1313
|
-
flow.resolveCode =
|
|
1312
|
+
const promptPromise = needsManualCode ? new Promise((resolve18) => {
|
|
1313
|
+
flow.resolveCode = resolve18;
|
|
1314
1314
|
}) : void 0;
|
|
1315
1315
|
oauthProvider.login({
|
|
1316
1316
|
onAuth: (info) => {
|
|
@@ -1340,7 +1340,7 @@ var app = new Hono().post("/restart", requireAdmin, (c) => {
|
|
|
1340
1340
|
existing.error = err instanceof Error ? err.message : String(err);
|
|
1341
1341
|
}
|
|
1342
1342
|
});
|
|
1343
|
-
await new Promise((
|
|
1343
|
+
await new Promise((resolve18) => setTimeout(resolve18, 2e3));
|
|
1344
1344
|
const state = oauthFlows.get(flowId);
|
|
1345
1345
|
return c.json({
|
|
1346
1346
|
flowId,
|
|
@@ -1598,8 +1598,8 @@ var app2 = new Hono2().get("/events", async (c) => {
|
|
|
1598
1598
|
});
|
|
1599
1599
|
}, 15e3);
|
|
1600
1600
|
cleanups.push(() => clearInterval(keepAlive));
|
|
1601
|
-
await new Promise((
|
|
1602
|
-
stream.onAbort(() =>
|
|
1601
|
+
await new Promise((resolve18) => {
|
|
1602
|
+
stream.onAbort(() => resolve18());
|
|
1603
1603
|
});
|
|
1604
1604
|
} finally {
|
|
1605
1605
|
for (const cleanup of cleanups) {
|
|
@@ -2002,7 +2002,7 @@ var app4 = new Hono4().post("/:platform/inbound", zValidator3("json", inboundSch
|
|
|
2002
2002
|
}
|
|
2003
2003
|
const participants = await getParticipants(channel.id);
|
|
2004
2004
|
if (!participants.some((p) => p.userId === puppet.id)) {
|
|
2005
|
-
const { addParticipant } = await import("./conversations-
|
|
2005
|
+
const { addParticipant } = await import("./conversations-AYLXPOGC.js");
|
|
2006
2006
|
await addParticipant(channel.id, puppet.id);
|
|
2007
2007
|
}
|
|
2008
2008
|
const contentBlocks = body.content;
|
|
@@ -2095,8 +2095,8 @@ async function fanOutToBridgedMinds(opts) {
|
|
|
2095
2095
|
const participants = await getParticipants(opts.conversationId);
|
|
2096
2096
|
const mindParticipants = participants.filter((p) => p.userType === "mind");
|
|
2097
2097
|
const participantNames = participants.map((p) => p.username);
|
|
2098
|
-
const { getMindManager: getMindManager2 } = await import("./mind-manager-
|
|
2099
|
-
const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-
|
|
2098
|
+
const { getMindManager: getMindManager2 } = await import("./mind-manager-EDCLALBF.js");
|
|
2099
|
+
const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-5277OBHI.js");
|
|
2100
2100
|
const manager = getMindManager2();
|
|
2101
2101
|
const sm = getSleepManagerIfReady2();
|
|
2102
2102
|
const targetMinds = mindParticipants.filter((ap) => {
|
|
@@ -2182,13 +2182,13 @@ var config_default = config;
|
|
|
2182
2182
|
|
|
2183
2183
|
// packages/daemon/src/web/api/env.ts
|
|
2184
2184
|
import { Hono as Hono7 } from "hono";
|
|
2185
|
-
var app6 = new Hono7().get("/:name/env", async (c) => {
|
|
2185
|
+
var app6 = new Hono7().get("/:name/env", requireSelf(), async (c) => {
|
|
2186
2186
|
const name = c.req.param("name");
|
|
2187
2187
|
if (!await findMind(name)) return c.json({ error: "Mind not found" }, 404);
|
|
2188
2188
|
const shared = readEnv(sharedEnvPath());
|
|
2189
2189
|
const mind = readEnv(mindEnvPath(name));
|
|
2190
2190
|
return c.json({ shared, mind });
|
|
2191
|
-
}).get("/:name/env/:key", async (c) => {
|
|
2191
|
+
}).get("/:name/env/:key", requireSelf(), async (c) => {
|
|
2192
2192
|
const name = c.req.param("name");
|
|
2193
2193
|
if (!await findMind(name)) return c.json({ error: "Mind not found" }, 404);
|
|
2194
2194
|
const key = c.req.param("key");
|
|
@@ -2225,7 +2225,7 @@ var app6 = new Hono7().get("/:name/env", async (c) => {
|
|
|
2225
2225
|
writeEnv(path, env);
|
|
2226
2226
|
return c.json({ ok: true });
|
|
2227
2227
|
});
|
|
2228
|
-
var sharedEnvApp = new Hono7().get("/", (c) => {
|
|
2228
|
+
var sharedEnvApp = new Hono7().get("/", requireAdmin, (c) => {
|
|
2229
2229
|
return c.json(readEnv(sharedEnvPath()));
|
|
2230
2230
|
}).put("/:key", requireAdmin, async (c) => {
|
|
2231
2231
|
const key = c.req.param("key");
|
|
@@ -2261,7 +2261,7 @@ var app7 = new Hono8().get("/", (c) => {
|
|
|
2261
2261
|
}).get("/all", (c) => {
|
|
2262
2262
|
const detail = c.req.query("detail") === "true";
|
|
2263
2263
|
return c.json(detail ? getAllDiscoveredExtensionsDetailed() : getAllDiscoveredExtensions());
|
|
2264
|
-
}).put("/:id/enabled", async (c) => {
|
|
2264
|
+
}).put("/:id/enabled", requireAdmin, async (c) => {
|
|
2265
2265
|
const { id } = c.req.param();
|
|
2266
2266
|
const body = await c.req.json().catch(() => null);
|
|
2267
2267
|
if (!body || typeof body.enabled !== "boolean") {
|
|
@@ -2273,7 +2273,7 @@ var app7 = new Hono8().get("/", (c) => {
|
|
|
2273
2273
|
return c.json({ error: err.message }, 404);
|
|
2274
2274
|
}
|
|
2275
2275
|
return c.json({ ok: true, requiresRestart: true });
|
|
2276
|
-
}).post("/install", async (c) => {
|
|
2276
|
+
}).post("/install", requireAdmin, async (c) => {
|
|
2277
2277
|
const body = await c.req.json();
|
|
2278
2278
|
const pkg = body.package?.trim();
|
|
2279
2279
|
if (!pkg) {
|
|
@@ -2287,7 +2287,7 @@ var app7 = new Hono8().get("/", (c) => {
|
|
|
2287
2287
|
const isValidation = message.includes("already installed") || message.includes("Invalid package");
|
|
2288
2288
|
return c.json({ error: message }, isValidation ? 400 : 500);
|
|
2289
2289
|
}
|
|
2290
|
-
}).delete("/uninstall/:package", async (c) => {
|
|
2290
|
+
}).delete("/uninstall/:package", requireAdmin, async (c) => {
|
|
2291
2291
|
const pkg = c.req.param("package");
|
|
2292
2292
|
try {
|
|
2293
2293
|
await uninstallNpmExtension(pkg);
|
|
@@ -2308,7 +2308,7 @@ async function notifyMind(mindName, message) {
|
|
|
2308
2308
|
const entry = await findMind(mindName);
|
|
2309
2309
|
if (!entry) return;
|
|
2310
2310
|
try {
|
|
2311
|
-
const { sendSystemMessage } = await import("./system-chat-
|
|
2311
|
+
const { sendSystemMessage } = await import("./system-chat-LQSJVY55.js");
|
|
2312
2312
|
await sendSystemMessage(mindName, message);
|
|
2313
2313
|
} catch (err) {
|
|
2314
2314
|
logger_default.warn(`[file-sharing] notify mind ${mindName} failed`, logger_default.errorData(err));
|
|
@@ -2357,11 +2357,11 @@ var app8 = new Hono9().post("/:name/files/send", requireSelf(), async (c) => {
|
|
|
2357
2357
|
`[file] ${senderName} sent ${filename} (${sizeStr}) \u2014 run: volute chat accept ${id}`
|
|
2358
2358
|
);
|
|
2359
2359
|
return c.json({ status: "pending", id }, 200);
|
|
2360
|
-
}).get("/:name/files/pending", async (c) => {
|
|
2360
|
+
}).get("/:name/files/pending", requireSelf(), async (c) => {
|
|
2361
2361
|
const name = c.req.param("name");
|
|
2362
2362
|
if (!await findMind(name)) return c.json({ error: "Mind not found" }, 404);
|
|
2363
2363
|
return c.json(listPending(name));
|
|
2364
|
-
}).post("/:name/files/accept", async (c) => {
|
|
2364
|
+
}).post("/:name/files/accept", requireSelf(), async (c) => {
|
|
2365
2365
|
const name = c.req.param("name");
|
|
2366
2366
|
const entry = await findMind(name);
|
|
2367
2367
|
if (!entry) return c.json({ error: "Mind not found" }, 404);
|
|
@@ -2383,7 +2383,7 @@ var app8 = new Hono9().post("/:name/files/send", requireSelf(), async (c) => {
|
|
|
2383
2383
|
}
|
|
2384
2384
|
await notifyMind(result.sender, `[file] ${name} accepted ${result.filename}`);
|
|
2385
2385
|
return c.json({ ok: true, destPath: result.destPath });
|
|
2386
|
-
}).post("/:name/files/reject", async (c) => {
|
|
2386
|
+
}).post("/:name/files/reject", requireSelf(), async (c) => {
|
|
2387
2387
|
const name = c.req.param("name");
|
|
2388
2388
|
if (!await findMind(name)) return c.json({ error: "Mind not found" }, 404);
|
|
2389
2389
|
const body = await c.req.json();
|
|
@@ -2400,7 +2400,7 @@ var app8 = new Hono9().post("/:name/files/send", requireSelf(), async (c) => {
|
|
|
2400
2400
|
}
|
|
2401
2401
|
await notifyMind(result.sender, `[file] ${name} rejected ${result.filename}`);
|
|
2402
2402
|
return c.json({ ok: true });
|
|
2403
|
-
}).post("/:name/files/stage", async (c) => {
|
|
2403
|
+
}).post("/:name/files/stage", requireSelf(), async (c) => {
|
|
2404
2404
|
const receiverName = c.req.param("name");
|
|
2405
2405
|
const receiverEntry = await findMind(receiverName);
|
|
2406
2406
|
if (!receiverEntry) return c.json({ error: "Mind not found" }, 404);
|
|
@@ -2433,8 +2433,34 @@ var file_sharing_default = app8;
|
|
|
2433
2433
|
// packages/daemon/src/web/api/files.ts
|
|
2434
2434
|
import { mkdirSync as mkdirSync3, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
2435
2435
|
import { readdir, readFile, realpath, stat } from "fs/promises";
|
|
2436
|
-
import { extname as extname2, resolve as
|
|
2436
|
+
import { extname as extname2, resolve as resolve6 } from "path";
|
|
2437
2437
|
import { Hono as Hono10 } from "hono";
|
|
2438
|
+
|
|
2439
|
+
// packages/daemon/src/lib/util/paths.ts
|
|
2440
|
+
import { resolve as resolve5, sep } from "path";
|
|
2441
|
+
var PathTraversalError = class extends Error {
|
|
2442
|
+
constructor(base, userPath) {
|
|
2443
|
+
super(`Path "${userPath}" escapes base directory "${base}"`);
|
|
2444
|
+
this.name = "PathTraversalError";
|
|
2445
|
+
}
|
|
2446
|
+
};
|
|
2447
|
+
function resolveWithinBase(base, userPath) {
|
|
2448
|
+
const resolvedBase = resolve5(base);
|
|
2449
|
+
const target = resolve5(resolvedBase, userPath);
|
|
2450
|
+
if (target !== resolvedBase && !target.startsWith(resolvedBase + sep)) {
|
|
2451
|
+
throw new PathTraversalError(base, userPath);
|
|
2452
|
+
}
|
|
2453
|
+
return target;
|
|
2454
|
+
}
|
|
2455
|
+
function safeResolveWithinBase(base, userPath) {
|
|
2456
|
+
try {
|
|
2457
|
+
return resolveWithinBase(base, userPath);
|
|
2458
|
+
} catch {
|
|
2459
|
+
return null;
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
|
|
2463
|
+
// packages/daemon/src/web/api/files.ts
|
|
2438
2464
|
var AVATAR_MIME2 = {
|
|
2439
2465
|
".png": "image/png",
|
|
2440
2466
|
".jpg": "image/jpeg",
|
|
@@ -2478,13 +2504,14 @@ var app9 = new Hono10().post("/:name/avatar", requireSelf(), async (c) => {
|
|
|
2478
2504
|
return c.json({ error: "Invalid file type (png, jpg, gif, webp only)" }, 400);
|
|
2479
2505
|
}
|
|
2480
2506
|
const dir = entry.dir ?? mindDir(name);
|
|
2481
|
-
const homeDir =
|
|
2507
|
+
const homeDir = resolve6(dir, "home");
|
|
2482
2508
|
const filename = `avatar${ext}`;
|
|
2483
|
-
const avatarPath =
|
|
2509
|
+
const avatarPath = resolve6(homeDir, filename);
|
|
2484
2510
|
const config2 = readVoluteConfig(dir) ?? {};
|
|
2485
2511
|
const oldAvatar = config2.profile?.avatar;
|
|
2486
2512
|
if (oldAvatar && oldAvatar !== filename) {
|
|
2487
|
-
|
|
2513
|
+
const oldAvatarPath = safeResolveWithinBase(homeDir, oldAvatar);
|
|
2514
|
+
if (oldAvatarPath) rmSync2(oldAvatarPath, { force: true });
|
|
2488
2515
|
}
|
|
2489
2516
|
const buffer2 = Buffer.from(await file.arrayBuffer());
|
|
2490
2517
|
mkdirSync3(homeDir, { recursive: true });
|
|
@@ -2506,8 +2533,8 @@ var app9 = new Hono10().post("/:name/avatar", requireSelf(), async (c) => {
|
|
|
2506
2533
|
const ext = extname2(config2.profile.avatar).toLowerCase();
|
|
2507
2534
|
const mime = AVATAR_MIME2[ext];
|
|
2508
2535
|
if (!mime) return c.json({ error: "Invalid avatar extension" }, 400);
|
|
2509
|
-
const homeDir =
|
|
2510
|
-
const avatarPath =
|
|
2536
|
+
const homeDir = resolve6(dir, "home");
|
|
2537
|
+
const avatarPath = resolve6(homeDir, config2.profile.avatar);
|
|
2511
2538
|
if (!avatarPath.startsWith(`${homeDir}/`)) return c.json({ error: "Invalid avatar path" }, 400);
|
|
2512
2539
|
let realAvatarPath;
|
|
2513
2540
|
try {
|
|
@@ -2535,7 +2562,7 @@ var app9 = new Hono10().post("/:name/avatar", requireSelf(), async (c) => {
|
|
|
2535
2562
|
const name = c.req.param("name");
|
|
2536
2563
|
const entry = await findMind(name);
|
|
2537
2564
|
if (!entry) return c.json({ error: "Mind not found" }, 404);
|
|
2538
|
-
const homeDir =
|
|
2565
|
+
const homeDir = resolve6(entry.dir ?? mindDir(name), "home");
|
|
2539
2566
|
let entries;
|
|
2540
2567
|
try {
|
|
2541
2568
|
entries = await readdir(homeDir, { withFileTypes: true });
|
|
@@ -2550,10 +2577,10 @@ var app9 = new Hono10().post("/:name/avatar", requireSelf(), async (c) => {
|
|
|
2550
2577
|
const name = c.req.param("name");
|
|
2551
2578
|
const entry = await findMind(name);
|
|
2552
2579
|
if (!entry) return c.json({ error: "Mind not found" }, 404);
|
|
2553
|
-
const homeDir =
|
|
2580
|
+
const homeDir = resolve6(entry.dir ?? mindDir(name), "home");
|
|
2554
2581
|
const wildcard = c.req.path.replace(new RegExp(`^.*/minds/${name}/files`), "") || "/";
|
|
2555
2582
|
const relativePath = wildcard.slice(1);
|
|
2556
|
-
const requestedPath =
|
|
2583
|
+
const requestedPath = resolve6(homeDir, relativePath);
|
|
2557
2584
|
if (requestedPath !== homeDir && !requestedPath.startsWith(`${homeDir}/`))
|
|
2558
2585
|
return c.text("Forbidden", 403);
|
|
2559
2586
|
if (relativePath.split("/").some((seg) => seg.startsWith("."))) return c.text("Forbidden", 403);
|
|
@@ -2985,16 +3012,16 @@ import { Hono as Hono12 } from "hono";
|
|
|
2985
3012
|
// packages/daemon/src/lib/mind/identity.ts
|
|
2986
3013
|
import { createHash, generateKeyPairSync, sign, verify } from "crypto";
|
|
2987
3014
|
import { existsSync as existsSync4, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "fs";
|
|
2988
|
-
import { resolve as
|
|
3015
|
+
import { resolve as resolve7 } from "path";
|
|
2989
3016
|
function generateIdentity(mindDir2) {
|
|
2990
|
-
const identityDir =
|
|
3017
|
+
const identityDir = resolve7(mindDir2, ".mind/identity");
|
|
2991
3018
|
mkdirSync4(identityDir, { recursive: true });
|
|
2992
3019
|
const { publicKey, privateKey } = generateKeyPairSync("ed25519", {
|
|
2993
3020
|
publicKeyEncoding: { type: "spki", format: "pem" },
|
|
2994
3021
|
privateKeyEncoding: { type: "pkcs8", format: "pem" }
|
|
2995
3022
|
});
|
|
2996
|
-
const privatePath =
|
|
2997
|
-
const publicPath =
|
|
3023
|
+
const privatePath = resolve7(identityDir, "private.pem");
|
|
3024
|
+
const publicPath = resolve7(identityDir, "public.pem");
|
|
2998
3025
|
writeFileSync4(privatePath, privateKey, { mode: 384 });
|
|
2999
3026
|
writeFileSync4(publicPath, publicKey, { mode: 420 });
|
|
3000
3027
|
const config2 = readVoluteConfig(mindDir2) ?? {};
|
|
@@ -3009,7 +3036,7 @@ function getPublicKey(mindDir2) {
|
|
|
3009
3036
|
const config2 = readVoluteConfig(mindDir2);
|
|
3010
3037
|
const relPath = config2?.identity?.publicKey;
|
|
3011
3038
|
if (!relPath) return null;
|
|
3012
|
-
const fullPath =
|
|
3039
|
+
const fullPath = resolve7(mindDir2, relPath);
|
|
3013
3040
|
if (!existsSync4(fullPath)) return null;
|
|
3014
3041
|
return readFileSync5(fullPath, "utf-8");
|
|
3015
3042
|
}
|
|
@@ -3059,14 +3086,14 @@ var keys_default = app10;
|
|
|
3059
3086
|
// packages/daemon/src/web/api/logs.ts
|
|
3060
3087
|
import { spawn as spawn2 } from "child_process";
|
|
3061
3088
|
import { existsSync as existsSync5 } from "fs";
|
|
3062
|
-
import { resolve as
|
|
3089
|
+
import { resolve as resolve8 } from "path";
|
|
3063
3090
|
import { Hono as Hono13 } from "hono";
|
|
3064
3091
|
import { streamSSE as streamSSE3 } from "hono/streaming";
|
|
3065
|
-
var app11 = new Hono13().get("/:name/logs", async (c) => {
|
|
3092
|
+
var app11 = new Hono13().get("/:name/logs", requireSelf(), async (c) => {
|
|
3066
3093
|
const name = c.req.param("name");
|
|
3067
3094
|
const entry = await findMind(name);
|
|
3068
3095
|
if (!entry) return c.json({ error: "Mind not found" }, 404);
|
|
3069
|
-
const logFile =
|
|
3096
|
+
const logFile = resolve8(stateDir(name), "logs", "mind.log");
|
|
3070
3097
|
if (!existsSync5(logFile)) {
|
|
3071
3098
|
return c.json({ error: "No log file found" }, 404);
|
|
3072
3099
|
}
|
|
@@ -3085,16 +3112,16 @@ var app11 = new Hono13().get("/:name/logs", async (c) => {
|
|
|
3085
3112
|
stream.onAbort(() => {
|
|
3086
3113
|
tail.kill();
|
|
3087
3114
|
});
|
|
3088
|
-
await new Promise((
|
|
3089
|
-
tail.on("exit",
|
|
3090
|
-
stream.onAbort(
|
|
3115
|
+
await new Promise((resolve18) => {
|
|
3116
|
+
tail.on("exit", resolve18);
|
|
3117
|
+
stream.onAbort(resolve18);
|
|
3091
3118
|
});
|
|
3092
3119
|
});
|
|
3093
|
-
}).get("/:name/logs/tail", async (c) => {
|
|
3120
|
+
}).get("/:name/logs/tail", requireSelf(), async (c) => {
|
|
3094
3121
|
const name = c.req.param("name");
|
|
3095
3122
|
const entry = await findMind(name);
|
|
3096
3123
|
if (!entry) return c.json({ error: "Mind not found" }, 404);
|
|
3097
|
-
const logFile =
|
|
3124
|
+
const logFile = resolve8(stateDir(name), "logs", "mind.log");
|
|
3098
3125
|
if (!existsSync5(logFile)) {
|
|
3099
3126
|
return c.json({ error: "No log file found" }, 404);
|
|
3100
3127
|
}
|
|
@@ -3105,8 +3132,8 @@ var app11 = new Hono13().get("/:name/logs", async (c) => {
|
|
|
3105
3132
|
tail.stdout.on("data", (data) => {
|
|
3106
3133
|
output += data.toString();
|
|
3107
3134
|
});
|
|
3108
|
-
await new Promise((
|
|
3109
|
-
tail.on("exit",
|
|
3135
|
+
await new Promise((resolve18) => {
|
|
3136
|
+
tail.on("exit", resolve18);
|
|
3110
3137
|
});
|
|
3111
3138
|
return c.text(output);
|
|
3112
3139
|
});
|
|
@@ -3203,7 +3230,7 @@ import {
|
|
|
3203
3230
|
rmSync as rmSync4,
|
|
3204
3231
|
writeFileSync as writeFileSync7
|
|
3205
3232
|
} from "fs";
|
|
3206
|
-
import { resolve as
|
|
3233
|
+
import { basename, resolve as resolve11 } from "path";
|
|
3207
3234
|
import { zValidator as zValidator5 } from "@hono/zod-validator";
|
|
3208
3235
|
import { and as and4, desc as desc3, eq as eq5, sql as sql2 } from "drizzle-orm";
|
|
3209
3236
|
import { Hono as Hono15 } from "hono";
|
|
@@ -3248,18 +3275,18 @@ function classify(raw) {
|
|
|
3248
3275
|
|
|
3249
3276
|
// packages/daemon/src/lib/mind/consolidate.ts
|
|
3250
3277
|
import { readdirSync, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "fs";
|
|
3251
|
-
import { resolve as
|
|
3278
|
+
import { resolve as resolve9 } from "path";
|
|
3252
3279
|
async function consolidateMemory(mindDir2) {
|
|
3253
|
-
const soulPath =
|
|
3254
|
-
const memoryPath =
|
|
3255
|
-
const memoryDir =
|
|
3280
|
+
const soulPath = resolve9(mindDir2, "home/SOUL.md");
|
|
3281
|
+
const memoryPath = resolve9(mindDir2, "home/MEMORY.md");
|
|
3282
|
+
const memoryDir = resolve9(mindDir2, "home/memory");
|
|
3256
3283
|
const soul = readFileSync6(soulPath, "utf-8");
|
|
3257
3284
|
const logs = [];
|
|
3258
3285
|
try {
|
|
3259
3286
|
const files = readdirSync(memoryDir).filter((f) => /^\d{4}-\d{2}-\d{2}\.md$/.test(f)).sort();
|
|
3260
3287
|
for (const filename of files) {
|
|
3261
3288
|
const date = filename.replace(".md", "");
|
|
3262
|
-
const content2 = readFileSync6(
|
|
3289
|
+
const content2 = readFileSync6(resolve9(memoryDir, filename), "utf-8").trim();
|
|
3263
3290
|
if (content2) {
|
|
3264
3291
|
logs.push(`### ${date}
|
|
3265
3292
|
|
|
@@ -3327,7 +3354,7 @@ async function cleanupVariant(variantName, projectRoot, variantPath, opts) {
|
|
|
3327
3354
|
logger_default.warn(`failed to stop variant ${variantName}`, logger_default.errorData(err));
|
|
3328
3355
|
}
|
|
3329
3356
|
}
|
|
3330
|
-
const { findMind: findMind2 } = await import("./registry-
|
|
3357
|
+
const { findMind: findMind2 } = await import("./registry-GV35XFT7.js");
|
|
3331
3358
|
const variantEntry = await findMind2(variantName);
|
|
3332
3359
|
const branchName = variantEntry?.branch ?? variantName;
|
|
3333
3360
|
if (existsSync6(variantPath)) {
|
|
@@ -3379,7 +3406,7 @@ function validateBranchName(branch) {
|
|
|
3379
3406
|
import { randomUUID } from "crypto";
|
|
3380
3407
|
import { mkdirSync as mkdirSync5, readFileSync as readFileSync7, writeFileSync as writeFileSync6 } from "fs";
|
|
3381
3408
|
import { homedir } from "os";
|
|
3382
|
-
import { resolve as
|
|
3409
|
+
import { resolve as resolve10 } from "path";
|
|
3383
3410
|
function convertSession(opts) {
|
|
3384
3411
|
const lines = readFileSync7(opts.sessionPath, "utf-8").trim().split("\n");
|
|
3385
3412
|
const sessionId = randomUUID();
|
|
@@ -3495,9 +3522,9 @@ function convertSession(opts) {
|
|
|
3495
3522
|
}
|
|
3496
3523
|
}
|
|
3497
3524
|
const projectId = opts.projectDir.replace(/\//g, "-");
|
|
3498
|
-
const sdkDir =
|
|
3525
|
+
const sdkDir = resolve10(homedir(), ".claude", "projects", projectId);
|
|
3499
3526
|
mkdirSync5(sdkDir, { recursive: true });
|
|
3500
|
-
const sdkPath =
|
|
3527
|
+
const sdkPath = resolve10(sdkDir, `${sessionId}.jsonl`);
|
|
3501
3528
|
writeFileSync6(sdkPath, `${sdkEvents.join("\n")}
|
|
3502
3529
|
`);
|
|
3503
3530
|
console.log(`Converted ${sdkEvents.length} messages \u2192 ${sdkPath}`);
|
|
@@ -3584,7 +3611,7 @@ async function getMindStatus(name, port, registryRunning) {
|
|
|
3584
3611
|
const manager = getMindManager();
|
|
3585
3612
|
let status = "stopped";
|
|
3586
3613
|
try {
|
|
3587
|
-
const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-
|
|
3614
|
+
const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-5277OBHI.js");
|
|
3588
3615
|
if (getSleepManagerIfReady2()?.isSleeping(name)) {
|
|
3589
3616
|
status = "sleeping";
|
|
3590
3617
|
}
|
|
@@ -3630,7 +3657,7 @@ async function initTemplateBranch(projectRoot, composedDir, manifest, mindName,
|
|
|
3630
3657
|
await gitExec(["commit", "-m", "initial commit"], opts);
|
|
3631
3658
|
}
|
|
3632
3659
|
async function updateTemplateBranch(projectRoot, template, mindName) {
|
|
3633
|
-
const tempWorktree =
|
|
3660
|
+
const tempWorktree = resolve11(projectRoot, ".variants", "_template_update");
|
|
3634
3661
|
let branchExists = false;
|
|
3635
3662
|
try {
|
|
3636
3663
|
await gitExec(["rev-parse", "--verify", TEMPLATE_BRANCH], { cwd: projectRoot });
|
|
@@ -3662,15 +3689,15 @@ async function updateTemplateBranch(projectRoot, template, mindName) {
|
|
|
3662
3689
|
});
|
|
3663
3690
|
}
|
|
3664
3691
|
copyTemplateToDir(composedDir, tempWorktree, mindName, manifest);
|
|
3665
|
-
const initDir =
|
|
3692
|
+
const initDir = resolve11(tempWorktree, ".init");
|
|
3666
3693
|
if (existsSync7(initDir)) {
|
|
3667
3694
|
rmSync4(initDir, { recursive: true, force: true });
|
|
3668
3695
|
}
|
|
3669
|
-
const homeDir =
|
|
3696
|
+
const homeDir = resolve11(tempWorktree, "home");
|
|
3670
3697
|
if (existsSync7(homeDir)) {
|
|
3671
3698
|
for (const entry of readdirSync2(homeDir)) {
|
|
3672
3699
|
if (entry !== "VOLUTE.md") {
|
|
3673
|
-
rmSync4(
|
|
3700
|
+
rmSync4(resolve11(homeDir, entry), { recursive: true, force: true });
|
|
3674
3701
|
}
|
|
3675
3702
|
}
|
|
3676
3703
|
}
|
|
@@ -3711,7 +3738,7 @@ async function mergeTemplateBranch(worktreeDir) {
|
|
|
3711
3738
|
async function npmInstallAsMind(cwd, mindName) {
|
|
3712
3739
|
if (isIsolationEnabled()) {
|
|
3713
3740
|
const [cmd, args] = await wrapForIsolation("npm", ["install"], mindName);
|
|
3714
|
-
await exec(cmd, args, { cwd, env: { ...process.env, HOME:
|
|
3741
|
+
await exec(cmd, args, { cwd, env: { ...process.env, HOME: resolve11(cwd, "home") } });
|
|
3715
3742
|
} else {
|
|
3716
3743
|
await exec("npm", ["install"], { cwd });
|
|
3717
3744
|
}
|
|
@@ -3762,7 +3789,7 @@ async function mergeUpgradeAndRestart(mindName, dir, worktreeDir, upgradeVariant
|
|
|
3762
3789
|
return { ok: true };
|
|
3763
3790
|
}
|
|
3764
3791
|
async function importFromArchive(c, tempDir, nameOverride, manifest) {
|
|
3765
|
-
const extractedMindDir =
|
|
3792
|
+
const extractedMindDir = resolve11(tempDir, "mind");
|
|
3766
3793
|
if (!existsSync7(extractedMindDir)) {
|
|
3767
3794
|
return c.json({ error: "Invalid archive: missing mind/ directory" }, 400);
|
|
3768
3795
|
}
|
|
@@ -3789,9 +3816,9 @@ async function importFromFullArchive(c, tempDir, extractedMindDir, nameOverride,
|
|
|
3789
3816
|
}
|
|
3790
3817
|
const state = stateDir(name);
|
|
3791
3818
|
mkdirSync6(state, { recursive: true });
|
|
3792
|
-
const envJson =
|
|
3819
|
+
const envJson = resolve11(tempDir, "state/env.json");
|
|
3793
3820
|
if (existsSync7(envJson)) {
|
|
3794
|
-
cpSync(envJson,
|
|
3821
|
+
cpSync(envJson, resolve11(state, "env.json"));
|
|
3795
3822
|
}
|
|
3796
3823
|
const port = await nextPort();
|
|
3797
3824
|
await addMind(name, port, manifest.stage, manifest.template);
|
|
@@ -3800,23 +3827,23 @@ async function importFromFullArchive(c, tempDir, extractedMindDir, nameOverride,
|
|
|
3800
3827
|
} catch (err) {
|
|
3801
3828
|
logger_default.warn(`failed to set template hash for ${name}`, logger_default.errorData(err));
|
|
3802
3829
|
}
|
|
3803
|
-
const homeDir =
|
|
3830
|
+
const homeDir = resolve11(dest, "home");
|
|
3804
3831
|
ensureVoluteGroup();
|
|
3805
3832
|
createMindUser(name, homeDir);
|
|
3806
3833
|
chownMindDir(dest, name);
|
|
3807
3834
|
await npmInstallAsMind(dest, name);
|
|
3808
3835
|
await importHistoryFromArchive(name, tempDir);
|
|
3809
3836
|
importSessionsFromArchive(dest, tempDir);
|
|
3810
|
-
if (!existsSync7(
|
|
3837
|
+
if (!existsSync7(resolve11(dest, ".git"))) {
|
|
3811
3838
|
try {
|
|
3812
|
-
const env = isIsolationEnabled() ? { ...process.env, HOME:
|
|
3839
|
+
const env = isIsolationEnabled() ? { ...process.env, HOME: resolve11(dest, "home") } : void 0;
|
|
3813
3840
|
await gitExec(["init"], { cwd: dest, mindName: name, env });
|
|
3814
3841
|
await configureGitIdentity(name, { cwd: dest, mindName: name, env });
|
|
3815
3842
|
await gitExec(["add", "-A"], { cwd: dest, mindName: name, env });
|
|
3816
3843
|
await gitExec(["commit", "-m", "import from archive"], { cwd: dest, mindName: name, env });
|
|
3817
3844
|
} catch (err) {
|
|
3818
3845
|
logger_default.error(`git setup failed for imported mind ${name}`, logger_default.errorData(err));
|
|
3819
|
-
rmSync4(
|
|
3846
|
+
rmSync4(resolve11(dest, ".git"), { recursive: true, force: true });
|
|
3820
3847
|
}
|
|
3821
3848
|
}
|
|
3822
3849
|
chownMindDir(dest, name);
|
|
@@ -3849,22 +3876,22 @@ async function importFromHomeOnlyArchive(c, tempDir, extractedMindDir, nameOverr
|
|
|
3849
3876
|
try {
|
|
3850
3877
|
copyTemplateToDir(composedDir, dest, name, templateManifest);
|
|
3851
3878
|
applyInitFiles(dest);
|
|
3852
|
-
const extractedHome =
|
|
3879
|
+
const extractedHome = resolve11(extractedMindDir, "home");
|
|
3853
3880
|
if (existsSync7(extractedHome)) {
|
|
3854
|
-
cpSync(extractedHome,
|
|
3881
|
+
cpSync(extractedHome, resolve11(dest, "home"), { recursive: true });
|
|
3855
3882
|
}
|
|
3856
|
-
const extractedMindInternal =
|
|
3883
|
+
const extractedMindInternal = resolve11(extractedMindDir, ".mind");
|
|
3857
3884
|
if (existsSync7(extractedMindInternal)) {
|
|
3858
|
-
cpSync(extractedMindInternal,
|
|
3885
|
+
cpSync(extractedMindInternal, resolve11(dest, ".mind"), { recursive: true });
|
|
3859
3886
|
}
|
|
3860
|
-
const identityDir =
|
|
3887
|
+
const identityDir = resolve11(dest, ".mind/identity");
|
|
3861
3888
|
let publicKeyPem;
|
|
3862
|
-
if (!manifest.includes.identity || !existsSync7(
|
|
3889
|
+
if (!manifest.includes.identity || !existsSync7(resolve11(identityDir, "private.pem"))) {
|
|
3863
3890
|
({ publicKeyPem } = generateIdentity(dest));
|
|
3864
3891
|
} else {
|
|
3865
|
-
publicKeyPem = readFileSync8(
|
|
3892
|
+
publicKeyPem = readFileSync8(resolve11(identityDir, "public.pem"), "utf-8");
|
|
3866
3893
|
}
|
|
3867
|
-
const promptsPath =
|
|
3894
|
+
const promptsPath = resolve11(dest, "home/.config/prompts.json");
|
|
3868
3895
|
if (!existsSync7(promptsPath)) {
|
|
3869
3896
|
const mindPrompts = await getMindPromptDefaults();
|
|
3870
3897
|
writeFileSync7(promptsPath, `${JSON.stringify(mindPrompts, null, 2)}
|
|
@@ -3872,13 +3899,13 @@ async function importFromHomeOnlyArchive(c, tempDir, extractedMindDir, nameOverr
|
|
|
3872
3899
|
}
|
|
3873
3900
|
const state = stateDir(name);
|
|
3874
3901
|
mkdirSync6(state, { recursive: true });
|
|
3875
|
-
const envJson =
|
|
3902
|
+
const envJson = resolve11(tempDir, "state/env.json");
|
|
3876
3903
|
if (existsSync7(envJson)) {
|
|
3877
|
-
cpSync(envJson,
|
|
3904
|
+
cpSync(envJson, resolve11(state, "env.json"));
|
|
3878
3905
|
}
|
|
3879
3906
|
const port = await nextPort();
|
|
3880
3907
|
await addMind(name, port, manifest.stage, manifest.template);
|
|
3881
|
-
const homeDir =
|
|
3908
|
+
const homeDir = resolve11(dest, "home");
|
|
3882
3909
|
ensureVoluteGroup();
|
|
3883
3910
|
createMindUser(name, homeDir);
|
|
3884
3911
|
chownMindDir(dest, name);
|
|
@@ -3891,7 +3918,7 @@ async function importFromHomeOnlyArchive(c, tempDir, extractedMindDir, nameOverr
|
|
|
3891
3918
|
await initTemplateBranch(dest, composedDir, templateManifest, name, env);
|
|
3892
3919
|
} catch (err) {
|
|
3893
3920
|
logger_default.error(`git setup failed for imported mind ${name}`, logger_default.errorData(err));
|
|
3894
|
-
rmSync4(
|
|
3921
|
+
rmSync4(resolve11(dest, ".git"), { recursive: true, force: true });
|
|
3895
3922
|
gitWarning = "Git setup failed \u2014 variants and upgrades won't be available until git is initialized.";
|
|
3896
3923
|
}
|
|
3897
3924
|
const skillSet = manifest.stage === "seed" ? SEED_SKILLS : getStandardSkillsWithExtensions();
|
|
@@ -3934,7 +3961,7 @@ async function importFromHomeOnlyArchive(c, tempDir, extractedMindDir, nameOverr
|
|
|
3934
3961
|
}
|
|
3935
3962
|
}
|
|
3936
3963
|
async function importHistoryFromArchive(name, tempDir) {
|
|
3937
|
-
const historyJsonl =
|
|
3964
|
+
const historyJsonl = resolve11(tempDir, "history.jsonl");
|
|
3938
3965
|
if (!existsSync7(historyJsonl)) return;
|
|
3939
3966
|
try {
|
|
3940
3967
|
const db = await getDb();
|
|
@@ -3974,13 +4001,13 @@ async function importHistoryFromArchive(name, tempDir) {
|
|
|
3974
4001
|
}
|
|
3975
4002
|
}
|
|
3976
4003
|
function importSessionsFromArchive(dest, tempDir) {
|
|
3977
|
-
const sessionsDir =
|
|
4004
|
+
const sessionsDir = resolve11(tempDir, "sessions");
|
|
3978
4005
|
if (!existsSync7(sessionsDir)) return;
|
|
3979
4006
|
try {
|
|
3980
|
-
const destSessions =
|
|
4007
|
+
const destSessions = resolve11(dest, ".mind/sessions");
|
|
3981
4008
|
mkdirSync6(destSessions, { recursive: true });
|
|
3982
4009
|
for (const file of readdirSync2(sessionsDir)) {
|
|
3983
|
-
cpSync(
|
|
4010
|
+
cpSync(resolve11(sessionsDir, file), resolve11(destSessions, file));
|
|
3984
4011
|
}
|
|
3985
4012
|
} catch (err) {
|
|
3986
4013
|
logger_default.error("Failed to import sessions from archive", logger_default.errorData(err));
|
|
@@ -4055,7 +4082,7 @@ var app13 = new Hono15().post("/", requireAdminOrSystem, zValidator5("json", cre
|
|
|
4055
4082
|
applyInitFiles(dest);
|
|
4056
4083
|
const { publicKeyPem } = generateIdentity(dest);
|
|
4057
4084
|
{
|
|
4058
|
-
const { readGlobalConfig: readGlobal } = await import("./setup-
|
|
4085
|
+
const { readGlobalConfig: readGlobal } = await import("./setup-OTEC3ZPM.js");
|
|
4059
4086
|
const mindDefaults = readGlobal().mindDefaults;
|
|
4060
4087
|
const config2 = readVoluteConfig(dest);
|
|
4061
4088
|
if (!config2) throw new Error("Failed to read volute.json after identity generation");
|
|
@@ -4092,7 +4119,7 @@ var app13 = new Hono15().post("/", requireAdminOrSystem, zValidator5("json", cre
|
|
|
4092
4119
|
}
|
|
4093
4120
|
writeVoluteConfig(dest, config2);
|
|
4094
4121
|
const modelId = body.model ?? cog?.model;
|
|
4095
|
-
const sdkConfigPath =
|
|
4122
|
+
const sdkConfigPath = resolve11(dest, "home/.config/config.json");
|
|
4096
4123
|
if (modelId || cog?.compaction) {
|
|
4097
4124
|
const existing = existsSync7(sdkConfigPath) ? JSON.parse(readFileSync8(sdkConfigPath, "utf-8")) : {};
|
|
4098
4125
|
if (modelId) {
|
|
@@ -4107,7 +4134,7 @@ var app13 = new Hono15().post("/", requireAdminOrSystem, zValidator5("json", cre
|
|
|
4107
4134
|
}
|
|
4108
4135
|
const mindPrompts = await getMindPromptDefaults();
|
|
4109
4136
|
writeFileSync7(
|
|
4110
|
-
|
|
4137
|
+
resolve11(dest, "home/.config/prompts.json"),
|
|
4111
4138
|
`${JSON.stringify(mindPrompts, null, 2)}
|
|
4112
4139
|
`
|
|
4113
4140
|
);
|
|
@@ -4119,7 +4146,7 @@ var app13 = new Hono15().post("/", requireAdminOrSystem, zValidator5("json", cre
|
|
|
4119
4146
|
} catch (err) {
|
|
4120
4147
|
logger_default.warn(`failed to set template hash for ${name}`, logger_default.errorData(err));
|
|
4121
4148
|
}
|
|
4122
|
-
const homeDir =
|
|
4149
|
+
const homeDir = resolve11(dest, "home");
|
|
4123
4150
|
ensureVoluteGroup();
|
|
4124
4151
|
createMindUser(name, homeDir);
|
|
4125
4152
|
chownMindDir(dest, name);
|
|
@@ -4132,7 +4159,7 @@ var app13 = new Hono15().post("/", requireAdminOrSystem, zValidator5("json", cre
|
|
|
4132
4159
|
await initTemplateBranch(dest, composedDir, manifest, name, env);
|
|
4133
4160
|
} catch (err) {
|
|
4134
4161
|
logger_default.error(`git setup failed for ${name}`, logger_default.errorData(err));
|
|
4135
|
-
rmSync4(
|
|
4162
|
+
rmSync4(resolve11(dest, ".git"), { recursive: true, force: true });
|
|
4136
4163
|
gitWarning = "Git setup failed \u2014 variants and upgrades won't be available until git is initialized.";
|
|
4137
4164
|
}
|
|
4138
4165
|
chownMindDir(dest, name);
|
|
@@ -4142,11 +4169,11 @@ The human who planted you described you as: "${body.description}"
|
|
|
4142
4169
|
` : "";
|
|
4143
4170
|
const seedSoulRaw = body.seedSoul ?? await getPrompt("seed_soul", { name, description: descLine });
|
|
4144
4171
|
const seedSoul = body.seedSoul ? substitute(seedSoulRaw, { name, description: descLine }) : seedSoulRaw;
|
|
4145
|
-
writeFileSync7(
|
|
4172
|
+
writeFileSync7(resolve11(dest, "home/SOUL.md"), seedSoul);
|
|
4146
4173
|
}
|
|
4147
4174
|
let skillSet = body.skills ?? (body.stage === "seed" ? SEED_SKILLS : getStandardSkillsWithExtensions());
|
|
4148
4175
|
if (body.stage === "seed" && !body.skills) {
|
|
4149
|
-
const { isImagegenEnabled } = await import("./setup-
|
|
4176
|
+
const { isImagegenEnabled } = await import("./setup-OTEC3ZPM.js");
|
|
4150
4177
|
if (isImagegenEnabled()) {
|
|
4151
4178
|
skillSet = [...skillSet, "imagegen"];
|
|
4152
4179
|
}
|
|
@@ -4164,7 +4191,7 @@ The human who planted you described you as: "${body.description}"
|
|
|
4164
4191
|
try {
|
|
4165
4192
|
const spiritEntry = await findMind("volute");
|
|
4166
4193
|
if (spiritEntry) {
|
|
4167
|
-
const { spiritDir } = await import("./spirit-
|
|
4194
|
+
const { spiritDir } = await import("./spirit-NVXWSVKM.js");
|
|
4168
4195
|
const sDir = spiritEntry.dir ?? spiritDir();
|
|
4169
4196
|
const spiritConfig = readVoluteConfig(sDir) ?? {};
|
|
4170
4197
|
const schedules = spiritConfig.schedules ?? [];
|
|
@@ -4179,7 +4206,7 @@ The human who planted you described you as: "${body.description}"
|
|
|
4179
4206
|
});
|
|
4180
4207
|
spiritConfig.schedules = schedules;
|
|
4181
4208
|
writeVoluteConfig(sDir, spiritConfig);
|
|
4182
|
-
const { getScheduler: getScheduler2 } = await import("./scheduler-
|
|
4209
|
+
const { getScheduler: getScheduler2 } = await import("./scheduler-GQBDCGLU.js");
|
|
4183
4210
|
getScheduler2().loadSchedules("volute", sDir);
|
|
4184
4211
|
}
|
|
4185
4212
|
}
|
|
@@ -4190,11 +4217,11 @@ The human who planted you described you as: "${body.description}"
|
|
|
4190
4217
|
if (body.stage !== "seed") {
|
|
4191
4218
|
const customSoul = await getPromptIfCustom("default_soul");
|
|
4192
4219
|
if (customSoul) {
|
|
4193
|
-
writeFileSync7(
|
|
4220
|
+
writeFileSync7(resolve11(dest, "home/SOUL.md"), customSoul.replace(/\{\{name\}\}/g, name));
|
|
4194
4221
|
}
|
|
4195
4222
|
const customMemory = await getPromptIfCustom("default_memory");
|
|
4196
4223
|
if (customMemory) {
|
|
4197
|
-
writeFileSync7(
|
|
4224
|
+
writeFileSync7(resolve11(dest, "home/MEMORY.md"), customMemory);
|
|
4198
4225
|
}
|
|
4199
4226
|
}
|
|
4200
4227
|
publishPublicKey(name, publicKeyPem).catch(
|
|
@@ -4243,12 +4270,12 @@ The human who planted you described you as: "${body.description}"
|
|
|
4243
4270
|
return importFromArchive(c, body.archivePath, body.name, body.manifest);
|
|
4244
4271
|
}
|
|
4245
4272
|
const wsDir = body.workspacePath;
|
|
4246
|
-
if (!wsDir || !existsSync7(
|
|
4273
|
+
if (!wsDir || !existsSync7(resolve11(wsDir, "SOUL.md")) || !existsSync7(resolve11(wsDir, "IDENTITY.md"))) {
|
|
4247
4274
|
return c.json({ error: "Invalid workspace: missing SOUL.md or IDENTITY.md" }, 400);
|
|
4248
4275
|
}
|
|
4249
|
-
const soul = readFileSync8(
|
|
4250
|
-
const identity = readFileSync8(
|
|
4251
|
-
const userPath =
|
|
4276
|
+
const soul = readFileSync8(resolve11(wsDir, "SOUL.md"), "utf-8");
|
|
4277
|
+
const identity = readFileSync8(resolve11(wsDir, "IDENTITY.md"), "utf-8");
|
|
4278
|
+
const userPath = resolve11(wsDir, "USER.md");
|
|
4252
4279
|
const user = existsSync7(userPath) ? readFileSync8(userPath, "utf-8") : "";
|
|
4253
4280
|
const name = body.name ?? parseNameFromIdentity(identity) ?? "imported-mind";
|
|
4254
4281
|
const template = body.template ?? "claude";
|
|
@@ -4276,26 +4303,26 @@ ${user.trimEnd()}
|
|
|
4276
4303
|
copyTemplateToDir(composedDir, dest, name, manifest);
|
|
4277
4304
|
applyInitFiles(dest);
|
|
4278
4305
|
const { publicKeyPem: importPublicKey } = generateIdentity(dest);
|
|
4279
|
-
writeFileSync7(
|
|
4280
|
-
const wsMemoryPath =
|
|
4306
|
+
writeFileSync7(resolve11(dest, "home/SOUL.md"), mergedSoul);
|
|
4307
|
+
const wsMemoryPath = resolve11(wsDir, "MEMORY.md");
|
|
4281
4308
|
const hasMemory = existsSync7(wsMemoryPath);
|
|
4282
4309
|
if (hasMemory) {
|
|
4283
4310
|
const existingMemory = readFileSync8(wsMemoryPath, "utf-8");
|
|
4284
4311
|
writeFileSync7(
|
|
4285
|
-
|
|
4312
|
+
resolve11(dest, "home/MEMORY.md"),
|
|
4286
4313
|
`${existingMemory.trimEnd()}${mergedMemoryExtra}`
|
|
4287
4314
|
);
|
|
4288
4315
|
} else if (user) {
|
|
4289
|
-
writeFileSync7(
|
|
4316
|
+
writeFileSync7(resolve11(dest, "home/MEMORY.md"), `${user.trimEnd()}
|
|
4290
4317
|
`);
|
|
4291
4318
|
}
|
|
4292
|
-
const wsMemoryDir =
|
|
4319
|
+
const wsMemoryDir = resolve11(wsDir, "memory");
|
|
4293
4320
|
let dailyLogCount = 0;
|
|
4294
4321
|
if (existsSync7(wsMemoryDir)) {
|
|
4295
|
-
const destMemoryDir =
|
|
4322
|
+
const destMemoryDir = resolve11(dest, "home/memory");
|
|
4296
4323
|
const files = readdirSync2(wsMemoryDir).filter((f) => f.endsWith(".md"));
|
|
4297
4324
|
for (const file of files) {
|
|
4298
|
-
cpSync(
|
|
4325
|
+
cpSync(resolve11(wsMemoryDir, file), resolve11(destMemoryDir, file));
|
|
4299
4326
|
}
|
|
4300
4327
|
dailyLogCount = files.length;
|
|
4301
4328
|
}
|
|
@@ -4306,7 +4333,7 @@ ${user.trimEnd()}
|
|
|
4306
4333
|
} catch (err) {
|
|
4307
4334
|
logger_default.warn(`failed to set template hash for ${name}`, logger_default.errorData(err));
|
|
4308
4335
|
}
|
|
4309
|
-
const homeDir =
|
|
4336
|
+
const homeDir = resolve11(dest, "home");
|
|
4310
4337
|
ensureVoluteGroup();
|
|
4311
4338
|
createMindUser(name, homeDir);
|
|
4312
4339
|
chownMindDir(dest, name);
|
|
@@ -4314,20 +4341,20 @@ ${user.trimEnd()}
|
|
|
4314
4341
|
if (!hasMemory && dailyLogCount > 0) {
|
|
4315
4342
|
await consolidateMemory(dest);
|
|
4316
4343
|
}
|
|
4317
|
-
const env = isIsolationEnabled() ? { ...process.env, HOME:
|
|
4344
|
+
const env = isIsolationEnabled() ? { ...process.env, HOME: resolve11(dest, "home") } : void 0;
|
|
4318
4345
|
await gitExec(["init"], { cwd: dest, mindName: name, env });
|
|
4319
4346
|
await configureGitIdentity(name, { cwd: dest, mindName: name, env });
|
|
4320
4347
|
await gitExec(["add", "-A"], { cwd: dest, mindName: name, env });
|
|
4321
4348
|
await gitExec(["commit", "-m", "import from OpenClaw"], { cwd: dest, mindName: name, env });
|
|
4322
|
-
const sessionFile = body.sessionPath ?
|
|
4349
|
+
const sessionFile = body.sessionPath ? resolve11(body.sessionPath) : findOpenClawSession(wsDir);
|
|
4323
4350
|
if (sessionFile && existsSync7(sessionFile)) {
|
|
4324
4351
|
if (template === "pi") {
|
|
4325
4352
|
importPiSession(sessionFile, dest);
|
|
4326
4353
|
} else if (template === "claude") {
|
|
4327
4354
|
const sessionId = convertSession({ sessionPath: sessionFile, projectDir: dest });
|
|
4328
|
-
const mindRuntimeDir =
|
|
4355
|
+
const mindRuntimeDir = resolve11(dest, ".mind");
|
|
4329
4356
|
mkdirSync6(mindRuntimeDir, { recursive: true });
|
|
4330
|
-
writeFileSync7(
|
|
4357
|
+
writeFileSync7(resolve11(mindRuntimeDir, "session.json"), JSON.stringify({ sessionId }));
|
|
4331
4358
|
}
|
|
4332
4359
|
}
|
|
4333
4360
|
importOpenClawConnectors(name, dest);
|
|
@@ -4368,7 +4395,7 @@ ${user.trimEnd()}
|
|
|
4368
4395
|
const minds = await Promise.all(
|
|
4369
4396
|
entries.map(async (entry) => {
|
|
4370
4397
|
const mindStatus = await getMindStatus(entry.name, entry.port, entry.running);
|
|
4371
|
-
const hasPages = existsSync7(
|
|
4398
|
+
const hasPages = existsSync7(resolve11(mindDir(entry.name), "home", "pages"));
|
|
4372
4399
|
return {
|
|
4373
4400
|
...entry,
|
|
4374
4401
|
...mindStatus,
|
|
@@ -4397,9 +4424,9 @@ ${user.trimEnd()}
|
|
|
4397
4424
|
return { name: s.name, port: s.port, status: variantStatus };
|
|
4398
4425
|
})
|
|
4399
4426
|
);
|
|
4400
|
-
const hasPages = existsSync7(
|
|
4427
|
+
const hasPages = existsSync7(resolve11(mindDir(name), "home", "pages"));
|
|
4401
4428
|
return c.json({ ...entry, ...mindStatus, variants: variantStatuses, hasPages });
|
|
4402
|
-
}).get("/:name/context", async (c) => proxyToMind(c, "context")).get("/:name/context/messages", async (c) => proxyToMind(c, "context/messages")).post("/:name/start", requireSelf(), async (c) => {
|
|
4429
|
+
}).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) => {
|
|
4403
4430
|
const name = c.req.param("name");
|
|
4404
4431
|
const entry = await findMind(name);
|
|
4405
4432
|
if (!entry) return c.json({ error: "Mind not found" }, 404);
|
|
@@ -4444,7 +4471,7 @@ ${user.trimEnd()}
|
|
|
4444
4471
|
const manager = getMindManager();
|
|
4445
4472
|
try {
|
|
4446
4473
|
if (context?.type === "reload") {
|
|
4447
|
-
const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-
|
|
4474
|
+
const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-5277OBHI.js");
|
|
4448
4475
|
const sleepState = getSleepManagerIfReady2()?.getState(name);
|
|
4449
4476
|
if (sleepState?.sleeping) {
|
|
4450
4477
|
logger_default.info(`skipping reload for ${name} during sleep \u2014 will apply on next wake`);
|
|
@@ -4539,7 +4566,7 @@ ${user.trimEnd()}
|
|
|
4539
4566
|
const name = c.req.param("name");
|
|
4540
4567
|
const entry = await findMind(name);
|
|
4541
4568
|
if (!entry) return c.json({ error: "Mind not found" }, 404);
|
|
4542
|
-
const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-
|
|
4569
|
+
const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-5277OBHI.js");
|
|
4543
4570
|
const sm = getSleepManagerIfReady2();
|
|
4544
4571
|
if (!sm) return c.json({ error: "Sleep manager not initialized" }, 503);
|
|
4545
4572
|
return c.json(sm.getState(name));
|
|
@@ -4547,7 +4574,7 @@ ${user.trimEnd()}
|
|
|
4547
4574
|
const name = c.req.param("name");
|
|
4548
4575
|
const entry = await findMind(name);
|
|
4549
4576
|
if (!entry) return c.json({ error: "Mind not found" }, 404);
|
|
4550
|
-
const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-
|
|
4577
|
+
const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-5277OBHI.js");
|
|
4551
4578
|
const sm = getSleepManagerIfReady2();
|
|
4552
4579
|
if (!sm) return c.json({ error: "Sleep manager not initialized" }, 503);
|
|
4553
4580
|
if (sm.isSleeping(name)) return c.json({ error: "Mind is already sleeping" }, 409);
|
|
@@ -4567,7 +4594,7 @@ ${user.trimEnd()}
|
|
|
4567
4594
|
const name = c.req.param("name");
|
|
4568
4595
|
const entry = await findMind(name);
|
|
4569
4596
|
if (!entry) return c.json({ error: "Mind not found" }, 404);
|
|
4570
|
-
const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-
|
|
4597
|
+
const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-5277OBHI.js");
|
|
4571
4598
|
const sm = getSleepManagerIfReady2();
|
|
4572
4599
|
if (!sm) return c.json({ error: "Sleep manager not initialized" }, 503);
|
|
4573
4600
|
const sleepState = sm.getState(name);
|
|
@@ -4582,7 +4609,7 @@ ${user.trimEnd()}
|
|
|
4582
4609
|
const name = c.req.param("name");
|
|
4583
4610
|
const entry = await findMind(name);
|
|
4584
4611
|
if (!entry) return c.json({ error: "Mind not found" }, 404);
|
|
4585
|
-
const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-
|
|
4612
|
+
const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-5277OBHI.js");
|
|
4586
4613
|
const sm = getSleepManagerIfReady2();
|
|
4587
4614
|
if (!sm) return c.json({ error: "Sleep manager not initialized" }, 503);
|
|
4588
4615
|
const flushed = await sm.flushQueuedMessages(name);
|
|
@@ -4597,10 +4624,10 @@ ${user.trimEnd()}
|
|
|
4597
4624
|
const profile = config2.profile ?? {};
|
|
4598
4625
|
if (body.displayName !== void 0) profile.displayName = body.displayName;
|
|
4599
4626
|
if (body.description !== void 0) profile.description = body.description;
|
|
4600
|
-
if (body.avatar !== void 0) profile.avatar = body.avatar;
|
|
4627
|
+
if (body.avatar !== void 0) profile.avatar = basename(body.avatar);
|
|
4601
4628
|
config2.profile = profile;
|
|
4602
4629
|
writeVoluteConfig(dir, config2);
|
|
4603
|
-
const { syncMindProfile: syncMindProfile2 } = await import("./auth-
|
|
4630
|
+
const { syncMindProfile: syncMindProfile2 } = await import("./auth-X6ZITZ7D.js");
|
|
4604
4631
|
await syncMindProfile2(name, profile);
|
|
4605
4632
|
broadcast({ type: "profile_updated", mind: name, summary: `${name} profile updated` });
|
|
4606
4633
|
return c.json({ ok: true });
|
|
@@ -4640,14 +4667,14 @@ ${user.trimEnd()}
|
|
|
4640
4667
|
return c.json({ output: "" });
|
|
4641
4668
|
}
|
|
4642
4669
|
const dir = entry.dir ?? mindDir(name);
|
|
4643
|
-
const soulPath =
|
|
4644
|
-
const memoryPath =
|
|
4670
|
+
const soulPath = resolve11(dir, "home/SOUL.md");
|
|
4671
|
+
const memoryPath = resolve11(dir, "home/MEMORY.md");
|
|
4645
4672
|
const soulCustom = existsSync7(soulPath) && !readFileSync8(soulPath, "utf-8").includes(ORIENTATION_MARKER);
|
|
4646
4673
|
const memoryWritten = existsSync7(memoryPath) && readFileSync8(memoryPath, "utf-8").trim().length > 0;
|
|
4647
4674
|
const config2 = readVoluteConfig(dir);
|
|
4648
4675
|
const displayNameSet = !!config2?.profile?.displayName;
|
|
4649
4676
|
const avatarSet = !!config2?.profile?.avatar;
|
|
4650
|
-
const { isImagegenEnabled } = await import("./setup-
|
|
4677
|
+
const { isImagegenEnabled } = await import("./setup-OTEC3ZPM.js");
|
|
4651
4678
|
const imagegenEnabled = isImagegenEnabled();
|
|
4652
4679
|
const done = [];
|
|
4653
4680
|
const remaining = [];
|
|
@@ -4685,7 +4712,7 @@ ${user.trimEnd()}
|
|
|
4685
4712
|
try {
|
|
4686
4713
|
const spiritEntry = await findMind("volute");
|
|
4687
4714
|
if (spiritEntry) {
|
|
4688
|
-
const { spiritDir } = await import("./spirit-
|
|
4715
|
+
const { spiritDir } = await import("./spirit-NVXWSVKM.js");
|
|
4689
4716
|
const sDir = spiritEntry.dir ?? spiritDir();
|
|
4690
4717
|
const spiritConfig = readVoluteConfig(sDir);
|
|
4691
4718
|
if (spiritConfig?.schedules) {
|
|
@@ -4693,7 +4720,7 @@ ${user.trimEnd()}
|
|
|
4693
4720
|
spiritConfig.schedules = spiritConfig.schedules.filter((s) => s.id !== nurtureId);
|
|
4694
4721
|
if (spiritConfig.schedules.length === 0) spiritConfig.schedules = void 0;
|
|
4695
4722
|
writeVoluteConfig(sDir, spiritConfig);
|
|
4696
|
-
const { getScheduler: getScheduler2 } = await import("./scheduler-
|
|
4723
|
+
const { getScheduler: getScheduler2 } = await import("./scheduler-GQBDCGLU.js");
|
|
4697
4724
|
getScheduler2().loadSchedules("volute", sDir);
|
|
4698
4725
|
}
|
|
4699
4726
|
}
|
|
@@ -4748,16 +4775,16 @@ ${user.trimEnd()}
|
|
|
4748
4775
|
const template = body.template ?? entry.template ?? "claude";
|
|
4749
4776
|
const UPGRADE_BRANCH = "upgrade";
|
|
4750
4777
|
const upgradeVariantName = `${mindName}-upgrade`;
|
|
4751
|
-
const worktreeDir =
|
|
4778
|
+
const worktreeDir = resolve11(dir, ".variants", UPGRADE_BRANCH);
|
|
4752
4779
|
if (body.abort) {
|
|
4753
4780
|
if (!existsSync7(worktreeDir)) {
|
|
4754
4781
|
return c.json({ error: "No upgrade in progress" }, 400);
|
|
4755
4782
|
}
|
|
4756
4783
|
try {
|
|
4757
4784
|
try {
|
|
4758
|
-
const gitDirContent = readFileSync8(
|
|
4785
|
+
const gitDirContent = readFileSync8(resolve11(worktreeDir, ".git"), "utf-8").trim();
|
|
4759
4786
|
const gitDir = gitDirContent.replace("gitdir: ", "");
|
|
4760
|
-
if (existsSync7(
|
|
4787
|
+
if (existsSync7(resolve11(gitDir, "MERGE_HEAD"))) {
|
|
4761
4788
|
await gitExec(["merge", "--abort"], { cwd: worktreeDir });
|
|
4762
4789
|
}
|
|
4763
4790
|
} catch {
|
|
@@ -4840,7 +4867,7 @@ ${user.trimEnd()}
|
|
|
4840
4867
|
}
|
|
4841
4868
|
if (body.diff) {
|
|
4842
4869
|
try {
|
|
4843
|
-
if (!existsSync7(
|
|
4870
|
+
if (!existsSync7(resolve11(dir, ".git"))) {
|
|
4844
4871
|
return c.json({ error: "Mind has no git history \u2014 nothing to diff against" }, 400);
|
|
4845
4872
|
}
|
|
4846
4873
|
await updateTemplateBranch(dir, template, mindName);
|
|
@@ -4864,16 +4891,16 @@ ${user.trimEnd()}
|
|
|
4864
4891
|
409
|
|
4865
4892
|
);
|
|
4866
4893
|
}
|
|
4867
|
-
if (!existsSync7(
|
|
4894
|
+
if (!existsSync7(resolve11(dir, ".git"))) {
|
|
4868
4895
|
try {
|
|
4869
|
-
const env = isIsolationEnabled() ? { ...process.env, HOME:
|
|
4896
|
+
const env = isIsolationEnabled() ? { ...process.env, HOME: resolve11(dir, "home") } : void 0;
|
|
4870
4897
|
await gitExec(["init"], { cwd: dir, mindName, env });
|
|
4871
4898
|
await configureGitIdentity(mindName, { cwd: dir, mindName, env });
|
|
4872
4899
|
await gitExec(["add", "-A"], { cwd: dir, mindName, env });
|
|
4873
4900
|
await gitExec(["commit", "-m", "initial commit"], { cwd: dir, mindName, env });
|
|
4874
4901
|
chownMindDir(dir, mindName);
|
|
4875
4902
|
} catch (err) {
|
|
4876
|
-
rmSync4(
|
|
4903
|
+
rmSync4(resolve11(dir, ".git"), { recursive: true, force: true });
|
|
4877
4904
|
return c.json(
|
|
4878
4905
|
{
|
|
4879
4906
|
error: `Git initialization failed: ${err instanceof Error ? err.message : String(err)}`
|
|
@@ -4888,7 +4915,7 @@ ${user.trimEnd()}
|
|
|
4888
4915
|
} catch {
|
|
4889
4916
|
}
|
|
4890
4917
|
await updateTemplateBranch(dir, template, mindName);
|
|
4891
|
-
const parentDir =
|
|
4918
|
+
const parentDir = resolve11(dir, ".variants");
|
|
4892
4919
|
if (!existsSync7(parentDir)) {
|
|
4893
4920
|
mkdirSync6(parentDir, { recursive: true });
|
|
4894
4921
|
}
|
|
@@ -5007,13 +5034,13 @@ ${user.trimEnd()}
|
|
|
5007
5034
|
}
|
|
5008
5035
|
const result = await getMessagesPaginated(convId, { before, limit });
|
|
5009
5036
|
return c.json({ items: result.messages, hasMore: result.hasMore });
|
|
5010
|
-
}).get("/:name/budget", async (c) => {
|
|
5037
|
+
}).get("/:name/budget", requireSelf(), async (c) => {
|
|
5011
5038
|
const name = c.req.param("name");
|
|
5012
5039
|
const baseName = await getBaseName(name);
|
|
5013
5040
|
const usage = getTokenBudget().getUsage(baseName);
|
|
5014
5041
|
if (!usage) return c.json({ error: "No budget configured" }, 404);
|
|
5015
5042
|
return c.json(usage);
|
|
5016
|
-
}).get("/:name/config", async (c) => {
|
|
5043
|
+
}).get("/:name/config", requireSelf(), async (c) => {
|
|
5017
5044
|
const name = c.req.param("name");
|
|
5018
5045
|
const entry = await findMind(name);
|
|
5019
5046
|
if (!entry) return c.json({ error: "Mind not found" }, 404);
|
|
@@ -5021,7 +5048,7 @@ ${user.trimEnd()}
|
|
|
5021
5048
|
if (!existsSync7(dir)) return c.json({ error: "Mind directory missing" }, 404);
|
|
5022
5049
|
let config2 = readVoluteConfig(dir);
|
|
5023
5050
|
if (!config2 && entry.template === "pi") {
|
|
5024
|
-
const piConfigPath =
|
|
5051
|
+
const piConfigPath = resolve11(dir, "home/.config/config.json");
|
|
5025
5052
|
if (existsSync7(piConfigPath)) {
|
|
5026
5053
|
try {
|
|
5027
5054
|
config2 = JSON.parse(readFileSync8(piConfigPath, "utf-8"));
|
|
@@ -5030,7 +5057,7 @@ ${user.trimEnd()}
|
|
|
5030
5057
|
}
|
|
5031
5058
|
}
|
|
5032
5059
|
let templateConfig = {};
|
|
5033
|
-
const configJsonPath =
|
|
5060
|
+
const configJsonPath = resolve11(dir, "home/.config/config.json");
|
|
5034
5061
|
if (existsSync7(configJsonPath)) {
|
|
5035
5062
|
try {
|
|
5036
5063
|
templateConfig = JSON.parse(readFileSync8(configJsonPath, "utf-8"));
|
|
@@ -5122,12 +5149,12 @@ ${user.trimEnd()}
|
|
|
5122
5149
|
}
|
|
5123
5150
|
writeVoluteConfig(dir, existing);
|
|
5124
5151
|
if (body.unescapeNewlines !== void 0) {
|
|
5125
|
-
const { clearEchoTextCache } = await import("./echo-text-
|
|
5152
|
+
const { clearEchoTextCache } = await import("./echo-text-QFCH3H6G.js");
|
|
5126
5153
|
clearEchoTextCache(name);
|
|
5127
5154
|
}
|
|
5128
5155
|
const needsConfigJson = body.model !== void 0 || body.thinkingLevel !== void 0 || body.maxThinkingTokens !== void 0 || body.compaction !== void 0;
|
|
5129
5156
|
if (needsConfigJson) {
|
|
5130
|
-
const configJsonPath =
|
|
5157
|
+
const configJsonPath = resolve11(dir, "home/.config/config.json");
|
|
5131
5158
|
let templateConfig = {};
|
|
5132
5159
|
if (existsSync7(configJsonPath)) {
|
|
5133
5160
|
try {
|
|
@@ -5199,7 +5226,7 @@ ${user.trimEnd()}
|
|
|
5199
5226
|
}
|
|
5200
5227
|
if (entry.mindType === "spirit" && body.model !== void 0) {
|
|
5201
5228
|
try {
|
|
5202
|
-
const { readGlobalConfig: readGlobalConfig2, writeGlobalConfig: writeGlobalConfig2 } = await import("./setup-
|
|
5229
|
+
const { readGlobalConfig: readGlobalConfig2, writeGlobalConfig: writeGlobalConfig2 } = await import("./setup-OTEC3ZPM.js");
|
|
5203
5230
|
const globalConfig = readGlobalConfig2();
|
|
5204
5231
|
globalConfig.spiritModel = body.model;
|
|
5205
5232
|
writeGlobalConfig2(globalConfig);
|
|
@@ -5209,7 +5236,7 @@ ${user.trimEnd()}
|
|
|
5209
5236
|
}
|
|
5210
5237
|
return c.json({ ok: true });
|
|
5211
5238
|
}
|
|
5212
|
-
).get("/:name/delivery/pending", async (c) => {
|
|
5239
|
+
).get("/:name/delivery/pending", requireSelf(), async (c) => {
|
|
5213
5240
|
const name = c.req.param("name");
|
|
5214
5241
|
const baseName = await getBaseName(name);
|
|
5215
5242
|
try {
|
|
@@ -5227,7 +5254,7 @@ ${user.trimEnd()}
|
|
|
5227
5254
|
if (!body.systemPrompt || !body.message) {
|
|
5228
5255
|
return c.json({ error: "systemPrompt and message required" }, 400);
|
|
5229
5256
|
}
|
|
5230
|
-
const { aiComplete: aiCompleteFn, isAiConfigured } = await import("./ai-service-
|
|
5257
|
+
const { aiComplete: aiCompleteFn, isAiConfigured } = await import("./ai-service-AUWIPWLP.js");
|
|
5231
5258
|
if (!isAiConfigured()) {
|
|
5232
5259
|
return c.json({ error: "AI service not configured" }, 503);
|
|
5233
5260
|
}
|
|
@@ -5409,7 +5436,7 @@ ${user.trimEnd()}
|
|
|
5409
5436
|
}
|
|
5410
5437
|
}
|
|
5411
5438
|
return c.json({ ok: true });
|
|
5412
|
-
}).get("/:name/events", async (c) => {
|
|
5439
|
+
}).get("/:name/events", requireSelf(), async (c) => {
|
|
5413
5440
|
const name = c.req.param("name");
|
|
5414
5441
|
const baseName = await getBaseName(name);
|
|
5415
5442
|
const entry = await findMind(baseName);
|
|
@@ -5491,7 +5518,7 @@ ${user.trimEnd()}
|
|
|
5491
5518
|
return c.json({ error: "Failed to persist" }, 500);
|
|
5492
5519
|
}
|
|
5493
5520
|
return c.json({ ok: true });
|
|
5494
|
-
}).get("/:name/history/sessions", async (c) => {
|
|
5521
|
+
}).get("/:name/history/sessions", requireSelf(), async (c) => {
|
|
5495
5522
|
const name = c.req.param("name");
|
|
5496
5523
|
const db = await getDb();
|
|
5497
5524
|
const rows = await db.select({
|
|
@@ -5502,18 +5529,18 @@ ${user.trimEnd()}
|
|
|
5502
5529
|
tool_count: sql2`SUM(CASE WHEN ${mindHistory.type}='tool_use' THEN 1 ELSE 0 END)`
|
|
5503
5530
|
}).from(mindHistory).where(and4(eq5(mindHistory.mind, name), sql2`${mindHistory.session} IS NOT NULL`)).groupBy(mindHistory.session).orderBy(sql2`MIN(${mindHistory.created_at}) DESC`);
|
|
5504
5531
|
return c.json(rows);
|
|
5505
|
-
}).get("/:name/history/channels", async (c) => {
|
|
5532
|
+
}).get("/:name/history/channels", requireSelf(), async (c) => {
|
|
5506
5533
|
const name = c.req.param("name");
|
|
5507
5534
|
const db = await getDb();
|
|
5508
5535
|
const rows = await db.selectDistinct({ channel: mindHistory.channel }).from(mindHistory).where(eq5(mindHistory.mind, name));
|
|
5509
5536
|
return c.json(rows.map((r) => r.channel));
|
|
5510
|
-
}).get("/:name/history/export", async (c) => {
|
|
5537
|
+
}).get("/:name/history/export", requireSelf(), async (c) => {
|
|
5511
5538
|
const name = c.req.param("name");
|
|
5512
5539
|
if (!await findMind(name)) return c.json({ error: "Mind not found" }, 404);
|
|
5513
5540
|
const db = await getDb();
|
|
5514
5541
|
const rows = await db.select().from(mindHistory).where(eq5(mindHistory.mind, name));
|
|
5515
5542
|
return c.json(rows);
|
|
5516
|
-
}).get("/:name/history/turn", async (c) => {
|
|
5543
|
+
}).get("/:name/history/turn", requireSelf(), async (c) => {
|
|
5517
5544
|
const name = c.req.param("name");
|
|
5518
5545
|
const turnId = c.req.query("turn_id");
|
|
5519
5546
|
const detail = c.req.query("detail") === "1";
|
|
@@ -5540,7 +5567,7 @@ ${user.trimEnd()}
|
|
|
5540
5567
|
).orderBy(mindHistory.id);
|
|
5541
5568
|
}
|
|
5542
5569
|
return c.json(rows);
|
|
5543
|
-
}).get("/:name/history/cross-session", async (c) => {
|
|
5570
|
+
}).get("/:name/history/cross-session", requireSelf(), async (c) => {
|
|
5544
5571
|
const name = c.req.param("name");
|
|
5545
5572
|
const currentSession = c.req.query("session");
|
|
5546
5573
|
const db = await getDb();
|
|
@@ -5596,7 +5623,7 @@ ${lines.join("\n")}` });
|
|
|
5596
5623
|
const maxId = notices.reduce((m, n) => Math.max(m, n.id), 0);
|
|
5597
5624
|
noticeDrainWatermarks.set(`${baseName}:${session}`, maxId);
|
|
5598
5625
|
return c.json({ context: formatNotices(notices), notices });
|
|
5599
|
-
}).get("/:name/history", async (c) => {
|
|
5626
|
+
}).get("/:name/history", requireSelf(), async (c) => {
|
|
5600
5627
|
const name = c.req.param("name");
|
|
5601
5628
|
const channel = c.req.query("channel");
|
|
5602
5629
|
const session = c.req.query("session");
|
|
@@ -5747,7 +5774,7 @@ function writeSchedules(name, dir, schedules) {
|
|
|
5747
5774
|
data: { schedules }
|
|
5748
5775
|
});
|
|
5749
5776
|
}
|
|
5750
|
-
var app15 = new Hono17().get("/:name/clock/status", async (c) => {
|
|
5777
|
+
var app15 = new Hono17().get("/:name/clock/status", requireSelf(), async (c) => {
|
|
5751
5778
|
const name = c.req.param("name");
|
|
5752
5779
|
const entry = await findMind(name);
|
|
5753
5780
|
if (!entry) return c.json({ error: "Mind not found" }, 404);
|
|
@@ -5806,7 +5833,7 @@ var app15 = new Hono17().get("/:name/clock/status", async (c) => {
|
|
|
5806
5833
|
upcoming.sort((a, b) => a.at.localeCompare(b.at));
|
|
5807
5834
|
previous.sort((a, b) => b.at.localeCompare(a.at));
|
|
5808
5835
|
return c.json({ sleep: sleepState, sleepConfig, schedules, upcoming, previous });
|
|
5809
|
-
}).get("/:name/sleep/config", async (c) => {
|
|
5836
|
+
}).get("/:name/sleep/config", requireSelf(), async (c) => {
|
|
5810
5837
|
const name = c.req.param("name");
|
|
5811
5838
|
const entry = await findMind(name);
|
|
5812
5839
|
if (!entry) return c.json({ error: "Mind not found" }, 404);
|
|
@@ -5838,7 +5865,7 @@ var app15 = new Hono17().get("/:name/clock/status", async (c) => {
|
|
|
5838
5865
|
writeVoluteConfig(dir, config2);
|
|
5839
5866
|
getSleepManagerIfReady()?.invalidateSleepConfig(name);
|
|
5840
5867
|
return c.json({ ok: true });
|
|
5841
|
-
}).get("/:name/schedules", async (c) => {
|
|
5868
|
+
}).get("/:name/schedules", requireSelf(), async (c) => {
|
|
5842
5869
|
const name = c.req.param("name");
|
|
5843
5870
|
const entry = await findMind(name);
|
|
5844
5871
|
if (!entry) return c.json({ error: "Mind not found" }, 404);
|
|
@@ -5963,7 +5990,7 @@ var app15 = new Hono17().get("/:name/clock/status", async (c) => {
|
|
|
5963
5990
|
}
|
|
5964
5991
|
writeSchedules(name, dir, filtered);
|
|
5965
5992
|
return c.json({ ok: true });
|
|
5966
|
-
}).post("/:name/webhook/:event", async (c) => {
|
|
5993
|
+
}).post("/:name/webhook/:event", requireSelf(), async (c) => {
|
|
5967
5994
|
const name = c.req.param("name");
|
|
5968
5995
|
const event = c.req.param("event");
|
|
5969
5996
|
const entry = await findMind(name);
|
|
@@ -5971,7 +5998,7 @@ var app15 = new Hono17().get("/:name/clock/status", async (c) => {
|
|
|
5971
5998
|
const body = await c.req.text();
|
|
5972
5999
|
const message = `[webhook: ${event}] ${body}`;
|
|
5973
6000
|
try {
|
|
5974
|
-
const { sendSystemMessage } = await import("./system-chat-
|
|
6001
|
+
const { sendSystemMessage } = await import("./system-chat-LQSJVY55.js");
|
|
5975
6002
|
await sendSystemMessage(name, message);
|
|
5976
6003
|
return c.json({ ok: true });
|
|
5977
6004
|
} catch (err) {
|
|
@@ -5984,14 +6011,14 @@ var schedules_default = app15;
|
|
|
5984
6011
|
// packages/daemon/src/web/api/setup.ts
|
|
5985
6012
|
import { mkdirSync as mkdirSync7 } from "fs";
|
|
5986
6013
|
import { homedir as homedir2 } from "os";
|
|
5987
|
-
import { resolve as
|
|
6014
|
+
import { resolve as resolve12 } from "path";
|
|
5988
6015
|
import { Hono as Hono18 } from "hono";
|
|
5989
6016
|
import { setCookie as setCookie2 } from "hono/cookie";
|
|
5990
6017
|
var DEFAULT_API_URL2 = "https://volute.systems";
|
|
5991
6018
|
var setup = new Hono18();
|
|
5992
6019
|
function writeSetupConfig(systemName, description) {
|
|
5993
|
-
const configHome = process.env.VOLUTE_HOME ??
|
|
5994
|
-
const mindsDir =
|
|
6020
|
+
const configHome = process.env.VOLUTE_HOME ?? resolve12(homedir2(), ".volute");
|
|
6021
|
+
const mindsDir = resolve12(configHome, "minds");
|
|
5995
6022
|
mkdirSync7(configHome, { recursive: true });
|
|
5996
6023
|
mkdirSync7(mindsDir, { recursive: true });
|
|
5997
6024
|
const existingConfig = readGlobalConfig();
|
|
@@ -6025,7 +6052,7 @@ setup.get("/status", async (c) => {
|
|
|
6025
6052
|
let hasAccount = false;
|
|
6026
6053
|
if (hasSystem) {
|
|
6027
6054
|
try {
|
|
6028
|
-
const { listUsersByType: listUsersByType2 } = await import("./auth-
|
|
6055
|
+
const { listUsersByType: listUsersByType2 } = await import("./auth-X6ZITZ7D.js");
|
|
6029
6056
|
const brains = await listUsersByType2("brain");
|
|
6030
6057
|
hasAccount = brains.length > 0;
|
|
6031
6058
|
} catch (err) {
|
|
@@ -6236,7 +6263,7 @@ setup.post("/account", async (c) => {
|
|
|
6236
6263
|
}
|
|
6237
6264
|
}
|
|
6238
6265
|
try {
|
|
6239
|
-
const { createUser: createUser2, updateUserProfile: updateUserProfile2 } = await import("./auth-
|
|
6266
|
+
const { createUser: createUser2, updateUserProfile: updateUserProfile2 } = await import("./auth-X6ZITZ7D.js");
|
|
6240
6267
|
const user = await createUser2(body.username.trim(), body.password);
|
|
6241
6268
|
if (body.displayName?.trim()) {
|
|
6242
6269
|
await updateUserProfile2(user.id, { display_name: body.displayName.trim() });
|
|
@@ -6282,7 +6309,7 @@ setup.post("/models", async (c) => {
|
|
|
6282
6309
|
return c.json({ error: "Spirit model is required" }, 400);
|
|
6283
6310
|
}
|
|
6284
6311
|
try {
|
|
6285
|
-
const { setEnabledModels: setEnabledModels3, setUtilityModel: setUtilityModel2 } = await import("./ai-service-
|
|
6312
|
+
const { setEnabledModels: setEnabledModels3, setUtilityModel: setUtilityModel2 } = await import("./ai-service-AUWIPWLP.js");
|
|
6286
6313
|
setEnabledModels3(body.models);
|
|
6287
6314
|
const config2 = readGlobalConfig();
|
|
6288
6315
|
config2.spiritModel = body.spiritModel.trim();
|
|
@@ -6300,15 +6327,15 @@ setup.post("/complete", async (c) => {
|
|
|
6300
6327
|
return c.json({ error: "Setup already complete" }, 400);
|
|
6301
6328
|
}
|
|
6302
6329
|
try {
|
|
6303
|
-
const { ensureSpiritProject, syncSpiritTemplate } = await import("./spirit-
|
|
6304
|
-
const { startSpiritFull } = await import("./mind-service-
|
|
6330
|
+
const { ensureSpiritProject, syncSpiritTemplate } = await import("./spirit-NVXWSVKM.js");
|
|
6331
|
+
const { startSpiritFull } = await import("./mind-service-WTOFVNLW.js");
|
|
6305
6332
|
await ensureSpiritProject();
|
|
6306
6333
|
await syncSpiritTemplate();
|
|
6307
6334
|
const warnings = [];
|
|
6308
6335
|
const config2 = readGlobalConfig();
|
|
6309
6336
|
if (config2.setup?.service && config2.setup?.type === "local") {
|
|
6310
6337
|
try {
|
|
6311
|
-
const { installUserService } = await import("./service-install-
|
|
6338
|
+
const { installUserService } = await import("./service-install-W3FQXJKB.js");
|
|
6312
6339
|
const installed = await installUserService(config2.port, config2.hostname);
|
|
6313
6340
|
if (!installed) {
|
|
6314
6341
|
warnings.push("Service installation is not supported on this platform.");
|
|
@@ -6336,8 +6363,8 @@ setup.post("/complete", async (c) => {
|
|
|
6336
6363
|
}
|
|
6337
6364
|
let spiritConversationId;
|
|
6338
6365
|
try {
|
|
6339
|
-
const { getOrCreateMindUser: getOrCreateMindUser2, listUsersByType: listUsersByType2 } = await import("./auth-
|
|
6340
|
-
const { createConversation: createConversation2, findDMConversation: findDMConversation2 } = await import("./conversations-
|
|
6366
|
+
const { getOrCreateMindUser: getOrCreateMindUser2, listUsersByType: listUsersByType2 } = await import("./auth-X6ZITZ7D.js");
|
|
6367
|
+
const { createConversation: createConversation2, findDMConversation: findDMConversation2 } = await import("./conversations-AYLXPOGC.js");
|
|
6341
6368
|
const spiritUser = await getOrCreateMindUser2("volute");
|
|
6342
6369
|
const brains = await listUsersByType2("brain");
|
|
6343
6370
|
const admin2 = brains.find((u) => u.role === "admin");
|
|
@@ -6359,8 +6386,8 @@ setup.post("/complete", async (c) => {
|
|
|
6359
6386
|
logger_default.info("setup complete state", { spiritConversationId, spiritStarted });
|
|
6360
6387
|
if (spiritConversationId && spiritStarted) {
|
|
6361
6388
|
try {
|
|
6362
|
-
const { deliverMessage: deliverMessage2 } = await import("./message-delivery-
|
|
6363
|
-
const { listUsersByType: listUsers2 } = await import("./auth-
|
|
6389
|
+
const { deliverMessage: deliverMessage2 } = await import("./message-delivery-7BCYJLH2.js");
|
|
6390
|
+
const { listUsersByType: listUsers2 } = await import("./auth-X6ZITZ7D.js");
|
|
6364
6391
|
const admins = await listUsers2("brain");
|
|
6365
6392
|
const admin2 = admins.find((u) => u.role === "admin");
|
|
6366
6393
|
const adminName = admin2?.display_name || admin2?.username || "the admin";
|
|
@@ -6399,7 +6426,7 @@ var setup_default = setup;
|
|
|
6399
6426
|
// packages/daemon/src/web/api/skills.ts
|
|
6400
6427
|
import { existsSync as existsSync8, mkdtempSync, readdirSync as readdirSync3, rmSync as rmSync5 } from "fs";
|
|
6401
6428
|
import { tmpdir } from "os";
|
|
6402
|
-
import { join, resolve as
|
|
6429
|
+
import { join, resolve as resolve13 } from "path";
|
|
6403
6430
|
import AdmZip from "adm-zip";
|
|
6404
6431
|
import { Hono as Hono19 } from "hono";
|
|
6405
6432
|
var app16 = new Hono19().get("/", async (c) => {
|
|
@@ -6475,7 +6502,7 @@ var app16 = new Hono19().get("/", async (c) => {
|
|
|
6475
6502
|
try {
|
|
6476
6503
|
const zip = new AdmZip(buffer2);
|
|
6477
6504
|
for (const entry of zip.getEntries()) {
|
|
6478
|
-
const target =
|
|
6505
|
+
const target = resolve13(tmpDir, entry.entryName);
|
|
6479
6506
|
if (!target.startsWith(tmpDir)) {
|
|
6480
6507
|
return c.json({ error: "Invalid zip: paths must not escape archive" }, 400);
|
|
6481
6508
|
}
|
|
@@ -6817,8 +6844,8 @@ var app20 = new Hono23().use("*", authMiddleware).get("/", async (c) => {
|
|
|
6817
6844
|
});
|
|
6818
6845
|
}, 15e3);
|
|
6819
6846
|
cleanups.push(() => clearInterval(keepAlive));
|
|
6820
|
-
await new Promise((
|
|
6821
|
-
stream.onAbort(() =>
|
|
6847
|
+
await new Promise((resolve18) => {
|
|
6848
|
+
stream.onAbort(() => resolve18());
|
|
6822
6849
|
});
|
|
6823
6850
|
} finally {
|
|
6824
6851
|
for (const cleanup of cleanups) {
|
|
@@ -6834,15 +6861,15 @@ var events_default = app20;
|
|
|
6834
6861
|
|
|
6835
6862
|
// packages/daemon/src/web/api/variants.ts
|
|
6836
6863
|
import { existsSync as existsSync9, mkdirSync as mkdirSync9, writeFileSync as writeFileSync8 } from "fs";
|
|
6837
|
-
import { resolve as
|
|
6864
|
+
import { resolve as resolve15 } from "path";
|
|
6838
6865
|
import { Hono as Hono24 } from "hono";
|
|
6839
6866
|
|
|
6840
6867
|
// packages/daemon/src/lib/mind/spawn-server.ts
|
|
6841
6868
|
import { spawn as spawn4 } from "child_process";
|
|
6842
6869
|
import { closeSync, mkdirSync as mkdirSync8, openSync, readFileSync as readFileSync9 } from "fs";
|
|
6843
|
-
import { resolve as
|
|
6870
|
+
import { resolve as resolve14 } from "path";
|
|
6844
6871
|
function tsxBin(cwd) {
|
|
6845
|
-
return
|
|
6872
|
+
return resolve14(cwd, "node_modules", ".bin", "tsx");
|
|
6846
6873
|
}
|
|
6847
6874
|
function spawnServer(cwd, port, options) {
|
|
6848
6875
|
if (options?.detached) {
|
|
@@ -6855,31 +6882,31 @@ function spawnAttached(cwd, port) {
|
|
|
6855
6882
|
cwd,
|
|
6856
6883
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6857
6884
|
});
|
|
6858
|
-
return new Promise((
|
|
6859
|
-
const timeout = setTimeout(() =>
|
|
6885
|
+
return new Promise((resolve18) => {
|
|
6886
|
+
const timeout = setTimeout(() => resolve18(null), 3e4);
|
|
6860
6887
|
function checkOutput(data) {
|
|
6861
6888
|
const match = data.toString().match(/listening on :(\d+)/);
|
|
6862
6889
|
if (match) {
|
|
6863
6890
|
clearTimeout(timeout);
|
|
6864
|
-
|
|
6891
|
+
resolve18({ child, actualPort: parseInt(match[1], 10) });
|
|
6865
6892
|
}
|
|
6866
6893
|
}
|
|
6867
6894
|
child.stdout?.on("data", checkOutput);
|
|
6868
6895
|
child.stderr?.on("data", checkOutput);
|
|
6869
6896
|
child.on("error", () => {
|
|
6870
6897
|
clearTimeout(timeout);
|
|
6871
|
-
|
|
6898
|
+
resolve18(null);
|
|
6872
6899
|
});
|
|
6873
6900
|
child.on("exit", () => {
|
|
6874
6901
|
clearTimeout(timeout);
|
|
6875
|
-
|
|
6902
|
+
resolve18(null);
|
|
6876
6903
|
});
|
|
6877
6904
|
});
|
|
6878
6905
|
}
|
|
6879
6906
|
function spawnDetached(cwd, port, logDir) {
|
|
6880
|
-
const logsDir = logDir ??
|
|
6907
|
+
const logsDir = logDir ?? resolve14(cwd, ".mind", "logs");
|
|
6881
6908
|
mkdirSync8(logsDir, { recursive: true });
|
|
6882
|
-
const logPath =
|
|
6909
|
+
const logPath = resolve14(logsDir, "mind.log");
|
|
6883
6910
|
const logFd = openSync(logPath, "a");
|
|
6884
6911
|
const child = spawn4(tsxBin(cwd), ["src/server.ts", "--port", String(port)], {
|
|
6885
6912
|
cwd,
|
|
@@ -6995,11 +7022,11 @@ var app21 = new Hono24().get("/:name/variants", async (c) => {
|
|
|
6995
7022
|
return c.json({ error: `Name already in use: ${variantName}` }, 409);
|
|
6996
7023
|
}
|
|
6997
7024
|
const projectRoot = mindDir(mindName);
|
|
6998
|
-
const variantDir =
|
|
7025
|
+
const variantDir = resolve15(projectRoot, ".variants", variantName);
|
|
6999
7026
|
if (existsSync9(variantDir)) {
|
|
7000
7027
|
return c.json({ error: `Variant directory already exists: ${variantDir}` }, 409);
|
|
7001
7028
|
}
|
|
7002
|
-
mkdirSync9(
|
|
7029
|
+
mkdirSync9(resolve15(projectRoot, ".variants"), { recursive: true });
|
|
7003
7030
|
try {
|
|
7004
7031
|
await gitExec(["worktree", "add", "-b", variantName, variantDir], { cwd: projectRoot });
|
|
7005
7032
|
} catch (e) {
|
|
@@ -7012,7 +7039,7 @@ var app21 = new Hono24().get("/:name/variants", async (c) => {
|
|
|
7012
7039
|
const [cmd, args] = await wrapForIsolation("npm", ["install"], mindName);
|
|
7013
7040
|
await exec(cmd, args, {
|
|
7014
7041
|
cwd: variantDir,
|
|
7015
|
-
env: { ...process.env, HOME:
|
|
7042
|
+
env: { ...process.env, HOME: resolve15(variantDir, "home") }
|
|
7016
7043
|
});
|
|
7017
7044
|
} else {
|
|
7018
7045
|
await exec("npm", ["install"], { cwd: variantDir });
|
|
@@ -7022,7 +7049,7 @@ var app21 = new Hono24().get("/:name/variants", async (c) => {
|
|
|
7022
7049
|
return c.json({ error: `npm install failed: ${msg}` }, 500);
|
|
7023
7050
|
}
|
|
7024
7051
|
if (body.soul) {
|
|
7025
|
-
writeFileSync8(
|
|
7052
|
+
writeFileSync8(resolve15(variantDir, "home/SOUL.md"), body.soul);
|
|
7026
7053
|
}
|
|
7027
7054
|
const variantPort = body.port ?? await nextPort();
|
|
7028
7055
|
await addVariant(variantName, mindName, variantPort, variantDir, variantName);
|
|
@@ -7117,8 +7144,8 @@ var app21 = new Hono24().get("/:name/variants", async (c) => {
|
|
|
7117
7144
|
await cleanupVariant(variantName, projectRoot, variantEntry.dir);
|
|
7118
7145
|
if (variantName.endsWith("-upgrade") || variantName === "upgrade") {
|
|
7119
7146
|
try {
|
|
7120
|
-
const { computeTemplateHash: computeTemplateHash2 } = await import("./template-hash-
|
|
7121
|
-
const { setMindTemplateHash: setMindTemplateHash2 } = await import("./registry-
|
|
7147
|
+
const { computeTemplateHash: computeTemplateHash2 } = await import("./template-hash-DMHSLRDX.js");
|
|
7148
|
+
const { setMindTemplateHash: setMindTemplateHash2 } = await import("./registry-GV35XFT7.js");
|
|
7122
7149
|
const tmpl = parentEntry.template ?? "claude";
|
|
7123
7150
|
await setMindTemplateHash2(mindName, computeTemplateHash2(tmpl));
|
|
7124
7151
|
} catch (err) {
|
|
@@ -7131,7 +7158,7 @@ var app21 = new Hono24().get("/:name/variants", async (c) => {
|
|
|
7131
7158
|
const [cmd, args] = await wrapForIsolation("npm", ["install"], mindName);
|
|
7132
7159
|
await exec(cmd, args, {
|
|
7133
7160
|
cwd: projectRoot,
|
|
7134
|
-
env: { ...process.env, HOME:
|
|
7161
|
+
env: { ...process.env, HOME: resolve15(projectRoot, "home") }
|
|
7135
7162
|
});
|
|
7136
7163
|
} else {
|
|
7137
7164
|
await exec("npm", ["install"], { cwd: projectRoot });
|
|
@@ -7548,11 +7575,11 @@ var app23 = new Hono26().get("/:name/conversations/:id/events", async (c) => {
|
|
|
7548
7575
|
if (!stream.aborted) console.error("[chat] SSE ping error:", err);
|
|
7549
7576
|
});
|
|
7550
7577
|
}, 15e3);
|
|
7551
|
-
await new Promise((
|
|
7578
|
+
await new Promise((resolve18) => {
|
|
7552
7579
|
stream.onAbort(() => {
|
|
7553
7580
|
unsubscribe();
|
|
7554
7581
|
clearInterval(keepAlive);
|
|
7555
|
-
|
|
7582
|
+
resolve18();
|
|
7556
7583
|
});
|
|
7557
7584
|
});
|
|
7558
7585
|
});
|
|
@@ -7765,7 +7792,7 @@ var app_default = app25;
|
|
|
7765
7792
|
import { existsSync as existsSync10 } from "fs";
|
|
7766
7793
|
import { readFile as readFile2, stat as stat2 } from "fs/promises";
|
|
7767
7794
|
import { createServer as createHttpsServer } from "https";
|
|
7768
|
-
import { dirname as dirname2, extname as extname3, resolve as
|
|
7795
|
+
import { dirname as dirname2, extname as extname3, resolve as resolve16 } from "path";
|
|
7769
7796
|
import { serve } from "@hono/node-server";
|
|
7770
7797
|
var MIME_TYPES2 = {
|
|
7771
7798
|
".html": "text/html",
|
|
@@ -7784,7 +7811,7 @@ async function startServer({
|
|
|
7784
7811
|
let assetsDir = "";
|
|
7785
7812
|
let searchDir = dirname2(new URL(import.meta.url).pathname);
|
|
7786
7813
|
for (let i = 0; i < 5; i++) {
|
|
7787
|
-
const candidate =
|
|
7814
|
+
const candidate = resolve16(searchDir, "dist", "web-assets");
|
|
7788
7815
|
if (existsSync10(candidate)) {
|
|
7789
7816
|
assetsDir = candidate;
|
|
7790
7817
|
break;
|
|
@@ -7795,20 +7822,20 @@ async function startServer({
|
|
|
7795
7822
|
app_default.get("*", async (c) => {
|
|
7796
7823
|
const urlPath = new URL(c.req.url).pathname;
|
|
7797
7824
|
if (urlPath.startsWith("/api/") || urlPath.startsWith("/ext/")) return c.notFound();
|
|
7798
|
-
const filePath =
|
|
7825
|
+
const filePath = resolve16(assetsDir, urlPath.slice(1));
|
|
7799
7826
|
if (!filePath.startsWith(assetsDir)) return c.text("Forbidden", 403);
|
|
7800
7827
|
const s = await stat2(filePath).catch(() => null);
|
|
7801
7828
|
if (s?.isFile()) {
|
|
7802
7829
|
const ext = extname3(filePath);
|
|
7803
7830
|
const mime = MIME_TYPES2[ext] || "application/octet-stream";
|
|
7804
7831
|
const body = await readFile2(filePath);
|
|
7805
|
-
const
|
|
7806
|
-
const nameWithoutExt =
|
|
7832
|
+
const basename2 = filePath.slice(filePath.lastIndexOf("/") + 1);
|
|
7833
|
+
const nameWithoutExt = basename2.slice(0, basename2.lastIndexOf("."));
|
|
7807
7834
|
const isHashed = /[-.][\da-f]{8,}$/.test(nameWithoutExt);
|
|
7808
7835
|
const cacheControl = isHashed ? "public, max-age=31536000, immutable" : "no-cache";
|
|
7809
7836
|
return c.body(body, 200, { "Content-Type": mime, "Cache-Control": cacheControl });
|
|
7810
7837
|
}
|
|
7811
|
-
const indexPath =
|
|
7838
|
+
const indexPath = resolve16(assetsDir, "index.html");
|
|
7812
7839
|
const indexStat = await stat2(indexPath).catch(() => null);
|
|
7813
7840
|
if (indexStat?.isFile()) {
|
|
7814
7841
|
const body = await readFile2(indexPath, "utf-8");
|
|
@@ -7825,10 +7852,10 @@ async function startServer({
|
|
|
7825
7852
|
createServer: createHttpsServer,
|
|
7826
7853
|
serverOptions: { key: tls.key, cert: tls.cert }
|
|
7827
7854
|
});
|
|
7828
|
-
await new Promise((
|
|
7855
|
+
await new Promise((resolve18, reject) => {
|
|
7829
7856
|
server2.on("listening", () => {
|
|
7830
7857
|
logger_default.info("Volute UI running (https)", { hostname, port });
|
|
7831
|
-
|
|
7858
|
+
resolve18();
|
|
7832
7859
|
});
|
|
7833
7860
|
server2.on("error", (err) => {
|
|
7834
7861
|
reject(err);
|
|
@@ -7836,13 +7863,13 @@ async function startServer({
|
|
|
7836
7863
|
});
|
|
7837
7864
|
const internalPort = port + 1;
|
|
7838
7865
|
const internalServer = serve({ fetch: app_default.fetch, port: internalPort, hostname: "127.0.0.1" });
|
|
7839
|
-
await new Promise((
|
|
7866
|
+
await new Promise((resolve18, reject) => {
|
|
7840
7867
|
internalServer.on("listening", () => {
|
|
7841
7868
|
logger_default.info("Volute API running (http, internal)", {
|
|
7842
7869
|
hostname: "127.0.0.1",
|
|
7843
7870
|
port: internalPort
|
|
7844
7871
|
});
|
|
7845
|
-
|
|
7872
|
+
resolve18();
|
|
7846
7873
|
});
|
|
7847
7874
|
internalServer.on("error", (err) => {
|
|
7848
7875
|
reject(err);
|
|
@@ -7851,10 +7878,10 @@ async function startServer({
|
|
|
7851
7878
|
return { server: server2, internalPort };
|
|
7852
7879
|
}
|
|
7853
7880
|
const server = serve({ fetch: app_default.fetch, port, hostname });
|
|
7854
|
-
await new Promise((
|
|
7881
|
+
await new Promise((resolve18, reject) => {
|
|
7855
7882
|
server.on("listening", () => {
|
|
7856
7883
|
logger_default.info("Volute API running (http)", { hostname, port });
|
|
7857
|
-
|
|
7884
|
+
resolve18();
|
|
7858
7885
|
});
|
|
7859
7886
|
server.on("error", (err) => {
|
|
7860
7887
|
reject(err);
|
|
@@ -7865,7 +7892,7 @@ async function startServer({
|
|
|
7865
7892
|
|
|
7866
7893
|
// packages/daemon/src/daemon.ts
|
|
7867
7894
|
if (!process.env.VOLUTE_HOME) {
|
|
7868
|
-
process.env.VOLUTE_HOME =
|
|
7895
|
+
process.env.VOLUTE_HOME = resolve17(homedir3(), ".volute");
|
|
7869
7896
|
}
|
|
7870
7897
|
if (process.env.VOLUTE_TIMEZONE && !process.env.TZ) {
|
|
7871
7898
|
process.env.TZ = process.env.VOLUTE_TIMEZONE;
|
|
@@ -7876,7 +7903,7 @@ async function startDaemon(opts) {
|
|
|
7876
7903
|
const home = voluteHome();
|
|
7877
7904
|
const systemDir = voluteSystemDir();
|
|
7878
7905
|
if (!opts.foreground) {
|
|
7879
|
-
const rotatingLog = new RotatingLog(
|
|
7906
|
+
const rotatingLog = new RotatingLog(resolve17(systemDir, "daemon.log"));
|
|
7880
7907
|
logger_default.setOutput((line) => rotatingLog.write(`${line}
|
|
7881
7908
|
`));
|
|
7882
7909
|
const write = (...args) => rotatingLog.write(`${format(...args)}
|
|
@@ -7886,22 +7913,22 @@ async function startDaemon(opts) {
|
|
|
7886
7913
|
console.warn = write;
|
|
7887
7914
|
console.info = write;
|
|
7888
7915
|
}
|
|
7889
|
-
const DAEMON_PID_PATH =
|
|
7890
|
-
const DAEMON_JSON_PATH =
|
|
7916
|
+
const DAEMON_PID_PATH = resolve17(systemDir, "daemon.pid");
|
|
7917
|
+
const DAEMON_JSON_PATH = resolve17(systemDir, "daemon.json");
|
|
7891
7918
|
mkdirSync10(home, { recursive: true });
|
|
7892
7919
|
ensureSystemDir();
|
|
7893
|
-
const { migrateSetupCompleted } = await import("./setup-
|
|
7920
|
+
const { migrateSetupCompleted } = await import("./setup-OTEC3ZPM.js");
|
|
7894
7921
|
migrateSetupCompleted();
|
|
7895
|
-
await (await import("./db-
|
|
7922
|
+
await (await import("./db-ZEPKEJJD.js")).getDb();
|
|
7896
7923
|
try {
|
|
7897
7924
|
const { eq: eq7, and: and5 } = await import("drizzle-orm");
|
|
7898
|
-
const { users: users2 } = await import("./schema-
|
|
7899
|
-
const db = await (await import("./db-
|
|
7925
|
+
const { users: users2 } = await import("./schema-LYQUDL7G.js");
|
|
7926
|
+
const db = await (await import("./db-ZEPKEJJD.js")).getDb();
|
|
7900
7927
|
await db.update(users2).set({ role: "system" }).where(and5(eq7(users2.user_type, "system"), eq7(users2.role, "user")));
|
|
7901
7928
|
} catch (err) {
|
|
7902
7929
|
logger_default.warn("failed to migrate system user role", logger_default.errorData(err));
|
|
7903
7930
|
}
|
|
7904
|
-
const { initSandbox } = await import("./sandbox-
|
|
7931
|
+
const { initSandbox } = await import("./sandbox-5R32QKWQ.js");
|
|
7905
7932
|
await initSandbox();
|
|
7906
7933
|
try {
|
|
7907
7934
|
await syncBuiltinSkills();
|
|
@@ -7928,7 +7955,7 @@ async function startDaemon(opts) {
|
|
|
7928
7955
|
logger_default.warn("failed to ensure #system channel", logger_default.errorData(err));
|
|
7929
7956
|
}
|
|
7930
7957
|
try {
|
|
7931
|
-
const { getOrCreateSystemUser: getOrCreateSystemUser2 } = await import("./auth-
|
|
7958
|
+
const { getOrCreateSystemUser: getOrCreateSystemUser2 } = await import("./auth-X6ZITZ7D.js");
|
|
7932
7959
|
await getOrCreateSystemUser2();
|
|
7933
7960
|
} catch (err) {
|
|
7934
7961
|
logger_default.warn(
|
|
@@ -7937,12 +7964,12 @@ async function startDaemon(opts) {
|
|
|
7937
7964
|
);
|
|
7938
7965
|
}
|
|
7939
7966
|
const token = process.env.VOLUTE_DAEMON_TOKEN || randomBytes(32).toString("hex");
|
|
7940
|
-
const { readGlobalConfig: readGlobalConfig2 } = await import("./setup-
|
|
7967
|
+
const { readGlobalConfig: readGlobalConfig2 } = await import("./setup-OTEC3ZPM.js");
|
|
7941
7968
|
const globalCfg = readGlobalConfig2();
|
|
7942
7969
|
let tls;
|
|
7943
7970
|
if (opts.tailscale || globalCfg.tailscale) {
|
|
7944
7971
|
try {
|
|
7945
|
-
const { getTailscaleTls } = await import("./tailscale-
|
|
7972
|
+
const { getTailscaleTls } = await import("./tailscale-X4HRKRTW.js");
|
|
7946
7973
|
const tlsConfig = await getTailscaleTls();
|
|
7947
7974
|
tls = { key: tlsConfig.key, cert: tlsConfig.cert };
|
|
7948
7975
|
logger_default.info("Tailscale HTTPS enabled", { hostname: tlsConfig.hostname });
|
|
@@ -8021,10 +8048,10 @@ async function startDaemon(opts) {
|
|
|
8021
8048
|
await Promise.all(workers);
|
|
8022
8049
|
}
|
|
8023
8050
|
try {
|
|
8024
|
-
const { isSetupComplete: isSetupComplete2 } = await import("./setup-
|
|
8051
|
+
const { isSetupComplete: isSetupComplete2 } = await import("./setup-OTEC3ZPM.js");
|
|
8025
8052
|
if (isSetupComplete2()) {
|
|
8026
|
-
const { ensureSpiritProject, syncSpiritTemplate } = await import("./spirit-
|
|
8027
|
-
const { startSpiritFull } = await import("./mind-service-
|
|
8053
|
+
const { ensureSpiritProject, syncSpiritTemplate } = await import("./spirit-NVXWSVKM.js");
|
|
8054
|
+
const { startSpiritFull } = await import("./mind-service-WTOFVNLW.js");
|
|
8028
8055
|
await ensureSpiritProject();
|
|
8029
8056
|
await syncSpiritTemplate();
|
|
8030
8057
|
const spiritEntry = await findMind("volute");
|
|
@@ -8041,7 +8068,7 @@ async function startDaemon(opts) {
|
|
|
8041
8068
|
bridgeManager.startBridges(daemonPort).catch((err) => {
|
|
8042
8069
|
logger_default.warn("failed to start bridges", logger_default.errorData(err));
|
|
8043
8070
|
});
|
|
8044
|
-
import("./cloud-sync-
|
|
8071
|
+
import("./cloud-sync-MAQCJEFJ.js").then(
|
|
8045
8072
|
({ consumeQueuedMessages }) => consumeQueuedMessages().catch((err) => {
|
|
8046
8073
|
logger_default.warn("failed to consume queued cloud messages", logger_default.errorData(err));
|
|
8047
8074
|
})
|
|
@@ -8049,7 +8076,7 @@ async function startDaemon(opts) {
|
|
|
8049
8076
|
logger_default.warn("failed to load cloud-sync module", logger_default.errorData(err));
|
|
8050
8077
|
});
|
|
8051
8078
|
try {
|
|
8052
|
-
const { backfillTemplateHashes, notifyVersionUpdate } = await import("./version-notify-
|
|
8079
|
+
const { backfillTemplateHashes, notifyVersionUpdate } = await import("./version-notify-N37N2C4G.js");
|
|
8053
8080
|
backfillTemplateHashes();
|
|
8054
8081
|
notifyVersionUpdate().catch((err) => {
|
|
8055
8082
|
logger_default.warn("failed to send version update notifications", logger_default.errorData(err));
|