@onpoint-dev-tools/crewcoder-opentui 0.0.0-stage → 0.1.0
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/LICENSE +191 -0
- package/README.md +262 -2
- package/THIRD_PARTY_NOTICES.md +51 -0
- package/dist/App.d.ts +16 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/App.js +428 -0
- package/dist/App.js.map +1 -0
- package/dist/Root.d.ts +11 -0
- package/dist/Root.d.ts.map +1 -0
- package/dist/Root.js +13 -0
- package/dist/Root.js.map +1 -0
- package/dist/alert-model.d.ts +31 -0
- package/dist/alert-model.d.ts.map +1 -0
- package/dist/alert-model.js +34 -0
- package/dist/alert-model.js.map +1 -0
- package/dist/args.d.ts +13 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +63 -0
- package/dist/args.js.map +1 -0
- package/dist/attachments.d.ts +29 -0
- package/dist/attachments.d.ts.map +1 -0
- package/dist/attachments.js +38 -0
- package/dist/attachments.js.map +1 -0
- package/dist/block-panels.d.ts +43 -0
- package/dist/block-panels.d.ts.map +1 -0
- package/dist/block-panels.js +210 -0
- package/dist/block-panels.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +138 -0
- package/dist/cli.js.map +1 -0
- package/dist/command-format.d.ts +18 -0
- package/dist/command-format.d.ts.map +1 -0
- package/dist/command-format.js +66 -0
- package/dist/command-format.js.map +1 -0
- package/dist/command-runner.d.ts +128 -0
- package/dist/command-runner.d.ts.map +1 -0
- package/dist/command-runner.js +571 -0
- package/dist/command-runner.js.map +1 -0
- package/dist/commands.d.ts +47 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +108 -0
- package/dist/commands.js.map +1 -0
- package/dist/components/AttachmentRow.d.ts +11 -0
- package/dist/components/AttachmentRow.d.ts.map +1 -0
- package/dist/components/AttachmentRow.js +17 -0
- package/dist/components/AttachmentRow.js.map +1 -0
- package/dist/components/Composer.d.ts +23 -0
- package/dist/components/Composer.d.ts.map +1 -0
- package/dist/components/Composer.js +45 -0
- package/dist/components/Composer.js.map +1 -0
- package/dist/components/ExtensionQuestion.d.ts +18 -0
- package/dist/components/ExtensionQuestion.d.ts.map +1 -0
- package/dist/components/ExtensionQuestion.js +45 -0
- package/dist/components/ExtensionQuestion.js.map +1 -0
- package/dist/components/GoalForm.d.ts +18 -0
- package/dist/components/GoalForm.d.ts.map +1 -0
- package/dist/components/GoalForm.js +26 -0
- package/dist/components/GoalForm.js.map +1 -0
- package/dist/components/Home.d.ts +21 -0
- package/dist/components/Home.d.ts.map +1 -0
- package/dist/components/Home.js +48 -0
- package/dist/components/Home.js.map +1 -0
- package/dist/components/MentionList.d.ts +14 -0
- package/dist/components/MentionList.d.ts.map +1 -0
- package/dist/components/MentionList.js +24 -0
- package/dist/components/MentionList.js.map +1 -0
- package/dist/components/SearchBar.d.ts +19 -0
- package/dist/components/SearchBar.d.ts.map +1 -0
- package/dist/components/SearchBar.js +28 -0
- package/dist/components/SearchBar.js.map +1 -0
- package/dist/components/Sidebar.d.ts +19 -0
- package/dist/components/Sidebar.d.ts.map +1 -0
- package/dist/components/Sidebar.js +35 -0
- package/dist/components/Sidebar.js.map +1 -0
- package/dist/components/SummaryEditor.d.ts +16 -0
- package/dist/components/SummaryEditor.d.ts.map +1 -0
- package/dist/components/SummaryEditor.js +21 -0
- package/dist/components/SummaryEditor.js.map +1 -0
- package/dist/components/Transcript.d.ts +37 -0
- package/dist/components/Transcript.d.ts.map +1 -0
- package/dist/components/Transcript.js +314 -0
- package/dist/components/Transcript.js.map +1 -0
- package/dist/components/ui/alert.d.ts +9 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/alert.js +18 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/command-palette.d.ts +15 -0
- package/dist/components/ui/command-palette.d.ts.map +1 -0
- package/dist/components/ui/command-palette.js +14 -0
- package/dist/components/ui/command-palette.js.map +1 -0
- package/dist/components/ui/confirm.d.ts +12 -0
- package/dist/components/ui/confirm.d.ts.map +1 -0
- package/dist/components/ui/confirm.js +16 -0
- package/dist/components/ui/confirm.js.map +1 -0
- package/dist/components/ui/select.d.ts +11 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +29 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/spinner.d.ts +14 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/spinner.js +17 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/tool-approval.d.ts +14 -0
- package/dist/components/ui/tool-approval.d.ts.map +1 -0
- package/dist/components/ui/tool-approval.js +37 -0
- package/dist/components/ui/tool-approval.js.map +1 -0
- package/dist/components/ui/tool-call.d.ts +12 -0
- package/dist/components/ui/tool-call.d.ts.map +1 -0
- package/dist/components/ui/tool-call.js +69 -0
- package/dist/components/ui/tool-call.js.map +1 -0
- package/dist/components/ui/types.d.ts +82 -0
- package/dist/components/ui/types.d.ts.map +1 -0
- package/dist/components/ui/types.js +2 -0
- package/dist/components/ui/types.js.map +1 -0
- package/dist/crewcoder-cli.d.ts +51 -0
- package/dist/crewcoder-cli.d.ts.map +1 -0
- package/dist/crewcoder-cli.js +26 -0
- package/dist/crewcoder-cli.js.map +1 -0
- package/dist/diff-anchors.d.ts +14 -0
- package/dist/diff-anchors.d.ts.map +1 -0
- package/dist/diff-anchors.js +43 -0
- package/dist/diff-anchors.js.map +1 -0
- package/dist/footer-layout.d.ts +49 -0
- package/dist/footer-layout.d.ts.map +1 -0
- package/dist/footer-layout.js +79 -0
- package/dist/footer-layout.js.map +1 -0
- package/dist/glyphs.d.ts +32 -0
- package/dist/glyphs.d.ts.map +1 -0
- package/dist/glyphs.js +35 -0
- package/dist/glyphs.js.map +1 -0
- package/dist/goal-form.d.ts +47 -0
- package/dist/goal-form.d.ts.map +1 -0
- package/dist/goal-form.js +59 -0
- package/dist/goal-form.js.map +1 -0
- package/dist/hooks/use-animation.d.ts +6 -0
- package/dist/hooks/use-animation.d.ts.map +1 -0
- package/dist/hooks/use-animation.js +52 -0
- package/dist/hooks/use-animation.js.map +1 -0
- package/dist/hooks/use-app-colors.d.ts +6 -0
- package/dist/hooks/use-app-colors.d.ts.map +1 -0
- package/dist/hooks/use-app-colors.js +6 -0
- package/dist/hooks/use-app-colors.js.map +1 -0
- package/dist/hooks/use-glyph-set.d.ts +8 -0
- package/dist/hooks/use-glyph-set.d.ts.map +1 -0
- package/dist/hooks/use-glyph-set.js +22 -0
- package/dist/hooks/use-glyph-set.js.map +1 -0
- package/dist/hooks/use-motion.d.ts +6 -0
- package/dist/hooks/use-motion.d.ts.map +1 -0
- package/dist/hooks/use-motion.js +8 -0
- package/dist/hooks/use-motion.js.map +1 -0
- package/dist/hooks/use-terminal-focus.d.ts +16 -0
- package/dist/hooks/use-terminal-focus.d.ts.map +1 -0
- package/dist/hooks/use-terminal-focus.js +30 -0
- package/dist/hooks/use-terminal-focus.js.map +1 -0
- package/dist/hooks/use-theme.d.ts +6 -0
- package/dist/hooks/use-theme.d.ts.map +1 -0
- package/dist/hooks/use-theme.js +11 -0
- package/dist/hooks/use-theme.js.map +1 -0
- package/dist/hunk.d.ts +27 -0
- package/dist/hunk.d.ts.map +1 -0
- package/dist/hunk.js +43 -0
- package/dist/hunk.js.map +1 -0
- package/dist/image-view.d.ts +33 -0
- package/dist/image-view.d.ts.map +1 -0
- package/dist/image-view.js +51 -0
- package/dist/image-view.js.map +1 -0
- package/dist/keybindings.d.ts +28 -0
- package/dist/keybindings.d.ts.map +1 -0
- package/dist/keybindings.js +105 -0
- package/dist/keybindings.js.map +1 -0
- package/dist/lib/terminal-themes/default.d.ts +3 -0
- package/dist/lib/terminal-themes/default.d.ts.map +1 -0
- package/dist/lib/terminal-themes/default.js +49 -0
- package/dist/lib/terminal-themes/default.js.map +1 -0
- package/dist/logo-pulse.d.ts +23 -0
- package/dist/logo-pulse.d.ts.map +1 -0
- package/dist/logo-pulse.js +30 -0
- package/dist/logo-pulse.js.map +1 -0
- package/dist/markdown-style.d.ts +47 -0
- package/dist/markdown-style.d.ts.map +1 -0
- package/dist/markdown-style.js +138 -0
- package/dist/markdown-style.js.map +1 -0
- package/dist/mentions.d.ts +57 -0
- package/dist/mentions.d.ts.map +1 -0
- package/dist/mentions.js +109 -0
- package/dist/mentions.js.map +1 -0
- package/dist/palette-model.d.ts +42 -0
- package/dist/palette-model.d.ts.map +1 -0
- package/dist/palette-model.js +77 -0
- package/dist/palette-model.js.map +1 -0
- package/dist/path-suggestions.d.ts +50 -0
- package/dist/path-suggestions.d.ts.map +1 -0
- package/dist/path-suggestions.js +99 -0
- package/dist/path-suggestions.js.map +1 -0
- package/dist/picker-flows.d.ts +78 -0
- package/dist/picker-flows.d.ts.map +1 -0
- package/dist/picker-flows.js +444 -0
- package/dist/picker-flows.js.map +1 -0
- package/dist/pickers.d.ts +34 -0
- package/dist/pickers.d.ts.map +1 -0
- package/dist/pickers.js +136 -0
- package/dist/pickers.js.map +1 -0
- package/dist/prompt-history.d.ts +32 -0
- package/dist/prompt-history.d.ts.map +1 -0
- package/dist/prompt-history.js +40 -0
- package/dist/prompt-history.js.map +1 -0
- package/dist/providers/app-theme-provider.d.ts +12 -0
- package/dist/providers/app-theme-provider.d.ts.map +1 -0
- package/dist/providers/app-theme-provider.js +14 -0
- package/dist/providers/app-theme-provider.js.map +1 -0
- package/dist/providers/theme-provider.d.ts +10 -0
- package/dist/providers/theme-provider.d.ts.map +1 -0
- package/dist/providers/theme-provider.js +57 -0
- package/dist/providers/theme-provider.js.map +1 -0
- package/dist/question-model.d.ts +71 -0
- package/dist/question-model.d.ts.map +1 -0
- package/dist/question-model.js +176 -0
- package/dist/question-model.js.map +1 -0
- package/dist/search-controller.d.ts +46 -0
- package/dist/search-controller.d.ts.map +1 -0
- package/dist/search-controller.js +89 -0
- package/dist/search-controller.js.map +1 -0
- package/dist/search-jump.d.ts +27 -0
- package/dist/search-jump.d.ts.map +1 -0
- package/dist/search-jump.js +65 -0
- package/dist/search-jump.js.map +1 -0
- package/dist/session-controller.d.ts +268 -0
- package/dist/session-controller.d.ts.map +1 -0
- package/dist/session-controller.js +941 -0
- package/dist/session-controller.js.map +1 -0
- package/dist/sidebar-model.d.ts +45 -0
- package/dist/sidebar-model.d.ts.map +1 -0
- package/dist/sidebar-model.js +223 -0
- package/dist/sidebar-model.js.map +1 -0
- package/dist/sidebar.d.ts +49 -0
- package/dist/sidebar.d.ts.map +1 -0
- package/dist/sidebar.js +106 -0
- package/dist/sidebar.js.map +1 -0
- package/dist/status-line.d.ts +32 -0
- package/dist/status-line.d.ts.map +1 -0
- package/dist/status-line.js +69 -0
- package/dist/status-line.js.map +1 -0
- package/dist/syntax/filetype.d.ts +12 -0
- package/dist/syntax/filetype.d.ts.map +1 -0
- package/dist/syntax/filetype.js +28 -0
- package/dist/syntax/filetype.js.map +1 -0
- package/dist/syntax/grammars.d.ts +42 -0
- package/dist/syntax/grammars.d.ts.map +1 -0
- package/dist/syntax/grammars.js +52 -0
- package/dist/syntax/grammars.js.map +1 -0
- package/dist/text-offset.d.ts +5 -0
- package/dist/text-offset.d.ts.map +1 -0
- package/dist/text-offset.js +38 -0
- package/dist/text-offset.js.map +1 -0
- package/dist/text-wrap.d.ts +12 -0
- package/dist/text-wrap.d.ts.map +1 -0
- package/dist/text-wrap.js +53 -0
- package/dist/text-wrap.js.map +1 -0
- package/dist/theme-controller.d.ts +77 -0
- package/dist/theme-controller.d.ts.map +1 -0
- package/dist/theme-controller.js +178 -0
- package/dist/theme-controller.js.map +1 -0
- package/dist/theme.d.ts +51 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +86 -0
- package/dist/theme.js.map +1 -0
- package/dist/tmux-check.d.ts +35 -0
- package/dist/tmux-check.d.ts.map +1 -0
- package/dist/tmux-check.js +66 -0
- package/dist/tmux-check.js.map +1 -0
- package/dist/tmux.d.ts +69 -0
- package/dist/tmux.d.ts.map +1 -0
- package/dist/tmux.js +135 -0
- package/dist/tmux.js.map +1 -0
- package/dist/tool-diff.d.ts +51 -0
- package/dist/tool-diff.d.ts.map +1 -0
- package/dist/tool-diff.js +158 -0
- package/dist/tool-diff.js.map +1 -0
- package/dist/tool-presentation.d.ts +46 -0
- package/dist/tool-presentation.d.ts.map +1 -0
- package/dist/tool-presentation.js +148 -0
- package/dist/tool-presentation.js.map +1 -0
- package/dist/tool-renderer-view.d.ts +14 -0
- package/dist/tool-renderer-view.d.ts.map +1 -0
- package/dist/tool-renderer-view.js +10 -0
- package/dist/tool-renderer-view.js.map +1 -0
- package/dist/transcript-search.d.ts +54 -0
- package/dist/transcript-search.d.ts.map +1 -0
- package/dist/transcript-search.js +160 -0
- package/dist/transcript-search.js.map +1 -0
- package/dist/transcript.d.ts +59 -0
- package/dist/transcript.d.ts.map +1 -0
- package/dist/transcript.js +123 -0
- package/dist/transcript.js.map +1 -0
- package/dist/workflow-tools.d.ts +42 -0
- package/dist/workflow-tools.d.ts.map +1 -0
- package/dist/workflow-tools.js +89 -0
- package/dist/workflow-tools.js.map +1 -0
- package/examples/themes/ember.json +75 -0
- package/grammars/bash/LICENSE +21 -0
- package/grammars/bash/highlights.scm +56 -0
- package/grammars/bash/tree-sitter-bash.wasm +0 -0
- package/grammars/css/LICENSE +21 -0
- package/grammars/css/highlights.scm +76 -0
- package/grammars/css/tree-sitter-css.wasm +0 -0
- package/grammars/go/LICENSE +21 -0
- package/grammars/go/highlights.scm +123 -0
- package/grammars/go/tree-sitter-go.wasm +0 -0
- package/grammars/html/LICENSE +21 -0
- package/grammars/html/highlights.scm +13 -0
- package/grammars/html/tree-sitter-html.wasm +0 -0
- package/grammars/json/LICENSE +21 -0
- package/grammars/json/highlights.scm +16 -0
- package/grammars/json/tree-sitter-json.wasm +0 -0
- package/grammars/python/LICENSE +21 -0
- package/grammars/python/highlights.scm +137 -0
- package/grammars/python/tree-sitter-python.wasm +0 -0
- package/grammars/rust/LICENSE +21 -0
- package/grammars/rust/highlights.scm +161 -0
- package/grammars/rust/tree-sitter-rust.wasm +0 -0
- package/grammars/yaml/LICENSE +20 -0
- package/grammars/yaml/highlights.scm +79 -0
- package/grammars/yaml/tree-sitter-yaml.wasm +0 -0
- package/package.json +56 -5
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { describeAttachment } from "@onpoint-dev-tools/crewcoder-tui-core/state/image-attachment";
|
|
2
|
+
import { formatTokensPerSecond } from "@onpoint-dev-tools/crewcoder-tui-core/state/usage";
|
|
3
|
+
import { USER_MESSAGE_MARKER } from "./glyphs.js";
|
|
4
|
+
export function transcriptSections(blocks) {
|
|
5
|
+
const sections = [];
|
|
6
|
+
blocks.forEach((block, index) => {
|
|
7
|
+
if (block.type !== "tool" && block.type !== "approval") {
|
|
8
|
+
sections.push({ kind: "block", block, start: index });
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const last = sections.at(-1);
|
|
12
|
+
// One box per worker in a crew: a new worker's tools start a new box.
|
|
13
|
+
if (last?.kind === "work" && workerOf(last.blocks.at(-1)) === workerOf(block))
|
|
14
|
+
last.blocks.push(block);
|
|
15
|
+
else
|
|
16
|
+
sections.push({ kind: "work", blocks: [block], start: index });
|
|
17
|
+
});
|
|
18
|
+
return sections;
|
|
19
|
+
}
|
|
20
|
+
/** The crew worker that produced a block, if any (`worker` is set by the reducer during crews). */
|
|
21
|
+
export function workerOf(block) {
|
|
22
|
+
return block && "worker" in block ? block.worker : undefined;
|
|
23
|
+
}
|
|
24
|
+
/** The last assistant/thinking block of an active run still grows; the reducer only appends to it. */
|
|
25
|
+
export function isStreaming(block, isLast, running) {
|
|
26
|
+
return running && isLast && (block.type === "assistant" || block.type === "thinking");
|
|
27
|
+
}
|
|
28
|
+
/** Convert a reducer block into a display row. Pure, so it is tested without a renderer. */
|
|
29
|
+
export function blockToRow(block) {
|
|
30
|
+
switch (block.type) {
|
|
31
|
+
case "user":
|
|
32
|
+
// A crew worker's brief came from the crew, not from the keyboard.
|
|
33
|
+
if (block.worker) {
|
|
34
|
+
return {
|
|
35
|
+
label: `TASK → ${normalize(block.worker)}`,
|
|
36
|
+
tone: "muted",
|
|
37
|
+
text: normalize(block.text),
|
|
38
|
+
detail: block.background?.length ? normalize(block.background.join("\n")) : undefined
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// `UserMessage` draws the label as a marker left of the text, not as a row above it.
|
|
42
|
+
return {
|
|
43
|
+
label: USER_MESSAGE_MARKER,
|
|
44
|
+
tone: "user",
|
|
45
|
+
text: normalize(block.text),
|
|
46
|
+
// Background is provider context, not typed text; keep it visibly separate.
|
|
47
|
+
detail: block.background?.length ? normalize(block.background.join("\n")) : undefined
|
|
48
|
+
};
|
|
49
|
+
case "assistant":
|
|
50
|
+
return { label: "CREW CODER", tone: "assistant", text: normalize(block.text) };
|
|
51
|
+
case "thinking":
|
|
52
|
+
return { label: "THINKING", tone: "thinking", text: normalize(block.text) };
|
|
53
|
+
case "tool":
|
|
54
|
+
return {
|
|
55
|
+
label: `TOOL ${block.name} · ${block.status}`,
|
|
56
|
+
tone: block.status === "error" ? "error" : "tool",
|
|
57
|
+
text: normalize(block.text ?? "")
|
|
58
|
+
};
|
|
59
|
+
case "approval":
|
|
60
|
+
return {
|
|
61
|
+
label: `APPROVAL ${block.toolName ?? ""} · ${block.status}`.replace(/\s+·/, " ·"),
|
|
62
|
+
tone: "approval",
|
|
63
|
+
text: normalize(block.text),
|
|
64
|
+
detail: block.resolutionReason
|
|
65
|
+
};
|
|
66
|
+
case "error":
|
|
67
|
+
return { label: "ERROR", tone: "error", text: normalize(block.text) };
|
|
68
|
+
case "system":
|
|
69
|
+
return { label: "SYSTEM", tone: "system", text: normalize(block.text) };
|
|
70
|
+
case "compaction":
|
|
71
|
+
return { label: `COMPACTION · ${block.status}`, tone: "system", text: normalize(block.message) };
|
|
72
|
+
case "image":
|
|
73
|
+
// Tool-result images are labelled apart so they never read as the user's attachment.
|
|
74
|
+
// The caption; `ImageView` draws the pixels between `text` and `detail`.
|
|
75
|
+
return {
|
|
76
|
+
label: block.attachment.source === "tool" ? "TOOL IMAGE" : "IMAGE",
|
|
77
|
+
tone: "muted",
|
|
78
|
+
text: `${block.attachment.name} · ${describeAttachment(block.attachment)}`,
|
|
79
|
+
detail: block.attachment.path
|
|
80
|
+
};
|
|
81
|
+
case "extension_ui":
|
|
82
|
+
// The question and its outcome only; extension and request ids stay internal.
|
|
83
|
+
return {
|
|
84
|
+
label: `QUESTION · ${block.status}`,
|
|
85
|
+
tone: "approval",
|
|
86
|
+
text: normalize(block.title),
|
|
87
|
+
detail: block.answer !== undefined ? `Answer: ${normalize(block.answer)}` : undefined
|
|
88
|
+
};
|
|
89
|
+
case "live_ui":
|
|
90
|
+
// Live UI is skipped by owner decision and never mounted here; say so rather than drop it.
|
|
91
|
+
return { label: "LIVE UI", tone: "muted", text: `${normalize(block.title)} (extension live UI is not available in this UI)` };
|
|
92
|
+
default: {
|
|
93
|
+
// Crews, goals, jobs, ... draw as panels (`block-panels.ts`); the Transcript routes them
|
|
94
|
+
// before reaching here. The assignment makes a new block type a compile error.
|
|
95
|
+
const panel = block;
|
|
96
|
+
return { label: panel.type.toUpperCase().replace(/_/g, " "), tone: "muted", text: "" };
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A reply's generation speed beside its label (`42.3 tok/s`), once its
|
|
102
|
+
* `message_end` reported it. The agent times only generation, not tools or
|
|
103
|
+
* approvals inside the call (`GenerationClock`). Streaming, replayed, and
|
|
104
|
+
* synthetic replies have none.
|
|
105
|
+
*/
|
|
106
|
+
export function throughputLabel(block) {
|
|
107
|
+
if (block.type !== "assistant")
|
|
108
|
+
return undefined;
|
|
109
|
+
const rate = block.tokensPerSecond;
|
|
110
|
+
if (rate === undefined || !Number.isFinite(rate) || rate <= 0)
|
|
111
|
+
return undefined;
|
|
112
|
+
return `${formatTokensPerSecond(rate)} tok/s`;
|
|
113
|
+
}
|
|
114
|
+
/** Normalize line endings and strip terminal control sequences from agent text. */
|
|
115
|
+
export function normalize(text) {
|
|
116
|
+
return text
|
|
117
|
+
.replace(/\r\n?/g, "\n")
|
|
118
|
+
// eslint-disable-next-line no-control-regex
|
|
119
|
+
.replace(/\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[@-_]/g, "")
|
|
120
|
+
// eslint-disable-next-line no-control-regex
|
|
121
|
+
.replace(/[\x00-\x08\x0b-\x1f\x7f]/g, "");
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=transcript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcript.js","sourceRoot":"","sources":["../src/transcript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8DAA8D,CAAC;AAClG,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAG1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AA0BlD,MAAM,UAAU,kBAAkB,CAAC,MAAgC;IACjE,MAAM,QAAQ,GAAwB,EAAE,CAAC;IACzC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAC9B,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACvD,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;YACtD,OAAO;QACT,CAAC;QACD,MAAM,IAAI,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7B,sEAAsE;QACtE,IAAI,IAAI,EAAE,IAAI,KAAK,MAAM,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK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AAC,CAAC,CAAC;YACR,yFAAyF;YACzF,+EAA+E;YAC/E,MAAM,KAAK,GAAe,KAAK,CAAC;YAChC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QACzF,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAAoB;IAClD,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW;QAAE,OAAO,SAAS,CAAC;IACjD,MAAM,IAAI,GAAG,KAAK,CAAC,eAAe,CAAC;IACnC,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IAChF,OAAO,GAAG,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC;AAChD,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,IAAI;SACR,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC;QACxB,4CAA4C;SAC3C,OAAO,CAAC,wEAAwE,EAAE,EAAE,CAAC;QACtF,4CAA4C;SAC3C,OAAO,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["import { describeAttachment } from \"@onpoint-dev-tools/crewcoder-tui-core/state/image-attachment\";\nimport { formatTokensPerSecond } from \"@onpoint-dev-tools/crewcoder-tui-core/state/usage\";\nimport type { TuiEventBlock } from \"@onpoint-dev-tools/crewcoder-tui-core/state/tui-store\";\nimport type { PanelBlock } from \"./block-panels.js\";\nimport { USER_MESSAGE_MARKER } from \"./glyphs.js\";\n\nexport type TranscriptTone = \"user\" | \"assistant\" | \"thinking\" | \"tool\" | \"approval\" | \"error\" | \"system\" | \"muted\";\n\nexport type TranscriptRow = {\n label: string;\n tone: TranscriptTone;\n text: string;\n /** Muted context rendered under the row, such as user-message background. */\n detail?: string;\n};\n\nexport type ToolBlock = Extract<TuiEventBlock, { type: \"tool\" }>;\nexport type ApprovalBlock = Extract<TuiEventBlock, { type: \"approval\" }>;\n/** Blocks that belong to the agent's work: tool calls and the approvals that gate them. */\nexport type WorkBlock = ToolBlock | ApprovalBlock;\n\n/**\n * A turn reads as sections in event order: a run of consecutive tool calls and\n * approvals is one `work` section (the Agent work box); every other block is\n * its own section. Blocks are never reordered.\n */\nexport type TranscriptSection =\n | { kind: \"work\"; blocks: WorkBlock[]; start: number }\n | { kind: \"block\"; block: TuiEventBlock; start: number };\n\nexport function transcriptSections(blocks: readonly TuiEventBlock[]): TranscriptSection[] {\n const sections: TranscriptSection[] = [];\n blocks.forEach((block, index) => {\n if (block.type !== \"tool\" && block.type !== \"approval\") {\n sections.push({ kind: \"block\", block, start: index });\n return;\n }\n const last = sections.at(-1);\n // One box per worker in a crew: a new worker's tools start a new box.\n if (last?.kind === \"work\" && workerOf(last.blocks.at(-1)) === workerOf(block)) last.blocks.push(block);\n else sections.push({ kind: \"work\", blocks: [block], start: index });\n });\n return sections;\n}\n\n/** The crew worker that produced a block, if any (`worker` is set by the reducer during crews). */\nexport function workerOf(block: TuiEventBlock | undefined): string | undefined {\n return block && \"worker\" in block ? block.worker : undefined;\n}\n\n/** Per-tool display state, owned by SessionController. */\nexport type ToolExpansion = {\n /** Long output or diff shown in full rather than collapsed. */\n isExpanded(block: ToolBlock): boolean;\n toggle(block: ToolBlock): void;\n /** The file diff of an edit is shown (not hidden). */\n isDiffShown(block: ToolBlock): boolean;\n toggleDiff(block: ToolBlock): void;\n /** Real file lines of a finished snippet edit, once read (see `computeLineAnchors`). */\n lineAnchors(block: ToolBlock): ReadonlyMap<string, number> | undefined;\n};\n\n/** The last assistant/thinking block of an active run still grows; the reducer only appends to it. */\nexport function isStreaming(block: TuiEventBlock, isLast: boolean, running: boolean): boolean {\n return running && isLast && (block.type === \"assistant\" || block.type === \"thinking\");\n}\n\n/** Convert a reducer block into a display row. Pure, so it is tested without a renderer. */\nexport function blockToRow(block: TuiEventBlock): TranscriptRow {\n switch (block.type) {\n case \"user\":\n // A crew worker's brief came from the crew, not from the keyboard.\n if (block.worker) {\n return {\n label: `TASK → ${normalize(block.worker)}`,\n tone: \"muted\",\n text: normalize(block.text),\n detail: block.background?.length ? normalize(block.background.join(\"\\n\")) : undefined\n };\n }\n // `UserMessage` draws the label as a marker left of the text, not as a row above it.\n return {\n label: USER_MESSAGE_MARKER,\n tone: \"user\",\n text: normalize(block.text),\n // Background is provider context, not typed text; keep it visibly separate.\n detail: block.background?.length ? normalize(block.background.join(\"\\n\")) : undefined\n };\n case \"assistant\":\n return { label: \"CREW CODER\", tone: \"assistant\", text: normalize(block.text) };\n case \"thinking\":\n return { label: \"THINKING\", tone: \"thinking\", text: normalize(block.text) };\n case \"tool\":\n return {\n label: `TOOL ${block.name} · ${block.status}`,\n tone: block.status === \"error\" ? \"error\" : \"tool\",\n text: normalize(block.text ?? \"\")\n };\n case \"approval\":\n return {\n label: `APPROVAL ${block.toolName ?? \"\"} · ${block.status}`.replace(/\\s+·/, \" ·\"),\n tone: \"approval\",\n text: normalize(block.text),\n detail: block.resolutionReason\n };\n case \"error\":\n return { label: \"ERROR\", tone: \"error\", text: normalize(block.text) };\n case \"system\":\n return { label: \"SYSTEM\", tone: \"system\", text: normalize(block.text) };\n case \"compaction\":\n return { label: `COMPACTION · ${block.status}`, tone: \"system\", text: normalize(block.message) };\n case \"image\":\n // Tool-result images are labelled apart so they never read as the user's attachment.\n // The caption; `ImageView` draws the pixels between `text` and `detail`.\n return {\n label: block.attachment.source === \"tool\" ? \"TOOL IMAGE\" : \"IMAGE\",\n tone: \"muted\",\n text: `${block.attachment.name} · ${describeAttachment(block.attachment)}`,\n detail: block.attachment.path\n };\n case \"extension_ui\":\n // The question and its outcome only; extension and request ids stay internal.\n return {\n label: `QUESTION · ${block.status}`,\n tone: \"approval\",\n text: normalize(block.title),\n detail: block.answer !== undefined ? `Answer: ${normalize(block.answer)}` : undefined\n };\n case \"live_ui\":\n // Live UI is skipped by owner decision and never mounted here; say so rather than drop it.\n return { label: \"LIVE UI\", tone: \"muted\", text: `${normalize(block.title)} (extension live UI is not available in this UI)` };\n default: {\n // Crews, goals, jobs, ... draw as panels (`block-panels.ts`); the Transcript routes them\n // before reaching here. The assignment makes a new block type a compile error.\n const panel: PanelBlock = block;\n return { label: panel.type.toUpperCase().replace(/_/g, \" \"), tone: \"muted\", text: \"\" };\n }\n }\n}\n\n/**\n * A reply's generation speed beside its label (`42.3 tok/s`), once its\n * `message_end` reported it. The agent times only generation, not tools or\n * approvals inside the call (`GenerationClock`). Streaming, replayed, and\n * synthetic replies have none.\n */\nexport function throughputLabel(block: TuiEventBlock): string | undefined {\n if (block.type !== \"assistant\") return undefined;\n const rate = block.tokensPerSecond;\n if (rate === undefined || !Number.isFinite(rate) || rate <= 0) return undefined;\n return `${formatTokensPerSecond(rate)} tok/s`;\n}\n\n/** Normalize line endings and strip terminal control sequences from agent text. */\nexport function normalize(text: string): string {\n return text\n .replace(/\\r\\n?/g, \"\\n\")\n // eslint-disable-next-line no-control-regex\n .replace(/\\x1b\\[[0-9;?]*[ -/]*[@-~]|\\x1b\\][^\\x07\\x1b]*(?:\\x07|\\x1b\\\\)|\\x1b[@-_]/g, \"\")\n // eslint-disable-next-line no-control-regex\n .replace(/[\\x00-\\x08\\x0b-\\x1f\\x7f]/g, \"\");\n}\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ToolBlock } from "./transcript.js";
|
|
2
|
+
/**
|
|
3
|
+
* CrewCoder-mode workflow tools (`docs/TRANSCRIPT.md#plans-and-questions`), drawn from
|
|
4
|
+
* their arguments rather than as tool output, as in legacy `MainViewport`: the
|
|
5
|
+
* clarify step lists its questions, and a proposed plan reads as sections with the
|
|
6
|
+
* approval hint. Never collapsed: the user approves what they can read. Pure.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CLARIFY_TOOL = "crewcoder_clarify";
|
|
9
|
+
export declare const PROPOSE_PLAN_TOOL = "crewcoder_propose_plan";
|
|
10
|
+
export declare const PLAN_APPROVAL_HINT = "Approve with /approve-plan, or reply approve. Describe revisions instead if this plan is wrong.";
|
|
11
|
+
/** One planned file change: `modify src/a.ts`, why, and a representative snippet. */
|
|
12
|
+
export type WorkflowFile = {
|
|
13
|
+
action: string;
|
|
14
|
+
path: string;
|
|
15
|
+
description: string;
|
|
16
|
+
snippet?: string;
|
|
17
|
+
};
|
|
18
|
+
export type WorkflowSection = {
|
|
19
|
+
kind: "text";
|
|
20
|
+
heading?: string;
|
|
21
|
+
text: string;
|
|
22
|
+
} | {
|
|
23
|
+
kind: "list";
|
|
24
|
+
heading?: string;
|
|
25
|
+
items: string[];
|
|
26
|
+
} | {
|
|
27
|
+
kind: "files";
|
|
28
|
+
heading: string;
|
|
29
|
+
files: WorkflowFile[];
|
|
30
|
+
};
|
|
31
|
+
export type WorkflowView = {
|
|
32
|
+
title: string;
|
|
33
|
+
sections: WorkflowSection[];
|
|
34
|
+
hint?: string;
|
|
35
|
+
};
|
|
36
|
+
/** The view of a clarify or plan tool, or undefined for other tools and failed calls (those show their error). */
|
|
37
|
+
export declare function workflowView(block: ToolBlock): WorkflowView | undefined;
|
|
38
|
+
/** The text a view draws, in order, for transcript search (headings and the hint are labels, not content). */
|
|
39
|
+
export declare function workflowTexts(view: WorkflowView): string[];
|
|
40
|
+
/** `modify src/a.ts` */
|
|
41
|
+
export declare function fileLine(file: Pick<WorkflowFile, "action" | "path">): string;
|
|
42
|
+
//# sourceMappingURL=workflow-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-tools.d.ts","sourceRoot":"","sources":["../src/workflow-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5D;;;;;GAKG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CRIPT.md#plans-and-questions`), drawn from
|
|
4
|
+
* their arguments rather than as tool output, as in legacy `MainViewport`: the
|
|
5
|
+
* clarify step lists its questions, and a proposed plan reads as sections with the
|
|
6
|
+
* approval hint. Never collapsed: the user approves what they can read. Pure.
|
|
7
|
+
*/
|
|
8
|
+
export const CLARIFY_TOOL = "crewcoder_clarify";
|
|
9
|
+
export const PROPOSE_PLAN_TOOL = "crewcoder_propose_plan";
|
|
10
|
+
export const PLAN_APPROVAL_HINT = "Approve with /approve-plan, or reply approve. Describe revisions instead if this plan is wrong.";
|
|
11
|
+
/** The view of a clarify or plan tool, or undefined for other tools and failed calls (those show their error). */
|
|
12
|
+
export function workflowView(block) {
|
|
13
|
+
if (block.status === "error")
|
|
14
|
+
return undefined;
|
|
15
|
+
if (block.name === CLARIFY_TOOL)
|
|
16
|
+
return clarifyView(block);
|
|
17
|
+
if (block.name === PROPOSE_PLAN_TOOL)
|
|
18
|
+
return planView(block);
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
function clarifyView(block) {
|
|
22
|
+
const questions = stringList(block.args?.questions);
|
|
23
|
+
if (questions.length > 0)
|
|
24
|
+
return { title: "Clarifying questions", sections: [{ kind: "list", items: questions }] };
|
|
25
|
+
return { title: "Clarifying questions", sections: fallback(block) };
|
|
26
|
+
}
|
|
27
|
+
function planView(block) {
|
|
28
|
+
const args = block.args ?? {};
|
|
29
|
+
const sections = [];
|
|
30
|
+
const text = (heading, value) => {
|
|
31
|
+
const body = stringValue(value);
|
|
32
|
+
if (body)
|
|
33
|
+
sections.push({ kind: "text", heading, text: body });
|
|
34
|
+
};
|
|
35
|
+
text("Requirements", args.requirements);
|
|
36
|
+
text("Investigation", args.investigation);
|
|
37
|
+
const files = fileChanges(args.fileChanges);
|
|
38
|
+
if (files.length > 0)
|
|
39
|
+
sections.push({ kind: "files", heading: "File changes", files });
|
|
40
|
+
text("Plan", args.plan);
|
|
41
|
+
text("Acceptance criteria", args.acceptanceCriteria);
|
|
42
|
+
if (sections.length === 0)
|
|
43
|
+
return { title: "Proposed plan", sections: fallback(block) };
|
|
44
|
+
return { title: "Proposed plan", sections, hint: PLAN_APPROVAL_HINT };
|
|
45
|
+
}
|
|
46
|
+
/** No usable arguments: the tool's own text, so nothing is lost. */
|
|
47
|
+
function fallback(block) {
|
|
48
|
+
const text = normalize(block.text ?? "").trim();
|
|
49
|
+
return text ? [{ kind: "text", text }] : [];
|
|
50
|
+
}
|
|
51
|
+
function stringValue(value) {
|
|
52
|
+
return typeof value === "string" ? normalize(value).trim() : "";
|
|
53
|
+
}
|
|
54
|
+
function stringList(value) {
|
|
55
|
+
return Array.isArray(value) ? value.map((item) => (typeof item === "string" ? normalize(item).trim() : "")).filter(Boolean) : [];
|
|
56
|
+
}
|
|
57
|
+
function fileChanges(value) {
|
|
58
|
+
if (!Array.isArray(value))
|
|
59
|
+
return [];
|
|
60
|
+
return value.flatMap((entry) => {
|
|
61
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry))
|
|
62
|
+
return [];
|
|
63
|
+
const record = entry;
|
|
64
|
+
const path = stringValue(record.path);
|
|
65
|
+
if (!path)
|
|
66
|
+
return [];
|
|
67
|
+
const snippet = stringValue(record.snippet);
|
|
68
|
+
return [{ action: stringValue(record.action) || "change", path, description: stringValue(record.description), ...(snippet ? { snippet } : {}) }];
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/** The text a view draws, in order, for transcript search (headings and the hint are labels, not content). */
|
|
72
|
+
export function workflowTexts(view) {
|
|
73
|
+
return view.sections.flatMap((section) => {
|
|
74
|
+
if (section.kind === "text")
|
|
75
|
+
return [section.text];
|
|
76
|
+
if (section.kind === "list")
|
|
77
|
+
return section.items.map((item, index) => `${index + 1}. ${item}`);
|
|
78
|
+
return section.files.flatMap((file) => [
|
|
79
|
+
fileLine(file),
|
|
80
|
+
...(file.description ? [file.description] : []),
|
|
81
|
+
...(file.snippet ? [file.snippet] : [])
|
|
82
|
+
]);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/** `modify src/a.ts` */
|
|
86
|
+
export function fileLine(file) {
|
|
87
|
+
return `${file.action} ${file.path}`;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=workflow-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-tools.js","sourceRoot":"","sources":["../src/workflow-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,iBAAiB,CAAC;AAE5D;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,mBAAmB,CAAC;AAChD,MAAM,CAAC,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAE1D,MAAM,CAAC,MAAM,kBAAkB,GAAG,iGAAiG,CAAC;AAYpI,kHAAkH;AAClH,MAAM,UAAU,YAAY,CAAC,KAAgB;IAC3C,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO;QAAE,OAAO,SAAS,CAAC;IAC/C,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY;QAAE,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;IAC3D,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB;QAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7D,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,WAAW,CAAC,KAAgB;IACnC,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACpD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,sBAAsB,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACnH,OAAO,EAAE,KAAK,EAAE,sBAAsB,EAAE,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;AACtE,CAAC;AAED,SAAS,QAAQ,CA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ions`), drawn from\n * their arguments rather than as tool output, as in legacy `MainViewport`: the\n * clarify step lists its questions, and a proposed plan reads as sections with the\n * approval hint. Never collapsed: the user approves what they can read. Pure.\n */\n\nexport const CLARIFY_TOOL = \"crewcoder_clarify\";\nexport const PROPOSE_PLAN_TOOL = \"crewcoder_propose_plan\";\n\nexport const PLAN_APPROVAL_HINT = \"Approve with /approve-plan, or reply approve. Describe revisions instead if this plan is wrong.\";\n\n/** One planned file change: `modify src/a.ts`, why, and a representative snippet. */\nexport type WorkflowFile = { action: string; path: string; description: string; snippet?: string };\n\nexport type WorkflowSection =\n | { kind: \"text\"; heading?: string; text: string }\n | { kind: \"list\"; heading?: string; items: string[] }\n | { kind: \"files\"; heading: string; files: WorkflowFile[] };\n\nexport type WorkflowView = { title: string; sections: WorkflowSection[]; hint?: string };\n\n/** The view of a clarify or plan tool, or undefined for other tools and failed calls (those show their error). */\nexport function workflowView(block: ToolBlock): WorkflowView | undefined {\n if (block.status === \"error\") return undefined;\n if (block.name === CLARIFY_TOOL) return clarifyView(block);\n if (block.name === PROPOSE_PLAN_TOOL) return planView(block);\n return undefined;\n}\n\nfunction clarifyView(block: ToolBlock): WorkflowView {\n const questions = stringList(block.args?.questions);\n if (questions.length > 0) return { title: \"Clarifying questions\", sections: [{ kind: \"list\", items: questions }] };\n return { title: \"Clarifying questions\", sections: fallback(block) };\n}\n\nfunction planView(block: ToolBlock): WorkflowView {\n const args = block.args ?? {};\n const sections: WorkflowSection[] = [];\n const text = (heading: string, value: unknown): void => {\n const body = stringValue(value);\n if (body) sections.push({ kind: \"text\", heading, text: body });\n };\n text(\"Requirements\", args.requirements);\n text(\"Investigation\", args.investigation);\n const files = fileChanges(args.fileChanges);\n if (files.length > 0) sections.push({ kind: \"files\", heading: \"File changes\", files });\n text(\"Plan\", args.plan);\n text(\"Acceptance criteria\", args.acceptanceCriteria);\n if (sections.length === 0) return { title: \"Proposed plan\", sections: fallback(block) };\n return { title: \"Proposed plan\", sections, hint: PLAN_APPROVAL_HINT };\n}\n\n/** No usable arguments: the tool's own text, so nothing is lost. */\nfunction fallback(block: ToolBlock): WorkflowSection[] {\n const text = normalize(block.text ?? \"\").trim();\n return text ? [{ kind: \"text\", text }] : [];\n}\n\nfunction stringValue(value: unknown): string {\n return typeof value === \"string\" ? normalize(value).trim() : \"\";\n}\n\nfunction stringList(value: unknown): string[] {\n return Array.isArray(value) ? value.map((item) => (typeof item === \"string\" ? normalize(item).trim() : \"\")).filter(Boolean) : [];\n}\n\nfunction fileChanges(value: unknown): WorkflowFile[] {\n if (!Array.isArray(value)) return [];\n return value.flatMap((entry): WorkflowFile[] => {\n if (!entry || typeof entry !== \"object\" || Array.isArray(entry)) return [];\n const record = entry as Record<string, unknown>;\n const path = stringValue(record.path);\n if (!path) return [];\n const snippet = stringValue(record.snippet);\n return [{ action: stringValue(record.action) || \"change\", path, description: stringValue(record.description), ...(snippet ? { snippet } : {}) }];\n });\n}\n\n/** The text a view draws, in order, for transcript search (headings and the hint are labels, not content). */\nexport function workflowTexts(view: WorkflowView): string[] {\n return view.sections.flatMap((section) => {\n if (section.kind === \"text\") return [section.text];\n if (section.kind === \"list\") return section.items.map((item, index) => `${index + 1}. ${item}`);\n return section.files.flatMap((file) => [\n fileLine(file),\n ...(file.description ? [file.description] : []),\n ...(file.snippet ? [file.snippet] : [])\n ]);\n });\n}\n\n/** `modify src/a.ts` */\nexport function fileLine(file: Pick<WorkflowFile, \"action\" | \"path\">): string {\n return `${file.action} ${file.path}`;\n}\n"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ember",
|
|
3
|
+
"extends": "slate",
|
|
4
|
+
"vars": {
|
|
5
|
+
"char": "#16130f",
|
|
6
|
+
"char2": "#1c1814",
|
|
7
|
+
"char3": "#201b16",
|
|
8
|
+
"char4": "#2a231c",
|
|
9
|
+
"ash": "#3d3228",
|
|
10
|
+
"smoke": "#7a6c5d",
|
|
11
|
+
"dust": "#9a8a77",
|
|
12
|
+
"sand": "#c9b9a3",
|
|
13
|
+
"parchment": "#e8dccb",
|
|
14
|
+
"cream": "#f5ebdd",
|
|
15
|
+
"amber": "#e0a458",
|
|
16
|
+
"apricot": "#f2c18d",
|
|
17
|
+
"gold": "#e6b450",
|
|
18
|
+
"coral": "#e07a5f",
|
|
19
|
+
"sage": "#9cb380",
|
|
20
|
+
"teal": "#8fb8b0",
|
|
21
|
+
"rose": "#d9a0c6"
|
|
22
|
+
},
|
|
23
|
+
"colors": {
|
|
24
|
+
"background": "char",
|
|
25
|
+
"backgroundAlt": "char2",
|
|
26
|
+
"surface": "char3",
|
|
27
|
+
"surfaceAlt": "char4",
|
|
28
|
+
"surfaceGlow": "char4",
|
|
29
|
+
"panel": "char3",
|
|
30
|
+
"panelAlt": "char4",
|
|
31
|
+
"panelThinking": "char3",
|
|
32
|
+
"selectedBg": "#3a2e22",
|
|
33
|
+
"diffAddBg": "#1e2a1a",
|
|
34
|
+
"diffDelBg": "#33201a",
|
|
35
|
+
"border": "ash",
|
|
36
|
+
"borderStrong": "amber",
|
|
37
|
+
"primary": "amber",
|
|
38
|
+
"text": "parchment",
|
|
39
|
+
"muted": "dust",
|
|
40
|
+
"subtle": "sand",
|
|
41
|
+
"success": "sage",
|
|
42
|
+
"warning": "gold",
|
|
43
|
+
"danger": "coral",
|
|
44
|
+
"accent": "apricot",
|
|
45
|
+
"accent2": "sage",
|
|
46
|
+
"accent3": "ash",
|
|
47
|
+
"glow": "amber"
|
|
48
|
+
},
|
|
49
|
+
"syntax": {
|
|
50
|
+
"keyword": "coral",
|
|
51
|
+
"string": "sage",
|
|
52
|
+
"number": "rose",
|
|
53
|
+
"constant": "rose",
|
|
54
|
+
"comment": "smoke",
|
|
55
|
+
"function": "apricot",
|
|
56
|
+
"type": "teal",
|
|
57
|
+
"property": "parchment",
|
|
58
|
+
"operator": "sand",
|
|
59
|
+
"punctuation": "dust",
|
|
60
|
+
"tag": "coral",
|
|
61
|
+
"attribute": "gold",
|
|
62
|
+
"escape": "gold"
|
|
63
|
+
},
|
|
64
|
+
"markdown": {
|
|
65
|
+
"heading": "amber",
|
|
66
|
+
"strong": "cream",
|
|
67
|
+
"emphasis": "sand",
|
|
68
|
+
"strikethrough": "smoke",
|
|
69
|
+
"code": "teal",
|
|
70
|
+
"link": "apricot",
|
|
71
|
+
"linkUrl": "smoke",
|
|
72
|
+
"listMarker": "amber",
|
|
73
|
+
"quote": "dust"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Max Brunsfeld
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[
|
|
2
|
+
(string)
|
|
3
|
+
(raw_string)
|
|
4
|
+
(heredoc_body)
|
|
5
|
+
(heredoc_start)
|
|
6
|
+
] @string
|
|
7
|
+
|
|
8
|
+
(command_name) @function
|
|
9
|
+
|
|
10
|
+
(variable_name) @property
|
|
11
|
+
|
|
12
|
+
[
|
|
13
|
+
"case"
|
|
14
|
+
"do"
|
|
15
|
+
"done"
|
|
16
|
+
"elif"
|
|
17
|
+
"else"
|
|
18
|
+
"esac"
|
|
19
|
+
"export"
|
|
20
|
+
"fi"
|
|
21
|
+
"for"
|
|
22
|
+
"function"
|
|
23
|
+
"if"
|
|
24
|
+
"in"
|
|
25
|
+
"select"
|
|
26
|
+
"then"
|
|
27
|
+
"unset"
|
|
28
|
+
"until"
|
|
29
|
+
"while"
|
|
30
|
+
] @keyword
|
|
31
|
+
|
|
32
|
+
(comment) @comment
|
|
33
|
+
|
|
34
|
+
(function_definition name: (word) @function)
|
|
35
|
+
|
|
36
|
+
(file_descriptor) @number
|
|
37
|
+
|
|
38
|
+
[
|
|
39
|
+
(command_substitution)
|
|
40
|
+
(process_substitution)
|
|
41
|
+
(expansion)
|
|
42
|
+
]@embedded
|
|
43
|
+
|
|
44
|
+
[
|
|
45
|
+
"$"
|
|
46
|
+
"&&"
|
|
47
|
+
">"
|
|
48
|
+
">>"
|
|
49
|
+
"<"
|
|
50
|
+
"|"
|
|
51
|
+
] @operator
|
|
52
|
+
|
|
53
|
+
(
|
|
54
|
+
(command (_) @constant)
|
|
55
|
+
(#match? @constant "^-")
|
|
56
|
+
)
|
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Max Brunsfeld
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
(comment) @comment
|
|
2
|
+
|
|
3
|
+
(tag_name) @tag
|
|
4
|
+
(nesting_selector) @tag
|
|
5
|
+
(universal_selector) @tag
|
|
6
|
+
|
|
7
|
+
"~" @operator
|
|
8
|
+
">" @operator
|
|
9
|
+
"+" @operator
|
|
10
|
+
"-" @operator
|
|
11
|
+
"*" @operator
|
|
12
|
+
"/" @operator
|
|
13
|
+
"=" @operator
|
|
14
|
+
"^=" @operator
|
|
15
|
+
"|=" @operator
|
|
16
|
+
"~=" @operator
|
|
17
|
+
"$=" @operator
|
|
18
|
+
"*=" @operator
|
|
19
|
+
|
|
20
|
+
"and" @operator
|
|
21
|
+
"or" @operator
|
|
22
|
+
"not" @operator
|
|
23
|
+
"only" @operator
|
|
24
|
+
|
|
25
|
+
(attribute_selector (plain_value) @string)
|
|
26
|
+
|
|
27
|
+
((property_name) @variable
|
|
28
|
+
(#match? @variable "^--"))
|
|
29
|
+
((plain_value) @variable
|
|
30
|
+
(#match? @variable "^--"))
|
|
31
|
+
|
|
32
|
+
(class_name) @property
|
|
33
|
+
(id_name) @property
|
|
34
|
+
(namespace_name) @property
|
|
35
|
+
(property_name) @property
|
|
36
|
+
(feature_name) @property
|
|
37
|
+
|
|
38
|
+
(pseudo_element_selector (tag_name) @attribute)
|
|
39
|
+
(pseudo_class_selector (class_name) @attribute)
|
|
40
|
+
(attribute_name) @attribute
|
|
41
|
+
|
|
42
|
+
(function_name) @function
|
|
43
|
+
|
|
44
|
+
"@media" @keyword
|
|
45
|
+
"@import" @keyword
|
|
46
|
+
"@charset" @keyword
|
|
47
|
+
"@namespace" @keyword
|
|
48
|
+
"@supports" @keyword
|
|
49
|
+
"@keyframes" @keyword
|
|
50
|
+
(at_keyword) @keyword
|
|
51
|
+
(to) @keyword
|
|
52
|
+
(from) @keyword
|
|
53
|
+
(important) @keyword
|
|
54
|
+
|
|
55
|
+
(string_value) @string
|
|
56
|
+
(color_value) @string.special
|
|
57
|
+
|
|
58
|
+
(integer_value) @number
|
|
59
|
+
(float_value) @number
|
|
60
|
+
(unit) @type
|
|
61
|
+
|
|
62
|
+
[
|
|
63
|
+
"#"
|
|
64
|
+
","
|
|
65
|
+
"."
|
|
66
|
+
":"
|
|
67
|
+
"::"
|
|
68
|
+
";"
|
|
69
|
+
] @punctuation.delimiter
|
|
70
|
+
|
|
71
|
+
[
|
|
72
|
+
"{"
|
|
73
|
+
")"
|
|
74
|
+
"("
|
|
75
|
+
"}"
|
|
76
|
+
] @punctuation.bracket
|
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 Max Brunsfeld
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|