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,215 @@
1
+ /**
2
+ * TranscriptTailer — tails Claude Code session JSONL files for full conversation streaming.
3
+ *
4
+ * When a SessionStart hook fires, we get the transcript_path. We then watch
5
+ * that file and stream every new entry (user prompts, assistant prose, tool calls,
6
+ * tool results) to the relay for DO storage and to IPC clients for live display.
7
+ *
8
+ * This captures everything hooks DON'T: Claude's conversational text responses,
9
+ * thinking blocks, and the full conversation flow.
10
+ */
11
+ // chokidar is loaded lazily in startTailing() so a daemon without chokidar
12
+ // bundled still imports this module cleanly — tailing becomes a no-op.
13
+ import { createReadStream, existsSync, statSync } from 'fs';
14
+ import { createInterface } from 'readline';
15
+ import { EventEmitter } from 'events';
16
+ export class TranscriptTailer extends EventEmitter {
17
+ /** Active tailers keyed by session ID */
18
+ tailers = new Map();
19
+ /**
20
+ * Start tailing a session transcript.
21
+ * Call this when a SessionStart hook fires with transcript_path.
22
+ */
23
+ async startTailing(sessionId, transcriptPath) {
24
+ // Callers fire-and-forget this method; any throw would become an
25
+ // unhandled rejection. All paths log and return.
26
+ try {
27
+ if (this.tailers.has(sessionId))
28
+ return;
29
+ if (!existsSync(transcriptPath))
30
+ return;
31
+ let watch;
32
+ try {
33
+ watch = (await import('chokidar')).watch;
34
+ }
35
+ catch {
36
+ console.warn(`[transcript-tailer] chokidar not available — cannot tail ${transcriptPath}`);
37
+ return;
38
+ }
39
+ await this._startTailingInner(sessionId, transcriptPath, watch);
40
+ }
41
+ catch (err) {
42
+ console.warn(`[transcript-tailer] startTailing failed for ${transcriptPath}: ${err?.message ?? err}`);
43
+ }
44
+ }
45
+ async _startTailingInner(sessionId, transcriptPath, watch) {
46
+ const lastSize = statSync(transcriptPath).size;
47
+ const watcher = watch(transcriptPath, {
48
+ persistent: true,
49
+ usePolling: true,
50
+ interval: 200,
51
+ });
52
+ const state = { path: transcriptPath, watcher, lastSize, processing: false };
53
+ this.tailers.set(sessionId, state);
54
+ watcher.on('change', () => {
55
+ this.readNewLines(sessionId, state);
56
+ });
57
+ // Read any existing content after our start position
58
+ // (there may be lines written between SessionStart and our watch starting)
59
+ setTimeout(() => this.readNewLines(sessionId, state), 100);
60
+ }
61
+ /**
62
+ * Stop tailing a session (call on SessionEnd).
63
+ * Does a final read to capture any remaining lines.
64
+ */
65
+ stopTailing(sessionId) {
66
+ const state = this.tailers.get(sessionId);
67
+ if (!state)
68
+ return;
69
+ // Final read
70
+ this.readNewLines(sessionId, state);
71
+ state.watcher.close();
72
+ this.tailers.delete(sessionId);
73
+ }
74
+ /** Stop all tailers */
75
+ stopAll() {
76
+ for (const [sessionId] of this.tailers) {
77
+ this.stopTailing(sessionId);
78
+ }
79
+ }
80
+ /** Number of active tailers */
81
+ get activeCount() {
82
+ return this.tailers.size;
83
+ }
84
+ // ─── Internal ───
85
+ async readNewLines(sessionId, state) {
86
+ if (state.processing)
87
+ return;
88
+ state.processing = true;
89
+ try {
90
+ if (!existsSync(state.path)) {
91
+ state.processing = false;
92
+ return;
93
+ }
94
+ const currentSize = statSync(state.path).size;
95
+ if (currentSize <= state.lastSize) {
96
+ if (currentSize < state.lastSize)
97
+ state.lastSize = 0; // File was truncated
98
+ state.processing = false;
99
+ return;
100
+ }
101
+ const stream = createReadStream(state.path, {
102
+ start: state.lastSize,
103
+ encoding: 'utf8',
104
+ });
105
+ const rl = createInterface({ input: stream });
106
+ for await (const line of rl) {
107
+ if (!line.trim())
108
+ continue;
109
+ try {
110
+ const raw = JSON.parse(line);
111
+ const entry = this.parseEntry(sessionId, raw);
112
+ if (entry) {
113
+ this.emit('entry', entry);
114
+ }
115
+ }
116
+ catch {
117
+ // Skip malformed lines
118
+ }
119
+ }
120
+ state.lastSize = currentSize;
121
+ }
122
+ catch {
123
+ // File may have been deleted
124
+ }
125
+ state.processing = false;
126
+ }
127
+ parseEntry(sessionId, raw) {
128
+ // Skip file-history-snapshot entries (large, not conversational)
129
+ if (raw.type === 'file-history-snapshot')
130
+ return null;
131
+ // Skip progress entries (subagent internal)
132
+ if (raw.type === 'progress')
133
+ return null;
134
+ // User message
135
+ if (raw.type === 'user' && raw.message?.role === 'user') {
136
+ const content = typeof raw.message.content === 'string'
137
+ ? raw.message.content
138
+ : Array.isArray(raw.message.content)
139
+ ? raw.message.content
140
+ .filter((b) => b.type === 'text')
141
+ .map((b) => b.text)
142
+ .join('')
143
+ : '';
144
+ return {
145
+ sessionId,
146
+ type: 'user',
147
+ role: 'user',
148
+ content,
149
+ uuid: raw.uuid,
150
+ timestamp: raw.timestamp,
151
+ raw,
152
+ };
153
+ }
154
+ // Assistant message
155
+ if (raw.type === 'assistant' || raw.message?.role === 'assistant') {
156
+ const content = raw.message?.content;
157
+ if (!Array.isArray(content))
158
+ return null;
159
+ // Extract text blocks
160
+ const textParts = content.filter((b) => b.type === 'text').map((b) => b.text);
161
+ const text = textParts.join('');
162
+ // Extract tool use blocks
163
+ const toolUses = content.filter((b) => b.type === 'tool_use');
164
+ // If it has text, emit as assistant message
165
+ if (text) {
166
+ return {
167
+ sessionId,
168
+ type: 'assistant',
169
+ role: 'assistant',
170
+ content: text,
171
+ uuid: raw.uuid,
172
+ timestamp: raw.timestamp,
173
+ raw,
174
+ };
175
+ }
176
+ // If it has tool use, emit as tool_use
177
+ if (toolUses.length > 0) {
178
+ const tool = toolUses[0];
179
+ return {
180
+ sessionId,
181
+ type: 'tool_use',
182
+ toolName: tool.name,
183
+ toolInput: tool.input,
184
+ uuid: raw.uuid,
185
+ timestamp: raw.timestamp,
186
+ raw,
187
+ };
188
+ }
189
+ // If it has thinking, emit as thinking
190
+ const thinking = content.find((b) => b.type === 'thinking');
191
+ if (thinking) {
192
+ return {
193
+ sessionId,
194
+ type: 'thinking',
195
+ content: '(thinking...)',
196
+ uuid: raw.uuid,
197
+ timestamp: raw.timestamp,
198
+ raw,
199
+ };
200
+ }
201
+ }
202
+ // Tool result
203
+ if (raw.type === 'tool_result') {
204
+ return {
205
+ sessionId,
206
+ type: 'tool_result',
207
+ toolResponse: raw.content,
208
+ uuid: raw.uuid,
209
+ timestamp: raw.timestamp,
210
+ raw,
211
+ };
212
+ }
213
+ return null;
214
+ }
215
+ }