@cueloop/client 0.1.0-alpha.66 → 0.1.0-alpha.67

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.
Files changed (115) hide show
  1. package/package.json +6 -5
  2. package/src/App.autoclose.test.tsx +2 -2
  3. package/src/App.diff.test.tsx +71 -39
  4. package/src/App.plan-review.test.tsx +20 -21
  5. package/src/App.readonly.test.tsx +7 -3
  6. package/src/App.test.tsx +73 -14
  7. package/src/App.tsx +375 -129
  8. package/src/App.walk.test.tsx +14 -15
  9. package/src/App.workbench.test.tsx +390 -0
  10. package/src/__snapshots__/view-plan.regression.test.ts.snap +1 -1
  11. package/src/annotation-palette.ts +61 -0
  12. package/src/app-screens.tsx +176 -45
  13. package/src/app-view-model.ts +7 -65
  14. package/src/components/AnnotationCard.tsx +1 -1
  15. package/src/components/AnnotationCards.stories.tsx +87 -0
  16. package/src/components/AnnotationCards.tsx +303 -0
  17. package/src/components/AppHeader.stories.tsx +50 -0
  18. package/src/components/AppHeader.tsx +83 -0
  19. package/src/components/AppShell.stories.tsx +47 -42
  20. package/src/components/AppShell.tsx +212 -100
  21. package/src/components/AppShell.zoom.test.tsx +94 -0
  22. package/src/components/ChangesColumn.tsx +49 -26
  23. package/src/components/DiffSheet.scroll.test.tsx +38 -55
  24. package/src/components/DiffSheet.split.test.tsx +140 -0
  25. package/src/components/DiffSheet.stories.tsx +55 -53
  26. package/src/components/DiffSheet.syntax.test.tsx +24 -7
  27. package/src/components/DiffSheet.tsx +607 -276
  28. package/src/components/DiscussionMarkerRail.stories.tsx +54 -0
  29. package/src/components/DiscussionMarkerRail.tsx +181 -0
  30. package/src/components/EditorGrid.stories.tsx +59 -0
  31. package/src/components/EditorGrid.tabs.test.tsx +105 -0
  32. package/src/components/EditorGrid.tsx +338 -0
  33. package/src/components/EditorGrid.zoom.test.tsx +68 -0
  34. package/src/components/FileContentsView.stories.tsx +16 -0
  35. package/src/components/FileContentsView.test.tsx +29 -0
  36. package/src/components/FileContentsView.tsx +78 -0
  37. package/src/components/InboxList.tsx +159 -30
  38. package/src/components/PaneGrid.stories.tsx +84 -0
  39. package/src/components/PaneGrid.tsx +128 -0
  40. package/src/components/PanelColumn.stories.tsx +25 -0
  41. package/src/components/PanelColumn.tsx +95 -0
  42. package/src/components/ProjectTreeView.stories.tsx +25 -0
  43. package/src/components/ProjectTreeView.test.tsx +32 -0
  44. package/src/components/ProjectTreeView.tsx +82 -0
  45. package/src/components/PromptDialog.tsx +8 -1
  46. package/src/components/RootOverlay.stories.tsx +44 -0
  47. package/src/components/RootOverlay.tsx +35 -0
  48. package/src/components/SettingsDialog.tsx +2 -1
  49. package/src/components/SurfaceScrollbar.stories.tsx +34 -0
  50. package/src/components/SurfaceScrollbar.test.tsx +111 -0
  51. package/src/components/SurfaceScrollbar.tsx +93 -0
  52. package/src/components/ThreadFooter.stories.tsx +2 -2
  53. package/src/components/ThreadFooter.test.tsx +31 -0
  54. package/src/components/ThreadFooter.tsx +12 -7
  55. package/src/components/ThreadView.tsx +62 -1440
  56. package/src/components/ThreadsSidebar.tsx +14 -1
  57. package/src/components/Tooltip.stories.tsx +26 -0
  58. package/src/components/Tooltip.tsx +72 -0
  59. package/src/components/WelcomeSurface.stories.tsx +12 -0
  60. package/src/components/WelcomeSurface.tsx +52 -0
  61. package/src/components/__snapshots__/stories.test.tsx.snap +509 -559
  62. package/src/components/diff-sheet-layout.test.ts +125 -55
  63. package/src/components/diff-sheet-layout.ts +3 -103
  64. package/src/components/editor-grid.test.ts +86 -0
  65. package/src/components/editor-grid.ts +138 -0
  66. package/src/components/fade-title.test.ts +49 -0
  67. package/src/components/fade-title.ts +61 -0
  68. package/src/components/file-tree.test.ts +15 -0
  69. package/src/components/file-tree.ts +59 -4
  70. package/src/components/pages/Workspace.stories.tsx +2 -2
  71. package/src/components/primitives/IconButton.tsx +21 -2
  72. package/src/components/primitives/Tree.tsx +13 -4
  73. package/src/components/primitives/icons.ts +27 -4
  74. package/src/components/session-tree.test.ts +20 -0
  75. package/src/components/session-tree.ts +16 -2
  76. package/src/components/stories-app.tsx +2 -2
  77. package/src/config.test.ts +20 -49
  78. package/src/config.ts +26 -28
  79. package/src/diff-fold.test.ts +78 -0
  80. package/src/diff-fold.ts +126 -0
  81. package/src/diff-syntax.test.ts +16 -0
  82. package/src/diff-syntax.ts +6 -3
  83. package/src/discussions.ts +79 -0
  84. package/src/intent-dispatch.test.ts +31 -11
  85. package/src/intent-dispatch.ts +93 -48
  86. package/src/key-bindings.test.ts +1 -1
  87. package/src/keymap.test.ts +3 -25
  88. package/src/keymap.ts +17 -18
  89. package/src/mark-runs.ts +120 -0
  90. package/src/pty.ts +10 -2
  91. package/src/run.ts +17 -7
  92. package/src/serve.test.ts +4 -8
  93. package/src/session-controller.curate.test.ts +75 -0
  94. package/src/session-controller.share.test.ts +1 -0
  95. package/src/session-controller.tree.test.ts +26 -0
  96. package/src/session-controller.ts +153 -29
  97. package/src/slash-palette.ts +83 -0
  98. package/src/split-diff.test.ts +110 -0
  99. package/src/split-diff.ts +149 -0
  100. package/src/test-support.test.ts +3 -3
  101. package/src/test-support.ts +39 -8
  102. package/src/thread-chords.test.ts +25 -9
  103. package/src/thread-chords.ts +33 -8
  104. package/src/use-annotation-surface.tsx +837 -0
  105. package/src/use-changes-workbench.ts +151 -0
  106. package/src/use-frame-measure.ts +38 -0
  107. package/src/use-settings-dialog.tsx +14 -24
  108. package/src/use-terminal-virtualizer.ts +233 -0
  109. package/src/view-diff.ts +114 -0
  110. package/src/components/ReviewPanel.stories.tsx +0 -100
  111. package/src/components/ReviewPanel.tsx +0 -103
  112. package/src/components/ReviewRail.stories.tsx +0 -232
  113. package/src/components/ReviewRail.tsx +0 -327
  114. package/src/review-panel.test.ts +0 -113
  115. package/src/review-panel.ts +0 -83
@@ -1,100 +0,0 @@
1
- import React from "react";
2
- import { DARK } from "../theme";
3
- import { REVIEW_MAX_WIDTH, REVIEW_MIN_WIDTH } from "../review-panel";
4
- import type { Story, StoryMeta } from "./story";
5
- import { ReviewPanel } from "./ReviewPanel";
6
- import { FIXTURE_ANNOTATIONS, fixturePlanSession } from "./story-fixtures";
7
-
8
- export const meta: StoryMeta = { title: "Surfaces/ReviewPanel" };
9
-
10
- /** An empty Tree tab: the stories here show the review tab. */
11
- const tree = {
12
- rows: [],
13
- canMove: true,
14
- canFork: true,
15
- onSelect: () => {},
16
- onGo: () => {},
17
- onBranch: () => {},
18
- onLabel: () => {},
19
- onFork: () => {},
20
- onForkAndShare: () => {},
21
- };
22
-
23
- const rail = {
24
- session: fixturePlanSession(),
25
- tree,
26
- authorNames: {},
27
- selectedId: FIXTURE_ANNOTATIONS[0]!.id,
28
- resolvedIds: new Set(FIXTURE_ANNOTATIONS.map((annotation) => annotation.id)),
29
- curationItems: [],
30
- railTab: "review" as const,
31
- pendingCount: 2,
32
- cardEdit: null,
33
- submitConfirm: null,
34
- onTabChange: () => {},
35
- onSelectCard: () => {},
36
- onActivateCard: () => {},
37
- onSelectCuration: () => {},
38
- onUndoCuration: () => {},
39
- onSubmitRequest: () => {},
40
- onLaunchHarness: () => {},
41
- };
42
-
43
- const panelCallbacks = { onDividerGrab: () => {}, onToggle: () => {} };
44
-
45
- /** The plan area to the left of the divider, so the layout reads in context. */
46
- function PanelFrame({ children }: { children: React.ReactNode }): React.ReactNode {
47
- return (
48
- <box
49
- style={{
50
- flexDirection: "row",
51
- width: "100%",
52
- height: "100%",
53
- backgroundColor: DARK.background,
54
- }}
55
- >
56
- <box style={{ flexGrow: 1, paddingLeft: 1 }}>
57
- <text fg={DARK.textMuted}>The plan takes the width the panel hands back.</text>
58
- </box>
59
- {children}
60
- </box>
61
- );
62
- }
63
-
64
- export const ExpandedNarrow: Story = {
65
- render: () => (
66
- <PanelFrame>
67
- <ReviewPanel mode="expanded" width={REVIEW_MIN_WIDTH} rail={rail} {...panelCallbacks} />
68
- </PanelFrame>
69
- ),
70
- size: { width: 80, height: 24 },
71
- };
72
-
73
- export const ExpandedWide: Story = {
74
- render: () => (
75
- <PanelFrame>
76
- <ReviewPanel mode="expanded" width={REVIEW_MAX_WIDTH} rail={rail} {...panelCallbacks} />
77
- </PanelFrame>
78
- ),
79
- expectedColors: [DARK.accent],
80
- size: { width: 90, height: 24 },
81
- };
82
-
83
- export const Compact: Story = {
84
- render: () => (
85
- <PanelFrame>
86
- <ReviewPanel mode="compact" width={34} rail={rail} {...panelCallbacks} />
87
- </PanelFrame>
88
- ),
89
- expectedColors: [DARK.accent],
90
- size: { width: 60, height: 24 },
91
- };
92
-
93
- export const Hidden: Story = {
94
- render: () => (
95
- <PanelFrame>
96
- <ReviewPanel mode="hidden" width={34} rail={rail} {...panelCallbacks} />
97
- </PanelFrame>
98
- ),
99
- size: { width: 60, height: 24 },
100
- };
@@ -1,103 +0,0 @@
1
- /**
2
- * The review surface's outer shell: the grabbable divider plus the rail in one
3
- * of three modes - expanded (the full ReviewRail, resizable), compact (a narrow
4
- * count + dots strip that hands width back to the plan), or hidden (nothing at
5
- * all, no leftover tab). The keybinding cycles all three; the clickable chevron
6
- * toggles expanded and compact only. App owns the width/mode state and the drag
7
- * on the container; this file only reads them. The geometry (width clamp, the
8
- * divider glyph column, the cycle) lives in review-panel.ts so this stays
9
- * declarative.
10
- */
11
-
12
- import React from "react";
13
- import type { Annotation } from "@cueloop/schema";
14
- import type { Theme } from "../theme";
15
- import { useComponentTheme } from "./theme-context";
16
- import { ReviewRail, type ReviewRailHandle, type ReviewRailProps } from "./ReviewRail";
17
- import { REVIEW_COMPACT_WIDTH, type ReviewPanelMode } from "../review-panel";
18
-
19
- export interface ReviewPanelProps {
20
- mode: ReviewPanelMode;
21
- /** Expanded-rail width in columns (already clamped by the app). */
22
- width: number;
23
- /** Arm a divider drag; the app tracks the drag itself on the container. */
24
- onDividerGrab: () => void;
25
- /** Chevron click: expanded <-> compact (never hidden). */
26
- onToggle: () => void;
27
- /** The expanded ReviewRail's props; width and onCollapse are supplied here. */
28
- rail: Omit<ReviewRailProps, "width" | "onCollapse" | "theme">;
29
- railRef?: React.Ref<ReviewRailHandle>;
30
- theme?: Theme;
31
- }
32
-
33
- /** An invisible, full-height grab column: the plan's right border is the seam. */
34
- function ReviewDivider({ onGrab }: { onGrab: () => void }): React.ReactNode {
35
- // childless: it stretches to the row height like the plan and rail beside it,
36
- // so the three columns share one bottom edge. Invisible, but full-height grab.
37
- return <box style={{ width: 1 }} onMouseDown={onGrab} />;
38
- }
39
-
40
- /** The compact strip: the card count, one kind-colored dot per card, and the
41
- * `<` expand chevron, bottom-padded to sit at the same row as the expanded `>`. */
42
- function CompactRail({
43
- annotations,
44
- onExpand,
45
- theme,
46
- }: {
47
- annotations: Annotation[];
48
- onExpand: () => void;
49
- theme?: Theme;
50
- }): React.ReactNode {
51
- const tokens = useComponentTheme(theme);
52
-
53
- return (
54
- <box
55
- style={{
56
- width: REVIEW_COMPACT_WIDTH,
57
- backgroundColor: tokens.panel,
58
- flexDirection: "column",
59
- paddingTop: 1,
60
- paddingBottom: 1,
61
- }}
62
- >
63
- <box style={{ alignItems: "center" }}>
64
- <text fg={tokens.accent}>{String(annotations.length)}</text>
65
- </box>
66
- <box style={{ height: 1 }} />
67
- <box style={{ flexDirection: "column", alignItems: "center" }}>
68
- {annotations.map((annotation) => (
69
- <text key={annotation.id} fg={tokens.accent}>
70
- ●
71
- </text>
72
- ))}
73
- </box>
74
- <box style={{ flexGrow: 1 }} />
75
- <box style={{ paddingLeft: 1 }} onMouseUp={onExpand}>
76
- <text fg={tokens.textDim}>{"<"}</text>
77
- </box>
78
- </box>
79
- );
80
- }
81
-
82
- export function ReviewPanel({
83
- mode,
84
- width,
85
- onDividerGrab,
86
- onToggle,
87
- rail,
88
- railRef,
89
- theme,
90
- }: ReviewPanelProps): React.ReactNode {
91
- if (mode === "hidden") return null;
92
-
93
- return (
94
- <>
95
- <ReviewDivider onGrab={onDividerGrab} />
96
- {mode === "expanded" ? (
97
- <ReviewRail ref={railRef} {...rail} width={width} onCollapse={onToggle} theme={theme} />
98
- ) : (
99
- <CompactRail annotations={rail.session.annotations} onExpand={onToggle} theme={theme} />
100
- )}
101
- </>
102
- );
103
- }
@@ -1,232 +0,0 @@
1
- import React from "react";
2
- import { DARK } from "../theme";
3
- import type { Story, StoryMeta } from "./story";
4
- import { ReviewRail } from "./ReviewRail";
5
- import { FIXTURE_ANNOTATIONS, fixtureDiffSession, fixturePlanSession } from "./story-fixtures";
6
-
7
- export const meta: StoryMeta = { title: "Surfaces/ReviewRail" };
8
-
9
- /** An empty Tree tab: the stories here show the review tab. */
10
- const tree = {
11
- rows: [],
12
- canMove: true,
13
- canFork: true,
14
- onSelect: () => {},
15
- onGo: () => {},
16
- onBranch: () => {},
17
- onLabel: () => {},
18
- onFork: () => {},
19
- onForkAndShare: () => {},
20
- };
21
-
22
- const callbacks = {
23
- curationItems: [],
24
- tree,
25
- onTabChange: () => {},
26
- onSelectCard: () => {},
27
- onActivateCard: () => {},
28
- onSelectCuration: () => {},
29
- onUndoCuration: () => {},
30
- onSubmitRequest: () => {},
31
- onLaunchHarness: () => {},
32
- };
33
-
34
- /** The rail expects a height-constrained parent, like the app's main row. */
35
- function RailFrame({ children }: { children: React.ReactNode }): React.ReactNode {
36
- return <box style={{ flexDirection: "row", width: "100%", height: "100%" }}>{children}</box>;
37
- }
38
-
39
- export const AnnotationStack: Story = {
40
- render: () => (
41
- <RailFrame>
42
- <ReviewRail
43
- session={fixturePlanSession()}
44
- authorNames={{}}
45
- selectedId={FIXTURE_ANNOTATIONS[0]!.id}
46
- resolvedIds={new Set(FIXTURE_ANNOTATIONS.map((annotation) => annotation.id))}
47
- railTab="review"
48
- pendingCount={2}
49
- cardEdit={null}
50
- submitConfirm={null}
51
- {...callbacks}
52
- />
53
- </RailFrame>
54
- ),
55
- expectedColors: [DARK.accent],
56
- size: { width: 40, height: 24 },
57
- };
58
-
59
- export const MixedOwnershipStack: Story = {
60
- render: () => (
61
- <RailFrame>
62
- <ReviewRail
63
- session={fixturePlanSession({
64
- participants: [{ id: "SHA256:collab1", provider: "ssh", name: "Priya" }],
65
- annotations: [
66
- {
67
- id: "own_note",
68
- kind: "comment",
69
- anchor: { quote: "persists sessions", prefix: "The daemon ", suffix: " to disk" },
70
- body: "Which daemon owns this?",
71
- createdAt: "2026-01-01T00:00:00Z",
72
- },
73
- {
74
- id: "collab_note",
75
- kind: "comment",
76
- anchor: { quote: "move the store", prefix: "", suffix: "" },
77
- body: "move it behind one interface",
78
- author: "SHA256:collab1",
79
- createdAt: "2026-01-01T00:00:01Z",
80
- },
81
- ],
82
- })}
83
- authorNames={{}}
84
- selectedId="own_note"
85
- resolvedIds={new Set(["own_note", "collab_note"])}
86
- railTab="review"
87
- pendingCount={2}
88
- cardEdit={null}
89
- submitConfirm={null}
90
- {...callbacks}
91
- />
92
- </RailFrame>
93
- ),
94
- // every annotation border is accent now
95
- expectedColors: [DARK.accent],
96
- size: { width: 40, height: 24 },
97
- };
98
-
99
- export const Removals: Story = {
100
- render: () => (
101
- <RailFrame>
102
- <ReviewRail
103
- session={fixtureDiffSession()}
104
- authorNames={{}}
105
- resolvedIds={null}
106
- railTab="review"
107
- pendingCount={0}
108
- cardEdit={null}
109
- submitConfirm={null}
110
- {...callbacks}
111
- curationItems={[
112
- {
113
- id: "diff:src/store.ts#0#1",
114
- source: "diff",
115
- preview: ["- private items = [];", "+ private items = new Map();"],
116
- revealIndex: 3,
117
- },
118
- {
119
- id: "diff:src/store.ts#1#hunk",
120
- source: "diff",
121
- preview: ["- return null;", "+ return fallback();", "+ log(fallback);"],
122
- revealIndex: 9,
123
- },
124
- ]}
125
- selectedCurationId="diff:src/store.ts#0#1"
126
- />
127
- </RailFrame>
128
- ),
129
- expectedColors: [DARK.red],
130
- size: { width: 40, height: 24 },
131
- };
132
-
133
- /** A plan cut and an annotation interleave in one line-ordered stack. */
134
- export const InterleavedStack: Story = {
135
- render: () => (
136
- <RailFrame>
137
- <ReviewRail
138
- session={fixturePlanSession()}
139
- authorNames={{}}
140
- selectedId={FIXTURE_ANNOTATIONS[0]!.id}
141
- resolvedIds={new Set(FIXTURE_ANNOTATIONS.map((annotation) => annotation.id))}
142
- railTab="review"
143
- pendingCount={2}
144
- cardEdit={null}
145
- submitConfirm={null}
146
- {...callbacks}
147
- curationItems={[
148
- {
149
- id: "plan:6-6",
150
- source: "plan",
151
- preview: ["- add recovery"],
152
- revealIndex: 1,
153
- },
154
- ]}
155
- annotationPositions={new Map([[FIXTURE_ANNOTATIONS[0]!.id, 5]])}
156
- />
157
- </RailFrame>
158
- ),
159
- expectedColors: [DARK.accent],
160
- size: { width: 40, height: 24 },
161
- };
162
-
163
- export const AgentTab: Story = {
164
- render: () => (
165
- <RailFrame>
166
- <ReviewRail
167
- session={fixturePlanSession()}
168
- authorNames={{}}
169
- resolvedIds={new Set()}
170
- railTab="agent"
171
- pendingCount={2}
172
- cardEdit={null}
173
- submitConfirm={null}
174
- {...callbacks}
175
- />
176
- </RailFrame>
177
- ),
178
- size: { width: 40, height: 24 },
179
- };
180
-
181
- export const SubmitConfirmOpen: Story = {
182
- render: () => (
183
- <RailFrame>
184
- <ReviewRail
185
- session={fixturePlanSession()}
186
- authorNames={{}}
187
- resolvedIds={new Set()}
188
- railTab="review"
189
- pendingCount={2}
190
- cardEdit={null}
191
- submitConfirm={{
192
- verdict: "request_changes",
193
- summary: "",
194
- onInput: () => {},
195
- onSelectVerdict: () => {},
196
- onSubmit: () => {},
197
- onCancel: () => {},
198
- }}
199
- {...callbacks}
200
- />
201
- </RailFrame>
202
- ),
203
- expectedColors: [DARK.red],
204
- size: { width: 40, height: 30 },
205
- };
206
-
207
- export const Resolved: Story = {
208
- render: () => (
209
- <RailFrame>
210
- <ReviewRail
211
- session={fixturePlanSession({
212
- status: "resolved",
213
- verdict: {
214
- kind: "approve",
215
- summary: "",
216
- feedback: "",
217
- resolvedAt: "2026-01-01T00:00:00Z",
218
- },
219
- })}
220
- authorNames={{}}
221
- resolvedIds={new Set()}
222
- railTab="review"
223
- pendingCount={0}
224
- cardEdit={null}
225
- submitConfirm={null}
226
- {...callbacks}
227
- />
228
- </RailFrame>
229
- ),
230
- expectedColors: [DARK.green],
231
- size: { width: 40, height: 24 },
232
- };