@bubblebrain-ai/bubble 0.0.12 → 0.0.14

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 (180) hide show
  1. package/dist/agent/execution-governor.js +1 -1
  2. package/dist/agent/input-controller.d.ts +11 -0
  3. package/dist/agent/input-controller.js +30 -0
  4. package/dist/agent/tool-intent.js +1 -0
  5. package/dist/agent.d.ts +8 -4
  6. package/dist/agent.js +623 -312
  7. package/dist/approval/controller.d.ts +1 -0
  8. package/dist/approval/controller.js +20 -3
  9. package/dist/approval/tool-helper.js +2 -0
  10. package/dist/approval/types.d.ts +14 -1
  11. package/dist/context/compact.js +9 -3
  12. package/dist/context/projector.js +27 -12
  13. package/dist/debug-trace.d.ts +27 -0
  14. package/dist/debug-trace.js +385 -0
  15. package/dist/feishu/agent-host/approval-card.js +9 -0
  16. package/dist/feishu/serve.js +7 -1
  17. package/dist/main.js +86 -9
  18. package/dist/model-catalog.js +1 -0
  19. package/dist/orchestrator/default-hooks.js +19 -8
  20. package/dist/orchestrator/hooks.d.ts +1 -0
  21. package/dist/prompt/environment.js +2 -0
  22. package/dist/prompt/reminders.d.ts +5 -6
  23. package/dist/prompt/reminders.js +8 -9
  24. package/dist/prompt/runtime.js +2 -2
  25. package/dist/provider-openai-codex.d.ts +7 -0
  26. package/dist/provider-openai-codex.js +265 -124
  27. package/dist/provider-registry.d.ts +2 -0
  28. package/dist/provider-registry.js +58 -9
  29. package/dist/provider.d.ts +3 -0
  30. package/dist/provider.js +5 -1
  31. package/dist/session-log.js +13 -1
  32. package/dist/slash-commands/commands.js +39 -0
  33. package/dist/slash-commands/types.d.ts +12 -0
  34. package/dist/stats/usage.d.ts +52 -0
  35. package/dist/stats/usage.js +414 -0
  36. package/dist/tools/apply-patch.d.ts +9 -0
  37. package/dist/tools/apply-patch.js +330 -0
  38. package/dist/tools/bash.js +205 -44
  39. package/dist/tools/edit-apply.d.ts +5 -2
  40. package/dist/tools/edit-apply.js +221 -31
  41. package/dist/tools/edit.js +12 -3
  42. package/dist/tools/file-mutation-queue.d.ts +1 -0
  43. package/dist/tools/file-mutation-queue.js +12 -1
  44. package/dist/tools/index.d.ts +2 -0
  45. package/dist/tools/index.js +7 -1
  46. package/dist/tools/patch-apply.d.ts +41 -0
  47. package/dist/tools/patch-apply.js +312 -0
  48. package/dist/tools/server-manager.d.ts +36 -0
  49. package/dist/tools/server-manager.js +234 -0
  50. package/dist/tools/server.d.ts +6 -0
  51. package/dist/tools/server.js +245 -0
  52. package/dist/tools/write.d.ts +3 -6
  53. package/dist/tools/write.js +26 -46
  54. package/dist/tui/clipboard.d.ts +1 -0
  55. package/dist/tui/clipboard.js +53 -0
  56. package/dist/tui/detect-theme.d.ts +2 -0
  57. package/dist/tui/detect-theme.js +87 -0
  58. package/dist/tui/display-history.d.ts +63 -0
  59. package/dist/tui/display-history.js +306 -0
  60. package/dist/tui/edit-diff.d.ts +11 -0
  61. package/dist/tui/edit-diff.js +57 -0
  62. package/dist/tui/escape-confirmation.d.ts +15 -0
  63. package/dist/tui/escape-confirmation.js +30 -0
  64. package/dist/tui/file-mentions.d.ts +29 -0
  65. package/dist/tui/file-mentions.js +174 -0
  66. package/dist/tui/global-key-router.d.ts +3 -0
  67. package/dist/tui/global-key-router.js +87 -0
  68. package/dist/tui/image-paste.d.ts +95 -0
  69. package/dist/tui/image-paste.js +505 -0
  70. package/dist/tui/input-history.d.ts +16 -0
  71. package/dist/tui/input-history.js +79 -0
  72. package/dist/tui/markdown-inline.d.ts +22 -0
  73. package/dist/tui/markdown-inline.js +68 -0
  74. package/dist/tui/markdown-theme-rules.d.ts +23 -0
  75. package/dist/tui/markdown-theme-rules.js +164 -0
  76. package/dist/tui/markdown-theme.d.ts +5 -0
  77. package/dist/tui/markdown-theme.js +27 -0
  78. package/dist/tui/model-picker-data.d.ts +10 -0
  79. package/dist/tui/model-picker-data.js +32 -0
  80. package/dist/tui/opencode-spinner.d.ts +22 -0
  81. package/dist/tui/opencode-spinner.js +216 -0
  82. package/dist/tui/prompt-keybindings.d.ts +42 -0
  83. package/dist/tui/prompt-keybindings.js +35 -0
  84. package/dist/tui/recent-activity.d.ts +8 -0
  85. package/dist/tui/recent-activity.js +71 -0
  86. package/dist/tui/render-signature.d.ts +1 -0
  87. package/dist/tui/render-signature.js +7 -0
  88. package/dist/tui/run.d.ts +45 -0
  89. package/dist/tui/run.js +9359 -0
  90. package/dist/tui/session-display.d.ts +6 -0
  91. package/dist/tui/session-display.js +12 -0
  92. package/dist/tui/sidebar-mcp.d.ts +31 -0
  93. package/dist/tui/sidebar-mcp.js +62 -0
  94. package/dist/tui/sidebar-state.d.ts +12 -0
  95. package/dist/tui/sidebar-state.js +69 -0
  96. package/dist/tui/streaming-tool-args.d.ts +15 -0
  97. package/dist/tui/streaming-tool-args.js +30 -0
  98. package/dist/tui/tool-renderers/fallback.d.ts +2 -0
  99. package/dist/tui/tool-renderers/fallback.js +75 -0
  100. package/dist/tui/tool-renderers/registry.d.ts +3 -0
  101. package/dist/tui/tool-renderers/registry.js +11 -0
  102. package/dist/tui/tool-renderers/subagent.d.ts +2 -0
  103. package/dist/tui/tool-renderers/subagent.js +135 -0
  104. package/dist/tui/tool-renderers/types.d.ts +36 -0
  105. package/dist/tui/tool-renderers/types.js +1 -0
  106. package/dist/tui/tool-renderers/write-preview.d.ts +12 -0
  107. package/dist/tui/tool-renderers/write-preview.js +32 -0
  108. package/dist/tui/tool-renderers/write.d.ts +6 -0
  109. package/dist/tui/tool-renderers/write.js +88 -0
  110. package/dist/tui/trace-groups.d.ts +27 -0
  111. package/dist/tui/trace-groups.js +419 -0
  112. package/dist/tui/wordmark.d.ts +15 -0
  113. package/dist/tui/wordmark.js +179 -0
  114. package/dist/tui-ink/app.js +45 -9
  115. package/dist/tui-ink/approval/approval-dialog.js +7 -1
  116. package/dist/tui-ink/display-history.d.ts +1 -0
  117. package/dist/tui-ink/display-history.js +5 -4
  118. package/dist/tui-ink/message-list.js +23 -9
  119. package/dist/tui-ink/theme.d.ts +3 -9
  120. package/dist/tui-ink/theme.js +39 -45
  121. package/dist/tui-ink/trace-groups.js +1 -1
  122. package/dist/tui-ink/welcome.js +22 -78
  123. package/dist/tui-opentui/app.d.ts +54 -0
  124. package/dist/tui-opentui/app.js +1365 -0
  125. package/dist/tui-opentui/approval/approval-dialog.d.ts +15 -0
  126. package/dist/tui-opentui/approval/approval-dialog.js +145 -0
  127. package/dist/tui-opentui/approval/diff-view.d.ts +9 -0
  128. package/dist/tui-opentui/approval/diff-view.js +43 -0
  129. package/dist/tui-opentui/approval/select.d.ts +37 -0
  130. package/dist/tui-opentui/approval/select.js +91 -0
  131. package/dist/tui-opentui/detect-theme.d.ts +2 -0
  132. package/dist/tui-opentui/detect-theme.js +87 -0
  133. package/dist/tui-opentui/display-history.d.ts +56 -0
  134. package/dist/tui-opentui/display-history.js +130 -0
  135. package/dist/tui-opentui/edit-diff.d.ts +11 -0
  136. package/dist/tui-opentui/edit-diff.js +57 -0
  137. package/dist/tui-opentui/feedback-dialog.d.ts +21 -0
  138. package/dist/tui-opentui/feedback-dialog.js +164 -0
  139. package/dist/tui-opentui/feishu-setup-picker.d.ts +7 -0
  140. package/dist/tui-opentui/feishu-setup-picker.js +272 -0
  141. package/dist/tui-opentui/file-mentions.d.ts +29 -0
  142. package/dist/tui-opentui/file-mentions.js +174 -0
  143. package/dist/tui-opentui/footer.d.ts +26 -0
  144. package/dist/tui-opentui/footer.js +40 -0
  145. package/dist/tui-opentui/image-paste.d.ts +54 -0
  146. package/dist/tui-opentui/image-paste.js +288 -0
  147. package/dist/tui-opentui/input-box.d.ts +34 -0
  148. package/dist/tui-opentui/input-box.js +471 -0
  149. package/dist/tui-opentui/input-history.d.ts +16 -0
  150. package/dist/tui-opentui/input-history.js +79 -0
  151. package/dist/tui-opentui/markdown.d.ts +66 -0
  152. package/dist/tui-opentui/markdown.js +127 -0
  153. package/dist/tui-opentui/message-list.d.ts +31 -0
  154. package/dist/tui-opentui/message-list.js +128 -0
  155. package/dist/tui-opentui/model-picker.d.ts +63 -0
  156. package/dist/tui-opentui/model-picker.js +450 -0
  157. package/dist/tui-opentui/plan-confirm.d.ts +9 -0
  158. package/dist/tui-opentui/plan-confirm.js +124 -0
  159. package/dist/tui-opentui/question-dialog.d.ts +10 -0
  160. package/dist/tui-opentui/question-dialog.js +110 -0
  161. package/dist/tui-opentui/recent-activity.d.ts +8 -0
  162. package/dist/tui-opentui/recent-activity.js +71 -0
  163. package/dist/tui-opentui/run-session-picker.d.ts +10 -0
  164. package/dist/tui-opentui/run-session-picker.js +28 -0
  165. package/dist/tui-opentui/run.d.ts +38 -0
  166. package/dist/tui-opentui/run.js +48 -0
  167. package/dist/tui-opentui/session-picker.d.ts +12 -0
  168. package/dist/tui-opentui/session-picker.js +120 -0
  169. package/dist/tui-opentui/theme.d.ts +89 -0
  170. package/dist/tui-opentui/theme.js +157 -0
  171. package/dist/tui-opentui/todos.d.ts +9 -0
  172. package/dist/tui-opentui/todos.js +45 -0
  173. package/dist/tui-opentui/trace-groups.d.ts +27 -0
  174. package/dist/tui-opentui/trace-groups.js +419 -0
  175. package/dist/tui-opentui/use-terminal-size.d.ts +4 -0
  176. package/dist/tui-opentui/use-terminal-size.js +5 -0
  177. package/dist/tui-opentui/welcome.d.ts +25 -0
  178. package/dist/tui-opentui/welcome.js +77 -0
  179. package/dist/types.d.ts +36 -2
  180. package/package.json +5 -1
@@ -0,0 +1,25 @@
1
+ /** @jsxImportSource @opentui/react */
2
+ import React from "react";
3
+ import type { DisplayMessage } from "./display-history.js";
4
+ interface WelcomeBannerProps {
5
+ terminalColumns: number;
6
+ modelLabel?: string;
7
+ cwd?: string;
8
+ tips: string[];
9
+ skillsCount?: number;
10
+ mcpConnectedCount?: number;
11
+ mcpTotalCount?: number;
12
+ hasAgentsFile?: boolean;
13
+ }
14
+ interface HomeSurfaceProps extends WelcomeBannerProps {
15
+ terminalRows: number;
16
+ composer: React.ReactNode;
17
+ }
18
+ interface WelcomeVisibilityInput {
19
+ messages: Pick<DisplayMessage, "role" | "syntheticKind">[];
20
+ startedWithVisibleHistory: boolean;
21
+ }
22
+ export declare function shouldShowWelcomeBanner({ messages, startedWithVisibleHistory, }: WelcomeVisibilityInput): boolean;
23
+ export declare function WelcomeBanner({ terminalColumns, modelLabel, cwd, tips, skillsCount, mcpConnectedCount, mcpTotalCount, hasAgentsFile, }: WelcomeBannerProps): React.ReactNode;
24
+ export declare function HomeSurface({ terminalColumns, terminalRows, modelLabel, cwd, tips, skillsCount, mcpConnectedCount, mcpTotalCount, hasAgentsFile, composer, }: HomeSurfaceProps): React.ReactNode;
25
+ export {};
@@ -0,0 +1,77 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
2
+ import { createRequire } from "node:module";
3
+ import { useTheme } from "./theme.js";
4
+ import { BUBBLE_COMPACT_WORDMARK, BUBBLE_WORDMARK, bubbleWordmarkMaxWidth, } from "../tui/wordmark.js";
5
+ const require = createRequire(import.meta.url);
6
+ const PACKAGE_VERSION = readPackageVersion();
7
+ const WIDE_LOGO_MIN_WIDTH = bubbleWordmarkMaxWidth(BUBBLE_WORDMARK) + 4;
8
+ export function shouldShowWelcomeBanner({ messages, startedWithVisibleHistory, }) {
9
+ if (startedWithVisibleHistory)
10
+ return false;
11
+ return !messages.some((message) => message.syntheticKind !== "ui_summary");
12
+ }
13
+ export function WelcomeBanner({ terminalColumns, modelLabel, cwd, tips, skillsCount = 0, mcpConnectedCount = 0, mcpTotalCount = 0, hasAgentsFile = false, }) {
14
+ const theme = useTheme();
15
+ const effectiveWidth = Math.max(20, Math.min(terminalColumns - 2, 118));
16
+ const useWideLogo = effectiveWidth >= WIDE_LOGO_MIN_WIDTH;
17
+ const actionableTips = tips
18
+ .filter((item) => !item.startsWith("Ready with") && item.trim().length > 0)
19
+ .slice(0, 2);
20
+ const tip = actionableTips.length > 0
21
+ ? actionableTips.join(" · ")
22
+ : "Type / for commands and @ to reference files";
23
+ const sessionLine = modelLabel
24
+ ? `${modelLabel}${cwd ? ` · ${cwd}` : ""}`
25
+ : cwd;
26
+ return (_jsxs("box", { style: { flexDirection: "column", marginBottom: 1 }, children: [useWideLogo ? (_jsx("box", { style: { flexDirection: "column" }, children: BUBBLE_WORDMARK.map((line, i) => (_jsx(LogoRow, { line: line, theme: theme }, `logo-row-${i}`))) })) : (_jsx(LogoRow, { line: BUBBLE_COMPACT_WORDMARK[0] ?? { text: "bubble βrain", tone: "ink" }, theme: theme })), _jsxs("box", { style: { marginTop: 1, flexDirection: "column" }, children: [_jsx(MetaRow, { label: "Version", value: PACKAGE_VERSION, theme: theme }), sessionLine && _jsx(MetaRow, { label: "Session", value: sessionLine, theme: theme, bold: true }), _jsx(MetaRow, { label: "Tip", value: tip, theme: theme }), _jsx(MetaRow, { label: "Status", value: statusSummary(skillsCount, mcpConnectedCount, mcpTotalCount, hasAgentsFile), theme: theme })] })] }));
27
+ }
28
+ function LogoRow({ line, theme }) {
29
+ if (!line.segments) {
30
+ return (_jsx("text", { fg: logoColor(theme, line.tone ?? "caption"), attributes: 1, content: line.text ?? "" }));
31
+ }
32
+ return (_jsx("box", { style: { flexDirection: "row" }, children: line.segments.map((segment, index) => (_jsx("text", { fg: logoColor(theme, segment.tone), attributes: 1, content: segment.text }, `${index}-${segment.text}`))) }));
33
+ }
34
+ function logoColor(theme, tone) {
35
+ switch (tone) {
36
+ case "brand": return theme.warning;
37
+ case "ink": return theme.text;
38
+ case "stone": return theme.textMuted;
39
+ case "soft": return theme.textDim;
40
+ case "caption": return theme.textMuted;
41
+ }
42
+ }
43
+ export function HomeSurface({ terminalColumns, terminalRows, modelLabel, cwd, tips, skillsCount = 0, mcpConnectedCount = 0, mcpTotalCount = 0, hasAgentsFile = false, composer, }) {
44
+ const theme = useTheme();
45
+ const height = Math.max(18, terminalRows - 1);
46
+ const effectiveWidth = Math.max(24, Math.min(terminalColumns - 4, 118));
47
+ const composerWidth = Math.min(76, effectiveWidth);
48
+ return (_jsxs("box", { style: {
49
+ height,
50
+ flexDirection: "column",
51
+ alignItems: "center",
52
+ justifyContent: "center",
53
+ paddingLeft: 2,
54
+ paddingRight: 2,
55
+ }, children: [_jsx(WelcomeBanner, { terminalColumns: effectiveWidth, modelLabel: modelLabel, cwd: cwd, tips: tips, skillsCount: skillsCount, mcpConnectedCount: mcpConnectedCount, mcpTotalCount: mcpTotalCount, hasAgentsFile: hasAgentsFile }), _jsx("box", { style: { width: composerWidth, maxWidth: composerWidth, marginTop: 1 }, children: composer }), _jsx("box", { style: { marginTop: 1 }, children: _jsx("text", { fg: theme.textMuted, content: "enter send \u00B7 shift+enter newline \u00B7 / commands \u00B7 @ files" }) })] }));
56
+ }
57
+ function MetaRow({ label, value, theme, bold, }) {
58
+ // opencode uses 10-char left-padded labels in textMuted + bold value in text.
59
+ const padded = label.padEnd(10, " ");
60
+ return (_jsxs("box", { style: { flexDirection: "row" }, children: [_jsx("text", { fg: theme.textMuted, content: padded }), _jsx("text", { fg: theme.text, attributes: bold ? 1 : 0, content: value })] }));
61
+ }
62
+ function statusSummary(skills, mcpOn, mcpTotal, agents) {
63
+ const parts = [];
64
+ parts.push(skills > 0 ? `${skills} skills` : "no skills");
65
+ parts.push(mcpTotal === 0 ? "no MCPs" : `${mcpOn}/${mcpTotal} MCPs`);
66
+ parts.push(agents ? "AGENTS.md ✓" : "AGENTS.md ×");
67
+ return parts.join(" · ");
68
+ }
69
+ function readPackageVersion() {
70
+ try {
71
+ const pkg = require("../../package.json");
72
+ return pkg.version ? `v${pkg.version}` : "v0.0.0";
73
+ }
74
+ catch {
75
+ return "v0.0.0";
76
+ }
77
+ }
package/dist/types.d.ts CHANGED
@@ -23,6 +23,16 @@ export interface AssistantMessage {
23
23
  content: string;
24
24
  reasoning?: string;
25
25
  toolCalls?: ToolCall[];
26
+ /** Model metadata captured for local usage statistics. */
27
+ model?: string;
28
+ providerId?: string;
29
+ modelId?: string;
30
+ usage?: TokenUsage;
31
+ error?: {
32
+ name: string;
33
+ message: string;
34
+ aborted?: boolean;
35
+ };
26
36
  }
27
37
  export interface ToolMessage {
28
38
  role: "tool";
@@ -90,9 +100,9 @@ export interface ParsedToolCall extends ToolCall {
90
100
  */
91
101
  argsCorrupt?: boolean;
92
102
  }
93
- export type ToolResultStatus = "success" | "no_match" | "partial" | "timeout" | "blocked" | "command_error";
103
+ export type ToolResultStatus = "success" | "no_match" | "partial" | "timeout" | "blocked" | "cancelled" | "command_error";
94
104
  export interface ToolResultMetadata {
95
- kind?: "search" | "read" | "write" | "edit" | "shell" | "web" | "security" | "lsp" | "question" | "subagent";
105
+ kind?: "search" | "read" | "write" | "edit" | "patch" | "shell" | "server" | "web" | "security" | "lsp" | "question" | "subagent";
96
106
  path?: string;
97
107
  pattern?: string;
98
108
  matches?: number;
@@ -267,6 +277,16 @@ export interface Provider {
267
277
  abortSignal?: AbortSignal;
268
278
  }): Promise<string>;
269
279
  }
280
+ export interface AgentRunInput {
281
+ id: string;
282
+ content: string;
283
+ submittedAt?: number;
284
+ }
285
+ export interface AgentInputController {
286
+ drainPendingInputs(): AgentRunInput[];
287
+ pendingInputCount(): number;
288
+ }
289
+ export type AgentInputRejectedReason = "no_continuation";
270
290
  export type AgentEvent = {
271
291
  type: "turn_start";
272
292
  } | {
@@ -313,6 +333,20 @@ export type AgentEvent = {
313
333
  type: "context_recovered";
314
334
  droppedMessages: number;
315
335
  reason: "overflow";
336
+ } | {
337
+ type: "input_pending_changed";
338
+ pending: number;
339
+ } | {
340
+ type: "input_applied";
341
+ id: string;
342
+ content: string;
343
+ target: "current_turn";
344
+ } | {
345
+ type: "input_rejected";
346
+ id: string;
347
+ content: string;
348
+ reason: AgentInputRejectedReason;
349
+ target: "next_turn";
316
350
  } | {
317
351
  type: "mode_changed";
318
352
  mode: PermissionMode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bubblebrain-ai/bubble",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "A terminal coding agent",
5
5
  "type": "module",
6
6
  "engines": {
@@ -25,6 +25,9 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@larksuiteoapi/node-sdk": "^1.65.0",
28
+ "@opentui/core": "^0.2.15",
29
+ "@opentui/react": "^0.2.15",
30
+ "@opentui/solid": "^0.2.15",
28
31
  "@types/better-sqlite3": "^7.6.13",
29
32
  "@types/react": "^19.2.14",
30
33
  "@vue/language-server": "^3.2.7",
@@ -38,6 +41,7 @@
38
41
  "qrcode-terminal": "^0.12.0",
39
42
  "react": "^19.2.6",
40
43
  "shiki": "^4.0.2",
44
+ "solid-js": "^1.9.12",
41
45
  "string-width": "^8.2.1",
42
46
  "typescript-language-server": "^5.1.3",
43
47
  "vscode-jsonrpc": "^8.2.1",