@adecore/agents-react 0.39.0 → 0.40.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/dist/agents/AgentModelLabel.js +2 -1
- package/dist/agents/model-name.js +2 -1
- package/dist/agents/provider-paths.d.ts +2 -1
- package/dist/agents/provider-paths.js +7 -3
- package/dist/chat/account-choice.js +57 -28
- package/dist/chat/bookmarks.js +2 -1
- package/dist/chat/drafts.d.ts +0 -1
- package/dist/chat/drafts.js +9 -28
- package/dist/chat/logic/picker-entries.js +2 -8
- package/dist/chat/logic/resume-compaction.js +2 -5
- package/dist/chat/logic/timeline-copy.js +2 -8
- package/dist/chat/logic/timeline.js +9 -10
- package/dist/chat/logic/workflow.js +2 -4
- package/dist/chat/subagent-conversation.js +2 -1
- package/dist/chat/ui/GoalDock.js +2 -1
- package/dist/chat/ui/LimitState.js +4 -6
- package/dist/chat/ui/composer/use-continuable-turn.js +0 -1
- package/dist/chat/ui/composer/use-notice.js +2 -1
- package/dist/chat/ui/composer/use-prompt-history.js +1 -1
- package/dist/chat/ui/composer/use-prompt-menus.js +216 -253
- package/dist/chat/ui/composer/use-take-back.js +2 -2
- package/dist/chat/ui/diff/ApprovalReview.js +1 -1
- package/dist/chat/ui/highlighter.d.ts +0 -6
- package/dist/chat/ui/highlighter.js +0 -12
- package/dist/chat/ui/icons.d.ts +0 -1
- package/dist/chat/ui/icons.js +0 -3
- package/dist/chat/ui/rows/MessageRows.js +2 -5
- package/dist/chat/ui/rows/row-rhythm.js +2 -5
- package/dist/chat/ui/theme-watch.js +3 -7
- package/dist/prompts/logic/usePromptSession.js +2 -1
- package/dist/providers/AddAccountForm.js +2 -1
- package/dist/providers/CliDetail.js +104 -130
- package/dist/providers/account-actions.js +6 -9
- package/dist/state/chats.d.ts +1 -0
- package/dist/state/chats.js +6 -11
- package/dist/state/provider-accounts.d.ts +1 -1
- package/dist/state/provider-accounts.js +2 -8
- package/dist/transport.d.ts +2 -0
- package/dist/transport.js +14 -0
- package/dist/usage/ChartLogo.d.ts +5 -0
- package/dist/usage/ChartLogo.js +48 -0
- package/dist/usage/LimitsList.js +6 -16
- package/dist/usage/UsageBreakdown.js +17 -40
- package/dist/usage/UsageLimits.js +183 -211
- package/dist/usage/UsagePage.js +3 -17
- package/dist/usage/UsageSummary.js +4 -9
- package/dist/usage/limits.js +16 -31
- package/dist/usage/summary.d.ts +1 -1
- package/dist/usage/summary.js +3 -5
- package/package.json +26 -26
- package/src/agents/AccountDot.tsx +1 -0
- package/src/agents/AgentIcon.tsx +2 -0
- package/src/agents/AgentModelLabel.tsx +4 -6
- package/src/agents/ModelOptionControl.tsx +8 -0
- package/src/agents/account-limits.ts +3 -0
- package/src/agents/accounts.ts +12 -0
- package/src/agents/model-name.ts +13 -1
- package/src/agents/model-options.ts +2 -0
- package/src/agents/model-requirement.ts +4 -0
- package/src/agents/option-words.ts +2 -0
- package/src/agents/provider-paths.ts +8 -3
- package/src/agents/status-look.ts +1 -0
- package/src/chat/account-choice.ts +25 -19
- package/src/chat/actions.ts +5 -0
- package/src/chat/attachments.ts +8 -0
- package/src/chat/bookmarks.ts +13 -1
- package/src/chat/chat-client.ts +63 -0
- package/src/chat/chat-references.ts +3 -0
- package/src/chat/composer-effort.ts +5 -0
- package/src/chat/composer-send.ts +4 -0
- package/src/chat/drafts.ts +21 -17
- package/src/chat/forks.ts +4 -0
- package/src/chat/guards.ts +2 -0
- package/src/chat/index.ts +7 -0
- package/src/chat/logic/ansi.ts +47 -0
- package/src/chat/logic/bookmarks.ts +7 -0
- package/src/chat/logic/command-looks.ts +29 -0
- package/src/chat/logic/context-usage.ts +3 -0
- package/src/chat/logic/continue-after-stop.ts +5 -0
- package/src/chat/logic/effort.ts +4 -0
- package/src/chat/logic/embedded-code.ts +63 -0
- package/src/chat/logic/fork.ts +22 -0
- package/src/chat/logic/generated-image.ts +7 -0
- package/src/chat/logic/goal.ts +7 -0
- package/src/chat/logic/handback.ts +2 -0
- package/src/chat/logic/limit.ts +8 -0
- package/src/chat/logic/picker-entries.ts +16 -4
- package/src/chat/logic/resume-compaction.ts +22 -5
- package/src/chat/logic/scrubber.ts +38 -5
- package/src/chat/logic/thought.ts +5 -0
- package/src/chat/logic/thread-cards.ts +6 -0
- package/src/chat/logic/timeline-copy.ts +4 -9
- package/src/chat/logic/timeline-target.ts +15 -0
- package/src/chat/logic/timeline.ts +113 -10
- package/src/chat/logic/tools.ts +30 -0
- package/src/chat/logic/visual-height.ts +5 -0
- package/src/chat/logic/visual-viewport.ts +1 -0
- package/src/chat/logic/welcome.ts +3 -0
- package/src/chat/logic/workflow.ts +26 -7
- package/src/chat/mentions.ts +56 -0
- package/src/chat/pending-prompts.ts +16 -0
- package/src/chat/persisted-json.ts +15 -0
- package/src/chat/preferences.ts +16 -0
- package/src/chat/prompt-hold.ts +2 -0
- package/src/chat/quote.ts +7 -0
- package/src/chat/reading-width.ts +1 -0
- package/src/chat/recent-messages.ts +5 -0
- package/src/chat/resume-compaction-dismissals.ts +1 -0
- package/src/chat/stash.ts +12 -0
- package/src/chat/subagent-conversation.ts +24 -4
- package/src/chat/subagent-list.ts +14 -0
- package/src/chat/subagent-support.ts +1 -0
- package/src/chat/subagent-view.ts +9 -0
- package/src/chat/thumbnails.ts +14 -0
- package/src/chat/timeline-flash.ts +2 -0
- package/src/chat/timeline-scroll.ts +23 -0
- package/src/chat/ui/AccountPill.tsx +4 -0
- package/src/chat/ui/AnsiOutput.tsx +1 -0
- package/src/chat/ui/BookmarkMarker.tsx +5 -0
- package/src/chat/ui/BookmarkSubmenu.tsx +1 -0
- package/src/chat/ui/ChatActivity.tsx +13 -0
- package/src/chat/ui/CodeBlock.tsx +8 -0
- package/src/chat/ui/Composer.tsx +15 -0
- package/src/chat/ui/ComposerInput.tsx +22 -0
- package/src/chat/ui/DiffPool.tsx +3 -0
- package/src/chat/ui/EditDiff.tsx +5 -0
- package/src/chat/ui/GoalDock.tsx +13 -1
- package/src/chat/ui/ImageView.tsx +11 -0
- package/src/chat/ui/LimitState.tsx +23 -6
- package/src/chat/ui/Markdown.tsx +41 -0
- package/src/chat/ui/MermaidBlock.tsx +16 -0
- package/src/chat/ui/MessageActions.tsx +8 -0
- package/src/chat/ui/ModelMarks.tsx +1 -0
- package/src/chat/ui/Pickers.tsx +26 -0
- package/src/chat/ui/PromptComposer.tsx +2 -0
- package/src/chat/ui/PromptEditor.tsx +6 -0
- package/src/chat/ui/QuoteButton.tsx +12 -0
- package/src/chat/ui/ReferenceChip.tsx +3 -0
- package/src/chat/ui/ResumeCompactionDock.tsx +1 -0
- package/src/chat/ui/RowTime.tsx +1 -0
- package/src/chat/ui/RunSettings.tsx +38 -0
- package/src/chat/ui/Scrubber.tsx +14 -0
- package/src/chat/ui/SessionLine.tsx +1 -0
- package/src/chat/ui/ShellCommand.tsx +32 -0
- package/src/chat/ui/SubagentControls.tsx +7 -0
- package/src/chat/ui/SubagentInfo.tsx +1 -0
- package/src/chat/ui/SubagentStopButton.tsx +6 -0
- package/src/chat/ui/SubagentTimeline.tsx +10 -0
- package/src/chat/ui/Timeline.tsx +119 -0
- package/src/chat/ui/TimelineMenu.tsx +5 -0
- package/src/chat/ui/UnifiedDiff.tsx +6 -0
- package/src/chat/ui/UploadThumb.tsx +2 -0
- package/src/chat/ui/VisualDialogs.tsx +3 -0
- package/src/chat/ui/VisualFrame.tsx +15 -0
- package/src/chat/ui/Welcome.tsx +1 -0
- package/src/chat/ui/chip-clipboard.ts +20 -0
- package/src/chat/ui/code-lines.ts +14 -0
- package/src/chat/ui/code-theme.ts +1 -0
- package/src/chat/ui/composer/ComposerControls.tsx +5 -0
- package/src/chat/ui/composer/ComposerMenu.tsx +12 -0
- package/src/chat/ui/composer/DraftParts.tsx +2 -0
- package/src/chat/ui/composer/QueuedMessages.tsx +4 -0
- package/src/chat/ui/composer/chip-paste.ts +16 -0
- package/src/chat/ui/composer/chips.ts +6 -0
- package/src/chat/ui/composer/editor.ts +9 -0
- package/src/chat/ui/composer/insert.ts +2 -0
- package/src/chat/ui/composer/key-handler.ts +39 -0
- package/src/chat/ui/composer/keys.ts +23 -0
- package/src/chat/ui/composer/placeholder.ts +6 -0
- package/src/chat/ui/composer/prompt-picks.ts +1 -0
- package/src/chat/ui/composer/surface.ts +5 -0
- package/src/chat/ui/composer/use-chat-controls.ts +13 -0
- package/src/chat/ui/composer/use-compaction-offer.ts +3 -0
- package/src/chat/ui/composer/use-composer-menus.ts +2 -0
- package/src/chat/ui/composer/use-composer-submit.ts +27 -0
- package/src/chat/ui/composer/use-continuable-turn.ts +3 -5
- package/src/chat/ui/composer/use-draft-files.ts +24 -0
- package/src/chat/ui/composer/use-effort-stepper.ts +8 -0
- package/src/chat/ui/composer/use-notice.ts +4 -1
- package/src/chat/ui/composer/use-pending-requests.ts +3 -0
- package/src/chat/ui/composer/use-prompt-history.ts +20 -11
- package/src/chat/ui/composer/use-prompt-hold.ts +3 -0
- package/src/chat/ui/composer/use-prompt-menus.ts +34 -14
- package/src/chat/ui/composer/use-take-back.ts +20 -2
- package/src/chat/ui/diff/ApprovalReview.tsx +18 -15
- package/src/chat/ui/diff/DiffFallbackBoundary.tsx +1 -0
- package/src/chat/ui/diff/DiffOmitted.tsx +1 -0
- package/src/chat/ui/diff/DiffStack.tsx +2 -0
- package/src/chat/ui/diff/DiffUnavailable.tsx +1 -0
- package/src/chat/ui/diff/EditorEditDiff.tsx +13 -0
- package/src/chat/ui/diff/EditorPatchDiff.tsx +4 -0
- package/src/chat/ui/diff/LegacyDiffPool.tsx +2 -0
- package/src/chat/ui/diff/LegacyEditDiff.tsx +2 -0
- package/src/chat/ui/diff/LegacyUnifiedDiff.tsx +8 -0
- package/src/chat/ui/diff/RawDiff.tsx +1 -0
- package/src/chat/ui/diff/ReviewDiff.tsx +1 -0
- package/src/chat/ui/diff/diff-source-budget.ts +8 -0
- package/src/chat/ui/diff/editor-edit-model.ts +4 -0
- package/src/chat/ui/diff/review-plan.ts +9 -0
- package/src/chat/ui/diff/review-settle.ts +1 -0
- package/src/chat/ui/diff/syntax-runtime.ts +52 -0
- package/src/chat/ui/diff/use-review-stack.ts +9 -0
- package/src/chat/ui/diff-syntax.ts +12 -0
- package/src/chat/ui/diff-theme.ts +2 -0
- package/src/chat/ui/file-links.ts +2 -0
- package/src/chat/ui/find-reveal.ts +1 -0
- package/src/chat/ui/full-diff.ts +1 -0
- package/src/chat/ui/highlighter.ts +29 -15
- package/src/chat/ui/icons.tsx +2 -4
- package/src/chat/ui/index.ts +4 -0
- package/src/chat/ui/intelligent-ui/UiBlockFrame.tsx +25 -0
- package/src/chat/ui/intelligent-ui/UiFallbackPart.tsx +1 -0
- package/src/chat/ui/intelligent-ui/UiReply.tsx +63 -0
- package/src/chat/ui/intelligent-ui/block-local.ts +5 -0
- package/src/chat/ui/intelligent-ui/chart-data.ts +15 -0
- package/src/chat/ui/intelligent-ui/node-text.ts +17 -0
- package/src/chat/ui/intelligent-ui/renderers/binding.ts +1 -0
- package/src/chat/ui/intelligent-ui/renderers/chart.tsx +31 -0
- package/src/chat/ui/intelligent-ui/renderers/choices.tsx +4 -0
- package/src/chat/ui/intelligent-ui/renderers/content.tsx +18 -0
- package/src/chat/ui/intelligent-ui/renderers/data.tsx +11 -0
- package/src/chat/ui/intelligent-ui/renderers/inputs.tsx +13 -0
- package/src/chat/ui/intelligent-ui/renderers/links.tsx +9 -0
- package/src/chat/ui/intelligent-ui/renderers/map-slots.ts +15 -0
- package/src/chat/ui/intelligent-ui/renderers/map-style.ts +15 -0
- package/src/chat/ui/intelligent-ui/renderers/map-view.tsx +48 -0
- package/src/chat/ui/intelligent-ui/renderers/map.tsx +20 -0
- package/src/chat/ui/intelligent-ui/renderers/place-point.ts +3 -0
- package/src/chat/ui/intelligent-ui/renderers/structure.tsx +3 -0
- package/src/chat/ui/intelligent-ui/renderers/text.tsx +8 -0
- package/src/chat/ui/intelligent-ui/reply-parts.ts +5 -0
- package/src/chat/ui/intelligent-ui/table-data.ts +17 -0
- package/src/chat/ui/intelligent-ui/use-in-view.ts +4 -0
- package/src/chat/ui/intelligent-ui/use-later.ts +4 -0
- package/src/chat/ui/intelligent-ui/use-truncated.ts +5 -0
- package/src/chat/ui/intelligent-ui/use-ui-links.ts +29 -0
- package/src/chat/ui/intelligent-ui/use-ui-queries.ts +60 -0
- package/src/chat/ui/markdown-blocks.ts +64 -0
- package/src/chat/ui/mermaid.ts +4 -0
- package/src/chat/ui/quote-selection.ts +10 -0
- package/src/chat/ui/rehype-chips.ts +5 -0
- package/src/chat/ui/rehype-fade.ts +2 -0
- package/src/chat/ui/remark-html-as-text.ts +5 -0
- package/src/chat/ui/reveal.ts +18 -0
- package/src/chat/ui/rows/ForksRow.tsx +5 -0
- package/src/chat/ui/rows/GeneratedImageRow.tsx +10 -0
- package/src/chat/ui/rows/MessageRows.tsx +29 -5
- package/src/chat/ui/rows/RowContainer.tsx +1 -0
- package/src/chat/ui/rows/Rows.tsx +2 -0
- package/src/chat/ui/rows/SubagentRow.tsx +13 -0
- package/src/chat/ui/rows/TaskRow.tsx +7 -0
- package/src/chat/ui/rows/VisualRow.tsx +4 -0
- package/src/chat/ui/rows/WorkRows.tsx +46 -0
- package/src/chat/ui/rows/WorkflowRow.tsx +10 -0
- package/src/chat/ui/rows/row-rhythm.ts +7 -5
- package/src/chat/ui/theme-watch.ts +8 -7
- package/src/chat/ui/thread-references.ts +7 -0
- package/src/chat/ui/use-diff-source-tokens.ts +8 -0
- package/src/chat/ui/useToggleSet.ts +3 -0
- package/src/chat/ui/visual-theme.ts +30 -0
- package/src/chat/visual-bridge.ts +23 -0
- package/src/chat/visual-viewport.ts +12 -0
- package/src/host-hooks.ts +6 -4
- package/src/host.ts +2 -0
- package/src/index.ts +3 -0
- package/src/lazy.tsx +9 -0
- package/src/mounted-registry.ts +4 -0
- package/src/port-transport.ts +32 -0
- package/src/prompts/index.ts +2 -0
- package/src/prompts/logic/focus.ts +5 -0
- package/src/prompts/logic/keys.ts +12 -0
- package/src/prompts/logic/prompts.ts +8 -0
- package/src/prompts/logic/subjects.ts +8 -0
- package/src/prompts/logic/useFocusAfterAnswer.ts +2 -0
- package/src/prompts/logic/usePromptSession.ts +13 -1
- package/src/prompts/ui/ApprovalBody.tsx +2 -0
- package/src/prompts/ui/PromptActions.tsx +2 -0
- package/src/prompts/ui/PromptCard.tsx +6 -0
- package/src/prompts/ui/PromptView.tsx +6 -0
- package/src/prompts/ui/QuestionBody.tsx +11 -0
- package/src/providers/AccountColors.tsx +1 -0
- package/src/providers/AccountDetail.tsx +7 -0
- package/src/providers/AccountVariables.tsx +2 -0
- package/src/providers/AddAccountForm.tsx +5 -1
- package/src/providers/CliDetail.tsx +6 -5
- package/src/providers/InstallPage.tsx +11 -0
- package/src/providers/ProviderList.tsx +3 -0
- package/src/providers/ProvidersPane.tsx +18 -0
- package/src/providers/account-actions.ts +10 -8
- package/src/providers/install-steps.ts +3 -0
- package/src/providers/pane-target.ts +5 -0
- package/src/providers/provider-abilities.ts +1 -0
- package/src/providers/provider-groups.ts +6 -0
- package/src/providers/variables.ts +12 -0
- package/src/scope.ts +2 -0
- package/src/state/chats.ts +61 -14
- package/src/state/index.ts +2 -0
- package/src/state/provider-accounts.ts +7 -9
- package/src/state/providers.ts +1 -0
- package/src/state/usage.ts +6 -0
- package/src/storage.ts +18 -0
- package/src/testing/prompts.ts +5 -0
- package/src/transport.ts +18 -0
- package/src/usage/ChartLogo.tsx +12 -0
- package/src/usage/LimitsList.tsx +7 -8
- package/src/usage/UsageBreakdown.tsx +11 -4
- package/src/usage/UsageChart.tsx +5 -0
- package/src/usage/UsageLimits.tsx +10 -7
- package/src/usage/UsageLimitsCard.tsx +2 -0
- package/src/usage/UsagePage.tsx +16 -19
- package/src/usage/UsageSummary.tsx +4 -5
- package/src/usage/UsageTiles.tsx +2 -0
- package/src/usage/format.ts +7 -0
- package/src/usage/limit-groups.ts +14 -0
- package/src/usage/limits.ts +11 -13
- package/src/usage/money.ts +1 -0
- package/src/usage/summary.ts +15 -7
|
@@ -149,18 +149,6 @@ export function loadLanguage(lang) {
|
|
|
149
149
|
export function loadTheme(theme, custom) {
|
|
150
150
|
return codeHighlighter().loadTheme(theme, custom);
|
|
151
151
|
}
|
|
152
|
-
/* The web bundle's highlighter once every one of `langs` and `theme` is in, or null while one is still on its way. */
|
|
153
|
-
export function readyHighlighter(langs, theme) {
|
|
154
|
-
return codeHighlighter().ready(langs, theme);
|
|
155
|
-
}
|
|
156
|
-
/* The language the web bundle draws `lang` in: the bundled grammar, or plain text. Only meaningful once a load settled. */
|
|
157
|
-
export function loadedLanguage(lang) {
|
|
158
|
-
return codeHighlighter().language(lang);
|
|
159
|
-
}
|
|
160
|
-
/* The web bundle's tokenizer for a language in a theme, or null while shiki, the grammar or the theme is still on its way. */
|
|
161
|
-
export function tokenizerFor(lang, theme) {
|
|
162
|
-
return codeHighlighter().tokenizer(lang, theme);
|
|
163
|
-
}
|
|
164
152
|
/* The inline style of one token; undefined when it only has the surrounding color. */
|
|
165
153
|
export function tokenStyle(token) {
|
|
166
154
|
const style = token.fontStyle ?? 0;
|
package/dist/chat/ui/icons.d.ts
CHANGED
package/dist/chat/ui/icons.js
CHANGED
|
@@ -3,9 +3,6 @@ import { toolEntry } from '../logic/tool-catalog.js';
|
|
|
3
3
|
import { Icon } from '@adecore/ui';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
const SIZE = 12;
|
|
6
|
-
/* A pending dock draws its mark a step up from the lines of a transcript, at the size a sidebar
|
|
7
|
-
row uses, because it is a thing to answer rather than a thing to read past. */
|
|
8
|
-
export const DOCK_ICON_SIZE = 14;
|
|
9
6
|
/* The gutter every row in the thread opens with: 16 wide, on the line box of its first row of text,
|
|
10
7
|
so the mark of a tool call, a note and a fold all sit in one column and their labels start at the
|
|
11
8
|
same x. The same box the menu rows and the toasts use. */
|
|
@@ -786,11 +786,8 @@ function Writing() {
|
|
|
786
786
|
return t1;
|
|
787
787
|
}
|
|
788
788
|
/*
|
|
789
|
-
* A reply
|
|
790
|
-
*
|
|
791
|
-
* it says it is being written and fades in once it is done. Only a row that saw the reply being
|
|
792
|
-
* written fades anything: an old reply scrolled back into view just stands there. A `#Name` it
|
|
793
|
-
* spells for a view, node or chat of the project is a chip that opens it.
|
|
789
|
+
* A reply, streamed a word, a block or the whole of it at a time. Only a row that saw the reply being
|
|
790
|
+
* written fades anything in: an old reply scrolled back into view just stands there.
|
|
794
791
|
*/
|
|
795
792
|
export function AssistantRow(t0) {
|
|
796
793
|
const $ = _c(67);
|
|
@@ -3,11 +3,8 @@ import { isBlock } from '../../logic/timeline.js';
|
|
|
3
3
|
/* Below this distance from the bottom a thread follows what the agent writes; above it the reader scrolled back on purpose. */
|
|
4
4
|
export const FOLLOW_THRESHOLD_PX = 40;
|
|
5
5
|
/*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* app's card have no margin of their own like prose does, so the row under one takes the block gap
|
|
9
|
-
* too. A question already carries the gap before it, and the row after one is the answer, so neither
|
|
10
|
-
* takes a seam.
|
|
6
|
+
* A seam where tool lines meet prose gets the block gap, and so does the row under a visual or an app's
|
|
7
|
+
* card, which have no margin of their own. A question and the answer after it never take a seam.
|
|
11
8
|
*/
|
|
12
9
|
export function rowRhythm(row, previous) {
|
|
13
10
|
const question = row.kind === 'user';
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
/* The attributes of the root and the body an app switches its theme, its accent or its palette with. */
|
|
2
2
|
const THEME_ATTRIBUTES = ['class', 'style', 'data-theme'];
|
|
3
3
|
/*
|
|
4
|
-
* Calls `changed` after the root of `owner`
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* well, the signal the terminal follows too. Returns what stops it.
|
|
8
|
-
*
|
|
9
|
-
* Any change of those attributes counts, also one that leaves every token as it was (a dialog that
|
|
10
|
-
* locks the scroll writes the root's `style`), so a caller compares what it reads with what it drew.
|
|
4
|
+
* Calls `changed` at most once a frame after the root or body of `owner` changes a theme attribute. An app
|
|
5
|
+
* that rewrites its palette through a stylesheet touches the root's `style` as well, as the terminal expects.
|
|
6
|
+
* Any change counts, also one that leaves every token alone, so a caller compares what it reads with what it drew.
|
|
11
7
|
*/
|
|
12
8
|
export function watchTheme(owner, changed) {
|
|
13
9
|
const view = owner.defaultView ?? window;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useRef, useState } from 'react';
|
|
2
|
+
import { errorMessage } from '../../transport.js';
|
|
2
3
|
import { emptyPromptDraft } from './prompts.js';
|
|
3
4
|
/*
|
|
4
5
|
* What answering a row of prompts needs besides the prompts: a draft per request that survives
|
|
@@ -59,7 +60,7 @@ export function usePromptSession({
|
|
|
59
60
|
} catch (cause) {
|
|
60
61
|
setError({
|
|
61
62
|
id: id_1,
|
|
62
|
-
message:
|
|
63
|
+
message: errorMessage(cause)
|
|
63
64
|
});
|
|
64
65
|
return 'failed';
|
|
65
66
|
} finally {
|
|
@@ -11,6 +11,7 @@ import { DetailHeader, SettingsRow, SettingsSection } from '@adecore/ui/settings
|
|
|
11
11
|
import { Button, FormError, Icon, Input } from '@adecore/ui';
|
|
12
12
|
import { CliTile } from './parts.js';
|
|
13
13
|
import { providerAccountsOf } from '../state/provider-accounts.js';
|
|
14
|
+
import { errorMessage } from '../transport.js';
|
|
14
15
|
/*
|
|
15
16
|
* A name and a color, asked before anything exists, so the account is made once with both. By default
|
|
16
17
|
* the machine makes the folder; under Advanced a person points at a folder of their own instead.
|
|
@@ -60,7 +61,7 @@ export function AddAccountForm({
|
|
|
60
61
|
onAdded(await createAccount(scope, provider.kind, label, color), label, true);
|
|
61
62
|
}
|
|
62
63
|
} catch (e) {
|
|
63
|
-
setError(
|
|
64
|
+
setError(errorMessage(e));
|
|
64
65
|
setBusy(false);
|
|
65
66
|
}
|
|
66
67
|
};
|
|
@@ -5,14 +5,14 @@ import { AccountDot } from '../agents/AccountDot.js';
|
|
|
5
5
|
import { ModelOptionControl } from '../agents/ModelOptionControl.js';
|
|
6
6
|
import { carryOptions } from '../agents/model-options.js';
|
|
7
7
|
import { optionWord } from '../agents/option-words.js';
|
|
8
|
-
import { ACCOUNT_TONE_CLASSES, accountName, accountStatusLine } from '../agents/accounts.js';
|
|
8
|
+
import { ACCOUNT_TONE_CLASSES, accountName, accountStatusLine, offeredAccounts } from '../agents/accounts.js';
|
|
9
9
|
import { accountFor, forgetChatSelection, rememberChatAccount, rememberChatSelection, selectionFor, useChatPreferences } from '../chat/preferences.js';
|
|
10
10
|
import { useChatScope } from '../scope.js';
|
|
11
11
|
import { providerAbilities } from './provider-abilities.js';
|
|
12
12
|
import { DetailHeader, SettingsRow, SettingsSection } from '@adecore/ui/settings';
|
|
13
13
|
import { Button, Icon, Select } from '@adecore/ui';
|
|
14
14
|
import { CliTile } from './parts.js';
|
|
15
|
-
import {
|
|
15
|
+
import { knownAccounts, useProviderAccounts } from '../state/provider-accounts.js';
|
|
16
16
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
const PROVIDER_DEFAULT = '';
|
|
18
18
|
/* One row per knob the chosen model exposes; the composer's option picker shows the same descriptors. */
|
|
@@ -85,7 +85,7 @@ function ModelOptionRows(t0) {
|
|
|
85
85
|
}
|
|
86
86
|
/* One CLI: what it is, what a new chat of it starts with unless `defaults` is off, and its accounts. */
|
|
87
87
|
export function CliDetail(t0) {
|
|
88
|
-
const $ = _c(
|
|
88
|
+
const $ = _c(49);
|
|
89
89
|
const {
|
|
90
90
|
provider,
|
|
91
91
|
entries,
|
|
@@ -129,75 +129,48 @@ export function CliDetail(t0) {
|
|
|
129
129
|
t2 = $[5];
|
|
130
130
|
}
|
|
131
131
|
const model = t2;
|
|
132
|
+
const machineAccounts = useProviderAccounts(knownAccounts);
|
|
133
|
+
let canAddAccount;
|
|
132
134
|
let t3;
|
|
133
|
-
if ($[8] !== scopeId) {
|
|
134
|
-
t3 = s => s.byScope[scopeId]?.loaded ? s.byScope[scopeId].accounts : undefined;
|
|
135
|
-
$[8] = scopeId;
|
|
136
|
-
$[9] = t3;
|
|
137
|
-
} else {
|
|
138
|
-
t3 = $[9];
|
|
139
|
-
}
|
|
140
|
-
const machineAccounts = useProviderAccountsStore(t3);
|
|
141
135
|
let t4;
|
|
142
|
-
if ($[10] !==
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
$[11] = preferences;
|
|
146
|
-
$[12] = provider.kind;
|
|
147
|
-
$[13] = scopeId;
|
|
148
|
-
$[14] = t4;
|
|
149
|
-
} else {
|
|
150
|
-
t4 = $[14];
|
|
151
|
-
}
|
|
152
|
-
const picked = t4;
|
|
153
|
-
let canAddAccount;
|
|
154
|
-
let t5;
|
|
155
|
-
let t6;
|
|
156
|
-
if ($[15] !== defaults || $[16] !== entries || $[17] !== login || $[18] !== model || $[19] !== onAddAccount || $[20] !== picked || $[21] !== provider || $[22] !== scopeId || $[23] !== selection?.options || $[24] !== t) {
|
|
157
|
-
let t7;
|
|
158
|
-
if ($[28] !== picked) {
|
|
159
|
-
t7 = entry_0 => entry_0.account.enabled !== false || entry_0.id === picked;
|
|
160
|
-
$[28] = picked;
|
|
161
|
-
$[29] = t7;
|
|
162
|
-
} else {
|
|
163
|
-
t7 = $[29];
|
|
164
|
-
}
|
|
165
|
-
const choosable = (entries ?? []).filter(t7);
|
|
136
|
+
if ($[8] !== defaults || $[9] !== entries || $[10] !== login || $[11] !== machineAccounts || $[12] !== model || $[13] !== onAddAccount || $[14] !== preferences || $[15] !== provider || $[16] !== scopeId || $[17] !== selection?.options || $[18] !== t) {
|
|
137
|
+
const picked = accountFor(preferences, scopeId, provider.kind, machineAccounts) ?? provider.kind;
|
|
138
|
+
const choosable = offeredAccounts(entries ?? [], picked);
|
|
166
139
|
canAddAccount = login !== null;
|
|
167
|
-
let
|
|
168
|
-
if ($[
|
|
169
|
-
|
|
140
|
+
let t5;
|
|
141
|
+
if ($[22] !== provider.kind) {
|
|
142
|
+
t5 = /*#__PURE__*/_jsx(CliTile, {
|
|
170
143
|
kind: provider.kind
|
|
171
144
|
});
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
145
|
+
$[22] = provider.kind;
|
|
146
|
+
$[23] = t5;
|
|
174
147
|
} else {
|
|
175
|
-
|
|
148
|
+
t5 = $[23];
|
|
176
149
|
}
|
|
177
|
-
const
|
|
178
|
-
let
|
|
179
|
-
if ($[
|
|
180
|
-
|
|
150
|
+
const t6 = provider.name;
|
|
151
|
+
let t7;
|
|
152
|
+
if ($[24] !== provider.version || $[25] !== t) {
|
|
153
|
+
t7 = provider.version ? `${t("abilities.version", {
|
|
181
154
|
version: provider.version
|
|
182
155
|
})} ` : "";
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
$[
|
|
156
|
+
$[24] = provider.version;
|
|
157
|
+
$[25] = t;
|
|
158
|
+
$[26] = t7;
|
|
186
159
|
} else {
|
|
187
|
-
|
|
160
|
+
t7 = $[26];
|
|
188
161
|
}
|
|
189
|
-
let
|
|
190
|
-
if ($[
|
|
191
|
-
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
162
|
+
let t8;
|
|
163
|
+
if ($[27] !== provider) {
|
|
164
|
+
t8 = providerAbilities(provider);
|
|
165
|
+
$[27] = provider;
|
|
166
|
+
$[28] = t8;
|
|
194
167
|
} else {
|
|
195
|
-
|
|
168
|
+
t8 = $[28];
|
|
196
169
|
}
|
|
197
|
-
const
|
|
198
|
-
let
|
|
199
|
-
if ($[
|
|
200
|
-
|
|
170
|
+
const t9 = `${t7}${t8}`;
|
|
171
|
+
let t10;
|
|
172
|
+
if ($[29] !== canAddAccount || $[30] !== onAddAccount || $[31] !== t) {
|
|
173
|
+
t10 = canAddAccount && /*#__PURE__*/_jsxs(Button, {
|
|
201
174
|
variant: "secondary",
|
|
202
175
|
className: "whitespace-nowrap",
|
|
203
176
|
onClick: onAddAccount,
|
|
@@ -206,29 +179,29 @@ export function CliDetail(t0) {
|
|
|
206
179
|
size: 14
|
|
207
180
|
}), t("cli.addAccount")]
|
|
208
181
|
});
|
|
209
|
-
$[
|
|
210
|
-
$[
|
|
211
|
-
$[
|
|
212
|
-
$[
|
|
182
|
+
$[29] = canAddAccount;
|
|
183
|
+
$[30] = onAddAccount;
|
|
184
|
+
$[31] = t;
|
|
185
|
+
$[32] = t10;
|
|
213
186
|
} else {
|
|
214
|
-
|
|
187
|
+
t10 = $[32];
|
|
215
188
|
}
|
|
216
|
-
if ($[
|
|
217
|
-
|
|
218
|
-
mark:
|
|
219
|
-
title:
|
|
220
|
-
subtitle:
|
|
221
|
-
actions:
|
|
189
|
+
if ($[33] !== provider.name || $[34] !== t10 || $[35] !== t5 || $[36] !== t9) {
|
|
190
|
+
t3 = /*#__PURE__*/_jsx(DetailHeader, {
|
|
191
|
+
mark: t5,
|
|
192
|
+
title: t6,
|
|
193
|
+
subtitle: t9,
|
|
194
|
+
actions: t10
|
|
222
195
|
});
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
196
|
+
$[33] = provider.name;
|
|
197
|
+
$[34] = t10;
|
|
198
|
+
$[35] = t5;
|
|
199
|
+
$[36] = t9;
|
|
200
|
+
$[37] = t3;
|
|
228
201
|
} else {
|
|
229
|
-
|
|
202
|
+
t3 = $[37];
|
|
230
203
|
}
|
|
231
|
-
|
|
204
|
+
t4 = defaults && /*#__PURE__*/_jsxs(SettingsSection, {
|
|
232
205
|
title: t("cli.defaults.title"),
|
|
233
206
|
description: t("cli.defaults.description"),
|
|
234
207
|
children: [choosable.length > 0 && /*#__PURE__*/_jsx(SettingsRow, {
|
|
@@ -240,11 +213,11 @@ export function CliDetail(t0) {
|
|
|
240
213
|
provider: provider.name
|
|
241
214
|
}),
|
|
242
215
|
align: "end",
|
|
243
|
-
items: choosable.map(
|
|
244
|
-
value:
|
|
245
|
-
label: accountName(
|
|
216
|
+
items: choosable.map(entry_0 => ({
|
|
217
|
+
value: entry_0.id,
|
|
218
|
+
label: accountName(entry_0, provider.name),
|
|
246
219
|
icon: /*#__PURE__*/_jsx(AccountDot, {
|
|
247
|
-
color:
|
|
220
|
+
color: entry_0.account.color,
|
|
248
221
|
className: "size-2"
|
|
249
222
|
})
|
|
250
223
|
})),
|
|
@@ -265,15 +238,15 @@ export function CliDetail(t0) {
|
|
|
265
238
|
items: [{
|
|
266
239
|
value: PROVIDER_DEFAULT,
|
|
267
240
|
label: t("cli.defaults.providerDefault")
|
|
268
|
-
}, ...provider.models.map(
|
|
269
|
-
value:
|
|
270
|
-
label:
|
|
271
|
-
name:
|
|
272
|
-
}) :
|
|
241
|
+
}, ...provider.models.map(entry_1 => ({
|
|
242
|
+
value: entry_1.slug,
|
|
243
|
+
label: entry_1.legacy ? t("cli.defaults.legacyModel", {
|
|
244
|
+
name: entry_1.name
|
|
245
|
+
}) : entry_1.name
|
|
273
246
|
}))],
|
|
274
247
|
onValueChange: value => value === PROVIDER_DEFAULT ? forgetChatSelection(provider.kind) : rememberChatSelection(provider.kind, {
|
|
275
248
|
model: value,
|
|
276
|
-
options: carryOptions(selection?.options ?? {}, provider.models.find(
|
|
249
|
+
options: carryOptions(selection?.options ?? {}, provider.models.find(entry_2 => entry_2.slug === value))
|
|
277
250
|
})
|
|
278
251
|
})
|
|
279
252
|
}), model && /*#__PURE__*/_jsx(ModelOptionRows, {
|
|
@@ -285,27 +258,28 @@ export function CliDetail(t0) {
|
|
|
285
258
|
label: t("cli.defaults.usesCliDefault")
|
|
286
259
|
})]
|
|
287
260
|
});
|
|
288
|
-
$[
|
|
289
|
-
$[
|
|
290
|
-
$[
|
|
291
|
-
$[
|
|
292
|
-
$[
|
|
293
|
-
$[
|
|
294
|
-
$[
|
|
295
|
-
$[
|
|
296
|
-
$[
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
261
|
+
$[8] = defaults;
|
|
262
|
+
$[9] = entries;
|
|
263
|
+
$[10] = login;
|
|
264
|
+
$[11] = machineAccounts;
|
|
265
|
+
$[12] = model;
|
|
266
|
+
$[13] = onAddAccount;
|
|
267
|
+
$[14] = preferences;
|
|
268
|
+
$[15] = provider;
|
|
269
|
+
$[16] = scopeId;
|
|
270
|
+
$[17] = selection?.options;
|
|
271
|
+
$[18] = t;
|
|
272
|
+
$[19] = canAddAccount;
|
|
273
|
+
$[20] = t3;
|
|
274
|
+
$[21] = t4;
|
|
301
275
|
} else {
|
|
302
|
-
canAddAccount = $[
|
|
303
|
-
|
|
304
|
-
|
|
276
|
+
canAddAccount = $[19];
|
|
277
|
+
t3 = $[20];
|
|
278
|
+
t4 = $[21];
|
|
305
279
|
}
|
|
306
|
-
let
|
|
307
|
-
if ($[
|
|
308
|
-
|
|
280
|
+
let t5;
|
|
281
|
+
if ($[38] !== canAddAccount || $[39] !== entries || $[40] !== login || $[41] !== onPickAccount || $[42] !== provider.name || $[43] !== t) {
|
|
282
|
+
t5 = entries === null ? /*#__PURE__*/_jsx("p", {
|
|
309
283
|
className: "text-xs text-text-faint",
|
|
310
284
|
children: t("list.noAccounts")
|
|
311
285
|
}) : /*#__PURE__*/_jsx(SettingsSection, {
|
|
@@ -313,17 +287,17 @@ export function CliDetail(t0) {
|
|
|
313
287
|
footer: canAddAccount ? undefined : t("cli.onlyDefault", {
|
|
314
288
|
provider: provider.name
|
|
315
289
|
}),
|
|
316
|
-
children: entries.map(
|
|
317
|
-
const status = accountStatusLine(
|
|
290
|
+
children: entries.map(entry_3 => {
|
|
291
|
+
const status = accountStatusLine(entry_3.status, login === "terminal");
|
|
318
292
|
return /*#__PURE__*/_jsxs("button", {
|
|
319
293
|
type: "button",
|
|
320
294
|
className: "flex w-full min-w-0 items-center gap-3 px-4.5 py-3 text-left first:rounded-t-xl last:rounded-b-xl hover:bg-surface-hover",
|
|
321
|
-
onClick: () => onPickAccount(
|
|
295
|
+
onClick: () => onPickAccount(entry_3.id),
|
|
322
296
|
children: [/*#__PURE__*/_jsx(AccountDot, {
|
|
323
|
-
color:
|
|
297
|
+
color: entry_3.account.color
|
|
324
298
|
}), /*#__PURE__*/_jsx("span", {
|
|
325
299
|
className: "min-w-0 grow truncate text-sm text-text",
|
|
326
|
-
children: accountName(
|
|
300
|
+
children: accountName(entry_3, provider.name)
|
|
327
301
|
}), /*#__PURE__*/_jsx("span", {
|
|
328
302
|
className: `shrink-0 text-xs ${ACCOUNT_TONE_CLASSES[status.tone]}`,
|
|
329
303
|
children: status.text
|
|
@@ -332,30 +306,30 @@ export function CliDetail(t0) {
|
|
|
332
306
|
size: 14,
|
|
333
307
|
className: "shrink-0 text-text-faint"
|
|
334
308
|
})]
|
|
335
|
-
},
|
|
309
|
+
}, entry_3.id);
|
|
336
310
|
})
|
|
337
311
|
});
|
|
338
|
-
$[
|
|
339
|
-
$[
|
|
340
|
-
$[
|
|
341
|
-
$[
|
|
342
|
-
$[
|
|
343
|
-
$[
|
|
344
|
-
$[
|
|
312
|
+
$[38] = canAddAccount;
|
|
313
|
+
$[39] = entries;
|
|
314
|
+
$[40] = login;
|
|
315
|
+
$[41] = onPickAccount;
|
|
316
|
+
$[42] = provider.name;
|
|
317
|
+
$[43] = t;
|
|
318
|
+
$[44] = t5;
|
|
345
319
|
} else {
|
|
346
|
-
|
|
320
|
+
t5 = $[44];
|
|
347
321
|
}
|
|
348
|
-
let
|
|
349
|
-
if ($[
|
|
350
|
-
|
|
351
|
-
children: [
|
|
322
|
+
let t6;
|
|
323
|
+
if ($[45] !== t3 || $[46] !== t4 || $[47] !== t5) {
|
|
324
|
+
t6 = /*#__PURE__*/_jsxs(_Fragment, {
|
|
325
|
+
children: [t3, t4, t5]
|
|
352
326
|
});
|
|
353
|
-
$[
|
|
354
|
-
$[
|
|
355
|
-
$[
|
|
356
|
-
$[
|
|
327
|
+
$[45] = t3;
|
|
328
|
+
$[46] = t4;
|
|
329
|
+
$[47] = t5;
|
|
330
|
+
$[48] = t6;
|
|
357
331
|
} else {
|
|
358
|
-
|
|
332
|
+
t6 = $[48];
|
|
359
333
|
}
|
|
360
|
-
return
|
|
334
|
+
return t6;
|
|
361
335
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import i18next from 'i18next';
|
|
2
2
|
import { accountFor, readChatPreferences, rememberChatAccount } from '../chat/preferences.js';
|
|
3
3
|
import { providerAccountsOf, useProviderAccountsStore } from '../state/provider-accounts.js';
|
|
4
|
+
import { errorMessage } from '../transport.js';
|
|
4
5
|
function words(key, values) {
|
|
5
6
|
return i18next.t(`agent-providers:${key}`, values);
|
|
6
7
|
}
|
|
7
|
-
function reason(e) {
|
|
8
|
-
return e instanceof Error ? e.message : String(e);
|
|
9
|
-
}
|
|
10
8
|
function linkTo(scope) {
|
|
11
9
|
if (scope.transport.status !== 'open') {
|
|
12
10
|
throw new Error(words('notAnswering'));
|
|
@@ -25,7 +23,7 @@ export async function saveAccounts(scope, host, accounts) {
|
|
|
25
23
|
id: `providers-save-${scope.id}`,
|
|
26
24
|
kind: 'error',
|
|
27
25
|
title: words('account.saveFailed'),
|
|
28
|
-
description:
|
|
26
|
+
description: errorMessage(e)
|
|
29
27
|
});
|
|
30
28
|
return false;
|
|
31
29
|
}
|
|
@@ -56,15 +54,14 @@ export async function removeAccount(scope, host, id, kind) {
|
|
|
56
54
|
}
|
|
57
55
|
/* An account in a folder the host makes for it; answers its id. Throws what the host said, for the form to show. */
|
|
58
56
|
export async function createAccount(scope, kind, label, color) {
|
|
59
|
-
const
|
|
57
|
+
const {
|
|
58
|
+
id,
|
|
59
|
+
...accounts
|
|
60
|
+
} = await linkTo(scope).request('accounts.create', {
|
|
60
61
|
kind,
|
|
61
62
|
label,
|
|
62
63
|
color
|
|
63
64
|
});
|
|
64
|
-
const {
|
|
65
|
-
id,
|
|
66
|
-
...accounts
|
|
67
|
-
} = created;
|
|
68
65
|
useProviderAccountsStore.getState().set(scope.id, accounts);
|
|
69
66
|
return id;
|
|
70
67
|
}
|
package/dist/state/chats.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ interface ChatsStore {
|
|
|
43
43
|
forget(key: string): void;
|
|
44
44
|
forgetWhere(matches: (key: string) => boolean): void;
|
|
45
45
|
}
|
|
46
|
+
export declare function isWaiting(item: ChatItem | undefined): item is ChatApprovalItem | ChatQuestionItem;
|
|
46
47
|
export declare function prependPage(state: ChatState, cursor: string, page: ChatHistoryResult): ChatState;
|
|
47
48
|
export declare function waitingRequestsOf(chat: Pick<ChatState, 'structure' | 'order' | 'waitingBefore'> | undefined): Array<ChatApprovalItem | ChatQuestionItem>;
|
|
48
49
|
export declare function applyEvent(state: ChatState, event: ChatEvent): ChatState;
|
package/dist/state/chats.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useContext } from 'react';
|
|
|
3
3
|
import { create } from 'zustand';
|
|
4
4
|
import { appendToolOutput } from '@adecore/agent-contracts/text';
|
|
5
5
|
import { ChatScopeContext, useChatScope } from '../scope.js';
|
|
6
|
-
function isWaiting(item) {
|
|
6
|
+
export function isWaiting(item) {
|
|
7
7
|
return item?.kind === 'approval' && item.decision === 'pending' || item?.kind === 'question' && item.state === 'pending';
|
|
8
8
|
}
|
|
9
9
|
function stateOf(info, items, page) {
|
|
@@ -215,10 +215,7 @@ function applyUpdate(state, event, write) {
|
|
|
215
215
|
text: item.text + event.text
|
|
216
216
|
};
|
|
217
217
|
// The first text is structure after all, since an empty reply that is not streaming has no row.
|
|
218
|
-
|
|
219
|
-
return write(state, grown);
|
|
220
|
-
}
|
|
221
|
-
return write(state, grown, false);
|
|
218
|
+
return write(state, grown, item.text === '');
|
|
222
219
|
}
|
|
223
220
|
if (item?.kind === 'tool' && item.state === 'running') {
|
|
224
221
|
const progress = item.progress ?? {
|
|
@@ -226,14 +223,13 @@ function applyUpdate(state, event, write) {
|
|
|
226
223
|
description: null,
|
|
227
224
|
output: null
|
|
228
225
|
};
|
|
229
|
-
|
|
226
|
+
return write(state, {
|
|
230
227
|
...item,
|
|
231
228
|
progress: {
|
|
232
229
|
...progress,
|
|
233
230
|
output: appendToolOutput(progress.output, event.text)
|
|
234
231
|
}
|
|
235
|
-
};
|
|
236
|
-
return write(state, grown, false);
|
|
232
|
+
}, false);
|
|
237
233
|
}
|
|
238
234
|
return state;
|
|
239
235
|
}
|
|
@@ -338,9 +334,8 @@ export const useChats = create(set => ({
|
|
|
338
334
|
});
|
|
339
335
|
},
|
|
340
336
|
/*
|
|
341
|
-
* The
|
|
342
|
-
*
|
|
343
|
-
* the counters need, and they ask the info and never the items.
|
|
337
|
+
* The host sends this for every chat it has loaded. The thread stays empty until somebody attaches,
|
|
338
|
+
* since a header, a list and the counters read the info and never the items.
|
|
344
339
|
*/
|
|
345
340
|
status(key, info) {
|
|
346
341
|
set(s => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProviderAccounts } from '@adecore/agent-contracts';
|
|
2
|
-
import type
|
|
2
|
+
import { type ChatTransport } from '../transport.js';
|
|
3
3
|
export interface ProviderAccountsRow {
|
|
4
4
|
accounts: ProviderAccounts | null;
|
|
5
5
|
loaded: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { create } from 'zustand';
|
|
3
3
|
import { useChatScope } from '../scope.js';
|
|
4
|
+
import { whenOpen } from '../transport.js';
|
|
4
5
|
/* One object for a host that has not answered yet, so a selector gets a stable snapshot. */
|
|
5
6
|
const NONE = {
|
|
6
7
|
accounts: null,
|
|
@@ -78,13 +79,6 @@ export function watchProviderAccounts(scopeId, transport) {
|
|
|
78
79
|
const off = [transport.on('accounts.changed', accounts => {
|
|
79
80
|
changes += 1;
|
|
80
81
|
store.set(scopeId, accounts);
|
|
81
|
-
}), transport
|
|
82
|
-
if (status === 'open') {
|
|
83
|
-
load();
|
|
84
|
-
}
|
|
85
|
-
})];
|
|
86
|
-
if (transport.status === 'open') {
|
|
87
|
-
load();
|
|
88
|
-
}
|
|
82
|
+
}), whenOpen(transport, load)];
|
|
89
83
|
return () => off.forEach(stop => stop());
|
|
90
84
|
}
|
package/dist/transport.d.ts
CHANGED
|
@@ -21,4 +21,6 @@ export declare class ChatTransportError extends Error {
|
|
|
21
21
|
constructor(code: string, message: string);
|
|
22
22
|
}
|
|
23
23
|
export declare function errorCode(error: unknown): string | null;
|
|
24
|
+
export declare function whenOpen(transport: ChatTransport, run: () => void): () => void;
|
|
25
|
+
export declare function errorMessage(error: unknown): string;
|
|
24
26
|
export declare function isConnectionError(error: unknown): boolean;
|
package/dist/transport.js
CHANGED
|
@@ -11,6 +11,20 @@ export class ChatTransportError extends Error {
|
|
|
11
11
|
export function errorCode(error) {
|
|
12
12
|
return typeof error === 'object' && error !== null && 'code' in error && typeof error.code === 'string' ? error.code : null;
|
|
13
13
|
}
|
|
14
|
+
/* Runs `run` now while the link is up and again each time it comes back; answers the function that stops it. */
|
|
15
|
+
export function whenOpen(transport, run) {
|
|
16
|
+
if (transport.status === 'open') {
|
|
17
|
+
run();
|
|
18
|
+
}
|
|
19
|
+
return transport.subscribeStatus(status => {
|
|
20
|
+
if (status === 'open') {
|
|
21
|
+
run();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export function errorMessage(error) {
|
|
26
|
+
return error instanceof Error ? error.message : String(error);
|
|
27
|
+
}
|
|
14
28
|
/* Whether a request failed because the link was down rather than because the host refused it; the reconnect asks again. */
|
|
15
29
|
export function isConnectionError(error) {
|
|
16
30
|
const code = errorCode(error);
|