hyperclaw 5.0.0 → 5.0.2
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/LICENSE +2 -1
- package/README.md +449 -99
- package/dist/a2ui-protocol-Gzm29Gaw.js +75 -0
- package/dist/agents-routing-Biy5ew4a.js +4 -0
- package/dist/agents-routing-CL3HQNoM.js +327 -0
- package/dist/api-keys-guide-CGn5BSF7.js +149 -0
- package/dist/api-keys-guide-ChbThbPj.js +149 -0
- package/dist/audit-BJohI_vC.js +441 -0
- package/dist/audit-NPIMmOSq.js +441 -0
- package/dist/bounty-tools-BUqUKjt0.js +211 -0
- package/dist/bounty-tools-CY_i91DU.js +211 -0
- package/dist/browser-tools-CxJY6pAn.js +5 -0
- package/dist/browser-tools-JZ9ji6AW.js +179 -0
- package/dist/chat-qVuqhlPu.js +258 -0
- package/dist/claw-tasks-B-8RRMdq.js +80 -0
- package/dist/claw-tasks-Cyzdbhz_.js +80 -0
- package/dist/connector-1x1rCBHz.js +162 -0
- package/dist/connector-B4jeCULG.js +305 -0
- package/dist/connector-B7qngfkT.js +286 -0
- package/dist/connector-B8BK0GBo.js +531 -0
- package/dist/connector-BE9eJs8-.js +182 -0
- package/dist/connector-BEe-DTGQ.js +189 -0
- package/dist/connector-BU7p5ZgB.js +167 -0
- package/dist/connector-BUzzq7Ij.js +568 -0
- package/dist/connector-BpDqLgnW.js +419 -0
- package/dist/connector-BpW88ut2.js +189 -0
- package/dist/connector-Bxv-gy8U.js +167 -0
- package/dist/connector-Bz14zcJv.js +213 -0
- package/dist/connector-C1zP5-5q.js +85 -0
- package/dist/connector-CAcpcovF.js +498 -0
- package/dist/connector-CJgVjS58.js +181 -0
- package/dist/connector-Cf53D6qV.js +425 -0
- package/dist/connector-CyHmlbNz.js +508 -0
- package/dist/connector-D22mJGVu.js +340 -0
- package/dist/connector-D6RtMmlL.js +225 -0
- package/dist/connector-D9EnT8A4.js +280 -0
- package/dist/connector-DNDwIh37.js +239 -0
- package/dist/connector-Di27MeO4.js +350 -0
- package/dist/connector-Do0BPiHt.js +194 -0
- package/dist/connector-DvLwOfJy.js +192 -0
- package/dist/connector-DvU83NSq.js +181 -0
- package/dist/connector-DxskpDc_.js +173 -0
- package/dist/connector-byy3eISx.js +552 -0
- package/dist/connector-vV89hsyd.js +218 -0
- package/dist/cost-tracker-Ca1UPZ33.js +103 -0
- package/dist/cost-tracker-fnaj_6M9.js +103 -0
- package/dist/credentials-store-BxijEirw.js +77 -0
- package/dist/credentials-store-CA8UtK0T.js +77 -0
- package/dist/credentials-store-CPkVO6-z.js +4 -0
- package/dist/credentials-store-Cm7DH-kh.js +4 -0
- package/dist/cron-tasks-L0mz1yyU.js +82 -0
- package/dist/cron-tasks-_pqQCmxc.js +82 -0
- package/dist/daemon-7ViroziB.js +5 -0
- package/dist/daemon-BfyKmZhr.js +318 -0
- package/dist/daemon-CNyunwkR.js +5 -0
- package/dist/daemon-CindY8OK.js +318 -0
- package/dist/delivery-DVHmv1IR.js +4 -0
- package/dist/delivery-DgiZcJBp.js +4 -0
- package/dist/delivery-DpMX0Yyc.js +95 -0
- package/dist/delivery-otAU4alM.js +95 -0
- package/dist/destructive-gate-CA0DtA5K.js +101 -0
- package/dist/destructive-gate-DZt71UZR.js +101 -0
- package/dist/developer-keys-Cnd1kswV.js +127 -0
- package/dist/developer-keys-DENo3ZA6.js +8 -0
- package/dist/doctor-Dgjoc3DG.js +230 -0
- package/dist/doctor-RwsOhtAl.js +6 -0
- package/dist/engine-B0kLfRL0.js +256 -0
- package/dist/engine-BJUpRUOv.js +7 -0
- package/dist/engine-D_VeoZHw.js +305 -0
- package/dist/engine-JjRnhlsE.js +7 -0
- package/dist/env-resolve-17ekEU6p.js +10 -0
- package/dist/env-resolve-BFJXWl94.js +115 -0
- package/dist/env-resolve-Z2XF6leB.js +115 -0
- package/dist/env-resolve-bDYssfih.js +10 -0
- package/dist/extraction-tools-DbxnxIco.js +5 -0
- package/dist/extraction-tools-Dg7AHS35.js +91 -0
- package/dist/form_data-CGAy4HE0.js +8657 -0
- package/dist/gmail-watch-setup-C3uSWznp.js +40 -0
- package/dist/health-DUjluWHQ.js +6 -0
- package/dist/health-DVfkpUQW.js +152 -0
- package/dist/heartbeat-engine-CrgL4mrP.js +83 -0
- package/dist/heartbeat-engine-Ut6pXBD6.js +83 -0
- package/dist/hub-9LaKnLjY.js +6 -0
- package/dist/hub-BO6bj8Yj.js +515 -0
- package/dist/hub-Bu52YZqW.js +6 -0
- package/dist/hub-CfwUz9YW.js +515 -0
- package/dist/hyperclawbot-BrcoYLOp.js +505 -0
- package/dist/hyperclawbot-CBiDSKsa.js +505 -0
- package/dist/inference-0mlFQqIm.js +922 -0
- package/dist/inference-DHR82Gh7.js +6 -0
- package/dist/inference-DhA8jpfH.js +2692 -0
- package/dist/inference-SzqFe_nk.js +6 -0
- package/dist/knowledge-graph-BrYpSgxW.js +131 -0
- package/dist/knowledge-graph-DE5lSF02.js +131 -0
- package/dist/loader-9JqY6Nlq.js +4 -0
- package/dist/loader-BkDi8MD9.js +400 -0
- package/dist/loader-Cjdd1kw4.js +400 -0
- package/dist/loader-DI2qDRPC.js +4 -0
- package/dist/logger-Cp8wC7F8.js +83 -0
- package/dist/logger-DCT2l9GV.js +83 -0
- package/dist/manager-3cq3DydI.js +4 -0
- package/dist/manager-B2Gls5RG.js +218 -0
- package/dist/manager-BUrFrPuq.js +117 -0
- package/dist/manager-Bi9UYyVR.js +105 -0
- package/dist/manager-Biz9ixWJ.js +40 -0
- package/dist/manager-CBUHJiY7.js +6 -0
- package/dist/manager-CVLLaKmq.js +218 -0
- package/dist/manager-CWNSML5D.js +117 -0
- package/dist/manager-SJe9gt-q.js +4 -0
- package/dist/mcp-CUoTCMw-.js +139 -0
- package/dist/mcp-loader-BIz-450x.js +94 -0
- package/dist/mcp-loader-CvxRDtPC.js +94 -0
- package/dist/memory-OL77OMOr.js +270 -0
- package/dist/memory-auto-CpQHZlEJ.js +306 -0
- package/dist/memory-auto-D-L2q21G.js +306 -0
- package/dist/memory-auto-DTcy5VBy.js +5 -0
- package/dist/memory-auto-Z6LCf-iK.js +5 -0
- package/dist/memory-gUi4VaIf.js +4 -0
- package/dist/memory-integration-B8RSN4pr.js +91 -0
- package/dist/memory-integration-g2vxwgoE.js +91 -0
- package/dist/moltbook-B-40gQOL.js +81 -0
- package/dist/moltbook-Cl8cQfxJ.js +81 -0
- package/dist/node-TWxRm84k.js +222 -0
- package/dist/nodes-registry-C9dCFwjh.js +52 -0
- package/dist/nodes-registry-DKRtsbNg.js +52 -0
- package/dist/oauth-flow-CeaaGAz0.js +150 -0
- package/dist/oauth-flow-JCfporKq.js +150 -0
- package/dist/oauth-provider-4R0EJlsT.js +110 -0
- package/dist/oauth-provider-B4dzn56l.js +110 -0
- package/dist/observability-CDZmeHfa.js +89 -0
- package/dist/observability-nZ3CBIxG.js +89 -0
- package/dist/onboard-BBBWcfhp.js +10 -0
- package/dist/onboard-BVOtKQdh.js +3641 -0
- package/dist/onboard-Bw28IRQ3.js +4070 -0
- package/dist/onboard-CGNIw27w.js +11 -0
- package/dist/orchestrator-BovkM63z.js +6 -0
- package/dist/orchestrator-CcKx1Ovk.js +189 -0
- package/dist/orchestrator-DSbpkP1X.js +189 -0
- package/dist/orchestrator-DcFfDLTX.js +6 -0
- package/dist/osint-B4_m3VHQ.js +277 -0
- package/dist/osint-B6BZKQAD.js +277 -0
- package/dist/pairing-B6RArWhD.js +196 -0
- package/dist/pairing-BsQ08DLq.js +4 -0
- package/dist/pc-access-B0KocJNe.js +819 -0
- package/dist/pc-access-DkzmugZ7.js +8 -0
- package/dist/pending-approval-BgNjjuI2.js +22 -0
- package/dist/pending-approval-C_HkX1QL.js +22 -0
- package/dist/providers-DxiamZSL.js +5 -0
- package/dist/providers-Dy15rDb7.js +657 -0
- package/dist/reminders-store-CzUY0zYx.js +58 -0
- package/dist/renderer-ANNfXsHn.js +225 -0
- package/dist/rules-BSQwwAYC.js +103 -0
- package/dist/run-main.js +142 -132
- package/dist/runner-BHRSOPEU.js +1271 -0
- package/dist/runner-CJFJUtPm.js +1271 -0
- package/dist/sdk/index.js +2 -2
- package/dist/sdk/index.mjs +2 -2
- package/dist/security--oQObeJO.js +4 -0
- package/dist/security-wBOg0TA8.js +73 -0
- package/dist/server-Brl_HQUB.js +1255 -0
- package/dist/server-CbTTpB5m.js +1255 -0
- package/dist/server-DP_bPzvI.js +4 -0
- package/dist/server-DhfipkwN.js +4 -0
- package/dist/session-store-B09r5HgB.js +5 -0
- package/dist/session-store-DCTQIVur.js +113 -0
- package/dist/sessions-tools-BdlN6Pb6.js +95 -0
- package/dist/sessions-tools-JVLDKSJ_.js +5 -0
- package/dist/skill-loader-B5oeliGu.js +7 -0
- package/dist/skill-loader-Wf3brNOj.js +160 -0
- package/dist/skill-runtime-BGlvly2s.js +102 -0
- package/dist/skill-runtime-BXWd-Ktf.js +102 -0
- package/dist/skill-runtime-DhL2T76p.js +5 -0
- package/dist/skill-runtime-jgklm02e.js +5 -0
- package/dist/src-BbPa6Q8p.js +63 -0
- package/dist/src-BeXtfkK2.js +458 -0
- package/dist/src-Bhybpk1J.js +63 -0
- package/dist/src-CGQjRI4N.js +20 -0
- package/dist/src-DMJ4-uqk.js +458 -0
- package/dist/sub-agent-tools-CmE345s_.js +39 -0
- package/dist/sub-agent-tools-DHY-4WWM.js +39 -0
- package/dist/theme-D0smfC_l.js +8 -0
- package/dist/theme-DajRRZbA.js +180 -0
- package/dist/tool-policy-DZvF8xlQ.js +189 -0
- package/dist/tool-policy-DgNqFWYn.js +189 -0
- package/dist/tts-elevenlabs-C06nUxMK.js +61 -0
- package/dist/tts-elevenlabs-JeFaGNJU.js +61 -0
- package/dist/update-check-BVEqHhFY.js +83 -0
- package/dist/update-check-w4XuxVl7.js +81 -0
- package/dist/vision-JOtOS1Br.js +121 -0
- package/dist/vision-fky3elEo.js +121 -0
- package/dist/vision-tools-C8B3776g.js +5 -0
- package/dist/vision-tools-CB28ZCO_.js +5 -0
- package/dist/vision-tools-dwn9p4el.js +51 -0
- package/dist/vision-tools-vPPwQ-0N.js +51 -0
- package/dist/voice-transcription-B6RtplmN.js +138 -0
- package/dist/voice-transcription-DBo5hXmu.js +138 -0
- package/dist/website-watch-tools-B-jRAeTe.js +139 -0
- package/dist/website-watch-tools-BC9xAL67.js +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-jS-bbMI5.js');
|
|
2
|
+
const fs_extra = require_chunk.__toESM(require("fs-extra"));
|
|
3
|
+
const path = require_chunk.__toESM(require("path"));
|
|
4
|
+
const os = require_chunk.__toESM(require("os"));
|
|
5
|
+
const https = require_chunk.__toESM(require("https"));
|
|
6
|
+
|
|
7
|
+
//#region src/services/voice-transcription.ts
|
|
8
|
+
const HC_DIR = path.default.join(os.default.homedir(), ".hyperclaw");
|
|
9
|
+
async function getConfig() {
|
|
10
|
+
try {
|
|
11
|
+
const cfg = await fs_extra.default.readJson(path.default.join(HC_DIR, "hyperclaw.json"));
|
|
12
|
+
const providerId = cfg?.provider?.providerId;
|
|
13
|
+
const apiKey = cfg?.provider?.apiKey;
|
|
14
|
+
return {
|
|
15
|
+
providerId,
|
|
16
|
+
apiKey
|
|
17
|
+
};
|
|
18
|
+
} catch {
|
|
19
|
+
return {};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
async function transcribeWithWhisper(buffer, apiKey) {
|
|
23
|
+
return new Promise((resolve, reject) => {
|
|
24
|
+
const boundary = "----HyperClaw" + Date.now();
|
|
25
|
+
const header = [
|
|
26
|
+
`--${boundary}`,
|
|
27
|
+
"Content-Disposition: form-data; name=\"file\"; filename=\"audio.ogg\"",
|
|
28
|
+
"Content-Type: application/octet-stream",
|
|
29
|
+
"",
|
|
30
|
+
""
|
|
31
|
+
].join("\r\n");
|
|
32
|
+
const footer = `\r\n--${boundary}\r\nContent-Disposition: form-data; name="model"\r\n\r\nwhisper-1\r\n--${boundary}--\r\n`;
|
|
33
|
+
const body = Buffer.concat([
|
|
34
|
+
Buffer.from(header, "utf8"),
|
|
35
|
+
buffer,
|
|
36
|
+
Buffer.from(footer, "utf8")
|
|
37
|
+
]);
|
|
38
|
+
const req = https.default.request({
|
|
39
|
+
hostname: "api.openai.com",
|
|
40
|
+
port: 443,
|
|
41
|
+
path: "/v1/audio/transcriptions",
|
|
42
|
+
method: "POST",
|
|
43
|
+
headers: {
|
|
44
|
+
"Authorization": `Bearer ${apiKey}`,
|
|
45
|
+
"Content-Type": `multipart/form-data; boundary=${boundary}`,
|
|
46
|
+
"Content-Length": body.length
|
|
47
|
+
}
|
|
48
|
+
}, (res) => {
|
|
49
|
+
let data = "";
|
|
50
|
+
res.on("data", (c) => data += c);
|
|
51
|
+
res.on("end", () => {
|
|
52
|
+
try {
|
|
53
|
+
const j = JSON.parse(data);
|
|
54
|
+
resolve(j.text?.trim() || "[No transcription]");
|
|
55
|
+
} catch {
|
|
56
|
+
resolve(`[Transcription error: ${data.slice(0, 100)}]`);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
req.on("error", reject);
|
|
61
|
+
req.write(body);
|
|
62
|
+
req.end();
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
async function transcribeWithGemini(buffer, apiKey) {
|
|
66
|
+
const base64 = buffer.toString("base64");
|
|
67
|
+
const payload = JSON.stringify({
|
|
68
|
+
contents: [{ parts: [{ text: "Transcribe this audio to text. Output only the transcription, no other text." }, { inlineData: {
|
|
69
|
+
mimeType: "audio/ogg",
|
|
70
|
+
data: base64
|
|
71
|
+
} }] }],
|
|
72
|
+
generationConfig: { maxOutputTokens: 1024 }
|
|
73
|
+
});
|
|
74
|
+
return new Promise((resolve, reject) => {
|
|
75
|
+
const req = https.default.request({
|
|
76
|
+
hostname: "generativelanguage.googleapis.com",
|
|
77
|
+
port: 443,
|
|
78
|
+
path: "/v1beta/models/gemini-2.0-flash:generateContent?key=" + encodeURIComponent(apiKey),
|
|
79
|
+
method: "POST",
|
|
80
|
+
headers: {
|
|
81
|
+
"Content-Type": "application/json",
|
|
82
|
+
"Content-Length": Buffer.byteLength(payload)
|
|
83
|
+
}
|
|
84
|
+
}, (res) => {
|
|
85
|
+
let data = "";
|
|
86
|
+
res.on("data", (c) => data += c);
|
|
87
|
+
res.on("end", () => {
|
|
88
|
+
try {
|
|
89
|
+
const j = JSON.parse(data);
|
|
90
|
+
const text = j.candidates?.[0]?.content?.parts?.[0]?.text?.trim();
|
|
91
|
+
resolve(text || "[No transcription]");
|
|
92
|
+
} catch {
|
|
93
|
+
resolve(`[Transcription error: ${data.slice(0, 100)}]`);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
req.on("error", reject);
|
|
98
|
+
req.write(payload);
|
|
99
|
+
req.end();
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
|
|
104
|
+
* Transcribe audio using configured provider or fallbacks.
|
|
105
|
+
|
|
106
|
+
* Providers: OpenAI (Whisper), Google (Gemini), OpenRouter.
|
|
107
|
+
|
|
108
|
+
* Env: OPENAI_API_KEY, WHISPER_API_KEY, GOOGLE_AI_API_KEY.
|
|
109
|
+
|
|
110
|
+
*/
|
|
111
|
+
async function transcribeVoiceNote(audioPathOrBuffer, apiKey) {
|
|
112
|
+
let buffer;
|
|
113
|
+
if (typeof audioPathOrBuffer === "string") buffer = await fs_extra.default.readFile(audioPathOrBuffer);
|
|
114
|
+
else buffer = audioPathOrBuffer;
|
|
115
|
+
const cfg = await getConfig();
|
|
116
|
+
const openaiKey = apiKey || process.env.OPENAI_API_KEY || process.env.WHISPER_API_KEY || (cfg.providerId === "openai" || cfg.providerId === "openrouter" ? cfg.apiKey : "");
|
|
117
|
+
const googleKey = process.env.GOOGLE_AI_API_KEY || (cfg.providerId === "google" ? cfg.apiKey : "");
|
|
118
|
+
if (cfg.providerId === "google" && googleKey) try {
|
|
119
|
+
return await transcribeWithGemini(buffer, googleKey);
|
|
120
|
+
} catch {}
|
|
121
|
+
if ((cfg.providerId === "openrouter" || cfg.providerId === "openai") && openaiKey) try {
|
|
122
|
+
return await transcribeWithWhisper(buffer, openaiKey);
|
|
123
|
+
} catch {}
|
|
124
|
+
if (openaiKey) try {
|
|
125
|
+
return await transcribeWithWhisper(buffer, openaiKey);
|
|
126
|
+
} catch (e) {
|
|
127
|
+
return `[Transcription failed: ${e.message}]`;
|
|
128
|
+
}
|
|
129
|
+
if (googleKey) try {
|
|
130
|
+
return await transcribeWithGemini(buffer, googleKey);
|
|
131
|
+
} catch (e) {
|
|
132
|
+
return `[Transcription failed: ${e.message}]`;
|
|
133
|
+
}
|
|
134
|
+
return "[Voice note — add OPENAI_API_KEY or GOOGLE_AI_API_KEY (or select OpenAI/Google provider in the wizard) for transcription]";
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
//#endregion
|
|
138
|
+
exports.transcribeVoiceNote = transcribeVoiceNote;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-jS-bbMI5.js');
|
|
2
|
+
const fs_extra = require_chunk.__toESM(require("fs-extra"));
|
|
3
|
+
const path = require_chunk.__toESM(require("path"));
|
|
4
|
+
const os = require_chunk.__toESM(require("os"));
|
|
5
|
+
const crypto = require_chunk.__toESM(require("crypto"));
|
|
6
|
+
const http = require_chunk.__toESM(require("http"));
|
|
7
|
+
const https = require_chunk.__toESM(require("https"));
|
|
8
|
+
|
|
9
|
+
//#region packages/core/src/agent/website-watch-tools.ts
|
|
10
|
+
async function fetchUrl(url) {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
const client = url.startsWith("https") ? https.default : http.default;
|
|
13
|
+
const req = client.get(url, { timeout: 15e3 }, (res) => {
|
|
14
|
+
let data = "";
|
|
15
|
+
res.on("data", (c) => data += c);
|
|
16
|
+
res.on("end", () => resolve(data));
|
|
17
|
+
});
|
|
18
|
+
req.on("error", reject);
|
|
19
|
+
req.on("timeout", () => {
|
|
20
|
+
req.destroy();
|
|
21
|
+
reject(new Error("Timeout"));
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function hashContent(html) {
|
|
26
|
+
const cleaned = html.replace(/\s+/g, " ").replace(/<script[^>]*>[\s\S]*?<\/script>/gi, "").slice(0, 5e4);
|
|
27
|
+
return crypto.default.createHash("sha256").update(cleaned).digest("hex").slice(0, 16);
|
|
28
|
+
}
|
|
29
|
+
async function loadWatches() {
|
|
30
|
+
try {
|
|
31
|
+
return await fs_extra.default.readJson(WATCH_FILE);
|
|
32
|
+
} catch {
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function saveWatches(watches) {
|
|
37
|
+
await fs_extra.default.ensureDir(path.default.dirname(WATCH_FILE));
|
|
38
|
+
await fs_extra.default.writeJson(WATCH_FILE, watches, { spaces: 2 });
|
|
39
|
+
}
|
|
40
|
+
function getWebsiteWatchTools() {
|
|
41
|
+
return [
|
|
42
|
+
{
|
|
43
|
+
name: "watch_website_add",
|
|
44
|
+
description: "Add a URL to the website change watch list. Use with watch_website_check to detect changes.",
|
|
45
|
+
input_schema: {
|
|
46
|
+
type: "object",
|
|
47
|
+
properties: { url: {
|
|
48
|
+
type: "string",
|
|
49
|
+
description: "URL to watch (e.g. https://example.com)"
|
|
50
|
+
} },
|
|
51
|
+
required: ["url"]
|
|
52
|
+
},
|
|
53
|
+
handler: async (input) => {
|
|
54
|
+
const url = input.url.trim();
|
|
55
|
+
if (!url.startsWith("http")) return "Error: URL must start with http:// or https://";
|
|
56
|
+
const watches = await loadWatches();
|
|
57
|
+
const content = await fetchUrl(url).catch((e) => `[fetch error: ${e.message}]`);
|
|
58
|
+
const hash = hashContent(content);
|
|
59
|
+
watches[url] = {
|
|
60
|
+
url,
|
|
61
|
+
lastHash: hash,
|
|
62
|
+
lastCheck: (/* @__PURE__ */ new Date()).toISOString(),
|
|
63
|
+
lastSnippet: content.slice(0, 200)
|
|
64
|
+
};
|
|
65
|
+
await saveWatches(watches);
|
|
66
|
+
return `Added: ${url}. Initial hash: ${hash}`;
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "watch_website_check",
|
|
71
|
+
description: "Check watched URLs for changes. Returns list of URLs that changed since last check.",
|
|
72
|
+
input_schema: {
|
|
73
|
+
type: "object",
|
|
74
|
+
properties: { url: {
|
|
75
|
+
type: "string",
|
|
76
|
+
description: "Specific URL to check (optional — checks all if omitted)"
|
|
77
|
+
} }
|
|
78
|
+
},
|
|
79
|
+
handler: async (input) => {
|
|
80
|
+
const watches = await loadWatches();
|
|
81
|
+
const filterUrl = input.url;
|
|
82
|
+
const toCheck = filterUrl ? [filterUrl] : Object.keys(watches);
|
|
83
|
+
const changed = [];
|
|
84
|
+
for (const url of toCheck) {
|
|
85
|
+
const ent = watches[url];
|
|
86
|
+
if (!ent) continue;
|
|
87
|
+
try {
|
|
88
|
+
const content = await fetchUrl(url);
|
|
89
|
+
const hash = hashContent(content);
|
|
90
|
+
ent.lastCheck = (/* @__PURE__ */ new Date()).toISOString();
|
|
91
|
+
if (hash !== ent.lastHash) {
|
|
92
|
+
ent.lastHash = hash;
|
|
93
|
+
ent.lastSnippet = content.slice(0, 300);
|
|
94
|
+
changed.push(url);
|
|
95
|
+
}
|
|
96
|
+
watches[url] = ent;
|
|
97
|
+
} catch (e) {
|
|
98
|
+
changed.push(`${url} [error: ${e.message}]`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
await saveWatches(watches);
|
|
102
|
+
if (changed.length === 0) return "No changes detected.";
|
|
103
|
+
return `Changed: ${changed.join(", ")}`;
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "watch_website_list",
|
|
108
|
+
description: "List all watched URLs.",
|
|
109
|
+
input_schema: {
|
|
110
|
+
type: "object",
|
|
111
|
+
properties: {}
|
|
112
|
+
},
|
|
113
|
+
handler: async () => {
|
|
114
|
+
const watches = await loadWatches();
|
|
115
|
+
const urls = Object.keys(watches);
|
|
116
|
+
if (urls.length === 0) return "No watched URLs. Add with watch_website_add.";
|
|
117
|
+
return urls.map((u) => `- ${u} (last: ${watches[u].lastCheck})`).join("\n");
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
var WATCH_FILE;
|
|
123
|
+
var init_website_watch_tools = require_chunk.__esm({ "packages/core/src/agent/website-watch-tools.ts"() {
|
|
124
|
+
WATCH_FILE = path.default.join(os.default.homedir(), ".hyperclaw", "website-watches.json");
|
|
125
|
+
} });
|
|
126
|
+
|
|
127
|
+
//#endregion
|
|
128
|
+
Object.defineProperty(exports, 'getWebsiteWatchTools', {
|
|
129
|
+
enumerable: true,
|
|
130
|
+
get: function () {
|
|
131
|
+
return getWebsiteWatchTools;
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
Object.defineProperty(exports, 'init_website_watch_tools', {
|
|
135
|
+
enumerable: true,
|
|
136
|
+
get: function () {
|
|
137
|
+
return init_website_watch_tools;
|
|
138
|
+
}
|
|
139
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-jS-bbMI5.js');
|
|
2
|
+
const require_website_watch_tools = require('./website-watch-tools-B-jRAeTe.js');
|
|
3
|
+
|
|
4
|
+
require_website_watch_tools.init_website_watch_tools();
|
|
5
|
+
exports.getWebsiteWatchTools = require_website_watch_tools.getWebsiteWatchTools;
|