@sixb/app 0.1.16 → 0.1.18
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 +8 -0
- package/dist/agent/agent-chat.d.ts.map +1 -1
- package/dist/agent/bash/interpret.d.ts +6 -2
- package/dist/agent/bash/interpret.d.ts.map +1 -1
- package/dist/agent/components/approval-mode-icons.d.ts +5 -0
- package/dist/agent/components/approval-mode-icons.d.ts.map +1 -0
- package/dist/agent/components/composer-add-menu.d.ts +15 -0
- package/dist/agent/components/composer-add-menu.d.ts.map +1 -0
- package/dist/agent/components/composer-commands.d.ts +37 -0
- package/dist/agent/components/composer-commands.d.ts.map +1 -0
- package/dist/agent/components/composer-menu.d.ts +18 -15
- package/dist/agent/components/composer-menu.d.ts.map +1 -1
- package/dist/agent/components/composer-settings.d.ts +34 -0
- package/dist/agent/components/composer-settings.d.ts.map +1 -0
- package/dist/agent/components/composer.d.ts +10 -3
- package/dist/agent/components/composer.d.ts.map +1 -1
- package/dist/agent/components/context-chips.d.ts +5 -0
- package/dist/agent/components/context-chips.d.ts.map +1 -1
- package/dist/agent/components/conversation-panel.d.ts +3 -1
- package/dist/agent/components/conversation-panel.d.ts.map +1 -1
- package/dist/agent/components/dictation-bar.d.ts +7 -3
- package/dist/agent/components/dictation-bar.d.ts.map +1 -1
- package/dist/agent/components/model-picker-row.d.ts +1 -3
- package/dist/agent/components/model-picker-row.d.ts.map +1 -1
- package/dist/agent/components/reasoning-effort-slider.d.ts.map +1 -1
- package/dist/agent/components/shared-thread-notice.d.ts +4 -2
- package/dist/agent/components/shared-thread-notice.d.ts.map +1 -1
- package/dist/agent/delegation/use-children.d.ts.map +1 -1
- package/dist/agent/hooks/use-agent-conversation.d.ts +2 -0
- package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
- package/dist/agent/hooks/use-thread-lists.d.ts +8 -0
- package/dist/agent/hooks/use-thread-lists.d.ts.map +1 -1
- package/dist/agent/i18n/en.d.ts +69 -8
- package/dist/agent/i18n/en.d.ts.map +1 -1
- package/dist/agent/i18n/fr.d.ts.map +1 -1
- package/dist/agent/i18n/index.d.ts +126 -12
- package/dist/agent/i18n/index.d.ts.map +1 -1
- package/dist/agent/model-selection.d.ts +1 -0
- package/dist/agent/model-selection.d.ts.map +1 -1
- package/dist/agent/run-sounds.d.ts +18 -0
- package/dist/agent/run-sounds.d.ts.map +1 -0
- package/dist/chunk-6n5pdqp0.js.map +1 -1
- package/dist/{chunk-12v6y89k.js → chunk-btky7c9w.js} +11678 -11190
- package/dist/{chunk-12v6y89k.js.map → chunk-btky7c9w.js.map} +59 -57
- package/dist/{chunk-bpj9mg5c.js → chunk-gq6xek89.js} +1 -1
- package/dist/{chunk-bpj9mg5c.js.map → chunk-gq6xek89.js.map} +1 -1
- package/dist/{chunk-hzy2g13h.js → chunk-hdbmj6f0.js} +1 -1
- package/dist/{chunk-hzy2g13h.js.map → chunk-hdbmj6f0.js.map} +1 -1
- package/dist/chunk-md3p7qdt.js.map +1 -1
- package/dist/{chunk-2a69ge8h.js → chunk-pkcm8rn8.js} +1 -1
- package/dist/{chunk-2a69ge8h.js.map → chunk-pkcm8rn8.js.map} +1 -1
- package/dist/chunk-yvhzn4ye.js.map +1 -1
- package/dist/codegen.d.ts.map +1 -1
- package/dist/createCustomApp.d.ts.map +1 -1
- package/dist/frame-origins.d.ts +10 -0
- package/dist/frame-origins.d.ts.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +3 -3
- package/dist/pages/settings/messages.d.ts +16 -0
- package/dist/pages/settings/messages.d.ts.map +1 -1
- package/dist/pages/settings/personal.d.ts +2 -2
- package/dist/pages/settings/personal.d.ts.map +1 -1
- package/dist/pages.js +49 -3
- package/dist/pages.js.map +4 -4
- package/dist/server.js +97 -22
- package/dist/server.js.map +6 -5
- package/package.json +3 -3
- package/src/agent/agent-chat.tsx +6 -1
- package/src/agent/agent.css +145 -14
- package/src/agent/bash/interpret.ts +41 -5
- package/src/agent/components/approval-mode-icons.ts +9 -0
- package/src/agent/components/composer-add-menu.tsx +126 -0
- package/src/agent/components/composer-commands.tsx +165 -0
- package/src/agent/components/composer-menu.tsx +33 -46
- package/src/agent/components/composer-settings.tsx +437 -0
- package/src/agent/components/composer.tsx +312 -153
- package/src/agent/components/context-chips.tsx +21 -8
- package/src/agent/components/conversation-panel.tsx +16 -9
- package/src/agent/components/dictation-bar.tsx +28 -23
- package/src/agent/components/model-picker-row.tsx +14 -24
- package/src/agent/components/reasoning-effort-slider.tsx +14 -10
- package/src/agent/components/shared-thread-notice.tsx +7 -2
- package/src/agent/components/transcript.tsx +2 -1
- package/src/agent/hooks/use-agent-conversation.ts +18 -6
- package/src/agent/i18n/en.ts +58 -15
- package/src/agent/i18n/fr.ts +77 -13
- package/src/agent/model-selection.ts +4 -0
- package/src/agent/publish-artifact/publish-artifact-tool-view.tsx +3 -2
- package/src/agent/run-sounds.ts +171 -0
- package/src/codegen.ts +44 -0
- package/src/createCustomApp.ts +53 -26
- package/src/frame-origins.ts +61 -0
- package/src/index.ts +5 -1
- package/src/pages/settings/messages.ts +8 -0
- package/src/pages/settings/personal.tsx +60 -3
- package/dist/agent/components/approval-mode-chip.d.ts +0 -15
- package/dist/agent/components/approval-mode-chip.d.ts.map +0 -1
- package/dist/agent/components/auto-model-chip.d.ts +0 -23
- package/dist/agent/components/auto-model-chip.d.ts.map +0 -1
- package/dist/agent/components/model-controls.d.ts +0 -41
- package/dist/agent/components/model-controls.d.ts.map +0 -1
- package/src/agent/components/approval-mode-chip.tsx +0 -120
- package/src/agent/components/auto-model-chip.tsx +0 -219
- package/src/agent/components/model-controls.tsx +0 -238
package/src/index.ts
CHANGED
|
@@ -39,13 +39,17 @@ export {
|
|
|
39
39
|
type AgentThreadsProps,
|
|
40
40
|
} from "./agent/components/agent-threads"
|
|
41
41
|
export { Composer, type ComposerProps } from "./agent/components/composer"
|
|
42
|
+
export type { ComposerCommand } from "./agent/components/composer-commands"
|
|
43
|
+
export {
|
|
44
|
+
ComposerSettings,
|
|
45
|
+
type ComposerSettingsProps,
|
|
46
|
+
} from "./agent/components/composer-settings"
|
|
42
47
|
export { ContextChips, type ContextChipsProps } from "./agent/components/context-chips"
|
|
43
48
|
export {
|
|
44
49
|
ContextPicker,
|
|
45
50
|
type ContextPickerProps,
|
|
46
51
|
type ContextPickerResult,
|
|
47
52
|
} from "./agent/components/context-picker"
|
|
48
|
-
export { ModelControls, type ModelControlsProps } from "./agent/components/model-controls"
|
|
49
53
|
export { ProviderLogo, type ProviderLogoProps } from "./agent/components/provider-logo"
|
|
50
54
|
export {
|
|
51
55
|
ReasoningEffortSlider,
|
|
@@ -78,6 +78,10 @@ export const en = {
|
|
|
78
78
|
signOut: "Sign out",
|
|
79
79
|
signingOut: "Signing out…",
|
|
80
80
|
signOutFailed: "Could not sign out.",
|
|
81
|
+
sounds: "Notification sound",
|
|
82
|
+
soundsDescription:
|
|
83
|
+
"When the agent finishes or needs your approval while you're elsewhere. Saved in this browser.",
|
|
84
|
+
soundChoices: { off: "Off", chime: "Chime", bell: "Bell", pop: "Pop" },
|
|
81
85
|
approvals: "When the agent changes things",
|
|
82
86
|
approvalsDescription:
|
|
83
87
|
"What the agent may do without asking you, in conversations where you haven't chosen a mode. Switch in any conversation from the chip under the message box.",
|
|
@@ -455,6 +459,10 @@ export const fr: Translation<SettingsMessages> = {
|
|
|
455
459
|
signOut: "Se déconnecter",
|
|
456
460
|
signingOut: "Déconnexion…",
|
|
457
461
|
signOutFailed: "Impossible de se déconnecter.",
|
|
462
|
+
sounds: "Son de notification",
|
|
463
|
+
soundsDescription:
|
|
464
|
+
"Quand l’agent a terminé ou attend votre approbation pendant que vous êtes ailleurs. Enregistré dans ce navigateur.",
|
|
465
|
+
soundChoices: { off: "Désactivé", chime: "Carillon", bell: "Cloche", pop: "Pop" },
|
|
458
466
|
approvals: "Quand l’agent modifie quelque chose",
|
|
459
467
|
approvalsDescription:
|
|
460
468
|
"Ce que l’agent peut faire sans vous demander, dans les conversations où vous n’avez pas choisi de mode. Changez-le dans n’importe quelle conversation depuis le bouton sous la zone de message.",
|
|
@@ -16,8 +16,15 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"
|
|
|
16
16
|
import { Loader2, LogOut, Pencil } from "lucide-react"
|
|
17
17
|
import { type SubmitEvent, useEffect, useMemo, useRef, useState } from "react"
|
|
18
18
|
import { AGENT_APPROVAL_MODES, type AgentApprovalMode } from "../../agent/approvals"
|
|
19
|
-
import { APPROVAL_MODE_ICONS } from "../../agent/components/approval-mode-
|
|
19
|
+
import { APPROVAL_MODE_ICONS } from "../../agent/components/approval-mode-icons"
|
|
20
20
|
import { useAgentMessages } from "../../agent/i18n"
|
|
21
|
+
import {
|
|
22
|
+
playRunSound,
|
|
23
|
+
RUN_SOUND_CHOICES,
|
|
24
|
+
type RunSoundChoice,
|
|
25
|
+
readRunSound,
|
|
26
|
+
writeRunSound,
|
|
27
|
+
} from "../../agent/run-sounds"
|
|
21
28
|
import { moveRadioFocus } from "../../agent/utils/radio-group"
|
|
22
29
|
import { useCurrentUser, useSignOut } from "../../session"
|
|
23
30
|
import { notify, SectionPage } from "../section-page"
|
|
@@ -27,8 +34,8 @@ import { useSettingsMessages } from "./messages"
|
|
|
27
34
|
import { SessionsSection } from "./sessions"
|
|
28
35
|
|
|
29
36
|
/**
|
|
30
|
-
* Settings › Personal: who you are in this project, your groups, how the app looks,
|
|
31
|
-
* may change without asking, and where you're signed in.
|
|
37
|
+
* Settings › Personal: who you are in this project, your groups, how the app looks, the sound the
|
|
38
|
+
* agent's turns end with, what it may change without asking, and where you're signed in.
|
|
32
39
|
*/
|
|
33
40
|
export function SettingsPersonalPage() {
|
|
34
41
|
const messages = useSettingsMessages().personal
|
|
@@ -149,6 +156,7 @@ export function SettingsPersonalPage() {
|
|
|
149
156
|
<ThemePicker labels className="self-start" />
|
|
150
157
|
</PageSection>
|
|
151
158
|
) : null}
|
|
159
|
+
<RunSoundSection />
|
|
152
160
|
<ApprovalModeSection />
|
|
153
161
|
<SessionsSection />
|
|
154
162
|
</SectionPage>
|
|
@@ -223,6 +231,55 @@ function NameForm({
|
|
|
223
231
|
)
|
|
224
232
|
}
|
|
225
233
|
|
|
234
|
+
/**
|
|
235
|
+
* The sound this browser plays when a turn you started ends while you're away from it, beside the
|
|
236
|
+
* themes it looks like. Choosing one plays it, the current one too. Shown only in a project with an
|
|
237
|
+
* agent.
|
|
238
|
+
*/
|
|
239
|
+
function RunSoundSection() {
|
|
240
|
+
const messages = useSettingsMessages().personal
|
|
241
|
+
const agent = useQuery({ ...getAgentOptions(), retry: false, staleTime: 5 * 60_000 })
|
|
242
|
+
const [current, setCurrent] = useState(readRunSound)
|
|
243
|
+
if (!agent.data) return null
|
|
244
|
+
|
|
245
|
+
const choose = (choice: RunSoundChoice) => {
|
|
246
|
+
setCurrent(choice)
|
|
247
|
+
writeRunSound(choice)
|
|
248
|
+
if (choice !== "off") playRunSound(choice, "done")
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return (
|
|
252
|
+
<PageSection title={messages.sounds} description={messages.soundsDescription}>
|
|
253
|
+
<div
|
|
254
|
+
role="radiogroup"
|
|
255
|
+
aria-label={messages.sounds}
|
|
256
|
+
onKeyDown={(event) => moveRadioFocus(event, { select: true })}
|
|
257
|
+
className="inline-flex items-center gap-0.5 self-start rounded-lg bg-muted/70 p-1 ring-1 ring-border/70"
|
|
258
|
+
>
|
|
259
|
+
{RUN_SOUND_CHOICES.map((choice) => {
|
|
260
|
+
const selected = choice === current
|
|
261
|
+
return (
|
|
262
|
+
<button
|
|
263
|
+
key={choice}
|
|
264
|
+
type="button"
|
|
265
|
+
role="radio"
|
|
266
|
+
aria-checked={selected}
|
|
267
|
+
tabIndex={selected ? 0 : -1}
|
|
268
|
+
onClick={() => choose(choice)}
|
|
269
|
+
className={cn(
|
|
270
|
+
"flex h-8 items-center justify-center rounded-md px-3 text-sm font-medium text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50",
|
|
271
|
+
selected && "bg-background text-foreground ring-1 ring-border"
|
|
272
|
+
)}
|
|
273
|
+
>
|
|
274
|
+
{messages.soundChoices[choice]}
|
|
275
|
+
</button>
|
|
276
|
+
)
|
|
277
|
+
})}
|
|
278
|
+
</div>
|
|
279
|
+
</PageSection>
|
|
280
|
+
)
|
|
281
|
+
}
|
|
282
|
+
|
|
226
283
|
/**
|
|
227
284
|
* Your approval mode where you choose none: new conversations, and those you never switched. Shown
|
|
228
285
|
* only in a project with an agent; a choice saves at once.
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type LucideIcon } from "lucide-react";
|
|
2
|
-
import { type AgentApprovalMode } from "../approvals";
|
|
3
|
-
export declare const APPROVAL_MODE_ICONS: Readonly<Record<AgentApprovalMode, LucideIcon>>;
|
|
4
|
-
export interface ApprovalModeChipProps {
|
|
5
|
-
readonly mode: AgentApprovalMode;
|
|
6
|
-
/** A choice the composer's owner keeps, here and for the reader's next conversations. */
|
|
7
|
-
readonly onChange: (mode: AgentApprovalMode) => void;
|
|
8
|
-
readonly disabled?: boolean;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* What the agent may change without asking: a quiet control in the composer's toolbar, beside
|
|
12
|
-
* `+`. It always names the mode, in muted text like the controls around it. A phone opens a sheet.
|
|
13
|
-
*/
|
|
14
|
-
export declare function ApprovalModeChip({ mode, onChange, disabled }: ApprovalModeChipProps): import("react").JSX.Element;
|
|
15
|
-
//# sourceMappingURL=approval-mode-chip.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"approval-mode-chip.d.ts","sourceRoot":"","sources":["../../../src/agent/components/approval-mode-chip.tsx"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,UAAU,EAAmB,MAAM,cAAc,CAAA;AAErE,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAW3E,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAI/E,CAAA;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAA;IAChC,yFAAyF;IACzF,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAA;IACpD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,qBAAqB,+BAsCnF"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type ModelReasoningLevel } from "@sixb/core/models";
|
|
2
|
-
import type { LanguageModel } from "../types";
|
|
3
|
-
export interface AutoModelChipProps {
|
|
4
|
-
readonly models: readonly LanguageModel[];
|
|
5
|
-
/** The model pinned in this conversation; without one, Auto. */
|
|
6
|
-
readonly selectedModel?: LanguageModel;
|
|
7
|
-
readonly selectedReasoning?: ModelReasoningLevel;
|
|
8
|
-
/** A decision model picks each message's model on Auto; without one, Auto runs `standard`. */
|
|
9
|
-
readonly routing?: boolean;
|
|
10
|
-
readonly disabled?: boolean;
|
|
11
|
-
readonly onSelectModel: (model: LanguageModel) => void;
|
|
12
|
-
readonly onSelectReasoning: (reasoning: ModelReasoningLevel) => void;
|
|
13
|
-
readonly onResetReasoning?: () => void;
|
|
14
|
-
/** Forget the conversation's pin, including one whose model left the catalog. */
|
|
15
|
-
readonly onChooseAuto: () => void;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* The model choice when `models.language` uses tiers, beside the send button: "Auto" until a
|
|
19
|
-
* model is pinned, then that model. The menu lists Auto, which is also the way back, then each
|
|
20
|
-
* tier's models; a pinned model's thinking shows under them.
|
|
21
|
-
*/
|
|
22
|
-
export declare function AutoModelChip({ models, selectedModel, selectedReasoning, routing, disabled, onSelectModel, onSelectReasoning, onResetReasoning, onChooseAuto, }: AutoModelChipProps): import("react").JSX.Element;
|
|
23
|
-
//# sourceMappingURL=auto-model-chip.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auto-model-chip.d.ts","sourceRoot":"","sources":["../../../src/agent/components/auto-model-chip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAMlF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAkB7C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAA;IACzC,gEAAgE;IAChE,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,CAAA;IACtC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,mBAAmB,CAAA;IAChD,8FAA8F;IAC9F,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IACtD,QAAQ,CAAC,iBAAiB,EAAE,CAAC,SAAS,EAAE,mBAAmB,KAAK,IAAI,CAAA;IACpE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAA;IACtC,iFAAiF;IACjF,QAAQ,CAAC,YAAY,EAAE,MAAM,IAAI,CAAA;CAClC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,OAAe,EACf,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,GACb,EAAE,kBAAkB,+BAqDpB"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { ModelReasoningLevel } from "@sixb/core/models";
|
|
2
|
-
import { type ReactNode } from "react";
|
|
3
|
-
import type { AgentMessages } from "../i18n/en";
|
|
4
|
-
import type { LanguageModel } from "../types";
|
|
5
|
-
export interface ModelControlsProps {
|
|
6
|
-
readonly models: readonly LanguageModel[];
|
|
7
|
-
readonly selectedModel?: LanguageModel;
|
|
8
|
-
readonly selectedReasoning?: ModelReasoningLevel;
|
|
9
|
-
readonly loading?: boolean;
|
|
10
|
-
readonly error?: boolean;
|
|
11
|
-
readonly disabled?: boolean;
|
|
12
|
-
readonly onSelectModel: (model: LanguageModel) => void;
|
|
13
|
-
readonly onSelectReasoning: (reasoning: ModelReasoningLevel) => void;
|
|
14
|
-
/** Return to the selected model's default reasoning. */
|
|
15
|
-
readonly onResetReasoning?: () => void;
|
|
16
|
-
/** The selection follows the project defaults: nothing was chosen explicitly. */
|
|
17
|
-
readonly usingDefault?: boolean;
|
|
18
|
-
/** Forget the explicit choice and follow the project defaults again; with tiers, Auto. */
|
|
19
|
-
readonly onResetToDefault?: () => void;
|
|
20
|
-
/** With tiers: a decision model picks each message's model on Auto. */
|
|
21
|
-
readonly routing?: boolean;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* The model picker. With tiers and `onResetToDefault`, an Auto chip: no `selectedModel` is Auto,
|
|
25
|
-
* and choosing a model pins it.
|
|
26
|
-
*/
|
|
27
|
-
export declare function ModelControls(props: ModelControlsProps): import("react").JSX.Element;
|
|
28
|
-
/**
|
|
29
|
-
* The composer's model control: the model's logo and name, its thinking level in muted text, and
|
|
30
|
-
* a chevron, as quiet text that fills only when hovered or open.
|
|
31
|
-
*/
|
|
32
|
-
export declare const ModelTrigger: import("react").ForwardRefExoticComponent<{
|
|
33
|
-
readonly icon: ReactNode;
|
|
34
|
-
readonly name: string;
|
|
35
|
-
readonly level?: string;
|
|
36
|
-
readonly open: boolean;
|
|
37
|
-
} & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
38
|
-
/** The trigger's level: an explicit one the model offers a choice of. */
|
|
39
|
-
export declare function reasoningLabel(model: LanguageModel | undefined, reasoning: ModelReasoningLevel | undefined, messages: AgentMessages["reasoning"]): string | undefined;
|
|
40
|
-
export declare function sameModel(left: LanguageModel, right: LanguageModel | undefined): boolean;
|
|
41
|
-
//# sourceMappingURL=model-controls.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model-controls.d.ts","sourceRoot":"","sources":["../../../src/agent/components/model-controls.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAG5D,OAAO,EAA6C,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAA;AAEpG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAY7C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAA;IACzC,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,CAAA;IACtC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,mBAAmB,CAAA;IAChD,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IACtD,QAAQ,CAAC,iBAAiB,EAAE,CAAC,SAAS,EAAE,mBAAmB,KAAK,IAAI,CAAA;IACpE,wDAAwD;IACxD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAA;IACtC,iFAAiF;IACjF,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;IAC/B,0FAA0F;IAC1F,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAA;IACtC,uEAAuE;IACvE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,+BAiBtD;AAgID;;;GAGG;AACH,eAAO,MAAM,YAAY;mBAGN,SAAS;mBACT,MAAM;qBACJ,MAAM;mBACR,OAAO;kLAiBxB,CAAA;AAEF,yEAAyE;AACzE,wBAAgB,cAAc,CAC5B,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,SAAS,EAAE,mBAAmB,GAAG,SAAS,EAC1C,QAAQ,EAAE,aAAa,CAAC,WAAW,CAAC,GACnC,MAAM,GAAG,SAAS,CAIpB;AAUD,wBAAgB,SAAS,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,GAAG,SAAS,GAAG,OAAO,CAExF"}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { cn } from "@sixb/ui/lib/utils"
|
|
2
|
-
import { Hand, type LucideIcon, PencilLine, Zap } from "lucide-react"
|
|
3
|
-
import { useId, useState } from "react"
|
|
4
|
-
import { AGENT_APPROVAL_MODES, type AgentApprovalMode } from "../approvals"
|
|
5
|
-
import { useAgentMessages } from "../i18n"
|
|
6
|
-
import { moveRadioFocus } from "../utils/radio-group"
|
|
7
|
-
import {
|
|
8
|
-
COMPOSER_MENU_ROW_CLASS_NAME,
|
|
9
|
-
COMPOSER_TRIGGER_CLASS_NAME,
|
|
10
|
-
ComposerMenu,
|
|
11
|
-
ComposerMenuCheck,
|
|
12
|
-
ComposerMenuRowText,
|
|
13
|
-
} from "./composer-menu"
|
|
14
|
-
|
|
15
|
-
export const APPROVAL_MODE_ICONS: Readonly<Record<AgentApprovalMode, LucideIcon>> = {
|
|
16
|
-
manual: Hand,
|
|
17
|
-
"accept-edits": PencilLine,
|
|
18
|
-
auto: Zap,
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface ApprovalModeChipProps {
|
|
22
|
-
readonly mode: AgentApprovalMode
|
|
23
|
-
/** A choice the composer's owner keeps, here and for the reader's next conversations. */
|
|
24
|
-
readonly onChange: (mode: AgentApprovalMode) => void
|
|
25
|
-
readonly disabled?: boolean
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* What the agent may change without asking: a quiet control in the composer's toolbar, beside
|
|
30
|
-
* `+`. It always names the mode, in muted text like the controls around it. A phone opens a sheet.
|
|
31
|
-
*/
|
|
32
|
-
export function ApprovalModeChip({ mode, onChange, disabled }: ApprovalModeChipProps) {
|
|
33
|
-
const messages = useAgentMessages().approvalModes
|
|
34
|
-
const [open, setOpen] = useState(false)
|
|
35
|
-
const Icon = APPROVAL_MODE_ICONS[mode]
|
|
36
|
-
const label = messages.modes[mode].label
|
|
37
|
-
|
|
38
|
-
const choose = (next: AgentApprovalMode) => {
|
|
39
|
-
setOpen(false)
|
|
40
|
-
if (next !== mode) onChange(next)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const trigger = (
|
|
44
|
-
<button
|
|
45
|
-
type="button"
|
|
46
|
-
disabled={disabled}
|
|
47
|
-
aria-label={messages.chip(label)}
|
|
48
|
-
aria-haspopup="dialog"
|
|
49
|
-
aria-expanded={open}
|
|
50
|
-
title={messages.shortcut}
|
|
51
|
-
data-approval-mode={mode}
|
|
52
|
-
className={cn(COMPOSER_TRIGGER_CLASS_NAME, "shrink-0")}
|
|
53
|
-
>
|
|
54
|
-
<Icon className="size-4 shrink-0" aria-hidden="true" />
|
|
55
|
-
<span className="truncate">{label}</span>
|
|
56
|
-
</button>
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<ComposerMenu
|
|
61
|
-
open={open}
|
|
62
|
-
onOpenChange={setOpen}
|
|
63
|
-
trigger={trigger}
|
|
64
|
-
title={messages.title}
|
|
65
|
-
align="start"
|
|
66
|
-
>
|
|
67
|
-
<ApprovalModeMenu mode={mode} onChoose={choose} />
|
|
68
|
-
</ComposerMenu>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function ApprovalModeMenu({
|
|
73
|
-
mode,
|
|
74
|
-
onChoose,
|
|
75
|
-
}: {
|
|
76
|
-
readonly mode: AgentApprovalMode
|
|
77
|
-
readonly onChoose: (mode: AgentApprovalMode) => void
|
|
78
|
-
}) {
|
|
79
|
-
const messages = useAgentMessages().approvalModes
|
|
80
|
-
const groupId = useId()
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<div className="p-1.5">
|
|
84
|
-
<div
|
|
85
|
-
role="radiogroup"
|
|
86
|
-
aria-label={messages.title}
|
|
87
|
-
onKeyDown={(event) => moveRadioFocus(event)}
|
|
88
|
-
>
|
|
89
|
-
{AGENT_APPROVAL_MODES.map((option) => {
|
|
90
|
-
const selected = option === mode
|
|
91
|
-
const descriptionId = `${groupId}-${option}`
|
|
92
|
-
const Icon = APPROVAL_MODE_ICONS[option]
|
|
93
|
-
return (
|
|
94
|
-
<button
|
|
95
|
-
key={option}
|
|
96
|
-
type="button"
|
|
97
|
-
role="radio"
|
|
98
|
-
aria-checked={selected}
|
|
99
|
-
tabIndex={selected ? 0 : -1}
|
|
100
|
-
aria-describedby={descriptionId}
|
|
101
|
-
onClick={() => onChoose(option)}
|
|
102
|
-
className={cn(COMPOSER_MENU_ROW_CLASS_NAME, "items-start")}
|
|
103
|
-
>
|
|
104
|
-
<Icon className="mt-0.5 size-4 shrink-0 text-muted-foreground" aria-hidden="true" />
|
|
105
|
-
<ComposerMenuRowText
|
|
106
|
-
title={messages.modes[option].label}
|
|
107
|
-
description={messages.modes[option].description}
|
|
108
|
-
descriptionId={descriptionId}
|
|
109
|
-
selected={selected}
|
|
110
|
-
/>
|
|
111
|
-
<span className="mt-0.5">
|
|
112
|
-
<ComposerMenuCheck checked={selected} />
|
|
113
|
-
</span>
|
|
114
|
-
</button>
|
|
115
|
-
)
|
|
116
|
-
})}
|
|
117
|
-
</div>
|
|
118
|
-
</div>
|
|
119
|
-
)
|
|
120
|
-
}
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import { LANGUAGE_MODEL_TIERS, type ModelReasoningLevel } from "@sixb/core/models"
|
|
2
|
-
import { cn } from "@sixb/ui/lib/utils"
|
|
3
|
-
import { Sparkles } from "lucide-react"
|
|
4
|
-
import { useId, useState } from "react"
|
|
5
|
-
import { useAgentMessages } from "../i18n"
|
|
6
|
-
import { defaultLanguageModel } from "../model-selection"
|
|
7
|
-
import type { LanguageModel } from "../types"
|
|
8
|
-
import { moveRadioFocus } from "../utils/radio-group"
|
|
9
|
-
import {
|
|
10
|
-
COMPOSER_MENU_ROW_CLASS_NAME,
|
|
11
|
-
COMPOSER_MENU_ROW_SELECTED_CLASS_NAME,
|
|
12
|
-
COMPOSER_MENU_SECTION_CLASS_NAME,
|
|
13
|
-
ComposerMenu,
|
|
14
|
-
ComposerMenuCheck,
|
|
15
|
-
ComposerMenuDivider,
|
|
16
|
-
ComposerMenuHeader,
|
|
17
|
-
ComposerMenuRowText,
|
|
18
|
-
ComposerMenuScroll,
|
|
19
|
-
} from "./composer-menu"
|
|
20
|
-
import { ModelTrigger, reasoningLabel, sameModel } from "./model-controls"
|
|
21
|
-
import { ModelPickerRow } from "./model-picker-row"
|
|
22
|
-
import { ProviderLogo } from "./provider-logo"
|
|
23
|
-
import { ReasoningEffortSlider } from "./reasoning-effort-slider"
|
|
24
|
-
|
|
25
|
-
export interface AutoModelChipProps {
|
|
26
|
-
readonly models: readonly LanguageModel[]
|
|
27
|
-
/** The model pinned in this conversation; without one, Auto. */
|
|
28
|
-
readonly selectedModel?: LanguageModel
|
|
29
|
-
readonly selectedReasoning?: ModelReasoningLevel
|
|
30
|
-
/** A decision model picks each message's model on Auto; without one, Auto runs `standard`. */
|
|
31
|
-
readonly routing?: boolean
|
|
32
|
-
readonly disabled?: boolean
|
|
33
|
-
readonly onSelectModel: (model: LanguageModel) => void
|
|
34
|
-
readonly onSelectReasoning: (reasoning: ModelReasoningLevel) => void
|
|
35
|
-
readonly onResetReasoning?: () => void
|
|
36
|
-
/** Forget the conversation's pin, including one whose model left the catalog. */
|
|
37
|
-
readonly onChooseAuto: () => void
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* The model choice when `models.language` uses tiers, beside the send button: "Auto" until a
|
|
42
|
-
* model is pinned, then that model. The menu lists Auto, which is also the way back, then each
|
|
43
|
-
* tier's models; a pinned model's thinking shows under them.
|
|
44
|
-
*/
|
|
45
|
-
export function AutoModelChip({
|
|
46
|
-
models,
|
|
47
|
-
selectedModel,
|
|
48
|
-
selectedReasoning,
|
|
49
|
-
routing = false,
|
|
50
|
-
disabled,
|
|
51
|
-
onSelectModel,
|
|
52
|
-
onSelectReasoning,
|
|
53
|
-
onResetReasoning,
|
|
54
|
-
onChooseAuto,
|
|
55
|
-
}: AutoModelChipProps) {
|
|
56
|
-
const agentMessages = useAgentMessages()
|
|
57
|
-
const messages = agentMessages.models
|
|
58
|
-
const [open, setOpen] = useState(false)
|
|
59
|
-
const name = selectedModel?.name ?? messages.auto
|
|
60
|
-
const level = reasoningLabel(selectedModel, selectedReasoning, agentMessages.reasoning)
|
|
61
|
-
const standard = defaultLanguageModel(models)
|
|
62
|
-
const autoDescription =
|
|
63
|
-
routing || !standard ? messages.autoRouting : messages.autoStandard(standard.name)
|
|
64
|
-
|
|
65
|
-
const chooseAuto = () => {
|
|
66
|
-
setOpen(false)
|
|
67
|
-
onChooseAuto()
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<ComposerMenu
|
|
72
|
-
open={open}
|
|
73
|
-
onOpenChange={setOpen}
|
|
74
|
-
title={messages.title}
|
|
75
|
-
align="end"
|
|
76
|
-
trigger={
|
|
77
|
-
<ModelTrigger
|
|
78
|
-
icon={
|
|
79
|
-
selectedModel ? (
|
|
80
|
-
<ProviderLogo model={selectedModel} className="size-4" />
|
|
81
|
-
) : (
|
|
82
|
-
<Sparkles className="size-4 shrink-0" aria-hidden="true" />
|
|
83
|
-
)
|
|
84
|
-
}
|
|
85
|
-
name={name}
|
|
86
|
-
level={level}
|
|
87
|
-
open={open}
|
|
88
|
-
disabled={disabled || models.length === 0}
|
|
89
|
-
aria-label={messages.chip(level ? `${name} ${level}` : name)}
|
|
90
|
-
aria-haspopup="dialog"
|
|
91
|
-
title={selectedModel ? name : autoDescription}
|
|
92
|
-
/>
|
|
93
|
-
}
|
|
94
|
-
>
|
|
95
|
-
<AutoModelMenu
|
|
96
|
-
models={models}
|
|
97
|
-
selectedModel={selectedModel}
|
|
98
|
-
selectedReasoning={selectedReasoning}
|
|
99
|
-
autoDescription={autoDescription}
|
|
100
|
-
disabled={disabled}
|
|
101
|
-
onChooseAuto={chooseAuto}
|
|
102
|
-
onSelectModel={onSelectModel}
|
|
103
|
-
onSelectReasoning={onSelectReasoning}
|
|
104
|
-
onResetReasoning={onResetReasoning}
|
|
105
|
-
/>
|
|
106
|
-
</ComposerMenu>
|
|
107
|
-
)
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function AutoModelMenu({
|
|
111
|
-
models,
|
|
112
|
-
selectedModel,
|
|
113
|
-
selectedReasoning,
|
|
114
|
-
autoDescription,
|
|
115
|
-
disabled,
|
|
116
|
-
onChooseAuto,
|
|
117
|
-
onSelectModel,
|
|
118
|
-
onSelectReasoning,
|
|
119
|
-
onResetReasoning,
|
|
120
|
-
}: Omit<AutoModelChipProps, "routing"> & { readonly autoDescription: string }) {
|
|
121
|
-
const agentMessages = useAgentMessages()
|
|
122
|
-
const messages = agentMessages.models
|
|
123
|
-
const groupId = useId()
|
|
124
|
-
const autoDescriptionId = `${groupId}-auto`
|
|
125
|
-
const auto = selectedModel === undefined
|
|
126
|
-
const tiers = LANGUAGE_MODEL_TIERS.map((tier) => ({
|
|
127
|
-
tier,
|
|
128
|
-
models: models.filter((model) => model.tier === tier),
|
|
129
|
-
})).filter((group) => group.models.length > 0)
|
|
130
|
-
const headed = tiers.some((group) => group.models.length > 1)
|
|
131
|
-
|
|
132
|
-
return (
|
|
133
|
-
<>
|
|
134
|
-
{/* Only radios belong to a radio group: each describes itself with its tier's label. */}
|
|
135
|
-
<ComposerMenuScroll
|
|
136
|
-
role="radiogroup"
|
|
137
|
-
aria-label={messages.title}
|
|
138
|
-
onKeyDown={(event) => moveRadioFocus(event)}
|
|
139
|
-
className="flex-1 overscroll-contain p-1.5"
|
|
140
|
-
>
|
|
141
|
-
<button
|
|
142
|
-
type="button"
|
|
143
|
-
role="radio"
|
|
144
|
-
aria-checked={auto}
|
|
145
|
-
tabIndex={auto ? 0 : -1}
|
|
146
|
-
aria-describedby={autoDescriptionId}
|
|
147
|
-
disabled={disabled}
|
|
148
|
-
onClick={onChooseAuto}
|
|
149
|
-
className={cn(
|
|
150
|
-
COMPOSER_MENU_ROW_CLASS_NAME,
|
|
151
|
-
"items-start",
|
|
152
|
-
auto && COMPOSER_MENU_ROW_SELECTED_CLASS_NAME
|
|
153
|
-
)}
|
|
154
|
-
>
|
|
155
|
-
<Sparkles className="mt-0.5 size-[18px] shrink-0 text-foreground" aria-hidden="true" />
|
|
156
|
-
<ComposerMenuRowText
|
|
157
|
-
title={messages.auto}
|
|
158
|
-
description={autoDescription}
|
|
159
|
-
descriptionId={autoDescriptionId}
|
|
160
|
-
selected={auto}
|
|
161
|
-
/>
|
|
162
|
-
<span className="mt-0.5">
|
|
163
|
-
<ComposerMenuCheck checked={auto} />
|
|
164
|
-
</span>
|
|
165
|
-
</button>
|
|
166
|
-
<ComposerMenuDivider />
|
|
167
|
-
{headed
|
|
168
|
-
? tiers.map((group) => (
|
|
169
|
-
<div key={group.tier}>
|
|
170
|
-
<div id={`${groupId}-${group.tier}`}>
|
|
171
|
-
<ComposerMenuHeader>
|
|
172
|
-
{agentMessages.delegation.tiers[group.tier]}
|
|
173
|
-
</ComposerMenuHeader>
|
|
174
|
-
</div>
|
|
175
|
-
{group.models.map((model) => (
|
|
176
|
-
<ModelPickerRow
|
|
177
|
-
key={`${model.provider}:${model.modelId}`}
|
|
178
|
-
model={model}
|
|
179
|
-
selected={sameModel(model, selectedModel)}
|
|
180
|
-
disabled={disabled}
|
|
181
|
-
radio
|
|
182
|
-
describedBy={`${groupId}-${group.tier}`}
|
|
183
|
-
onSelect={onSelectModel}
|
|
184
|
-
/>
|
|
185
|
-
))}
|
|
186
|
-
</div>
|
|
187
|
-
))
|
|
188
|
-
: // One model a tier: the tier reads after the name, not as a heading over each.
|
|
189
|
-
tiers.map((group) =>
|
|
190
|
-
group.models.map((model) => (
|
|
191
|
-
<ModelPickerRow
|
|
192
|
-
key={`${model.provider}:${model.modelId}`}
|
|
193
|
-
model={model}
|
|
194
|
-
selected={sameModel(model, selectedModel)}
|
|
195
|
-
disabled={disabled}
|
|
196
|
-
radio
|
|
197
|
-
tier={{
|
|
198
|
-
id: `${groupId}-${group.tier}`,
|
|
199
|
-
label: agentMessages.delegation.tiers[group.tier],
|
|
200
|
-
}}
|
|
201
|
-
onSelect={onSelectModel}
|
|
202
|
-
/>
|
|
203
|
-
))
|
|
204
|
-
)}
|
|
205
|
-
</ComposerMenuScroll>
|
|
206
|
-
{selectedModel && selectedReasoning ? (
|
|
207
|
-
<div className={COMPOSER_MENU_SECTION_CLASS_NAME}>
|
|
208
|
-
<ReasoningEffortSlider
|
|
209
|
-
model={selectedModel}
|
|
210
|
-
value={selectedReasoning}
|
|
211
|
-
disabled={disabled}
|
|
212
|
-
onChange={onSelectReasoning}
|
|
213
|
-
onReset={onResetReasoning}
|
|
214
|
-
/>
|
|
215
|
-
</div>
|
|
216
|
-
) : null}
|
|
217
|
-
</>
|
|
218
|
-
)
|
|
219
|
-
}
|