@shipfox/client-logs 0.2.0
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/.storybook/main.ts +1 -0
- package/.storybook/preview.css +9 -0
- package/.storybook/preview.tsx +56 -0
- package/.swcrc +42 -0
- package/.turbo/turbo-build.log +2 -0
- package/.turbo/turbo-type$colon$emit.log +1 -0
- package/.turbo/turbo-type.log +1 -0
- package/CHANGELOG.md +93 -0
- package/LICENSE +21 -0
- package/dist/components/agent-session-rows.d.ts +8 -0
- package/dist/components/agent-session-rows.d.ts.map +1 -0
- package/dist/components/agent-session-rows.js +374 -0
- package/dist/components/agent-session-rows.js.map +1 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +6 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/log-group.d.ts +11 -0
- package/dist/components/log-group.d.ts.map +1 -0
- package/dist/components/log-group.js +57 -0
- package/dist/components/log-group.js.map +1 -0
- package/dist/components/log-view.d.ts +20 -0
- package/dist/components/log-view.d.ts.map +1 -0
- package/dist/components/log-view.js +243 -0
- package/dist/components/log-view.js.map +1 -0
- package/dist/components/output-log-row.d.ts +9 -0
- package/dist/components/output-log-row.d.ts.map +1 -0
- package/dist/components/output-log-row.js +24 -0
- package/dist/components/output-log-row.js.map +1 -0
- package/dist/components/system-markers.d.ts +21 -0
- package/dist/components/system-markers.d.ts.map +1 -0
- package/dist/components/system-markers.js +113 -0
- package/dist/components/system-markers.js.map +1 -0
- package/dist/core/log-read.d.ts +33 -0
- package/dist/core/log-read.d.ts.map +1 -0
- package/dist/core/log-read.js +49 -0
- package/dist/core/log-read.js.map +1 -0
- package/dist/core/log-tree.d.ts +85 -0
- package/dist/core/log-tree.d.ts.map +1 -0
- package/dist/core/log-tree.js +139 -0
- package/dist/core/log-tree.js.map +1 -0
- package/dist/env.d.js +2 -0
- package/dist/env.d.js.map +1 -0
- package/dist/hooks/api/step-logs.d.ts +24 -0
- package/dist/hooks/api/step-logs.d.ts.map +1 -0
- package/dist/hooks/api/step-logs.js +129 -0
- package/dist/hooks/api/step-logs.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -0
- package/package.json +84 -0
- package/src/components/agent-session-rows.tsx +341 -0
- package/src/components/index.ts +15 -0
- package/src/components/log-group.stories.tsx +204 -0
- package/src/components/log-group.tsx +54 -0
- package/src/components/log-view.stories.tsx +584 -0
- package/src/components/log-view.test.tsx +266 -0
- package/src/components/log-view.tsx +281 -0
- package/src/components/output-log-row.stories.tsx +76 -0
- package/src/components/output-log-row.tsx +35 -0
- package/src/components/system-markers.stories.tsx +46 -0
- package/src/components/system-markers.tsx +148 -0
- package/src/core/log-read.test.ts +219 -0
- package/src/core/log-read.ts +79 -0
- package/src/core/log-tree.test.ts +380 -0
- package/src/core/log-tree.ts +200 -0
- package/src/env.d.ts +7 -0
- package/src/hooks/api/step-logs-query.test.tsx +283 -0
- package/src/hooks/api/step-logs.test.ts +66 -0
- package/src/hooks/api/step-logs.ts +166 -0
- package/src/index.ts +18 -0
- package/test/setup.ts +3 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/tsconfig.test.json +8 -0
- package/vercel.json +8 -0
- package/vitest.config.ts +70 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default} from '../../.storybook/main.ts';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
@import "@shipfox/react-ui/index.css";
|
|
2
|
+
|
|
3
|
+
/* The `@import` pulls in the full design-system theme (tokens, preflight, base layer)
|
|
4
|
+
from react-ui. Tailwind v4 only emits utilities for classes it finds in scanned
|
|
5
|
+
source, and these stories render react-ui components whose classes live in react-ui's
|
|
6
|
+
own source. Scanning both trees keeps those components styled, the same way
|
|
7
|
+
apps/client/src/styles.css scans every package it renders. */
|
|
8
|
+
@source "../src";
|
|
9
|
+
@source "../../../shared/react/ui/src";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import './preview.css';
|
|
2
|
+
import {ThemeProvider} from '@shipfox/react-ui/theme';
|
|
3
|
+
import type {Decorator, Preview} from '@storybook/react';
|
|
4
|
+
|
|
5
|
+
if (typeof document !== 'undefined' && document.fonts) {
|
|
6
|
+
void Promise.all([
|
|
7
|
+
document.fonts.load("16px 'Inter'"),
|
|
8
|
+
document.fonts.load("italic 16px 'Inter'"),
|
|
9
|
+
document.fonts.load("16px 'Commit Mono'"),
|
|
10
|
+
document.fonts.load("bold 16px 'Commit Mono'"),
|
|
11
|
+
]);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const withTheme: Decorator = (Story, context) => {
|
|
15
|
+
const theme = context.globals.theme;
|
|
16
|
+
return (
|
|
17
|
+
<ThemeProvider key={theme} defaultTheme={theme} storageKey={`shipfox-theme-${theme}`}>
|
|
18
|
+
<Story />
|
|
19
|
+
</ThemeProvider>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const preview: Preview = {
|
|
24
|
+
decorators: [withTheme],
|
|
25
|
+
parameters: {
|
|
26
|
+
argos: {
|
|
27
|
+
// Dual-theme coverage lives in @shipfox/react-ui (the theming source of truth);
|
|
28
|
+
// feature packages capture only the primary dark theme to limit Argos spend.
|
|
29
|
+
modes: {
|
|
30
|
+
dark: {theme: 'dark'},
|
|
31
|
+
},
|
|
32
|
+
fitToContent: false,
|
|
33
|
+
},
|
|
34
|
+
options: {
|
|
35
|
+
storySort: {method: 'alphabetical'},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
globalTypes: {
|
|
39
|
+
theme: {
|
|
40
|
+
name: 'Theme',
|
|
41
|
+
description: 'Global theme for components',
|
|
42
|
+
defaultValue: 'dark',
|
|
43
|
+
toolbar: {
|
|
44
|
+
icon: 'sun',
|
|
45
|
+
items: [
|
|
46
|
+
{value: 'light', icon: 'sun', title: 'Light'},
|
|
47
|
+
{value: 'dark', icon: 'moon', title: 'Dark'},
|
|
48
|
+
{value: 'system', icon: 'info', title: 'System'},
|
|
49
|
+
],
|
|
50
|
+
showName: true,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default preview;
|
package/.swcrc
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"jsc": {
|
|
3
|
+
"target": "es2023",
|
|
4
|
+
"parser": {
|
|
5
|
+
"syntax": "typescript",
|
|
6
|
+
"decorators": true,
|
|
7
|
+
"dynamicImport": true,
|
|
8
|
+
"tsx": true
|
|
9
|
+
},
|
|
10
|
+
"transform": {
|
|
11
|
+
"decoratorMetadata": true,
|
|
12
|
+
"legacyDecorator": true,
|
|
13
|
+
"react": {
|
|
14
|
+
"runtime": "automatic"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"keepClassNames": true,
|
|
18
|
+
"externalHelpers": true,
|
|
19
|
+
"loose": true,
|
|
20
|
+
"experimental": {
|
|
21
|
+
"keepImportAttributes": true
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"module": {
|
|
25
|
+
"type": "es6",
|
|
26
|
+
"strict": true,
|
|
27
|
+
"strictMode": true,
|
|
28
|
+
"noInterop": true,
|
|
29
|
+
"resolveFully": true
|
|
30
|
+
},
|
|
31
|
+
"sourceMaps": true,
|
|
32
|
+
"minify": false,
|
|
33
|
+
"exclude": [
|
|
34
|
+
"node_modules",
|
|
35
|
+
"jest.config.ts",
|
|
36
|
+
"^.*\\.spec\\.tsx?$",
|
|
37
|
+
"^.*\\.test\\.tsx?$",
|
|
38
|
+
"^.*\\.stories\\.tsx?$",
|
|
39
|
+
".*/jest-setup\\.ts$",
|
|
40
|
+
"^.*\\.js$"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$ shipfox-tsc-emit
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$ shipfox-tsc-check
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# @shipfox/client-logs
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3d064b8: Publishes the client runtime closure with shell, feature, route, Vite, and testing contracts.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [3d064b8]
|
|
12
|
+
- @shipfox/client-api@0.2.0
|
|
13
|
+
|
|
14
|
+
## 0.1.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [c18d624]
|
|
19
|
+
- @shipfox/react-ui@0.3.1
|
|
20
|
+
|
|
21
|
+
## 0.1.1
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [1b0d344]
|
|
26
|
+
- @shipfox/api-logs-dto@2.0.0
|
|
27
|
+
- @shipfox/client-api@0.0.1
|
|
28
|
+
- @shipfox/react-ui@0.3.0
|
|
29
|
+
|
|
30
|
+
## 0.1.0
|
|
31
|
+
|
|
32
|
+
### Minor Changes
|
|
33
|
+
|
|
34
|
+
- b83d31a: Renders agent session log records inline with process output so agent steps show prompts, assistant messages, thinking, tool activity, and failure anchors.
|
|
35
|
+
- f104ff2: Add `@shipfox/client-logs`: the record components for the step-log read stream, composing the `@shipfox/react-ui` log primitives. This covers every process and system record (`output`, `group_start`/`group_end`, `end`, `gap`, `capped`, `runner_lost`); `agent_session` is rendered by the agent-sessions surface.
|
|
36
|
+
- `buildLogTree(records)` is a pure transform that reconstructs the group tree from the flat record list. `group_end` closes the matching `group_id` (so a `group_start` dropped under gap/backlog pressure does not mis-nest), record dispatch is an exhaustive switch, and each group node carries a precomputed `hasError` (a `runner_lost` in its subtree, a genuine failure; `stderr` is a channel, not an error) and subtree line count.
|
|
37
|
+
- `OutputLogRow` renders stdout/stderr (stderr gets a subtle left channel rule, not a background tint), `LogGroup` is a collapsible disclosure with running/duration/incomplete affordances and an inset error bar, the system markers render as timeline rows, and `LogView` is the top-level dispatcher with an empty state. Reviewed in a package-local Storybook captured by Argos (`client-logs`).
|
|
38
|
+
- `@shipfox/api-logs-dto` now measures UTF-8 byte length with `TextEncoder` instead of `node:buffer`, so this shared record contract is browser-safe for the client log viewer. Behavior is identical.
|
|
39
|
+
- `@shipfox/react-ui` gains two shared formatters in `utils`: `formatBytes` (new) and `formatDuration` (an ms-span, sub-second sibling to the existing `humanDuration`), so `client-logs` and future packages share one implementation instead of re-rolling them.
|
|
40
|
+
|
|
41
|
+
- 0c6373a: Adds a React Query data layer for step logs that maps inline and presigned reads into one polling snapshot.
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- dc3e434: Show logs inline under the active or selected workflow step attempt, including missing-stream retry for running attempts and stale-log retry states.
|
|
46
|
+
- Updated dependencies [43d7996]
|
|
47
|
+
- Updated dependencies [14e0bea]
|
|
48
|
+
- Updated dependencies [a56748d]
|
|
49
|
+
- Updated dependencies [9018f0b]
|
|
50
|
+
- Updated dependencies [7fdfd72]
|
|
51
|
+
- Updated dependencies [2a3193f]
|
|
52
|
+
- Updated dependencies [f104ff2]
|
|
53
|
+
- Updated dependencies [7341569]
|
|
54
|
+
- Updated dependencies [68e4022]
|
|
55
|
+
- Updated dependencies [f92122b]
|
|
56
|
+
- Updated dependencies [4207772]
|
|
57
|
+
- Updated dependencies [d49ee4c]
|
|
58
|
+
- Updated dependencies [e4c6abf]
|
|
59
|
+
- Updated dependencies [2883ab4]
|
|
60
|
+
- Updated dependencies [5d0676a]
|
|
61
|
+
- Updated dependencies [a35c2dc]
|
|
62
|
+
- Updated dependencies [58f7aef]
|
|
63
|
+
- Updated dependencies [5264a22]
|
|
64
|
+
- Updated dependencies [9674879]
|
|
65
|
+
- Updated dependencies [225c9a5]
|
|
66
|
+
- Updated dependencies [bf8319f]
|
|
67
|
+
- Updated dependencies [24f131b]
|
|
68
|
+
- Updated dependencies [bb2a7bc]
|
|
69
|
+
- Updated dependencies [5eb06d0]
|
|
70
|
+
- Updated dependencies [4e13e5f]
|
|
71
|
+
- Updated dependencies [e92150d]
|
|
72
|
+
- Updated dependencies [8037501]
|
|
73
|
+
- Updated dependencies [0fb6018]
|
|
74
|
+
- Updated dependencies [c27a1ed]
|
|
75
|
+
- Updated dependencies [b8e49ff]
|
|
76
|
+
- Updated dependencies [8037501]
|
|
77
|
+
- Updated dependencies [6c0da64]
|
|
78
|
+
- Updated dependencies [07f8ff8]
|
|
79
|
+
- Updated dependencies [e457582]
|
|
80
|
+
- Updated dependencies [8b5c905]
|
|
81
|
+
- Updated dependencies [f849131]
|
|
82
|
+
- Updated dependencies [94bdcc5]
|
|
83
|
+
- Updated dependencies [a34c8ea]
|
|
84
|
+
- Updated dependencies [2933c33]
|
|
85
|
+
- Updated dependencies [8ac4bf4]
|
|
86
|
+
- Updated dependencies [3a0be6b]
|
|
87
|
+
- Updated dependencies [d42baf4]
|
|
88
|
+
- Updated dependencies [8037501]
|
|
89
|
+
- Updated dependencies [54bb8a3]
|
|
90
|
+
- Updated dependencies [f711e18]
|
|
91
|
+
- @shipfox/react-ui@0.3.0
|
|
92
|
+
- @shipfox/api-logs-dto@0.1.0
|
|
93
|
+
- @shipfox/client-api@0.0.1
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shipfox
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SessionViewRow } from '@shipfox/api-logs-dto';
|
|
2
|
+
export interface AgentSessionRowsProps {
|
|
3
|
+
rows: readonly SessionViewRow[];
|
|
4
|
+
resolvedToolCallIds: ReadonlySet<string>;
|
|
5
|
+
indent: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function AgentSessionRows({ rows, resolvedToolCallIds, indent }: AgentSessionRowsProps): import("react").JSX.Element[];
|
|
8
|
+
//# sourceMappingURL=agent-session-rows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-session-rows.d.ts","sourceRoot":"","sources":["../../src/components/agent-session-rows.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,cAAc,EAAqB,MAAM,uBAAuB,CAAC;AAkB9E,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,SAAS,cAAc,EAAE,CAAC;IAChC,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,gBAAgB,CAAC,EAAC,IAAI,EAAE,mBAAmB,EAAE,MAAM,EAAC,EAAE,qBAAqB,iCAU1F"}
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Icon } from '@shipfox/react-ui/icon';
|
|
4
|
+
import { LogContent, LogDisclosure, LogDisclosureContent, LogDisclosureTrigger, LogRow } from '@shipfox/react-ui/log';
|
|
5
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '@shipfox/react-ui/tooltip';
|
|
6
|
+
import { cn } from '@shipfox/react-ui/utils';
|
|
7
|
+
import { Fragment, useState } from 'react';
|
|
8
|
+
const PREVIEW_CHAR_LIMIT = 1200;
|
|
9
|
+
const WORD_SUMMARY_CHAR_LIMIT = 5000;
|
|
10
|
+
const WHITESPACE = /\s+/g;
|
|
11
|
+
const WORD_SEPARATOR = /\s+/;
|
|
12
|
+
export function AgentSessionRows({ rows, resolvedToolCallIds, indent }) {
|
|
13
|
+
return rows.map((row, index)=>/*#__PURE__*/ _jsx(AgentSessionRowView, {
|
|
14
|
+
row: row,
|
|
15
|
+
resolvedToolCallIds: resolvedToolCallIds,
|
|
16
|
+
indent: indent
|
|
17
|
+
}, `${row.kind}-${index}`));
|
|
18
|
+
}
|
|
19
|
+
function AgentSessionRowView({ row, resolvedToolCallIds, indent }) {
|
|
20
|
+
switch(row.kind){
|
|
21
|
+
case 'message':
|
|
22
|
+
return /*#__PURE__*/ _jsx(LogRow, {
|
|
23
|
+
lineNumber: null,
|
|
24
|
+
timestamp: new Date(row.timestamp),
|
|
25
|
+
indent: indent,
|
|
26
|
+
tone: row.terminalFailure ? 'error' : 'default',
|
|
27
|
+
"data-log-terminal-failure": row.terminalFailure ? 'true' : undefined,
|
|
28
|
+
children: /*#__PURE__*/ _jsx(LogContent, {
|
|
29
|
+
className: "text-foreground-neutral-base",
|
|
30
|
+
children: /*#__PURE__*/ _jsxs("span", {
|
|
31
|
+
className: "flex min-w-0 items-start gap-8",
|
|
32
|
+
children: [
|
|
33
|
+
/*#__PURE__*/ _jsx(MessageIcon, {
|
|
34
|
+
role: row.role,
|
|
35
|
+
terminalFailure: row.terminalFailure
|
|
36
|
+
}),
|
|
37
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
38
|
+
className: "flex min-w-0 flex-1 flex-col gap-2",
|
|
39
|
+
children: [
|
|
40
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
41
|
+
className: "flex min-w-0 items-center gap-8",
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ _jsx(MessageRoleLabel, {
|
|
44
|
+
label: row.label,
|
|
45
|
+
terminalFailure: row.terminalFailure
|
|
46
|
+
}),
|
|
47
|
+
/*#__PURE__*/ _jsx(RowMetadata, {
|
|
48
|
+
meta: row.meta,
|
|
49
|
+
className: "ml-auto flex-none"
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
}),
|
|
53
|
+
/*#__PURE__*/ _jsx("span", {
|
|
54
|
+
className: "block min-w-0",
|
|
55
|
+
children: /*#__PURE__*/ _jsx(PreviewText, {
|
|
56
|
+
text: row.text
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
case 'thinking':
|
|
66
|
+
return /*#__PURE__*/ _jsxs(LogDisclosure, {
|
|
67
|
+
indent: indent,
|
|
68
|
+
children: [
|
|
69
|
+
/*#__PURE__*/ _jsx(LogDisclosureTrigger, {
|
|
70
|
+
summary: wordSummary(row.text),
|
|
71
|
+
timestamp: new Date(row.timestamp),
|
|
72
|
+
className: "text-foreground-neutral-subtle",
|
|
73
|
+
children: "thinking"
|
|
74
|
+
}),
|
|
75
|
+
/*#__PURE__*/ _jsx(LogDisclosureContent, {
|
|
76
|
+
className: "text-foreground-neutral-subtle",
|
|
77
|
+
children: /*#__PURE__*/ _jsx(LogContent, {
|
|
78
|
+
className: "text-foreground-neutral-subtle",
|
|
79
|
+
children: /*#__PURE__*/ _jsx(PreviewText, {
|
|
80
|
+
text: row.text
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
]
|
|
85
|
+
});
|
|
86
|
+
case 'tool-call':
|
|
87
|
+
{
|
|
88
|
+
const awaitingResult = row.id != null && !resolvedToolCallIds.has(row.id);
|
|
89
|
+
return /*#__PURE__*/ _jsxs(LogDisclosure, {
|
|
90
|
+
indent: indent,
|
|
91
|
+
children: [
|
|
92
|
+
/*#__PURE__*/ _jsx(LogDisclosureTrigger, {
|
|
93
|
+
timestamp: new Date(row.timestamp),
|
|
94
|
+
summary: compactPreview(row.input),
|
|
95
|
+
trailing: awaitingResult ? /*#__PURE__*/ _jsxs("span", {
|
|
96
|
+
className: "inline-flex items-center gap-4",
|
|
97
|
+
children: [
|
|
98
|
+
/*#__PURE__*/ _jsx(Icon, {
|
|
99
|
+
name: "loader4Line",
|
|
100
|
+
className: "size-12 motion-safe:animate-spin",
|
|
101
|
+
"aria-hidden": "true"
|
|
102
|
+
}),
|
|
103
|
+
"awaiting result"
|
|
104
|
+
]
|
|
105
|
+
}) : null,
|
|
106
|
+
children: /*#__PURE__*/ _jsxs("span", {
|
|
107
|
+
className: "inline-flex min-w-0 items-center gap-6",
|
|
108
|
+
children: [
|
|
109
|
+
/*#__PURE__*/ _jsx(Icon, {
|
|
110
|
+
name: "terminalBoxLine",
|
|
111
|
+
className: "size-14 flex-none",
|
|
112
|
+
"aria-hidden": "true"
|
|
113
|
+
}),
|
|
114
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
115
|
+
className: "truncate",
|
|
116
|
+
children: [
|
|
117
|
+
"tool ",
|
|
118
|
+
row.name
|
|
119
|
+
]
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
})
|
|
123
|
+
}),
|
|
124
|
+
/*#__PURE__*/ _jsx(LogDisclosureContent, {
|
|
125
|
+
children: /*#__PURE__*/ _jsx(LogContent, {
|
|
126
|
+
variant: "code",
|
|
127
|
+
children: /*#__PURE__*/ _jsx(PreviewText, {
|
|
128
|
+
text: row.input
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
case 'tool-result':
|
|
136
|
+
return /*#__PURE__*/ _jsxs(LogDisclosure, {
|
|
137
|
+
indent: indent,
|
|
138
|
+
children: [
|
|
139
|
+
/*#__PURE__*/ _jsx(LogDisclosureTrigger, {
|
|
140
|
+
timestamp: new Date(row.timestamp),
|
|
141
|
+
summary: compactPreview(row.output),
|
|
142
|
+
trailing: /*#__PURE__*/ _jsxs("span", {
|
|
143
|
+
className: cn('inline-flex items-center gap-4', row.isError ? 'text-red-600 dark:text-red-400' : 'text-foreground-neutral-muted'),
|
|
144
|
+
children: [
|
|
145
|
+
/*#__PURE__*/ _jsx(Icon, {
|
|
146
|
+
name: row.isError ? 'closeCircleLine' : 'checkLine',
|
|
147
|
+
className: "size-12",
|
|
148
|
+
"aria-hidden": "true"
|
|
149
|
+
}),
|
|
150
|
+
row.isError ? 'error' : 'ok'
|
|
151
|
+
]
|
|
152
|
+
}),
|
|
153
|
+
children: /*#__PURE__*/ _jsxs("span", {
|
|
154
|
+
className: "inline-flex min-w-0 items-center gap-6",
|
|
155
|
+
children: [
|
|
156
|
+
/*#__PURE__*/ _jsx(Icon, {
|
|
157
|
+
name: "terminalWindowLine",
|
|
158
|
+
className: "size-14 flex-none",
|
|
159
|
+
"aria-hidden": "true"
|
|
160
|
+
}),
|
|
161
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
162
|
+
className: "truncate",
|
|
163
|
+
children: [
|
|
164
|
+
"result ",
|
|
165
|
+
row.toolName
|
|
166
|
+
]
|
|
167
|
+
})
|
|
168
|
+
]
|
|
169
|
+
})
|
|
170
|
+
}),
|
|
171
|
+
/*#__PURE__*/ _jsx(LogDisclosureContent, {
|
|
172
|
+
children: /*#__PURE__*/ _jsx(LogContent, {
|
|
173
|
+
variant: "code",
|
|
174
|
+
className: cn(row.isError && 'text-red-600 dark:text-red-400'),
|
|
175
|
+
children: /*#__PURE__*/ _jsx(PreviewText, {
|
|
176
|
+
text: row.output
|
|
177
|
+
})
|
|
178
|
+
})
|
|
179
|
+
})
|
|
180
|
+
]
|
|
181
|
+
});
|
|
182
|
+
case 'lifecycle':
|
|
183
|
+
return /*#__PURE__*/ _jsx(LogRow, {
|
|
184
|
+
lineNumber: null,
|
|
185
|
+
timestamp: new Date(row.timestamp),
|
|
186
|
+
indent: indent,
|
|
187
|
+
tone: row.tone,
|
|
188
|
+
"data-log-terminal-failure": row.terminalFailure ? 'true' : undefined,
|
|
189
|
+
children: /*#__PURE__*/ _jsx(LogContent, {
|
|
190
|
+
className: "text-foreground-neutral-muted",
|
|
191
|
+
children: /*#__PURE__*/ _jsxs("span", {
|
|
192
|
+
className: "inline-flex w-full items-center gap-8",
|
|
193
|
+
children: [
|
|
194
|
+
/*#__PURE__*/ _jsx(Icon, {
|
|
195
|
+
name: "informationLine",
|
|
196
|
+
className: "size-14 flex-none",
|
|
197
|
+
"aria-hidden": "true"
|
|
198
|
+
}),
|
|
199
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
200
|
+
className: "min-w-0",
|
|
201
|
+
children: [
|
|
202
|
+
/*#__PURE__*/ _jsx("span", {
|
|
203
|
+
className: "font-medium",
|
|
204
|
+
children: row.label
|
|
205
|
+
}),
|
|
206
|
+
row.detail != null ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
207
|
+
children: [
|
|
208
|
+
' · ',
|
|
209
|
+
/*#__PURE__*/ _jsx("span", {
|
|
210
|
+
className: "text-foreground-neutral-subtle",
|
|
211
|
+
children: row.detail
|
|
212
|
+
})
|
|
213
|
+
]
|
|
214
|
+
}) : null
|
|
215
|
+
]
|
|
216
|
+
}),
|
|
217
|
+
/*#__PURE__*/ _jsx("span", {
|
|
218
|
+
"aria-hidden": "true",
|
|
219
|
+
className: "h-px flex-1 border-t border-dashed border-current opacity-30"
|
|
220
|
+
}),
|
|
221
|
+
/*#__PURE__*/ _jsx(RowMetadata, {
|
|
222
|
+
meta: row.meta
|
|
223
|
+
})
|
|
224
|
+
]
|
|
225
|
+
})
|
|
226
|
+
})
|
|
227
|
+
});
|
|
228
|
+
case 'raw':
|
|
229
|
+
return /*#__PURE__*/ _jsxs(LogDisclosure, {
|
|
230
|
+
indent: indent,
|
|
231
|
+
children: [
|
|
232
|
+
/*#__PURE__*/ _jsx(LogDisclosureTrigger, {
|
|
233
|
+
timestamp: new Date(row.timestamp),
|
|
234
|
+
summary: compactPreview(row.raw),
|
|
235
|
+
className: "text-orange-600 dark:text-orange-400",
|
|
236
|
+
children: /*#__PURE__*/ _jsxs("span", {
|
|
237
|
+
className: "inline-flex min-w-0 items-center gap-6",
|
|
238
|
+
children: [
|
|
239
|
+
/*#__PURE__*/ _jsx(Icon, {
|
|
240
|
+
name: "errorWarningLine",
|
|
241
|
+
className: "size-14 flex-none",
|
|
242
|
+
"aria-hidden": "true"
|
|
243
|
+
}),
|
|
244
|
+
/*#__PURE__*/ _jsx("span", {
|
|
245
|
+
className: "truncate",
|
|
246
|
+
children: row.label
|
|
247
|
+
})
|
|
248
|
+
]
|
|
249
|
+
})
|
|
250
|
+
}),
|
|
251
|
+
/*#__PURE__*/ _jsx(LogDisclosureContent, {
|
|
252
|
+
children: /*#__PURE__*/ _jsx(LogContent, {
|
|
253
|
+
variant: "code",
|
|
254
|
+
children: /*#__PURE__*/ _jsx(PreviewText, {
|
|
255
|
+
text: row.raw
|
|
256
|
+
})
|
|
257
|
+
})
|
|
258
|
+
})
|
|
259
|
+
]
|
|
260
|
+
});
|
|
261
|
+
default:
|
|
262
|
+
return assertNever(row);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
function MessageIcon({ role, terminalFailure }) {
|
|
266
|
+
const name = terminalFailure ? 'closeCircleLine' : role === 'user' ? 'userLine' : role === 'assistant' ? 'robot2Line' : 'message2Line';
|
|
267
|
+
return /*#__PURE__*/ _jsx(Icon, {
|
|
268
|
+
name: name,
|
|
269
|
+
className: cn('mt-2 size-14 flex-none', terminalFailure ? 'text-red-600 dark:text-red-400' : 'text-foreground-neutral-muted'),
|
|
270
|
+
"aria-hidden": "true"
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
function MessageRoleLabel({ label, terminalFailure }) {
|
|
274
|
+
return /*#__PURE__*/ _jsx("span", {
|
|
275
|
+
className: cn('min-w-0 font-code text-foreground-neutral-muted', terminalFailure && 'text-foreground-highlight-error'),
|
|
276
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
277
|
+
className: "truncate",
|
|
278
|
+
children: label
|
|
279
|
+
})
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
function RowMetadata({ meta, className }) {
|
|
283
|
+
if (meta.length === 0) return null;
|
|
284
|
+
const inlineMeta = meta.length === 1 && meta[0]?.inline !== false ? meta[0] : null;
|
|
285
|
+
if (inlineMeta != null) {
|
|
286
|
+
return /*#__PURE__*/ _jsx("span", {
|
|
287
|
+
className: cn('font-code text-xs text-foreground-neutral-muted', className),
|
|
288
|
+
title: `${inlineMeta.label}: ${inlineMeta.value}`,
|
|
289
|
+
children: inlineMeta.value
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
return /*#__PURE__*/ _jsx("span", {
|
|
293
|
+
className: className,
|
|
294
|
+
children: /*#__PURE__*/ _jsx(MetadataTrigger, {
|
|
295
|
+
meta: meta
|
|
296
|
+
})
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
function MetadataTrigger({ meta }) {
|
|
300
|
+
return /*#__PURE__*/ _jsxs(Tooltip, {
|
|
301
|
+
children: [
|
|
302
|
+
/*#__PURE__*/ _jsx(TooltipTrigger, {
|
|
303
|
+
asChild: true,
|
|
304
|
+
children: /*#__PURE__*/ _jsx("button", {
|
|
305
|
+
type: "button",
|
|
306
|
+
className: "inline-flex size-20 flex-none items-center justify-center rounded-4 text-foreground-neutral-muted opacity-60 transition-opacity hover:bg-background-components-hover hover:text-foreground-neutral-base hover:opacity-100 focus-visible:opacity-100 focus-visible:shadow-[inset_0_0_0_2px_var(--color-primary-500)] group-hover/log-row:opacity-100",
|
|
307
|
+
"aria-label": "Show message metadata",
|
|
308
|
+
children: /*#__PURE__*/ _jsx(Icon, {
|
|
309
|
+
name: "informationLine",
|
|
310
|
+
className: "size-12",
|
|
311
|
+
"aria-hidden": "true"
|
|
312
|
+
})
|
|
313
|
+
})
|
|
314
|
+
}),
|
|
315
|
+
/*#__PURE__*/ _jsx(TooltipContent, {
|
|
316
|
+
align: "end",
|
|
317
|
+
variant: "inverted",
|
|
318
|
+
className: "max-w-360 px-8 py-6",
|
|
319
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
320
|
+
className: "grid grid-cols-[max-content_minmax(0,1fr)] gap-x-8 gap-y-2 font-code text-xs",
|
|
321
|
+
children: meta.map((item)=>/*#__PURE__*/ _jsxs(Fragment, {
|
|
322
|
+
children: [
|
|
323
|
+
/*#__PURE__*/ _jsx("span", {
|
|
324
|
+
className: "text-foreground-contrast-secondary",
|
|
325
|
+
children: item.label
|
|
326
|
+
}),
|
|
327
|
+
/*#__PURE__*/ _jsx("span", {
|
|
328
|
+
className: "min-w-0 break-all text-foreground-contrast-primary",
|
|
329
|
+
children: item.value
|
|
330
|
+
})
|
|
331
|
+
]
|
|
332
|
+
}, `${item.label}-${item.value}`))
|
|
333
|
+
})
|
|
334
|
+
})
|
|
335
|
+
]
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
function PreviewText({ text }) {
|
|
339
|
+
const [expanded, setExpanded] = useState(false);
|
|
340
|
+
const truncated = text.length > PREVIEW_CHAR_LIMIT;
|
|
341
|
+
const visible = truncated && !expanded ? `${text.slice(0, PREVIEW_CHAR_LIMIT)}…` : text;
|
|
342
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
343
|
+
children: [
|
|
344
|
+
visible,
|
|
345
|
+
truncated ? /*#__PURE__*/ _jsx("button", {
|
|
346
|
+
type: "button",
|
|
347
|
+
"aria-expanded": expanded,
|
|
348
|
+
className: "ml-8 inline-flex min-h-24 items-center rounded-4 px-6 font-display text-xs text-foreground-highlight-interactive focus-visible:shadow-[inset_0_0_0_2px_var(--color-primary-500)]",
|
|
349
|
+
onClick: ()=>setExpanded((value)=>!value),
|
|
350
|
+
children: expanded ? 'show less' : 'show more'
|
|
351
|
+
}) : null
|
|
352
|
+
]
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
function compactPreview(value) {
|
|
356
|
+
// Normalize only a bounded head: tool output can be megabytes, and this runs
|
|
357
|
+
// per render for every disclosure trigger.
|
|
358
|
+
const head = value.length > 200 ? value.slice(0, 200) : value;
|
|
359
|
+
const singleLine = head.replace(WHITESPACE, ' ').trim();
|
|
360
|
+
if (singleLine.length <= 80) return singleLine;
|
|
361
|
+
return `${singleLine.slice(0, 80)}…`;
|
|
362
|
+
}
|
|
363
|
+
function wordSummary(value) {
|
|
364
|
+
const truncated = value.length > WORD_SUMMARY_CHAR_LIMIT;
|
|
365
|
+
const head = truncated ? value.slice(0, WORD_SUMMARY_CHAR_LIMIT) : value;
|
|
366
|
+
const count = head.trim().split(WORD_SEPARATOR).filter(Boolean).length;
|
|
367
|
+
const marker = truncated ? '+' : '';
|
|
368
|
+
return `${count}${marker} ${count === 1 ? 'word' : 'words'}`;
|
|
369
|
+
}
|
|
370
|
+
function assertNever(value) {
|
|
371
|
+
throw new Error(`unexpected agent session row: ${JSON.stringify(value)}`);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
//# sourceMappingURL=agent-session-rows.js.map
|