@threadplane/chat 0.0.46 → 0.0.49
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.
- package/CHANGELOG.md +1 -0
- package/README.md +234 -90
- package/fesm2022/threadplane-chat-testing.mjs +0 -2
- package/fesm2022/threadplane-chat-testing.mjs.map +1 -1
- package/fesm2022/threadplane-chat.mjs +368 -139
- package/fesm2022/threadplane-chat.mjs.map +1 -1
- package/package.json +1 -1
- package/types/threadplane-chat-testing.d.ts +15 -1
- package/types/threadplane-chat.d.ts +62 -5
package/package.json
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { Agent, AgentCheckpoint, AgentWithHistory, Message } from '@threadplane/chat';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Shared config for the adapters' `provideFakeAgent()` helpers
|
|
5
|
+
* (@threadplane/langgraph and @threadplane/ag-ui). Drives an in-process
|
|
6
|
+
* fake backend that streams a canned assistant reply.
|
|
7
|
+
*/
|
|
8
|
+
interface FakeAgentConfig {
|
|
9
|
+
/** Assistant reply, streamed token-by-token. */
|
|
10
|
+
tokens?: string[];
|
|
11
|
+
/** Optional reasoning chunks emitted before the text reply. */
|
|
12
|
+
reasoningTokens?: string[];
|
|
13
|
+
/** Milliseconds between successive token emissions. */
|
|
14
|
+
delayMs?: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
3
17
|
/**
|
|
4
18
|
* Runs a suite of contract conformance assertions against a factory that
|
|
5
19
|
* produces a fresh Agent. Adapter packages should call this in their
|
|
@@ -36,4 +50,4 @@ declare const REASONING_FIXTURE_EVENTS: AbstractEvent[];
|
|
|
36
50
|
declare function assertReasoningFixtureMessages(messages: readonly Message[]): void;
|
|
37
51
|
|
|
38
52
|
export { REASONING_FIXTURE_EVENTS, REASONING_FIXTURE_MESSAGE_ID, REASONING_FIXTURE_REASONING, REASONING_FIXTURE_RESPONSE, assertReasoningFixtureMessages, runAgentConformance, runAgentWithHistoryConformance };
|
|
39
|
-
export type { AbstractEvent };
|
|
53
|
+
export type { AbstractEvent, FakeAgentConfig };
|
|
@@ -2,10 +2,10 @@ import * as _angular_core from '@angular/core';
|
|
|
2
2
|
import { InjectionToken, Signal, TemplateRef, Type, WritableSignal } from '@angular/core';
|
|
3
3
|
import * as _threadplane_render from '@threadplane/render';
|
|
4
4
|
import { AngularRegistry, RenderEvent, ViewRegistry, RenderViewEntry } from '@threadplane/render';
|
|
5
|
-
export {
|
|
5
|
+
export { ViewRegistry, toRenderRegistry, views, withViews, withoutViews } from '@threadplane/render';
|
|
6
6
|
import { Observable } from 'rxjs';
|
|
7
7
|
import * as _json_render_core from '@json-render/core';
|
|
8
|
-
import {
|
|
8
|
+
import { StateStore, Spec } from '@json-render/core';
|
|
9
9
|
import { A2uiComponentDef, A2uiSurface, A2uiMessage, A2uiActionMessage } from '@threadplane/a2ui';
|
|
10
10
|
export { A2uiAction, A2uiActionContextEntry, A2uiActionMessage, A2uiChildren, A2uiClientDataModel, A2uiComponent, A2uiComponentDef, A2uiSurface, A2uiTheme, DynamicBoolean, DynamicNumber, DynamicString, isLiteralBoolean, isLiteralNumber, isLiteralString, isPathRef } from '@threadplane/a2ui';
|
|
11
11
|
import { PartialJsonParser } from '@cacheplane/partial-json';
|
|
@@ -679,6 +679,35 @@ declare class ChatToolCallsComponent {
|
|
|
679
679
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ChatToolCallsComponent, "chat-tool-calls", never, { "agent": { "alias": "agent"; "required": true; "isSignal": true; }; "message": { "alias": "message"; "required": false; "isSignal": true; }; "grouping": { "alias": "grouping"; "required": false; "isSignal": true; }; "groupSummary": { "alias": "groupSummary"; "required": false; "isSignal": true; }; "excludeToolNames": { "alias": "excludeToolNames"; "required": false; "isSignal": true; }; }, {}, ["templates"], never, true, never>;
|
|
680
680
|
}
|
|
681
681
|
|
|
682
|
+
/**
|
|
683
|
+
* Renders a frontend component for a tool call by reusing the chat
|
|
684
|
+
* composition's `views` registry. A tool call whose `name` matches a
|
|
685
|
+
* registry key is bridged into a synthetic one-element render spec
|
|
686
|
+
* (`{ root: name, elements: { [name]: { type: name, props } } }`) and
|
|
687
|
+
* rendered through the existing render-spec pipeline.
|
|
688
|
+
*
|
|
689
|
+
* Props merge the live `args` (present while the call streams) with the
|
|
690
|
+
* `result` (on completion) and always include `status`, so a view
|
|
691
|
+
* component can show its own loading/empty/error states. `RenderElement`
|
|
692
|
+
* filters props down to the component's declared inputs, so extra keys
|
|
693
|
+
* (and a `status` a component chooses not to declare) are harmless.
|
|
694
|
+
*/
|
|
695
|
+
declare class ChatToolViewsComponent {
|
|
696
|
+
readonly agent: _angular_core.InputSignal<Agent>;
|
|
697
|
+
readonly message: _angular_core.InputSignal<Message | undefined>;
|
|
698
|
+
readonly views: _angular_core.InputSignal<Readonly<Record<string, _angular_core.Type<unknown> | _threadplane_render.RenderViewEntry>> | undefined>;
|
|
699
|
+
readonly store: _angular_core.InputSignal<StateStore | undefined>;
|
|
700
|
+
readonly handlers: _angular_core.InputSignal<Record<string, (params: Record<string, unknown>) => unknown | Promise<unknown>>>;
|
|
701
|
+
readonly registry: _angular_core.Signal<_threadplane_render.AngularRegistry | undefined>;
|
|
702
|
+
readonly toolViews: _angular_core.Signal<{
|
|
703
|
+
id: string;
|
|
704
|
+
loading: boolean;
|
|
705
|
+
spec: Spec;
|
|
706
|
+
}[]>;
|
|
707
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ChatToolViewsComponent, never>;
|
|
708
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ChatToolViewsComponent, "chat-tool-views", never, { "agent": { "alias": "agent"; "required": true; "isSignal": true; }; "message": { "alias": "message"; "required": false; "isSignal": true; }; "views": { "alias": "views"; "required": false; "isSignal": true; }; "store": { "alias": "store"; "required": false; "isSignal": true; }; "handlers": { "alias": "handlers"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
709
|
+
}
|
|
710
|
+
|
|
682
711
|
declare class ChatSubagentsComponent {
|
|
683
712
|
readonly agent: _angular_core.InputSignal<Agent>;
|
|
684
713
|
readonly templateRef: _angular_core.Signal<TemplateRef<any> | undefined>;
|
|
@@ -1181,6 +1210,12 @@ declare class ChatComponent {
|
|
|
1181
1210
|
private readonly _internalStore;
|
|
1182
1211
|
readonly resolvedStore: _angular_core.Signal<StateStore | undefined>;
|
|
1183
1212
|
readonly renderRegistry: _angular_core.Signal<_threadplane_render.AngularRegistry | undefined>;
|
|
1213
|
+
/** Tool names that have a registered view (keys of the `views` registry).
|
|
1214
|
+
* These render as inline tool-views and are excluded from the default
|
|
1215
|
+
* tool-call card so they don't render twice. */
|
|
1216
|
+
readonly viewToolNames: _angular_core.Signal<readonly string[]>;
|
|
1217
|
+
/** Union of GenUI dispatcher tool names and registered view tool names. */
|
|
1218
|
+
readonly excludedToolNames: _angular_core.Signal<readonly string[]>;
|
|
1184
1219
|
readonly messageContent: typeof messageContent;
|
|
1185
1220
|
/**
|
|
1186
1221
|
* Renderable content for a human-role message bubble. Most human
|
|
@@ -1189,7 +1224,7 @@ declare class ChatComponent {
|
|
|
1189
1224
|
* on a rendered surface) flow through the same submit channel and
|
|
1190
1225
|
* land in the message stream as a HumanMessage whose content is a
|
|
1191
1226
|
* JSON-serialized `A2uiActionMessage`. Showing the raw JSON as if
|
|
1192
|
-
* the user typed it leaks the protocol; per the A2UI
|
|
1227
|
+
* the user typed it leaks the protocol; per the A2UI spec
|
|
1193
1228
|
* those events resemble tool calls more than user utterances.
|
|
1194
1229
|
*
|
|
1195
1230
|
* `a2uiActionLabel` returns a short human-readable label for
|
|
@@ -1450,6 +1485,28 @@ declare class ChatInterruptPanelComponent {
|
|
|
1450
1485
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ChatInterruptPanelComponent, "chat-interrupt-panel", never, { "agent": { "alias": "agent"; "required": true; "isSignal": true; }; }, { "action": "action"; }, never, never, true, never>;
|
|
1451
1486
|
}
|
|
1452
1487
|
|
|
1488
|
+
type ChatApprovalAction = 'approve' | 'edit' | 'cancel';
|
|
1489
|
+
declare class ChatApprovalCardComponent {
|
|
1490
|
+
readonly agent: _angular_core.InputSignal<Agent>;
|
|
1491
|
+
readonly matchKind: _angular_core.InputSignal<string | undefined>;
|
|
1492
|
+
readonly title: _angular_core.InputSignal<string>;
|
|
1493
|
+
readonly showEdit: _angular_core.InputSignal<boolean>;
|
|
1494
|
+
readonly action: _angular_core.OutputEmitterRef<ChatApprovalAction>;
|
|
1495
|
+
protected readonly bodyTemplate: _angular_core.Signal<TemplateRef<unknown> | undefined>;
|
|
1496
|
+
private readonly dialogRef;
|
|
1497
|
+
private readonly interrupt;
|
|
1498
|
+
protected readonly payload: _angular_core.Signal<{
|
|
1499
|
+
kind?: unknown;
|
|
1500
|
+
} | undefined>;
|
|
1501
|
+
constructor();
|
|
1502
|
+
protected emit(action: ChatApprovalAction): void;
|
|
1503
|
+
protected onCancelEvent(ev: Event): void;
|
|
1504
|
+
private closeDialog;
|
|
1505
|
+
protected onDialogClose(): void;
|
|
1506
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ChatApprovalCardComponent, never>;
|
|
1507
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ChatApprovalCardComponent, "chat-approval-card", never, { "agent": { "alias": "agent"; "required": true; "isSignal": true; }; "matchKind": { "alias": "matchKind"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "showEdit": { "alias": "showEdit"; "required": false; "isSignal": true; }; }, { "action": "action"; }, ["bodyTemplate"], never, true, never>;
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1453
1510
|
/**
|
|
1454
1511
|
* Returns a CSS style string for a subagent's status badge.
|
|
1455
1512
|
* Kept exported for backward compatibility with existing consumers; the
|
|
@@ -2251,5 +2308,5 @@ interface MockAgentOptions {
|
|
|
2251
2308
|
}
|
|
2252
2309
|
declare function mockAgent(opts?: MockAgentOptions): MockAgent;
|
|
2253
2310
|
|
|
2254
|
-
export { A2uiAudioPlayerComponent, A2uiButtonComponent, A2uiCardComponent, A2uiCheckBoxComponent, A2uiColumnComponent, A2uiDateTimeInputComponent, A2uiDividerComponent, A2uiIconComponent, A2uiImageComponent, A2uiListComponent, A2uiModalComponent, A2uiMultipleChoiceComponent, A2uiRowComponent, A2uiSliderComponent, A2uiSurfaceComponent, A2uiTabsComponent, A2uiTextComponent, A2uiTextFieldComponent, A2uiVideoComponent, CHAT_CONFIG, CHAT_LIFECYCLE, CHAT_MARKDOWN_STYLES, ChatCitationCardTemplateDirective, ChatCitationsCardComponent, ChatCitationsComponent, ChatComponent, ChatConfirmDialogComponent, ChatErrorComponent, ChatGenerativeUiComponent, ChatGenuiSkeletonComponent, ChatHistorySearchPaletteComponent, ChatInputComponent, ChatInterruptComponent, ChatInterruptPanelComponent, ChatLauncherButtonComponent, ChatMessageActionsComponent, ChatMessageComponent, ChatMessageListComponent, ChatOverflowMenuComponent, ChatPopupComponent, ChatProjectListComponent, ChatReasoningComponent, ChatScrollBubbleComponent, ChatSelectComponent, ChatSidebarComponent, ChatSidenavComponent, ChatSidenavScrimComponent, ChatStreamingMdComponent, ChatSubagentCardComponent, ChatSubagentsComponent, ChatSuggestionsComponent, ChatThreadListComponent, ChatTimelineComponent, ChatTimelineSliderComponent, ChatToolCallCardComponent, ChatToolCallTemplateDirective, ChatToolCallsComponent, ChatTraceComponent, ChatTypingIndicatorComponent, ChatWelcomeComponent, ChatWelcomeSuggestionComponent, ChatWindowComponent, CitationsResolverService, ICON_AGENT, ICON_CHECK, ICON_CHEVRON_DOWN, ICON_CHEVRON_UP, ICON_SEND, ICON_TOOL, ICON_WARNING, IS_HEADER_ROW, MARKDOWN_VIEW_REGISTRY, MarkdownAutolinkComponent, MarkdownBlockquoteComponent, MarkdownChildrenComponent, MarkdownCitationReferenceComponent, MarkdownCodeBlockComponent, MarkdownDocumentComponent, MarkdownEmphasisComponent, MarkdownHardBreakComponent, MarkdownHeadingComponent, MarkdownImageComponent, MarkdownInlineCodeComponent, MarkdownLinkComponent, MarkdownListComponent, MarkdownListItemComponent, MarkdownParagraphComponent, MarkdownSoftBreakComponent, MarkdownStrikethroughComponent, MarkdownStrongComponent, MarkdownTableCellComponent, MarkdownTableComponent, MarkdownTableRowComponent, MarkdownTextComponent, MarkdownThematicBreakComponent, MessageTemplateDirective, a2uiBasicCatalog, buildA2uiActionMessage, cacheplaneMarkdownViews, createA2uiSurfaceStore, createContentClassifier, createParseTreeStore, createPartialArgsBridge, emitBinding, extractErrorMessage, formatDuration, getInterrupt, getMessageType, isAssistantMessage, isSystemMessage, isToolMessage, isTyping, isUserMessage, messageContent, mockAgent, normalizeEnvelopeArgs, normalizeViewEntry, provideChat, renderMarkdown, statusColor, submitMessage, surfaceToSpec };
|
|
2255
|
-
export type { A2uiComponentView, A2uiSurfaceState, A2uiSurfaceStore, A2uiViewEntry, A2uiViews, Agent, AgentCheckpoint, AgentCustomEvent, AgentEvent, AgentInterrupt, AgentRuntimeTelemetryEvent, AgentRuntimeTelemetryPayload, AgentRuntimeTelemetryProperties, AgentRuntimeTelemetrySink, AgentStateUpdateEvent, AgentStatus, AgentSubmitInput, AgentSubmitOptions, AgentWithHistory, ChatConfig, ChatLifecycle, ChatMessageRole, ChatRenderEvent, ChatScrollBubbleMode, ChatSelectOption, ChatSidenavMode, ChatToolCallTemplateContext, Citation, ContentBlock, ContentClassifier, ContentType, ElementAccumulationState, InterruptAction, Message, MessageTemplateType, MockAgent, MockAgentOptions, OverflowMenuItem, ParseTreeStore, PartialArgsBridge, Project, ProjectActionAdapter, ResolvedCitation, Role, Subagent, SubagentStatus, Thread, ThreadActionAdapter, ThreadMatch, ToolCall, ToolCallInfo, ToolCallStatus, TraceState };
|
|
2311
|
+
export { A2uiAudioPlayerComponent, A2uiButtonComponent, A2uiCardComponent, A2uiCheckBoxComponent, A2uiColumnComponent, A2uiDateTimeInputComponent, A2uiDividerComponent, A2uiIconComponent, A2uiImageComponent, A2uiListComponent, A2uiModalComponent, A2uiMultipleChoiceComponent, A2uiRowComponent, A2uiSliderComponent, A2uiSurfaceComponent, A2uiTabsComponent, A2uiTextComponent, A2uiTextFieldComponent, A2uiVideoComponent, CHAT_CONFIG, CHAT_LIFECYCLE, CHAT_MARKDOWN_STYLES, ChatApprovalCardComponent, ChatCitationCardTemplateDirective, ChatCitationsCardComponent, ChatCitationsComponent, ChatComponent, ChatConfirmDialogComponent, ChatErrorComponent, ChatGenerativeUiComponent, ChatGenuiSkeletonComponent, ChatHistorySearchPaletteComponent, ChatInputComponent, ChatInterruptComponent, ChatInterruptPanelComponent, ChatLauncherButtonComponent, ChatMessageActionsComponent, ChatMessageComponent, ChatMessageListComponent, ChatOverflowMenuComponent, ChatPopupComponent, ChatProjectListComponent, ChatReasoningComponent, ChatScrollBubbleComponent, ChatSelectComponent, ChatSidebarComponent, ChatSidenavComponent, ChatSidenavScrimComponent, ChatStreamingMdComponent, ChatSubagentCardComponent, ChatSubagentsComponent, ChatSuggestionsComponent, ChatThreadListComponent, ChatTimelineComponent, ChatTimelineSliderComponent, ChatToolCallCardComponent, ChatToolCallTemplateDirective, ChatToolCallsComponent, ChatToolViewsComponent, ChatTraceComponent, ChatTypingIndicatorComponent, ChatWelcomeComponent, ChatWelcomeSuggestionComponent, ChatWindowComponent, CitationsResolverService, ICON_AGENT, ICON_CHECK, ICON_CHEVRON_DOWN, ICON_CHEVRON_UP, ICON_SEND, ICON_TOOL, ICON_WARNING, IS_HEADER_ROW, MARKDOWN_VIEW_REGISTRY, MarkdownAutolinkComponent, MarkdownBlockquoteComponent, MarkdownChildrenComponent, MarkdownCitationReferenceComponent, MarkdownCodeBlockComponent, MarkdownDocumentComponent, MarkdownEmphasisComponent, MarkdownHardBreakComponent, MarkdownHeadingComponent, MarkdownImageComponent, MarkdownInlineCodeComponent, MarkdownLinkComponent, MarkdownListComponent, MarkdownListItemComponent, MarkdownParagraphComponent, MarkdownSoftBreakComponent, MarkdownStrikethroughComponent, MarkdownStrongComponent, MarkdownTableCellComponent, MarkdownTableComponent, MarkdownTableRowComponent, MarkdownTextComponent, MarkdownThematicBreakComponent, MessageTemplateDirective, a2uiBasicCatalog, buildA2uiActionMessage, cacheplaneMarkdownViews, createA2uiSurfaceStore, createContentClassifier, createParseTreeStore, createPartialArgsBridge, emitBinding, extractErrorMessage, formatDuration, getInterrupt, getMessageType, isAssistantMessage, isSystemMessage, isToolMessage, isTyping, isUserMessage, messageContent, mockAgent, normalizeEnvelopeArgs, normalizeViewEntry, provideChat, renderMarkdown, statusColor, submitMessage, surfaceToSpec };
|
|
2312
|
+
export type { A2uiComponentView, A2uiSurfaceState, A2uiSurfaceStore, A2uiViewEntry, A2uiViews, Agent, AgentCheckpoint, AgentCustomEvent, AgentEvent, AgentInterrupt, AgentRuntimeTelemetryEvent, AgentRuntimeTelemetryPayload, AgentRuntimeTelemetryProperties, AgentRuntimeTelemetrySink, AgentStateUpdateEvent, AgentStatus, AgentSubmitInput, AgentSubmitOptions, AgentWithHistory, ChatApprovalAction, ChatConfig, ChatLifecycle, ChatMessageRole, ChatRenderEvent, ChatScrollBubbleMode, ChatSelectOption, ChatSidenavMode, ChatToolCallTemplateContext, Citation, ContentBlock, ContentClassifier, ContentType, ElementAccumulationState, InterruptAction, Message, MessageTemplateType, MockAgent, MockAgentOptions, OverflowMenuItem, ParseTreeStore, PartialArgsBridge, Project, ProjectActionAdapter, ResolvedCitation, Role, Subagent, SubagentStatus, Thread, ThreadActionAdapter, ThreadMatch, ToolCall, ToolCallInfo, ToolCallStatus, TraceState };
|