hyperclaw 4.0.0 → 4.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.
Files changed (156) hide show
  1. package/README.md +53 -18
  2. package/dist/a2ui-protocol-CT_jDEU9.js +75 -0
  3. package/dist/agents-routing-683Q2JGp.js +129 -0
  4. package/dist/agents-routing-BpZBswBH.js +4 -0
  5. package/dist/api-keys-guide-Bzig1R5W.js +149 -0
  6. package/dist/api-keys-guide-Dq5Obbp4.js +149 -0
  7. package/dist/audit-BYxPlnTQ.js +248 -0
  8. package/dist/bounty-tools-C6LyzxM-.js +211 -0
  9. package/dist/browser-tools-CQBSbIuO.js +5 -0
  10. package/dist/browser-tools-YQmwRLLM.js +179 -0
  11. package/dist/claw-tasks-BRLUvFRD.js +80 -0
  12. package/dist/connector-3HnyH8fn.js +167 -0
  13. package/dist/connector-6PMZo5Ky.js +189 -0
  14. package/dist/connector-B6eoF3DD.js +181 -0
  15. package/dist/connector-B9tLG8UZ.js +196 -0
  16. package/dist/connector-BOlqjXWP.js +182 -0
  17. package/dist/connector-BP8zsbP8.js +189 -0
  18. package/dist/connector-BPoSevxp.js +286 -0
  19. package/dist/connector-BRHj773i.js +163 -0
  20. package/dist/connector-BToxU-jV.js +267 -0
  21. package/dist/connector-BliDVsJQ.js +239 -0
  22. package/dist/connector-Bv6s9oP7.js +88 -0
  23. package/dist/connector-By5wWGTR.js +343 -0
  24. package/dist/connector-C1BaFFgN.js +213 -0
  25. package/dist/connector-CRRWY5Wv.js +167 -0
  26. package/dist/connector-CXPQVGyI.js +85 -0
  27. package/dist/connector-Cdk1CXKi.js +194 -0
  28. package/dist/connector-CwlgFgjx.js +181 -0
  29. package/dist/connector-DFchk6l7.js +178 -0
  30. package/dist/connector-DKw7tRAy.js +192 -0
  31. package/dist/connector-DRv1ahC_.js +343 -0
  32. package/dist/connector-DU63KW94.js +165 -0
  33. package/dist/connector-Dbvb1Cj9.js +280 -0
  34. package/dist/connector-DcZdQcgR.js +173 -0
  35. package/dist/connector-DxKL8VvZ.js +182 -0
  36. package/dist/connector-T_YdZtzv.js +162 -0
  37. package/dist/connector-i4gOS9xL.js +154 -0
  38. package/dist/connector-rHXE1ZD2.js +167 -0
  39. package/dist/connector-wdUXChwa.js +172 -0
  40. package/dist/cost-tracker-pVE15Yq4.js +103 -0
  41. package/dist/credentials-store-BvnMPJwi.js +4 -0
  42. package/dist/credentials-store-sb-TRLwR.js +77 -0
  43. package/dist/cron-tasks-BvDFNyiE.js +82 -0
  44. package/dist/delivery-B-SJqXLn.js +95 -0
  45. package/dist/delivery-D5Z98EVq.js +95 -0
  46. package/dist/delivery-DCOXhXEO.js +5 -0
  47. package/dist/delivery-VgFeuu2J.js +5 -0
  48. package/dist/destructive-gate-m-dWqUFg.js +101 -0
  49. package/dist/developer-keys-JaJK3T27.js +127 -0
  50. package/dist/developer-keys-kyqmtWK3.js +8 -0
  51. package/dist/doctor-3oi89QIc.js +175 -0
  52. package/dist/doctor-Cf1XSfp9.js +4 -0
  53. package/dist/engine-B4eMiTgl.js +7 -0
  54. package/dist/engine-B8M7dYul.js +7 -0
  55. package/dist/engine-BhT-1M9W.js +256 -0
  56. package/dist/engine-D49jnSd_.js +256 -0
  57. package/dist/env-resolve-DWOQ45jG.js +9 -0
  58. package/dist/env-resolve-szSWl0UF.js +94 -0
  59. package/dist/extraction-tools-D3qDFBJ1.js +91 -0
  60. package/dist/extraction-tools-DLr_AEwq.js +5 -0
  61. package/dist/form_data-B_hIUrxU.js +8657 -0
  62. package/dist/gmail-watch-setup-Czt8rXaX.js +40 -0
  63. package/dist/heartbeat-engine-CRqfPcFM.js +83 -0
  64. package/dist/hub-DTsqe5Bt.js +6 -0
  65. package/dist/hub-FrPTA33j.js +515 -0
  66. package/dist/hyperclawbot-D9KCtc4P.js +480 -0
  67. package/dist/hyperclawbot-DfMGowZC.js +480 -0
  68. package/dist/hyperclawbot-Dw27pJo4.js +480 -0
  69. package/dist/inference-CTWJeX9Q.js +922 -0
  70. package/dist/inference-ix607p7k.js +6 -0
  71. package/dist/knowledge-graph-DqA-Fztl.js +131 -0
  72. package/dist/loader-CISCqBto.js +400 -0
  73. package/dist/loader-CYMQ8VOS.js +4 -0
  74. package/dist/logger-8tEtAd3y.js +83 -0
  75. package/dist/manager-CPjeRe-6.js +4 -0
  76. package/dist/manager-Cwzj7w5R.js +105 -0
  77. package/dist/manager-DLmZI-9R.js +6 -0
  78. package/dist/manager-DSGhn5i3.js +117 -0
  79. package/dist/manager-DgyF52mg.js +218 -0
  80. package/dist/manager-Dm8nrMFx.js +40 -0
  81. package/dist/mcp-B_9Ber63.js +139 -0
  82. package/dist/mcp-loader-DSM5UiFG.js +94 -0
  83. package/dist/mcp-loader-j5ZLLw5O.js +94 -0
  84. package/dist/memory-BI1kPkAN.js +4 -0
  85. package/dist/memory-BVFGkxxK.js +270 -0
  86. package/dist/memory-auto-Bc7euou4.js +306 -0
  87. package/dist/memory-auto-DPfbkMVt.js +5 -0
  88. package/dist/memory-integration-DZExqWr4.js +91 -0
  89. package/dist/moltbook-B6ZeGN5_.js +81 -0
  90. package/dist/node-pwL6O_KX.js +222 -0
  91. package/dist/nodes-registry-CsPm_-CJ.js +52 -0
  92. package/dist/oauth-flow-CpWlgvNB.js +150 -0
  93. package/dist/oauth-provider-BZb6qOw5.js +110 -0
  94. package/dist/observability-B43YvNQV.js +89 -0
  95. package/dist/onboard-3q20ZyHj.js +9 -0
  96. package/dist/onboard-Bd_wsYdi.js +4086 -0
  97. package/dist/onboard-CAN7x3me.js +3026 -0
  98. package/dist/onboard-DnegOHMh.js +3026 -0
  99. package/dist/onboard-RYtDlYBw.js +9 -0
  100. package/dist/onboard-aTwlQs-4.js +9 -0
  101. package/dist/orchestrator-BSp2M5EU.js +189 -0
  102. package/dist/orchestrator-C7ko5tWa.js +6 -0
  103. package/dist/orchestrator-DfPkIx2Z.js +6 -0
  104. package/dist/orchestrator-NJQsmiBE.js +189 -0
  105. package/dist/pairing-DU0_J28n.js +87 -0
  106. package/dist/pairing-DWllbSbO.js +4 -0
  107. package/dist/pc-access-Ly-uA8mn.js +8 -0
  108. package/dist/pc-access-NxBvTrRj.js +819 -0
  109. package/dist/pending-approval-DIHvwwWS.js +22 -0
  110. package/dist/puppeteer-2o3QOwAy.js +2 -2
  111. package/dist/puppeteer-BYTMp3BI.js +2 -2
  112. package/dist/puppeteer-DQ45qwWk.js +2 -2
  113. package/dist/reminders-store-D79qdfN0.js +58 -0
  114. package/dist/renderer-pqlDRKbH.js +225 -0
  115. package/dist/rules-BooT_qFP.js +103 -0
  116. package/dist/run-main.js +366 -1109
  117. package/dist/runner-Bu--_RXw.js +810 -0
  118. package/dist/runner-D1rjuMTJ.js +810 -0
  119. package/dist/sdk/index.js +2 -2
  120. package/dist/sdk/index.mjs +2 -2
  121. package/dist/security-C-5URby1.js +73 -0
  122. package/dist/security-_xve79aq.js +4 -0
  123. package/dist/server-0kgyELx4.js +1047 -0
  124. package/dist/server-BIuTobTC.js +4 -0
  125. package/dist/server-BRlCEjyT.js +1047 -0
  126. package/dist/server-CCI1hv45.js +1047 -0
  127. package/dist/server-DU9POoWc.js +4 -0
  128. package/dist/server-RBqwE_GN.js +4 -0
  129. package/dist/session-store-CujxByI6.js +113 -0
  130. package/dist/session-store-qpJUg2M1.js +5 -0
  131. package/dist/sessions-tools-CB2qbwIk.js +5 -0
  132. package/dist/sessions-tools-DHMaTZIs.js +95 -0
  133. package/dist/skill-loader-BkceKkIg.js +7 -0
  134. package/dist/skill-loader-DhgIwK4J.js +159 -0
  135. package/dist/skill-runtime--LqxWrp5.js +102 -0
  136. package/dist/skill-runtime-C5l0Tgt-.js +5 -0
  137. package/dist/skill-runtime-DsXK_HYG.js +102 -0
  138. package/dist/skill-runtime-IVTiqrMR.js +5 -0
  139. package/dist/src-BEVLgaF1.js +63 -0
  140. package/dist/src-Bgu_OxTQ.js +458 -0
  141. package/dist/src-Bq-oKt7Z.js +458 -0
  142. package/dist/src-DWCUhnD4.js +20 -0
  143. package/dist/src-cfRTjFef.js +63 -0
  144. package/dist/sub-agent-tools-BD9DF8_g.js +39 -0
  145. package/dist/sub-agent-tools-V7b3T9_s.js +39 -0
  146. package/dist/tool-policy-DNvNRnve.js +189 -0
  147. package/dist/tts-elevenlabs-BUOGKL-k.js +61 -0
  148. package/dist/update-check-BD4qH7Am.js +81 -0
  149. package/dist/vision-DRq-f-Dj.js +121 -0
  150. package/dist/vision-tools-CFZEpQKm.js +5 -0
  151. package/dist/vision-tools-CQnBI9aa.js +51 -0
  152. package/dist/voice-transcription-CbQBToY0.js +138 -0
  153. package/dist/voice-transcription-CgWq54hn.js +138 -0
  154. package/dist/website-watch-tools-Bk_TnwuE.js +5 -0
  155. package/dist/website-watch-tools-DraMPxdl.js +139 -0
  156. package/package.json +1 -1
@@ -0,0 +1,4 @@
1
+ const require_chunk = require('./chunk-jS-bbMI5.js');
2
+ const require_server = require('./server-BRlCEjyT.js');
3
+
4
+ exports.startGateway = require_server.startGateway;
@@ -0,0 +1,4 @@
1
+ const require_chunk = require('./chunk-jS-bbMI5.js');
2
+ const require_server = require('./server-CCI1hv45.js');
3
+
4
+ exports.startGateway = require_server.startGateway;
@@ -0,0 +1,113 @@
1
+ const require_chunk = require('./chunk-jS-bbMI5.js');
2
+
3
+ //#region packages/core/src/agent/session-store.ts
4
+ function sanitizeKey(key) {
5
+ return key.replace(/[^a-z0-9_-]/gi, "_");
6
+ }
7
+ /** File-based session store. Sessions persist across gateway restarts. */
8
+ async function createFileSessionStore(baseDir) {
9
+ const fs = await import("fs-extra");
10
+ const path = await import("path");
11
+ const dir = path.join(baseDir, "sessions");
12
+ await fs.ensureDir(dir);
13
+ const readState = async (key) => {
14
+ const fp = path.join(dir, `${sanitizeKey(key)}.json`);
15
+ if (!await fs.pathExists(fp)) return null;
16
+ try {
17
+ return await fs.readJson(fp);
18
+ } catch {
19
+ return null;
20
+ }
21
+ };
22
+ const writeState = async (key, state) => {
23
+ const fp = path.join(dir, `${sanitizeKey(key)}.json`);
24
+ await fs.writeJson(fp, {
25
+ ...state,
26
+ lastActiveAt: (/* @__PURE__ */ new Date()).toISOString()
27
+ });
28
+ };
29
+ return {
30
+ async get(key) {
31
+ return readState(key);
32
+ },
33
+ async set(key, state) {
34
+ await writeState(key, {
35
+ ...state,
36
+ lastActiveAt: (/* @__PURE__ */ new Date()).toISOString()
37
+ });
38
+ },
39
+ async append(key, role, content, source) {
40
+ const existing = await readState(key);
41
+ const transcript = existing?.transcript ?? [];
42
+ transcript.push({
43
+ role,
44
+ content
45
+ });
46
+ if (transcript.length > 100) transcript.splice(0, transcript.length - 80);
47
+ await writeState(key, {
48
+ id: existing?.id ?? key,
49
+ source: existing?.source ?? source ?? "unknown",
50
+ externalId: existing?.externalId,
51
+ transcript,
52
+ lastActiveAt: (/* @__PURE__ */ new Date()).toISOString(),
53
+ workingMemory: existing?.workingMemory,
54
+ agentState: existing?.agentState
55
+ });
56
+ },
57
+ async getWorkingMemory(key) {
58
+ const s = await readState(key);
59
+ const slots = (s?.workingMemory ?? []).filter((w) => {
60
+ if (w.expiresAt && new Date(w.expiresAt) < /* @__PURE__ */ new Date()) return false;
61
+ return true;
62
+ });
63
+ return slots.slice(-MAX_WORKING_MEMORY);
64
+ },
65
+ async setWorkingMemory(key, slots) {
66
+ const existing = await readState(key);
67
+ const state = {
68
+ id: existing?.id ?? key,
69
+ source: existing?.source ?? "unknown",
70
+ transcript: existing?.transcript ?? [],
71
+ lastActiveAt: (/* @__PURE__ */ new Date()).toISOString(),
72
+ workingMemory: slots.slice(-MAX_WORKING_MEMORY),
73
+ agentState: existing?.agentState
74
+ };
75
+ await writeState(key, state);
76
+ },
77
+ async updateAgentState(key, patch) {
78
+ const existing = await readState(key);
79
+ const agentState = {
80
+ ...existing?.agentState ?? {},
81
+ ...patch
82
+ };
83
+ await writeState(key, {
84
+ id: existing?.id ?? key,
85
+ source: existing?.source ?? "unknown",
86
+ externalId: existing?.externalId,
87
+ transcript: existing?.transcript ?? [],
88
+ lastActiveAt: (/* @__PURE__ */ new Date()).toISOString(),
89
+ workingMemory: existing?.workingMemory,
90
+ agentState
91
+ });
92
+ }
93
+ };
94
+ }
95
+ var MAX_WORKING_MEMORY, WORKING_MEMORY_TTL_MS;
96
+ var init_session_store = require_chunk.__esm({ "packages/core/src/agent/session-store.ts"() {
97
+ MAX_WORKING_MEMORY = 20;
98
+ WORKING_MEMORY_TTL_MS = 24 * 60 * 60 * 1e3;
99
+ } });
100
+
101
+ //#endregion
102
+ Object.defineProperty(exports, 'createFileSessionStore', {
103
+ enumerable: true,
104
+ get: function () {
105
+ return createFileSessionStore;
106
+ }
107
+ });
108
+ Object.defineProperty(exports, 'init_session_store', {
109
+ enumerable: true,
110
+ get: function () {
111
+ return init_session_store;
112
+ }
113
+ });
@@ -0,0 +1,5 @@
1
+ const require_chunk = require('./chunk-jS-bbMI5.js');
2
+ const require_session_store = require('./session-store-CujxByI6.js');
3
+
4
+ require_session_store.init_session_store();
5
+ exports.createFileSessionStore = require_session_store.createFileSessionStore;
@@ -0,0 +1,5 @@
1
+ const require_chunk = require('./chunk-jS-bbMI5.js');
2
+ const require_sessions_tools = require('./sessions-tools-DHMaTZIs.js');
3
+
4
+ require_sessions_tools.init_sessions_tools();
5
+ exports.getSessionsTools = require_sessions_tools.getSessionsTools;
@@ -0,0 +1,95 @@
1
+ const require_chunk = require('./chunk-jS-bbMI5.js');
2
+
3
+ //#region packages/core/src/agent/sessions-tools.ts
4
+ function getSessionsTools(getServer, currentSessionId) {
5
+ return [
6
+ {
7
+ name: "sessions_list",
8
+ description: "List active WebSocket sessions connected to the gateway. Use to discover other agents or clients.",
9
+ input_schema: {
10
+ type: "object",
11
+ properties: {},
12
+ required: []
13
+ },
14
+ handler: async () => {
15
+ const server = getServer();
16
+ if (!server) return "Gateway not available (sessions tools only work when running in gateway).";
17
+ const list = server.getSessionsList?.() ?? [];
18
+ return JSON.stringify(list, null, 2);
19
+ }
20
+ },
21
+ {
22
+ name: "sessions_send",
23
+ description: "Send a message to another session. Use sessions_list to get session IDs.",
24
+ input_schema: {
25
+ type: "object",
26
+ properties: {
27
+ sessionId: {
28
+ type: "string",
29
+ description: "Target session ID from sessions_list"
30
+ },
31
+ content: {
32
+ type: "string",
33
+ description: "Message content to send"
34
+ }
35
+ },
36
+ required: ["sessionId", "content"]
37
+ },
38
+ handler: async (input) => {
39
+ const server = getServer();
40
+ if (!server) return "Gateway not available.";
41
+ const sessionId = input.sessionId;
42
+ const content = input.content;
43
+ const ok = server.sendToSession?.(sessionId, {
44
+ type: "chat:incoming",
45
+ content,
46
+ fromSession: currentSessionId ?? "unknown"
47
+ });
48
+ if (ok) return `Sent to session ${sessionId}.`;
49
+ return `Session ${sessionId} not found or disconnected.`;
50
+ }
51
+ },
52
+ {
53
+ name: "sessions_history",
54
+ description: "Get recent chat transcript for a session. Returns user/assistant turns.",
55
+ input_schema: {
56
+ type: "object",
57
+ properties: {
58
+ sessionId: {
59
+ type: "string",
60
+ description: "Session ID (use \"self\" for current session)"
61
+ },
62
+ limit: {
63
+ type: "string",
64
+ description: "Max turns to return (default 20)"
65
+ }
66
+ },
67
+ required: ["sessionId"]
68
+ },
69
+ handler: async (input) => {
70
+ const server = getServer();
71
+ if (!server) return "Gateway not available.";
72
+ const sid = input.sessionId === "self" ? currentSessionId : input.sessionId;
73
+ if (!sid) return "No current session.";
74
+ const limit = parseInt(input.limit || "20");
75
+ const history = server.getSessionHistory?.(sid, limit) ?? [];
76
+ return JSON.stringify(history, null, 2);
77
+ }
78
+ }
79
+ ];
80
+ }
81
+ var init_sessions_tools = require_chunk.__esm({ "packages/core/src/agent/sessions-tools.ts"() {} });
82
+
83
+ //#endregion
84
+ Object.defineProperty(exports, 'getSessionsTools', {
85
+ enumerable: true,
86
+ get: function () {
87
+ return getSessionsTools;
88
+ }
89
+ });
90
+ Object.defineProperty(exports, 'init_sessions_tools', {
91
+ enumerable: true,
92
+ get: function () {
93
+ return init_sessions_tools;
94
+ }
95
+ });
@@ -0,0 +1,7 @@
1
+ const require_chunk = require('./chunk-jS-bbMI5.js');
2
+ const require_skill_loader = require('./skill-loader-DhgIwK4J.js');
3
+
4
+ require_skill_loader.init_skill_loader();
5
+ exports.buildSkillsContext = require_skill_loader.buildSkillsContext;
6
+ exports.loadSkills = require_skill_loader.loadSkills;
7
+ exports.writeSkill = require_skill_loader.writeSkill;
@@ -0,0 +1,159 @@
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
+
6
+ //#region packages/core/src/agent/skill-loader.ts
7
+ /** Validate skill id and content (manifest checks). */
8
+ function validateSkill(id, content) {
9
+ const errors = [];
10
+ if (!id || id.length > 64) errors.push("id must be 1–64 characters");
11
+ else if (!ID_REGEX.test(id)) errors.push("id must be lowercase alphanumeric with only - or _");
12
+ const trimmed = (content || "").trim();
13
+ if (!trimmed) errors.push("content is empty");
14
+ if (trimmed.length > MAX_SKILL_CONTENT_SIZE) errors.push(`content exceeds ${MAX_SKILL_CONTENT_SIZE} characters`);
15
+ return {
16
+ valid: errors.length === 0,
17
+ errors
18
+ };
19
+ }
20
+ /** Extract manifest (title, version) from content. */
21
+ function extractManifest(content) {
22
+ const titleMatch = content.match(/^#\s+(.+)$/m);
23
+ const versionMatch = content.match(/^(?:version|Version):\s*(\S+)/m);
24
+ return {
25
+ title: titleMatch ? titleMatch[1].trim().slice(0, 120) : void 0,
26
+ version: versionMatch ? versionMatch[1].trim().slice(0, 32) : void 0
27
+ };
28
+ }
29
+ async function runBeforeLoad() {
30
+ for (const h of lifecycleHooks) if (h.onBeforeLoad) await Promise.resolve(h.onBeforeLoad());
31
+ }
32
+ async function runAfterLoad(skills) {
33
+ for (const h of lifecycleHooks) if (h.onAfterLoad) await Promise.resolve(h.onAfterLoad(skills));
34
+ }
35
+ async function runUnload(skills) {
36
+ for (const h of lifecycleHooks) if (h.onUnload) await Promise.resolve(h.onUnload(skills));
37
+ }
38
+ function extractCapabilities(content) {
39
+ const capMatch = content.match(/## Capabilities?\s*\n+([\s\S]*?)(?=\n## |\n# |$)/i);
40
+ if (capMatch) return capMatch[1].trim().slice(0, 200);
41
+ const firstPara = content.replace(/^#.*\n+/, "").split(/\n\n/)[0]?.trim();
42
+ return firstPara ? firstPara.slice(0, 200) : "";
43
+ }
44
+ async function loadSkills(opts) {
45
+ await runBeforeLoad();
46
+ const skills = [];
47
+ for (const base of [BUNDLED_SKILLS, WORKSPACE_SKILLS]) {
48
+ if (!await fs_extra.default.pathExists(base)) continue;
49
+ const dirs = await fs_extra.default.readdir(base);
50
+ for (const id of dirs) {
51
+ const skillPath = path.default.join(base, id, "SKILL.md");
52
+ if (!await fs_extra.default.pathExists(skillPath)) continue;
53
+ const content = await fs_extra.default.readFile(skillPath, "utf8");
54
+ if (skills.some((s) => s.id === id)) continue;
55
+ if (!opts?.skipValidation) {
56
+ const v = validateSkill(id, content);
57
+ if (!v.valid) continue;
58
+ }
59
+ const manifest = extractManifest(content);
60
+ skills.push({
61
+ id,
62
+ path: skillPath,
63
+ content,
64
+ capabilities: extractCapabilities(content),
65
+ title: manifest.title,
66
+ version: manifest.version
67
+ });
68
+ }
69
+ }
70
+ lastLoaded = skills;
71
+ await runAfterLoad(skills);
72
+ return skills;
73
+ }
74
+ /** Unload current skills (run onUnload), then load again. */
75
+ async function reloadSkills() {
76
+ await runUnload(lastLoaded);
77
+ return loadSkills();
78
+ }
79
+ function buildSkillsContext(skills) {
80
+ if (skills.length === 0) return "";
81
+ const capabilityList = skills.filter((s) => s.capabilities).map((s) => `- ${s.id}: ${s.capabilities}`).join("\n");
82
+ const header = capabilityList ? `\nCapability summary:\n${capabilityList}\n\n` : "";
83
+ const blocks = skills.map((s) => `## Skill: ${s.id}\n\n${s.content}`).join("\n\n---\n\n");
84
+ return `\n\n# Loaded Skills\n${header}${blocks}\n`;
85
+ }
86
+ /** Capability discovery: return id + summary for each loaded skill. */
87
+ function getSkillCapabilities(skills) {
88
+ return skills.filter((s) => s.capabilities).map((s) => ({
89
+ id: s.id,
90
+ capabilities: s.capabilities
91
+ }));
92
+ }
93
+ /** Create or overwrite a skill from agent (self-writing skills). */
94
+ async function writeSkill(skillId, opts) {
95
+ const id = skillId.replace(/[^a-z0-9-_]/gi, "-").toLowerCase() || "unnamed-skill";
96
+ const dir = path.default.join(WORKSPACE_SKILLS, id);
97
+ await fs_extra.default.ensureDir(dir);
98
+ const header = opts.name || id ? `# ${opts.name || id}\n\n${opts.description ? `> ${opts.description}\n\n` : ""}` : "";
99
+ const full = header + opts.content.trim();
100
+ await fs_extra.default.writeFile(path.default.join(dir, "SKILL.md"), full, "utf8");
101
+ return {
102
+ path: path.default.join(dir, "SKILL.md"),
103
+ id
104
+ };
105
+ }
106
+ var HC_DIR, BUNDLED_SKILLS, WORKSPACE_SKILLS, MAX_SKILL_CONTENT_SIZE, ID_REGEX, lifecycleHooks, lastLoaded;
107
+ var init_skill_loader = require_chunk.__esm({ "packages/core/src/agent/skill-loader.ts"() {
108
+ HC_DIR = path.default.join(os.default.homedir(), ".hyperclaw");
109
+ BUNDLED_SKILLS = path.default.join(__dirname, "..", "..", "..", "..", "skills");
110
+ WORKSPACE_SKILLS = path.default.join(HC_DIR, "workspace", "skills");
111
+ MAX_SKILL_CONTENT_SIZE = 2e5;
112
+ ID_REGEX = /^[a-z0-9][a-z0-9-_]*$/;
113
+ lifecycleHooks = [];
114
+ lastLoaded = [];
115
+ } });
116
+
117
+ //#endregion
118
+ Object.defineProperty(exports, 'buildSkillsContext', {
119
+ enumerable: true,
120
+ get: function () {
121
+ return buildSkillsContext;
122
+ }
123
+ });
124
+ Object.defineProperty(exports, 'getSkillCapabilities', {
125
+ enumerable: true,
126
+ get: function () {
127
+ return getSkillCapabilities;
128
+ }
129
+ });
130
+ Object.defineProperty(exports, 'init_skill_loader', {
131
+ enumerable: true,
132
+ get: function () {
133
+ return init_skill_loader;
134
+ }
135
+ });
136
+ Object.defineProperty(exports, 'loadSkills', {
137
+ enumerable: true,
138
+ get: function () {
139
+ return loadSkills;
140
+ }
141
+ });
142
+ Object.defineProperty(exports, 'reloadSkills', {
143
+ enumerable: true,
144
+ get: function () {
145
+ return reloadSkills;
146
+ }
147
+ });
148
+ Object.defineProperty(exports, 'validateSkill', {
149
+ enumerable: true,
150
+ get: function () {
151
+ return validateSkill;
152
+ }
153
+ });
154
+ Object.defineProperty(exports, 'writeSkill', {
155
+ enumerable: true,
156
+ get: function () {
157
+ return writeSkill;
158
+ }
159
+ });
@@ -0,0 +1,102 @@
1
+ const require_chunk = require('./chunk-jS-bbMI5.js');
2
+
3
+ //#region packages/core/src/agent/skill-runtime.ts
4
+ /** Extract execution contract from skill content. Parses ## Execution or ## Invoke blocks. */
5
+ function extractExecutionContract(skill) {
6
+ const content = skill.content || "";
7
+ const execMatch = content.match(/##\s*(?:Execution|Invoke)\s*\n+([\s\S]*?)(?=\n## |\n# |$)/i);
8
+ if (!execMatch) return null;
9
+ const block = execMatch[1].trim();
10
+ const contract = {
11
+ skillId: skill.id,
12
+ invokeMode: "prompt"
13
+ };
14
+ const schemaMatch = block.match(/input\s*:\s*\{([^}]+)\}/i) || block.match(/params\s*:\s*\{([^}]+)\}/i);
15
+ if (schemaMatch) {
16
+ const props = {};
17
+ const parts = schemaMatch[1].split(/,\s*/);
18
+ for (const p of parts) {
19
+ const [key, typeDesc] = p.split(/\s*:\s*/).map((s) => s.trim());
20
+ if (key) props[key] = {
21
+ type: typeDesc || "string",
22
+ description: ""
23
+ };
24
+ }
25
+ contract.inputSchema = {
26
+ properties: props,
27
+ required: Object.keys(props)
28
+ };
29
+ }
30
+ if (block.toLowerCase().includes("subagent") || block.toLowerCase().includes("full run")) contract.invokeMode = "subagent";
31
+ return contract;
32
+ }
33
+ /** Invoke a skill with params. Runs as focused prompt or subagent call. */
34
+ async function invokeSkill(skillId, params, opts) {
35
+ const { loadSkills } = await Promise.resolve().then(() => require("./skill-loader-BkceKkIg.js"));
36
+ const skills = opts?.skills ?? await loadSkills();
37
+ const skill = skills.find((s) => s.id === skillId);
38
+ if (!skill) return `Error: Skill "${skillId}" not found.`;
39
+ const contract = extractExecutionContract(skill);
40
+ const inputStr = Object.entries(params).map(([k, v]) => `${k}: ${typeof v === "object" ? JSON.stringify(v) : v}`).join(", ");
41
+ const { runAgentEngine } = await Promise.resolve().then(() => require("./engine-B4eMiTgl.js"));
42
+ const prompt = `Execute the skill "${skillId}" with these inputs: ${inputStr}\n\nFollow the skill instructions exactly. Output only the result.`;
43
+ const result = await runAgentEngine(prompt, {});
44
+ return result.text;
45
+ }
46
+ /** Build tools for skill invocation. Agent can call invoke_skill(skillId, params). */
47
+ function getSkillInvokeTools(skills) {
48
+ const invokable = skills.filter((s) => extractExecutionContract(s) || s.capabilities);
49
+ if (invokable.length === 0) return [];
50
+ const descriptions = invokable.map((s) => `- ${s.id}: ${s.capabilities || s.title || "no description"}`).join("\n");
51
+ return [{
52
+ name: "invoke_skill",
53
+ description: `Invoke a loaded skill by id. Available: ${invokable.map((s) => s.id).join(", ")}. Use when the user wants to run a specific capability.`,
54
+ input_schema: {
55
+ type: "object",
56
+ properties: {
57
+ skill_id: {
58
+ type: "string",
59
+ description: `Skill id. Options: ${invokable.map((s) => s.id).join(", ")}`
60
+ },
61
+ params: {
62
+ type: "object",
63
+ description: "Optional key-value params for the skill"
64
+ }
65
+ },
66
+ required: ["skill_id"]
67
+ },
68
+ handler: async (input) => {
69
+ const id = String(input.skill_id || "").trim();
70
+ const params = typeof input.params === "object" && input.params !== null ? input.params : {};
71
+ if (!id) return "Error: skill_id is required.";
72
+ return invokeSkill(id, params);
73
+ }
74
+ }];
75
+ }
76
+ var init_skill_runtime = require_chunk.__esm({ "packages/core/src/agent/skill-runtime.ts"() {} });
77
+
78
+ //#endregion
79
+ Object.defineProperty(exports, 'extractExecutionContract', {
80
+ enumerable: true,
81
+ get: function () {
82
+ return extractExecutionContract;
83
+ }
84
+ });
85
+ Object.defineProperty(exports, 'getSkillInvokeTools', {
86
+ enumerable: true,
87
+ get: function () {
88
+ return getSkillInvokeTools;
89
+ }
90
+ });
91
+ Object.defineProperty(exports, 'init_skill_runtime', {
92
+ enumerable: true,
93
+ get: function () {
94
+ return init_skill_runtime;
95
+ }
96
+ });
97
+ Object.defineProperty(exports, 'invokeSkill', {
98
+ enumerable: true,
99
+ get: function () {
100
+ return invokeSkill;
101
+ }
102
+ });
@@ -0,0 +1,5 @@
1
+ const require_chunk = require('./chunk-jS-bbMI5.js');
2
+ const require_skill_runtime = require('./skill-runtime--LqxWrp5.js');
3
+
4
+ require_skill_runtime.init_skill_runtime();
5
+ exports.getSkillInvokeTools = require_skill_runtime.getSkillInvokeTools;
@@ -0,0 +1,102 @@
1
+ const require_chunk = require('./chunk-jS-bbMI5.js');
2
+
3
+ //#region packages/core/src/agent/skill-runtime.ts
4
+ /** Extract execution contract from skill content. Parses ## Execution or ## Invoke blocks. */
5
+ function extractExecutionContract(skill) {
6
+ const content = skill.content || "";
7
+ const execMatch = content.match(/##\s*(?:Execution|Invoke)\s*\n+([\s\S]*?)(?=\n## |\n# |$)/i);
8
+ if (!execMatch) return null;
9
+ const block = execMatch[1].trim();
10
+ const contract = {
11
+ skillId: skill.id,
12
+ invokeMode: "prompt"
13
+ };
14
+ const schemaMatch = block.match(/input\s*:\s*\{([^}]+)\}/i) || block.match(/params\s*:\s*\{([^}]+)\}/i);
15
+ if (schemaMatch) {
16
+ const props = {};
17
+ const parts = schemaMatch[1].split(/,\s*/);
18
+ for (const p of parts) {
19
+ const [key, typeDesc] = p.split(/\s*:\s*/).map((s) => s.trim());
20
+ if (key) props[key] = {
21
+ type: typeDesc || "string",
22
+ description: ""
23
+ };
24
+ }
25
+ contract.inputSchema = {
26
+ properties: props,
27
+ required: Object.keys(props)
28
+ };
29
+ }
30
+ if (block.toLowerCase().includes("subagent") || block.toLowerCase().includes("full run")) contract.invokeMode = "subagent";
31
+ return contract;
32
+ }
33
+ /** Invoke a skill with params. Runs as focused prompt or subagent call. */
34
+ async function invokeSkill(skillId, params, opts) {
35
+ const { loadSkills } = await Promise.resolve().then(() => require("./skill-loader-CSxIAcTC.js"));
36
+ const skills = opts?.skills ?? await loadSkills();
37
+ const skill = skills.find((s) => s.id === skillId);
38
+ if (!skill) return `Error: Skill "${skillId}" not found.`;
39
+ const contract = extractExecutionContract(skill);
40
+ const inputStr = Object.entries(params).map(([k, v]) => `${k}: ${typeof v === "object" ? JSON.stringify(v) : v}`).join(", ");
41
+ const { runAgentEngine } = await Promise.resolve().then(() => require("./engine-B8M7dYul.js"));
42
+ const prompt = `Execute the skill "${skillId}" with these inputs: ${inputStr}\n\nFollow the skill instructions exactly. Output only the result.`;
43
+ const result = await runAgentEngine(prompt, {});
44
+ return result.text;
45
+ }
46
+ /** Build tools for skill invocation. Agent can call invoke_skill(skillId, params). */
47
+ function getSkillInvokeTools(skills) {
48
+ const invokable = skills.filter((s) => extractExecutionContract(s) || s.capabilities);
49
+ if (invokable.length === 0) return [];
50
+ const descriptions = invokable.map((s) => `- ${s.id}: ${s.capabilities || s.title || "no description"}`).join("\n");
51
+ return [{
52
+ name: "invoke_skill",
53
+ description: `Invoke a loaded skill by id. Available: ${invokable.map((s) => s.id).join(", ")}. Use when the user wants to run a specific capability.`,
54
+ input_schema: {
55
+ type: "object",
56
+ properties: {
57
+ skill_id: {
58
+ type: "string",
59
+ description: `Skill id. Options: ${invokable.map((s) => s.id).join(", ")}`
60
+ },
61
+ params: {
62
+ type: "object",
63
+ description: "Optional key-value params for the skill"
64
+ }
65
+ },
66
+ required: ["skill_id"]
67
+ },
68
+ handler: async (input) => {
69
+ const id = String(input.skill_id || "").trim();
70
+ const params = typeof input.params === "object" && input.params !== null ? input.params : {};
71
+ if (!id) return "Error: skill_id is required.";
72
+ return invokeSkill(id, params);
73
+ }
74
+ }];
75
+ }
76
+ var init_skill_runtime = require_chunk.__esm({ "packages/core/src/agent/skill-runtime.ts"() {} });
77
+
78
+ //#endregion
79
+ Object.defineProperty(exports, 'extractExecutionContract', {
80
+ enumerable: true,
81
+ get: function () {
82
+ return extractExecutionContract;
83
+ }
84
+ });
85
+ Object.defineProperty(exports, 'getSkillInvokeTools', {
86
+ enumerable: true,
87
+ get: function () {
88
+ return getSkillInvokeTools;
89
+ }
90
+ });
91
+ Object.defineProperty(exports, 'init_skill_runtime', {
92
+ enumerable: true,
93
+ get: function () {
94
+ return init_skill_runtime;
95
+ }
96
+ });
97
+ Object.defineProperty(exports, 'invokeSkill', {
98
+ enumerable: true,
99
+ get: function () {
100
+ return invokeSkill;
101
+ }
102
+ });
@@ -0,0 +1,5 @@
1
+ const require_chunk = require('./chunk-jS-bbMI5.js');
2
+ const require_skill_runtime = require('./skill-runtime-DsXK_HYG.js');
3
+
4
+ require_skill_runtime.init_skill_runtime();
5
+ exports.getSkillInvokeTools = require_skill_runtime.getSkillInvokeTools;
@@ -0,0 +1,63 @@
1
+ const require_chunk = require('./chunk-jS-bbMI5.js');
2
+ const require_paths = require('./paths-AIyBxIzm.js');
3
+ const require_browser_tools = require('./browser-tools-YQmwRLLM.js');
4
+ require('./src-DWCUhnD4.js');
5
+ const require_engine = require('./engine-BhT-1M9W.js');
6
+ const require_extraction_tools = require('./extraction-tools-D3qDFBJ1.js');
7
+ const require_inference = require('./inference-CTWJeX9Q.js');
8
+ const require_memory_auto = require('./memory-auto-Bc7euou4.js');
9
+ const require_orchestrator = require('./orchestrator-BSp2M5EU.js');
10
+ const require_pc_access = require('./pc-access-NxBvTrRj.js');
11
+ const require_session_store = require('./session-store-CujxByI6.js');
12
+ const require_sessions_tools = require('./sessions-tools-DHMaTZIs.js');
13
+ const require_skill_loader = require('./skill-loader-DhgIwK4J.js');
14
+ const require_skill_runtime = require('./skill-runtime--LqxWrp5.js');
15
+ const require_vision_tools = require('./vision-tools-CQnBI9aa.js');
16
+ const require_website_watch_tools = require('./website-watch-tools-DraMPxdl.js');
17
+ const require_src$1 = require('./src-Bgu_OxTQ.js');
18
+
19
+ require_src$1.init_src();
20
+ exports.ACPThreadManager = require_src$1.ACPThreadManager;
21
+ exports.AutoMemory = require_memory_auto.AutoMemory;
22
+ exports.InferenceEngine = require_inference.InferenceEngine;
23
+ exports.appendMemory = require_memory_auto.appendMemory;
24
+ exports.buildSkillsContext = require_skill_loader.buildSkillsContext;
25
+ exports.clearMemory = require_memory_auto.clearMemory;
26
+ exports.createFileSessionStore = require_session_store.createFileSessionStore;
27
+ exports.createPiRPCHandler = require_src$1.createPiRPCHandler;
28
+ exports.extractExecutionContract = require_skill_runtime.extractExecutionContract;
29
+ exports.extractFactsLocally = require_memory_auto.extractFactsLocally;
30
+ exports.formatAgentResponse = require_src$1.formatAgentResponse;
31
+ exports.getAgentHelp = require_src$1.getAgentHelp;
32
+ exports.getBrowserTools = require_browser_tools.getBrowserTools;
33
+ exports.getBuiltinTools = require_inference.getBuiltinTools;
34
+ exports.getConfigPath = require_paths.getConfigPath;
35
+ exports.getEnvFilePath = require_paths.getEnvFilePath;
36
+ exports.getExtractionTools = require_extraction_tools.getExtractionTools;
37
+ exports.getHyperClawDir = require_paths.getHyperClawDir;
38
+ exports.getPCAccessTools = require_pc_access.getPCAccessTools;
39
+ exports.getSessionsTools = require_sessions_tools.getSessionsTools;
40
+ exports.getSkillCapabilities = require_skill_loader.getSkillCapabilities;
41
+ exports.getSkillInvokeTools = require_skill_runtime.getSkillInvokeTools;
42
+ exports.getVisionTools = require_vision_tools.getVisionTools;
43
+ exports.getWebsiteWatchTools = require_website_watch_tools.getWebsiteWatchTools;
44
+ exports.invokeSkill = require_skill_runtime.invokeSkill;
45
+ exports.loadPCAccessConfig = require_pc_access.loadPCAccessConfig;
46
+ exports.loadSkills = require_skill_loader.loadSkills;
47
+ exports.loadSkillsContext = require_engine.loadSkillsContext;
48
+ exports.loadWorkspaceContext = require_engine.loadWorkspaceContext;
49
+ exports.planSteps = require_orchestrator.planSteps;
50
+ exports.readMemory = require_memory_auto.readMemory;
51
+ exports.reloadSkills = require_skill_loader.reloadSkills;
52
+ exports.resolveTools = require_engine.resolveTools;
53
+ exports.runAgent = require_src$1.runAgent;
54
+ exports.runAgentEngine = require_engine.runAgentEngine;
55
+ exports.runMultiStep = require_orchestrator.runMultiStep;
56
+ exports.runMultiStepParallel = require_orchestrator.runMultiStepParallel;
57
+ exports.runWithPlan = require_orchestrator.runWithPlan;
58
+ exports.saveMemoryDirect = require_memory_auto.saveMemoryDirect;
59
+ exports.savePCAccessConfig = require_pc_access.savePCAccessConfig;
60
+ exports.searchMemory = require_memory_auto.searchMemory;
61
+ exports.showMemory = require_memory_auto.showMemory;
62
+ exports.showPCAccessStatus = require_pc_access.showPCAccessStatus;
63
+ exports.validateSkill = require_skill_loader.validateSkill;