@slices.sh/ai-chat 0.1.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/LICENSE +21 -0
- package/dist/exports.json +794 -0
- package/dist/fixture/fixture-approval.d.ts +4 -0
- package/dist/fixture/fixture-approval.js +59 -0
- package/dist/fixture/fixture-artifacts.d.ts +2 -0
- package/dist/fixture/fixture-artifacts.js +48 -0
- package/dist/fixture/fixture-question.d.ts +5 -0
- package/dist/fixture/fixture-question.js +93 -0
- package/dist/fixture/fixture-script.d.ts +35 -0
- package/dist/fixture/fixture-script.js +280 -0
- package/dist/fixture/fixture-selection.d.ts +5 -0
- package/dist/fixture/fixture-selection.js +20 -0
- package/dist/fixture/fixture.d.ts +20 -0
- package/dist/fixture/fixture.js +75 -0
- package/dist/fixture/provider.d.ts +15 -0
- package/dist/fixture/provider.js +14 -0
- package/dist/headless/always-allow.d.ts +2 -0
- package/dist/headless/always-allow.js +24 -0
- package/dist/headless/answer.d.ts +6 -0
- package/dist/headless/answer.js +29 -0
- package/dist/headless/approval-error.d.ts +2 -0
- package/dist/headless/approval-error.js +16 -0
- package/dist/headless/approval-reason.d.ts +2 -0
- package/dist/headless/approval-reason.js +13 -0
- package/dist/headless/approval-receipt.d.ts +4 -0
- package/dist/headless/approval-receipt.js +13 -0
- package/dist/headless/approve.d.ts +4 -0
- package/dist/headless/approve.js +15 -0
- package/dist/headless/branch-navigation.d.ts +2 -0
- package/dist/headless/branch-navigation.js +11 -0
- package/dist/headless/branch-next.d.ts +2 -0
- package/dist/headless/branch-next.js +21 -0
- package/dist/headless/branch-page.d.ts +5 -0
- package/dist/headless/branch-page.js +13 -0
- package/dist/headless/branch-previous.d.ts +2 -0
- package/dist/headless/branch-previous.js +21 -0
- package/dist/headless/cancel-edit.d.ts +2 -0
- package/dist/headless/cancel-edit.js +10 -0
- package/dist/headless/cancel-queue-edit.d.ts +2 -0
- package/dist/headless/cancel-queue-edit.js +15 -0
- package/dist/headless/cancel-queued.d.ts +2 -0
- package/dist/headless/cancel-queued.js +15 -0
- package/dist/headless/chat-dictation/confirm.d.ts +2 -0
- package/dist/headless/chat-dictation/confirm.js +14 -0
- package/dist/headless/chat-dictation/index.d.ts +12 -0
- package/dist/headless/chat-dictation/index.js +9 -0
- package/dist/headless/chat-dictation/input.d.ts +3 -0
- package/dist/headless/chat-dictation/input.js +42 -0
- package/dist/headless/chat-dictation/root.d.ts +3 -0
- package/dist/headless/chat-dictation/root.js +42 -0
- package/dist/headless/chat-dictation/text.d.ts +3 -0
- package/dist/headless/chat-dictation/text.js +14 -0
- package/dist/headless/chat-dictation/voice.d.ts +3 -0
- package/dist/headless/chat-dictation/voice.js +35 -0
- package/dist/headless/citation-content.d.ts +3 -0
- package/dist/headless/citation-content.js +19 -0
- package/dist/headless/citation-description.d.ts +2 -0
- package/dist/headless/citation-description.js +12 -0
- package/dist/headless/citation-root.d.ts +2 -0
- package/dist/headless/citation-root.js +13 -0
- package/dist/headless/citation-title.d.ts +2 -0
- package/dist/headless/citation-title.js +12 -0
- package/dist/headless/citation-trigger.d.ts +2 -0
- package/dist/headless/citation-trigger.js +12 -0
- package/dist/headless/clear-answer.d.ts +5 -0
- package/dist/headless/clear-answer.js +19 -0
- package/dist/headless/composer-root.d.ts +14 -0
- package/dist/headless/composer-root.js +12 -0
- package/dist/headless/composer-standalone.d.ts +3 -0
- package/dist/headless/composer-standalone.js +10 -0
- package/dist/headless/composer.d.ts +3 -0
- package/dist/headless/composer.js +24 -0
- package/dist/headless/context-usage.d.ts +3 -0
- package/dist/headless/context-usage.js +13 -0
- package/dist/headless/contexts.d.ts +77 -0
- package/dist/headless/contexts.js +53 -0
- package/dist/headless/continue.d.ts +4 -0
- package/dist/headless/continue.js +26 -0
- package/dist/headless/copy.d.ts +11 -0
- package/dist/headless/copy.js +21 -0
- package/dist/headless/deny.d.ts +4 -0
- package/dist/headless/deny.js +15 -0
- package/dist/headless/edit-queued.d.ts +2 -0
- package/dist/headless/edit-queued.js +15 -0
- package/dist/headless/edit.d.ts +2 -0
- package/dist/headless/edit.js +17 -0
- package/dist/headless/edited-attachments.d.ts +5 -0
- package/dist/headless/edited-attachments.js +11 -0
- package/dist/headless/edited-input.d.ts +2 -0
- package/dist/headless/edited-input.js +28 -0
- package/dist/headless/empty.d.ts +3 -0
- package/dist/headless/empty.js +12 -0
- package/dist/headless/failed.d.ts +15 -0
- package/dist/headless/failed.js +17 -0
- package/dist/headless/feedback-error.d.ts +2 -0
- package/dist/headless/feedback-error.js +11 -0
- package/dist/headless/feedback-root.d.ts +2 -0
- package/dist/headless/feedback-root.js +24 -0
- package/dist/headless/feedback.d.ts +4 -0
- package/dist/headless/feedback.js +18 -0
- package/dist/headless/file-audio.d.ts +2 -0
- package/dist/headless/file-audio.js +16 -0
- package/dist/headless/file-context.d.ts +4 -0
- package/dist/headless/file-context.js +7 -0
- package/dist/headless/file-img.d.ts +2 -0
- package/dist/headless/file-img.js +21 -0
- package/dist/headless/file-kind-gate.d.ts +5 -0
- package/dist/headless/file-kind-gate.js +11 -0
- package/dist/headless/file-link.d.ts +3 -0
- package/dist/headless/file-link.js +14 -0
- package/dist/headless/file-root.d.ts +5 -0
- package/dist/headless/file-root.js +13 -0
- package/dist/headless/file-unavailable.d.ts +2 -0
- package/dist/headless/file-unavailable.js +12 -0
- package/dist/headless/file-video.d.ts +2 -0
- package/dist/headless/file-video.js +16 -0
- package/dist/headless/follow-ups.d.ts +5 -0
- package/dist/headless/follow-ups.js +20 -0
- package/dist/headless/forget-approval.d.ts +2 -0
- package/dist/headless/forget-approval.js +21 -0
- package/dist/headless/gate-content.d.ts +2 -0
- package/dist/headless/gate-content.js +6 -0
- package/dist/headless/index.d.ts +249 -0
- package/dist/headless/index.js +251 -0
- package/dist/headless/input.d.ts +11 -0
- package/dist/headless/input.js +18 -0
- package/dist/headless/jump-to-latest.d.ts +3 -0
- package/dist/headless/jump-to-latest.js +14 -0
- package/dist/headless/message-edit-root.d.ts +2 -0
- package/dist/headless/message-edit-root.js +13 -0
- package/dist/headless/message-editing.d.ts +2 -0
- package/dist/headless/message-editing.js +10 -0
- package/dist/headless/message-editor.d.ts +2 -0
- package/dist/headless/message-editor.js +19 -0
- package/dist/headless/message-footer.d.ts +3 -0
- package/dist/headless/message-footer.js +15 -0
- package/dist/headless/message-reading.d.ts +2 -0
- package/dist/headless/message-reading.js +10 -0
- package/dist/headless/message.d.ts +11 -0
- package/dist/headless/message.js +34 -0
- package/dist/headless/messages.d.ts +9 -0
- package/dist/headless/messages.js +19 -0
- package/dist/headless/model-picker.d.ts +2 -0
- package/dist/headless/model-picker.js +14 -0
- package/dist/headless/model.d.ts +4 -0
- package/dist/headless/model.js +13 -0
- package/dist/headless/models.d.ts +5 -0
- package/dist/headless/models.js +11 -0
- package/dist/headless/optional-tools.d.ts +7 -0
- package/dist/headless/optional-tools.js +12 -0
- package/dist/headless/other-answer.d.ts +5 -0
- package/dist/headless/other-answer.js +32 -0
- package/dist/headless/part-approval.d.ts +2 -0
- package/dist/headless/part-approval.js +33 -0
- package/dist/headless/part-file.d.ts +6 -0
- package/dist/headless/part-file.js +11 -0
- package/dist/headless/part-question.d.ts +2 -0
- package/dist/headless/part-question.js +57 -0
- package/dist/headless/part-reasoning.d.ts +15 -0
- package/dist/headless/part-reasoning.js +26 -0
- package/dist/headless/part-source.d.ts +5 -0
- package/dist/headless/part-source.js +20 -0
- package/dist/headless/part-text.d.ts +16 -0
- package/dist/headless/part-text.js +29 -0
- package/dist/headless/part-tool.d.ts +16 -0
- package/dist/headless/part-tool.js +14 -0
- package/dist/headless/parts.d.ts +11 -0
- package/dist/headless/parts.js +11 -0
- package/dist/headless/question-back.d.ts +2 -0
- package/dist/headless/question-back.js +16 -0
- package/dist/headless/question-error.d.ts +2 -0
- package/dist/headless/question-error.js +14 -0
- package/dist/headless/question-invalid.d.ts +8 -0
- package/dist/headless/question-invalid.js +18 -0
- package/dist/headless/question-item.d.ts +8 -0
- package/dist/headless/question-item.js +51 -0
- package/dist/headless/question-next.d.ts +3 -0
- package/dist/headless/question-next.js +16 -0
- package/dist/headless/question-other.d.ts +5 -0
- package/dist/headless/question-other.js +22 -0
- package/dist/headless/question-progress.d.ts +8 -0
- package/dist/headless/question-progress.js +14 -0
- package/dist/headless/question-receipt.d.ts +11 -0
- package/dist/headless/question-receipt.js +29 -0
- package/dist/headless/questions.d.ts +3 -0
- package/dist/headless/questions.js +13 -0
- package/dist/headless/queue-editing.d.ts +4 -0
- package/dist/headless/queue-editing.js +11 -0
- package/dist/headless/queue-item.d.ts +2 -0
- package/dist/headless/queue-item.js +10 -0
- package/dist/headless/queue-items.d.ts +2 -0
- package/dist/headless/queue-items.js +11 -0
- package/dist/headless/queue-preview.d.ts +6 -0
- package/dist/headless/queue-preview.js +11 -0
- package/dist/headless/queued-input.d.ts +2 -0
- package/dist/headless/queued-input.js +27 -0
- package/dist/headless/queued.d.ts +17 -0
- package/dist/headless/queued.js +16 -0
- package/dist/headless/read-aloud.d.ts +5 -0
- package/dist/headless/read-aloud.js +19 -0
- package/dist/headless/reasoning-disclosure.d.ts +3 -0
- package/dist/headless/reasoning-disclosure.js +17 -0
- package/dist/headless/reasoning-timer.d.ts +5 -0
- package/dist/headless/reasoning-timer.js +13 -0
- package/dist/headless/references.d.ts +6 -0
- package/dist/headless/references.js +13 -0
- package/dist/headless/regenerate.d.ts +3 -0
- package/dist/headless/regenerate.js +22 -0
- package/dist/headless/remembered-approval.d.ts +2 -0
- package/dist/headless/remembered-approval.js +14 -0
- package/dist/headless/root.d.ts +30 -0
- package/dist/headless/root.js +99 -0
- package/dist/headless/save-edit.d.ts +2 -0
- package/dist/headless/save-edit.js +16 -0
- package/dist/headless/save-queued.d.ts +2 -0
- package/dist/headless/save-queued.js +15 -0
- package/dist/headless/send-now.d.ts +2 -0
- package/dist/headless/send-now.js +17 -0
- package/dist/headless/settings.d.ts +2 -0
- package/dist/headless/settings.js +10 -0
- package/dist/headless/skip-questions.d.ts +6 -0
- package/dist/headless/skip-questions.js +18 -0
- package/dist/headless/source-context.d.ts +5 -0
- package/dist/headless/source-context.js +9 -0
- package/dist/headless/source-link.d.ts +2 -0
- package/dist/headless/source-link.js +13 -0
- package/dist/headless/source-primitives.d.ts +1 -0
- package/dist/headless/source-primitives.js +7 -0
- package/dist/headless/source-root.d.ts +5 -0
- package/dist/headless/source-root.js +9 -0
- package/dist/headless/source-sheet-close.d.ts +2 -0
- package/dist/headless/source-sheet-close.js +12 -0
- package/dist/headless/source-sheet-content.d.ts +3 -0
- package/dist/headless/source-sheet-content.js +16 -0
- package/dist/headless/source-sheet-description.d.ts +2 -0
- package/dist/headless/source-sheet-description.js +12 -0
- package/dist/headless/source-sheet-root.d.ts +2 -0
- package/dist/headless/source-sheet-root.js +13 -0
- package/dist/headless/source-sheet-title.d.ts +2 -0
- package/dist/headless/source-sheet-title.js +12 -0
- package/dist/headless/source-sheet-trigger.d.ts +2 -0
- package/dist/headless/source-sheet-trigger.js +12 -0
- package/dist/headless/source-unavailable.d.ts +2 -0
- package/dist/headless/source-unavailable.js +9 -0
- package/dist/headless/sources.d.ts +14 -0
- package/dist/headless/sources.js +12 -0
- package/dist/headless/speaker.d.ts +13 -0
- package/dist/headless/speaker.js +10 -0
- package/dist/headless/step-boundary.d.ts +4 -0
- package/dist/headless/step-boundary.js +16 -0
- package/dist/headless/stop.d.ts +10 -0
- package/dist/headless/stop.js +18 -0
- package/dist/headless/stopped.d.ts +11 -0
- package/dist/headless/stopped.js +17 -0
- package/dist/headless/submit-answers.d.ts +3 -0
- package/dist/headless/submit-answers.js +12 -0
- package/dist/headless/submit.d.ts +23 -0
- package/dist/headless/submit.js +24 -0
- package/dist/headless/suggestion.d.ts +10 -0
- package/dist/headless/suggestion.js +14 -0
- package/dist/headless/suggestions.d.ts +8 -0
- package/dist/headless/suggestions.js +12 -0
- package/dist/headless/thread.d.ts +3 -0
- package/dist/headless/thread.js +25 -0
- package/dist/headless/timing.d.ts +5 -0
- package/dist/headless/timing.js +13 -0
- package/dist/headless/toggle-tool.d.ts +4 -0
- package/dist/headless/toggle-tool.js +15 -0
- package/dist/headless/tool-error.d.ts +4 -0
- package/dist/headless/tool-error.js +13 -0
- package/dist/headless/tool-input.d.ts +4 -0
- package/dist/headless/tool-input.js +13 -0
- package/dist/headless/tool-output.d.ts +4 -0
- package/dist/headless/tool-output.js +13 -0
- package/dist/headless/tool-renderer.d.ts +13 -0
- package/dist/headless/tool-renderer.js +15 -0
- package/dist/headless/transcript.d.ts +23 -0
- package/dist/headless/transcript.js +24 -0
- package/dist/headless/try-again.d.ts +2 -0
- package/dist/headless/try-again.js +24 -0
- package/dist/headless/unavailable.d.ts +8 -0
- package/dist/headless/unavailable.js +9 -0
- package/dist/headless/usage.d.ts +13 -0
- package/dist/headless/usage.js +15 -0
- package/dist/headless/use-merged-ref.d.ts +2 -0
- package/dist/headless/use-merged-ref.js +17 -0
- package/dist/headless/use-question.d.ts +3 -0
- package/dist/headless/use-question.js +9 -0
- package/dist/headless/waiting.d.ts +13 -0
- package/dist/headless/waiting.js +12 -0
- package/dist/headless/writing.d.ts +13 -0
- package/dist/headless/writing.js +12 -0
- package/dist/hooks/chat-refusal.d.ts +18 -0
- package/dist/hooks/chat-refusal.js +44 -0
- package/dist/hooks/turn-mailbox.d.ts +14 -0
- package/dist/hooks/turn-mailbox.js +114 -0
- package/dist/hooks/use-branches.d.ts +10 -0
- package/dist/hooks/use-branches.js +69 -0
- package/dist/hooks/use-chat-instance.d.ts +28 -0
- package/dist/hooks/use-chat-instance.js +44 -0
- package/dist/hooks/use-chat-settings.d.ts +11 -0
- package/dist/hooks/use-chat-settings.js +33 -0
- package/dist/hooks/use-chat-sink.d.ts +19 -0
- package/dist/hooks/use-chat-sink.js +56 -0
- package/dist/hooks/use-composer.d.ts +33 -0
- package/dist/hooks/use-composer.js +45 -0
- package/dist/hooks/use-context-usage.d.ts +8 -0
- package/dist/hooks/use-context-usage.js +14 -0
- package/dist/hooks/use-copied.d.ts +14 -0
- package/dist/hooks/use-copied.js +22 -0
- package/dist/hooks/use-draft.d.ts +6 -0
- package/dist/hooks/use-draft.js +38 -0
- package/dist/hooks/use-feedback.d.ts +8 -0
- package/dist/hooks/use-feedback.js +28 -0
- package/dist/hooks/use-follow.d.ts +15 -0
- package/dist/hooks/use-follow.js +30 -0
- package/dist/hooks/use-media-load.d.ts +5 -0
- package/dist/hooks/use-media-load.js +12 -0
- package/dist/hooks/use-media.d.ts +3 -0
- package/dist/hooks/use-media.js +9 -0
- package/dist/hooks/use-question-check.d.ts +11 -0
- package/dist/hooks/use-question-check.js +29 -0
- package/dist/hooks/use-question-draft.d.ts +34 -0
- package/dist/hooks/use-question-draft.js +57 -0
- package/dist/hooks/use-question-steps.d.ts +18 -0
- package/dist/hooks/use-question-steps.js +31 -0
- package/dist/hooks/use-question-write.d.ts +8 -0
- package/dist/hooks/use-question-write.js +25 -0
- package/dist/hooks/use-read-aloud.d.ts +8 -0
- package/dist/hooks/use-read-aloud.js +60 -0
- package/dist/hooks/use-reasoning.d.ts +8 -0
- package/dist/hooks/use-reasoning.js +32 -0
- package/dist/hooks/use-remembered-approvals.d.ts +9 -0
- package/dist/hooks/use-remembered-approvals.js +40 -0
- package/dist/hooks/use-reply.d.ts +3 -0
- package/dist/hooks/use-reply.js +9 -0
- package/dist/hooks/use-report-missing-configuration.d.ts +9 -0
- package/dist/hooks/use-report-missing-configuration.js +14 -0
- package/dist/hooks/use-retry-delay.d.ts +5 -0
- package/dist/hooks/use-retry-delay.js +17 -0
- package/dist/hooks/use-sent-draft.d.ts +8 -0
- package/dist/hooks/use-sent-draft.js +25 -0
- package/dist/hooks/use-source-disclosure.d.ts +5 -0
- package/dist/hooks/use-source-disclosure.js +9 -0
- package/dist/hooks/use-sources.d.ts +3 -0
- package/dist/hooks/use-sources.js +9 -0
- package/dist/hooks/use-tool-approval-memory.d.ts +8 -0
- package/dist/hooks/use-tool-approval-memory.js +16 -0
- package/dist/hooks/use-tool-approval.d.ts +10 -0
- package/dist/hooks/use-tool-approval.js +26 -0
- package/dist/hooks/use-turn-queue.d.ts +32 -0
- package/dist/hooks/use-turn-queue.js +33 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +5 -0
- package/dist/next.d.ts +43 -0
- package/dist/next.js +10 -0
- package/dist/services/approval-memory.d.ts +9 -0
- package/dist/services/approval-memory.js +32 -0
- package/dist/services/approval.d.ts +14 -0
- package/dist/services/approval.js +37 -0
- package/dist/services/branches.d.ts +27 -0
- package/dist/services/branches.js +131 -0
- package/dist/services/chat-session.d.ts +20 -0
- package/dist/services/chat-session.js +61 -0
- package/dist/services/choices.d.ts +31 -0
- package/dist/services/choices.js +39 -0
- package/dist/services/continue.d.ts +8 -0
- package/dist/services/continue.js +24 -0
- package/dist/services/errors.d.ts +52 -0
- package/dist/services/errors.js +54 -0
- package/dist/services/media.d.ts +9 -0
- package/dist/services/media.js +19 -0
- package/dist/services/messages.d.ts +44 -0
- package/dist/services/messages.js +0 -0
- package/dist/services/optional.d.ts +7 -0
- package/dist/services/optional.js +7 -0
- package/dist/services/ports.d.ts +31 -0
- package/dist/services/ports.js +0 -0
- package/dist/services/questions.d.ts +67 -0
- package/dist/services/questions.js +119 -0
- package/dist/services/request.d.ts +26 -0
- package/dist/services/request.js +85 -0
- package/dist/services/selection.d.ts +10 -0
- package/dist/services/selection.js +49 -0
- package/dist/services/sources.d.ts +11 -0
- package/dist/services/sources.js +29 -0
- package/dist/services/tools.d.ts +11 -0
- package/dist/services/tools.js +0 -0
- package/dist/services/turn.d.ts +84 -0
- package/dist/services/turn.js +0 -0
- package/dist/services/types.d.ts +23 -0
- package/dist/services/types.js +15 -0
- package/package.json +822 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { usePart, useRequired } from "@slices.sh/core/part";
|
|
3
|
+
import { QuestionStepsContext, QuestionWriteContext } from "./contexts.js";
|
|
4
|
+
function QuestionBack(props) {
|
|
5
|
+
const steps = useRequired(QuestionStepsContext, "Chat.QuestionBack requires Chat.PartQuestion.");
|
|
6
|
+
const write = useRequired(QuestionWriteContext, "Chat.QuestionBack requires Chat.PartQuestion.");
|
|
7
|
+
const element = usePart("button", props, {
|
|
8
|
+
defaults: { type: "button" },
|
|
9
|
+
locked: { disabled: write.pending },
|
|
10
|
+
behavior: { onClick: () => steps.move("back") }
|
|
11
|
+
});
|
|
12
|
+
return steps.index === 0 ? null : element;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
QuestionBack
|
|
16
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { usePart, useRequired } from "@slices.sh/core/part";
|
|
3
|
+
import { QuestionWriteContext } from "./contexts.js";
|
|
4
|
+
function QuestionError(props) {
|
|
5
|
+
const write = useRequired(QuestionWriteContext, "Chat.QuestionError requires Chat.PartQuestion.");
|
|
6
|
+
return usePart(
|
|
7
|
+
"p",
|
|
8
|
+
{ ...props, children: write.error ? props.children : null },
|
|
9
|
+
{ locked: { role: "alert" } }
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
QuestionError
|
|
14
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { QuestionProblem } from "../services/types";
|
|
2
|
+
import { type PartProps } from "@slices.sh/core/part";
|
|
3
|
+
/** What is missing from one question's answer, once the person tried to go on without it. */
|
|
4
|
+
export declare function QuestionInvalid({ name, ...props }: PartProps<"p", {
|
|
5
|
+
problem: QuestionProblem;
|
|
6
|
+
}> & {
|
|
7
|
+
name: string;
|
|
8
|
+
}): import("react").ReactNode;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { usePart, useRequired } from "@slices.sh/core/part";
|
|
3
|
+
import { QuestionCheckContext } from "./contexts.js";
|
|
4
|
+
function QuestionInvalid({
|
|
5
|
+
name,
|
|
6
|
+
...props
|
|
7
|
+
}) {
|
|
8
|
+
const check = useRequired(QuestionCheckContext, "Chat.QuestionInvalid requires Chat.PartQuestion.");
|
|
9
|
+
const problem = check.shown(name);
|
|
10
|
+
const element = usePart("p", props, {
|
|
11
|
+
state: { problem: problem ?? "required" },
|
|
12
|
+
locked: { role: "alert" }
|
|
13
|
+
});
|
|
14
|
+
return problem ? element : null;
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
QuestionInvalid
|
|
18
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type PartProps } from "@slices.sh/core/part";
|
|
2
|
+
/**
|
|
3
|
+
* One question: a radiogroup when the answer is one choice, a group when it is several. Only the
|
|
4
|
+
* question of the current step is drawn. Number shortcuts stay inside it and never intercept typing.
|
|
5
|
+
*/
|
|
6
|
+
export declare function QuestionItem({ name, ref, ...props }: PartProps<"fieldset"> & {
|
|
7
|
+
name: string;
|
|
8
|
+
}): import("react").ReactNode;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { usePart, useRequired } from "@slices.sh/core/part";
|
|
4
|
+
import { QuestionCheckContext, QuestionStepsContext } from "./contexts.js";
|
|
5
|
+
import { useMergedRef } from "./use-merged-ref.js";
|
|
6
|
+
import { useQuestion } from "./use-question.js";
|
|
7
|
+
function QuestionItem({ name, ref, ...props }) {
|
|
8
|
+
const question = useQuestion(name, "QuestionItem");
|
|
9
|
+
const check = useRequired(QuestionCheckContext, "Chat.QuestionItem requires Chat.PartQuestion.");
|
|
10
|
+
const steps = useRequired(QuestionStepsContext, "Chat.QuestionItem requires Chat.PartQuestion.");
|
|
11
|
+
const multiple = Boolean(question?.multiple);
|
|
12
|
+
const invalid = check.shown(name) !== null;
|
|
13
|
+
const arrive = useCallback(
|
|
14
|
+
(node) => {
|
|
15
|
+
if (node && steps.moved) node.focus();
|
|
16
|
+
},
|
|
17
|
+
[steps.moved]
|
|
18
|
+
);
|
|
19
|
+
const merged = useMergedRef(arrive, ref);
|
|
20
|
+
const element = usePart(
|
|
21
|
+
"fieldset",
|
|
22
|
+
{ ...props, ref: merged },
|
|
23
|
+
{
|
|
24
|
+
defaults: { tabIndex: -1 },
|
|
25
|
+
attributes: { invalid },
|
|
26
|
+
locked: {
|
|
27
|
+
role: multiple ? void 0 : "radiogroup",
|
|
28
|
+
"aria-invalid": !multiple && invalid ? true : void 0
|
|
29
|
+
},
|
|
30
|
+
behavior: {
|
|
31
|
+
onKeyDown: (event) => {
|
|
32
|
+
if (event.defaultPrevented || event.ctrlKey || event.metaKey || event.altKey || !/^[1-9]$/.test(event.key))
|
|
33
|
+
return;
|
|
34
|
+
const target = event.target;
|
|
35
|
+
if (target.closest("textarea,[contenteditable=true],input:not([type=radio]):not([type=checkbox])"))
|
|
36
|
+
return;
|
|
37
|
+
const choice = event.currentTarget.querySelectorAll("input[aria-keyshortcuts]")[Number(event.key) - 1];
|
|
38
|
+
if (choice && !choice.disabled) {
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
choice.focus();
|
|
41
|
+
choice.click();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
return question && steps.active(name) ? element : null;
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
QuestionItem
|
|
51
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { usePart, useRequired } from "@slices.sh/core/part";
|
|
3
|
+
import { QuestionStepsContext, QuestionWriteContext } from "./contexts.js";
|
|
4
|
+
function QuestionNext(props) {
|
|
5
|
+
const steps = useRequired(QuestionStepsContext, "Chat.QuestionNext requires Chat.PartQuestion.");
|
|
6
|
+
const write = useRequired(QuestionWriteContext, "Chat.QuestionNext requires Chat.PartQuestion.");
|
|
7
|
+
const element = usePart("button", props, {
|
|
8
|
+
defaults: { type: "button" },
|
|
9
|
+
locked: { disabled: write.pending },
|
|
10
|
+
behavior: { onClick: () => steps.move("next") }
|
|
11
|
+
});
|
|
12
|
+
return steps.index === steps.count - 1 ? null : element;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
QuestionNext
|
|
16
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { usePart, useRequired } from "@slices.sh/core/part";
|
|
3
|
+
import { QuestionDraftContext, QuestionWriteContext } from "./contexts.js";
|
|
4
|
+
import { useQuestion } from "./use-question.js";
|
|
5
|
+
function QuestionOther({ name, ...props }) {
|
|
6
|
+
const question = useQuestion(name, "QuestionOther");
|
|
7
|
+
const draft = useRequired(QuestionDraftContext, "Chat.QuestionOther requires Chat.PartQuestion.");
|
|
8
|
+
const write = useRequired(QuestionWriteContext, "Chat.QuestionOther requires Chat.PartQuestion.");
|
|
9
|
+
const element = usePart("input", props, {
|
|
10
|
+
defaults: { type: "text" },
|
|
11
|
+
behavior: {
|
|
12
|
+
// A pointer, not focus: tabbing past the field must not replace a choice the person made.
|
|
13
|
+
onPointerDown: () => draft.change(name, { type: "select-other" }),
|
|
14
|
+
onChange: (event) => draft.change(name, { type: "write-other", text: event.currentTarget.value })
|
|
15
|
+
},
|
|
16
|
+
locked: { disabled: write.pending, value: draft.other(name).text, "aria-label": question?.other }
|
|
17
|
+
});
|
|
18
|
+
return question?.other ? element : null;
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
QuestionOther
|
|
22
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type PartProps } from "@slices.sh/core/part";
|
|
2
|
+
type Progress = {
|
|
3
|
+
position: number;
|
|
4
|
+
count: number;
|
|
5
|
+
};
|
|
6
|
+
/** "2 of 3": the place in a form of several questions, and nothing in a form of one. */
|
|
7
|
+
export declare function QuestionProgress(props: PartProps<"p", Progress>): import("react").ReactNode;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { usePart, useRequired } from "@slices.sh/core/part";
|
|
3
|
+
import { QuestionStepsContext } from "./contexts.js";
|
|
4
|
+
function QuestionProgress(props) {
|
|
5
|
+
const steps = useRequired(QuestionStepsContext, "Chat.QuestionProgress requires Chat.PartQuestion.");
|
|
6
|
+
const element = usePart("p", props, {
|
|
7
|
+
state: { position: steps.index + 1, count: steps.count },
|
|
8
|
+
locked: { "aria-live": "polite" }
|
|
9
|
+
});
|
|
10
|
+
return steps.count > 1 ? element : null;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
QuestionProgress
|
|
14
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type GateProps } from "@slices.sh/core/part";
|
|
2
|
+
type Receipt = {
|
|
3
|
+
title: string;
|
|
4
|
+
answers: {
|
|
5
|
+
name: string;
|
|
6
|
+
title: string;
|
|
7
|
+
values: string[];
|
|
8
|
+
}[];
|
|
9
|
+
};
|
|
10
|
+
export declare function QuestionReceipt({ children }: GateProps<Receipt>): import("react").ReactNode;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { isToolUIPart } from "ai";
|
|
3
|
+
import { isSkippedQuestion, questionInput } from "../hooks/use-question-draft.js";
|
|
4
|
+
import { useRequired } from "@slices.sh/core/part";
|
|
5
|
+
import { PartScope } from "./contexts.js";
|
|
6
|
+
import { gateContent } from "./gate-content.js";
|
|
7
|
+
function QuestionReceipt({ children }) {
|
|
8
|
+
const part = useRequired(PartScope, "Chat.QuestionReceipt requires Chat.Parts.");
|
|
9
|
+
const input = questionInput(part);
|
|
10
|
+
if (!input || !isToolUIPart(part) || part.state !== "output-available" || !part.output || typeof part.output !== "object")
|
|
11
|
+
return null;
|
|
12
|
+
const output = part.output;
|
|
13
|
+
const skipped = isSkippedQuestion(part);
|
|
14
|
+
const answers = input.questions.map((q) => {
|
|
15
|
+
const value = skipped ? void 0 : output[q.name];
|
|
16
|
+
const values = (Array.isArray(value) ? value : typeof value === "string" ? [value] : []).filter(
|
|
17
|
+
(value2) => typeof value2 === "string" && Boolean(value2.trim())
|
|
18
|
+
);
|
|
19
|
+
return {
|
|
20
|
+
name: q.name,
|
|
21
|
+
title: q.title,
|
|
22
|
+
values: values.map((value2) => q.choices.find((c) => c.value === value2)?.label ?? value2)
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
return gateContent(children, { title: input.title, answers });
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
QuestionReceipt
|
|
29
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRequired } from "@slices.sh/core/part";
|
|
3
|
+
import { QuestionInputContext } from "./contexts.js";
|
|
4
|
+
import { gateContent } from "./gate-content.js";
|
|
5
|
+
function Questions({ children }) {
|
|
6
|
+
return gateContent(
|
|
7
|
+
children,
|
|
8
|
+
useRequired(QuestionInputContext, "Chat.Questions requires Chat.PartQuestion.")
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
Questions
|
|
13
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRequired } from "@slices.sh/core/part";
|
|
3
|
+
import { QueueScope } from "./contexts.js";
|
|
4
|
+
import { gateContent } from "./gate-content.js";
|
|
5
|
+
function QueueEditing({ children }) {
|
|
6
|
+
const item = useRequired(QueueScope, "Chat.QueueEditing requires Chat.QueueItems.");
|
|
7
|
+
return item.draft !== null ? gateContent(children, { text: item.text }) : null;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
QueueEditing
|
|
11
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { usePart, useRequired } from "@slices.sh/core/part";
|
|
3
|
+
import { QueueScope } from "./contexts.js";
|
|
4
|
+
function QueueItem(props) {
|
|
5
|
+
const item = useRequired(QueueScope, "Chat.QueueItem requires Chat.QueueItems.");
|
|
6
|
+
return usePart("div", props, { defaults: { role: "group" }, locked: { "aria-label": item.text } });
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
QueueItem
|
|
10
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useRequired } from "@slices.sh/core/part";
|
|
4
|
+
import { QueueContext, QueueScope } from "./contexts.js";
|
|
5
|
+
function QueueItems({ children }) {
|
|
6
|
+
const queue = useRequired(QueueContext, "Chat.QueueItems requires Chat.Root.");
|
|
7
|
+
return queue.items.map((item) => /* @__PURE__ */ jsx(QueueScope, { value: item, children }, item.id));
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
QueueItems
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRequired } from "@slices.sh/core/part";
|
|
3
|
+
import { QueueScope } from "./contexts.js";
|
|
4
|
+
import { gateContent } from "./gate-content.js";
|
|
5
|
+
function QueuePreview({ children }) {
|
|
6
|
+
const item = useRequired(QueueScope, "Chat.QueuePreview requires Chat.QueueItems.");
|
|
7
|
+
return item.draft === null ? gateContent(children, { text: item.text, files: item.files ?? [] }) : null;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
QueuePreview
|
|
11
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { usePart, useRequired } from "@slices.sh/core/part";
|
|
3
|
+
import { QueueContext, QueueScope } from "./contexts.js";
|
|
4
|
+
function QueuedInput(props) {
|
|
5
|
+
const queue = useRequired(QueueContext, "Chat.QueuedInput requires Chat.Root.");
|
|
6
|
+
const item = useRequired(QueueScope, "Chat.QueuedInput requires Chat.QueueItems.");
|
|
7
|
+
return usePart("textarea", props, {
|
|
8
|
+
locked: { value: item.draft ?? item.text },
|
|
9
|
+
behavior: {
|
|
10
|
+
onChange: (event) => queue.change({ type: "edit", id: item.id, text: event.currentTarget.value }),
|
|
11
|
+
onKeyDown: (event) => {
|
|
12
|
+
if (event.nativeEvent.isComposing) return;
|
|
13
|
+
if (event.key === "Escape") {
|
|
14
|
+
event.preventDefault();
|
|
15
|
+
queue.change({ type: "cancel-edit", id: item.id });
|
|
16
|
+
}
|
|
17
|
+
if (event.key === "Enter" && (event.ctrlKey || event.metaKey)) {
|
|
18
|
+
event.preventDefault();
|
|
19
|
+
queue.change({ type: "save-edit", id: item.id });
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
QueuedInput
|
|
27
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type GateProps } from "@slices.sh/core/part";
|
|
2
|
+
/**
|
|
3
|
+
* How many messages are waiting, and for what: the running turn, an open question or a tool
|
|
4
|
+
* decision. A reason is always given, because a queue that holds without saying why looks broken.
|
|
5
|
+
*
|
|
6
|
+
* The queue was computed, returned and thrown away, so typing during an answer cleared the
|
|
7
|
+
* box and showed nothing: three follow-ups looked like three sends that did not work, and
|
|
8
|
+
* then arrived minutes later in an order nobody could predict.
|
|
9
|
+
*
|
|
10
|
+
* This is a gate and not a live region, and the difference matters: a region announces what
|
|
11
|
+
* appears *inside* it, so one that arrives already holding its sentence announces nothing.
|
|
12
|
+
* The region is the composer's, mounted from the first render; this puts a sentence into it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function Queued({ children, }: GateProps<{
|
|
15
|
+
count: number;
|
|
16
|
+
waitingFor: "turn" | "question" | "approval";
|
|
17
|
+
}>): import("react").ReactNode;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRequired } from "@slices.sh/core/part";
|
|
3
|
+
import { QueueContext } from "./contexts.js";
|
|
4
|
+
import { gateContent } from "./gate-content.js";
|
|
5
|
+
function Queued({
|
|
6
|
+
children
|
|
7
|
+
}) {
|
|
8
|
+
const queue = useRequired(QueueContext, "Chat.Queued must be inside <Chat.Root>.");
|
|
9
|
+
return queue.waiting > 0 ? gateContent(children, {
|
|
10
|
+
count: queue.waiting,
|
|
11
|
+
waitingFor: queue.blockedBy === "question" || queue.blockedBy === "approval" ? queue.blockedBy : "turn"
|
|
12
|
+
}) : null;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
Queued
|
|
16
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useReadAloud } from "../hooks/use-read-aloud.js";
|
|
3
|
+
import { usePart, useRequired } from "@slices.sh/core/part";
|
|
4
|
+
import { MessageScope } from "./contexts.js";
|
|
5
|
+
function ReadAloud(props) {
|
|
6
|
+
const message = useRequired(MessageScope, "Chat.ReadAloud requires Chat.Messages.");
|
|
7
|
+
const text = message.parts.flatMap((part) => part.type === "text" ? [part.text] : []).join("\n\n");
|
|
8
|
+
const speech = useReadAloud(text);
|
|
9
|
+
const element = usePart("button", props, {
|
|
10
|
+
defaults: { type: "button" },
|
|
11
|
+
state: { playing: speech.playing, failed: speech.failed },
|
|
12
|
+
locked: { "aria-pressed": speech.playing },
|
|
13
|
+
behavior: { onClick: speech.toggle }
|
|
14
|
+
});
|
|
15
|
+
return speech.available && message.role === "assistant" && text.trim() ? element : null;
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
ReadAloud
|
|
19
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { usePart, useRequired } from "@slices.sh/core/part";
|
|
3
|
+
import { ReasoningContext } from "./contexts.js";
|
|
4
|
+
function ReasoningDisclosure(props) {
|
|
5
|
+
const value = useRequired(ReasoningContext, "Chat.ReasoningDisclosure requires Chat.PartReasoning.");
|
|
6
|
+
return usePart("details", props, {
|
|
7
|
+
locked: { open: value.open },
|
|
8
|
+
behavior: {
|
|
9
|
+
onToggle: (event) => {
|
|
10
|
+
if (event.currentTarget.open !== value.open) value.setOpen(event.currentTarget.open);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
ReasoningDisclosure
|
|
17
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { usePart, useRequired } from "@slices.sh/core/part";
|
|
3
|
+
import { ReasoningContext } from "./contexts.js";
|
|
4
|
+
function ReasoningTimer(props) {
|
|
5
|
+
const { seconds, streaming } = useRequired(
|
|
6
|
+
ReasoningContext,
|
|
7
|
+
"Chat.ReasoningTimer requires Chat.PartReasoning."
|
|
8
|
+
);
|
|
9
|
+
return usePart("span", props, { state: { seconds, streaming } });
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
ReasoningTimer
|
|
13
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type GateProps } from "@slices.sh/core/part";
|
|
2
|
+
import type { ChatSource } from "../services/types";
|
|
3
|
+
/** URL and document references in native transcript order, deduplicated by source identity. */
|
|
4
|
+
export declare function References({ children }: GateProps<{
|
|
5
|
+
sources: readonly ChatSource[];
|
|
6
|
+
}>): import("react").ReactNode;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSources } from "../hooks/use-sources.js";
|
|
3
|
+
import { useRequired } from "@slices.sh/core/part";
|
|
4
|
+
import { MessageScope } from "./contexts.js";
|
|
5
|
+
import { gateContent } from "./gate-content.js";
|
|
6
|
+
function References({ children }) {
|
|
7
|
+
const message = useRequired(MessageScope, "Chat.References requires Chat.Messages.");
|
|
8
|
+
const sources = useSources(message);
|
|
9
|
+
return sources.length ? gateContent(children, { sources }) : null;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
References
|
|
13
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useChat } from "@ai-sdk/react";
|
|
3
|
+
import { usePart, useRequired } from "@slices.sh/core/part";
|
|
4
|
+
import { BranchContext, MessageScope, ChatContext } from "./contexts.js";
|
|
5
|
+
function Regenerate(props) {
|
|
6
|
+
const chat = useRequired(ChatContext, "Chat.Regenerate requires Chat.Root.");
|
|
7
|
+
const { messages } = useChat({ chat });
|
|
8
|
+
const branches = useRequired(BranchContext, "Chat.Regenerate requires Chat.Root.");
|
|
9
|
+
const message = useRequired(MessageScope, "Chat.Regenerate requires Chat.Messages.");
|
|
10
|
+
const element = usePart("button", props, {
|
|
11
|
+
defaults: { type: "button" },
|
|
12
|
+
locked: { disabled: branches.blocked },
|
|
13
|
+
behavior: { onClick: () => branches.regenerate(message.id) }
|
|
14
|
+
});
|
|
15
|
+
return message.role === "assistant" && messages.slice(
|
|
16
|
+
0,
|
|
17
|
+
messages.findIndex((item) => item.id === message.id)
|
|
18
|
+
).some((item) => item.role === "user") ? element : null;
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
Regenerate
|
|
22
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { getToolName, isToolUIPart } from "ai";
|
|
3
|
+
import { usePart, useRequired } from "@slices.sh/core/part";
|
|
4
|
+
import { ApprovalMemoryContext, PartScope } from "./contexts.js";
|
|
5
|
+
function RememberedApproval(props) {
|
|
6
|
+
const memory = useRequired(ApprovalMemoryContext, "Chat.RememberedApproval requires Chat.Root.");
|
|
7
|
+
const part = useRequired(PartScope, "Chat.RememberedApproval requires Chat.Parts.");
|
|
8
|
+
const name = isToolUIPart(part) ? getToolName(part) : null;
|
|
9
|
+
const element = usePart("span", props, {});
|
|
10
|
+
return memory.enabled && name && memory.tools.includes(name) ? element : null;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
RememberedApproval
|
|
14
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ChatSettings, ChatFeedbackOptions } from "../services/types";
|
|
2
|
+
import { type AiChat } from "../hooks/use-chat-instance";
|
|
3
|
+
import type { Enabled } from "@slices.sh/core";
|
|
4
|
+
import { type RootProps } from "@slices.sh/core/part";
|
|
5
|
+
type ChatRootProps = RootProps & ChatFeedbackOptions & {
|
|
6
|
+
/** The key in `services/ai-chat/config.ts`: the route the chat talks to when it is handed none. Left out, the config's slug. */
|
|
7
|
+
name?: string;
|
|
8
|
+
/** The config to talk to, `"default"` when left out. */
|
|
9
|
+
config?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Left out or `true`: required, and a missing service or config throws. `"optional"`: renders
|
|
12
|
+
* its children, and a Composer under it renders nothing. `false`: off. A capability name
|
|
13
|
+
* requires the service and that capability.
|
|
14
|
+
*/
|
|
15
|
+
enabled?: Enabled;
|
|
16
|
+
/**
|
|
17
|
+
* An AI SDK `Chat` the app made — its id, the messages it opens on, a transport with your
|
|
18
|
+
* headers — which every part reads with `useChat({ chat })`. Without one, a chat over the
|
|
19
|
+
* installed backend's route.
|
|
20
|
+
*/
|
|
21
|
+
chat?: AiChat;
|
|
22
|
+
/** From chatSession(client, name), bound to the supplied Chat transport. */
|
|
23
|
+
settings?: ChatSettings | null;
|
|
24
|
+
/** The sink's `whenBusy`: on, a message sent mid-answer is accepted and queued; off, Composer holds it until the chat is free. */
|
|
25
|
+
queue?: boolean;
|
|
26
|
+
/** Enable explicit per-tool consent remembered only for this Chat instance. */
|
|
27
|
+
rememberApprovals?: boolean;
|
|
28
|
+
};
|
|
29
|
+
export declare function Root(props: ChatRootProps): import("react").JSX.Element;
|
|
30
|
+
export {};
|