volute 0.25.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/README.md +28 -33
  2. package/dist/{activity-events-4O37J7PD.js → activity-events-BBIEA2F4.js} +2 -3
  3. package/dist/api.d.ts +886 -220
  4. package/dist/{archive-4ZQYK5MN.js → archive-UA4BDFXQ.js} +2 -2
  5. package/dist/{auth-HM2RSPY7.js → auth-D3OT2ARB.js} +3 -3
  6. package/dist/bridge-FQHZL3MC.js +206 -0
  7. package/dist/chat-MHJ3L6JQ.js +58 -0
  8. package/dist/{chunk-PHU4DEAJ.js → chunk-2WPW7OT6.js} +3 -3
  9. package/dist/{chunk-BOTQ25QT.js → chunk-2YP2TVDT.js} +138 -56
  10. package/dist/{chunk-DG7TO7EE.js → chunk-4WXYUOAK.js} +5 -7
  11. package/dist/{chunk-JTDFJWI2.js → chunk-AW7PFDVN.js} +5 -5
  12. package/dist/{chunk-2767L2RZ.js → chunk-EHYDTZTF.js} +6 -6
  13. package/dist/{chunk-ZSH4G2P5.js → chunk-GIE6CSN5.js} +17 -17
  14. package/dist/chunk-H7OZRFJB.js +432 -0
  15. package/dist/{chunk-ON3FF5JA.js → chunk-HDN7MNGD.js} +3 -3
  16. package/dist/chunk-IAYBDWVG.js +477 -0
  17. package/dist/chunk-IKRVFPWU.js +83 -0
  18. package/dist/{chunk-TRQEV3CD.js → chunk-JGFVMROS.js} +32 -6
  19. package/dist/{chunk-PHHKNGA3.js → chunk-JKOWNZ4P.js} +3 -3
  20. package/dist/{chunk-E7GOKNOT.js → chunk-K5NAC55T.js} +1 -1
  21. package/dist/{chunk-HFCBO2GL.js → chunk-KDGS53OS.js} +4 -4
  22. package/dist/chunk-KTLFDYPT.js +61 -0
  23. package/dist/{chunk-3AIBT4TW.js → chunk-LAC664WU.js} +30 -4
  24. package/dist/{chunk-PMX4EIJK.js → chunk-OQZH4PBB.js} +467 -1054
  25. package/dist/{chunk-SHSWYG2J.js → chunk-PHSAT7YL.js} +71 -58
  26. package/dist/chunk-RKQEHRBB.js +177 -0
  27. package/dist/{chunk-RVKR2R7F.js → chunk-SSI47XP2.js} +10 -2
  28. package/dist/chunk-T6HKBWXZ.js +23 -0
  29. package/dist/chunk-USUXRNVD.js +113 -0
  30. package/dist/{chunk-BFK6SOEJ.js → chunk-VIVMW2H2.js} +4 -4
  31. package/dist/{chunk-KTJGZ7M7.js → chunk-XBLSAVJF.js} +1 -1
  32. package/dist/chunk-ZYGKG6VC.js +22 -0
  33. package/dist/cli.js +51 -32
  34. package/dist/{cloud-sync-PPBBJDY6.js → cloud-sync-T7M3ESC3.js} +15 -12
  35. package/dist/connectors/discord-bridge.js +158 -0
  36. package/dist/connectors/slack-bridge.js +119 -0
  37. package/dist/connectors/telegram-bridge.js +133 -0
  38. package/dist/conversations-M2K4253F.js +55 -0
  39. package/dist/create-D7J73A6H.js +45 -0
  40. package/dist/{create-VDQJER52.js → create-QWV73WXD.js} +1 -1
  41. package/dist/{daemon-client-JOVQZ52X.js → daemon-client-I42FK2BF.js} +2 -2
  42. package/dist/{daemon-restart-FDNOZEAD.js → daemon-restart-M2QTYMEG.js} +7 -6
  43. package/dist/daemon.js +2247 -1085
  44. package/dist/db-IC4J52XQ.js +8 -0
  45. package/dist/{delete-2MRR4JX5.js → delete-4JYGD4VN.js} +1 -1
  46. package/dist/down-LVBXEULC.js +14 -0
  47. package/dist/{env-2FPOZK37.js → env-YJMUMFIY.js} +5 -5
  48. package/dist/{export-IKFAPRAO.js → export-BOJQWBMA.js} +4 -4
  49. package/dist/{file-KT3UIQM3.js → file-CR36YUPD.js} +4 -4
  50. package/dist/{history-46WZN5CN.js → history-XKRTAFS2.js} +7 -7
  51. package/dist/{import-TH26J76F.js → import-SRTQXBGH.js} +4 -4
  52. package/dist/join-J4QU42DL.js +66 -0
  53. package/dist/list-R73GENNL.js +40 -0
  54. package/dist/{log-6SGSSR3D.js → log-ABYNVYJ3.js} +4 -4
  55. package/dist/login-3QZNR2DF.js +46 -0
  56. package/dist/{login-UO6AOVEA.js → login-XX37I52P.js} +3 -3
  57. package/dist/logout-T53VKCPU.js +39 -0
  58. package/dist/{logout-UKD5LA37.js → logout-W4KOOBIT.js} +2 -2
  59. package/dist/{logs-HRBONI5I.js → logs-U35JR2KE.js} +7 -7
  60. package/dist/{merge-KSFJKX6T.js → merge-LNSMSAOF.js} +4 -4
  61. package/dist/message-delivery-LDXLGERA.js +25 -0
  62. package/dist/migrate-registry-to-db-XC7T5B7P.js +110 -0
  63. package/dist/{mind-YVWAHL2A.js → mind-DI33C74K.js} +25 -25
  64. package/dist/{mind-activity-tracker-NMDDEV3K.js → mind-activity-tracker-EN6XNXPF.js} +3 -4
  65. package/dist/{mind-manager-4NDNAYAB.js → mind-manager-M6EMUW5I.js} +6 -5
  66. package/dist/{mind-sleep-GHPTSAYN.js → mind-sleep-BTSWQNAC.js} +4 -4
  67. package/dist/{mind-wake-BJDJFMDF.js → mind-wake-SBAKIDVP.js} +4 -4
  68. package/dist/notes-XCER3I7M.js +220 -0
  69. package/dist/{package-3HF5MXU2.js → package-7WY6VKU3.js} +2 -1
  70. package/dist/{pages-Y6DRWUOJ.js → pages-6EBS6CBR.js} +2 -2
  71. package/dist/{publish-EEKTZBHW.js → publish-66UB2ZFY.js} +5 -5
  72. package/dist/{pull-D32SPFVU.js → pull-XCHJTM5M.js} +4 -4
  73. package/dist/read-36UFXN3G.js +46 -0
  74. package/dist/{register-U2UO6TC4.js → register-6B2CXTYM.js} +3 -3
  75. package/dist/{registry-D2BSQ2X5.js → registry-NDNOOYG4.js} +15 -9
  76. package/dist/{restart-5BMNV7KU.js → restart-6ESL3NBO.js} +6 -6
  77. package/dist/sandbox-TGBX22DS.js +19 -0
  78. package/dist/{schedule-YEFDLVMJ.js → schedule-QTJMFATP.js} +7 -7
  79. package/dist/{seed-6FEKB3YC.js → seed-SSUCYYDF.js} +2 -2
  80. package/dist/{send-IISDYFCL.js → send-ZNCJDSRP.js} +28 -36
  81. package/dist/service-6LIN3F3K.js +122 -0
  82. package/dist/setup-JG4QAEBV.js +371 -0
  83. package/dist/setup-JHL5ZEST.js +17 -0
  84. package/dist/{shared-LWMNTTZN.js → shared-ML5I4Q2A.js} +4 -4
  85. package/dist/{skill-T3EMR6IR.js → skill-AUAQTSP5.js} +7 -7
  86. package/dist/skills/dreaming/SKILL.md +68 -0
  87. package/dist/skills/dreaming/references/INSTALL.md +56 -0
  88. package/dist/skills/dreaming/scripts/dream.ts +289 -0
  89. package/dist/skills/dreaming/scripts/wake-context-dreams.sh +30 -0
  90. package/dist/skills/notes/SKILL.md +34 -0
  91. package/dist/skills/orientation/SKILL.md +3 -3
  92. package/dist/skills/volute-mind/SKILL.md +32 -30
  93. package/dist/sleep-manager-MWYHM5HV.js +29 -0
  94. package/dist/split-TKJ5OT3P.js +63 -0
  95. package/dist/{sprout-QJVGJDSH.js → sprout-IJVVKSJ2.js} +6 -7
  96. package/dist/{start-C7XITZ5O.js → start-EUJSS5R4.js} +4 -4
  97. package/dist/{status-SIRPLEZC.js → status-77YEPHMW.js} +5 -5
  98. package/dist/{status-LYS4NUOZ.js → status-7GA4SM4Y.js} +4 -4
  99. package/dist/{status-LV34BG6G.js → status-THLOBLWG.js} +2 -2
  100. package/dist/{stop-CVKBSLXY.js → stop-3XAITBBF.js} +6 -6
  101. package/dist/{tailscale-AJ4VL5XK.js → tailscale-NY5MUMY3.js} +1 -1
  102. package/dist/up-NKSMXBWR.js +17 -0
  103. package/dist/{update-7XCZMYBT.js → update-PTSH22AZ.js} +11 -11
  104. package/dist/{update-check-F5Z3ALXX.js → update-check-64FWC4Y2.js} +2 -2
  105. package/dist/{upgrade-7RUIXGOO.js → upgrade-HA47CS4C.js} +12 -5
  106. package/dist/variant-7TGZHOU3.js +41 -0
  107. package/dist/{version-notify-AZQMC32A.js → version-notify-5Z4MNR6M.js} +26 -28
  108. package/dist/web-assets/assets/index-CI5wgghI.css +1 -0
  109. package/dist/web-assets/assets/index-is5CvJWH.js +75 -0
  110. package/dist/web-assets/favicon.png +0 -0
  111. package/dist/web-assets/index.html +2 -2
  112. package/drizzle/0015_notes.sql +23 -0
  113. package/drizzle/0016_note_reactions_and_replies.sql +15 -0
  114. package/drizzle/0017_minds.sql +16 -0
  115. package/drizzle/meta/_journal.json +21 -0
  116. package/package.json +2 -1
  117. package/templates/_base/.init/.config/hooks/wake-context.sh +7 -0
  118. package/templates/_base/.init/.config/prompts.json +2 -2
  119. package/templates/_base/home/VOLUTE.md +5 -5
  120. package/templates/_base/src/lib/startup.ts +10 -2
  121. package/templates/claude/src/agent.ts +51 -1
  122. package/templates/claude/src/server.ts +1 -0
  123. package/templates/pi/package.json.tmpl +1 -0
  124. package/templates/pi/src/agent.ts +48 -1
  125. package/templates/pi/src/lib/subagents.ts +150 -0
  126. package/templates/pi/src/server.ts +1 -0
  127. package/dist/channel-HZOSHGNF.js +0 -260
  128. package/dist/chunk-33XAVCS4.js +0 -203
  129. package/dist/chunk-B2CPS4QU.js +0 -283
  130. package/dist/chunk-NWPT4ASZ.js +0 -89
  131. package/dist/chunk-SIAG3QMM.js +0 -42
  132. package/dist/chunk-WSLPZF72.js +0 -173
  133. package/dist/connector-M6XFI6GM.js +0 -147
  134. package/dist/connectors/discord.js +0 -177
  135. package/dist/connectors/slack.js +0 -181
  136. package/dist/connectors/telegram.js +0 -187
  137. package/dist/down-674SX2IZ.js +0 -14
  138. package/dist/message-delivery-XMGV3FUM.js +0 -23
  139. package/dist/service-FASYWLTC.js +0 -247
  140. package/dist/setup-BMLM2UTK.js +0 -230
  141. package/dist/sleep-manager-RKTFZPD3.js +0 -27
  142. package/dist/up-CJ26KQLN.js +0 -15
  143. package/dist/variant-UGREB4G5.js +0 -207
  144. package/dist/web-assets/assets/index-CGPSVu19.js +0 -69
  145. package/dist/web-assets/assets/index-V_rNDsM8.css +0 -1
@@ -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-JOVQZ52X.js");
24
+ const { daemonFetch } = await import("./daemon-client-I42FK2BF.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()), {
@@ -64,7 +64,7 @@ async function run(args) {
64
64
  Seeded mind: ${name} (port ${createData.port})`);
65
65
  console.log(`
66
66
  Talk to your new mind:`);
67
- console.log(` volute send @${name} "hello"`);
67
+ console.log(` volute chat send @${name} "hello"`);
68
68
  }
69
69
  export {
70
70
  run
@@ -1,20 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- getClient,
4
- urlOf
5
- } from "./chunk-4RQBJWQX.js";
3
+ readStdin
4
+ } from "./chunk-ZYGKG6VC.js";
6
5
  import {
7
6
  resolveMindName
8
7
  } from "./chunk-NAOW2CLO.js";
9
- import {
10
- parseArgs
11
- } from "./chunk-D424ZQGI.js";
12
8
  import {
13
9
  daemonFetch
14
- } from "./chunk-TRQEV3CD.js";
10
+ } from "./chunk-JGFVMROS.js";
11
+ import {
12
+ getClient,
13
+ urlOf
14
+ } from "./chunk-4RQBJWQX.js";
15
15
  import {
16
- findMind
17
- } from "./chunk-B2CPS4QU.js";
16
+ parseArgs
17
+ } from "./chunk-D424ZQGI.js";
18
+ import "./chunk-H7OZRFJB.js";
18
19
  import "./chunk-K3NQKI34.js";
19
20
 
20
21
  // src/commands/send.ts
@@ -51,24 +52,15 @@ function parseTarget(target) {
51
52
  };
52
53
  }
53
54
 
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 = [];
55
+ // src/commands/send.ts
56
+ async function isMind(name) {
59
57
  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);
58
+ const res = await daemonFetch(`/api/minds/${encodeURIComponent(name)}`);
59
+ return res.ok;
60
+ } catch {
61
+ return false;
66
62
  }
67
- const text = Buffer.concat(chunks).toString().replace(/\r?\n$/, "");
68
- return text || void 0;
69
63
  }
70
-
71
- // src/commands/send.ts
72
64
  var IMAGE_MEDIA_TYPES = {
73
65
  ".png": "image/png",
74
66
  ".jpg": "image/jpeg",
@@ -170,28 +162,28 @@ async function run(args) {
170
162
  const images = flags.image ? [loadImage(flags.image)] : void 0;
171
163
  if (!target || !message && !images) {
172
164
  console.error(
173
- 'Usage: volute send <target> "<message>" [--mind <name>] [--image <path>] [--wait]'
165
+ 'Usage: volute chat send <target> "<message>" [--mind <name>] [--image <path>] [--wait]'
174
166
  );
175
- console.error(' echo "message" | volute send <target> [--mind <name>]');
167
+ console.error(' echo "message" | volute chat send <target> [--mind <name>]');
176
168
  console.error("");
177
169
  console.error("Examples:");
178
- console.error(' volute send @other-mind "hello"');
179
- console.error(' volute send animal-chat "hello everyone"');
180
- console.error(' volute send discord:server/channel "hello"');
181
- console.error(' volute send @mind "check this out" --image photo.png');
182
- console.error(" volute send @mind --image photo.png");
183
- console.error(' volute send @mind "hello" --wait');
170
+ console.error(' volute chat send @other-mind "hello"');
171
+ console.error(' volute chat send animal-chat "hello everyone"');
172
+ console.error(' volute chat send discord:server/channel "hello"');
173
+ console.error(' volute chat send @mind "check this out" --image photo.png');
174
+ console.error(" volute chat send @mind --image photo.png");
175
+ console.error(' volute chat send @mind "hello" --wait');
184
176
  process.exit(1);
185
177
  }
186
178
  if (target === "system" || target === "@system") {
187
179
  console.error(
188
180
  `Can't send to system \u2014 system messages are automated.
189
- To reply to a person, use their username from the message prefix (e.g. volute send @username "msg").`
181
+ To reply to a person, use their username from the message prefix (e.g. volute chat send @username "msg").`
190
182
  );
191
183
  process.exit(1);
192
184
  }
193
185
  let parsed = parseTarget(target);
194
- if (!parsed.isDM && parsed.platform === "volute" && findMind(parsed.identifier)) {
186
+ if (!parsed.isDM && parsed.platform === "volute" && await isMind(parsed.identifier)) {
195
187
  parsed = {
196
188
  platform: "volute",
197
189
  identifier: `@${parsed.identifier}`,
@@ -206,8 +198,8 @@ To reply to a person, use their username from the message prefix (e.g. volute se
206
198
  const targetName = parsed.identifier.slice(1);
207
199
  const mindSelf = process.env.VOLUTE_MIND;
208
200
  const sender = flags.sender || mindSelf || userInfo().username;
209
- waitMindName = findMind(targetName) ? targetName : void 0;
210
- const targetIsMind = !!findMind(targetName);
201
+ const targetIsMind = await isMind(targetName);
202
+ waitMindName = targetIsMind ? targetName : void 0;
211
203
  const contextMind = mindSelf && !targetIsMind ? mindSelf : targetName;
212
204
  const participants = mindSelf && !targetIsMind ? [targetName] : [sender];
213
205
  const createRes = await daemonFetch(
@@ -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-LAC664WU.js";
9
+ import "./chunk-AW7PFDVN.js";
10
+ import "./chunk-RKQEHRBB.js";
11
+ import {
12
+ parseArgs
13
+ } from "./chunk-D424ZQGI.js";
14
+ import "./chunk-H7OZRFJB.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
+ promptLine
4
+ } from "./chunk-SSI47XP2.js";
5
+ import {
6
+ LAUNCHD_PLIST_LABEL,
7
+ LAUNCHD_PLIST_PATH,
8
+ SYSTEM_LAUNCHD_PLIST_PATH,
9
+ SYSTEM_SERVICE_PATH,
10
+ USER_SYSTEMD_UNIT
11
+ } from "./chunk-LAC664WU.js";
12
+ import {
13
+ resolveVoluteBin
14
+ } from "./chunk-AW7PFDVN.js";
15
+ import {
16
+ ensureVoluteGroup
17
+ } from "./chunk-RKQEHRBB.js";
18
+ import {
19
+ readGlobalConfig,
20
+ writeGlobalConfig
21
+ } from "./chunk-IKRVFPWU.js";
22
+ import {
23
+ parseArgs
24
+ } from "./chunk-D424ZQGI.js";
25
+ import "./chunk-H7OZRFJB.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, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
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/system/daemon.log" : resolve(homedir(), ".volute", "system", "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
+ };
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ configPath,
4
+ isSetupComplete,
5
+ migrateSetupConfig,
6
+ readGlobalConfig,
7
+ writeGlobalConfig
8
+ } from "./chunk-IKRVFPWU.js";
9
+ import "./chunk-H7OZRFJB.js";
10
+ import "./chunk-K3NQKI34.js";
11
+ export {
12
+ configPath,
13
+ isSetupComplete,
14
+ migrateSetupConfig,
15
+ readGlobalConfig,
16
+ writeGlobalConfig
17
+ };
@@ -6,16 +6,16 @@ async function run(args) {
6
6
  const subcommand = args[0];
7
7
  switch (subcommand) {
8
8
  case "merge":
9
- await import("./merge-KSFJKX6T.js").then((m) => m.run(args.slice(1)));
9
+ await import("./merge-LNSMSAOF.js").then((m) => m.run(args.slice(1)));
10
10
  break;
11
11
  case "pull":
12
- await import("./pull-D32SPFVU.js").then((m) => m.run(args.slice(1)));
12
+ await import("./pull-XCHJTM5M.js").then((m) => m.run(args.slice(1)));
13
13
  break;
14
14
  case "log":
15
- await import("./log-6SGSSR3D.js").then((m) => m.run(args.slice(1)));
15
+ await import("./log-ABYNVYJ3.js").then((m) => m.run(args.slice(1)));
16
16
  break;
17
17
  case "status":
18
- await import("./status-LYS4NUOZ.js").then((m) => m.run(args.slice(1)));
18
+ await import("./status-7GA4SM4Y.js").then((m) => m.run(args.slice(1)));
19
19
  break;
20
20
  case "--help":
21
21
  case "-h":
@@ -1,18 +1,18 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ resolveMindName
4
+ } from "./chunk-NAOW2CLO.js";
5
+ import {
6
+ daemonFetch
7
+ } from "./chunk-JGFVMROS.js";
2
8
  import {
3
9
  getClient,
4
10
  urlOf
5
11
  } from "./chunk-4RQBJWQX.js";
6
- import {
7
- resolveMindName
8
- } from "./chunk-NAOW2CLO.js";
9
12
  import {
10
13
  parseArgs
11
14
  } from "./chunk-D424ZQGI.js";
12
- import {
13
- daemonFetch
14
- } from "./chunk-TRQEV3CD.js";
15
- import "./chunk-B2CPS4QU.js";
15
+ import "./chunk-H7OZRFJB.js";
16
16
  import "./chunk-K3NQKI34.js";
17
17
 
18
18
  // src/commands/skill.ts