@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,1492 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
FileDiffInfo,
|
|
3
|
+
FormInfo,
|
|
4
|
+
JsonValue,
|
|
5
|
+
ModelRef,
|
|
6
|
+
PermissionRequest,
|
|
7
|
+
SessionMessageAssistant,
|
|
8
|
+
SessionMessageAssistantTool,
|
|
9
|
+
SessionMessageInfo,
|
|
10
|
+
SessionMessageUser,
|
|
11
|
+
SessionStatus,
|
|
12
|
+
} from "@zyro-sec/client/promise"
|
|
13
|
+
import type { SessionDocument } from "../document"
|
|
14
|
+
import type { SessionUserPresentation } from "../timeline/session-timeline"
|
|
15
|
+
|
|
16
|
+
export const CURRENT_SESSION_ID = "session_current_story"
|
|
17
|
+
|
|
18
|
+
export const STORY_TIME = 1_735_689_600_000
|
|
19
|
+
|
|
20
|
+
export const STORY_MODEL = {
|
|
21
|
+
id: "claude-sonnet-4",
|
|
22
|
+
providerID: "anthropic",
|
|
23
|
+
variant: "balanced",
|
|
24
|
+
} satisfies ModelRef
|
|
25
|
+
|
|
26
|
+
function user(id: string, text: string, offset: number): SessionMessageUser {
|
|
27
|
+
return {
|
|
28
|
+
id,
|
|
29
|
+
type: "user",
|
|
30
|
+
text,
|
|
31
|
+
time: { created: STORY_TIME + offset },
|
|
32
|
+
metadata: { agent: "build", model: STORY_MODEL },
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function assistant(input: {
|
|
37
|
+
id: string
|
|
38
|
+
offset: number
|
|
39
|
+
content: SessionMessageAssistant["content"]
|
|
40
|
+
completed?: number
|
|
41
|
+
error?: SessionMessageAssistant["error"]
|
|
42
|
+
retry?: SessionMessageAssistant["retry"]
|
|
43
|
+
agent?: string
|
|
44
|
+
}): SessionMessageAssistant {
|
|
45
|
+
return {
|
|
46
|
+
id: input.id,
|
|
47
|
+
type: "assistant",
|
|
48
|
+
agent: input.agent ?? "build",
|
|
49
|
+
model: STORY_MODEL,
|
|
50
|
+
content: input.content,
|
|
51
|
+
error: input.error,
|
|
52
|
+
retry: input.retry,
|
|
53
|
+
time: {
|
|
54
|
+
created: STORY_TIME + input.offset,
|
|
55
|
+
completed: input.completed === undefined ? undefined : STORY_TIME + input.completed,
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function completedTool(input: {
|
|
61
|
+
id: string
|
|
62
|
+
name: string
|
|
63
|
+
offset: number
|
|
64
|
+
args: Record<string, JsonValue>
|
|
65
|
+
output: string
|
|
66
|
+
metadata?: Record<string, JsonValue>
|
|
67
|
+
}): SessionMessageAssistantTool {
|
|
68
|
+
return {
|
|
69
|
+
type: "tool",
|
|
70
|
+
id: input.id,
|
|
71
|
+
name: input.name,
|
|
72
|
+
state: {
|
|
73
|
+
status: "completed",
|
|
74
|
+
input: input.args,
|
|
75
|
+
content: [{ type: "text", text: input.output }],
|
|
76
|
+
metadata: input.metadata,
|
|
77
|
+
},
|
|
78
|
+
time: {
|
|
79
|
+
created: STORY_TIME + input.offset,
|
|
80
|
+
ran: STORY_TIME + input.offset + 100,
|
|
81
|
+
completed: STORY_TIME + input.offset + 900,
|
|
82
|
+
},
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function runningTool(input: {
|
|
87
|
+
id: string
|
|
88
|
+
name: string
|
|
89
|
+
offset: number
|
|
90
|
+
args: Record<string, JsonValue>
|
|
91
|
+
output?: string
|
|
92
|
+
metadata?: Record<string, JsonValue>
|
|
93
|
+
}): SessionMessageAssistantTool {
|
|
94
|
+
const metadata = { ...input.metadata }
|
|
95
|
+
|
|
96
|
+
if (input.output !== undefined) metadata.output = input.output
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
type: "tool",
|
|
100
|
+
id: input.id,
|
|
101
|
+
name: input.name,
|
|
102
|
+
state: {
|
|
103
|
+
status: "running",
|
|
104
|
+
input: input.args,
|
|
105
|
+
metadata,
|
|
106
|
+
},
|
|
107
|
+
time: { created: STORY_TIME + input.offset, ran: STORY_TIME + input.offset + 100 },
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function streamingTool(input: { id: string; name: string; offset: number; args: Record<string, JsonValue> }) {
|
|
112
|
+
return {
|
|
113
|
+
type: "tool",
|
|
114
|
+
id: input.id,
|
|
115
|
+
name: input.name,
|
|
116
|
+
state: {
|
|
117
|
+
status: "streaming",
|
|
118
|
+
input: JSON.stringify(input.args),
|
|
119
|
+
},
|
|
120
|
+
time: { created: STORY_TIME + input.offset },
|
|
121
|
+
} satisfies SessionMessageAssistantTool
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function failedTool(input: {
|
|
125
|
+
id: string
|
|
126
|
+
name: string
|
|
127
|
+
offset: number
|
|
128
|
+
args: Record<string, JsonValue>
|
|
129
|
+
message: string
|
|
130
|
+
metadata?: Record<string, JsonValue>
|
|
131
|
+
}): SessionMessageAssistantTool {
|
|
132
|
+
return {
|
|
133
|
+
type: "tool",
|
|
134
|
+
id: input.id,
|
|
135
|
+
name: input.name,
|
|
136
|
+
state: {
|
|
137
|
+
status: "error",
|
|
138
|
+
input: input.args,
|
|
139
|
+
error: { type: "ToolExecutionError", message: input.message },
|
|
140
|
+
metadata: input.metadata,
|
|
141
|
+
},
|
|
142
|
+
time: {
|
|
143
|
+
created: STORY_TIME + input.offset,
|
|
144
|
+
ran: STORY_TIME + input.offset + 100,
|
|
145
|
+
completed: STORY_TIME + input.offset + 700,
|
|
146
|
+
},
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function document(messages: SessionMessageInfo[], status: SessionStatus = { type: "idle" }): SessionDocument {
|
|
151
|
+
return {
|
|
152
|
+
sessionID: CURRENT_SESSION_ID,
|
|
153
|
+
messages,
|
|
154
|
+
status,
|
|
155
|
+
diffs: [],
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export const emptySessionDocument = {
|
|
160
|
+
sessionID: CURRENT_SESSION_ID,
|
|
161
|
+
messages: [],
|
|
162
|
+
status: { type: "idle" },
|
|
163
|
+
diffs: [],
|
|
164
|
+
} satisfies SessionDocument
|
|
165
|
+
|
|
166
|
+
export const pendingAndQueuedDocument = document(
|
|
167
|
+
[
|
|
168
|
+
user("msg_user_done", "Summarize the current timeline implementation.", 1_000),
|
|
169
|
+
assistant({
|
|
170
|
+
id: "msg_assistant_done",
|
|
171
|
+
offset: 2_000,
|
|
172
|
+
completed: 4_500,
|
|
173
|
+
content: [{ type: "text", text: "The timeline projects current Session messages into stable typed rows." }],
|
|
174
|
+
}),
|
|
175
|
+
user("msg_user_pending", "Add deterministic stories for the current Session UI.", 5_000),
|
|
176
|
+
] satisfies SessionMessageInfo[],
|
|
177
|
+
{ type: "busy" },
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
export const queuedPrompts = [
|
|
181
|
+
{ id: "inbox_queue_1", text: "Cover the compact terminal width." },
|
|
182
|
+
{ id: "inbox_queue_2", text: "Then verify the full Storybook build." },
|
|
183
|
+
] satisfies { id: string; text: string }[]
|
|
184
|
+
|
|
185
|
+
export const streamingDocument = document(
|
|
186
|
+
[
|
|
187
|
+
user("msg_user_stream", "Explain the projection while you implement it.", 10_000),
|
|
188
|
+
assistant({
|
|
189
|
+
id: "msg_assistant_stream",
|
|
190
|
+
offset: 11_000,
|
|
191
|
+
content: [
|
|
192
|
+
{
|
|
193
|
+
type: "reasoning",
|
|
194
|
+
text: "## Checking the current contract\n\nThe assistant content is nested on each current Session message.",
|
|
195
|
+
native: { phase: "streaming" },
|
|
196
|
+
time: { created: STORY_TIME + 11_100 },
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
type: "text",
|
|
200
|
+
text: "I have the typed rows in place. Next I am checking the streaming presentation",
|
|
201
|
+
native: { phase: "streaming" },
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
}),
|
|
205
|
+
] satisfies SessionMessageInfo[],
|
|
206
|
+
{ type: "busy" },
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
export const reviewDiffs = [
|
|
210
|
+
{
|
|
211
|
+
file: "packages/app/src/components/session-status.tsx",
|
|
212
|
+
patch:
|
|
213
|
+
"diff --git a/packages/app/src/components/session-status.tsx b/packages/app/src/components/session-status.tsx\nindex 8412c72..09d4938 100644\n--- a/packages/app/src/components/session-status.tsx\n+++ b/packages/app/src/components/session-status.tsx\n@@ -1,3 +1,3 @@\n export function SessionStatus() {\n- return <span>Working</span>\n+ return <span>Running checks</span>\n }\n",
|
|
214
|
+
additions: 1,
|
|
215
|
+
deletions: 1,
|
|
216
|
+
status: "modified",
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
file: "packages/app/src/components/session-status.test.tsx",
|
|
220
|
+
patch:
|
|
221
|
+
'diff --git a/packages/app/src/components/session-status.test.tsx b/packages/app/src/components/session-status.test.tsx\nnew file mode 100644\nindex 0000000..0c19b30\n--- /dev/null\n+++ b/packages/app/src/components/session-status.test.tsx\n@@ -0,0 +1,5 @@\n+import { expect, test } from "bun:test"\n+\n+test("shows the active status", () => {\n+ expect("Running checks").toContain("checks")\n+})\n',
|
|
222
|
+
additions: 5,
|
|
223
|
+
deletions: 0,
|
|
224
|
+
status: "added",
|
|
225
|
+
},
|
|
226
|
+
] satisfies FileDiffInfo[]
|
|
227
|
+
|
|
228
|
+
export const editThenTestDocument = {
|
|
229
|
+
...document([
|
|
230
|
+
user("msg_user_edit", "Change the active status label and run the focused component test.", 20_000),
|
|
231
|
+
assistant({
|
|
232
|
+
id: "msg_assistant_inspect_status",
|
|
233
|
+
offset: 21_000,
|
|
234
|
+
completed: 22_000,
|
|
235
|
+
content: [
|
|
236
|
+
{
|
|
237
|
+
type: "reasoning",
|
|
238
|
+
text: "## Finding the current label\n\nI will inspect the component and its focused test before changing it.",
|
|
239
|
+
time: { created: STORY_TIME + 21_100, completed: STORY_TIME + 21_400 },
|
|
240
|
+
},
|
|
241
|
+
completedTool({
|
|
242
|
+
id: "tool_grep_status",
|
|
243
|
+
name: "grep",
|
|
244
|
+
offset: 21_500,
|
|
245
|
+
args: { pattern: "Working", path: "packages/app/src", include: "*.tsx" },
|
|
246
|
+
output: "packages/app/src/components/session-status.tsx:4: return <span>Working</span>",
|
|
247
|
+
metadata: {},
|
|
248
|
+
}),
|
|
249
|
+
completedTool({
|
|
250
|
+
id: "tool_read_status",
|
|
251
|
+
name: "read",
|
|
252
|
+
offset: 21_700,
|
|
253
|
+
args: { path: "packages/app/src/components/session-status.tsx", offset: 1, limit: 80 },
|
|
254
|
+
output: "export function SessionStatus() {\n return <span>Working</span>\n}",
|
|
255
|
+
metadata: { loaded: ["packages/app/src/components/session-status.tsx"] },
|
|
256
|
+
}),
|
|
257
|
+
],
|
|
258
|
+
}),
|
|
259
|
+
assistant({
|
|
260
|
+
id: "msg_assistant_edit",
|
|
261
|
+
offset: 22_500,
|
|
262
|
+
completed: 24_000,
|
|
263
|
+
content: [
|
|
264
|
+
completedTool({
|
|
265
|
+
id: "tool_edit_status",
|
|
266
|
+
name: "edit",
|
|
267
|
+
offset: 22_600,
|
|
268
|
+
args: {
|
|
269
|
+
path: "packages/app/src/components/session-status.tsx",
|
|
270
|
+
oldString: " return <span>Working</span>",
|
|
271
|
+
newString: " return <span>Running checks</span>",
|
|
272
|
+
},
|
|
273
|
+
output: "Updated packages/app/src/components/session-status.tsx",
|
|
274
|
+
metadata: {
|
|
275
|
+
files: [
|
|
276
|
+
{
|
|
277
|
+
file: "packages/app/src/components/session-status.tsx",
|
|
278
|
+
patch: reviewDiffs[0].patch,
|
|
279
|
+
additions: 1,
|
|
280
|
+
deletions: 1,
|
|
281
|
+
status: "modified",
|
|
282
|
+
},
|
|
283
|
+
],
|
|
284
|
+
},
|
|
285
|
+
}),
|
|
286
|
+
],
|
|
287
|
+
}),
|
|
288
|
+
assistant({
|
|
289
|
+
id: "msg_assistant_test_status",
|
|
290
|
+
offset: 24_500,
|
|
291
|
+
completed: 26_500,
|
|
292
|
+
content: [
|
|
293
|
+
completedTool({
|
|
294
|
+
id: "tool_test_status",
|
|
295
|
+
name: "shell",
|
|
296
|
+
offset: 24_600,
|
|
297
|
+
args: { command: "bun test src/components/session-status.test.tsx" },
|
|
298
|
+
output: "bun test v1.2.0\n\n1 pass\n0 fail\nRan 1 test across 1 file.",
|
|
299
|
+
metadata: { exit: 0 },
|
|
300
|
+
}),
|
|
301
|
+
],
|
|
302
|
+
}),
|
|
303
|
+
assistant({
|
|
304
|
+
id: "msg_assistant_status_result",
|
|
305
|
+
offset: 27_000,
|
|
306
|
+
completed: 28_000,
|
|
307
|
+
content: [
|
|
308
|
+
{
|
|
309
|
+
type: "text",
|
|
310
|
+
text: "Updated the active label to **Running checks** and verified the focused component test.\n\n- 1 test passed\n- 0 tests failed",
|
|
311
|
+
},
|
|
312
|
+
],
|
|
313
|
+
}),
|
|
314
|
+
] satisfies SessionMessageInfo[]),
|
|
315
|
+
diffs: reviewDiffs,
|
|
316
|
+
} satisfies SessionDocument
|
|
317
|
+
|
|
318
|
+
export const standaloneShellRunningDocument = document(
|
|
319
|
+
[
|
|
320
|
+
{
|
|
321
|
+
id: "msg_shell_running",
|
|
322
|
+
type: "shell",
|
|
323
|
+
shellID: "shell_running",
|
|
324
|
+
command: "bun run storybook --ci",
|
|
325
|
+
status: "running",
|
|
326
|
+
output: {
|
|
327
|
+
output: "Starting Storybook manager...\nBuilding preview...",
|
|
328
|
+
cursor: 49,
|
|
329
|
+
size: 49,
|
|
330
|
+
truncated: false,
|
|
331
|
+
},
|
|
332
|
+
time: { created: STORY_TIME + 30_000 },
|
|
333
|
+
},
|
|
334
|
+
] satisfies SessionMessageInfo[],
|
|
335
|
+
{ type: "busy" },
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
export const standaloneShellCompletedDocument = document([
|
|
339
|
+
{
|
|
340
|
+
id: "msg_shell_completed",
|
|
341
|
+
type: "shell",
|
|
342
|
+
shellID: "shell_completed",
|
|
343
|
+
command: "git status --short",
|
|
344
|
+
status: "exited",
|
|
345
|
+
exit: 0,
|
|
346
|
+
output: {
|
|
347
|
+
output: " M packages/session-ui/src/timeline/session-timeline.tsx",
|
|
348
|
+
cursor: 59,
|
|
349
|
+
size: 59,
|
|
350
|
+
truncated: false,
|
|
351
|
+
},
|
|
352
|
+
time: { created: STORY_TIME + 31_000, completed: STORY_TIME + 31_800 },
|
|
353
|
+
},
|
|
354
|
+
] satisfies SessionMessageInfo[])
|
|
355
|
+
|
|
356
|
+
export const thinkingDocument = document(
|
|
357
|
+
[user("msg_user_thinking", "Find why the Session header shifts after the first streamed response.", 32_000)],
|
|
358
|
+
{ type: "busy" },
|
|
359
|
+
)
|
|
360
|
+
|
|
361
|
+
export const fileChangeLoadingDocument = document(
|
|
362
|
+
[
|
|
363
|
+
user("msg_user_edit_loading", "Update the empty-state copy to explain the next action.", 33_000),
|
|
364
|
+
assistant({
|
|
365
|
+
id: "msg_assistant_edit_loading",
|
|
366
|
+
offset: 34_000,
|
|
367
|
+
content: [
|
|
368
|
+
streamingTool({
|
|
369
|
+
id: "tool_edit_loading",
|
|
370
|
+
name: "edit",
|
|
371
|
+
offset: 34_100,
|
|
372
|
+
args: {
|
|
373
|
+
path: "packages/app/src/components/empty-session.tsx",
|
|
374
|
+
oldString: "No messages yet",
|
|
375
|
+
newString: "Ask OpenCode to start working",
|
|
376
|
+
},
|
|
377
|
+
}),
|
|
378
|
+
],
|
|
379
|
+
}),
|
|
380
|
+
] satisfies SessionMessageInfo[],
|
|
381
|
+
{ type: "busy" },
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
export const fileChangeRunningDocument = document(
|
|
385
|
+
[
|
|
386
|
+
user("msg_user_edit_running", "Update the empty-state copy to explain the next action.", 35_000),
|
|
387
|
+
assistant({
|
|
388
|
+
id: "msg_assistant_edit_running",
|
|
389
|
+
offset: 36_000,
|
|
390
|
+
content: [
|
|
391
|
+
runningTool({
|
|
392
|
+
id: "tool_edit_running",
|
|
393
|
+
name: "edit",
|
|
394
|
+
offset: 36_100,
|
|
395
|
+
args: {
|
|
396
|
+
path: "packages/app/src/components/empty-session.tsx",
|
|
397
|
+
oldString: "No messages yet",
|
|
398
|
+
newString: "Ask OpenCode to start working",
|
|
399
|
+
},
|
|
400
|
+
}),
|
|
401
|
+
],
|
|
402
|
+
}),
|
|
403
|
+
] satisfies SessionMessageInfo[],
|
|
404
|
+
{ type: "busy" },
|
|
405
|
+
)
|
|
406
|
+
|
|
407
|
+
export const multiFilePatchDocument = document([
|
|
408
|
+
user("msg_user_patch", "Add a keyboard shortcut hint and cover it with a focused test.", 37_000),
|
|
409
|
+
assistant({
|
|
410
|
+
id: "msg_assistant_patch",
|
|
411
|
+
offset: 38_000,
|
|
412
|
+
completed: 41_000,
|
|
413
|
+
content: [
|
|
414
|
+
completedTool({
|
|
415
|
+
id: "tool_patch_shortcut",
|
|
416
|
+
name: "patch",
|
|
417
|
+
offset: 38_100,
|
|
418
|
+
args: { patchText: "Update the shortcut hint and add its focused test" },
|
|
419
|
+
output: "Applied patch to 2 files",
|
|
420
|
+
metadata: {
|
|
421
|
+
files: [
|
|
422
|
+
{
|
|
423
|
+
file: "packages/app/src/components/session-hint.tsx",
|
|
424
|
+
status: "modified",
|
|
425
|
+
patch:
|
|
426
|
+
'diff --git a/packages/app/src/components/session-hint.tsx b/packages/app/src/components/session-hint.tsx\nindex 414271a..114b7a2 100644\n--- a/packages/app/src/components/session-hint.tsx\n+++ b/packages/app/src/components/session-hint.tsx\n@@ -1 +1 @@\n-export const hint = "Open commands"\n+export const hint = "Open commands with Ctrl+P"\n',
|
|
427
|
+
additions: 1,
|
|
428
|
+
deletions: 1,
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
file: "packages/app/src/components/session-hint.test.ts",
|
|
432
|
+
status: "added",
|
|
433
|
+
patch:
|
|
434
|
+
'diff --git a/packages/app/src/components/session-hint.test.ts b/packages/app/src/components/session-hint.test.ts\nnew file mode 100644\nindex 0000000..d4fe351\n--- /dev/null\n+++ b/packages/app/src/components/session-hint.test.ts\n@@ -0,0 +1,5 @@\n+import { expect, test } from "bun:test"\n+\n+test("includes the shortcut", () => {\n+ expect("Open commands with Ctrl+P").toContain("Ctrl+P")\n+})\n',
|
|
435
|
+
additions: 5,
|
|
436
|
+
deletions: 0,
|
|
437
|
+
},
|
|
438
|
+
],
|
|
439
|
+
},
|
|
440
|
+
}),
|
|
441
|
+
],
|
|
442
|
+
}),
|
|
443
|
+
assistant({
|
|
444
|
+
id: "msg_assistant_patch_result",
|
|
445
|
+
offset: 41_500,
|
|
446
|
+
completed: 42_500,
|
|
447
|
+
content: [{ type: "text", text: "Added the shortcut hint and its focused test in two files." }],
|
|
448
|
+
}),
|
|
449
|
+
] satisfies SessionMessageInfo[])
|
|
450
|
+
|
|
451
|
+
export const writeFileDocument = document([
|
|
452
|
+
user("msg_user_write", "Add a short contributor note for running the component stories.", 43_000),
|
|
453
|
+
assistant({
|
|
454
|
+
id: "msg_assistant_write",
|
|
455
|
+
offset: 44_000,
|
|
456
|
+
completed: 46_000,
|
|
457
|
+
content: [
|
|
458
|
+
completedTool({
|
|
459
|
+
id: "tool_write_storybook_note",
|
|
460
|
+
name: "write",
|
|
461
|
+
offset: 44_100,
|
|
462
|
+
args: {
|
|
463
|
+
path: "docs/component-workbench.md",
|
|
464
|
+
content:
|
|
465
|
+
"# Component workbench\n\nRun `bun run storybook` from `packages/storybook` to inspect Session workflows without a server.\n",
|
|
466
|
+
},
|
|
467
|
+
output: "Created docs/component-workbench.md",
|
|
468
|
+
}),
|
|
469
|
+
],
|
|
470
|
+
}),
|
|
471
|
+
] satisfies SessionMessageInfo[])
|
|
472
|
+
|
|
473
|
+
export const terminalRunningDocument = document(
|
|
474
|
+
[
|
|
475
|
+
user("msg_user_terminal_running", "Run the focused Session UI tests.", 47_000),
|
|
476
|
+
assistant({
|
|
477
|
+
id: "msg_assistant_terminal_running",
|
|
478
|
+
offset: 48_000,
|
|
479
|
+
content: [
|
|
480
|
+
runningTool({
|
|
481
|
+
id: "tool_terminal_running",
|
|
482
|
+
name: "shell",
|
|
483
|
+
offset: 48_100,
|
|
484
|
+
args: { command: "bun test src/timeline" },
|
|
485
|
+
output: "bun test v1.2.0\nRunning timeline tests...",
|
|
486
|
+
}),
|
|
487
|
+
],
|
|
488
|
+
}),
|
|
489
|
+
] satisfies SessionMessageInfo[],
|
|
490
|
+
{ type: "busy" },
|
|
491
|
+
)
|
|
492
|
+
|
|
493
|
+
export const terminalPassedDocument = document([
|
|
494
|
+
user("msg_user_terminal_passed", "Run the focused Session UI tests.", 49_000),
|
|
495
|
+
assistant({
|
|
496
|
+
id: "msg_assistant_terminal_passed",
|
|
497
|
+
offset: 50_000,
|
|
498
|
+
completed: 52_000,
|
|
499
|
+
content: [
|
|
500
|
+
completedTool({
|
|
501
|
+
id: "tool_terminal_passed",
|
|
502
|
+
name: "shell",
|
|
503
|
+
offset: 50_100,
|
|
504
|
+
args: { command: "bun test src/timeline" },
|
|
505
|
+
output: "12 pass\n0 fail\nRan 12 tests across 3 files.",
|
|
506
|
+
metadata: { exit: 0 },
|
|
507
|
+
}),
|
|
508
|
+
],
|
|
509
|
+
}),
|
|
510
|
+
] satisfies SessionMessageInfo[])
|
|
511
|
+
|
|
512
|
+
export const expandedShellDocument = document([
|
|
513
|
+
user("msg_user_shell_expanded", "Inspect the active service and its available feature surface.", 52_100),
|
|
514
|
+
assistant({
|
|
515
|
+
id: "msg_assistant_shell_expanded",
|
|
516
|
+
offset: 52_200,
|
|
517
|
+
completed: 52_900,
|
|
518
|
+
content: [
|
|
519
|
+
completedTool({
|
|
520
|
+
id: "tool_shell_expanded",
|
|
521
|
+
name: "shell",
|
|
522
|
+
offset: 52_300,
|
|
523
|
+
args: {
|
|
524
|
+
command:
|
|
525
|
+
"opencode api get /openapi.json > /private/var/folders/j/gd69b2|16y91666jzf3p9g22asdasc0000gn/T/opencode/temp/tes",
|
|
526
|
+
},
|
|
527
|
+
output:
|
|
528
|
+
'{"location":{"directory":"/Users/usrnk1","project":{"id":"global","directory":"/","canonical":"/"}},"data":[{"id":"opencode","name":"OpenCode","description":"Use this skill for any question about OpenCode itself, including how OpenCode works, using or configuring it, migrating from V1 to V2, troubleshooting it, developing plugins or integrations, using the OpenCode SDK, clients, server, or API, and contributing to the OpenCode codebase."}]}',
|
|
529
|
+
metadata: { exit: 0 },
|
|
530
|
+
}),
|
|
531
|
+
],
|
|
532
|
+
}),
|
|
533
|
+
] satisfies SessionMessageInfo[])
|
|
534
|
+
|
|
535
|
+
export const executeCodeDocument = document([
|
|
536
|
+
user("msg_user_execute", "Verify the Code Mode runtime responds.", 52_100),
|
|
537
|
+
assistant({
|
|
538
|
+
id: "msg_assistant_execute",
|
|
539
|
+
offset: 52_200,
|
|
540
|
+
completed: 52_900,
|
|
541
|
+
content: [
|
|
542
|
+
completedTool({
|
|
543
|
+
id: "tool_execute_code",
|
|
544
|
+
name: "execute",
|
|
545
|
+
offset: 52_300,
|
|
546
|
+
args: {
|
|
547
|
+
code: 'const tab = await tools.browser.tabs.open({ url: "http://localhost:4399" })\nconst usage = await tools.opencode_console.get_usage({ range: "24h" })\nreturn { tab: tab.id, cost: usage.cost_usd }',
|
|
548
|
+
},
|
|
549
|
+
output: '{\n "tab": "tab_4f1c",\n "cost": 0.42\n}',
|
|
550
|
+
metadata: {
|
|
551
|
+
toolCalls: [
|
|
552
|
+
{ tool: "browser.tabs.open", status: "completed", input: { url: "http://localhost:4399" } },
|
|
553
|
+
{ tool: "opencode_console.get_usage", status: "completed", input: { range: "24h" } },
|
|
554
|
+
],
|
|
555
|
+
},
|
|
556
|
+
}),
|
|
557
|
+
completedTool({
|
|
558
|
+
id: "tool_execute_followup",
|
|
559
|
+
name: "execute",
|
|
560
|
+
offset: 52_600,
|
|
561
|
+
args: { code: "return await tools.browser.tabs.list()" },
|
|
562
|
+
output: "[]",
|
|
563
|
+
metadata: { toolCalls: [{ tool: "browser.tabs.list", status: "completed" }] },
|
|
564
|
+
}),
|
|
565
|
+
completedTool({
|
|
566
|
+
id: "tool_execute_long_call",
|
|
567
|
+
name: "execute",
|
|
568
|
+
offset: 52_700,
|
|
569
|
+
args: {
|
|
570
|
+
code: 'return await tools.mesh.exec({ target: "blade", script: "foreach ($t in \'\\\\opencode-mesh\\\\sync\', \'\\\\opencode-mesh\\\\run\') { schtasks /delete /tn $t /f 2>&1 | Out-Null; \\"deleted $t\\" }" })',
|
|
571
|
+
},
|
|
572
|
+
output:
|
|
573
|
+
"deleted \\opencode-mesh\\sync\ndeleted \\opencode-mesh\\run\nCleanup finished on blade after removing both scheduled tasks and their trigger history.",
|
|
574
|
+
metadata: {
|
|
575
|
+
toolCalls: [
|
|
576
|
+
{
|
|
577
|
+
tool: "mesh.exec",
|
|
578
|
+
status: "completed",
|
|
579
|
+
input: {
|
|
580
|
+
target: "blade",
|
|
581
|
+
script:
|
|
582
|
+
"foreach ($t in '\\opencode-mesh\\sync', '\\opencode-mesh\\run') { schtasks /delete /tn $t /f 2>&1 | Out-Null; \"deleted $t\" }",
|
|
583
|
+
},
|
|
584
|
+
},
|
|
585
|
+
],
|
|
586
|
+
},
|
|
587
|
+
}),
|
|
588
|
+
],
|
|
589
|
+
}),
|
|
590
|
+
] satisfies SessionMessageInfo[])
|
|
591
|
+
|
|
592
|
+
// A script that read a source tree file by file: its rows start at the latest calls.
|
|
593
|
+
export const executeManyCallsDocument = document([
|
|
594
|
+
user("msg_user_execute_many", "Find every state machine in the app.", 52_100),
|
|
595
|
+
assistant({
|
|
596
|
+
id: "msg_assistant_execute_many",
|
|
597
|
+
offset: 52_200,
|
|
598
|
+
completed: 52_900,
|
|
599
|
+
content: [
|
|
600
|
+
completedTool({
|
|
601
|
+
id: "tool_execute_many_calls",
|
|
602
|
+
name: "execute",
|
|
603
|
+
offset: 52_300,
|
|
604
|
+
args: {
|
|
605
|
+
code: 'const files = await Array.fromAsync(new Bun.Glob("src/**/*.ts").scan())\nreturn files.filter((file) => Bun.file(file).name?.endsWith("machine.ts")).length',
|
|
606
|
+
},
|
|
607
|
+
output: "48",
|
|
608
|
+
metadata: {
|
|
609
|
+
toolCalls: Array.from({ length: 75 }, (_, index) => ({
|
|
610
|
+
tool: "Bun",
|
|
611
|
+
status: "completed",
|
|
612
|
+
input: { method: "file", path: `src/session/module-${index}.ts` },
|
|
613
|
+
})),
|
|
614
|
+
},
|
|
615
|
+
}),
|
|
616
|
+
],
|
|
617
|
+
}),
|
|
618
|
+
] satisfies SessionMessageInfo[])
|
|
619
|
+
|
|
620
|
+
const executeWorktreeNames = [
|
|
621
|
+
"child-permission-sync",
|
|
622
|
+
"frontmatter-flow-repair",
|
|
623
|
+
"command-legacy-variant",
|
|
624
|
+
"service-discovery-validation",
|
|
625
|
+
"sampled-checksum-tail",
|
|
626
|
+
]
|
|
627
|
+
|
|
628
|
+
export const executeLongDetailsDocument = document([
|
|
629
|
+
user("msg_user_execute_long", "Create a worktree for each issue.", 52_100),
|
|
630
|
+
assistant({
|
|
631
|
+
id: "msg_assistant_execute_long",
|
|
632
|
+
offset: 52_200,
|
|
633
|
+
completed: 52_900,
|
|
634
|
+
content: [
|
|
635
|
+
completedTool({
|
|
636
|
+
id: "tool_execute_worktrees",
|
|
637
|
+
name: "execute",
|
|
638
|
+
offset: 52_300,
|
|
639
|
+
args: {
|
|
640
|
+
code: [
|
|
641
|
+
"const names = [",
|
|
642
|
+
...executeWorktreeNames.map((name) => ` "${name}",`),
|
|
643
|
+
"];",
|
|
644
|
+
"",
|
|
645
|
+
"const results = await Promise.allSettled(",
|
|
646
|
+
" names.map((name) => tools.opencode.worktree_create({ name }))",
|
|
647
|
+
");",
|
|
648
|
+
"",
|
|
649
|
+
"return names.map((name, i) => ({",
|
|
650
|
+
" name,",
|
|
651
|
+
' result: results[i].status === "fulfilled" ? results[i].value : String(results[i].reason),',
|
|
652
|
+
"}));",
|
|
653
|
+
].join("\n"),
|
|
654
|
+
},
|
|
655
|
+
output: JSON.stringify(
|
|
656
|
+
executeWorktreeNames.map((name) => ({
|
|
657
|
+
name,
|
|
658
|
+
result: { directory: `/Users/dev/.local/share/opencode/worktree/012780/${name}` },
|
|
659
|
+
})),
|
|
660
|
+
),
|
|
661
|
+
metadata: {
|
|
662
|
+
toolCalls: executeWorktreeNames.map((name) => ({
|
|
663
|
+
tool: "opencode.worktree_create",
|
|
664
|
+
status: "completed",
|
|
665
|
+
input: { name },
|
|
666
|
+
})),
|
|
667
|
+
},
|
|
668
|
+
}),
|
|
669
|
+
],
|
|
670
|
+
}),
|
|
671
|
+
] satisfies SessionMessageInfo[])
|
|
672
|
+
|
|
673
|
+
export const terminalFailedDocument = document([
|
|
674
|
+
user("msg_user_terminal_failed", "Run the focused Session UI tests.", 53_000),
|
|
675
|
+
assistant({
|
|
676
|
+
id: "msg_assistant_terminal_failed",
|
|
677
|
+
offset: 54_000,
|
|
678
|
+
completed: 56_000,
|
|
679
|
+
content: [
|
|
680
|
+
completedTool({
|
|
681
|
+
id: "tool_terminal_failed",
|
|
682
|
+
name: "shell",
|
|
683
|
+
offset: 54_100,
|
|
684
|
+
args: { command: "bun test src/timeline" },
|
|
685
|
+
output: "1 pass\n1 fail\nFailed: keeps the active tool disclosure open",
|
|
686
|
+
metadata: { exit: 1 },
|
|
687
|
+
}),
|
|
688
|
+
],
|
|
689
|
+
}),
|
|
690
|
+
] satisfies SessionMessageInfo[])
|
|
691
|
+
|
|
692
|
+
export const recoveryDocument = document([
|
|
693
|
+
user("msg_user_recovery", "Fix the failing active-tool disclosure test and verify the timeline package.", 57_000),
|
|
694
|
+
assistant({
|
|
695
|
+
id: "msg_assistant_recovery_failure",
|
|
696
|
+
offset: 58_000,
|
|
697
|
+
completed: 60_000,
|
|
698
|
+
content: [
|
|
699
|
+
completedTool({
|
|
700
|
+
id: "tool_recovery_failure",
|
|
701
|
+
name: "shell",
|
|
702
|
+
offset: 58_100,
|
|
703
|
+
args: { command: "bun test src/timeline/rows-current.test.ts" },
|
|
704
|
+
output: "1 pass\n1 fail\nExpected active disclosure to remain open.",
|
|
705
|
+
metadata: { exit: 1 },
|
|
706
|
+
}),
|
|
707
|
+
{
|
|
708
|
+
type: "text",
|
|
709
|
+
text: "The focused test reproduces the issue. The row key changes when the running tool receives its result.",
|
|
710
|
+
},
|
|
711
|
+
],
|
|
712
|
+
}),
|
|
713
|
+
assistant({
|
|
714
|
+
id: "msg_assistant_recovery_edit",
|
|
715
|
+
offset: 60_500,
|
|
716
|
+
completed: 63_000,
|
|
717
|
+
content: [
|
|
718
|
+
completedTool({
|
|
719
|
+
id: "tool_recovery_edit",
|
|
720
|
+
name: "edit",
|
|
721
|
+
offset: 60_600,
|
|
722
|
+
args: {
|
|
723
|
+
path: "packages/session-ui/src/timeline/timeline-row.ts",
|
|
724
|
+
oldString: "return `${row.group.key}:${row.status}`",
|
|
725
|
+
newString: "return row.group.key",
|
|
726
|
+
},
|
|
727
|
+
output: "Updated packages/session-ui/src/timeline/timeline-row.ts",
|
|
728
|
+
metadata: {
|
|
729
|
+
files: [
|
|
730
|
+
{
|
|
731
|
+
file: "packages/session-ui/src/timeline/timeline-row.ts",
|
|
732
|
+
patch:
|
|
733
|
+
"diff --git a/packages/session-ui/src/timeline/timeline-row.ts b/packages/session-ui/src/timeline/timeline-row.ts\nindex ac4ed80..4f0ecb1 100644\n--- a/packages/session-ui/src/timeline/timeline-row.ts\n+++ b/packages/session-ui/src/timeline/timeline-row.ts\n@@ -1 +1 @@\n-export const key = (row) => `${row.group.key}:${row.status}`\n+export const key = (row) => row.group.key\n",
|
|
734
|
+
additions: 1,
|
|
735
|
+
deletions: 1,
|
|
736
|
+
status: "modified",
|
|
737
|
+
},
|
|
738
|
+
],
|
|
739
|
+
},
|
|
740
|
+
}),
|
|
741
|
+
completedTool({
|
|
742
|
+
id: "tool_recovery_pass",
|
|
743
|
+
name: "shell",
|
|
744
|
+
offset: 62_000,
|
|
745
|
+
args: { command: "bun test src/timeline" },
|
|
746
|
+
output: "14 pass\n0 fail\nRan 14 tests across 3 files.",
|
|
747
|
+
metadata: { exit: 0 },
|
|
748
|
+
}),
|
|
749
|
+
],
|
|
750
|
+
}),
|
|
751
|
+
assistant({
|
|
752
|
+
id: "msg_assistant_recovery_result",
|
|
753
|
+
offset: 63_500,
|
|
754
|
+
completed: 64_500,
|
|
755
|
+
content: [
|
|
756
|
+
{
|
|
757
|
+
type: "text",
|
|
758
|
+
text: "Kept the disclosure keyed to the stable tool group. The focused failure now passes, and all 14 timeline tests are green.",
|
|
759
|
+
},
|
|
760
|
+
],
|
|
761
|
+
}),
|
|
762
|
+
] satisfies SessionMessageInfo[])
|
|
763
|
+
|
|
764
|
+
export const requestHistoryDocument = document([
|
|
765
|
+
user("msg_user_requests", "Ask before changing the release target.", 40_000),
|
|
766
|
+
assistant({
|
|
767
|
+
id: "msg_assistant_requests",
|
|
768
|
+
offset: 41_000,
|
|
769
|
+
completed: 44_000,
|
|
770
|
+
content: [
|
|
771
|
+
completedTool({
|
|
772
|
+
id: "tool_question_release",
|
|
773
|
+
name: "question",
|
|
774
|
+
offset: 41_500,
|
|
775
|
+
args: {
|
|
776
|
+
questions: [
|
|
777
|
+
{
|
|
778
|
+
question: "Which release target should I use?",
|
|
779
|
+
header: "Target",
|
|
780
|
+
options: [
|
|
781
|
+
{ label: "Canary", description: "Publish for internal validation" },
|
|
782
|
+
{ label: "Stable", description: "Publish to all users" },
|
|
783
|
+
],
|
|
784
|
+
},
|
|
785
|
+
],
|
|
786
|
+
},
|
|
787
|
+
output: "Canary",
|
|
788
|
+
metadata: { answers: [["Canary"]] },
|
|
789
|
+
}),
|
|
790
|
+
failedTool({
|
|
791
|
+
id: "tool_permission_release",
|
|
792
|
+
name: "shell",
|
|
793
|
+
offset: 43_000,
|
|
794
|
+
args: { command: "npm publish --tag canary" },
|
|
795
|
+
message: "Permission was denied for npm publish --tag canary",
|
|
796
|
+
}),
|
|
797
|
+
],
|
|
798
|
+
}),
|
|
799
|
+
] satisfies SessionMessageInfo[])
|
|
800
|
+
|
|
801
|
+
export const inspectAndExplainDocument = document([
|
|
802
|
+
user(
|
|
803
|
+
"msg_user_research",
|
|
804
|
+
"Review how the Session timeline keeps tool rows stable while streaming. Do not change code.",
|
|
805
|
+
65_000,
|
|
806
|
+
),
|
|
807
|
+
assistant({
|
|
808
|
+
id: "msg_assistant_research_context",
|
|
809
|
+
offset: 66_000,
|
|
810
|
+
completed: 69_000,
|
|
811
|
+
content: [
|
|
812
|
+
{
|
|
813
|
+
type: "reasoning",
|
|
814
|
+
text: "## Tracing row identity\n\nI will follow the projection from current messages to rendered row keys.",
|
|
815
|
+
time: { created: STORY_TIME + 66_100, completed: STORY_TIME + 66_400 },
|
|
816
|
+
},
|
|
817
|
+
completedTool({
|
|
818
|
+
id: "tool_research_glob",
|
|
819
|
+
name: "glob",
|
|
820
|
+
offset: 66_500,
|
|
821
|
+
args: { pattern: "src/timeline/**/*.{ts,tsx}", path: "packages/session-ui" },
|
|
822
|
+
output:
|
|
823
|
+
"packages/session-ui/src/timeline/projection.ts\npackages/session-ui/src/timeline/session-timeline.tsx\npackages/session-ui/src/timeline/timeline-row.ts",
|
|
824
|
+
metadata: { count: 3 },
|
|
825
|
+
}),
|
|
826
|
+
completedTool({
|
|
827
|
+
id: "tool_research_grep",
|
|
828
|
+
name: "grep",
|
|
829
|
+
offset: 67_000,
|
|
830
|
+
args: { pattern: "TimelineRow.key", path: "packages/session-ui/src/timeline", include: "*.ts*" },
|
|
831
|
+
output:
|
|
832
|
+
"packages/session-ui/src/timeline/projection.ts:39\npackages/session-ui/src/timeline/session-timeline.tsx:332",
|
|
833
|
+
metadata: { matches: 2 },
|
|
834
|
+
}),
|
|
835
|
+
completedTool({
|
|
836
|
+
id: "tool_research_read",
|
|
837
|
+
name: "read",
|
|
838
|
+
offset: 67_500,
|
|
839
|
+
args: { path: "packages/session-ui/src/timeline/projection.ts", offset: 309, limit: 125 },
|
|
840
|
+
output:
|
|
841
|
+
"export function reuseTimelineRows(previous, rows) {\n // Preserve matching row objects and context keys.\n}",
|
|
842
|
+
metadata: { loaded: ["packages/session-ui/src/timeline/projection.ts"] },
|
|
843
|
+
}),
|
|
844
|
+
],
|
|
845
|
+
}),
|
|
846
|
+
assistant({
|
|
847
|
+
id: "msg_assistant_research_result",
|
|
848
|
+
offset: 69_500,
|
|
849
|
+
completed: 71_000,
|
|
850
|
+
content: [
|
|
851
|
+
{
|
|
852
|
+
type: "text",
|
|
853
|
+
text: "The projection owns row identity in one pass. It reuses matching row objects, preserves context-group keys when older history attaches, and renders by those stable keys. Streaming updates therefore replace content without remounting unrelated rows.",
|
|
854
|
+
},
|
|
855
|
+
],
|
|
856
|
+
}),
|
|
857
|
+
] satisfies SessionMessageInfo[])
|
|
858
|
+
|
|
859
|
+
export const webResearchDocument = document([
|
|
860
|
+
user("msg_user_web_research", "Check the current accessibility guidance for status updates in live regions.", 72_000),
|
|
861
|
+
assistant({
|
|
862
|
+
id: "msg_assistant_web_research",
|
|
863
|
+
offset: 73_000,
|
|
864
|
+
completed: 76_000,
|
|
865
|
+
content: [
|
|
866
|
+
completedTool({
|
|
867
|
+
id: "tool_web_search",
|
|
868
|
+
name: "websearch",
|
|
869
|
+
offset: 73_100,
|
|
870
|
+
args: { query: "figma mcp setup" },
|
|
871
|
+
output: [
|
|
872
|
+
"https://www.figma.com/community/file/1606560040358762787/figma-mcp-console-setup-guide",
|
|
873
|
+
"https://designagentlab.com",
|
|
874
|
+
"https://www.figma.com/community/whiteboarding?resource_type=widgets",
|
|
875
|
+
"https://figma-console-mcp.southleft.com/mcp",
|
|
876
|
+
"https://designagentlab.com/figma-console-mcp",
|
|
877
|
+
"https://designagentlab.com/figma-tutorials",
|
|
878
|
+
"https://github.com/southleft/figma-console-mcp/issues",
|
|
879
|
+
"https://designagentlab.com/ui-kits",
|
|
880
|
+
"https://designagentlab.com/prototyping-tools",
|
|
881
|
+
"https://www.inthepocket.design/guidelines/figma-mcp/setup-figma-mcp",
|
|
882
|
+
"https://www.figma.com/community/plugins",
|
|
883
|
+
"https://figma-console-mcp.southleft.com/docs",
|
|
884
|
+
"https://designagentlab.com/resources",
|
|
885
|
+
"https://github.com/southleft/figma-console-mcp/releases",
|
|
886
|
+
"https://www.inthepocket.design/blog/figma-mcp",
|
|
887
|
+
"https://designagentlab.com/community",
|
|
888
|
+
].join("\n"),
|
|
889
|
+
metadata: { provider: "firecrawl" },
|
|
890
|
+
}),
|
|
891
|
+
completedTool({
|
|
892
|
+
id: "tool_web_fetch",
|
|
893
|
+
name: "webfetch",
|
|
894
|
+
offset: 74_000,
|
|
895
|
+
args: { url: "https://www.figma.com" },
|
|
896
|
+
output: "Status messages should be programmatically determinable without receiving focus.",
|
|
897
|
+
}),
|
|
898
|
+
],
|
|
899
|
+
}),
|
|
900
|
+
assistant({
|
|
901
|
+
id: "msg_assistant_web_result",
|
|
902
|
+
offset: 76_500,
|
|
903
|
+
completed: 77_500,
|
|
904
|
+
content: [
|
|
905
|
+
{
|
|
906
|
+
type: "text",
|
|
907
|
+
text: "Use a status role for concise progress updates that should be announced without moving focus. Avoid putting the complete streaming transcript in one assertive live region.",
|
|
908
|
+
},
|
|
909
|
+
],
|
|
910
|
+
}),
|
|
911
|
+
] satisfies SessionMessageInfo[])
|
|
912
|
+
|
|
913
|
+
export const loadedResourcesDocument = document([
|
|
914
|
+
user("msg_user_skill", "Read the project instructions, load the RTL-aware skill, and review the file row.", 79_000),
|
|
915
|
+
assistant({
|
|
916
|
+
id: "msg_assistant_skill",
|
|
917
|
+
offset: 80_000,
|
|
918
|
+
completed: 82_000,
|
|
919
|
+
content: [
|
|
920
|
+
completedTool({
|
|
921
|
+
id: "tool_loaded_file",
|
|
922
|
+
name: "read",
|
|
923
|
+
offset: 80_100,
|
|
924
|
+
args: { path: "C:/workspaces/opencode/packages/cli/AGENTS.md" },
|
|
925
|
+
output: "Project instructions loaded.",
|
|
926
|
+
metadata: { loaded: ["C:/workspaces/opencode/packages/cli/AGENTS.md"] },
|
|
927
|
+
}),
|
|
928
|
+
completedTool({
|
|
929
|
+
id: "tool_skill_rtl",
|
|
930
|
+
name: "skill",
|
|
931
|
+
offset: 80_200,
|
|
932
|
+
args: { name: "rtl-aware-development" },
|
|
933
|
+
output: "Loaded RTL-aware development guidance",
|
|
934
|
+
metadata: { name: "rtl-aware-development" },
|
|
935
|
+
}),
|
|
936
|
+
{
|
|
937
|
+
type: "text",
|
|
938
|
+
text: "The row keeps the surrounding interface in RTL while isolating `packages/app/src/session.tsx` as LTR code. Focus order remains semantic.",
|
|
939
|
+
},
|
|
940
|
+
],
|
|
941
|
+
}),
|
|
942
|
+
] satisfies SessionMessageInfo[])
|
|
943
|
+
|
|
944
|
+
export const instructionsUpdatedSingleDocument = document([
|
|
945
|
+
user("msg_user_instructions_single", "Check if beta service reports the shared session as running.", 85_000),
|
|
946
|
+
assistant({
|
|
947
|
+
id: "msg_assistant_instructions_single",
|
|
948
|
+
offset: 86_000,
|
|
949
|
+
completed: 88_000,
|
|
950
|
+
content: [
|
|
951
|
+
{
|
|
952
|
+
type: "text",
|
|
953
|
+
text: "The beta service is healthy and already reports this shared session as running. I found unrelated desktop changes in the worktree and will leave them untouched; next I'm narrowing the beta-only capabilities to features that can be demonstrated safely in this session rather than invoking every administrative API.",
|
|
954
|
+
},
|
|
955
|
+
],
|
|
956
|
+
}),
|
|
957
|
+
{
|
|
958
|
+
id: "msg_instructions_updated_single",
|
|
959
|
+
type: "system",
|
|
960
|
+
text: "Updated instructions for api/v2-demo",
|
|
961
|
+
description: "Instructions updated: api/v2-demo",
|
|
962
|
+
time: { created: STORY_TIME + 89_000 },
|
|
963
|
+
},
|
|
964
|
+
] satisfies SessionMessageInfo[])
|
|
965
|
+
|
|
966
|
+
export const instructionsUpdatedMultipleDocument = document([
|
|
967
|
+
user("msg_user_instructions_multi", "Check if beta service reports the shared session as running.", 85_000),
|
|
968
|
+
assistant({
|
|
969
|
+
id: "msg_assistant_instructions_multi",
|
|
970
|
+
offset: 86_000,
|
|
971
|
+
completed: 88_000,
|
|
972
|
+
content: [
|
|
973
|
+
{
|
|
974
|
+
type: "text",
|
|
975
|
+
text: "The beta service is healthy and already reports this shared session as running. I found unrelated desktop changes in the worktree and will leave them untouched; next I'm narrowing the beta-only capabilities to features that can be demonstrated safely in this session rather than invoking every administrative API.",
|
|
976
|
+
},
|
|
977
|
+
],
|
|
978
|
+
}),
|
|
979
|
+
{
|
|
980
|
+
id: "msg_instructions_updated_multi",
|
|
981
|
+
type: "system",
|
|
982
|
+
text: "Updated instructions for api/v2-demo and api/session",
|
|
983
|
+
description: "Instructions updated: api/v2-demo, api/session",
|
|
984
|
+
time: { created: STORY_TIME + 89_000 },
|
|
985
|
+
},
|
|
986
|
+
] satisfies SessionMessageInfo[])
|
|
987
|
+
|
|
988
|
+
export const permissionPendingDocument = document(
|
|
989
|
+
[
|
|
990
|
+
user("msg_user_permission_pending", "Publish the verified preview build to the canary channel.", 83_000),
|
|
991
|
+
assistant({
|
|
992
|
+
id: "msg_assistant_permission_pending",
|
|
993
|
+
offset: 84_000,
|
|
994
|
+
content: [
|
|
995
|
+
runningTool({
|
|
996
|
+
id: "tool_permission_pending",
|
|
997
|
+
name: "shell",
|
|
998
|
+
offset: 84_100,
|
|
999
|
+
args: { command: "npm publish --tag canary" },
|
|
1000
|
+
}),
|
|
1001
|
+
],
|
|
1002
|
+
}),
|
|
1003
|
+
] satisfies SessionMessageInfo[],
|
|
1004
|
+
{ type: "busy" },
|
|
1005
|
+
)
|
|
1006
|
+
|
|
1007
|
+
export const questionPendingDocument = document(
|
|
1008
|
+
[
|
|
1009
|
+
user("msg_user_question_pending", "Add the Session panel, but ask which layout to use first.", 85_000),
|
|
1010
|
+
assistant({
|
|
1011
|
+
id: "msg_assistant_question_pending",
|
|
1012
|
+
offset: 86_000,
|
|
1013
|
+
content: [
|
|
1014
|
+
runningTool({
|
|
1015
|
+
id: "tool_question_pending",
|
|
1016
|
+
name: "question",
|
|
1017
|
+
offset: 86_100,
|
|
1018
|
+
args: {
|
|
1019
|
+
questions: [
|
|
1020
|
+
{
|
|
1021
|
+
header: "Layout",
|
|
1022
|
+
question: "Which Session layout should I implement?",
|
|
1023
|
+
options: [
|
|
1024
|
+
{ label: "Focused", description: "Keep the conversation at a comfortable reading width" },
|
|
1025
|
+
{ label: "Wide", description: "Keep the review panel visible beside the conversation" },
|
|
1026
|
+
],
|
|
1027
|
+
},
|
|
1028
|
+
],
|
|
1029
|
+
},
|
|
1030
|
+
}),
|
|
1031
|
+
],
|
|
1032
|
+
}),
|
|
1033
|
+
] satisfies SessionMessageInfo[],
|
|
1034
|
+
{ type: "busy" },
|
|
1035
|
+
)
|
|
1036
|
+
|
|
1037
|
+
export const activeQuestionRequest = {
|
|
1038
|
+
id: "form_session_layout",
|
|
1039
|
+
sessionID: CURRENT_SESSION_ID,
|
|
1040
|
+
title: "Session layout",
|
|
1041
|
+
metadata: { kind: "question" },
|
|
1042
|
+
fields: [
|
|
1043
|
+
{
|
|
1044
|
+
key: "layout",
|
|
1045
|
+
type: "string",
|
|
1046
|
+
title: "Layout",
|
|
1047
|
+
description: "Which Session layout should I implement?",
|
|
1048
|
+
options: [
|
|
1049
|
+
{ value: "focused", label: "Focused", description: "Keep the conversation at a comfortable reading width" },
|
|
1050
|
+
{ value: "wide", label: "Wide", description: "Keep the review panel visible beside the conversation" },
|
|
1051
|
+
],
|
|
1052
|
+
custom: true,
|
|
1053
|
+
},
|
|
1054
|
+
{
|
|
1055
|
+
key: "details",
|
|
1056
|
+
type: "multiselect",
|
|
1057
|
+
title: "Include",
|
|
1058
|
+
description: "Which supporting surfaces should remain visible?",
|
|
1059
|
+
options: [
|
|
1060
|
+
{ value: "files", label: "Changed files" },
|
|
1061
|
+
{ value: "terminal", label: "Terminal" },
|
|
1062
|
+
{ value: "tasks", label: "Background tasks" },
|
|
1063
|
+
],
|
|
1064
|
+
},
|
|
1065
|
+
],
|
|
1066
|
+
} satisfies FormInfo
|
|
1067
|
+
|
|
1068
|
+
export const retryDocument = document(
|
|
1069
|
+
[
|
|
1070
|
+
user("msg_user_retry", "Generate the migration notes.", 50_000),
|
|
1071
|
+
assistant({
|
|
1072
|
+
id: "msg_assistant_retry",
|
|
1073
|
+
offset: 51_000,
|
|
1074
|
+
content: [],
|
|
1075
|
+
retry: {
|
|
1076
|
+
attempt: 2,
|
|
1077
|
+
at: 1_900_000_000_000,
|
|
1078
|
+
error: { type: "ProviderRateLimitError", message: "Rate limit reached. Retrying with backoff." },
|
|
1079
|
+
},
|
|
1080
|
+
}),
|
|
1081
|
+
] satisfies SessionMessageInfo[],
|
|
1082
|
+
{ type: "busy" },
|
|
1083
|
+
)
|
|
1084
|
+
|
|
1085
|
+
const compactionPrelude = [
|
|
1086
|
+
user("msg_user_compact", "Continue the implementation after compacting context.", 60_000),
|
|
1087
|
+
assistant({
|
|
1088
|
+
id: "msg_assistant_before_compact",
|
|
1089
|
+
offset: 61_000,
|
|
1090
|
+
completed: 62_500,
|
|
1091
|
+
content: [{ type: "text", text: "I inspected the timeline and identified the current message boundary." }],
|
|
1092
|
+
error: { type: "ExecutionInterrupted", message: "Context compaction started" },
|
|
1093
|
+
}),
|
|
1094
|
+
] satisfies SessionMessageInfo[]
|
|
1095
|
+
|
|
1096
|
+
export const compactionRunningDocument = document(
|
|
1097
|
+
[
|
|
1098
|
+
...compactionPrelude,
|
|
1099
|
+
{
|
|
1100
|
+
id: "msg_compaction_running",
|
|
1101
|
+
type: "compaction",
|
|
1102
|
+
status: "running",
|
|
1103
|
+
reason: "auto",
|
|
1104
|
+
summary: "## Goal\n\nRestore compaction output while preserving timeline notices.",
|
|
1105
|
+
time: { created: STORY_TIME + 63_000 },
|
|
1106
|
+
},
|
|
1107
|
+
] satisfies SessionMessageInfo[],
|
|
1108
|
+
{ type: "busy" },
|
|
1109
|
+
)
|
|
1110
|
+
|
|
1111
|
+
export const compactionDocument = document([
|
|
1112
|
+
...compactionPrelude,
|
|
1113
|
+
{
|
|
1114
|
+
id: "msg_compaction_complete",
|
|
1115
|
+
type: "compaction",
|
|
1116
|
+
status: "completed",
|
|
1117
|
+
reason: "auto",
|
|
1118
|
+
summary: "The Session timeline now consumes current nested assistant content.",
|
|
1119
|
+
cost: 0.0142,
|
|
1120
|
+
tokens: { input: 3_180, output: 412, reasoning: 96, cache: { read: 8_704, write: 0 } },
|
|
1121
|
+
time: { created: STORY_TIME + 63_000 },
|
|
1122
|
+
},
|
|
1123
|
+
assistant({
|
|
1124
|
+
id: "msg_assistant_after_compact",
|
|
1125
|
+
offset: 64_000,
|
|
1126
|
+
completed: 66_000,
|
|
1127
|
+
content: [{ type: "text", text: "Context restored. I continued from the durable Session messages." }],
|
|
1128
|
+
}),
|
|
1129
|
+
] satisfies SessionMessageInfo[])
|
|
1130
|
+
|
|
1131
|
+
export const compactionManualDocument = document([
|
|
1132
|
+
...compactionPrelude,
|
|
1133
|
+
{
|
|
1134
|
+
id: "msg_compaction_manual",
|
|
1135
|
+
type: "compaction",
|
|
1136
|
+
status: "completed",
|
|
1137
|
+
reason: "manual",
|
|
1138
|
+
summary: "The Session timeline now consumes current nested assistant content.",
|
|
1139
|
+
cost: 0.0142,
|
|
1140
|
+
tokens: { input: 3_180, output: 412, reasoning: 96, cache: { read: 8_704, write: 0 } },
|
|
1141
|
+
time: { created: STORY_TIME + 63_000 },
|
|
1142
|
+
},
|
|
1143
|
+
] satisfies SessionMessageInfo[])
|
|
1144
|
+
|
|
1145
|
+
export const compactionFailedDocument = document([
|
|
1146
|
+
...compactionPrelude,
|
|
1147
|
+
{
|
|
1148
|
+
id: "msg_compaction_failed",
|
|
1149
|
+
type: "compaction",
|
|
1150
|
+
status: "failed",
|
|
1151
|
+
reason: "auto",
|
|
1152
|
+
error: { type: "compaction.failed", message: "The provider rejected the compaction request." },
|
|
1153
|
+
time: { created: STORY_TIME + 63_000 },
|
|
1154
|
+
},
|
|
1155
|
+
] satisfies SessionMessageInfo[])
|
|
1156
|
+
|
|
1157
|
+
export const compactionCancelledDocument = document([
|
|
1158
|
+
...compactionPrelude,
|
|
1159
|
+
{
|
|
1160
|
+
id: "msg_compaction_cancelled",
|
|
1161
|
+
type: "compaction",
|
|
1162
|
+
status: "failed",
|
|
1163
|
+
reason: "manual",
|
|
1164
|
+
error: { type: "aborted", message: "Compaction cancelled" },
|
|
1165
|
+
time: { created: STORY_TIME + 63_000 },
|
|
1166
|
+
},
|
|
1167
|
+
] satisfies SessionMessageInfo[])
|
|
1168
|
+
|
|
1169
|
+
export type SubagentReport = {
|
|
1170
|
+
childID: string
|
|
1171
|
+
agent: string
|
|
1172
|
+
state: "completed" | "error" | "cancelled"
|
|
1173
|
+
description: string
|
|
1174
|
+
body: string
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
export function subagentReport(id: string, created: number, report: SubagentReport): SessionMessageInfo {
|
|
1178
|
+
return {
|
|
1179
|
+
id,
|
|
1180
|
+
type: "synthetic",
|
|
1181
|
+
description: report.description,
|
|
1182
|
+
text: `<background-result kind="subagent" sessionID="${report.childID}" state="${report.state}" description="${report.description}">\n${report.body}\n</background-result>`,
|
|
1183
|
+
metadata: { source: "subagent", childID: report.childID, agent: report.agent, state: report.state },
|
|
1184
|
+
time: { created },
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
export const subagentDocument = document(
|
|
1189
|
+
[
|
|
1190
|
+
user("msg_user_subagent", "Delegate the fixture review and report the result.", 70_000),
|
|
1191
|
+
assistant({
|
|
1192
|
+
id: "msg_assistant_subagent",
|
|
1193
|
+
offset: 71_000,
|
|
1194
|
+
completed: 74_000,
|
|
1195
|
+
agent: "build",
|
|
1196
|
+
content: [
|
|
1197
|
+
completedTool({
|
|
1198
|
+
id: "tool_subagent_review",
|
|
1199
|
+
name: "subagent",
|
|
1200
|
+
offset: 71_500,
|
|
1201
|
+
args: {
|
|
1202
|
+
agent: "review",
|
|
1203
|
+
description: "Review current Session fixtures",
|
|
1204
|
+
prompt: "Check the current Session fixtures for protocol accuracy and report findings.",
|
|
1205
|
+
},
|
|
1206
|
+
output: "The subagent is working in the background.",
|
|
1207
|
+
metadata: { sessionID: "session_child_review", status: "running" },
|
|
1208
|
+
}),
|
|
1209
|
+
completedTool({
|
|
1210
|
+
id: "tool_subagent_tests",
|
|
1211
|
+
name: "subagent",
|
|
1212
|
+
offset: 73_000,
|
|
1213
|
+
args: {
|
|
1214
|
+
agent: "test",
|
|
1215
|
+
description: "Check the Storybook scenarios",
|
|
1216
|
+
prompt: "Run the focused Storybook scenario checks and report any failures.",
|
|
1217
|
+
},
|
|
1218
|
+
output: "The subagent is working in the background.",
|
|
1219
|
+
metadata: { sessionID: "session_child_tests", status: "running" },
|
|
1220
|
+
}),
|
|
1221
|
+
],
|
|
1222
|
+
}),
|
|
1223
|
+
subagentReport("msg_review_report", STORY_TIME + 75_000, {
|
|
1224
|
+
childID: "session_child_review",
|
|
1225
|
+
agent: "review",
|
|
1226
|
+
state: "completed",
|
|
1227
|
+
description: "Review current Session fixtures",
|
|
1228
|
+
body: "The fixtures use fixed current protocol messages and nested tool states.",
|
|
1229
|
+
}),
|
|
1230
|
+
] satisfies SessionMessageInfo[],
|
|
1231
|
+
{ type: "busy" },
|
|
1232
|
+
)
|
|
1233
|
+
|
|
1234
|
+
export const attachmentsAndCommentsDocument = document([
|
|
1235
|
+
{
|
|
1236
|
+
...user("msg_user_attachments", "Use @review to check the attached layout and the selected lines.", 80_000),
|
|
1237
|
+
files: [
|
|
1238
|
+
{
|
|
1239
|
+
data: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
|
|
1240
|
+
mime: "image/png",
|
|
1241
|
+
name: "timeline-layout.png",
|
|
1242
|
+
source: { type: "inline" },
|
|
1243
|
+
},
|
|
1244
|
+
{
|
|
1245
|
+
data: "IyBTdG9yeWJvb2sgY2hlY2tsaXN0Cg==",
|
|
1246
|
+
mime: "text/markdown",
|
|
1247
|
+
name: "review-checklist.md",
|
|
1248
|
+
source: { type: "inline" },
|
|
1249
|
+
mention: { text: "@review-checklist.md", start: 32, end: 52 },
|
|
1250
|
+
},
|
|
1251
|
+
],
|
|
1252
|
+
agents: [{ name: "review", mention: { text: "@review", start: 4, end: 11 } }],
|
|
1253
|
+
},
|
|
1254
|
+
assistant({
|
|
1255
|
+
id: "msg_assistant_attachments",
|
|
1256
|
+
offset: 81_000,
|
|
1257
|
+
completed: 83_000,
|
|
1258
|
+
content: [
|
|
1259
|
+
{
|
|
1260
|
+
type: "text",
|
|
1261
|
+
text: "The attachment and line comment both point to the narrow timeline spacing. I kept the correction local.",
|
|
1262
|
+
},
|
|
1263
|
+
],
|
|
1264
|
+
}),
|
|
1265
|
+
] satisfies SessionMessageInfo[])
|
|
1266
|
+
|
|
1267
|
+
export const attachmentsAndCommentsPresentation = {
|
|
1268
|
+
msg_user_attachments: {
|
|
1269
|
+
comments: [
|
|
1270
|
+
{
|
|
1271
|
+
path: "packages/session-ui/src/timeline/session-timeline.tsx",
|
|
1272
|
+
comment: "Keep the row readable at 360 px without changing the production component.",
|
|
1273
|
+
selection: { startLine: 238, endLine: 241 },
|
|
1274
|
+
},
|
|
1275
|
+
],
|
|
1276
|
+
},
|
|
1277
|
+
} satisfies Record<string, SessionUserPresentation>
|
|
1278
|
+
|
|
1279
|
+
// The header and body as the OpenCode iOS app's `VoiceHandoff.format` writes them.
|
|
1280
|
+
const voiceHeader =
|
|
1281
|
+
"Voice delegation. The user is on a voice call with a voice agent, which hands their requests to you. Instruction is the user's own spoken words since the previous delegation, transcribed from speech, so it may contain recognition errors and disfluencies: resolve meaning from the complete utterance, not a disfluent prefix. Voice, when present, is how the voice agent framed the request. Transcript delta is the surrounding voice conversation, both sides, for context, not additional commands. Lead your reply with one or two plain sentences suitable for reading aloud, then any detail; answer only what was asked, with no unrequested tips. If this arrives while you are already working (a follow-up, nudge, or status check), answer it promptly: a clear status update, the finished result if you have enough, or the precise blocker or input you need; then continue on the fastest safe path."
|
|
1282
|
+
|
|
1283
|
+
const voiceInstruction =
|
|
1284
|
+
"okay so the upload test keeps failing on CI but only sometimes, can you look at the last few runs, figure out whether it's the retry timing or the fixture cleanup, and if it's the fixture just fix it and open a PR"
|
|
1285
|
+
|
|
1286
|
+
export const voiceDocument = document([
|
|
1287
|
+
user(
|
|
1288
|
+
"msg_user_voice",
|
|
1289
|
+
`${voiceHeader}\n${JSON.stringify({ instruction: "check the upload test", transcript_delta: ["user: check the upload test"], voice: "Checking the upload test." }, null, 2)}`,
|
|
1290
|
+
100_000,
|
|
1291
|
+
),
|
|
1292
|
+
assistant({
|
|
1293
|
+
id: "msg_assistant_voice",
|
|
1294
|
+
offset: 101_000,
|
|
1295
|
+
completed: 104_000,
|
|
1296
|
+
content: [{ type: "text", text: "The upload test is flaky on CI: it fails about one run in five." }],
|
|
1297
|
+
}),
|
|
1298
|
+
user(
|
|
1299
|
+
"msg_user_voice_continued",
|
|
1300
|
+
`Voice delegation (continued). Same fields as before.\n${JSON.stringify({ instruction: voiceInstruction, transcript_delta: [`user: ${voiceInstruction}`] }, null, 2)}`,
|
|
1301
|
+
110_000,
|
|
1302
|
+
),
|
|
1303
|
+
assistant({
|
|
1304
|
+
id: "msg_assistant_voice_continued",
|
|
1305
|
+
offset: 111_000,
|
|
1306
|
+
completed: 118_000,
|
|
1307
|
+
content: [{ type: "text", text: "It was the fixture cleanup. I fixed it and opened a pull request." }],
|
|
1308
|
+
}),
|
|
1309
|
+
user("msg_user_typed", "Thanks, merge it once CI is green.", 120_000),
|
|
1310
|
+
] satisfies SessionMessageInfo[])
|
|
1311
|
+
|
|
1312
|
+
export const voicePresentation = {
|
|
1313
|
+
msg_user_voice: { displayText: "Checking the upload test.", voice: true },
|
|
1314
|
+
msg_user_voice_continued: { displayText: voiceInstruction, voice: true },
|
|
1315
|
+
} satisfies Record<string, SessionUserPresentation>
|
|
1316
|
+
|
|
1317
|
+
export const revertDocument = document([
|
|
1318
|
+
user("msg_user_revert_base", "Add a compact Session summary.", 90_000),
|
|
1319
|
+
assistant({
|
|
1320
|
+
id: "msg_assistant_revert_base",
|
|
1321
|
+
offset: 91_000,
|
|
1322
|
+
completed: 93_000,
|
|
1323
|
+
content: [{ type: "text", text: "Added a compact summary with the current Session status." }],
|
|
1324
|
+
}),
|
|
1325
|
+
user("msg_user_revert_boundary", "Replace the summary with an animated dashboard.", 94_000),
|
|
1326
|
+
assistant({
|
|
1327
|
+
id: "msg_assistant_revert_boundary",
|
|
1328
|
+
offset: 95_000,
|
|
1329
|
+
completed: 98_000,
|
|
1330
|
+
content: [{ type: "text", text: "Created the dashboard draft. Use the user action menu to revert this boundary." }],
|
|
1331
|
+
}),
|
|
1332
|
+
] satisfies SessionMessageInfo[])
|
|
1333
|
+
|
|
1334
|
+
const largeMessages = Array.from({ length: 16 }, (_, index) => {
|
|
1335
|
+
const offset = 110_000 + index * 5_000
|
|
1336
|
+
const userID = `msg_user_large_${String(index + 1).padStart(2, "0")}`
|
|
1337
|
+
const assistantID = `msg_assistant_large_${String(index + 1).padStart(2, "0")}`
|
|
1338
|
+
|
|
1339
|
+
const context =
|
|
1340
|
+
index % 4 === 0
|
|
1341
|
+
? [
|
|
1342
|
+
completedTool({
|
|
1343
|
+
id: `tool_read_large_${String(index + 1).padStart(2, "0")}`,
|
|
1344
|
+
name: "read",
|
|
1345
|
+
offset: offset + 1_500,
|
|
1346
|
+
args: { path: `src/feature-${index + 1}.ts`, offset: 1, limit: 80 },
|
|
1347
|
+
output: `export const feature${index + 1} = true`,
|
|
1348
|
+
metadata: { loaded: [`src/feature-${index + 1}.ts`] },
|
|
1349
|
+
}),
|
|
1350
|
+
]
|
|
1351
|
+
: []
|
|
1352
|
+
|
|
1353
|
+
return [
|
|
1354
|
+
user(userID, `Complete deterministic Session UI checkpoint ${index + 1}.`, offset),
|
|
1355
|
+
assistant({
|
|
1356
|
+
id: assistantID,
|
|
1357
|
+
offset: offset + 1_000,
|
|
1358
|
+
completed: offset + 3_500,
|
|
1359
|
+
content: [
|
|
1360
|
+
...context,
|
|
1361
|
+
{
|
|
1362
|
+
type: "text",
|
|
1363
|
+
text: `Checkpoint ${index + 1} is complete. The message uses fixed protocol data and stable content.`,
|
|
1364
|
+
},
|
|
1365
|
+
],
|
|
1366
|
+
}),
|
|
1367
|
+
] satisfies SessionMessageInfo[]
|
|
1368
|
+
}).flat()
|
|
1369
|
+
|
|
1370
|
+
export const largeCompletedDocument = {
|
|
1371
|
+
sessionID: CURRENT_SESSION_ID,
|
|
1372
|
+
messages: largeMessages,
|
|
1373
|
+
status: { type: "idle" },
|
|
1374
|
+
diffs: [
|
|
1375
|
+
{
|
|
1376
|
+
file: "packages/session-ui/src/timeline/session-timeline.stories.tsx",
|
|
1377
|
+
patch: "@@ -0,0 +1,16 @@",
|
|
1378
|
+
additions: 16,
|
|
1379
|
+
deletions: 0,
|
|
1380
|
+
status: "added",
|
|
1381
|
+
},
|
|
1382
|
+
],
|
|
1383
|
+
} satisfies SessionDocument
|
|
1384
|
+
|
|
1385
|
+
export const activePermissionRequest = {
|
|
1386
|
+
id: "permission_publish_canary",
|
|
1387
|
+
sessionID: CURRENT_SESSION_ID,
|
|
1388
|
+
action: "shell",
|
|
1389
|
+
resources: ["npm publish --tag canary"],
|
|
1390
|
+
save: ["npm publish *"],
|
|
1391
|
+
source: { type: "tool", messageID: "msg_assistant_permission_pending", id: "tool_permission_pending" },
|
|
1392
|
+
} satisfies PermissionRequest
|
|
1393
|
+
|
|
1394
|
+
export function commentaryRuns() {
|
|
1395
|
+
const prompt = user("user", "Check the job", 0)
|
|
1396
|
+
|
|
1397
|
+
const idle = (id: string, offset: number) =>
|
|
1398
|
+
({ id, type: "idle", outcome: "succeeded", time: { created: STORY_TIME + offset } }) satisfies SessionMessageInfo
|
|
1399
|
+
|
|
1400
|
+
const notice = (id: string, offset: number) =>
|
|
1401
|
+
({
|
|
1402
|
+
id,
|
|
1403
|
+
type: "synthetic",
|
|
1404
|
+
text: "Job updated",
|
|
1405
|
+
description: "Job updated",
|
|
1406
|
+
metadata: { source: "console.watch" },
|
|
1407
|
+
time: { created: STORY_TIME + offset },
|
|
1408
|
+
}) satisfies SessionMessageInfo
|
|
1409
|
+
|
|
1410
|
+
const execute = (id: string, offset: number) =>
|
|
1411
|
+
completedTool({ id, name: "execute", offset, args: {}, output: "Done" })
|
|
1412
|
+
|
|
1413
|
+
const complete = [
|
|
1414
|
+
prompt,
|
|
1415
|
+
assistant({
|
|
1416
|
+
id: "reply",
|
|
1417
|
+
offset: 1_000,
|
|
1418
|
+
content: [{ type: "text", text: "The job is queued." }],
|
|
1419
|
+
completed: 2_000,
|
|
1420
|
+
}),
|
|
1421
|
+
idle("idle", 3_000),
|
|
1422
|
+
...[1, 2, 3].flatMap((index) => {
|
|
1423
|
+
const offset = index * 10_000
|
|
1424
|
+
|
|
1425
|
+
return [
|
|
1426
|
+
notice(`notice-${index}`, offset),
|
|
1427
|
+
assistant({
|
|
1428
|
+
id: `work-${index}`,
|
|
1429
|
+
offset: offset + 1_000,
|
|
1430
|
+
content: [{ type: "text", text: "Checking the update." }, execute(`tool-${index}`, offset + 1_000)],
|
|
1431
|
+
completed: offset + 2_000,
|
|
1432
|
+
}),
|
|
1433
|
+
assistant({
|
|
1434
|
+
id: `reply-${index}`,
|
|
1435
|
+
offset: offset + 3_000,
|
|
1436
|
+
content: [{ type: "text", text: "I checked the update." }],
|
|
1437
|
+
completed: offset + 4_000,
|
|
1438
|
+
}),
|
|
1439
|
+
idle(`idle-${index}`, offset + 5_000),
|
|
1440
|
+
]
|
|
1441
|
+
}),
|
|
1442
|
+
user("next-user", "Check the job again", 40_000),
|
|
1443
|
+
]
|
|
1444
|
+
|
|
1445
|
+
const prior = assistant({
|
|
1446
|
+
id: "prior",
|
|
1447
|
+
offset: 1_000,
|
|
1448
|
+
content: [{ type: "text", text: "Waiting for the result.", native: { phase: "commentary" } }],
|
|
1449
|
+
completed: 2_000,
|
|
1450
|
+
})
|
|
1451
|
+
|
|
1452
|
+
const wake = [
|
|
1453
|
+
notice("wake", 4_000),
|
|
1454
|
+
assistant({
|
|
1455
|
+
id: "working",
|
|
1456
|
+
offset: 5_000,
|
|
1457
|
+
content: [
|
|
1458
|
+
{ type: "text", text: "Checking again." },
|
|
1459
|
+
runningTool({ id: "running", name: "execute", offset: 5_000, args: {} }),
|
|
1460
|
+
],
|
|
1461
|
+
}),
|
|
1462
|
+
]
|
|
1463
|
+
|
|
1464
|
+
const busy = [prompt, prior, idle("idle", 3_000), ...wake]
|
|
1465
|
+
|
|
1466
|
+
const failed = [
|
|
1467
|
+
prompt,
|
|
1468
|
+
prior,
|
|
1469
|
+
{
|
|
1470
|
+
id: "failed",
|
|
1471
|
+
type: "idle",
|
|
1472
|
+
outcome: "failed",
|
|
1473
|
+
error: { type: "provider.no-route", message: "Model unavailable" },
|
|
1474
|
+
time: { created: STORY_TIME + 3_000 },
|
|
1475
|
+
},
|
|
1476
|
+
...wake,
|
|
1477
|
+
] satisfies SessionMessageInfo[]
|
|
1478
|
+
|
|
1479
|
+
const toolOnly = [
|
|
1480
|
+
...complete.slice(0, -1),
|
|
1481
|
+
notice("tool-only-notice", 40_000),
|
|
1482
|
+
assistant({
|
|
1483
|
+
id: "tool-only-work",
|
|
1484
|
+
offset: 41_000,
|
|
1485
|
+
content: [execute("tool-only-call", 41_000)],
|
|
1486
|
+
completed: 42_000,
|
|
1487
|
+
}),
|
|
1488
|
+
idle("tool-only-idle", 43_000),
|
|
1489
|
+
]
|
|
1490
|
+
|
|
1491
|
+
return { complete, busy, failed, toolOnly }
|
|
1492
|
+
}
|