Agent Chat

同じエージェントとの会話をチャットとして表示:自分のメッセージはアクセントの吹き出し、エージェントはアバターの下、控えめなツール操作、作業中を示すライブステータス、入力欄。Terminal とパーツ単位で入れ替えられます。回答の行と数字キーを備えたエージェントの質問、折りたたまれた「N 秒間思考」の行も含みます。

対応フレームワーク
  • Angular: 対応
  • Vue: 対応
  • React: 対応
  • React Native: 未対応

使い方

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

インポート

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

API リファレンス

SoneAgentChatComponentコンポーネント

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

セレクター
sone-agent-chat

SoneAgentChatComposerActionsDirectiveディレクティブ

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

セレクター
[soneAgentChatComposerActions]

SoneAgentChatComposerComponentコンポーネント

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

セレクター
sone-agent-chat-composer
出力
名前型
submitted

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

void

SoneAgentChatComposerInputDirectiveディレクティブ

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

セレクター
textarea[soneAgentChatComposerInput]
入力
名前型 デフォルト
ariaLabel

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

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

SoneAgentChatDividerComponentコンポーネント

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

セレクター
sone-agent-chat-divider
入力
名前型 デフォルト
timeAgentTime | nullnull
toneAgentTone"default"

SoneAgentChatLogComponentコンポーネント

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

セレクター
sone-agent-chat-log
入力
名前型 デフォルト
label

The log's accessible name.

string | nullnull
follow

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

booleantrue

SoneAgentChatMessageAvatarDirectiveディレクティブ

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

セレクター
[soneAgentChatMessageAvatar]

SoneAgentChatMessageComponentコンポーネント

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

セレクター
sone-agent-chat-message
入力
名前型 デフォルト
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

SoneAgentChatMessageDetailDirectiveディレクティブ

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

セレクター
[soneAgentChatMessageDetail]

SoneAgentChatMessageMetaDirectiveディレクティブ

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

セレクター
[soneAgentChatMessageMeta]

SoneAgentChatQuestionComponentコンポーネント

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

セレクター
sone-agent-chat-question
入力
名前型 デフォルト
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
出力
名前型
answer

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

string

SoneAgentChatStatusActionsDirectiveディレクティブ

Actions next to the status (Interrupt, Stop).

セレクター
[soneAgentChatStatusActions]

SoneAgentChatStatusComponentコンポーネント

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

セレクター
sone-agent-chat-status
入力
名前型 デフォルト
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

SoneAgentChatThoughtComponentコンポーネント

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

セレクター
sone-agent-chat-thought
入力
名前型 デフォルト
seconds

How long the agent thought, in whole seconds.

number0
open双方向

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

booleanfalse