Agent Chat

La stessa conversazione con un agente come chat: i tuoi messaggi in fumetti d'accento, gli agenti sotto i loro avatar, l'attività degli strumenti discreta, uno stato di lavoro dal vivo e un campo di scrittura. Si scambia con Terminal parte per parte. Una domanda dell'agente con righe di risposta e tasti numerici, e una riga compressa «Ha pensato per N secondi».

Disponibile in
  • Angular: disponibile
  • Vue: disponibile
  • React: disponibile
  • React Native: non ancora disponibile

Utilizzo

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

Importazione

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

Riferimento API

SoneAgentChatComponentComponente

`<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.

Selettore
sone-agent-chat

SoneAgentChatComposerActionsDirectiveDirettiva

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

Selettore
[soneAgentChatComposerActions]

SoneAgentChatComposerComponentComponente

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

Selettore
sone-agent-chat-composer
Output
NomeTipo
submitted

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

void

SoneAgentChatComposerInputDirectiveDirettiva

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

Selettore
textarea[soneAgentChatComposerInput]
Input
NomeTipo Predefinito
ariaLabel

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

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

SoneAgentChatDividerComponentComponente

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

Selettore
sone-agent-chat-divider
Input
NomeTipo Predefinito
timeAgentTime | nullnull
toneAgentTone"default"

SoneAgentChatLogComponentComponente

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

Selettore
sone-agent-chat-log
Input
NomeTipo Predefinito
label

The log's accessible name.

string | nullnull
follow

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

booleantrue

SoneAgentChatMessageAvatarDirectiveDirettiva

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

Selettore
[soneAgentChatMessageAvatar]

SoneAgentChatMessageComponentComponente

`<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.

Selettore
sone-agent-chat-message
Input
NomeTipo Predefinito
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

SoneAgentChatMessageDetailDirectiveDirettiva

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

Selettore
[soneAgentChatMessageDetail]

SoneAgentChatMessageMetaDirectiveDirettiva

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

Selettore
[soneAgentChatMessageMeta]

SoneAgentChatQuestionComponentComponente

`<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.

Selettore
sone-agent-chat-question
Input
NomeTipo Predefinito
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
Output
NomeTipo
answer

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

string

SoneAgentChatStatusActionsDirectiveDirettiva

Actions next to the status (Interrupt, Stop).

Selettore
[soneAgentChatStatusActions]

SoneAgentChatStatusComponentComponente

`<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).

Selettore
sone-agent-chat-status
Input
NomeTipo Predefinito
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

SoneAgentChatThoughtComponentComponente

`<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.

Selettore
sone-agent-chat-thought
Input
NomeTipo Predefinito
seconds

How long the agent thought, in whole seconds.

number0
openbidirezionale

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

booleanfalse