volute 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -20
- package/dist/{activity-events-4O37J7PD.js → activity-events-ZMBAKLUF.js} +2 -2
- package/dist/api.d.ts +590 -10
- package/dist/{auth-HM2RSPY7.js → auth-4TV573WE.js} +2 -2
- package/dist/{channel-HZOSHGNF.js → channel-ZVZV42UD.js} +3 -3
- package/dist/{chunk-NOBRGACV.js → chunk-2VO7453N.js} +56 -19
- package/dist/{chunk-OOW675I3.js → chunk-3CFRE2VC.js} +931 -775
- package/dist/{chunk-PHHKNGA3.js → chunk-3TV4GLFO.js} +2 -2
- package/dist/{chunk-4TJ72QQ3.js → chunk-5Y3PBKW6.js} +3 -3
- package/dist/{chunk-BFK6SOEJ.js → chunk-J2CO4WEV.js} +1 -1
- package/dist/{chunk-TQDITGES.js → chunk-LX22GRG7.js} +10 -13
- package/dist/{chunk-E7GOKNOT.js → chunk-NWI2425I.js} +1 -1
- package/dist/{chunk-2767L2RZ.js → chunk-OZFKBXD6.js} +1 -1
- package/dist/{chunk-XLC342FO.js → chunk-SIAG3QMM.js} +14 -1
- package/dist/{chunk-RVKR2R7F.js → chunk-SSI47XP2.js} +10 -2
- package/dist/chunk-TZKJLDQN.js +78 -0
- package/dist/{chunk-P3W36ZGD.js → chunk-USNBKHYG.js} +33 -5
- package/dist/chunk-UTL75LP6.js +113 -0
- package/dist/{chunk-3AIBT4TW.js → chunk-V63B7DX3.js} +24 -1
- package/dist/{chunk-33XAVCS4.js → chunk-WBHMQ5OZ.js} +49 -0
- package/dist/{chunk-TRQEV3CD.js → chunk-WGOGUMPO.js} +22 -3
- package/dist/chunk-XOXLRRR2.js +176 -0
- package/dist/{chunk-JTDFJWI2.js → chunk-YJA7P64S.js} +1 -1
- package/dist/chunk-ZYGKG6VC.js +22 -0
- package/dist/cli.js +44 -20
- package/dist/{cloud-sync-DIU3OCPV.js → cloud-sync-NI2K3C7G.js} +11 -9
- package/dist/{connector-M6XFI6GM.js → connector-G722WXAU.js} +4 -4
- package/dist/{create-VDQJER52.js → create-4YBRTTJS.js} +1 -1
- package/dist/{daemon-client-JOVQZ52X.js → daemon-client-Z7FAJ6JW.js} +1 -1
- package/dist/{daemon-restart-YMPEATQH.js → daemon-restart-BJZ3O4U4.js} +6 -5
- package/dist/daemon.js +982 -340
- package/dist/{delete-2MRR4JX5.js → delete-27OYNK25.js} +1 -1
- package/dist/{down-674SX2IZ.js → down-7UKFMJJZ.js} +4 -4
- package/dist/{env-2FPOZK37.js → env-M336ONDP.js} +4 -4
- package/dist/{export-IKFAPRAO.js → export-HP4G5DQC.js} +1 -1
- package/dist/{file-KT3UIQM3.js → file-HUDKTRAS.js} +3 -3
- package/dist/{history-46WZN5CN.js → history-B64GTFTD.js} +3 -3
- package/dist/{import-FRDPQPJ2.js → import-XIB7UV4S.js} +2 -2
- package/dist/{log-6SGSSR3D.js → log-PBFNILJ4.js} +3 -3
- package/dist/{login-UO6AOVEA.js → login-6U7U6BNG.js} +1 -1
- package/dist/login-B5E7N7MY.js +46 -0
- package/dist/logout-XSJRYS3U.js +39 -0
- package/dist/{logs-HRBONI5I.js → logs-3CART7O7.js} +3 -3
- package/dist/{merge-KSFJKX6T.js → merge-VK2HSKMA.js} +3 -3
- package/dist/{message-delivery-S7BCNV6Y.js → message-delivery-MS5JYPZX.js} +11 -9
- package/dist/{mind-KPLCRKQA.js → mind-HZ3QSDDJ.js} +17 -17
- package/dist/{mind-activity-tracker-NMDDEV3K.js → mind-activity-tracker-4G6FURY2.js} +3 -3
- package/dist/{mind-manager-ZNRIYEK3.js → mind-manager-VVK67AY3.js} +6 -4
- package/dist/{mind-sleep-GHPTSAYN.js → mind-sleep-DTV7L44D.js} +3 -3
- package/dist/{mind-wake-BJDJFMDF.js → mind-wake-PFN4FN3T.js} +3 -3
- package/dist/notes-37FW2UR2.js +230 -0
- package/dist/{package-S5YF25XV.js → package-VZWLXPHV.js} +3 -1
- package/dist/{pages-TWR6U7DS.js → pages-DIIT5HMQ.js} +1 -1
- package/dist/{publish-BZNHKUUK.js → publish-HQV7YREB.js} +4 -4
- package/dist/{pull-D32SPFVU.js → pull-2MB4SK3C.js} +3 -3
- package/dist/{register-U2UO6TC4.js → register-EFND67FQ.js} +1 -1
- package/dist/{restart-5BMNV7KU.js → restart-CCK7D6TV.js} +3 -3
- package/dist/sandbox-EHGFF52K.js +19 -0
- package/dist/{schedule-YEFDLVMJ.js → schedule-6F7ELB2M.js} +3 -3
- package/dist/{seed-6FEKB3YC.js → seed-E5OQGWX3.js} +1 -1
- package/dist/{send-IISDYFCL.js → send-IH6XZKPC.js} +6 -20
- package/dist/service-LLBV3R7M.js +122 -0
- package/dist/setup-F6TWFYGQ.js +371 -0
- package/dist/setup-YGAAIKKZ.js +17 -0
- package/dist/{shared-LWMNTTZN.js → shared-UMO4S7CC.js} +4 -4
- package/dist/{skill-BQOFACEI.js → skill-42LGFBQC.js} +13 -5
- package/dist/skills/dreaming/SKILL.md +68 -0
- package/dist/skills/dreaming/references/INSTALL.md +56 -0
- package/dist/skills/dreaming/scripts/dream.ts +289 -0
- package/dist/skills/dreaming/scripts/wake-context-dreams.sh +30 -0
- package/dist/skills/imagegen/SKILL.md +37 -0
- package/dist/skills/imagegen/references/INSTALL.md +13 -0
- package/dist/skills/imagegen/scripts/imagegen.ts +136 -0
- package/dist/skills/notes/SKILL.md +34 -0
- package/dist/skills/resonance/SKILL.md +73 -0
- package/dist/skills/resonance/assets/default-config.json +21 -0
- package/dist/skills/resonance/references/INSTALL.md +23 -0
- package/dist/skills/resonance/scripts/resonance.ts +1250 -0
- package/dist/skills/volute-mind/SKILL.md +23 -3
- package/dist/{sleep-manager-XXSWQQLE.js → sleep-manager-EE4NRN2Q.js} +11 -9
- package/dist/{sprout-CGSW4CF5.js → sprout-QL74KR2X.js} +5 -5
- package/dist/{start-C7XITZ5O.js → start-O5JQASRC.js} +3 -3
- package/dist/{status-SIRPLEZC.js → status-FZBEBM7Q.js} +3 -3
- package/dist/{status-LYS4NUOZ.js → status-WXD4HXRL.js} +3 -3
- package/dist/{stop-CVKBSLXY.js → stop-2SOG5NYF.js} +3 -3
- package/dist/up-SDMCSVI3.js +17 -0
- package/dist/{update-7XCZMYBT.js → update-5VUDAI3D.js} +6 -6
- package/dist/{upgrade-7RUIXGOO.js → upgrade-QCCO33BK.js} +1 -1
- package/dist/{variant-UGREB4G5.js → variant-WWLDY6D5.js} +4 -4
- package/dist/{version-notify-SZ75QRGO.js → version-notify-USFZBWMG.js} +11 -9
- package/dist/web-assets/assets/index-CUQ31ieL.js +69 -0
- package/dist/web-assets/assets/index-CW8NSl1o.css +1 -0
- package/dist/web-assets/favicon.png +0 -0
- package/dist/web-assets/index.html +5 -4
- package/dist/web-assets/logo.png +0 -0
- package/drizzle/0015_notes.sql +23 -0
- package/drizzle/0016_note_reactions_and_replies.sql +15 -0
- package/drizzle/meta/_journal.json +14 -0
- package/package.json +3 -1
- package/templates/_base/.init/.config/hooks/wake-context.sh +7 -0
- package/templates/_base/home/public/.gitkeep +0 -0
- package/templates/_base/src/lib/startup.ts +8 -0
- package/templates/claude/src/agent.ts +51 -1
- package/templates/claude/src/server.ts +1 -0
- package/templates/pi/package.json.tmpl +1 -0
- package/templates/pi/src/agent.ts +48 -1
- package/templates/pi/src/lib/subagents.ts +150 -0
- package/templates/pi/src/server.ts +1 -0
- package/dist/chunk-NWPT4ASZ.js +0 -89
- package/dist/service-FASYWLTC.js +0 -247
- package/dist/setup-BMLM2UTK.js +0 -230
- package/dist/up-OMHACRJL.js +0 -15
- package/dist/web-assets/assets/index-Bx9WDoaQ.js +0 -69
- package/dist/web-assets/assets/index-Clz8OhmJ.css +0 -1
|
@@ -4,7 +4,7 @@ import "./chunk-K3NQKI34.js";
|
|
|
4
4
|
// package.json
|
|
5
5
|
var package_default = {
|
|
6
6
|
name: "volute",
|
|
7
|
-
version: "0.
|
|
7
|
+
version: "0.26.0",
|
|
8
8
|
description: "CLI for creating and managing self-modifying AI minds powered by the Claude Agent SDK",
|
|
9
9
|
type: "module",
|
|
10
10
|
license: "MIT",
|
|
@@ -60,6 +60,7 @@ var package_default = {
|
|
|
60
60
|
"db:migrate": "drizzle-kit migrate"
|
|
61
61
|
},
|
|
62
62
|
dependencies: {
|
|
63
|
+
"@anthropic-ai/sandbox-runtime": "^0.0.39",
|
|
63
64
|
"@hono/node-server": "^1.19.9",
|
|
64
65
|
"@hono/zod-validator": "^0.7.6",
|
|
65
66
|
"@libsql/client": "^0.17.0",
|
|
@@ -86,6 +87,7 @@ var package_default = {
|
|
|
86
87
|
dompurify: "^3.3.1",
|
|
87
88
|
"drizzle-kit": "^0.31.8",
|
|
88
89
|
lefthook: "^2.1.0",
|
|
90
|
+
libsql: "^0.5.22",
|
|
89
91
|
marked: "^17.0.1",
|
|
90
92
|
svelte: "^5.53.0",
|
|
91
93
|
tsup: "^8.0.0",
|
|
@@ -6,7 +6,7 @@ async function run(args) {
|
|
|
6
6
|
const subcommand = args[0];
|
|
7
7
|
switch (subcommand) {
|
|
8
8
|
case "publish":
|
|
9
|
-
await import("./publish-
|
|
9
|
+
await import("./publish-HQV7YREB.js").then((m) => m.run(args.slice(1)));
|
|
10
10
|
break;
|
|
11
11
|
case "status":
|
|
12
12
|
await import("./status-LV34BG6G.js").then((m) => m.run(args.slice(1)));
|
|
@@ -7,16 +7,16 @@ import {
|
|
|
7
7
|
} from "./chunk-NAOW2CLO.js";
|
|
8
8
|
import {
|
|
9
9
|
sharedDir
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3TV4GLFO.js";
|
|
11
11
|
import {
|
|
12
12
|
readSystemsConfig
|
|
13
13
|
} from "./chunk-HFCBO2GL.js";
|
|
14
14
|
import "./chunk-YUIHSKR6.js";
|
|
15
|
+
import "./chunk-YJA7P64S.js";
|
|
16
|
+
import "./chunk-XOXLRRR2.js";
|
|
15
17
|
import {
|
|
16
18
|
parseArgs
|
|
17
19
|
} from "./chunk-D424ZQGI.js";
|
|
18
|
-
import "./chunk-JTDFJWI2.js";
|
|
19
|
-
import "./chunk-NWPT4ASZ.js";
|
|
20
20
|
import {
|
|
21
21
|
mindDir
|
|
22
22
|
} from "./chunk-B2CPS4QU.js";
|
|
@@ -42,7 +42,7 @@ async function run(args) {
|
|
|
42
42
|
pagesDir = resolve(sharedDir(), "pages");
|
|
43
43
|
} else if (flags.mind || process.env.VOLUTE_MIND) {
|
|
44
44
|
mindName = resolveMindName(flags);
|
|
45
|
-
pagesDir = resolve(mindDir(mindName), "home", "pages");
|
|
45
|
+
pagesDir = resolve(mindDir(mindName), "home", "public", "pages");
|
|
46
46
|
} else {
|
|
47
47
|
mindName = "system";
|
|
48
48
|
pagesDir = resolve(sharedDir(), "pages");
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
daemonFetch
|
|
4
|
+
} from "./chunk-WGOGUMPO.js";
|
|
2
5
|
import {
|
|
3
6
|
resolveMindName
|
|
4
7
|
} from "./chunk-NAOW2CLO.js";
|
|
5
8
|
import {
|
|
6
9
|
parseArgs
|
|
7
10
|
} from "./chunk-D424ZQGI.js";
|
|
8
|
-
import {
|
|
9
|
-
daemonFetch
|
|
10
|
-
} from "./chunk-TRQEV3CD.js";
|
|
11
11
|
import "./chunk-B2CPS4QU.js";
|
|
12
12
|
import "./chunk-K3NQKI34.js";
|
|
13
13
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
daemonFetch
|
|
4
|
+
} from "./chunk-WGOGUMPO.js";
|
|
2
5
|
import {
|
|
3
6
|
getClient,
|
|
4
7
|
urlOf
|
|
@@ -6,9 +9,6 @@ import {
|
|
|
6
9
|
import {
|
|
7
10
|
resolveMindName
|
|
8
11
|
} from "./chunk-NAOW2CLO.js";
|
|
9
|
-
import {
|
|
10
|
-
daemonFetch
|
|
11
|
-
} from "./chunk-TRQEV3CD.js";
|
|
12
12
|
import "./chunk-B2CPS4QU.js";
|
|
13
13
|
import "./chunk-K3NQKI34.js";
|
|
14
14
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
buildDenyRead,
|
|
4
|
+
initSandbox,
|
|
5
|
+
isSandboxEnabled,
|
|
6
|
+
shellEscape,
|
|
7
|
+
wrapForSandbox
|
|
8
|
+
} from "./chunk-UTL75LP6.js";
|
|
9
|
+
import "./chunk-YUIHSKR6.js";
|
|
10
|
+
import "./chunk-TZKJLDQN.js";
|
|
11
|
+
import "./chunk-B2CPS4QU.js";
|
|
12
|
+
import "./chunk-K3NQKI34.js";
|
|
13
|
+
export {
|
|
14
|
+
buildDenyRead,
|
|
15
|
+
initSandbox,
|
|
16
|
+
isSandboxEnabled,
|
|
17
|
+
shellEscape,
|
|
18
|
+
wrapForSandbox
|
|
19
|
+
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
daemonFetch
|
|
4
|
+
} from "./chunk-WGOGUMPO.js";
|
|
2
5
|
import {
|
|
3
6
|
getClient,
|
|
4
7
|
urlOf
|
|
@@ -9,9 +12,6 @@ import {
|
|
|
9
12
|
import {
|
|
10
13
|
parseArgs
|
|
11
14
|
} from "./chunk-D424ZQGI.js";
|
|
12
|
-
import {
|
|
13
|
-
daemonFetch
|
|
14
|
-
} from "./chunk-TRQEV3CD.js";
|
|
15
15
|
import "./chunk-B2CPS4QU.js";
|
|
16
16
|
import "./chunk-K3NQKI34.js";
|
|
17
17
|
|
|
@@ -21,7 +21,7 @@ async function run(args) {
|
|
|
21
21
|
}
|
|
22
22
|
const template = flags.template ?? "claude";
|
|
23
23
|
const skills = flags.skills === "none" ? [] : flags.skills ? flags.skills.split(",") : void 0;
|
|
24
|
-
const { daemonFetch } = await import("./daemon-client-
|
|
24
|
+
const { daemonFetch } = await import("./daemon-client-Z7FAJ6JW.js");
|
|
25
25
|
const { getClient, urlOf } = await import("./api-client-YPKOZP2O.js");
|
|
26
26
|
const client = getClient();
|
|
27
27
|
const createRes = await daemonFetch(urlOf(client.api.minds.$url()), {
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
readStdin
|
|
4
|
+
} from "./chunk-ZYGKG6VC.js";
|
|
5
|
+
import {
|
|
6
|
+
daemonFetch
|
|
7
|
+
} from "./chunk-WGOGUMPO.js";
|
|
2
8
|
import {
|
|
3
9
|
getClient,
|
|
4
10
|
urlOf
|
|
@@ -9,9 +15,6 @@ import {
|
|
|
9
15
|
import {
|
|
10
16
|
parseArgs
|
|
11
17
|
} from "./chunk-D424ZQGI.js";
|
|
12
|
-
import {
|
|
13
|
-
daemonFetch
|
|
14
|
-
} from "./chunk-TRQEV3CD.js";
|
|
15
18
|
import {
|
|
16
19
|
findMind
|
|
17
20
|
} from "./chunk-B2CPS4QU.js";
|
|
@@ -51,23 +54,6 @@ function parseTarget(target) {
|
|
|
51
54
|
};
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
// src/lib/read-stdin.ts
|
|
55
|
-
import { isatty } from "tty";
|
|
56
|
-
async function readStdin() {
|
|
57
|
-
if (isatty(0)) return void 0;
|
|
58
|
-
const chunks = [];
|
|
59
|
-
try {
|
|
60
|
-
for await (const chunk of process.stdin) {
|
|
61
|
-
chunks.push(chunk);
|
|
62
|
-
}
|
|
63
|
-
} catch (err) {
|
|
64
|
-
console.error(`Failed to read from stdin: ${err instanceof Error ? err.message : String(err)}`);
|
|
65
|
-
process.exit(1);
|
|
66
|
-
}
|
|
67
|
-
const text = Buffer.concat(chunks).toString().replace(/\r?\n$/, "");
|
|
68
|
-
return text || void 0;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
57
|
// src/commands/send.ts
|
|
72
58
|
var IMAGE_MEDIA_TYPES = {
|
|
73
59
|
".png": "image/png",
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
LAUNCHD_PLIST_LABEL,
|
|
4
|
+
LAUNCHD_PLIST_PATH,
|
|
5
|
+
SYSTEM_LAUNCHD_PLIST_PATH,
|
|
6
|
+
SYSTEM_SERVICE_PATH,
|
|
7
|
+
USER_SYSTEMD_UNIT
|
|
8
|
+
} from "./chunk-V63B7DX3.js";
|
|
9
|
+
import "./chunk-YJA7P64S.js";
|
|
10
|
+
import "./chunk-XOXLRRR2.js";
|
|
11
|
+
import {
|
|
12
|
+
parseArgs
|
|
13
|
+
} from "./chunk-D424ZQGI.js";
|
|
14
|
+
import "./chunk-B2CPS4QU.js";
|
|
15
|
+
import "./chunk-K3NQKI34.js";
|
|
16
|
+
|
|
17
|
+
// src/commands/service.ts
|
|
18
|
+
import { execFile } from "child_process";
|
|
19
|
+
import { existsSync } from "fs";
|
|
20
|
+
import { promisify } from "util";
|
|
21
|
+
var execFileAsync = promisify(execFile);
|
|
22
|
+
async function status() {
|
|
23
|
+
const platform = process.platform;
|
|
24
|
+
if (platform === "darwin") {
|
|
25
|
+
if (existsSync(SYSTEM_LAUNCHD_PLIST_PATH)) {
|
|
26
|
+
try {
|
|
27
|
+
const { stdout } = await execFileAsync("launchctl", ["list", LAUNCHD_PLIST_LABEL]);
|
|
28
|
+
console.log("System service (LaunchDaemon):");
|
|
29
|
+
console.log(stdout);
|
|
30
|
+
} catch {
|
|
31
|
+
console.log("System service installed but not currently loaded.");
|
|
32
|
+
}
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (!existsSync(LAUNCHD_PLIST_PATH)) {
|
|
36
|
+
console.log("Service not installed.");
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
const { stdout } = await execFileAsync("launchctl", ["list", LAUNCHD_PLIST_LABEL]);
|
|
41
|
+
console.log(stdout);
|
|
42
|
+
} catch {
|
|
43
|
+
console.log("Service installed but not currently loaded.");
|
|
44
|
+
}
|
|
45
|
+
} else if (platform === "linux") {
|
|
46
|
+
if (existsSync(SYSTEM_SERVICE_PATH)) {
|
|
47
|
+
try {
|
|
48
|
+
const { stdout } = await execFileAsync("systemctl", ["status", "volute", "--no-pager"]);
|
|
49
|
+
console.log(stdout);
|
|
50
|
+
} catch (err) {
|
|
51
|
+
const e = err;
|
|
52
|
+
if (e.stdout) {
|
|
53
|
+
console.log(e.stdout);
|
|
54
|
+
} else {
|
|
55
|
+
console.error("System service installed but could not retrieve status.");
|
|
56
|
+
if (e.stderr) console.error(e.stderr);
|
|
57
|
+
else if (e.message) console.error(e.message);
|
|
58
|
+
console.error("Try running: systemctl status volute");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (!existsSync(USER_SYSTEMD_UNIT)) {
|
|
64
|
+
console.log("Service not installed.");
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
const { stdout } = await execFileAsync("systemctl", [
|
|
69
|
+
"--user",
|
|
70
|
+
"status",
|
|
71
|
+
"volute",
|
|
72
|
+
"--no-pager"
|
|
73
|
+
]);
|
|
74
|
+
console.log(stdout);
|
|
75
|
+
} catch (err) {
|
|
76
|
+
const e = err;
|
|
77
|
+
if (e.stdout) console.log(e.stdout);
|
|
78
|
+
else console.log("Service installed but status unknown.");
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
console.error(`Unsupported platform: ${platform}`);
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async function run(args) {
|
|
86
|
+
const { positional } = parseArgs(args, {});
|
|
87
|
+
const subcommand = positional[0];
|
|
88
|
+
switch (subcommand) {
|
|
89
|
+
case "install":
|
|
90
|
+
console.log("'volute service install' has been replaced by 'volute setup'.");
|
|
91
|
+
console.log("Run `volute setup` to configure your installation.");
|
|
92
|
+
break;
|
|
93
|
+
case "uninstall":
|
|
94
|
+
console.log("'volute service uninstall' has been replaced by 'volute setup'.");
|
|
95
|
+
console.log("To uninstall the service, remove the service file manually:");
|
|
96
|
+
if (process.platform === "darwin") {
|
|
97
|
+
console.log(" launchctl unload ~/Library/LaunchAgents/com.volute.daemon.plist");
|
|
98
|
+
console.log(" rm ~/Library/LaunchAgents/com.volute.daemon.plist");
|
|
99
|
+
} else {
|
|
100
|
+
console.log(" systemctl --user disable --now volute");
|
|
101
|
+
console.log(" rm ~/.config/systemd/user/volute.service");
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
case "status":
|
|
105
|
+
await status();
|
|
106
|
+
break;
|
|
107
|
+
default:
|
|
108
|
+
console.log(`Usage:
|
|
109
|
+
volute service status Check service status
|
|
110
|
+
|
|
111
|
+
Note: 'volute service install' and 'volute service uninstall' have been
|
|
112
|
+
replaced by 'volute setup'. Run 'volute setup' to configure your installation.`);
|
|
113
|
+
if (subcommand && subcommand !== "--help") {
|
|
114
|
+
console.error(`
|
|
115
|
+
Unknown subcommand: ${subcommand}`);
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export {
|
|
121
|
+
run
|
|
122
|
+
};
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
LAUNCHD_PLIST_LABEL,
|
|
4
|
+
LAUNCHD_PLIST_PATH,
|
|
5
|
+
SYSTEM_LAUNCHD_PLIST_PATH,
|
|
6
|
+
SYSTEM_SERVICE_PATH,
|
|
7
|
+
USER_SYSTEMD_UNIT
|
|
8
|
+
} from "./chunk-V63B7DX3.js";
|
|
9
|
+
import {
|
|
10
|
+
promptLine
|
|
11
|
+
} from "./chunk-SSI47XP2.js";
|
|
12
|
+
import {
|
|
13
|
+
resolveVoluteBin
|
|
14
|
+
} from "./chunk-YJA7P64S.js";
|
|
15
|
+
import {
|
|
16
|
+
ensureVoluteGroup
|
|
17
|
+
} from "./chunk-XOXLRRR2.js";
|
|
18
|
+
import {
|
|
19
|
+
parseArgs
|
|
20
|
+
} from "./chunk-D424ZQGI.js";
|
|
21
|
+
import {
|
|
22
|
+
readGlobalConfig,
|
|
23
|
+
writeGlobalConfig
|
|
24
|
+
} from "./chunk-TZKJLDQN.js";
|
|
25
|
+
import "./chunk-B2CPS4QU.js";
|
|
26
|
+
import "./chunk-K3NQKI34.js";
|
|
27
|
+
|
|
28
|
+
// src/commands/setup.ts
|
|
29
|
+
import { execFile, execFileSync } from "child_process";
|
|
30
|
+
import { mkdirSync, writeFileSync } from "fs";
|
|
31
|
+
import { homedir } from "os";
|
|
32
|
+
import { dirname, resolve } from "path";
|
|
33
|
+
import { promisify } from "util";
|
|
34
|
+
var execFileAsync = promisify(execFile);
|
|
35
|
+
var HOST_RE = /^[a-zA-Z0-9.:_-]+$/;
|
|
36
|
+
function validateHost(host) {
|
|
37
|
+
if (!HOST_RE.test(host)) {
|
|
38
|
+
throw new Error(`Invalid host: ${host}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function escapeXml(s) {
|
|
42
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
43
|
+
}
|
|
44
|
+
function generatePlist(voluteBin, opts) {
|
|
45
|
+
const args = ["up", "--foreground"];
|
|
46
|
+
if (opts.port != null) args.push("--port", String(opts.port));
|
|
47
|
+
if (opts.host) args.push("--host", opts.host);
|
|
48
|
+
const logPath = opts.system ? "/var/lib/volute/daemon.log" : resolve(homedir(), ".volute", "daemon.log");
|
|
49
|
+
const envEntries = [];
|
|
50
|
+
if (opts.system) {
|
|
51
|
+
envEntries.push(
|
|
52
|
+
" <key>EnvironmentVariables</key>",
|
|
53
|
+
" <dict>",
|
|
54
|
+
" <key>VOLUTE_HOME</key>",
|
|
55
|
+
" <string>/var/lib/volute</string>",
|
|
56
|
+
" <key>VOLUTE_MINDS_DIR</key>",
|
|
57
|
+
" <string>/minds</string>",
|
|
58
|
+
" <key>VOLUTE_ISOLATION</key>",
|
|
59
|
+
" <string>user</string>",
|
|
60
|
+
" </dict>"
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
64
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
65
|
+
<plist version="1.0">
|
|
66
|
+
<dict>
|
|
67
|
+
<key>Label</key>
|
|
68
|
+
<string>${LAUNCHD_PLIST_LABEL}</string>
|
|
69
|
+
<key>ProgramArguments</key>
|
|
70
|
+
<array>
|
|
71
|
+
${[voluteBin, ...args].map((a) => `<string>${escapeXml(a)}</string>`).join("\n ")}
|
|
72
|
+
</array>
|
|
73
|
+
${envEntries.length > 0 ? envEntries.join("\n") + "\n" : ""} <key>RunAtLoad</key>
|
|
74
|
+
<true/>
|
|
75
|
+
<key>KeepAlive</key>
|
|
76
|
+
<true/>
|
|
77
|
+
<key>StandardOutPath</key>
|
|
78
|
+
<string>${logPath}</string>
|
|
79
|
+
<key>StandardErrorPath</key>
|
|
80
|
+
<string>${logPath}</string>
|
|
81
|
+
</dict>
|
|
82
|
+
</plist>`;
|
|
83
|
+
}
|
|
84
|
+
function generateUserUnit(voluteBin, port, host) {
|
|
85
|
+
const args = ["up", "--foreground"];
|
|
86
|
+
if (port != null) args.push("--port", String(port));
|
|
87
|
+
if (host) args.push("--host", host);
|
|
88
|
+
return `[Unit]
|
|
89
|
+
Description=Volute Daemon
|
|
90
|
+
After=network.target
|
|
91
|
+
|
|
92
|
+
[Service]
|
|
93
|
+
Type=exec
|
|
94
|
+
ExecStart=${voluteBin} ${args.join(" ")}
|
|
95
|
+
Restart=on-failure
|
|
96
|
+
RestartSec=5
|
|
97
|
+
|
|
98
|
+
[Install]
|
|
99
|
+
WantedBy=default.target
|
|
100
|
+
`;
|
|
101
|
+
}
|
|
102
|
+
function buildServicePath(voluteBin) {
|
|
103
|
+
const binDir = dirname(voluteBin);
|
|
104
|
+
const standardPaths = [
|
|
105
|
+
"/usr/local/sbin",
|
|
106
|
+
"/usr/local/bin",
|
|
107
|
+
"/usr/sbin",
|
|
108
|
+
"/usr/bin",
|
|
109
|
+
"/sbin",
|
|
110
|
+
"/bin"
|
|
111
|
+
];
|
|
112
|
+
const parts = standardPaths.includes(binDir) ? standardPaths : [binDir, ...standardPaths];
|
|
113
|
+
return parts.join(":");
|
|
114
|
+
}
|
|
115
|
+
function generateSystemUnit(voluteBin, port, host) {
|
|
116
|
+
const args = ["up", "--foreground"];
|
|
117
|
+
if (port != null) args.push("--port", String(port));
|
|
118
|
+
if (host) args.push("--host", host);
|
|
119
|
+
const home = homedir();
|
|
120
|
+
const binUnderHome = voluteBin.startsWith(`${home}/`);
|
|
121
|
+
const lines = [
|
|
122
|
+
"[Unit]",
|
|
123
|
+
"Description=Volute Mind Manager",
|
|
124
|
+
"After=network.target",
|
|
125
|
+
"",
|
|
126
|
+
"[Service]",
|
|
127
|
+
"Type=exec",
|
|
128
|
+
`ExecStart=${voluteBin} ${args.join(" ")}`,
|
|
129
|
+
`Environment=PATH=${buildServicePath(voluteBin)}`,
|
|
130
|
+
"Environment=VOLUTE_HOME=/var/lib/volute",
|
|
131
|
+
"Environment=VOLUTE_MINDS_DIR=/minds",
|
|
132
|
+
"Environment=VOLUTE_ISOLATION=user",
|
|
133
|
+
"Restart=on-failure",
|
|
134
|
+
"RestartSec=5",
|
|
135
|
+
"ProtectSystem=true",
|
|
136
|
+
"ReadWritePaths=/var/lib/volute /minds",
|
|
137
|
+
"PrivateTmp=yes"
|
|
138
|
+
];
|
|
139
|
+
if (!binUnderHome) {
|
|
140
|
+
lines.push("ProtectHome=yes");
|
|
141
|
+
}
|
|
142
|
+
lines.push("RestrictSUIDSGID=yes", "", "[Install]", "WantedBy=multi-user.target", "");
|
|
143
|
+
return lines.join("\n");
|
|
144
|
+
}
|
|
145
|
+
var DATA_DIR = "/var/lib/volute";
|
|
146
|
+
var MINDS_DIR = "/minds";
|
|
147
|
+
var PROFILE_PATH = "/etc/profile.d/volute.sh";
|
|
148
|
+
var WRAPPER_PATH = "/usr/local/bin/volute";
|
|
149
|
+
async function installUserService(voluteBin, port, host) {
|
|
150
|
+
const platform = process.platform;
|
|
151
|
+
try {
|
|
152
|
+
if (platform === "darwin") {
|
|
153
|
+
mkdirSync(resolve(homedir(), "Library", "LaunchAgents"), { recursive: true });
|
|
154
|
+
writeFileSync(LAUNCHD_PLIST_PATH, generatePlist(voluteBin, { port, host }));
|
|
155
|
+
console.log(` Wrote ${LAUNCHD_PLIST_PATH}`);
|
|
156
|
+
await execFileAsync("launchctl", ["load", LAUNCHD_PLIST_PATH]);
|
|
157
|
+
console.log(" Service installed (launchd)");
|
|
158
|
+
return true;
|
|
159
|
+
} else if (platform === "linux") {
|
|
160
|
+
mkdirSync(resolve(homedir(), ".config", "systemd", "user"), { recursive: true });
|
|
161
|
+
writeFileSync(USER_SYSTEMD_UNIT, generateUserUnit(voluteBin, port, host));
|
|
162
|
+
console.log(` Wrote ${USER_SYSTEMD_UNIT}`);
|
|
163
|
+
await execFileAsync("systemctl", ["--user", "enable", "--now", "volute"]);
|
|
164
|
+
console.log(" Service installed (systemd user)");
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
} catch (err) {
|
|
168
|
+
console.warn(
|
|
169
|
+
` Warning: failed to install service: ${err instanceof Error ? err.message : err}`
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
function installSystemService(voluteBin, port, host) {
|
|
175
|
+
const platform = process.platform;
|
|
176
|
+
if (platform === "darwin") {
|
|
177
|
+
writeFileSync(
|
|
178
|
+
SYSTEM_LAUNCHD_PLIST_PATH,
|
|
179
|
+
generatePlist(voluteBin, { port, host: host ?? "0.0.0.0", system: true })
|
|
180
|
+
);
|
|
181
|
+
console.log(` Wrote ${SYSTEM_LAUNCHD_PLIST_PATH}`);
|
|
182
|
+
try {
|
|
183
|
+
execFileSync("launchctl", ["load", SYSTEM_LAUNCHD_PLIST_PATH]);
|
|
184
|
+
console.log(" Service installed (LaunchDaemon)");
|
|
185
|
+
return true;
|
|
186
|
+
} catch (err) {
|
|
187
|
+
console.warn(
|
|
188
|
+
` Warning: failed to load LaunchDaemon: ${err instanceof Error ? err.message : err}`
|
|
189
|
+
);
|
|
190
|
+
console.warn(" Try: sudo launchctl load /Library/LaunchDaemons/com.volute.daemon.plist");
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
} else if (platform === "linux") {
|
|
194
|
+
writeFileSync(SYSTEM_SERVICE_PATH, generateSystemUnit(voluteBin, port, host ?? "0.0.0.0"));
|
|
195
|
+
console.log(` Wrote ${SYSTEM_SERVICE_PATH}`);
|
|
196
|
+
try {
|
|
197
|
+
execFileSync("systemctl", ["daemon-reload"]);
|
|
198
|
+
execFileSync("systemctl", ["enable", "--now", "volute"]);
|
|
199
|
+
console.log(" Service installed (systemd)");
|
|
200
|
+
return true;
|
|
201
|
+
} catch (err) {
|
|
202
|
+
console.warn(
|
|
203
|
+
` Warning: failed to enable service: ${err instanceof Error ? err.message : err}`
|
|
204
|
+
);
|
|
205
|
+
console.warn(" Try: systemctl daemon-reload && systemctl enable --now volute");
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
function setupSystemDirectories() {
|
|
212
|
+
mkdirSync(DATA_DIR, { recursive: true });
|
|
213
|
+
console.log(` Created ${DATA_DIR}`);
|
|
214
|
+
mkdirSync(MINDS_DIR, { recursive: true });
|
|
215
|
+
console.log(` Created ${MINDS_DIR}`);
|
|
216
|
+
execFileSync("chmod", ["755", DATA_DIR]);
|
|
217
|
+
execFileSync("chmod", ["755", MINDS_DIR]);
|
|
218
|
+
}
|
|
219
|
+
function setupSystemGitIdentity() {
|
|
220
|
+
try {
|
|
221
|
+
execFileSync("git", ["config", "--system", "user.name"]);
|
|
222
|
+
console.log(" System git identity already configured");
|
|
223
|
+
} catch {
|
|
224
|
+
try {
|
|
225
|
+
execFileSync("git", ["config", "--system", "user.name", "Volute"]);
|
|
226
|
+
execFileSync("git", ["config", "--system", "user.email", "volute@localhost"]);
|
|
227
|
+
console.log(" Configured system git identity");
|
|
228
|
+
} catch (err) {
|
|
229
|
+
console.warn(
|
|
230
|
+
` Warning: failed to set system git config: ${err instanceof Error ? err.message : err}`
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function setupSystemWrapper(voluteBin) {
|
|
236
|
+
const binDir = dirname(voluteBin);
|
|
237
|
+
if (voluteBin !== WRAPPER_PATH && !voluteBin.startsWith("/usr/bin")) {
|
|
238
|
+
const wrapper = `#!/bin/sh
|
|
239
|
+
export PATH="${binDir}:$PATH"
|
|
240
|
+
export VOLUTE_HOME="${DATA_DIR}"
|
|
241
|
+
export VOLUTE_MINDS_DIR="${MINDS_DIR}"
|
|
242
|
+
exec "${voluteBin}" "$@"
|
|
243
|
+
`;
|
|
244
|
+
writeFileSync(WRAPPER_PATH, wrapper, { mode: 493 });
|
|
245
|
+
console.log(` Wrote ${WRAPPER_PATH}`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function setupSystemEnvProfile() {
|
|
249
|
+
if (process.platform === "linux") {
|
|
250
|
+
writeFileSync(
|
|
251
|
+
PROFILE_PATH,
|
|
252
|
+
`export VOLUTE_HOME=${DATA_DIR}
|
|
253
|
+
export VOLUTE_MINDS_DIR=${MINDS_DIR}
|
|
254
|
+
`
|
|
255
|
+
);
|
|
256
|
+
console.log(` Wrote ${PROFILE_PATH}`);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
async function run(args) {
|
|
260
|
+
const { flags } = parseArgs(args, {
|
|
261
|
+
name: { type: "string" },
|
|
262
|
+
system: { type: "boolean" },
|
|
263
|
+
service: { type: "boolean" },
|
|
264
|
+
dir: { type: "string" },
|
|
265
|
+
port: { type: "number" },
|
|
266
|
+
host: { type: "string" }
|
|
267
|
+
});
|
|
268
|
+
const isInteractive = !flags.name && process.stdin.isTTY;
|
|
269
|
+
let systemName;
|
|
270
|
+
let setupType;
|
|
271
|
+
let wantService;
|
|
272
|
+
const port = flags.port;
|
|
273
|
+
const host = flags.host;
|
|
274
|
+
if (isInteractive) {
|
|
275
|
+
console.log("Welcome to Volute!\n");
|
|
276
|
+
systemName = await promptLine("System name: ");
|
|
277
|
+
if (!systemName.trim()) {
|
|
278
|
+
console.error("System name is required.");
|
|
279
|
+
process.exit(1);
|
|
280
|
+
}
|
|
281
|
+
systemName = systemName.trim();
|
|
282
|
+
console.log("\nInstall type:");
|
|
283
|
+
console.log(" 1. Local (minds in ~/.volute/minds/, sandbox isolation)");
|
|
284
|
+
console.log(" 2. System (minds in /minds, per-user isolation, requires sudo)");
|
|
285
|
+
const typeChoice = await promptLine("> ");
|
|
286
|
+
setupType = typeChoice.trim() === "2" ? "system" : "local";
|
|
287
|
+
if (setupType === "system" && process.getuid?.() !== 0) {
|
|
288
|
+
console.error("\nSystem install requires root. Re-run with sudo.");
|
|
289
|
+
process.exit(1);
|
|
290
|
+
}
|
|
291
|
+
const serviceDefault = setupType === "system" ? "Y/n" : "y/N";
|
|
292
|
+
const servicePrompt = `
|
|
293
|
+
Install as a service (auto-start on boot)? [${serviceDefault}]: `;
|
|
294
|
+
const serviceAnswer = (await promptLine(servicePrompt)).trim().toLowerCase();
|
|
295
|
+
if (setupType === "system") {
|
|
296
|
+
wantService = serviceAnswer !== "n";
|
|
297
|
+
} else {
|
|
298
|
+
wantService = serviceAnswer === "y" || serviceAnswer === "yes";
|
|
299
|
+
}
|
|
300
|
+
} else {
|
|
301
|
+
if (!flags.name) {
|
|
302
|
+
console.error("Error: --name is required in non-interactive mode.");
|
|
303
|
+
console.error("Usage: volute setup --name <name> [--system] [--service] [--dir <path>]");
|
|
304
|
+
process.exit(1);
|
|
305
|
+
}
|
|
306
|
+
systemName = flags.name;
|
|
307
|
+
setupType = flags.system ? "system" : "local";
|
|
308
|
+
wantService = flags.service ?? setupType === "system";
|
|
309
|
+
if (setupType === "system" && process.getuid?.() !== 0) {
|
|
310
|
+
console.error("Error: system install requires root (use sudo).");
|
|
311
|
+
process.exit(1);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (host) validateHost(host);
|
|
315
|
+
console.log("\nSetting up...");
|
|
316
|
+
let isolation;
|
|
317
|
+
let mindsDir;
|
|
318
|
+
let configHome;
|
|
319
|
+
if (setupType === "system") {
|
|
320
|
+
configHome = DATA_DIR;
|
|
321
|
+
mindsDir = MINDS_DIR;
|
|
322
|
+
isolation = "user";
|
|
323
|
+
process.env.VOLUTE_HOME = DATA_DIR;
|
|
324
|
+
process.env.VOLUTE_MINDS_DIR = MINDS_DIR;
|
|
325
|
+
setupSystemDirectories();
|
|
326
|
+
ensureVoluteGroup({ force: true });
|
|
327
|
+
console.log(" Ensured volute group exists");
|
|
328
|
+
setupSystemGitIdentity();
|
|
329
|
+
const voluteBin = resolveVoluteBin();
|
|
330
|
+
setupSystemWrapper(voluteBin);
|
|
331
|
+
setupSystemEnvProfile();
|
|
332
|
+
if (wantService) {
|
|
333
|
+
if (!installSystemService(voluteBin, port, host)) wantService = false;
|
|
334
|
+
}
|
|
335
|
+
} else {
|
|
336
|
+
configHome = flags.dir ? resolve(flags.dir) : resolve(homedir(), ".volute");
|
|
337
|
+
if (flags.dir) {
|
|
338
|
+
process.env.VOLUTE_HOME = configHome;
|
|
339
|
+
}
|
|
340
|
+
mindsDir = resolve(configHome, "minds");
|
|
341
|
+
isolation = "sandbox";
|
|
342
|
+
mkdirSync(configHome, { recursive: true });
|
|
343
|
+
console.log(` Created ${configHome}`);
|
|
344
|
+
mkdirSync(mindsDir, { recursive: true });
|
|
345
|
+
console.log(" Sandbox enabled for mind isolation");
|
|
346
|
+
if (wantService) {
|
|
347
|
+
const voluteBin = resolveVoluteBin();
|
|
348
|
+
if (!await installUserService(voluteBin, port, host)) wantService = false;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
const existingConfig = readGlobalConfig();
|
|
352
|
+
const setup = {
|
|
353
|
+
type: setupType,
|
|
354
|
+
mindsDir,
|
|
355
|
+
isolation,
|
|
356
|
+
service: wantService
|
|
357
|
+
};
|
|
358
|
+
const config = {
|
|
359
|
+
...existingConfig,
|
|
360
|
+
name: systemName,
|
|
361
|
+
setup
|
|
362
|
+
};
|
|
363
|
+
if (port != null) config.port = port;
|
|
364
|
+
if (host) config.hostname = host;
|
|
365
|
+
writeGlobalConfig(config);
|
|
366
|
+
console.log(`
|
|
367
|
+
Done! Use \`volute mind create <name>\` to create your first mind.`);
|
|
368
|
+
}
|
|
369
|
+
export {
|
|
370
|
+
run
|
|
371
|
+
};
|