@cueloop/client 0.1.0-alpha.4 → 0.1.0-alpha.40

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 (131) hide show
  1. package/package.json +32 -24
  2. package/src/App.autoclose.test.tsx +137 -0
  3. package/src/App.diff.test.tsx +158 -22
  4. package/src/App.export.test.tsx +44 -37
  5. package/src/App.plan-review.test.tsx +632 -0
  6. package/src/App.readonly.test.tsx +60 -36
  7. package/src/App.rendering.test.tsx +132 -0
  8. package/src/App.review-panel.test.tsx +136 -0
  9. package/src/App.submit-confirm.test.tsx +220 -0
  10. package/src/App.test.tsx +128 -69
  11. package/src/App.toast.test.tsx +75 -0
  12. package/src/App.tsx +0 -0
  13. package/src/App.walk.test.tsx +288 -0
  14. package/src/attribution.test.ts +31 -0
  15. package/src/attribution.ts +38 -0
  16. package/src/clipboard.test.ts +23 -0
  17. package/src/clipboard.ts +30 -0
  18. package/src/components/AnnotationCard.compose-rows.test.ts +49 -0
  19. package/src/components/AnnotationCard.stories.tsx +94 -0
  20. package/src/components/AnnotationCard.tsx +228 -0
  21. package/src/components/Breadcrumb.stories.tsx +19 -0
  22. package/src/components/Breadcrumb.tsx +44 -0
  23. package/src/components/CodeBlock.stories.tsx +42 -0
  24. package/src/components/CodeBlock.tsx +83 -0
  25. package/src/components/CompletionOverlay.stories.tsx +23 -0
  26. package/src/components/CompletionOverlay.tsx +59 -0
  27. package/src/components/ConfirmCard.stories.tsx +56 -0
  28. package/src/components/ConfirmCard.tsx +135 -0
  29. package/src/components/ConfirmDialog.stories.tsx +21 -0
  30. package/src/components/ConfirmDialog.tsx +64 -0
  31. package/src/components/DiffSheet.scroll.test.tsx +123 -0
  32. package/src/components/DiffSheet.stories.tsx +78 -0
  33. package/src/components/DiffSheet.syntax.test.tsx +62 -0
  34. package/src/components/DiffSheet.tsx +355 -0
  35. package/src/components/InboxList.stories.tsx +31 -0
  36. package/src/components/InboxList.tsx +62 -0
  37. package/src/components/KeybindsDialog.stories.tsx +31 -0
  38. package/src/components/KeybindsDialog.tsx +58 -0
  39. package/src/components/MarkerPopover.stories.tsx +58 -0
  40. package/src/components/MarkerPopover.tsx +102 -0
  41. package/src/components/MenuBar.stories.tsx +37 -0
  42. package/src/components/MenuBar.tsx +74 -0
  43. package/src/components/PlanSheet.stories.tsx +113 -0
  44. package/src/components/PlanSheet.tsx +389 -0
  45. package/src/components/PromptDialog.stories.tsx +36 -0
  46. package/src/components/PromptDialog.tsx +78 -0
  47. package/src/components/ReviewPanel.stories.tsx +86 -0
  48. package/src/components/ReviewPanel.tsx +101 -0
  49. package/src/components/ReviewRail.stories.tsx +220 -0
  50. package/src/components/ReviewRail.tsx +316 -0
  51. package/src/components/SettingsDialog.stories.tsx +111 -0
  52. package/src/components/SettingsDialog.tsx +141 -0
  53. package/src/components/SettingsRows.stories.tsx +18 -0
  54. package/src/components/SettingsRows.tsx +108 -0
  55. package/src/components/Toast.stories.tsx +12 -0
  56. package/src/components/Toast.tsx +44 -0
  57. package/src/components/WalkWizard.stories.tsx +100 -0
  58. package/src/components/WalkWizard.tsx +152 -0
  59. package/src/components/__snapshots__/stories.test.tsx.snap +1829 -0
  60. package/src/components/agent-launcher.stories.tsx +26 -0
  61. package/src/components/agent-launcher.test.tsx +21 -0
  62. package/src/components/agent-launcher.tsx +123 -0
  63. package/src/components/diff-sheet-layout.test.ts +127 -0
  64. package/src/components/diff-sheet-layout.ts +167 -0
  65. package/src/components/primitives/Button.stories.tsx +32 -0
  66. package/src/components/primitives/Button.tsx +48 -0
  67. package/src/components/primitives/Card.stories.tsx +25 -0
  68. package/src/components/primitives/Card.tsx +59 -0
  69. package/src/components/primitives/Dialog.stories.tsx +24 -0
  70. package/src/components/primitives/Dialog.tsx +64 -0
  71. package/src/components/primitives/StatusBar.stories.tsx +11 -0
  72. package/src/components/primitives/StatusBar.tsx +22 -0
  73. package/src/components/primitives/Tabs.stories.tsx +29 -0
  74. package/src/components/primitives/Tabs.tsx +98 -0
  75. package/src/components/primitives/Toolbar.stories.tsx +17 -0
  76. package/src/components/primitives/Toolbar.tsx +14 -0
  77. package/src/components/primitives/frame.test.ts +12 -0
  78. package/src/components/primitives/frame.ts +14 -0
  79. package/src/components/quick-actions-editor.stories.tsx +54 -0
  80. package/src/components/quick-actions-editor.tsx +136 -0
  81. package/src/components/stories-app.tsx +123 -0
  82. package/src/components/stories.test.tsx +62 -0
  83. package/src/components/story-fixtures.ts +98 -0
  84. package/src/components/story.ts +69 -0
  85. package/src/components/syntax-highlight.ts +92 -0
  86. package/src/components/theme-context.stories.tsx +46 -0
  87. package/src/components/theme-context.tsx +36 -0
  88. package/src/components/truncate-text.ts +6 -0
  89. package/src/config.test.ts +430 -31
  90. package/src/config.ts +304 -26
  91. package/src/diff-hunk-curate.test.ts +315 -0
  92. package/src/diff-hunk-curate.ts +233 -0
  93. package/src/diff-intraline.test.ts +164 -0
  94. package/src/diff-intraline.ts +132 -0
  95. package/src/diff-syntax.test.ts +96 -0
  96. package/src/diff-syntax.ts +154 -0
  97. package/src/editor.test.ts +143 -0
  98. package/src/editor.ts +123 -9
  99. package/src/herdr.test.ts +41 -0
  100. package/src/herdr.ts +27 -0
  101. package/src/index.ts +10 -0
  102. package/src/integrations.test.ts +41 -0
  103. package/src/integrations.ts +30 -0
  104. package/src/intent-dispatch.test.ts +492 -0
  105. package/src/intent-dispatch.ts +428 -0
  106. package/src/key-bindings.test.ts +152 -0
  107. package/src/key-bindings.ts +424 -0
  108. package/src/keymap.test.ts +622 -0
  109. package/src/keymap.ts +339 -0
  110. package/src/review-panel.test.ts +113 -0
  111. package/src/review-panel.ts +83 -0
  112. package/src/run.ts +9 -5
  113. package/src/serve.test.ts +24 -9
  114. package/src/serve.ts +7 -7
  115. package/src/session-controller.curate.test.ts +253 -0
  116. package/src/session-controller.share.test.ts +309 -0
  117. package/src/session-controller.ts +900 -0
  118. package/src/share.ts +113 -0
  119. package/src/test-support.test.ts +55 -0
  120. package/src/test-support.ts +187 -0
  121. package/src/theme-presets.ts +168 -0
  122. package/src/theme.ts +36 -15
  123. package/src/version.ts +5 -0
  124. package/src/view-diff.test.ts +19 -8
  125. package/src/view-diff.ts +34 -23
  126. package/src/view-plan.test.ts +294 -0
  127. package/src/view-plan.ts +408 -0
  128. package/src/walk.test.ts +121 -0
  129. package/src/walk.ts +70 -0
  130. package/src/view.test.ts +0 -157
  131. package/src/view.ts +0 -0
package/src/view.test.ts DELETED
@@ -1,157 +0,0 @@
1
- import { describe, expect, test } from "bun:test";
2
- import {
3
- blockRuns,
4
- buildDisplay,
5
- cutBlock,
6
- displayText,
7
- marksByDisplay,
8
- overlayMarks,
9
- restoreBlock,
10
- restoreLine,
11
- spanKey,
12
- startSpan,
13
- wrapRuns,
14
- } from "./view";
15
- import { parseBlocks, type Annotation } from "@cueloop/schema";
16
-
17
- const BASE = `# Plan
18
-
19
- ## Context
20
-
21
- The daemon persists sessions to disk atomically.
22
-
23
- - first item
24
- - second item
25
- `;
26
-
27
- describe("buildDisplay reconciliation", () => {
28
- test("no working copy: everything is same", () => {
29
- const d = buildDisplay(BASE);
30
- expect(d.every((x) => x.type === "same")).toBe(true);
31
- });
32
-
33
- test("reworded block pairs as mod (similar)", () => {
34
- const working = BASE.replace("persists sessions to disk", "writes sessions to disk");
35
- const d = buildDisplay(BASE, working);
36
- const mod = d.find((x) => x.type === "mod")!;
37
- expect(mod.base!.text).toContain("persists");
38
- expect(mod.work!.text).toContain("writes");
39
- });
40
-
41
- test("unrelated cut + insert do NOT merge into a mod", () => {
42
- const working = BASE.replace("- second item\n", "") + "\nA totally new closing note.\n";
43
- const d = buildDisplay(BASE, working);
44
- expect(d.some((x) => x.type === "del" && x.base!.text === "second item")).toBe(true);
45
- expect(d.some((x) => x.type === "add" && x.work!.text.includes("closing note"))).toBe(true);
46
- expect(d.some((x) => x.type === "mod")).toBe(false);
47
- });
48
-
49
- test("ordered list items get running numbers", () => {
50
- const d = buildDisplay("1. one\n2. two\n3. three\n");
51
- expect(d.map((x) => x.oliNum)).toEqual([1, 2, 3]);
52
- });
53
- });
54
-
55
- describe("blockRuns + overlayMarks", () => {
56
- test("mod blocks emit word-diff runs that reconstruct both sides", () => {
57
- const d = buildDisplay("plain old text here\n", "plain new text here\n")[0]!;
58
- const runs = blockRuns(d, true);
59
- const oldSide = runs.filter((r) => r.role !== "ins").map((r) => r.text).join("");
60
- const newSide = runs.filter((r) => r.role !== "del").map((r) => r.text).join("");
61
- expect(oldSide).toBe("plain old text here");
62
- expect(newSide).toBe("plain new text here");
63
- });
64
-
65
- test("marks bind to working-text offsets and skip del runs", () => {
66
- const d = buildDisplay("old words linger\n", "new words linger\n")[0]!;
67
- const runs = blockRuns(d, true);
68
- const marked = overlayMarks(runs, [{ start: 4, end: 9, role: "mark-comment" }]); // "words"
69
- const markedText = marked.filter((r) => r.role === "mark-comment").map((r) => r.text).join("");
70
- expect(markedText).toBe("words");
71
- // del run text untouched
72
- expect(marked.some((r) => r.role === "del" && r.text === "old")).toBe(true);
73
- });
74
-
75
- test("marks never override ins emphasis", () => {
76
- const d = buildDisplay("keep\n", "keep added\n")[0]!;
77
- const runs = overlayMarks(blockRuns(d, true), [{ start: 0, end: 10, role: "mark-comment" }]);
78
- expect(runs.some((r) => r.role === "ins")).toBe(true);
79
- });
80
- });
81
-
82
- describe("marksByDisplay", () => {
83
- test("annotations resolve into display coordinates", () => {
84
- const working = BASE.replace("first item", "first item edited beyond recognition of it");
85
- const display = buildDisplay(BASE, working);
86
- const ann: Annotation = {
87
- id: "a1",
88
- kind: "comment",
89
- anchor: { quote: "atomically", prefix: "to disk ", suffix: "." },
90
- body: "define atomically",
91
- createdAt: "",
92
- };
93
- const map = marksByDisplay([ann], display);
94
- const [dispIdx, marks] = [...map.entries()][0]!;
95
- expect(displayText(display[dispIdx]!)).toContain("atomically");
96
- expect(marks[0]!.annotationId).toBe("a1");
97
- });
98
-
99
- test("orphaned annotations produce no marks", () => {
100
- const display = buildDisplay(BASE);
101
- const ann: Annotation = {
102
- id: "a1",
103
- kind: "comment",
104
- anchor: { quote: "text that is gone", prefix: "", suffix: "" },
105
- body: "",
106
- createdAt: "",
107
- };
108
- expect(marksByDisplay([ann], display).size).toBe(0);
109
- });
110
- });
111
-
112
- describe("wrapRuns", () => {
113
- test("wraps at word boundaries within width", () => {
114
- const lines = wrapRuns([{ text: "alpha beta gamma delta", role: "plain", start: 0 }], 11);
115
- const rendered = lines.map((l) => l.map((r) => r.text).join(""));
116
- expect(rendered.every((l) => l.length <= 11)).toBe(true);
117
- expect(rendered.join(" ").replace(/\s+/g, " ").trim()).toBe("alpha beta gamma delta");
118
- });
119
-
120
- test("hard-splits words longer than the width", () => {
121
- const lines = wrapRuns([{ text: "abcdefghij", role: "plain", start: 0 }], 4);
122
- expect(lines.length).toBeGreaterThan(1);
123
- });
124
-
125
- test("newlines force line breaks (code blocks)", () => {
126
- const lines = wrapRuns([{ text: "line1\nline2", role: "plain", start: 0 }], 80);
127
- expect(lines.length).toBe(2);
128
- });
129
- });
130
-
131
- describe("span mode", () => {
132
- const text = "one two three four";
133
- test("v selects the first word; l grows; w slides; $ to end", () => {
134
- let s = startSpan(0, text)!;
135
- expect(text.slice(s.start, s.end)).toBe("one");
136
- s = spanKey(s, "l", text);
137
- expect(text.slice(s.start, s.end)).toBe("one two");
138
- s = spanKey(s, "w", text);
139
- expect(text.slice(s.start, s.end)).toBe("two three");
140
- s = spanKey(s, "$", text);
141
- expect(text.slice(s.start, s.end)).toBe("two three four");
142
- });
143
- });
144
-
145
- describe("cut / restore round-trip", () => {
146
- test("cut removes the block lines; restore puts them back", () => {
147
- const blocks = parseBlocks(BASE);
148
- const li = blocks.find((b) => b.text === "second item")!;
149
- const cut = cutBlock(BASE, li);
150
- expect(cut).not.toContain("second item");
151
- const display = buildDisplay(BASE, cut);
152
- const delIdx = display.findIndex((d) => d.type === "del");
153
- const line = restoreLine(display, delIdx, cut.split("\n").length);
154
- const restored = restoreBlock(cut, "- second item", line);
155
- expect(buildDisplay(BASE, restored).every((d) => d.type === "same")).toBe(true);
156
- });
157
- });
package/src/view.ts DELETED
Binary file