@threadplane/chat 0.0.55 → 0.0.56

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadplane/chat",
3
- "version": "0.0.55",
3
+ "version": "0.0.56",
4
4
  "exports": {
5
5
  "./chat.css": "./chat.css",
6
6
  "./themes/default-dark.css": "./themes/default-dark.css",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@cacheplane/partial-json": ">=0.1.1 <0.3.0",
28
- "@cacheplane/partial-markdown": "^0.5.3",
28
+ "@cacheplane/partial-markdown": "^0.5.5",
29
29
  "tslib": "^2.3.0",
30
30
  "@threadplane/telemetry": "*"
31
31
  },
@@ -162,6 +162,20 @@ interface Citation {
162
162
  snippet?: string;
163
163
  /** Provider-specific extras (retrieval score, source type, etc.). */
164
164
  extra?: Record<string, unknown>;
165
+ /**
166
+ * Source classification driving the type badge. Free-form and extensible:
167
+ * 'web' (default-inferred from an http(s) url) | 'file' | 'app' | 'memory'
168
+ * | any custom string. Optional — display derives 'web' from the url when absent.
169
+ */
170
+ sourceType?: string;
171
+ /**
172
+ * Provider-supplied favicon/logo (absolute URL or `data:` URI). NEVER
173
+ * auto-fetched by the library — supply this from your own resolver if you
174
+ * want real favicons; otherwise a monogram is rendered.
175
+ */
176
+ iconUrl?: string;
177
+ /** Freshness signal shown in the preview-card footer. */
178
+ publishedAt?: string | number | Date;
165
179
  }
166
180
 
167
181
  type Role = 'user' | 'assistant' | 'system' | 'tool';
@@ -1415,37 +1429,79 @@ declare class ChatCitationCardTemplateDirective {
1415
1429
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ChatCitationCardTemplateDirective, never>;
1416
1430
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ChatCitationCardTemplateDirective, "ng-template[chatCitationCard]", never, {}, {}, never, never, true, never>;
1417
1431
  }
1432
+ interface FavEntry {
1433
+ id: string;
1434
+ iconUrl?: string;
1435
+ mono: string;
1436
+ color: string;
1437
+ }
1418
1438
  declare class ChatCitationsComponent {
1419
1439
  readonly message: _angular_core.InputSignal<Message>;
1420
1440
  readonly heading: _angular_core.InputSignal<string>;
1441
+ protected readonly expanded: _angular_core.WritableSignal<boolean>;
1442
+ protected readonly listId: string;
1421
1443
  cardTpl: ChatCitationCardTemplateDirective | null;
1422
- /**
1423
- * Optional resolver — present when chat-citations is rendered inside a
1424
- * chat-message that provides CitationsResolverService (the standard
1425
- * placement). When absent, the panel reads only Message.citations.
1426
- */
1427
1444
  private readonly resolver;
1428
1445
  /**
1429
1446
  * Combined citation list:
1430
1447
  * 1. Message.citations (provider-populated, takes precedence by id)
1431
- * 2. Markdown sidecar defs (Pandoc-formatted [^id]: lines), merged in
1432
- * for any id not already present.
1433
- *
1434
- * Sorted by index ascending. This guarantees the sources panel surfaces
1435
- * citations whether they come from message metadata, content syntax, or
1436
- * both — matching the same precedence as inline-marker resolution.
1448
+ * 2. Markdown sidecar defs (Pandoc [^id]: lines), merged for unseen ids.
1449
+ * Sorted by index ascending.
1437
1450
  */
1438
1451
  protected readonly citations: _angular_core.Signal<Citation[]>;
1452
+ /** First 3 sources, mapped to favicon/monogram chips for the header preview. */
1453
+ protected readonly favstack: _angular_core.Signal<FavEntry[]>;
1439
1454
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ChatCitationsComponent, never>;
1440
1455
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<ChatCitationsComponent, "chat-citations", never, { "message": { "alias": "message"; "required": true; "isSignal": true; }; "heading": { "alias": "heading"; "required": false; "isSignal": true; }; }, {}, ["cardTpl"], never, true, never>;
1441
1456
  }
1442
1457
 
1458
+ /**
1459
+ * Sources-panel detail card: index badge, favicon/monogram + domain + type,
1460
+ * title, one-line snippet. Renders as an <a> (opens the source) when a url is
1461
+ * present, otherwise a non-interactive <div>. Shares the panel style module.
1462
+ */
1443
1463
  declare class ChatCitationsCardComponent {
1444
1464
  readonly citation: _angular_core.InputSignal<Citation>;
1465
+ protected readonly domain: _angular_core.Signal<string | null>;
1466
+ protected readonly title: _angular_core.Signal<string | null>;
1467
+ protected readonly monogram: _angular_core.Signal<string>;
1468
+ protected readonly monoColor: _angular_core.Signal<string>;
1469
+ protected readonly typeLabel: _angular_core.Signal<string | null>;
1445
1470
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ChatCitationsCardComponent, never>;
1446
1471
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<ChatCitationsCardComponent, "chat-citations-card", never, { "citation": { "alias": "citation"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
1447
1472
  }
1448
1473
 
1474
+ /**
1475
+ * Presentational provenance card for a single Citation. Rendered inside the
1476
+ * inline marker's connected-overlay pane (hover/tap preview) — self-contained
1477
+ * so its encapsulated styles apply even when portaled to the body-level pane.
1478
+ */
1479
+ declare class ChatCitationPreviewComponent {
1480
+ readonly citation: _angular_core.InputSignal<Citation>;
1481
+ protected readonly domain: _angular_core.Signal<string | null>;
1482
+ protected readonly monogram: _angular_core.Signal<string>;
1483
+ protected readonly monoColor: _angular_core.Signal<string>;
1484
+ protected readonly typeLabel: _angular_core.Signal<string | null>;
1485
+ protected readonly published: _angular_core.Signal<string | null>;
1486
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ChatCitationPreviewComponent, never>;
1487
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ChatCitationPreviewComponent, "chat-citation-preview", never, { "citation": { "alias": "citation"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
1488
+ }
1489
+
1490
+ /** Hostname of `url` with a leading `www.` removed; null if absent/malformed. */
1491
+ declare function deriveDomain(url?: string): string | null;
1492
+ /** Explicit `sourceType`, else 'web' inferred from a url, else 'unknown'. */
1493
+ declare function deriveSourceType(c: Citation): string;
1494
+ /** Uppercased first letter of the domain (or title) for the monogram chip. */
1495
+ declare function deriveMonogram(c: Citation): string;
1496
+ /** Deterministic hue in [0,360) from a seed string (stable monogram color). */
1497
+ declare function monogramHue(seed: string): number;
1498
+ /** Short freshness label (e.g. "Apr 2024"); null when absent or unparseable. */
1499
+ declare function formatPublished(value?: string | number | Date): string | null;
1500
+ /** Deterministic monogram-chip background color (stable per source). */
1501
+ declare function monogramColor(c: Citation): string;
1502
+ /** Human label for the source-type badge; null when type is 'unknown'. */
1503
+ declare function citationTypeLabel(c: Citation): string | null;
1504
+
1449
1505
  interface ThreadRoutingConfig {
1450
1506
  /** The app-owned source-of-truth signal for the active thread id. */
1451
1507
  threadId: WritableSignal<string | null>;
@@ -1782,8 +1838,8 @@ declare class ChatComponent {
1782
1838
  *
1783
1839
  * Matches the same `streaming + current` condition the bubble uses
1784
1840
  * to enable `.chat-message__caret`:
1785
- * `agent().isLoading() && i === agent().messages().length - 1`
1786
- * `i === agent().messages().length - 1`
1841
+ * `this.agent().isLoading() && i === this.agent().messages().length - 1`
1842
+ * `i === this.agent().messages().length - 1`
1787
1843
  *
1788
1844
  * Restricted to assistant role because the caret only renders on
1789
1845
  * assistant bubbles (`:host([data-role="assistant"][data-current=...
@@ -2274,10 +2330,41 @@ declare class MarkdownHardBreakComponent {
2274
2330
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<MarkdownHardBreakComponent, "chat-md-hard-break", never, { "node": { "alias": "node"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
2275
2331
  }
2276
2332
 
2333
+ /**
2334
+ * Inline citation marker. Renders a numbered pill and reveals a provenance
2335
+ * preview card (portaled via the connected-overlay primitive) on hover/focus
2336
+ * (desktop) or tap (touch). Click navigates on desktop when a url exists;
2337
+ * on touch it previews instead of navigating.
2338
+ */
2277
2339
  declare class MarkdownCitationReferenceComponent {
2278
2340
  readonly node: _angular_core.InputSignal<MarkdownCitationReferenceNode>;
2279
2341
  private readonly resolver;
2342
+ private readonly document;
2280
2343
  protected readonly resolved: _angular_core.Signal<_threadplane_chat.ResolvedCitation | null>;
2344
+ protected readonly open: _angular_core.WritableSignal<boolean>;
2345
+ protected readonly positions: ConnectedPosition[];
2346
+ /** Read fresh each time: SSR renders with no window, and hybrid devices change. */
2347
+ private get hoverCapable();
2348
+ private openTimer;
2349
+ private closeTimer;
2350
+ private pane;
2351
+ private justOpenedByFocus;
2352
+ constructor();
2353
+ protected ariaLabel(c: Citation): string;
2354
+ protected onEnter(): void;
2355
+ protected onLeave(): void;
2356
+ protected onFocus(): void;
2357
+ protected onBlur(): void;
2358
+ protected onClick(e: MouseEvent, c: Citation): void;
2359
+ protected onKeydown(e: KeyboardEvent, c: Citation): void;
2360
+ protected onAttached(pane: HTMLElement): void;
2361
+ protected close(): void;
2362
+ private readonly onPaneEnter;
2363
+ private readonly onPaneLeave;
2364
+ private scheduleClose;
2365
+ private cancelOpen;
2366
+ private cancelClose;
2367
+ private clearTimers;
2281
2368
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<MarkdownCitationReferenceComponent, never>;
2282
2369
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<MarkdownCitationReferenceComponent, "chat-md-citation-reference", never, { "node": { "alias": "node"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
2283
2370
  }
@@ -3073,5 +3160,5 @@ declare function mockAgent(opts?: MockAgentOptions): MockAgent;
3073
3160
  /** Inferred argument type for a schema (alias of StandardSchemaInferOutput). */
3074
3161
  type ToolArgs<S extends StandardSchemaV1> = StandardSchemaInferOutput<S>;
3075
3162
 
3076
- export { A2uiAudioPlayerComponent, A2uiButtonComponent, A2uiCardComponent, A2uiCheckBoxComponent, A2uiColumnComponent, A2uiDateTimeInputComponent, A2uiDividerComponent, A2uiIconComponent, A2uiImageComponent, A2uiListComponent, A2uiModalComponent, A2uiMultipleChoiceComponent, A2uiRowComponent, A2uiSliderComponent, A2uiSurfaceComponent, A2uiTabsComponent, A2uiTextComponent, A2uiTextFieldComponent, A2uiVideoComponent, AGENT_ERROR_MESSAGES, AgentError, CHAT_CONFIG, CHAT_LIFECYCLE, ChatApprovalCardComponent, ChatCitationCardTemplateDirective, ChatCitationsCardComponent, ChatCitationsComponent, ChatComponent, ChatConfirmDialogComponent, ChatConnectedOverlayDirective, ChatErrorComponent, ChatGenerativeUiComponent, ChatGenuiSkeletonComponent, ChatHistorySearchPaletteComponent, ChatInputComponent, ChatInterruptComponent, ChatInterruptPanelComponent, ChatLauncherButtonComponent, ChatMessageActionsComponent, ChatMessageComponent, ChatMessageListComponent, ChatOverflowMenuComponent, ChatOverlayOriginDirective, 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, IS_HEADER_ROW, MARKDOWN_VIEW_REGISTRY, MarkdownAutolinkComponent, MarkdownBlockquoteComponent, MarkdownChildrenComponent, MarkdownCitationReferenceComponent, MarkdownCodeBlockComponent, MarkdownDocumentComponent, MarkdownEmphasisComponent, MarkdownHardBreakComponent, MarkdownHeadingComponent, MarkdownHtmlComponent, MarkdownImageComponent, MarkdownInlineCodeComponent, MarkdownLinkComponent, MarkdownListComponent, MarkdownListItemComponent, MarkdownMathComponent, MarkdownParagraphComponent, MarkdownSoftBreakComponent, MarkdownStrikethroughComponent, MarkdownStrongComponent, MarkdownTableCellComponent, MarkdownTableComponent, MarkdownTableRowComponent, MarkdownTextComponent, MarkdownThematicBreakComponent, MessageTemplateDirective, a2uiBasicCatalog, action, ask, buildA2uiActionMessage, cacheplaneMarkdownViews, createA2uiSurfaceStore, createAgentRef, createContentClassifier, createParseTreeStore, createPartialArgsBridge, deriveJsonSchema, emitBinding, executeFunctionTool, extractErrorMessage, formatDuration, getInterrupt, getMessageType, injectThreadRouting, isAbortError, isAssistantMessage, isSystemMessage, isToolMessage, isTyping, isUserMessage, messageContent, mockAgent, normalizeEnvelopeArgs, normalizeViewEntry, provideChat, renderMarkdown, startClientToolExecutor, statusColor, submitMessage, toAgentError, toClientToolSpecs, tools, validateArgs, view };
3163
+ export { A2uiAudioPlayerComponent, A2uiButtonComponent, A2uiCardComponent, A2uiCheckBoxComponent, A2uiColumnComponent, A2uiDateTimeInputComponent, A2uiDividerComponent, A2uiIconComponent, A2uiImageComponent, A2uiListComponent, A2uiModalComponent, A2uiMultipleChoiceComponent, A2uiRowComponent, A2uiSliderComponent, A2uiSurfaceComponent, A2uiTabsComponent, A2uiTextComponent, A2uiTextFieldComponent, A2uiVideoComponent, AGENT_ERROR_MESSAGES, AgentError, CHAT_CONFIG, CHAT_LIFECYCLE, ChatApprovalCardComponent, ChatCitationCardTemplateDirective, ChatCitationPreviewComponent, ChatCitationsCardComponent, ChatCitationsComponent, ChatComponent, ChatConfirmDialogComponent, ChatConnectedOverlayDirective, ChatErrorComponent, ChatGenerativeUiComponent, ChatGenuiSkeletonComponent, ChatHistorySearchPaletteComponent, ChatInputComponent, ChatInterruptComponent, ChatInterruptPanelComponent, ChatLauncherButtonComponent, ChatMessageActionsComponent, ChatMessageComponent, ChatMessageListComponent, ChatOverflowMenuComponent, ChatOverlayOriginDirective, 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, IS_HEADER_ROW, MARKDOWN_VIEW_REGISTRY, MarkdownAutolinkComponent, MarkdownBlockquoteComponent, MarkdownChildrenComponent, MarkdownCitationReferenceComponent, MarkdownCodeBlockComponent, MarkdownDocumentComponent, MarkdownEmphasisComponent, MarkdownHardBreakComponent, MarkdownHeadingComponent, MarkdownHtmlComponent, MarkdownImageComponent, MarkdownInlineCodeComponent, MarkdownLinkComponent, MarkdownListComponent, MarkdownListItemComponent, MarkdownMathComponent, MarkdownParagraphComponent, MarkdownSoftBreakComponent, MarkdownStrikethroughComponent, MarkdownStrongComponent, MarkdownTableCellComponent, MarkdownTableComponent, MarkdownTableRowComponent, MarkdownTextComponent, MarkdownThematicBreakComponent, MessageTemplateDirective, a2uiBasicCatalog, action, ask, buildA2uiActionMessage, cacheplaneMarkdownViews, citationTypeLabel, createA2uiSurfaceStore, createAgentRef, createContentClassifier, createParseTreeStore, createPartialArgsBridge, deriveDomain, deriveJsonSchema, deriveMonogram, deriveSourceType, emitBinding, executeFunctionTool, extractErrorMessage, formatDuration, formatPublished, getInterrupt, getMessageType, injectThreadRouting, isAbortError, isAssistantMessage, isSystemMessage, isToolMessage, isTyping, isUserMessage, messageContent, mockAgent, monogramColor, monogramHue, normalizeEnvelopeArgs, normalizeViewEntry, provideChat, renderMarkdown, startClientToolExecutor, statusColor, submitMessage, toAgentError, toClientToolSpecs, tools, validateArgs, view };
3077
3164
  export type { A2uiComponentView, A2uiSurfaceState, A2uiSurfaceStore, A2uiViewEntry, A2uiViews, Agent, AgentCheckpoint, AgentCustomEvent, AgentErrorKind, AgentEvent, AgentInterrupt, AgentRef, AgentRuntimeTelemetryEvent, AgentRuntimeTelemetryPayload, AgentRuntimeTelemetryProperties, AgentRuntimeTelemetrySink, AgentStateUpdateEvent, AgentStatus, AgentSubmitInput, AgentSubmitOptions, AgentWithHistory, AnyFunctionToolDef, AskToolDef, ChatApprovalAction, ChatConfig, ChatLifecycle, ChatMessageRole, ChatRenderEvent, ChatScrollBubbleMode, ChatSelectOption, ChatSidenavMode, ChatToolCallTemplateContext, Citation, ClientToolDef, ClientToolRegistry, ClientToolResult, ClientToolSpec, ClientToolsCapability, ClientToolsCoordinator, ConnectedPosition, ContentBlock, ContentClassifier, ContentType, ElementAccumulationState, FunctionToolDef, InterruptAction, Message, MessageTemplateType, MockAgent, MockAgentOptions, OverflowMenuItem, OverlayPositionResult, ParseTreeStore, PartialArgsBridge, Project, ProjectActionAdapter, ResolvedCitation, Role, Subagent, SubagentStatus, Thread, ThreadActionAdapter, ThreadMatch, ThreadRoutingConfig, ToolArgs, ToolCall, ToolCallInfo, ToolCallStatus, TraceState, ViewProps, ViewToolDef };