@hachej/boring-agent 0.1.111 → 0.2.0

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 (156) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +262 -51
  3. package/dist/agents.d.ts +75 -0
  4. package/dist/agents.js +91 -0
  5. package/dist/approval.d.ts +71 -0
  6. package/dist/approval.js +126 -0
  7. package/dist/artifacts.d.ts +53 -0
  8. package/dist/artifacts.js +129 -0
  9. package/dist/ask-user.d.ts +40 -0
  10. package/dist/ask-user.js +134 -0
  11. package/dist/attachment.d.ts +5 -0
  12. package/dist/attachment.js +4 -0
  13. package/dist/browser-task.d.ts +32 -0
  14. package/dist/browser-task.js +119 -0
  15. package/dist/chat-transport.d.ts +80 -0
  16. package/dist/chat-transport.js +306 -0
  17. package/dist/contracts.d.ts +40 -0
  18. package/dist/contracts.js +1 -0
  19. package/dist/conversations.d.ts +136 -0
  20. package/dist/conversations.js +366 -0
  21. package/dist/definitions.d.ts +37 -0
  22. package/dist/definitions.js +99 -0
  23. package/dist/delivery-input.d.ts +35 -0
  24. package/dist/delivery-input.js +56 -0
  25. package/dist/delivery.d.ts +33 -0
  26. package/dist/delivery.js +154 -0
  27. package/dist/durable-wait.d.ts +23 -0
  28. package/dist/durable-wait.js +79 -0
  29. package/dist/file-convert.d.ts +46 -0
  30. package/dist/file-convert.js +159 -0
  31. package/dist/file-guard.d.ts +50 -0
  32. package/dist/file-guard.js +171 -0
  33. package/dist/file-types.d.ts +17 -0
  34. package/dist/file-types.js +95 -0
  35. package/dist/gateway-provider.d.ts +24 -0
  36. package/dist/gateway-provider.js +42 -0
  37. package/dist/git.d.ts +34 -0
  38. package/dist/git.js +79 -0
  39. package/dist/harness-pool.d.ts +38 -0
  40. package/dist/harness-pool.js +134 -0
  41. package/dist/index.d.ts +4 -0
  42. package/dist/index.js +1 -0
  43. package/dist/json-schema-tool.d.ts +25 -0
  44. package/dist/json-schema-tool.js +19 -0
  45. package/dist/memory/optchat-core.d.ts +118 -0
  46. package/dist/memory/optchat-core.js +317 -0
  47. package/dist/memory/optchat.d.ts +156 -0
  48. package/dist/memory/optchat.js +432 -0
  49. package/dist/mentions.d.ts +56 -0
  50. package/dist/mentions.js +140 -0
  51. package/dist/metering.d.ts +183 -0
  52. package/dist/metering.js +443 -0
  53. package/dist/model-gateway.d.ts +86 -0
  54. package/dist/model-gateway.js +241 -0
  55. package/dist/native-version.d.ts +9 -0
  56. package/dist/native-version.js +7 -0
  57. package/dist/native.d.ts +4 -0
  58. package/dist/native.js +1 -0
  59. package/dist/presentation.d.ts +17 -0
  60. package/dist/presentation.js +39 -0
  61. package/dist/projection-format.d.ts +68 -0
  62. package/dist/projection-format.js +118 -0
  63. package/dist/projection-window.d.ts +9 -0
  64. package/dist/projection-window.js +93 -0
  65. package/dist/projection.d.ts +22 -0
  66. package/dist/projection.js +153 -0
  67. package/dist/question-response.d.ts +20 -0
  68. package/dist/question-response.js +75 -0
  69. package/dist/questions.d.ts +74 -0
  70. package/dist/questions.js +199 -0
  71. package/dist/self-evolving.d.ts +55 -0
  72. package/dist/self-evolving.js +239 -0
  73. package/dist/skills.d.ts +15 -0
  74. package/dist/skills.js +51 -0
  75. package/dist/tool-evidence.d.ts +14 -0
  76. package/dist/tool-evidence.js +54 -0
  77. package/dist/validation.d.ts +38 -0
  78. package/dist/validation.js +68 -0
  79. package/dist/workspaces.d.ts +107 -0
  80. package/dist/workspaces.js +212 -0
  81. package/package.json +145 -150
  82. package/dist/DebugDrawer-JNA43SVR.js +0 -8
  83. package/dist/admin-DORVQfLn.d.ts +0 -340
  84. package/dist/chunk-2BGLZZ7T.js +0 -10
  85. package/dist/chunk-42D6KAQV.js +0 -2882
  86. package/dist/chunk-4XOW57KJ.js +0 -343
  87. package/dist/chunk-72KT6VWV.js +0 -1338
  88. package/dist/chunk-7XAOVFSN.js +0 -28
  89. package/dist/chunk-KJIEMSQP.js +0 -198
  90. package/dist/chunk-KN72XWP7.js +0 -394
  91. package/dist/chunk-N6THTH7P.js +0 -110
  92. package/dist/chunk-V3H5A3BR.js +0 -22501
  93. package/dist/chunk-YGRQ4Q5P.js +0 -20
  94. package/dist/chunk-YTUZFKB3.js +0 -78
  95. package/dist/core/index.d.ts +0 -28
  96. package/dist/core/index.js +0 -617
  97. package/dist/createHarness-DOLOHA62.js +0 -18
  98. package/dist/eval/index.d.ts +0 -247
  99. package/dist/eval/index.js +0 -541
  100. package/dist/file-search-BUgMSKZE.d.ts +0 -289
  101. package/dist/front/artifacts.d.ts +0 -34
  102. package/dist/front/artifacts.js +0 -21
  103. package/dist/front/index.d.ts +0 -1082
  104. package/dist/front/index.js +0 -12912
  105. package/dist/front/styles.css +0 -5380
  106. package/dist/harness-qHlMJhZo.d.ts +0 -276
  107. package/dist/middleware-CaAEXpi5.d.ts +0 -115
  108. package/dist/piChatEvent-DpE0lIb9.d.ts +0 -450
  109. package/dist/piChatSessionService-CBct-hmz.d.ts +0 -86
  110. package/dist/sandbox-BMhut3kh.d.ts +0 -317
  111. package/dist/server/agent-host/testing/compositionRouteProof.d.ts +0 -8
  112. package/dist/server/agent-host/testing/compositionRouteProof.js +0 -78
  113. package/dist/server/agent-host/testing/gatewayConformance.d.ts +0 -43
  114. package/dist/server/agent-host/testing/gatewayConformance.js +0 -605
  115. package/dist/server/index.d.ts +0 -2278
  116. package/dist/server/index.js +0 -274
  117. package/dist/server/pi-session-readability.d.ts +0 -12
  118. package/dist/server/pi-session-readability.js +0 -23
  119. package/dist/server/worker/index.d.ts +0 -68
  120. package/dist/server/worker/index.js +0 -377
  121. package/dist/share-entry-CxS6UJ_L.d.ts +0 -330
  122. package/dist/shared/index.d.ts +0 -2111
  123. package/dist/shared/index.js +0 -262
  124. package/dist/types-DcWoQMn8.d.ts +0 -1377
  125. package/docs/ACCESSIBILITY.md +0 -52
  126. package/docs/AGENT_GATEWAY_V0.md +0 -212
  127. package/docs/AGENT_PACKAGES.md +0 -90
  128. package/docs/API.md +0 -123
  129. package/docs/AUTHORING.md +0 -68
  130. package/docs/CSP.md +0 -41
  131. package/docs/ERROR_CODES.md +0 -229
  132. package/docs/KNOWN_LIMITATIONS.md +0 -100
  133. package/docs/MIGRATION.md +0 -50
  134. package/docs/PERFORMANCE.md +0 -68
  135. package/docs/PLUGINS.md +0 -138
  136. package/docs/README.md +0 -98
  137. package/docs/RISKS-MULTI-TAB.md +0 -46
  138. package/docs/SESSION_IDENTITY.md +0 -91
  139. package/docs/STYLING.md +0 -73
  140. package/docs/UI-SHADCN.md +0 -56
  141. package/docs/VERCEL_COSTS.md +0 -103
  142. package/docs/plans/archive/AGENT_EVAL_FRAMEWORK.md +0 -466
  143. package/docs/plans/archive/agent-package-spec.md +0 -1777
  144. package/docs/plans/archive/harness-followup-capabilities.md +0 -440
  145. package/docs/plans/archive/harness-tool-ui-capabilities.md +0 -144
  146. package/docs/plans/archive/pi-followup-history-projection.md +0 -229
  147. package/docs/plans/archive/pi-tools-migration.md +0 -1061
  148. package/docs/plans/archive/reviews/pi-followup-history-codex-review.md +0 -11
  149. package/docs/plans/archive/reviews/pi-followup-history-gpt-review.md +0 -64
  150. package/docs/plans/archive/reviews/pi-followup-history-opus-review.md +0 -43
  151. package/docs/plans/archive/reviews/pi-followup-history-xai-review.md +0 -43
  152. package/docs/plans/archive/vercel-base-snapshot-template-plan.md +0 -527
  153. package/docs/plans/archive/vercel-persistent-sandbox-adapter.md +0 -553
  154. package/docs/runtime-provisioning.md +0 -157
  155. package/docs/runtime.md +0 -296
  156. package/docs/tools.md +0 -102
@@ -1,1082 +0,0 @@
1
- import { q as ToolUiMetadata, B as BoringChatPart, w as BoringChatMessage, M as PiChatStatus, c as PiChatSnapshot, n as QueuedUserMessage, D as ChatError, d as PiChatEvent, P as PromptPayload, e as PromptReceipt, F as FollowUpPayload, f as FollowUpReceipt, Q as QueueClearPayload, g as QueueClearReceipt, I as InterruptPayload, h as CommandReceipt, i as StopPayload, j as StopReceipt, b as SessionSummary, H as ErrorCode } from '../piChatEvent-DpE0lIb9.js';
2
- import * as react from 'react';
3
- import { ComponentProps, HTMLAttributes, FormEvent, ReactNode, ComponentType } from 'react';
4
- import { FileUIPart, ChatStatus, UIMessage } from 'ai';
5
- import { s as AgentSummary, j as AgentGatewayErrorCode, P as JsonValue, E as CredentialMetadataV1 } from '../admin-DORVQfLn.js';
6
- export { Artifact, ArtifactAction, ArtifactActions, ArtifactDescription, ArtifactHeader, ArtifactOpenProvider, ArtifactTitle, OpenArtifactHandler, useOpenArtifact } from './artifacts.js';
7
- import { InputGroupAddon, InputGroupButton, InputGroupTextarea, Button, Collapsible, CollapsibleContent, CollapsibleTrigger } from '@hachej/boring-ui-kit';
8
- import { Streamdown } from 'streamdown';
9
- import { StickToBottom } from 'use-stick-to-bottom';
10
- import { ClassValue } from 'clsx';
11
- import 'zod';
12
- import 'lucide-react';
13
-
14
- interface UploadFileOptions {
15
- apiBaseUrl?: string;
16
- workspaceRequestId?: string | null;
17
- requestHeaders?: Record<string, string | undefined>;
18
- directory?: string;
19
- sourcePath?: string;
20
- responseUrl?: 'markdown' | 'raw';
21
- fetch?: typeof globalThis.fetch;
22
- }
23
- interface UploadFileResult {
24
- url: string;
25
- path: string;
26
- }
27
- declare function uploadFile(file: File, opts?: UploadFileOptions): Promise<UploadFileResult>;
28
-
29
- type PromptInputFilePart = FileUIPart & {
30
- path?: string;
31
- };
32
-
33
- type PromptInputFooterProps = ComponentProps<typeof InputGroupAddon>;
34
- declare const PromptInputFooter: ({ align, className, ...props }: PromptInputFooterProps) => react.JSX.Element;
35
-
36
- interface PromptInputMessage {
37
- text: string;
38
- files: PromptInputFilePart[];
39
- }
40
- type PromptInputProps = Omit<HTMLAttributes<HTMLFormElement>, "onSubmit" | "onError"> & {
41
- accept?: string;
42
- multiple?: boolean;
43
- globalDrop?: boolean;
44
- syncHiddenInput?: boolean;
45
- maxFiles?: number;
46
- maxFileSize?: number;
47
- onError?: (err: {
48
- code: "max_files" | "max_file_size" | "accept";
49
- message: string;
50
- }) => void;
51
- onSubmit: (message: PromptInputMessage, event: FormEvent<HTMLFormElement>) => false | void | Promise<false | void>;
52
- /** When provided, files are uploaded to the server immediately on add and the
53
- * attachment URL is replaced with the stable server path before submit. */
54
- onUploadFile?: (file: File) => Promise<{
55
- url: string;
56
- path?: string;
57
- }>;
58
- };
59
- declare const PromptInput: ({ className, accept, multiple, globalDrop, syncHiddenInput, maxFiles, maxFileSize, onError, onSubmit, onUploadFile, children, ...props }: PromptInputProps) => react.JSX.Element;
60
- type PromptInputTextareaProps = ComponentProps<typeof InputGroupTextarea>;
61
- declare const PromptInputTextarea: ({ onChange, onKeyDown, className, placeholder, ...props }: PromptInputTextareaProps) => react.JSX.Element;
62
- type PromptInputSubmitProps = ComponentProps<typeof InputGroupButton> & {
63
- status?: ChatStatus;
64
- onStop?: () => void;
65
- };
66
- declare const PromptInputSubmit: ({ className, variant, size, status, onStop, onClick, children, ...props }: PromptInputSubmitProps) => react.JSX.Element;
67
-
68
- /**
69
- * Extended-thinking budget. Sent through the agent runtime to providers that
70
- * support reasoning controls. 'off' means no reasoning chunks; the higher
71
- * tiers progressively allow more think-time.
72
- */
73
- type ThinkingLevel = 'off' | 'low' | 'medium' | 'high';
74
- /**
75
- * Selected model, stored as { provider, id } so the composer can pass through
76
- * the agent runtime's registered model IDs rather than a local alias table.
77
- * Unqualified legacy aliases are ignored: Boring must not infer a provider
78
- * when the runtime owns model selection.
79
- */
80
- interface ModelSelection {
81
- provider: string;
82
- id: string;
83
- }
84
- interface AvailableModel extends ModelSelection {
85
- label: string;
86
- available: boolean;
87
- }
88
-
89
- /**
90
- * Suggested action shown in a chat empty state. Customizable per child app
91
- * via `ChatPanel.suggestions` / `ChatCenteredShell.chatSuggestions`.
92
- *
93
- * Click behavior: if `onSelect` is provided it wins; otherwise `prompt`
94
- * (or `label` as a fallback) is sent as the next user message.
95
- */
96
- interface ChatSuggestion {
97
- /** Title shown on the suggestion card. */
98
- label: string;
99
- /** Smaller hint/subtitle line below the label. */
100
- hint?: string;
101
- /**
102
- * Lucide-compatible icon component (any component that accepts className
103
- * + strokeWidth). Pass `BookOpen`, `Code2`, etc. directly from lucide-react.
104
- */
105
- icon?: ComponentType<{
106
- className?: string;
107
- strokeWidth?: number;
108
- }>;
109
- /**
110
- * Text inserted as the user's next message when the card is clicked. If
111
- * omitted, falls back to `label`.
112
- */
113
- prompt?: string;
114
- /**
115
- * Override the click handler entirely. When set, `prompt` is ignored —
116
- * the host decides what happens (e.g., open a wizard, prefill the
117
- * composer, route somewhere).
118
- */
119
- onSelect?: () => void;
120
- }
121
- /**
122
- * Sensible defaults that mirror the suggestions the chat-centered shell
123
- * showed before the agent was wired into the workspace. Child apps that
124
- * pass nothing inherit these; passing an empty array hides the grid.
125
- */
126
- declare const defaultChatSuggestions: ChatSuggestion[];
127
- interface ChatEmptyStateProps {
128
- /** Small uppercase eyebrow above the headline. */
129
- eyebrow?: string;
130
- /** Large headline. Editorial tone. */
131
- title?: string;
132
- /** Single-paragraph description below the headline. */
133
- description?: ReactNode;
134
- /**
135
- * Suggestion cards. Pass `[]` to hide the grid entirely (headline still
136
- * renders). Defaults to `defaultChatSuggestions`.
137
- */
138
- suggestions?: ChatSuggestion[];
139
- /**
140
- * Fired when a suggestion card is clicked. The default ChatPanel wiring
141
- * resolves this to `sendMessage` with the suggestion's prompt.
142
- */
143
- onSelect?: (suggestion: ChatSuggestion) => void;
144
- /** Uses the concise empty-chat hierarchy. */
145
- hero?: boolean;
146
- /** Optional content rendered below the suggestion grid. */
147
- footer?: ReactNode;
148
- className?: string;
149
- }
150
- declare function ChatEmptyState({ eyebrow, title, description, suggestions, onSelect, hero, footer, className, }: ChatEmptyStateProps): react.JSX.Element;
151
-
152
- interface ParsedCommand {
153
- name: string;
154
- args: string;
155
- }
156
- declare function parseSlashCommand(text: string): ParsedCommand | null;
157
-
158
- type SlashCommandHandlerResult = string | void | {
159
- message?: string;
160
- preserveDraft?: boolean;
161
- /**
162
- * Result text the agent must see. When set, the command's outcome is also
163
- * submitted as an expanded-text turn, so it lands in the model's context the
164
- * same way a skill command's expansion does — a browser-only notice is
165
- * invisible to the agent. Keep it a short structured summary, not a dump.
166
- */
167
- modelMessage?: string;
168
- };
169
- type SlashCommandHandler = (args: string, ctx: SlashCommandContext) => SlashCommandHandlerResult | Promise<SlashCommandHandlerResult>;
170
- type SlashCommandClickBehavior = 'execute' | 'insert' | 'disabled';
171
- interface SlashCommand {
172
- name: string;
173
- description: string;
174
- /**
175
- * - local: handled in the browser.
176
- * - skill: forwarded to the PI agent as `skill: <name>\n\n<args>`.
177
- * Server commands registered via `useServerCommands` omit `kind` (or set
178
- * it to `local`) — Pi handles execution natively so no frontend kind-check
179
- * is needed.
180
- */
181
- kind?: 'local' | 'skill';
182
- /** Explicit opt-in for assistant-message command links. Unset commands remain plain text. */
183
- clickBehavior?: SlashCommandClickBehavior;
184
- /**
185
- * Origin of the command, surfaced as a tag in the slash-command picker.
186
- * Mirrors Pi's command sources for server commands; `local` for built-in
187
- * browser commands. Display only.
188
- */
189
- source?: 'local' | 'extension' | 'prompt' | 'skill';
190
- /** Originating plugin/package name (when known), shown as a tag. */
191
- sourcePlugin?: string;
192
- /**
193
- * Narrow browser-local escape hatch for independent controls that must remain
194
- * usable while Pi is running. The predicate must admit only exact safe subcommands.
195
- */
196
- allowWhileBusy?: (args: string) => boolean;
197
- handler: SlashCommandHandler;
198
- }
199
- interface SlashCommandContext {
200
- sessionId: string;
201
- clearMessages: () => void;
202
- resetSession: () => void;
203
- listCommands: () => SlashCommand[];
204
- reloadAgentPlugins: () => Promise<string>;
205
- openModelPicker?: () => boolean | void;
206
- selectComposerModel?: (query: string) => string | void;
207
- openThinkingPicker?: () => boolean | void;
208
- selectComposerThinking?: (query: string) => string | void;
209
- /**
210
- * Drives the PluginUpdateStatus banner above the composer. The `/reload`
211
- * builtin prefers this over the inline-text path: it calls
212
- * `pluginUpdate.run()` which (1) sets the banner to "running", (2)
213
- * hits the addressed Agent reload route, (3) transitions to "success" or "error"
214
- * with diagnostics. Returns a short string ack for the assistant
215
- * message bubble.
216
- */
217
- pluginUpdate?: {
218
- run: () => Promise<string>;
219
- };
220
- }
221
- interface CommandRegistry {
222
- register(cmd: SlashCommand): void;
223
- unregister(name: string): void;
224
- get(name: string): SlashCommand | undefined;
225
- list(): SlashCommand[];
226
- }
227
- declare function createCommandRegistry(initial?: SlashCommand[]): CommandRegistry;
228
-
229
- declare const builtinCommands: SlashCommand[];
230
-
231
- type ToolState$1 = 'input-streaming' | 'input-available' | 'approval-requested' | 'approval-responded' | 'output-available' | 'output-error' | 'output-denied' | 'aborted';
232
-
233
- type BoringToolCallPart = Extract<BoringChatPart, {
234
- type: 'tool-call';
235
- }>;
236
- interface ToolRendererResolution {
237
- key: string;
238
- source: 'rendererId' | 'toolName' | 'fallback';
239
- requestedRendererId?: string;
240
- }
241
- interface ToolPart$1 {
242
- /** Neutral render-model type. Legacy `tool-<name>` values are accepted at the renderer boundary. */
243
- type: 'tool-call' | `tool-${string}` | 'dynamic-tool';
244
- toolName: string;
245
- /** Stable tool call id; for Pi-native BoringChatPart this is BoringChatPart.id. */
246
- toolCallId: string;
247
- state: ToolState$1;
248
- input?: unknown;
249
- output?: unknown;
250
- errorText?: string;
251
- ui?: ToolUiMetadata;
252
- rendererResolution?: ToolRendererResolution;
253
- }
254
- type ToolRenderablePart = ToolPart$1 | BoringToolCallPart | unknown;
255
- type ToolRenderer = ((part: ToolPart$1) => ReactNode) & {
256
- presentation?: "inline";
257
- };
258
- type ToolRendererOverrides = Partial<Record<string, ToolRenderer>>;
259
- declare const defaultToolRenderers: Record<string, ToolRenderer>;
260
- declare function mergeToolRenderers(overrides?: ToolRendererOverrides): Record<string, ToolRenderer>;
261
- declare function resolveToolRenderer(toolNameOrPart: string | ToolPart$1, overrides?: ToolRendererOverrides): ToolRenderer;
262
-
263
- type ChatPanelRuntimeDependenciesWarmupStatus = {
264
- state: 'preparing' | 'ready' | 'failed';
265
- message?: string;
266
- requirement?: string;
267
- };
268
- type ChatPanelWorkspaceWarmupStatus = {
269
- status: 'preparing';
270
- requirement?: 'workspace-fs' | 'sandbox-exec' | 'ui-bridge';
271
- message?: string;
272
- runtimeDependencies?: ChatPanelRuntimeDependenciesWarmupStatus;
273
- } | {
274
- status: 'ready';
275
- runtimeDependencies?: ChatPanelRuntimeDependenciesWarmupStatus;
276
- } | {
277
- status: 'failed';
278
- requirement?: 'workspace-fs' | 'sandbox-exec' | 'ui-bridge';
279
- message?: string;
280
- runtimeDependencies?: ChatPanelRuntimeDependenciesWarmupStatus;
281
- };
282
-
283
- interface OptimisticUserMessage extends BoringChatMessage {
284
- role: 'user';
285
- clientNonce: string;
286
- clientSeq?: number;
287
- /**
288
- * Id of the last committed message when this optimistic prompt was submitted.
289
- * Used to position the placeholder by sequence rather than by wall-clock time,
290
- * so client/server clock skew can't render a just-sent prompt above the
291
- * previous reply.
292
- */
293
- afterMessageId?: string;
294
- }
295
-
296
- type PiChatConnectionState = 'disconnected' | 'connecting' | 'connected' | 'reconnecting' | 'suspended';
297
-
298
- interface PiChatRuntimeNotice {
299
- id: string;
300
- level: 'info' | 'warning' | 'error';
301
- text: string;
302
- dismissible?: boolean;
303
- /** Stable, canonical server error code (a shared ErrorCode enum member) when this
304
- * notice came from a rejected run. Lets a host render a recovery action for a specific
305
- * code without the agent knowing what the code means. */
306
- errorCode?: string;
307
- }
308
- interface PiChatRetryNotice {
309
- attempt: number;
310
- maxAttempts: number;
311
- delayMs: number;
312
- errorMessage: string;
313
- }
314
- interface PiChatSeqGap {
315
- expectedSeq: number;
316
- actualSeq: number;
317
- lastSeq: number;
318
- }
319
- interface PiChatHistoryState {
320
- /** First cut renders full history; this explicit shape leaves room for paged windows later. */
321
- mode: 'full';
322
- messageCount: number;
323
- }
324
- interface PiChatState {
325
- sessionId: string;
326
- workspaceId?: string;
327
- storageScope: string;
328
- status: PiChatStatus;
329
- currentModel?: PiChatSnapshot['currentModel'];
330
- turnId?: string;
331
- lastSeq: number;
332
- committedMessages: BoringChatMessage[];
333
- streamingMessage?: BoringChatMessage;
334
- streamingPreservedTextPartKeys?: Set<string>;
335
- history: PiChatHistoryState;
336
- queue: {
337
- followUps: QueuedUserMessage[];
338
- };
339
- optimisticOutbox: Record<string, OptimisticUserMessage>;
340
- pendingToolCallIds: Set<string>;
341
- connection: {
342
- state: PiChatConnectionState;
343
- lastHeartbeatAt?: number;
344
- };
345
- error?: ChatError;
346
- retryNotice?: PiChatRetryNotice;
347
- notices: PiChatRuntimeNotice[];
348
- hydrated: boolean;
349
- needsResync?: PiChatSeqGap;
350
- }
351
-
352
- type PiChatStoreListener = () => void;
353
- interface PiChatStoreOptions {
354
- scheduleNotify?: (notify: () => void) => unknown;
355
- cancelNotify?: (handle: unknown) => void;
356
- }
357
-
358
- interface RemotePiSessionHeaders {
359
- [key: string]: string | undefined;
360
- }
361
- interface RemotePiSessionOptions {
362
- sessionId: string;
363
- /** Addressed AgentGateway owner for this session. */
364
- agentTypeId: string;
365
- workspaceId?: string;
366
- storageScope?: string;
367
- apiBaseUrl?: string;
368
- headers?: RemotePiSessionHeaders | (() => RemotePiSessionHeaders | Promise<RemotePiSessionHeaders>);
369
- fetch?: typeof globalThis.fetch;
370
- onEvent?: (event: PiChatEvent) => void;
371
- storeOptions?: PiChatStoreOptions;
372
- autoStart?: boolean;
373
- reconnect?: {
374
- baseMs?: number;
375
- maxMs?: number;
376
- jitterRatio?: number;
377
- random?: () => number;
378
- };
379
- debug?: {
380
- largeStateWarningBytes?: number;
381
- largeStateWarningMessages?: number;
382
- onWarning?: (warning: RemotePiSessionLargeStateWarning) => void;
383
- };
384
- setTimeoutFn?: typeof globalThis.setTimeout;
385
- clearTimeoutFn?: typeof globalThis.clearTimeout;
386
- requestTimeoutMs?: number;
387
- commandTimeoutMs?: number;
388
- }
389
- interface RemotePiSessionLargeStateWarning {
390
- type: 'large-state';
391
- sessionId: string;
392
- approxBytes: number;
393
- messageCount: number;
394
- thresholdBytes: number;
395
- thresholdMessages: number;
396
- }
397
- interface RemotePiSessionDebugState {
398
- sessionId: string;
399
- lastSeq: number;
400
- status: PiChatState['status'];
401
- connection: PiChatState['connection']['state'];
402
- lastHeartbeatAt?: number;
403
- queue: {
404
- followUps: number;
405
- optimisticOutbox: number;
406
- pendingToolCalls: number;
407
- };
408
- recentEventTypes: string[];
409
- gapCount: number;
410
- retryNotice?: PiChatState['retryNotice'];
411
- largeStateWarning?: RemotePiSessionLargeStateWarning;
412
- history: {
413
- mode: 'full';
414
- messageCount: number;
415
- streamingMessageCount: 0 | 1;
416
- };
417
- disposed: boolean;
418
- suspended: boolean;
419
- generation: number;
420
- streamRunId: number;
421
- reconnectAttempt: number;
422
- hasReconnectTimer: boolean;
423
- inflightFetches: number;
424
- }
425
- declare class RemotePiSession {
426
- private readonly options;
427
- private readonly store;
428
- private readonly fetchImpl;
429
- private readonly apiBaseUrl;
430
- private readonly storageScope;
431
- private readonly setTimeoutFn;
432
- private readonly clearTimeoutFn;
433
- private readonly requestTimeoutMs;
434
- private readonly commandTimeoutMs;
435
- private generation;
436
- private streamRunId;
437
- private reconnectAttempt;
438
- private started;
439
- private suspended;
440
- private disposed;
441
- private streamAbortController?;
442
- private reconnectTimer?;
443
- private readonly fetchControllers;
444
- private readonly recentEventTypes;
445
- private gapCount;
446
- private largeStateWarning?;
447
- constructor(options: RemotePiSessionOptions);
448
- getState(): PiChatState;
449
- getDebugState(): RemotePiSessionDebugState;
450
- subscribe(listener: PiChatStoreListener): () => void;
451
- start(cursor?: number): Promise<void>;
452
- prompt(payload: PromptPayload): Promise<PromptReceipt>;
453
- followUp(payload: FollowUpPayload): Promise<FollowUpReceipt>;
454
- clearQueue(payload?: QueueClearPayload): Promise<QueueClearReceipt>;
455
- private postQueueClear;
456
- interrupt(payload?: InterruptPayload): Promise<CommandReceipt>;
457
- stop(payload?: StopPayload): Promise<StopReceipt>;
458
- suspendStream(): void;
459
- resumeStream(): void;
460
- dispose(): void;
461
- private hydrateAndConnect;
462
- private connectEvents;
463
- private runEventStream;
464
- private rehydrateAfterStreamReset;
465
- private ensureReconnectScheduled;
466
- private scheduleReconnect;
467
- private postCommand;
468
- private addressedCommandReceipt;
469
- private rollbackOptimisticMessage;
470
- private fetchJson;
471
- private requestHeaders;
472
- private stateUrl;
473
- private eventsUrl;
474
- private sessionUrl;
475
- private addressedCommandPayload;
476
- private dispatchProtocolError;
477
- private recordEventType;
478
- private recordLargeStateWarning;
479
- private clearReconnectTimer;
480
- private abortEventStream;
481
- private isGenerationActive;
482
- private isStreamLifecycleActive;
483
- private isHydrationActive;
484
- private isStreamActive;
485
- }
486
-
487
- interface ActiveSessionStorageLike {
488
- getItem(key: string): string | null;
489
- setItem(key: string, value: string): void;
490
- removeItem(key: string): void;
491
- }
492
- interface BootResumeSessionSource {
493
- apiBaseUrl?: string;
494
- sessionsApiPath: string;
495
- /** Explicit normalized owner, including when sessionsApiPath is host-fixed. */
496
- agentTypeId?: string;
497
- workspaceId?: string;
498
- storageScope?: string;
499
- }
500
- interface ActiveSessionStorageOptions {
501
- storageScope?: string;
502
- storage?: ActiveSessionStorageLike;
503
- bootResumeSource?: BootResumeSessionSource;
504
- }
505
- declare function activeSessionStorageKey(storageScope?: string): string;
506
- declare function readActiveSessionId(options?: ActiveSessionStorageOptions): string | undefined;
507
- declare function writeActiveSessionId(sessionId: string | undefined, options?: ActiveSessionStorageOptions): void;
508
-
509
- interface PiSessionCreateInit {
510
- title?: string;
511
- /** Boot-only intent to resume this exact tab-owned empty session. */
512
- resumeSessionId?: string;
513
- }
514
- interface PiSessionRefreshOptions {
515
- background?: boolean;
516
- /** Reject when the authoritative refresh fails instead of only updating hook state. */
517
- throwOnError?: boolean;
518
- }
519
- interface UsePiSessionsOptions {
520
- agentTypeId: string;
521
- apiBaseUrl?: string;
522
- sessionsApiPath?: string;
523
- workspaceId?: string;
524
- /** Stable caller identity echoed only after this source's rows are authoritative. */
525
- sourceIdentity?: string;
526
- /** Server-authorized workspace/storage scope used for HTTP requests. */
527
- storageScope?: string;
528
- /** Browser-only active-session persistence scope; defaults to storageScope. */
529
- activeSessionStorageScope?: string;
530
- requestHeaders?: Record<string, string | undefined>;
531
- enabled?: boolean;
532
- refreshKey?: unknown;
533
- initialActiveSessionId?: string;
534
- fetch?: typeof globalThis.fetch;
535
- storage?: ActiveSessionStorageLike;
536
- /** Tab-owned unsent-session resume storage. Defaults to sessionStorage. */
537
- bootResumeStorage?: ActiveSessionStorageLike;
538
- createRemoteSession?: (options: RemotePiSessionOptions) => RemotePiSession;
539
- remoteSessionOptions?: Omit<Partial<RemotePiSessionOptions>, 'sessionId' | 'agentTypeId' | 'workspaceId' | 'storageScope' | 'apiBaseUrl' | 'headers' | 'fetch'>;
540
- connectActiveSession?: boolean;
541
- retry?: {
542
- maxRetries?: number;
543
- baseMs?: number;
544
- maxMs?: number;
545
- };
546
- }
547
- interface UsePiSessionsResult {
548
- sessions: SessionSummary[];
549
- activeSession: SessionSummary | undefined;
550
- activeSessionId: string | undefined;
551
- /** Hidden boot candidate; never connected/rendered before create confirms it. */
552
- resumeSessionId: string | undefined;
553
- activePiSession: RemotePiSession | undefined;
554
- dataStorageScope: string;
555
- /** Attests that returned session data belongs to the caller's expected source. */
556
- sourceIdentity: string | undefined;
557
- loading: boolean;
558
- loadingMore: boolean;
559
- hasMore: boolean;
560
- /** Archived inventory is paged independently from the active list. */
561
- archivedLoaded: boolean;
562
- archivedLoading: boolean;
563
- hasMoreArchived: boolean;
564
- error: Error | undefined;
565
- refresh: (options?: PiSessionRefreshOptions) => Promise<void>;
566
- create: (init?: PiSessionCreateInit) => Promise<SessionSummary>;
567
- rename: (id: string, title: string) => Promise<SessionSummary>;
568
- /** Explicit archive capability; never aliases delete. */
569
- setArchived: (id: string, archived: boolean) => Promise<SessionSummary>;
570
- /** Loads the first or next archived-only page. */
571
- loadArchived: () => Promise<void>;
572
- switch: (id: string) => void;
573
- delete: (id: string) => Promise<void>;
574
- loadMore: () => Promise<void>;
575
- reset: () => void;
576
- }
577
- declare function usePiSessions(options: UsePiSessionsOptions): UsePiSessionsResult;
578
-
579
- interface SessionListProps {
580
- sessions: SessionSummary[];
581
- activeId?: string;
582
- loading?: boolean;
583
- onSwitch?: (id: string) => void;
584
- onCreate?: () => void;
585
- onDelete?: (id: string) => void;
586
- onLoadMore?: () => void;
587
- hasMore?: boolean;
588
- loadingMore?: boolean;
589
- onClose?: () => void;
590
- className?: string;
591
- }
592
- declare function SessionList({ sessions, activeId, loading, onSwitch, onCreate, onDelete, onLoadMore, hasMore, loadingMore, onClose, className, }: SessionListProps): react.JSX.Element;
593
- declare const SessionBrowser: typeof SessionList;
594
-
595
- interface PiSessionSearchItem {
596
- id: string;
597
- /** boring-ui session title maps to pi's session display name. */
598
- title?: string | null;
599
- /** Optional pi-style session name for callers that already expose it. */
600
- name?: string | null;
601
- /** Optional full transcript search text when available from a pi session listing. */
602
- allMessagesText?: string | null;
603
- /** Optional cwd from the underlying pi session. */
604
- cwd?: string | null;
605
- updatedAt?: string | number | Date | null;
606
- }
607
- type PiSessionSearchSortMode = "fuzzy" | "recent";
608
- interface PiSessionSearchOptions {
609
- sortMode?: PiSessionSearchSortMode;
610
- limit?: number;
611
- }
612
- type SearchToken = {
613
- kind: "fuzzy" | "phrase";
614
- value: string;
615
- };
616
- type ParsedSearchQuery = {
617
- mode: "tokens";
618
- tokens: SearchToken[];
619
- regex: null;
620
- error?: undefined;
621
- } | {
622
- mode: "regex";
623
- tokens: [];
624
- regex: RegExp | null;
625
- error?: string;
626
- };
627
- /**
628
- * Parse session-search queries with the same user-facing syntax as pi's native
629
- * session picker: whitespace fuzzy tokens, quoted exact phrases, and `re:`
630
- * regex mode. Kept intentionally small so boring-agent frontends can reuse the
631
- * pi search behavior without importing the terminal-only session picker UI.
632
- */
633
- declare function parsePiSessionSearchQuery(query: string): ParsedSearchQuery;
634
- declare function matchPiSessionSearch(session: PiSessionSearchItem, parsed: ParsedSearchQuery): {
635
- matches: boolean;
636
- score: number;
637
- };
638
- declare function searchPiSessions<T extends PiSessionSearchItem>(sessions: readonly T[], query: string, options?: PiSessionSearchOptions): T[];
639
-
640
- interface PiComposerHandledSubmit {
641
- handled: true;
642
- message?: string;
643
- }
644
- interface PiComposerReplacementSubmit {
645
- replacement: {
646
- text: string;
647
- displayText?: string;
648
- };
649
- }
650
- type PiComposerBeforeSubmitResult = boolean | void | PiComposerHandledSubmit | PiComposerReplacementSubmit;
651
-
652
- interface ComposerBlockerAction {
653
- id: string;
654
- label: string;
655
- }
656
- interface ComposerBlocker {
657
- id: string;
658
- reason?: string;
659
- label?: string;
660
- sessionId?: string;
661
- actions?: ComposerBlockerAction[];
662
- surfaceKind?: string;
663
- target?: unknown;
664
- }
665
-
666
- /**
667
- * How much of a turn the transcript shows.
668
- *
669
- * - `full` (default): everything — text, reasoning, tool calls, tool groups.
670
- * - `messages-only`: just the conversation. Reasoning and tool activity are
671
- * suppressed and a streaming turn shows one quiet status line instead. For
672
- * hosts whose user is not a developer and for whom "ran bash" is noise, not
673
- * progress.
674
- */
675
- type ChatRenderMode = 'full' | 'messages-only';
676
-
677
- type ChatSubmitSource = 'composer' | 'suggestion' | 'auto-submit';
678
- interface ChatSubmitContext {
679
- files: PromptInputFilePart[];
680
- sessionId: string;
681
- source: ChatSubmitSource;
682
- }
683
- type ChatBeforeSubmitResult = PiComposerBeforeSubmitResult;
684
- interface ChatPanelEmptyState {
685
- eyebrow?: string;
686
- title?: string;
687
- description?: ReactNode;
688
- /** Optional content rendered below the suggestion grid (e.g. a footer link). */
689
- footer?: ReactNode;
690
- }
691
- interface AgentPluginReloadResult {
692
- message: string;
693
- reloaded: boolean;
694
- }
695
- interface PiChatPanelProps<TComposerBlocker extends ComposerBlocker = ComposerBlocker> {
696
- /** Optional externally selected Pi session id. When provided, session navigation is owned by the host. */
697
- sessionId?: string;
698
- /** Addressed AgentGateway owner for every chat/session request. */
699
- agentTypeId: string;
700
- /** Alias kept for consumers that still pass the pre-cutover prop name. */
701
- extraCommands?: SlashCommand[];
702
- apiBaseUrl?: string;
703
- workspaceId?: string;
704
- storageScope?: string;
705
- requestHeaders?: Record<string, string | undefined>;
706
- storage?: ActiveSessionStorageLike;
707
- fetch?: typeof globalThis.fetch;
708
- className?: string;
709
- chrome?: boolean;
710
- /**
711
- * How much of a turn the transcript shows. `messages-only` renders user and
712
- * assistant text only — no reasoning, no tool calls, one quiet working line
713
- * while a turn streams. Defaults to `full`, so existing hosts are unchanged.
714
- */
715
- renderMode?: ChatRenderMode;
716
- /**
717
- * Tool names that stay visible under `renderMode="messages-only"`. Empty by
718
- * default. Pair each with a renderer in `toolRenderers`: the host opts a tool
719
- * back in when the call is itself something the user must see and act on.
720
- */
721
- messagesOnlyVisibleTools?: readonly string[];
722
- /** Hide per-message copy actions in `messages-only` mode. Defaults to false. */
723
- messagesOnlyHideCopyActions?: boolean;
724
- /**
725
- * User-message prefixes omitted from the transcript in `messages-only` mode.
726
- * The messages remain in agent context; this only lets a host hide its own
727
- * machine-authored control prompts from the person using the chat.
728
- */
729
- messagesOnlyHiddenUserPrefixes?: readonly string[];
730
- debug?: boolean;
731
- showSessions?: boolean;
732
- hotReloadEnabled?: boolean;
733
- suggestions?: ChatSuggestion[];
734
- emptyState?: ChatPanelEmptyState;
735
- emptyPlacement?: 'default' | 'hero';
736
- composerPlaceholder?: string;
737
- /** Replaces the composer's default streaming pill when supplied. Pass `null` to hide it. */
738
- composerActivity?: ReactNode;
739
- initialDraft?: string;
740
- autoSubmitInitialDraft?: boolean;
741
- onDraftRestored?: () => void;
742
- onAutoSubmitInitialDraftAccepted?: () => void;
743
- onAutoSubmitInitialDraftSettled?: () => void;
744
- model?: ModelSelection | null;
745
- defaultModel?: ModelSelection;
746
- availableModels?: AvailableModel[];
747
- hideDefaultModelOption?: boolean;
748
- hideComposerSettings?: boolean;
749
- suppressPreSubmitCancelledWarning?: boolean;
750
- thinkingLevel?: ThinkingLevel;
751
- thinkingControl?: boolean;
752
- serverResourcesEnabled?: boolean;
753
- mentionedFiles?: string[] | (() => string[]);
754
- commands?: SlashCommand[];
755
- /** Built-in slash command names to omit from the composer command registry. */
756
- excludeBuiltinCommands?: string[];
757
- toolRenderers?: ToolRendererOverrides;
758
- createRemoteSession?: (options: RemotePiSessionOptions) => RemotePiSession;
759
- remoteSessionOptions?: UsePiSessionsOptions['remoteSessionOptions'];
760
- hydrateMessages?: boolean;
761
- allowPromptDuringInitialHydration?: boolean;
762
- workspaceWarmupStatus?: ChatPanelWorkspaceWarmupStatus;
763
- onSessionReset?: () => void | Promise<void>;
764
- /** Persist oversized text prompts through the workspace upload route and send a compact path reference. Enabled by default. */
765
- spillLargePrompts?: boolean;
766
- /** Character threshold for generic prompt spilling. Defaults to 12,000. */
767
- largePromptThresholdChars?: number;
768
- onBeforeSubmit?: (draft: string, context: ChatSubmitContext) => ChatBeforeSubmitResult | Promise<ChatBeforeSubmitResult>;
769
- onReloadAgentPlugins?: () => Promise<AgentPluginReloadResult | string>;
770
- onCommandResult?: (message: string) => void;
771
- onComposerWarning?: (message: string) => void;
772
- onMentionedFilesConsumed?: () => void;
773
- onPromptSubmitStarted?: (context: {
774
- sessionId: string;
775
- clientNonce: string;
776
- }) => void;
777
- onData?: (part: unknown) => void;
778
- onOpenArtifact?: (path: string, options?: {
779
- filesystem?: string;
780
- }) => void;
781
- composerBlockers?: TComposerBlocker[];
782
- onComposerStop?: () => void;
783
- onComposerBlockerAction?: (blocker: TComposerBlocker, action: string) => void;
784
- /** Fired once each time a run settles (busy → idle). Hosts use it to refresh
785
- * out-of-band state after a turn (e.g. a usage/quota indicator). The agent stays
786
- * agnostic about what the host does with it. */
787
- onTurnComplete?: () => void;
788
- /** Host-supplied action node for a runtime notice, keyed off notice.errorCode.
789
- * Lets a host attach a recovery action for a specific error code without the agent
790
- * knowing what the code means or what the action does. */
791
- renderNoticeAction?: (notice: PiChatRuntimeNotice) => ReactNode;
792
- }
793
- declare function PiChatPanel<TComposerBlocker extends ComposerBlocker = ComposerBlocker>({ sessionId, agentTypeId, extraCommands, apiBaseUrl, workspaceId, storageScope, requestHeaders, storage, fetch, className, chrome, renderMode, messagesOnlyVisibleTools, messagesOnlyHideCopyActions, messagesOnlyHiddenUserPrefixes, debug, showSessions, hotReloadEnabled, suggestions, emptyState, emptyPlacement, composerPlaceholder, composerActivity, initialDraft, autoSubmitInitialDraft, onDraftRestored, onAutoSubmitInitialDraftAccepted, onAutoSubmitInitialDraftSettled, model, defaultModel, availableModels, hideDefaultModelOption, hideComposerSettings, suppressPreSubmitCancelledWarning, thinkingLevel, thinkingControl, serverResourcesEnabled, mentionedFiles, commands, excludeBuiltinCommands, toolRenderers, createRemoteSession, remoteSessionOptions, hydrateMessages, allowPromptDuringInitialHydration, workspaceWarmupStatus, onSessionReset, spillLargePrompts, largePromptThresholdChars, onBeforeSubmit, onReloadAgentPlugins, onCommandResult, onComposerWarning, onMentionedFilesConsumed, onPromptSubmitStarted, onData, onOpenArtifact, composerBlockers, onComposerStop, onComposerBlockerAction, onTurnComplete, renderNoticeAction, }: PiChatPanelProps<TComposerBlocker>): react.JSX.Element;
794
-
795
- type AddressedAgentOption = Pick<AgentSummary, 'agentTypeId' | 'label' | 'description' | 'pluginIds'>;
796
- interface UseAddressedAgentSelectionOptions {
797
- apiBaseUrl?: string;
798
- requestHeaders?: Record<string, string | undefined>;
799
- storageScope?: string;
800
- /** Initial regular Agent selection; never changes fleet membership or order. */
801
- preferredAgentTypeId?: string;
802
- fetch?: typeof globalThis.fetch;
803
- enabled?: boolean;
804
- }
805
- interface UseAddressedAgentSelectionResult {
806
- agents: AddressedAgentOption[];
807
- selectedAgentTypeId: string | undefined;
808
- loading: boolean;
809
- error: Error | undefined;
810
- selectAgentTypeId: (agentTypeId: string) => void;
811
- }
812
- declare function useAddressedAgentSelection({ apiBaseUrl, requestHeaders, storageScope, preferredAgentTypeId, fetch, enabled, }?: UseAddressedAgentSelectionOptions): UseAddressedAgentSelectionResult;
813
-
814
- type GatewayResponseErrorCode = AgentGatewayErrorCode | ErrorCode;
815
- declare class GatewayResponseError extends Error {
816
- readonly status: number;
817
- readonly code?: GatewayResponseErrorCode | undefined;
818
- readonly details?: JsonValue | undefined;
819
- readonly body?: unknown | undefined;
820
- readonly operation?: string | undefined;
821
- readonly errorCode?: GatewayResponseErrorCode;
822
- constructor(status: number, message: string, code?: GatewayResponseErrorCode | undefined, details?: JsonValue | undefined, body?: unknown | undefined, operation?: string | undefined);
823
- }
824
- declare function gatewayResponseError(response: Response, fallbackMessage: string, operation?: string): Promise<GatewayResponseError>;
825
- declare function gatewayResponseErrorFromBody(status: number, body: unknown, fallbackMessage: string, operation?: string): GatewayResponseError;
826
- declare function errorResponseCode(error: unknown): GatewayResponseErrorCode | undefined;
827
-
828
- interface DebugDrawerProps {
829
- agentTypeId: string;
830
- apiBaseUrl?: string;
831
- fetch?: typeof globalThis.fetch;
832
- sessionId: string;
833
- messages: UIMessage[];
834
- requestHeaders?: Record<string, string>;
835
- storageScope?: string;
836
- width: number;
837
- onWidthChange: (w: number) => void;
838
- }
839
- declare function DebugDrawer({ agentTypeId, apiBaseUrl, fetch, sessionId, messages, requestHeaders, storageScope, width, onWidthChange }: DebugDrawerProps): react.JSX.Element;
840
-
841
- type CredentialFundingMethod = 'api-key' | 'openai-codex';
842
- type CredentialOAuthEvent = {
843
- readonly type: 'auth_url';
844
- readonly url: string;
845
- } | {
846
- readonly type: 'device_code';
847
- readonly userCode: string;
848
- readonly verificationUri: string;
849
- readonly expiresInSeconds?: number;
850
- } | {
851
- readonly type: 'progress';
852
- };
853
- interface CredentialOAuthPrompt {
854
- readonly type: string;
855
- readonly options?: readonly {
856
- readonly id: string;
857
- readonly label: string;
858
- }[];
859
- }
860
- interface CredentialOAuthFlow {
861
- readonly flowId: string;
862
- readonly providerId: 'openai-codex';
863
- readonly status: 'pending' | 'succeeded' | 'failed' | 'cancelled';
864
- readonly events: readonly CredentialOAuthEvent[];
865
- readonly prompt?: CredentialOAuthPrompt;
866
- }
867
- interface CredentialSettingsClient {
868
- list(): Promise<readonly CredentialMetadataV1[]>;
869
- putApiKey(providerId: string, apiKey: string): Promise<CredentialMetadataV1>;
870
- disable(providerId: string): Promise<CredentialMetadataV1>;
871
- revoke(providerId: string): Promise<CredentialMetadataV1>;
872
- delete(providerId: string): Promise<CredentialMetadataV1>;
873
- startCodexLogin(): Promise<CredentialOAuthFlow>;
874
- getCodexLogin(flowId: string): Promise<CredentialOAuthFlow>;
875
- respondToCodexLogin(flowId: string, value: string): Promise<CredentialOAuthFlow>;
876
- cancelCodexLogin(flowId: string): Promise<void>;
877
- }
878
- declare function createCredentialSettingsClient(apiBaseUrl?: string, fetchImpl?: typeof fetch, requestHeaders?: Readonly<Record<string, string>>): CredentialSettingsClient;
879
-
880
- interface CredentialSettingsSurfaceProps {
881
- /** The host must derive this from its authenticated workspace membership. */
882
- isWorkspaceOwner: boolean;
883
- /** Active workspace scope sent to the authenticated credential routes. */
884
- workspaceId?: string;
885
- apiBaseUrl?: string;
886
- /** Test/host transport seam. It must preserve the metadata-only contract. */
887
- client?: CredentialSettingsClient;
888
- }
889
- /** Workspace identity is also the state boundary: switching workspaces remounts
890
- * the inner surface so metadata and pending OAuth/lifecycle state cannot cross. */
891
- declare function CredentialSettingsSurface(props: CredentialSettingsSurfaceProps): react.JSX.Element;
892
-
893
- type SelectorTrigger = 'button' | 'slash';
894
- declare const ModelSelectTrigger: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "value"> & {
895
- value: ModelSelection | null;
896
- options: AvailableModel[];
897
- sessionModel?: ModelSelection;
898
- isOverride?: boolean;
899
- disabled?: boolean;
900
- trigger?: SelectorTrigger;
901
- open?: boolean;
902
- emptyLabel?: string;
903
- } & react.RefAttributes<HTMLButtonElement>>;
904
- declare function ModelPickerMenu({ value, onChange, options, disabled, hideDefaultOption, onClose, className, }: {
905
- value: ModelSelection | null;
906
- onChange: (next: ModelSelection | null) => void;
907
- options: AvailableModel[];
908
- disabled?: boolean;
909
- hideDefaultOption?: boolean;
910
- onClose?: () => void;
911
- className?: string;
912
- }): react.JSX.Element;
913
- /**
914
- * Model picker whose options are pi-coding-agent's actual available
915
- * models (fetched from the addressed Agent models route). Groups by provider and
916
- * shows a concise human-friendly label with the raw pi id as the
917
- * option's stored value, encoded as "{provider}:{id}" to keep
918
- * ids stable across providers.
919
- */
920
- declare function ModelSelect({ value, onChange, options, disabled, trigger, openSignal, className, emptyLabel, ariaInvalid, ariaDescribedBy, hideDefaultOption, }: {
921
- value: ModelSelection | null;
922
- onChange: (next: ModelSelection | null) => void;
923
- options: AvailableModel[];
924
- disabled?: boolean;
925
- trigger?: SelectorTrigger;
926
- openSignal?: unknown;
927
- className?: string;
928
- emptyLabel?: string;
929
- ariaInvalid?: boolean;
930
- ariaDescribedBy?: string;
931
- hideDefaultOption?: boolean;
932
- }): react.JSX.Element;
933
- declare function ThinkingSelect({ value, onChange, disabled, trigger, openSignal, className, }: {
934
- value: ThinkingLevel;
935
- onChange: (next: ThinkingLevel) => void;
936
- disabled?: boolean;
937
- trigger?: SelectorTrigger;
938
- openSignal?: unknown;
939
- className?: string;
940
- }): react.JSX.Element;
941
-
942
- interface AgentCommandContribution {
943
- id: string;
944
- title: string;
945
- run: () => void;
946
- keywords?: string[];
947
- shortcut?: string;
948
- when?: () => boolean;
949
- pluginId?: string;
950
- }
951
- interface AgentCommandOptions {
952
- focusComposer?: () => void;
953
- newChat?: () => void;
954
- stopGeneration?: () => void;
955
- canStopGeneration?: () => boolean;
956
- }
957
- declare function getAgentCommands(options?: AgentCommandOptions): AgentCommandContribution[];
958
-
959
- type ComposerDraftUpdate = (currentDraft: string) => string;
960
- interface ComposerActionContributionProps {
961
- updateDraft(update: ComposerDraftUpdate, options?: {
962
- focus?: boolean;
963
- }): void;
964
- }
965
- interface ComposerContribution {
966
- id: string;
967
- Top?: ComponentType;
968
- Action?: ComponentType<ComposerActionContributionProps>;
969
- commands?: readonly SlashCommand[];
970
- }
971
- declare function ComposerContributionProvider({ contribution, children, }: {
972
- contribution: ComposerContribution;
973
- children: ReactNode;
974
- }): react.JSX.Element;
975
-
976
- interface ChatMessageContributionProps {
977
- message: BoringChatMessage;
978
- }
979
- interface ChatMessageContribution {
980
- id: string;
981
- /** Pure, hook-free claim predicate. */
982
- matches(message: BoringChatMessage): boolean;
983
- Component: ComponentType<ChatMessageContributionProps>;
984
- }
985
- declare function ChatMessageContributionProvider({ contribution, children, }: {
986
- contribution: ChatMessageContribution;
987
- children: ReactNode;
988
- }): react.JSX.Element;
989
-
990
- declare function mergeShadcnToolRenderers(overrides?: ToolRendererOverrides): Record<string, ToolRenderer>;
991
-
992
- type GroupedToolEntry = {
993
- part: ToolRenderablePart;
994
- key: string;
995
- };
996
- interface ToolCallGroupProps {
997
- tools: GroupedToolEntry[];
998
- mergedToolRenderers: ToolRendererOverrides;
999
- }
1000
- declare const ToolCallGroup: react.MemoExoticComponent<({ tools, mergedToolRenderers }: ToolCallGroupProps) => react.JSX.Element | null>;
1001
-
1002
- type MessageProps = HTMLAttributes<HTMLDivElement> & {
1003
- from: UIMessage["role"];
1004
- };
1005
- declare const Message: ({ className, from, ...props }: MessageProps) => react.JSX.Element;
1006
- type MessageContentProps = HTMLAttributes<HTMLDivElement>;
1007
- declare const MessageContent: ({ children, className, ...props }: MessageContentProps) => react.JSX.Element;
1008
- type MessageActionsProps = ComponentProps<"div">;
1009
- declare const MessageActions: ({ className, children, ...props }: MessageActionsProps) => react.JSX.Element;
1010
- type MessageActionProps = ComponentProps<typeof Button> & {
1011
- tooltip?: string;
1012
- label?: string;
1013
- };
1014
- declare const MessageAction: ({ tooltip, children, label, variant, size, ...props }: MessageActionProps) => react.JSX.Element;
1015
- type MessageResponseProps = ComponentProps<typeof Streamdown>;
1016
- type BoringMessageResponseProps = MessageResponseProps & {
1017
- /** Source path inferred from the preceding write/edit tool call, when known. */
1018
- codeFilename?: string;
1019
- };
1020
- declare const MessageResponse: react.MemoExoticComponent<({ className, shikiTheme, components, codeFilename, rehypePlugins, allowedTags, ...props }: BoringMessageResponseProps) => react.JSX.Element>;
1021
-
1022
- type ConversationProps = ComponentProps<typeof StickToBottom> & {
1023
- onScrollToBottomReady?: (scrollToBottom: () => void) => void;
1024
- };
1025
- declare const Conversation: ({ className, children, onScrollToBottomReady, ...props }: ConversationProps) => react.JSX.Element;
1026
- type ConversationContentProps = ComponentProps<typeof StickToBottom.Content>;
1027
- declare const ConversationContent: ({ className, ...props }: ConversationContentProps) => react.JSX.Element;
1028
- type ConversationScrollButtonProps = ComponentProps<typeof Button>;
1029
- declare const ConversationScrollButton: ({ className, ...props }: ConversationScrollButtonProps) => false | react.JSX.Element;
1030
-
1031
- type ReasoningProps = ComponentProps<typeof Collapsible> & {
1032
- isStreaming?: boolean;
1033
- open?: boolean;
1034
- defaultOpen?: boolean;
1035
- onOpenChange?: (open: boolean) => void;
1036
- duration?: number;
1037
- autoClose?: boolean;
1038
- };
1039
- declare const Reasoning: react.MemoExoticComponent<({ className, isStreaming, open, defaultOpen, onOpenChange, duration: durationProp, autoClose, children, ...props }: ReasoningProps) => react.JSX.Element>;
1040
- type ReasoningTriggerProps = ComponentProps<typeof CollapsibleTrigger> & {
1041
- getThinkingMessage?: (isStreaming: boolean, duration?: number) => ReactNode;
1042
- };
1043
- declare const ReasoningTrigger: react.MemoExoticComponent<({ className, children, getThinkingMessage, ...props }: ReasoningTriggerProps) => react.JSX.Element>;
1044
- type ReasoningContentProps = ComponentProps<typeof CollapsibleContent> & {
1045
- children: string;
1046
- };
1047
- declare const ReasoningContent: react.MemoExoticComponent<({ className, children, ...props }: ReasoningContentProps) => react.JSX.Element>;
1048
-
1049
- type CodeBlockProps = HTMLAttributes<HTMLDivElement> & {
1050
- code: string;
1051
- language: string;
1052
- showLineNumbers?: boolean;
1053
- };
1054
- declare const CodeBlock: ({ code, language, showLineNumbers, className, children, ...props }: CodeBlockProps) => react.JSX.Element;
1055
-
1056
- type ToolProps = ComponentProps<typeof Collapsible>;
1057
- declare const Tool: ({ className, ...props }: ToolProps) => react.JSX.Element;
1058
- type ToolState = "input-streaming" | "input-available" | "approval-requested" | "approval-responded" | "output-available" | "output-denied" | "output-error" | "aborted";
1059
- type ToolPart = {
1060
- type: `tool-${string}` | "dynamic-tool" | "tool-call";
1061
- state: ToolState;
1062
- toolName?: string;
1063
- input?: unknown;
1064
- output?: unknown;
1065
- errorText?: string;
1066
- };
1067
- type ToolHeaderProps = {
1068
- title?: ReactNode;
1069
- className?: string;
1070
- icon?: ReactNode;
1071
- type: ToolPart["type"];
1072
- state: ToolState;
1073
- toolName?: string;
1074
- statusLabel?: string;
1075
- };
1076
- declare const ToolHeader: ({ className, title, type, state, icon, toolName, statusLabel, ...props }: ToolHeaderProps) => react.JSX.Element;
1077
- type ToolContentProps = ComponentProps<typeof CollapsibleContent>;
1078
- declare const ToolContent: ({ className, ...props }: ToolContentProps) => react.JSX.Element;
1079
-
1080
- declare function cn(...inputs: ClassValue[]): string;
1081
-
1082
- export { type AddressedAgentOption, type AgentCommandContribution, type AgentCommandOptions, type AgentPluginReloadResult, type AvailableModel, BoringChatMessage, type ChatBeforeSubmitResult, ChatEmptyState, type ChatEmptyStateProps, type ChatMessageContribution, type ChatMessageContributionProps, ChatMessageContributionProvider, PiChatPanel as ChatPanel, type PiChatPanelProps as ChatPanelProps, type ChatRenderMode, type ChatSubmitContext, type ChatSuggestion, CodeBlock, type CommandRegistry, type ComposerActionContributionProps, type ComposerBlocker, type ComposerBlockerAction, type ComposerContribution, ComposerContributionProvider, type ComposerDraftUpdate, Conversation, ConversationContent, ConversationScrollButton, type CredentialFundingMethod, type CredentialOAuthEvent, type CredentialOAuthFlow, type CredentialOAuthPrompt, type CredentialSettingsClient, CredentialSettingsSurface, type CredentialSettingsSurfaceProps, DebugDrawer, GatewayResponseError, type GatewayResponseErrorCode, type GroupedToolEntry, Message, MessageAction, MessageActions, MessageContent, MessageResponse, ModelPickerMenu, ModelSelect, ModelSelectTrigger, type ModelSelection, type ParsedCommand, PiChatPanel, type PiChatPanelProps, SessionBrowser as PiSessionBrowser, type PiSessionCreateInit, SessionList as PiSessionList, type PiSessionSearchItem, type PiSessionSearchOptions, type PiSessionSearchSortMode, PromptInput, PromptInputFooter, PromptInputSubmit, PromptInputTextarea, Reasoning, ReasoningContent, ReasoningTrigger, type SessionListProps, type SlashCommand, type SlashCommandContext, type ThinkingLevel, ThinkingSelect, Tool, ToolCallGroup, ToolContent, ToolHeader, type ToolPart$1 as ToolPart, type ToolRenderer, type ToolRendererOverrides, type UploadFileOptions, type UploadFileResult, type UseAddressedAgentSelectionOptions, type UseAddressedAgentSelectionResult, type UsePiSessionsOptions, type UsePiSessionsResult, activeSessionStorageKey, builtinCommands, cn, createCommandRegistry, createCredentialSettingsClient, defaultChatSuggestions, defaultToolRenderers, errorResponseCode, gatewayResponseError, gatewayResponseErrorFromBody, getAgentCommands, matchPiSessionSearch, mergeShadcnToolRenderers, mergeToolRenderers, parsePiSessionSearchQuery, parseSlashCommand, readActiveSessionId, resolveToolRenderer, searchPiSessions, uploadFile, useAddressedAgentSelection, usePiSessions, writeActiveSessionId };