@teaflask/assistant 0.6.0 → 0.7.1
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/README.md +1 -1
- package/custom-elements.json +264 -0
- package/dist/affordances/aria-dropdowns.js +315 -0
- package/dist/affordances/aria-toggles.js +39 -0
- package/dist/affordances/dropdown-display.js +129 -0
- package/dist/affordances/page-gestures.js +91 -0
- package/dist/affordances/prefill-reasons.js +75 -0
- package/dist/affordances/prefill.js +113 -62
- package/dist/appearance/theme.d.ts +138 -0
- package/dist/components/approval-card.js +3 -3
- package/dist/components/approval-context.d.ts +20 -0
- package/dist/components/assistant-companion.d.ts +15 -0
- package/dist/components/assistant-page.d.ts +61 -0
- package/dist/components/assistant-palette.d.ts +12 -0
- package/dist/components/assistant-palette.js +2 -2
- package/dist/components/child-transcript.js +1 -1
- package/dist/components/companion-header-disclosure.js +1 -1
- package/dist/components/companion-history-menu.js +1 -1
- package/dist/components/composer.js +11 -65
- package/dist/components/conversation-context.d.ts +6 -0
- package/dist/components/conversation-gate-card.js +1 -1
- package/dist/components/conversation-view.d.ts +11 -0
- package/dist/components/elicitation-context.d.ts +39 -0
- package/dist/components/model-picker-chip.js +4 -2
- package/dist/components/primitives/button.js +25 -17
- package/dist/components/primitives/floating-panel.js +1 -1
- package/dist/components/provider-chip.js +8 -1
- package/dist/components/question-panel-footer.js +1 -1
- package/dist/components/react-tool-view.d.ts +7 -0
- package/dist/components/subagent-count-pill.js +2 -2
- package/dist/components/subagent-group-row.js +1 -26
- package/dist/components/subagent-preview-popover.js +1 -1
- package/dist/components/subscription-connect-arms.js +6 -4
- package/dist/components/subscription-connect-flow.js +30 -45
- package/dist/components/subscription-connected-standing.js +9 -6
- package/dist/components/subscription-plan-notice.js +4 -2
- package/dist/components/teaflask-assistant-provider.d.ts +99 -0
- package/dist/components/teaflask-assistant.d.ts +33 -0
- package/dist/components/tool-views/action-view.js +1 -1
- package/dist/components/tool-views/parts-classes.d.ts +5 -5
- package/dist/components/tool-views/parts-classes.js +5 -5
- package/dist/components/tool-views/parts.d.ts +44 -0
- package/dist/components/tool-views/questions-view.js +2 -2
- package/dist/components/tool-views/view-dom.d.ts +76 -0
- package/dist/components/transcript.js +2 -2
- package/dist/components/use-assistant-activity.d.ts +5 -0
- package/dist/components/use-assistant-conversation.d.ts +99 -2
- package/dist/components/use-store-cell.d.ts +5 -0
- package/dist/components/use-thread-dispatches.js +8 -366
- package/dist/components/use-transcript-folds.js +2 -1
- package/dist/components/use-transcript.d.ts +55 -2
- package/dist/components/use-transcript.js +7 -2
- package/dist/contract/actions-adapter.d.ts +78 -0
- package/dist/contract/errors.d.ts +6 -1
- package/dist/contract/events.d.ts +1 -3
- package/dist/contract/identity.d.ts +1 -1
- package/dist/contract/subscriptions.d.ts +2 -2
- package/dist/contract/subscriptions.js +1 -1
- package/dist/contract/telemetry.d.ts +45 -0
- package/dist/contract/threads.d.ts +5 -1
- package/dist/core/activity.d.ts +44 -0
- package/dist/core/approval-inbox.d.ts +69 -0
- package/dist/core/assistant-session-registry.js +15 -0
- package/dist/core/composer-attachments.js +82 -0
- package/dist/core/composer-input-state.js +1 -0
- package/dist/core/composer-policy.d.ts +20 -0
- package/dist/core/connection-epoch.d.ts +65 -2
- package/dist/core/conversation-adoption.js +3 -0
- package/dist/core/conversation-contract.d.ts +112 -1
- package/dist/core/conversation-publish.js +1 -0
- package/dist/core/conversation-store.d.ts +3 -0
- package/dist/core/conversation-store.js +7 -0
- package/dist/core/dispatch-poll.js +81 -0
- package/dist/core/elicitation-answers.js +12 -0
- package/dist/core/elicitation-cards.d.ts +14 -0
- package/dist/core/elicitation-pickers.d.ts +16 -0
- package/dist/core/execution-handlers.js +3 -3
- package/dist/core/memory-provenance-anchors.d.ts +16 -0
- package/dist/core/observable-cell.d.ts +12 -0
- package/dist/core/pending-decision-gap.d.ts +9 -0
- package/dist/core/question-drafts.d.ts +59 -0
- package/dist/core/receipt-anchors.d.ts +9 -0
- package/dist/core/segment-timing.d.ts +23 -0
- package/dist/core/subagent-delivery-anchors.d.ts +7 -0
- package/dist/core/subagent-ledger-join.js +176 -0
- package/dist/core/subagent-rows.d.ts +68 -0
- package/dist/core/thread-dispatch-ledger.js +303 -0
- package/dist/core/tool-call-display.d.ts +71 -0
- package/dist/core/tool-call-presentation.d.ts +34 -1
- package/dist/core/tool-call-presentation.js +0 -1
- package/dist/core/tool-schema-anchors.d.ts +6 -0
- package/dist/core/tool-view.d.ts +174 -1
- package/dist/core/transcript-rows.d.ts +138 -3
- package/dist/core/turn-failed-anchors.d.ts +4 -0
- package/dist/core/user-turn-ledger.d.ts +3 -0
- package/dist/generated/models/apiErrorCode.d.ts +1 -0
- package/dist/generated/models/apiErrorCode.js +1 -0
- package/dist/generated/models/assistantTurnStatus.d.ts +16 -0
- package/dist/generated/models/servingAssistantThreadResponse.d.ts +23 -0
- package/dist/generated/models/servingAttachmentResponse.d.ts +29 -0
- package/dist/generated/models/servingErrorCode.d.ts +18 -0
- package/dist/generated/models/servingTurnAttachmentResponse.d.ts +12 -0
- package/dist/generated/models/siteTheme.d.ts +1 -0
- package/dist/generated/models/thinkingEffort.d.ts +10 -0
- package/dist/generated/models/threadModelPickResponse.d.ts +12 -0
- package/dist/headless.d.ts +9 -4
- package/dist/index.d.ts +2 -6
- package/dist/index.js +0 -3
- package/dist/persistence/stored-thread.d.ts +5 -0
- package/dist/reader/render.js +7 -4
- package/dist/reader/roles.js +28 -1
- package/dist/reader/snapshot-node.js +2 -29
- package/dist/reader/snapshot-root.js +14 -8
- package/dist/reader/snapshot.js +6 -1
- package/dist/styles.css +1 -1
- package/dist/transport/serving-error.d.ts +21 -0
- package/package.json +6 -25
- package/dist/affordances/highlight.d.ts +0 -3
- package/dist/affordances/prefill.d.ts +0 -14
- package/dist/components/activity-rail.d.ts +0 -12
- package/dist/components/activity-shelf.d.ts +0 -7
- package/dist/components/agent-identity-mark.d.ts +0 -7
- package/dist/components/appearance-context.d.ts +0 -14
- package/dist/components/approval-card.d.ts +0 -7
- package/dist/components/assistant-palette-body.d.ts +0 -3
- package/dist/components/assistant-transcript.d.ts +0 -47
- package/dist/components/attachment-chips.d.ts +0 -4
- package/dist/components/child-transcript.d.ts +0 -22
- package/dist/components/companion-drawer-body.d.ts +0 -1
- package/dist/components/companion-drawer.d.ts +0 -10
- package/dist/components/companion-header-disclosure.d.ts +0 -20
- package/dist/components/companion-history-menu.d.ts +0 -15
- package/dist/components/companion-mark-image.d.ts +0 -3
- package/dist/components/companion-mark-image.js +0 -18
- package/dist/components/companion-mark.d.ts +0 -1
- package/dist/components/companion-mode-menu.d.ts +0 -15
- package/dist/components/composer-attachment-chip.d.ts +0 -7
- package/dist/components/composer-banner.d.ts +0 -4
- package/dist/components/composer.d.ts +0 -4
- package/dist/components/conversation-gate-card.d.ts +0 -8
- package/dist/components/conversation-surfaces-provider.d.ts +0 -6
- package/dist/components/copy-text-button.d.ts +0 -5
- package/dist/components/elicitation-receipt-row.d.ts +0 -4
- package/dist/components/human-file-size.d.ts +0 -1
- package/dist/components/icons.d.ts +0 -15
- package/dist/components/lazy-body.d.ts +0 -4
- package/dist/components/markdown/assistant-markdown.d.ts +0 -3
- package/dist/components/markdown/code-block.d.ts +0 -4
- package/dist/components/markdown/highlight.d.ts +0 -1
- package/dist/components/markdown/markdown-structure.d.ts +0 -16
- package/dist/components/markdown/memoized-blocks.d.ts +0 -6
- package/dist/components/markdown/paced-assistant-markdown.d.ts +0 -4
- package/dist/components/markdown/reveal-pacer.d.ts +0 -20
- package/dist/components/markdown/shiki-highlighter.d.ts +0 -1
- package/dist/components/markdown/streaming-repair.d.ts +0 -1
- package/dist/components/markdown/use-highlighted-html.d.ts +0 -1
- package/dist/components/markdown/use-paced-reveal.d.ts +0 -5
- package/dist/components/memory-updated-footer.d.ts +0 -4
- package/dist/components/message-list-row.d.ts +0 -13
- package/dist/components/message-list-slots.d.ts +0 -25
- package/dist/components/message-list-slots.js +0 -1
- package/dist/components/message-list.d.ts +0 -23
- package/dist/components/model-picker-chip.d.ts +0 -1
- package/dist/components/model-picker-effort.d.ts +0 -4
- package/dist/components/model-picker-panels.d.ts +0 -22
- package/dist/components/notice-banner.d.ts +0 -8
- package/dist/components/operation-icons.d.ts +0 -19
- package/dist/components/pretty-print.d.ts +0 -1
- package/dist/components/primitives/autofocus.d.ts +0 -1
- package/dist/components/primitives/button.d.ts +0 -10
- package/dist/components/primitives/cx.d.ts +0 -1
- package/dist/components/primitives/dialog.d.ts +0 -7
- package/dist/components/primitives/disclosure.d.ts +0 -22
- package/dist/components/primitives/file-input.d.ts +0 -5
- package/dist/components/primitives/floating-panel.d.ts +0 -15
- package/dist/components/primitives/kbd.d.ts +0 -2
- package/dist/components/primitives/sheet.d.ts +0 -11
- package/dist/components/primitives/sheet.js +0 -18
- package/dist/components/primitives/textarea.d.ts +0 -7
- package/dist/components/primitives/use-dock-reflow.d.ts +0 -2
- package/dist/components/primitives/use-swipe-dismiss.d.ts +0 -17
- package/dist/components/provider-chip.d.ts +0 -8
- package/dist/components/question-panel-answers.d.ts +0 -29
- package/dist/components/question-panel-footer.d.ts +0 -9
- package/dist/components/question-panel.d.ts +0 -4
- package/dist/components/reasoning-row.d.ts +0 -4
- package/dist/components/receipt-rows.d.ts +0 -3
- package/dist/components/run-status-announcer.d.ts +0 -5
- package/dist/components/scroll-follow-guards.d.ts +0 -1
- package/dist/components/served-suggestions.d.ts +0 -3
- package/dist/components/slot-boundary.d.ts +0 -11
- package/dist/components/standing-poll.d.ts +0 -1
- package/dist/components/streaming-states.d.ts +0 -12
- package/dist/components/subagent-count-pill.d.ts +0 -8
- package/dist/components/subagent-current-work.d.ts +0 -6
- package/dist/components/subagent-delegation-surface.d.ts +0 -9
- package/dist/components/subagent-delivery-divider.d.ts +0 -5
- package/dist/components/subagent-drill-in.d.ts +0 -8
- package/dist/components/subagent-execution-work.d.ts +0 -3
- package/dist/components/subagent-group-row.d.ts +0 -26
- package/dist/components/subagent-preview-popover.d.ts +0 -8
- package/dist/components/subscription-connect-arms.d.ts +0 -25
- package/dist/components/subscription-connect-flow.d.ts +0 -60
- package/dist/components/subscription-connected-standing.d.ts +0 -16
- package/dist/components/subscription-plan-notice.d.ts +0 -1
- package/dist/components/subscription-recheck.d.ts +0 -10
- package/dist/components/surface-boundary.d.ts +0 -8
- package/dist/components/suspension-surfaces.d.ts +0 -3
- package/dist/components/thread-list.d.ts +0 -16
- package/dist/components/tool-arguments-summary.d.ts +0 -2
- package/dist/components/tool-call-rows.d.ts +0 -10
- package/dist/components/tool-row.d.ts +0 -7
- package/dist/components/tool-view-registry-context.d.ts +0 -3
- package/dist/components/tool-view-slot.d.ts +0 -11
- package/dist/components/tool-views/action-view.d.ts +0 -1
- package/dist/components/tool-views/command-view.d.ts +0 -1
- package/dist/components/tool-views/docs-search-view.d.ts +0 -10
- package/dist/components/tool-views/file-edit-view.d.ts +0 -1
- package/dist/components/tool-views/questions-view.d.ts +0 -1
- package/dist/components/transcript.d.ts +0 -3
- package/dist/components/use-agent-subscriber.d.ts +0 -3
- package/dist/components/use-agent-subscriber.js +0 -13
- package/dist/components/use-answer-list-fold.d.ts +0 -6
- package/dist/components/use-assistant-surface-presence.d.ts +0 -2
- package/dist/components/use-child-replay-stream.d.ts +0 -20
- package/dist/components/use-latest-ref.d.ts +0 -2
- package/dist/components/use-member-toggle-outrank.d.ts +0 -6
- package/dist/components/use-perch-clearance.d.ts +0 -2
- package/dist/components/use-question-panel-keys.d.ts +0 -32
- package/dist/components/use-register-assistant-surface.d.ts +0 -2
- package/dist/components/use-resolved-theme-mode.d.ts +0 -3
- package/dist/components/use-roster-disclosure.d.ts +0 -20
- package/dist/components/use-roster-preview.d.ts +0 -24
- package/dist/components/use-thread-dispatches.d.ts +0 -8
- package/dist/components/use-transcript-folds.d.ts +0 -26
- package/dist/components/user-message.d.ts +0 -6
- package/dist/contract/actions-adapter.js +0 -1
- package/dist/contract/assistant-config.js +0 -1
- package/dist/contract/dispatches.d.ts +0 -15
- package/dist/contract/errors.js +0 -1
- package/dist/contract/identity.js +0 -1
- package/dist/core/activity-title.d.ts +0 -1
- package/dist/core/agent-identity.d.ts +0 -2
- package/dist/core/approval-decision.d.ts +0 -6
- package/dist/core/approval-resolved.d.ts +0 -7
- package/dist/core/assistant-prose.d.ts +0 -2
- package/dist/core/assistant-session-registry.d.ts +0 -51
- package/dist/core/attachment-uploads.d.ts +0 -5
- package/dist/core/block-timing-anchors.d.ts +0 -5
- package/dist/core/companion-drawer-flag.d.ts +0 -4
- package/dist/core/companion-presence.d.ts +0 -7
- package/dist/core/composer-input-state.d.ts +0 -8
- package/dist/core/connection-driver.d.ts +0 -3
- package/dist/core/conversation-adoption.d.ts +0 -13
- package/dist/core/conversation-contract.js +0 -1
- package/dist/core/conversation-publish.d.ts +0 -8
- package/dist/core/conversation-refresh.d.ts +0 -4
- package/dist/core/conversation-send.d.ts +0 -6
- package/dist/core/disposable-subscriber.d.ts +0 -6
- package/dist/core/disposable-subscriber.js +0 -18
- package/dist/core/dock-reflow.d.ts +0 -5
- package/dist/core/elicitation-answers.d.ts +0 -7
- package/dist/core/epoch-sync.d.ts +0 -12
- package/dist/core/error-copy.d.ts +0 -3
- package/dist/core/execution-driver.d.ts +0 -37
- package/dist/core/host-fill.d.ts +0 -1
- package/dist/core/hotkey.d.ts +0 -18
- package/dist/core/identity-pair.d.ts +0 -14
- package/dist/core/idle-recheck.d.ts +0 -3
- package/dist/core/messages-cell.d.ts +0 -11
- package/dist/core/perch-clearance.d.ts +0 -19
- package/dist/core/question-receipt.d.ts +0 -11
- package/dist/core/reasoning-copy.d.ts +0 -2
- package/dist/core/run-folds.d.ts +0 -43
- package/dist/core/run-status.d.ts +0 -4
- package/dist/core/settle-refresh.d.ts +0 -9
- package/dist/core/step-caption.d.ts +0 -2
- package/dist/core/stop-copy.d.ts +0 -1
- package/dist/core/stop-settle.d.ts +0 -5
- package/dist/core/stream-trouble.d.ts +0 -5
- package/dist/core/subagent-brief.d.ts +0 -3
- package/dist/core/subagent-presence.d.ts +0 -10
- package/dist/core/subagent-roster.d.ts +0 -35
- package/dist/core/surface-registry.d.ts +0 -16
- package/dist/core/suspension-queue.d.ts +0 -14
- package/dist/core/tail-slot-pool.d.ts +0 -13
- package/dist/core/time-labels.d.ts +0 -7
- package/dist/core/tool-call-display-anchors.d.ts +0 -11
- package/dist/core/tool-cancel-anchors.d.ts +0 -5
- package/dist/core/tool-decision-anchors.d.ts +0 -6
- package/dist/core/tool-error-anchors.d.ts +0 -5
- package/dist/core/tool-flag-anchors.d.ts +0 -9
- package/dist/core/tool-offload-anchors.d.ts +0 -5
- package/dist/core/tool-outcome.d.ts +0 -9
- package/dist/core/tool-refusal-anchors.d.ts +0 -5
- package/dist/core/tool-result-envelope.d.ts +0 -3
- package/dist/core/tool-sentence-anchors.d.ts +0 -11
- package/dist/core/transcript-lease.d.ts +0 -2
- package/dist/core/turn-failure-copy.d.ts +0 -4
- package/dist/core/turns-backfill.d.ts +0 -14
- package/dist/core/wire-sentence-cap.d.ts +0 -1
- package/dist/generated/serving.d.ts +0 -38
- package/dist/markdown.d.ts +0 -4
- package/dist/markdown.js +0 -4
- package/dist/persistence/execution-ledger.d.ts +0 -7
- package/dist/persistence/panel-mode.d.ts +0 -6
- package/dist/persistence/plan-notice.d.ts +0 -3
- package/dist/reader/accessible-name.d.ts +0 -3
- package/dist/reader/interactivity.d.ts +0 -11
- package/dist/reader/layout-probe.d.ts +0 -29
- package/dist/reader/line-diff.d.ts +0 -1
- package/dist/reader/read-page.d.ts +0 -12
- package/dist/reader/redaction.d.ts +0 -3
- package/dist/reader/render.d.ts +0 -3
- package/dist/reader/roles.d.ts +0 -8
- package/dist/reader/snapshot-compaction.d.ts +0 -5
- package/dist/reader/snapshot-node.d.ts +0 -4
- package/dist/reader/snapshot-root.d.ts +0 -15
- package/dist/reader/snapshot.d.ts +0 -60
- package/dist/reader/visibility.d.ts +0 -8
- package/dist/scroll.d.ts +0 -1
- package/dist/scroll.js +0 -1
- package/dist/transcript-ui.d.ts +0 -15
- package/dist/transcript-ui.js +0 -8
- package/dist/transcript.d.ts +0 -43
- package/dist/transcript.js +0 -38
- package/dist/transport/actions-adapter.d.ts +0 -4
- package/dist/transport/door-budget.d.ts +0 -4
- package/dist/transport/serving-api.d.ts +0 -33
- package/dist/transport/serving-fetch.d.ts +0 -11
|
@@ -1,11 +1,44 @@
|
|
|
1
1
|
import { type AssistantCompanionProps } from "./assistant-companion.js";
|
|
2
2
|
import { type TeaflaskAssistantProviderProps } from "./teaflask-assistant-provider.js";
|
|
3
|
+
/**
|
|
4
|
+
* The imperative handle you get through a ref on `TeaflaskAssistant`. It exists
|
|
5
|
+
* only while the component is mounted.
|
|
6
|
+
*/
|
|
3
7
|
export interface TeaflaskAssistantHandle {
|
|
8
|
+
/**
|
|
9
|
+
* Opens the ⌘K palette even when the hotkey is disabled or rebound. The
|
|
10
|
+
* corner widget hides while the palette is open. Call it as
|
|
11
|
+
* `ref.current?.openPalette()`.
|
|
12
|
+
*/
|
|
4
13
|
openPalette: () => void;
|
|
5
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* The props `TeaflaskAssistant` adds on top of the provider's, for the palette
|
|
17
|
+
* hotkey and the widget's corner.
|
|
18
|
+
*/
|
|
6
19
|
export interface TeaflaskAssistantRootProps {
|
|
20
|
+
/**
|
|
21
|
+
* The keyboard shortcut that toggles the palette. It defaults to `"mod+k"`,
|
|
22
|
+
* where mod is ⌘ on macOS and Ctrl elsewhere, and takes the same syntax for
|
|
23
|
+
* other keys (`"mod+j"`, `"ctrl+shift+p"`). Pass `false` to disable it. An
|
|
24
|
+
* unrecognized value also disables it, with a console warning, and a key
|
|
25
|
+
* press your own handler calls `preventDefault()` on is ignored.
|
|
26
|
+
*/
|
|
7
27
|
hotkey?: string | false;
|
|
28
|
+
/**
|
|
29
|
+
* The screen corner where the widget and its drawer sit. The default is
|
|
30
|
+
* `"bottom-right"`.
|
|
31
|
+
*/
|
|
8
32
|
corner?: AssistantCompanionProps["corner"];
|
|
9
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Props for `TeaflaskAssistant`, which are all the provider props plus `hotkey`
|
|
36
|
+
* and `corner`.
|
|
37
|
+
*/
|
|
10
38
|
export type TeaflaskAssistantProps = TeaflaskAssistantProviderProps & TeaflaskAssistantRootProps;
|
|
39
|
+
/**
|
|
40
|
+
* The all-in-one assistant. It contains the provider plus the corner widget
|
|
41
|
+
* (which opens the chat drawer) and the ⌘K palette, so mount it once in the
|
|
42
|
+
* layout that wraps every page. Pass a ref to get a `TeaflaskAssistantHandle`.
|
|
43
|
+
*/
|
|
11
44
|
export declare const TeaflaskAssistant: import("react").ForwardRefExoticComponent<TeaflaskAssistantProps & import("react").RefAttributes<TeaflaskAssistantHandle>>;
|
|
@@ -6,7 +6,7 @@ const REQUEST_SECTIONS = [
|
|
|
6
6
|
["query", "Query"],
|
|
7
7
|
["body", "Body"],
|
|
8
8
|
];
|
|
9
|
-
const VALUE_PANE_CLASS = "tf:m-0 tf:whitespace-pre-wrap tf:font-mono tf:text-xs tf:text-tf-foreground";
|
|
9
|
+
const VALUE_PANE_CLASS = "tf:m-0 tf:whitespace-pre-wrap tf:font-mono tf:text-xs tf:text-tf-card-foreground";
|
|
10
10
|
export const actionToolView = statelessToolView(_renderAction);
|
|
11
11
|
function _renderAction({ call }) {
|
|
12
12
|
const root = el("div", "tf:flex tf:flex-col tf:gap-2");
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export declare const CARD_CLASS = "tf:overflow-hidden tf:rounded-lg tf:border tf:border-tf-border tf:bg-tf-card";
|
|
1
|
+
export declare const CARD_CLASS = "tf:overflow-hidden tf:rounded-lg tf:border tf:border-tf-border tf:bg-tf-card tf:text-tf-card-foreground";
|
|
2
2
|
export declare const CARD_TITLE_CLASS = "tf:mb-1 tf:text-tf-label tf:font-medium tf:text-tf-foreground";
|
|
3
3
|
export declare const ROW_CLASS = "tf:flex tf:min-w-0 tf:items-center tf:gap-2.5 tf:border-t tf:border-tf-border tf:px-2.5 tf:py-1.5 tf:first:border-t-0";
|
|
4
|
-
export declare const ROW_LINK_CLASS = "tf:no-underline tf:hover:bg-tf-accent";
|
|
4
|
+
export declare const ROW_LINK_CLASS = "tf:group/row tf:text-inherit tf:no-underline tf:hover:bg-tf-accent";
|
|
5
5
|
export declare const ROW_ICON_CLASS = "tf:flex tf:size-6 tf:shrink-0 tf:items-center tf:justify-center tf:rounded-[5px] tf:bg-tf-muted tf:text-tf-muted-foreground";
|
|
6
6
|
export declare const ROW_TEXT_CLASS = "tf:flex tf:min-w-0 tf:flex-1 tf:flex-col tf:leading-[1.35]";
|
|
7
|
-
export declare const ROW_TITLE_CLASS = "tf:truncate tf:text-tf-label tf:font-medium tf:text-tf-foreground";
|
|
7
|
+
export declare const ROW_TITLE_CLASS = "tf:truncate tf:text-tf-label tf:font-medium tf:text-tf-card-foreground tf:group-hover/row:text-tf-accent-foreground";
|
|
8
8
|
export declare const ROW_SECONDARY_CLASS = "tf:truncate tf:text-xs tf:text-tf-muted-foreground";
|
|
9
9
|
export declare const ROW_TRAIL_CLASS = "tf:ms-auto tf:flex tf:shrink-0 tf:items-center tf:gap-2";
|
|
10
|
-
export declare const BADGE_CLASS = "tf:inline-flex tf:shrink-0 tf:items-center tf:rounded-[3px] tf:border tf:border-tf-border tf:px-1.5 tf:py-px tf:text-[11px] tf:leading-4 tf:font-medium tf:text-tf-foreground";
|
|
10
|
+
export declare const BADGE_CLASS = "tf:inline-flex tf:shrink-0 tf:items-center tf:rounded-[3px] tf:border tf:border-tf-border tf:px-1.5 tf:py-px tf:text-[11px] tf:leading-4 tf:font-medium tf:text-tf-card-foreground tf:group-hover/row:text-tf-accent-foreground";
|
|
11
11
|
export declare const FACT_LIST_CLASS = "tf:m-0 tf:border-t tf:border-tf-border tf:first:border-t-0";
|
|
12
12
|
export declare const FACT_ROW_CLASS = "tf:grid tf:grid-cols-[minmax(6rem,30%)_minmax(0,1fr)] tf:gap-x-3 tf:border-t tf:border-tf-border tf:px-2.5 tf:py-1.5 tf:first:border-t-0";
|
|
13
13
|
export declare const FACT_LABEL_CLASS = "tf:min-w-0 tf:text-xs tf:text-tf-muted-foreground tf:wrap-anywhere";
|
|
14
|
-
export declare const FACT_VALUE_CLASS = "tf:m-0 tf:min-w-0 tf:text-xs tf:text-tf-foreground tf:wrap-anywhere";
|
|
14
|
+
export declare const FACT_VALUE_CLASS = "tf:m-0 tf:min-w-0 tf:text-xs tf:text-tf-card-foreground tf:wrap-anywhere";
|
|
15
15
|
export declare const CAPTION_ROW_CLASS = "tf:flex tf:items-center tf:justify-between tf:gap-3 tf:border-t tf:border-tf-border tf:px-2.5 tf:py-1.5 tf:text-xs tf:text-tf-muted-foreground tf:first:border-t-0";
|
|
16
16
|
export declare const CARD_BLOCK_CLASS = "tf:border-t tf:border-tf-border tf:px-2.5 tf:py-2 tf:first:border-t-0";
|
|
17
17
|
export declare const BODY_REGION_CLASS = "tf:max-h-72 tf:overflow-auto tf:border-t tf:border-tf-border tf:px-2.5 tf:py-2 tf:first:border-t-0";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export const CARD_CLASS = "tf:overflow-hidden tf:rounded-lg tf:border tf:border-tf-border tf:bg-tf-card";
|
|
1
|
+
export const CARD_CLASS = "tf:overflow-hidden tf:rounded-lg tf:border tf:border-tf-border tf:bg-tf-card tf:text-tf-card-foreground";
|
|
2
2
|
export const CARD_TITLE_CLASS = "tf:mb-1 tf:text-tf-label tf:font-medium tf:text-tf-foreground";
|
|
3
3
|
export const ROW_CLASS = "tf:flex tf:min-w-0 tf:items-center tf:gap-2.5 tf:border-t tf:border-tf-border tf:px-2.5 tf:py-1.5 tf:first:border-t-0";
|
|
4
|
-
export const ROW_LINK_CLASS = "tf:no-underline tf:hover:bg-tf-accent";
|
|
4
|
+
export const ROW_LINK_CLASS = "tf:group/row tf:text-inherit tf:no-underline tf:hover:bg-tf-accent";
|
|
5
5
|
export const ROW_ICON_CLASS = "tf:flex tf:size-6 tf:shrink-0 tf:items-center tf:justify-center tf:rounded-[5px] tf:bg-tf-muted tf:text-tf-muted-foreground";
|
|
6
6
|
export const ROW_TEXT_CLASS = "tf:flex tf:min-w-0 tf:flex-1 tf:flex-col tf:leading-[1.35]";
|
|
7
|
-
export const ROW_TITLE_CLASS = "tf:truncate tf:text-tf-label tf:font-medium tf:text-tf-foreground";
|
|
7
|
+
export const ROW_TITLE_CLASS = "tf:truncate tf:text-tf-label tf:font-medium tf:text-tf-card-foreground tf:group-hover/row:text-tf-accent-foreground";
|
|
8
8
|
export const ROW_SECONDARY_CLASS = "tf:truncate tf:text-xs tf:text-tf-muted-foreground";
|
|
9
9
|
export const ROW_TRAIL_CLASS = "tf:ms-auto tf:flex tf:shrink-0 tf:items-center tf:gap-2";
|
|
10
|
-
export const BADGE_CLASS = "tf:inline-flex tf:shrink-0 tf:items-center tf:rounded-[3px] tf:border tf:border-tf-border tf:px-1.5 tf:py-px tf:text-[11px] tf:leading-4 tf:font-medium tf:text-tf-foreground";
|
|
10
|
+
export const BADGE_CLASS = "tf:inline-flex tf:shrink-0 tf:items-center tf:rounded-[3px] tf:border tf:border-tf-border tf:px-1.5 tf:py-px tf:text-[11px] tf:leading-4 tf:font-medium tf:text-tf-card-foreground tf:group-hover/row:text-tf-accent-foreground";
|
|
11
11
|
export const FACT_LIST_CLASS = "tf:m-0 tf:border-t tf:border-tf-border tf:first:border-t-0";
|
|
12
12
|
export const FACT_ROW_CLASS = "tf:grid tf:grid-cols-[minmax(6rem,30%)_minmax(0,1fr)] tf:gap-x-3 tf:border-t tf:border-tf-border tf:px-2.5 tf:py-1.5 tf:first:border-t-0";
|
|
13
13
|
export const FACT_LABEL_CLASS = "tf:min-w-0 tf:text-xs tf:text-tf-muted-foreground tf:wrap-anywhere";
|
|
14
|
-
export const FACT_VALUE_CLASS = "tf:m-0 tf:min-w-0 tf:text-xs tf:text-tf-foreground tf:wrap-anywhere";
|
|
14
|
+
export const FACT_VALUE_CLASS = "tf:m-0 tf:min-w-0 tf:text-xs tf:text-tf-card-foreground tf:wrap-anywhere";
|
|
15
15
|
export const CAPTION_ROW_CLASS = "tf:flex tf:items-center tf:justify-between tf:gap-3 tf:border-t tf:border-tf-border tf:px-2.5 tf:py-1.5 tf:text-xs tf:text-tf-muted-foreground tf:first:border-t-0";
|
|
16
16
|
export const CARD_BLOCK_CLASS = "tf:border-t tf:border-tf-border tf:px-2.5 tf:py-2 tf:first:border-t-0";
|
|
17
17
|
export const BODY_REGION_CLASS = `tf:max-h-72 tf:overflow-auto ${CARD_BLOCK_CLASS}`;
|
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The small label shown above a card. Use it on its own above ToolViewBones,
|
|
4
|
+
* which draw no card.
|
|
5
|
+
*/
|
|
2
6
|
export declare function ToolViewTitle({ children }: {
|
|
3
7
|
children: ReactNode;
|
|
4
8
|
}): import("react").JSX.Element;
|
|
9
|
+
/**
|
|
10
|
+
* A bordered card holding rows, facts, captions or a body, with an optional
|
|
11
|
+
* small `title` above it; the base container for a tool view built from these
|
|
12
|
+
* parts, so it matches the assistant's built-in views.
|
|
13
|
+
*/
|
|
5
14
|
export declare function ToolViewCard({ title, children, ...rest }: {
|
|
6
15
|
title?: string;
|
|
7
16
|
children: ReactNode;
|
|
8
17
|
} & Record<`data-${string}`, string | number | undefined>): import("react").JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* A list row with an optional icon tile, a title, a muted second line and
|
|
20
|
+
* trailing content such as a ToolViewBadge. With `href` the row is a plain link
|
|
21
|
+
* that navigates the whole page, since a view can't reach your app's router.
|
|
22
|
+
*/
|
|
9
23
|
export declare function ToolViewRow({ icon, title, secondary, trailing, href, ...rest }: {
|
|
10
24
|
icon?: ReactNode;
|
|
11
25
|
title: ReactNode;
|
|
@@ -13,29 +27,59 @@ export declare function ToolViewRow({ icon, title, secondary, trailing, href, ..
|
|
|
13
27
|
trailing?: ReactNode;
|
|
14
28
|
href?: string;
|
|
15
29
|
} & Record<`data-${string}`, string | number | undefined>): import("react").JSX.Element;
|
|
30
|
+
/**
|
|
31
|
+
* Label and value rows, in the order given, for showing a record's properties.
|
|
32
|
+
*/
|
|
16
33
|
export declare function ToolViewFacts({ facts, ...rest }: {
|
|
17
34
|
facts: readonly {
|
|
18
35
|
label: string;
|
|
19
36
|
value: ReactNode;
|
|
20
37
|
}[];
|
|
21
38
|
} & Record<`data-${string}`, string | number | undefined>): import("react").JSX.Element;
|
|
39
|
+
/**
|
|
40
|
+
* A quiet, muted line inside a card, such as a count or a response status, with
|
|
41
|
+
* optional `trailing` content on the right.
|
|
42
|
+
*/
|
|
22
43
|
export declare function ToolViewCaption({ children, trailing, ...rest }: {
|
|
23
44
|
children: ReactNode;
|
|
24
45
|
trailing?: ReactNode;
|
|
25
46
|
} & Record<`data-${string}`, string | number | undefined>): import("react").JSX.Element;
|
|
47
|
+
/**
|
|
48
|
+
* A labelled scrolling region inside a card, up to 18rem tall, for a document,
|
|
49
|
+
* a diff or other long content; `label` is its accessible name. Extra `data-*`
|
|
50
|
+
* attributes pass through to the element.
|
|
51
|
+
*/
|
|
26
52
|
export declare function ToolViewBody({ label, children, ...rest }: {
|
|
27
53
|
label: string;
|
|
28
54
|
children: ReactNode;
|
|
29
55
|
} & Record<`data-${string}`, string | number | undefined>): import("react").JSX.Element;
|
|
56
|
+
/**
|
|
57
|
+
* A scrolling area inside a card, up to 18rem tall, for a long list of rows.
|
|
58
|
+
* Extra `data-*` attributes pass through to the element.
|
|
59
|
+
*/
|
|
30
60
|
export declare function ToolViewScroll({ children, ...rest }: {
|
|
31
61
|
children: ReactNode;
|
|
32
62
|
} & Record<`data-${string}`, string | number | undefined>): import("react").JSX.Element;
|
|
63
|
+
/**
|
|
64
|
+
* A small outlined label, usually trailing a ToolViewRow, for a short state
|
|
65
|
+
* such as "Awaiting approval" or "Not created". Extra `data-*` attributes pass
|
|
66
|
+
* through to the element.
|
|
67
|
+
*/
|
|
33
68
|
export declare function ToolViewBadge({ children, ...rest }: {
|
|
34
69
|
children: ReactNode;
|
|
35
70
|
} & Record<`data-${string}`, string | number | undefined>): import("react").JSX.Element;
|
|
71
|
+
/**
|
|
72
|
+
* One muted sentence, for something absent, degraded or not shown, such as the
|
|
73
|
+
* text from settledOutcomeNoteOf.
|
|
74
|
+
*/
|
|
36
75
|
export declare function ToolViewNote({ children, ...rest }: {
|
|
37
76
|
children: ReactNode;
|
|
38
77
|
} & Record<`data-${string}`, string | number | undefined>): import("react").JSX.Element;
|
|
78
|
+
/**
|
|
79
|
+
* Pulsing skeleton lines that hold the place where a result will appear while
|
|
80
|
+
* the call runs, with no card or border; `lines` defaults to 3. Hidden from
|
|
81
|
+
* screen readers.
|
|
82
|
+
*/
|
|
39
83
|
export declare function ToolViewBones({ lines, ...rest }: {
|
|
40
84
|
lines?: number;
|
|
41
85
|
} & Record<`data-${string}`, string | number | undefined>): import("react").JSX.Element;
|
|
@@ -27,12 +27,12 @@ function renderQuestions({ call }) {
|
|
|
27
27
|
function questionSection(question, answer) {
|
|
28
28
|
const section = el("div", "tf:min-w-0 tf:border-t tf:border-tf-border tf:p-4 tf:first:border-t-0");
|
|
29
29
|
const title = el("dt", "");
|
|
30
|
-
title.append(el("span", "tf:wrap-anywhere tf:text-tf-label tf:font-medium tf:text-tf-foreground", question.heading));
|
|
30
|
+
title.append(el("span", "tf:wrap-anywhere tf:text-tf-label tf:font-medium tf:text-tf-card-foreground", question.heading));
|
|
31
31
|
const prompt = el("dd", "tf:m-0 tf:mt-1.5 tf:wrap-anywhere tf:whitespace-pre-wrap tf:text-tf-label tf:leading-relaxed tf:text-tf-muted-foreground", question.prompt);
|
|
32
32
|
prompt.dataset.tfElicitationReceiptQuestion = "";
|
|
33
33
|
section.append(title, prompt);
|
|
34
34
|
if (answer !== undefined) {
|
|
35
|
-
const value = el("dd", "tf:m-0 tf:mt-3 tf:rounded-md tf:bg-tf-muted tf:px-3 tf:py-2.5 tf:wrap-anywhere tf:whitespace-pre-wrap tf:text-tf-label tf:leading-relaxed tf:text-tf-foreground");
|
|
35
|
+
const value = el("dd", "tf:m-0 tf:mt-3 tf:rounded-md tf:bg-tf-muted tf:px-3 tf:py-2.5 tf:wrap-anywhere tf:whitespace-pre-wrap tf:text-tf-label tf:leading-relaxed tf:text-tf-card-foreground");
|
|
36
36
|
value.dataset.tfElicitationReceiptAnswer = "";
|
|
37
37
|
value.append(el("span", "tf:sr-only", "Answered: "), document.createTextNode(answer));
|
|
38
38
|
section.append(value);
|
|
@@ -2,14 +2,32 @@ import type { ToolViewAdapter, ToolViewCall, ToolViewProps } from "../../core/to
|
|
|
2
2
|
import { LABEL_CLASS, PANE_CLASS, PANE_WRAPPER_CLASS } from "./parts-classes.js";
|
|
3
3
|
export { LABEL_CLASS, PANE_CLASS, PANE_WRAPPER_CLASS };
|
|
4
4
|
export declare function el<K extends keyof HTMLElementTagNameMap>(tag: K, className: string, text?: string): HTMLElementTagNameMap[K];
|
|
5
|
+
/**
|
|
6
|
+
* A labelled block of monospace text on a muted background, for raw text such
|
|
7
|
+
* as output or a diff.
|
|
8
|
+
*/
|
|
5
9
|
export declare function pane(label: string, text: string): HTMLElement;
|
|
10
|
+
/**
|
|
11
|
+
* A terminal-style block showing `$ command`, then its output, then stderr in a
|
|
12
|
+
* quieter tone. Pass `command: null` to show output only; empty parts are left
|
|
13
|
+
* out.
|
|
14
|
+
*/
|
|
6
15
|
export declare function terminal(options: {
|
|
7
16
|
command: string | null;
|
|
8
17
|
output?: string;
|
|
9
18
|
stderr?: string;
|
|
10
19
|
}): HTMLElement;
|
|
20
|
+
/** The plain-DOM version of ToolViewScroll, holding the given elements. */
|
|
11
21
|
export declare function scrollRegion(children: readonly HTMLElement[]): HTMLElement;
|
|
22
|
+
/**
|
|
23
|
+
* The plain-DOM version of ToolViewCard, holding the given elements under an
|
|
24
|
+
* optional title.
|
|
25
|
+
*/
|
|
12
26
|
export declare function card(children: readonly HTMLElement[], title?: string): HTMLElement;
|
|
27
|
+
/**
|
|
28
|
+
* The plain-DOM version of ToolViewRow, without a link; `below` adds an element
|
|
29
|
+
* under the title and second line.
|
|
30
|
+
*/
|
|
13
31
|
export declare function listRow(options: {
|
|
14
32
|
title: string;
|
|
15
33
|
secondary?: string;
|
|
@@ -17,25 +35,73 @@ export declare function listRow(options: {
|
|
|
17
35
|
icon?: Element;
|
|
18
36
|
below?: HTMLElement;
|
|
19
37
|
}): HTMLElement;
|
|
38
|
+
/**
|
|
39
|
+
* The plain-DOM version of ToolViewFacts, from `[label, value]` pairs in order.
|
|
40
|
+
*/
|
|
20
41
|
export declare function factRows(facts: readonly (readonly [label: string, value: string | HTMLElement])[]): HTMLElement;
|
|
42
|
+
/**
|
|
43
|
+
* The plain-DOM version of ToolViewCaption, with optional trailing content on
|
|
44
|
+
* the right.
|
|
45
|
+
*/
|
|
21
46
|
export declare function captionRow(text: string, trailing?: HTMLElement | string): HTMLElement;
|
|
22
47
|
export declare function badge(text: string): HTMLElement;
|
|
48
|
+
/** The plain-DOM version of ToolViewBones, with `count` skeleton lines. */
|
|
23
49
|
export declare function boneRows(count: number): HTMLElement;
|
|
50
|
+
/** The plain-DOM version of ToolViewNote. */
|
|
24
51
|
export declare function note(text: string): HTMLElement;
|
|
52
|
+
/**
|
|
53
|
+
* Returns the value if it is a plain object (not null and not an array), else
|
|
54
|
+
* null. Handy for reading `call.args` or `call.result` safely.
|
|
55
|
+
*/
|
|
25
56
|
export declare function recordOf(value: unknown): Record<string, unknown> | null;
|
|
26
57
|
export declare function stringOf(value: unknown): string | null;
|
|
27
58
|
export declare function statelessToolView(render: (props: ToolViewProps) => HTMLElement): ToolViewAdapter;
|
|
59
|
+
/**
|
|
60
|
+
* True when the call finished successfully and its own result is available
|
|
61
|
+
* (status "output-available" and not offloaded). Check it before drawing a
|
|
62
|
+
* result.
|
|
63
|
+
*/
|
|
28
64
|
export declare function settledWithResult(call: ToolViewCall): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* The same as settledOutcomeNoteOf, as a list of zero or one note elements
|
|
67
|
+
* ready to append in a plain-DOM view.
|
|
68
|
+
*/
|
|
29
69
|
export declare function settledOutcomeNotesOf(call: ToolViewCall): HTMLElement[];
|
|
70
|
+
/**
|
|
71
|
+
* A short sentence for a call that ended without a usable result (failed,
|
|
72
|
+
* declined, not approved, didn't run, interrupted, or result replaced by a
|
|
73
|
+
* preview). Null while the call is running or when it finished normally.
|
|
74
|
+
*/
|
|
30
75
|
export declare function settledOutcomeNoteOf(call: ToolViewCall): string | null;
|
|
76
|
+
/** An action's recorded HTTP response, as read by actionEnvelopeOf. */
|
|
31
77
|
export interface ActionEnvelope {
|
|
78
|
+
/** The HTTP status code your API returned, or null if none was recorded. */
|
|
32
79
|
status: number | null;
|
|
80
|
+
/** Your API's response body as recorded. */
|
|
33
81
|
body: unknown;
|
|
82
|
+
/**
|
|
83
|
+
* True when the body was cut to fit a size limit, so it is not complete.
|
|
84
|
+
*/
|
|
34
85
|
truncated: boolean;
|
|
35
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Reads an action call's `resultText` into your API's HTTP status, response
|
|
89
|
+
* body and whether the body was cut short. Returns null when the text is not an
|
|
90
|
+
* action's successful result.
|
|
91
|
+
*/
|
|
36
92
|
export declare function actionEnvelopeOf(resultText: string | undefined): ActionEnvelope | null;
|
|
93
|
+
/** A failed action's reason, as read by actionFailureOf. */
|
|
37
94
|
export interface ActionFailure {
|
|
95
|
+
/**
|
|
96
|
+
* The failure sentence as recorded, including wording meant for the agent.
|
|
97
|
+
* Use humanFailureSentenceOf to show it to a user.
|
|
98
|
+
*/
|
|
38
99
|
message: string;
|
|
100
|
+
/**
|
|
101
|
+
* The HTTP status, your API's error code and its per-field problems (`path`
|
|
102
|
+
* and `message`, in the API's order) when the failure named them, else
|
|
103
|
+
* null. `fieldsOmitted` counts further problems left out of `fields`.
|
|
104
|
+
*/
|
|
39
105
|
detail: {
|
|
40
106
|
status: number;
|
|
41
107
|
code: string;
|
|
@@ -46,6 +112,16 @@ export interface ActionFailure {
|
|
|
46
112
|
fieldsOmitted?: number;
|
|
47
113
|
} | null;
|
|
48
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Reads a failed action call's `errorText` into its message plus, when the
|
|
117
|
+
* failure named them, the HTTP status, error code and per-field problems.
|
|
118
|
+
* Returns null when there is no error text or it is not a failure.
|
|
119
|
+
*/
|
|
49
120
|
export declare function actionFailureOf(errorText: string | undefined): ActionFailure | null;
|
|
121
|
+
/**
|
|
122
|
+
* Turns a call's `errorText` into a sentence fit to show the user, removing the
|
|
123
|
+
* HTTP status and code, the field problems and the instructions meant for the
|
|
124
|
+
* agent. Text that is not an action failure comes back unchanged.
|
|
125
|
+
*/
|
|
50
126
|
export declare function humanFailureSentenceOf(errorText: string): string;
|
|
51
127
|
export declare function fileGlyph(): SVGElement;
|
|
@@ -23,9 +23,9 @@ export function Transcript({ surface }) {
|
|
|
23
23
|
const { pendingSend } = useConversation();
|
|
24
24
|
const connection = useCell(store.connection);
|
|
25
25
|
const { approvalCards, approvalSurface, elicitationSurface } = useDecisionSurfaces(store);
|
|
26
|
-
const {
|
|
26
|
+
const { displayRows, running, turnOpen, decisionsPending, activity } = useTranscript({ surface });
|
|
27
27
|
const rowIndexByToolCallId = useMemo(() => _rowIndexByToolCallIdOf(displayRows), [displayRows]);
|
|
28
|
-
const dispatches = useThreadDispatches(session, connection?.threadId ?? null
|
|
28
|
+
const dispatches = useThreadDispatches(session, connection?.threadId ?? null);
|
|
29
29
|
const dispatchesJoin = useMemo(() => ({ byOrdinal: dispatches }), [dispatches]);
|
|
30
30
|
const coworkerWork = useCell(store.coworkerWork);
|
|
31
31
|
if (connection === null) {
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { AssistantActivitySnapshot } from "../core/activity.js";
|
|
2
|
+
/**
|
|
3
|
+
* Returns a live summary of the assistant's state for badges or presence
|
|
4
|
+
* indicators elsewhere in your UI, updating as the conversation changes on any
|
|
5
|
+
* surface. Call it inside the provider or `TeaflaskAssistant`.
|
|
6
|
+
*/
|
|
2
7
|
export declare function useAssistantActivity(): AssistantActivitySnapshot;
|
|
@@ -1,23 +1,120 @@
|
|
|
1
1
|
import type { ServingAssistantThread } from "../contract/threads.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComposerContract } from "../core/conversation-store.js";
|
|
3
3
|
import type { PendingDecisionGap } from "../core/pending-decision-gap.js";
|
|
4
4
|
import type { ServingApiError } from "../transport/serving-error.js";
|
|
5
|
+
/** The conversation on screen. */
|
|
6
|
+
export interface OpenConversation {
|
|
7
|
+
/**
|
|
8
|
+
* The conversation's server record, including its id, title, whether a
|
|
9
|
+
* reply is running, timestamps and saved model choice.
|
|
10
|
+
*/
|
|
11
|
+
thread: ServingAssistantThread;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The open conversation, the visitor's history, the notices worth showing, and
|
|
15
|
+
* the actions that move between conversations, as returned by
|
|
16
|
+
* useAssistantConversation().
|
|
17
|
+
*/
|
|
5
18
|
export interface AssistantConversation {
|
|
19
|
+
/**
|
|
20
|
+
* Set when the assistant cannot start because of a configuration problem
|
|
21
|
+
* (code PUBLISHABLE_KEY_INVALID, ORIGIN_NOT_ALLOWED, END_USER_TOKEN_INVALID
|
|
22
|
+
* or END_USER_ID_MISMATCH); show it instead of the conversation. Null
|
|
23
|
+
* otherwise, and cleared once a session starts successfully.
|
|
24
|
+
*/
|
|
6
25
|
setupError: ServingApiError | null;
|
|
7
|
-
|
|
26
|
+
/**
|
|
27
|
+
* The conversation on screen, or null when none is open (a fresh
|
|
28
|
+
* conversation has no record until its first message is sent).
|
|
29
|
+
*/
|
|
30
|
+
conversation: OpenConversation | null;
|
|
31
|
+
/**
|
|
32
|
+
* The visitor's past conversations (up to 200), for a history list. Only
|
|
33
|
+
* loaded for an identified visitor; empty for anonymous visitors.
|
|
34
|
+
*/
|
|
8
35
|
threads: ServingAssistantThread[];
|
|
36
|
+
/**
|
|
37
|
+
* True when the visitor is identified (you passed a userId, or their
|
|
38
|
+
* session is signed in), so a history list makes sense; false for an
|
|
39
|
+
* anonymous visitor.
|
|
40
|
+
*/
|
|
9
41
|
historyExpected: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* True while a conversation is loading (a stored conversation at startup,
|
|
44
|
+
* or one picked with openThread); show a loading state rather than the
|
|
45
|
+
* empty state.
|
|
46
|
+
*/
|
|
10
47
|
threadOpening: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Increases each time the live connection restarts (after each send, a
|
|
50
|
+
* retry, or an automatic reconnect). Use it with the conversation id as a
|
|
51
|
+
* React key if you want your transcript subtree to remount on reconnect.
|
|
52
|
+
*/
|
|
11
53
|
reconnectNonce: number;
|
|
54
|
+
/**
|
|
55
|
+
* The composer's state and controls for this conversation, the same value
|
|
56
|
+
* useConversation() returns.
|
|
57
|
+
*/
|
|
12
58
|
composerContract: ComposerContract;
|
|
59
|
+
/**
|
|
60
|
+
* A sentence to show the visitor when sending a message, opening a
|
|
61
|
+
* conversation or stopping a reply failed. Null otherwise; cleared by the
|
|
62
|
+
* next send, open or new conversation.
|
|
63
|
+
*/
|
|
13
64
|
sendError: string | null;
|
|
65
|
+
/**
|
|
66
|
+
* A sentence to show when the newest reply failed. Null when it didn't, and
|
|
67
|
+
* also once the transcript itself shows that failure as a receipt row, so
|
|
68
|
+
* you never show it twice.
|
|
69
|
+
*/
|
|
14
70
|
turnFailure: string | null;
|
|
71
|
+
/**
|
|
72
|
+
* True when the connection dropped while a reply was in progress; show a
|
|
73
|
+
* notice with a Retry button that calls retryStream. Never true while the
|
|
74
|
+
* visitor is stopping a reply.
|
|
75
|
+
*/
|
|
15
76
|
showInterruptionBanner: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Set when the agent is waiting on an approval or question that this page
|
|
79
|
+
* could not display (after a short grace period). Show a notice with a
|
|
80
|
+
* Retry button that calls refreshConversation; null otherwise.
|
|
81
|
+
*/
|
|
16
82
|
pendingDecisionGap: PendingDecisionGap | null;
|
|
83
|
+
/**
|
|
84
|
+
* Reconnects to the conversation and replays it from the start, clearing
|
|
85
|
+
* the interruption notice. Use it as the interruption notice's Retry.
|
|
86
|
+
*/
|
|
17
87
|
retryStream: () => void;
|
|
88
|
+
/**
|
|
89
|
+
* Re-reads the open conversation from the server and applies what it finds.
|
|
90
|
+
* Does nothing when no conversation is open; network failures are ignored.
|
|
91
|
+
*/
|
|
18
92
|
refreshConversation: () => Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Opens one of the visitor's past conversations (from threads) and makes it
|
|
95
|
+
* the one resumed next time. While it loads, threadOpening is true; if it
|
|
96
|
+
* can't be opened, sendError is set, and a conversation that no longer
|
|
97
|
+
* exists is removed from threads.
|
|
98
|
+
*/
|
|
19
99
|
openThread: (thread: ServingAssistantThread) => void;
|
|
100
|
+
/**
|
|
101
|
+
* Leaves the current conversation and shows an empty one. Clears the unsent
|
|
102
|
+
* draft, staged attachments, unsent question answers and model choice; the
|
|
103
|
+
* new conversation is created when the first message is sent.
|
|
104
|
+
*/
|
|
20
105
|
startNewConversation: () => void;
|
|
106
|
+
/**
|
|
107
|
+
* Re-opens the conversation this browser last used, as saved for this
|
|
108
|
+
* publishable key; if none is saved, an open conversation is closed. The
|
|
109
|
+
* provider calls it once at startup; call it again when your UI reopens if
|
|
110
|
+
* another surface may have switched conversations meanwhile.
|
|
111
|
+
*/
|
|
21
112
|
resumeStoredThread: () => void;
|
|
22
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Returns the live state and controls of the assistant conversation, for
|
|
116
|
+
* building your own UI. Must be called inside <TeaflaskAssistantProvider> (it
|
|
117
|
+
* throws otherwise); every component that calls it reads the same conversation
|
|
118
|
+
* as the widget, drawer, palette and full-page assistant.
|
|
119
|
+
*/
|
|
23
120
|
export declare function useAssistantConversation(): AssistantConversation;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { ReadonlyCell } from "../core/observable-cell.js";
|
|
2
|
+
/**
|
|
3
|
+
* Subscribes a React component to an observable value such as composerInput and
|
|
4
|
+
* returns its current value, re-rendering when it changes. Server rendering
|
|
5
|
+
* gets the initial value.
|
|
6
|
+
*/
|
|
2
7
|
export declare function useCell<T>(cell: ReadonlyCell<T>): T;
|