volute 0.41.1 → 0.42.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-7YVHZKRD.js → accept-N5XULCXK.js} +1 -1
- package/dist/{ai-service-XCLE3MQP.js → ai-service-3GBOJGUA.js} +10 -2
- package/dist/{bridge-WPYSOQKR.js → bridge-2PO3AI5D.js} +1 -1
- package/dist/{chat-7DOENBY2.js → chat-LYL5CWJV.js} +8 -8
- package/dist/{chunk-MYJSKXGH.js → chunk-43K5UWF7.js} +3 -3
- package/dist/{chunk-IJCZAYGT.js → chunk-4ZSUUBG5.js} +97 -2
- package/dist/{chunk-F44AEQAW.js → chunk-6G7R2LPI.js} +13 -13
- package/dist/{chunk-OSUF75I7.js → chunk-BR6KFHVT.js} +1 -1
- package/dist/{chunk-GCS64EAD.js → chunk-BWZHX46O.js} +3 -3
- package/dist/{chunk-ULNQ6OC4.js → chunk-JPDN6ZRJ.js} +9 -6
- package/dist/{chunk-EKLRS2SX.js → chunk-JU5GWO77.js} +2 -2
- package/dist/chunk-KZAL7HEQ.js +141 -0
- package/dist/{chunk-MJIJFCAH.js → chunk-M3T3Y6FT.js} +2 -2
- package/dist/{chunk-G777ME4L.js → chunk-NSGIVS5T.js} +1 -1
- package/dist/{chunk-CGPESELY.js → chunk-P6DPB33N.js} +19 -3
- package/dist/{chunk-IFNSAOA4.js → chunk-RBNMDAKB.js} +4 -0
- package/dist/{chunk-763WUVJQ.js → chunk-WR7CSHQ4.js} +1 -1
- package/dist/cli.js +21 -21
- package/dist/{clock-HP2TGMG5.js → clock-K43IMROX.js} +3 -3
- package/dist/{cloud-sync-2XVXEOSU.js → cloud-sync-E3ZL5SZ4.js} +7 -7
- package/dist/{config-W7MS3PWY.js → config-TJLYUV3U.js} +3 -3
- package/dist/{create-CJ2SR4EU.js → create-DF3KISTW.js} +1 -1
- package/dist/{create-OTM46ZUM.js → create-ERNQYOCK.js} +2 -2
- package/dist/{daemon-client-EWDPOOHC.js → daemon-client-IYR4KCPU.js} +3 -1
- package/dist/{daemon-restart-HDVGTYH7.js → daemon-restart-QBZOMILO.js} +4 -4
- package/dist/daemon.js +99 -51
- package/dist/{delete-4ND5PLE7.js → delete-BFMIGAIB.js} +1 -1
- package/dist/{delivery-manager-CPADWRV2.js → delivery-manager-J3BRHXUF.js} +7 -7
- package/dist/{down-DS6WCT34.js → down-DSRWSCXY.js} +2 -2
- package/dist/{echo-text-GEDEEY7M.js → echo-text-3HBQUWPX.js} +9 -8
- package/dist/{env-XX2MBZCZ.js → env-VZ4MLFQW.js} +1 -1
- package/dist/{export-5DOQV2WM.js → export-WYI3E3TB.js} +1 -1
- package/dist/{extension-BCFYXI7A.js → extension-SEID47SR.js} +1 -1
- package/dist/{extensions-SU3N4COT.js → extensions-X6MKBJLB.js} +7 -7
- package/dist/{files-K2MEMV3W.js → files-COTCVBGO.js} +1 -1
- package/dist/{import-V6QEHMPQ.js → import-EPK6WCYS.js} +2 -2
- package/dist/{join-4S3KT7NE.js → join-RXPXGV4L.js} +1 -1
- package/dist/{list-XJB5WII6.js → list-OXIAY3W7.js} +1 -1
- package/dist/{login-PHMTLNUF.js → login-GPBXOU4D.js} +1 -1
- package/dist/{login-YWD6PUOT.js → login-MY6ETFYB.js} +1 -1
- package/dist/{logout-BP3R3CAA.js → logout-DNNTIYE2.js} +1 -1
- package/dist/{logout-Q2WICH4V.js → logout-NCG3TMDL.js} +1 -1
- package/dist/{message-delivery-HPMELC4Q.js → message-delivery-4ZWFDBAY.js} +7 -7
- package/dist/{mind-APS4URT7.js → mind-K5PZHPBR.js} +18 -18
- package/dist/{mind-history-TDUQFYAG.js → mind-history-VRO5A76U.js} +1 -1
- package/dist/{mind-list-2T353Q5G.js → mind-list-4D7J4CHD.js} +1 -1
- package/dist/{mind-manager-74XQZEGX.js → mind-manager-6DSY5IJW.js} +7 -7
- package/dist/{mind-profile-2HHR7LZ7.js → mind-profile-PEQYASQX.js} +1 -1
- package/dist/{mind-service-XGXSMQP6.js → mind-service-R2FM53KD.js} +7 -7
- package/dist/{mind-sleep-4NXV4J4U.js → mind-sleep-YMBR3I35.js} +1 -1
- package/dist/{mind-status-CG66OXDK.js → mind-status-UO34ASXZ.js} +1 -1
- package/dist/{mind-wake-TNB54DBR.js → mind-wake-LCLGTXA2.js} +1 -1
- package/dist/{package-MVFX22K5.js → package-G4AM2IDZ.js} +1 -1
- package/dist/{read-JLR4NQXU.js → read-QVAXMTPV.js} +1 -1
- package/dist/{register-IQ2M4UO6.js → register-Y2H4PY5R.js} +1 -1
- package/dist/{reject-N2D4CZND.js → reject-EV35X64Y.js} +1 -1
- package/dist/{restart-43A5MBGV.js → restart-FJQ662XJ.js} +1 -1
- package/dist/{sandbox-ND53WZVU.js → sandbox-E7RWZDVG.js} +2 -2
- package/dist/{scheduler-MEBQF5MW.js → scheduler-2FKQCRCM.js} +7 -7
- package/dist/{seed-L4XFZ3VX.js → seed-SKVSWF7S.js} +1 -1
- package/dist/{seed-check-N5ALJBT6.js → seed-check-VLTVILOV.js} +1 -1
- package/dist/{seed-cmd-NSTPYJFC.js → seed-cmd-D2H5VLB4.js} +3 -3
- package/dist/{seed-create-ZYCZC46W.js → seed-create-BUSKQ5II.js} +4 -4
- package/dist/{seed-sprout-YXHU73XA.js → seed-sprout-R2IZPITD.js} +5 -5
- package/dist/{send-KQECN2EL.js → send-SLDFRSTL.js} +1 -1
- package/dist/{service-Q5OVY5AK.js → service-ZDOSEQCE.js} +1 -1
- package/dist/{service-install-GTDUHP6R.js → service-install-2HZPDHEY.js} +2 -2
- package/dist/{setup-RMR3TKCR.js → setup-IU3ID7II.js} +4 -4
- package/dist/{setup-FPFWDMXD.js → setup-IYOUPCIK.js} +5 -1
- package/dist/{skill-E43BI34Y.js → skill-FKFHIJRR.js} +1 -1
- package/dist/{skills-AOZF6U2B.js → skills-P6RGGASV.js} +2 -2
- package/dist/{sleep-manager-OHM3TO62.js → sleep-manager-F5KWIFOX.js} +7 -7
- package/dist/{spirit-ONLRFATY.js → spirit-XLD6QXSS.js} +4 -4
- package/dist/{split-5IBUODEE.js → split-WBMZXBHF.js} +1 -1
- package/dist/{sprout-2KJOQZCL.js → sprout-QV2RJM5W.js} +1 -1
- package/dist/{start-5AYFGNS7.js → start-5JE3TV66.js} +1 -1
- package/dist/{status-ECZHHSY5.js → status-QAKAPDYW.js} +9 -5
- package/dist/{stop-WJ6IG6OK.js → stop-AAMTG3TU.js} +1 -1
- package/dist/{system-chat-HZUKBIKJ.js → system-chat-EQIH6JVL.js} +7 -7
- package/dist/{systems-5MA57Q7G.js → systems-VNB5WKSS.js} +4 -4
- package/dist/{turn-tracker-TIX4DY2W.js → turn-tracker-Z5UJC4BY.js} +3 -3
- package/dist/{up-7KVNER6V.js → up-ZTPGC7HB.js} +3 -3
- package/dist/{update-OPR4KU4M.js → update-NY3XBVAJ.js} +6 -6
- package/dist/{upgrade-QB7AHIKX.js → upgrade-37DAGF6H.js} +1 -1
- package/dist/{version-notify-UFFDUPCX.js → version-notify-P7UAR7HZ.js} +7 -7
- package/dist/web-assets/assets/{index-DaUp9iE2.js → index-CrFAsfiE.js} +10 -10
- package/dist/web-assets/assets/{index-DqHSW9Fr.css → index-D7udpBCx.css} +1 -1
- package/dist/web-assets/index.html +2 -2
- package/package.json +1 -1
- package/templates/codex/src/server.ts +8 -2
- package/templates/pi/src/lib/resolve-model.ts +50 -12
- package/dist/chunk-MA7MYEOK.js +0 -71
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
addCustomModel,
|
|
3
4
|
aiComplete,
|
|
4
5
|
aiCompleteUtility,
|
|
6
|
+
buildCustomModel,
|
|
5
7
|
fireProviderRefreshHook,
|
|
6
8
|
getAiConfig,
|
|
7
9
|
getAvailableModels,
|
|
8
10
|
getConfiguredProviders,
|
|
11
|
+
getCustomModels,
|
|
9
12
|
getEnabledModels,
|
|
10
13
|
getUtilityModel,
|
|
11
14
|
isAiConfigured,
|
|
12
15
|
qualifyModelId,
|
|
13
16
|
removeAiConfig,
|
|
17
|
+
removeCustomModel,
|
|
14
18
|
removeProviderConfig,
|
|
15
19
|
resolveApiKey,
|
|
16
20
|
resolveTemplate,
|
|
@@ -19,24 +23,28 @@ import {
|
|
|
19
23
|
setProviderRefreshHook,
|
|
20
24
|
setUtilityModel,
|
|
21
25
|
unqualifyModelId
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
26
|
+
} from "./chunk-4ZSUUBG5.js";
|
|
27
|
+
import "./chunk-KZAL7HEQ.js";
|
|
24
28
|
import "./chunk-T2TP6ZC6.js";
|
|
25
29
|
import "./chunk-IUZ3EV2D.js";
|
|
26
30
|
import "./chunk-MHFAWJCC.js";
|
|
27
31
|
import "./chunk-K3NQKI34.js";
|
|
28
32
|
export {
|
|
33
|
+
addCustomModel,
|
|
29
34
|
aiComplete,
|
|
30
35
|
aiCompleteUtility,
|
|
36
|
+
buildCustomModel,
|
|
31
37
|
fireProviderRefreshHook,
|
|
32
38
|
getAiConfig,
|
|
33
39
|
getAvailableModels,
|
|
34
40
|
getConfiguredProviders,
|
|
41
|
+
getCustomModels,
|
|
35
42
|
getEnabledModels,
|
|
36
43
|
getUtilityModel,
|
|
37
44
|
isAiConfigured,
|
|
38
45
|
qualifyModelId,
|
|
39
46
|
removeAiConfig,
|
|
47
|
+
removeCustomModel,
|
|
40
48
|
removeProviderConfig,
|
|
41
49
|
resolveApiKey,
|
|
42
50
|
resolveTemplate,
|
|
@@ -12,35 +12,35 @@ var cmd = subcommands({
|
|
|
12
12
|
commands: {
|
|
13
13
|
send: {
|
|
14
14
|
description: "Send a message",
|
|
15
|
-
run: (args) => import("./send-
|
|
15
|
+
run: (args) => import("./send-SLDFRSTL.js").then((m) => m.run(args))
|
|
16
16
|
},
|
|
17
17
|
list: {
|
|
18
18
|
description: "List conversations",
|
|
19
|
-
run: (args) => import("./list-
|
|
19
|
+
run: (args) => import("./list-OXIAY3W7.js").then((m) => m.run(args))
|
|
20
20
|
},
|
|
21
21
|
read: {
|
|
22
22
|
description: "Read conversation messages",
|
|
23
|
-
run: (args) => import("./read-
|
|
23
|
+
run: (args) => import("./read-QVAXMTPV.js").then((m) => m.run(args))
|
|
24
24
|
},
|
|
25
25
|
create: {
|
|
26
26
|
description: "Create a conversation",
|
|
27
|
-
run: (args) => import("./create-
|
|
27
|
+
run: (args) => import("./create-DF3KISTW.js").then((m) => m.run(args))
|
|
28
28
|
},
|
|
29
29
|
bridge: {
|
|
30
30
|
description: "Manage platform bridges",
|
|
31
|
-
run: (args) => import("./bridge-
|
|
31
|
+
run: (args) => import("./bridge-2PO3AI5D.js").then((m) => m.run(args))
|
|
32
32
|
},
|
|
33
33
|
files: {
|
|
34
34
|
description: "List pending incoming files",
|
|
35
|
-
run: (args) => import("./files-
|
|
35
|
+
run: (args) => import("./files-COTCVBGO.js").then((m) => m.run(args))
|
|
36
36
|
},
|
|
37
37
|
accept: {
|
|
38
38
|
description: "Accept a pending file",
|
|
39
|
-
run: (args) => import("./accept-
|
|
39
|
+
run: (args) => import("./accept-N5XULCXK.js").then((m) => m.run(args))
|
|
40
40
|
},
|
|
41
41
|
reject: {
|
|
42
42
|
description: "Reject a pending file",
|
|
43
|
-
run: (args) => import("./reject-
|
|
43
|
+
run: (args) => import("./reject-EV35X64Y.js").then((m) => m.run(args))
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
footer: "Use --mind <name> or VOLUTE_MIND to identify the mind."
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
getSharedSkill,
|
|
11
11
|
installSkill,
|
|
12
12
|
mindSkillsDir
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-M3T3Y6FT.js";
|
|
14
14
|
import {
|
|
15
15
|
readVoluteConfig,
|
|
16
16
|
writeVoluteConfig
|
|
@@ -21,10 +21,10 @@ import {
|
|
|
21
21
|
import {
|
|
22
22
|
qualifyModelId,
|
|
23
23
|
resolveTemplate
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-4ZSUUBG5.js";
|
|
25
25
|
import {
|
|
26
26
|
readGlobalConfig
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-KZAL7HEQ.js";
|
|
28
28
|
import {
|
|
29
29
|
logger_default
|
|
30
30
|
} from "./chunk-T2TP6ZC6.js";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
readGlobalConfig,
|
|
4
4
|
writeGlobalConfig
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KZAL7HEQ.js";
|
|
6
6
|
import {
|
|
7
7
|
logger_default
|
|
8
8
|
} from "./chunk-T2TP6ZC6.js";
|
|
@@ -141,11 +141,96 @@ function setEnabledModels(modelIds) {
|
|
|
141
141
|
const config = readGlobalConfig();
|
|
142
142
|
writeGlobalConfig({ ...config, ai });
|
|
143
143
|
}
|
|
144
|
+
function getCustomModels() {
|
|
145
|
+
return getAiConfig()?.customModels ?? [];
|
|
146
|
+
}
|
|
147
|
+
function addCustomModel(provider, id, name) {
|
|
148
|
+
const ai = getAiConfig() ?? { providers: {} };
|
|
149
|
+
const customModels = ai.customModels ?? [];
|
|
150
|
+
if (!customModels.some((m) => m.provider === provider && m.id === id)) {
|
|
151
|
+
customModels.push({ provider, id, ...name ? { name } : {} });
|
|
152
|
+
}
|
|
153
|
+
ai.customModels = customModels;
|
|
154
|
+
const config = readGlobalConfig();
|
|
155
|
+
writeGlobalConfig({ ...config, ai });
|
|
156
|
+
}
|
|
157
|
+
function removeCustomModel(provider, id) {
|
|
158
|
+
const ai = getAiConfig();
|
|
159
|
+
if (!ai) return;
|
|
160
|
+
const customModels = (ai.customModels ?? []).filter(
|
|
161
|
+
(m) => !(m.provider === provider && m.id === id)
|
|
162
|
+
);
|
|
163
|
+
ai.customModels = customModels.length > 0 ? customModels : void 0;
|
|
164
|
+
if (!ai.customModels) delete ai.customModels;
|
|
165
|
+
if (ai.models) {
|
|
166
|
+
ai.models = ai.models.filter((mid) => mid !== id);
|
|
167
|
+
if (ai.models.length === 0) delete ai.models;
|
|
168
|
+
}
|
|
169
|
+
const config = readGlobalConfig();
|
|
170
|
+
writeGlobalConfig({ ...config, ai });
|
|
171
|
+
}
|
|
172
|
+
function sharedPrefixLength(a, b) {
|
|
173
|
+
let i = 0;
|
|
174
|
+
while (i < a.length && i < b.length && a[i] === b[i]) i++;
|
|
175
|
+
return i;
|
|
176
|
+
}
|
|
177
|
+
function pickSibling(provider, id) {
|
|
178
|
+
const siblings = getBuiltinModels(provider);
|
|
179
|
+
if (siblings.length === 0) return void 0;
|
|
180
|
+
let best = siblings[0];
|
|
181
|
+
let bestPrefix = -1;
|
|
182
|
+
for (const s of siblings) {
|
|
183
|
+
const prefix = sharedPrefixLength(s.id, id);
|
|
184
|
+
if (prefix > bestPrefix || prefix === bestPrefix && s.contextWindow > best.contextWindow) {
|
|
185
|
+
bestPrefix = prefix;
|
|
186
|
+
best = s;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return best;
|
|
190
|
+
}
|
|
191
|
+
function buildCustomModel(provider, id, name) {
|
|
192
|
+
const sibling = pickSibling(provider, id);
|
|
193
|
+
if (!sibling) return void 0;
|
|
194
|
+
return {
|
|
195
|
+
...sibling,
|
|
196
|
+
id,
|
|
197
|
+
name: name ?? id,
|
|
198
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
function pruneAbsorbedCustomModels() {
|
|
202
|
+
const ai = getAiConfig();
|
|
203
|
+
const custom = ai?.customModels ?? [];
|
|
204
|
+
if (custom.length === 0 || !ai) return custom;
|
|
205
|
+
const kept = custom.filter((cm) => !getBuiltinModel(cm.provider, cm.id));
|
|
206
|
+
if (kept.length !== custom.length) {
|
|
207
|
+
ai.customModels = kept.length > 0 ? kept : void 0;
|
|
208
|
+
if (!ai.customModels) delete ai.customModels;
|
|
209
|
+
const config = readGlobalConfig();
|
|
210
|
+
writeGlobalConfig({ ...config, ai });
|
|
211
|
+
}
|
|
212
|
+
return kept;
|
|
213
|
+
}
|
|
144
214
|
async function getAvailableModels() {
|
|
145
215
|
const providers = await getConfiguredProviders();
|
|
216
|
+
const configured = new Set(providers);
|
|
146
217
|
const result = [];
|
|
218
|
+
const seen = /* @__PURE__ */ new Set();
|
|
147
219
|
for (const provider of providers) {
|
|
148
|
-
|
|
220
|
+
for (const m of getBuiltinModels(provider)) {
|
|
221
|
+
result.push(m);
|
|
222
|
+
seen.add(m.id);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
for (const cm of pruneAbsorbedCustomModels()) {
|
|
226
|
+
if (!configured.has(cm.provider) || seen.has(cm.id)) continue;
|
|
227
|
+
const built = buildCustomModel(cm.provider, cm.id, cm.name);
|
|
228
|
+
if (built) {
|
|
229
|
+
result.push(built);
|
|
230
|
+
seen.add(cm.id);
|
|
231
|
+
} else {
|
|
232
|
+
aiLog.warn(`custom model ${cm.provider}:${cm.id} has no sibling to clone from; skipping`);
|
|
233
|
+
}
|
|
149
234
|
}
|
|
150
235
|
return result;
|
|
151
236
|
}
|
|
@@ -185,6 +270,12 @@ function findModel(modelId) {
|
|
|
185
270
|
const model = getBuiltinModel(provider, modelId);
|
|
186
271
|
if (model) return model;
|
|
187
272
|
}
|
|
273
|
+
for (const cm of getCustomModels()) {
|
|
274
|
+
if (cm.id === modelId) {
|
|
275
|
+
const built = buildCustomModel(cm.provider, cm.id, cm.name);
|
|
276
|
+
if (built) return built;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
188
279
|
for (const provider of getBuiltinProviders()) {
|
|
189
280
|
const found = getBuiltinModels(provider).find((m) => m.id.startsWith(modelId));
|
|
190
281
|
if (found) return found;
|
|
@@ -240,6 +331,10 @@ export {
|
|
|
240
331
|
resolveTemplate,
|
|
241
332
|
getEnabledModels,
|
|
242
333
|
setEnabledModels,
|
|
334
|
+
getCustomModels,
|
|
335
|
+
addCustomModel,
|
|
336
|
+
removeCustomModel,
|
|
337
|
+
buildCustomModel,
|
|
243
338
|
getAvailableModels,
|
|
244
339
|
resolveApiKey,
|
|
245
340
|
qualifyModelId,
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
} from "./chunk-BLOAJLGI.js";
|
|
5
5
|
import {
|
|
6
6
|
spiritDir
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-43K5UWF7.js";
|
|
8
8
|
import {
|
|
9
9
|
hashSkillDir,
|
|
10
10
|
importSkillFromDir,
|
|
11
11
|
removeSharedSkill,
|
|
12
12
|
sharedSkillsDir
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-M3T3Y6FT.js";
|
|
14
14
|
import {
|
|
15
15
|
addMessage,
|
|
16
16
|
createChannel,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
import {
|
|
29
29
|
isSandboxEnabled,
|
|
30
30
|
wrapForSandbox
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-WR7CSHQ4.js";
|
|
32
32
|
import {
|
|
33
33
|
markIdle,
|
|
34
34
|
onMindEvent
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
getPrompt,
|
|
46
46
|
publish as publish3,
|
|
47
47
|
summarizeOrphanedTurns
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-BWZHX46O.js";
|
|
49
49
|
import {
|
|
50
50
|
exec
|
|
51
51
|
} from "./chunk-GN52E2DP.js";
|
|
@@ -59,11 +59,11 @@ import {
|
|
|
59
59
|
aiCompleteUtility,
|
|
60
60
|
getAiConfig,
|
|
61
61
|
resolveApiKey
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-4ZSUUBG5.js";
|
|
63
63
|
import {
|
|
64
64
|
readGlobalConfig,
|
|
65
65
|
writeGlobalConfig
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-KZAL7HEQ.js";
|
|
67
67
|
import {
|
|
68
68
|
getOrCreateMindUser,
|
|
69
69
|
getOrCreateSystemUser,
|
|
@@ -838,7 +838,7 @@ var MindManager = class {
|
|
|
838
838
|
if (this.shuttingDown || this.stopping.has(name)) return;
|
|
839
839
|
mlog.error(`mind ${name} exited with code ${code}`);
|
|
840
840
|
try {
|
|
841
|
-
const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-
|
|
841
|
+
const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-F5KWIFOX.js");
|
|
842
842
|
const sleepState = getSleepManagerIfReady2()?.getState(name);
|
|
843
843
|
if (sleepState?.sleeping) {
|
|
844
844
|
mlog.info(`${name} is sleeping \u2014 skipping crash recovery`);
|
|
@@ -862,7 +862,7 @@ var MindManager = class {
|
|
|
862
862
|
(err) => mlog.warn(`failed to clear turn state for ${name} after crash`, logger_default.errorData(err))
|
|
863
863
|
);
|
|
864
864
|
try {
|
|
865
|
-
const { getDeliveryManager: getDeliveryManager2 } = await import("./delivery-manager-
|
|
865
|
+
const { getDeliveryManager: getDeliveryManager2 } = await import("./delivery-manager-J3BRHXUF.js");
|
|
866
866
|
getDeliveryManager2().clearMindSessions(name);
|
|
867
867
|
} catch (err) {
|
|
868
868
|
if (!(err instanceof Error && err.message.includes("not initialized"))) {
|
|
@@ -921,7 +921,7 @@ var MindManager = class {
|
|
|
921
921
|
mlog.warn(`failed to clear turn state for ${name} on stop`, logger_default.errorData(err));
|
|
922
922
|
}
|
|
923
923
|
try {
|
|
924
|
-
const { getDeliveryManager: getDeliveryManager2 } = await import("./delivery-manager-
|
|
924
|
+
const { getDeliveryManager: getDeliveryManager2 } = await import("./delivery-manager-J3BRHXUF.js");
|
|
925
925
|
getDeliveryManager2().clearMindSessions(name);
|
|
926
926
|
} catch (err) {
|
|
927
927
|
if (!(err instanceof Error && err.message.includes("not initialized"))) {
|
|
@@ -929,7 +929,7 @@ var MindManager = class {
|
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
931
|
try {
|
|
932
|
-
const { clearEchoTextCache } = await import("./echo-text-
|
|
932
|
+
const { clearEchoTextCache } = await import("./echo-text-3HBQUWPX.js");
|
|
933
933
|
clearEchoTextCache(name);
|
|
934
934
|
} catch (err) {
|
|
935
935
|
mlog.debug(`failed to clear echo-text cache for ${name}`, logger_default.errorData(err));
|
|
@@ -2992,7 +2992,7 @@ var SleepManager = class {
|
|
|
2992
2992
|
const db = await getDb();
|
|
2993
2993
|
const rows = await db.select().from(deliveryQueue).where(and2(eq3(deliveryQueue.mind, name), eq3(deliveryQueue.status, "sleep-queued"))).all();
|
|
2994
2994
|
if (rows.length === 0) return 0;
|
|
2995
|
-
const { deliverMessage: deliverMessage2 } = await import("./message-delivery-
|
|
2995
|
+
const { deliverMessage: deliverMessage2 } = await import("./message-delivery-4ZWFDBAY.js");
|
|
2996
2996
|
const delivered = [];
|
|
2997
2997
|
for (const row of rows) {
|
|
2998
2998
|
try {
|
|
@@ -3924,7 +3924,7 @@ var DeliveryManager = class {
|
|
|
3924
3924
|
`To accept this channel, add a routing rule for "${channel}" to your routes.json.`,
|
|
3925
3925
|
`Messages are being held until a route is configured.`
|
|
3926
3926
|
].filter((line) => line !== null).join("\n");
|
|
3927
|
-
const { sendSystemMessage: sendSystemMessage2 } = await import("./system-chat-
|
|
3927
|
+
const { sendSystemMessage: sendSystemMessage2 } = await import("./system-chat-EQIH6JVL.js");
|
|
3928
3928
|
await sendSystemMessage2(mindName, notification);
|
|
3929
3929
|
}
|
|
3930
3930
|
async persistToQueue(mindName, session, payload, status = "pending") {
|
|
@@ -4450,7 +4450,7 @@ async function generateSystemReply(conversationId, mindName, message) {
|
|
|
4450
4450
|
if (config.sleep.schedule?.wake) contextParts.push(`Wake cron: ${config.sleep.schedule.wake}`);
|
|
4451
4451
|
}
|
|
4452
4452
|
try {
|
|
4453
|
-
const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-
|
|
4453
|
+
const { getSleepManagerIfReady: getSleepManagerIfReady2 } = await import("./sleep-manager-F5KWIFOX.js");
|
|
4454
4454
|
const sm = getSleepManagerIfReady2();
|
|
4455
4455
|
if (sm) {
|
|
4456
4456
|
const state = sm.getState(mindName);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
aiCompleteUtility
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4ZSUUBG5.js";
|
|
5
5
|
import {
|
|
6
6
|
logger_default
|
|
7
7
|
} from "./chunk-T2TP6ZC6.js";
|
|
@@ -1013,11 +1013,11 @@ var Summarizer = class {
|
|
|
1013
1013
|
}
|
|
1014
1014
|
};
|
|
1015
1015
|
async function reconcileWedgedTurns(idleMs) {
|
|
1016
|
-
const { sweepWedgedTurns: sweepWedgedTurns2, summarizeOrphanedTurns: summarizeOrphanedTurns2 } = await import("./turn-tracker-
|
|
1016
|
+
const { sweepWedgedTurns: sweepWedgedTurns2, summarizeOrphanedTurns: summarizeOrphanedTurns2 } = await import("./turn-tracker-Z5UJC4BY.js");
|
|
1017
1017
|
const wedged = await sweepWedgedTurns2(idleMs);
|
|
1018
1018
|
if (wedged.length === 0) return;
|
|
1019
1019
|
summarizeOrphanedTurns2(wedged);
|
|
1020
|
-
const { tryGetDeliveryManager } = await import("./delivery-manager-
|
|
1020
|
+
const { tryGetDeliveryManager } = await import("./delivery-manager-J3BRHXUF.js");
|
|
1021
1021
|
const dm = tryGetDeliveryManager();
|
|
1022
1022
|
if (!dm) return;
|
|
1023
1023
|
for (const t of wedged) {
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-QPTQKGGF.js";
|
|
6
6
|
import {
|
|
7
7
|
recordOutbound
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6G7R2LPI.js";
|
|
9
9
|
import {
|
|
10
10
|
readEnv,
|
|
11
11
|
sharedEnvPath
|
|
@@ -23,7 +23,11 @@ import {
|
|
|
23
23
|
} from "./chunk-CU6OFXMM.js";
|
|
24
24
|
import {
|
|
25
25
|
publish
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-BWZHX46O.js";
|
|
27
|
+
import {
|
|
28
|
+
daemonConfigPath,
|
|
29
|
+
readDaemonToken
|
|
30
|
+
} from "./chunk-P6DPB33N.js";
|
|
27
31
|
import {
|
|
28
32
|
getOrCreateMindUser,
|
|
29
33
|
getUserByUsername
|
|
@@ -35,8 +39,7 @@ import {
|
|
|
35
39
|
buildVoluteSlug
|
|
36
40
|
} from "./chunk-LGNUFVMR.js";
|
|
37
41
|
import {
|
|
38
|
-
mindDir
|
|
39
|
-
voluteSystemDir
|
|
42
|
+
mindDir
|
|
40
43
|
} from "./chunk-IUZ3EV2D.js";
|
|
41
44
|
import {
|
|
42
45
|
__export
|
|
@@ -540,7 +543,7 @@ function readSessionFile(mindDir2) {
|
|
|
540
543
|
return void 0;
|
|
541
544
|
}
|
|
542
545
|
function getDaemonConfig() {
|
|
543
|
-
const configPath =
|
|
546
|
+
const configPath = daemonConfigPath();
|
|
544
547
|
if (!existsSync(configPath)) {
|
|
545
548
|
throw new Error("Volute daemon is not running");
|
|
546
549
|
}
|
|
@@ -556,7 +559,7 @@ function getDaemonConfig() {
|
|
|
556
559
|
const url = new URL("http://localhost");
|
|
557
560
|
url.hostname = config.hostname || "localhost";
|
|
558
561
|
url.port = String(config.port);
|
|
559
|
-
return { url: url.origin, token:
|
|
562
|
+
return { url: url.origin, token: readDaemonToken() };
|
|
560
563
|
}
|
|
561
564
|
async function read4(env, channelSlug, limit) {
|
|
562
565
|
const mindName = env.VOLUTE_MIND;
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
modeLabel,
|
|
8
8
|
pollHealth,
|
|
9
9
|
startService
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-P6DPB33N.js";
|
|
11
11
|
import {
|
|
12
12
|
readGlobalConfig
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-KZAL7HEQ.js";
|
|
14
14
|
import {
|
|
15
15
|
voluteHome,
|
|
16
16
|
voluteSystemDir
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
voluteSystemDir
|
|
4
|
+
} from "./chunk-IUZ3EV2D.js";
|
|
5
|
+
|
|
6
|
+
// packages/daemon/src/lib/config/setup.ts
|
|
7
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "fs";
|
|
8
|
+
import { resolve } from "path";
|
|
9
|
+
function configPath() {
|
|
10
|
+
return resolve(voluteSystemDir(), "config.json");
|
|
11
|
+
}
|
|
12
|
+
function secretsPath() {
|
|
13
|
+
return resolve(voluteSystemDir(), "secrets.json");
|
|
14
|
+
}
|
|
15
|
+
function hasEntries(obj) {
|
|
16
|
+
return !!obj && Object.keys(obj).length > 0;
|
|
17
|
+
}
|
|
18
|
+
function splitConfig(config) {
|
|
19
|
+
const publicConfig = { ...config };
|
|
20
|
+
const secrets = {};
|
|
21
|
+
if (config.ai) {
|
|
22
|
+
const { providers, ...rest } = config.ai;
|
|
23
|
+
publicConfig.ai = { ...rest, providers: {} };
|
|
24
|
+
if (hasEntries(providers)) secrets.ai = { providers };
|
|
25
|
+
}
|
|
26
|
+
if (config.imagegen) {
|
|
27
|
+
const { providers, ...rest } = config.imagegen;
|
|
28
|
+
publicConfig.imagegen = { ...rest };
|
|
29
|
+
if (providers && Object.keys(providers).length > 0) secrets.imagegen = { providers };
|
|
30
|
+
}
|
|
31
|
+
return { publicConfig, secrets };
|
|
32
|
+
}
|
|
33
|
+
function mergeSecrets(publicConfig, secrets) {
|
|
34
|
+
const merged = { ...publicConfig };
|
|
35
|
+
if (secrets.ai?.providers) {
|
|
36
|
+
merged.ai = { ...merged.ai ?? { providers: {} }, providers: secrets.ai.providers };
|
|
37
|
+
}
|
|
38
|
+
if (secrets.imagegen?.providers) {
|
|
39
|
+
merged.imagegen = { ...merged.imagegen ?? {}, providers: secrets.imagegen.providers };
|
|
40
|
+
}
|
|
41
|
+
return merged;
|
|
42
|
+
}
|
|
43
|
+
function readSecrets() {
|
|
44
|
+
const path = secretsPath();
|
|
45
|
+
if (!existsSync(path)) return {};
|
|
46
|
+
try {
|
|
47
|
+
return JSON.parse(readFileSync(path, "utf-8"));
|
|
48
|
+
} catch {
|
|
49
|
+
return {};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
var _cachedConfig = null;
|
|
53
|
+
var CONFIG_CACHE_TTL = 2e3;
|
|
54
|
+
function _resetConfigCache() {
|
|
55
|
+
_cachedConfig = null;
|
|
56
|
+
}
|
|
57
|
+
function readGlobalConfig() {
|
|
58
|
+
if (_cachedConfig && Date.now() - _cachedConfig.ts < CONFIG_CACHE_TTL) {
|
|
59
|
+
return { ..._cachedConfig.config };
|
|
60
|
+
}
|
|
61
|
+
const path = configPath();
|
|
62
|
+
if (!existsSync(path)) {
|
|
63
|
+
_cachedConfig = null;
|
|
64
|
+
return {};
|
|
65
|
+
}
|
|
66
|
+
let publicConfig;
|
|
67
|
+
try {
|
|
68
|
+
publicConfig = JSON.parse(readFileSync(path, "utf-8"));
|
|
69
|
+
} catch (err) {
|
|
70
|
+
console.error(`Failed to parse ${path}: ${err instanceof Error ? err.message : err}`);
|
|
71
|
+
return {};
|
|
72
|
+
}
|
|
73
|
+
const config = mergeSecrets(publicConfig, readSecrets());
|
|
74
|
+
_cachedConfig = { config, ts: Date.now() };
|
|
75
|
+
return config;
|
|
76
|
+
}
|
|
77
|
+
function writeGlobalConfig(config) {
|
|
78
|
+
mkdirSync(voluteSystemDir(), { recursive: true });
|
|
79
|
+
const { publicConfig, secrets } = splitConfig(config);
|
|
80
|
+
const cfgPath = configPath();
|
|
81
|
+
writeFileSync(cfgPath, `${JSON.stringify(publicConfig, null, 2)}
|
|
82
|
+
`, { mode: 420 });
|
|
83
|
+
chmodSync(cfgPath, 420);
|
|
84
|
+
const secPath = secretsPath();
|
|
85
|
+
writeFileSync(secPath, `${JSON.stringify(secrets, null, 2)}
|
|
86
|
+
`, { mode: 384 });
|
|
87
|
+
chmodSync(secPath, 384);
|
|
88
|
+
_cachedConfig = { config, ts: Date.now() };
|
|
89
|
+
}
|
|
90
|
+
function migrateConfigSecrets() {
|
|
91
|
+
const path = configPath();
|
|
92
|
+
if (!existsSync(path)) return;
|
|
93
|
+
let raw;
|
|
94
|
+
try {
|
|
95
|
+
raw = readFileSync(path, "utf-8");
|
|
96
|
+
} catch {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
let parsed;
|
|
100
|
+
try {
|
|
101
|
+
parsed = JSON.parse(raw);
|
|
102
|
+
} catch {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const embedsSecrets = hasEntries(parsed.ai?.providers) || hasEntries(parsed.imagegen?.providers);
|
|
106
|
+
const mode = statSync(path).mode & 511;
|
|
107
|
+
if (!embedsSecrets && mode === 420) return;
|
|
108
|
+
_resetConfigCache();
|
|
109
|
+
writeGlobalConfig(readGlobalConfig());
|
|
110
|
+
}
|
|
111
|
+
function isSetupComplete() {
|
|
112
|
+
const config = readGlobalConfig();
|
|
113
|
+
return config.setupCompleted === true;
|
|
114
|
+
}
|
|
115
|
+
function isImagegenEnabled() {
|
|
116
|
+
const config = readGlobalConfig();
|
|
117
|
+
const ig = config.imagegen;
|
|
118
|
+
if (!ig) return false;
|
|
119
|
+
if (ig.enabled === true) return true;
|
|
120
|
+
if (ig.providers && Object.keys(ig.providers).length > 0) return true;
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
function migrateSetupCompleted() {
|
|
124
|
+
const config = readGlobalConfig();
|
|
125
|
+
if (config.setup != null && config.setupCompleted == null) {
|
|
126
|
+
config.setupCompleted = true;
|
|
127
|
+
writeGlobalConfig(config);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export {
|
|
132
|
+
configPath,
|
|
133
|
+
secretsPath,
|
|
134
|
+
_resetConfigCache,
|
|
135
|
+
readGlobalConfig,
|
|
136
|
+
writeGlobalConfig,
|
|
137
|
+
migrateConfigSecrets,
|
|
138
|
+
isSetupComplete,
|
|
139
|
+
isImagegenEnabled,
|
|
140
|
+
migrateSetupCompleted
|
|
141
|
+
};
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
readGlobalConfig,
|
|
8
8
|
writeGlobalConfig
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-KZAL7HEQ.js";
|
|
10
10
|
import {
|
|
11
11
|
logger_default
|
|
12
12
|
} from "./chunk-T2TP6ZC6.js";
|
|
@@ -46,7 +46,7 @@ async function initDefaultSkills() {
|
|
|
46
46
|
const config = readGlobalConfig();
|
|
47
47
|
let extensionSkills = [];
|
|
48
48
|
try {
|
|
49
|
-
const { getExtensionStandardSkills } = await import("./extensions-
|
|
49
|
+
const { getExtensionStandardSkills } = await import("./extensions-X6MKBJLB.js");
|
|
50
50
|
extensionSkills = getExtensionStandardSkills();
|
|
51
51
|
} catch (err) {
|
|
52
52
|
logger_default.warn("failed to load extension standard skills during init", logger_default.errorData(err));
|
|
@@ -168,16 +168,30 @@ async function restartService(mode) {
|
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
+
function daemonConfigPath() {
|
|
172
|
+
return resolve(voluteSystemDir(), "daemon.json");
|
|
173
|
+
}
|
|
174
|
+
function daemonTokenPath() {
|
|
175
|
+
return resolve(voluteSystemDir(), "daemon-token");
|
|
176
|
+
}
|
|
177
|
+
function readDaemonToken() {
|
|
178
|
+
const path = daemonTokenPath();
|
|
179
|
+
if (!existsSync(path)) return void 0;
|
|
180
|
+
try {
|
|
181
|
+
return readFileSync(path, "utf-8").trim() || void 0;
|
|
182
|
+
} catch {
|
|
183
|
+
return void 0;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
171
186
|
function readDaemonConfig() {
|
|
172
|
-
const configPath =
|
|
187
|
+
const configPath = daemonConfigPath();
|
|
173
188
|
if (!existsSync(configPath)) return { hostname: "127.0.0.1", port: 1618 };
|
|
174
189
|
try {
|
|
175
190
|
const config = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
176
191
|
return {
|
|
177
192
|
hostname: config.hostname || "127.0.0.1",
|
|
178
193
|
port: config.port ?? 1618,
|
|
179
|
-
internalPort: config.internalPort
|
|
180
|
-
token: config.token
|
|
194
|
+
internalPort: config.internalPort
|
|
181
195
|
};
|
|
182
196
|
} catch {
|
|
183
197
|
console.error("Warning: could not read daemon config, using defaults.");
|
|
@@ -212,6 +226,8 @@ export {
|
|
|
212
226
|
startService,
|
|
213
227
|
stopService,
|
|
214
228
|
restartService,
|
|
229
|
+
daemonConfigPath,
|
|
230
|
+
readDaemonToken,
|
|
215
231
|
readDaemonConfig,
|
|
216
232
|
modeLabel
|
|
217
233
|
};
|