hyperclaw 4.0.2 → 5.0.1

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 (194) hide show
  1. package/README.md +246 -60
  2. package/dist/a2ui-protocol-CfBI44-Q.js +75 -0
  3. package/dist/agents-routing-ChHiZp36.js +327 -0
  4. package/dist/agents-routing-ChqZ6l2S.js +4 -0
  5. package/dist/api-keys-guide-BCcOl0Q7.js +149 -0
  6. package/dist/api-keys-guide-CGn5BSF7.js +149 -0
  7. package/dist/audit-BJohI_vC.js +441 -0
  8. package/dist/audit-BaIiyWFu.js +441 -0
  9. package/dist/bounty-tools-CY_i91DU.js +211 -0
  10. package/dist/bounty-tools-DWudyZie.js +211 -0
  11. package/dist/browser-tools-BsTeGMnX.js +5 -0
  12. package/dist/browser-tools-D8_rLe2p.js +179 -0
  13. package/dist/claw-tasks-CgTsiNE8.js +80 -0
  14. package/dist/claw-tasks-Cyzdbhz_.js +80 -0
  15. package/dist/connector-5N0-X_xs.js +194 -0
  16. package/dist/connector-B3v0qcXg.js +425 -0
  17. package/dist/connector-B8R3iBY1.js +280 -0
  18. package/dist/connector-BAM-08NN.js +189 -0
  19. package/dist/connector-BC8FIVu4.js +181 -0
  20. package/dist/connector-BDmwwaVc.js +213 -0
  21. package/dist/connector-BGjbBy69.js +225 -0
  22. package/dist/connector-BO2SRzfG.js +218 -0
  23. package/dist/connector-BfXky0L3.js +167 -0
  24. package/dist/connector-BiiSJpx3.js +192 -0
  25. package/dist/connector-BnDmIhIu.js +85 -0
  26. package/dist/connector-C1HSoUyk.js +189 -0
  27. package/dist/connector-CKQHZOXg.js +568 -0
  28. package/dist/connector-CRl-iidy.js +239 -0
  29. package/dist/connector-Ci9glMD-.js +340 -0
  30. package/dist/connector-CjtZIEDj.js +181 -0
  31. package/dist/connector-Ck6JtOsX.js +531 -0
  32. package/dist/connector-D8Kelee0.js +286 -0
  33. package/dist/connector-DAnRJ0oP.js +162 -0
  34. package/dist/connector-DXTp5PE8.js +508 -0
  35. package/dist/connector-Dih6dUPP.js +173 -0
  36. package/dist/connector-DqTH_tPX.js +182 -0
  37. package/dist/connector-DrnEiiyP.js +419 -0
  38. package/dist/connector-DtR5GGTX.js +167 -0
  39. package/dist/connector-Tky_qS_K.js +350 -0
  40. package/dist/connector-ZSc3oTTy.js +305 -0
  41. package/dist/connector-sW5yhU1m.js +498 -0
  42. package/dist/connector-u3ICd3Ic.js +552 -0
  43. package/dist/cost-tracker-Ca1UPZ33.js +103 -0
  44. package/dist/cost-tracker-DD9wtWsr.js +103 -0
  45. package/dist/credentials-store-C6ir0Dae.js +4 -0
  46. package/dist/credentials-store-CA8UtK0T.js +77 -0
  47. package/dist/credentials-store-Cm7DH-kh.js +4 -0
  48. package/dist/credentials-store-H13LqOwJ.js +77 -0
  49. package/dist/cron-tasks-Bli7Kzd2.js +82 -0
  50. package/dist/cron-tasks-_pqQCmxc.js +82 -0
  51. package/dist/daemon-7ViroziB.js +5 -0
  52. package/dist/daemon-BfyKmZhr.js +318 -0
  53. package/dist/daemon-Bg4GtCmc.js +318 -0
  54. package/dist/daemon-DhmwY8k4.js +5 -0
  55. package/dist/delivery-BmIYy9VQ.js +4 -0
  56. package/dist/delivery-DVHmv1IR.js +4 -0
  57. package/dist/delivery-DpMX0Yyc.js +95 -0
  58. package/dist/delivery-pWUPBp1F.js +95 -0
  59. package/dist/destructive-gate-D6vWOdEl.js +101 -0
  60. package/dist/destructive-gate-DZt71UZR.js +101 -0
  61. package/dist/developer-keys-CPWT7Q6S.js +8 -0
  62. package/dist/developer-keys-DrrcUqFa.js +127 -0
  63. package/dist/doctor-BvCe8BBk.js +230 -0
  64. package/dist/doctor-CxyPLYsJ.js +6 -0
  65. package/dist/engine-B0kLfRL0.js +256 -0
  66. package/dist/engine-BJUpRUOv.js +7 -0
  67. package/dist/engine-CEDSqXfw.js +256 -0
  68. package/dist/engine-Da4JMNpI.js +7 -0
  69. package/dist/env-resolve-17ekEU6p.js +10 -0
  70. package/dist/env-resolve-CiXbWYwe.js +10 -0
  71. package/dist/env-resolve-CmGWhWXJ.js +115 -0
  72. package/dist/env-resolve-Z2XF6leB.js +115 -0
  73. package/dist/extraction-tools-HOZstZ0y.js +91 -0
  74. package/dist/extraction-tools-m4lmAv7l.js +5 -0
  75. package/dist/form_data-Cz040rio.js +8657 -0
  76. package/dist/gmail-watch-setup-Du7DVV7S.js +40 -0
  77. package/dist/health-B-asI__D.js +6 -0
  78. package/dist/health-Ds2YlpTB.js +152 -0
  79. package/dist/heartbeat-engine-BYT5ayQH.js +83 -0
  80. package/dist/heartbeat-engine-Ut6pXBD6.js +83 -0
  81. package/dist/hub-9LaKnLjY.js +6 -0
  82. package/dist/hub-CfwUz9YW.js +515 -0
  83. package/dist/hub-D0XwdjM-.js +515 -0
  84. package/dist/hub-LiD5Iztb.js +6 -0
  85. package/dist/hyperclawbot-CBiDSKsa.js +505 -0
  86. package/dist/hyperclawbot-zvczQgKx.js +505 -0
  87. package/dist/inference-0mlFQqIm.js +922 -0
  88. package/dist/inference-BKVkBREb.js +6 -0
  89. package/dist/inference-DCXH4Q3x.js +922 -0
  90. package/dist/inference-SzqFe_nk.js +6 -0
  91. package/dist/knowledge-graph-DE5lSF02.js +131 -0
  92. package/dist/knowledge-graph-iBG76fvm.js +131 -0
  93. package/dist/loader-BkDi8MD9.js +400 -0
  94. package/dist/loader-CC45xGpC.js +4 -0
  95. package/dist/loader-CnEdOyjT.js +400 -0
  96. package/dist/loader-DI2qDRPC.js +4 -0
  97. package/dist/logger-Cp8wC7F8.js +83 -0
  98. package/dist/logger-ybOp7VOC.js +83 -0
  99. package/dist/manager-03ipO9R0.js +105 -0
  100. package/dist/manager-B2Gls5RG.js +218 -0
  101. package/dist/manager-BpDfbDjg.js +117 -0
  102. package/dist/manager-Bxl0sqlh.js +4 -0
  103. package/dist/manager-CWNSML5D.js +117 -0
  104. package/dist/manager-CrVDn6eN.js +6 -0
  105. package/dist/manager-FCgF1plu.js +218 -0
  106. package/dist/manager-SJe9gt-q.js +4 -0
  107. package/dist/manager-rgCsaWT1.js +40 -0
  108. package/dist/mcp-CfoSU4Uz.js +139 -0
  109. package/dist/mcp-loader-CvxRDtPC.js +94 -0
  110. package/dist/mcp-loader-DkRBsLpk.js +94 -0
  111. package/dist/memory-BlHL7JCO.js +4 -0
  112. package/dist/memory-DsS_eFvJ.js +270 -0
  113. package/dist/memory-auto-BkvtSFUw.js +5 -0
  114. package/dist/memory-auto-Bnz_-1wP.js +306 -0
  115. package/dist/memory-auto-CpQHZlEJ.js +306 -0
  116. package/dist/memory-auto-Z6LCf-iK.js +5 -0
  117. package/dist/memory-integration-cSYkZyEo.js +91 -0
  118. package/dist/memory-integration-g2vxwgoE.js +91 -0
  119. package/dist/moltbook-BtLDZTfM.js +81 -0
  120. package/dist/moltbook-Cl8cQfxJ.js +81 -0
  121. package/dist/node-Dw2Gi-cP.js +222 -0
  122. package/dist/nodes-registry-B8dmrlLv.js +52 -0
  123. package/dist/nodes-registry-C9dCFwjh.js +52 -0
  124. package/dist/oauth-flow-CeaaGAz0.js +150 -0
  125. package/dist/oauth-flow-DQPvMHRH.js +150 -0
  126. package/dist/oauth-provider-B4dzn56l.js +110 -0
  127. package/dist/oauth-provider-Uo4Nib_c.js +110 -0
  128. package/dist/observability-BV-Yx0V9.js +89 -0
  129. package/dist/observability-nZ3CBIxG.js +89 -0
  130. package/dist/onboard-0WoDxbv_.js +10 -0
  131. package/dist/onboard-BBBWcfhp.js +10 -0
  132. package/dist/onboard-BXNXCQp4.js +4070 -0
  133. package/dist/onboard-Bw28IRQ3.js +4070 -0
  134. package/dist/orchestrator-BovkM63z.js +6 -0
  135. package/dist/orchestrator-DSbpkP1X.js +189 -0
  136. package/dist/orchestrator-DmnEvMaL.js +189 -0
  137. package/dist/orchestrator-RI3bpqqc.js +6 -0
  138. package/dist/osint-B4_m3VHQ.js +277 -0
  139. package/dist/pairing-6iM27aD8.js +196 -0
  140. package/dist/pairing-dGoiGepK.js +4 -0
  141. package/dist/pc-access-CgCsYrpt.js +8 -0
  142. package/dist/pc-access-_iH2aorG.js +819 -0
  143. package/dist/pending-approval-BgNjjuI2.js +22 -0
  144. package/dist/pending-approval-CUXjysAo.js +22 -0
  145. package/dist/reminders-store-Drjed_-h.js +58 -0
  146. package/dist/renderer-BVQrd0_g.js +225 -0
  147. package/dist/rules-BE4GV6cV.js +103 -0
  148. package/dist/run-main.js +1639 -460
  149. package/dist/runner-CJFJUtPm.js +1271 -0
  150. package/dist/runner-DatMMYYE.js +1271 -0
  151. package/dist/sdk/index.js +2 -2
  152. package/dist/sdk/index.mjs +2 -2
  153. package/dist/security-BqNyT4ID.js +4 -0
  154. package/dist/security-tpgqPWWH.js +73 -0
  155. package/dist/server-Brl_HQUB.js +1255 -0
  156. package/dist/server-D4wVHiX9.js +4 -0
  157. package/dist/server-Dh3JlBFB.js +1255 -0
  158. package/dist/server-DhfipkwN.js +4 -0
  159. package/dist/session-store-BUiPz0Vv.js +5 -0
  160. package/dist/session-store-is4B6qmD.js +113 -0
  161. package/dist/sessions-tools-CbUTFe4i.js +5 -0
  162. package/dist/sessions-tools-CeqD7iil.js +95 -0
  163. package/dist/skill-loader-BaNLVmJy.js +7 -0
  164. package/dist/skill-loader-HgpF6Vqs.js +159 -0
  165. package/dist/skill-runtime-BXWd-Ktf.js +102 -0
  166. package/dist/skill-runtime-CJN24QPW.js +102 -0
  167. package/dist/skill-runtime-jgklm02e.js +5 -0
  168. package/dist/skill-runtime-w1ig_lcw.js +5 -0
  169. package/dist/src-Bhybpk1J.js +63 -0
  170. package/dist/src-BxPHKO5x.js +63 -0
  171. package/dist/src-DIc-L2IG.js +20 -0
  172. package/dist/src-DMJ4-uqk.js +458 -0
  173. package/dist/src-g_rNx5rh.js +458 -0
  174. package/dist/sub-agent-tools-CHQoHz9c.js +39 -0
  175. package/dist/sub-agent-tools-DHY-4WWM.js +39 -0
  176. package/dist/theme-DcxwcUgZ.js +180 -0
  177. package/dist/theme-cx0fkgWC.js +8 -0
  178. package/dist/tool-policy-CNT-mF2Z.js +189 -0
  179. package/dist/tool-policy-DZvF8xlQ.js +189 -0
  180. package/dist/tts-elevenlabs-BRosZv-f.js +61 -0
  181. package/dist/tts-elevenlabs-C06nUxMK.js +61 -0
  182. package/dist/update-check-C2Dz85wJ.js +81 -0
  183. package/dist/update-check-w4XuxVl7.js +81 -0
  184. package/dist/vision-BMmiIKy7.js +121 -0
  185. package/dist/vision-JOtOS1Br.js +121 -0
  186. package/dist/vision-tools-CB28ZCO_.js +5 -0
  187. package/dist/vision-tools-DVuYc17I.js +51 -0
  188. package/dist/vision-tools-U3YC4L-g.js +5 -0
  189. package/dist/vision-tools-vPPwQ-0N.js +51 -0
  190. package/dist/voice-transcription-B555DbWR.js +138 -0
  191. package/dist/voice-transcription-DBo5hXmu.js +138 -0
  192. package/dist/website-watch-tools-DFMrJU-R.js +139 -0
  193. package/dist/website-watch-tools-Du3W5sN7.js +5 -0
  194. package/package.json +1 -1
@@ -0,0 +1,180 @@
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 os = require_chunk.__toESM(require("os"));
6
+
7
+ //#region src/infra/theme.ts
8
+ var theme_exports = {};
9
+ require_chunk.__export(theme_exports, {
10
+ allThemes: () => allThemes,
11
+ getTheme: () => getTheme,
12
+ getThemeName: () => getThemeName,
13
+ primary: () => primary,
14
+ setThemeName: () => setThemeName
15
+ });
16
+ function getThemeName() {
17
+ if (_cached) return _cached;
18
+ try {
19
+ const raw = fs_extra.default.readJsonSync(THEME_FILE);
20
+ if (raw?.name && raw.name in THEMES) {
21
+ _cached = raw.name;
22
+ return _cached;
23
+ }
24
+ } catch {}
25
+ return "dark";
26
+ }
27
+ async function setThemeName(name) {
28
+ await fs_extra.default.ensureDir(path.default.dirname(THEME_FILE));
29
+ await fs_extra.default.writeJson(THEME_FILE, { name }, { spaces: 2 });
30
+ _cached = name;
31
+ }
32
+ function getTheme(daemon = false) {
33
+ const t = THEMES[getThemeName()];
34
+ const c = (s) => chalk.default.hex(t.primary)(s);
35
+ const d = (s) => chalk.default.hex(t.daemonPrimary)(s);
36
+ const a = daemon ? d : c;
37
+ return {
38
+ ...t,
39
+ c,
40
+ d,
41
+ a,
42
+ bold: (s) => chalk.default.bold.hex(daemon ? t.daemonPrimary : t.primary)(s)
43
+ };
44
+ }
45
+ /** Returns chalk fn for primary color (non-daemon). */
46
+ function primary() {
47
+ return (s) => chalk.default.hex(THEMES[getThemeName()].primary)(s);
48
+ }
49
+ function allThemes() {
50
+ return Object.entries(THEMES).map(([name, t]) => ({
51
+ name,
52
+ label: t.label
53
+ }));
54
+ }
55
+ var THEMES, THEME_FILE, _cached;
56
+ var init_theme = require_chunk.__esm({ "src/infra/theme.ts"() {
57
+ THEMES = {
58
+ dark: {
59
+ label: "Dark Professional (default)",
60
+ primary: "#06b6d4",
61
+ primaryLight: "#22d3ee",
62
+ primaryXLight: "#67e8f9",
63
+ daemonPrimary: "#dc2626",
64
+ borderColor: "cyan",
65
+ daemonBorderColor: "red",
66
+ boxBg: "#0a0a0a",
67
+ gradient: [
68
+ "#06b6d4",
69
+ "#22d3ee",
70
+ "#67e8f9"
71
+ ],
72
+ daemonGradient: [
73
+ "#dc2626",
74
+ "#ef4444",
75
+ "#fca5a5"
76
+ ],
77
+ secondary: (s) => chalk.default.white(s),
78
+ muted: (s) => chalk.default.gray(s),
79
+ success: (s) => chalk.default.green(s),
80
+ warning: (s) => chalk.default.yellow(s),
81
+ error: (s) => chalk.default.red(s)
82
+ },
83
+ grey: {
84
+ label: "Grey Professional",
85
+ primary: "#06b6d4",
86
+ primaryLight: "#22d3ee",
87
+ primaryXLight: "#a5f3fc",
88
+ daemonPrimary: "#dc2626",
89
+ borderColor: "gray",
90
+ daemonBorderColor: "red",
91
+ boxBg: "",
92
+ gradient: [
93
+ "#64748b",
94
+ "#06b6d4",
95
+ "#22d3ee"
96
+ ],
97
+ daemonGradient: [
98
+ "#6b7280",
99
+ "#dc2626",
100
+ "#ef4444"
101
+ ],
102
+ secondary: (s) => chalk.default.hex("#d1d5db")(s),
103
+ muted: (s) => chalk.default.hex("#6b7280")(s),
104
+ success: (s) => chalk.default.hex("#10b981")(s),
105
+ warning: (s) => chalk.default.hex("#f59e0b")(s),
106
+ error: (s) => chalk.default.hex("#ef4444")(s)
107
+ },
108
+ white: {
109
+ label: "White / Light Professional",
110
+ primary: "#0284c7",
111
+ primaryLight: "#0ea5e9",
112
+ primaryXLight: "#38bdf8",
113
+ daemonPrimary: "#b91c1c",
114
+ borderColor: "blue",
115
+ daemonBorderColor: "red",
116
+ boxBg: "",
117
+ gradient: [
118
+ "#0369a1",
119
+ "#0284c7",
120
+ "#0ea5e9"
121
+ ],
122
+ daemonGradient: [
123
+ "#991b1b",
124
+ "#b91c1c",
125
+ "#dc2626"
126
+ ],
127
+ secondary: (s) => chalk.default.black(s),
128
+ muted: (s) => chalk.default.hex("#374151")(s),
129
+ success: (s) => chalk.default.hex("#065f46")(s),
130
+ warning: (s) => chalk.default.hex("#92400e")(s),
131
+ error: (s) => chalk.default.hex("#991b1b")(s)
132
+ }
133
+ };
134
+ THEME_FILE = path.default.join(os.default.homedir(), ".hyperclaw", "theme.json");
135
+ _cached = null;
136
+ } });
137
+
138
+ //#endregion
139
+ Object.defineProperty(exports, 'allThemes', {
140
+ enumerable: true,
141
+ get: function () {
142
+ return allThemes;
143
+ }
144
+ });
145
+ Object.defineProperty(exports, 'getTheme', {
146
+ enumerable: true,
147
+ get: function () {
148
+ return getTheme;
149
+ }
150
+ });
151
+ Object.defineProperty(exports, 'getThemeName', {
152
+ enumerable: true,
153
+ get: function () {
154
+ return getThemeName;
155
+ }
156
+ });
157
+ Object.defineProperty(exports, 'init_theme', {
158
+ enumerable: true,
159
+ get: function () {
160
+ return init_theme;
161
+ }
162
+ });
163
+ Object.defineProperty(exports, 'primary', {
164
+ enumerable: true,
165
+ get: function () {
166
+ return primary;
167
+ }
168
+ });
169
+ Object.defineProperty(exports, 'setThemeName', {
170
+ enumerable: true,
171
+ get: function () {
172
+ return setThemeName;
173
+ }
174
+ });
175
+ Object.defineProperty(exports, 'theme_exports', {
176
+ enumerable: true,
177
+ get: function () {
178
+ return theme_exports;
179
+ }
180
+ });
@@ -0,0 +1,8 @@
1
+ const require_chunk = require('./chunk-jS-bbMI5.js');
2
+ const require_theme = require('./theme-DcxwcUgZ.js');
3
+
4
+ require_theme.init_theme();
5
+ exports.allThemes = require_theme.allThemes;
6
+ exports.getTheme = require_theme.getTheme;
7
+ exports.getThemeName = require_theme.getThemeName;
8
+ exports.setThemeName = require_theme.setThemeName;
@@ -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,61 @@
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
+ /**
8
+
9
+ * Convert text to speech via ElevenLabs API.
10
+
11
+ * Returns base64-encoded MP3 or null on error.
12
+
13
+ */
14
+ async function textToSpeech(text, opts) {
15
+ const voiceId = opts.voiceId || DEFAULT_VOICE;
16
+ const modelId = opts.modelId || DEFAULT_MODEL;
17
+ const format = opts.outputFormat || "mp3_22050_32";
18
+ const body = JSON.stringify({
19
+ text,
20
+ model_id: modelId
21
+ });
22
+ const path = `/v1/text-to-speech/${voiceId}?output_format=${format}`;
23
+ return new Promise((resolve) => {
24
+ const req = https.default.request({
25
+ hostname: "api.elevenlabs.io",
26
+ port: 443,
27
+ path,
28
+ method: "POST",
29
+ headers: {
30
+ "Content-Type": "application/json",
31
+ "xi-api-key": opts.apiKey,
32
+ "Content-Length": Buffer.byteLength(body)
33
+ }
34
+ }, (res) => {
35
+ const chunks = [];
36
+ res.on("data", (c) => chunks.push(c));
37
+ res.on("end", () => {
38
+ const buf = Buffer.concat(chunks);
39
+ if (res.statusCode !== 200) {
40
+ console.warn(`[tts] ElevenLabs error ${res.statusCode}: ${buf.slice(0, 200)}`);
41
+ resolve(null);
42
+ return;
43
+ }
44
+ resolve(buf.toString("base64"));
45
+ });
46
+ });
47
+ req.on("error", (e) => {
48
+ console.warn("[tts] ElevenLabs request error:", e.message);
49
+ resolve(null);
50
+ });
51
+ req.setTimeout(3e4, () => {
52
+ req.destroy();
53
+ resolve(null);
54
+ });
55
+ req.write(body);
56
+ req.end();
57
+ });
58
+ }
59
+
60
+ //#endregion
61
+ exports.textToSpeech = textToSpeech;
@@ -0,0 +1,61 @@
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
+ /**
8
+
9
+ * Convert text to speech via ElevenLabs API.
10
+
11
+ * Returns base64-encoded MP3 or null on error.
12
+
13
+ */
14
+ async function textToSpeech(text, opts) {
15
+ const voiceId = opts.voiceId || DEFAULT_VOICE;
16
+ const modelId = opts.modelId || DEFAULT_MODEL;
17
+ const format = opts.outputFormat || "mp3_22050_32";
18
+ const body = JSON.stringify({
19
+ text,
20
+ model_id: modelId
21
+ });
22
+ const path = `/v1/text-to-speech/${voiceId}?output_format=${format}`;
23
+ return new Promise((resolve) => {
24
+ const req = https.default.request({
25
+ hostname: "api.elevenlabs.io",
26
+ port: 443,
27
+ path,
28
+ method: "POST",
29
+ headers: {
30
+ "Content-Type": "application/json",
31
+ "xi-api-key": opts.apiKey,
32
+ "Content-Length": Buffer.byteLength(body)
33
+ }
34
+ }, (res) => {
35
+ const chunks = [];
36
+ res.on("data", (c) => chunks.push(c));
37
+ res.on("end", () => {
38
+ const buf = Buffer.concat(chunks);
39
+ if (res.statusCode !== 200) {
40
+ console.warn(`[tts] ElevenLabs error ${res.statusCode}: ${buf.slice(0, 200)}`);
41
+ resolve(null);
42
+ return;
43
+ }
44
+ resolve(buf.toString("base64"));
45
+ });
46
+ });
47
+ req.on("error", (e) => {
48
+ console.warn("[tts] ElevenLabs request error:", e.message);
49
+ resolve(null);
50
+ });
51
+ req.setTimeout(3e4, () => {
52
+ req.destroy();
53
+ resolve(null);
54
+ });
55
+ req.write(body);
56
+ req.end();
57
+ });
58
+ }
59
+
60
+ //#endregion
61
+ exports.textToSpeech = textToSpeech;