@abacus-ai/cli 2.0.0-canary.0 → 2.0.0-canary.2

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 (198) hide show
  1. package/dist/index.mjs +807 -561
  2. package/package.json +4 -1
  3. package/.oxlintrc.json +0 -8
  4. package/resources/abacus.ico +0 -0
  5. package/resources/entitlements.plist +0 -9
  6. package/src/__e2e__/README.md +0 -196
  7. package/src/__e2e__/agent-interactions.e2e.test.tsx +0 -61
  8. package/src/__e2e__/cli-commands.e2e.test.tsx +0 -77
  9. package/src/__e2e__/conversation-throttle.e2e.test.ts +0 -453
  10. package/src/__e2e__/conversation.e2e.test.tsx +0 -56
  11. package/src/__e2e__/diff-preview.e2e.test.tsx +0 -3399
  12. package/src/__e2e__/file-creation.e2e.test.tsx +0 -149
  13. package/src/__e2e__/helpers/test-helpers.ts +0 -450
  14. package/src/__e2e__/keyboard-navigation.e2e.test.tsx +0 -34
  15. package/src/__e2e__/llm-models.e2e.test.ts +0 -402
  16. package/src/__e2e__/mcp/mcp-callback-flow.e2e.test.tsx +0 -71
  17. package/src/__e2e__/mcp/mcp-full-app-ui.e2e.test.tsx +0 -167
  18. package/src/__e2e__/mcp/mcp-ui-rendering.e2e.test.tsx +0 -185
  19. package/src/__e2e__/repl.e2e.test.tsx +0 -78
  20. package/src/__e2e__/shell-compatibility.e2e.test.tsx +0 -76
  21. package/src/__e2e__/theme-mcp.e2e.test.tsx +0 -98
  22. package/src/__e2e__/tool-permissions.e2e.test.tsx +0 -66
  23. package/src/args.ts +0 -22
  24. package/src/components/__tests__/react-compiler.test.tsx +0 -78
  25. package/src/components/__tests__/status-indicator.test.tsx +0 -403
  26. package/src/components/composer/__tests__/bash-runner.test.tsx +0 -263
  27. package/src/components/composer/agent-mode-indicator.tsx +0 -63
  28. package/src/components/composer/bash-runner.tsx +0 -54
  29. package/src/components/composer/commands/default-commands.tsx +0 -615
  30. package/src/components/composer/commands/handler.tsx +0 -59
  31. package/src/components/composer/commands/picker.tsx +0 -273
  32. package/src/components/composer/commands/registry.ts +0 -233
  33. package/src/components/composer/commands/types.ts +0 -33
  34. package/src/components/composer/context.tsx +0 -88
  35. package/src/components/composer/file-mention-picker.tsx +0 -83
  36. package/src/components/composer/help.tsx +0 -44
  37. package/src/components/composer/index.tsx +0 -1006
  38. package/src/components/composer/mentions.ts +0 -57
  39. package/src/components/composer/message-queue.tsx +0 -70
  40. package/src/components/composer/mode-panel.tsx +0 -35
  41. package/src/components/composer/modes/__tests__/bash-handler.test.tsx +0 -755
  42. package/src/components/composer/modes/__tests__/bash-renderer.test.tsx +0 -1108
  43. package/src/components/composer/modes/bash-handler.tsx +0 -132
  44. package/src/components/composer/modes/bash-renderer.tsx +0 -175
  45. package/src/components/composer/modes/default-handlers.tsx +0 -33
  46. package/src/components/composer/modes/index.ts +0 -41
  47. package/src/components/composer/modes/types.ts +0 -21
  48. package/src/components/composer/persistent-shell.ts +0 -283
  49. package/src/components/composer/process.ts +0 -65
  50. package/src/components/composer/types.ts +0 -9
  51. package/src/components/composer/use-mention-search.ts +0 -68
  52. package/src/components/error-boundry.tsx +0 -60
  53. package/src/components/exit-message.tsx +0 -29
  54. package/src/components/expanded-view.tsx +0 -74
  55. package/src/components/file-completion.tsx +0 -127
  56. package/src/components/header.tsx +0 -47
  57. package/src/components/logo.tsx +0 -37
  58. package/src/components/segments.tsx +0 -356
  59. package/src/components/status-indicator.tsx +0 -306
  60. package/src/components/tool-group-summary.tsx +0 -263
  61. package/src/components/tool-permissions/ask-user-question-permission-ui.tsx +0 -312
  62. package/src/components/tool-permissions/diff-preview.tsx +0 -355
  63. package/src/components/tool-permissions/index.ts +0 -5
  64. package/src/components/tool-permissions/permission-options.tsx +0 -375
  65. package/src/components/tool-permissions/permission-preview-header.tsx +0 -57
  66. package/src/components/tool-permissions/tool-permission-ui.tsx +0 -398
  67. package/src/components/tools/agent/ask-user-question.tsx +0 -101
  68. package/src/components/tools/agent/enter-plan-mode.tsx +0 -49
  69. package/src/components/tools/agent/exit-plan-mode.tsx +0 -75
  70. package/src/components/tools/agent/handoff-to-main.tsx +0 -27
  71. package/src/components/tools/agent/subagent.tsx +0 -37
  72. package/src/components/tools/agent/todo-write.tsx +0 -104
  73. package/src/components/tools/browser/close-tab.tsx +0 -58
  74. package/src/components/tools/browser/computer.tsx +0 -70
  75. package/src/components/tools/browser/get-interactive-elements.tsx +0 -54
  76. package/src/components/tools/browser/get-tab-content.tsx +0 -51
  77. package/src/components/tools/browser/navigate-to.tsx +0 -59
  78. package/src/components/tools/browser/new-tab.tsx +0 -60
  79. package/src/components/tools/browser/perform-action.tsx +0 -63
  80. package/src/components/tools/browser/refresh-tab.tsx +0 -43
  81. package/src/components/tools/browser/switch-tab.tsx +0 -58
  82. package/src/components/tools/filesystem/delete-file.tsx +0 -104
  83. package/src/components/tools/filesystem/edit.tsx +0 -220
  84. package/src/components/tools/filesystem/list-dir.tsx +0 -78
  85. package/src/components/tools/filesystem/read-file.tsx +0 -180
  86. package/src/components/tools/filesystem/upload-image.tsx +0 -76
  87. package/src/components/tools/ide/ide-diagnostics.tsx +0 -62
  88. package/src/components/tools/index.ts +0 -91
  89. package/src/components/tools/mcp/mcp-tool.tsx +0 -158
  90. package/src/components/tools/search/fetch-url.tsx +0 -73
  91. package/src/components/tools/search/file-search.tsx +0 -78
  92. package/src/components/tools/search/grep.tsx +0 -90
  93. package/src/components/tools/search/semantic-search.tsx +0 -66
  94. package/src/components/tools/search/web-search.tsx +0 -71
  95. package/src/components/tools/shared/index.tsx +0 -48
  96. package/src/components/tools/shared/zod-coercion.ts +0 -35
  97. package/src/components/tools/terminal/bash-tool-output.tsx +0 -174
  98. package/src/components/tools/terminal/get-terminal-output.tsx +0 -85
  99. package/src/components/tools/terminal/run-in-terminal.tsx +0 -106
  100. package/src/components/tools/types.ts +0 -16
  101. package/src/components/tools.tsx +0 -66
  102. package/src/components/ui/__tests__/divider.test.tsx +0 -61
  103. package/src/components/ui/__tests__/gradient.test.tsx +0 -125
  104. package/src/components/ui/__tests__/input.test.tsx +0 -166
  105. package/src/components/ui/__tests__/select.test.tsx +0 -273
  106. package/src/components/ui/__tests__/shimmer.test.tsx +0 -99
  107. package/src/components/ui/blinking-indicator.tsx +0 -25
  108. package/src/components/ui/divider.tsx +0 -162
  109. package/src/components/ui/gradient.tsx +0 -56
  110. package/src/components/ui/input.tsx +0 -228
  111. package/src/components/ui/select.tsx +0 -151
  112. package/src/components/ui/shimmer.tsx +0 -84
  113. package/src/context/agent-mode.tsx +0 -95
  114. package/src/context/extension-file.tsx +0 -136
  115. package/src/context/network-activity.tsx +0 -45
  116. package/src/context/notification.tsx +0 -62
  117. package/src/context/shell-size.tsx +0 -49
  118. package/src/context/shell-title.tsx +0 -38
  119. package/src/entrypoints/print-mode.ts +0 -312
  120. package/src/entrypoints/repl.tsx +0 -401
  121. package/src/hooks/use-agent.ts +0 -15
  122. package/src/hooks/use-api-client.ts +0 -1
  123. package/src/hooks/use-available-height.ts +0 -8
  124. package/src/hooks/use-cleanup.ts +0 -29
  125. package/src/hooks/use-interrupt-manager.ts +0 -242
  126. package/src/hooks/use-models.ts +0 -22
  127. package/src/index.ts +0 -217
  128. package/src/lib/__tests__/ansi.test.ts +0 -255
  129. package/src/lib/__tests__/cli.test.ts +0 -122
  130. package/src/lib/__tests__/commands.test.ts +0 -325
  131. package/src/lib/__tests__/constants.test.ts +0 -15
  132. package/src/lib/__tests__/focusables.test.ts +0 -25
  133. package/src/lib/__tests__/fs.test.ts +0 -231
  134. package/src/lib/__tests__/markdown.test.tsx +0 -348
  135. package/src/lib/__tests__/mcpCommandHandler.test.ts +0 -173
  136. package/src/lib/__tests__/mcpManagement.test.ts +0 -38
  137. package/src/lib/__tests__/path-paste.test.ts +0 -144
  138. package/src/lib/__tests__/path.test.ts +0 -300
  139. package/src/lib/__tests__/queries.test.ts +0 -39
  140. package/src/lib/__tests__/standaloneMcpService.test.ts +0 -71
  141. package/src/lib/__tests__/text-buffer.test.ts +0 -328
  142. package/src/lib/__tests__/text-utils.test.ts +0 -32
  143. package/src/lib/__tests__/timing.test.ts +0 -78
  144. package/src/lib/__tests__/utils.test.ts +0 -238
  145. package/src/lib/__tests__/vim-buffer-actions.test.ts +0 -154
  146. package/src/lib/ansi.ts +0 -150
  147. package/src/lib/cli-push-server.ts +0 -112
  148. package/src/lib/cli.ts +0 -44
  149. package/src/lib/clipboard.ts +0 -226
  150. package/src/lib/command-utils.ts +0 -93
  151. package/src/lib/commands.ts +0 -270
  152. package/src/lib/constants.ts +0 -3
  153. package/src/lib/extension-connection.ts +0 -181
  154. package/src/lib/focusables.ts +0 -7
  155. package/src/lib/fs.ts +0 -533
  156. package/src/lib/markdown/code-block.tsx +0 -63
  157. package/src/lib/markdown/index.ts +0 -4
  158. package/src/lib/markdown/link.tsx +0 -19
  159. package/src/lib/markdown/markdown.tsx +0 -372
  160. package/src/lib/markdown/types.ts +0 -15
  161. package/src/lib/mcpCommandHandler.ts +0 -121
  162. package/src/lib/mcpManagement.ts +0 -44
  163. package/src/lib/path-paste.ts +0 -185
  164. package/src/lib/path.ts +0 -179
  165. package/src/lib/queries.ts +0 -15
  166. package/src/lib/standaloneMcpService.ts +0 -688
  167. package/src/lib/status-utils.ts +0 -237
  168. package/src/lib/test-utils.tsx +0 -72
  169. package/src/lib/text-buffer.ts +0 -2415
  170. package/src/lib/text-utils.ts +0 -272
  171. package/src/lib/timing.ts +0 -63
  172. package/src/lib/types.ts +0 -295
  173. package/src/lib/utils.ts +0 -182
  174. package/src/lib/vim-buffer-actions.ts +0 -732
  175. package/src/providers/agent.tsx +0 -1075
  176. package/src/providers/api-client.tsx +0 -43
  177. package/src/services/logger.ts +0 -85
  178. package/src/terminal/detection.ts +0 -187
  179. package/src/terminal/exit.ts +0 -279
  180. package/src/terminal/notification.ts +0 -83
  181. package/src/terminal/progress.ts +0 -201
  182. package/src/terminal/setup.ts +0 -797
  183. package/src/terminal/suspend.ts +0 -58
  184. package/src/terminal/types.ts +0 -51
  185. package/src/theme/context.tsx +0 -57
  186. package/src/theme/index.ts +0 -4
  187. package/src/theme/themed.tsx +0 -35
  188. package/src/theme/themes.json +0 -546
  189. package/src/theme/types.ts +0 -110
  190. package/src/tools/types.ts +0 -59
  191. package/src/tools/utils/__tests__/zod-coercion.test.ts +0 -33
  192. package/src/tools/utils/tool-ui-components.tsx +0 -631
  193. package/src/tools/utils/zod-coercion.ts +0 -35
  194. package/tsconfig.json +0 -11
  195. package/tsconfig.node.json +0 -29
  196. package/tsconfig.test.json +0 -27
  197. package/tsdown.config.ts +0 -17
  198. package/vitest.config.ts +0 -76
@@ -1,1075 +0,0 @@
1
- import type { AbacusClient, ToolUseResult } from "@codellm/api";
2
-
3
- import {
4
- AgentMode,
5
- AgentStatus,
6
- AgentSession,
7
- CallbackPermissionProvider,
8
- type ConversationSegment,
9
- type Diagnostic,
10
- type McpManager,
11
- type PermissionRequest,
12
- type PermissionDecision,
13
- type ToolDisplayData,
14
- type ParsedToolResult,
15
- } from "@codellm/agent";
16
- import { AuthExpiredError, NetworkError } from "@codellm/api";
17
- import {
18
- createContext,
19
- memo,
20
- useCallback,
21
- useEffect,
22
- useMemo,
23
- useReducer,
24
- useRef,
25
- useState,
26
- useTransition,
27
- } from "react";
28
-
29
- import type { AgentArgs } from "../args.js";
30
- import type { FileAttachment, HistorySegment } from "../lib/types.js";
31
-
32
- import { useAgentMode } from "../context/agent-mode.js";
33
- import { useExtensionFile } from "../context/extension-file.js";
34
- import { useNetworkActivity } from "../context/network-activity.js";
35
- import { useNotification } from "../context/notification.js";
36
- import { useApiClient } from "../providers/api-client.js";
37
- import { showProgress, hideProgress } from "../terminal/progress.js";
38
-
39
- export { AgentMode, AgentStatus };
40
-
41
- // Re-export permission decision types for permission-options.tsx compatibility
42
- export type ToolPermissionDecision = "accept" | "reject" | "background" | "allowAlways";
43
-
44
- export interface ToolPermissionResult {
45
- decision: ToolPermissionDecision;
46
- userMessage?: string;
47
- }
48
-
49
- /** Permission pending in the UI — uses SDK's PermissionRequest directly */
50
- export interface PendingToolPermission {
51
- request: PermissionRequest;
52
- resolve: (decision: PermissionDecision) => void;
53
- }
54
-
55
- export interface RetryState {
56
- attempt: number;
57
- maxAttempts: number;
58
- delayMs: number;
59
- isNetworkError: boolean;
60
- }
61
-
62
- export interface AgentContextValue {
63
- conversationId: string | null;
64
- conversationTitle: string | null;
65
- segments: HistorySegment[];
66
- segmentsLength: number;
67
- sendMessage: (options: {
68
- message: string;
69
- selectedModel?: string;
70
- fileAttachments?: FileAttachment[];
71
- }) => Promise<void>;
72
- stop: () => void;
73
- rejectPendingPermission: () => void;
74
- agentStatus: AgentStatus;
75
- clearSegments: () => void;
76
- clearSegmentsOnly: () => void;
77
- clearTempSegments: () => void;
78
- loadConversation: (id: string) => Promise<void>;
79
- addNotification: (
80
- message: string,
81
- severity?: "info" | "warning" | "error",
82
- temp?: boolean,
83
- ) => void;
84
- mcp: McpManager;
85
- addAllowedDirectory: (dirPath: string) => void;
86
- pendingToolPermission: PendingToolPermission | null;
87
- refreshMcpTools: (skipReload?: boolean, showNotification?: boolean) => Promise<void>;
88
- isPendingSegmentUpdate: boolean;
89
- queuedMessages: string[];
90
- addToQueue: (message: string) => void;
91
- removeFirstFromQueue: () => void;
92
- clearQueue: () => void;
93
- /** First queued message drained when the agent was manually stopped — the composer
94
- * should restore this into the input buffer and then call clearDequeuedOnStop(). */
95
- dequeuedOnStop: string | null;
96
- clearDequeuedOnStop: () => void;
97
- /** @deprecated use agentStatus directly */
98
- activeToolOutputs: Record<string, string>;
99
- retryState: RetryState | null;
100
- networkOnline: boolean;
101
- }
102
-
103
- export const AgentContext = createContext<AgentContextValue | null>(null);
104
-
105
- // ---------------------------------------------------------------------------
106
- // Segment reducer
107
- // ---------------------------------------------------------------------------
108
- type SegmentAction =
109
- | { type: "INIT_SEND"; userSeg: HistorySegment; spinnySeg: HistorySegment }
110
- | { type: "TEXT_DELTA"; segId: string; content: string }
111
- | { type: "THINKING_DELTA"; segId: string; content: string; startTime: number }
112
- | { type: "THINKING_COMPLETE"; segId: string; endTime: number }
113
- | { type: "TOOL_DISPLAY_DATA"; toolCallId: string; data: Partial<ToolDisplayData> }
114
- | {
115
- type: "TOOL_REQUESTED";
116
- toolCallId: string;
117
- textSegId: string | null;
118
- toolSeg: HistorySegment;
119
- }
120
- | {
121
- type: "TOOL_EXECUTION_COMPLETE";
122
- toolCallId: string;
123
- rawResult: ToolUseResult;
124
- parsedResult?: ParsedToolResult;
125
- spinnySeg: HistorySegment;
126
- }
127
- | { type: "TOOL_USER_MESSAGE"; seg: HistorySegment }
128
- | { type: "TEXT_COMPLETED"; segId: string }
129
- | { type: "FINALIZE"; textSegId: string | null }
130
- | { type: "ADD_NOTIFICATION"; seg: HistorySegment }
131
- | { type: "ERROR"; errorSeg: HistorySegment }
132
- | { type: "REMOVE_USER_SEG"; userSegId: string }
133
- | { type: "CLEAR" }
134
- | { type: "LOAD"; segments: HistorySegment[] }
135
- | { type: "REMOVE_TEMP" };
136
-
137
- function segmentsReducer(prev: HistorySegment[], action: SegmentAction): HistorySegment[] {
138
- switch (action.type) {
139
- case "INIT_SEND":
140
- // Remove temp segments, add user message and spinny placeholder
141
- return [...prev.filter((s) => s.temp !== true), action.userSeg, action.spinnySeg];
142
-
143
- case "TEXT_DELTA": {
144
- const { segId, content } = action;
145
- const withoutSpinny = prev.filter((s) => !s.isSpinny);
146
- const existing = withoutSpinny.find((s) => s.id === segId);
147
- if (existing) {
148
- return withoutSpinny.map((s) =>
149
- s.id === segId ? { ...s, segment: ((s.segment as string) || "") + content } : s,
150
- );
151
- }
152
- return [
153
- ...withoutSpinny,
154
- {
155
- id: segId,
156
- status: "transient",
157
- source: "bot",
158
- type: "text",
159
- segment: content,
160
- } as HistorySegment,
161
- ];
162
- }
163
-
164
- case "THINKING_DELTA": {
165
- const { segId, content, startTime } = action;
166
- const existing = prev.find((s) => s.id === segId);
167
- if (existing) {
168
- return prev.map((s) =>
169
- s.id === segId ? { ...s, segment: ((s.segment as string) || "") + content } : s,
170
- );
171
- }
172
- return [
173
- ...prev,
174
- {
175
- id: segId,
176
- status: "transient",
177
- source: "bot",
178
- type: "thinking",
179
- isSpinny: true,
180
- segment: content,
181
- thinkingStartTime: startTime,
182
- } as HistorySegment,
183
- ];
184
- }
185
-
186
- case "THINKING_COMPLETE":
187
- return prev.map((s) =>
188
- s.id === action.segId
189
- ? { ...s, status: "completed", isSpinny: false, thinkingEndTime: action.endTime }
190
- : s,
191
- );
192
-
193
- case "TOOL_DISPLAY_DATA":
194
- return prev.map((s) =>
195
- s.id === action.toolCallId
196
- ? { ...s, toolDisplayData: { ...s.toolDisplayData, ...action.data } }
197
- : s,
198
- );
199
-
200
- case "TOOL_REQUESTED": {
201
- const { textSegId, toolSeg } = action;
202
- let withoutSpinny: HistorySegment[];
203
- if (textSegId) {
204
- withoutSpinny = prev
205
- .filter((s) => !s.isSpinny)
206
- .map((s) => (s.id === textSegId ? { ...s, status: "completed" as const } : s));
207
- } else {
208
- withoutSpinny = prev.filter((s) => !s.isSpinny);
209
- }
210
- return [...withoutSpinny, toolSeg];
211
- }
212
-
213
- case "TOOL_EXECUTION_COMPLETE": {
214
- const { toolCallId, rawResult, parsedResult, spinnySeg } = action;
215
- const updated = prev.map((s) =>
216
- s.id === toolCallId
217
- ? {
218
- ...s,
219
- status: "completed" as const,
220
- toolUseResult: rawResult,
221
- ...(parsedResult !== undefined && { parsedResult }),
222
- }
223
- : s,
224
- );
225
- return [...updated, spinnySeg];
226
- }
227
-
228
- case "TOOL_USER_MESSAGE":
229
- return [...prev, action.seg];
230
-
231
- case "TEXT_COMPLETED":
232
- return prev.map((s) => (s.id === action.segId ? { ...s, status: "completed" as const } : s));
233
-
234
- case "FINALIZE": {
235
- // Mark transient text segment as completed (if any), then remove all spinny segments
236
- let result = prev;
237
- if (action.textSegId) {
238
- result = result.map((s) =>
239
- s.id === action.textSegId ? { ...s, status: "completed" as const } : s,
240
- );
241
- }
242
- return result.filter((s) => !s.isSpinny);
243
- }
244
-
245
- case "ADD_NOTIFICATION": {
246
- const seg = action.seg;
247
- // Deduplicate: if the last segment is a notification with the same message, flash it instead
248
- const last = prev[prev.length - 1];
249
- if (
250
- last &&
251
- last.type === "code_llm_notification" &&
252
- last.message === seg.message &&
253
- last.severity === seg.severity
254
- ) {
255
- const updated = [...prev];
256
- updated[updated.length - 1] = {
257
- ...last,
258
- flashKey: (last.flashKey ?? 0) + 1,
259
- };
260
- return updated;
261
- }
262
- return [...prev, seg];
263
- }
264
-
265
- case "ERROR":
266
- return [...prev.filter((s) => !s.isSpinny), action.errorSeg];
267
-
268
- case "REMOVE_USER_SEG":
269
- return prev.filter((s) => s.id !== action.userSegId);
270
-
271
- case "CLEAR":
272
- return [];
273
-
274
- case "LOAD":
275
- return action.segments;
276
-
277
- case "REMOVE_TEMP":
278
- if (!prev.some((s) => s.temp === true)) return prev;
279
- return prev.filter((s) => s.temp !== true);
280
-
281
- default:
282
- return prev;
283
- }
284
- }
285
-
286
- interface AgentProviderProps extends React.PropsWithChildren {
287
- apiClient: AbacusClient;
288
- agentArgs?: AgentArgs;
289
- }
290
-
291
- // ---------------------------------------------------------------------------
292
- // Bridge: ConversationSegment → HistorySegment (temporary until CLI fully adopts ConversationSegment)
293
- // ---------------------------------------------------------------------------
294
- function conversationSegmentToHistory(seg: ConversationSegment): HistorySegment {
295
- switch (seg.type) {
296
- case "text":
297
- return {
298
- id: seg.id,
299
- status: "completed",
300
- source: seg.source,
301
- type: "text",
302
- segment: seg.content,
303
- };
304
- case "thinking":
305
- return {
306
- id: seg.id,
307
- status: "completed",
308
- source: "bot",
309
- type: "thinking",
310
- segment: seg.content,
311
- isSpinny: seg.isSpinny,
312
- ...(seg.title !== undefined && { title: seg.title }),
313
- };
314
- case "tool_call":
315
- return {
316
- id: seg.id,
317
- status: "completed",
318
- source: "bot",
319
- type: "code_llm_tool_call",
320
- toolUseRequest: seg.toolUseRequest,
321
- toolUseResult: seg.toolUseResult ?? {
322
- id: seg.toolUseRequest.id,
323
- content: " ",
324
- },
325
- ...(seg.parsedResult !== undefined && { parsedResult: seg.parsedResult }),
326
- ...(seg.toolDisplayData !== undefined && { toolDisplayData: seg.toolDisplayData }),
327
- };
328
- case "notification":
329
- return {
330
- id: seg.id,
331
- status: "completed",
332
- source: "bot",
333
- type: "code_llm_notification",
334
- message: seg.message,
335
- severity: seg.severity,
336
- ...(seg.actions !== undefined && { actions: seg.actions }),
337
- };
338
- case "tool_group":
339
- // Flatten tool groups — each tool becomes its own segment
340
- // The first tool carries the group info
341
- return {
342
- id: seg.id,
343
- status: "completed",
344
- source: "bot",
345
- type: "text",
346
- segment: seg.summary,
347
- };
348
- }
349
- }
350
-
351
- export const AgentProvider = memo(({ children, apiClient, agentArgs }: AgentProviderProps) => {
352
- const [isPendingSegmentUpdate, startSegmentTransition] = useTransition();
353
- const { agentMode, setAgentMode } = useAgentMode();
354
- const agentModeRef = useRef(agentMode);
355
- const { notifyActionRequired, notifyTaskComplete } = useNotification();
356
- const { startUpload, startDownload, stopActivity } = useNetworkActivity();
357
- const { authManager, setAuthExpired } = useApiClient();
358
-
359
- const { connection, pushServer } = useExtensionFile();
360
- const connectionRef = useRef(connection);
361
- const pushServerRef = useRef(pushServer);
362
- useEffect(() => {
363
- connectionRef.current = connection;
364
- }, [connection]);
365
- useEffect(() => {
366
- pushServerRef.current = pushServer;
367
- }, [pushServer]);
368
-
369
- const [agentStatus, setAgentStatus] = useState<AgentStatus>(AgentStatus.Idle);
370
- const [segments, dispatchSegments] = useReducer(segmentsReducer, []);
371
- const displayDataMapRef = useRef<Map<string, ToolDisplayData>>(new Map());
372
- const [conversationTitle, setConversationTitle] = useState<string | null>(null);
373
- const [pendingToolPermission, setPendingToolPermission] = useState<PendingToolPermission | null>(
374
- null,
375
- );
376
- const [queuedMessages, setQueuedMessages] = useState<string[]>([]);
377
- const [dequeuedOnStop, setDequeuedOnStop] = useState<string | null>(null);
378
- const [retryState, setRetryState] = useState<RetryState | null>(null);
379
- const [networkOnline, setNetworkOnline] = useState(true);
380
-
381
- // activeToolOutputs kept for BashToolOutput compatibility
382
- const activeToolOutputs: Record<string, string> = {};
383
-
384
- const conversationIdRef = useRef<string | null>(null);
385
-
386
- const cwd = process.cwd();
387
-
388
- const permissionProvider = useMemo(() => {
389
- return new CallbackPermissionProvider(
390
- async (req: PermissionRequest): Promise<PermissionDecision> => {
391
- const conn = connectionRef.current;
392
-
393
- // For edit tool with VS Code connection: show diff in VS Code, show options in CLI
394
- if (conn && pushServerRef.current && req.type === "edit_file") {
395
- const toolId = req.tool.id;
396
- const displayData = displayDataMapRef.current.get(toolId);
397
- const input = req.tool.input as Record<string, unknown>;
398
- const filePath = String(input.targetFile ?? req.filePath ?? "");
399
- const originalContent = displayData?.originalContent ?? req.originalContent ?? "";
400
- const newContent =
401
- displayData?.newContent ?? req.newContent ?? String(input.codeEdit ?? "");
402
-
403
- if (filePath && (originalContent || newContent)) {
404
- const shown = await conn.showDiff({
405
- filePath,
406
- originalContent,
407
- modifiedContent: newContent,
408
- toolId,
409
- });
410
- if (shown) {
411
- const pushServer = pushServerRef.current;
412
- const editReq: PermissionRequest = {
413
- ...req,
414
- diffShownInEditor: true,
415
- };
416
-
417
- const cliPromise = new Promise<PermissionDecision>((resolve) => {
418
- setPendingToolPermission({
419
- request: editReq,
420
- resolve: (decision) => {
421
- setPendingToolPermission(null);
422
- const isAccept =
423
- decision === "accept" ||
424
- decision === "allowAlways" ||
425
- decision === "background" ||
426
- (typeof decision === "object" && decision.type === "accept_with_message") ||
427
- (typeof decision === "object" && decision.type === "question_answers");
428
- setAgentStatus(isAccept ? AgentStatus.ExecutingTool : AgentStatus.Submitted);
429
- resolve(decision);
430
- },
431
- });
432
- setAgentStatus(AgentStatus.WaitingForToolPermission);
433
- void notifyActionRequired("Abacus.AI is waiting for your input");
434
- });
435
-
436
- const pushPromise = pushServer.waitForDecision(toolId).then((d) => {
437
- setPendingToolPermission(null);
438
- return (d === "allowAlways" ? "allowAlways" : d) as PermissionDecision;
439
- });
440
-
441
- const decision = await Promise.race([cliPromise, pushPromise]);
442
-
443
- const simpleDecision =
444
- decision === "accept" || decision === "reject" || decision === "allowAlways"
445
- ? decision
446
- : decision === "background"
447
- ? "accept"
448
- : typeof decision === "object" && decision.type === "accept_with_message"
449
- ? "accept"
450
- : typeof decision === "object" && decision.type === "reject_with_message"
451
- ? "reject"
452
- : "accept";
453
- conn
454
- .notifyDiffDecision({
455
- targetFile: filePath,
456
- decision: simpleDecision === "allowAlways" ? "accept" : simpleDecision,
457
- })
458
- .catch(() => {});
459
-
460
- return decision;
461
- }
462
- }
463
- }
464
-
465
- // For exit_plan_mode with VS Code connection: open plan in VS Code, wait for decision
466
- if (conn && pushServerRef.current && req.type === "exit_plan_mode") {
467
- const toolId = req.tool.id;
468
- const shown = await conn.showToolView({
469
- filePath: req.planFilePath,
470
- toolKey: toolId,
471
- });
472
- if (shown) {
473
- const decision = await pushServerRef.current.waitForDecision(toolId);
474
- return decision === "allowAlways" ? "allowAlways" : decision;
475
- }
476
- }
477
-
478
- // Fallback: show CLI permission UI
479
- return new Promise((resolve) => {
480
- setPendingToolPermission({
481
- request: req,
482
- resolve: (decision) => {
483
- setPendingToolPermission(null);
484
- // Immediately reflect the decision in the status indicator so the running
485
- // spinner appears without waiting for the event buffer to drain
486
- const isAccept =
487
- decision === "accept" ||
488
- decision === "allowAlways" ||
489
- decision === "background" ||
490
- (typeof decision === "object" && decision.type === "accept_with_message") ||
491
- (typeof decision === "object" && decision.type === "question_answers");
492
- setAgentStatus(isAccept ? AgentStatus.ExecutingTool : AgentStatus.Submitted);
493
- resolve(decision);
494
- },
495
- });
496
- setAgentStatus(AgentStatus.WaitingForToolPermission);
497
- void notifyActionRequired("Abacus.AI is waiting for your input");
498
- });
499
- },
500
- );
501
- }, [notifyActionRequired]);
502
-
503
- const sessionRef = useRef<AgentSession | null>(null);
504
-
505
- function createSession(): AgentSession {
506
- return new AgentSession({
507
- allowedDirectories: [cwd],
508
- primaryWorkspace: cwd,
509
- apiClient,
510
- mode: agentModeRef.current,
511
- permissionProvider,
512
- diagnosticsProvider: {
513
- getDiagnostics: async (files?: string[]): Promise<Diagnostic[]> => {
514
- const conn = connectionRef.current;
515
- if (!conn) return [];
516
- return conn.getDiagnostics(files) as Promise<Diagnostic[]>;
517
- },
518
- },
519
- });
520
- }
521
-
522
- if (!sessionRef.current) {
523
- sessionRef.current = createSession();
524
- }
525
-
526
- const session = sessionRef.current;
527
-
528
- useEffect(() => {
529
- agentModeRef.current = agentMode;
530
- session.setMode(agentMode);
531
- }, [agentMode, session]);
532
-
533
- useEffect(() => {
534
- if (agentArgs?.conversationId) {
535
- void loadConversation(agentArgs.conversationId);
536
- }
537
- // eslint-disable-next-line react-hooks/exhaustive-deps
538
- }, []);
539
-
540
- // Progress indicator side effects
541
- useEffect(() => {
542
- switch (agentStatus) {
543
- case AgentStatus.Submitted:
544
- case AgentStatus.Streaming:
545
- showProgress({ state: "indeterminate", label: "Processing" });
546
- break;
547
- case AgentStatus.ExecutingTool:
548
- showProgress({ state: "indeterminate", label: "Executing tools" });
549
- break;
550
- case AgentStatus.WaitingForToolPermission:
551
- hideProgress();
552
- break;
553
- case AgentStatus.Idle:
554
- hideProgress();
555
- break;
556
- }
557
- }, [agentStatus]);
558
-
559
- const addNotification = useCallback(
560
- (message: string, severity: "info" | "warning" | "error" = "info", temp = false) => {
561
- const seg: HistorySegment = {
562
- id: crypto.randomUUID(),
563
- status: "completed",
564
- source: "bot",
565
- type: "code_llm_notification",
566
- severity,
567
- message,
568
- temp,
569
- };
570
- dispatchSegments({ type: "ADD_NOTIFICATION", seg });
571
- },
572
- [],
573
- );
574
-
575
- const clearSegments = useCallback(() => {
576
- dispatchSegments({ type: "CLEAR" });
577
- setConversationTitle(null);
578
- setAgentStatus(AgentStatus.Idle);
579
- conversationIdRef.current = null;
580
- displayDataMapRef.current.clear();
581
- sessionRef.current = createSession();
582
- // eslint-disable-next-line react-hooks/exhaustive-deps
583
- }, [apiClient, cwd, permissionProvider]);
584
-
585
- const clearSegmentsOnly = useCallback(() => {
586
- dispatchSegments({ type: "CLEAR" });
587
- }, []);
588
-
589
- const clearTempSegments = useCallback(() => {
590
- dispatchSegments({ type: "REMOVE_TEMP" });
591
- }, []);
592
-
593
- const stop = useCallback(() => {
594
- const first = session.dequeue();
595
- session.clearQueue();
596
- setQueuedMessages([]);
597
- if (first !== null) {
598
- setDequeuedOnStop(first);
599
- }
600
- session.stop();
601
- setPendingToolPermission(null);
602
- setAgentStatus(AgentStatus.Idle);
603
- }, [session]);
604
-
605
- const rejectPendingPermission = useCallback(() => {
606
- if (pendingToolPermission) {
607
- pendingToolPermission.resolve("reject");
608
- }
609
- }, [pendingToolPermission]);
610
-
611
- const loadConversation = useCallback(
612
- async (id: string) => {
613
- setAgentStatus(AgentStatus.LoadingConversation);
614
- dispatchSegments({ type: "CLEAR" });
615
- setConversationTitle(null);
616
- conversationIdRef.current = id;
617
- try {
618
- const result = await session.loadConversation(id);
619
-
620
- if (result.title) {
621
- setConversationTitle(result.title);
622
- }
623
-
624
- if (result.segments.length > 0) {
625
- // Convert ConversationSegment[] to HistorySegment[] for existing CLI rendering
626
- dispatchSegments({
627
- type: "LOAD",
628
- segments: result.segments.map((seg) => conversationSegmentToHistory(seg)),
629
- });
630
- }
631
- } catch {
632
- addNotification("Failed to load conversation", "error");
633
- } finally {
634
- setAgentStatus(AgentStatus.Idle);
635
- }
636
- },
637
- [session, addNotification],
638
- );
639
-
640
- const refreshMcpTools = useCallback(
641
- async (_skipReload?: boolean, showNotification?: boolean) => {
642
- await session.mcp.refresh();
643
- if (showNotification) {
644
- addNotification("MCP tools refreshed", "info", true);
645
- }
646
- },
647
- [session, addNotification],
648
- );
649
-
650
- const sendMessage = useCallback(
651
- async ({
652
- message,
653
- selectedModel,
654
- fileAttachments,
655
- }: {
656
- message: string;
657
- selectedModel?: string;
658
- fileAttachments?: FileAttachment[];
659
- }) => {
660
- if (!message) return;
661
- if (agentStatus === AgentStatus.LoadingConversation) return;
662
-
663
- if (selectedModel) session.setModel(selectedModel);
664
-
665
- // Attach file content to message
666
- let fullMessage = message;
667
- if (fileAttachments && fileAttachments.length > 0) {
668
- const textAttachments = fileAttachments.filter((a) => !a.mimeType.startsWith("image/"));
669
- for (const attachment of textAttachments) {
670
- const content =
671
- typeof attachment.content === "string"
672
- ? attachment.content
673
- : attachment.content.toString("utf-8");
674
- fullMessage += `\n\n<file path="${attachment.filePath}">\n${content}\n</file>`;
675
- }
676
- }
677
-
678
- const userSegId = crypto.randomUUID();
679
- const userSeg: HistorySegment = {
680
- id: userSegId,
681
- status: "completed",
682
- source: "user",
683
- type: "text",
684
- segment: message,
685
- };
686
- const spinnySeg: HistorySegment = {
687
- id: crypto.randomUUID(),
688
- status: "transient",
689
- source: "bot",
690
- type: "collapsible_component",
691
- title: "Processing request",
692
- temp: true,
693
- isSpinny: true,
694
- };
695
- dispatchSegments({ type: "INIT_SEND", userSeg, spinnySeg });
696
-
697
- setAgentStatus(AgentStatus.Submitted);
698
- startUpload();
699
-
700
- let currentTextSegId: string | null = null;
701
- let currentThinkingSegId: string | null = null;
702
-
703
- let diagnosticIssues: string | undefined;
704
- const conn = connectionRef.current;
705
- const currentFile = conn?.getCurrentFile();
706
- const selectionRange = conn?.getSelectionRange();
707
- if (conn && currentFile) {
708
- try {
709
- const diags = (await conn.getDiagnostics([currentFile])) as Diagnostic[];
710
- const issues = diags.filter((d) => d.severity === "error" || d.severity === "warning");
711
- if (issues.length > 0) {
712
- diagnosticIssues = issues
713
- .map((d) => `${d.file}:${d.line}:${d.column} [${d.severity}] ${d.message}`)
714
- .join("\n");
715
- }
716
- } catch {
717
- // ignore diagnostics errors
718
- }
719
- }
720
-
721
- try {
722
- for await (const event of session.send(fullMessage, {
723
- diagnosticIssues,
724
- currentFile: currentFile ?? undefined,
725
- selectionStartLine: selectionRange?.startLine,
726
- selectionEndLine: selectionRange?.endLine,
727
- })) {
728
- switch (event.type) {
729
- case "text_delta": {
730
- setAgentStatus(AgentStatus.Streaming);
731
- stopActivity();
732
- startDownload();
733
-
734
- const content = event.content;
735
- if (!currentTextSegId) {
736
- currentTextSegId = crypto.randomUUID();
737
- }
738
- const segId = currentTextSegId;
739
- startSegmentTransition(() => {
740
- dispatchSegments({ type: "TEXT_DELTA", segId, content });
741
- });
742
- break;
743
- }
744
-
745
- case "thinking_delta": {
746
- const content = event.content;
747
- if (!currentThinkingSegId) {
748
- currentThinkingSegId = crypto.randomUUID();
749
- }
750
- const thinkSegId = currentThinkingSegId;
751
- const thinkStart = Date.now();
752
- startSegmentTransition(() => {
753
- dispatchSegments({
754
- type: "THINKING_DELTA",
755
- segId: thinkSegId,
756
- content,
757
- startTime: thinkStart,
758
- });
759
- });
760
- break;
761
- }
762
-
763
- case "thinking_complete": {
764
- if (currentThinkingSegId) {
765
- const segId = currentThinkingSegId;
766
- const endTime = Date.now();
767
- dispatchSegments({ type: "THINKING_COMPLETE", segId, endTime });
768
- currentThinkingSegId = null;
769
- }
770
- break;
771
- }
772
-
773
- case "tool_display_data": {
774
- const { toolCallId, data } = event;
775
- const current = displayDataMapRef.current.get(toolCallId) ?? {};
776
- displayDataMapRef.current.set(toolCallId, { ...current, ...data });
777
- // Update any already-existing segment for this toolCallId
778
- dispatchSegments({ type: "TOOL_DISPLAY_DATA", toolCallId, data });
779
- break;
780
- }
781
-
782
- case "tool_requested": {
783
- setAgentStatus(AgentStatus.ExecutingTool);
784
- stopActivity();
785
- startUpload();
786
-
787
- const toolCallId = event.tool.id;
788
- const toolSeg: HistorySegment = {
789
- id: toolCallId,
790
- status: "transient",
791
- source: "bot",
792
- type: "code_llm_tool_call",
793
- toolUseRequest: {
794
- id: toolCallId,
795
- name: event.tool.name,
796
- input: event.tool.input,
797
- },
798
- toolDisplayData: displayDataMapRef.current.get(toolCallId),
799
- } as HistorySegment;
800
- dispatchSegments({
801
- type: "TOOL_REQUESTED",
802
- toolCallId,
803
- textSegId: currentTextSegId,
804
- toolSeg,
805
- });
806
- currentTextSegId = null;
807
- break;
808
- }
809
-
810
- case "tool_execution_complete": {
811
- stopActivity();
812
- startDownload();
813
-
814
- const toolCallId = event.tool.id;
815
- const { parsedResult, ...rawResult } = event.result;
816
- const spinnySeg: HistorySegment = {
817
- id: crypto.randomUUID(),
818
- status: "transient",
819
- source: "bot",
820
- type: "collapsible_component",
821
- title: "Analyzing result",
822
- temp: true,
823
- isSpinny: true,
824
- } as HistorySegment;
825
- dispatchSegments({
826
- type: "TOOL_EXECUTION_COMPLETE",
827
- toolCallId,
828
- rawResult,
829
- ...(parsedResult !== undefined && { parsedResult }),
830
- spinnySeg,
831
- });
832
- currentTextSegId = null;
833
- break;
834
- }
835
-
836
- case "notification": {
837
- if (event.severity === "error" || event.severity === "warning") {
838
- addNotification(event.message, event.severity, false);
839
- }
840
- break;
841
- }
842
-
843
- case "error": {
844
- const errorSeg: HistorySegment = {
845
- id: crypto.randomUUID(),
846
- status: "completed",
847
- source: "bot",
848
- type: "code_llm_notification",
849
- severity: "error",
850
- message: event.error.message,
851
- } as HistorySegment;
852
- dispatchSegments({ type: "ERROR", errorSeg });
853
- break;
854
- }
855
-
856
- case "mode_changed": {
857
- setAgentMode(event.mode);
858
- break;
859
- }
860
-
861
- case "tool_user_message": {
862
- const userMsgSeg: HistorySegment = {
863
- id: crypto.randomUUID(),
864
- status: "completed",
865
- source: "user",
866
- type: "text",
867
- segment: event.message,
868
- } as HistorySegment;
869
- dispatchSegments({ type: "TOOL_USER_MESSAGE", seg: userMsgSeg });
870
- break;
871
- }
872
-
873
- case "retry": {
874
- setRetryState({
875
- attempt: event.attempt,
876
- maxAttempts: event.maxAttempts,
877
- delayMs: event.delayMs,
878
- isNetworkError: event.isNetworkError,
879
- });
880
- break;
881
- }
882
-
883
- case "network_status": {
884
- setNetworkOnline(event.online);
885
- if (event.online) {
886
- setRetryState(null);
887
- }
888
- break;
889
- }
890
-
891
- case "user_message_dequeued": {
892
- // A queued user message is now being processed. Render it as a user
893
- // turn in the conversation, replacing the existing spinner with a
894
- // fresh one so the UI shows the correct turn structure.
895
- const dequeuedUserSeg: HistorySegment = {
896
- id: crypto.randomUUID(),
897
- status: "completed",
898
- source: "user",
899
- type: "text",
900
- segment: event.content,
901
- };
902
- const newSpinnySeg: HistorySegment = {
903
- id: crypto.randomUUID(),
904
- status: "transient",
905
- source: "bot",
906
- type: "collapsible_component",
907
- title: "Processing request",
908
- temp: true,
909
- isSpinny: true,
910
- };
911
- dispatchSegments({
912
- type: "INIT_SEND",
913
- userSeg: dequeuedUserSeg,
914
- spinnySeg: newSpinnySeg,
915
- });
916
- // The dequeued message is no longer in the queue; sync display state.
917
- setQueuedMessages(session.getQueue());
918
- // Reset so the next text_delta produces a fresh streaming segment.
919
- currentTextSegId = null;
920
- currentThinkingSegId = null;
921
- break;
922
- }
923
-
924
- case "turn_complete": {
925
- if (currentTextSegId) {
926
- const segId = currentTextSegId;
927
- dispatchSegments({ type: "TEXT_COMPLETED", segId });
928
- currentTextSegId = null;
929
- }
930
- // Sync React queue state in case AgentRunner consumed a queued message
931
- // inline (Anthropic/OpenAI path) — keeps the queue pill accurate.
932
- setQueuedMessages(session.getQueue());
933
- break;
934
- }
935
- }
936
- }
937
- } catch (err) {
938
- // Auth expired — trigger logout flow (unless env-based auth)
939
- if (err instanceof AuthExpiredError) {
940
- if (!authManager.isEnvAuth()) {
941
- setAuthExpired(true);
942
- void authManager.logout();
943
- }
944
- dispatchSegments({ type: "REMOVE_USER_SEG", userSegId });
945
- addNotification("Session expired — use /login to authenticate again.", "error");
946
- } else {
947
- const errorMessage =
948
- err instanceof NetworkError
949
- ? "Unable to connect to API"
950
- : err instanceof Error
951
- ? err.message
952
- : "An error occurred";
953
- dispatchSegments({ type: "REMOVE_USER_SEG", userSegId });
954
- addNotification(errorMessage, "error");
955
- }
956
-
957
- // Restore message to input buffer on error
958
- setDequeuedOnStop(fullMessage);
959
- // Clear the queue — messages won't be processed after a failure
960
- session.clearQueue();
961
- setQueuedMessages([]);
962
- } finally {
963
- stopActivity();
964
- setRetryState(null);
965
- // Finalize transient text segment and remove all spinny transient segments
966
- dispatchSegments({ type: "FINALIZE", textSegId: currentTextSegId });
967
- setAgentStatus(AgentStatus.Idle);
968
- void notifyTaskComplete("Abacus.AI completed the task");
969
- }
970
- },
971
- // eslint-disable-next-line react-hooks/exhaustive-deps
972
- [
973
- session,
974
- agentStatus,
975
- addNotification,
976
- notifyTaskComplete,
977
- startUpload,
978
- startDownload,
979
- stopActivity,
980
- startSegmentTransition,
981
- setAgentMode,
982
- authManager,
983
- setAuthExpired,
984
- ],
985
- );
986
-
987
- const addToQueue = useCallback(
988
- (message: string) => {
989
- session.enqueue(message);
990
- setQueuedMessages(session.getQueue());
991
- },
992
- [session],
993
- );
994
-
995
- const removeFirstFromQueue = useCallback(() => {
996
- session.dequeue();
997
- setQueuedMessages(session.getQueue());
998
- }, [session]);
999
-
1000
- const clearQueue = useCallback(() => {
1001
- session.clearQueue();
1002
- setQueuedMessages([]);
1003
- }, [session]);
1004
-
1005
- const clearDequeuedOnStop = useCallback(() => {
1006
- setDequeuedOnStop(null);
1007
- }, []);
1008
-
1009
- const addAllowedDirectory = useCallback(
1010
- (dirPath: string) => session.addAllowedDirectory(dirPath),
1011
- [session],
1012
- );
1013
-
1014
- const contextValue = useMemo<AgentContextValue>(
1015
- () => ({
1016
- conversationId: conversationIdRef.current,
1017
- conversationTitle,
1018
- segments,
1019
- segmentsLength: segments.length,
1020
- sendMessage,
1021
- stop,
1022
- rejectPendingPermission,
1023
- agentStatus,
1024
- clearSegments,
1025
- clearSegmentsOnly,
1026
- clearTempSegments,
1027
- loadConversation,
1028
- addNotification,
1029
- mcp: session.mcp,
1030
- addAllowedDirectory,
1031
- pendingToolPermission,
1032
- refreshMcpTools,
1033
- isPendingSegmentUpdate,
1034
- queuedMessages,
1035
- addToQueue,
1036
- removeFirstFromQueue,
1037
- clearQueue,
1038
- dequeuedOnStop,
1039
- clearDequeuedOnStop,
1040
- activeToolOutputs,
1041
- retryState,
1042
- networkOnline,
1043
- }),
1044
- [
1045
- conversationTitle,
1046
- segments,
1047
- sendMessage,
1048
- stop,
1049
- rejectPendingPermission,
1050
- agentStatus,
1051
- clearSegments,
1052
- clearSegmentsOnly,
1053
- clearTempSegments,
1054
- loadConversation,
1055
- addNotification,
1056
- session,
1057
- addAllowedDirectory,
1058
- pendingToolPermission,
1059
- refreshMcpTools,
1060
- isPendingSegmentUpdate,
1061
- queuedMessages,
1062
- addToQueue,
1063
- removeFirstFromQueue,
1064
- clearQueue,
1065
- dequeuedOnStop,
1066
- clearDequeuedOnStop,
1067
- retryState,
1068
- networkOnline,
1069
- ],
1070
- );
1071
-
1072
- return <AgentContext.Provider value={contextValue}>{children}</AgentContext.Provider>;
1073
- });
1074
-
1075
- AgentProvider.displayName = "AgentProvider";