@zyro-sec/session-ui 0.0.0-stage → 1.0.4
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/AGENTS.md +25 -0
- package/bunfig.toml +2 -0
- package/component-tests/basic-tool.fixture.tsx +46 -0
- package/component-tests/basic-tool.spec.ts +63 -0
- package/component-tests/file-media.fixture.tsx +39 -0
- package/component-tests/file-media.spec.ts +13 -0
- package/component-tests/file-tool.spec.ts +62 -0
- package/component-tests/file-viewer.fixture.tsx +109 -0
- package/component-tests/file-viewer.spec.ts +134 -0
- package/component-tests/file.spec.ts +33 -0
- package/component-tests/line-comment-v2.spec.ts +15 -0
- package/component-tests/markdown-code-wrap.spec.ts +94 -0
- package/component-tests/markdown-readiness.spec.ts +95 -0
- package/component-tests/markdown.fixture.tsx +104 -0
- package/component-tests/markdown.spec.ts +1564 -0
- package/component-tests/mermaid-preview.spec.ts +43 -0
- package/component-tests/patch-group.spec.ts +79 -0
- package/component-tests/read-group.spec.ts +72 -0
- package/component-tests/read-image.fixture.tsx +66 -0
- package/component-tests/read-image.spec.ts +154 -0
- package/component-tests/session-compaction.spec.ts +254 -0
- package/component-tests/session-lifecycle.spec.ts +190 -0
- package/component-tests/session-message-projection.spec.ts +639 -0
- package/component-tests/session-notice-projection.spec.ts +20 -0
- package/component-tests/session-review-comments.spec.ts +179 -0
- package/component-tests/session-shell.spec.ts +93 -0
- package/component-tests/session-timeline-mobile.spec.ts +201 -0
- package/component-tests/session-timeline-notices.spec.ts +38 -0
- package/component-tests/session-timeline-reasoning.spec.ts +107 -0
- package/component-tests/session-timeline.spec.ts +157 -0
- package/component-tests/session-tool-projection.spec.ts +323 -0
- package/component-tests/text-lifecycle.fixture.tsx +26 -0
- package/component-tests/text-lifecycle.spec.ts +42 -0
- package/component-tests/timeline-subagent-rows.spec.ts +33 -0
- package/component-tests/tool-disclosure.spec.ts +48 -0
- package/component-tests/tool-group-sticky.spec.ts +37 -0
- package/component-tests/tool-group.spec.ts +290 -0
- package/component-tests/tool-status-title.fixture.tsx +22 -0
- package/component-tests/tool-status-title.spec.ts +30 -0
- package/component-tests/user-message-quotes.spec.ts +111 -0
- package/package.json +91 -4
- package/playwright.components.config.ts +4 -0
- package/playwright.local.config.ts +2 -0
- package/src/actions.ts +54 -0
- package/src/components/apply-patch-file.ts +122 -0
- package/src/components/basic-tool.css +487 -0
- package/src/components/basic-tool.tsx +258 -0
- package/src/components/copy-machine.ts +78 -0
- package/src/components/copy.ts +85 -0
- package/src/components/diagram-preview.tsx +28 -0
- package/src/components/disclosure-machine.ts +188 -0
- package/src/components/disclosure.ts +129 -0
- package/src/components/dock-prompt.stories.tsx +73 -0
- package/src/components/dock-prompt.tsx +29 -0
- package/src/components/file-comment-selection.tsx +146 -0
- package/src/components/file-media-machine.ts +165 -0
- package/src/components/file-media.stories.tsx +112 -0
- package/src/components/file-media.tsx +323 -0
- package/src/components/file-search.tsx +73 -0
- package/src/components/file.css +59 -0
- package/src/components/file.tsx +1300 -0
- package/src/components/image-preview.tsx +35 -0
- package/src/components/line-comment-annotations.tsx +580 -0
- package/src/components/line-comment-machine.ts +262 -0
- package/src/components/line-comment-styles.ts +293 -0
- package/src/components/line-comment.stories.tsx +152 -0
- package/src/components/line-comment.tsx +448 -0
- package/src/components/link-segments.ts +20 -0
- package/src/components/linked-text.tsx +21 -0
- package/src/components/markdown-cache-machine.ts +257 -0
- package/src/components/markdown-cache.tsx +556 -0
- package/src/components/markdown-clipboard.ts +101 -0
- package/src/components/markdown-code-machine.ts +200 -0
- package/src/components/markdown-code-state.ts +22 -0
- package/src/components/markdown-fragment-links.ts +74 -0
- package/src/components/markdown-github.svg +3 -0
- package/src/components/markdown-globe.svg +5 -0
- package/src/components/markdown-image-machine.ts +170 -0
- package/src/components/markdown-image.ts +156 -0
- package/src/components/markdown-inline-code-kind.ts +39 -0
- package/src/components/markdown-mermaid.ts +18 -0
- package/src/components/markdown-phase-machine.ts +102 -0
- package/src/components/markdown-projection.ts +13 -0
- package/src/components/markdown-session-links.ts +183 -0
- package/src/components/markdown-solid.test.tsx +92 -0
- package/src/components/markdown-solid.tsx +113 -0
- package/src/components/markdown-stream.ts +95 -0
- package/src/components/markdown-worker-machine.ts +516 -0
- package/src/components/markdown-worker-protocol.ts +73 -0
- package/src/components/markdown-worker.ts +250 -0
- package/src/components/markdown.css +672 -0
- package/src/components/markdown.stories.tsx +199 -0
- package/src/components/markdown.tsx +1612 -0
- package/src/components/markdown.worker.ts +188 -0
- package/src/components/message-file.ts +102 -0
- package/src/components/message-nav.css +134 -0
- package/src/components/message-nav.tsx +159 -0
- package/src/components/message-part.css +2109 -0
- package/src/components/message-part.tsx +3 -0
- package/src/components/question-prompt-experimental.css +576 -0
- package/src/components/question-prompt.css +527 -0
- package/src/components/quote-highlight.css +59 -0
- package/src/components/review-focus-driver.ts +142 -0
- package/src/components/review-focus-machine.ts +95 -0
- package/src/components/session-compaction.css +270 -0
- package/src/components/session-diff.ts +358 -0
- package/src/components/session-error.tsx +41 -0
- package/src/components/session-retry.tsx +92 -0
- package/src/components/session-review-machine.ts +241 -0
- package/src/components/session-review.css +264 -0
- package/src/components/session-review.stories.tsx +232 -0
- package/src/components/session-review.tsx +733 -0
- package/src/components/session-turn.css +282 -0
- package/src/components/shell-submessage.css +24 -0
- package/src/components/timeline-separator.tsx +69 -0
- package/src/components/tool-count-label.css +57 -0
- package/src/components/tool-count-label.tsx +76 -0
- package/src/components/tool-count-summary.css +102 -0
- package/src/components/tool-count-summary.stories.tsx +99 -0
- package/src/components/tool-count-summary.tsx +44 -0
- package/src/components/tool-error-card.css +178 -0
- package/src/components/tool-error-card.stories.tsx +113 -0
- package/src/components/tool-error-card.tsx +202 -0
- package/src/components/tool-status-title-machine.ts +128 -0
- package/src/components/tool-status-title.css +89 -0
- package/src/components/tool-status-title.tsx +163 -0
- package/src/context/data.tsx +107 -0
- package/src/context/index.ts +1 -0
- package/src/context/markdown.tsx +129 -0
- package/src/context/sources.tsx +34 -0
- package/src/document.ts +8 -0
- package/src/file-presentation.ts +34 -0
- package/src/message/action-machine.ts +72 -0
- package/src/message/agent-label.ts +3 -0
- package/src/message/attachment-card.css +119 -0
- package/src/message/attachment-card.tsx +40 -0
- package/src/message/attachment-media-machine.ts +213 -0
- package/src/message/comment-card.tsx +155 -0
- package/src/message/compaction-entrance-machine.ts +93 -0
- package/src/message/current-message.tsx +157 -0
- package/src/message/current-tool-state.ts +161 -0
- package/src/message/message-content.tsx +1391 -0
- package/src/message/paced-text-machine.ts +73 -0
- package/src/message/prompt-message.stories.tsx +149 -0
- package/src/message/relative-time.ts +45 -0
- package/src/message/user-message-quote-parts.ts +16 -0
- package/src/message/user-message-quotes.stories.tsx +797 -0
- package/src/message/user-message-quotes.tsx +135 -0
- package/src/pierre/comment-hover-machine.ts +53 -0
- package/src/pierre/comment-hover.ts +131 -0
- package/src/pierre/comment-selection-machine.ts +257 -0
- package/src/pierre/commented-lines.ts +106 -0
- package/src/pierre/diff-selection.ts +91 -0
- package/src/pierre/file-find-machine.ts +323 -0
- package/src/pierre/file-find.ts +537 -0
- package/src/pierre/file-runtime.ts +42 -0
- package/src/pierre/file-selection.ts +140 -0
- package/src/pierre/index.ts +344 -0
- package/src/pierre/media.ts +140 -0
- package/src/pierre/render-machine.ts +381 -0
- package/src/pierre/selection-bridge.ts +82 -0
- package/src/pierre/selection-machine.ts +198 -0
- package/src/pierre/virtualizer.ts +114 -0
- package/src/pierre/worker.ts +46 -0
- package/src/sources/experiment.ts +59 -0
- package/src/sources/site-icon.tsx +53 -0
- package/src/sources/sources-chip.tsx +57 -0
- package/src/sources/sources-expand-machine.ts +101 -0
- package/src/sources/sources-panel.tsx +249 -0
- package/src/sources/sources-title.tsx +21 -0
- package/src/sources/sources.css +266 -0
- package/src/sources/sources.ts +141 -0
- package/src/storybook/current-session-fixtures.ts +1492 -0
- package/src/storybook/current-session-scenarios.ts +76 -0
- package/src/storybook/current-session-story.tsx +154 -0
- package/src/storybook/index.ts +43 -0
- package/src/styles/index.css +19 -0
- package/src/timeline/__snapshots__/group-labels.test.ts.snap +110 -0
- package/src/timeline/__snapshots__/placement.test.ts.snap +1041 -0
- package/src/timeline/code-blocks.stories.tsx +105 -0
- package/src/timeline/commentary.stories.tsx +70 -0
- package/src/timeline/commentary.ts +38 -0
- package/src/timeline/detail.ts +111 -0
- package/src/timeline/error-card.stories.tsx +134 -0
- package/src/timeline/error-spacing.stories.tsx +71 -0
- package/src/timeline/facts.ts +493 -0
- package/src/timeline/file-changes.stories.tsx +436 -0
- package/src/timeline/group-label-fixtures.ts +97 -0
- package/src/timeline/mermaid.stories.tsx +131 -0
- package/src/timeline/place.ts +280 -0
- package/src/timeline/placement-fixtures.ts +365 -0
- package/src/timeline/placement-reactivity.ts +133 -0
- package/src/timeline/projection.ts +1261 -0
- package/src/timeline/research-and-agents.stories.tsx +461 -0
- package/src/timeline/session-timeline-row.tsx +1675 -0
- package/src/timeline/session-timeline.tsx +68 -0
- package/src/timeline/steer-arrival-machine.ts +134 -0
- package/src/timeline/terminal-work.stories.tsx +464 -0
- package/src/timeline/timeline-row.stories.tsx +1069 -0
- package/src/timeline/timeline-row.ts +238 -0
- package/src/timeline/turn-phase-machine.ts +112 -0
- package/src/timeline/user-message-fold.stories.tsx +194 -0
- package/src/timeline/user-runs.ts +87 -0
- package/src/timeline-next/__snapshots__/placement.test.ts.snap +990 -0
- package/src/timeline-next/compaction.tsx +236 -0
- package/src/timeline-next/errors.ts +101 -0
- package/src/timeline-next/event-row.tsx +168 -0
- package/src/timeline-next/events.ts +103 -0
- package/src/timeline-next/index.ts +10 -0
- package/src/timeline-next/nested-rail.ts +125 -0
- package/src/timeline-next/projection.ts +1028 -0
- package/src/timeline-next/row.tsx +1728 -0
- package/src/timeline-next/rules.ts +89 -0
- package/src/timeline-next/separator.tsx +73 -0
- package/src/timeline-next/spacing.ts +127 -0
- package/src/timeline-next/status-line.tsx +41 -0
- package/src/timeline-next/status.ts +33 -0
- package/src/timeline-next/stories/compare-renderer.stories.tsx +190 -0
- package/src/timeline-next/stories/compare-sessions/.gitignore +3 -0
- package/src/timeline-next/stories/compare.stories.tsx +486 -0
- package/src/timeline-next/stories/playground.stories.tsx +297 -0
- package/src/timeline-next/stories/session-replay.ts +1156 -0
- package/src/timeline-next/stories/session-timeline.tsx +50 -0
- package/src/timeline-next/stories/subagent-status.stories.tsx +132 -0
- package/src/timeline-next/timeline-next.css +649 -0
- package/src/timeline-next/tools/__snapshots__/activity-label.test.ts.snap +39 -0
- package/src/timeline-next/tools/activity-label.ts +166 -0
- package/src/timeline-next/tools/assistant-content.tsx +84 -0
- package/src/timeline-next/tools/context-group.tsx +619 -0
- package/src/timeline-next/tools/error-card.tsx +147 -0
- package/src/timeline-next/tools/explore.tsx +119 -0
- package/src/timeline-next/tools/file-group.tsx +128 -0
- package/src/timeline-next/tools/patch.tsx +174 -0
- package/src/timeline-next/tools/shell.tsx +186 -0
- package/src/timeline-next/tools/thought.tsx +87 -0
- package/src/timeline-next/tools/tool-display.tsx +119 -0
- package/src/tools/ansi.ts +8 -0
- package/src/tools/context-group-label.ts +123 -0
- package/src/tools/file-runs.ts +35 -0
- package/src/tools/project-path.ts +18 -0
- package/src/tools/read-group.stories.tsx +159 -0
- package/src/tools/run-machine.ts +185 -0
- package/src/tools/shell-output-machine.ts +233 -0
- package/src/tools/shell-output.ts +91 -0
- package/src/tools/subagent-row-variants.stories.tsx +129 -0
- package/src/tools/tool-group.stories.tsx +345 -0
- package/src/tools/tool-renderer.tsx +2876 -0
- package/src/v2/components/line-comment-annotations-v2.tsx +215 -0
- package/src/v2/components/session-file-panel-v2.tsx +149 -0
- package/src/v2/components/session-progress-indicator-v2.css +5 -0
- package/src/v2/components/session-progress-indicator-v2.stories.tsx +86 -0
- package/src/v2/components/session-progress-indicator-v2.tsx +16 -0
- package/src/v2/components/session-review-empty-changes-v2.tsx +17 -0
- package/src/v2/components/session-review-empty-no-git-v2.tsx +28 -0
- package/src/v2/components/session-review-file-preview-v2-virtualize.ts +5 -0
- package/src/v2/components/session-review-file-preview-v2.tsx +266 -0
- package/src/v2/components/session-review-v2.css +653 -0
- package/src/v2/components/session-review-v2.tsx +422 -0
- package/src/v2/components/sidebar-presence-machine.ts +69 -0
- package/tsconfig.json +20 -0
- package/README.md +0 -3
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { For, createMemo } from "solid-js"
|
|
2
|
+
import { createStore } from "solid-js/store"
|
|
3
|
+
import type { SessionDocument } from "../document"
|
|
4
|
+
import type { SessionUserActions } from "../actions"
|
|
5
|
+
import type { TimelineDetail } from "./detail"
|
|
6
|
+
import { createReactiveTimelineProjection, TimelineRow, type ReasoningMode } from "./projection"
|
|
7
|
+
import { createSessionTimelineRowRenderer, type SessionUserPresentation } from "./session-timeline-row"
|
|
8
|
+
|
|
9
|
+
export type { SessionUserPresentation } from "./session-timeline-row"
|
|
10
|
+
|
|
11
|
+
export type SessionTimelineProps = {
|
|
12
|
+
document: SessionDocument
|
|
13
|
+
presentation?: Record<string, SessionUserPresentation | undefined>
|
|
14
|
+
actions?: SessionUserActions
|
|
15
|
+
reasoningMode?: ReasoningMode
|
|
16
|
+
shellToolDefaultOpen?: boolean
|
|
17
|
+
editToolDefaultOpen?: boolean
|
|
18
|
+
timelineDetail?: TimelineDetail
|
|
19
|
+
turnDiffs?: boolean
|
|
20
|
+
inlineQuotes?: boolean
|
|
21
|
+
class?: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function SessionTimeline(props: SessionTimelineProps) {
|
|
25
|
+
const projection = createReactiveTimelineProjection({
|
|
26
|
+
sessionMessages: () => props.document.messages,
|
|
27
|
+
status: () => props.document.status,
|
|
28
|
+
reasoningMode: () => props.reasoningMode ?? "compact",
|
|
29
|
+
shellToolDefaultOpen: () => props.shellToolDefaultOpen ?? false,
|
|
30
|
+
editToolDefaultOpen: () => props.editToolDefaultOpen ?? false,
|
|
31
|
+
timelineDetail: props.timelineDetail && (() => props.timelineDetail!),
|
|
32
|
+
turnDiffs: () => props.turnDiffs ?? false,
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const [toolOpen, setToolOpen] = createStore<Record<string, boolean | undefined>>({})
|
|
36
|
+
|
|
37
|
+
const renderer = createSessionTimelineRowRenderer({
|
|
38
|
+
sessionID: () => props.document.sessionID,
|
|
39
|
+
status: () => props.document.status,
|
|
40
|
+
projection,
|
|
41
|
+
presentation: (message) => props.presentation?.[message.id],
|
|
42
|
+
actions: props.actions,
|
|
43
|
+
reasoningMode: () => props.reasoningMode ?? "compact",
|
|
44
|
+
shellToolDefaultOpen: () => props.shellToolDefaultOpen ?? false,
|
|
45
|
+
editToolDefaultOpen: () => props.editToolDefaultOpen ?? false,
|
|
46
|
+
timelineDetail: props.timelineDetail && (() => props.timelineDetail!),
|
|
47
|
+
inlineQuotes: () => props.inlineQuotes ?? false,
|
|
48
|
+
disclosure: {
|
|
49
|
+
value: (key) => toolOpen[key],
|
|
50
|
+
set: (key, open) => setToolOpen(key, open),
|
|
51
|
+
},
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const rowKeys = createMemo(() => projection.rows().map(TimelineRow.key))
|
|
55
|
+
|
|
56
|
+
function Row(props: { rowKey: string }) {
|
|
57
|
+
const initial = projection.rowByKey().get(props.rowKey)!
|
|
58
|
+
const row = createMemo(() => projection.rowByKey().get(props.rowKey) ?? initial)
|
|
59
|
+
|
|
60
|
+
return <renderer.Row row={row} />
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<div data-component="session-timeline" class={props.class}>
|
|
65
|
+
<For each={rowKeys()}>{(rowKey) => <Row rowKey={rowKey} />}</For>
|
|
66
|
+
</div>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Predicate } from "effect"
|
|
2
|
+
import type { TimelineRow } from "./timeline-row"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Which user messages grow in as they render. `seen` holds the message IDs of the session's rows so far: user messages,
|
|
6
|
+
* shells and assistant messages. A user message counts as a steer only when it lands below a seen row while the session
|
|
7
|
+
* works, so the first page and history loaded above it appear as they are. `arriving` holds steers whose rows have not
|
|
8
|
+
* rendered yet; rendering one, or the session going idle, removes it. `growing` holds steers whose rows are growing in;
|
|
9
|
+
* the grow finishing, or the row unmounting, removes it.
|
|
10
|
+
*/
|
|
11
|
+
export type SteerArrivalState =
|
|
12
|
+
| {
|
|
13
|
+
readonly status: "tracking"
|
|
14
|
+
readonly sessionID: string
|
|
15
|
+
readonly seen: ReadonlySet<string>
|
|
16
|
+
readonly arriving: ReadonlySet<string>
|
|
17
|
+
readonly growing: ReadonlySet<string>
|
|
18
|
+
}
|
|
19
|
+
| { readonly status: "disposed" }
|
|
20
|
+
|
|
21
|
+
export type SteerArrivalEvent =
|
|
22
|
+
| {
|
|
23
|
+
readonly type: "sync"
|
|
24
|
+
readonly sessionID: string
|
|
25
|
+
readonly rows: readonly TimelineRow.TimelineRow[]
|
|
26
|
+
readonly busy: boolean
|
|
27
|
+
}
|
|
28
|
+
| { readonly type: "rendered"; readonly messageID: string }
|
|
29
|
+
| { readonly type: "grown"; readonly messageID: string }
|
|
30
|
+
| { readonly type: "disposed" }
|
|
31
|
+
|
|
32
|
+
const EMPTY: ReadonlySet<string> = new Set()
|
|
33
|
+
|
|
34
|
+
export const INITIAL_STEER_ARRIVAL_STATE: SteerArrivalState = Object.freeze({
|
|
35
|
+
status: "tracking",
|
|
36
|
+
sessionID: "",
|
|
37
|
+
seen: EMPTY,
|
|
38
|
+
arriving: EMPTY,
|
|
39
|
+
growing: EMPTY,
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
export const DISPOSED_STEER_ARRIVAL_STATE: SteerArrivalState = Object.freeze({ status: "disposed" })
|
|
43
|
+
|
|
44
|
+
export const DISPOSED_STEER_ARRIVAL_EVENT: SteerArrivalEvent = Object.freeze({ type: "disposed" })
|
|
45
|
+
|
|
46
|
+
// Row projections run on every streamed change, so a sync that adds no row and keeps the steers returns the same state.
|
|
47
|
+
export function transitionSteerArrival(state: SteerArrivalState, event: SteerArrivalEvent): SteerArrivalState {
|
|
48
|
+
if (state.status === "disposed") return state
|
|
49
|
+
|
|
50
|
+
if (event.type === "disposed") return DISPOSED_STEER_ARRIVAL_STATE
|
|
51
|
+
|
|
52
|
+
if (event.type === "rendered") {
|
|
53
|
+
if (!state.arriving.has(event.messageID)) return state
|
|
54
|
+
const arriving = new Set(state.arriving)
|
|
55
|
+
arriving.delete(event.messageID)
|
|
56
|
+
|
|
57
|
+
return { ...state, arriving, growing: new Set([...state.growing, event.messageID]) }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (event.type === "grown") {
|
|
61
|
+
if (!state.growing.has(event.messageID)) return state
|
|
62
|
+
const growing = new Set(state.growing)
|
|
63
|
+
growing.delete(event.messageID)
|
|
64
|
+
|
|
65
|
+
return { ...state, growing }
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const rows = event.rows
|
|
69
|
+
|
|
70
|
+
if (event.sessionID !== state.sessionID)
|
|
71
|
+
return {
|
|
72
|
+
status: "tracking",
|
|
73
|
+
sessionID: event.sessionID,
|
|
74
|
+
seen: new Set(rows.flatMap((row) => rowAnchor(row) ?? [])),
|
|
75
|
+
arriving: EMPTY,
|
|
76
|
+
growing: EMPTY,
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const unseen = rows.some((row) => {
|
|
80
|
+
const anchor = rowAnchor(row)
|
|
81
|
+
|
|
82
|
+
return anchor !== undefined && !state.seen.has(anchor)
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
if (!unseen && (event.busy || state.arriving.size === 0)) return state
|
|
86
|
+
|
|
87
|
+
const last = rows.findLastIndex((row) => {
|
|
88
|
+
const anchor = rowAnchor(row)
|
|
89
|
+
|
|
90
|
+
return anchor !== undefined && state.seen.has(anchor)
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
// With no seen row left to land below (a first page, or rows replaced wholesale), every row is history.
|
|
94
|
+
const steers =
|
|
95
|
+
event.busy && last >= 0
|
|
96
|
+
? rows
|
|
97
|
+
.slice(last + 1)
|
|
98
|
+
.filter((row) => Predicate.isTagged(row, "UserMessage") && !state.seen.has(row.userMessageID))
|
|
99
|
+
.map((row) => row.userMessageID)
|
|
100
|
+
: []
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
status: "tracking",
|
|
104
|
+
sessionID: state.sessionID,
|
|
105
|
+
seen: unseen ? new Set([...state.seen, ...rows.flatMap((row) => rowAnchor(row) ?? [])]) : state.seen,
|
|
106
|
+
arriving: !event.busy ? EMPTY : steers.length > 0 ? new Set([...state.arriving, ...steers]) : state.arriving,
|
|
107
|
+
growing: state.growing,
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function shouldGrowUserMessage(state: SteerArrivalState, messageID: string) {
|
|
112
|
+
return state.status === "tracking" && state.arriving.has(messageID)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Whether a run's gaps and meta lines snap rather than spring: while a steer is landing or growing in, the growing row
|
|
117
|
+
* moves the run, so springing as well would make the bubbles jump.
|
|
118
|
+
*/
|
|
119
|
+
export function shouldSnapUserRun(state: SteerArrivalState) {
|
|
120
|
+
return state.status === "tracking" && (state.arriving.size > 0 || state.growing.size > 0)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Each row stands for the message that produced it; message IDs are unique across user, shell and assistant messages.
|
|
124
|
+
function rowAnchor(row: TimelineRow.TimelineRow) {
|
|
125
|
+
if (Predicate.isTagged(row, "UserMessage")) return row.userMessageID
|
|
126
|
+
|
|
127
|
+
if (Predicate.isTagged(row, "Shell")) return row.messageID
|
|
128
|
+
|
|
129
|
+
if (Predicate.isTagged(row, "Thinking")) return row.ref.messageID
|
|
130
|
+
|
|
131
|
+
if (!Predicate.isTagged(row, "AssistantPart")) return
|
|
132
|
+
|
|
133
|
+
return row.group.type === "part" ? row.group.ref.messageID : row.group.refs[0]?.messageID
|
|
134
|
+
}
|
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
import type { SessionMessageAssistant, SessionMessageShell } from "@zyro-sec/client/promise"
|
|
2
|
+
import { Match } from "effect"
|
|
3
|
+
import { createEffect, createMemo, createSignal, Show } from "solid-js"
|
|
4
|
+
import { createStore } from "solid-js/store"
|
|
5
|
+
import { DataProvider } from "../context/data"
|
|
6
|
+
import { SessionShellMessage } from "../tools/tool-renderer"
|
|
7
|
+
import { CurrentSessionProviders, CurrentSessionTimelineStory } from "../storybook/current-session-story"
|
|
8
|
+
import {
|
|
9
|
+
STORY_TIME,
|
|
10
|
+
executeCodeDocument,
|
|
11
|
+
executeLongDetailsDocument,
|
|
12
|
+
executeManyCallsDocument,
|
|
13
|
+
expandedShellDocument,
|
|
14
|
+
recoveryDocument,
|
|
15
|
+
standaloneShellCompletedDocument,
|
|
16
|
+
standaloneShellRunningDocument,
|
|
17
|
+
terminalFailedDocument,
|
|
18
|
+
terminalPassedDocument,
|
|
19
|
+
terminalRunningDocument,
|
|
20
|
+
} from "../storybook/current-session-fixtures"
|
|
21
|
+
import { storyDocument, storyTool } from "../storybook/current-session-scenarios"
|
|
22
|
+
import { SessionTimeline } from "./session-timeline"
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
title: "OpenCode/Work/Terminal",
|
|
26
|
+
id: "current-session-terminal-work",
|
|
27
|
+
component: SessionTimeline,
|
|
28
|
+
parameters: {
|
|
29
|
+
layout: "fullscreen",
|
|
30
|
+
docs: {
|
|
31
|
+
description: {
|
|
32
|
+
component:
|
|
33
|
+
"Common shell states in a real Session turn: an active command, a successful check, a focused failure, and the follow-up correction.",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const RunningTests = {
|
|
40
|
+
render: () => (
|
|
41
|
+
<CurrentSessionTimelineStory
|
|
42
|
+
title="Running tests"
|
|
43
|
+
description="The active shell message keeps its progress treatment and can be opened while running."
|
|
44
|
+
document={terminalRunningDocument}
|
|
45
|
+
width="720px"
|
|
46
|
+
shellToolDefaultOpen
|
|
47
|
+
/>
|
|
48
|
+
),
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const RunningAUserCommand = {
|
|
52
|
+
render: () => (
|
|
53
|
+
<CurrentSessionTimelineStory
|
|
54
|
+
title="Running a user command"
|
|
55
|
+
description="A command entered directly in shell mode remains active and streams its captured output."
|
|
56
|
+
document={standaloneShellRunningDocument}
|
|
57
|
+
width="720px"
|
|
58
|
+
shellToolDefaultOpen
|
|
59
|
+
/>
|
|
60
|
+
),
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const UserCommandCompleted = {
|
|
64
|
+
render: () => (
|
|
65
|
+
<CurrentSessionTimelineStory
|
|
66
|
+
title="User command completed"
|
|
67
|
+
description="A direct shell command keeps its final output and successful exit status in the transcript."
|
|
68
|
+
document={standaloneShellCompletedDocument}
|
|
69
|
+
width="720px"
|
|
70
|
+
shellToolDefaultOpen
|
|
71
|
+
/>
|
|
72
|
+
),
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export const LiveUserCommand = {
|
|
76
|
+
args: { outcome: "exited", output: true, expanded: true },
|
|
77
|
+
argTypes: { outcome: { control: "select", options: ["exited", "nonzero", "timeout", "killed"] } },
|
|
78
|
+
render: (args: { outcome: "exited" | "nonzero" | "timeout" | "killed"; output: boolean; expanded: boolean }) => {
|
|
79
|
+
const [stats, setStats] = createStore({ reads: 0 })
|
|
80
|
+
|
|
81
|
+
const [message, setMessage] = createSignal<SessionMessageShell>({
|
|
82
|
+
id: "msg_shell_live",
|
|
83
|
+
type: "shell",
|
|
84
|
+
shellID: "shell_live",
|
|
85
|
+
command: "printf ready",
|
|
86
|
+
status: "running",
|
|
87
|
+
time: { created: 1 },
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
let output = args.output ? "ready\n" : ""
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<section class="mx-auto flex w-full max-w-[720px] flex-col gap-4 p-6">
|
|
94
|
+
<output aria-label="Output requests">{stats.reads}</output>
|
|
95
|
+
<button type="button" onClick={() => (output += "next line\n")}>
|
|
96
|
+
Update output
|
|
97
|
+
</button>
|
|
98
|
+
<button
|
|
99
|
+
type="button"
|
|
100
|
+
onClick={() => {
|
|
101
|
+
if (args.output) output += "finished\n"
|
|
102
|
+
setMessage((value) => ({
|
|
103
|
+
...value,
|
|
104
|
+
status: args.outcome === "nonzero" ? "exited" : args.outcome,
|
|
105
|
+
exit: Match.value(args.outcome).pipe(
|
|
106
|
+
Match.when("nonzero", () => 1),
|
|
107
|
+
Match.when("exited", () => 0),
|
|
108
|
+
Match.orElse(() => undefined),
|
|
109
|
+
),
|
|
110
|
+
output: { output, cursor: output.length, size: output.length, truncated: false },
|
|
111
|
+
time: { created: 1, completed: 2 },
|
|
112
|
+
}))
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
115
|
+
Complete command
|
|
116
|
+
</button>
|
|
117
|
+
<DataProvider
|
|
118
|
+
directory="/workspace"
|
|
119
|
+
data={{ session: [], session_status: {}, session_diff: {} }}
|
|
120
|
+
shellOutput={async (input) => {
|
|
121
|
+
setStats("reads", (value) => value + 1)
|
|
122
|
+
|
|
123
|
+
if (message().status !== "running") throw new Error("Shell output unavailable")
|
|
124
|
+
|
|
125
|
+
if (input.id !== "shell_live" || input.location?.directory !== "/workspace") {
|
|
126
|
+
throw new Error("Unexpected shell output request")
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
location: {
|
|
131
|
+
directory: "/workspace",
|
|
132
|
+
project: { id: "project_shell", directory: "/workspace", canonical: "/workspace" },
|
|
133
|
+
},
|
|
134
|
+
data: {
|
|
135
|
+
output: output.slice(input.cursor ?? 0),
|
|
136
|
+
cursor: output.length,
|
|
137
|
+
size: output.length,
|
|
138
|
+
truncated: false,
|
|
139
|
+
},
|
|
140
|
+
}
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
<SessionShellMessage message={message()} defaultOpen={args.expanded} />
|
|
144
|
+
</DataProvider>
|
|
145
|
+
</section>
|
|
146
|
+
)
|
|
147
|
+
},
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const CollapsedShell = {
|
|
151
|
+
render: () => (
|
|
152
|
+
<CurrentSessionTimelineStory
|
|
153
|
+
title="Collapsed completed shell"
|
|
154
|
+
description="A focused shell disclosure responds to the keyboard without scrolling its containing surface."
|
|
155
|
+
document={terminalPassedDocument}
|
|
156
|
+
width="720px"
|
|
157
|
+
/>
|
|
158
|
+
),
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export const TestsPassed = {
|
|
162
|
+
render: () => (
|
|
163
|
+
<CurrentSessionTimelineStory
|
|
164
|
+
title="Tests passed"
|
|
165
|
+
description="A completed focused check shows its command, output, and successful tool state."
|
|
166
|
+
document={terminalPassedDocument}
|
|
167
|
+
width="720px"
|
|
168
|
+
shellToolDefaultOpen
|
|
169
|
+
/>
|
|
170
|
+
),
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export const ExpandedShell = {
|
|
174
|
+
render: () => (
|
|
175
|
+
<CurrentSessionTimelineStory
|
|
176
|
+
title="Expanded shell"
|
|
177
|
+
description="The expanded shell separates the command from its output in a full-width card without a detail rail."
|
|
178
|
+
document={expandedShellDocument}
|
|
179
|
+
width="786px"
|
|
180
|
+
shellToolDefaultOpen
|
|
181
|
+
/>
|
|
182
|
+
),
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export const ExecuteCode = {
|
|
186
|
+
render: () => (
|
|
187
|
+
<CurrentSessionTimelineStory
|
|
188
|
+
title="Execute code"
|
|
189
|
+
description="Each Code Mode execution lists the tools its script called."
|
|
190
|
+
document={executeCodeDocument}
|
|
191
|
+
width="786px"
|
|
192
|
+
shellToolDefaultOpen
|
|
193
|
+
/>
|
|
194
|
+
),
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export const ExecuteManyCalls = {
|
|
198
|
+
render: () => (
|
|
199
|
+
<CurrentSessionTimelineStory
|
|
200
|
+
title="Execute many calls"
|
|
201
|
+
description="A script that made 75 calls lists its latest 10; the row above them reveals earlier calls 50 at a time."
|
|
202
|
+
document={executeManyCallsDocument}
|
|
203
|
+
width="786px"
|
|
204
|
+
shellToolDefaultOpen
|
|
205
|
+
/>
|
|
206
|
+
),
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export const ExecuteLongDetails = {
|
|
210
|
+
render: () => (
|
|
211
|
+
<CurrentSessionTimelineStory
|
|
212
|
+
title="Execute long details"
|
|
213
|
+
description="A script and output taller than the details dialog scroll inside it and keep the dialog's bottom padding."
|
|
214
|
+
document={executeLongDetailsDocument}
|
|
215
|
+
width="786px"
|
|
216
|
+
shellToolDefaultOpen
|
|
217
|
+
/>
|
|
218
|
+
),
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export const ExecuteGrouped = {
|
|
222
|
+
render: () => (
|
|
223
|
+
<CurrentSessionTimelineStory
|
|
224
|
+
title="Execute grouped"
|
|
225
|
+
description="Executions inside a tool group open by default to the tools their scripts called."
|
|
226
|
+
document={executeCodeDocument}
|
|
227
|
+
width="786px"
|
|
228
|
+
/>
|
|
229
|
+
),
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export const ExecuteFailed = {
|
|
233
|
+
render: () => (
|
|
234
|
+
<CurrentSessionTimelineStory
|
|
235
|
+
title="Execute failed"
|
|
236
|
+
description="Failed Code Mode executions mark the failed call, which expands to show its input and the full error message."
|
|
237
|
+
document={storyDocument([
|
|
238
|
+
storyTool(
|
|
239
|
+
"tool_execute_search",
|
|
240
|
+
"execute",
|
|
241
|
+
"completed",
|
|
242
|
+
{ code: 'const found = search({ namespace: "browser", offset: 20, limit: 30 });\nreturn found;\n' },
|
|
243
|
+
{ output: "[]", metadata: { toolCalls: [] } },
|
|
244
|
+
),
|
|
245
|
+
storyTool(
|
|
246
|
+
"tool_execute_failed_url",
|
|
247
|
+
"execute",
|
|
248
|
+
"completed",
|
|
249
|
+
{
|
|
250
|
+
code: 'const tab = await tools.browser.tabs.open({\n url: "file:///C:/tmp/opencode/throne-of-glass-luke.html",\n focus: true\n});\nconst shot = await tools.browser.screenshot({ tabID: tab.id, fullPage: true });\nreturn { tab, shot };\n',
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
output:
|
|
254
|
+
"Invalid browser URL. Use an HTTP/HTTPS URL or about:blank without embedded credentials. Paths and file:// URLs are not browser URLs; use browser.tabs.open({ path }) to show a local file to the user. The connected server must be able to reach the address; localhost refers to that server.",
|
|
255
|
+
metadata: {
|
|
256
|
+
error: true,
|
|
257
|
+
toolCalls: [
|
|
258
|
+
{
|
|
259
|
+
tool: "browser.tabs.open",
|
|
260
|
+
status: "error",
|
|
261
|
+
input: { url: "file:///C:/tmp/opencode/throne-of-glass-luke.html", focus: true },
|
|
262
|
+
},
|
|
263
|
+
],
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
),
|
|
267
|
+
{
|
|
268
|
+
type: "reasoning",
|
|
269
|
+
text: "## Serving the page\n\nThe browser needs an HTTP URL, so I will serve the file locally.",
|
|
270
|
+
time: { created: STORY_TIME + 150, completed: STORY_TIME + 1_150 },
|
|
271
|
+
},
|
|
272
|
+
storyTool(
|
|
273
|
+
"tool_execute_serve",
|
|
274
|
+
"shell",
|
|
275
|
+
"completed",
|
|
276
|
+
{
|
|
277
|
+
command:
|
|
278
|
+
"bun -e \"Bun.serve({ port: 4399, fetch() { return new Response(Bun.file('C:/tmp/opencode/throne-of-glass-luke.html'), { headers: { 'content-type': 'text/html' } }) } })\"",
|
|
279
|
+
},
|
|
280
|
+
{ output: "", metadata: { exit: 0 } },
|
|
281
|
+
),
|
|
282
|
+
storyTool(
|
|
283
|
+
"tool_execute_failed_screenshot",
|
|
284
|
+
"execute",
|
|
285
|
+
"completed",
|
|
286
|
+
{
|
|
287
|
+
code: 'const tab = await tools.browser.tabs.open({\n url: "http://localhost:4399",\n focus: true\n});\nawait tools.browser.wait({ tabID: tab.id, condition: "load", timeoutMs: 5000 });\nconst shot = await tools.browser.screenshot({ tabID: tab.id, fullPage: true });\nreturn { tab, shot };\n',
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
output:
|
|
291
|
+
"[browser.operation_failed] browser.screenshot failed. A full-page screenshot needs this tab on screen in the Review pane, and it is not shown now. Omit fullPage to capture the viewport, which works while the tab is hidden, and scroll to capture the rest.",
|
|
292
|
+
metadata: {
|
|
293
|
+
error: true,
|
|
294
|
+
toolCalls: [
|
|
295
|
+
{
|
|
296
|
+
tool: "browser.tabs.open",
|
|
297
|
+
status: "completed",
|
|
298
|
+
input: { url: "http://localhost:4399", focus: true },
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
tool: "browser.wait",
|
|
302
|
+
status: "completed",
|
|
303
|
+
input: { tabID: "tab_4f1c", condition: "load", timeoutMs: 5000 },
|
|
304
|
+
},
|
|
305
|
+
{ tool: "browser.screenshot", status: "error", input: { tabID: "tab_4f1c", fullPage: true } },
|
|
306
|
+
],
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
),
|
|
310
|
+
storyTool(
|
|
311
|
+
"tool_execute_list",
|
|
312
|
+
"execute",
|
|
313
|
+
"completed",
|
|
314
|
+
{ code: "const list = await tools.browser.tabs.list();\nreturn list;\n" },
|
|
315
|
+
{ output: "[]", metadata: { toolCalls: [{ tool: "browser.tabs.list", status: "completed" }] } },
|
|
316
|
+
),
|
|
317
|
+
])}
|
|
318
|
+
width="786px"
|
|
319
|
+
/>
|
|
320
|
+
),
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export const TestFailed = {
|
|
324
|
+
render: () => (
|
|
325
|
+
<CurrentSessionTimelineStory
|
|
326
|
+
title="Test failed"
|
|
327
|
+
description="A normal non-zero test result keeps the command and actionable failure message together."
|
|
328
|
+
document={terminalFailedDocument}
|
|
329
|
+
width="720px"
|
|
330
|
+
shellToolDefaultOpen
|
|
331
|
+
/>
|
|
332
|
+
),
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function InteractiveCommandStory(props: {
|
|
336
|
+
expanded?: boolean
|
|
337
|
+
streaming?: boolean
|
|
338
|
+
existingGroup?: boolean
|
|
339
|
+
tool?: "shell" | "execute" | "subagent"
|
|
340
|
+
}) {
|
|
341
|
+
const initialPhase = (): "streaming" | "input" | "running" | "completed" =>
|
|
342
|
+
props.streaming ? "streaming" : "completed"
|
|
343
|
+
|
|
344
|
+
const [state, setState] = createStore({
|
|
345
|
+
phase: initialPhase(),
|
|
346
|
+
started: !props.existingGroup,
|
|
347
|
+
lines: 3,
|
|
348
|
+
sibling: false,
|
|
349
|
+
busy: false,
|
|
350
|
+
})
|
|
351
|
+
|
|
352
|
+
createEffect(() => setState("phase", initialPhase()))
|
|
353
|
+
createEffect(() => setState("started", !props.existingGroup))
|
|
354
|
+
|
|
355
|
+
const document = createMemo(() => {
|
|
356
|
+
const phase = state.phase
|
|
357
|
+
|
|
358
|
+
const options: NonNullable<Parameters<typeof storyTool>[4]> = {
|
|
359
|
+
output:
|
|
360
|
+
phase === "running"
|
|
361
|
+
? "still running"
|
|
362
|
+
: Array.from({ length: state.lines }, (_, index) => `line ${index + 1}`).join("\n"),
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
if (phase === "streaming") options.raw = ""
|
|
366
|
+
|
|
367
|
+
const content: SessionMessageAssistant["content"] = [
|
|
368
|
+
...(props.existingGroup
|
|
369
|
+
? [storyTool("tool_context_lifecycle", "read", "completed", { filePath: "/workspace/README.md" })]
|
|
370
|
+
: []),
|
|
371
|
+
...(state.started
|
|
372
|
+
? [
|
|
373
|
+
storyTool(
|
|
374
|
+
"tool_shell_lifecycle",
|
|
375
|
+
props.tool ?? "shell",
|
|
376
|
+
phase === "input" ? "streaming" : phase,
|
|
377
|
+
phase === "streaming"
|
|
378
|
+
? {}
|
|
379
|
+
: props.tool === "execute"
|
|
380
|
+
? { code: 'console.log("ready")' }
|
|
381
|
+
: props.tool === "subagent"
|
|
382
|
+
? { description: "Inspect lifecycle", agent: "explore", prompt: "Inspect lifecycle" }
|
|
383
|
+
: { command: "printf ready" },
|
|
384
|
+
options,
|
|
385
|
+
),
|
|
386
|
+
]
|
|
387
|
+
: []),
|
|
388
|
+
...(state.sibling ? [{ type: "text" as const, text: "Sibling content" }] : []),
|
|
389
|
+
]
|
|
390
|
+
|
|
391
|
+
return {
|
|
392
|
+
...storyDocument(content, state.started && phase !== "completed"),
|
|
393
|
+
status: { type: (state.started && phase !== "completed") || state.busy ? ("busy" as const) : ("idle" as const) },
|
|
394
|
+
}
|
|
395
|
+
})
|
|
396
|
+
|
|
397
|
+
return (
|
|
398
|
+
<section class="mx-auto flex w-full max-w-[720px] flex-col gap-4 p-6">
|
|
399
|
+
<div class="flex flex-wrap gap-3">
|
|
400
|
+
{props.existingGroup && (
|
|
401
|
+
<button type="button" onClick={() => setState({ started: true, phase: "streaming" })}>
|
|
402
|
+
Start tool
|
|
403
|
+
</button>
|
|
404
|
+
)}
|
|
405
|
+
<button type="button" onClick={() => setState("phase", "input")}>
|
|
406
|
+
Complete input
|
|
407
|
+
</button>
|
|
408
|
+
<button type="button" onClick={() => setState("phase", "running")}>
|
|
409
|
+
Run command
|
|
410
|
+
</button>
|
|
411
|
+
<button type="button" onClick={() => setState("phase", "completed")}>
|
|
412
|
+
Complete command
|
|
413
|
+
</button>
|
|
414
|
+
<button type="button" onClick={() => setState("lines", 6)}>
|
|
415
|
+
Update output
|
|
416
|
+
</button>
|
|
417
|
+
<button type="button" onClick={() => setState("sibling", true)}>
|
|
418
|
+
Append sibling
|
|
419
|
+
</button>
|
|
420
|
+
<button type="button" onClick={() => setState("busy", true)}>
|
|
421
|
+
Mark session busy
|
|
422
|
+
</button>
|
|
423
|
+
<button type="button" onClick={() => setState("busy", false)}>
|
|
424
|
+
Mark session idle
|
|
425
|
+
</button>
|
|
426
|
+
</div>
|
|
427
|
+
<CurrentSessionProviders document={document()}>
|
|
428
|
+
<SessionTimeline document={document()} shellToolDefaultOpen={props.expanded} />
|
|
429
|
+
</CurrentSessionProviders>
|
|
430
|
+
</section>
|
|
431
|
+
)
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
export const TerminalCommands = {
|
|
435
|
+
args: { scenario: "command", expanded: false, streaming: false, existingGroup: false, tool: "shell" },
|
|
436
|
+
argTypes: {
|
|
437
|
+
scenario: { control: "select", options: ["command", "collapsed"] },
|
|
438
|
+
tool: { control: "select", options: ["shell", "execute", "subagent"] },
|
|
439
|
+
},
|
|
440
|
+
render: (args: {
|
|
441
|
+
scenario: string
|
|
442
|
+
expanded: boolean
|
|
443
|
+
streaming: boolean
|
|
444
|
+
existingGroup: boolean
|
|
445
|
+
tool: "shell" | "execute" | "subagent"
|
|
446
|
+
}) => (
|
|
447
|
+
<Show when={args.scenario !== "collapsed"} fallback={<CollapsedShell.render />}>
|
|
448
|
+
<InteractiveCommandStory {...args} />
|
|
449
|
+
</Show>
|
|
450
|
+
),
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
export const FixedAndPassed = {
|
|
454
|
+
render: () => (
|
|
455
|
+
<CurrentSessionTimelineStory
|
|
456
|
+
title="Fixed and passed"
|
|
457
|
+
description="The agent reproduces a failure, makes one correction, and reruns the package checks successfully."
|
|
458
|
+
document={recoveryDocument}
|
|
459
|
+
width="860px"
|
|
460
|
+
editToolDefaultOpen
|
|
461
|
+
shellToolDefaultOpen
|
|
462
|
+
/>
|
|
463
|
+
),
|
|
464
|
+
}
|