@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,37 @@
|
|
|
1
|
+
import { expect, story } from "../../stories/playwright/story"
|
|
2
|
+
|
|
3
|
+
story("keeps the open Used header below the session title while scrolling", async ({ mount }) => {
|
|
4
|
+
const root = await mount("current-tool-group--sticky-header", { args: { height: "720" } })
|
|
5
|
+
const scroller = root.locator('[data-story="sticky-header-scroll"]')
|
|
6
|
+
const header = root.getByRole("button", { name: "Used 37 Write, Shell, Grep, Edit", exact: true })
|
|
7
|
+
|
|
8
|
+
const top = (locator: typeof header) =>
|
|
9
|
+
locator.evaluate((node) => {
|
|
10
|
+
const scroller = node.closest('[data-story="sticky-header-scroll"]')!
|
|
11
|
+
|
|
12
|
+
return node.getBoundingClientRect().top - scroller.getBoundingClientRect().top
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
expect(await scroller.evaluate((node) => node.scrollHeight > node.clientHeight * 2)).toBe(true)
|
|
16
|
+
await scroller.evaluate((node) => (node.scrollTop = 900))
|
|
17
|
+
await expect.poll(() => top(header)).toBe(48)
|
|
18
|
+
|
|
19
|
+
// Nested file headers stack below the stuck Used header instead of covering it.
|
|
20
|
+
const file = root.locator('[data-component="sticky-accordion-header"]').filter({ hasText: "model.ts" })
|
|
21
|
+
// Outside a timeline row the diff sizes itself only after it renders on screen (content-visibility: auto),
|
|
22
|
+
// and a header can stick only while its diff extends below it.
|
|
23
|
+
await expect
|
|
24
|
+
.poll(() => file.evaluate((node) => node.parentElement!.getBoundingClientRect().height))
|
|
25
|
+
.toBeGreaterThan(400)
|
|
26
|
+
await file.evaluate((node) => {
|
|
27
|
+
const scroller = node.closest<HTMLElement>('[data-story="sticky-header-scroll"]')!
|
|
28
|
+
scroller.scrollTop += node.getBoundingClientRect().top - scroller.getBoundingClientRect().top + 60
|
|
29
|
+
})
|
|
30
|
+
await expect.poll(() => top(header)).toBe(48)
|
|
31
|
+
await expect.poll(() => top(file)).toBe(84)
|
|
32
|
+
|
|
33
|
+
await header.click()
|
|
34
|
+
await expect(header).toHaveAttribute("aria-expanded", "false")
|
|
35
|
+
await expect.poll(() => top(header)).toBe(48)
|
|
36
|
+
await expect(root.locator('[data-slot="context-tool-group-item"]')).toHaveCount(0)
|
|
37
|
+
})
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import type { Locator } from "@playwright/test"
|
|
2
|
+
import { expect, story } from "../../stories/playwright/story"
|
|
3
|
+
|
|
4
|
+
// The digits drawn inside the count's clipped width, left to right. Each slot shows whichever visible glyph lines up
|
|
5
|
+
// with it, so a slot mid-roll reads "_", and the spare leading zero outside the width is skipped.
|
|
6
|
+
const shown = (count: Locator) =>
|
|
7
|
+
count.locator('[data-slot="animated-number-value"]').evaluate((value) => {
|
|
8
|
+
const clip = value.getBoundingClientRect()
|
|
9
|
+
|
|
10
|
+
return Array.from(value.querySelectorAll('[data-slot="animated-number-digit"]'), (slot) => ({
|
|
11
|
+
slot,
|
|
12
|
+
rect: slot.getBoundingClientRect(),
|
|
13
|
+
}))
|
|
14
|
+
.filter((item) => item.rect.left >= clip.left - 0.5 && item.rect.right <= clip.right + 0.5)
|
|
15
|
+
.toSorted((a, b) => a.rect.left - b.rect.left)
|
|
16
|
+
.map(
|
|
17
|
+
(item) =>
|
|
18
|
+
Array.from(item.slot.querySelectorAll("[data-digit]"))
|
|
19
|
+
.find(
|
|
20
|
+
(glyph) =>
|
|
21
|
+
getComputedStyle(glyph).visibility === "visible" &&
|
|
22
|
+
Math.abs(glyph.getBoundingClientRect().top - item.rect.top) < 0.5,
|
|
23
|
+
)
|
|
24
|
+
?.getAttribute("data-digit") ?? "_",
|
|
25
|
+
)
|
|
26
|
+
.join("")
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
for (const reasoningDefaultOpen of [false, true]) {
|
|
30
|
+
story(
|
|
31
|
+
`keeps ordered thoughts and tool-only counts with reasoning ${reasoningDefaultOpen ? "expanded" : "collapsed"}`,
|
|
32
|
+
async ({ mount }) => {
|
|
33
|
+
const root = await mount("current-tool-group--mixed-reasoning", { args: { reasoningDefaultOpen } })
|
|
34
|
+
const group = root.locator('[data-component="collapsed-tool-group"]')
|
|
35
|
+
const used = group.getByRole("button", { name: /^Used \d+ Read, Skill$/ })
|
|
36
|
+
const first = group.locator('[data-timeline-part-id="reasoning_first"]')
|
|
37
|
+
const second = group.locator('[data-timeline-part-id="reasoning_second"]')
|
|
38
|
+
await expect(used).toHaveAttribute("aria-expanded", "true")
|
|
39
|
+
await expect(used).toHaveAccessibleName("Used 4 Read, Skill")
|
|
40
|
+
await expect(group.locator('[data-component="context-tool-group-trigger"]')).toHaveAttribute(
|
|
41
|
+
"aria-label",
|
|
42
|
+
"Used 4 Read, Skill",
|
|
43
|
+
)
|
|
44
|
+
await expect(group.locator('[data-slot="context-tool-group-item"]')).toHaveText([
|
|
45
|
+
/Read.*group\.ts/,
|
|
46
|
+
/Thought/,
|
|
47
|
+
/Loaded.*opencode.*frontend-design.*skills/,
|
|
48
|
+
/Thought/,
|
|
49
|
+
/Loaded.*rtl-aware-development.*skill/,
|
|
50
|
+
])
|
|
51
|
+
await expect(
|
|
52
|
+
group.locator('[data-timeline-part-ids="reasoning_skill_first,reasoning_skill_second"]'),
|
|
53
|
+
).toBeVisible()
|
|
54
|
+
await expect(first.getByRole("button", { name: "Thought", exact: true })).toHaveAttribute(
|
|
55
|
+
"aria-expanded",
|
|
56
|
+
String(reasoningDefaultOpen),
|
|
57
|
+
)
|
|
58
|
+
await expect(second.getByRole("button", { name: "Thought", exact: true })).toHaveAttribute(
|
|
59
|
+
"aria-expanded",
|
|
60
|
+
String(reasoningDefaultOpen),
|
|
61
|
+
)
|
|
62
|
+
await first.getByRole("button", { name: "Thought", exact: true }).click()
|
|
63
|
+
await root.getByRole("button", { name: "Append follow-up read", exact: true }).click()
|
|
64
|
+
await expect(used).toHaveAccessibleName("Used 5 Read, Skill")
|
|
65
|
+
await expect(group.locator('[data-component="context-tool-group-trigger"]')).toHaveAttribute(
|
|
66
|
+
"aria-label",
|
|
67
|
+
"Used 5 Read, Skill",
|
|
68
|
+
)
|
|
69
|
+
await expect(group.locator('[data-slot="context-tool-group-item"]')).toHaveText([
|
|
70
|
+
/Read.*group\.ts/,
|
|
71
|
+
/Thought/,
|
|
72
|
+
/Loaded.*opencode.*frontend-design.*skills/,
|
|
73
|
+
/Thought/,
|
|
74
|
+
/Loaded.*rtl-aware-development.*skill/,
|
|
75
|
+
/Read.*group\.test\.ts/,
|
|
76
|
+
])
|
|
77
|
+
await expect(first.getByRole("button", { name: "Thought", exact: true })).toHaveAttribute(
|
|
78
|
+
"aria-expanded",
|
|
79
|
+
String(!reasoningDefaultOpen),
|
|
80
|
+
)
|
|
81
|
+
await expect(second.getByRole("button", { name: "Thought", exact: true })).toHaveAttribute(
|
|
82
|
+
"aria-expanded",
|
|
83
|
+
String(reasoningDefaultOpen),
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
if (reasoningDefaultOpen) {
|
|
87
|
+
await expect(
|
|
88
|
+
first.getByText("The renderer groups adjacent tools. Check the relevant skills before changing it."),
|
|
89
|
+
).toBeHidden()
|
|
90
|
+
|
|
91
|
+
return
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
await expect(
|
|
95
|
+
first.getByText("The renderer groups adjacent tools. Check the relevant skills before changing it."),
|
|
96
|
+
).toBeVisible()
|
|
97
|
+
},
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
story("summarizes subagents as Agent while retaining their card titles", async ({ mount }) => {
|
|
102
|
+
const root = await mount("current-tool-group--mixed-tools")
|
|
103
|
+
const group = root.locator('[data-component="collapsed-tool-group"]')
|
|
104
|
+
await expect(group.getByRole("button", { name: "Used 4 Shell, Read, Agent", exact: true })).toBeVisible()
|
|
105
|
+
const header = group.locator('[data-component="context-tool-group-trigger"]')
|
|
106
|
+
const prefix = header.locator('[data-slot="context-tool-group-prefix"]')
|
|
107
|
+
const count = header.locator('[data-slot="context-tool-group-count"]')
|
|
108
|
+
const title = header.locator('[data-slot="basic-tool-tool-title"]')
|
|
109
|
+
await expect(prefix).toHaveText("Used")
|
|
110
|
+
await expect(count).toHaveText("4")
|
|
111
|
+
await expect(title).toHaveText("Shell, Read, Agent")
|
|
112
|
+
await expect(title).toHaveCSS("white-space", "nowrap")
|
|
113
|
+
await expect(title).toHaveCSS("text-overflow", "ellipsis")
|
|
114
|
+
expect(await prefix.evaluate((node) => node.textContent)).toBe("Used")
|
|
115
|
+
expect(await count.evaluate((node) => node.textContent)).toBe("4")
|
|
116
|
+
expect(await prefix.locator("..").evaluate((node) => getComputedStyle(node).columnGap)).toBe("4px")
|
|
117
|
+
expect(await title.locator("..").evaluate((node) => getComputedStyle(node).columnGap)).toBe("4px")
|
|
118
|
+
expect(await count.evaluate((node) => getComputedStyle(node).fontVariantNumeric)).toBe("tabular-nums")
|
|
119
|
+
|
|
120
|
+
const colors = await Promise.all(
|
|
121
|
+
[prefix, count, title].map((part) => part.evaluate((node) => getComputedStyle(node).color)),
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
expect(colors[1]).toBe(colors[2])
|
|
125
|
+
expect(colors[0]).not.toBe(colors[1])
|
|
126
|
+
|
|
127
|
+
const gap = await group.evaluate((element) => {
|
|
128
|
+
const title = element.querySelector('[data-component="context-tool-group-trigger"]')!.getBoundingClientRect()
|
|
129
|
+
const arrow = element.querySelector('[data-slot="collapsible-arrow-icon"]')!.getBoundingClientRect()
|
|
130
|
+
|
|
131
|
+
return arrow.left - title.right
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
expect(gap).toBeLessThanOrEqual(8)
|
|
135
|
+
await expect(group.locator('[data-component="task-tool-title"]')).toHaveText(["General", "Explore"])
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
for (const direction of ["ltr", "rtl"]) {
|
|
139
|
+
story(`reads and shows a two-digit count once, in order, in ${direction}`, async ({ mount, page }) => {
|
|
140
|
+
const root = await mount("current-tool-group--sticky-header", { globals: { direction } })
|
|
141
|
+
const count = root.locator('[data-component="context-tool-group-trigger"] [data-slot="context-tool-group-count"]')
|
|
142
|
+
await expect(count).toHaveText("37")
|
|
143
|
+
expect(await count.ariaSnapshot()).toBe('- text: "37"')
|
|
144
|
+
// The clipped width follows the web font's metrics.
|
|
145
|
+
await page.evaluate(() => document.fonts.ready.then(() => undefined))
|
|
146
|
+
expect(await shown(count)).toBe("37")
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
story("does not animate the count on mount or when its font changes", async ({ mount }) => {
|
|
151
|
+
const root = await mount("current-tool-group--sticky-header")
|
|
152
|
+
const count = root.locator('[data-component="context-tool-group-trigger"] [data-slot="context-tool-group-count"]')
|
|
153
|
+
await expect(count).toHaveText("37")
|
|
154
|
+
expect(await count.evaluate((element) => element.getAnimations({ subtree: true }).length)).toBe(0)
|
|
155
|
+
|
|
156
|
+
// Like a late web font swap or a zoom change: the digit width changes without the count changing.
|
|
157
|
+
await count.evaluate((element) => {
|
|
158
|
+
element.style.fontSize = "20px"
|
|
159
|
+
})
|
|
160
|
+
expect(await count.evaluate((element) => element.getAnimations({ subtree: true }).length)).toBe(0)
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
story("settles count changes made while detached, without rolling", async ({ mount }) => {
|
|
164
|
+
const root = await mount("current-tool-group--count-rollover")
|
|
165
|
+
const count = root.locator('[data-component="context-tool-group-trigger"] [data-slot="context-tool-group-count"]')
|
|
166
|
+
await expect(count).toHaveText("9")
|
|
167
|
+
|
|
168
|
+
// A background session keeps adding tools while its cached timeline is detached.
|
|
169
|
+
await root.getByRole("button", { name: "Detach" }).click()
|
|
170
|
+
|
|
171
|
+
for (let added = 0; added < 12; added++) await root.getByRole("button", { name: "Add read" }).click()
|
|
172
|
+
|
|
173
|
+
await root.getByRole("button", { name: "Attach" }).click()
|
|
174
|
+
|
|
175
|
+
await expect(count).toHaveText("21")
|
|
176
|
+
expect(await count.evaluate((element) => element.getAnimations({ subtree: true }).length)).toBe(0)
|
|
177
|
+
await expect(count.locator('[data-animating="true"]')).toHaveCount(0)
|
|
178
|
+
expect(await shown(count)).toBe("21")
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
story("keeps a digit rolling when the count changes again mid-roll", async ({ mount, page }) => {
|
|
182
|
+
const root = await mount("current-tool-group--count-rollover")
|
|
183
|
+
const count = root.locator('[data-component="context-tool-group-trigger"] [data-slot="context-tool-group-count"]')
|
|
184
|
+
// A slow roll keeps the second change inside the first roll on a loaded machine.
|
|
185
|
+
await page.addStyleTag({ content: ":root { --tool-motion-odometer-ms: 5000ms }" })
|
|
186
|
+
await expect(count).toHaveText("9")
|
|
187
|
+
|
|
188
|
+
await root.getByRole("button", { name: "Add read" }).click()
|
|
189
|
+
await root.getByRole("button", { name: "Add read" }).click()
|
|
190
|
+
await expect(count).toHaveText("11")
|
|
191
|
+
// 9 -> 10 starts the tens digit rolling; 10 -> 11 leaves it unchanged, so it finishes its roll instead of jumping.
|
|
192
|
+
await expect(count.locator('[data-animating="true"]')).toHaveCount(2)
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
story("rolls the leading digit in and out when the count gains or loses a digit", async ({ mount }) => {
|
|
196
|
+
const root = await mount("current-tool-group--count-rollover")
|
|
197
|
+
const count = root.locator('[data-component="context-tool-group-trigger"] [data-slot="context-tool-group-count"]')
|
|
198
|
+
const rolling = count.locator('[data-animating="true"]')
|
|
199
|
+
await expect(count).toHaveText("9")
|
|
200
|
+
|
|
201
|
+
await root.getByRole("button", { name: "Add read" }).click()
|
|
202
|
+
// The tens digit rolls in from zero beside the ones digit instead of appearing.
|
|
203
|
+
await expect(rolling).toHaveCount(2)
|
|
204
|
+
expect(await count.ariaSnapshot()).toBe('- text: "10"')
|
|
205
|
+
await expect(rolling).toHaveCount(0)
|
|
206
|
+
|
|
207
|
+
await root.getByRole("button", { name: "Remove read" }).click()
|
|
208
|
+
// The tens digit rolls back to zero before it leaves instead of vanishing.
|
|
209
|
+
await expect(rolling).toHaveCount(2)
|
|
210
|
+
expect(await count.ariaSnapshot()).toBe('- text: "9"')
|
|
211
|
+
await expect(rolling).toHaveCount(0)
|
|
212
|
+
await expect(count).toHaveText("9")
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
story("rolls the count and exposes only its current value while rolling", async ({ mount }) => {
|
|
216
|
+
const root = await mount("current-tool-group--mixed-reasoning")
|
|
217
|
+
const count = root.locator('[data-component="context-tool-group-trigger"] [data-slot="context-tool-group-count"]')
|
|
218
|
+
await expect(count).toHaveText("4")
|
|
219
|
+
await root.getByRole("button", { name: "Append follow-up read" }).click()
|
|
220
|
+
await expect(count.locator('[data-animating="true"]')).toHaveCount(1)
|
|
221
|
+
// One read mid-roll: a retrying assertion would pass once the strip hides again.
|
|
222
|
+
expect(await count.ariaSnapshot()).toBe('- text: "5"')
|
|
223
|
+
await expect(count).toHaveText("5")
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
for (const width of [840, 390]) {
|
|
227
|
+
story(`keeps grouped cards inside their trigger bounds at ${width}px`, async ({ mount, page }) => {
|
|
228
|
+
await page.setViewportSize({ width, height: 600 })
|
|
229
|
+
const root = await mount("current-tool-group--mixed-tools")
|
|
230
|
+
const group = root.locator('[data-component="collapsed-tool-group"]')
|
|
231
|
+
const trigger = group.getByRole("button", { name: "Used 4 Shell, Read, Agent", exact: true })
|
|
232
|
+
const header = group.locator('[data-component="context-tool-group-trigger"]')
|
|
233
|
+
await expect(header).toHaveAttribute("aria-label", "Used 4 Shell, Read, Agent")
|
|
234
|
+
await expect(header.locator('[data-component="tag"]')).toHaveCount(0)
|
|
235
|
+
await expect(trigger).toHaveAttribute("aria-expanded", "true")
|
|
236
|
+
|
|
237
|
+
for (const action of ["click", "Enter", "Space"] as const) {
|
|
238
|
+
if (action === "click") await trigger.click()
|
|
239
|
+
|
|
240
|
+
if (action !== "click") await trigger.press(action)
|
|
241
|
+
await expect(trigger).toHaveAttribute("aria-expanded", "false")
|
|
242
|
+
await expect(group.locator('[data-component="context-tool-group-list"]')).toBeHidden()
|
|
243
|
+
await expect(trigger).toBeFocused()
|
|
244
|
+
|
|
245
|
+
if (action === "click") await trigger.click()
|
|
246
|
+
|
|
247
|
+
if (action !== "click") await trigger.press(action)
|
|
248
|
+
await expect(trigger).toHaveAttribute("aria-expanded", "true")
|
|
249
|
+
await expect(group.locator('[data-component="context-tool-group-list"]')).toBeVisible()
|
|
250
|
+
await expect(trigger).toBeFocused()
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const cards = group.locator('[data-component="task-tool-surface"]')
|
|
254
|
+
await expect(cards).toHaveCount(2)
|
|
255
|
+
await expect
|
|
256
|
+
.poll(() =>
|
|
257
|
+
cards.evaluateAll((nodes) =>
|
|
258
|
+
nodes.map((node) => {
|
|
259
|
+
const card = node.getBoundingClientRect()
|
|
260
|
+
const trigger = node.closest('[data-component="tool-trigger"]')!.getBoundingClientRect()
|
|
261
|
+
const item = node.closest('[data-slot="context-tool-group-item"]')!.getBoundingClientRect()
|
|
262
|
+
|
|
263
|
+
return (
|
|
264
|
+
card.height === 36 &&
|
|
265
|
+
card.top >= trigger.top &&
|
|
266
|
+
card.bottom <= trigger.bottom &&
|
|
267
|
+
card.top >= item.top &&
|
|
268
|
+
card.bottom <= item.bottom
|
|
269
|
+
)
|
|
270
|
+
}),
|
|
271
|
+
),
|
|
272
|
+
)
|
|
273
|
+
.toEqual([true, true])
|
|
274
|
+
const shell = group.locator('[data-timeline-part-id="group_shell"]')
|
|
275
|
+
await expect(shell.locator('[data-slot="collapsible-trigger"]')).toHaveCSS("height", "28px")
|
|
276
|
+
await shell.getByRole("button").click()
|
|
277
|
+
await expect(shell.locator('[data-slot="bash-command"]')).toHaveText("printf 'group geometry'")
|
|
278
|
+
await expect(shell.locator('[data-slot="bash-result"]')).toHaveText("group geometry")
|
|
279
|
+
await expect
|
|
280
|
+
.poll(() =>
|
|
281
|
+
shell.evaluate((node) => {
|
|
282
|
+
const card = node.querySelector('[data-component="bash-output"]')!.getBoundingClientRect()
|
|
283
|
+
const item = node.closest('[data-slot="context-tool-group-item"]')!.getBoundingClientRect()
|
|
284
|
+
|
|
285
|
+
return card.top >= item.top && card.bottom <= item.bottom
|
|
286
|
+
}),
|
|
287
|
+
)
|
|
288
|
+
.toBe(true)
|
|
289
|
+
})
|
|
290
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createSignal } from "solid-js"
|
|
2
|
+
import { render } from "solid-js/web"
|
|
3
|
+
import { ToolStatusTitle } from "../src/components/tool-status-title"
|
|
4
|
+
|
|
5
|
+
export function mountToolStatusTitle() {
|
|
6
|
+
const host = document.createElement("div")
|
|
7
|
+
host.dataset.testid = "tool-status-title-fixture"
|
|
8
|
+
document.body.appendChild(host)
|
|
9
|
+
const [active, setActive] = createSignal(true)
|
|
10
|
+
const [hidden, setHidden] = createSignal(false)
|
|
11
|
+
|
|
12
|
+
render(
|
|
13
|
+
() => (
|
|
14
|
+
<div style={{ display: hidden() ? "none" : "block" }}>
|
|
15
|
+
<ToolStatusTitle active={active()} activeText="Exploring" doneText="Explored" split={false} />
|
|
16
|
+
</div>
|
|
17
|
+
),
|
|
18
|
+
host,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
return { setActive, setHidden }
|
|
22
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { expect, sourceURL, story } from "../../stories/playwright/story"
|
|
2
|
+
|
|
3
|
+
const fixture = sourceURL(new URL("./tool-status-title.fixture.tsx", import.meta.url))
|
|
4
|
+
|
|
5
|
+
story("shows a title that finished in a hidden tab at once when the tab shows again", async ({ mount, page }) => {
|
|
6
|
+
await mount("components-animated-count-list--completed")
|
|
7
|
+
|
|
8
|
+
const width = await page.evaluate(async (fixture) => {
|
|
9
|
+
const { mountToolStatusTitle } = await import(fixture)
|
|
10
|
+
const title = mountToolStatusTitle()
|
|
11
|
+
title.setHidden(true)
|
|
12
|
+
title.setActive(false)
|
|
13
|
+
// The title measures its new width on the next frame.
|
|
14
|
+
await new Promise(requestAnimationFrame)
|
|
15
|
+
await new Promise(requestAnimationFrame)
|
|
16
|
+
title.setHidden(false)
|
|
17
|
+
|
|
18
|
+
return document.querySelector<HTMLElement>(
|
|
19
|
+
'[data-testid="tool-status-title-fixture"] [data-slot="tool-status-swap"]',
|
|
20
|
+
)!.style.width
|
|
21
|
+
}, fixture)
|
|
22
|
+
|
|
23
|
+
// Before the machine, the hidden title measured 0px and kept that width, clipping "Explored" for 600 ms.
|
|
24
|
+
expect(width).toBe("")
|
|
25
|
+
const title = page.getByTestId("tool-status-title-fixture").locator('[data-component="tool-status-title"]')
|
|
26
|
+
await expect(title).toHaveAttribute("data-ready", "false")
|
|
27
|
+
await expect(title).toHaveAttribute("aria-label", "Explored")
|
|
28
|
+
await expect(title.locator('[data-slot="tool-status-done"]')).toBeVisible()
|
|
29
|
+
await expect(title.locator('[data-slot="tool-status-active"]')).toHaveCount(0)
|
|
30
|
+
})
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { expect, story } from "../../stories/playwright/story"
|
|
2
|
+
|
|
3
|
+
// Each story renders a case twice: with comment cards (inlineQuotes off), then inline (on).
|
|
4
|
+
|
|
5
|
+
story("shows a quote-only prompt as a bubble inline and as cards when the gate is off", async ({ mount }) => {
|
|
6
|
+
const root = await mount("current-prompt-quotes--one-commented")
|
|
7
|
+
const messages = root.locator('[data-component="user-message"]')
|
|
8
|
+
|
|
9
|
+
await expect(messages.nth(0).locator('[data-component="attachment-card"]')).toHaveCount(1)
|
|
10
|
+
await expect(messages.nth(0).locator('[data-slot="user-message-quotes"]')).toHaveCount(0)
|
|
11
|
+
|
|
12
|
+
const bubble = messages.nth(1).locator('[data-slot="user-message-text"]')
|
|
13
|
+
await expect(bubble.locator('[data-slot="user-message-quote"]')).toHaveText("gap-2 on the Projects section")
|
|
14
|
+
await expect(bubble.locator('[data-slot="user-message-quote-comment"]')).toHaveText("drop it to gap 1")
|
|
15
|
+
await expect(messages.nth(1).locator('[data-component="attachment-card"]')).toHaveCount(0)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
story("puts the composer text before the quotes, each comment under its quote", async ({ mount }) => {
|
|
19
|
+
const bubble = (await mount("current-prompt-quotes--mixed"))
|
|
20
|
+
.locator('[data-component="user-message"]')
|
|
21
|
+
.nth(1)
|
|
22
|
+
.locator('[data-slot="user-message-text"]')
|
|
23
|
+
|
|
24
|
+
await expect(bubble).toContainText("and run the sidebar story at 360px after")
|
|
25
|
+
|
|
26
|
+
const order = await bubble.evaluate((element) => {
|
|
27
|
+
const text = element.textContent ?? ""
|
|
28
|
+
|
|
29
|
+
return [
|
|
30
|
+
text.indexOf("and run the sidebar story"),
|
|
31
|
+
text.indexOf("gap-2 on the Projects section"),
|
|
32
|
+
text.indexOf("drop it to gap 1"),
|
|
33
|
+
text.indexOf("gap-2 in the Pinned group"),
|
|
34
|
+
]
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
expect(order).toEqual([...order].sort((a, b) => a - b))
|
|
38
|
+
await expect(bubble.locator('[data-slot="user-message-quote-group"]')).toHaveCount(3)
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
story("clamps a long quote, which opens and closes by click and keyboard", async ({ mount, page }) => {
|
|
42
|
+
const bubble = (await mount("current-prompt-quotes--short-and-long"))
|
|
43
|
+
.locator('[data-component="user-message"]')
|
|
44
|
+
.nth(1)
|
|
45
|
+
|
|
46
|
+
await page.evaluate(() => document.fonts.ready.then(() => undefined))
|
|
47
|
+
|
|
48
|
+
const short = bubble.locator('[data-slot="user-message-quote-text"]').filter({ hasText: "The menu is hovered." })
|
|
49
|
+
const long = bubble.locator('[data-slot="user-message-quote-text"]').filter({ hasText: "The scrollbar thumb" })
|
|
50
|
+
|
|
51
|
+
await expect(short).not.toHaveAttribute("role", "button")
|
|
52
|
+
await expect(long).toHaveAttribute("aria-expanded", "false")
|
|
53
|
+
|
|
54
|
+
const muted = await long.evaluate((element) => getComputedStyle(element).color)
|
|
55
|
+
await long.hover()
|
|
56
|
+
await expect(long).not.toHaveCSS("color", muted)
|
|
57
|
+
|
|
58
|
+
const clamped = await long.evaluate((element) => element.clientHeight)
|
|
59
|
+
await long.click()
|
|
60
|
+
await expect(long).toHaveAttribute("aria-expanded", "true")
|
|
61
|
+
expect(await long.evaluate((element) => element.clientHeight)).toBeGreaterThan(clamped)
|
|
62
|
+
|
|
63
|
+
await long.press("Enter")
|
|
64
|
+
await expect(long).toHaveAttribute("aria-expanded", "false")
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
story("keeps a quote expandable after resizing its bubble", async ({ mount, page }) => {
|
|
68
|
+
const message = (await mount("current-prompt-quotes--source", { args: { width: "840" } }))
|
|
69
|
+
.locator('[data-component="user-message"]')
|
|
70
|
+
.nth(1)
|
|
71
|
+
|
|
72
|
+
await page.evaluate(() => document.fonts.ready.then(() => undefined))
|
|
73
|
+
|
|
74
|
+
const quote = message.locator('[data-slot="user-message-quote-text"]').filter({ hasText: "Cannot find module" })
|
|
75
|
+
|
|
76
|
+
await expect(quote).not.toHaveAttribute("role", "button")
|
|
77
|
+
await message.evaluate((element) => {
|
|
78
|
+
element.style.maxWidth = "240px"
|
|
79
|
+
})
|
|
80
|
+
await expect(quote).toHaveAttribute("aria-expanded", "false")
|
|
81
|
+
await quote.click()
|
|
82
|
+
await expect(quote).toHaveAttribute("aria-expanded", "true")
|
|
83
|
+
expect(await quote.evaluate((element) => element.scrollHeight > element.clientHeight)).toBe(false)
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
story("folds the whole bubble, quotes included, with Collapse long messages", async ({ mount }) => {
|
|
87
|
+
const message = (await mount("current-prompt-quotes--fold-and-expand"))
|
|
88
|
+
.locator('[data-component="user-message"]')
|
|
89
|
+
.nth(1)
|
|
90
|
+
|
|
91
|
+
const fold = message.locator('[data-slot="user-message-fold"]')
|
|
92
|
+
|
|
93
|
+
await expect(fold).toHaveAttribute("data-folded", "")
|
|
94
|
+
await expect(fold.locator('[data-slot="user-message-quotes"]')).toHaveCount(1)
|
|
95
|
+
|
|
96
|
+
await message.locator('[data-slot="user-message-fold-toggle"]').click()
|
|
97
|
+
await expect(fold).not.toHaveAttribute("data-folded", "")
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
story("puts the bar at the start of a right-to-left message", async ({ mount }) => {
|
|
101
|
+
const message = (await mount("current-prompt-quotes--all-cases-rtl"))
|
|
102
|
+
.locator('[data-component="user-message"]')
|
|
103
|
+
.nth(1)
|
|
104
|
+
|
|
105
|
+
const quote = message.locator('[data-slot="user-message-quote"]').first()
|
|
106
|
+
const text = quote.locator('[data-slot="user-message-quote-text"]')
|
|
107
|
+
|
|
108
|
+
await expect(message.locator('[data-slot="user-message-text"]')).toHaveCSS("direction", "rtl")
|
|
109
|
+
await expect(quote).toHaveCSS("border-right-width", "2px")
|
|
110
|
+
expect(await text.evaluate((element) => getComputedStyle(element).textAlign)).toBe("right")
|
|
111
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,93 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zyro-sec/session-ui",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"exports": {
|
|
7
|
+
"./actions": "./src/actions.ts",
|
|
8
|
+
"./document": "./src/document.ts",
|
|
9
|
+
"./message": "./src/message/current-message.tsx",
|
|
10
|
+
"./timeline/projection": "./src/timeline/projection.ts",
|
|
11
|
+
"./timeline/detail": "./src/timeline/detail.ts",
|
|
12
|
+
"./timeline/row": "./src/timeline/session-timeline-row.tsx",
|
|
13
|
+
"./timeline": "./src/timeline/session-timeline.tsx",
|
|
14
|
+
"./timeline-next": "./src/timeline-next/index.ts",
|
|
15
|
+
"./basic-tool": "./src/components/basic-tool.tsx",
|
|
16
|
+
"./copy": "./src/components/copy.ts",
|
|
17
|
+
"./dock-prompt": "./src/components/dock-prompt.tsx",
|
|
18
|
+
"./file": "./src/components/file.tsx",
|
|
19
|
+
"./file-media": "./src/components/file-media.tsx",
|
|
20
|
+
"./file-search": "./src/components/file-search.tsx",
|
|
21
|
+
"./linked-text": "./src/components/linked-text.tsx",
|
|
22
|
+
"./line-comment": "./src/components/line-comment.tsx",
|
|
23
|
+
"./line-comment-annotations": "./src/components/line-comment-annotations.tsx",
|
|
24
|
+
"./markdown": "./src/components/markdown.tsx",
|
|
25
|
+
"./message-part": "./src/components/message-part.tsx",
|
|
26
|
+
"./message-nav": "./src/components/message-nav.tsx",
|
|
27
|
+
"./session-review": "./src/components/session-review.tsx",
|
|
28
|
+
"./session-retry": "./src/components/session-retry.tsx",
|
|
29
|
+
"./tool-count-label": "./src/components/tool-count-label.tsx",
|
|
30
|
+
"./tool-count-summary": "./src/components/tool-count-summary.tsx",
|
|
31
|
+
"./tool-error-card": "./src/components/tool-error-card.tsx",
|
|
32
|
+
"./tool-status-title": "./src/components/tool-status-title.tsx",
|
|
33
|
+
"./session-diff": "./src/components/session-diff.ts",
|
|
34
|
+
"./message-file": "./src/components/message-file.ts",
|
|
35
|
+
"./attachment-card": "./src/message/attachment-card.tsx",
|
|
36
|
+
"./comment-card": "./src/message/comment-card.tsx",
|
|
37
|
+
"./markdown-stream": "./src/components/markdown-stream.ts",
|
|
38
|
+
"./markdown-cache": "./src/components/markdown-cache.tsx",
|
|
39
|
+
"./line-comment-styles": "./src/components/line-comment-styles.ts",
|
|
40
|
+
"./pierre": "./src/pierre/index.ts",
|
|
41
|
+
"./pierre/*": "./src/pierre/*.ts",
|
|
42
|
+
"./context": "./src/context/index.ts",
|
|
43
|
+
"./context/*": "./src/context/*.tsx",
|
|
44
|
+
"./sources": "./src/sources/sources.ts",
|
|
45
|
+
"./sources/experiment": "./src/sources/experiment.ts",
|
|
46
|
+
"./sources/panel": "./src/sources/sources-panel.tsx",
|
|
47
|
+
"./sources/title": "./src/sources/sources-title.tsx",
|
|
48
|
+
"./styles": "./src/styles/index.css",
|
|
49
|
+
"./storybook": "./src/storybook/index.ts",
|
|
50
|
+
"./tools/ansi": "./src/tools/ansi.ts",
|
|
51
|
+
"./tools/shell-output": "./src/tools/shell-output.ts",
|
|
52
|
+
"./v2/*.css": "./src/v2/components/*.css",
|
|
53
|
+
"./v2/*": "./src/v2/components/*.tsx"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"typecheck": "bun check --no-script -b",
|
|
57
|
+
"typecheck:tsc": "tsc -b",
|
|
58
|
+
"test": "bun test src --only-failures",
|
|
59
|
+
"test:components": "playwright test --config playwright.components.config.ts",
|
|
60
|
+
"test:components:ui": "playwright test --config playwright.components.config.ts --ui"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@happy-dom/global-registrator": "20.0.11",
|
|
64
|
+
"@playwright/test": "1.60.0",
|
|
65
|
+
"@tsconfig/node22": "22.0.2",
|
|
66
|
+
"@types/bun": "1.4.3",
|
|
67
|
+
"@typescript/native": "npm:typescript@7.1.0-beta",
|
|
68
|
+
"vite": "7.3.7",
|
|
69
|
+
"vite-plugin-solid": "2.11.10"
|
|
70
|
+
},
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"@kitlangton/solid-motion": "0.2.2",
|
|
73
|
+
"@kobalte/core": "0.13.13",
|
|
74
|
+
"@zyro-sec/client": "^1.0.4",
|
|
75
|
+
"@zyro-sec/patchmark": "^1.0.4",
|
|
76
|
+
"@zyro-sec/ui": "^1.0.4",
|
|
77
|
+
"@zyro-sec/util": "^1.0.4",
|
|
78
|
+
"@pierre/diffs": "1.6.1",
|
|
79
|
+
"@pierre/highlights": "0.2.0",
|
|
80
|
+
"@solid-primitives/event-listener": "2.4.6",
|
|
81
|
+
"@solid-primitives/media": "2.3.6",
|
|
82
|
+
"@solid-primitives/resize-observer": "2.2.0",
|
|
83
|
+
"diff": "8.0.4",
|
|
84
|
+
"effect": "4.1.0",
|
|
85
|
+
"dompurify": "3.4.17",
|
|
86
|
+
"marked": "18.0.11",
|
|
87
|
+
"pele": "1.7.0",
|
|
88
|
+
"solid-js": "1.9.17"
|
|
89
|
+
},
|
|
90
|
+
"publishConfig": {
|
|
91
|
+
"access": "public"
|
|
92
|
+
}
|
|
93
|
+
}
|
package/src/actions.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { PromptAttachment } from "@zyro-sec/client/promise"
|
|
2
|
+
|
|
3
|
+
export type SessionUserComment =
|
|
4
|
+
| {
|
|
5
|
+
type?: "file"
|
|
6
|
+
path: string
|
|
7
|
+
comment: string
|
|
8
|
+
selection?: {
|
|
9
|
+
startLine: number
|
|
10
|
+
endLine: number
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
| {
|
|
14
|
+
/** A comment on something other than file lines, such as an element picked in a page. */
|
|
15
|
+
type: "note"
|
|
16
|
+
comment: string
|
|
17
|
+
label: string
|
|
18
|
+
title?: string
|
|
19
|
+
subtitle?: string
|
|
20
|
+
icon: string
|
|
21
|
+
}
|
|
22
|
+
| {
|
|
23
|
+
/** Plain text quoted from the session timeline, or from the named source, with an optional comment. */
|
|
24
|
+
type: "quote"
|
|
25
|
+
text: string
|
|
26
|
+
comment?: string
|
|
27
|
+
source?: { label: string; icon: string }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** An attachment delivered to the model as a path on the server instead of inline bytes. */
|
|
31
|
+
export type SessionUserAttachmentReference = {
|
|
32
|
+
name: string
|
|
33
|
+
mime: string
|
|
34
|
+
path: string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type SessionUserActions = {
|
|
38
|
+
openAttachment?: (file: PromptAttachment) => void
|
|
39
|
+
/** Opens the model picker, which a budget notice offers when a budget pauses the model in use. */
|
|
40
|
+
chooseModel?: () => void
|
|
41
|
+
revert?: (input: { sessionID: string; messageID: string }) => Promise<void> | void
|
|
42
|
+
/** Starts a new session with the history before this message and its prompt in the composer. */
|
|
43
|
+
fork?: (input: { sessionID: string; messageID: string }) => Promise<void> | void
|
|
44
|
+
/**
|
|
45
|
+
* An input the server has not delivered yet. Like the TUI, a pending steer can move to the queue or be deleted;
|
|
46
|
+
* it shows as waiting only while `steering` behind delivered work or `stranded` by an execution that ended.
|
|
47
|
+
* `sending` is a prompt this client shows before it can send it; it waits without actions until the server has it.
|
|
48
|
+
*/
|
|
49
|
+
pending?: {
|
|
50
|
+
status: (messageID: string) => "starting" | "steering" | "stranded" | "queued" | "sending" | undefined
|
|
51
|
+
queue: (input: { sessionID: string; messageID: string }) => Promise<void>
|
|
52
|
+
remove: (input: { sessionID: string; messageID: string }) => Promise<void>
|
|
53
|
+
}
|
|
54
|
+
}
|