volute 0.21.0 → 0.22.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 (56) hide show
  1. package/dist/api.d.ts +4294 -0
  2. package/dist/chunk-G5KRTU2F.js +76 -0
  3. package/dist/{chunk-J5A3DF2U.js → chunk-JNFRY2WU.js} +1 -1
  4. package/dist/{chunk-IPJXU366.js → chunk-JTDFJWI2.js} +1 -0
  5. package/dist/chunk-OSFGKF2T.js +2651 -0
  6. package/dist/{chunk-L3LHXZD7.js → chunk-PHHKNGA3.js} +1 -1
  7. package/dist/{chunk-Q7AITQ44.js → chunk-QIXPN3OO.js} +1 -1
  8. package/dist/{chunk-PC6R6UUW.js → chunk-RK627D57.js} +36 -59
  9. package/dist/{chunk-5462YKWP.js → chunk-TFS25FIM.js} +1 -1
  10. package/dist/{chunk-7LPTHFIL.js → chunk-VNVCRVYI.js} +55 -5
  11. package/dist/{chunk-QUJUKM4U.js → chunk-VT5QODNE.js} +1 -1
  12. package/dist/chunk-XLC342FO.js +29 -0
  13. package/dist/cli.js +10 -10
  14. package/dist/cloud-sync-C6WRYRVR.js +96 -0
  15. package/dist/{daemon-restart-BH67ZOTE.js → daemon-restart-TPQ2XBRZ.js} +4 -4
  16. package/dist/daemon.js +1199 -1785
  17. package/dist/{down-LIOQ5JDH.js → down-WSUASL5E.js} +3 -3
  18. package/dist/{import-E433B4KG.js → import-EAXTHHXL.js} +2 -1
  19. package/dist/message-delivery-WUS4K4ZC.js +21 -0
  20. package/dist/{mind-BIDOF65R.js → mind-BTXR5B3C.js} +13 -5
  21. package/dist/{mind-manager-3V2NXX4I.js → mind-manager-P5OBDUKI.js} +1 -1
  22. package/dist/mind-sleep-FWRBIFBS.js +41 -0
  23. package/dist/mind-wake-LJK2YU5X.js +36 -0
  24. package/dist/{package-HQR52XSG.js → package-A7PEYJI2.js} +10 -1
  25. package/dist/{pages-KQBR5TAZ.js → pages-YSTRWJR4.js} +1 -1
  26. package/dist/{publish-OJ4QMXVZ.js → publish-BZNHKUUK.js} +2 -2
  27. package/dist/{service-TVNEORO7.js → service-7BFXDI6J.js} +4 -4
  28. package/dist/{setup-OZDYCKDI.js → setup-SSIIXQMI.js} +2 -2
  29. package/dist/sleep-manager-3RWUX2ZR.js +27 -0
  30. package/dist/{sprout-6Z6C42YM.js → sprout-UKCYBGHK.js} +2 -2
  31. package/dist/{status-Z7NAFMBI.js → status-H2MKDN6L.js} +2 -2
  32. package/dist/{up-7BGDMFRT.js → up-JKGC7PPF.js} +3 -3
  33. package/dist/{update-4WT7VWHW.js → update-ELC6MEUT.js} +2 -2
  34. package/dist/{upgrade-ZEC2GGFO.js → upgrade-GXW2EQY3.js} +11 -2
  35. package/dist/{version-notify-TFS2U5CF.js → version-notify-5FGUAVSF.js} +11 -3
  36. package/dist/web-assets/assets/index-DWBxl4LO.js +69 -0
  37. package/dist/web-assets/assets/index-ZqMd1mx1.css +1 -0
  38. package/dist/web-assets/index.html +2 -2
  39. package/package.json +10 -1
  40. package/templates/_base/.init/.config/prompts.json +1 -0
  41. package/templates/_base/home/.config/config.json.tmpl +4 -1
  42. package/templates/_base/src/lib/logger.ts +68 -23
  43. package/templates/_base/src/lib/startup.ts +12 -3
  44. package/templates/claude/src/agent.ts +150 -29
  45. package/templates/claude/src/lib/hooks/pre-compact.ts +18 -4
  46. package/templates/claude/src/lib/message-channel.ts +6 -0
  47. package/templates/claude/src/lib/stream-consumer.ts +7 -0
  48. package/templates/claude/src/server.ts +3 -1
  49. package/templates/pi/home/.config/config.json.tmpl +4 -1
  50. package/templates/pi/src/agent.ts +87 -0
  51. package/templates/pi/src/lib/event-handler.ts +13 -1
  52. package/templates/pi/src/server.ts +3 -1
  53. package/dist/chunk-OGZYB5GL.js +0 -847
  54. package/dist/web-assets/assets/index-BR3gtK3E.css +0 -1
  55. package/dist/web-assets/assets/index-CWmrZRQd.js +0 -64
  56. /package/dist/{shared-DCQ2UXOM.js → shared-2OGT3NSL.js} +0 -0
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ subscribe
4
+ } from "./chunk-A4S7H6G6.js";
5
+ import {
6
+ logger_default
7
+ } from "./chunk-YUIHSKR6.js";
8
+
9
+ // src/lib/webhook.ts
10
+ var slog = logger_default.child("webhook");
11
+ function getWebhookUrl() {
12
+ return process.env.VOLUTE_WEBHOOK_URL;
13
+ }
14
+ function getAuthHeaders() {
15
+ const headers = { "Content-Type": "application/json" };
16
+ const secret = process.env.VOLUTE_WEBHOOK_SECRET;
17
+ if (secret) headers.Authorization = `Bearer ${secret}`;
18
+ return headers;
19
+ }
20
+ function fireWebhook(event) {
21
+ try {
22
+ const url = getWebhookUrl();
23
+ if (!url) return;
24
+ const payload = { ...event, timestamp: event.timestamp ?? (/* @__PURE__ */ new Date()).toISOString() };
25
+ fetch(url, {
26
+ method: "POST",
27
+ headers: getAuthHeaders(),
28
+ body: JSON.stringify(payload)
29
+ }).then((res) => {
30
+ if (!res.ok) {
31
+ slog.warn(`webhook ${event.event} returned HTTP ${res.status}`);
32
+ }
33
+ }).catch((err) => {
34
+ slog.warn(`webhook delivery failed for ${event.event}`, logger_default.errorData(err));
35
+ });
36
+ } catch (err) {
37
+ slog.error(`webhook ${event.event} failed to serialize`, logger_default.errorData(err));
38
+ }
39
+ }
40
+ function initWebhook() {
41
+ const url = getWebhookUrl();
42
+ if (!url) return () => {
43
+ };
44
+ try {
45
+ const parsed = new URL(url);
46
+ if (!["http:", "https:"].includes(parsed.protocol)) {
47
+ slog.error(`VOLUTE_WEBHOOK_URL has unsupported protocol: ${parsed.protocol}`);
48
+ return () => {
49
+ };
50
+ }
51
+ } catch {
52
+ slog.error(`VOLUTE_WEBHOOK_URL is not a valid URL`);
53
+ return () => {
54
+ };
55
+ }
56
+ slog.info("webhook enabled");
57
+ return subscribe((event) => {
58
+ try {
59
+ fireWebhook({
60
+ event: event.type,
61
+ mind: event.mind,
62
+ data: { summary: event.summary, ...event.metadata },
63
+ timestamp: event.created_at
64
+ });
65
+ } catch (err) {
66
+ slog.error(`failed to fire webhook for ${event.type}`, logger_default.errorData(err));
67
+ }
68
+ });
69
+ }
70
+
71
+ export {
72
+ getWebhookUrl,
73
+ getAuthHeaders,
74
+ fireWebhook,
75
+ initWebhook
76
+ };
@@ -4,7 +4,7 @@ import {
4
4
  modeLabel,
5
5
  pollHealth,
6
6
  startService
7
- } from "./chunk-QUJUKM4U.js";
7
+ } from "./chunk-VT5QODNE.js";
8
8
  import {
9
9
  parseArgs
10
10
  } from "./chunk-D424ZQGI.js";
@@ -15,6 +15,7 @@ function exec(cmd, args, options) {
15
15
  (err, stdout, stderr) => {
16
16
  if (err) {
17
17
  err.stderr = stderr;
18
+ err.stdout = stdout;
18
19
  reject(err);
19
20
  } else {
20
21
  resolve(stdout);