@invana/assistant 0.0.34 → 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
@@ -369,9 +369,9 @@ function stopPatches(spec, now = Date.now()) {
369
369
  }
370
370
  return patches;
371
371
  }
372
- var ChatSessionContext = React6.createContext(null);
372
+ var ChatSessionContext = React7.createContext(null);
373
373
  function useChatSessionContext() {
374
- const value = React6.useContext(ChatSessionContext);
374
+ const value = React7.useContext(ChatSessionContext);
375
375
  if (!value) throw new Error("A ChatSession part was rendered outside <ChatSession>.");
376
376
  return value;
377
377
  }
@@ -387,32 +387,32 @@ var DEFAULT_ICONS = {
387
387
  rateDown: "\u22121"
388
388
  };
389
389
  function useViewState() {
390
- const [steps, setSteps] = React6.useState({});
391
- const [records, setRecords] = React6.useState({});
392
- const [ratings, setRatings] = React6.useState({});
393
- const stepsOpen = React6.useCallback((turnId, live) => steps[turnId] ?? live, [steps]);
394
- 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(
395
395
  (turnId, open) => setSteps((prev) => ({ ...prev, [turnId]: open ?? !(prev[turnId] ?? false) })),
396
396
  []
397
397
  );
398
- const recordOpen = React6.useCallback(
398
+ const recordOpen = React7.useCallback(
399
399
  (turnId, stepId) => !!records[`${turnId}/${stepId}`],
400
400
  [records]
401
401
  );
402
- const toggleRecord = React6.useCallback((turnId, stepId, open) => {
402
+ const toggleRecord = React7.useCallback((turnId, stepId, open) => {
403
403
  const key = `${turnId}/${stepId}`;
404
404
  setRecords((prev) => ({ ...prev, [key]: open ?? !prev[key] }));
405
405
  }, []);
406
- const rating = React6.useCallback((turnId) => ratings[turnId], [ratings]);
407
- const setRating = React6.useCallback(
406
+ const rating = React7.useCallback((turnId) => ratings[turnId], [ratings]);
407
+ const setRating = React7.useCallback(
408
408
  (turnId, value) => setRatings((prev) => ({ ...prev, [turnId]: value })),
409
409
  []
410
410
  );
411
411
  return { stepsOpen, toggleSteps, recordOpen, toggleRecord, rating, setRating };
412
412
  }
413
413
  function useClock(fixed, live, every = 250) {
414
- const [now, setNow] = React6.useState(() => fixed ?? Date.now());
415
- React6.useEffect(() => {
414
+ const [now, setNow] = React7.useState(() => fixed ?? Date.now());
415
+ React7.useEffect(() => {
416
416
  if (fixed !== void 0 || !live) return;
417
417
  const timer = setInterval(() => setNow(Date.now()), every);
418
418
  return () => clearInterval(timer);
@@ -635,7 +635,7 @@ function KeyHints({ running }) {
635
635
  ] });
636
636
  }
637
637
  function useStopKey(running, stop) {
638
- React6.useEffect(() => {
638
+ React7.useEffect(() => {
639
639
  if (!running) return;
640
640
  const onKey = (e) => {
641
641
  if (e.key !== "Escape" || e.defaultPrevented) return;
@@ -646,7 +646,175 @@ function useStopKey(running, stop) {
646
646
  return () => document.removeEventListener("keydown", onKey);
647
647
  }, [running, stop]);
648
648
  }
649
- 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;
650
818
  var ClarifyFootnote = ClarifyFootnote$1;
651
819
  var ClarifyActions = ClarifyActions$1;
652
820
 
@@ -794,7 +962,7 @@ function AskView({ turn, registry, onEvent, now }) {
794
962
  }
795
963
  const time = turn.state === "answered" && turn.answeredAt ? relativeTime(turn.answeredAt, now) : void 0;
796
964
  return /* @__PURE__ */ jsx(
797
- ClarifyCard,
965
+ ClarifyCard2,
798
966
  {
799
967
  state: turn.state,
800
968
  kind: traits.kind,
@@ -1000,15 +1168,15 @@ function ComposerBar({ isRunning: isRunning2, onStop }) {
1000
1168
  const { spec, emit, icons, setComposer } = useChatSessionContext();
1001
1169
  const composer = spec.composer;
1002
1170
  const controls = composer?.controls ?? [];
1003
- const [draft, setDraft] = React6.useState("");
1004
- const [files, setFiles] = React6.useState([]);
1005
- const [picks, setPicks] = React6.useState({});
1171
+ const [draft, setDraft] = React7.useState("");
1172
+ const [files, setFiles] = React7.useState([]);
1173
+ const [picks, setPicks] = React7.useState({});
1006
1174
  const settings = initialSettings(composer);
1007
1175
  for (const c of controls) {
1008
1176
  const pick = picks[c.id];
1009
1177
  if (pick !== void 0 && c.options.some((o) => o.value === pick)) settings[c.id] = pick;
1010
1178
  }
1011
- const fileInput = React6.useRef(null);
1179
+ const fileInput = React7.useRef(null);
1012
1180
  const picked = controls.map((c) => c.options.find((o) => o.value === settings[c.id])).filter(Boolean);
1013
1181
  const placeholder = picked.find((o) => o?.placeholder)?.placeholder ?? composer?.placeholder;
1014
1182
  const mono = picked.some((o) => o?.mono);
@@ -1389,7 +1557,7 @@ function CliSession({ running, onStop, header, onClose, emptyState, className })
1389
1557
 
1390
1558
  // src/styles/types.ts
1391
1559
  var DEFAULT_ANSWER_ACTIONS = ["retry", "copy", "steps", "rate"];
1392
- var TurnLabel = React6.forwardRef(
1560
+ var TurnLabel = React7.forwardRef(
1393
1561
  ({ align = "start", className, children, ...props }, ref) => /* @__PURE__ */ jsx(
1394
1562
  "div",
1395
1563
  {
@@ -1522,7 +1690,7 @@ function WebSession({ running, onStop, header, onClose, emptyState, className })
1522
1690
  ] });
1523
1691
  }
1524
1692
  var handlerName = (type) => `on${type.replace(/(^|-)([a-z])/g, (_, __, c) => c.toUpperCase())}`;
1525
- var ChatSession = React6.forwardRef(function ChatSession2(props, ref) {
1693
+ var ChatSession = React7.forwardRef(function ChatSession2(props, ref) {
1526
1694
  const {
1527
1695
  spec,
1528
1696
  variant = "web",
@@ -1547,49 +1715,49 @@ var ChatSession = React6.forwardRef(function ChatSession2(props, ref) {
1547
1715
  });
1548
1716
  const running = live.turns.some((t) => isAnswer(t) && runOutcome(t) === "live");
1549
1717
  const now = useClock(fixedNow, running);
1550
- const resolved = React6.useMemo(() => resolveRegistry(registry), [registry]);
1551
- 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]);
1552
1720
  const viewState = useViewState();
1553
- const [uncontrolledView, setUncontrolledView] = React6.useState(defaultView);
1721
+ const [uncontrolledView, setUncontrolledView] = React7.useState(defaultView);
1554
1722
  const view = controlledView ?? uncontrolledView;
1555
- const root = React6.useRef(null);
1556
- const composer = React6.useRef(null);
1557
- const setComposer = React6.useCallback((element) => {
1723
+ const root = React7.useRef(null);
1724
+ const composer = React7.useRef(null);
1725
+ const setComposer = React7.useCallback((element) => {
1558
1726
  composer.current = element;
1559
1727
  }, []);
1560
- const latest = React6.useRef(props);
1561
- const liveRef = React6.useRef(live);
1562
- React6.useLayoutEffect(() => {
1728
+ const latest = React7.useRef(props);
1729
+ const liveRef = React7.useRef(live);
1730
+ React7.useLayoutEffect(() => {
1563
1731
  latest.current = props;
1564
1732
  liveRef.current = live;
1565
1733
  });
1566
- const emit = React6.useCallback((event) => {
1734
+ const emit = React7.useCallback((event) => {
1567
1735
  const handler = latest.current[handlerName(event.type)];
1568
1736
  if (typeof handler === "function") handler(event);
1569
1737
  latest.current.onEvent?.(event);
1570
1738
  }, []);
1571
- const stop = React6.useCallback(() => {
1739
+ const stop = React7.useCallback(() => {
1572
1740
  stopStream();
1573
1741
  emit({ type: "stop" });
1574
1742
  }, [stopStream, emit]);
1575
1743
  useStopKey(running, stop);
1576
- const setView = React6.useCallback(
1744
+ const setView = React7.useCallback(
1577
1745
  (next) => {
1578
1746
  if (latest.current.view === void 0) setUncontrolledView(next);
1579
1747
  latest.current.onViewChange?.(next);
1580
1748
  },
1581
1749
  []
1582
1750
  );
1583
- const scrollToTurn = React6.useCallback((turnId) => {
1751
+ const scrollToTurn = React7.useCallback((turnId) => {
1584
1752
  setTimeout(() => {
1585
1753
  const id = turnDomId(liveRef.current, turnId);
1586
1754
  root.current?.querySelector(`[id="${CSS.escape(id)}"]`)?.scrollIntoView({ block: "start", behavior: "smooth" });
1587
1755
  }, 80);
1588
1756
  }, []);
1589
- const focusComposer = React6.useCallback(() => {
1757
+ const focusComposer = React7.useCallback(() => {
1590
1758
  composer.current?.querySelector("textarea")?.focus();
1591
1759
  }, []);
1592
- React6.useImperativeHandle(
1760
+ React7.useImperativeHandle(
1593
1761
  ref,
1594
1762
  () => ({
1595
1763
  scrollToTurn,
@@ -1639,19 +1807,19 @@ var ChatSession = React6.forwardRef(function ChatSession2(props, ref) {
1639
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 }) }) });
1640
1808
  });
1641
1809
  function useChatSession(initial) {
1642
- const [spec, setSpec] = React6.useState(initial);
1643
- const current = React6.useRef(spec);
1644
- const controllers = React6.useRef(/* @__PURE__ */ new Set());
1645
- const [streams, setStreams] = React6.useState(0);
1646
- 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) => {
1647
1815
  current.current = next;
1648
1816
  setSpec(next);
1649
1817
  }, []);
1650
- const apply = React6.useCallback(
1818
+ const apply = React7.useCallback(
1651
1819
  (patch) => set2(applyPatches(current.current, Array.isArray(patch) ? patch : [patch])),
1652
1820
  [set2]
1653
1821
  );
1654
- const run = React6.useCallback(
1822
+ const run = React7.useCallback(
1655
1823
  async (open) => {
1656
1824
  const controller = new AbortController();
1657
1825
  controllers.current.add(controller);
@@ -1669,8 +1837,8 @@ function useChatSession(initial) {
1669
1837
  },
1670
1838
  [set2]
1671
1839
  );
1672
- const stream = React6.useCallback((source) => run(() => source), [run]);
1673
- const play = React6.useCallback(
1840
+ const stream = React7.useCallback((source) => run(() => source), [run]);
1841
+ const play = React7.useCallback(
1674
1842
  (script, options) => run((signal) => playScript(script, { ...options, signal })),
1675
1843
  [run]
1676
1844
  );
@@ -1678,25 +1846,25 @@ function useChatSession(initial) {
1678
1846
  for (const c of controllers.current) c.abort();
1679
1847
  controllers.current.clear();
1680
1848
  };
1681
- const stop = React6.useCallback(() => {
1849
+ const stop = React7.useCallback(() => {
1682
1850
  abortAll();
1683
1851
  set2(applyPatches(current.current, stopPatches(current.current)));
1684
1852
  }, [set2]);
1685
- const reset = React6.useCallback(
1853
+ const reset = React7.useCallback(
1686
1854
  (next) => {
1687
1855
  abortAll();
1688
1856
  set2(next);
1689
1857
  },
1690
1858
  [set2]
1691
1859
  );
1692
- React6.useEffect(() => () => abortAll(), []);
1860
+ React7.useEffect(() => () => abortAll(), []);
1693
1861
  return { spec, apply, stream, play, stop, reset, streaming: streams > 0, running: isRunning(spec) };
1694
1862
  }
1695
1863
  function ChatSessionTurn({ turn, onEvent, registry, now }) {
1696
- const resolved = React6.useMemo(() => resolveRegistry(registry), [registry]);
1864
+ const resolved = React7.useMemo(() => resolveRegistry(registry), [registry]);
1697
1865
  const view = useViewState();
1698
- const [clock] = React6.useState(() => now ?? Date.now());
1699
- 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]);
1700
1868
  const context = {
1701
1869
  spec: { id: `turn-${turn.id}`, turns: [turn] },
1702
1870
  registry: resolved,
@@ -1889,6 +2057,6 @@ function validate(spec, options = {}) {
1889
2057
  return issues;
1890
2058
  }
1891
2059
 
1892
- 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 };
1893
2061
  //# sourceMappingURL=index.js.map
1894
2062
  //# sourceMappingURL=index.js.map