@invana/assistant 0.0.33 → 0.0.35

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/dist/index.d.cts CHANGED
@@ -2,8 +2,8 @@ import * as React from 'react';
2
2
  import { TraceStep, AnswerKind, Tone, AnswerOptionsByKind, ActionOption, AskState, AskSpec, AskKind, AskOptionsByKind, BlockPatch, PatchSource as PatchSource$1, PatchChunk as PatchChunk$1, PatchScript as PatchScript$1, ScriptStep as ScriptStep$1, EventSourceOptions, PlayOptions, PageSpec } from '@invana/blocks';
3
3
  export { ANSWER_KINDS, ASK_KINDS, ActionOption, AnswerKind, AnswerOptionsByKind, ApprovalOptions, AskKind, AskOptionsByKind, AskSpec, AskState, AskText, AskValueByKind, BLOCKS, BlockKind, BlockOptionsByKind, CannotOptions, CaveatNoteOptions, CaveatOptions, CaveatTone, Cell, ChoiceFigure, ChoiceOption, CitationSource, CitationsOptions, Column, ConfirmCard, ConfirmCardProps, ConfirmCost, ConfirmOptions, CostFigure, EntityOptions, EventSourceOptions, Figure, FileItem, ForkOptions, FormOptions, HypothesisOptions, InterpretationOptions, LongOptions, MethodOptions, MetricOptions, ModelSpecOptions, MultiOptions, MultistepOptions, NarrativeOptions, NumberOptions, PeriodOptions, Placeholder, PlaceholderProps, PlanOptions, PlayOptions, ProposalOptions, QuickOptions, QuickPick, RangeOptions, RecordRow, ScaleOptions, ScopeOptions, ScopePart, ShortOptions, SingleOptions, SuggestionChips, SuggestionChipsProps, SuggestionsOptions, Tone, TraceIoRow, TraceOptions, TraceStep, TypedValue, WeightsOptions, scriptLength } from '@invana/blocks';
4
4
  import * as _invana_ui from '@invana/ui';
5
- import { ChatSessionActivityRow as ChatSessionActivityRow$1, ChatSessionActivitySubLine as ChatSessionActivitySubLine$1, ChatSessionCaret as ChatSessionCaret$1, ChatSessionComposer as ChatSessionComposer$1, ChatSessionContextChip as ChatSessionContextChip$1, ChatSessionDisclosure as ChatSessionDisclosure$1, ChatSessionDisclosureCode as ChatSessionDisclosureCode$1, ChatSessionDisclosureSteps as ChatSessionDisclosureSteps$1, ChatSession as ChatSession$1, ChatSessionMessage as ChatSessionMessage$1, ChatSessionMessageOptions as ChatSessionMessageOptions$1, ChatSessionProgressLine as ChatSessionProgressLine$1, ChatSessionPromptRow as ChatSessionPromptRow$1, ChatSessionStatusBar as ChatSessionStatusBar$1, ChatSessionTaskGroup as ChatSessionTaskGroup$1, ChatSessionTaskRow as ChatSessionTaskRow$1 } from '@invana/ui';
6
- export { ChatSessionActivityRowProps, ChatSessionActivityStatus, ChatSessionActivitySubLineProps, ChatSessionComposerProps, ChatSessionContextChipProps, ChatSessionDisclosureProps, ChatSessionDisclosureStepsProps, ChatSessionProps as ChatSessionFrameProps, ChatSessionMessageAction, ChatSessionMessageOptionsProps, ChatSessionMessageProps, ChatSessionMessageRole, ChatSessionMessageStatus, ChatSessionProgressLineProps, ChatSessionPromptRowProps, ChatSessionStatusBarProps, ChatSessionTaskGroupProps, ChatSessionTaskRowProps, ChatSessionTaskStatus, ClarifyActionsProps, ClarifyCardProps, ClarifyFootnoteProps, ClarifyOption, ClarifyState, EmissionCardProps, EmissionHeaderProps, EmissionKind, TemplateOption, TemplatePickerProps } from '@invana/ui';
5
+ import { ChatSessionActivityRow as ChatSessionActivityRow$1, ChatSessionActivitySubLine as ChatSessionActivitySubLine$1, ChatSessionCaret as ChatSessionCaret$1, ChatSessionComposer as ChatSessionComposer$1, ChatSessionContextChip as ChatSessionContextChip$1, ChatSessionDisclosure as ChatSessionDisclosure$1, ChatSessionDisclosureCode as ChatSessionDisclosureCode$1, ChatSessionDisclosureSteps as ChatSessionDisclosureSteps$1, ChatSession as ChatSession$1, ChatSessionMessage as ChatSessionMessage$1, ChatSessionMessageOptions as ChatSessionMessageOptions$1, ChatSessionProgressLine as ChatSessionProgressLine$1, ChatSessionPromptRow as ChatSessionPromptRow$1, ChatSessionStatusBar as ChatSessionStatusBar$1, ChatSessionTaskGroup as ChatSessionTaskGroup$1, ChatSessionTaskRow as ChatSessionTaskRow$1, ClarifyState, ClarifyQuestion } from '@invana/ui';
6
+ export { ChatSessionActivityRowProps, ChatSessionActivityStatus, ChatSessionActivitySubLineProps, ChatSessionComposerProps, ChatSessionContextChipProps, ChatSessionDisclosureProps, ChatSessionDisclosureStepsProps, ChatSessionProps as ChatSessionFrameProps, ChatSessionMessageAction, ChatSessionMessageOptionsProps, ChatSessionMessageProps, ChatSessionMessageRole, ChatSessionMessageStatus, ChatSessionProgressLineProps, ChatSessionPromptRowProps, ChatSessionStatusBarProps, ChatSessionTaskGroupProps, ChatSessionTaskRowProps, ChatSessionTaskStatus, ClarifyActionsProps, ClarifyCardProps, ClarifyFootnoteProps, ClarifyOption, ClarifyQuestion, ClarifyState, EmissionCardProps, EmissionHeaderProps, EmissionKind, TemplateOption, TemplatePickerProps } from '@invana/ui';
7
7
 
8
8
  /**
9
9
  * Everything the analyst can do, as data. The component never acts on a
@@ -1419,6 +1419,54 @@ interface TurnLabelProps extends React.HTMLAttributes<HTMLDivElement> {
1419
1419
  */
1420
1420
  declare const TurnLabel: React.ForwardRefExoticComponent<TurnLabelProps & React.RefAttributes<HTMLDivElement>>;
1421
1421
 
1422
+ /** One question of the group — a `ClarifyQuestion` with the name its answer is keyed by. */
1423
+ interface ClarifyGroupQuestion extends ClarifyQuestion {
1424
+ /** The answer's key in `onSubmit` — `measure`. */
1425
+ name: string;
1426
+ /** The tab's label, a word or two — `Measure`. Falls back to `Q1`, `Q2`, … */
1427
+ title?: React.ReactNode;
1428
+ /** Submit waits for it. @default true */
1429
+ required?: boolean;
1430
+ }
1431
+ /** What was answered, keyed by question name: an option's value, or the words typed. */
1432
+ type ClarifyAnswers = Record<string, string>;
1433
+ interface ClarifyCardGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onSubmit" | "onSelect"> {
1434
+ /** @default "pending" */
1435
+ state?: ClarifyState;
1436
+ /** The title line's word. @default "questions" */
1437
+ kind?: React.ReactNode;
1438
+ /** Which step asked — `understand`. */
1439
+ step?: React.ReactNode;
1440
+ /** Two to four questions asked together, in order. */
1441
+ questions: ClarifyGroupQuestion[];
1442
+ /**
1443
+ * The answers. While pending, the ones already given — the group opens on
1444
+ * the first question still open. Settled, what was sent.
1445
+ */
1446
+ answers?: ClarifyAnswers;
1447
+ /** Every answer, once the required ones are in. */
1448
+ onSubmit?: (answers: ClarifyAnswers) => void;
1449
+ /** @default "Or type your own" */
1450
+ typePlaceholder?: string;
1451
+ /** Settled, the summary folds and opens to the questions with their answers. @default true */
1452
+ collapsible?: boolean;
1453
+ /** Settled only: open on first render. @default false */
1454
+ defaultOpen?: boolean;
1455
+ }
1456
+ /**
1457
+ * Several questions asked at once, one tab each.
1458
+ *
1459
+ * While pending, the tabs say which questions have an answer; picking an
1460
+ * option moves on to the next open one, and the words typed under the options
1461
+ * are an answer too. Submit sends them all together once the required ones
1462
+ * are in — one round, one wait, rather than a question per round.
1463
+ *
1464
+ * Settled, it is the inline `ClarifyCard` of the same questions: folded to
1465
+ * `Answered · 3 questions`, opening to each question with its answer chosen
1466
+ * and the options not taken dimmed.
1467
+ */
1468
+ declare const ClarifyCardGroup: React.ForwardRefExoticComponent<ClarifyCardGroupProps & React.RefAttributes<HTMLDivElement>>;
1469
+
1422
1470
  /** The ask, through its whole life: pending, answered, skipped, superseded, expired. */
1423
1471
  declare const ClarifyCard: React.ForwardRefExoticComponent<_invana_ui.ClarifyCardProps & React.RefAttributes<HTMLDivElement>>;
1424
1472
  /** The line under an ask: why these options, or where a default came from. */
@@ -1465,4 +1513,4 @@ interface ValidateOptions {
1465
1513
  }
1466
1514
  declare function validate(spec: ConversationSpec, options?: ValidateOptions): ValidationIssue[];
1467
1515
 
1468
- export { ANSWER_INTENTS, ASK_INTENTS, type AccessModel, type AccessSpec, type AgentSpec, type AnalystTurn, type AnswerIntentId, type AnswerState, type AnswerTurn, type AskIntentId, type AskRegistry, type AskRenderer, type AskRendererProps, type AskTraits, type AskTurn, BUILT_IN_ASKS, BUILT_IN_ASK_TRAITS, BUILT_IN_BLOCKS, BUILT_IN_BLOCK_TRAITS, type BlockBase, type BlockRegistry, type BlockRenderer, type BlockRendererProps, type BlockSpec, type BlockTraits, ChatSession, ChatSessionActivityRow, ChatSessionActivitySubLine, type ChatSessionAnswerAction, type ChatSessionBuiltInAction, ChatSessionCaret, ChatSessionComposer, ChatSessionContextChip, type ChatSessionCustomAction, ChatSessionDisclosure, ChatSessionDisclosureCode, ChatSessionDisclosureSteps, type ChatSessionEventOf, ChatSessionFrame, type ChatSessionHandle, type ChatSessionHandlers, type ChatSessionIcons, ChatSessionMessage, ChatSessionMessageOptions, ChatSessionProgressLine, ChatSessionPromptRow, type ChatSessionProps, ChatSessionStatusBar, ChatSessionTaskGroup, ChatSessionTaskRow, ChatSessionTurn, type ChatSessionTurnProps, type ChatSessionVariant, type ChatSessionView, CitationMarker, ClarifyActions, ClarifyCard, ClarifyFootnote, type ComposerControl, type ComposerOption, type ComposerSpec, type ConversationEvent, type ConversationEventType, type ConversationPatch, type ConversationPatchOp, type ConversationSpec, DEFAULT_ANSWER_ACTIONS, type DeltaOptions, EVENT_TYPES, EmissionBody, EmissionCard, EmissionHeader, type Envelope, type Exchange, FLOWS, type FlowId, type GovernanceSpec, type Outcome, PATTERNS, type PatchChunk, PatchError, type PatchScript, type PatchSource, type PatternId, type RegistryOverrides, type ResolvedRegistry, type RunOutcome, STAGES, type ScriptStep, type StageId, TemplatePicker, type Turn, TurnLabel, type TurnLabelProps, type UseChatSession, type ValidateOptions, type ValidationIssue, answerTime, answerToPage, applyPatch, applyPatches, chatSessionGutterClass, clockTime, currentStep, dayLabel, elapsedSince, exchangesOf, formatDuration, fromEventSource, fromNdjson, isLive, isRunning, offsetScript, patchesOf, plainText, playScript, resolveRegistry, runOutcome, stepTime, stopPatches, textDeltas, thinkingDeltas, threadCounts, useChatSession, validate };
1516
+ export { ANSWER_INTENTS, ASK_INTENTS, type AccessModel, type AccessSpec, type AgentSpec, type AnalystTurn, type AnswerIntentId, type AnswerState, type AnswerTurn, type AskIntentId, type AskRegistry, type AskRenderer, type AskRendererProps, type AskTraits, type AskTurn, BUILT_IN_ASKS, BUILT_IN_ASK_TRAITS, BUILT_IN_BLOCKS, BUILT_IN_BLOCK_TRAITS, type BlockBase, type BlockRegistry, type BlockRenderer, type BlockRendererProps, type BlockSpec, type BlockTraits, ChatSession, ChatSessionActivityRow, ChatSessionActivitySubLine, type ChatSessionAnswerAction, type ChatSessionBuiltInAction, ChatSessionCaret, ChatSessionComposer, ChatSessionContextChip, type ChatSessionCustomAction, ChatSessionDisclosure, ChatSessionDisclosureCode, ChatSessionDisclosureSteps, type ChatSessionEventOf, ChatSessionFrame, type ChatSessionHandle, type ChatSessionHandlers, type ChatSessionIcons, ChatSessionMessage, ChatSessionMessageOptions, ChatSessionProgressLine, ChatSessionPromptRow, type ChatSessionProps, ChatSessionStatusBar, ChatSessionTaskGroup, ChatSessionTaskRow, ChatSessionTurn, type ChatSessionTurnProps, type ChatSessionVariant, type ChatSessionView, CitationMarker, ClarifyActions, type ClarifyAnswers, ClarifyCard, ClarifyCardGroup, type ClarifyCardGroupProps, ClarifyFootnote, type ClarifyGroupQuestion, type ComposerControl, type ComposerOption, type ComposerSpec, type ConversationEvent, type ConversationEventType, type ConversationPatch, type ConversationPatchOp, type ConversationSpec, DEFAULT_ANSWER_ACTIONS, type DeltaOptions, EVENT_TYPES, EmissionBody, EmissionCard, EmissionHeader, type Envelope, type Exchange, FLOWS, type FlowId, type GovernanceSpec, type Outcome, PATTERNS, type PatchChunk, PatchError, type PatchScript, type PatchSource, type PatternId, type RegistryOverrides, type ResolvedRegistry, type RunOutcome, STAGES, type ScriptStep, type StageId, TemplatePicker, type Turn, TurnLabel, type TurnLabelProps, type UseChatSession, type ValidateOptions, type ValidationIssue, answerTime, answerToPage, applyPatch, applyPatches, chatSessionGutterClass, clockTime, currentStep, dayLabel, elapsedSince, exchangesOf, formatDuration, fromEventSource, fromNdjson, isLive, isRunning, offsetScript, patchesOf, plainText, playScript, resolveRegistry, runOutcome, stepTime, stopPatches, textDeltas, thinkingDeltas, threadCounts, useChatSession, validate };
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import * as React from 'react';
2
2
  import { TraceStep, AnswerKind, Tone, AnswerOptionsByKind, ActionOption, AskState, AskSpec, AskKind, AskOptionsByKind, BlockPatch, PatchSource as PatchSource$1, PatchChunk as PatchChunk$1, PatchScript as PatchScript$1, ScriptStep as ScriptStep$1, EventSourceOptions, PlayOptions, PageSpec } from '@invana/blocks';
3
3
  export { ANSWER_KINDS, ASK_KINDS, ActionOption, AnswerKind, AnswerOptionsByKind, ApprovalOptions, AskKind, AskOptionsByKind, AskSpec, AskState, AskText, AskValueByKind, BLOCKS, BlockKind, BlockOptionsByKind, CannotOptions, CaveatNoteOptions, CaveatOptions, CaveatTone, Cell, ChoiceFigure, ChoiceOption, CitationSource, CitationsOptions, Column, ConfirmCard, ConfirmCardProps, ConfirmCost, ConfirmOptions, CostFigure, EntityOptions, EventSourceOptions, Figure, FileItem, ForkOptions, FormOptions, HypothesisOptions, InterpretationOptions, LongOptions, MethodOptions, MetricOptions, ModelSpecOptions, MultiOptions, MultistepOptions, NarrativeOptions, NumberOptions, PeriodOptions, Placeholder, PlaceholderProps, PlanOptions, PlayOptions, ProposalOptions, QuickOptions, QuickPick, RangeOptions, RecordRow, ScaleOptions, ScopeOptions, ScopePart, ShortOptions, SingleOptions, SuggestionChips, SuggestionChipsProps, SuggestionsOptions, Tone, TraceIoRow, TraceOptions, TraceStep, TypedValue, WeightsOptions, scriptLength } from '@invana/blocks';
4
4
  import * as _invana_ui from '@invana/ui';
5
- import { ChatSessionActivityRow as ChatSessionActivityRow$1, ChatSessionActivitySubLine as ChatSessionActivitySubLine$1, ChatSessionCaret as ChatSessionCaret$1, ChatSessionComposer as ChatSessionComposer$1, ChatSessionContextChip as ChatSessionContextChip$1, ChatSessionDisclosure as ChatSessionDisclosure$1, ChatSessionDisclosureCode as ChatSessionDisclosureCode$1, ChatSessionDisclosureSteps as ChatSessionDisclosureSteps$1, ChatSession as ChatSession$1, ChatSessionMessage as ChatSessionMessage$1, ChatSessionMessageOptions as ChatSessionMessageOptions$1, ChatSessionProgressLine as ChatSessionProgressLine$1, ChatSessionPromptRow as ChatSessionPromptRow$1, ChatSessionStatusBar as ChatSessionStatusBar$1, ChatSessionTaskGroup as ChatSessionTaskGroup$1, ChatSessionTaskRow as ChatSessionTaskRow$1 } from '@invana/ui';
6
- export { ChatSessionActivityRowProps, ChatSessionActivityStatus, ChatSessionActivitySubLineProps, ChatSessionComposerProps, ChatSessionContextChipProps, ChatSessionDisclosureProps, ChatSessionDisclosureStepsProps, ChatSessionProps as ChatSessionFrameProps, ChatSessionMessageAction, ChatSessionMessageOptionsProps, ChatSessionMessageProps, ChatSessionMessageRole, ChatSessionMessageStatus, ChatSessionProgressLineProps, ChatSessionPromptRowProps, ChatSessionStatusBarProps, ChatSessionTaskGroupProps, ChatSessionTaskRowProps, ChatSessionTaskStatus, ClarifyActionsProps, ClarifyCardProps, ClarifyFootnoteProps, ClarifyOption, ClarifyState, EmissionCardProps, EmissionHeaderProps, EmissionKind, TemplateOption, TemplatePickerProps } from '@invana/ui';
5
+ import { ChatSessionActivityRow as ChatSessionActivityRow$1, ChatSessionActivitySubLine as ChatSessionActivitySubLine$1, ChatSessionCaret as ChatSessionCaret$1, ChatSessionComposer as ChatSessionComposer$1, ChatSessionContextChip as ChatSessionContextChip$1, ChatSessionDisclosure as ChatSessionDisclosure$1, ChatSessionDisclosureCode as ChatSessionDisclosureCode$1, ChatSessionDisclosureSteps as ChatSessionDisclosureSteps$1, ChatSession as ChatSession$1, ChatSessionMessage as ChatSessionMessage$1, ChatSessionMessageOptions as ChatSessionMessageOptions$1, ChatSessionProgressLine as ChatSessionProgressLine$1, ChatSessionPromptRow as ChatSessionPromptRow$1, ChatSessionStatusBar as ChatSessionStatusBar$1, ChatSessionTaskGroup as ChatSessionTaskGroup$1, ChatSessionTaskRow as ChatSessionTaskRow$1, ClarifyState, ClarifyQuestion } from '@invana/ui';
6
+ export { ChatSessionActivityRowProps, ChatSessionActivityStatus, ChatSessionActivitySubLineProps, ChatSessionComposerProps, ChatSessionContextChipProps, ChatSessionDisclosureProps, ChatSessionDisclosureStepsProps, ChatSessionProps as ChatSessionFrameProps, ChatSessionMessageAction, ChatSessionMessageOptionsProps, ChatSessionMessageProps, ChatSessionMessageRole, ChatSessionMessageStatus, ChatSessionProgressLineProps, ChatSessionPromptRowProps, ChatSessionStatusBarProps, ChatSessionTaskGroupProps, ChatSessionTaskRowProps, ChatSessionTaskStatus, ClarifyActionsProps, ClarifyCardProps, ClarifyFootnoteProps, ClarifyOption, ClarifyQuestion, ClarifyState, EmissionCardProps, EmissionHeaderProps, EmissionKind, TemplateOption, TemplatePickerProps } from '@invana/ui';
7
7
 
8
8
  /**
9
9
  * Everything the analyst can do, as data. The component never acts on a
@@ -1419,6 +1419,54 @@ interface TurnLabelProps extends React.HTMLAttributes<HTMLDivElement> {
1419
1419
  */
1420
1420
  declare const TurnLabel: React.ForwardRefExoticComponent<TurnLabelProps & React.RefAttributes<HTMLDivElement>>;
1421
1421
 
1422
+ /** One question of the group — a `ClarifyQuestion` with the name its answer is keyed by. */
1423
+ interface ClarifyGroupQuestion extends ClarifyQuestion {
1424
+ /** The answer's key in `onSubmit` — `measure`. */
1425
+ name: string;
1426
+ /** The tab's label, a word or two — `Measure`. Falls back to `Q1`, `Q2`, … */
1427
+ title?: React.ReactNode;
1428
+ /** Submit waits for it. @default true */
1429
+ required?: boolean;
1430
+ }
1431
+ /** What was answered, keyed by question name: an option's value, or the words typed. */
1432
+ type ClarifyAnswers = Record<string, string>;
1433
+ interface ClarifyCardGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onSubmit" | "onSelect"> {
1434
+ /** @default "pending" */
1435
+ state?: ClarifyState;
1436
+ /** The title line's word. @default "questions" */
1437
+ kind?: React.ReactNode;
1438
+ /** Which step asked — `understand`. */
1439
+ step?: React.ReactNode;
1440
+ /** Two to four questions asked together, in order. */
1441
+ questions: ClarifyGroupQuestion[];
1442
+ /**
1443
+ * The answers. While pending, the ones already given — the group opens on
1444
+ * the first question still open. Settled, what was sent.
1445
+ */
1446
+ answers?: ClarifyAnswers;
1447
+ /** Every answer, once the required ones are in. */
1448
+ onSubmit?: (answers: ClarifyAnswers) => void;
1449
+ /** @default "Or type your own" */
1450
+ typePlaceholder?: string;
1451
+ /** Settled, the summary folds and opens to the questions with their answers. @default true */
1452
+ collapsible?: boolean;
1453
+ /** Settled only: open on first render. @default false */
1454
+ defaultOpen?: boolean;
1455
+ }
1456
+ /**
1457
+ * Several questions asked at once, one tab each.
1458
+ *
1459
+ * While pending, the tabs say which questions have an answer; picking an
1460
+ * option moves on to the next open one, and the words typed under the options
1461
+ * are an answer too. Submit sends them all together once the required ones
1462
+ * are in — one round, one wait, rather than a question per round.
1463
+ *
1464
+ * Settled, it is the inline `ClarifyCard` of the same questions: folded to
1465
+ * `Answered · 3 questions`, opening to each question with its answer chosen
1466
+ * and the options not taken dimmed.
1467
+ */
1468
+ declare const ClarifyCardGroup: React.ForwardRefExoticComponent<ClarifyCardGroupProps & React.RefAttributes<HTMLDivElement>>;
1469
+
1422
1470
  /** The ask, through its whole life: pending, answered, skipped, superseded, expired. */
1423
1471
  declare const ClarifyCard: React.ForwardRefExoticComponent<_invana_ui.ClarifyCardProps & React.RefAttributes<HTMLDivElement>>;
1424
1472
  /** The line under an ask: why these options, or where a default came from. */
@@ -1465,4 +1513,4 @@ interface ValidateOptions {
1465
1513
  }
1466
1514
  declare function validate(spec: ConversationSpec, options?: ValidateOptions): ValidationIssue[];
1467
1515
 
1468
- export { ANSWER_INTENTS, ASK_INTENTS, type AccessModel, type AccessSpec, type AgentSpec, type AnalystTurn, type AnswerIntentId, type AnswerState, type AnswerTurn, type AskIntentId, type AskRegistry, type AskRenderer, type AskRendererProps, type AskTraits, type AskTurn, BUILT_IN_ASKS, BUILT_IN_ASK_TRAITS, BUILT_IN_BLOCKS, BUILT_IN_BLOCK_TRAITS, type BlockBase, type BlockRegistry, type BlockRenderer, type BlockRendererProps, type BlockSpec, type BlockTraits, ChatSession, ChatSessionActivityRow, ChatSessionActivitySubLine, type ChatSessionAnswerAction, type ChatSessionBuiltInAction, ChatSessionCaret, ChatSessionComposer, ChatSessionContextChip, type ChatSessionCustomAction, ChatSessionDisclosure, ChatSessionDisclosureCode, ChatSessionDisclosureSteps, type ChatSessionEventOf, ChatSessionFrame, type ChatSessionHandle, type ChatSessionHandlers, type ChatSessionIcons, ChatSessionMessage, ChatSessionMessageOptions, ChatSessionProgressLine, ChatSessionPromptRow, type ChatSessionProps, ChatSessionStatusBar, ChatSessionTaskGroup, ChatSessionTaskRow, ChatSessionTurn, type ChatSessionTurnProps, type ChatSessionVariant, type ChatSessionView, CitationMarker, ClarifyActions, ClarifyCard, ClarifyFootnote, type ComposerControl, type ComposerOption, type ComposerSpec, type ConversationEvent, type ConversationEventType, type ConversationPatch, type ConversationPatchOp, type ConversationSpec, DEFAULT_ANSWER_ACTIONS, type DeltaOptions, EVENT_TYPES, EmissionBody, EmissionCard, EmissionHeader, type Envelope, type Exchange, FLOWS, type FlowId, type GovernanceSpec, type Outcome, PATTERNS, type PatchChunk, PatchError, type PatchScript, type PatchSource, type PatternId, type RegistryOverrides, type ResolvedRegistry, type RunOutcome, STAGES, type ScriptStep, type StageId, TemplatePicker, type Turn, TurnLabel, type TurnLabelProps, type UseChatSession, type ValidateOptions, type ValidationIssue, answerTime, answerToPage, applyPatch, applyPatches, chatSessionGutterClass, clockTime, currentStep, dayLabel, elapsedSince, exchangesOf, formatDuration, fromEventSource, fromNdjson, isLive, isRunning, offsetScript, patchesOf, plainText, playScript, resolveRegistry, runOutcome, stepTime, stopPatches, textDeltas, thinkingDeltas, threadCounts, useChatSession, validate };
1516
+ export { ANSWER_INTENTS, ASK_INTENTS, type AccessModel, type AccessSpec, type AgentSpec, type AnalystTurn, type AnswerIntentId, type AnswerState, type AnswerTurn, type AskIntentId, type AskRegistry, type AskRenderer, type AskRendererProps, type AskTraits, type AskTurn, BUILT_IN_ASKS, BUILT_IN_ASK_TRAITS, BUILT_IN_BLOCKS, BUILT_IN_BLOCK_TRAITS, type BlockBase, type BlockRegistry, type BlockRenderer, type BlockRendererProps, type BlockSpec, type BlockTraits, ChatSession, ChatSessionActivityRow, ChatSessionActivitySubLine, type ChatSessionAnswerAction, type ChatSessionBuiltInAction, ChatSessionCaret, ChatSessionComposer, ChatSessionContextChip, type ChatSessionCustomAction, ChatSessionDisclosure, ChatSessionDisclosureCode, ChatSessionDisclosureSteps, type ChatSessionEventOf, ChatSessionFrame, type ChatSessionHandle, type ChatSessionHandlers, type ChatSessionIcons, ChatSessionMessage, ChatSessionMessageOptions, ChatSessionProgressLine, ChatSessionPromptRow, type ChatSessionProps, ChatSessionStatusBar, ChatSessionTaskGroup, ChatSessionTaskRow, ChatSessionTurn, type ChatSessionTurnProps, type ChatSessionVariant, type ChatSessionView, CitationMarker, ClarifyActions, type ClarifyAnswers, ClarifyCard, ClarifyCardGroup, type ClarifyCardGroupProps, ClarifyFootnote, type ClarifyGroupQuestion, type ComposerControl, type ComposerOption, type ComposerSpec, type ConversationEvent, type ConversationEventType, type ConversationPatch, type ConversationPatchOp, type ConversationSpec, DEFAULT_ANSWER_ACTIONS, type DeltaOptions, EVENT_TYPES, EmissionBody, EmissionCard, EmissionHeader, type Envelope, type Exchange, FLOWS, type FlowId, type GovernanceSpec, type Outcome, PATTERNS, type PatchChunk, PatchError, type PatchScript, type PatchSource, type PatternId, type RegistryOverrides, type ResolvedRegistry, type RunOutcome, STAGES, type ScriptStep, type StageId, TemplatePicker, type Turn, TurnLabel, type TurnLabelProps, type UseChatSession, type ValidateOptions, type ValidationIssue, answerTime, answerToPage, applyPatch, applyPatches, chatSessionGutterClass, clockTime, currentStep, dayLabel, elapsedSince, exchangesOf, formatDuration, fromEventSource, fromNdjson, isLive, isRunning, offsetScript, patchesOf, plainText, playScript, resolveRegistry, runOutcome, stepTime, stopPatches, textDeltas, thinkingDeltas, threadCounts, useChatSession, validate };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import * as React6 from 'react';
1
+ import * as React7 from 'react';
2
2
  import { ANSWER_KINDS, BLOCK_RENDERERS, ASK_KINDS, useStreamedSpec, ScopeBlock, CitationsBlock, NarrativeBlock, Placeholder, ActionRow, SuggestionChips, patchesOf as patchesOf$1, fromNdjson as fromNdjson$1, fromEventSource as fromEventSource$1, playScript as playScript$1, offsetScript as offsetScript$1, applyBlockPatch, BlockPatchError } from '@invana/blocks';
3
3
  export { ANSWER_KINDS, ASK_KINDS, BLOCKS, ConfirmCard, Placeholder, SuggestionChips, scriptLength } from '@invana/blocks';
4
- import { cn, EmissionCard as EmissionCard$1, EmissionBody as EmissionBody$1, ChatSessionCaret as ChatSessionCaret$1, ChatSession as ChatSession$1, ChatSessionStatusBar as ChatSessionStatusBar$1, ChatSessionTaskGroup as ChatSessionTaskGroup$1, ChatSessionPromptRow as ChatSessionPromptRow$1, ChatSessionComposer as ChatSessionComposer$1, ChatSessionMessage as ChatSessionMessage$1, ChatSessionTaskRow as ChatSessionTaskRow$1, ChatSessionActivitySubLine as ChatSessionActivitySubLine$1, ChatSessionDisclosure as ChatSessionDisclosure$1, ChatSessionProgressLine as ChatSessionProgressLine$1, ChatSessionActivityRow as ChatSessionActivityRow$1, ClarifyCard as ClarifyCard$1, Eyebrow, PropertyList, PropertyRow, Skeleton, ChatSessionMessageOptions as ChatSessionMessageOptions$1, ChatSessionContextChip as ChatSessionContextChip$1, ChatSessionDisclosureCode as ChatSessionDisclosureCode$1, ChatSessionDisclosureSteps as ChatSessionDisclosureSteps$1, CitationMarker as CitationMarker$1, ClarifyActions as ClarifyActions$1, ClarifyFootnote as ClarifyFootnote$1, EmissionHeader as EmissionHeader$1, TemplatePicker as TemplatePicker$1, chatSessionGutterClass as chatSessionGutterClass$1 } from '@invana/ui';
4
+ import { ClarifyCard, NavItems, Questionnaire, QuestionnaireItem, QuestionnaireChoices, QuestionnaireChoice, QuestionnaireChoiceTitle, QuestionnaireChoiceDescription, QuestionnaireInput, Button, cn, EmissionCard as EmissionCard$1, EmissionBody as EmissionBody$1, ChatSessionCaret as ChatSessionCaret$1, ChatSession as ChatSession$1, ChatSessionStatusBar as ChatSessionStatusBar$1, ChatSessionTaskGroup as ChatSessionTaskGroup$1, ChatSessionPromptRow as ChatSessionPromptRow$1, ChatSessionComposer as ChatSessionComposer$1, ChatSessionMessage as ChatSessionMessage$1, ChatSessionTaskRow as ChatSessionTaskRow$1, ChatSessionActivitySubLine as ChatSessionActivitySubLine$1, ChatSessionDisclosure as ChatSessionDisclosure$1, ChatSessionProgressLine as ChatSessionProgressLine$1, ChatSessionActivityRow as ChatSessionActivityRow$1, Eyebrow, PropertyList, PropertyRow, Skeleton, ChatSessionMessageOptions as ChatSessionMessageOptions$1, ChatSessionContextChip as ChatSessionContextChip$1, ChatSessionDisclosureCode as ChatSessionDisclosureCode$1, ChatSessionDisclosureSteps as ChatSessionDisclosureSteps$1, CitationMarker as CitationMarker$1, ClarifyActions as ClarifyActions$1, ClarifyFootnote as ClarifyFootnote$1, EmissionHeader as EmissionHeader$1, TemplatePicker as TemplatePicker$1, chatSessionGutterClass as chatSessionGutterClass$1 } from '@invana/ui';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
6
  import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '@invana/forms';
7
7
 
@@ -48,7 +48,7 @@ function subscribe(listener) {
48
48
  return () => listeners.delete(listener);
49
49
  }
50
50
  function useCiteFocus(turn, initial) {
51
- const pointed = React6.useSyncExternalStore(
51
+ const pointed = React7.useSyncExternalStore(
52
52
  subscribe,
53
53
  () => focus.get(turn),
54
54
  () => void 0
@@ -85,6 +85,7 @@ function answerBlock(kind) {
85
85
  Renderer,
86
86
  {
87
87
  spec: block,
88
+ seamless: true,
88
89
  onAction: (action, value) => {
89
90
  const event = toEvent(turn.id, action, value, index);
90
91
  if (event) onEvent(event);
@@ -105,6 +106,7 @@ function askBlock(kind) {
105
106
  state: turn.state,
106
107
  value: turn.value,
107
108
  id: turn.id,
109
+ seamless: true,
108
110
  onAction: (action, value) => {
109
111
  const event = toEvent(turn.id, action, value, -1);
110
112
  if (event) onEvent(event);
@@ -367,9 +369,9 @@ function stopPatches(spec, now = Date.now()) {
367
369
  }
368
370
  return patches;
369
371
  }
370
- var ChatSessionContext = React6.createContext(null);
372
+ var ChatSessionContext = React7.createContext(null);
371
373
  function useChatSessionContext() {
372
- const value = React6.useContext(ChatSessionContext);
374
+ const value = React7.useContext(ChatSessionContext);
373
375
  if (!value) throw new Error("A ChatSession part was rendered outside <ChatSession>.");
374
376
  return value;
375
377
  }
@@ -385,32 +387,32 @@ var DEFAULT_ICONS = {
385
387
  rateDown: "\u22121"
386
388
  };
387
389
  function useViewState() {
388
- const [steps, setSteps] = React6.useState({});
389
- const [records, setRecords] = React6.useState({});
390
- const [ratings, setRatings] = React6.useState({});
391
- const stepsOpen = React6.useCallback((turnId, live) => steps[turnId] ?? live, [steps]);
392
- const toggleSteps = React6.useCallback(
390
+ const [steps, setSteps] = React7.useState({});
391
+ const [records, setRecords] = React7.useState({});
392
+ const [ratings, setRatings] = React7.useState({});
393
+ const stepsOpen = React7.useCallback((turnId, live) => steps[turnId] ?? live, [steps]);
394
+ const toggleSteps = React7.useCallback(
393
395
  (turnId, open) => setSteps((prev) => ({ ...prev, [turnId]: open ?? !(prev[turnId] ?? false) })),
394
396
  []
395
397
  );
396
- const recordOpen = React6.useCallback(
398
+ const recordOpen = React7.useCallback(
397
399
  (turnId, stepId) => !!records[`${turnId}/${stepId}`],
398
400
  [records]
399
401
  );
400
- const toggleRecord = React6.useCallback((turnId, stepId, open) => {
402
+ const toggleRecord = React7.useCallback((turnId, stepId, open) => {
401
403
  const key = `${turnId}/${stepId}`;
402
404
  setRecords((prev) => ({ ...prev, [key]: open ?? !prev[key] }));
403
405
  }, []);
404
- const rating = React6.useCallback((turnId) => ratings[turnId], [ratings]);
405
- const setRating = React6.useCallback(
406
+ const rating = React7.useCallback((turnId) => ratings[turnId], [ratings]);
407
+ const setRating = React7.useCallback(
406
408
  (turnId, value) => setRatings((prev) => ({ ...prev, [turnId]: value })),
407
409
  []
408
410
  );
409
411
  return { stepsOpen, toggleSteps, recordOpen, toggleRecord, rating, setRating };
410
412
  }
411
413
  function useClock(fixed, live, every = 250) {
412
- const [now, setNow] = React6.useState(() => fixed ?? Date.now());
413
- React6.useEffect(() => {
414
+ const [now, setNow] = React7.useState(() => fixed ?? Date.now());
415
+ React7.useEffect(() => {
414
416
  if (fixed !== void 0 || !live) return;
415
417
  const timer = setInterval(() => setNow(Date.now()), every);
416
418
  return () => clearInterval(timer);
@@ -633,7 +635,7 @@ function KeyHints({ running }) {
633
635
  ] });
634
636
  }
635
637
  function useStopKey(running, stop) {
636
- React6.useEffect(() => {
638
+ React7.useEffect(() => {
637
639
  if (!running) return;
638
640
  const onKey = (e) => {
639
641
  if (e.key !== "Escape" || e.defaultPrevented) return;
@@ -644,7 +646,175 @@ function useStopKey(running, stop) {
644
646
  return () => document.removeEventListener("keydown", onKey);
645
647
  }, [running, stop]);
646
648
  }
647
- var ClarifyCard = ClarifyCard$1;
649
+ function Answered(props) {
650
+ return /* @__PURE__ */ jsx(
651
+ "svg",
652
+ {
653
+ "aria-hidden": "true",
654
+ viewBox: "0 0 24 24",
655
+ fill: "none",
656
+ stroke: "currentColor",
657
+ strokeWidth: 2.5,
658
+ strokeLinecap: "round",
659
+ strokeLinejoin: "round",
660
+ ...props,
661
+ children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
662
+ }
663
+ );
664
+ }
665
+ var ClarifyCardGroup = React7.forwardRef(
666
+ ({
667
+ state = "pending",
668
+ kind = "questions",
669
+ step,
670
+ questions,
671
+ answers: given,
672
+ onSubmit,
673
+ typePlaceholder = "Or type your own",
674
+ collapsible = true,
675
+ defaultOpen = false,
676
+ className,
677
+ ...props
678
+ }, ref) => {
679
+ const settled = state !== "pending";
680
+ const [answers, setAnswers] = React7.useState(given ?? {});
681
+ const isAnswered = (q) => !!answers[q.name]?.trim();
682
+ const [active, setActive] = React7.useState(
683
+ () => (questions.find((q) => !given?.[q.name]) ?? questions[0])?.name ?? ""
684
+ );
685
+ if (settled) {
686
+ return /* @__PURE__ */ jsx(
687
+ ClarifyCard,
688
+ {
689
+ ref,
690
+ variant: "inline",
691
+ state,
692
+ kind,
693
+ step,
694
+ collapsible,
695
+ defaultOpen,
696
+ className,
697
+ questions: questions.map((q) => {
698
+ const a = given?.[q.name];
699
+ const picked = q.options?.some((o) => o.value === a);
700
+ return { ...q, value: picked ? a : void 0, answer: picked ? void 0 : a };
701
+ }),
702
+ ...props
703
+ }
704
+ );
705
+ }
706
+ const index = Math.max(
707
+ 0,
708
+ questions.findIndex((q) => q.name === active)
709
+ );
710
+ const current = questions[index];
711
+ const answeredCount = questions.filter(isAnswered).length;
712
+ const ready = questions.every((q) => q.required === false || isAnswered(q));
713
+ const last = index === questions.length - 1;
714
+ const answer = (name, value, advance) => {
715
+ const next = { ...answers, [name]: value };
716
+ setAnswers(next);
717
+ if (!advance) return;
718
+ const after = [...questions.slice(index + 1), ...questions.slice(0, index)];
719
+ const open = after.find((q) => !next[q.name]?.trim());
720
+ if (open) setActive(open.name);
721
+ };
722
+ const tabs = questions.map((q, i) => ({
723
+ key: q.name,
724
+ name: typeof q.title === "string" ? q.title : `Question ${i + 1}`,
725
+ label: q.title ?? `Q${i + 1}`,
726
+ icon: isAnswered(q) ? Answered : void 0,
727
+ iconClassName: "size-3 text-primary"
728
+ }));
729
+ const typed = current ? !current.options?.some((o) => o.value === answers[current.name]) : false;
730
+ return /* @__PURE__ */ jsxs(
731
+ "div",
732
+ {
733
+ ref,
734
+ "data-state": state,
735
+ className: cn("flex min-w-0 flex-col gap-2", className),
736
+ ...props,
737
+ children: [
738
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [
739
+ /* @__PURE__ */ jsx("span", { className: "shrink-0 font-medium first-letter:uppercase", children: kind }),
740
+ /* @__PURE__ */ jsxs("span", { className: "min-w-0 truncate text-muted-foreground first-letter:uppercase", children: [
741
+ step != null ? /* @__PURE__ */ jsxs(Fragment, { children: [
742
+ step,
743
+ " \xB7 "
744
+ ] }) : null,
745
+ answeredCount,
746
+ " of ",
747
+ questions.length,
748
+ " answered"
749
+ ] })
750
+ ] }),
751
+ /* @__PURE__ */ jsx(
752
+ NavItems,
753
+ {
754
+ items: tabs,
755
+ selectionMode: "tabs",
756
+ variant: "underline",
757
+ overflow: true,
758
+ activeKey: current?.name,
759
+ onActiveChange: setActive,
760
+ className: "border-b border-border"
761
+ }
762
+ ),
763
+ current ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
764
+ current.question != null ? /* @__PURE__ */ jsx("p", { className: "font-medium", children: current.question }) : null,
765
+ /* @__PURE__ */ jsx(Questionnaire, { onSubmit: (e) => e.preventDefault(), children: /* @__PURE__ */ jsxs(QuestionnaireItem, { name: current.name, children: [
766
+ current.options?.length ? /* @__PURE__ */ jsx(QuestionnaireChoices, { children: current.options.map((o) => {
767
+ const checked = answers[current.name] === o.value;
768
+ return /* @__PURE__ */ jsxs(
769
+ QuestionnaireChoice,
770
+ {
771
+ value: o.value,
772
+ detail: o.detail,
773
+ disabled: o.disabled,
774
+ checked,
775
+ onChange: () => answer(current.name, o.value, true),
776
+ className: "border-transparent",
777
+ children: [
778
+ /* @__PURE__ */ jsx(QuestionnaireChoiceTitle, { children: o.label }),
779
+ o.description != null ? /* @__PURE__ */ jsx(QuestionnaireChoiceDescription, { children: o.description }) : null
780
+ ]
781
+ },
782
+ o.value
783
+ );
784
+ }) }) : null,
785
+ /* @__PURE__ */ jsx(
786
+ QuestionnaireInput,
787
+ {
788
+ "aria-label": `${typeof current.title === "string" ? current.title : "Answer"} \u2014 your own words`,
789
+ placeholder: current.options?.length ? typePlaceholder : "Type your answer",
790
+ value: typed ? answers[current.name] ?? "" : "",
791
+ onChange: (e) => answer(current.name, e.currentTarget.value, false)
792
+ }
793
+ )
794
+ ] }) })
795
+ ] }) : null,
796
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
797
+ /* @__PURE__ */ jsx(
798
+ Button,
799
+ {
800
+ size: "xs",
801
+ variant: "ghost",
802
+ disabled: index === 0,
803
+ onClick: () => setActive(questions[index - 1]?.name ?? active),
804
+ children: "Back"
805
+ }
806
+ ),
807
+ /* @__PURE__ */ jsx("span", { className: "flex-1" }),
808
+ !last ? /* @__PURE__ */ jsx(Button, { size: "xs", variant: "outline", onClick: () => setActive(questions[index + 1]?.name ?? active), children: "Next" }) : null,
809
+ /* @__PURE__ */ jsx(Button, { size: "xs", disabled: !ready, onClick: () => onSubmit?.(answers), children: "Submit" })
810
+ ] })
811
+ ]
812
+ }
813
+ );
814
+ }
815
+ );
816
+ ClarifyCardGroup.displayName = "ClarifyCardGroup";
817
+ var ClarifyCard2 = ClarifyCard;
648
818
  var ClarifyFootnote = ClarifyFootnote$1;
649
819
  var ClarifyActions = ClarifyActions$1;
650
820
 
@@ -792,7 +962,7 @@ function AskView({ turn, registry, onEvent, now }) {
792
962
  }
793
963
  const time = turn.state === "answered" && turn.answeredAt ? relativeTime(turn.answeredAt, now) : void 0;
794
964
  return /* @__PURE__ */ jsx(
795
- ClarifyCard,
965
+ ClarifyCard2,
796
966
  {
797
967
  state: turn.state,
798
968
  kind: traits.kind,
@@ -998,15 +1168,15 @@ function ComposerBar({ isRunning: isRunning2, onStop }) {
998
1168
  const { spec, emit, icons, setComposer } = useChatSessionContext();
999
1169
  const composer = spec.composer;
1000
1170
  const controls = composer?.controls ?? [];
1001
- const [draft, setDraft] = React6.useState("");
1002
- const [files, setFiles] = React6.useState([]);
1003
- const [picks, setPicks] = React6.useState({});
1171
+ const [draft, setDraft] = React7.useState("");
1172
+ const [files, setFiles] = React7.useState([]);
1173
+ const [picks, setPicks] = React7.useState({});
1004
1174
  const settings = initialSettings(composer);
1005
1175
  for (const c of controls) {
1006
1176
  const pick = picks[c.id];
1007
1177
  if (pick !== void 0 && c.options.some((o) => o.value === pick)) settings[c.id] = pick;
1008
1178
  }
1009
- const fileInput = React6.useRef(null);
1179
+ const fileInput = React7.useRef(null);
1010
1180
  const picked = controls.map((c) => c.options.find((o) => o.value === settings[c.id])).filter(Boolean);
1011
1181
  const placeholder = picked.find((o) => o?.placeholder)?.placeholder ?? composer?.placeholder;
1012
1182
  const mono = picked.some((o) => o?.mono);
@@ -1387,7 +1557,7 @@ function CliSession({ running, onStop, header, onClose, emptyState, className })
1387
1557
 
1388
1558
  // src/styles/types.ts
1389
1559
  var DEFAULT_ANSWER_ACTIONS = ["retry", "copy", "steps", "rate"];
1390
- var TurnLabel = React6.forwardRef(
1560
+ var TurnLabel = React7.forwardRef(
1391
1561
  ({ align = "start", className, children, ...props }, ref) => /* @__PURE__ */ jsx(
1392
1562
  "div",
1393
1563
  {
@@ -1520,7 +1690,7 @@ function WebSession({ running, onStop, header, onClose, emptyState, className })
1520
1690
  ] });
1521
1691
  }
1522
1692
  var handlerName = (type) => `on${type.replace(/(^|-)([a-z])/g, (_, __, c) => c.toUpperCase())}`;
1523
- var ChatSession = React6.forwardRef(function ChatSession2(props, ref) {
1693
+ var ChatSession = React7.forwardRef(function ChatSession2(props, ref) {
1524
1694
  const {
1525
1695
  spec,
1526
1696
  variant = "web",
@@ -1545,49 +1715,49 @@ var ChatSession = React6.forwardRef(function ChatSession2(props, ref) {
1545
1715
  });
1546
1716
  const running = live.turns.some((t) => isAnswer(t) && runOutcome(t) === "live");
1547
1717
  const now = useClock(fixedNow, running);
1548
- const resolved = React6.useMemo(() => resolveRegistry(registry), [registry]);
1549
- const resolvedIcons = React6.useMemo(() => ({ ...DEFAULT_ICONS, ...icons }), [icons]);
1718
+ const resolved = React7.useMemo(() => resolveRegistry(registry), [registry]);
1719
+ const resolvedIcons = React7.useMemo(() => ({ ...DEFAULT_ICONS, ...icons }), [icons]);
1550
1720
  const viewState = useViewState();
1551
- const [uncontrolledView, setUncontrolledView] = React6.useState(defaultView);
1721
+ const [uncontrolledView, setUncontrolledView] = React7.useState(defaultView);
1552
1722
  const view = controlledView ?? uncontrolledView;
1553
- const root = React6.useRef(null);
1554
- const composer = React6.useRef(null);
1555
- const setComposer = React6.useCallback((element) => {
1723
+ const root = React7.useRef(null);
1724
+ const composer = React7.useRef(null);
1725
+ const setComposer = React7.useCallback((element) => {
1556
1726
  composer.current = element;
1557
1727
  }, []);
1558
- const latest = React6.useRef(props);
1559
- const liveRef = React6.useRef(live);
1560
- React6.useLayoutEffect(() => {
1728
+ const latest = React7.useRef(props);
1729
+ const liveRef = React7.useRef(live);
1730
+ React7.useLayoutEffect(() => {
1561
1731
  latest.current = props;
1562
1732
  liveRef.current = live;
1563
1733
  });
1564
- const emit = React6.useCallback((event) => {
1734
+ const emit = React7.useCallback((event) => {
1565
1735
  const handler = latest.current[handlerName(event.type)];
1566
1736
  if (typeof handler === "function") handler(event);
1567
1737
  latest.current.onEvent?.(event);
1568
1738
  }, []);
1569
- const stop = React6.useCallback(() => {
1739
+ const stop = React7.useCallback(() => {
1570
1740
  stopStream();
1571
1741
  emit({ type: "stop" });
1572
1742
  }, [stopStream, emit]);
1573
1743
  useStopKey(running, stop);
1574
- const setView = React6.useCallback(
1744
+ const setView = React7.useCallback(
1575
1745
  (next) => {
1576
1746
  if (latest.current.view === void 0) setUncontrolledView(next);
1577
1747
  latest.current.onViewChange?.(next);
1578
1748
  },
1579
1749
  []
1580
1750
  );
1581
- const scrollToTurn = React6.useCallback((turnId) => {
1751
+ const scrollToTurn = React7.useCallback((turnId) => {
1582
1752
  setTimeout(() => {
1583
1753
  const id = turnDomId(liveRef.current, turnId);
1584
1754
  root.current?.querySelector(`[id="${CSS.escape(id)}"]`)?.scrollIntoView({ block: "start", behavior: "smooth" });
1585
1755
  }, 80);
1586
1756
  }, []);
1587
- const focusComposer = React6.useCallback(() => {
1757
+ const focusComposer = React7.useCallback(() => {
1588
1758
  composer.current?.querySelector("textarea")?.focus();
1589
1759
  }, []);
1590
- React6.useImperativeHandle(
1760
+ React7.useImperativeHandle(
1591
1761
  ref,
1592
1762
  () => ({
1593
1763
  scrollToTurn,
@@ -1637,19 +1807,19 @@ var ChatSession = React6.forwardRef(function ChatSession2(props, ref) {
1637
1807
  return /* @__PURE__ */ jsx(ChatSessionContext.Provider, { value: context, children: /* @__PURE__ */ jsx("div", { ref: root, "data-variant": variant, className: "contents", children: variant === "cli" ? /* @__PURE__ */ jsx(CliSession, { ...shared }) : /* @__PURE__ */ jsx(WebSession, { ...shared }) }) });
1638
1808
  });
1639
1809
  function useChatSession(initial) {
1640
- const [spec, setSpec] = React6.useState(initial);
1641
- const current = React6.useRef(spec);
1642
- const controllers = React6.useRef(/* @__PURE__ */ new Set());
1643
- const [streams, setStreams] = React6.useState(0);
1644
- const set2 = React6.useCallback((next) => {
1810
+ const [spec, setSpec] = React7.useState(initial);
1811
+ const current = React7.useRef(spec);
1812
+ const controllers = React7.useRef(/* @__PURE__ */ new Set());
1813
+ const [streams, setStreams] = React7.useState(0);
1814
+ const set2 = React7.useCallback((next) => {
1645
1815
  current.current = next;
1646
1816
  setSpec(next);
1647
1817
  }, []);
1648
- const apply = React6.useCallback(
1818
+ const apply = React7.useCallback(
1649
1819
  (patch) => set2(applyPatches(current.current, Array.isArray(patch) ? patch : [patch])),
1650
1820
  [set2]
1651
1821
  );
1652
- const run = React6.useCallback(
1822
+ const run = React7.useCallback(
1653
1823
  async (open) => {
1654
1824
  const controller = new AbortController();
1655
1825
  controllers.current.add(controller);
@@ -1667,8 +1837,8 @@ function useChatSession(initial) {
1667
1837
  },
1668
1838
  [set2]
1669
1839
  );
1670
- const stream = React6.useCallback((source) => run(() => source), [run]);
1671
- const play = React6.useCallback(
1840
+ const stream = React7.useCallback((source) => run(() => source), [run]);
1841
+ const play = React7.useCallback(
1672
1842
  (script, options) => run((signal) => playScript(script, { ...options, signal })),
1673
1843
  [run]
1674
1844
  );
@@ -1676,25 +1846,25 @@ function useChatSession(initial) {
1676
1846
  for (const c of controllers.current) c.abort();
1677
1847
  controllers.current.clear();
1678
1848
  };
1679
- const stop = React6.useCallback(() => {
1849
+ const stop = React7.useCallback(() => {
1680
1850
  abortAll();
1681
1851
  set2(applyPatches(current.current, stopPatches(current.current)));
1682
1852
  }, [set2]);
1683
- const reset = React6.useCallback(
1853
+ const reset = React7.useCallback(
1684
1854
  (next) => {
1685
1855
  abortAll();
1686
1856
  set2(next);
1687
1857
  },
1688
1858
  [set2]
1689
1859
  );
1690
- React6.useEffect(() => () => abortAll(), []);
1860
+ React7.useEffect(() => () => abortAll(), []);
1691
1861
  return { spec, apply, stream, play, stop, reset, streaming: streams > 0, running: isRunning(spec) };
1692
1862
  }
1693
1863
  function ChatSessionTurn({ turn, onEvent, registry, now }) {
1694
- const resolved = React6.useMemo(() => resolveRegistry(registry), [registry]);
1864
+ const resolved = React7.useMemo(() => resolveRegistry(registry), [registry]);
1695
1865
  const view = useViewState();
1696
- const [clock] = React6.useState(() => now ?? Date.now());
1697
- const emit = React6.useCallback((event) => onEvent?.(event), [onEvent]);
1866
+ const [clock] = React7.useState(() => now ?? Date.now());
1867
+ const emit = React7.useCallback((event) => onEvent?.(event), [onEvent]);
1698
1868
  const context = {
1699
1869
  spec: { id: `turn-${turn.id}`, turns: [turn] },
1700
1870
  registry: resolved,
@@ -1887,6 +2057,6 @@ function validate(spec, options = {}) {
1887
2057
  return issues;
1888
2058
  }
1889
2059
 
1890
- export { ANSWER_INTENTS, ASK_INTENTS, BUILT_IN_ASKS, BUILT_IN_ASK_TRAITS, BUILT_IN_BLOCKS, BUILT_IN_BLOCK_TRAITS, ChatSession, ChatSessionActivityRow, ChatSessionActivitySubLine, ChatSessionCaret, ChatSessionComposer, ChatSessionContextChip, ChatSessionDisclosure, ChatSessionDisclosureCode, ChatSessionDisclosureSteps, ChatSessionFrame, ChatSessionMessage, ChatSessionMessageOptions, ChatSessionProgressLine, ChatSessionPromptRow, ChatSessionStatusBar, ChatSessionTaskGroup, ChatSessionTaskRow, ChatSessionTurn, CitationMarker, ClarifyActions, ClarifyCard, ClarifyFootnote, DEFAULT_ANSWER_ACTIONS, EVENT_TYPES, EmissionBody, EmissionCard, EmissionHeader, FLOWS, PATTERNS, PatchError, STAGES, TemplatePicker, TurnLabel, answerTime, answerToPage, applyPatch, applyPatches, chatSessionGutterClass, clockTime, currentStep, dayLabel, elapsedSince, exchangesOf, formatDuration, fromEventSource, fromNdjson, isLive, isRunning, offsetScript, patchesOf, plainText, playScript, resolveRegistry, runOutcome, stepTime, stopPatches, textDeltas, thinkingDeltas, threadCounts, useChatSession, validate };
2060
+ export { ANSWER_INTENTS, ASK_INTENTS, BUILT_IN_ASKS, BUILT_IN_ASK_TRAITS, BUILT_IN_BLOCKS, BUILT_IN_BLOCK_TRAITS, ChatSession, ChatSessionActivityRow, ChatSessionActivitySubLine, ChatSessionCaret, ChatSessionComposer, ChatSessionContextChip, ChatSessionDisclosure, ChatSessionDisclosureCode, ChatSessionDisclosureSteps, ChatSessionFrame, ChatSessionMessage, ChatSessionMessageOptions, ChatSessionProgressLine, ChatSessionPromptRow, ChatSessionStatusBar, ChatSessionTaskGroup, ChatSessionTaskRow, ChatSessionTurn, CitationMarker, ClarifyActions, ClarifyCard2 as ClarifyCard, ClarifyCardGroup, ClarifyFootnote, DEFAULT_ANSWER_ACTIONS, EVENT_TYPES, EmissionBody, EmissionCard, EmissionHeader, FLOWS, PATTERNS, PatchError, STAGES, TemplatePicker, TurnLabel, answerTime, answerToPage, applyPatch, applyPatches, chatSessionGutterClass, clockTime, currentStep, dayLabel, elapsedSince, exchangesOf, formatDuration, fromEventSource, fromNdjson, isLive, isRunning, offsetScript, patchesOf, plainText, playScript, resolveRegistry, runOutcome, stepTime, stopPatches, textDeltas, thinkingDeltas, threadCounts, useChatSession, validate };
1891
2061
  //# sourceMappingURL=index.js.map
1892
2062
  //# sourceMappingURL=index.js.map