@sixb/app 0.1.17 → 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/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/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.map +1 -1
- 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/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/agent/i18n/fr.ts
CHANGED
|
@@ -70,6 +70,24 @@ export const fr: Translation<AgentMessages> = {
|
|
|
70
70
|
dictationTranscribing: "Transcription…",
|
|
71
71
|
cancelDictation: "Annuler la dictée",
|
|
72
72
|
finishDictation: "Terminer",
|
|
73
|
+
add: "Ajouter des fichiers et plus",
|
|
74
|
+
mention: "Mentionner un enregistrement",
|
|
75
|
+
commands: "Commandes",
|
|
76
|
+
},
|
|
77
|
+
commands: {
|
|
78
|
+
list: "Commandes",
|
|
79
|
+
auto: "Laisser Auto choisir le modèle",
|
|
80
|
+
model: (name) => `Utiliser ${name}`,
|
|
81
|
+
modes: {
|
|
82
|
+
manual: "Demander avant chaque action",
|
|
83
|
+
"accept-edits": "Autoriser les modifications sans demander",
|
|
84
|
+
auto: "Tout lancer sans demander",
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
settings: {
|
|
88
|
+
title: "Modèle et autorisations",
|
|
89
|
+
chip: (summary) => `${summary}. Changer le modèle et les autorisations`,
|
|
90
|
+
permissions: "Autorisations",
|
|
73
91
|
},
|
|
74
92
|
files: {
|
|
75
93
|
spreadsheet: "Feuille de calcul",
|
|
@@ -100,15 +118,11 @@ export const fr: Translation<AgentMessages> = {
|
|
|
100
118
|
unnamed: "Contexte",
|
|
101
119
|
},
|
|
102
120
|
models: {
|
|
103
|
-
choose: "Choisir le modèle et l’effort de raisonnement",
|
|
104
121
|
unavailable: "Modèles indisponibles",
|
|
105
122
|
defaultModel: "Modèle par défaut",
|
|
106
|
-
popover: "Modèle et effort de raisonnement",
|
|
107
123
|
search: "Rechercher un modèle",
|
|
108
124
|
list: "Modèles",
|
|
109
125
|
empty: "Aucun modèle correspondant.",
|
|
110
|
-
default: "Par défaut",
|
|
111
|
-
defaultSummary: (summary) => `Par défaut · ${summary}`,
|
|
112
126
|
details: (name) => `Détails sur ${name}`,
|
|
113
127
|
contextWindow: "Fenêtre de contexte",
|
|
114
128
|
tokens: (tokens) => count(tokens, "jeton"),
|
|
@@ -120,9 +134,8 @@ export const fr: Translation<AgentMessages> = {
|
|
|
120
134
|
reasoning: "Raisonnement",
|
|
121
135
|
via: (name) => `Via ${name}`,
|
|
122
136
|
title: "Modèle",
|
|
123
|
-
chip: (name) => `Modèle : ${name}. Le changer`,
|
|
124
137
|
auto: "Auto",
|
|
125
|
-
autoRouting: "
|
|
138
|
+
autoRouting: "Le meilleur modèle pour chaque message",
|
|
126
139
|
autoStandard: (name) => `Sixb utilise ${name}`,
|
|
127
140
|
},
|
|
128
141
|
reasoning: {
|
|
@@ -573,6 +586,57 @@ export const fr: Translation<AgentMessages> = {
|
|
|
573
586
|
title: "Exécution de workflow vérifiée",
|
|
574
587
|
running: "Vérification d’une exécution de workflow",
|
|
575
588
|
},
|
|
589
|
+
listDatasets: {
|
|
590
|
+
title: "Jeux de données listés",
|
|
591
|
+
running: "Récupération des jeux de données",
|
|
592
|
+
},
|
|
593
|
+
inspectDataset: {
|
|
594
|
+
title: (dataset) =>
|
|
595
|
+
dataset ? `Jeu de données ${quoted(dataset)} examiné` : "Jeu de données examiné",
|
|
596
|
+
running: (dataset) =>
|
|
597
|
+
dataset ? `Examen du jeu de données ${quoted(dataset)}` : "Examen d’un jeu de données",
|
|
598
|
+
},
|
|
599
|
+
datasetVersions: {
|
|
600
|
+
title: (dataset) =>
|
|
601
|
+
dataset ? `Versions de ${quoted(dataset)} listées` : "Versions d’un jeu de données listées",
|
|
602
|
+
running: (dataset) =>
|
|
603
|
+
dataset
|
|
604
|
+
? `Récupération des versions de ${quoted(dataset)}`
|
|
605
|
+
: "Récupération des versions d’un jeu de données",
|
|
606
|
+
},
|
|
607
|
+
datasetRows: {
|
|
608
|
+
title: (dataset) =>
|
|
609
|
+
dataset ? `Lignes de ${quoted(dataset)} lues` : "Lignes d’un jeu de données lues",
|
|
610
|
+
running: (dataset) =>
|
|
611
|
+
dataset
|
|
612
|
+
? `Lecture des lignes de ${quoted(dataset)}`
|
|
613
|
+
: "Lecture des lignes d’un jeu de données",
|
|
614
|
+
},
|
|
615
|
+
listSyncs: { title: "Synchronisations listées", running: "Récupération des synchronisations" },
|
|
616
|
+
inspectSync: {
|
|
617
|
+
title: (sync) =>
|
|
618
|
+
sync ? `Synchronisation ${quoted(sync)} examinée` : "Synchronisation examinée",
|
|
619
|
+
running: (sync) =>
|
|
620
|
+
sync ? `Examen de la synchronisation ${quoted(sync)}` : "Examen d’une synchronisation",
|
|
621
|
+
},
|
|
622
|
+
listSyncRuns: {
|
|
623
|
+
title: "Exécutions de synchronisations listées",
|
|
624
|
+
running: "Récupération des exécutions de synchronisations",
|
|
625
|
+
},
|
|
626
|
+
listPipelines: { title: "Pipelines listés", running: "Récupération des pipelines" },
|
|
627
|
+
inspectPipeline: {
|
|
628
|
+
title: (pipeline) => (pipeline ? `Pipeline ${quoted(pipeline)} examiné` : "Pipeline examiné"),
|
|
629
|
+
running: (pipeline) =>
|
|
630
|
+
pipeline ? `Examen du pipeline ${quoted(pipeline)}` : "Examen d’un pipeline",
|
|
631
|
+
},
|
|
632
|
+
listPipelineRuns: {
|
|
633
|
+
title: "Exécutions de pipelines listées",
|
|
634
|
+
running: "Récupération des exécutions de pipelines",
|
|
635
|
+
},
|
|
636
|
+
pipelineRun: {
|
|
637
|
+
title: "Exécution de pipeline vérifiée",
|
|
638
|
+
running: "Vérification d’une exécution de pipeline",
|
|
639
|
+
},
|
|
576
640
|
upload: { title: "Fichier téléversé", running: "Téléversement d’un fichier" },
|
|
577
641
|
download: { title: "Fichier téléchargé", running: "Téléchargement d’un fichier" },
|
|
578
642
|
models: {
|
|
@@ -765,6 +829,7 @@ export const fr: Translation<AgentMessages> = {
|
|
|
765
829
|
cancel: "Annuler",
|
|
766
830
|
close: "Fermer",
|
|
767
831
|
sharedBy: (owner) => `Fil de ${owner}`,
|
|
832
|
+
onComputer: (owner) => `Tourne sur l’ordinateur de ${owner} : vous pouvez le suivre ici`,
|
|
768
833
|
answering: (name) => `L’agent répond à ${name}…`,
|
|
769
834
|
continueMine: "Continuer dans mon propre fil",
|
|
770
835
|
continuing: "Copie…",
|
|
@@ -782,22 +847,21 @@ export const fr: Translation<AgentMessages> = {
|
|
|
782
847
|
},
|
|
783
848
|
approvalModes: {
|
|
784
849
|
title: "Que peut faire l’agent sans demander ?",
|
|
785
|
-
chip: (mode) => `Autorisations : ${mode}. Les changer`,
|
|
786
850
|
changed: (mode) => `Autorisations : ${mode}`,
|
|
787
851
|
shortcut: "Maj+Tab dans un message vide passe au mode suivant",
|
|
788
852
|
modes: {
|
|
789
853
|
manual: {
|
|
790
|
-
label: "
|
|
791
|
-
description: "
|
|
854
|
+
label: "Demander d’abord",
|
|
855
|
+
description: "Vous demande avant chaque action ou workflow.",
|
|
792
856
|
},
|
|
793
857
|
"accept-edits": {
|
|
794
|
-
label: "Modifications
|
|
858
|
+
label: "Modifications permises",
|
|
795
859
|
description:
|
|
796
|
-
"Modifie vos données
|
|
860
|
+
"Modifie vos données de lui-même. Demande avant de contacter d’autres systèmes ou de lancer un workflow.",
|
|
797
861
|
},
|
|
798
862
|
auto: {
|
|
799
|
-
label: "
|
|
800
|
-
description: "Lance toutes les actions et tous les workflows sans demander",
|
|
863
|
+
label: "Accès complet",
|
|
864
|
+
description: "Lance toutes les actions et tous les workflows sans demander.",
|
|
801
865
|
},
|
|
802
866
|
},
|
|
803
867
|
saveFailed: "Impossible de changer ce que l’agent peut faire. Réessayez.",
|
|
@@ -101,3 +101,7 @@ export function preferenceWithoutReasoning(
|
|
|
101
101
|
const model = selection.request?.model
|
|
102
102
|
return model ? { model } : null
|
|
103
103
|
}
|
|
104
|
+
|
|
105
|
+
export function sameModel(left: LanguageModel, right: LanguageModel | undefined): boolean {
|
|
106
|
+
return left.provider === right?.provider && left.modelId === right.modelId
|
|
107
|
+
}
|
|
@@ -56,7 +56,8 @@ export function PublishArtifactToolView({ tool }: { tool: NormalizedTool }) {
|
|
|
56
56
|
)
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
/** The refusal the Agent received, without the
|
|
59
|
+
/** The refusal the Agent received, without the harness's prefix. */
|
|
60
60
|
function refusal(errorText: string): string {
|
|
61
|
-
|
|
61
|
+
// [SixbAgentWorker] on refusals recorded before the harness had a package of its own.
|
|
62
|
+
return errorText.replace(/^\[SixbAgent(?:Worker)?\] publish_artifact(_version)? refused: /, "")
|
|
62
63
|
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { createAgentRunSocket, type ReconnectingSocket } from "@sixb/client"
|
|
2
|
+
import { isActiveAgentRunStatus } from "./run-presentation"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A sound when a turn the reader started ends while they are away from it: in another tab or app,
|
|
6
|
+
* on another page, or in another conversation. Each run is followed on a socket of its own from the
|
|
7
|
+
* moment this tab starts it, so leaving the conversation does not stop the listening; a reload
|
|
8
|
+
* does.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const SOUND_KEY = "sixb:agent-sounds"
|
|
12
|
+
|
|
13
|
+
export const RUN_SOUND_CHOICES = ["off", "chime", "bell", "pop"] as const
|
|
14
|
+
export type RunSoundChoice = (typeof RUN_SOUND_CHOICES)[number]
|
|
15
|
+
export type RunSound = Exclude<RunSoundChoice, "off">
|
|
16
|
+
|
|
17
|
+
/** The sound this browser plays when a turn ends: chime unless the reader chose another. */
|
|
18
|
+
export function readRunSound(): RunSoundChoice {
|
|
19
|
+
try {
|
|
20
|
+
const value = globalThis.localStorage?.getItem(SOUND_KEY)
|
|
21
|
+
return RUN_SOUND_CHOICES.find((choice) => choice === value) ?? "chime"
|
|
22
|
+
} catch {
|
|
23
|
+
return "chime"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function writeRunSound(choice: RunSoundChoice) {
|
|
28
|
+
try {
|
|
29
|
+
globalThis.localStorage?.setItem(SOUND_KEY, choice)
|
|
30
|
+
} catch {
|
|
31
|
+
// Ignore storage errors.
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The turn is over, or one of its calls waits for the reader's decision. */
|
|
36
|
+
export type RunTone = "done" | "waiting"
|
|
37
|
+
|
|
38
|
+
/** One note: when it starts and how long it rings, in seconds, and its pitch in Hz. */
|
|
39
|
+
interface Note {
|
|
40
|
+
readonly frequency: number
|
|
41
|
+
readonly at: number
|
|
42
|
+
readonly length: number
|
|
43
|
+
readonly gain?: number
|
|
44
|
+
/** The pitch it slides to as it fades. */
|
|
45
|
+
readonly glideTo?: number
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const PEAK_GAIN = 0.12
|
|
49
|
+
|
|
50
|
+
const chime = (frequency: number, at: number): Note => ({ frequency, at, length: 0.35 })
|
|
51
|
+
|
|
52
|
+
// A struck bell: its note, and two quieter overtones that fade sooner.
|
|
53
|
+
const strike = (frequency: number, at: number): readonly Note[] => [
|
|
54
|
+
{ frequency, at, length: 1.4, gain: 0.1 },
|
|
55
|
+
{ frequency: frequency * 2, at, length: 0.7, gain: 0.035 },
|
|
56
|
+
{ frequency: frequency * 3, at, length: 0.4, gain: 0.015 },
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
const pop = (at: number): Note => ({ frequency: 600, at, length: 0.1, gain: 0.2, glideTo: 300 })
|
|
60
|
+
|
|
61
|
+
// Each sound says the two apart the same way: waiting repeats itself.
|
|
62
|
+
const SOUNDS: Record<RunSound, Record<RunTone, readonly Note[]>> = {
|
|
63
|
+
chime: {
|
|
64
|
+
done: [chime(659.25, 0), chime(987.77, 0.12)],
|
|
65
|
+
waiting: [chime(880, 0), chime(880, 0.12)],
|
|
66
|
+
},
|
|
67
|
+
bell: {
|
|
68
|
+
done: strike(1046.5, 0),
|
|
69
|
+
waiting: [...strike(783.99, 0), ...strike(783.99, 0.28)],
|
|
70
|
+
},
|
|
71
|
+
pop: {
|
|
72
|
+
done: [pop(0)],
|
|
73
|
+
waiting: [pop(0), pop(0.13)],
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let audio: AudioContext | null = null
|
|
78
|
+
|
|
79
|
+
// A browser lets a page start audio only once the reader has interacted with it, so the context is
|
|
80
|
+
// made as the reader starts a turn, and kept.
|
|
81
|
+
function audioContext(): AudioContext | null {
|
|
82
|
+
if (typeof AudioContext === "undefined") return null
|
|
83
|
+
audio ??= new AudioContext()
|
|
84
|
+
// A page the browser does not let play stays silent.
|
|
85
|
+
if (audio.state === "suspended") audio.resume().catch(() => {})
|
|
86
|
+
return audio
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function playRunSound(sound: RunSound, tone: RunTone) {
|
|
90
|
+
const context = audioContext()
|
|
91
|
+
if (!context) return
|
|
92
|
+
|
|
93
|
+
const start = context.currentTime + 0.02
|
|
94
|
+
for (const note of SOUNDS[sound][tone]) {
|
|
95
|
+
const at = start + note.at
|
|
96
|
+
const end = at + note.length
|
|
97
|
+
const oscillator = context.createOscillator()
|
|
98
|
+
const gain = context.createGain()
|
|
99
|
+
oscillator.frequency.setValueAtTime(note.frequency, at)
|
|
100
|
+
if (note.glideTo) oscillator.frequency.exponentialRampToValueAtTime(note.glideTo, end)
|
|
101
|
+
gain.gain.setValueAtTime(0, at)
|
|
102
|
+
gain.gain.linearRampToValueAtTime(note.gain ?? PEAK_GAIN, at + 0.01)
|
|
103
|
+
gain.gain.exponentialRampToValueAtTime(0.0001, end)
|
|
104
|
+
oscillator.connect(gain).connect(context.destination)
|
|
105
|
+
oscillator.start(at)
|
|
106
|
+
oscillator.stop(end)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const followed = new Map<string, ReconnectingSocket>()
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Follow a run this tab just started until it ends, and play its tone unless the reader watched it
|
|
114
|
+
* end. Call it where the turn starts, close to the reader's click or key.
|
|
115
|
+
*/
|
|
116
|
+
export function watchRun(run: { readonly id: string; readonly threadId: string }) {
|
|
117
|
+
if (typeof window === "undefined" || followed.has(run.id) || readRunSound() === "off") return
|
|
118
|
+
audioContext()
|
|
119
|
+
|
|
120
|
+
// Closing the socket drops what it still receives, so a run ends once.
|
|
121
|
+
const end = (ended: { readonly status: string; readonly finishReason?: string }) => {
|
|
122
|
+
followed.get(run.id)?.close()
|
|
123
|
+
followed.delete(run.id)
|
|
124
|
+
|
|
125
|
+
// The sound chosen now, though the reader may have changed it while the turn ran.
|
|
126
|
+
const sound = readRunSound()
|
|
127
|
+
const tone = runTone(ended)
|
|
128
|
+
if (tone && sound !== "off" && !watching(run.threadId)) playRunSound(sound, tone)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
followed.set(
|
|
132
|
+
run.id,
|
|
133
|
+
createAgentRunSocket({
|
|
134
|
+
runId: run.id,
|
|
135
|
+
onEvent: (event) => {
|
|
136
|
+
if (event.type === "agent.run.finished") end(event)
|
|
137
|
+
},
|
|
138
|
+
// A run that ended before the socket subscribed shows it in its snapshot.
|
|
139
|
+
onRunSnapshot: (snapshot) => {
|
|
140
|
+
if (!isActiveAgentRunStatus(snapshot.status)) end(snapshot)
|
|
141
|
+
},
|
|
142
|
+
})
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// A stopped turn makes no sound: whoever stopped it knows. A failed one is over all the same.
|
|
147
|
+
function runTone(ended: {
|
|
148
|
+
readonly status: string
|
|
149
|
+
readonly finishReason?: string
|
|
150
|
+
}): RunTone | null {
|
|
151
|
+
if (ended.status === "cancelled") return null
|
|
152
|
+
return ended.status === "succeeded" && ended.finishReason === "awaiting_approval"
|
|
153
|
+
? "waiting"
|
|
154
|
+
: "done"
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Whether the reader sees the conversation now: this tab in front and focused, and a transcript of
|
|
159
|
+
* it on screen. Its middle is hit-tested, so a collapsed panel, an inert one or one covered by
|
|
160
|
+
* another view does not count.
|
|
161
|
+
*/
|
|
162
|
+
function watching(threadId: string): boolean {
|
|
163
|
+
if (document.visibilityState !== "visible" || !document.hasFocus()) return false
|
|
164
|
+
for (const element of document.querySelectorAll<HTMLElement>("[data-agent-thread]")) {
|
|
165
|
+
if (element.dataset.agentThread !== threadId) continue
|
|
166
|
+
const rect = element.getBoundingClientRect()
|
|
167
|
+
const hit = document.elementFromPoint(rect.left + rect.width / 2, rect.top + rect.height / 2)
|
|
168
|
+
if (hit && element.contains(hit)) return true
|
|
169
|
+
}
|
|
170
|
+
return false
|
|
171
|
+
}
|
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"}
|