@bubblebrain-ai/bubble 0.0.24 → 0.0.26

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/README.md +5 -3
  2. package/dist/agent.js +1 -1
  3. package/dist/clipboard.d.ts +14 -0
  4. package/dist/clipboard.js +132 -0
  5. package/dist/config.d.ts +3 -0
  6. package/dist/config.js +22 -6
  7. package/dist/goal/format.js +34 -4
  8. package/dist/goal/store.d.ts +3 -0
  9. package/dist/goal/store.js +14 -1
  10. package/dist/goal/usage.d.ts +2 -0
  11. package/dist/goal/usage.js +3 -0
  12. package/dist/main.js +23 -42
  13. package/dist/model-catalog.d.ts +3 -1
  14. package/dist/model-catalog.js +17 -28
  15. package/dist/prompt/compose.js +1 -1
  16. package/dist/provider-anthropic.d.ts +4 -0
  17. package/dist/provider-anthropic.js +31 -0
  18. package/dist/provider-ark-responses.d.ts +17 -0
  19. package/dist/provider-ark-responses.js +462 -0
  20. package/dist/provider-transform.js +7 -0
  21. package/dist/provider.d.ts +7 -0
  22. package/dist/provider.js +170 -27
  23. package/dist/slash-commands/commands.js +22 -0
  24. package/dist/tools/todo.js +22 -38
  25. package/dist/tui/detect-theme.d.ts +1 -0
  26. package/dist/tui/detect-theme.js +23 -0
  27. package/dist/tui/image-display.d.ts +13 -0
  28. package/dist/tui/image-display.js +49 -0
  29. package/dist/tui/input-history.d.ts +37 -6
  30. package/dist/tui/input-history.js +194 -23
  31. package/dist/tui/model-switch.d.ts +42 -0
  32. package/dist/tui/model-switch.js +55 -0
  33. package/dist/tui-ink/app.d.ts +32 -2
  34. package/dist/tui-ink/app.js +1409 -549
  35. package/dist/tui-ink/approval/select.js +10 -0
  36. package/dist/tui-ink/detect-theme.d.ts +1 -2
  37. package/dist/tui-ink/detect-theme.js +1 -87
  38. package/dist/tui-ink/display-history.d.ts +1 -0
  39. package/dist/tui-ink/display-history.js +11 -0
  40. package/dist/tui-ink/feedback-dialog.js +10 -0
  41. package/dist/tui-ink/feishu-setup-picker.js +10 -0
  42. package/dist/tui-ink/footer.d.ts +1 -0
  43. package/dist/tui-ink/footer.js +8 -2
  44. package/dist/tui-ink/input-box.d.ts +71 -9
  45. package/dist/tui-ink/input-box.js +359 -121
  46. package/dist/tui-ink/input-history.d.ts +1 -16
  47. package/dist/tui-ink/input-history.js +1 -79
  48. package/dist/tui-ink/input-queue.d.ts +12 -0
  49. package/dist/tui-ink/input-queue.js +17 -0
  50. package/dist/tui-ink/key-events.d.ts +9 -0
  51. package/dist/tui-ink/key-events.js +8 -0
  52. package/dist/tui-ink/markdown.js +1 -1
  53. package/dist/tui-ink/message-list.d.ts +19 -1
  54. package/dist/tui-ink/message-list.js +111 -32
  55. package/dist/tui-ink/model-picker.d.ts +25 -2
  56. package/dist/tui-ink/model-picker.js +237 -20
  57. package/dist/tui-ink/plan-confirm.js +10 -0
  58. package/dist/tui-ink/question-dialog.js +46 -10
  59. package/dist/tui-ink/run.d.ts +10 -1
  60. package/dist/tui-ink/run.js +27 -42
  61. package/dist/tui-ink/session-picker.js +3 -0
  62. package/dist/tui-ink/submit-dedupe.d.ts +5 -0
  63. package/dist/tui-ink/submit-dedupe.js +25 -0
  64. package/dist/tui-ink/terminal-mouse.d.ts +24 -1
  65. package/dist/tui-ink/terminal-mouse.js +76 -21
  66. package/dist/tui-ink/theme.d.ts +6 -3
  67. package/dist/tui-ink/theme.js +10 -4
  68. package/dist/tui-ink/welcome.d.ts +1 -0
  69. package/dist/tui-ink/welcome.js +34 -27
  70. package/dist/variant/variant-resolver.js +4 -1
  71. package/package.json +1 -5
  72. package/dist/tui/clipboard.d.ts +0 -1
  73. package/dist/tui/clipboard.js +0 -53
  74. package/dist/tui/escape-confirmation.d.ts +0 -15
  75. package/dist/tui/escape-confirmation.js +0 -30
  76. package/dist/tui/global-key-router.d.ts +0 -3
  77. package/dist/tui/global-key-router.js +0 -87
  78. package/dist/tui/markdown-inline.d.ts +0 -22
  79. package/dist/tui/markdown-inline.js +0 -68
  80. package/dist/tui/markdown-theme-rules.d.ts +0 -23
  81. package/dist/tui/markdown-theme-rules.js +0 -164
  82. package/dist/tui/markdown-theme.d.ts +0 -5
  83. package/dist/tui/markdown-theme.js +0 -27
  84. package/dist/tui/opencode-spinner.d.ts +0 -22
  85. package/dist/tui/opencode-spinner.js +0 -216
  86. package/dist/tui/prompt-keybindings.d.ts +0 -42
  87. package/dist/tui/prompt-keybindings.js +0 -35
  88. package/dist/tui/render-signature.d.ts +0 -1
  89. package/dist/tui/render-signature.js +0 -7
  90. package/dist/tui/run.d.ts +0 -67
  91. package/dist/tui/run.js +0 -10166
  92. package/dist/tui/sidebar-mcp.d.ts +0 -31
  93. package/dist/tui/sidebar-mcp.js +0 -62
  94. package/dist/tui/sidebar-state.d.ts +0 -12
  95. package/dist/tui/sidebar-state.js +0 -69
  96. package/dist/tui/streaming-tool-args.d.ts +0 -15
  97. package/dist/tui/streaming-tool-args.js +0 -30
  98. package/dist/tui/tool-renderers/fallback.d.ts +0 -2
  99. package/dist/tui/tool-renderers/fallback.js +0 -75
  100. package/dist/tui/tool-renderers/registry.d.ts +0 -3
  101. package/dist/tui/tool-renderers/registry.js +0 -11
  102. package/dist/tui/tool-renderers/subagent.d.ts +0 -2
  103. package/dist/tui/tool-renderers/subagent.js +0 -135
  104. package/dist/tui/tool-renderers/types.d.ts +0 -36
  105. package/dist/tui/tool-renderers/types.js +0 -1
  106. package/dist/tui/tool-renderers/write-preview.d.ts +0 -12
  107. package/dist/tui/tool-renderers/write-preview.js +0 -32
  108. package/dist/tui/tool-renderers/write.d.ts +0 -6
  109. package/dist/tui/tool-renderers/write.js +0 -88
  110. package/dist/tui/transcript-scroll.d.ts +0 -25
  111. package/dist/tui/transcript-scroll.js +0 -20
  112. package/dist/tui-ink/transcript-viewport-math.d.ts +0 -11
  113. package/dist/tui-ink/transcript-viewport-math.js +0 -17
  114. package/dist/tui-ink/transcript-viewport.d.ts +0 -24
  115. package/dist/tui-ink/transcript-viewport.js +0 -83
  116. package/dist/tui-opentui/app.d.ts +0 -54
  117. package/dist/tui-opentui/app.js +0 -1371
  118. package/dist/tui-opentui/approval/approval-dialog.d.ts +0 -15
  119. package/dist/tui-opentui/approval/approval-dialog.js +0 -155
  120. package/dist/tui-opentui/approval/diff-view.d.ts +0 -9
  121. package/dist/tui-opentui/approval/diff-view.js +0 -43
  122. package/dist/tui-opentui/approval/select.d.ts +0 -37
  123. package/dist/tui-opentui/approval/select.js +0 -91
  124. package/dist/tui-opentui/detect-theme.d.ts +0 -2
  125. package/dist/tui-opentui/detect-theme.js +0 -87
  126. package/dist/tui-opentui/display-history.d.ts +0 -56
  127. package/dist/tui-opentui/display-history.js +0 -130
  128. package/dist/tui-opentui/edit-diff.d.ts +0 -11
  129. package/dist/tui-opentui/edit-diff.js +0 -57
  130. package/dist/tui-opentui/feedback-dialog.d.ts +0 -21
  131. package/dist/tui-opentui/feedback-dialog.js +0 -164
  132. package/dist/tui-opentui/feishu-setup-picker.d.ts +0 -7
  133. package/dist/tui-opentui/feishu-setup-picker.js +0 -272
  134. package/dist/tui-opentui/file-mentions.d.ts +0 -29
  135. package/dist/tui-opentui/file-mentions.js +0 -174
  136. package/dist/tui-opentui/footer.d.ts +0 -26
  137. package/dist/tui-opentui/footer.js +0 -40
  138. package/dist/tui-opentui/image-paste.d.ts +0 -54
  139. package/dist/tui-opentui/image-paste.js +0 -288
  140. package/dist/tui-opentui/input-box.d.ts +0 -32
  141. package/dist/tui-opentui/input-box.js +0 -462
  142. package/dist/tui-opentui/input-history.d.ts +0 -16
  143. package/dist/tui-opentui/input-history.js +0 -79
  144. package/dist/tui-opentui/markdown.d.ts +0 -66
  145. package/dist/tui-opentui/markdown.js +0 -127
  146. package/dist/tui-opentui/message-list.d.ts +0 -31
  147. package/dist/tui-opentui/message-list.js +0 -131
  148. package/dist/tui-opentui/model-picker.d.ts +0 -63
  149. package/dist/tui-opentui/model-picker.js +0 -450
  150. package/dist/tui-opentui/plan-confirm.d.ts +0 -9
  151. package/dist/tui-opentui/plan-confirm.js +0 -124
  152. package/dist/tui-opentui/question-dialog.d.ts +0 -10
  153. package/dist/tui-opentui/question-dialog.js +0 -110
  154. package/dist/tui-opentui/recent-activity.d.ts +0 -8
  155. package/dist/tui-opentui/recent-activity.js +0 -71
  156. package/dist/tui-opentui/run-session-picker.d.ts +0 -10
  157. package/dist/tui-opentui/run-session-picker.js +0 -28
  158. package/dist/tui-opentui/run.d.ts +0 -38
  159. package/dist/tui-opentui/run.js +0 -48
  160. package/dist/tui-opentui/session-picker.d.ts +0 -12
  161. package/dist/tui-opentui/session-picker.js +0 -120
  162. package/dist/tui-opentui/theme.d.ts +0 -89
  163. package/dist/tui-opentui/theme.js +0 -157
  164. package/dist/tui-opentui/todos.d.ts +0 -9
  165. package/dist/tui-opentui/todos.js +0 -45
  166. package/dist/tui-opentui/trace-groups.d.ts +0 -27
  167. package/dist/tui-opentui/trace-groups.js +0 -455
  168. package/dist/tui-opentui/use-terminal-size.d.ts +0 -4
  169. package/dist/tui-opentui/use-terminal-size.js +0 -5
  170. package/dist/tui-opentui/welcome.d.ts +0 -25
  171. package/dist/tui-opentui/welcome.js +0 -77
@@ -1,20 +0,0 @@
1
- /**
2
- * Transcript scroll-follow policy.
3
- *
4
- * The transcript snaps to the bottom ("follows") while the user is at the
5
- * bottom, and stays put while they read older history. Two events override a
6
- * scrolled-up position and re-engage following:
7
- * - the user sends a message (explicit intent to watch the newest turn)
8
- * - an approval prompt appears (requires the user's attention)
9
- *
10
- * Those renders set `forcePending`, which must survive until the deferred
11
- * scroll actually runs: streaming redraws in the interim recompute the follow
12
- * flag from the (still unscrolled) position and would otherwise cancel the
13
- * snap. A user mouse scroll clears the pending force — their latest gesture
14
- * always wins.
15
- */
16
- export function resolveTranscriptScroll(state) {
17
- if (state.forcePending)
18
- return "scroll-bottom";
19
- return state.shouldFollow && state.following ? "scroll-bottom" : "sync-position";
20
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Pure scroll arithmetic for the alt-screen transcript viewport.
3
- *
4
- * Mirrors the live OpenTUI scrollbox semantics (src/tui/run.ts
5
- * transcriptMaxScrollTop / isTranscriptAtBottom): "at bottom" tolerates a
6
- * one-line slack so sub-line rounding never flips the follow flag while the
7
- * user sits at the end of the transcript.
8
- */
9
- export declare function maxScrollTop(contentHeight: number, viewportHeight: number): number;
10
- export declare function clampScrollTop(scrollTop: number, contentHeight: number, viewportHeight: number): number;
11
- export declare function isAtBottom(scrollTop: number, contentHeight: number, viewportHeight: number): boolean;
@@ -1,17 +0,0 @@
1
- /**
2
- * Pure scroll arithmetic for the alt-screen transcript viewport.
3
- *
4
- * Mirrors the live OpenTUI scrollbox semantics (src/tui/run.ts
5
- * transcriptMaxScrollTop / isTranscriptAtBottom): "at bottom" tolerates a
6
- * one-line slack so sub-line rounding never flips the follow flag while the
7
- * user sits at the end of the transcript.
8
- */
9
- export function maxScrollTop(contentHeight, viewportHeight) {
10
- return Math.max(0, contentHeight - viewportHeight);
11
- }
12
- export function clampScrollTop(scrollTop, contentHeight, viewportHeight) {
13
- return Math.max(0, Math.min(scrollTop, maxScrollTop(contentHeight, viewportHeight)));
14
- }
15
- export function isAtBottom(scrollTop, contentHeight, viewportHeight) {
16
- return scrollTop >= maxScrollTop(contentHeight, viewportHeight) - 1;
17
- }
@@ -1,24 +0,0 @@
1
- import React from "react";
2
- export interface TranscriptViewportHandle {
3
- /**
4
- * Re-engage bottom-follow. Sets the pending force flag from
5
- * transcript-scroll.ts, so the snap survives streaming renders that land
6
- * between the request and the next measured layout.
7
- */
8
- forceScrollToBottom(): void;
9
- /** Scroll by N lines (negative = up). A user gesture: cancels a pending force. */
10
- scrollBy(lines: number): void;
11
- scrollPage(direction: "up" | "down"): void;
12
- }
13
- interface TranscriptViewportProps {
14
- children: React.ReactNode;
15
- }
16
- /**
17
- * Height-clamped scrolling viewport for the alt-screen transcript. The outer
18
- * box clips; the inner box carries the full transcript and slides via a
19
- * negative top margin. Follow policy is the shared transcript-scroll.ts:
20
- * stay snapped while at the bottom, hold position while reading history,
21
- * snap back on send/approval via forceScrollToBottom().
22
- */
23
- export declare const TranscriptViewport: React.ForwardRefExoticComponent<TranscriptViewportProps & React.RefAttributes<TranscriptViewportHandle>>;
24
- export {};
@@ -1,83 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
3
- import { Box, measureElement } from "ink";
4
- import { resolveTranscriptScroll } from "../tui/transcript-scroll.js";
5
- import { clampScrollTop, isAtBottom, maxScrollTop } from "./transcript-viewport-math.js";
6
- /**
7
- * Height-clamped scrolling viewport for the alt-screen transcript. The outer
8
- * box clips; the inner box carries the full transcript and slides via a
9
- * negative top margin. Follow policy is the shared transcript-scroll.ts:
10
- * stay snapped while at the bottom, hold position while reading history,
11
- * snap back on send/approval via forceScrollToBottom().
12
- */
13
- export const TranscriptViewport = forwardRef(function TranscriptViewport({ children }, ref) {
14
- const viewportRef = useRef(null);
15
- const contentRef = useRef(null);
16
- const [scrollTop, setScrollTop] = useState(0);
17
- const scrollTopRef = useRef(0);
18
- const followingRef = useRef(true);
19
- const forcePendingRef = useRef(false);
20
- // forceScrollToBottom must work even when no other state changes in the
21
- // same tick; bumping this guarantees a commit so the measuring effect runs.
22
- const [, setScrollEpoch] = useState(0);
23
- const applyScrollTop = (next) => {
24
- scrollTopRef.current = next;
25
- setScrollTop(next);
26
- };
27
- // measureElement returns the Yoga-computed size, valid only after layout —
28
- // callable from effects and input handlers, never during render.
29
- const measureHeights = () => ({
30
- viewportHeight: viewportRef.current ? measureElement(viewportRef.current).height : 0,
31
- contentHeight: contentRef.current ? measureElement(contentRef.current).height : 0,
32
- });
33
- // Content and viewport heights change with streaming text, tool expansion,
34
- // resize, and bottom-stack visibility — no dependency list covers them
35
- // all, so re-resolve after every commit. setState below bails out via
36
- // Object.is when nothing moved, so the steady state does not loop.
37
- useEffect(() => {
38
- const { viewportHeight, contentHeight } = measureHeights();
39
- if (viewportHeight <= 0)
40
- return;
41
- const action = resolveTranscriptScroll({
42
- forcePending: forcePendingRef.current,
43
- shouldFollow: followingRef.current,
44
- following: followingRef.current,
45
- });
46
- if (action === "scroll-bottom") {
47
- forcePendingRef.current = false;
48
- followingRef.current = true;
49
- applyScrollTop(maxScrollTop(contentHeight, viewportHeight));
50
- }
51
- else {
52
- const clamped = clampScrollTop(scrollTopRef.current, contentHeight, viewportHeight);
53
- followingRef.current = isAtBottom(clamped, contentHeight, viewportHeight);
54
- if (clamped !== scrollTopRef.current)
55
- applyScrollTop(clamped);
56
- }
57
- });
58
- useImperativeHandle(ref, () => {
59
- const scrollBy = (lines) => {
60
- forcePendingRef.current = false; // the user's latest gesture wins
61
- const { viewportHeight, contentHeight } = measureHeights();
62
- if (viewportHeight <= 0)
63
- return;
64
- const next = clampScrollTop(scrollTopRef.current + lines, contentHeight, viewportHeight);
65
- followingRef.current = isAtBottom(next, contentHeight, viewportHeight);
66
- if (next !== scrollTopRef.current)
67
- applyScrollTop(next);
68
- };
69
- return {
70
- forceScrollToBottom() {
71
- forcePendingRef.current = true;
72
- setScrollEpoch((epoch) => epoch + 1);
73
- },
74
- scrollBy,
75
- scrollPage(direction) {
76
- const { viewportHeight } = measureHeights();
77
- const step = Math.max(1, viewportHeight - 2);
78
- scrollBy(direction === "up" ? -step : step);
79
- },
80
- };
81
- }, []);
82
- return (_jsx(Box, { ref: viewportRef, flexDirection: "column", flexGrow: 1, minHeight: 0, overflowY: "hidden", children: _jsx(Box, { ref: contentRef, flexDirection: "column", flexShrink: 0, marginTop: -scrollTop, children: children }) }));
83
- });
@@ -1,54 +0,0 @@
1
- /** @jsxImportSource @opentui/react */
2
- import React from "react";
3
- import { type Agent } from "../agent.js";
4
- import type { CliArgs } from "../cli.js";
5
- import type { SessionManager } from "../session.js";
6
- import type { PlanDecision, Provider } from "../types.js";
7
- import { type ResolvedTheme, type ThemeMode } from "./theme.js";
8
- import { ProviderRegistry } from "../provider-registry.js";
9
- import { SkillRegistry } from "../skills/registry.js";
10
- import type { ApprovalDecision, ApprovalRequest } from "../approval/types.js";
11
- import type { BashAllowlist } from "../approval/session-cache.js";
12
- import type { SettingsManager } from "../permissions/settings.js";
13
- import type { McpManager } from "../mcp/manager.js";
14
- import type { LspService } from "../lsp/index.js";
15
- import type { QuestionController } from "../question/index.js";
16
- import type { MemoryScope } from "../memory/index.js";
17
- export interface PlanHandlerRef {
18
- current?: (plan: string) => Promise<PlanDecision>;
19
- }
20
- export interface ApprovalHandlerRef {
21
- current?: (req: ApprovalRequest) => Promise<ApprovalDecision>;
22
- }
23
- interface AppProps {
24
- agent: Agent;
25
- args: CliArgs;
26
- sessionManager?: SessionManager;
27
- createProvider?: (providerId: string, apiKey: string, baseURL: string) => Provider;
28
- registry?: ProviderRegistry;
29
- skillRegistry?: SkillRegistry;
30
- planHandlerRef?: PlanHandlerRef;
31
- approvalHandlerRef?: ApprovalHandlerRef;
32
- questionController?: QuestionController;
33
- bashAllowlist?: BashAllowlist;
34
- settingsManager?: SettingsManager;
35
- lspService?: LspService;
36
- mcpManager?: McpManager;
37
- themeMode?: ThemeMode;
38
- themeOverrides?: Record<string, string>;
39
- detectedTheme?: ResolvedTheme;
40
- onThemeModeChange?: (mode: ThemeMode) => void;
41
- flushMemory?: () => Promise<void>;
42
- runMemoryCompaction?: () => Promise<string>;
43
- runMemorySummary?: (scope?: MemoryScope) => Promise<string>;
44
- runMemoryRefresh?: (scope?: MemoryScope) => Promise<string>;
45
- /** Whether the bypassPermissions mode is reachable via Shift+Tab cycling. */
46
- bypassEnabled?: boolean;
47
- onExit?: (summary: ExitSummary) => void;
48
- }
49
- export interface ExitSummary {
50
- /** Wall-clock duration of the session, in milliseconds. */
51
- wallMs: number;
52
- }
53
- export declare function App({ agent, args, sessionManager, createProvider, registry, skillRegistry, planHandlerRef, approvalHandlerRef, questionController, bashAllowlist, settingsManager, lspService, mcpManager, themeMode: initialThemeMode, themeOverrides, detectedTheme, onThemeModeChange, flushMemory, runMemoryCompaction, runMemorySummary, runMemoryRefresh, bypassEnabled, onExit }: AppProps): React.ReactNode;
54
- export {};