Agent Chat

La même conversation avec un agent sous forme de chat : vos messages dans des bulles d'accent, les agents sous leur avatar, l'activité des outils en retrait, un statut de travail en direct et une zone de saisie. S'échange avec Terminal pièce par pièce. Une question de l'agent avec des lignes de réponse et des touches numériques, et une ligne repliée « A réfléchi pendant N secondes ».

Disponible pour
  • Angular: disponible
  • Vue: disponible
  • React: disponible
  • React Native: pas encore disponible

Utilisation

Run started · fix-flaky-tests
Youto Lead
The checkout tests fail about once in ten runs. Find out why and fix it.
Lead
On it. I'll rerun the suite to catch the failure first.
Lead
Ran npm test -- checkout --repeat 20 --reporter=verbose --coverage=false --bail=false
Exit code 1
✕ checkout › applies the discount once (2 of 20 runs)
    expected 90, received 81
    at discount.spec.ts:42:18
Explore
Read 2 files
Lead
Edited src/checkout/discount.ts
+3−1
Lead
Ran npm test -- checkout --repeat 20
ok · 41s
Lead

Fixed: the discount was applied twice.

  • applyDiscount() ran in a promise nobody awaited, so a slow run applied it again.
  • It is awaited now, and discount.spec.ts covers the slow path.

20 of 20 runs pass.

Done · 6 turns · 1m 12s
LeadNeeds you

Fix the orders that already got the double discount, or ship the fix now?

The fix is right. Orders placed before today may already hold a second discount.

12to answer/commands⌘Kanywhere

Lead is waiting for you

Importation

ts
import {
  SoneAgentChatComponent,
  SoneAgentChatComposerActionsDirective,
  SoneAgentChatComposerComponent,
  SoneAgentChatComposerInputDirective,
  SoneAgentChatDividerComponent,
  SoneAgentChatLogComponent,
  SoneAgentChatMessageAvatarDirective,
  SoneAgentChatMessageComponent,
  SoneAgentChatMessageDetailDirective,
  SoneAgentChatMessageMetaDirective,
  SoneAgentChatQuestionComponent,
  SoneAgentChatStatusActionsDirective,
  SoneAgentChatStatusComponent,
  SoneAgentChatThoughtComponent,
} from "@surface-one/angular/agent-chat";

Référence de l’API

SoneAgentChatComponentComposant

`<sone-agent-chat>` — the frame of an agent conversation shown as a chat: the thread (`<sone-agent-chat-log>`), the agent's live status (`<sone-agent-chat-status>`) and the composer (`<sone-agent-chat-composer>`). Every part takes the same inputs as its `<sone-terminal>` twin, so an app switches between the two views without touching its data.

Sélecteur
sone-agent-chat

SoneAgentChatComposerActionsDirectiveDirective

Buttons and selects at the end of the composer (model, send).

Sélecteur
[soneAgentChatComposerActions]

SoneAgentChatComposerComponentComposant

`<sone-agent-chat-composer>` — the message box around a `textarea[soneAgentChatComposerInput]`.

Sélecteur
sone-agent-chat-composer
Outputs
NomType
submitted

Fires when the person sends (Enter, or a submit button inside).

void

SoneAgentChatComposerInputDirectiveDirective

The composer's field: Enter sends, Shift+Enter breaks the line.

Sélecteur
textarea[soneAgentChatComposerInput]
Inputs
NomType Par défaut
ariaLabel

The field's accessible name (it has no visible label).

string | null$localize`:The prompt field of an agent conversation:Message`

SoneAgentChatDividerComponentComposant

`<sone-agent-chat-divider>` — a run boundary or a turn summary across the thread.

Sélecteur
sone-agent-chat-divider
Inputs
NomType Par défaut
timeAgentTime | nullnull
toneAgentTone"default"

SoneAgentChatLogComponentComposant

`<sone-agent-chat-log>` — the scrolling `role="log"`: follows the newest message, offers “Jump to newest”.

Sélecteur
sone-agent-chat-log
Inputs
NomType Par défaut
label

The log's accessible name.

string | nullnull
follow

Stay pinned to the newest line while the reader is there.

booleantrue

SoneAgentChatMessageAvatarDirectiveDirective

What stands in a message's avatar instead of the speaker's initials, such as the mark of the app that spoke.

Sélecteur
[soneAgentChatMessageAvatar]

SoneAgentChatMessageComponentComposant

`<sone-agent-chat-message>` — one entry. The person's messages are accent bubbles on the right; an agent's sit on the left under its avatar, name and time; `kind="activity"` is a quiet line of tool work with no bubble. `[soneAgentChatMessageMeta]` sits at the end of the bubble, `[soneAgentChatMessageDetail]` under it (an expanded body, a command's output), and `[soneAgentChatMessageAvatar]` replaces the initials in the avatar.

Sélecteur
sone-agent-chat-message
Inputs
NomType Par défaut
from

Who wrote it: the person (`user`), an `agent`, or the `system`.

AgentFrom"agent"
kind

`message` is something said; `activity` is a quiet line of tool work.

AgentEntryKind"message"
speaker

The speaker's name; the person's defaults to “You”.

string | nullnull
to

Who the person (or an agent) spoke to: “You → Lead”.

string | nullnull
time

When it was said: a `Date`, epoch milliseconds or an ISO string.

AgentTime | nullnull
tone

`danger` for a failed command, `success` / `warning` for an outcome.

AgentTone"default"
glyph

The mark in front of the text; `❯` for the person, `›` for activity. `""` hides it.

string | nullnull
hue

A speaker colour, `1`–`8` (the chart hues), so each agent keeps its own.

number | nullnull
note

A quiet note about the entry, such as the model that wrote it: after the time in the chat, in front of the text in the terminal.

string | nullnull

SoneAgentChatMessageDetailDirectiveDirective

Content under a message: its expanded body or a command's output.

Sélecteur
[soneAgentChatMessageDetail]

SoneAgentChatMessageMetaDirectiveDirective

Trailing content of a message: a metric, a badge, a “show more” toggle.

Sélecteur
[soneAgentChatMessageMeta]

SoneAgentChatQuestionComponentComposant

`<sone-agent-chat-question>` — a question an agent asks in the thread and waits on: who asks (`who`, `hue`, `time`) with a “Needs you” badge, the `question` with its one-line `reason`, the `options` as rows that say what each leads to, and a field for your own words. Keys `1`…`9` pick an answer while the field is empty; Enter in the field sends what you wrote. `answer` emits the chosen option's label or your trimmed text.

Sélecteur
sone-agent-chat-question
Inputs
NomType Par défaut
who

Who asks: its name, shown with its initials.

string | nullnull
time

When it asked.

AgentTime | nullnull
question

The question itself.

string""
reason

Why it asks, in one line.

string | nullnull
options

The answers to pick from (keys `1`…`9`).

readonly AgentQuestionOption[][]
placeholder

The own-answer field's placeholder (“Or write your own answer…”).

string | nullnull
hue

A speaker colour, `1`–`8` (the chart hues), as on `<sone-agent-chat-message>`.

number | nullnull
hints

The key hints row under the field.

booleantrue
Outputs
NomType
answer

The answer: the picked option's label, or the trimmed text written in the field.

string

SoneAgentChatStatusActionsDirectiveDirective

Actions next to the status (Interrupt, Stop).

Sélecteur
[soneAgentChatStatusActions]

SoneAgentChatStatusComponentComposant

`<sone-agent-chat-status>` — what the agent is doing right now, under the thread: its avatar (ringed while busy), an animated mark, the sentence (“Lead is working”), the running time and a slot for actions (`[soneAgentChatStatusActions]`, e.g. Interrupt).

Sélecteur
sone-agent-chat-status
Inputs
NomType Par défaut
stateAgentState"idle"
speaker

Who it is about: “Lead is working”.

string | nullnull
since

When the current state began; a running time is shown while the agent is active.

AgentTime | nullnull
label

Replaces the built-in sentence.

string | nullnull
hue

The speaker colour, `1`–`8`.

number | nullnull

SoneAgentChatThoughtComponentComposant

`<sone-agent-chat-thought>` — an agent's reasoning, folded into a quiet row (“Thought for 12 seconds ›”) that opens a panel with a rule along its edge. Put it first in an agent's `<sone-agent-chat-message>`; the projected content is the reasoning. `open` is two-way.

Sélecteur
sone-agent-chat-thought
Inputs
NomType Par défaut
seconds

How long the agent thought, in whole seconds.

number0
openbidirectionnel

The reasoning panel shows (two-way: `[(open)]`).

booleanfalse