@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
|
@@ -7,7 +7,13 @@ const VARIANT_CLASSES = {
|
|
|
7
7
|
"tf:bg-tf-primary tf:text-tf-primary-foreground tf:shadow-tf-control " +
|
|
8
8
|
"tf:hover:opacity-90 tf:disabled:opacity-50",
|
|
9
9
|
ghost: "tf:justify-center tf:rounded-tf tf:border-0 tf:px-3 tf:py-1.5 tf:text-tf-label tf:font-medium " +
|
|
10
|
-
"tf:bg-tf-transparent tf:text-tf-foreground tf:hover:bg-tf-accent
|
|
10
|
+
"tf:bg-tf-transparent tf:text-tf-foreground tf:hover:bg-tf-accent " +
|
|
11
|
+
"tf:hover:text-tf-accent-foreground tf:disabled:opacity-50",
|
|
12
|
+
secondary: "tf:relative tf:isolate tf:justify-center tf:rounded-tf tf:border-0 tf:px-3 tf:py-1.5 " +
|
|
13
|
+
"tf:text-tf-label tf:font-medium tf:bg-tf-secondary tf:text-tf-secondary-foreground " +
|
|
14
|
+
"tf:after:pointer-events-none tf:after:absolute tf:after:inset-0 tf:after:-z-10 " +
|
|
15
|
+
"tf:after:rounded-tf tf:after:bg-tf-accent tf:after:opacity-0 tf:after:transition-opacity " +
|
|
16
|
+
"tf:hover:after:opacity-100 tf:disabled:opacity-50",
|
|
11
17
|
send: "tf:size-8 tf:shrink-0 tf:justify-center tf:rounded-full tf:border-0 " +
|
|
12
18
|
"tf:bg-tf-primary tf:text-tf-primary-foreground tf:shadow-tf-control " +
|
|
13
19
|
"tf:hover:opacity-90 tf:disabled:bg-tf-muted tf:disabled:text-tf-muted-foreground " +
|
|
@@ -16,28 +22,28 @@ const VARIANT_CLASSES = {
|
|
|
16
22
|
"tf:bg-tf-primary tf:text-tf-primary-foreground tf:shadow-tf-control " +
|
|
17
23
|
"tf:hover:opacity-90 tf:aria-disabled:cursor-not-allowed tf:aria-disabled:opacity-70",
|
|
18
24
|
icon: "tf:size-7 tf:justify-center tf:rounded-tf tf:border-0 tf:bg-tf-transparent tf:text-tf-muted-foreground " +
|
|
19
|
-
"tf:hover:bg-tf-accent tf:hover:text-tf-foreground tf:disabled:opacity-50",
|
|
25
|
+
"tf:hover:bg-tf-accent tf:hover:text-tf-accent-foreground tf:disabled:opacity-50",
|
|
20
26
|
iconFloating: "tf:justify-center tf:rounded-full tf:border tf:bg-tf-background " +
|
|
21
27
|
"tf:text-tf-muted-foreground tf:shadow-tf-control " +
|
|
22
|
-
"tf:hover:bg-tf-accent tf:hover:text-tf-foreground tf:disabled:opacity-50",
|
|
28
|
+
"tf:hover:bg-tf-accent tf:hover:text-tf-accent-foreground tf:disabled:opacity-50",
|
|
23
29
|
row: "tf:h-8 tf:w-full tf:justify-start tf:rounded-tf tf:border-0 tf:px-2.5 tf:text-left tf:text-sm tf:font-medium " +
|
|
24
30
|
"tf:bg-tf-transparent tf:text-tf-muted-foreground tf:hover:bg-tf-accent " +
|
|
25
|
-
"tf:hover:text-tf-foreground tf:aria-[current=true]:bg-tf-accent " +
|
|
26
|
-
"tf:aria-[current=true]:text-tf-foreground tf:disabled:opacity-50",
|
|
31
|
+
"tf:hover:text-tf-accent-foreground tf:aria-[current=true]:bg-tf-accent " +
|
|
32
|
+
"tf:aria-[current=true]:text-tf-accent-foreground tf:disabled:opacity-50",
|
|
27
33
|
rowAction: "tf:h-9 tf:w-full tf:justify-start tf:gap-2 tf:rounded-tf tf:border-0 tf:px-2.5 tf:text-left tf:text-sm " +
|
|
28
34
|
"tf:font-medium tf:bg-tf-transparent tf:text-tf-foreground tf:hover:bg-tf-accent " +
|
|
29
|
-
"tf:disabled:opacity-50",
|
|
35
|
+
"tf:hover:text-tf-accent-foreground tf:disabled:opacity-50",
|
|
30
36
|
rowTouch: "tf:h-11 tf:w-full tf:justify-start tf:gap-2 tf:rounded-tf tf:border-0 tf:px-3 tf:text-left " +
|
|
31
37
|
"tf:text-tf-body tf:font-medium tf:bg-tf-transparent tf:text-tf-muted-foreground " +
|
|
32
|
-
"tf:hover:bg-tf-accent tf:hover:text-tf-foreground " +
|
|
33
|
-
"tf:aria-[current=true]:bg-tf-accent tf:aria-[current=true]:text-tf-foreground " +
|
|
38
|
+
"tf:hover:bg-tf-accent tf:hover:text-tf-accent-foreground " +
|
|
39
|
+
"tf:aria-[current=true]:bg-tf-accent tf:aria-[current=true]:text-tf-accent-foreground " +
|
|
34
40
|
"tf:disabled:opacity-50",
|
|
35
41
|
rowActionTouch: "tf:h-11 tf:w-full tf:justify-start tf:gap-2 tf:rounded-tf tf:border-0 tf:px-3 tf:text-left " +
|
|
36
42
|
"tf:text-tf-body tf:font-medium tf:bg-tf-transparent tf:text-tf-foreground " +
|
|
37
|
-
"tf:hover:bg-tf-accent tf:disabled:opacity-50",
|
|
43
|
+
"tf:hover:bg-tf-accent tf:hover:text-tf-accent-foreground tf:disabled:opacity-50",
|
|
38
44
|
prompt: "tf:min-h-11 tf:w-full tf:justify-start tf:gap-2.5 tf:rounded-tf tf:border-0 tf:px-4 tf:py-2 " +
|
|
39
45
|
"tf:text-left tf:text-tf-label tf:bg-tf-transparent tf:text-tf-foreground " +
|
|
40
|
-
"tf:hover:bg-tf-accent tf:disabled:opacity-50 " +
|
|
46
|
+
"tf:hover:bg-tf-accent tf:hover:text-tf-accent-foreground tf:disabled:opacity-50 " +
|
|
41
47
|
"tf:[&_[data-tf-prompt-mark]]:text-tf-muted-foreground " +
|
|
42
48
|
"tf:[&_[data-tf-prompt-go]]:opacity-0 tf:[&_[data-tf-prompt-go]]:transition-opacity " +
|
|
43
49
|
"tf:hover:[&_[data-tf-prompt-go]]:opacity-100 " +
|
|
@@ -46,21 +52,23 @@ const VARIANT_CLASSES = {
|
|
|
46
52
|
bare: "tf:rounded-tf tf:border-0 tf:bg-tf-transparent tf:p-0 tf:text-inherit tf:disabled:opacity-50",
|
|
47
53
|
chip: "tf:rounded-full tf:border-0 tf:px-2 tf:py-1 tf:text-tf-label tf:font-medium " +
|
|
48
54
|
"tf:bg-tf-transparent tf:text-tf-foreground tf:hover:bg-tf-accent " +
|
|
49
|
-
"tf:disabled:opacity-50",
|
|
55
|
+
"tf:hover:text-tf-accent-foreground tf:disabled:opacity-50",
|
|
50
56
|
chipQuiet: "tf:rounded-full tf:border-0 tf:px-2 tf:py-1 tf:text-tf-label tf:font-medium " +
|
|
51
57
|
"tf:bg-tf-transparent tf:text-tf-muted-foreground tf:hover:bg-tf-accent " +
|
|
52
|
-
"tf:hover:text-tf-foreground tf:disabled:opacity-50",
|
|
58
|
+
"tf:hover:text-tf-accent-foreground tf:disabled:opacity-50",
|
|
53
59
|
outline: "tf:justify-center tf:rounded-full tf:border tf:px-2.5 tf:py-[5px] tf:text-tf-label tf:font-medium " +
|
|
54
60
|
"tf:bg-tf-background tf:text-tf-foreground tf:shadow-tf-control " +
|
|
55
|
-
"tf:hover:bg-tf-accent tf:disabled:opacity-50",
|
|
61
|
+
"tf:hover:bg-tf-accent tf:hover:text-tf-accent-foreground tf:disabled:opacity-50",
|
|
62
|
+
glassChip: "tf:justify-center tf:rounded-full tf:border tf:px-2.5 tf:py-[5px] tf:text-tf-label " +
|
|
63
|
+
"tf:font-normal tf:disabled:opacity-50",
|
|
56
64
|
answerRow: "tf:min-h-11 tf:w-full tf:items-start tf:justify-start tf:gap-3 tf:rounded-tf tf:border-0 " +
|
|
57
65
|
"tf:bg-tf-transparent tf:px-3 tf:py-2.5 tf:text-left tf:text-tf-label tf:text-tf-foreground " +
|
|
58
|
-
"tf:wrap-anywhere tf:hover:bg-tf-accent tf:
|
|
59
|
-
"tf:aria-checked:bg-tf-emphasis",
|
|
66
|
+
"tf:wrap-anywhere tf:hover:bg-tf-accent tf:hover:text-tf-accent-foreground " +
|
|
67
|
+
"tf:disabled:opacity-50 tf:aria-checked:bg-tf-emphasis tf:aria-checked:text-tf-foreground",
|
|
60
68
|
};
|
|
61
69
|
export const TfButton = forwardRef(function TfButton({ variant = "primary", className, type, ...props }, ref) {
|
|
62
|
-
return (_jsx("button", { ref: ref, type: type ?? "button", className: cx("tf:appearance-none", "tf:inline-flex tf:items-center tf:gap-1.5 tf:transition-colors", "tf:focus-visible:outline-2 tf:focus-visible:outline-offset-2 tf:focus-visible:outline-tf-ring", "tf:disabled:cursor-not-allowed", VARIANT_CLASSES[variant], className), ...props }));
|
|
70
|
+
return (_jsx("button", { ref: ref, type: type ?? "button", ...(variant === "secondary" ? { "data-tf-secondary": "" } : {}), className: cx("tf:appearance-none", "tf:inline-flex tf:items-center tf:gap-1.5 tf:transition-colors", "tf:focus-visible:outline-2 tf:focus-visible:outline-offset-2 tf:focus-visible:outline-tf-ring", "tf:disabled:cursor-not-allowed", VARIANT_CLASSES[variant], className), ...props }));
|
|
63
71
|
});
|
|
64
72
|
export function TfLinkButton({ variant = "primary", className, children, ...props }) {
|
|
65
|
-
return (_jsx("a", { className: cx("tf:appearance-none tf:no-underline", "tf:inline-flex tf:items-center tf:gap-1.5 tf:transition-colors", "tf:focus-visible:outline-2 tf:focus-visible:outline-offset-2 tf:focus-visible:outline-tf-ring", VARIANT_CLASSES[variant], className), ...props, children: children }));
|
|
73
|
+
return (_jsx("a", { ...(variant === "secondary" ? { "data-tf-secondary": "" } : {}), className: cx("tf:appearance-none tf:no-underline", "tf:inline-flex tf:items-center tf:gap-1.5 tf:transition-colors", "tf:focus-visible:outline-2 tf:focus-visible:outline-offset-2 tf:focus-visible:outline-tf-ring", VARIANT_CLASSES[variant], className), ...props, children: children }));
|
|
66
74
|
}
|
|
@@ -42,7 +42,7 @@ export function TfFloatingPanel({ open, onOpenChange, corner = "bottom-right", d
|
|
|
42
42
|
handleSelector: "[data-tf-swipe-handle]",
|
|
43
43
|
});
|
|
44
44
|
useDockReflow(panelRef, dock);
|
|
45
|
-
return (_jsx("div", { ref: panelRef, popover: "manual", role: "dialog", "data-tf-assistant": "", "data-tf-floating-panel": corner, "data-tf-panel-dock": dock, "data-tf-glass": dock === "floating" ? "" : undefined, onToggle: parkOnForcedHide, onKeyDown: closeFromEscape, onPointerDown: swipe.onPointerDown, onPointerMove: swipe.onPointerMove, onPointerUp: swipe.onPointerUp, onPointerCancel: swipe.onPointerCancel, onClickCapture: swipe.onClickCapture, className: cx("tf:m-0 tf:hidden tf:p-0 tf:open:flex!", "tf:flex-col tf:overflow-hidden
|
|
45
|
+
return (_jsx("div", { ref: panelRef, popover: "manual", role: "dialog", "data-tf-assistant": "", "data-tf-floating-panel": corner, "data-tf-panel-dock": dock, "data-tf-glass": dock === "floating" ? "" : undefined, onToggle: parkOnForcedHide, onKeyDown: closeFromEscape, onPointerDown: swipe.onPointerDown, onPointerMove: swipe.onPointerMove, onPointerUp: swipe.onPointerUp, onPointerCancel: swipe.onPointerCancel, onClickCapture: swipe.onClickCapture, className: cx("tf:m-0 tf:hidden tf:p-0 tf:open:flex!", "tf:flex-col tf:overflow-hidden", dock === "sidebar"
|
|
46
46
|
?
|
|
47
47
|
"tf:inset-y-0 tf:right-0 tf:left-auto tf:h-dvh tf:w-104 tf:max-w-[calc(100vw-2rem)] tf:rounded-none tf:bg-tf-background tf:shadow-none"
|
|
48
48
|
: cx("tf:inset-auto tf:bottom-4 tf:w-[clamp(24rem,44vw,46rem)] tf:max-w-[calc(100vw-2rem)]", "tf:h-[min(68dvh,52rem,calc(100dvh-6rem))]", "tf:rounded-3xl tf:border", corner === "bottom-left" ? "tf:left-4" : "tf:right-4"), className), ...props, children: children }));
|
|
@@ -85,7 +85,7 @@ export function ProviderChip({ statuses, open, onOpenChange, fundingNote, }) {
|
|
|
85
85
|
event.preventDefault();
|
|
86
86
|
event.stopPropagation();
|
|
87
87
|
onOpenChange(false);
|
|
88
|
-
}, children: [_jsx(OpenAiMarkIcon, {}), _jsx("span", { className: "tf:whitespace-nowrap", children: headline.label }), _jsx(ChevronDownIcon, {})] }), open ? (_jsxs("div", { ref: menuRef, id: "tf-provider-chip-menu", role: "dialog", "aria-label": headline.accessibleName, "data-tf-glass": "", className: "tf:absolute tf:right-0 tf:bottom-full tf:mb-2 tf:flex tf:w-80 tf:max-w-[calc(100vw-2rem)] tf:flex-col tf:gap-3 tf:overflow-y-auto tf:rounded-2xl tf:border tf:p-3", onKeyDown: (event) => {
|
|
88
|
+
}, children: [_jsx(OpenAiMarkIcon, {}), _jsx("span", { className: "tf:whitespace-nowrap", children: headline.label }), _jsx(ChevronDownIcon, {})] }), open ? (_jsxs("div", { ref: menuRef, id: "tf-provider-chip-menu", role: "dialog", "aria-label": headline.accessibleName, "data-tf-glass": "", "data-tf-popover": "", className: "tf:absolute tf:right-0 tf:bottom-full tf:mb-2 tf:flex tf:w-80 tf:max-w-[calc(100vw-2rem)] tf:flex-col tf:gap-3 tf:overflow-y-auto tf:rounded-2xl tf:border tf:p-3", onKeyDown: (event) => {
|
|
89
89
|
if (event.key !== "Escape") {
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
@@ -112,6 +112,13 @@ function _chipHeadlineOf(statuses) {
|
|
|
112
112
|
connected: false,
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
+
if (!holding.offered) {
|
|
116
|
+
return {
|
|
117
|
+
label: `${name} · not in use`,
|
|
118
|
+
accessibleName: `${name} plan — not in use`,
|
|
119
|
+
connected: true,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
115
122
|
if (holding.state === "verifying") {
|
|
116
123
|
return {
|
|
117
124
|
label: `${name} · verifying…`,
|
|
@@ -8,7 +8,7 @@ export function QuestionPanelFooter({ card, cursor, gateReason, disabled, submit
|
|
|
8
8
|
const total = card.questions.length;
|
|
9
9
|
const isLast = cursor === total - 1;
|
|
10
10
|
const { confirming, cancelRef, keepEditingRef, requestCancel, keepEditing, discard, } = useCancelConfirm(card);
|
|
11
|
-
return (_jsx("div", { "data-tf-question-footer": "", className: "tf:mt-3 tf:flex tf:flex-wrap tf:items-center tf:justify-end tf:gap-2", children: card.status === "submitting" ? (_jsx("p", { className: "tf:flex tf:items-center tf:gap-2 tf:text-tf-label tf:text-tf-muted-foreground", children: _jsx(Spinner, { label: "Sending\u2026" }) })) : confirming ? (_jsxs(Fragment, { children: [_jsx("span", { className: "tf:text-tf-label tf:text-tf-muted-foreground", children: "Discard answers?" }), _jsx(TfButton, { ref: keepEditingRef, variant: "
|
|
11
|
+
return (_jsx("div", { "data-tf-question-footer": "", className: "tf:mt-3 tf:flex tf:flex-wrap tf:items-center tf:justify-end tf:gap-2", children: card.status === "submitting" ? (_jsx("p", { className: "tf:flex tf:items-center tf:gap-2 tf:text-tf-label tf:text-tf-muted-foreground", children: _jsx(Spinner, { label: "Sending\u2026" }) })) : confirming ? (_jsxs(Fragment, { children: [_jsx("span", { className: "tf:text-tf-label tf:text-tf-muted-foreground", children: "Discard answers?" }), _jsx(TfButton, { ref: keepEditingRef, variant: "secondary", onClick: keepEditing, children: "Keep editing" }), _jsx(TfButton, { variant: "outline", onClick: discard, children: "Discard" })] }, "confirm")) : (_jsxs(Fragment, { children: [gateReason !== null ? (_jsx("span", { "data-tf-question-gate": "", className: "tf:me-auto tf:text-tf-label tf:text-tf-muted-foreground", children: gateReason })) : null, _jsx(TfButton, { ref: cancelRef, variant: "secondary", disabled: disabled, onClick: requestCancel, children: "Cancel" }), _jsx(TfButton, { variant: "primary", disabled: disabled || submitGated, onClick: onProceed, children: isLast
|
|
12
12
|
? total === 1
|
|
13
13
|
? "Submit answer"
|
|
14
14
|
: "Submit answers"
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { type ComponentType } from "react";
|
|
2
2
|
import type { ToolViewAdapter, ToolViewProps } from "../core/tool-view.js";
|
|
3
|
+
/**
|
|
4
|
+
* Wraps a React component as a tool view (or as an icon) for a registration;
|
|
5
|
+
* the component receives ToolViewProps and keeps its state across updates. It
|
|
6
|
+
* renders in its own React root, so your app's providers (router, theme, data
|
|
7
|
+
* clients) don't reach it, and a render error makes the assistant show the next
|
|
8
|
+
* matching view.
|
|
9
|
+
*/
|
|
3
10
|
export declare function reactToolView<TArgs = Record<string, unknown>, TResult = unknown>(component: ComponentType<ToolViewProps<TArgs, TResult>>): ToolViewAdapter<TArgs, TResult>;
|
|
4
11
|
export declare const TOOL_VIEW_LATE_FAILURE_EVENT = "teaflask-tool-view-late-failure";
|
|
@@ -26,7 +26,7 @@ export function SubagentCountPill({ dispatches, threadId, renderPreview, }) {
|
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
28
|
const variantIndices = coworkerIndicesOf(dispatches.values());
|
|
29
|
-
return (_jsxs("div", { ref: wrapperRef, "data-tf-subagent-pill": "", "data-tf-shelf-item": "", className: "tf:pointer-events-auto tf:relative tf:w-fit", onPointerEnter: onWrapperPointerEnter, onPointerLeave: onWrapperPointerLeave, onBlur: onWrapperBlur, children: [_jsxs(TfButton, { ref: triggerRef, "data-tf-glass": "", variant: "
|
|
29
|
+
return (_jsxs("div", { ref: wrapperRef, "data-tf-subagent-pill": "", "data-tf-shelf-item": "", className: "tf:pointer-events-auto tf:relative tf:w-fit", onPointerEnter: onWrapperPointerEnter, onPointerLeave: onWrapperPointerLeave, onBlur: onWrapperBlur, children: [_jsxs(TfButton, { ref: triggerRef, "data-tf-glass": "", variant: "glassChip", className: "tf:min-h-11 tf:px-3 tf:md:px-2.5", "aria-label": `Subagents: ${label}`, "aria-expanded": open, "aria-controls": open ? rosterId : undefined, onPointerDown: onTriggerPointerDown, onPointerCancel: onTriggerPointerCancel, onFocus: onTriggerFocus, onClick: onTriggerClick, onKeyDown: onTriggerKeyDown, children: [_jsx(AgentIdentityMark, { register: "subagent", size: "md", className: "tf:text-tf-muted-foreground" }), roster.failed.length > 0 ? (_jsx("span", { "aria-hidden": true, className: "tf:size-1.5 tf:shrink-0 tf:rounded-full tf:bg-tf-destructive" })) : null, roster.running.length > 0 ? (_jsx(ShimmerText, { className: "tf:text-tf-muted-foreground", children: label })) : (label)] }), open ? (_jsx(SubagentRosterCard, { id: rosterId, roster: roster, variantIndices: variantIndices, threadId: threadId, renderPreview: renderPreview, triggerRef: triggerRef, onClose: close, refocusTrigger: refocusTrigger })) : null] }));
|
|
30
30
|
}
|
|
31
31
|
function SubagentRosterCard({ id, roster, variantIndices, threadId, renderPreview, triggerRef, onClose, refocusTrigger, }) {
|
|
32
32
|
const cardRef = useRef(null);
|
|
@@ -87,7 +87,7 @@ function SubagentRosterLine({ entry, variantIndex, previewable, previewOpen, onP
|
|
|
87
87
|
entry.failed ? entry.note : null,
|
|
88
88
|
]
|
|
89
89
|
.filter((part) => part !== null)
|
|
90
|
-
.join(" — "), className: "tf:group/subagent tf:min-h-11 tf:w-full tf:justify-start tf:px-2 tf:py-1.5 tf:hover:bg-tf-accent", onPointerEnter: (event) => {
|
|
90
|
+
.join(" — "), className: "tf:group/subagent tf:min-h-11 tf:w-full tf:justify-start tf:px-2 tf:py-1.5 tf:hover:bg-tf-accent tf:hover:text-tf-accent-foreground", onPointerEnter: (event) => {
|
|
91
91
|
if (event.pointerType !== "touch") {
|
|
92
92
|
onPreviewOpener(event.currentTarget);
|
|
93
93
|
onPreviewChange(true);
|
|
@@ -3,10 +3,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { activityTitleOf } from "../core/activity-title.js";
|
|
4
4
|
import { ChevronRightIcon } from "lucide-react";
|
|
5
5
|
import { createContext, useContext } from "react";
|
|
6
|
-
import { dispatchFailed, dispatchIsPaused, dispatchIsRunning, } from "../contract/dispatches.js";
|
|
7
|
-
import { subagentIdentityTokenOf } from "../core/agent-identity.js";
|
|
8
6
|
import { coworkerIndicesOf, settledWorkedLabelOf, } from "../core/subagent-presence.js";
|
|
9
7
|
import { subagentGroupHeadlineOf, subagentOutcomeCountsOf, } from "../core/subagent-rows.js";
|
|
8
|
+
import { resolvedSubagentEntryOf, } from "../core/subagent-ledger-join.js";
|
|
10
9
|
import { humanizedToolName, } from "../core/tool-call-display.js";
|
|
11
10
|
import { toolCallPresentationOf } from "../core/tool-call-presentation.js";
|
|
12
11
|
import { AgentIdentityMark } from "./agent-identity-mark.js";
|
|
@@ -21,30 +20,6 @@ const EMPTY_SUBAGENT_DISPATCHES = {
|
|
|
21
20
|
byOrdinal: new Map(),
|
|
22
21
|
};
|
|
23
22
|
export const SubagentDispatchesContext = createContext(EMPTY_SUBAGENT_DISPATCHES);
|
|
24
|
-
export function resolvedSubagentEntryOf(entry, byOrdinal) {
|
|
25
|
-
const ledger = entry.receipt != null ? byOrdinal.get(entry.receipt.ordinal) : undefined;
|
|
26
|
-
const ledgerLabel = ledger !== undefined && ledger.label !== "" ? ledger.label : null;
|
|
27
|
-
const childSessionId = ledger !== undefined && entry.receipt?.childSessionId != null
|
|
28
|
-
? entry.receipt.childSessionId
|
|
29
|
-
: null;
|
|
30
|
-
const running = ledger !== undefined ? dispatchIsRunning(ledger) : entry.running;
|
|
31
|
-
const failed = ledger !== undefined ? dispatchFailed(ledger) : entry.failed;
|
|
32
|
-
return {
|
|
33
|
-
toolCallId: entry.toolCallId,
|
|
34
|
-
label: ledgerLabel ?? entry.label,
|
|
35
|
-
running,
|
|
36
|
-
failed,
|
|
37
|
-
cancelled: entry.cancelled,
|
|
38
|
-
note: (ledger !== undefined && dispatchFailed(ledger) ? ledger.error : null) ??
|
|
39
|
-
entry.note,
|
|
40
|
-
childSessionId,
|
|
41
|
-
identityToken: childSessionId !== null ? subagentIdentityTokenOf(childSessionId) : null,
|
|
42
|
-
ordinal: entry.receipt?.ordinal ?? null,
|
|
43
|
-
paused: ledger !== undefined && dispatchIsPaused(ledger),
|
|
44
|
-
startedAt: ledger !== undefined ? ledger.created_at : null,
|
|
45
|
-
settledAt: ledger !== undefined && !running ? ledger.updated_at : null,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
23
|
export function SubagentGroupRow({ row }) {
|
|
49
24
|
const join = useContext(SubagentDispatchesContext);
|
|
50
25
|
const resolved = row.entries.map((entry) => resolvedSubagentEntryOf(entry, join.byOrdinal));
|
|
@@ -43,7 +43,7 @@ export function SubagentPreviewPopover({ id, anchorRef, previewRef, label, child
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
}, [anchorRef, previewRef]);
|
|
46
|
-
return (_jsxs("div", { ref: previewRef, id: id, role: "dialog", "aria-label": `Conversation preview: ${label}`, popover: "manual", tabIndex: -1, className: "tf:fixed tf:m-0 tf:overflow-visible tf:border-0 tf:bg-transparent tf:p-0 tf:text-tf-foreground tf:focus-visible:outline-2 tf:focus-visible:outline-offset-2 tf:focus-visible:outline-tf-ring", children: [_jsx("span", { "aria-hidden": true, "data-tf-subagent-preview-hover-bridge": "", className: "tf:pointer-events-auto tf:absolute tf:-inset-2" }), _jsx("div", { className: "tf:relative tf:h-full tf:w-full", children: children })] }));
|
|
46
|
+
return (_jsxs("div", { ref: previewRef, id: id, role: "dialog", "aria-label": `Conversation preview: ${label}`, popover: "manual", tabIndex: -1, className: "tf:fixed tf:m-0 tf:overflow-visible tf:border-0 tf:bg-transparent tf:p-0 tf:text-tf-popover-foreground tf:focus-visible:outline-2 tf:focus-visible:outline-offset-2 tf:focus-visible:outline-tf-ring", children: [_jsx("span", { "aria-hidden": true, "data-tf-subagent-preview-hover-bridge": "", className: "tf:pointer-events-auto tf:absolute tf:-inset-2" }), _jsx("div", { className: "tf:relative tf:h-full tf:w-full", children: children })] }));
|
|
47
47
|
}
|
|
48
48
|
function _previewPlacementOf(anchorRect, viewportWidth, viewportHeight) {
|
|
49
49
|
const gutter = 16;
|
|
@@ -33,11 +33,13 @@ export function ManageUsageLink({ provider, variant = "primary", }) {
|
|
|
33
33
|
export function HeartbeatLine({ sentence, tone = "muted", }) {
|
|
34
34
|
return (_jsxs("p", { className: tone === "muted"
|
|
35
35
|
? "tf:m-0 tf:flex tf:items-center tf:gap-1.5 tf:text-tf-label tf:text-tf-muted-foreground"
|
|
36
|
-
: "tf:m-0 tf:flex tf:items-center tf:gap-1.5 tf:text-tf-label
|
|
36
|
+
: "tf:m-0 tf:flex tf:items-center tf:gap-1.5 tf:text-tf-label", role: "status", children: [_jsx("span", { "aria-hidden": true, className: tone === "muted"
|
|
37
|
+
? "tf:size-1.5 tf:shrink-0 tf:animate-tf-pulse tf:rounded-full tf:bg-tf-foreground tf:motion-reduce:animate-none"
|
|
38
|
+
: "tf:size-1.5 tf:shrink-0 tf:animate-tf-pulse tf:rounded-full tf:bg-current tf:motion-reduce:animate-none" }), sentence] }));
|
|
37
39
|
}
|
|
38
|
-
export function PopupBlocked({
|
|
39
|
-
return (_jsxs("div", { className: "tf:flex tf:flex-col tf:gap-2", children: [_jsx("p", { className: "tf:m-0 tf:text-tf-label
|
|
40
|
+
export function PopupBlocked({ onBegin, onCancel, }) {
|
|
41
|
+
return (_jsxs("div", { className: "tf:flex tf:flex-col tf:gap-2", children: [_jsx("p", { className: "tf:m-0 tf:text-tf-label", role: "status", children: "Your browser blocked the sign-in window. Allow pop-ups for this site, then try again." }), _jsxs("div", { className: "tf:flex tf:flex-wrap tf:items-center tf:gap-2", children: [_jsx(TfButton, { variant: "primary", onClick: onBegin, children: "Try again" }), _jsx(TfButton, { variant: "secondary", onClick: onCancel, children: "Cancel" })] })] }));
|
|
40
42
|
}
|
|
41
43
|
export function NotConnected({ name, onBegin, }) {
|
|
42
|
-
return (_jsxs("div", { className: "tf:flex tf:flex-col tf:gap-2", children: [_jsxs("div", { className: "tf:flex tf:flex-col tf:gap-1", role: "status", children: [_jsx("p", { className: "tf:m-0 tf:text-tf-heading tf:font-medium
|
|
44
|
+
return (_jsxs("div", { className: "tf:flex tf:flex-col tf:gap-2", children: [_jsxs("div", { className: "tf:flex tf:flex-col tf:gap-1", role: "status", children: [_jsx("p", { className: "tf:m-0 tf:text-tf-heading tf:font-medium", children: NOT_CONNECTED_HEADLINE }), _jsx("p", { className: "tf:m-0 tf:text-tf-label tf:text-tf-muted-foreground", children: notConnectedExplanationOf(name) })] }), _jsx(TfButton, { variant: "primary", className: "tf:self-start", onClick: onBegin, children: "Try again" })] }));
|
|
43
45
|
}
|
|
@@ -35,7 +35,7 @@ export function useSubscriptionConnectFlow(status, session, refreshSubscriptions
|
|
|
35
35
|
noteSignedInRef.current = noteSignedIn;
|
|
36
36
|
});
|
|
37
37
|
useEffect(() => {
|
|
38
|
-
if (flow.kind !== "in_popup"
|
|
38
|
+
if (flow.kind !== "in_popup") {
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
return _awaitTheCallback({
|
|
@@ -84,6 +84,10 @@ export function useSubscriptionConnectFlow(status, session, refreshSubscriptions
|
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
const popup = window.open("about:blank", _POPUP_NAME, _POPUP_FEATURES);
|
|
87
|
+
if (popup === null) {
|
|
88
|
+
setFlow({ kind: "popup_blocked" });
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
87
91
|
void _begin(wires, popup);
|
|
88
92
|
},
|
|
89
93
|
disconnect: () => void _disconnect(wires),
|
|
@@ -93,11 +97,6 @@ export function useSubscriptionConnectFlow(status, session, refreshSubscriptions
|
|
|
93
97
|
}
|
|
94
98
|
setFlow({ kind: "idle" });
|
|
95
99
|
},
|
|
96
|
-
noteTabOpened: () => {
|
|
97
|
-
if (flow.kind === "popup_blocked" && !flow.tabOpened) {
|
|
98
|
-
setFlow({ ...flow, tabOpened: true });
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
100
|
};
|
|
102
101
|
}
|
|
103
102
|
function _isInProgress(flow) {
|
|
@@ -134,25 +133,20 @@ async function _begin(wires, popup) {
|
|
|
134
133
|
setFlow({ kind: "starting" });
|
|
135
134
|
try {
|
|
136
135
|
const authorization = await beginSubscriptionAuthorization(wires.session, wires.provider);
|
|
137
|
-
|
|
138
|
-
if (popup === null) {
|
|
139
|
-
setFlow({
|
|
140
|
-
kind: "popup_blocked",
|
|
141
|
-
authorization,
|
|
142
|
-
expiresAt,
|
|
143
|
-
tabOpened: false,
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
else if (popup.closed) {
|
|
136
|
+
if (popup.closed) {
|
|
147
137
|
setFlow({ kind: "idle" });
|
|
148
138
|
}
|
|
149
139
|
else {
|
|
150
140
|
popup.location.href = authorization.authorize_url;
|
|
151
|
-
setFlow({
|
|
141
|
+
setFlow({
|
|
142
|
+
kind: "in_popup",
|
|
143
|
+
popup,
|
|
144
|
+
expiresAt: Date.now() + authorization.expires_in * 1000,
|
|
145
|
+
});
|
|
152
146
|
}
|
|
153
147
|
}
|
|
154
148
|
catch (error) {
|
|
155
|
-
popup
|
|
149
|
+
popup.close();
|
|
156
150
|
setFlow({ kind: "error", sentence: failureSentenceOf(error) });
|
|
157
151
|
}
|
|
158
152
|
finally {
|
|
@@ -214,34 +208,27 @@ function _awaitTheCallback(wires, flow) {
|
|
|
214
208
|
if (!settle()) {
|
|
215
209
|
return;
|
|
216
210
|
}
|
|
217
|
-
|
|
218
|
-
flow.popup.close();
|
|
219
|
-
}
|
|
211
|
+
flow.popup.close();
|
|
220
212
|
setFlow({ kind: "error", sentence: _SIGN_IN_EXPIRED_SENTENCE });
|
|
221
213
|
}, Math.max(0, flow.expiresAt - Date.now()));
|
|
222
|
-
let closedWatch;
|
|
223
214
|
let grace;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
215
|
+
const { popup } = flow;
|
|
216
|
+
const closedWatch = window.setInterval(() => {
|
|
217
|
+
if (!popup.closed || grace !== undefined) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
grace = window.setTimeout(() => {
|
|
221
|
+
if (!settle()) {
|
|
228
222
|
return;
|
|
229
223
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
refreshSubscriptions();
|
|
235
|
-
setFlow({ kind: "checking", before: latestStatusRef.current });
|
|
236
|
-
}, _POPUP_CLOSED_GRACE_MS);
|
|
237
|
-
}, _POPUP_CLOSED_POLL_MS);
|
|
238
|
-
}
|
|
224
|
+
refreshSubscriptions();
|
|
225
|
+
setFlow({ kind: "checking", before: latestStatusRef.current });
|
|
226
|
+
}, _POPUP_CLOSED_GRACE_MS);
|
|
227
|
+
}, _POPUP_CLOSED_POLL_MS);
|
|
239
228
|
return () => {
|
|
240
229
|
window.removeEventListener("message", onMessage);
|
|
241
230
|
window.clearTimeout(expiry);
|
|
242
|
-
|
|
243
|
-
window.clearInterval(closedWatch);
|
|
244
|
-
}
|
|
231
|
+
window.clearInterval(closedWatch);
|
|
245
232
|
if (grace !== undefined) {
|
|
246
233
|
window.clearTimeout(grace);
|
|
247
234
|
}
|
|
@@ -281,9 +268,9 @@ export function ProviderConnectSection({ status, session, refreshSubscriptions,
|
|
|
281
268
|
headline: NOT_CONNECTED_HEADLINE,
|
|
282
269
|
detail: notConnectedExplanationOf(name),
|
|
283
270
|
}
|
|
284
|
-
: null, rechecking: recheck.rechecking, onRecheck: recheck.recheck, onReconnect: connect.begin, onDisconnect: connect.disconnect })) : (_jsx(ConnectFlow, { name: name, flow: connect.flow, errorSentence: connect.errorSentence, onBegin: connect.begin, onCancel: connect.cancel
|
|
271
|
+
: null, rechecking: recheck.rechecking, onRecheck: recheck.recheck, onReconnect: connect.begin, onDisconnect: connect.disconnect })) : (_jsx(ConnectFlow, { name: name, flow: connect.flow, errorSentence: connect.errorSentence, onBegin: connect.begin, onCancel: connect.cancel }))] }));
|
|
285
272
|
}
|
|
286
|
-
export function ConnectFlow({ name, flow, errorSentence, onBegin, onCancel,
|
|
273
|
+
export function ConnectFlow({ name, flow, errorSentence, onBegin, onCancel, }) {
|
|
287
274
|
if (flow.kind === "removed") {
|
|
288
275
|
return (_jsx("p", { className: "tf:m-0 tf:text-tf-label tf:text-tf-muted-foreground", role: "status", children: "Disconnected." }));
|
|
289
276
|
}
|
|
@@ -296,13 +283,11 @@ export function ConnectFlow({ name, flow, errorSentence, onBegin, onCancel, onTa
|
|
|
296
283
|
if (flow.kind === "checking") {
|
|
297
284
|
return _jsx(HeartbeatLine, { sentence: `Checking your ${name} connection…` });
|
|
298
285
|
}
|
|
299
|
-
if (flow.kind === "in_popup"
|
|
300
|
-
(
|
|
301
|
-
const where = flow.kind === "in_popup" ? "window" : "tab";
|
|
302
|
-
return (_jsxs("div", { className: "tf:flex tf:flex-col tf:gap-2", children: [_jsx(HeartbeatLine, { sentence: `Finish signing in to ${name} in the ${where} that opened.` }), _jsx(TfButton, { variant: "ghost", className: "tf:self-start", onClick: onCancel, children: "Cancel" })] }));
|
|
286
|
+
if (flow.kind === "in_popup") {
|
|
287
|
+
return (_jsxs("div", { className: "tf:flex tf:flex-col tf:gap-2", children: [_jsx(HeartbeatLine, { sentence: `Finish signing in to ${name} in the window that opened.` }), _jsx(TfButton, { variant: "secondary", className: "tf:self-start", onClick: onCancel, children: "Cancel" })] }));
|
|
303
288
|
}
|
|
304
289
|
if (flow.kind === "popup_blocked") {
|
|
305
|
-
return
|
|
290
|
+
return _jsx(PopupBlocked, { onBegin: onBegin, onCancel: onCancel });
|
|
306
291
|
}
|
|
307
292
|
if (flow.kind === "not_connected") {
|
|
308
293
|
return _jsx(NotConnected, { name: name, onBegin: onBegin });
|
|
@@ -10,11 +10,11 @@ export function ConnectedStanding({ name, status, errorSentence, outcome, rechec
|
|
|
10
10
|
const active = status.state === "active";
|
|
11
11
|
return (_jsxs("div", { className: "tf:flex tf:flex-col tf:gap-3", children: [_jsx(ConnectedStandingHeader, { name: name, status: status, actionsOpen: actionsOpen, actionsId: actionsId, onToggleActions: () => {
|
|
12
12
|
setActionsOpen((current) => !current);
|
|
13
|
-
} }), status.state === "bounced" ? null : (_jsxs("p", { className: "tf:m-0 tf:text-xs tf:text-tf-muted-foreground", children: ["Uses your ", name, " plan's included usage."] })), _jsx(StandingLine, { name: name, status: status, outcome: outcome, active: active }), status.offered ? null : (_jsxs("p", { className: "tf:m-0 tf:text-tf-label tf:text-tf-muted-foreground", children: [name, " sign-in is no longer offered here."] })), status.state === "bounced" && rechecking ? (_jsx(HeartbeatLine, { sentence: checkingPlanSentenceOf(name) })) : status.state === "bounced" ? (_jsx(BouncedRemedy, { name: name, status: status, onRecheck: onRecheck, onReconnect: onReconnect })) : null, errorSentence === null ? null : (_jsx("p", { className: "tf:m-0 tf:text-tf-label tf:text-tf-destructive", role: "alert", children: errorSentence })), actionsOpen ? (_jsxs("div", { id: actionsId, className: "tf:flex tf:flex-wrap tf:justify-end tf:gap-2 tf:border-t tf:pt-2", children: [status.bounce_cause === "quota" ? null : (_jsx(ManageUsageLink, { provider: status.provider, variant: "outline" })), _jsxs(TfButton, { variant: "outline", onClick: onDisconnect, children: ["Disconnect ", name] })] })) : null] }));
|
|
13
|
+
} }), status.state === "bounced" || !status.offered ? null : (_jsxs("p", { className: "tf:m-0 tf:text-xs tf:text-tf-muted-foreground", children: ["Uses your ", name, " plan's included usage."] })), _jsx(StandingLine, { name: name, status: status, outcome: outcome, active: active }), status.offered ? null : (_jsxs("p", { className: "tf:m-0 tf:text-tf-label tf:text-tf-muted-foreground", children: [name, " sign-in is no longer offered here."] })), status.state === "bounced" && rechecking ? (_jsx(HeartbeatLine, { sentence: checkingPlanSentenceOf(name) })) : status.state === "bounced" ? (_jsx(BouncedRemedy, { name: name, status: status, onRecheck: onRecheck, onReconnect: onReconnect })) : null, errorSentence === null ? null : (_jsx("p", { className: "tf:m-0 tf:text-tf-label tf:text-tf-destructive", role: "alert", children: errorSentence })), actionsOpen ? (_jsxs("div", { id: actionsId, className: "tf:flex tf:flex-wrap tf:justify-end tf:gap-2 tf:border-t tf:pt-2", children: [status.bounce_cause === "quota" ? null : (_jsx(ManageUsageLink, { provider: status.provider, variant: "outline" })), _jsxs(TfButton, { variant: "outline", onClick: onDisconnect, children: ["Disconnect ", name] })] })) : null] }));
|
|
14
14
|
}
|
|
15
15
|
function StandingLine({ name, status, outcome, active, }) {
|
|
16
16
|
if (outcome !== null) {
|
|
17
|
-
return (_jsxs("div", { className: "tf:flex tf:flex-col tf:gap-1", role: "status", children: [_jsx("p", { className: "tf:m-0 tf:text-tf-label tf:font-medium
|
|
17
|
+
return (_jsxs("div", { className: "tf:flex tf:flex-col tf:gap-1", role: "status", children: [_jsx("p", { className: "tf:m-0 tf:text-tf-label tf:font-medium", children: outcome.headline }), _jsx("p", { className: "tf:m-0 tf:text-tf-label tf:text-tf-muted-foreground", children: outcome.detail })] }));
|
|
18
18
|
}
|
|
19
19
|
if (active) {
|
|
20
20
|
return null;
|
|
@@ -22,7 +22,7 @@ function StandingLine({ name, status, outcome, active, }) {
|
|
|
22
22
|
if (status.state === "verifying") {
|
|
23
23
|
return (_jsx(HeartbeatLine, { sentence: standingSentenceOf(name, status), tone: "foreground" }));
|
|
24
24
|
}
|
|
25
|
-
return (_jsx("p", { className: "tf:m-0 tf:text-tf-label
|
|
25
|
+
return (_jsx("p", { className: "tf:m-0 tf:text-tf-label", role: "status", children: standingSentenceOf(name, status) }));
|
|
26
26
|
}
|
|
27
27
|
function BouncedRemedy({ name, status, onRecheck, onReconnect, }) {
|
|
28
28
|
if (status.bounce_cause === "quota") {
|
|
@@ -34,7 +34,7 @@ function BouncedRemedy({ name, status, onRecheck, onReconnect, }) {
|
|
|
34
34
|
return (_jsxs(TfButton, { variant: "primary", className: "tf:self-start", onClick: onReconnect, children: ["Reconnect ", name] }));
|
|
35
35
|
}
|
|
36
36
|
function ConnectedStandingHeader({ name, status, actionsOpen, actionsId, onToggleActions, }) {
|
|
37
|
-
return (_jsxs("div", { className: "tf:flex tf:items-center tf:justify-between tf:gap-3", children: [_jsxs("div", { className: "tf:flex tf:min-w-0 tf:items-center tf:gap-2.5", children: [_jsx("span", { className: "tf:flex tf:size-8 tf:shrink-0 tf:items-center tf:justify-center tf:rounded-full tf:bg-tf-muted
|
|
37
|
+
return (_jsxs("div", { className: "tf:flex tf:items-center tf:justify-between tf:gap-3", children: [_jsxs("div", { className: "tf:flex tf:min-w-0 tf:items-center tf:gap-2.5", children: [_jsx("span", { className: "tf:flex tf:size-8 tf:shrink-0 tf:items-center tf:justify-center tf:rounded-full tf:bg-tf-muted", children: _jsx(OpenAiMarkIcon, {}) }), _jsxs("div", { className: "tf:flex tf:min-w-0 tf:flex-col", children: [_jsx("span", { className: "tf:truncate tf:text-tf-label tf:font-medium", children: name }), _jsx("span", { className: "tf:truncate tf:text-xs tf:text-tf-muted-foreground", children: "AI subscription" })] })] }), _jsxs(TfButton, { variant: "outline", className: "tf:shrink-0", "aria-expanded": actionsOpen, "aria-controls": actionsId, onClick: onToggleActions, children: [_jsx("span", { "aria-hidden": true, className: stateDotClassOf(status) }), stateChipLabelOf(status), _jsx(ChevronDownIcon, {})] })] }));
|
|
38
38
|
}
|
|
39
39
|
function stateDotClassOf(status) {
|
|
40
40
|
if (status.state === "bounced" && status.bounce_cause !== "quota") {
|
|
@@ -43,14 +43,17 @@ function stateDotClassOf(status) {
|
|
|
43
43
|
if (status.state === "bounced") {
|
|
44
44
|
return "tf:size-1.5 tf:rounded-full tf:bg-tf-muted-foreground";
|
|
45
45
|
}
|
|
46
|
-
return "tf:size-1.5 tf:rounded-full tf:bg-
|
|
46
|
+
return "tf:size-1.5 tf:rounded-full tf:bg-current";
|
|
47
47
|
}
|
|
48
48
|
function stateChipLabelOf(status) {
|
|
49
49
|
if (status.state === "verifying") {
|
|
50
50
|
return "Verifying";
|
|
51
51
|
}
|
|
52
52
|
if (status.state === "bounced") {
|
|
53
|
-
|
|
53
|
+
if (status.bounce_cause === "quota") {
|
|
54
|
+
return "Limit reached";
|
|
55
|
+
}
|
|
56
|
+
return status.offered ? "Reconnect" : "Not working";
|
|
54
57
|
}
|
|
55
58
|
return "Connected";
|
|
56
59
|
}
|
|
@@ -15,8 +15,10 @@ export function SubscriptionPlanNotice() {
|
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
17
17
|
const standing = statuses?.find((status) => Object.is(status.provider, due));
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const inUse = standing?.connected === true &&
|
|
19
|
+
standing.state === "active" &&
|
|
20
|
+
standing.offered;
|
|
21
|
+
if (!inUse || readPlanNoticeSeen(session.publishableKey, due)) {
|
|
20
22
|
return null;
|
|
21
23
|
}
|
|
22
24
|
const name = providerNameOf(due);
|
|
@@ -13,27 +13,120 @@ import type { ServingApiError } from "../transport/serving-error.js";
|
|
|
13
13
|
import type { TokenSession } from "../transport/token-session.js";
|
|
14
14
|
import type { ToolViewRegistry } from "../core/tool-view.js";
|
|
15
15
|
import type { AssistantSuggestionInput } from "./conversation-view.js";
|
|
16
|
+
/**
|
|
17
|
+
* The identity props for a signed-in user, always passed together. When
|
|
18
|
+
* `userId` changes, including to undefined on sign-out, everything from the
|
|
19
|
+
* previous user is dropped and a fresh session starts.
|
|
20
|
+
*/
|
|
16
21
|
export interface TeaflaskAssistantIdentityProps {
|
|
22
|
+
/**
|
|
23
|
+
* Your stable id for the signed-in user. It must equal the `user_id` claim
|
|
24
|
+
* in the token that `getEndUserToken` returns, or the assistant shows a
|
|
25
|
+
* setup error instead of a conversation.
|
|
26
|
+
*/
|
|
17
27
|
userId: string;
|
|
28
|
+
/**
|
|
29
|
+
* Returns a short-lived token from your backend that proves who the user
|
|
30
|
+
* is: an HS256 JWT with `user_id` and `exp` (and optionally `email`),
|
|
31
|
+
* signed with the JWT secret from Settings → Keys in Teaflask. It is called
|
|
32
|
+
* whenever the assistant needs a new session token, and returning null
|
|
33
|
+
* continues anonymously.
|
|
34
|
+
*/
|
|
18
35
|
getEndUserToken: () => string | null | Promise<string | null>;
|
|
19
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* The identity props for a page with no signed-in user. Leave both `userId` and
|
|
39
|
+
* `getEndUserToken` unset, and the visitor chats anonymously.
|
|
40
|
+
*/
|
|
20
41
|
export interface TeaflaskAssistantAnonymousProps {
|
|
42
|
+
/** Leave unset for anonymous visitors. */
|
|
21
43
|
userId?: undefined;
|
|
44
|
+
/** Leave unset for anonymous visitors. */
|
|
22
45
|
getEndUserToken?: undefined;
|
|
23
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Props for `TeaflaskAssistantProvider`. Pass the shared props, plus either
|
|
49
|
+
* both `userId` and `getEndUserToken` for a signed-in user or neither for an
|
|
50
|
+
* anonymous visitor.
|
|
51
|
+
*/
|
|
24
52
|
export type TeaflaskAssistantProviderProps = TeaflaskAssistantProviderBaseProps & (TeaflaskAssistantIdentityProps | TeaflaskAssistantAnonymousProps);
|
|
53
|
+
/**
|
|
54
|
+
* The props shared by `TeaflaskAssistantProvider` and `TeaflaskAssistant`,
|
|
55
|
+
* except the identity pair. Changing `publishableKey`, `baseUrl` or `userId`
|
|
56
|
+
* starts a separate session.
|
|
57
|
+
*/
|
|
25
58
|
export interface TeaflaskAssistantProviderBaseProps {
|
|
59
|
+
/**
|
|
60
|
+
* Your agent's publishable key from Teaflask. It is meant for browser code,
|
|
61
|
+
* and requests are accepted only from your allowed origins.
|
|
62
|
+
*/
|
|
26
63
|
publishableKey: string;
|
|
64
|
+
/**
|
|
65
|
+
* The Teaflask API origin, which defaults to `https://api.teaflask.com`. A
|
|
66
|
+
* trailing slash is ignored.
|
|
67
|
+
*/
|
|
27
68
|
baseUrl?: string;
|
|
69
|
+
/**
|
|
70
|
+
* How this page calls your API when the agent runs an action, with the
|
|
71
|
+
* user's own cookies, headers or a request you build. Without it, the agent
|
|
72
|
+
* cannot run actions here and tells the user to do the step themselves.
|
|
73
|
+
*/
|
|
28
74
|
actionsAdapter?: ActionsAdapter;
|
|
75
|
+
/**
|
|
76
|
+
* Called with an app-relative path when the agent takes the user to a page,
|
|
77
|
+
* so wire it to your router. It may return a promise that resolves once
|
|
78
|
+
* your router has the navigation. Without it, the agent cannot navigate on
|
|
79
|
+
* this page.
|
|
80
|
+
*/
|
|
29
81
|
onNavigate?: (path: string) => void | Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Called with errors for your error reporting: a failed send or stop, a
|
|
84
|
+
* dropped stream, a conversation that fails to open, a failed session-token
|
|
85
|
+
* request, or a crash inside an assistant surface.
|
|
86
|
+
*/
|
|
30
87
|
onError?: (error: Error) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Called with product analytics events (approval submits and stream
|
|
90
|
+
* failures) that you can forward to your own analytics. If it throws, the
|
|
91
|
+
* error goes to `onError`.
|
|
92
|
+
*/
|
|
31
93
|
onTelemetry?: (event: AssistantTelemetryEvent) => void;
|
|
94
|
+
/**
|
|
95
|
+
* Theme tokens and dark-mode overrides, compared by value, so passing a new
|
|
96
|
+
* object literal on every render is fine. Under a strict Content Security
|
|
97
|
+
* Policy this needs inline styles allowed (`style-src-attr`). Otherwise set
|
|
98
|
+
* the `--tf-` variables in your CSS instead.
|
|
99
|
+
*/
|
|
32
100
|
theme?: AssistantTheme;
|
|
101
|
+
/**
|
|
102
|
+
* Forces light, dark or OS-following (`"auto"`) colors on every assistant
|
|
103
|
+
* surface. Omit it to stay light unless an ancestor element carries
|
|
104
|
+
* `data-tf-theme="dark"`.
|
|
105
|
+
*/
|
|
33
106
|
mode?: AssistantThemeMode;
|
|
107
|
+
/**
|
|
108
|
+
* Your own logo or mascot, shown on the corner widget and on the drawer's
|
|
109
|
+
* welcome screen. It fills a 4rem square, so a bare `<svg viewBox>` or
|
|
110
|
+
* `<img>` works without sizing. Omit it, or pass a falsy value, to show the
|
|
111
|
+
* Teaflask flask.
|
|
112
|
+
*/
|
|
34
113
|
companionMark?: ReactNode;
|
|
114
|
+
/**
|
|
115
|
+
* Opening prompts for the drawer's welcome screen, compared by value. Omit
|
|
116
|
+
* it to use the prompts configured for your agent in Teaflask for the
|
|
117
|
+
* current page. Any value, even `[]`, replaces those entirely.
|
|
118
|
+
*/
|
|
35
119
|
suggestions?: readonly AssistantSuggestionInput[];
|
|
120
|
+
/**
|
|
121
|
+
* Your own components for displaying specific tools and actions in the
|
|
122
|
+
* conversation, keyed by tool name (`action__<slug>` for an action). Define
|
|
123
|
+
* the registry once at module scope rather than inside a component.
|
|
124
|
+
*/
|
|
36
125
|
toolViews?: ToolViewRegistry;
|
|
126
|
+
/**
|
|
127
|
+
* Your app content. Components inside it can use the assistant hooks, such
|
|
128
|
+
* as `useAssistantActivity` and `useConversation`.
|
|
129
|
+
*/
|
|
37
130
|
children?: ReactNode;
|
|
38
131
|
}
|
|
39
132
|
interface AssistantSessionValue {
|
|
@@ -65,5 +158,11 @@ interface AssistantSessionValue {
|
|
|
65
158
|
}
|
|
66
159
|
export declare function useAssistantSession(): AssistantSessionValue;
|
|
67
160
|
export declare function useOptionalAssistantSession(): AssistantSessionValue | null;
|
|
161
|
+
/**
|
|
162
|
+
* Connects to Teaflask and shares one live conversation with every assistant
|
|
163
|
+
* component and hook inside it, without rendering any UI of its own. Use it in
|
|
164
|
+
* place of `TeaflaskAssistant` when you place the surfaces yourself or build
|
|
165
|
+
* your own UI.
|
|
166
|
+
*/
|
|
68
167
|
export declare function TeaflaskAssistantProvider({ publishableKey, baseUrl, userId, getEndUserToken, actionsAdapter, onNavigate, onError, onTelemetry, theme, mode, companionMark, suggestions, toolViews, children, }: TeaflaskAssistantProviderProps): import("react").JSX.Element;
|
|
69
168
|
export {};
|