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.
- package/dist/api.d.ts +4294 -0
- package/dist/chunk-G5KRTU2F.js +76 -0
- package/dist/{chunk-J5A3DF2U.js → chunk-JNFRY2WU.js} +1 -1
- package/dist/{chunk-IPJXU366.js → chunk-JTDFJWI2.js} +1 -0
- package/dist/chunk-OSFGKF2T.js +2651 -0
- package/dist/{chunk-L3LHXZD7.js → chunk-PHHKNGA3.js} +1 -1
- package/dist/{chunk-Q7AITQ44.js → chunk-QIXPN3OO.js} +1 -1
- package/dist/{chunk-PC6R6UUW.js → chunk-RK627D57.js} +36 -59
- package/dist/{chunk-5462YKWP.js → chunk-TFS25FIM.js} +1 -1
- package/dist/{chunk-7LPTHFIL.js → chunk-VNVCRVYI.js} +55 -5
- package/dist/{chunk-QUJUKM4U.js → chunk-VT5QODNE.js} +1 -1
- package/dist/chunk-XLC342FO.js +29 -0
- package/dist/cli.js +10 -10
- package/dist/cloud-sync-C6WRYRVR.js +96 -0
- package/dist/{daemon-restart-BH67ZOTE.js → daemon-restart-TPQ2XBRZ.js} +4 -4
- package/dist/daemon.js +1199 -1785
- package/dist/{down-LIOQ5JDH.js → down-WSUASL5E.js} +3 -3
- package/dist/{import-E433B4KG.js → import-EAXTHHXL.js} +2 -1
- package/dist/message-delivery-WUS4K4ZC.js +21 -0
- package/dist/{mind-BIDOF65R.js → mind-BTXR5B3C.js} +13 -5
- package/dist/{mind-manager-3V2NXX4I.js → mind-manager-P5OBDUKI.js} +1 -1
- package/dist/mind-sleep-FWRBIFBS.js +41 -0
- package/dist/mind-wake-LJK2YU5X.js +36 -0
- package/dist/{package-HQR52XSG.js → package-A7PEYJI2.js} +10 -1
- package/dist/{pages-KQBR5TAZ.js → pages-YSTRWJR4.js} +1 -1
- package/dist/{publish-OJ4QMXVZ.js → publish-BZNHKUUK.js} +2 -2
- package/dist/{service-TVNEORO7.js → service-7BFXDI6J.js} +4 -4
- package/dist/{setup-OZDYCKDI.js → setup-SSIIXQMI.js} +2 -2
- package/dist/sleep-manager-3RWUX2ZR.js +27 -0
- package/dist/{sprout-6Z6C42YM.js → sprout-UKCYBGHK.js} +2 -2
- package/dist/{status-Z7NAFMBI.js → status-H2MKDN6L.js} +2 -2
- package/dist/{up-7BGDMFRT.js → up-JKGC7PPF.js} +3 -3
- package/dist/{update-4WT7VWHW.js → update-ELC6MEUT.js} +2 -2
- package/dist/{upgrade-ZEC2GGFO.js → upgrade-GXW2EQY3.js} +11 -2
- package/dist/{version-notify-TFS2U5CF.js → version-notify-5FGUAVSF.js} +11 -3
- package/dist/web-assets/assets/index-DWBxl4LO.js +69 -0
- package/dist/web-assets/assets/index-ZqMd1mx1.css +1 -0
- package/dist/web-assets/index.html +2 -2
- package/package.json +10 -1
- package/templates/_base/.init/.config/prompts.json +1 -0
- package/templates/_base/home/.config/config.json.tmpl +4 -1
- package/templates/_base/src/lib/logger.ts +68 -23
- package/templates/_base/src/lib/startup.ts +12 -3
- package/templates/claude/src/agent.ts +150 -29
- package/templates/claude/src/lib/hooks/pre-compact.ts +18 -4
- package/templates/claude/src/lib/message-channel.ts +6 -0
- package/templates/claude/src/lib/stream-consumer.ts +7 -0
- package/templates/claude/src/server.ts +3 -1
- package/templates/pi/home/.config/config.json.tmpl +4 -1
- package/templates/pi/src/agent.ts +87 -0
- package/templates/pi/src/lib/event-handler.ts +13 -1
- package/templates/pi/src/server.ts +3 -1
- package/dist/chunk-OGZYB5GL.js +0 -847
- package/dist/web-assets/assets/index-BR3gtK3E.css +0 -1
- package/dist/web-assets/assets/index-CWmrZRQd.js +0 -64
- /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
|
+
};
|