Terminal
Una conversazione con un agente come terminale: un log monospaziato in cui le tue righe risaltano, l'attività degli strumenti discreta, uno stato dal vivo che dice chi lavora e da quanto, e un prompt.
Angular: disponibile Vue: disponibile React: disponibile React Native: non ancora disponibile
Utilizzo
Exit code 1
✕ checkout › applies the discount once (2 of 20 runs)
expected 90, received 81
at discount.spec.ts:42:18Fixed: 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.tscovers the slow path.
20 of 20 runs pass. Shall I look at the cart tests next?
<sone-terminal style="height: 560px; width: 100%">
<sone-terminal-log>
<sone-terminal-divider [time]="at(0)">Run started · fix-flaky-tests</sone-terminal-divider>
<sone-terminal-line from="user" to="Lead" [time]="at(1)">
The checkout tests fail about once in ten runs. Find out why and fix it.
</sone-terminal-line>
<sone-terminal-line speaker="Lead" [hue]="3" [time]="at(2)">
On it. I'll rerun the suite to catch the failure first.
</sone-terminal-line>
<sone-terminal-line kind="activity" speaker="Lead" [hue]="3" glyph="$" tone="danger" [time]="at(3)">
Ran npm test -- checkout --repeat 20 --reporter=verbose --coverage=false --bail=false
<button soneBtn soneTerminalLineMeta type="button" variant="outline" size="icon-xs"
[attr.aria-expanded]="open()" [attr.aria-label]="open() ? 'Hide output' : 'Show output'"
(click)="open.set(!open())">{{ open() ? "−" : "+" }}</button>
@if (open()) {
<pre soneTerminalLineDetail tabindex="0">Exit code 1
✕ checkout › applies the discount once (2 of 20 runs)
expected 90, received 81
at discount.spec.ts:42:18</pre>
}
</sone-terminal-line>
<sone-terminal-line kind="activity" speaker="Explore" [hue]="5" [time]="at(4)">Read 2 files</sone-terminal-line>
<sone-terminal-line kind="activity" speaker="Lead" [hue]="3" [time]="at(5)">
Edited src/checkout/discount.ts
<span soneTerminalLineMeta><ins>+3</ins> <del>−1</del></span>
</sone-terminal-line>
<sone-terminal-line kind="activity" speaker="Lead" [hue]="3" glyph="$" [time]="at(6)">
Ran npm test -- checkout --repeat 20
<span soneTerminalLineMeta>ok · 41s</span>
</sone-terminal-line>
<sone-terminal-line speaker="Lead" [hue]="3" [time]="at(7)">
<p><strong>Fixed: the discount was applied twice.</strong></p>
<ul>
<li><code>applyDiscount()</code> ran in a promise nobody awaited, so a slow run applied it again.</li>
<li>It is awaited now, and <code>discount.spec.ts</code> covers the slow path.</li>
</ul>
<p>20 of 20 runs pass. Shall I look at the cart tests next?</p>
</sone-terminal-line>
<sone-terminal-divider tone="success" [time]="at(8)">Done · 6 turns · 1m 12s</sone-terminal-divider>
@for (e of sent(); track e.id) {
<sone-terminal-line [from]="e.from" [kind]="e.kind" [glyph]="e.glyph ?? null"
[speaker]="e.from === 'user' ? null : 'Lead'" [to]="e.from === 'user' ? 'Lead' : null"
[hue]="3" [time]="at(9 + e.id)">
{{ e.text }}
@if (e.meta) { <span soneTerminalLineMeta>{{ e.meta }}</span> }
</sone-terminal-line>
}
</sone-terminal-log>
<sone-terminal-status [state]="state()" speaker="Lead" [hue]="3" [since]="since()">
{{ doing() }}
@if (state() === "working") {
<button soneBtn soneTerminalStatusActions type="button" variant="ghost" size="icon-sm"
aria-label="Interrupt" (click)="finish('idle')"><sone-icon icon="square" /></button>
}
</sone-terminal-status>
<sone-terminal-prompt (submitted)="send()">
<textarea soneTerminalPromptInput placeholder="Message the lead…"
[value]="draft()" (input)="draft.set($any($event.target).value)"></textarea>
<button soneBtn soneTerminalPromptActions type="submit" size="icon-sm"
aria-label="Send" [disabled]="!draft().trim()"><sone-icon icon="arrow-up" /></button>
</sone-terminal-prompt>
</sone-terminal>Importazione
import {
SoneTerminalComponent,
SoneTerminalDividerComponent,
SoneTerminalLineComponent,
SoneTerminalLineDetailDirective,
SoneTerminalLineMetaDirective,
SoneTerminalLogComponent,
SoneTerminalPromptActionsDirective,
SoneTerminalPromptComponent,
SoneTerminalPromptInputDirective,
SoneTerminalStatusActionsDirective,
SoneTerminalStatusComponent,
} from "@surface-one/angular/terminal";Riferimento API
SoneTerminalComponentComponente
`<sone-terminal>` — the frame of an agent conversation shown as a terminal: a monospace log (`<sone-terminal-log>`), the agent's live status (`<sone-terminal-status>`) and the prompt (`<sone-terminal-prompt>`). `<sone-agent-chat>` takes the very same parts as a chat.
SoneTerminalDividerComponentComponente
`<sone-terminal-divider>` — a run boundary or a turn summary across the log.
| Nome | Tipo | Predefinito |
|---|---|---|
time | AgentTime | null | null |
tone | AgentTone | "default" |
SoneTerminalLineComponentComponente
`<sone-terminal-line>` — one entry: time, speaker (`You → Lead`), glyph and text. The person's lines stand out (a soft tinted block, the `❯` prompt in the accent); `kind="activity"` is a quiet, one-line record of tool work. `[soneTerminalLineMeta]` sits at the end of the line, `[soneTerminalLineDetail]` under it (an expanded body, a command's output).
| Nome | Tipo | Predefinito |
|---|---|---|
fromWho 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" |
speakerThe speaker's name; the person's defaults to “You”. | string | null | null |
toWho the person (or an agent) spoke to: “You → Lead”. | string | null | null |
timeWhen it was said: a `Date`, epoch milliseconds or an ISO string. | AgentTime | null | null |
tone`danger` for a failed command, `success` / `warning` for an outcome. | AgentTone | "default" |
glyphThe mark in front of the text; `❯` for the person, `›` for activity. `""` hides it. | string | null | null |
hueA speaker colour, `1`–`8` (the chart hues), so each agent keeps its own. | number | null | null |
noteA 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 | null | null |
SoneTerminalLineDetailDirectiveDirettiva
Content under a line: its expanded body or a command's output.
SoneTerminalLineMetaDirectiveDirettiva
Trailing content of a line: a metric, a badge, a “show more” toggle.
SoneTerminalLogComponentComponente
`<sone-terminal-log>` — the scrolling `role="log"`: follows the newest line, offers “Jump to newest”.
| Nome | Tipo | Predefinito |
|---|---|---|
labelThe log's accessible name. | string | null | null |
followStay pinned to the newest line while the reader is there. | boolean | true |
SoneTerminalPromptActionsDirectiveDirettiva
Buttons and selects at the end of the prompt (model, send).
SoneTerminalPromptComponentComponente
`<sone-terminal-prompt>` — the `❯` prompt around a `textarea[soneTerminalPromptInput]`.
| Nome | Tipo |
|---|---|
submittedFires when the person sends (Enter, or a submit button inside). | void |
SoneTerminalPromptInputDirectiveDirettiva
The prompt's field: Enter sends, Shift+Enter breaks the line.
| Nome | Tipo | Predefinito |
|---|---|---|
ariaLabelThe field's accessible name (it has no visible label). | string | null | $localize`:The prompt field of an agent conversation:Message` |
SoneTerminalStatusActionsDirectiveDirettiva
Actions at the end of the status line (Interrupt, Stop).
SoneTerminalStatusComponentComponente
`<sone-terminal-status>` — what the agent is doing right now: an animated mark, the sentence (“Lead is working”), the running time and a slot for actions (`[soneTerminalStatusActions]`, e.g. Interrupt). While the agent is busy the whole terminal shows a sweeping line.
| Nome | Tipo | Predefinito |
|---|---|---|
state | AgentState | "idle" |
speakerWho it is about: “Lead is working”. | string | null | null |
sinceWhen the current state began; a running time is shown while the agent is active. | AgentTime | null | null |
labelReplaces the built-in sentence. | string | null | null |
hueThe speaker colour, `1`–`8`. | number | null | null |