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,257 @@
1
+ /**
2
+ * `beehaven comment` · `beehaven comments` · `beehaven mention` — comments and @mentions on every
3
+ * workspace surface (SS-41).
4
+ *
5
+ * beehaven comment <ref> "text" comment on a document, sheet, deck, ticket, board,
6
+ * thought or canvas — <ref> is an id, a key (SS-41,
7
+ * CLR-42) or an exact title
8
+ * --quote "…" document passage --slide 3 deck slide (1-based or id)
9
+ * --cell B4 sheet cell ("Tab!B4") --sheet Tab sheet tab when --cell names none
10
+ * --column todo board column --pin <id> reply to a canvas pin
11
+ * --x 120 --y 80 new canvas pin --reply <id> reply to a comment
12
+ * beehaven comments <ref> [--all] read the thread (--all includes resolved)
13
+ *
14
+ * beehaven mention where YOU were @mentioned (pending)
15
+ * beehaven mention ack <id> mark one dealt with — or it replays in every brief
16
+ * beehaven mention who [query] who an @ can reach (people and agents)
17
+ * beehaven mention resolve "text" dry run: what the @s in some text would reach
18
+ *
19
+ * ⚠ ONE VERB PER DIRECTION, ANY SURFACE. The worker's `comment` / `comments` resolve the reference
20
+ * and dispatch to the surface's own verb, so every anchor rule and permission applies unchanged.
21
+ * ⚠ THE RECEIPT IS PRINTED. A mention that reached nobody is said out loud at post time — the one
22
+ * moment the author can still fix the handle.
23
+ */
24
+ import { agentRpc as rpcOnce, getTimeout } from './workspace.js';
25
+ const c = {
26
+ dim: (s) => `\x1b[2m${s}\x1b[0m`,
27
+ cyan: (s) => `\x1b[36m${s}\x1b[0m`,
28
+ violet: (s) => `\x1b[35m${s}\x1b[0m`,
29
+ yellow: (s) => `\x1b[33m${s}\x1b[0m`,
30
+ bold: (s) => `\x1b[1m${s}\x1b[0m`,
31
+ };
32
+ /** ⚠ `rpcOnce` returns `{ error }` as a VALUE and never throws. */
33
+ function failure(res) {
34
+ if (!res || typeof res !== 'object')
35
+ return null;
36
+ if (typeof res.error === 'string' && res.error)
37
+ return res.error;
38
+ if (res.ok === false)
39
+ return String(res.message ?? res.code ?? 'the workspace refused the call');
40
+ return null;
41
+ }
42
+ function die(msg, hint) {
43
+ console.error(` Error: ${msg}`);
44
+ if (hint)
45
+ console.error(c.dim(` ${hint}`));
46
+ process.exit(1);
47
+ }
48
+ const ago = (ts) => {
49
+ const d = Date.now() - Number(ts || 0);
50
+ if (d < 60_000)
51
+ return 'just now';
52
+ if (d < 3_600_000)
53
+ return `${Math.round(d / 60_000)}m ago`;
54
+ if (d < 86_400_000)
55
+ return `${Math.round(d / 3_600_000)}h ago`;
56
+ return `${Math.round(d / 86_400_000)}d ago`;
57
+ };
58
+ /** Print what a post's @s did. Exported so `ticket comment` reports the same way. */
59
+ export function printMentionReceipt(res) {
60
+ const mentions = Array.isArray(res?.mentions) ? res.mentions : [];
61
+ const unmatched = Array.isArray(res?.unmatchedMentions) ? res.unmatchedMentions : [];
62
+ const ambiguous = Array.isArray(res?.ambiguousMentions) ? res.ambiguousMentions : [];
63
+ const people = mentions.filter((m) => m?.kind !== 'agent').map((m) => `@${m.handle}`);
64
+ const agents = mentions.filter((m) => m?.kind === 'agent').map((m) => `@${m.handle}`);
65
+ if (people.length)
66
+ console.log(c.dim(` Mentioned ${people.join(', ')} — notified`));
67
+ if (agents.length)
68
+ console.log(c.dim(` Queued for ${agents.map(c.violet).join(', ')} — in their next brief`));
69
+ if (unmatched.length)
70
+ console.log(c.yellow(` ⚠ ${unmatched.map((m) => `@${m}`).join(', ')} matched nobody — not delivered. Try: beehaven mention who`));
71
+ if (ambiguous.length)
72
+ console.log(c.yellow(` ⚠ ${ambiguous.map((m) => `@${m}`).join(', ')} matched more than one — not delivered. Use a handle from: beehaven mention who`));
73
+ }
74
+ const ANCHOR_FLAGS = [
75
+ ['quote', 'quote'], ['slide', 'slide'], ['cell', 'cell'], ['sheet', 'sheet'],
76
+ ['column', 'column'], ['pin', 'pinId'], ['kind', 'kind'],
77
+ ];
78
+ export async function cmdComment(rest, values) {
79
+ const t = getTimeout(values);
80
+ const ref = rest[0];
81
+ const text = rest.slice(1).join(' ').trim() || String(values.body ?? '').trim();
82
+ if (!ref || !text)
83
+ die('usage: beehaven comment <ref> "<text>"', 'ref = id, key (SS-41, CLR-42) or exact title · @handle mentions a person or agent · beehaven mention who');
84
+ const input = { on: ref, body: text };
85
+ for (const [flag, key] of ANCHOR_FLAGS)
86
+ if (values[flag] !== undefined && values[flag] !== '')
87
+ input[key] = String(values[flag]);
88
+ if (values.x !== undefined)
89
+ input.x = Number(values.x);
90
+ if (values.y !== undefined)
91
+ input.y = Number(values.y);
92
+ if (values.reply)
93
+ input.parentId = String(values.reply);
94
+ const res = await rpcOnce('comment', input, t);
95
+ const f = failure(res);
96
+ if (f)
97
+ die(f, res?.hint);
98
+ if (values.json) {
99
+ console.log(JSON.stringify(res, null, 2));
100
+ return;
101
+ }
102
+ const on = res?.on ?? {};
103
+ const where = on.key || on.title || on.id || ref;
104
+ const anchor = res?.cell ? ` · ${res.cell}${res.sheetName ? ` (${res.sheetName})` : ''}`
105
+ : res?.anchorKind === 'slide' ? ` · ${String(res.anchor).replace(/^slide:/, 'slide ')}`
106
+ : res?.column ? ` · column ${res.column}`
107
+ : res?.pinId ? ` · pin ${res.pinId}` : '';
108
+ console.log(` Commented on ${c.cyan(String(where))} ${c.dim(`(${on.surface || on.kind || 'item'})${anchor}`)}`);
109
+ if (res?.warning)
110
+ console.log(c.yellow(` ⚠ ${res.warning}`));
111
+ printMentionReceipt(res);
112
+ }
113
+ export async function cmdComments(rest, values) {
114
+ const t = getTimeout(values);
115
+ const ref = rest[0];
116
+ if (!ref)
117
+ die('usage: beehaven comments <ref> [--all]');
118
+ const res = await rpcOnce('comments', { on: ref, ...(values.all ? { includeResolved: true } : {}), ...(values.kind ? { kind: String(values.kind) } : {}) }, t);
119
+ const f = failure(res);
120
+ if (f)
121
+ die(f, res?.hint);
122
+ if (values.json) {
123
+ console.log(JSON.stringify(res, null, 2));
124
+ return;
125
+ }
126
+ // Canvas threads are pins with messages; every other surface returns `comments`.
127
+ const rows = Array.isArray(res?.comments) ? res.comments
128
+ : Array.isArray(res?.pins) ? res.pins.flatMap((p) => (p.messages ?? []).map((m, i) => ({
129
+ id: m.id || `${p.id}#${i}`, body: m.text, authorName: m.authorName, author: m.author, at: m.at,
130
+ parentId: i ? p.id : null, anchorLabel: `pin ${p.id}`, resolved: p.resolved,
131
+ }))) : [];
132
+ const on = res?.on ?? {};
133
+ console.log('');
134
+ console.log(` ${c.bold(String(on.key || on.title || ref))} ${c.dim(`— ${on.surface || on.kind || ''}`)}`);
135
+ if (!rows.length) {
136
+ console.log(c.dim(' No comments.'));
137
+ return;
138
+ }
139
+ for (const r of rows) {
140
+ const who = r.authorName || (String(r.author || '').startsWith('agent:') ? String(r.author).slice(6) : r.author) || 'someone';
141
+ const anchor = r.cell ? `${r.cell}${r.sheetName ? `·${r.sheetName}` : ''}` : r.slide ? `slide ${r.slide}` : r.column ? `col ${r.column}` : r.anchorLabel || '';
142
+ const indent = r.parentId ? ' ↳ ' : ' ';
143
+ console.log(`${indent}${c.cyan(String(who))}${anchor ? c.dim(` [${anchor}]`) : ''}${r.resolved ? c.dim(' (resolved)') : ''} ${c.dim(ago(r.at))}`);
144
+ console.log(`${r.parentId ? ' ' : ' '}${String(r.body ?? '')}`);
145
+ }
146
+ }
147
+ export async function cmdMention(sub, rest, values) {
148
+ const t = getTimeout(values);
149
+ if (sub === 'help') {
150
+ console.log(`
151
+ ${c.cyan('beehaven mention')} — where you were @mentioned, and who an @ can reach
152
+
153
+ beehaven mention your pending mentions (--all for acknowledged too)
154
+ beehaven mention ack <id> mark one dealt with (it otherwise replays in every brief)
155
+ beehaven mention who [query] people and agents an @ resolves to
156
+ beehaven mention resolve "text" dry run — what the @s in the text would reach
157
+
158
+ Comment anywhere with: beehaven comment <ref> "text @handle"
159
+ `);
160
+ return;
161
+ }
162
+ if (!sub || sub === 'list' || sub === 'ls') {
163
+ const res = await rpcOnce('mention-list', { pendingOnly: !values.all }, t);
164
+ const f = failure(res);
165
+ if (f)
166
+ die(f);
167
+ if (values.json) {
168
+ console.log(JSON.stringify(res, null, 2));
169
+ return;
170
+ }
171
+ const rows = res?.mentions ?? [];
172
+ if (!rows.length) {
173
+ console.log(c.dim(values.all ? ' No mentions.' : ' Nothing waiting — no pending mentions.'));
174
+ return;
175
+ }
176
+ console.log('');
177
+ for (const m of rows) {
178
+ const on = m.on ?? {};
179
+ const acted = m.acted || m.read;
180
+ console.log(` ${c.violet(String(m.id).slice(0, 8))} ${c.cyan(String(m.from))} ${c.dim(`on ${on.kind || 'item'} “${on.title || on.id || ''}” · ${ago(m.at)}`)}${acted ? c.dim(' ✓') : ''}`);
181
+ console.log(` ${String(m.text ?? m.title ?? '').replace(/\s+/g, ' ').slice(0, 160)}`);
182
+ if (on.href)
183
+ console.log(c.dim(` ${on.href}`));
184
+ }
185
+ if (res?.for === 'agent' && res?.pending)
186
+ console.log(c.dim(`\n Act, reply with \`beehaven comment <ref> "…"\`, then \`beehaven mention ack <id>\`.`));
187
+ return;
188
+ }
189
+ if (sub === 'ack') {
190
+ const id = rest[0];
191
+ if (!id)
192
+ die('usage: beehaven mention ack <id>');
193
+ // ⚠ The list prints an 8-char prefix; resolve it against the full ids before acking.
194
+ let full = id;
195
+ if (id.length < 32) {
196
+ const listed = await rpcOnce('mention-list', { pendingOnly: false, limit: 200 }, t);
197
+ const hit = (listed?.mentions ?? []).filter((m) => String(m.id).startsWith(id));
198
+ if (hit.length === 1)
199
+ full = String(hit[0].id);
200
+ else if (hit.length > 1)
201
+ die(`"${id}" matches ${hit.length} mentions — give more of the id`);
202
+ }
203
+ const res = await rpcOnce('mention-ack', { id: full, ...(values.body ? { note: String(values.body) } : {}) }, t);
204
+ const f = failure(res);
205
+ if (f)
206
+ die(f);
207
+ if (values.json) {
208
+ console.log(JSON.stringify(res, null, 2));
209
+ return;
210
+ }
211
+ console.log(res?.already ? c.dim(' Already acknowledged.') : ' Acknowledged — it will not appear in your next brief.');
212
+ return;
213
+ }
214
+ if (sub === 'who') {
215
+ const res = await rpcOnce('mentionable', { ...(rest[0] ? { query: rest[0] } : {}) }, t);
216
+ const f = failure(res);
217
+ if (f)
218
+ die(f);
219
+ if (values.json) {
220
+ console.log(JSON.stringify(res, null, 2));
221
+ return;
222
+ }
223
+ const rows = res?.people ?? [];
224
+ if (!rows.length) {
225
+ console.log(c.dim(' Nobody matches.'));
226
+ return;
227
+ }
228
+ console.log('');
229
+ for (const p of rows) {
230
+ const tag = p.kind === 'agent' ? c.violet('agent') : c.dim('person');
231
+ console.log(` ${c.cyan('@' + p.handle).padEnd(34)} ${tag} ${p.name && p.name !== p.handle ? p.name : ''}`);
232
+ }
233
+ console.log(c.dim(`\n A person is notified; an agent gets it queued in its inbox (its next brief).`));
234
+ return;
235
+ }
236
+ if (sub === 'resolve') {
237
+ const text = rest.join(' ').trim();
238
+ if (!text)
239
+ die('usage: beehaven mention resolve "text with @handles"');
240
+ const res = await rpcOnce('mention-resolve', { text }, t);
241
+ const f = failure(res);
242
+ if (f)
243
+ die(f);
244
+ if (values.json) {
245
+ console.log(JSON.stringify(res, null, 2));
246
+ return;
247
+ }
248
+ const m = res?.mentions ?? [];
249
+ for (const x of m)
250
+ console.log(` ${c.cyan('@' + x.handle)} → ${x.kind === 'agent' ? c.violet('agent') : 'person'} ${x.name ?? ''}`);
251
+ printMentionReceipt({ unmatchedMentions: res?.unmatched, ambiguousMentions: res?.ambiguous });
252
+ if (!m.length && !(res?.unmatched?.length) && !(res?.ambiguous?.length))
253
+ console.log(c.dim(' No @mentions in that text.'));
254
+ return;
255
+ }
256
+ die(`unknown subcommand "${sub}"`, 'beehaven mention help');
257
+ }