hyperclaw 5.2.7 → 5.2.9
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/a2ui-protocol-DEsfqO7h.js +75 -0
- package/dist/agents-routing-Cee7wrfi.js +398 -0
- package/dist/agents-routing-ChorJKFL.js +6 -0
- package/dist/agents-routing-Cpg20-1e.js +398 -0
- package/dist/agents-routing-uNzqjgOr.js +6 -0
- package/dist/api-key-validation-DgOBmp8Y.js +64 -0
- package/dist/api-key-validation-DydlUth1.js +64 -0
- package/dist/api-keys-guide--73Bq0Ey.js +149 -0
- package/dist/api-keys-guide-DqRGa4x7.js +149 -0
- package/dist/audit-CX5poVMR.js +445 -0
- package/dist/audit-Dntx9fG9.js +445 -0
- package/dist/banner-B_rR7FPO.js +7 -0
- package/dist/banner-Bb7CderS.js +143 -0
- package/dist/bounty-tools-BoU1NN5N.js +211 -0
- package/dist/bounty-tools-Dn9Yq7V1.js +211 -0
- package/dist/browser-tools-CJ9M9o22.js +179 -0
- package/dist/browser-tools-CXxWxA1c.js +5 -0
- package/dist/chat-C07wF0mM.js +494 -0
- package/dist/chat-D1Zc73I5.js +513 -0
- package/dist/claw-tasks-BLqd1a0Q.js +80 -0
- package/dist/claw-tasks-ChqkHdFs.js +80 -0
- package/dist/config-BlLlJ6Er.js +7 -0
- package/dist/config-Bzues-G2.js +7 -0
- package/dist/config-DGAAJ49A.js +261 -0
- package/dist/config-SgDxKyfV.js +261 -0
- package/dist/connector-1efnZgQN.js +566 -0
- package/dist/connector-B5q1_srT.js +286 -0
- package/dist/connector-BMFLJ4fr.js +508 -0
- package/dist/connector-BZYv9siY.js +189 -0
- package/dist/connector-B_XkXm-j.js +218 -0
- package/dist/connector-BkY1I6gf.js +189 -0
- package/dist/connector-C2Z3RN1z.js +350 -0
- package/dist/connector-C7aYvVzU.js +225 -0
- package/dist/connector-CXXYOyHw.js +164 -0
- package/dist/connector-Ca1J23HX.js +167 -0
- package/dist/connector-Cjqc656I.js +181 -0
- package/dist/connector-CluRienN.js +425 -0
- package/dist/connector-CuNz2eP-.js +305 -0
- package/dist/connector-DHL_oeHy.js +552 -0
- package/dist/connector-DJ79rd1L.js +173 -0
- package/dist/connector-DcLE6xCZ.js +239 -0
- package/dist/connector-DcyQTJnJ.js +162 -0
- package/dist/connector-DgyX9qSc.js +192 -0
- package/dist/connector-DnDXXZ7L.js +182 -0
- package/dist/connector-DqUslg-X.js +213 -0
- package/dist/connector-Duc-HmRZ.js +85 -0
- package/dist/connector-IV0QFer8.js +498 -0
- package/dist/connector-OnsLxE8G.js +194 -0
- package/dist/connector-UYu_TS0X.js +204 -0
- package/dist/connector-cCA5ffmp.js +340 -0
- package/dist/connector-fbNfx4_L.js +568 -0
- package/dist/connector-fi2vlwbO.js +276 -0
- package/dist/connector-l3LD8IDN.js +419 -0
- package/dist/cost-tracker-CgEXyEtz.js +103 -0
- package/dist/cost-tracker-DCXDUzBI.js +103 -0
- package/dist/credentials-store-1LDtNReY.js +89 -0
- package/dist/credentials-store-BFxEJR00.js +7 -0
- package/dist/credentials-store-Bmm9e1SS.js +7 -0
- package/dist/credentials-store-D8ERbGR2.js +89 -0
- package/dist/cron-tasks-1E6wKpTv.js +85 -0
- package/dist/cron-tasks-OQbgmenS.js +85 -0
- package/dist/daemon-B13UIqvL.js +7 -0
- package/dist/daemon-CzOW-1PS.js +421 -0
- package/dist/daemon-aVX-WGz1.js +421 -0
- package/dist/daemon-iFmVBPXN.js +7 -0
- package/dist/delivery-B8YGmrq5.js +4 -0
- package/dist/delivery-DWsU6gx-.js +95 -0
- package/dist/delivery-Pko6sSkt.js +4 -0
- package/dist/delivery-hMHFRZwy.js +95 -0
- package/dist/destructive-gate-C2TrWsp2.js +101 -0
- package/dist/destructive-gate-bnkroJWG.js +101 -0
- package/dist/developer-keys-BWXHaWxY.js +127 -0
- package/dist/developer-keys-CzDxVczE.js +8 -0
- package/dist/device-auth-store-C1bCwXO2.js +7 -0
- package/dist/device-auth-store-DIZTOz4V.js +88 -0
- package/dist/doctor-C6nAGdH8.js +233 -0
- package/dist/doctor-mgWumA25.js +6 -0
- package/dist/engine-BGRTi0fo.js +327 -0
- package/dist/engine-BvCEhaUn.js +7 -0
- package/dist/engine-ByQ-0sWM.js +7 -0
- package/dist/engine-gnMjO743.js +327 -0
- package/dist/env-resolve-BdagnXhK.js +151 -0
- package/dist/env-resolve-CHxjGo8u.js +151 -0
- package/dist/env-resolve-NEtsGacw.js +10 -0
- package/dist/env-resolve-pIETNTpQ.js +10 -0
- package/dist/extraction-tools-BE6z_Yw5.js +91 -0
- package/dist/extraction-tools-CJsdyBST.js +5 -0
- package/dist/form_data-B2_0EoWj.js +8657 -0
- package/dist/gmail-watch-setup-1RGIHNdu.js +42 -0
- package/dist/gmail-watch-setup-Brkj94Sy.js +42 -0
- package/dist/health-BMUmUNoe.js +152 -0
- package/dist/health-C8n9RH5O.js +6 -0
- package/dist/heartbeat-engine-D6oSpgxx.js +89 -0
- package/dist/heartbeat-engine-aRbab8a5.js +89 -0
- package/dist/hub-BJM2KXLO.js +6 -0
- package/dist/hub-Bb_dYECE.js +512 -0
- package/dist/hyperclawbot-CgrV46DA.js +516 -0
- package/dist/hyperclawbot-DzP_v3iA.js +516 -0
- package/dist/inference-BHJFPEKL.js +8 -0
- package/dist/inference-CFBkvLpE.js +2854 -0
- package/dist/inference-G4MbdErG.js +8 -0
- package/dist/inference-vweXyh27.js +2854 -0
- package/dist/knowledge-graph-9UNrsiIY.js +134 -0
- package/dist/knowledge-graph-yeMPBPP8.js +134 -0
- package/dist/loader-BXYJl25e.js +6 -0
- package/dist/loader-DIPs649t.js +410 -0
- package/dist/loader-Dq_cDlOW.js +6 -0
- package/dist/loader-gTdKBwiI.js +410 -0
- package/dist/logger-C3ZCDSkc.js +86 -0
- package/dist/logger-CG38Idq4.js +86 -0
- package/dist/manager--wG9JdFW.js +120 -0
- package/dist/manager-BI3izlRG.js +120 -0
- package/dist/manager-BNc21xgG.js +6 -0
- package/dist/manager-CQ3MWNHY.js +250 -0
- package/dist/manager-DWJ7WZcY.js +250 -0
- package/dist/manager-DYfzqckn.js +35 -0
- package/dist/mcp-CklaYr_6.js +142 -0
- package/dist/mcp-SsMEvl28.js +142 -0
- package/dist/mcp-loader-9v8eUsNI.js +93 -0
- package/dist/mcp-loader-DLrp_oZJ.js +93 -0
- package/dist/memory-BCYvdqwo.js +273 -0
- package/dist/memory-BGgCBSx1.js +6 -0
- package/dist/memory-auto-Bh52cQJP.js +5 -0
- package/dist/memory-auto-Bow9u_L7.js +306 -0
- package/dist/memory-auto-BupvVwNd.js +306 -0
- package/dist/memory-auto-CgBAI8mm.js +5 -0
- package/dist/memory-integration-4oGqX6rr.js +91 -0
- package/dist/memory-integration-CveUEI3V.js +91 -0
- package/dist/moltbook-B3DNdh40.js +81 -0
- package/dist/moltbook-xP7VXKlX.js +81 -0
- package/dist/node-C4esBfbX.js +226 -0
- package/dist/node-urDjajMt.js +226 -0
- package/dist/nodes-registry-Cd4eWw80.js +52 -0
- package/dist/nodes-registry-DLUZhEMS.js +52 -0
- package/dist/oauth-flow-BbLQTzZk.js +148 -0
- package/dist/oauth-flow-Bt-LaRHV.js +148 -0
- package/dist/oauth-provider-CVTKgj35.js +111 -0
- package/dist/oauth-provider-UZyG84s7.js +111 -0
- package/dist/observability-BtLyuxcz.js +89 -0
- package/dist/observability-lwYm4aoB.js +89 -0
- package/dist/onboard-B3drurt-.js +3812 -0
- package/dist/onboard-BV5Poocl.js +13 -0
- package/dist/onboard-DEwuHrMj.js +14 -0
- package/dist/onboard-UiynbNQy.js +3909 -0
- package/dist/orchestrator-BXyIgAeH.js +189 -0
- package/dist/orchestrator-DMZkAVa5.js +189 -0
- package/dist/orchestrator-MLTc4NYu.js +6 -0
- package/dist/orchestrator-rVGu7yYr.js +6 -0
- package/dist/osint-Bsf6RGPv.js +283 -0
- package/dist/osint-chat-Ark94iFc.js +789 -0
- package/dist/osint-chat-Hn8qpsC1.js +836 -0
- package/dist/osint-f9DeXT6j.js +283 -0
- package/dist/pairing-2vAiDBjN.js +6 -0
- package/dist/pairing-B4NoBvyE.js +207 -0
- package/dist/pc-access-BLnc-DYp.js +858 -0
- package/dist/pc-access-CTNtG2LD.js +8 -0
- package/dist/pending-approval-C4ZaHHWl.js +22 -0
- package/dist/pending-approval-CHUZ_qT6.js +22 -0
- package/dist/reminders-store-BixTWL1h.js +58 -0
- package/dist/renderer-B1ToXngl.js +228 -0
- package/dist/rules-Cqen1Mpt.js +106 -0
- package/dist/run-main.js +98 -94
- package/dist/runner-B9xANekJ.js +1274 -0
- package/dist/runner-Cr1_mwnU.js +1274 -0
- package/dist/security--17Fxo5Z.js +4 -0
- package/dist/security-B4vH02lO.js +4 -0
- package/dist/security-DP1qtJfL.js +90 -0
- package/dist/security-HOOGCw5z.js +90 -0
- package/dist/server-CRhXiGI9.js +4 -0
- package/dist/server-DUDXqJSo.js +1365 -0
- package/dist/server-De4H45Ju.js +1365 -0
- package/dist/server-ha59nA8a.js +4 -0
- package/dist/session-store-7sEPyV16.js +5 -0
- package/dist/session-store-Ce2QMSL_.js +141 -0
- package/dist/sessions-tools-CWr_pDtp.js +5 -0
- package/dist/sessions-tools-DKVu9aIN.js +95 -0
- package/dist/skill-loader-DK19Jm4e.js +7 -0
- package/dist/skill-loader-Dfs9VNM-.js +160 -0
- package/dist/skill-runtime-BRp2D8Jb.js +5 -0
- package/dist/skill-runtime-BeKh2rD_.js +5 -0
- package/dist/skill-runtime-C8bNwKwz.js +104 -0
- package/dist/skill-runtime-CcpC2Zfc.js +104 -0
- package/dist/src-B8LzGLSY.js +63 -0
- package/dist/src-BxmkZ9RH.js +63 -0
- package/dist/src-DUoc6_kn.js +458 -0
- package/dist/src-DjTtmSRg.js +20 -0
- package/dist/src-n_46LPDi.js +458 -0
- package/dist/sub-agent-tools-CldaMfd5.js +39 -0
- package/dist/sub-agent-tools-q5JqEze_.js +39 -0
- package/dist/tool-policy-DtGf3Ifq.js +189 -0
- package/dist/tool-policy-QXF3MMxu.js +189 -0
- package/dist/tts-elevenlabs-1zWD3QJw.js +64 -0
- package/dist/tts-elevenlabs-y6HGWWDS.js +64 -0
- package/dist/update-check-C4te7JmY.js +6 -0
- package/dist/update-check-GDue_it1.js +98 -0
- package/dist/vision-DV2ubVjr.js +167 -0
- package/dist/vision-tools-Cb86uMdh.js +5 -0
- package/dist/vision-tools-CbVfyTZT.js +5 -0
- package/dist/vision-tools-DieVQp6s.js +51 -0
- package/dist/vision-tools-DlnxaZjg.js +51 -0
- package/dist/vision-u4kMThdo.js +167 -0
- package/dist/voice-transcription-BolTT_HG.js +170 -0
- package/dist/voice-transcription-DgON5qaF.js +170 -0
- package/dist/website-watch-tools-B8L_NgwT.js +5 -0
- package/dist/website-watch-tools-Drm5HjIX.js +176 -0
- package/package.json +4 -1
- package/static/chat.html +9 -3
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-jS-bbMI5.js');
|
|
2
|
+
|
|
3
|
+
//#region src/infra/tool-policy.ts
|
|
4
|
+
function expandToToolNames(entries) {
|
|
5
|
+
const out = /* @__PURE__ */ new Set();
|
|
6
|
+
for (const e of entries) {
|
|
7
|
+
const key = e.toLowerCase().trim();
|
|
8
|
+
if (key === "*" || key === "") continue;
|
|
9
|
+
if (key.startsWith("group:")) {
|
|
10
|
+
const group = TOOL_GROUPS[key];
|
|
11
|
+
if (group) group.forEach((t) => out.add(t));
|
|
12
|
+
} else out.add(key);
|
|
13
|
+
}
|
|
14
|
+
return out;
|
|
15
|
+
}
|
|
16
|
+
function matchesPattern(toolName, pattern) {
|
|
17
|
+
const p = pattern.toLowerCase();
|
|
18
|
+
const t = toolName.toLowerCase();
|
|
19
|
+
if (p === "*" || p === t) return true;
|
|
20
|
+
if (p.endsWith("*")) {
|
|
21
|
+
const prefix = p.slice(0, -1);
|
|
22
|
+
return t.startsWith(prefix);
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
function isAllowed(toolName, allowSet, denySet, profileAllowSet) {
|
|
27
|
+
if (denySet.size > 0) {
|
|
28
|
+
for (const d of denySet) if (matchesPattern(toolName, d)) return false;
|
|
29
|
+
}
|
|
30
|
+
if (profileAllowSet && profileAllowSet.size > 0) {
|
|
31
|
+
let inProfile = false;
|
|
32
|
+
for (const a of profileAllowSet) if (matchesPattern(toolName, a)) {
|
|
33
|
+
inProfile = true;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
if (!inProfile) return false;
|
|
37
|
+
}
|
|
38
|
+
if (allowSet.size > 0) {
|
|
39
|
+
for (const a of allowSet) if (matchesPattern(toolName, a)) return true;
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
function applyToolPolicy(tools, config, context) {
|
|
45
|
+
if (!config) return tools;
|
|
46
|
+
let profile = config.profile ?? "full";
|
|
47
|
+
let allow = config.allow ?? [];
|
|
48
|
+
let deny = config.deny ?? [];
|
|
49
|
+
if (context?.provider && config.byProvider) {
|
|
50
|
+
const providerKey = context.provider + (context.model ? "/" + context.model : "");
|
|
51
|
+
const exact = config.byProvider[providerKey] ?? config.byProvider[context.provider];
|
|
52
|
+
if (exact) {
|
|
53
|
+
if (exact.profile) profile = exact.profile;
|
|
54
|
+
if (exact.allow?.length) allow = [...allow, ...exact.allow];
|
|
55
|
+
if (exact.deny?.length) deny = [...deny, ...exact.deny];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const denySet = expandToToolNames(deny);
|
|
59
|
+
const allowSet = expandToToolNames(allow);
|
|
60
|
+
const profileTools = profile === "full" ? null : new Set(PROFILE_TOOLS[profile]);
|
|
61
|
+
return tools.filter((t) => isAllowed(t.name, allowSet, denySet, profileTools));
|
|
62
|
+
}
|
|
63
|
+
/** For sandbox explain: return effective policy description. */
|
|
64
|
+
function describeToolPolicy(config, context) {
|
|
65
|
+
if (!config) return {
|
|
66
|
+
profile: "full",
|
|
67
|
+
allow: [],
|
|
68
|
+
deny: [],
|
|
69
|
+
source: "default"
|
|
70
|
+
};
|
|
71
|
+
let profile = config.profile ?? "full";
|
|
72
|
+
let allow = config.allow ?? [];
|
|
73
|
+
let deny = config.deny ?? [];
|
|
74
|
+
let source = "tools";
|
|
75
|
+
if (context?.provider && config.byProvider) {
|
|
76
|
+
const providerKey = context.provider + (context.model ? "/" + context.model : "");
|
|
77
|
+
const exact = config.byProvider[providerKey] ?? config.byProvider[context.provider];
|
|
78
|
+
if (exact) {
|
|
79
|
+
if (exact.profile) {
|
|
80
|
+
profile = exact.profile;
|
|
81
|
+
source = `tools.byProvider[${context.provider}]`;
|
|
82
|
+
}
|
|
83
|
+
if (exact.allow?.length) allow = [...allow, ...exact.allow];
|
|
84
|
+
if (exact.deny?.length) deny = [...deny, ...exact.deny];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
profile,
|
|
89
|
+
allow,
|
|
90
|
+
deny,
|
|
91
|
+
source
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
var TOOL_GROUPS, PROFILE_TOOLS;
|
|
95
|
+
var init_tool_policy = require_chunk.__esm({ "src/infra/tool-policy.ts"() {
|
|
96
|
+
TOOL_GROUPS = {
|
|
97
|
+
"group:fs": [
|
|
98
|
+
"read_file",
|
|
99
|
+
"write_file",
|
|
100
|
+
"edit_file",
|
|
101
|
+
"delete_file",
|
|
102
|
+
"list_directory"
|
|
103
|
+
],
|
|
104
|
+
"group:runtime": ["run_shell", "kill_process"],
|
|
105
|
+
"group:sessions": [
|
|
106
|
+
"sessions_list",
|
|
107
|
+
"sessions_send",
|
|
108
|
+
"sessions_history"
|
|
109
|
+
],
|
|
110
|
+
"group:memory": [
|
|
111
|
+
"read_memory",
|
|
112
|
+
"write_memory",
|
|
113
|
+
"memory_graph_add",
|
|
114
|
+
"memory_graph_query"
|
|
115
|
+
],
|
|
116
|
+
"group:ui": [
|
|
117
|
+
"canvas_add",
|
|
118
|
+
"browser_snapshot",
|
|
119
|
+
"browser_action"
|
|
120
|
+
],
|
|
121
|
+
"group:messaging": [
|
|
122
|
+
"sessions_send",
|
|
123
|
+
"sessions_list",
|
|
124
|
+
"sessions_history"
|
|
125
|
+
],
|
|
126
|
+
"group:automation": [
|
|
127
|
+
"add_reminder",
|
|
128
|
+
"list_reminders",
|
|
129
|
+
"complete_reminder",
|
|
130
|
+
"watch_website_add",
|
|
131
|
+
"watch_website_check",
|
|
132
|
+
"watch_website_list"
|
|
133
|
+
],
|
|
134
|
+
"group:pc": [
|
|
135
|
+
"run_shell",
|
|
136
|
+
"read_file",
|
|
137
|
+
"write_file",
|
|
138
|
+
"edit_file",
|
|
139
|
+
"list_directory",
|
|
140
|
+
"delete_file",
|
|
141
|
+
"kill_process",
|
|
142
|
+
"system_info",
|
|
143
|
+
"open",
|
|
144
|
+
"clipboard",
|
|
145
|
+
"search_files",
|
|
146
|
+
"screenshot",
|
|
147
|
+
"camera_capture",
|
|
148
|
+
"screen_record",
|
|
149
|
+
"contacts_list",
|
|
150
|
+
"calendar_events",
|
|
151
|
+
"photos_recent",
|
|
152
|
+
"app_updates",
|
|
153
|
+
"notify"
|
|
154
|
+
],
|
|
155
|
+
"group:extraction": ["extract_pdf", "extract_spreadsheet"],
|
|
156
|
+
"group:vision": ["analyze_image"]
|
|
157
|
+
};
|
|
158
|
+
PROFILE_TOOLS = {
|
|
159
|
+
full: [],
|
|
160
|
+
messaging: [
|
|
161
|
+
"get_current_time",
|
|
162
|
+
"sessions_list",
|
|
163
|
+
"sessions_history",
|
|
164
|
+
"sessions_send",
|
|
165
|
+
"read_memory",
|
|
166
|
+
"write_memory"
|
|
167
|
+
],
|
|
168
|
+
coding: [
|
|
169
|
+
...TOOL_GROUPS["group:fs"],
|
|
170
|
+
...TOOL_GROUPS["group:runtime"],
|
|
171
|
+
...TOOL_GROUPS["group:sessions"],
|
|
172
|
+
...TOOL_GROUPS["group:memory"],
|
|
173
|
+
"http_get",
|
|
174
|
+
"canvas_add",
|
|
175
|
+
"create_skill",
|
|
176
|
+
"get_current_time"
|
|
177
|
+
],
|
|
178
|
+
minimal: [
|
|
179
|
+
"get_current_time",
|
|
180
|
+
"sessions_list",
|
|
181
|
+
"read_memory"
|
|
182
|
+
]
|
|
183
|
+
};
|
|
184
|
+
} });
|
|
185
|
+
|
|
186
|
+
//#endregion
|
|
187
|
+
init_tool_policy();
|
|
188
|
+
exports.applyToolPolicy = applyToolPolicy;
|
|
189
|
+
exports.describeToolPolicy = describeToolPolicy;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-jS-bbMI5.js');
|
|
2
|
+
|
|
3
|
+
//#region src/infra/tool-policy.ts
|
|
4
|
+
function expandToToolNames(entries) {
|
|
5
|
+
const out = /* @__PURE__ */ new Set();
|
|
6
|
+
for (const e of entries) {
|
|
7
|
+
const key = e.toLowerCase().trim();
|
|
8
|
+
if (key === "*" || key === "") continue;
|
|
9
|
+
if (key.startsWith("group:")) {
|
|
10
|
+
const group = TOOL_GROUPS[key];
|
|
11
|
+
if (group) group.forEach((t) => out.add(t));
|
|
12
|
+
} else out.add(key);
|
|
13
|
+
}
|
|
14
|
+
return out;
|
|
15
|
+
}
|
|
16
|
+
function matchesPattern(toolName, pattern) {
|
|
17
|
+
const p = pattern.toLowerCase();
|
|
18
|
+
const t = toolName.toLowerCase();
|
|
19
|
+
if (p === "*" || p === t) return true;
|
|
20
|
+
if (p.endsWith("*")) {
|
|
21
|
+
const prefix = p.slice(0, -1);
|
|
22
|
+
return t.startsWith(prefix);
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
function isAllowed(toolName, allowSet, denySet, profileAllowSet) {
|
|
27
|
+
if (denySet.size > 0) {
|
|
28
|
+
for (const d of denySet) if (matchesPattern(toolName, d)) return false;
|
|
29
|
+
}
|
|
30
|
+
if (profileAllowSet && profileAllowSet.size > 0) {
|
|
31
|
+
let inProfile = false;
|
|
32
|
+
for (const a of profileAllowSet) if (matchesPattern(toolName, a)) {
|
|
33
|
+
inProfile = true;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
if (!inProfile) return false;
|
|
37
|
+
}
|
|
38
|
+
if (allowSet.size > 0) {
|
|
39
|
+
for (const a of allowSet) if (matchesPattern(toolName, a)) return true;
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
function applyToolPolicy(tools, config, context) {
|
|
45
|
+
if (!config) return tools;
|
|
46
|
+
let profile = config.profile ?? "full";
|
|
47
|
+
let allow = config.allow ?? [];
|
|
48
|
+
let deny = config.deny ?? [];
|
|
49
|
+
if (context?.provider && config.byProvider) {
|
|
50
|
+
const providerKey = context.provider + (context.model ? "/" + context.model : "");
|
|
51
|
+
const exact = config.byProvider[providerKey] ?? config.byProvider[context.provider];
|
|
52
|
+
if (exact) {
|
|
53
|
+
if (exact.profile) profile = exact.profile;
|
|
54
|
+
if (exact.allow?.length) allow = [...allow, ...exact.allow];
|
|
55
|
+
if (exact.deny?.length) deny = [...deny, ...exact.deny];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const denySet = expandToToolNames(deny);
|
|
59
|
+
const allowSet = expandToToolNames(allow);
|
|
60
|
+
const profileTools = profile === "full" ? null : new Set(PROFILE_TOOLS[profile]);
|
|
61
|
+
return tools.filter((t) => isAllowed(t.name, allowSet, denySet, profileTools));
|
|
62
|
+
}
|
|
63
|
+
/** For sandbox explain: return effective policy description. */
|
|
64
|
+
function describeToolPolicy(config, context) {
|
|
65
|
+
if (!config) return {
|
|
66
|
+
profile: "full",
|
|
67
|
+
allow: [],
|
|
68
|
+
deny: [],
|
|
69
|
+
source: "default"
|
|
70
|
+
};
|
|
71
|
+
let profile = config.profile ?? "full";
|
|
72
|
+
let allow = config.allow ?? [];
|
|
73
|
+
let deny = config.deny ?? [];
|
|
74
|
+
let source = "tools";
|
|
75
|
+
if (context?.provider && config.byProvider) {
|
|
76
|
+
const providerKey = context.provider + (context.model ? "/" + context.model : "");
|
|
77
|
+
const exact = config.byProvider[providerKey] ?? config.byProvider[context.provider];
|
|
78
|
+
if (exact) {
|
|
79
|
+
if (exact.profile) {
|
|
80
|
+
profile = exact.profile;
|
|
81
|
+
source = `tools.byProvider[${context.provider}]`;
|
|
82
|
+
}
|
|
83
|
+
if (exact.allow?.length) allow = [...allow, ...exact.allow];
|
|
84
|
+
if (exact.deny?.length) deny = [...deny, ...exact.deny];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
profile,
|
|
89
|
+
allow,
|
|
90
|
+
deny,
|
|
91
|
+
source
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
var TOOL_GROUPS, PROFILE_TOOLS;
|
|
95
|
+
var init_tool_policy = require_chunk.__esm({ "src/infra/tool-policy.ts"() {
|
|
96
|
+
TOOL_GROUPS = {
|
|
97
|
+
"group:fs": [
|
|
98
|
+
"read_file",
|
|
99
|
+
"write_file",
|
|
100
|
+
"edit_file",
|
|
101
|
+
"delete_file",
|
|
102
|
+
"list_directory"
|
|
103
|
+
],
|
|
104
|
+
"group:runtime": ["run_shell", "kill_process"],
|
|
105
|
+
"group:sessions": [
|
|
106
|
+
"sessions_list",
|
|
107
|
+
"sessions_send",
|
|
108
|
+
"sessions_history"
|
|
109
|
+
],
|
|
110
|
+
"group:memory": [
|
|
111
|
+
"read_memory",
|
|
112
|
+
"write_memory",
|
|
113
|
+
"memory_graph_add",
|
|
114
|
+
"memory_graph_query"
|
|
115
|
+
],
|
|
116
|
+
"group:ui": [
|
|
117
|
+
"canvas_add",
|
|
118
|
+
"browser_snapshot",
|
|
119
|
+
"browser_action"
|
|
120
|
+
],
|
|
121
|
+
"group:messaging": [
|
|
122
|
+
"sessions_send",
|
|
123
|
+
"sessions_list",
|
|
124
|
+
"sessions_history"
|
|
125
|
+
],
|
|
126
|
+
"group:automation": [
|
|
127
|
+
"add_reminder",
|
|
128
|
+
"list_reminders",
|
|
129
|
+
"complete_reminder",
|
|
130
|
+
"watch_website_add",
|
|
131
|
+
"watch_website_check",
|
|
132
|
+
"watch_website_list"
|
|
133
|
+
],
|
|
134
|
+
"group:pc": [
|
|
135
|
+
"run_shell",
|
|
136
|
+
"read_file",
|
|
137
|
+
"write_file",
|
|
138
|
+
"edit_file",
|
|
139
|
+
"list_directory",
|
|
140
|
+
"delete_file",
|
|
141
|
+
"kill_process",
|
|
142
|
+
"system_info",
|
|
143
|
+
"open",
|
|
144
|
+
"clipboard",
|
|
145
|
+
"search_files",
|
|
146
|
+
"screenshot",
|
|
147
|
+
"camera_capture",
|
|
148
|
+
"screen_record",
|
|
149
|
+
"contacts_list",
|
|
150
|
+
"calendar_events",
|
|
151
|
+
"photos_recent",
|
|
152
|
+
"app_updates",
|
|
153
|
+
"notify"
|
|
154
|
+
],
|
|
155
|
+
"group:extraction": ["extract_pdf", "extract_spreadsheet"],
|
|
156
|
+
"group:vision": ["analyze_image"]
|
|
157
|
+
};
|
|
158
|
+
PROFILE_TOOLS = {
|
|
159
|
+
full: [],
|
|
160
|
+
messaging: [
|
|
161
|
+
"get_current_time",
|
|
162
|
+
"sessions_list",
|
|
163
|
+
"sessions_history",
|
|
164
|
+
"sessions_send",
|
|
165
|
+
"read_memory",
|
|
166
|
+
"write_memory"
|
|
167
|
+
],
|
|
168
|
+
coding: [
|
|
169
|
+
...TOOL_GROUPS["group:fs"],
|
|
170
|
+
...TOOL_GROUPS["group:runtime"],
|
|
171
|
+
...TOOL_GROUPS["group:sessions"],
|
|
172
|
+
...TOOL_GROUPS["group:memory"],
|
|
173
|
+
"http_get",
|
|
174
|
+
"canvas_add",
|
|
175
|
+
"create_skill",
|
|
176
|
+
"get_current_time"
|
|
177
|
+
],
|
|
178
|
+
minimal: [
|
|
179
|
+
"get_current_time",
|
|
180
|
+
"sessions_list",
|
|
181
|
+
"read_memory"
|
|
182
|
+
]
|
|
183
|
+
};
|
|
184
|
+
} });
|
|
185
|
+
|
|
186
|
+
//#endregion
|
|
187
|
+
init_tool_policy();
|
|
188
|
+
exports.applyToolPolicy = applyToolPolicy;
|
|
189
|
+
exports.describeToolPolicy = describeToolPolicy;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-jS-bbMI5.js');
|
|
2
|
+
const https = require_chunk.__toESM(require("https"));
|
|
3
|
+
|
|
4
|
+
//#region src/services/tts-elevenlabs.ts
|
|
5
|
+
const DEFAULT_VOICE = "21m00Tcm4TlvDq8ikWAM";
|
|
6
|
+
const DEFAULT_MODEL = "eleven_multilingual_v2";
|
|
7
|
+
function sanitizeForLog(value) {
|
|
8
|
+
return String(value ?? "").replace(/[\r\n\t]+/g, " ").replace(/[^\x20-\x7e]+/g, "?").slice(0, 200);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
|
|
12
|
+
* Convert text to speech via ElevenLabs API.
|
|
13
|
+
|
|
14
|
+
* Returns base64-encoded MP3 or null on error.
|
|
15
|
+
|
|
16
|
+
*/
|
|
17
|
+
async function textToSpeech(text, opts) {
|
|
18
|
+
const voiceId = opts.voiceId || DEFAULT_VOICE;
|
|
19
|
+
const modelId = opts.modelId || DEFAULT_MODEL;
|
|
20
|
+
const format = opts.outputFormat || "mp3_22050_32";
|
|
21
|
+
const body = JSON.stringify({
|
|
22
|
+
text,
|
|
23
|
+
model_id: modelId
|
|
24
|
+
});
|
|
25
|
+
const path = `/v1/text-to-speech/${voiceId}?output_format=${format}`;
|
|
26
|
+
return new Promise((resolve) => {
|
|
27
|
+
const req = https.default.request({
|
|
28
|
+
hostname: "api.elevenlabs.io",
|
|
29
|
+
port: 443,
|
|
30
|
+
path,
|
|
31
|
+
method: "POST",
|
|
32
|
+
headers: {
|
|
33
|
+
"Content-Type": "application/json",
|
|
34
|
+
"xi-api-key": opts.apiKey,
|
|
35
|
+
"Content-Length": Buffer.byteLength(body)
|
|
36
|
+
}
|
|
37
|
+
}, (res) => {
|
|
38
|
+
const chunks = [];
|
|
39
|
+
res.on("data", (c) => chunks.push(c));
|
|
40
|
+
res.on("end", () => {
|
|
41
|
+
const buf = Buffer.concat(chunks);
|
|
42
|
+
if (res.statusCode !== 200) {
|
|
43
|
+
console.warn(`[tts] ElevenLabs error ${res.statusCode}: ${sanitizeForLog(buf.toString("utf8", 0, 200))}`);
|
|
44
|
+
resolve(null);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
resolve(buf.toString("base64"));
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
req.on("error", (e) => {
|
|
51
|
+
console.warn("[tts] ElevenLabs request error:", sanitizeForLog(e.message));
|
|
52
|
+
resolve(null);
|
|
53
|
+
});
|
|
54
|
+
req.setTimeout(3e4, () => {
|
|
55
|
+
req.destroy();
|
|
56
|
+
resolve(null);
|
|
57
|
+
});
|
|
58
|
+
req.write(body);
|
|
59
|
+
req.end();
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
exports.textToSpeech = textToSpeech;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-jS-bbMI5.js');
|
|
2
|
+
const https = require_chunk.__toESM(require("https"));
|
|
3
|
+
|
|
4
|
+
//#region src/services/tts-elevenlabs.ts
|
|
5
|
+
const DEFAULT_VOICE = "21m00Tcm4TlvDq8ikWAM";
|
|
6
|
+
const DEFAULT_MODEL = "eleven_multilingual_v2";
|
|
7
|
+
function sanitizeForLog(value) {
|
|
8
|
+
return String(value ?? "").replace(/[\r\n\t]+/g, " ").replace(/[^\x20-\x7e]+/g, "?").slice(0, 200);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
|
|
12
|
+
* Convert text to speech via ElevenLabs API.
|
|
13
|
+
|
|
14
|
+
* Returns base64-encoded MP3 or null on error.
|
|
15
|
+
|
|
16
|
+
*/
|
|
17
|
+
async function textToSpeech(text, opts) {
|
|
18
|
+
const voiceId = opts.voiceId || DEFAULT_VOICE;
|
|
19
|
+
const modelId = opts.modelId || DEFAULT_MODEL;
|
|
20
|
+
const format = opts.outputFormat || "mp3_22050_32";
|
|
21
|
+
const body = JSON.stringify({
|
|
22
|
+
text,
|
|
23
|
+
model_id: modelId
|
|
24
|
+
});
|
|
25
|
+
const path = `/v1/text-to-speech/${voiceId}?output_format=${format}`;
|
|
26
|
+
return new Promise((resolve) => {
|
|
27
|
+
const req = https.default.request({
|
|
28
|
+
hostname: "api.elevenlabs.io",
|
|
29
|
+
port: 443,
|
|
30
|
+
path,
|
|
31
|
+
method: "POST",
|
|
32
|
+
headers: {
|
|
33
|
+
"Content-Type": "application/json",
|
|
34
|
+
"xi-api-key": opts.apiKey,
|
|
35
|
+
"Content-Length": Buffer.byteLength(body)
|
|
36
|
+
}
|
|
37
|
+
}, (res) => {
|
|
38
|
+
const chunks = [];
|
|
39
|
+
res.on("data", (c) => chunks.push(c));
|
|
40
|
+
res.on("end", () => {
|
|
41
|
+
const buf = Buffer.concat(chunks);
|
|
42
|
+
if (res.statusCode !== 200) {
|
|
43
|
+
console.warn(`[tts] ElevenLabs error ${res.statusCode}: ${sanitizeForLog(buf.toString("utf8", 0, 200))}`);
|
|
44
|
+
resolve(null);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
resolve(buf.toString("base64"));
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
req.on("error", (e) => {
|
|
51
|
+
console.warn("[tts] ElevenLabs request error:", sanitizeForLog(e.message));
|
|
52
|
+
resolve(null);
|
|
53
|
+
});
|
|
54
|
+
req.setTimeout(3e4, () => {
|
|
55
|
+
req.destroy();
|
|
56
|
+
resolve(null);
|
|
57
|
+
});
|
|
58
|
+
req.write(body);
|
|
59
|
+
req.end();
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
exports.textToSpeech = textToSpeech;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-jS-bbMI5.js');
|
|
2
|
+
const require_update_check = require('./update-check-GDue_it1.js');
|
|
3
|
+
|
|
4
|
+
exports.checkForUpdates = require_update_check.checkForUpdates;
|
|
5
|
+
exports.maybeShowUpdateNotice = require_update_check.maybeShowUpdateNotice;
|
|
6
|
+
exports.notifyUpdateAvailable = require_update_check.notifyUpdateAvailable;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-jS-bbMI5.js');
|
|
2
|
+
const chalk = require_chunk.__toESM(require("chalk"));
|
|
3
|
+
const fs_extra = require_chunk.__toESM(require("fs-extra"));
|
|
4
|
+
const path = require_chunk.__toESM(require("path"));
|
|
5
|
+
const https = require_chunk.__toESM(require("https"));
|
|
6
|
+
|
|
7
|
+
//#region src/infra/update-check.ts
|
|
8
|
+
const NPM_REGISTRY = "https://registry.npmjs.org";
|
|
9
|
+
const PACKAGE_NAME = "hyperclaw";
|
|
10
|
+
function parseVersion(v) {
|
|
11
|
+
const match = v.replace(/^v/, "").match(/^(\d+)\.(\d+)\.(\d+)/);
|
|
12
|
+
if (!match) return [
|
|
13
|
+
0,
|
|
14
|
+
0,
|
|
15
|
+
0
|
|
16
|
+
];
|
|
17
|
+
return [
|
|
18
|
+
parseInt(match[1], 10),
|
|
19
|
+
parseInt(match[2], 10),
|
|
20
|
+
parseInt(match[3], 10)
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
function isNewer(latest, current) {
|
|
24
|
+
const a = parseVersion(latest);
|
|
25
|
+
const b = parseVersion(current);
|
|
26
|
+
for (let i = 0; i < 3; i++) {
|
|
27
|
+
if (a[i] > b[i]) return true;
|
|
28
|
+
if (a[i] < b[i]) return false;
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
async function checkForUpdates(currentVersion) {
|
|
33
|
+
if (process.env.HYPERCLAW_NO_UPDATE_CHECK === "1") return null;
|
|
34
|
+
return new Promise((resolve) => {
|
|
35
|
+
const req = https.default.get(`${NPM_REGISTRY}/${PACKAGE_NAME}/latest`, { timeout: 3e3 }, (res) => {
|
|
36
|
+
let data = "";
|
|
37
|
+
res.on("data", (chunk) => data += chunk);
|
|
38
|
+
res.on("end", () => {
|
|
39
|
+
try {
|
|
40
|
+
const json = JSON.parse(data);
|
|
41
|
+
const latest = json?.version;
|
|
42
|
+
if (!latest || typeof latest !== "string") {
|
|
43
|
+
resolve(null);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
resolve({
|
|
47
|
+
latest,
|
|
48
|
+
available: isNewer(latest, currentVersion)
|
|
49
|
+
});
|
|
50
|
+
} catch {
|
|
51
|
+
resolve(null);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
req.on("error", () => resolve(null));
|
|
56
|
+
req.on("timeout", () => {
|
|
57
|
+
req.destroy();
|
|
58
|
+
resolve(null);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function notifyUpdateAvailable(current, latest) {
|
|
63
|
+
console.log(chalk.default.yellow(` 🦅 Update available: ${latest} (you have ${current})`));
|
|
64
|
+
console.log(chalk.default.gray(" Run: npm i -g hyperclaw\n"));
|
|
65
|
+
}
|
|
66
|
+
/** Fire-and-forget: check for updates and notify user if available. Call after banner/startup. */
|
|
67
|
+
function maybeShowUpdateNotice(skipInDaemon = false) {
|
|
68
|
+
if (skipInDaemon) return;
|
|
69
|
+
(async () => {
|
|
70
|
+
try {
|
|
71
|
+
const pkgPath = path.default.join(__dirname, "../package.json");
|
|
72
|
+
const pkg = await fs_extra.default.readJson(pkgPath).catch(() => null);
|
|
73
|
+
const current = pkg?.version ?? "0.0.0";
|
|
74
|
+
const result = await checkForUpdates(current);
|
|
75
|
+
if (result?.available) notifyUpdateAvailable(current, result.latest);
|
|
76
|
+
} catch {}
|
|
77
|
+
})().catch(() => {});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
Object.defineProperty(exports, 'checkForUpdates', {
|
|
82
|
+
enumerable: true,
|
|
83
|
+
get: function () {
|
|
84
|
+
return checkForUpdates;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
Object.defineProperty(exports, 'maybeShowUpdateNotice', {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () {
|
|
90
|
+
return maybeShowUpdateNotice;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
Object.defineProperty(exports, 'notifyUpdateAvailable', {
|
|
94
|
+
enumerable: true,
|
|
95
|
+
get: function () {
|
|
96
|
+
return notifyUpdateAvailable;
|
|
97
|
+
}
|
|
98
|
+
});
|