@spexcode/transcript-ui 0.7.0-next.4 → 0.7.0-next.6
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/ToolLine.js +9 -5
- package/dist/TranscriptView.js +3 -1
- package/dist/context.d.ts +3 -0
- package/dist/context.js +3 -0
- package/package.json +2 -2
- package/styles.css +2 -0
package/dist/ToolLine.js
CHANGED
|
@@ -28,8 +28,9 @@ function WithheldOutput({ tool }) {
|
|
|
28
28
|
}
|
|
29
29
|
// One tool call as a SENTENCE, not a card: verb, target, and the size of what came back. It is
|
|
30
30
|
// `inline-flex` so a dozen of them read as a list of things that happened rather than a dozen boxes. There
|
|
31
|
-
// is no success mark
|
|
32
|
-
//
|
|
31
|
+
// is no success mark — the past-tense verb is the whole claim. A running call wears a small spinner and the
|
|
32
|
+
// word; a call whose harness recorded a structured failure wears `failed`, and one the person refused wears
|
|
33
|
+
// `rejected` — the outcome is the transcript's own field ([[transcript-reader]]), never read off the output prose.
|
|
33
34
|
export function ToolLine({ tool, open, onToggle, live = false }) {
|
|
34
35
|
const { labels, vocabulary } = useTranscriptUi();
|
|
35
36
|
const target = toolTarget(tool.input, vocabulary);
|
|
@@ -38,8 +39,9 @@ export function ToolLine({ tool, open, onToggle, live = false }) {
|
|
|
38
39
|
const withheld = tool.output === null;
|
|
39
40
|
const canOpen = !!tool.input || tool.output !== undefined || withheld;
|
|
40
41
|
const running = isRunning(tool, live);
|
|
41
|
-
const
|
|
42
|
-
|
|
42
|
+
const outcome = tool.outcome;
|
|
43
|
+
const row = (_jsxs(_Fragment, { children: [_jsx("span", { className: "tx-tool-verb", children: toolVerb(tool.name, vocabulary) }), lead && _jsx("span", { className: "tx-tool-target", children: lead }), trail && _jsx("span", { className: "tx-tool-trail", children: trail }), lines > 0 && _jsx("span", { className: "tx-tool-size", children: labels.lines(lines) }), running && _jsxs("span", { className: "tx-tool-running", children: [_jsx(Spinner, {}), labels.running] }), outcome && _jsx("span", { className: `tx-tool-outcome is-${outcome}`, children: outcome === 'failed' ? labels.failed : labels.rejected }), canOpen && _jsx(Caret, { open: open, className: "tx-tool-caret" })] }));
|
|
44
|
+
return (_jsxs("div", { className: `tx-tool${running ? ' is-running' : ''}${outcome ? ` is-${outcome}` : ''}`, children: [canOpen
|
|
43
45
|
? _jsx("button", { type: "button", onClick: onToggle, "aria-expanded": open, className: "tx-tool-row is-openable", children: row })
|
|
44
46
|
: _jsx("div", { className: "tx-tool-row", children: row }), open && canOpen && _jsxs(_Fragment, { children: [tool.input && _jsx("pre", { className: "tx-tool-in", children: tool.input }), withheld
|
|
45
47
|
? _jsx(WithheldOutput, { tool: tool })
|
|
@@ -58,5 +60,7 @@ export function ToolRun({ tools, openIds, onToggle, live = false, fold = true })
|
|
|
58
60
|
const id = `run:${tools[0].id}`;
|
|
59
61
|
const open = openIds.has(id);
|
|
60
62
|
const running = tools.some((tool) => isRunning(tool, live));
|
|
61
|
-
|
|
63
|
+
// a fold must not hide a failure: the row counts the calls that did not succeed
|
|
64
|
+
const failed = tools.filter((tool) => tool.outcome).length;
|
|
65
|
+
return _jsx("div", { className: "tx-tools", children: _jsxs("div", { className: `tx-tool${running ? ' is-running' : ''}${failed ? ' is-failed' : ''}`, children: [_jsxs("button", { type: "button", className: "tx-tool-row is-openable is-run", "aria-expanded": open, onClick: () => onToggle(id), children: [_jsx("span", { className: "tx-tool-verb", children: labels.toolUses(tools.length) }), _jsx("span", { className: "tx-tool-trail", children: runKinds(tools, vocabulary) }), failed > 0 && _jsx("span", { className: "tx-tool-outcome is-failed", children: labels.failedCount(failed) }), _jsx(Caret, { open: open, className: "tx-tool-caret" })] }), open && _jsx("div", { className: "tx-tool-kids", children: tools.map(line) })] }) });
|
|
62
66
|
}
|
package/dist/TranscriptView.js
CHANGED
|
@@ -17,9 +17,11 @@ export function WorkSegmentView({ segment, openIds, onToggle, live }) {
|
|
|
17
17
|
const open = openIds.has(id);
|
|
18
18
|
const kinds = runKinds(segment.work.flatMap((turn) => turn.tools ?? []), vocabulary);
|
|
19
19
|
const foldedCalls = segment.work.reduce((n, turn) => n + (turn.tools?.length || 0), 0);
|
|
20
|
+
// a fold must not hide a failure: the row counts the calls whose harness recorded one
|
|
21
|
+
const failedCalls = segment.work.reduce((n, turn) => n + (turn.tools?.filter((tool) => tool.outcome).length || 0), 0);
|
|
20
22
|
// history folds its runs; the work in progress (a live segment's calls after its newest prose) does not
|
|
21
23
|
const history = !segment.now || !!segment.answer;
|
|
22
|
-
return _jsxs(_Fragment, { children: [segment.folded ? (_jsxs("div", { className:
|
|
24
|
+
return _jsxs(_Fragment, { children: [segment.folded ? (_jsxs("div", { className: `tx-work${failedCalls ? ' is-failed' : ''}`, children: [_jsxs("button", { type: "button", className: "tx-work-row", "aria-expanded": open, onClick: () => onToggle(id), children: [_jsx("span", { className: "tx-work-lead", children: labels.toolUses(foldedCalls) }), kinds && _jsx("span", { className: "tx-work-detail", children: kinds }), failedCalls > 0 && _jsx("span", { className: "tx-tool-outcome is-failed", children: labels.failedCount(failedCalls) }), _jsx(Caret, { open: open, className: "tx-work-caret" })] }), open && _jsx("div", { className: "tx-work-body", children: segment.work.map((turn) => _jsx(TurnBody, { turn: turn, openIds: openIds, onToggle: onToggle, live: live }, turn.id)) })] })) : segment.work.map((turn) => _jsx(TurnBody, { turn: turn, openIds: openIds, onToggle: onToggle, live: live, fold: history }, turn.id)), segment.answer && _jsx(TurnBody, { turn: segment.answer, openIds: openIds, onToggle: onToggle, live: live, fold: !segment.now }), segment.after.map((turn) => _jsx(TurnBody, { turn: turn, openIds: openIds, onToggle: onToggle, live: live, fold: !segment.now }, turn.id))] });
|
|
23
25
|
}
|
|
24
26
|
export function SegmentView({ segment, ...rest }) {
|
|
25
27
|
if (segment.kind === 'quote')
|
package/dist/context.d.ts
CHANGED
|
@@ -11,6 +11,9 @@ export type ToolOutputResult = {
|
|
|
11
11
|
export type Labels = Readonly<{
|
|
12
12
|
loading: string;
|
|
13
13
|
running: string;
|
|
14
|
+
failed: string;
|
|
15
|
+
rejected: string;
|
|
16
|
+
failedCount: (n: number) => string;
|
|
14
17
|
more: string;
|
|
15
18
|
toolUses: (n: number) => string;
|
|
16
19
|
lines: (n: number) => string;
|
package/dist/context.js
CHANGED
|
@@ -4,6 +4,9 @@ import { defaultVocabulary } from './vocabulary.js';
|
|
|
4
4
|
export const defaultLabels = {
|
|
5
5
|
loading: 'loading…',
|
|
6
6
|
running: 'running',
|
|
7
|
+
failed: 'failed',
|
|
8
|
+
rejected: 'rejected',
|
|
9
|
+
failedCount: (n) => `${n} failed`,
|
|
7
10
|
more: 'more',
|
|
8
11
|
toolUses: (n) => `${n} tool use${n === 1 ? '' : 's'}`,
|
|
9
12
|
lines: (n) => `${n} line${n === 1 ? '' : 's'}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spexcode/transcript-ui",
|
|
3
|
-
"version": "0.7.0-next.
|
|
3
|
+
"version": "0.7.0-next.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React components that draw a normalized agent transcript — the person quoted, the agent as the page, a tool call as a sentence, the work folded behind its answer — with the fold, the prose renderer, the tool vocabulary, the labels and the design tokens all tunable.",
|
|
6
6
|
"files": [
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"test": "npm run build && tsx --test src/*.test.tsx"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@spexcode/transcript": "0.7.0-next.
|
|
27
|
+
"@spexcode/transcript": "0.7.0-next.6"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": "^18.2.0 || ^19.0.0"
|
package/styles.css
CHANGED
|
@@ -104,6 +104,8 @@
|
|
|
104
104
|
of words still being said. Reduced motion keeps the marks and drops the movement. */
|
|
105
105
|
.tx-tool.is-running .tx-tool-verb { color: var(--tx-ink2); }
|
|
106
106
|
.tx-tool-running { display: inline-flex; align-items: center; gap: 4px; flex: none; color: var(--tx-orange); font-size: var(--tx-type-caption); }
|
|
107
|
+
.tx-tool-outcome { flex: none; color: var(--tx-red); font-size: var(--tx-type-caption); }
|
|
108
|
+
.tx-tool.is-failed > .tx-tool-row .tx-tool-verb, .tx-tool.is-rejected > .tx-tool-row .tx-tool-verb { color: var(--tx-red); }
|
|
107
109
|
.tx-spin { animation: tx-spin 1s linear infinite; }
|
|
108
110
|
@keyframes tx-spin { to { transform: rotate(360deg); } }
|
|
109
111
|
.tx-live { margin-top: var(--tx-space-2); min-width: 0; }
|