hyperclaw 4.0.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -4
- package/dist/a2ui-protocol-CT_jDEU9.js +75 -0
- package/dist/a2ui-protocol-CfBI44-Q.js +75 -0
- package/dist/agents-routing-683Q2JGp.js +129 -0
- package/dist/agents-routing-BpZBswBH.js +4 -0
- package/dist/agents-routing-ChHiZp36.js +327 -0
- package/dist/agents-routing-ChqZ6l2S.js +4 -0
- package/dist/api-keys-guide-BCcOl0Q7.js +149 -0
- package/dist/api-keys-guide-Dq5Obbp4.js +149 -0
- package/dist/audit-BYxPlnTQ.js +248 -0
- package/dist/audit-BaIiyWFu.js +441 -0
- package/dist/bounty-tools-C6LyzxM-.js +211 -0
- package/dist/bounty-tools-DWudyZie.js +211 -0
- package/dist/browser-tools-BsTeGMnX.js +5 -0
- package/dist/browser-tools-CQBSbIuO.js +5 -0
- package/dist/browser-tools-D8_rLe2p.js +179 -0
- package/dist/browser-tools-YQmwRLLM.js +179 -0
- package/dist/claw-tasks-BRLUvFRD.js +80 -0
- package/dist/claw-tasks-CgTsiNE8.js +80 -0
- package/dist/connector-3HnyH8fn.js +167 -0
- package/dist/connector-5N0-X_xs.js +194 -0
- package/dist/connector-6PMZo5Ky.js +189 -0
- package/dist/connector-B3v0qcXg.js +425 -0
- package/dist/connector-B6eoF3DD.js +181 -0
- package/dist/connector-B8R3iBY1.js +280 -0
- package/dist/connector-B9tLG8UZ.js +196 -0
- package/dist/connector-BAM-08NN.js +189 -0
- package/dist/connector-BC8FIVu4.js +181 -0
- package/dist/connector-BDmwwaVc.js +213 -0
- package/dist/connector-BGjbBy69.js +225 -0
- package/dist/connector-BO2SRzfG.js +218 -0
- package/dist/connector-BOlqjXWP.js +182 -0
- package/dist/connector-BP8zsbP8.js +189 -0
- package/dist/connector-BPoSevxp.js +286 -0
- package/dist/connector-BRHj773i.js +163 -0
- package/dist/connector-BToxU-jV.js +267 -0
- package/dist/connector-BfXky0L3.js +167 -0
- package/dist/connector-BiiSJpx3.js +192 -0
- package/dist/connector-BliDVsJQ.js +239 -0
- package/dist/connector-BnDmIhIu.js +85 -0
- package/dist/connector-Bv6s9oP7.js +88 -0
- package/dist/connector-By5wWGTR.js +343 -0
- package/dist/connector-C1BaFFgN.js +213 -0
- package/dist/connector-C1HSoUyk.js +189 -0
- package/dist/connector-CKQHZOXg.js +568 -0
- package/dist/connector-CRRWY5Wv.js +167 -0
- package/dist/connector-CRl-iidy.js +239 -0
- package/dist/connector-CXPQVGyI.js +85 -0
- package/dist/connector-Cdk1CXKi.js +194 -0
- package/dist/connector-Ci9glMD-.js +340 -0
- package/dist/connector-CjtZIEDj.js +181 -0
- package/dist/connector-Ck6JtOsX.js +531 -0
- package/dist/connector-CwlgFgjx.js +181 -0
- package/dist/connector-D8Kelee0.js +286 -0
- package/dist/connector-DAnRJ0oP.js +162 -0
- package/dist/connector-DFchk6l7.js +178 -0
- package/dist/connector-DKw7tRAy.js +192 -0
- package/dist/connector-DRv1ahC_.js +2 -2
- package/dist/connector-DU63KW94.js +165 -0
- package/dist/connector-DXTp5PE8.js +508 -0
- package/dist/connector-Dbvb1Cj9.js +280 -0
- package/dist/connector-DcZdQcgR.js +173 -0
- package/dist/connector-Dih6dUPP.js +173 -0
- package/dist/connector-DqTH_tPX.js +182 -0
- package/dist/connector-DrnEiiyP.js +419 -0
- package/dist/connector-DtR5GGTX.js +167 -0
- package/dist/connector-DxKL8VvZ.js +182 -0
- package/dist/connector-T_YdZtzv.js +162 -0
- package/dist/connector-Tky_qS_K.js +350 -0
- package/dist/connector-ZSc3oTTy.js +305 -0
- package/dist/connector-i4gOS9xL.js +154 -0
- package/dist/connector-rHXE1ZD2.js +167 -0
- package/dist/connector-sW5yhU1m.js +498 -0
- package/dist/connector-u3ICd3Ic.js +552 -0
- package/dist/connector-wdUXChwa.js +172 -0
- package/dist/cost-tracker-DD9wtWsr.js +103 -0
- package/dist/cost-tracker-pVE15Yq4.js +103 -0
- package/dist/credentials-store-BvnMPJwi.js +4 -0
- package/dist/credentials-store-C6ir0Dae.js +4 -0
- package/dist/credentials-store-H13LqOwJ.js +77 -0
- package/dist/credentials-store-sb-TRLwR.js +77 -0
- package/dist/cron-tasks-Bli7Kzd2.js +82 -0
- package/dist/cron-tasks-BvDFNyiE.js +82 -0
- package/dist/daemon-Bg4GtCmc.js +318 -0
- package/dist/daemon-DhmwY8k4.js +5 -0
- package/dist/delivery-BmIYy9VQ.js +4 -0
- package/dist/delivery-D5Z98EVq.js +95 -0
- package/dist/delivery-DCOXhXEO.js +5 -0
- package/dist/delivery-pWUPBp1F.js +95 -0
- package/dist/destructive-gate-D6vWOdEl.js +101 -0
- package/dist/destructive-gate-m-dWqUFg.js +101 -0
- package/dist/developer-keys-CPWT7Q6S.js +8 -0
- package/dist/developer-keys-DrrcUqFa.js +127 -0
- package/dist/developer-keys-JaJK3T27.js +127 -0
- package/dist/developer-keys-kyqmtWK3.js +8 -0
- package/dist/doctor-3oi89QIc.js +175 -0
- package/dist/doctor-BvCe8BBk.js +230 -0
- package/dist/doctor-Cf1XSfp9.js +4 -0
- package/dist/doctor-CxyPLYsJ.js +6 -0
- package/dist/engine-B4eMiTgl.js +7 -0
- package/dist/engine-B8M7dYul.js +7 -0
- package/dist/engine-BhT-1M9W.js +256 -0
- package/dist/engine-CEDSqXfw.js +256 -0
- package/dist/engine-D49jnSd_.js +256 -0
- package/dist/engine-Da4JMNpI.js +7 -0
- package/dist/env-resolve-CiXbWYwe.js +10 -0
- package/dist/env-resolve-CmGWhWXJ.js +115 -0
- package/dist/env-resolve-DWOQ45jG.js +9 -0
- package/dist/env-resolve-szSWl0UF.js +94 -0
- package/dist/extraction-tools-D3qDFBJ1.js +91 -0
- package/dist/extraction-tools-DLr_AEwq.js +5 -0
- package/dist/extraction-tools-HOZstZ0y.js +91 -0
- package/dist/extraction-tools-m4lmAv7l.js +5 -0
- package/dist/form_data-B_hIUrxU.js +8657 -0
- package/dist/form_data-Cz040rio.js +8657 -0
- package/dist/gmail-watch-setup-Czt8rXaX.js +40 -0
- package/dist/gmail-watch-setup-Du7DVV7S.js +40 -0
- package/dist/health-B-asI__D.js +6 -0
- package/dist/health-Ds2YlpTB.js +152 -0
- package/dist/heartbeat-engine-BYT5ayQH.js +83 -0
- package/dist/heartbeat-engine-CRqfPcFM.js +83 -0
- package/dist/hub-D0XwdjM-.js +515 -0
- package/dist/hub-DTsqe5Bt.js +6 -0
- package/dist/hub-FrPTA33j.js +515 -0
- package/dist/hub-LiD5Iztb.js +6 -0
- package/dist/hyperclawbot-D9KCtc4P.js +480 -0
- package/dist/hyperclawbot-Dw27pJo4.js +480 -0
- package/dist/hyperclawbot-zvczQgKx.js +505 -0
- package/dist/inference-BKVkBREb.js +6 -0
- package/dist/inference-CTWJeX9Q.js +922 -0
- package/dist/inference-DCXH4Q3x.js +922 -0
- package/dist/inference-ix607p7k.js +6 -0
- package/dist/knowledge-graph-DqA-Fztl.js +131 -0
- package/dist/knowledge-graph-iBG76fvm.js +131 -0
- package/dist/loader-CC45xGpC.js +4 -0
- package/dist/loader-CISCqBto.js +400 -0
- package/dist/loader-CYMQ8VOS.js +4 -0
- package/dist/loader-CnEdOyjT.js +400 -0
- package/dist/logger-8tEtAd3y.js +83 -0
- package/dist/logger-ybOp7VOC.js +83 -0
- package/dist/manager-03ipO9R0.js +105 -0
- package/dist/manager-BpDfbDjg.js +117 -0
- package/dist/manager-Bxl0sqlh.js +4 -0
- package/dist/manager-CPjeRe-6.js +4 -0
- package/dist/manager-CrVDn6eN.js +6 -0
- package/dist/manager-Cwzj7w5R.js +105 -0
- package/dist/manager-DLmZI-9R.js +6 -0
- package/dist/manager-DSGhn5i3.js +117 -0
- package/dist/manager-DgyF52mg.js +218 -0
- package/dist/manager-Dm8nrMFx.js +40 -0
- package/dist/manager-FCgF1plu.js +218 -0
- package/dist/manager-rgCsaWT1.js +40 -0
- package/dist/mcp-B_9Ber63.js +139 -0
- package/dist/mcp-CfoSU4Uz.js +139 -0
- package/dist/mcp-loader-DSM5UiFG.js +94 -0
- package/dist/mcp-loader-DkRBsLpk.js +94 -0
- package/dist/mcp-loader-j5ZLLw5O.js +94 -0
- package/dist/memory-BI1kPkAN.js +4 -0
- package/dist/memory-BVFGkxxK.js +270 -0
- package/dist/memory-BlHL7JCO.js +4 -0
- package/dist/memory-DsS_eFvJ.js +270 -0
- package/dist/memory-auto-Bc7euou4.js +306 -0
- package/dist/memory-auto-BkvtSFUw.js +5 -0
- package/dist/memory-auto-Bnz_-1wP.js +306 -0
- package/dist/memory-auto-DPfbkMVt.js +5 -0
- package/dist/memory-integration-DZExqWr4.js +91 -0
- package/dist/memory-integration-cSYkZyEo.js +91 -0
- package/dist/moltbook-B6ZeGN5_.js +81 -0
- package/dist/moltbook-BtLDZTfM.js +81 -0
- package/dist/node-Dw2Gi-cP.js +222 -0
- package/dist/node-pwL6O_KX.js +222 -0
- package/dist/nodes-registry-B8dmrlLv.js +52 -0
- package/dist/nodes-registry-CsPm_-CJ.js +52 -0
- package/dist/oauth-flow-CpWlgvNB.js +150 -0
- package/dist/oauth-flow-DQPvMHRH.js +150 -0
- package/dist/oauth-provider-BZb6qOw5.js +110 -0
- package/dist/oauth-provider-Uo4Nib_c.js +110 -0
- package/dist/observability-B43YvNQV.js +89 -0
- package/dist/observability-BV-Yx0V9.js +89 -0
- package/dist/onboard-0WoDxbv_.js +10 -0
- package/dist/onboard-BXNXCQp4.js +4070 -0
- package/dist/onboard-Bd_wsYdi.js +4086 -0
- package/dist/onboard-CAN7x3me.js +3026 -0
- package/dist/onboard-DnegOHMh.js +4 -4
- package/dist/onboard-RYtDlYBw.js +9 -0
- package/dist/onboard-aTwlQs-4.js +9 -0
- package/dist/orchestrator-BSp2M5EU.js +189 -0
- package/dist/orchestrator-C7ko5tWa.js +6 -0
- package/dist/orchestrator-DfPkIx2Z.js +6 -0
- package/dist/orchestrator-DmnEvMaL.js +189 -0
- package/dist/orchestrator-NJQsmiBE.js +189 -0
- package/dist/orchestrator-RI3bpqqc.js +6 -0
- package/dist/pairing-6iM27aD8.js +196 -0
- package/dist/pairing-DU0_J28n.js +87 -0
- package/dist/pairing-DWllbSbO.js +4 -0
- package/dist/pairing-dGoiGepK.js +4 -0
- package/dist/pc-access-CgCsYrpt.js +8 -0
- package/dist/pc-access-Ly-uA8mn.js +8 -0
- package/dist/pc-access-NxBvTrRj.js +819 -0
- package/dist/pc-access-_iH2aorG.js +819 -0
- package/dist/pending-approval-CUXjysAo.js +22 -0
- package/dist/pending-approval-DIHvwwWS.js +22 -0
- package/dist/puppeteer-2o3QOwAy.js +2 -2
- package/dist/puppeteer-BYTMp3BI.js +2 -2
- package/dist/puppeteer-DQ45qwWk.js +2 -2
- package/dist/reminders-store-D79qdfN0.js +58 -0
- package/dist/reminders-store-Drjed_-h.js +58 -0
- package/dist/renderer-BVQrd0_g.js +225 -0
- package/dist/renderer-pqlDRKbH.js +225 -0
- package/dist/rules-BE4GV6cV.js +103 -0
- package/dist/rules-BooT_qFP.js +103 -0
- package/dist/run-main.js +1649 -1227
- package/dist/runner-D1rjuMTJ.js +810 -0
- package/dist/runner-DatMMYYE.js +1271 -0
- package/dist/sdk/index.js +2 -2
- package/dist/sdk/index.mjs +2 -2
- package/dist/security-BqNyT4ID.js +4 -0
- package/dist/security-C-5URby1.js +73 -0
- package/dist/security-_xve79aq.js +4 -0
- package/dist/security-tpgqPWWH.js +73 -0
- package/dist/server-0kgyELx4.js +1047 -0
- package/dist/server-BIuTobTC.js +4 -0
- package/dist/server-BRlCEjyT.js +1047 -0
- package/dist/server-CCI1hv45.js +2 -2
- package/dist/server-D4wVHiX9.js +4 -0
- package/dist/server-DU9POoWc.js +4 -0
- package/dist/server-Dh3JlBFB.js +1255 -0
- package/dist/session-store-BUiPz0Vv.js +5 -0
- package/dist/session-store-CujxByI6.js +113 -0
- package/dist/session-store-is4B6qmD.js +113 -0
- package/dist/session-store-qpJUg2M1.js +5 -0
- package/dist/sessions-tools-CB2qbwIk.js +5 -0
- package/dist/sessions-tools-CbUTFe4i.js +5 -0
- package/dist/sessions-tools-CeqD7iil.js +95 -0
- package/dist/sessions-tools-DHMaTZIs.js +95 -0
- package/dist/skill-loader-BaNLVmJy.js +7 -0
- package/dist/skill-loader-BkceKkIg.js +7 -0
- package/dist/skill-loader-DhgIwK4J.js +159 -0
- package/dist/skill-loader-HgpF6Vqs.js +159 -0
- package/dist/skill-runtime--LqxWrp5.js +102 -0
- package/dist/skill-runtime-C5l0Tgt-.js +5 -0
- package/dist/skill-runtime-CJN24QPW.js +102 -0
- package/dist/skill-runtime-DsXK_HYG.js +102 -0
- package/dist/skill-runtime-IVTiqrMR.js +5 -0
- package/dist/skill-runtime-w1ig_lcw.js +5 -0
- package/dist/src-BEVLgaF1.js +63 -0
- package/dist/src-Bgu_OxTQ.js +458 -0
- package/dist/src-Bq-oKt7Z.js +458 -0
- package/dist/src-BxPHKO5x.js +63 -0
- package/dist/src-DIc-L2IG.js +20 -0
- package/dist/src-DWCUhnD4.js +20 -0
- package/dist/src-cfRTjFef.js +63 -0
- package/dist/src-g_rNx5rh.js +458 -0
- package/dist/sub-agent-tools-BD9DF8_g.js +39 -0
- package/dist/sub-agent-tools-CHQoHz9c.js +39 -0
- package/dist/sub-agent-tools-V7b3T9_s.js +39 -0
- package/dist/theme-DcxwcUgZ.js +180 -0
- package/dist/theme-cx0fkgWC.js +8 -0
- package/dist/tool-policy-CNT-mF2Z.js +189 -0
- package/dist/tool-policy-DNvNRnve.js +189 -0
- package/dist/tts-elevenlabs-BRosZv-f.js +61 -0
- package/dist/tts-elevenlabs-BUOGKL-k.js +61 -0
- package/dist/update-check-BD4qH7Am.js +81 -0
- package/dist/update-check-C2Dz85wJ.js +81 -0
- package/dist/vision-BMmiIKy7.js +121 -0
- package/dist/vision-DRq-f-Dj.js +121 -0
- package/dist/vision-tools-CFZEpQKm.js +5 -0
- package/dist/vision-tools-CQnBI9aa.js +51 -0
- package/dist/vision-tools-DVuYc17I.js +51 -0
- package/dist/vision-tools-U3YC4L-g.js +5 -0
- package/dist/voice-transcription-B555DbWR.js +138 -0
- package/dist/voice-transcription-CgWq54hn.js +138 -0
- package/dist/website-watch-tools-Bk_TnwuE.js +5 -0
- package/dist/website-watch-tools-DFMrJU-R.js +139 -0
- package/dist/website-watch-tools-DraMPxdl.js +139 -0
- package/dist/website-watch-tools-Du3W5sN7.js +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
8
|
<img src="https://img.shields.io/badge/build-passing-brightgreen?style=flat-square" alt="build">
|
|
9
|
-
<img src="https://img.shields.io/badge/release-
|
|
9
|
+
<img src="https://img.shields.io/badge/release-v5.0.0-blue?style=flat-square" alt="release">
|
|
10
10
|
<img src="https://img.shields.io/badge/node-%E2%89%A522-green?style=flat-square" alt="node">
|
|
11
11
|
<img src="https://img.shields.io/badge/license-MIT-gray?style=flat-square" alt="license">
|
|
12
12
|
<img src="https://img.shields.io/badge/typescript-5.4-3178c6?style=flat-square&logo=typescript&logoColor=white" alt="typescript">
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
|
|
56
56
|
## Install
|
|
57
57
|
|
|
58
|
-
Runtime: Node ≥ 22.
|
|
58
|
+
Runtime: Node ≥ 22. Runs **natively on Windows, macOS, and Linux** — no WSL2 required.
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
61
|
npm install -g hyperclaw@latest
|
|
@@ -68,8 +68,24 @@ hyperclaw onboard
|
|
|
68
68
|
hyperclaw onboard --install-daemon
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
+
## Uninstall
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Stop and remove daemon (if running)
|
|
75
|
+
hyperclaw daemon uninstall
|
|
76
|
+
|
|
77
|
+
# Remove the package
|
|
78
|
+
npm uninstall -g hyperclaw
|
|
79
|
+
|
|
80
|
+
# Remove config and data (optional)
|
|
81
|
+
rm -rf ~/.hyperclaw
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
> **Windows users**: HyperClaw runs natively via Node.js. No WSL2, no admin rights needed.
|
|
85
|
+
> The daemon uses **Task Scheduler** and runs as your user account with full desktop access.
|
|
86
|
+
|
|
71
87
|
The wizard guides you step by step — provider, model, gateway, channels, and skills.
|
|
72
|
-
Works on **macOS, Linux, and Windows** (
|
|
88
|
+
Works on **macOS, Linux, and Windows** (native — no WSL2 required). Compatible with npm, pnpm, and bun.
|
|
73
89
|
|
|
74
90
|
---
|
|
75
91
|
|
|
@@ -101,7 +117,7 @@ Upgrading? Run `hyperclaw doctor` to check and migrate.
|
|
|
101
117
|
|
|
102
118
|
## Channels
|
|
103
119
|
|
|
104
|
-
HyperClaw connects to the channels you already use (
|
|
120
|
+
HyperClaw connects to the channels you already use (28+ channels):
|
|
105
121
|
|
|
106
122
|
| Channel | Status | Notes |
|
|
107
123
|
|---------|--------|-------|
|
|
@@ -133,6 +149,8 @@ HyperClaw connects to the channels you already use (27 channels):
|
|
|
133
149
|
| 🎙️ Voice Call | ✅ Available | Terminal voice session |
|
|
134
150
|
| 🌐 Chrome Extension | ✅ Available | Browser sidebar |
|
|
135
151
|
|
|
152
|
+
Twitch is also available via IRC over WebSocket.
|
|
153
|
+
|
|
136
154
|
Add a channel:
|
|
137
155
|
|
|
138
156
|
```bash
|
|
@@ -287,6 +305,42 @@ Send these in any connected channel (Telegram, Discord, Slack, etc.):
|
|
|
287
305
|
| `/verbose on\|off` | Verbose mode |
|
|
288
306
|
| `/usage off\|tokens\|full` | Per-response usage footer |
|
|
289
307
|
|
|
308
|
+
## HyperClaw Bot commands
|
|
309
|
+
|
|
310
|
+
Control the gateway remotely via your Telegram or Discord bot (`hyperclaw bot start`):
|
|
311
|
+
|
|
312
|
+
| Command | Description |
|
|
313
|
+
|---------|-------------|
|
|
314
|
+
| `/status` | Gateway + daemon status |
|
|
315
|
+
| `/restart` | Restart the gateway |
|
|
316
|
+
| `/logs [n]` | Last N log lines (default 20) |
|
|
317
|
+
| `/channels` | List configured channels |
|
|
318
|
+
| `/approve <ch> <code>` | Approve a DM pairing code |
|
|
319
|
+
| `/hook list` | List all hooks |
|
|
320
|
+
| `/hook on <id>` | Enable a hook |
|
|
321
|
+
| `/hook off <id>` | Disable a hook |
|
|
322
|
+
| `/agent <msg>` | Send a message to the AI agent |
|
|
323
|
+
| `/activation` | Show current group activation mode |
|
|
324
|
+
| `/activation mention` | Bot responds only to @mentions and replies _(default)_ |
|
|
325
|
+
| `/activation always` | Bot responds to all messages in a group |
|
|
326
|
+
| `/security` | Security audit summary |
|
|
327
|
+
| `/help` | List all commands |
|
|
328
|
+
|
|
329
|
+
## Agent-to-Agent (session tools)
|
|
330
|
+
|
|
331
|
+
When the gateway is running, the agent has access to session tools for agent-to-agent communication:
|
|
332
|
+
|
|
333
|
+
| Tool | Description |
|
|
334
|
+
|------|-------------|
|
|
335
|
+
| `sessions_list` | List all active WebSocket sessions connected to the gateway |
|
|
336
|
+
| `sessions_send` | Send a message to another session (by session ID) |
|
|
337
|
+
| `sessions_history` | Get the chat transcript of a session (`"self"` for current) |
|
|
338
|
+
|
|
339
|
+
Example — ask the agent to ping another session:
|
|
340
|
+
```
|
|
341
|
+
"List all connected sessions and send a hello to the first one"
|
|
342
|
+
```
|
|
343
|
+
|
|
290
344
|
---
|
|
291
345
|
|
|
292
346
|
## From source
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-jS-bbMI5.js');
|
|
2
|
+
|
|
3
|
+
//#region src/canvas/a2ui-protocol.ts
|
|
4
|
+
/** Map HyperClaw component type to A2UI-compatible type. */
|
|
5
|
+
function toA2UIType(t) {
|
|
6
|
+
const map = {
|
|
7
|
+
chart: "chart",
|
|
8
|
+
table: "table",
|
|
9
|
+
form: "form",
|
|
10
|
+
markdown: "markdown",
|
|
11
|
+
image: "image",
|
|
12
|
+
custom: "custom",
|
|
13
|
+
script: "script"
|
|
14
|
+
};
|
|
15
|
+
return map[t] || "custom";
|
|
16
|
+
}
|
|
17
|
+
/** Convert a CanvasComponent to A2UI surface. */
|
|
18
|
+
function componentToSurface(c) {
|
|
19
|
+
return {
|
|
20
|
+
id: c.id,
|
|
21
|
+
type: toA2UIType(c.type),
|
|
22
|
+
props: {
|
|
23
|
+
title: c.title,
|
|
24
|
+
width: c.width || "half"
|
|
25
|
+
},
|
|
26
|
+
data: c.data
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** Generate beginRendering from canvas state (full sync). */
|
|
30
|
+
function toBeginRendering(canvas) {
|
|
31
|
+
const surfaces = canvas.components.map(componentToSurface);
|
|
32
|
+
const dataModel = {};
|
|
33
|
+
for (const c of canvas.components) if (c.data != null) dataModel[c.id] = c.data;
|
|
34
|
+
return {
|
|
35
|
+
type: "beginRendering",
|
|
36
|
+
surfaceId: canvas.id,
|
|
37
|
+
surfaces,
|
|
38
|
+
dataModel: Object.keys(dataModel).length ? dataModel : void 0
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Generate surfaceUpdate for newly added component. */
|
|
42
|
+
function toSurfaceUpdate(canvasId, component) {
|
|
43
|
+
return {
|
|
44
|
+
type: "surfaceUpdate",
|
|
45
|
+
surfaceId: canvasId,
|
|
46
|
+
surfaces: [componentToSurface(component)]
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** Generate dataModelUpdate when component data changes. */
|
|
50
|
+
function toDataModelUpdate(canvasId, componentId, data) {
|
|
51
|
+
return {
|
|
52
|
+
type: "dataModelUpdate",
|
|
53
|
+
surfaceId: canvasId,
|
|
54
|
+
updates: { [componentId]: data }
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/** Generate deleteSurface for removed components. */
|
|
58
|
+
function toDeleteSurface(canvasId, componentIds) {
|
|
59
|
+
return {
|
|
60
|
+
type: "deleteSurface",
|
|
61
|
+
surfaceId: canvasId,
|
|
62
|
+
surfaceIds: componentIds
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/** Serialize A2UI messages to JSONL (one message per line). */
|
|
66
|
+
function toJSONL(messages) {
|
|
67
|
+
return messages.map((m) => JSON.stringify(m)).join("\n");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
exports.toBeginRendering = toBeginRendering;
|
|
72
|
+
exports.toDataModelUpdate = toDataModelUpdate;
|
|
73
|
+
exports.toDeleteSurface = toDeleteSurface;
|
|
74
|
+
exports.toJSONL = toJSONL;
|
|
75
|
+
exports.toSurfaceUpdate = toSurfaceUpdate;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-jS-bbMI5.js');
|
|
2
|
+
|
|
3
|
+
//#region src/canvas/a2ui-protocol.ts
|
|
4
|
+
/** Map HyperClaw component type to A2UI-compatible type. */
|
|
5
|
+
function toA2UIType(t) {
|
|
6
|
+
const map = {
|
|
7
|
+
chart: "chart",
|
|
8
|
+
table: "table",
|
|
9
|
+
form: "form",
|
|
10
|
+
markdown: "markdown",
|
|
11
|
+
image: "image",
|
|
12
|
+
custom: "custom",
|
|
13
|
+
script: "script"
|
|
14
|
+
};
|
|
15
|
+
return map[t] || "custom";
|
|
16
|
+
}
|
|
17
|
+
/** Convert a CanvasComponent to A2UI surface. */
|
|
18
|
+
function componentToSurface(c) {
|
|
19
|
+
return {
|
|
20
|
+
id: c.id,
|
|
21
|
+
type: toA2UIType(c.type),
|
|
22
|
+
props: {
|
|
23
|
+
title: c.title,
|
|
24
|
+
width: c.width || "half"
|
|
25
|
+
},
|
|
26
|
+
data: c.data
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** Generate beginRendering from canvas state (full sync). */
|
|
30
|
+
function toBeginRendering(canvas) {
|
|
31
|
+
const surfaces = canvas.components.map(componentToSurface);
|
|
32
|
+
const dataModel = {};
|
|
33
|
+
for (const c of canvas.components) if (c.data != null) dataModel[c.id] = c.data;
|
|
34
|
+
return {
|
|
35
|
+
type: "beginRendering",
|
|
36
|
+
surfaceId: canvas.id,
|
|
37
|
+
surfaces,
|
|
38
|
+
dataModel: Object.keys(dataModel).length ? dataModel : void 0
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Generate surfaceUpdate for newly added component. */
|
|
42
|
+
function toSurfaceUpdate(canvasId, component) {
|
|
43
|
+
return {
|
|
44
|
+
type: "surfaceUpdate",
|
|
45
|
+
surfaceId: canvasId,
|
|
46
|
+
surfaces: [componentToSurface(component)]
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** Generate dataModelUpdate when component data changes. */
|
|
50
|
+
function toDataModelUpdate(canvasId, componentId, data) {
|
|
51
|
+
return {
|
|
52
|
+
type: "dataModelUpdate",
|
|
53
|
+
surfaceId: canvasId,
|
|
54
|
+
updates: { [componentId]: data }
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/** Generate deleteSurface for removed components. */
|
|
58
|
+
function toDeleteSurface(canvasId, componentIds) {
|
|
59
|
+
return {
|
|
60
|
+
type: "deleteSurface",
|
|
61
|
+
surfaceId: canvasId,
|
|
62
|
+
surfaceIds: componentIds
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/** Serialize A2UI messages to JSONL (one message per line). */
|
|
66
|
+
function toJSONL(messages) {
|
|
67
|
+
return messages.map((m) => JSON.stringify(m)).join("\n");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
exports.toBeginRendering = toBeginRendering;
|
|
72
|
+
exports.toDataModelUpdate = toDataModelUpdate;
|
|
73
|
+
exports.toDeleteSurface = toDeleteSurface;
|
|
74
|
+
exports.toJSONL = toJSONL;
|
|
75
|
+
exports.toSurfaceUpdate = toSurfaceUpdate;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-jS-bbMI5.js');
|
|
2
|
+
const chalk = require_chunk.__toESM(require("chalk"));
|
|
3
|
+
const inquirer = require_chunk.__toESM(require("inquirer"));
|
|
4
|
+
const fs_extra = require_chunk.__toESM(require("fs-extra"));
|
|
5
|
+
const path = require_chunk.__toESM(require("path"));
|
|
6
|
+
const os = require_chunk.__toESM(require("os"));
|
|
7
|
+
|
|
8
|
+
//#region src/routing/agents-routing.ts
|
|
9
|
+
var AgentRouter = class {
|
|
10
|
+
stateFile;
|
|
11
|
+
agents = [];
|
|
12
|
+
constructor() {
|
|
13
|
+
this.stateFile = path.default.join(os.default.homedir(), ".hyperclaw", "agents.json");
|
|
14
|
+
this.load();
|
|
15
|
+
}
|
|
16
|
+
load() {
|
|
17
|
+
try {
|
|
18
|
+
this.agents = fs_extra.default.readJsonSync(this.stateFile);
|
|
19
|
+
} catch {
|
|
20
|
+
this.agents = [{
|
|
21
|
+
workspace: path.default.join(os.default.homedir(), ".hyperclaw", "workspace"),
|
|
22
|
+
name: "default",
|
|
23
|
+
model: void 0,
|
|
24
|
+
bindings: []
|
|
25
|
+
}];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
save() {
|
|
29
|
+
fs_extra.default.ensureDirSync(path.default.dirname(this.stateFile));
|
|
30
|
+
fs_extra.default.writeJsonSync(this.stateFile, this.agents, { spaces: 2 });
|
|
31
|
+
}
|
|
32
|
+
listBindings() {
|
|
33
|
+
console.log(chalk.default.bold.cyan("\n 🦅 AGENT BINDINGS\n"));
|
|
34
|
+
if (this.agents.length === 0) {
|
|
35
|
+
console.log(chalk.default.gray(" No agents configured."));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
for (const agent of this.agents) {
|
|
39
|
+
console.log(` ${chalk.default.bold(agent.name)} ${chalk.default.gray(agent.workspace)}`);
|
|
40
|
+
if (agent.bindings.length === 0) console.log(` ${chalk.default.gray("No channel bindings — receives from all channels")}`);
|
|
41
|
+
else for (const b of agent.bindings) {
|
|
42
|
+
const acct = b.accountId ? chalk.default.gray(`@${b.accountId}`) : chalk.default.gray("(all accounts)");
|
|
43
|
+
const role = b.role === "primary" ? chalk.default.green("[primary]") : chalk.default.gray("[secondary]");
|
|
44
|
+
console.log(` ${chalk.default.cyan(b.channelId)} ${acct} ${role}`);
|
|
45
|
+
}
|
|
46
|
+
console.log();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async bind() {
|
|
50
|
+
console.log(chalk.default.cyan("\n Bind a channel to an agent workspace\n"));
|
|
51
|
+
const { channel, workspace, role } = await inquirer.default.prompt([
|
|
52
|
+
{
|
|
53
|
+
type: "input",
|
|
54
|
+
name: "channel",
|
|
55
|
+
message: "Channel ID (e.g. telegram, discord, slack):",
|
|
56
|
+
validate: (v) => v.trim().length > 0 || "Required"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: "input",
|
|
60
|
+
name: "workspace",
|
|
61
|
+
message: "Agent workspace (directory or name):",
|
|
62
|
+
default: "default"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: "list",
|
|
66
|
+
name: "role",
|
|
67
|
+
message: "Binding role:",
|
|
68
|
+
choices: [{
|
|
69
|
+
name: "primary — routes all traffic from this channel",
|
|
70
|
+
value: "primary"
|
|
71
|
+
}, {
|
|
72
|
+
name: "secondary — fallback if primary is busy",
|
|
73
|
+
value: "secondary"
|
|
74
|
+
}]
|
|
75
|
+
}
|
|
76
|
+
]);
|
|
77
|
+
let agent = this.agents.find((a) => a.name === workspace || a.workspace === workspace);
|
|
78
|
+
if (!agent) {
|
|
79
|
+
agent = {
|
|
80
|
+
workspace,
|
|
81
|
+
name: workspace,
|
|
82
|
+
bindings: []
|
|
83
|
+
};
|
|
84
|
+
this.agents.push(agent);
|
|
85
|
+
}
|
|
86
|
+
agent.bindings.push({
|
|
87
|
+
channelId: channel,
|
|
88
|
+
agentWorkspace: agent.workspace,
|
|
89
|
+
role,
|
|
90
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
91
|
+
});
|
|
92
|
+
this.save();
|
|
93
|
+
console.log(chalk.default.green(`\n ✔ Bound ${channel} → ${workspace} (${role})\n`));
|
|
94
|
+
}
|
|
95
|
+
async unbind() {
|
|
96
|
+
const allBindings = [];
|
|
97
|
+
for (const agent of this.agents) for (const b of agent.bindings) allBindings.push({
|
|
98
|
+
agent: agent.name,
|
|
99
|
+
channel: b.channelId
|
|
100
|
+
});
|
|
101
|
+
if (allBindings.length === 0) {
|
|
102
|
+
console.log(chalk.default.gray("\n No bindings to remove.\n"));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const { toRemove } = await inquirer.default.prompt([{
|
|
106
|
+
type: "checkbox",
|
|
107
|
+
name: "toRemove",
|
|
108
|
+
message: "Select bindings to remove:",
|
|
109
|
+
choices: allBindings.map((b) => ({
|
|
110
|
+
name: `${b.channel} → ${b.agent}`,
|
|
111
|
+
value: b
|
|
112
|
+
}))
|
|
113
|
+
}]);
|
|
114
|
+
for (const { agent: agentName, channel } of toRemove) {
|
|
115
|
+
const agent = this.agents.find((a) => a.name === agentName);
|
|
116
|
+
if (agent) agent.bindings = agent.bindings.filter((b) => b.channelId !== channel);
|
|
117
|
+
}
|
|
118
|
+
this.save();
|
|
119
|
+
console.log(chalk.default.green(`\n ✔ Removed ${toRemove.length} binding(s)\n`));
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
//#endregion
|
|
124
|
+
Object.defineProperty(exports, 'AgentRouter', {
|
|
125
|
+
enumerable: true,
|
|
126
|
+
get: function () {
|
|
127
|
+
return AgentRouter;
|
|
128
|
+
}
|
|
129
|
+
});
|