@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,280 @@
|
|
|
1
|
+
import type { SessionMessageAssistant, SessionMessageInfo } from "@zyro-sec/client/promise"
|
|
2
|
+
import { untrack } from "solid-js"
|
|
3
|
+
import { timelineNoticeRequired, type TimelineDetail, type TimelinePlacement } from "./detail"
|
|
4
|
+
import { placeFactOf, scriptChangePaths, scriptFilePartID, type Fact, type PlaceFact } from "./facts"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Where each fact shows, under the Timeline detail setting: its category, whether it stands alone, joins a group or
|
|
8
|
+
* hides, and whether it starts open. The two timelines place a few things differently; `timeline` says which asks.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
type Content = SessionMessageAssistant["content"][number]
|
|
12
|
+
|
|
13
|
+
type Tool = Extract<Content, { type: "tool" }>
|
|
14
|
+
|
|
15
|
+
/** What can be placed: a call, a thought or text. Files and outcomes show through the call or notice they belong to. */
|
|
16
|
+
export type Placeable = PlaceFact | { kind: "thought"; id?: string } | { kind: "text"; id?: string }
|
|
17
|
+
|
|
18
|
+
/** Reads what placing a call needs. The projections read it through a signal, so a streamed delta moves nothing. */
|
|
19
|
+
export type PlaceFactOf = (tool: Tool) => PlaceFact
|
|
20
|
+
|
|
21
|
+
export type TimelineKind = "current" | "next"
|
|
22
|
+
|
|
23
|
+
/** The group a fact folds into, or `part` where it stands on its own row. */
|
|
24
|
+
export type PlaceGroup = "part" | "context" | "read" | "file" | "events" | "subagent"
|
|
25
|
+
|
|
26
|
+
export type Place = {
|
|
27
|
+
category?: keyof TimelineDetail
|
|
28
|
+
placement: TimelinePlacement
|
|
29
|
+
group: PlaceGroup
|
|
30
|
+
/** Whether it starts open, where the setting says; undefined leaves it to the row. */
|
|
31
|
+
opens?: boolean
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** The detail setting that shows or hides a fact. */
|
|
35
|
+
export function categoryOf(fact: Fact | Placeable): keyof TimelineDetail | undefined {
|
|
36
|
+
if (fact.kind === "thought") return "thinking"
|
|
37
|
+
|
|
38
|
+
if (fact.kind === "file") return "edit"
|
|
39
|
+
|
|
40
|
+
if (fact.kind === "outcome") return "notices"
|
|
41
|
+
|
|
42
|
+
if (fact.kind !== "call") return
|
|
43
|
+
|
|
44
|
+
if (fact.name === "shell" || fact.name === "execute") return "shell"
|
|
45
|
+
|
|
46
|
+
if (fact.mode === "edit") return "edit"
|
|
47
|
+
|
|
48
|
+
if (fact.name === "subagent") return "subagents"
|
|
49
|
+
|
|
50
|
+
return "tools"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Places each fact, in order. `commentary` marks, by index, the text that reads as commentary between calls. */
|
|
54
|
+
export function place(
|
|
55
|
+
facts: readonly Placeable[],
|
|
56
|
+
detail: TimelineDetail,
|
|
57
|
+
options: { timeline: TimelineKind; commentary?: readonly boolean[] },
|
|
58
|
+
): Place[] {
|
|
59
|
+
return facts.map((fact, index) => placeFact(fact, detail, options.timeline, !!options.commentary?.[index]))
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Places one message part. */
|
|
63
|
+
export function placeContent(
|
|
64
|
+
content: Content,
|
|
65
|
+
detail: TimelineDetail,
|
|
66
|
+
timeline: TimelineKind,
|
|
67
|
+
commentary = false,
|
|
68
|
+
factOf: PlaceFactOf = placeFactOf,
|
|
69
|
+
) {
|
|
70
|
+
return placeFact(placeableOf(content, factOf), detail, timeline, commentary)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Places message parts for one build of the rows, each call once however often it is asked. */
|
|
74
|
+
export function placer(detail: TimelineDetail, timeline: TimelineKind, factOf: PlaceFactOf = placeFactOf) {
|
|
75
|
+
const placed = new Map<Content, Place>()
|
|
76
|
+
|
|
77
|
+
return (content: Content, commentary = false) => {
|
|
78
|
+
if (content.type !== "tool") return placeContent(content, detail, timeline, commentary)
|
|
79
|
+
const known = placed.get(content)
|
|
80
|
+
|
|
81
|
+
if (known) return known
|
|
82
|
+
const result = placeContent(content, detail, timeline, false, factOf)
|
|
83
|
+
placed.set(content, result)
|
|
84
|
+
|
|
85
|
+
return result
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Where a change a script made to a file shows: under the Edits setting, as a direct edit's file does. */
|
|
90
|
+
export function placeScriptChange(detail: TimelineDetail): Place {
|
|
91
|
+
const placement = detail.edit.placement
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
category: "edit",
|
|
95
|
+
placement,
|
|
96
|
+
group: placement === "grouped" ? "context" : "file",
|
|
97
|
+
opens: detail.edit.details === "expanded",
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The changes a finished script made, as items of their own right after it, where edits show. Placement learns the
|
|
103
|
+
* script finished with changes through `factOf`, so a running script's progress never rebuilds the rows.
|
|
104
|
+
*/
|
|
105
|
+
export function scriptChangeItems(
|
|
106
|
+
messageID: string,
|
|
107
|
+
messageIndex: number,
|
|
108
|
+
content: Content,
|
|
109
|
+
detail?: TimelineDetail,
|
|
110
|
+
factOf: PlaceFactOf = placeFactOf,
|
|
111
|
+
) {
|
|
112
|
+
if (!detail || detail.edit.placement === "hidden" || content.type !== "tool" || content.name !== "execute") return []
|
|
113
|
+
|
|
114
|
+
if (factOf(content).changes === 0) return []
|
|
115
|
+
|
|
116
|
+
// Changes only append, so their count says when the paths change and a progress report that adds none moves nothing.
|
|
117
|
+
return untrack(() => scriptChangePaths(content)).map((path, index) => ({
|
|
118
|
+
messageID,
|
|
119
|
+
messageIndex,
|
|
120
|
+
partID: scriptFilePartID(content.id, index, path),
|
|
121
|
+
content,
|
|
122
|
+
script: true as const,
|
|
123
|
+
}))
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function placeableOf(content: Content, factOf: PlaceFactOf): Placeable {
|
|
127
|
+
if (content.type === "tool") return factOf(content)
|
|
128
|
+
|
|
129
|
+
return { kind: content.type === "reasoning" ? "thought" : "text" }
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function placeFact(fact: Placeable, detail: TimelineDetail, timeline: TimelineKind, commentary: boolean): Place {
|
|
133
|
+
const category = categoryOf(fact)
|
|
134
|
+
|
|
135
|
+
if (fact.kind === "text") {
|
|
136
|
+
if (!commentary) return { placement: "separate", group: "part", opens: timeline === "next" ? false : undefined }
|
|
137
|
+
const placement = detail.commentary.placement
|
|
138
|
+
|
|
139
|
+
return {
|
|
140
|
+
category: "commentary",
|
|
141
|
+
placement,
|
|
142
|
+
group: placement === "separate" ? "part" : "context",
|
|
143
|
+
opens: timeline === "next" ? false : undefined,
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (fact.kind === "thought") {
|
|
148
|
+
const placement = detail.thinking.placement
|
|
149
|
+
const opens = timeline === "next" ? false : detail.thinking.details === "expanded"
|
|
150
|
+
|
|
151
|
+
return { category, placement, group: placement === "grouped" ? "context" : "part", opens }
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (!category) return { category, placement: "hidden", group: "part" }
|
|
155
|
+
|
|
156
|
+
const setting = detail[category].placement
|
|
157
|
+
const settled = fact.status !== "streaming" && fact.status !== "running"
|
|
158
|
+
|
|
159
|
+
if (timeline === "current") {
|
|
160
|
+
// The current timeline reads a call's own name, so v1 commands and patches keep their old rows.
|
|
161
|
+
const failed = fact.status === "error" || (fact.failed && fact.tool !== "bash")
|
|
162
|
+
const shows = failed || (fact.tool !== "todowrite" && (fact.tool === "question" ? settled : setting !== "hidden"))
|
|
163
|
+
|
|
164
|
+
const group: PlaceGroup =
|
|
165
|
+
fact.tool === "question" && !failed
|
|
166
|
+
? "part"
|
|
167
|
+
: setting === "grouped"
|
|
168
|
+
? "context"
|
|
169
|
+
: fact.groupedRead
|
|
170
|
+
? "read"
|
|
171
|
+
: failed
|
|
172
|
+
? "part"
|
|
173
|
+
: ["patch", "edit", "write"].includes(fact.tool)
|
|
174
|
+
? "file"
|
|
175
|
+
: "part"
|
|
176
|
+
|
|
177
|
+
const opens =
|
|
178
|
+
fact.tool === "execute" || (setting === "hidden" && failed)
|
|
179
|
+
? true
|
|
180
|
+
: category === "shell" || category === "edit"
|
|
181
|
+
? detail[category].details === "expanded"
|
|
182
|
+
: fact.status === "error"
|
|
183
|
+
? false
|
|
184
|
+
: undefined
|
|
185
|
+
|
|
186
|
+
return { category, placement: shows ? (group === "context" ? "grouped" : "separate") : "hidden", group, opens }
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// A call stopped before the model finished writing it did nothing.
|
|
190
|
+
const shows =
|
|
191
|
+
fact.name !== "todowrite" &&
|
|
192
|
+
!(fact.stopped && !fact.called) &&
|
|
193
|
+
(fact.name === "question" ? settled : setting !== "hidden")
|
|
194
|
+
|
|
195
|
+
const group: PlaceGroup =
|
|
196
|
+
category === "subagents"
|
|
197
|
+
? "subagent"
|
|
198
|
+
: fact.background
|
|
199
|
+
? setting === "grouped" && !fact.failed
|
|
200
|
+
? "context"
|
|
201
|
+
: "events"
|
|
202
|
+
: fact.name === "question" && !fact.failed
|
|
203
|
+
? "part"
|
|
204
|
+
: setting === "grouped"
|
|
205
|
+
? "context"
|
|
206
|
+
: fact.groupedRead
|
|
207
|
+
? "read"
|
|
208
|
+
: fact.failed
|
|
209
|
+
? "part"
|
|
210
|
+
: fact.mode === "edit"
|
|
211
|
+
? "file"
|
|
212
|
+
: "part"
|
|
213
|
+
|
|
214
|
+
// A file shows its name and changes, closed; a stopped call shows as one that ran, so it opens as one would.
|
|
215
|
+
const opens =
|
|
216
|
+
fact.mode === "edit" && (fact.status !== "error" || fact.stopped)
|
|
217
|
+
? false
|
|
218
|
+
: category === "shell" || category === "edit"
|
|
219
|
+
? detail[category].details === "expanded"
|
|
220
|
+
: false
|
|
221
|
+
|
|
222
|
+
return { category, placement: shows ? (group === "context" ? "grouped" : "separate") : "hidden", group, opens }
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** Whether a file's diff starts open, where edits show in detail. */
|
|
226
|
+
export function diffOpens(detail: TimelineDetail) {
|
|
227
|
+
return detail.edit.details === "expanded"
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** Whether the setting hides all of the agent's activity, as Messages only does. */
|
|
231
|
+
export function hidesActivity(detail: TimelineDetail) {
|
|
232
|
+
return (["shell", "edit", "thinking", "subagents", "tools"] as const).every(
|
|
233
|
+
(category) => detail[category].placement === "hidden",
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Where a notice shows. What background work reports stands on its own, so it shows where it finished. Where its
|
|
239
|
+
* setting hides it, a notice that needs attention still shows. In the New timeline, a shell's report follows the shell
|
|
240
|
+
* setting, and what changed the session always stands on its own.
|
|
241
|
+
*/
|
|
242
|
+
export function placeNotice(
|
|
243
|
+
message: SessionMessageInfo,
|
|
244
|
+
detail: TimelineDetail,
|
|
245
|
+
timeline: TimelineKind,
|
|
246
|
+
): TimelinePlacement {
|
|
247
|
+
if (timeline === "next" && sessionEvent(message)) return "separate"
|
|
248
|
+
const source = message.type === "synthetic" ? message.metadata?.source : undefined
|
|
249
|
+
|
|
250
|
+
const placement =
|
|
251
|
+
source === "subagent"
|
|
252
|
+
? detail.subagents.placement
|
|
253
|
+
: source === "shell" && timeline === "next"
|
|
254
|
+
? detail.shell.placement
|
|
255
|
+
: detail.notices.placement
|
|
256
|
+
|
|
257
|
+
if (placement === "hidden") return timelineNoticeRequired(message) ? "separate" : "hidden"
|
|
258
|
+
|
|
259
|
+
return source === "subagent" || source === "shell" ? "separate" : placement
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** What the user did and what changed the session: a goal, a switch of agent, model or place, and a compaction. */
|
|
263
|
+
export function sessionEvent(message: SessionMessageInfo) {
|
|
264
|
+
if (
|
|
265
|
+
message.type === "agent-switched" ||
|
|
266
|
+
message.type === "model-switched" ||
|
|
267
|
+
message.type === "location-switched" ||
|
|
268
|
+
message.type === "compaction"
|
|
269
|
+
)
|
|
270
|
+
return true
|
|
271
|
+
|
|
272
|
+
return goal(message)
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** A goal the user set, which reads as their own message. */
|
|
276
|
+
export function goal(
|
|
277
|
+
message: SessionMessageInfo | undefined,
|
|
278
|
+
): message is Extract<SessionMessageInfo, { type: "synthetic" }> {
|
|
279
|
+
return message?.type === "synthetic" && message.metadata?.source === "goal"
|
|
280
|
+
}
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import type { JsonValue, SessionMessageAssistant, SessionMessageInfo } from "@zyro-sec/client/promise"
|
|
2
|
+
import { storyTool } from "../storybook/current-session-scenarios"
|
|
3
|
+
import { timelinePresets, type TimelineDetail } from "./detail"
|
|
4
|
+
|
|
5
|
+
// Turns and settings whose projected rows the placement tests pin for both timelines.
|
|
6
|
+
|
|
7
|
+
const assistant = (
|
|
8
|
+
id: string,
|
|
9
|
+
created: number,
|
|
10
|
+
content: SessionMessageAssistant["content"],
|
|
11
|
+
): SessionMessageAssistant => ({
|
|
12
|
+
id,
|
|
13
|
+
type: "assistant",
|
|
14
|
+
agent: "build",
|
|
15
|
+
model: { id: "model", providerID: "provider" },
|
|
16
|
+
content,
|
|
17
|
+
time: { created, completed: created },
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const text = (value: string) => ({ type: "text" as const, text: value })
|
|
21
|
+
|
|
22
|
+
const thought = (value: string) => ({ type: "reasoning" as const, text: value, time: { created: 1, completed: 2 } })
|
|
23
|
+
|
|
24
|
+
const stopped = (
|
|
25
|
+
id: string,
|
|
26
|
+
name: string,
|
|
27
|
+
input: Record<string, string | boolean>,
|
|
28
|
+
error = { type: "aborted", message: "Tool execution interrupted" },
|
|
29
|
+
): SessionMessageAssistant["content"][number] => ({
|
|
30
|
+
...storyTool(id, name, "error", input),
|
|
31
|
+
state: { status: "error", input, error, metadata: {} },
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const notice = (id: string, created: number, description: string, metadata: Record<string, JsonValue>) =>
|
|
35
|
+
({ id, type: "synthetic", text: description, description, metadata, time: { created } }) satisfies SessionMessageInfo
|
|
36
|
+
|
|
37
|
+
export const placementMessages: SessionMessageInfo[] = [
|
|
38
|
+
{ id: "msg_u1", type: "user", text: "explore and edit", time: { created: 1 } },
|
|
39
|
+
assistant("msg_a1", 2, [
|
|
40
|
+
thought("Looking around"),
|
|
41
|
+
text("Let me look first."),
|
|
42
|
+
storyTool("read_1", "read", "completed", { path: "/repo/a.ts" }),
|
|
43
|
+
storyTool("read_2", "read", "completed", { path: "/repo/b.ts" }),
|
|
44
|
+
storyTool("read_img", "read", "completed", { path: "/repo/logo.png" }),
|
|
45
|
+
storyTool("grep_1", "grep", "completed", { pattern: "x" }),
|
|
46
|
+
storyTool("glob_1", "glob", "completed", { pattern: "*.ts" }),
|
|
47
|
+
storyTool("fetch_1", "webfetch", "completed", { url: "https://a.dev" }),
|
|
48
|
+
storyTool("search_1", "websearch", "completed", { query: "q" }),
|
|
49
|
+
storyTool("skill_1", "skill", "completed", { name: "review" }),
|
|
50
|
+
text("Now editing."),
|
|
51
|
+
storyTool("edit_1", "edit", "completed", { path: "/repo/a.ts" }, { metadata: { files: [{ file: "/repo/a.ts" }] } }),
|
|
52
|
+
storyTool("write_1", "write", "completed", { path: "/repo/c.ts", content: "c" }),
|
|
53
|
+
storyTool(
|
|
54
|
+
"patch_1",
|
|
55
|
+
"patch",
|
|
56
|
+
"completed",
|
|
57
|
+
{},
|
|
58
|
+
{ metadata: { files: [{ file: "/repo/d.ts", status: "deleted" }] } },
|
|
59
|
+
),
|
|
60
|
+
storyTool("edit_err", "edit", "error", { path: "/repo/e.ts" }),
|
|
61
|
+
storyTool("todo_1", "todowrite", "completed", { todos: [] }),
|
|
62
|
+
text("Done editing, here is the answer."),
|
|
63
|
+
]),
|
|
64
|
+
{ id: "msg_u2", type: "user", text: "run things", time: { created: 10 } },
|
|
65
|
+
assistant("msg_a2", 11, [
|
|
66
|
+
storyTool("shell_1", "shell", "completed", { command: "ls" }, { metadata: { exit: 0 } }),
|
|
67
|
+
storyTool("shell_fail", "shell", "completed", { command: "false" }, { metadata: { exit: 1 } }),
|
|
68
|
+
storyTool(
|
|
69
|
+
"shell_bg",
|
|
70
|
+
"shell",
|
|
71
|
+
"completed",
|
|
72
|
+
{ command: "sleep 5", background: true },
|
|
73
|
+
{
|
|
74
|
+
metadata: { shellID: "sh_1", status: "running" },
|
|
75
|
+
},
|
|
76
|
+
),
|
|
77
|
+
storyTool(
|
|
78
|
+
"sub_1",
|
|
79
|
+
"subagent",
|
|
80
|
+
"completed",
|
|
81
|
+
{ description: "look around", agent: "explore" },
|
|
82
|
+
{
|
|
83
|
+
metadata: { sessionID: "ses_child", status: "running" },
|
|
84
|
+
},
|
|
85
|
+
),
|
|
86
|
+
storyTool("exec_1", "execute", "completed", { code: "1" }),
|
|
87
|
+
storyTool("question_1", "question", "completed", { questions: [] }),
|
|
88
|
+
storyTool("custom_1", "custom_tool", "completed", {}),
|
|
89
|
+
storyTool("custom_err", "custom_tool", "error", {}),
|
|
90
|
+
]),
|
|
91
|
+
{
|
|
92
|
+
id: "msg_n_shell",
|
|
93
|
+
type: "synthetic",
|
|
94
|
+
text: "Shell sleep 5 completed",
|
|
95
|
+
description: "sleep 5",
|
|
96
|
+
metadata: { source: "shell", shellID: "sh_1", state: "completed" },
|
|
97
|
+
time: { created: 12 },
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "msg_n_sub",
|
|
101
|
+
type: "synthetic",
|
|
102
|
+
text: "result",
|
|
103
|
+
description: "look around",
|
|
104
|
+
metadata: { source: "subagent", agent: "explore", childID: "ses_child", state: "completed" },
|
|
105
|
+
time: { created: 13 },
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: "msg_n_plain",
|
|
109
|
+
type: "synthetic",
|
|
110
|
+
text: "Instructions updated",
|
|
111
|
+
description: "Instructions updated",
|
|
112
|
+
time: { created: 14 },
|
|
113
|
+
},
|
|
114
|
+
assistant("msg_a3", 15, [text("All done.")]),
|
|
115
|
+
{ id: "msg_u3", type: "user", text: "v1 tools", time: { created: 20 } },
|
|
116
|
+
assistant("msg_a4", 21, [
|
|
117
|
+
storyTool("bash_1", "bash", "completed", { command: "ls" }, { metadata: { exit: 1 } }),
|
|
118
|
+
storyTool(
|
|
119
|
+
"task_1",
|
|
120
|
+
"task",
|
|
121
|
+
"completed",
|
|
122
|
+
{ description: "old task", subagent_type: "general" },
|
|
123
|
+
{
|
|
124
|
+
metadata: { sessionID: "ses_old", status: "completed" },
|
|
125
|
+
},
|
|
126
|
+
),
|
|
127
|
+
storyTool("apply_1", "apply_patch", "completed", {}, { metadata: { files: [{ file: "/repo/z.ts" }] } }),
|
|
128
|
+
text("Old tools done."),
|
|
129
|
+
]),
|
|
130
|
+
{
|
|
131
|
+
id: "msg_shell",
|
|
132
|
+
type: "shell",
|
|
133
|
+
shellID: "shell_user",
|
|
134
|
+
command: "pwd",
|
|
135
|
+
status: "exited",
|
|
136
|
+
exit: 0,
|
|
137
|
+
output: { output: "/repo", cursor: 5, size: 5, truncated: false },
|
|
138
|
+
time: { created: 30, completed: 31 },
|
|
139
|
+
},
|
|
140
|
+
{ id: "msg_u5", type: "user", text: "background in a group", time: { created: 40 } },
|
|
141
|
+
assistant("msg_a5", 41, [
|
|
142
|
+
storyTool("read_5", "read", "completed", { path: "/repo/f.ts" }),
|
|
143
|
+
storyTool(
|
|
144
|
+
"shell_bg_2",
|
|
145
|
+
"shell",
|
|
146
|
+
"completed",
|
|
147
|
+
{ command: "make build", background: true },
|
|
148
|
+
{ metadata: { shellID: "sh_2", status: "running" } },
|
|
149
|
+
),
|
|
150
|
+
]),
|
|
151
|
+
notice("msg_n_shell_2", 42, "make build", { source: "shell", shellID: "sh_2", state: "completed", exit: 0 }),
|
|
152
|
+
assistant("msg_a5b", 43, [text("Built.")]),
|
|
153
|
+
{ id: "msg_u6", type: "user", text: "stopped calls", time: { created: 50 } },
|
|
154
|
+
assistant("msg_a6", 51, [
|
|
155
|
+
stopped("stop_empty", "shell", {}),
|
|
156
|
+
stopped("stop_filled", "shell", { command: "git push" }),
|
|
157
|
+
stopped("cancel_filled", "shell", { command: "npm test" }, { type: "unknown", message: "Command cancelled" }),
|
|
158
|
+
stopped("cancel_empty", "shell", {}, { type: "unknown", message: "Command cancelled" }),
|
|
159
|
+
stopped("stop_edit", "edit", { path: "/repo/g.ts" }),
|
|
160
|
+
stopped("stop_custom", "custom_tool", {}),
|
|
161
|
+
text("Stopped."),
|
|
162
|
+
]),
|
|
163
|
+
{ id: "msg_u7", type: "user", text: "failures", time: { created: 60 } },
|
|
164
|
+
assistant("msg_a7", 61, [
|
|
165
|
+
storyTool("exec_err", "execute", "completed", { code: "x" }, { metadata: { error: true } }),
|
|
166
|
+
storyTool(
|
|
167
|
+
"exec_calls",
|
|
168
|
+
"execute",
|
|
169
|
+
"completed",
|
|
170
|
+
{ code: "y" },
|
|
171
|
+
{ metadata: { toolCalls: [{ tool: "read", status: "error" }] } },
|
|
172
|
+
),
|
|
173
|
+
storyTool(
|
|
174
|
+
"read_loaded",
|
|
175
|
+
"read",
|
|
176
|
+
"completed",
|
|
177
|
+
{ path: "/repo/h.ts" },
|
|
178
|
+
{ metadata: { loaded: ["/repo/AGENTS.md"] } },
|
|
179
|
+
),
|
|
180
|
+
thought("Weighing it"),
|
|
181
|
+
storyTool("shell_timeout", "shell", "completed", { command: "sleep 99" }, { metadata: { timeout: true } }),
|
|
182
|
+
text("Some failed."),
|
|
183
|
+
]),
|
|
184
|
+
notice("msg_n_error", 62, "Background job failed", { state: "error" }),
|
|
185
|
+
notice("msg_n_exit", 63, "make lint", { source: "shell", shellID: "sh_9", state: "completed", exit: 2 }),
|
|
186
|
+
notice("msg_n_timeout", 64, "make slow", { source: "shell", shellID: "sh_8", state: "completed", timeout: true }),
|
|
187
|
+
{
|
|
188
|
+
id: "msg_shell_fail",
|
|
189
|
+
type: "shell",
|
|
190
|
+
shellID: "shell_user_fail",
|
|
191
|
+
command: "false",
|
|
192
|
+
status: "exited",
|
|
193
|
+
exit: 1,
|
|
194
|
+
output: { output: "", cursor: 0, size: 0, truncated: false },
|
|
195
|
+
time: { created: 70, completed: 71 },
|
|
196
|
+
},
|
|
197
|
+
{ id: "msg_u8", type: "user", text: "session events", time: { created: 80 } },
|
|
198
|
+
{ id: "msg_agent", type: "agent-switched", agent: "explore", time: { created: 81 } },
|
|
199
|
+
{ id: "msg_model", type: "model-switched", model: { id: "next", providerID: "provider" }, time: { created: 82 } },
|
|
200
|
+
{
|
|
201
|
+
id: "msg_moved",
|
|
202
|
+
type: "location-switched",
|
|
203
|
+
location: { directory: "/repo-worktree" },
|
|
204
|
+
previous: { location: { directory: "/repo" } },
|
|
205
|
+
time: { created: 83 },
|
|
206
|
+
},
|
|
207
|
+
notice("msg_goal", 84, "Ship it", { source: "goal" }),
|
|
208
|
+
{
|
|
209
|
+
id: "msg_compacted",
|
|
210
|
+
type: "compaction",
|
|
211
|
+
status: "completed",
|
|
212
|
+
reason: "auto",
|
|
213
|
+
summary: "summary",
|
|
214
|
+
time: { created: 85 },
|
|
215
|
+
},
|
|
216
|
+
assistant("msg_a8", 86, [text("Switched.")]),
|
|
217
|
+
{ id: "msg_u9", type: "user", text: "compaction trouble", time: { created: 90 } },
|
|
218
|
+
{
|
|
219
|
+
id: "msg_compact_run",
|
|
220
|
+
type: "compaction",
|
|
221
|
+
status: "running",
|
|
222
|
+
reason: "manual",
|
|
223
|
+
summary: "",
|
|
224
|
+
time: { created: 91 },
|
|
225
|
+
},
|
|
226
|
+
{ id: "msg_u10", type: "user", text: "v1 failures", time: { created: 100 } },
|
|
227
|
+
assistant("msg_a10", 101, [
|
|
228
|
+
storyTool("bash_err", "bash", "error", { command: "make" }),
|
|
229
|
+
storyTool(
|
|
230
|
+
"bash_bg",
|
|
231
|
+
"bash",
|
|
232
|
+
"completed",
|
|
233
|
+
{ command: "serve", background: true },
|
|
234
|
+
{ metadata: { shellID: "sh_v1", status: "running" } },
|
|
235
|
+
),
|
|
236
|
+
storyTool("task_err", "task", "error", { description: "old failed", subagent_type: "general" }),
|
|
237
|
+
storyTool("apply_err", "apply_patch", "error", {}),
|
|
238
|
+
text("Old failures."),
|
|
239
|
+
]),
|
|
240
|
+
{ id: "msg_u11", type: "user", text: "streaming", time: { created: 110 } },
|
|
241
|
+
{
|
|
242
|
+
id: "msg_a11",
|
|
243
|
+
type: "assistant",
|
|
244
|
+
agent: "build",
|
|
245
|
+
model: { id: "model", providerID: "provider" },
|
|
246
|
+
time: { created: 111 },
|
|
247
|
+
content: [
|
|
248
|
+
storyTool("write_stream", "write", "streaming", {}, { raw: '{"path":"/repo/i.ts","content":"i' }),
|
|
249
|
+
storyTool("edit_stream", "edit", "streaming", {}, { raw: '{"path":"/repo/j.ts"' }),
|
|
250
|
+
storyTool("read_stream", "read", "streaming", {}, { raw: '{"path":"/repo/k.png"' }),
|
|
251
|
+
storyTool("shell_stream", "shell", "streaming", {}, { raw: '{"command":"ls","background":tr' }),
|
|
252
|
+
storyTool("exec_run", "execute", "running", { code: "z" }, { metadata: { toolCalls: [] } }),
|
|
253
|
+
storyTool("shell_run", "shell", "running", { command: "make" }, { output: "building" }),
|
|
254
|
+
storyTool("sub_run", "subagent", "running", { description: "dig", agent: "explore" }, { metadata: {} }),
|
|
255
|
+
storyTool("question_run", "question", "running", { questions: [] }),
|
|
256
|
+
{ type: "reasoning", text: "Still thinking", time: { created: 112 } },
|
|
257
|
+
],
|
|
258
|
+
},
|
|
259
|
+
{ id: "msg_u12", type: "user", text: "script edits", time: { created: 120 } },
|
|
260
|
+
{
|
|
261
|
+
id: "msg_a12",
|
|
262
|
+
type: "assistant",
|
|
263
|
+
agent: "build",
|
|
264
|
+
model: { id: "model", providerID: "provider" },
|
|
265
|
+
time: { created: 121, completed: 121 },
|
|
266
|
+
content: [
|
|
267
|
+
storyTool(
|
|
268
|
+
"exec_files",
|
|
269
|
+
"execute",
|
|
270
|
+
"completed",
|
|
271
|
+
{ code: "await edit()" },
|
|
272
|
+
{
|
|
273
|
+
metadata: {
|
|
274
|
+
toolCalls: [],
|
|
275
|
+
files: [
|
|
276
|
+
{
|
|
277
|
+
file: "/repo/merged.ts",
|
|
278
|
+
status: "modified",
|
|
279
|
+
additions: 1,
|
|
280
|
+
deletions: 1,
|
|
281
|
+
patch: "--- a/repo/merged.ts\n+++ b/repo/merged.ts\n@@ -1 +1 @@\n-a\n+b\n",
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
file: "/repo/merged.ts",
|
|
285
|
+
status: "modified",
|
|
286
|
+
additions: 2,
|
|
287
|
+
deletions: 0,
|
|
288
|
+
patch: "--- a/repo/merged.ts\n+++ b/repo/merged.ts\n@@ -1 +1,3 @@\n b\n+c\n+d\n",
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
file: "/repo/created.ts",
|
|
292
|
+
status: "added",
|
|
293
|
+
additions: 1,
|
|
294
|
+
deletions: 0,
|
|
295
|
+
patch: "--- /dev/null\n+++ b/repo/created.ts\n@@ -0,0 +1 @@\n+new\n",
|
|
296
|
+
},
|
|
297
|
+
{ file: "/repo/removed.bin", status: "deleted" },
|
|
298
|
+
],
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
),
|
|
302
|
+
storyTool("patch_2", "patch", "completed", {}, { metadata: { files: [{ file: "/repo/direct.ts" }] } }),
|
|
303
|
+
{ type: "text", text: "Script done." },
|
|
304
|
+
],
|
|
305
|
+
},
|
|
306
|
+
{ id: "msg_u13", type: "user", text: "live script edits", time: { created: 130 } },
|
|
307
|
+
{
|
|
308
|
+
id: "msg_a13",
|
|
309
|
+
type: "assistant",
|
|
310
|
+
agent: "build",
|
|
311
|
+
model: { id: "model", providerID: "provider" },
|
|
312
|
+
time: { created: 131 },
|
|
313
|
+
content: [
|
|
314
|
+
storyTool(
|
|
315
|
+
"exec_live",
|
|
316
|
+
"execute",
|
|
317
|
+
"running",
|
|
318
|
+
{ code: "await patch(); await write()" },
|
|
319
|
+
{
|
|
320
|
+
metadata: {
|
|
321
|
+
background: true,
|
|
322
|
+
toolCalls: [{ tool: "patch", status: "completed" }],
|
|
323
|
+
files: [
|
|
324
|
+
{
|
|
325
|
+
file: "/repo/live.ts",
|
|
326
|
+
status: "modified",
|
|
327
|
+
additions: 1,
|
|
328
|
+
deletions: 1,
|
|
329
|
+
patch: "--- a/repo/live.ts\n+++ b/repo/live.ts\n@@ -1 +1 @@\n-a\n+b\n",
|
|
330
|
+
},
|
|
331
|
+
],
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
),
|
|
335
|
+
],
|
|
336
|
+
},
|
|
337
|
+
]
|
|
338
|
+
|
|
339
|
+
const preset = (id: string): TimelineDetail => timelinePresets.find((item) => item.id === id)!.value
|
|
340
|
+
|
|
341
|
+
export const placementDetails = {
|
|
342
|
+
...Object.fromEntries(timelinePresets.map((item): [string, TimelineDetail] => [item.id, item.value])),
|
|
343
|
+
"edits grouped and collapsed": { ...preset("detailed"), edit: { placement: "grouped", details: "collapsed" } },
|
|
344
|
+
"edits collapsed": { ...preset("everything"), edit: { placement: "separate", details: "collapsed" } },
|
|
345
|
+
"commentary grouped": { ...preset("detailed"), commentary: { placement: "grouped" } },
|
|
346
|
+
"commentary hidden": { ...preset("compact"), commentary: { placement: "hidden" } },
|
|
347
|
+
"thinking grouped and expanded": { ...preset("detailed"), thinking: { placement: "grouped", details: "expanded" } },
|
|
348
|
+
"notices and subagents hidden": {
|
|
349
|
+
...preset("detailed"),
|
|
350
|
+
notices: { placement: "hidden" },
|
|
351
|
+
subagents: { placement: "hidden" },
|
|
352
|
+
},
|
|
353
|
+
"shell and tools hidden": {
|
|
354
|
+
...preset("detailed"),
|
|
355
|
+
shell: { placement: "hidden", details: "collapsed" },
|
|
356
|
+
tools: { placement: "hidden" },
|
|
357
|
+
},
|
|
358
|
+
} satisfies Record<string, TimelineDetail>
|
|
359
|
+
|
|
360
|
+
/** How the placement tests mark a part that starts open (`*`) or closed (`-`); unmarked, the row decides. */
|
|
361
|
+
export function openMark(open: boolean | undefined) {
|
|
362
|
+
if (open === undefined) return ""
|
|
363
|
+
|
|
364
|
+
return open ? "*" : "-"
|
|
365
|
+
}
|