@teaflask/assistant 0.6.0 → 0.7.0
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/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/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/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
|
@@ -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 {};
|
|
@@ -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);
|