@clearlysh/beehaven 0.8.16

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 (171) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +201 -0
  3. package/dist/__tests__/_cli-switch.js +105 -0
  4. package/dist/__tests__/agent-wrap-probe.js +136 -0
  5. package/dist/agent-attribution.js +192 -0
  6. package/dist/agent-identity-daemon.js +135 -0
  7. package/dist/agent-onboard.js +156 -0
  8. package/dist/agent-scope.js +79 -0
  9. package/dist/agent-sessions.js +370 -0
  10. package/dist/agent-state.js +482 -0
  11. package/dist/app-manifest.js +221 -0
  12. package/dist/app-signer.js +54 -0
  13. package/dist/app-signing.js +127 -0
  14. package/dist/audio-play.js +98 -0
  15. package/dist/avatar-protocol.js +25 -0
  16. package/dist/avatar-route.js +79 -0
  17. package/dist/bee/cloud-proxy.js +130 -0
  18. package/dist/blocked-actions.js +120 -0
  19. package/dist/build-channel.js +101 -0
  20. package/dist/buildings/daemon-workspace.js +475 -0
  21. package/dist/claude-bridge.js +310 -0
  22. package/dist/claude-credential-store.js +633 -0
  23. package/dist/clearly-sync.js +518 -0
  24. package/dist/clearly.js +616 -0
  25. package/dist/cli-state.js +334 -0
  26. package/dist/cli.js +6973 -0
  27. package/dist/commands/agent-skills.js +302 -0
  28. package/dist/commands/agent.js +1310 -0
  29. package/dist/commands/app.js +1123 -0
  30. package/dist/commands/auth.js +171 -0
  31. package/dist/commands/building-shell.js +392 -0
  32. package/dist/commands/canvas.js +932 -0
  33. package/dist/commands/claude.js +218 -0
  34. package/dist/commands/compliance.js +387 -0
  35. package/dist/commands/compose.js +507 -0
  36. package/dist/commands/composition.js +95 -0
  37. package/dist/commands/connect-session.js +409 -0
  38. package/dist/commands/conversations.js +160 -0
  39. package/dist/commands/costs.js +443 -0
  40. package/dist/commands/d1.js +253 -0
  41. package/dist/commands/daemon-cmd.js +162 -0
  42. package/dist/commands/deploy.js +164 -0
  43. package/dist/commands/design.js +617 -0
  44. package/dist/commands/dev-generate.js +125 -0
  45. package/dist/commands/dev.js +109 -0
  46. package/dist/commands/devices.js +135 -0
  47. package/dist/commands/explain-router.js +24 -0
  48. package/dist/commands/explain.js +882 -0
  49. package/dist/commands/explore.js +264 -0
  50. package/dist/commands/help.js +2418 -0
  51. package/dist/commands/init.js +408 -0
  52. package/dist/commands/install.js +129 -0
  53. package/dist/commands/library.js +229 -0
  54. package/dist/commands/marketplace.js +138 -0
  55. package/dist/commands/mcp-install.js +476 -0
  56. package/dist/commands/mention.js +257 -0
  57. package/dist/commands/omni.js +529 -0
  58. package/dist/commands/secrets.js +323 -0
  59. package/dist/commands/self-update.js +206 -0
  60. package/dist/commands/sheet.js +264 -0
  61. package/dist/commands/shell-output.js +309 -0
  62. package/dist/commands/shell.js +1048 -0
  63. package/dist/commands/shop.js +368 -0
  64. package/dist/commands/skills.js +311 -0
  65. package/dist/commands/slides.js +418 -0
  66. package/dist/commands/swarm.js +341 -0
  67. package/dist/commands/ticket.js +1301 -0
  68. package/dist/commands/tool.js +312 -0
  69. package/dist/commands/trash.js +106 -0
  70. package/dist/commands/treehouse.js +120 -0
  71. package/dist/commands/user.js +240 -0
  72. package/dist/commands/voice-tts.js +319 -0
  73. package/dist/commands/voice.js +166 -0
  74. package/dist/commands/watch-git.js +401 -0
  75. package/dist/commands/webhook.js +159 -0
  76. package/dist/commands/workspace.js +3354 -0
  77. package/dist/composition-repos.js +91 -0
  78. package/dist/daemon-avatar.js +130 -0
  79. package/dist/daemon-claude-code-auto-install.js +52 -0
  80. package/dist/daemon-client.js +363 -0
  81. package/dist/daemon-codex.js +349 -0
  82. package/dist/daemon-entry.js +101 -0
  83. package/dist/daemon-fetch-allowlist.js +194 -0
  84. package/dist/daemon-gemini.js +224 -0
  85. package/dist/daemon-mcp-clearly.js +353 -0
  86. package/dist/daemon-mcp-sandbox.js +127 -0
  87. package/dist/daemon-omni-company.js +338 -0
  88. package/dist/daemon-omni-hooks.js +375 -0
  89. package/dist/daemon-omni-identity.js +229 -0
  90. package/dist/daemon-omni-pipeline.js +251 -0
  91. package/dist/daemon-omni-policies.js +346 -0
  92. package/dist/daemon-omni-principal.js +580 -0
  93. package/dist/daemon-omni-tool-gate.js +116 -0
  94. package/dist/daemon-omni.js +1442 -0
  95. package/dist/daemon-path-transform.js +120 -0
  96. package/dist/daemon-write-sandbox.js +191 -0
  97. package/dist/daemon.js +4471 -0
  98. package/dist/dashboard.js +846 -0
  99. package/dist/dep-installer.js +286 -0
  100. package/dist/dev-mode.js +67 -0
  101. package/dist/doc-indexer.js +169 -0
  102. package/dist/e2e-crypto.js +94 -0
  103. package/dist/feature-flags.js +154 -0
  104. package/dist/file-browser.js +88 -0
  105. package/dist/first-party-hives.js +211 -0
  106. package/dist/folder-sync.js +226 -0
  107. package/dist/health.js +56 -0
  108. package/dist/ipc-auth.js +299 -0
  109. package/dist/ipc-client.js +495 -0
  110. package/dist/ipc-server.js +684 -0
  111. package/dist/keychain.js +224 -0
  112. package/dist/lib/admin-client.js +73 -0
  113. package/dist/lib/mobile-build-parser.js +156 -0
  114. package/dist/local-app-manager.js +660 -0
  115. package/dist/log-redaction.js +89 -0
  116. package/dist/logger.js +108 -0
  117. package/dist/manifest.js +143 -0
  118. package/dist/marketplace.js +793 -0
  119. package/dist/min-version-copy.js +51 -0
  120. package/dist/min-version.js +214 -0
  121. package/dist/public-surface.js +23 -0
  122. package/dist/relay-presets.js +89 -0
  123. package/dist/relay.js +2723 -0
  124. package/dist/repl.js +619 -0
  125. package/dist/setup-relay.js +363 -0
  126. package/dist/setup-service.js +536 -0
  127. package/dist/shared/bee-memory/index.js +6 -0
  128. package/dist/shared/bee-memory/types.js +682 -0
  129. package/dist/shared/claude-code/daemon-types.js +112 -0
  130. package/dist/shared/claude-code/index.js +2 -0
  131. package/dist/shared/claude-code/types.js +1 -0
  132. package/dist/shared/status/schema.js +133 -0
  133. package/dist/shell-session.js +198 -0
  134. package/dist/speak-lock.js +97 -0
  135. package/dist/spinner.js +57 -0
  136. package/dist/telemetry.js +166 -0
  137. package/dist/terminal/block-parser.js +207 -0
  138. package/dist/terminal/shell-integration.js +108 -0
  139. package/dist/transcript-tailer.js +215 -0
  140. package/dist/tts-qwen3.js +547 -0
  141. package/dist/types.js +4 -0
  142. package/dist/utm.js +38 -0
  143. package/dist/verb-surface.js +331 -0
  144. package/dist/version-utils.js +85 -0
  145. package/dist/watcher.js +207 -0
  146. package/package.json +88 -0
  147. package/python/qwen3_tts.py +230 -0
  148. package/scripts/stamp-build-channel.mjs +115 -0
  149. package/scripts/sync-installed.mjs +159 -0
  150. package/scripts/sync-skills.mjs +112 -0
  151. package/skills/README.md +24 -0
  152. package/skills/agent-doodle-space/SKILL.md +118 -0
  153. package/skills/agent-home/SKILL.md +98 -0
  154. package/skills/beehaven-cli/SKILL.md +144 -0
  155. package/skills/claude-shopper/README.md +90 -0
  156. package/skills/claude-shopper/SKILL.md +151 -0
  157. package/skills/clearly-agent/SKILL.md +183 -0
  158. package/skills/clearly-canvas/SKILL.md +222 -0
  159. package/skills/clearly-canvas/authoring.md +160 -0
  160. package/skills/clearly-canvas/communications.md +32 -0
  161. package/skills/clearly-canvas/composition-patterns.md +84 -0
  162. package/skills/clearly-canvas/example.mjs +78 -0
  163. package/skills/clearly-canvas/project-plans.md +156 -0
  164. package/skills/clearly-canvas/review.mjs +68 -0
  165. package/skills/clearly-workspace/SKILL.md +79 -0
  166. package/skills/clearly-workspace/survey.mjs +101 -0
  167. package/skills/codebase-map/SKILL.md +142 -0
  168. package/skills/design-craft/SKILL.md +300 -0
  169. package/skills/index.json +79 -0
  170. package/skills/layout-systems/SKILL.md +184 -0
  171. package/skills/pair-on-canvas/SKILL.md +92 -0
@@ -0,0 +1,159 @@
1
+ /**
2
+ * beehaven webhook — outgoing webhook DLQ inspection + replay
3
+ *
4
+ * Operates on the `_bh_webhooks` table the SDK's `this.webhooks()` writes
5
+ * into. Targets one workspace at a time via `<type>/<id>` (same shape as
6
+ * `beehaven admin sql`).
7
+ *
8
+ * Subcommands:
9
+ * list <type>/<id> [--status pending|dead|delivered] [--event NAME] [--limit N]
10
+ * show <type>/<id> <eventId>
11
+ * replay <type>/<id> <eventId> Re-arms the row; the next alarm tick drains it.
12
+ * dlq <type>/<id> Shortcut for `list --status dead`
13
+ *
14
+ * Auth: --url + --secret (or BEEHAVEN_WORKER_URL / BEEHAVEN_ADMIN_SECRET).
15
+ */
16
+ import { color, spinner, table } from '../spinner.js';
17
+ import { getAdminClient, doActionPath } from '../lib/admin-client.js';
18
+ function parseTarget(input) {
19
+ if (!input || !input.includes('/')) {
20
+ return { error: 'Target must be <type>/<id> — e.g. User/abc123' };
21
+ }
22
+ const [type, id] = input.split('/', 2);
23
+ return { type, id };
24
+ }
25
+ function fmtTime(ms) {
26
+ if (!ms)
27
+ return '—';
28
+ const n = typeof ms === 'string' ? Number(ms) : ms;
29
+ if (!isFinite(n))
30
+ return '—';
31
+ const d = new Date(n);
32
+ const today = new Date();
33
+ if (d.toDateString() === today.toDateString())
34
+ return d.toTimeString().slice(0, 8);
35
+ return d.toISOString().slice(0, 19).replace('T', ' ');
36
+ }
37
+ function statusColor(s) {
38
+ if (s === 'dead')
39
+ return color.red(s);
40
+ if (s === 'pending')
41
+ return color.yellow(s);
42
+ if (s === 'delivered')
43
+ return color.green(s);
44
+ return s;
45
+ }
46
+ async function runSql(client, t, query) {
47
+ const { ok, status, body } = await client.call(doActionPath(t.type, t.id, 'admin:sql'), {
48
+ method: 'POST',
49
+ body: { query },
50
+ });
51
+ if (!ok) {
52
+ console.error(color.red(`HTTP ${status}: ${body?.error ?? 'unknown'}`));
53
+ return null;
54
+ }
55
+ return body?.rows ?? [];
56
+ }
57
+ export async function webhook(opts) {
58
+ const client = getAdminClient({ url: opts.url, secret: opts.secret });
59
+ if ('error' in client) {
60
+ console.error(color.red(client.error));
61
+ process.exit(1);
62
+ }
63
+ const sub = opts.subcommand ?? 'list';
64
+ switch (sub) {
65
+ case 'list':
66
+ case 'dlq': {
67
+ const t = parseTarget(opts.positionals[0]);
68
+ if ('error' in t) {
69
+ console.error(t.error);
70
+ process.exit(1);
71
+ }
72
+ const limit = opts.limit ? parseInt(opts.limit) : 50;
73
+ const status = sub === 'dlq' ? 'dead' : opts.status;
74
+ const filters = [];
75
+ if (status)
76
+ filters.push(`status = '${status.replace(/'/g, '')}'`);
77
+ const where = filters.length ? `WHERE ${filters.join(' AND ')}` : '';
78
+ const sp = spinner(`Loading webhooks from ${t.type}/${t.id}…`).start();
79
+ const rows = await runSql(client, t, `SELECT id, event, status, attempts, created_at, last_error FROM _bh_webhooks ${where} ORDER BY created_at DESC LIMIT ${limit}`);
80
+ if (!rows) {
81
+ sp.fail('Query failed');
82
+ process.exit(1);
83
+ }
84
+ sp.succeed(`${rows.length} events`);
85
+ if (opts.json) {
86
+ console.log(JSON.stringify(rows, null, 2));
87
+ return;
88
+ }
89
+ if (rows.length === 0) {
90
+ console.log(color.dim('(no webhooks)'));
91
+ return;
92
+ }
93
+ console.log('');
94
+ console.log(table(['ID', 'Event', 'Status', 'Tries', 'Created', 'Last Error'], rows.map((r) => [
95
+ color.cyan(String(r.id).slice(0, 12)),
96
+ r.event ?? '—',
97
+ statusColor(r.status ?? '—'),
98
+ String(r.attempts ?? 0),
99
+ fmtTime(r.created_at),
100
+ r.last_error ? color.dim(String(r.last_error).slice(0, 40)) : '—',
101
+ ])));
102
+ return;
103
+ }
104
+ case 'show': {
105
+ const t = parseTarget(opts.positionals[0]);
106
+ if ('error' in t) {
107
+ console.error(t.error);
108
+ process.exit(1);
109
+ }
110
+ const eventId = opts.positionals[1];
111
+ if (!eventId) {
112
+ console.error('Usage: beehaven webhook show <type>/<id> <eventId>');
113
+ process.exit(1);
114
+ }
115
+ const sp = spinner(`Loading ${eventId}…`).start();
116
+ const rows = await runSql(client, t, `SELECT * FROM _bh_webhooks WHERE id = '${eventId.replace(/'/g, "''")}'`);
117
+ if (!rows) {
118
+ sp.fail('Query failed');
119
+ process.exit(1);
120
+ }
121
+ sp.succeed(rows.length ? 'Found' : 'Not found');
122
+ if (rows.length === 0)
123
+ process.exit(1);
124
+ console.log(JSON.stringify(rows[0], null, 2));
125
+ return;
126
+ }
127
+ case 'replay': {
128
+ const t = parseTarget(opts.positionals[0]);
129
+ if ('error' in t) {
130
+ console.error(t.error);
131
+ process.exit(1);
132
+ }
133
+ const eventId = opts.positionals[1];
134
+ if (!eventId) {
135
+ console.error('Usage: beehaven webhook replay <type>/<id> <eventId>');
136
+ process.exit(1);
137
+ }
138
+ const escaped = eventId.replace(/'/g, "''");
139
+ const sp = spinner(`Re-arming ${eventId}…`).start();
140
+ const rows = await runSql(client, t, `UPDATE _bh_webhooks SET status = 'pending', attempts = 0, next_retry_at = ${Date.now()}, last_error = NULL, delivered_at = NULL WHERE id = '${escaped}' RETURNING id`);
141
+ if (!rows) {
142
+ sp.fail('Update failed');
143
+ process.exit(1);
144
+ }
145
+ if (rows.length === 0) {
146
+ sp.fail(`No webhook with id ${eventId}`);
147
+ process.exit(1);
148
+ }
149
+ sp.succeed(`Re-armed ${eventId}`);
150
+ console.log(color.dim(' Status flipped to pending — the next alarm tick will drain it.'));
151
+ console.log(color.dim(' For an immediate drain, expose a `webhook-drain` action on your workspace.'));
152
+ return;
153
+ }
154
+ default:
155
+ console.error(`Unknown webhook subcommand: ${sub}`);
156
+ console.error('Use: list | dlq | show | replay');
157
+ process.exit(1);
158
+ }
159
+ }