@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
package/dist/core/tool-view.d.ts
CHANGED
|
@@ -1,62 +1,235 @@
|
|
|
1
1
|
import type { ToolCallState } from "./tool-call-display.js";
|
|
2
|
+
/** The palette a tool view renders in. */
|
|
2
3
|
export type ToolViewThemeMode = "light" | "dark";
|
|
4
|
+
/** A JSON Schema document, passed through as received and never validated. */
|
|
3
5
|
export type JsonSchema = Record<string, unknown>;
|
|
6
|
+
/**
|
|
7
|
+
* One tool or action call, as a tool view receives it. You get a fresh copy
|
|
8
|
+
* through `update` as the call progresses; never mutate it.
|
|
9
|
+
*/
|
|
4
10
|
export interface ToolViewCall<TArgs = Record<string, unknown>, TResult = unknown> {
|
|
11
|
+
/** The tool's name. For an action, `action__<slug>`. */
|
|
5
12
|
toolName: string;
|
|
13
|
+
/**
|
|
14
|
+
* Unique id of the call, stable for its whole life and equal to the
|
|
15
|
+
* `data-tf-tool-call-id` attribute on its row. Empty when the call has no
|
|
16
|
+
* id.
|
|
17
|
+
*/
|
|
6
18
|
toolCallId: string;
|
|
19
|
+
/** Where the call is in its life. See ToolCallState for each value. */
|
|
7
20
|
status: ToolCallState;
|
|
21
|
+
/**
|
|
22
|
+
* True while an approval or a question tied to this call is waiting on the
|
|
23
|
+
* user. The view may say so, but the decision itself happens in the
|
|
24
|
+
* assistant's own card, never in the view.
|
|
25
|
+
*/
|
|
8
26
|
awaitingDecision: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The arguments the agent passed, parsed, without the short caption the
|
|
29
|
+
* agent writes for each step; `{}` while they are still streaming in or if
|
|
30
|
+
* they are not a JSON object. For an action, `{ path_params, query, body
|
|
31
|
+
* }`, with one key for each part your API operation declares.
|
|
32
|
+
*/
|
|
9
33
|
args: TArgs;
|
|
34
|
+
/**
|
|
35
|
+
* The parsed result once the call has finished; for an action, your API's
|
|
36
|
+
* response body alone (read the HTTP status with
|
|
37
|
+
* `actionEnvelopeOf(resultText)`). Undefined until the result arrives, when
|
|
38
|
+
* it is not JSON, or when `truncated` is true.
|
|
39
|
+
*/
|
|
10
40
|
result?: TResult;
|
|
41
|
+
/**
|
|
42
|
+
* The raw result text as recorded. Undefined until the call finishes, and
|
|
43
|
+
* withheld for calls that failed, were not approved, didn't run, were
|
|
44
|
+
* declined or had their result replaced by a preview.
|
|
45
|
+
*/
|
|
11
46
|
resultText?: string;
|
|
47
|
+
/**
|
|
48
|
+
* True when the result was cut to fit a size limit. `result` is then
|
|
49
|
+
* undefined and `resultText` holds only the cut text, so don't show it as
|
|
50
|
+
* complete.
|
|
51
|
+
*/
|
|
12
52
|
truncated?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* True when the result was too large for the agent and was replaced by a
|
|
55
|
+
* shortened preview. The tool's real output is not available to the view.
|
|
56
|
+
*/
|
|
13
57
|
offloaded?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Why the call failed, set when it failed. Use humanFailureSentenceOf to
|
|
60
|
+
* get a sentence fit for the user, and actionFailureOf to read an action's
|
|
61
|
+
* HTTP status, error code and per-field problems.
|
|
62
|
+
*/
|
|
14
63
|
errorText?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Teaflask's reason for declining the call, set when `status` is "refused".
|
|
66
|
+
*/
|
|
15
67
|
refusalText?: string;
|
|
68
|
+
/**
|
|
69
|
+
* The JSON Schema of the tool's arguments, when it declared one. For an
|
|
70
|
+
* action, built from your operation's path, query and body schemas;
|
|
71
|
+
* undefined (never `{}`) otherwise, so a view must still work without it.
|
|
72
|
+
*/
|
|
16
73
|
argsSchema?: JsonSchema;
|
|
74
|
+
/**
|
|
75
|
+
* The JSON Schema of the tool's successful result, when it declared one.
|
|
76
|
+
* For an action, your operation's success response body schema, which
|
|
77
|
+
* matches `result`; undefined otherwise.
|
|
78
|
+
*/
|
|
17
79
|
resultSchema?: JsonSchema;
|
|
18
80
|
}
|
|
81
|
+
/** What a tool view's `mount` and `update` receive. */
|
|
19
82
|
export interface ToolViewProps<TArgs = Record<string, unknown>, TResult = unknown> {
|
|
83
|
+
/** The call to draw. */
|
|
20
84
|
call: ToolViewCall<TArgs, TResult>;
|
|
85
|
+
/**
|
|
86
|
+
* `themeMode` is the palette the assistant is actually painted in, "light"
|
|
87
|
+
* or "dark", with an "auto" setting already resolved. A change arrives
|
|
88
|
+
* through `update`.
|
|
89
|
+
*/
|
|
21
90
|
context: {
|
|
22
91
|
themeMode: ToolViewThemeMode;
|
|
23
92
|
};
|
|
24
93
|
}
|
|
94
|
+
/** A mounted tool view, as returned from `mount`. */
|
|
25
95
|
export interface ToolViewInstance<TArgs = Record<string, unknown>, TResult = unknown> {
|
|
96
|
+
/**
|
|
97
|
+
* Called with new props whenever the call changes (arguments arrive, status
|
|
98
|
+
* advances, the result lands, an approval opens or settles) or the theme
|
|
99
|
+
* changes. Apply them to the existing view so the user's state in it
|
|
100
|
+
* survives; a throw makes the assistant show the next matching view.
|
|
101
|
+
*/
|
|
26
102
|
update(props: ToolViewProps<TArgs, TResult>): void;
|
|
103
|
+
/**
|
|
104
|
+
* Called when the view is removed. Release any listeners, timers or roots
|
|
105
|
+
* you created.
|
|
106
|
+
*/
|
|
27
107
|
destroy(): void;
|
|
28
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* A tool view, which draws one tool or action call inside its row in the
|
|
111
|
+
* conversation in place of the default view of its arguments. Write one
|
|
112
|
+
* directly for plain DOM or any framework, or create one from a React component
|
|
113
|
+
* with reactToolView.
|
|
114
|
+
*/
|
|
29
115
|
export interface ToolViewAdapter<TArgs = Record<string, unknown>, TResult = unknown> {
|
|
116
|
+
/**
|
|
117
|
+
* Called once per call, even while its row is collapsed. Draw into
|
|
118
|
+
* `container` (the assistant owns it) and return the instance that receives
|
|
119
|
+
* updates; if `mount` throws, the error goes to the provider's `onError`
|
|
120
|
+
* and the next matching view is shown instead.
|
|
121
|
+
*/
|
|
30
122
|
mount(container: HTMLElement, props: ToolViewProps<TArgs, TResult>): ToolViewInstance<TArgs, TResult>;
|
|
31
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* A custom icon for a tool call, drawn in place of the default glyph in the
|
|
126
|
+
* small mark beside the row's label. Same mount, update and destroy lifecycle
|
|
127
|
+
* as a view; reactToolView can create one from a React component.
|
|
128
|
+
*/
|
|
32
129
|
export interface IconAdapter<TArgs = Record<string, unknown>, TResult = unknown> {
|
|
130
|
+
/**
|
|
131
|
+
* Draws the icon into `container` and returns the instance that receives
|
|
132
|
+
* later updates and teardown. If it throws, the next matching icon or the
|
|
133
|
+
* default glyph is shown instead.
|
|
134
|
+
*/
|
|
33
135
|
mount(container: HTMLElement, props: ToolViewProps<TArgs, TResult>): ToolViewInstance<TArgs, TResult>;
|
|
34
136
|
}
|
|
137
|
+
/** One entry in your tool-view registry, carrying a view, an icon, or both. */
|
|
35
138
|
export interface ToolViewRegistration {
|
|
36
|
-
|
|
139
|
+
/**
|
|
140
|
+
* Leave it out for your own tools and actions; they match by tool name,
|
|
141
|
+
* which ignores it. It only matters for a view key the server names, which
|
|
142
|
+
* must match this version exactly.
|
|
143
|
+
*/
|
|
144
|
+
version?: number;
|
|
145
|
+
/**
|
|
146
|
+
* Draws the call in its row's body, replacing the default view of its
|
|
147
|
+
* arguments.
|
|
148
|
+
*/
|
|
37
149
|
view?: ToolViewAdapter;
|
|
150
|
+
/**
|
|
151
|
+
* Replaces the glyph in the small mark beside the row's label. The mark's
|
|
152
|
+
* frame stays.
|
|
153
|
+
*/
|
|
38
154
|
icon?: IconAdapter;
|
|
39
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Your tool views, keyed by tool name (for an action, `action__<slug>`; see
|
|
158
|
+
* actionToolViews) or by a view key the server names, and passed as `toolViews`
|
|
159
|
+
* on the provider or the script-tag element. Keys starting with `teaflask.` are
|
|
160
|
+
* reserved and ignored.
|
|
161
|
+
*/
|
|
40
162
|
export type ToolViewRegistry = Readonly<Record<string, ToolViewRegistration>>;
|
|
41
163
|
export declare function isReservedToolViewKey(key: string): boolean;
|
|
42
164
|
export declare const PACKAGE_TOOL_VIEWS: ToolViewRegistry;
|
|
165
|
+
/**
|
|
166
|
+
* Returns the tool name an action runs under, `action__<slug>`, where the slug
|
|
167
|
+
* is the one shown for the action on its Actions page in Teaflask.
|
|
168
|
+
*/
|
|
43
169
|
export declare function actionToolName(slug: string): string;
|
|
170
|
+
/**
|
|
171
|
+
* Builds a tool-view registry keyed by action slug instead of tool name, by
|
|
172
|
+
* turning each slug into `action__<slug>`. Spread the result beside a registry
|
|
173
|
+
* of ordinary tool names and pass both as `toolViews`.
|
|
174
|
+
*/
|
|
44
175
|
export declare function actionToolViews(bySlug: Readonly<Record<string, ToolViewRegistration>>): ToolViewRegistry;
|
|
176
|
+
/** One tool view that matches a call, and how it matched. */
|
|
45
177
|
export interface ResolvedToolView {
|
|
178
|
+
/**
|
|
179
|
+
* How the view matched, where lower wins. 1 is your registry by the view
|
|
180
|
+
* key and version the server named for this call, 2 is your registry by the
|
|
181
|
+
* call's exact tool name (for an action, `action__<slug>`), and 3 is a view
|
|
182
|
+
* built into the package; because 2 beats 3, registering under a built-in
|
|
183
|
+
* tool's name replaces its view, and with no match at all the package's
|
|
184
|
+
* default view of the arguments is shown.
|
|
185
|
+
*/
|
|
46
186
|
rung: 1 | 2 | 3;
|
|
187
|
+
/**
|
|
188
|
+
* The registry key that matched, either the server-named view key or the
|
|
189
|
+
* tool name.
|
|
190
|
+
*/
|
|
47
191
|
key: string;
|
|
192
|
+
/** The view to mount. */
|
|
48
193
|
adapter: ToolViewAdapter;
|
|
49
194
|
}
|
|
195
|
+
/** One tool-call icon that matches a call, and how it matched. */
|
|
50
196
|
export interface ResolvedToolViewIcon {
|
|
197
|
+
/**
|
|
198
|
+
* How the icon matched, with the same meaning as ResolvedToolView.rung. 1
|
|
199
|
+
* is your registry by the server-named view key and version, 2 is your
|
|
200
|
+
* registry by exact tool name, and 3 is a built-in.
|
|
201
|
+
*/
|
|
51
202
|
rung: 1 | 2 | 3;
|
|
203
|
+
/**
|
|
204
|
+
* The registry key that matched, either the server-named view key or the
|
|
205
|
+
* tool name.
|
|
206
|
+
*/
|
|
52
207
|
key: string;
|
|
208
|
+
/** The icon to mount. */
|
|
53
209
|
adapter: IconAdapter;
|
|
54
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* The views and icons that match one call, best first, plus the call they will
|
|
213
|
+
* receive.
|
|
214
|
+
*/
|
|
55
215
|
export interface ToolViewResolution {
|
|
216
|
+
/**
|
|
217
|
+
* Matching views, best first. The first that mounts without throwing is
|
|
218
|
+
* shown; an empty list means the default view of the arguments.
|
|
219
|
+
*/
|
|
56
220
|
views: readonly ResolvedToolView[];
|
|
221
|
+
/** Matching icons, best first. An empty list means the default glyph. */
|
|
57
222
|
icons: readonly ResolvedToolViewIcon[];
|
|
223
|
+
/** The call the matched view receives, built the first time it is read. */
|
|
58
224
|
call: ToolViewCall;
|
|
59
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Finds the registered views and icons that match one tool call, best first,
|
|
228
|
+
* from the view the server named for it (if any), its tool name and your
|
|
229
|
+
* registry. The assistant does this for you; call it only if you render tool
|
|
230
|
+
* calls yourself, and treat an empty `views` list as "use the default view of
|
|
231
|
+
* the arguments".
|
|
232
|
+
*/
|
|
60
233
|
export declare function resolvedToolViewsOf(ref: {
|
|
61
234
|
key: string;
|
|
62
235
|
version: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Message } from "@ag-ui/core";
|
|
2
2
|
import type { TurnAttachment } from "../contract/threads.js";
|
|
3
3
|
import type { UserTurnMeta } from "./user-turn-ledger.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { TranscriptMarkers } from "./connection-epoch.js";
|
|
5
5
|
import { type MemoryUpdated } from "./memory-provenance-anchors.js";
|
|
6
6
|
import type { BlockTiming } from "./segment-timing.js";
|
|
7
7
|
import { type SubagentGroupRow } from "./subagent-rows.js";
|
|
@@ -10,61 +10,196 @@ import type { AnchoredTurnFailReceipts } from "./turn-failed-anchors.js";
|
|
|
10
10
|
import type { ToolCallDisplay, ToolCallState } from "./tool-call-display.js";
|
|
11
11
|
import type { ToolCallSchemas } from "./tool-schema-anchors.js";
|
|
12
12
|
export type MarkerPosition = "before" | "after";
|
|
13
|
+
/** A message the user sent. */
|
|
13
14
|
export interface UserMessageRow {
|
|
15
|
+
/** Identifies a user message row. */
|
|
14
16
|
kind: "user";
|
|
17
|
+
/** Stable unique key for this row, which is also the user message's id. */
|
|
15
18
|
key: string;
|
|
19
|
+
/** What the user typed. Empty when the message carries only attachments. */
|
|
16
20
|
text: string;
|
|
21
|
+
/** The files attached to the message, in upload order. */
|
|
17
22
|
attachments: TurnAttachment[];
|
|
23
|
+
/**
|
|
24
|
+
* When the message was sent, as an ISO-8601 timestamp from the server.
|
|
25
|
+
* Absent on an optimistic row and when transcriptRowsOf was given no turn
|
|
26
|
+
* metadata.
|
|
27
|
+
*/
|
|
18
28
|
createdAt?: string;
|
|
29
|
+
/**
|
|
30
|
+
* True while the message has been sent but not yet confirmed by the
|
|
31
|
+
* conversation; it already sits in its final position.
|
|
32
|
+
*/
|
|
19
33
|
optimistic?: true;
|
|
20
34
|
}
|
|
35
|
+
/** A block of the assistant's reply text. */
|
|
21
36
|
export interface AssistantTextRow {
|
|
37
|
+
/** Identifies an assistant reply row. */
|
|
22
38
|
kind: "assistant-text";
|
|
39
|
+
/** Stable unique key for this row, suitable as a React list key. */
|
|
23
40
|
key: string;
|
|
41
|
+
/**
|
|
42
|
+
* The reply as Markdown. While `streaming` is true it may end mid-sentence
|
|
43
|
+
* or mid-syntax.
|
|
44
|
+
*/
|
|
24
45
|
text: string;
|
|
46
|
+
/**
|
|
47
|
+
* True only on the newest reply text while the assistant is still working,
|
|
48
|
+
* meaning the text is still growing.
|
|
49
|
+
*/
|
|
25
50
|
streaming: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Memories the assistant saved during the run that produced this message,
|
|
53
|
+
* in the order they were saved. Absent when it saved none.
|
|
54
|
+
*/
|
|
26
55
|
memoryUpdates?: MemoryUpdated[];
|
|
27
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* The model's visible thinking before or between its replies and tool calls.
|
|
59
|
+
*/
|
|
28
60
|
export interface ReasoningRow {
|
|
61
|
+
/** Identifies a reasoning row. */
|
|
29
62
|
kind: "reasoning";
|
|
63
|
+
/** Stable unique key for this row, suitable as a React list key. */
|
|
30
64
|
key: string;
|
|
65
|
+
/** The reasoning text. */
|
|
31
66
|
text: string;
|
|
67
|
+
/**
|
|
68
|
+
* True while this is the newest message and the assistant is still working;
|
|
69
|
+
* turns false as soon as reply text or a tool call starts, which is a good
|
|
70
|
+
* moment to collapse it.
|
|
71
|
+
*/
|
|
32
72
|
streaming: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* When the reasoning started and ended by the server's clock. Absent when
|
|
75
|
+
* the history carries no timestamps, which means unknown rather than zero.
|
|
76
|
+
*/
|
|
33
77
|
timing?: BlockTiming;
|
|
34
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* One tool or action call the agent made, with its arguments, state and result.
|
|
81
|
+
*/
|
|
35
82
|
export interface ToolCallRow {
|
|
83
|
+
/** Identifies a tool call row. */
|
|
36
84
|
kind: "tool-call";
|
|
85
|
+
/** Stable unique key for this row, suitable as a React list key. */
|
|
37
86
|
key: string;
|
|
87
|
+
/** The call's id, which also keys this call in the markerAnchors maps. */
|
|
38
88
|
toolCallId: string;
|
|
89
|
+
/**
|
|
90
|
+
* The name of the tool the agent called; an action appears as
|
|
91
|
+
* `action__<slug>`.
|
|
92
|
+
*/
|
|
39
93
|
toolName: string;
|
|
94
|
+
/**
|
|
95
|
+
* Where the call stands. output-available means the result arrived,
|
|
96
|
+
* output-error it failed, denied the user declined its approval, cancelled
|
|
97
|
+
* it was stopped before it ran, refused the tool declined the request,
|
|
98
|
+
* superseded a retry abandoned it, input-available it awaits its result
|
|
99
|
+
* while the assistant works, and input-streaming it has no result while the
|
|
100
|
+
* assistant is not working (for example, paused for an approval).
|
|
101
|
+
*/
|
|
40
102
|
state: ToolCallState;
|
|
103
|
+
/**
|
|
104
|
+
* The arguments as raw JSON text, which may be incomplete while they are
|
|
105
|
+
* still streaming.
|
|
106
|
+
*/
|
|
41
107
|
argsText: string;
|
|
108
|
+
/**
|
|
109
|
+
* The result text exactly as the agent received it. Undefined until it
|
|
110
|
+
* arrives.
|
|
111
|
+
*/
|
|
42
112
|
result?: string;
|
|
113
|
+
/**
|
|
114
|
+
* True when the tool's output was too large and `result` holds a shortened
|
|
115
|
+
* stand-in rather than the actual output; show a "result shortened" note
|
|
116
|
+
* instead of the content.
|
|
117
|
+
*/
|
|
43
118
|
offloaded: boolean;
|
|
119
|
+
/** Why the call failed. Present only when state is output-error. */
|
|
44
120
|
errorText?: string;
|
|
121
|
+
/**
|
|
122
|
+
* The tool's explanation for declining the request. Present only when state
|
|
123
|
+
* is refused.
|
|
124
|
+
*/
|
|
45
125
|
refusalText?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Captions, status text, an icon and a tool view reference supplied by the
|
|
128
|
+
* server for this call. Absent when it supplied none.
|
|
129
|
+
*/
|
|
46
130
|
display?: ToolCallDisplay;
|
|
131
|
+
/**
|
|
132
|
+
* The JSON Schemas declared for this tool's arguments and result. Absent
|
|
133
|
+
* when the tool declared none.
|
|
134
|
+
*/
|
|
47
135
|
schemas?: ToolCallSchemas;
|
|
136
|
+
/**
|
|
137
|
+
* When the call started and finished by the server's clock. Absent when the
|
|
138
|
+
* history carries no timestamps, which means unknown rather than zero.
|
|
139
|
+
*/
|
|
48
140
|
timing?: BlockTiming;
|
|
141
|
+
/**
|
|
142
|
+
* True when the user was asked to approve this call or answer a question
|
|
143
|
+
* for it; it stays true after the decision and after a reload.
|
|
144
|
+
*/
|
|
49
145
|
decisionBearing?: boolean;
|
|
50
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* A notice shown after the last message of a turn that failed for a reason
|
|
149
|
+
* outside any single tool call, such as the model provider, usage limits or a
|
|
150
|
+
* lost connection.
|
|
151
|
+
*/
|
|
51
152
|
export interface TurnFailedReceiptsRow {
|
|
153
|
+
/** Identifies a failed-turn notice row. */
|
|
52
154
|
kind: "turn-failed-receipts";
|
|
155
|
+
/** Stable unique key for this row, suitable as a React list key. */
|
|
53
156
|
key: string;
|
|
157
|
+
/**
|
|
158
|
+
* Sentences explaining the failure, written to be shown to the user as they
|
|
159
|
+
* are.
|
|
160
|
+
*/
|
|
54
161
|
receipts: AnchoredTurnFailReceipts[MarkerPosition];
|
|
55
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* A divider shown before the assistant's reply in a turn it started on its own
|
|
165
|
+
* to report finished sub-agent results; such turns have no user message.
|
|
166
|
+
*/
|
|
56
167
|
export interface SubagentDeliveryRow {
|
|
168
|
+
/** Identifies a sub-agent delivery divider row. */
|
|
57
169
|
kind: "subagent-delivery";
|
|
170
|
+
/** Stable unique key for this row, suitable as a React list key. */
|
|
58
171
|
key: string;
|
|
172
|
+
/** The finished sub-agents whose results this turn reports. */
|
|
59
173
|
results: DeliveredResult[];
|
|
60
174
|
}
|
|
175
|
+
/** One row of the transcript. Switch on `kind` to pick how to render it. */
|
|
61
176
|
export type TranscriptRow = UserMessageRow | AssistantTextRow | ReasoningRow | ToolCallRow | SubagentGroupRow | TurnFailedReceiptsRow | SubagentDeliveryRow;
|
|
177
|
+
/**
|
|
178
|
+
* A message the user has just sent that the transcript does not contain yet,
|
|
179
|
+
* shown optimistically until it arrives.
|
|
180
|
+
*/
|
|
62
181
|
export interface PendingUserEcho {
|
|
182
|
+
/**
|
|
183
|
+
* Temporary id for the message; it switches to the message's real id once
|
|
184
|
+
* the send succeeds, so the echo is dropped when that row arrives.
|
|
185
|
+
*/
|
|
63
186
|
messageId: string;
|
|
187
|
+
/** What the user typed. */
|
|
64
188
|
text: string;
|
|
189
|
+
/** The files attached to the message, in upload order. */
|
|
65
190
|
attachments: TurnAttachment[];
|
|
66
191
|
}
|
|
67
|
-
|
|
192
|
+
/**
|
|
193
|
+
* Builds the transcript rows from the raw message list and its extra facts,
|
|
194
|
+
* exactly as useTranscript does. Pure; call it only when you need to derive
|
|
195
|
+
* rows from your own inputs.
|
|
196
|
+
*/
|
|
197
|
+
export declare function transcriptRowsOf(messages: readonly Message[], anchors: TranscriptMarkers, running: boolean, metaByMessageId?: ReadonlyMap<string, UserTurnMeta>): TranscriptRow[];
|
|
198
|
+
/**
|
|
199
|
+
* Appends the just-sent user message to the rows as an optimistic user row,
|
|
200
|
+
* unless a user row with the same key is already present. Returns the rows
|
|
201
|
+
* unchanged when `echo` is null.
|
|
202
|
+
*/
|
|
68
203
|
export declare function withPendingUserEcho(rows: readonly TranscriptRow[], echo: PendingUserEcho | null): readonly TranscriptRow[];
|
|
69
204
|
export declare function trailingRowIsStreaming(rows: readonly TranscriptRow[]): boolean;
|
|
70
205
|
export declare function errorTextOf(recordedError: string | undefined, result: string | undefined): string | undefined;
|
|
@@ -77,7 +212,7 @@ export interface TranscriptBlock {
|
|
|
77
212
|
messageId: string;
|
|
78
213
|
rows: TranscriptRow[];
|
|
79
214
|
}
|
|
80
|
-
export declare function transcriptBlocksOf(messages: readonly Message[], anchors:
|
|
215
|
+
export declare function transcriptBlocksOf(messages: readonly Message[], anchors: TranscriptMarkers, running: boolean, metaByMessageId?: ReadonlyMap<string, UserTurnMeta>, options?: {
|
|
81
216
|
markerBoundaries?: MarkerBoundaries;
|
|
82
217
|
attachmentsByMessageId?: ReadonlyMap<string, TurnAttachment[]>;
|
|
83
218
|
}): TranscriptBlock[];
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { receiptOf, wellFormedReceiptAnchorsOf, withReceiptAnchored, type AnchoredReceipts } from "./receipt-anchors.js";
|
|
2
2
|
import type { AgentSubscriber } from "@ag-ui/client";
|
|
3
|
+
/**
|
|
4
|
+
* The failure sentences for a failed turn, split by whether they are shown
|
|
5
|
+
* before or after the message they belong to.
|
|
6
|
+
*/
|
|
3
7
|
export type AnchoredTurnFailReceipts = AnchoredReceipts;
|
|
4
8
|
export declare const EMPTY_TURN_FAILED_ANCHORS: ReadonlyMap<string, AnchoredTurnFailReceipts>;
|
|
5
9
|
export declare const turnFailedReceiptOf: typeof receiptOf;
|
|
@@ -8,8 +8,11 @@ export interface UserTurnRecord {
|
|
|
8
8
|
attachments: TurnAttachment[];
|
|
9
9
|
createdAt: string;
|
|
10
10
|
}
|
|
11
|
+
/** The send time and attachments of one user message. */
|
|
11
12
|
export interface UserTurnMeta {
|
|
13
|
+
/** The files attached to the message, in upload order. */
|
|
12
14
|
attachments: TurnAttachment[];
|
|
15
|
+
/** When the message was sent, as an ISO-8601 timestamp from the server. */
|
|
13
16
|
createdAt: string;
|
|
14
17
|
}
|
|
15
18
|
export interface InjectableTurnLedger {
|
|
@@ -21,6 +21,7 @@ export declare const ApiErrorCode: {
|
|
|
21
21
|
readonly DOC_SLUG_RESERVED: "DOC_SLUG_RESERVED";
|
|
22
22
|
readonly DOC_REVISION_NOT_PUBLISHABLE: "DOC_REVISION_NOT_PUBLISHABLE";
|
|
23
23
|
readonly DOC_REVISION_NOT_DISCARDABLE: "DOC_REVISION_NOT_DISCARDABLE";
|
|
24
|
+
readonly DOC_PROPOSAL_STALE: "DOC_PROPOSAL_STALE";
|
|
24
25
|
readonly DOC_LIMIT_REACHED: "DOC_LIMIT_REACHED";
|
|
25
26
|
readonly HELP_SITE_CONFIG_INVALID: "HELP_SITE_CONFIG_INVALID";
|
|
26
27
|
readonly HELP_SITE_NEVER_PUBLISHED: "HELP_SITE_NEVER_PUBLISHED";
|
|
@@ -20,6 +20,7 @@ export const ApiErrorCode = {
|
|
|
20
20
|
DOC_SLUG_RESERVED: "DOC_SLUG_RESERVED",
|
|
21
21
|
DOC_REVISION_NOT_PUBLISHABLE: "DOC_REVISION_NOT_PUBLISHABLE",
|
|
22
22
|
DOC_REVISION_NOT_DISCARDABLE: "DOC_REVISION_NOT_DISCARDABLE",
|
|
23
|
+
DOC_PROPOSAL_STALE: "DOC_PROPOSAL_STALE",
|
|
23
24
|
DOC_LIMIT_REACHED: "DOC_LIMIT_REACHED",
|
|
24
25
|
HELP_SITE_CONFIG_INVALID: "HELP_SITE_CONFIG_INVALID",
|
|
25
26
|
HELP_SITE_NEVER_PUBLISHED: "HELP_SITE_NEVER_PUBLISHED",
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A turn's state. "queued" waits behind an earlier turn; "working" is running;
|
|
3
|
+
* "awaiting_input" is paused for an approval, an answer to a question or a
|
|
4
|
+
* browser tool result; "parked" waited too long and stopped, though a late
|
|
5
|
+
* answer still resumes it; "succeeded" and "failed" are finished; "superseded"
|
|
6
|
+
* means a new message replaced a parked turn's pending work; "stopped" means
|
|
7
|
+
* the user stopped it.
|
|
8
|
+
*/
|
|
1
9
|
export type AssistantTurnStatus = (typeof AssistantTurnStatus)[keyof typeof AssistantTurnStatus];
|
|
10
|
+
/**
|
|
11
|
+
* A turn's state. "queued" waits behind an earlier turn; "working" is running;
|
|
12
|
+
* "awaiting_input" is paused for an approval, an answer to a question or a
|
|
13
|
+
* browser tool result; "parked" waited too long and stopped, though a late
|
|
14
|
+
* answer still resumes it; "succeeded" and "failed" are finished; "superseded"
|
|
15
|
+
* means a new message replaced a parked turn's pending work; "stopped" means
|
|
16
|
+
* the user stopped it.
|
|
17
|
+
*/
|
|
2
18
|
export declare const AssistantTurnStatus: {
|
|
3
19
|
readonly queued: "queued";
|
|
4
20
|
readonly working: "working";
|
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
import type { ThreadModelPickResponse } from "./threadModelPickResponse.js";
|
|
2
|
+
/** One conversation between a user and your assistant. */
|
|
2
3
|
export interface ServingAssistantThreadResponse {
|
|
4
|
+
/** The conversation's id, stable for its whole life. */
|
|
3
5
|
id: string;
|
|
6
|
+
/**
|
|
7
|
+
* A short label taken from the first line of the first message (cut to 50
|
|
8
|
+
* characters), or the first attachment's filename when that message had no
|
|
9
|
+
* text.
|
|
10
|
+
*/
|
|
4
11
|
title: string;
|
|
12
|
+
/**
|
|
13
|
+
* True while the assistant has work running or queued in this conversation;
|
|
14
|
+
* false once it settles, or once a pause has outlived its wait and parked.
|
|
15
|
+
*/
|
|
5
16
|
busy: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The id of the conversation's live event stream, which differs from id.
|
|
19
|
+
* The package connects to the stream for you.
|
|
20
|
+
*/
|
|
6
21
|
stream_thread_id: string;
|
|
22
|
+
/** When the conversation was created, as an ISO 8601 timestamp. */
|
|
7
23
|
created_at: string;
|
|
24
|
+
/** When the conversation was last updated, as an ISO 8601 timestamp. */
|
|
8
25
|
updated_at: string;
|
|
26
|
+
/**
|
|
27
|
+
* The user's stored model and effort choice, or null when there is none and
|
|
28
|
+
* the assistant's configured model answers. The server may clear it between
|
|
29
|
+
* turns, for example when the model is no longer offered, so trust this
|
|
30
|
+
* over any locally remembered choice.
|
|
31
|
+
*/
|
|
9
32
|
model_pick?: ThreadModelPickResponse | null;
|
|
10
33
|
}
|
|
@@ -1,9 +1,38 @@
|
|
|
1
1
|
import type { AttachmentKind } from "./attachmentKind.js";
|
|
2
|
+
/**
|
|
3
|
+
* An uploaded file, as returned when you start an upload and when you finalize
|
|
4
|
+
* it.
|
|
5
|
+
*/
|
|
2
6
|
export interface ServingAttachmentResponse {
|
|
7
|
+
/**
|
|
8
|
+
* The attachment's id; pass it in sendMessage's attachment ids to send the
|
|
9
|
+
* file with a message.
|
|
10
|
+
*/
|
|
3
11
|
id: string;
|
|
12
|
+
/**
|
|
13
|
+
* What the file is, detected from its contents when the upload is
|
|
14
|
+
* finalized. Reads "file" until then, and for anything not recognized as an
|
|
15
|
+
* image, document, video or audio.
|
|
16
|
+
*/
|
|
4
17
|
kind: AttachmentKind;
|
|
18
|
+
/**
|
|
19
|
+
* The detected format, such as "png", "pdf", "txt" or "mp4". Null until the
|
|
20
|
+
* upload is finalized, and for kind "file".
|
|
21
|
+
*/
|
|
5
22
|
format: string | null;
|
|
23
|
+
/**
|
|
24
|
+
* The file's name without any folder path or control characters, shortened
|
|
25
|
+
* if very long.
|
|
26
|
+
*/
|
|
6
27
|
filename: string;
|
|
28
|
+
/**
|
|
29
|
+
* The file's size in bytes, as declared when the upload started and as
|
|
30
|
+
* measured once it is finalized.
|
|
31
|
+
*/
|
|
7
32
|
byte_size: number;
|
|
33
|
+
/**
|
|
34
|
+
* True once the upload is finalized; only ready attachments can be sent
|
|
35
|
+
* with a message.
|
|
36
|
+
*/
|
|
8
37
|
ready: boolean;
|
|
9
38
|
}
|
|
@@ -1,4 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The error codes the Teaflask API returns. PUBLISHABLE_KEY_INVALID,
|
|
3
|
+
* ORIGIN_NOT_ALLOWED and END_USER_TOKEN_INVALID mean a setup problem in your
|
|
4
|
+
* integration; RATE_LIMITED and ORCHESTRATION_UNAVAILABLE clear on retry;
|
|
5
|
+
* ASSISTANT_SIGN_IN_REQUIRED means the assistant only serves signed-in users;
|
|
6
|
+
* ASSISTANT_UNFUNDED means your Teaflask organization has no funds to pay for
|
|
7
|
+
* replies; the SUBSCRIPTION_ codes come from a user connecting their own
|
|
8
|
+
* ChatGPT plan.
|
|
9
|
+
*/
|
|
1
10
|
export type ServingErrorCode = (typeof ServingErrorCode)[keyof typeof ServingErrorCode];
|
|
11
|
+
/**
|
|
12
|
+
* The error codes the Teaflask API returns. PUBLISHABLE_KEY_INVALID,
|
|
13
|
+
* ORIGIN_NOT_ALLOWED and END_USER_TOKEN_INVALID mean a setup problem in your
|
|
14
|
+
* integration; RATE_LIMITED and ORCHESTRATION_UNAVAILABLE clear on retry;
|
|
15
|
+
* ASSISTANT_SIGN_IN_REQUIRED means the assistant only serves signed-in users;
|
|
16
|
+
* ASSISTANT_UNFUNDED means your Teaflask organization has no funds to pay for
|
|
17
|
+
* replies; the SUBSCRIPTION_ codes come from a user connecting their own
|
|
18
|
+
* ChatGPT plan.
|
|
19
|
+
*/
|
|
2
20
|
export declare const ServingErrorCode: {
|
|
3
21
|
readonly PUBLISHABLE_KEY_INVALID: "PUBLISHABLE_KEY_INVALID";
|
|
4
22
|
readonly ORIGIN_NOT_ALLOWED: "ORIGIN_NOT_ALLOWED";
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import type { AttachmentKind } from "./attachmentKind.js";
|
|
2
|
+
/**
|
|
3
|
+
* A file sent with a turn's message, as listed with the message; the built-in
|
|
4
|
+
* conversation shows it as a chip.
|
|
5
|
+
*/
|
|
2
6
|
export interface ServingTurnAttachmentResponse {
|
|
7
|
+
/** The attachment's id. */
|
|
3
8
|
id: string;
|
|
9
|
+
/** What the file is, detected from its contents. */
|
|
4
10
|
kind: AttachmentKind;
|
|
11
|
+
/**
|
|
12
|
+
* The detected format, such as "png", "pdf", "txt" or "mp4"; null for kind
|
|
13
|
+
* "file".
|
|
14
|
+
*/
|
|
5
15
|
format: string | null;
|
|
16
|
+
/** The file's name. */
|
|
6
17
|
filename: string;
|
|
18
|
+
/** The file's size in bytes. */
|
|
7
19
|
byte_size: number;
|
|
8
20
|
}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How much reasoning the model spends on each reply, from least to most: low,
|
|
3
|
+
* medium, high, xhigh, max. A level the answering model doesn't support is
|
|
4
|
+
* moved to the nearest one it does.
|
|
5
|
+
*/
|
|
1
6
|
export type ThinkingEffort = (typeof ThinkingEffort)[keyof typeof ThinkingEffort];
|
|
7
|
+
/**
|
|
8
|
+
* How much reasoning the model spends on each reply, from least to most: low,
|
|
9
|
+
* medium, high, xhigh, max. A level the answering model doesn't support is
|
|
10
|
+
* moved to the nearest one it does.
|
|
11
|
+
*/
|
|
2
12
|
export declare const ThinkingEffort: {
|
|
3
13
|
readonly low: "low";
|
|
4
14
|
readonly medium: "medium";
|