@hachej/boring-agent 0.1.92 → 0.1.94

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.
@@ -1,7 +1,7 @@
1
+ import { T as ToolUiMetadata, B as BoringChatPart, a as BoringChatMessage, P as PiChatStatus, Q as QueuedUserMessage, C as ChatError, b as PiChatEvent, c as PromptPayload, d as PromptReceipt, F as FollowUpPayload, e as FollowUpReceipt, f as QueueClearPayload, g as QueueClearReceipt, I as InterruptPayload, h as CommandReceipt, i as StopPayload, j as StopReceipt, k as SessionSummary } from '../piChatEvent-BsMp3MSo.js';
1
2
  import * as react from 'react';
2
3
  import { ComponentProps, HTMLAttributes, FormEvent, ReactNode, ComponentType } from 'react';
3
4
  import { FileUIPart, ChatStatus, UIMessage } from 'ai';
4
- import { T as ToolUiMetadata, B as BoringChatPart, a as BoringChatMessage, P as PiChatStatus, Q as QueuedUserMessage, C as ChatError, b as PiChatEvent, c as PromptPayload, d as PromptReceipt, F as FollowUpPayload, e as FollowUpReceipt, f as QueueClearPayload, g as QueueClearReceipt, I as InterruptPayload, h as CommandReceipt, i as StopPayload, j as StopReceipt, k as SessionSummary } from '../piChatEvent-BsMp3MSo.js';
5
5
  import { InputGroupAddon, InputGroupButton, InputGroupTextarea, Button, Collapsible, CollapsibleContent, CollapsibleTrigger } from '@hachej/boring-ui-kit';
6
6
  import { Streamdown } from 'streamdown';
7
7
  import { StickToBottom } from 'use-stick-to-bottom';
@@ -154,6 +154,7 @@ type SlashCommandHandlerResult = string | void | {
154
154
  preserveDraft?: boolean;
155
155
  };
156
156
  type SlashCommandHandler = (args: string, ctx: SlashCommandContext) => SlashCommandHandlerResult | Promise<SlashCommandHandlerResult>;
157
+ type SlashCommandClickBehavior = 'execute' | 'insert' | 'disabled';
157
158
  interface SlashCommand {
158
159
  name: string;
159
160
  description: string;
@@ -165,6 +166,8 @@ interface SlashCommand {
165
166
  * is needed.
166
167
  */
167
168
  kind?: 'local' | 'skill';
169
+ /** Explicit opt-in for assistant-message command links. Unset commands remain plain text. */
170
+ clickBehavior?: SlashCommandClickBehavior;
168
171
  /**
169
172
  * Origin of the command, surfaced as a tag in the slash-command picker.
170
173
  * Mirrors Pi's command sources for server commands; `local` for built-in
@@ -173,6 +176,11 @@ interface SlashCommand {
173
176
  source?: 'local' | 'extension' | 'prompt' | 'skill';
174
177
  /** Originating plugin/package name (when known), shown as a tag. */
175
178
  sourcePlugin?: string;
179
+ /**
180
+ * Narrow browser-local escape hatch for independent controls that must remain
181
+ * usable while Pi is running. The predicate must admit only exact safe subcommands.
182
+ */
183
+ allowWhileBusy?: (args: string) => boolean;
176
184
  handler: SlashCommandHandler;
177
185
  }
178
186
  interface SlashCommandContext {
@@ -207,7 +215,7 @@ declare function createCommandRegistry(initial?: SlashCommand[]): CommandRegistr
207
215
 
208
216
  declare const builtinCommands: SlashCommand[];
209
217
 
210
- type ToolState = 'input-streaming' | 'input-available' | 'approval-requested' | 'approval-responded' | 'output-available' | 'output-error' | 'output-denied' | 'aborted';
218
+ type ToolState$1 = 'input-streaming' | 'input-available' | 'approval-requested' | 'approval-responded' | 'output-available' | 'output-error' | 'output-denied' | 'aborted';
211
219
 
212
220
  type BoringToolCallPart = Extract<BoringChatPart, {
213
221
  type: 'tool-call';
@@ -217,25 +225,25 @@ interface ToolRendererResolution {
217
225
  source: 'rendererId' | 'toolName' | 'fallback';
218
226
  requestedRendererId?: string;
219
227
  }
220
- interface ToolPart {
228
+ interface ToolPart$1 {
221
229
  /** Neutral render-model type. Legacy `tool-<name>` values are accepted at the renderer boundary. */
222
230
  type: 'tool-call' | `tool-${string}` | 'dynamic-tool';
223
231
  toolName: string;
224
232
  /** Stable tool call id; for Pi-native BoringChatPart this is BoringChatPart.id. */
225
233
  toolCallId: string;
226
- state: ToolState;
234
+ state: ToolState$1;
227
235
  input?: unknown;
228
236
  output?: unknown;
229
237
  errorText?: string;
230
238
  ui?: ToolUiMetadata;
231
239
  rendererResolution?: ToolRendererResolution;
232
240
  }
233
- type ToolRenderablePart = ToolPart | BoringToolCallPart | unknown;
234
- type ToolRenderer = (part: ToolPart) => ReactNode;
241
+ type ToolRenderablePart = ToolPart$1 | BoringToolCallPart | unknown;
242
+ type ToolRenderer = (part: ToolPart$1) => ReactNode;
235
243
  type ToolRendererOverrides = Partial<Record<string, ToolRenderer>>;
236
244
  declare const defaultToolRenderers: Record<string, ToolRenderer>;
237
245
  declare function mergeToolRenderers(overrides?: ToolRendererOverrides): Record<string, ToolRenderer>;
238
- declare function resolveToolRenderer(toolNameOrPart: string | ToolPart, overrides?: ToolRendererOverrides): ToolRenderer;
246
+ declare function resolveToolRenderer(toolNameOrPart: string | ToolPart$1, overrides?: ToolRendererOverrides): ToolRenderer;
239
247
 
240
248
  type ChatPanelRuntimeDependenciesWarmupStatus = {
241
249
  state: 'preparing' | 'ready' | 'failed';
@@ -767,6 +775,37 @@ interface AgentCommandOptions {
767
775
  }
768
776
  declare function getAgentCommands(options?: AgentCommandOptions): AgentCommandContribution[];
769
777
 
778
+ type ComposerDraftUpdate = (currentDraft: string) => string;
779
+ interface ComposerActionContributionProps {
780
+ updateDraft(update: ComposerDraftUpdate, options?: {
781
+ focus?: boolean;
782
+ }): void;
783
+ }
784
+ interface ComposerContribution {
785
+ id: string;
786
+ Top?: ComponentType;
787
+ Action?: ComponentType<ComposerActionContributionProps>;
788
+ commands?: readonly SlashCommand[];
789
+ }
790
+ declare function ComposerContributionProvider({ contribution, children, }: {
791
+ contribution: ComposerContribution;
792
+ children: ReactNode;
793
+ }): react.JSX.Element;
794
+
795
+ interface ChatMessageContributionProps {
796
+ message: BoringChatMessage;
797
+ }
798
+ interface ChatMessageContribution {
799
+ id: string;
800
+ /** Pure, hook-free claim predicate. */
801
+ matches(message: BoringChatMessage): boolean;
802
+ Component: ComponentType<ChatMessageContributionProps>;
803
+ }
804
+ declare function ChatMessageContributionProvider({ contribution, children, }: {
805
+ contribution: ChatMessageContribution;
806
+ children: ReactNode;
807
+ }): react.JSX.Element;
808
+
770
809
  declare function mergeShadcnToolRenderers(overrides?: ToolRendererOverrides): Record<string, ToolRenderer>;
771
810
 
772
811
  type GroupedToolEntry = {
@@ -829,6 +868,30 @@ type CodeBlockProps = HTMLAttributes<HTMLDivElement> & {
829
868
  };
830
869
  declare const CodeBlock: ({ code, language, showLineNumbers, className, children, ...props }: CodeBlockProps) => react.JSX.Element;
831
870
 
871
+ type ToolProps = ComponentProps<typeof Collapsible>;
872
+ declare const Tool: ({ className, ...props }: ToolProps) => react.JSX.Element;
873
+ type ToolState = "input-streaming" | "input-available" | "approval-requested" | "approval-responded" | "output-available" | "output-denied" | "output-error" | "aborted";
874
+ type ToolPart = {
875
+ type: `tool-${string}` | "dynamic-tool" | "tool-call";
876
+ state: ToolState;
877
+ toolName?: string;
878
+ input?: unknown;
879
+ output?: unknown;
880
+ errorText?: string;
881
+ };
882
+ type ToolHeaderProps = {
883
+ title?: ReactNode;
884
+ className?: string;
885
+ icon?: ReactNode;
886
+ type: ToolPart["type"];
887
+ state: ToolState;
888
+ toolName?: string;
889
+ statusLabel?: string;
890
+ };
891
+ declare const ToolHeader: ({ className, title, type, state, icon, toolName, statusLabel, ...props }: ToolHeaderProps) => react.JSX.Element;
892
+ type ToolContentProps = ComponentProps<typeof CollapsibleContent>;
893
+ declare const ToolContent: ({ className, ...props }: ToolContentProps) => react.JSX.Element;
894
+
832
895
  declare function cn(...inputs: ClassValue[]): string;
833
896
 
834
- export { type AgentCommandContribution, type AgentCommandOptions, type AgentPluginReloadResult, ArtifactOpenProvider, type AvailableModel, ChatEmptyState, type ChatEmptyStateProps, PiChatPanel as ChatPanel, type PiChatPanelProps as ChatPanelProps, type ChatSuggestion, CodeBlock, type CommandRegistry, type ComposerBlocker, type ComposerBlockerAction, Conversation, ConversationContent, ConversationScrollButton, DebugDrawer, type GroupedToolEntry, Message, MessageAction, MessageActions, MessageContent, MessageResponse, ModelPickerMenu, ModelSelect, ModelSelectTrigger, type ModelSelection, type OpenArtifactHandler, 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, ToolCallGroup, type ToolPart, type ToolRenderer, type ToolRendererOverrides, type UploadFileOptions, type UploadFileResult, type UsePiSessionsOptions, type UsePiSessionsResult, activeSessionStorageKey, builtinCommands, clearActiveSessionId, cn, createCommandRegistry, defaultChatSuggestions, defaultToolRenderers, getAgentCommands, matchPiSessionSearch, mergeShadcnToolRenderers, mergeToolRenderers, parsePiSessionSearchQuery, parseSlashCommand, readActiveSessionId, resolveToolRenderer, searchPiSessions, uploadFile, useOpenArtifact, usePiSessions, writeActiveSessionId };
897
+ export { type AgentCommandContribution, type AgentCommandOptions, type AgentPluginReloadResult, ArtifactOpenProvider, type AvailableModel, BoringChatMessage, ChatEmptyState, type ChatEmptyStateProps, type ChatMessageContribution, type ChatMessageContributionProps, ChatMessageContributionProvider, PiChatPanel as ChatPanel, type PiChatPanelProps as ChatPanelProps, type ChatSuggestion, CodeBlock, type CommandRegistry, type ComposerActionContributionProps, type ComposerBlocker, type ComposerBlockerAction, type ComposerContribution, ComposerContributionProvider, type ComposerDraftUpdate, Conversation, ConversationContent, ConversationScrollButton, DebugDrawer, type GroupedToolEntry, Message, MessageAction, MessageActions, MessageContent, MessageResponse, ModelPickerMenu, ModelSelect, ModelSelectTrigger, type ModelSelection, type OpenArtifactHandler, 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 UsePiSessionsOptions, type UsePiSessionsResult, activeSessionStorageKey, builtinCommands, clearActiveSessionId, cn, createCommandRegistry, defaultChatSuggestions, defaultToolRenderers, getAgentCommands, matchPiSessionSearch, mergeShadcnToolRenderers, mergeToolRenderers, parsePiSessionSearchQuery, parseSlashCommand, readActiveSessionId, resolveToolRenderer, searchPiSessions, uploadFile, useOpenArtifact, usePiSessions, writeActiveSessionId };