shellpuppet 0.2.1 → 0.4.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/README.md +65 -18
- package/dist/agents/agy/index.d.ts +2 -0
- package/dist/agents/agy/index.js +11 -0
- package/dist/agents/agy/index.js.map +1 -0
- package/dist/agents/agy/nudge.d.ts +2 -0
- package/dist/agents/agy/nudge.js +29 -0
- package/dist/agents/agy/nudge.js.map +1 -0
- package/dist/agents/agy/reading.d.ts +2 -0
- package/dist/agents/agy/reading.js +28 -0
- package/dist/agents/agy/reading.js.map +1 -0
- package/dist/agents/barNudge.d.ts +9 -0
- package/dist/agents/barNudge.js +21 -0
- package/dist/agents/barNudge.js.map +1 -0
- package/dist/agents/claude/index.d.ts +2 -0
- package/dist/agents/claude/index.js +31 -0
- package/dist/agents/claude/index.js.map +1 -0
- package/dist/agents/claude/liveResumeId.d.ts +6 -0
- package/dist/agents/claude/liveResumeId.js +101 -0
- package/dist/agents/claude/liveResumeId.js.map +1 -0
- package/dist/agents/claude/nudge.d.ts +2 -0
- package/dist/agents/claude/nudge.js +38 -0
- package/dist/agents/claude/nudge.js.map +1 -0
- package/dist/agents/claude/prompts.d.ts +9 -0
- package/dist/agents/claude/prompts.js +16 -0
- package/dist/agents/claude/prompts.js.map +1 -0
- package/dist/agents/claude/reading.d.ts +2 -0
- package/dist/agents/claude/reading.js +25 -0
- package/dist/agents/claude/reading.js.map +1 -0
- package/dist/agents/codex/draft.d.ts +3 -0
- package/dist/agents/codex/draft.js +88 -0
- package/dist/agents/codex/draft.js.map +1 -0
- package/dist/agents/codex/index.d.ts +2 -0
- package/dist/agents/codex/index.js +30 -0
- package/dist/agents/codex/index.js.map +1 -0
- package/dist/agents/codex/lineBreaks.d.ts +6 -0
- package/dist/agents/codex/lineBreaks.js +105 -0
- package/dist/agents/codex/lineBreaks.js.map +1 -0
- package/dist/agents/codex/nudge.d.ts +2 -0
- package/dist/agents/codex/nudge.js +34 -0
- package/dist/agents/codex/nudge.js.map +1 -0
- package/dist/agents/codex/prompts.d.ts +9 -0
- package/dist/agents/codex/prompts.js +14 -0
- package/dist/agents/codex/prompts.js.map +1 -0
- package/dist/agents/codex/reading.d.ts +2 -0
- package/dist/agents/codex/reading.js +22 -0
- package/dist/agents/codex/reading.js.map +1 -0
- package/dist/agents/generic/index.d.ts +3 -0
- package/dist/agents/generic/index.js +9 -0
- package/dist/agents/generic/index.js.map +1 -0
- package/dist/agents/generic/prompts.d.ts +2 -0
- package/dist/agents/generic/prompts.js +10 -0
- package/dist/agents/generic/prompts.js.map +1 -0
- package/dist/agents/grok/actionBox.d.ts +13 -0
- package/dist/agents/grok/actionBox.js +127 -0
- package/dist/agents/grok/actionBox.js.map +1 -0
- package/dist/agents/grok/index.d.ts +2 -0
- package/dist/agents/grok/index.js +20 -0
- package/dist/agents/grok/index.js.map +1 -0
- package/dist/agents/grok/nudge.d.ts +2 -0
- package/dist/agents/grok/nudge.js +81 -0
- package/dist/agents/grok/nudge.js.map +1 -0
- package/dist/agents/grok/prompts.d.ts +4 -0
- package/dist/agents/grok/prompts.js +89 -0
- package/dist/agents/grok/prompts.js.map +1 -0
- package/dist/agents/grok/reading.d.ts +2 -0
- package/dist/agents/grok/reading.js +49 -0
- package/dist/agents/grok/reading.js.map +1 -0
- package/dist/agents/grok/readingRules.d.ts +2 -0
- package/dist/agents/grok/readingRules.js +44 -0
- package/dist/agents/grok/readingRules.js.map +1 -0
- package/dist/agents/hermes/frame.d.ts +25 -0
- package/dist/agents/hermes/frame.js +145 -0
- package/dist/agents/hermes/frame.js.map +1 -0
- package/dist/agents/hermes/index.d.ts +2 -0
- package/dist/agents/hermes/index.js +20 -0
- package/dist/agents/hermes/index.js.map +1 -0
- package/dist/agents/hermes/nudge.d.ts +5 -0
- package/dist/agents/hermes/nudge.js +76 -0
- package/dist/agents/hermes/nudge.js.map +1 -0
- package/dist/agents/hermes/prompts.d.ts +7 -0
- package/dist/agents/hermes/prompts.js +101 -0
- package/dist/agents/hermes/prompts.js.map +1 -0
- package/dist/agents/hermes/reading.d.ts +7 -0
- package/dist/agents/hermes/reading.js +102 -0
- package/dist/agents/hermes/reading.js.map +1 -0
- package/dist/agents/index.d.ts +28 -0
- package/dist/agents/index.js +48 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/input.d.ts +2 -0
- package/dist/agents/input.js +9 -0
- package/dist/agents/input.js.map +1 -0
- package/dist/agents/mimo/index.d.ts +2 -0
- package/dist/agents/mimo/index.js +13 -0
- package/dist/agents/mimo/index.js.map +1 -0
- package/dist/agents/mimo/nudge.d.ts +3 -0
- package/dist/agents/mimo/nudge.js +60 -0
- package/dist/agents/mimo/nudge.js.map +1 -0
- package/dist/agents/mimo/prompts.d.ts +2 -0
- package/dist/agents/mimo/prompts.js +40 -0
- package/dist/agents/mimo/prompts.js.map +1 -0
- package/dist/agents/mimo/reading.d.ts +2 -0
- package/dist/agents/mimo/reading.js +31 -0
- package/dist/agents/mimo/reading.js.map +1 -0
- package/dist/agents/mimo/readingRules.d.ts +2 -0
- package/dist/agents/mimo/readingRules.js +79 -0
- package/dist/agents/mimo/readingRules.js.map +1 -0
- package/dist/agents/mimo/stalls.d.ts +2 -0
- package/dist/agents/mimo/stalls.js +81 -0
- package/dist/agents/mimo/stalls.js.map +1 -0
- package/dist/agents/muse/index.d.ts +2 -0
- package/dist/agents/muse/index.js +20 -0
- package/dist/agents/muse/index.js.map +1 -0
- package/dist/agents/muse/input.d.ts +3 -0
- package/dist/agents/muse/input.js +7 -0
- package/dist/agents/muse/input.js.map +1 -0
- package/dist/agents/muse/nudge.d.ts +2 -0
- package/dist/agents/muse/nudge.js +33 -0
- package/dist/agents/muse/nudge.js.map +1 -0
- package/dist/agents/muse/prompts.d.ts +14 -0
- package/dist/agents/muse/prompts.js +132 -0
- package/dist/agents/muse/prompts.js.map +1 -0
- package/dist/agents/muse/reading.d.ts +2 -0
- package/dist/agents/muse/reading.js +33 -0
- package/dist/agents/muse/reading.js.map +1 -0
- package/dist/agents/muse/readingRules.d.ts +2 -0
- package/dist/agents/muse/readingRules.js +49 -0
- package/dist/agents/muse/readingRules.js.map +1 -0
- package/dist/agents/nudgeReading.d.ts +74 -0
- package/dist/agents/nudgeReading.js +252 -0
- package/dist/agents/nudgeReading.js.map +1 -0
- package/dist/agents/opencode/index.d.ts +2 -0
- package/dist/agents/opencode/index.js +21 -0
- package/dist/agents/opencode/index.js.map +1 -0
- package/dist/agents/opencode/nudge.d.ts +6 -0
- package/dist/agents/opencode/nudge.js +189 -0
- package/dist/agents/opencode/nudge.js.map +1 -0
- package/dist/agents/opencode/prompts.d.ts +6 -0
- package/dist/agents/opencode/prompts.js +198 -0
- package/dist/agents/opencode/prompts.js.map +1 -0
- package/dist/agents/opencode/reading.d.ts +2 -0
- package/dist/agents/opencode/reading.js +29 -0
- package/dist/agents/opencode/reading.js.map +1 -0
- package/dist/agents/opencode/stalls.d.ts +3 -0
- package/dist/agents/opencode/stalls.js +14 -0
- package/dist/agents/opencode/stalls.js.map +1 -0
- package/dist/agents/qoder/index.d.ts +2 -0
- package/dist/agents/qoder/index.js +12 -0
- package/dist/agents/qoder/index.js.map +1 -0
- package/dist/agents/qoder/nudge.d.ts +2 -0
- package/dist/agents/qoder/nudge.js +16 -0
- package/dist/agents/qoder/nudge.js.map +1 -0
- package/dist/agents/qoder/prompts.d.ts +2 -0
- package/dist/agents/qoder/prompts.js +6 -0
- package/dist/agents/qoder/prompts.js.map +1 -0
- package/dist/agents/qoder/reading.d.ts +2 -0
- package/dist/agents/qoder/reading.js +41 -0
- package/dist/agents/qoder/reading.js.map +1 -0
- package/dist/agents/types.d.ts +202 -0
- package/dist/agents/types.js +2 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/cli/index.js +220 -21
- package/dist/cli/index.js.map +1 -1
- package/dist/client/http.d.ts +8 -2
- package/dist/client/http.js +179 -56
- package/dist/client/http.js.map +1 -1
- package/dist/core/cron.d.ts +6 -0
- package/dist/core/cron.js +63 -0
- package/dist/core/cron.js.map +1 -0
- package/dist/core/dialogs.d.ts +2 -4
- package/dist/core/dialogs.js +6 -12
- package/dist/core/dialogs.js.map +1 -1
- package/dist/core/environment.d.ts +6 -0
- package/dist/core/environment.js +35 -0
- package/dist/core/environment.js.map +1 -0
- package/dist/core/mailbox.d.ts +223 -0
- package/dist/core/mailbox.js +549 -0
- package/dist/core/mailbox.js.map +1 -0
- package/dist/core/manager.d.ts +4 -0
- package/dist/core/manager.js +40 -2
- package/dist/core/manager.js.map +1 -1
- package/dist/core/messageText.d.ts +2 -0
- package/dist/core/messageText.js +6 -0
- package/dist/core/messageText.js.map +1 -0
- package/dist/core/nudge.d.ts +37 -0
- package/dist/core/nudge.js +60 -0
- package/dist/core/nudge.js.map +1 -0
- package/dist/core/promptDetector.d.ts +14 -12
- package/dist/core/promptDetector.js +115 -363
- package/dist/core/promptDetector.js.map +1 -1
- package/dist/core/promptText.d.ts +1 -0
- package/dist/core/promptText.js +4 -0
- package/dist/core/promptText.js.map +1 -0
- package/dist/core/readiness.d.ts +14 -0
- package/dist/core/readiness.js +95 -0
- package/dist/core/readiness.js.map +1 -0
- package/dist/core/reasoning.d.ts +68 -7
- package/dist/core/reasoning.js +584 -328
- package/dist/core/reasoning.js.map +1 -1
- package/dist/core/renderer.d.ts +63 -3
- package/dist/core/renderer.js +370 -42
- package/dist/core/renderer.js.map +1 -1
- package/dist/core/selection.d.ts +1 -1
- package/dist/core/selection.js +3 -3
- package/dist/core/selection.js.map +1 -1
- package/dist/core/session.d.ts +175 -13
- package/dist/core/session.js +1030 -93
- package/dist/core/session.js.map +1 -1
- package/dist/core/stringWidth.d.ts +2 -0
- package/dist/core/stringWidth.js +13 -0
- package/dist/core/stringWidth.js.map +1 -0
- package/dist/core/types.d.ts +62 -4
- package/dist/core/types.js +41 -0
- package/dist/core/types.js.map +1 -1
- package/dist/core/waiter.d.ts +9 -2
- package/dist/core/waiter.js +35 -10
- package/dist/core/waiter.js.map +1 -1
- package/dist/daemon/audit.d.ts +1 -1
- package/dist/daemon/audit.js +2 -1
- package/dist/daemon/audit.js.map +1 -1
- package/dist/daemon/config.d.ts +44 -0
- package/dist/daemon/config.js +166 -4
- package/dist/daemon/config.js.map +1 -1
- package/dist/daemon/folderPicker.js +21 -2
- package/dist/daemon/folderPicker.js.map +1 -1
- package/dist/daemon/homeOwner.d.ts +15 -0
- package/dist/daemon/homeOwner.js +106 -0
- package/dist/daemon/homeOwner.js.map +1 -0
- package/dist/daemon/index.js +14 -6
- package/dist/daemon/index.js.map +1 -1
- package/dist/daemon/launchProfiles.d.ts +5 -0
- package/dist/daemon/launchProfiles.js +54 -48
- package/dist/daemon/launchProfiles.js.map +1 -1
- package/dist/daemon/logger.js +1 -1
- package/dist/daemon/logger.js.map +1 -1
- package/dist/daemon/nudgeScheduler.d.ts +21 -0
- package/dist/daemon/nudgeScheduler.js +61 -0
- package/dist/daemon/nudgeScheduler.js.map +1 -0
- package/dist/daemon/paths.d.ts +20 -16
- package/dist/daemon/paths.js +181 -50
- package/dist/daemon/paths.js.map +1 -1
- package/dist/daemon/restartHold.js +16 -15
- package/dist/daemon/restartHold.js.map +1 -1
- package/dist/daemon/restartSource.d.ts +7 -0
- package/dist/daemon/restartSource.js +89 -0
- package/dist/daemon/restartSource.js.map +1 -0
- package/dist/daemon/schedules.d.ts +57 -0
- package/dist/daemon/schedules.js +181 -0
- package/dist/daemon/schedules.js.map +1 -0
- package/dist/daemon/screenshot.d.ts +4 -1
- package/dist/daemon/screenshot.js +45 -7
- package/dist/daemon/screenshot.js.map +1 -1
- package/dist/daemon/server.d.ts +82 -13
- package/dist/daemon/server.js +1737 -330
- package/dist/daemon/server.js.map +1 -1
- package/dist/daemon/sessionFeed.js +4 -1
- package/dist/daemon/sessionFeed.js.map +1 -1
- package/dist/daemon/viewerLauncher.js +3 -2
- package/dist/daemon/viewerLauncher.js.map +1 -1
- package/dist/daemon/wrappedLaunch.d.ts +1 -0
- package/dist/daemon/wrappedLaunch.js +38 -0
- package/dist/daemon/wrappedLaunch.js.map +1 -0
- package/dist/daemon/wrappedStart.d.ts +13 -0
- package/dist/daemon/wrappedStart.js +113 -0
- package/dist/daemon/wrappedStart.js.map +1 -0
- package/dist/daemon/wrappedSupervisor.d.ts +1 -0
- package/dist/daemon/wrappedSupervisor.js +55 -0
- package/dist/daemon/wrappedSupervisor.js.map +1 -0
- package/dist/mcp/config.js +2 -1
- package/dist/mcp/config.js.map +1 -1
- package/dist/mcp/index.js +28 -2
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/tools.d.ts +21 -1
- package/dist/mcp/tools.js +216 -29
- package/dist/mcp/tools.js.map +1 -1
- package/dist/viewer/dashboard-folders.js +7 -1
- package/dist/viewer/dashboard-layout.js +6 -52
- package/dist/viewer/dashboard.css +20 -4
- package/dist/viewer/dashboard.html +12 -3
- package/dist/viewer/dashboard.js +549 -382
- package/dist/viewer/pane.js +744 -136
- package/dist/viewer/viewer.css +1 -1
- package/dist/viewer/viewer.js +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { normalise } from '../../core/promptText.js';
|
|
2
|
+
/** The fixed controls at the foot of OpenCode and MiMo Code's question menu. */
|
|
3
|
+
const QUESTION_MENU_FOOTER = /^ *┃ {2}↑↓ select {2}enter submit {2}esc dismiss\s*$/u;
|
|
4
|
+
const QUESTION_MENU_HEADER = /^ *┃ {2}Questions\s*$/u;
|
|
5
|
+
const QUESTION_MENU_OPTION = /^ *┃ {2}([1-4])\. (\S.*)$/u;
|
|
6
|
+
const QUESTION_MENU_DESCRIPTION = /^ *┃ {5}\S/u;
|
|
7
|
+
const QUESTION_MENU_TEXT = /^ *┃ {2}(\S.*)$/u;
|
|
8
|
+
const QUESTION_MENU_BAR = /^ *┃\s*$/u;
|
|
9
|
+
/** Cheap text gate for the styled clipped-panel rule. Descriptions may separate choices. */
|
|
10
|
+
export function hasClippedQuestionShape(raw, viewportRows) {
|
|
11
|
+
const last = raw.length - 1;
|
|
12
|
+
if (viewportRows !== undefined && raw.length !== viewportRows)
|
|
13
|
+
return false;
|
|
14
|
+
// The live panel's gutter is at cell two. An ordinary MiMo composer or
|
|
15
|
+
// transcript cannot end in a clipped panel without that bottom-row gutter.
|
|
16
|
+
const bottom = raw[last] ?? '';
|
|
17
|
+
const marker = '⟦SP:selected⟧ ';
|
|
18
|
+
const offset = bottom.startsWith(marker) ? marker.length : 0;
|
|
19
|
+
if (bottom.charCodeAt(offset + 2) !== 0x2503 || bottom.charCodeAt(offset + 3) !== 0x20 ||
|
|
20
|
+
bottom.charCodeAt(offset + 4) !== 0x20)
|
|
21
|
+
return false;
|
|
22
|
+
const line = (row) => (raw[row] ?? '').replace(/^⟦SP:selected⟧ /u, '');
|
|
23
|
+
if (!QUESTION_MENU_OPTION.test(line(last)) && !QUESTION_MENU_DESCRIPTION.test(line(last)))
|
|
24
|
+
return false;
|
|
25
|
+
let header = last - 1;
|
|
26
|
+
while (header >= 0 && !QUESTION_MENU_HEADER.test(line(header)))
|
|
27
|
+
header--;
|
|
28
|
+
if (header < 1 || !QUESTION_MENU_BAR.test(line(header - 1)) || !QUESTION_MENU_BAR.test(line(header + 1)))
|
|
29
|
+
return false;
|
|
30
|
+
let questionEnd = header + 2;
|
|
31
|
+
while (questionEnd < last && !QUESTION_MENU_BAR.test(line(questionEnd)))
|
|
32
|
+
questionEnd++;
|
|
33
|
+
if (questionEnd === header + 2 || questionEnd >= last)
|
|
34
|
+
return false;
|
|
35
|
+
let nextChoice = 1;
|
|
36
|
+
for (let row = questionEnd + 1; row <= last; row++) {
|
|
37
|
+
const choice = QUESTION_MENU_OPTION.exec(line(row));
|
|
38
|
+
if (choice !== null) {
|
|
39
|
+
if (Number(choice[1]) !== nextChoice++)
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
else if (nextChoice === 1 || !QUESTION_MENU_DESCRIPTION.test(line(row)))
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return nextChoice >= 3;
|
|
46
|
+
}
|
|
47
|
+
/** OpenCode 2.2.5 draws the live menu on this panel, unlike its blue composer gutter. */
|
|
48
|
+
function panelStyle(line, from, to, colours) {
|
|
49
|
+
if (line === undefined || to > line.text.length)
|
|
50
|
+
return false;
|
|
51
|
+
return Array.from({ length: to - from }, (_, offset) => line.spans.find(span => span.from <= from + offset && span.to > from + offset)).every(span => span !== undefined && span.bg === '#141414' && colours.includes(span.fg ?? '') &&
|
|
52
|
+
!span.bold && !span.dim && !span.italic && !span.inverse);
|
|
53
|
+
}
|
|
54
|
+
function livePanelRow(raw, line, kind) {
|
|
55
|
+
const text = raw.trimEnd();
|
|
56
|
+
if (line?.text !== text || !panelStyle(line, 2, 3, ['#fab283']))
|
|
57
|
+
return false;
|
|
58
|
+
if (kind === 'bar')
|
|
59
|
+
return true;
|
|
60
|
+
const start = kind === 'description' ? 8 : 5;
|
|
61
|
+
if (kind === 'option') {
|
|
62
|
+
return (panelStyle(line, 5, 8, ['#fab283']) && panelStyle(line, 8, text.length, ['#fab283'])) ||
|
|
63
|
+
(panelStyle(line, 5, 8, ['#808080']) && panelStyle(line, 8, text.length, ['#eeeeee']));
|
|
64
|
+
}
|
|
65
|
+
return panelStyle(line, start, text.length, kind === 'header' || kind === 'description' ? ['#808080'] : ['#eeeeee']);
|
|
66
|
+
}
|
|
67
|
+
/** A menu taller than the viewport has no footer or custom-answer row on screen. */
|
|
68
|
+
function clippedQuestionMenu(raw, busy, viewportRows, styled) {
|
|
69
|
+
const last = raw.length - 1;
|
|
70
|
+
if (!hasClippedQuestionShape(raw, viewportRows))
|
|
71
|
+
return null;
|
|
72
|
+
let header = last - 1;
|
|
73
|
+
while (header >= 0 && !QUESTION_MENU_HEADER.test(raw[header] ?? ''))
|
|
74
|
+
header--;
|
|
75
|
+
if (header < 1 || !QUESTION_MENU_BAR.test(raw[header - 1] ?? '') || !QUESTION_MENU_BAR.test(raw[header + 1] ?? ''))
|
|
76
|
+
return null;
|
|
77
|
+
if (styled?.length !== raw.length || !livePanelRow(raw[header], styled[header], 'header') ||
|
|
78
|
+
!livePanelRow(raw[header - 1], styled[header - 1], 'bar') ||
|
|
79
|
+
!livePanelRow(raw[header + 1], styled[header + 1], 'bar'))
|
|
80
|
+
return null;
|
|
81
|
+
// Earlier transcript and idle chrome can remain above a live panel.
|
|
82
|
+
if (raw.slice(0, header).some((line) => busy(line) || /\besc interrupt\b|^ {3,}[⠀-⣿] |^ {3,}\+ Thought\s*$|^ {5}▣ {2}\S/iu.test(line)))
|
|
83
|
+
return null;
|
|
84
|
+
const question = [];
|
|
85
|
+
let cursor = header + 2;
|
|
86
|
+
while (cursor < last && !QUESTION_MENU_BAR.test(raw[cursor] ?? '')) {
|
|
87
|
+
const text = QUESTION_MENU_TEXT.exec(raw[cursor] ?? '');
|
|
88
|
+
if (text === null || QUESTION_MENU_OPTION.test(raw[cursor] ?? '') ||
|
|
89
|
+
!livePanelRow(raw[cursor], styled[cursor], 'question'))
|
|
90
|
+
return null;
|
|
91
|
+
question.push(text[1]);
|
|
92
|
+
cursor++;
|
|
93
|
+
}
|
|
94
|
+
if (question.length === 0 || cursor >= last)
|
|
95
|
+
return null;
|
|
96
|
+
if (!livePanelRow(raw[cursor], styled[cursor], 'bar'))
|
|
97
|
+
return null;
|
|
98
|
+
cursor++;
|
|
99
|
+
const options = [];
|
|
100
|
+
const optionRows = [];
|
|
101
|
+
for (; cursor <= last; cursor++) {
|
|
102
|
+
const line = raw[cursor] ?? '';
|
|
103
|
+
const option = QUESTION_MENU_OPTION.exec(line);
|
|
104
|
+
if (option !== null) {
|
|
105
|
+
if (Number(option[1]) !== options.length + 1 || options.length === 4)
|
|
106
|
+
return null;
|
|
107
|
+
if (!livePanelRow(line, styled[cursor], 'option'))
|
|
108
|
+
return null;
|
|
109
|
+
options.push(normalise(option[2]));
|
|
110
|
+
optionRows.push(cursor);
|
|
111
|
+
}
|
|
112
|
+
else if (options.length === 0 || !QUESTION_MENU_DESCRIPTION.test(line) ||
|
|
113
|
+
!livePanelRow(line, styled[cursor], 'description')) {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (options.length < 2 || options.at(-1) === 'Type your own answer')
|
|
118
|
+
return null;
|
|
119
|
+
return {
|
|
120
|
+
question: normalise(question.join(' ')),
|
|
121
|
+
options,
|
|
122
|
+
optionRows,
|
|
123
|
+
signature: normalise(raw.slice(header, last + 1).join(' ')),
|
|
124
|
+
rows: [header, last],
|
|
125
|
+
basis: 'frame',
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/** A live left-ruled question menu with its fixed footer and custom-answer choice. */
|
|
129
|
+
function openCodeQuestionMenu(raw, lines, busy, viewportRows, styled) {
|
|
130
|
+
const clipped = clippedQuestionMenu(raw, busy, viewportRows, styled);
|
|
131
|
+
if (clipped !== null)
|
|
132
|
+
return clipped;
|
|
133
|
+
const footer = [...lines].reverse().find((line) => QUESTION_MENU_FOOTER.test(line.text));
|
|
134
|
+
if (footer === undefined)
|
|
135
|
+
return null;
|
|
136
|
+
const after = lines.filter((line) => line.index > footer.index);
|
|
137
|
+
// The programme may draw a status line below the menu, but another input
|
|
138
|
+
// box or a resumed transcript means this menu is no longer waiting.
|
|
139
|
+
if (after.length > 2 || after.some((line) => busy(line.text) || /[╭╰│❯›]/u.test(line.text)))
|
|
140
|
+
return null;
|
|
141
|
+
let cursor = footer.index - 1;
|
|
142
|
+
while (QUESTION_MENU_BAR.test(raw[cursor] ?? ''))
|
|
143
|
+
cursor--;
|
|
144
|
+
const options = [];
|
|
145
|
+
for (let count = 0; count < 4 && cursor >= 0; count++) {
|
|
146
|
+
while (QUESTION_MENU_DESCRIPTION.test(raw[cursor] ?? ''))
|
|
147
|
+
cursor--;
|
|
148
|
+
const row = QUESTION_MENU_OPTION.exec(raw[cursor] ?? '');
|
|
149
|
+
if (row === null)
|
|
150
|
+
break;
|
|
151
|
+
options.unshift(row[2]);
|
|
152
|
+
cursor--;
|
|
153
|
+
}
|
|
154
|
+
// The walk above collects option rows from the bottom. Their numbers must
|
|
155
|
+
// be consecutive, with the final row offering the custom answer.
|
|
156
|
+
if (options.length < 2 || options.length > 4 || options.at(-1) !== 'Type your own answer')
|
|
157
|
+
return null;
|
|
158
|
+
const firstOption = cursor + 1;
|
|
159
|
+
const numbered = raw.slice(firstOption, footer.index).map((line) => QUESTION_MENU_OPTION.exec(line)?.[1]);
|
|
160
|
+
if (numbered.filter((value) => value !== undefined).join(',') !== options.map((_, i) => String(i + 1)).join(','))
|
|
161
|
+
return null;
|
|
162
|
+
if (!QUESTION_MENU_BAR.test(raw[cursor] ?? ''))
|
|
163
|
+
return null;
|
|
164
|
+
while (QUESTION_MENU_BAR.test(raw[cursor] ?? ''))
|
|
165
|
+
cursor--;
|
|
166
|
+
const question = [];
|
|
167
|
+
while (cursor >= 0 && question.length < 8) {
|
|
168
|
+
const row = QUESTION_MENU_TEXT.exec(raw[cursor] ?? '');
|
|
169
|
+
if (row === null || QUESTION_MENU_OPTION.test(raw[cursor] ?? ''))
|
|
170
|
+
break;
|
|
171
|
+
question.unshift(row[1]);
|
|
172
|
+
cursor--;
|
|
173
|
+
}
|
|
174
|
+
if (question.length === 0)
|
|
175
|
+
return null;
|
|
176
|
+
const first = cursor + 1;
|
|
177
|
+
return {
|
|
178
|
+
question: normalise(question.join(' ')),
|
|
179
|
+
options,
|
|
180
|
+
optionRows: raw.slice(firstOption, footer.index).map((line, index) => QUESTION_MENU_OPTION.test(line) ? firstOption + index : -1).filter((index) => index >= 0),
|
|
181
|
+
signature: normalise(raw.slice(first, footer.index + 1).join(' ')),
|
|
182
|
+
rows: [first, footer.index],
|
|
183
|
+
basis: 'footer',
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
export const permissionDialog = {
|
|
187
|
+
// OpenCode offers three choices, the middle one "Always allow"; MiMo
|
|
188
|
+
// Code, built from it, calls that one "Allow always", and leaves it out
|
|
189
|
+
// when the command deletes files.
|
|
190
|
+
name: 'OpenCode and MiMo Code',
|
|
191
|
+
title: '^ *┃ +△ Permission required',
|
|
192
|
+
choices: '^ *┃ +Allow once {2,}(?:(?:Always allow|Allow always) {2,})?Reject',
|
|
193
|
+
};
|
|
194
|
+
export const prompts = [
|
|
195
|
+
{ kind: 'menu', order: 1, detect: (raw, lines, _tail, busy, viewportRows, styled) => openCodeQuestionMenu(raw, lines, busy, viewportRows, styled) },
|
|
196
|
+
{ kind: 'dialog', signature: permissionDialog },
|
|
197
|
+
];
|
|
198
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/agents/opencode/prompts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAKrD,gFAAgF;AAChF,MAAM,oBAAoB,GAAG,uDAAuD,CAAC;AACrF,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AACtD,MAAM,oBAAoB,GAAG,4BAA4B,CAAC;AAC1D,MAAM,yBAAyB,GAAG,aAAa,CAAC;AAChD,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAC9C,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAEtC,4FAA4F;AAC5F,MAAM,UAAU,uBAAuB,CAAC,GAAsB,EAAE,YAAqB;IACnF,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;IAC5B,IAAI,YAAY,KAAK,SAAS,IAAI,GAAG,CAAC,MAAM,KAAK,YAAY;QAAE,OAAO,KAAK,CAAC;IAC5E,uEAAuE;IACvE,2EAA2E;IAC3E,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,gBAAgB,CAAC;IAChC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,IAAI,M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IACpC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE;IACnJ,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE;CAChD,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const reading = {
|
|
2
|
+
// OpenCode 2.0.26: no reasoning text is drawn. While the model
|
|
3
|
+
// thinks it shows "⠇ Thinking"; afterwards a collapsed "+ Thought · Ns"
|
|
4
|
+
// with nothing under it. The answer is plain paragraphs, in the same
|
|
5
|
+
// colour and indent as any other text, closed by a footer naming the
|
|
6
|
+
// agent, the model and the elapsed time. A sidebar
|
|
7
|
+
// can share the rows on the right.
|
|
8
|
+
name: 'opencode',
|
|
9
|
+
programs: ['opencode'],
|
|
10
|
+
measured: 'OpenCode 2.0.26',
|
|
11
|
+
composer: { text: '^ {2}[┃╹]' },
|
|
12
|
+
chrome: [{ text: '^ {2}┃' }, { text: '^\\s{60,}\\S' }],
|
|
13
|
+
busy: [
|
|
14
|
+
{ text: '\\besc interrupt\\b' },
|
|
15
|
+
{ text: '^ {3,}[⠀-⣿] ' },
|
|
16
|
+
{ text: '^ {3,}\\+ Thought\\s*$' },
|
|
17
|
+
],
|
|
18
|
+
turn: { text: '^ {2}┃ {2}\\S' },
|
|
19
|
+
answer: {
|
|
20
|
+
start: { text: '^ {5}[^\\s→+⠀-⣿]', lead: { fg: ['default', '#eeeeee', '#ffffff', '#000000'] } },
|
|
21
|
+
continues: { text: '^ {5}[^\\s→+⠀-⣿]', lead: { fg: ['default', '#eeeeee', '#ffffff', '#000000'] } },
|
|
22
|
+
upward: true,
|
|
23
|
+
},
|
|
24
|
+
trailer: { text: '^ {5}\\S+ · [^·]+ · \\d[\\d.]*m?s\\b' },
|
|
25
|
+
requireTrailer: true,
|
|
26
|
+
// The sidebar, on the same rows to the right.
|
|
27
|
+
tidy: ' {20,}\\S.*$',
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=reading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reading.js","sourceRoot":"","sources":["../../../src/agents/opencode/reading.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAAmB;IACrC,+DAA+D;IAC/D,wEAAwE;IACxE,qEAAqE;IACrE,qEAAqE;IACrE,mDAAmD;IACnD,mCAAmC;IACnC,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE,CAAC,UAAU,CAAC;IACtB,QAAQ,EAAE,iBAAiB;IAC3B,QAAQ,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;IAC/B,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;IACtD,IAAI,EAAE;QACJ,EAAE,IAAI,EAAE,qBAAqB,EAAE;QAC/B,EAAE,IAAI,EAAE,cAAc,EAAE;QACxB,EAAE,IAAI,EAAE,wBAAwB,EAAE;KACnC;IACD,IAAI,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;IAC/B,MAAM,EAAE;QACN,KAAK,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,EAAE;QAC/F,SAAS,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,EAAE;QACnG,MAAM,EAAE,IAAI;KACb;IACD,OAAO,EAAE,EAAE,IAAI,EAAE,sCAAsC,EAAE;IACzD,cAAc,EAAE,IAAI;IACpB,8CAA8C;IAC9C,IAAI,EAAE,cAAc;CACrB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// OpenCode's centred connection banner remains visible over a busy row or dialog.
|
|
2
|
+
// A permission dialog can cover the gutter beside the banner title.
|
|
3
|
+
// MiMo Code shares the same underlying terminal interface.
|
|
4
|
+
export const serverLost = {
|
|
5
|
+
reason: 'server-lost',
|
|
6
|
+
description: 'The local agent server connection was lost.',
|
|
7
|
+
marker: { text: /^(?: {2}┃| {3}) {15,}[⠀-⣿] Connection lost…$/u, fg: ['#eeeeee'] },
|
|
8
|
+
overlay: { message: { text: '^Reconnecting to the server automatically\\.$' }, background: '#141414', centreOffset: -1 },
|
|
9
|
+
frameColumns: [2, 16, 18],
|
|
10
|
+
chrome: [], before: { text: '$^' }, rows: [], footer: { text: '$^' },
|
|
11
|
+
composer: { text: '$^' }, idle: [], bottom: [],
|
|
12
|
+
};
|
|
13
|
+
export const stalls = [serverLost];
|
|
14
|
+
//# sourceMappingURL=stalls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stalls.js","sourceRoot":"","sources":["../../../src/agents/opencode/stalls.ts"],"names":[],"mappings":"AAEA,kFAAkF;AAClF,oEAAoE;AACpE,2DAA2D;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAmB;IACxC,MAAM,EAAE,aAAa;IACrB,WAAW,EAAE,6CAA6C;IAC1D,MAAM,EAAE,EAAE,IAAI,EAAE,+CAA+C,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE;IAClF,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,+CAA+C,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,CAAC,EAAE;IACxH,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC;IACzB,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;IACpE,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE;CAC/C,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAqB,CAAC,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { readiness as nudgeReadiness } from './nudge.js';
|
|
2
|
+
import { prompts } from './prompts.js';
|
|
3
|
+
import { reading } from './reading.js';
|
|
4
|
+
import { submittingText } from '../input.js';
|
|
5
|
+
export const qoder = {
|
|
6
|
+
name: reading.name, programs: reading.programs, reading, prompts,
|
|
7
|
+
input: { submit: { key: '\r', delayMs: 150, matches: submittingText } },
|
|
8
|
+
// First paint at 22 to 23 s, accepting input at 24 s (agent-profiles.md).
|
|
9
|
+
readiness: { readyText: ['Type your message'], settleMs: 2000 },
|
|
10
|
+
nudge: { readiness: nudgeReadiness },
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agents/qoder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,CAAC,MAAM,KAAK,GAAgB;IAChC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO;IAChE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE;IACvE,0EAA0E;IAC1E,SAAS,EAAE,EAAE,SAAS,EAAE,CAAC,mBAAmB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC/D,KAAK,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE;CACrC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { bodyStyles, readingReadiness } from '../nudgeReading.js';
|
|
2
|
+
import { reading } from './reading.js';
|
|
3
|
+
/** Grey placeholder on an idle Qoder composer. `? for shortcuts` is status above the frame. */
|
|
4
|
+
const PLACEHOLDER = 'Type your message or @path/to/file';
|
|
5
|
+
function placeholderInk(line) {
|
|
6
|
+
const body = bodyStyles(line);
|
|
7
|
+
return body.length > 0 && body.every((style) => style.fg === '#95958f');
|
|
8
|
+
}
|
|
9
|
+
export function readiness(view) {
|
|
10
|
+
return readingReadiness(view, reading, {
|
|
11
|
+
placeholder: PLACEHOLDER,
|
|
12
|
+
continuations: true,
|
|
13
|
+
placeholderInk,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=nudge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nudge.js","sourceRoot":"","sources":["../../../src/agents/qoder/nudge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,+FAA+F;AAC/F,MAAM,WAAW,GAAG,oCAAoC,CAAC;AAEzD,SAAS,cAAc,CAAC,IAAgB;IACtC,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9B,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAe;IACvC,OAAO,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE;QACrC,WAAW,EAAE,WAAW;QACxB,aAAa,EAAE,IAAI;QACnB,cAAc;KACf,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/agents/qoder/prompts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,CAAC,MAAM,OAAO,GAAkB,CAAC;QACrC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,+BAA+B,EAAE,MAAM,EAAE,GAAG;QACpE,QAAQ,EAAE,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAK,CAAC;KAC7C,CAAC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const RULE_INDENTED = '^\\s*[─━]{10,}';
|
|
2
|
+
export const reading = {
|
|
3
|
+
// Qoder CLI 1.1.80, default thinking: a "Thinking" heading in
|
|
4
|
+
// italics, then the reasoning behind a grey "│" bar in grey italics, as
|
|
5
|
+
// the model works and after it has answered. Messages start with a "▪"
|
|
6
|
+
// in the text colour, tool calls with a green one. While a turn runs, a
|
|
7
|
+
// braille spinner line says "(esc to cancel, Ns)".
|
|
8
|
+
name: 'qoder',
|
|
9
|
+
programs: ['qodercli', 'qoder'],
|
|
10
|
+
measured: 'Qoder CLI 1.1.80',
|
|
11
|
+
composer: { text: '^ > ' },
|
|
12
|
+
// The placeholder ("Type your message or @path/to/file") is grey; typed text is not.
|
|
13
|
+
typed: { text: '^ > ', word: { notFg: ['#95958f'] } },
|
|
14
|
+
chrome: [
|
|
15
|
+
{ text: RULE_INDENTED },
|
|
16
|
+
{ text: 'Shift\\+Tab' },
|
|
17
|
+
{ text: '\\? for shortcuts\\s*$' },
|
|
18
|
+
{ text: '\\(esc to cancel' },
|
|
19
|
+
],
|
|
20
|
+
frame: { text: RULE_INDENTED },
|
|
21
|
+
busy: [{ text: '\\(esc to cancel' }],
|
|
22
|
+
turn: { text: '^ > \\S' },
|
|
23
|
+
reasoning: [
|
|
24
|
+
// The bar by its text alone: a code span or a table inside the
|
|
25
|
+
// reasoning is drawn upright, and an upright line is still reasoning.
|
|
26
|
+
{
|
|
27
|
+
start: { text: '^ Thinking\\s*$', lead: { italic: true } },
|
|
28
|
+
continues: { text: '^ │( |$)' },
|
|
29
|
+
},
|
|
30
|
+
// The same bar on its own: the heading may have scrolled away.
|
|
31
|
+
{
|
|
32
|
+
start: { text: '^ │ ' },
|
|
33
|
+
continues: { text: '^ │( |$)' },
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
answer: {
|
|
37
|
+
start: { text: '^ ▪ ', lead: { fg: ['default', '#eeeeeb', '#ffffff', '#000000'] } },
|
|
38
|
+
continues: { text: '^ {3}[^\\s└│]' },
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=reading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reading.js","sourceRoot":"","sources":["../../../src/agents/qoder/reading.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG,gBAAgB,CAAC;AAEvC,MAAM,CAAC,MAAM,OAAO,GAAmB;IACrC,8DAA8D;IAC9D,wEAAwE;IACxE,uEAAuE;IACvE,wEAAwE;IACxE,mDAAmD;IACnD,IAAI,EAAE,OAAO;IACb,QAAQ,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC;IAC/B,QAAQ,EAAE,kBAAkB;IAC5B,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;IAC1B,qFAAqF;IACrF,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE;IACrD,MAAM,EAAE;QACN,EAAE,IAAI,EAAE,aAAa,EAAE;QACvB,EAAE,IAAI,EAAE,aAAa,EAAE;QACvB,EAAE,IAAI,EAAE,wBAAwB,EAAE;QAClC,EAAE,IAAI,EAAE,kBAAkB,EAAE;KAC7B;IACD,KAAK,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE;IAC9B,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC;IACpC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IACzB,SAAS,EAAE;QACT,+DAA+D;QAC/D,sEAAsE;QACtE;YACE,KAAK,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;YAC1D,SAAS,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;SAChC;QACD,+DAA+D;QAC/D;YACE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACvB,SAAS,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;SAChC;KACF;IACD,MAAM,EAAE;QACN,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,EAAE;QACnF,SAAS,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;KACrC;CACF,CAAC"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import type { AgentSignature, CompiledSignature, LineTest } from '../core/reasoning.js';
|
|
2
|
+
import type { DialogSignature } from '../core/dialogs.js';
|
|
3
|
+
import type { DetectedPrompt } from '../core/promptDetector.js';
|
|
4
|
+
import type { CursorPosition } from '../core/types.js';
|
|
5
|
+
import type { CellStyle, StyledLine } from '../core/renderer.js';
|
|
6
|
+
export type ProgramMatch = string;
|
|
7
|
+
export type AgentSource = 'explicit' | 'program' | 'fallback';
|
|
8
|
+
export interface VerifyTiming {
|
|
9
|
+
baseMs: number;
|
|
10
|
+
perCharacterMs: number;
|
|
11
|
+
maxMs: number;
|
|
12
|
+
}
|
|
13
|
+
/** Reserved for a later, explicitly configured safety adapter. */
|
|
14
|
+
export interface SafetyAdapter {
|
|
15
|
+
readonly kind: string;
|
|
16
|
+
}
|
|
17
|
+
export interface PromptLine {
|
|
18
|
+
text: string;
|
|
19
|
+
index: number;
|
|
20
|
+
}
|
|
21
|
+
export interface PromptRows {
|
|
22
|
+
kind: 'rows';
|
|
23
|
+
styledHeading?: RegExp;
|
|
24
|
+
numbered?: RegExp;
|
|
25
|
+
pointer?: RegExp;
|
|
26
|
+
/** A module's input row, which must not seed a pointer chooser. */
|
|
27
|
+
composer?: RegExp;
|
|
28
|
+
footer?: RegExp;
|
|
29
|
+
marker?: RegExp;
|
|
30
|
+
busy?: RegExp;
|
|
31
|
+
keyHint?: RegExp;
|
|
32
|
+
questionPrefix?: RegExp;
|
|
33
|
+
commandStart?: (raw: string[], firstOption: number) => number;
|
|
34
|
+
clackMessage?: (raw: string[], index: number) => string[];
|
|
35
|
+
}
|
|
36
|
+
export type PromptShape = {
|
|
37
|
+
kind: 'dialog';
|
|
38
|
+
signature: DialogSignature;
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'menu';
|
|
41
|
+
order: number;
|
|
42
|
+
detect: (raw: string[], lines: PromptLine[], tail: PromptLine[], busy: (text: string) => boolean, viewportRows?: number, styled?: readonly StyledLine[]) => DetectedPrompt | null;
|
|
43
|
+
} | PromptRows;
|
|
44
|
+
export interface PromptSettler {
|
|
45
|
+
settle(prompt: DetectedPrompt | null, screen: string, now: number, styled?: readonly StyledLine[]): DetectedPrompt | null;
|
|
46
|
+
}
|
|
47
|
+
export interface ReadingContext {
|
|
48
|
+
matches: (line: StyledLine, test: CompiledSignature['composer']) => boolean;
|
|
49
|
+
ink: (line: StyledLine) => CellStyle[];
|
|
50
|
+
ranges: (lines: readonly StyledLine[], signature: CompiledSignature, limit: number) => [number, number][];
|
|
51
|
+
}
|
|
52
|
+
export interface ReadingRules {
|
|
53
|
+
/** Hidden row ranges for a reader that can positively identify only framed output. */
|
|
54
|
+
hiddenRanges?: (lines: readonly StyledLine[], limit: number) => [number, number][];
|
|
55
|
+
/** Earliest possible answer row for a completed turn with a distinct closing frame. */
|
|
56
|
+
answerFloor?: (lines: readonly StyledLine[], limit: number) => number;
|
|
57
|
+
/** Crop only independently framed adjacent UI, before any reading walk. */
|
|
58
|
+
contentRegion?: (lines: readonly StyledLine[]) => readonly StyledLine[];
|
|
59
|
+
/** Rows owned by a live frame, even if its controls were painted on physical wraps. */
|
|
60
|
+
claimPromptRows?: (lines: readonly StyledLine[], prompt: DetectedPrompt | null) => readonly [number, number] | null;
|
|
61
|
+
composer?: (lines: readonly StyledLine[], index: number, signature: CompiledSignature, context: ReadingContext) => boolean;
|
|
62
|
+
busyWithoutComposer?: boolean;
|
|
63
|
+
busy?: (lines: readonly StyledLine[], turnStart: number, chrome: number, signature: CompiledSignature, context: ReadingContext) => boolean;
|
|
64
|
+
pendingComposer?: boolean;
|
|
65
|
+
/** Live answer content, outside tools and quotations; missing turn context is inconclusive. */
|
|
66
|
+
liveContent?: (lines: readonly StyledLine[], turnStart: number, candidate: number, context: ReadingContext) => boolean | 'inconclusive';
|
|
67
|
+
/** Remove a side panel only when the surrounding frame establishes its columns. */
|
|
68
|
+
inputRegion?: (lines: readonly StyledLine[], composer: number) => readonly StyledLine[];
|
|
69
|
+
}
|
|
70
|
+
/** An evidenced error at the end of an idle turn, never a phrase search. */
|
|
71
|
+
export interface StallSignature {
|
|
72
|
+
reason: string;
|
|
73
|
+
/** Fixed product wording. Never supplied by the terminal. */
|
|
74
|
+
description: string;
|
|
75
|
+
/** Complete visible marker row, excluding trailing space, before styled reads. */
|
|
76
|
+
marker: {
|
|
77
|
+
text: string | RegExp;
|
|
78
|
+
fg: string[];
|
|
79
|
+
};
|
|
80
|
+
/** Controls on the completed footer only; group 1 retains its semantic prefix. */
|
|
81
|
+
cosmetic?: RegExp;
|
|
82
|
+
/** Framing shared with the module's answer reader, independent of body text. */
|
|
83
|
+
contentRegion?: ReadingRules['contentRegion'];
|
|
84
|
+
chrome: LineTest[];
|
|
85
|
+
/** Columns whose ink establishes row ownership for cheap invalidation. */
|
|
86
|
+
frameColumns: number[];
|
|
87
|
+
before: LineTest;
|
|
88
|
+
/** Some versions omit the neutral introduction above the coloured error. */
|
|
89
|
+
beforeOptional?: boolean;
|
|
90
|
+
rows: LineTest[];
|
|
91
|
+
/** The general error message may occupy several red-gutter rows. */
|
|
92
|
+
flexibleMessage?: boolean;
|
|
93
|
+
/** A long error can leave only its coloured body visible above the footer. */
|
|
94
|
+
clippedBody?: boolean;
|
|
95
|
+
footer: LineTest;
|
|
96
|
+
composer: LineTest;
|
|
97
|
+
/** Mode row immediately before the closing edge, for partial redraw ownership. */
|
|
98
|
+
composerStatus?: LineTest;
|
|
99
|
+
/** Allowed non-blank rows of the idle composer, including placeholders. */
|
|
100
|
+
idle: LineTest[];
|
|
101
|
+
/** A styled suggestion with the shortcut's opening parenthesis at the inset right edge. */
|
|
102
|
+
idleClipped?: {
|
|
103
|
+
row: LineTest;
|
|
104
|
+
rightInset: number;
|
|
105
|
+
};
|
|
106
|
+
/** Positional rows immediately below the closing edge; later rows are output. */
|
|
107
|
+
bottom: LineTest[];
|
|
108
|
+
/** A live modal banner may interrupt a busy turn without an idle footer. */
|
|
109
|
+
overlay?: {
|
|
110
|
+
message: LineTest;
|
|
111
|
+
background: string;
|
|
112
|
+
centreOffset: number;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* What a module can tell about typing into the composer it already describes.
|
|
117
|
+
* `queue` is a running turn whose composer is visible and empty, for a program
|
|
118
|
+
* that takes a submitted line while it works (queued or handed to the turn).
|
|
119
|
+
*/
|
|
120
|
+
export type NudgeReadiness = 'ready' | 'busy' | 'queue' | 'draft' | 'unknown';
|
|
121
|
+
/**
|
|
122
|
+
* One visible viewport. Plain rows are enough for a recorded transcript.
|
|
123
|
+
* When styled rows are set, their text is that same viewport: the ink tells
|
|
124
|
+
* the recorded placeholder from a draft. A difference is not judged.
|
|
125
|
+
*/
|
|
126
|
+
export interface NudgeView {
|
|
127
|
+
/** Terminal width in cells, when known. */
|
|
128
|
+
viewportCols?: number;
|
|
129
|
+
/** Cursor and optional physical cells from the same viewport as the text. */
|
|
130
|
+
cursor?: CursorPosition;
|
|
131
|
+
untrimmedRow?: (y: number) => StyledLine | undefined;
|
|
132
|
+
rows: readonly string[];
|
|
133
|
+
styled?: readonly StyledLine[];
|
|
134
|
+
/** Exact daemon line allowed in the composer during a delayed submission. */
|
|
135
|
+
expectedDraft?: string;
|
|
136
|
+
/** A scheduled write needs the reason a busy composer blocks this particular run. */
|
|
137
|
+
whenBusy?: 'skip' | 'queue';
|
|
138
|
+
/** Prove a draft for the distinct key that queues it during a running turn. */
|
|
139
|
+
queueDraft?: boolean;
|
|
140
|
+
/** Require a blank composer or the module's exact known placeholder. */
|
|
141
|
+
exactEmpty?: boolean;
|
|
142
|
+
}
|
|
143
|
+
/** Internal harness data and the few detector walks not yet expressed as data. */
|
|
144
|
+
export interface AgentModule {
|
|
145
|
+
name: string;
|
|
146
|
+
programs: ProgramMatch[];
|
|
147
|
+
reading: AgentSignature;
|
|
148
|
+
prompts: PromptShape[];
|
|
149
|
+
/** A recognisable but incomplete menu whose text could fool the shared row heuristics. */
|
|
150
|
+
incompleteMenu?: (rows: readonly string[]) => boolean;
|
|
151
|
+
input?: {
|
|
152
|
+
submit?: {
|
|
153
|
+
key: string;
|
|
154
|
+
delayMs?: number;
|
|
155
|
+
matches?: (data: string) => boolean;
|
|
156
|
+
/** Minimum pause for a pasted line, scaled by its length where measured. */
|
|
157
|
+
perCharacterMs?: number;
|
|
158
|
+
/** Quiet time after the draft is visible, before Enter. */
|
|
159
|
+
quietMs?: number;
|
|
160
|
+
/** Time for the composer to settle after Enter. */
|
|
161
|
+
settleMs?: number;
|
|
162
|
+
/** Extra time after the minimum pause to wait for a painted, quiet draft. */
|
|
163
|
+
maxWaitMs?: number;
|
|
164
|
+
/** A composer replacement: group 1 is the placeholder; named group chars is its length, if shown. */
|
|
165
|
+
pastePlaceholder?: RegExp;
|
|
166
|
+
/** Input for which this module accepts a paste placeholder as proof. */
|
|
167
|
+
pastePlaceholderBody?: RegExp;
|
|
168
|
+
};
|
|
169
|
+
resizeBehindSubmit?: boolean;
|
|
170
|
+
verifyMs?: VerifyTiming;
|
|
171
|
+
};
|
|
172
|
+
readiness?: {
|
|
173
|
+
/** Alternative literal ready signals recorded in agent-profiles.md. */
|
|
174
|
+
readyText?: string[];
|
|
175
|
+
/** A composer whose position matters as well as its text. */
|
|
176
|
+
readyScreen?: (screen: string) => boolean;
|
|
177
|
+
readyQuietMs?: number;
|
|
178
|
+
settleMs?: number;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Whether this program's screen is idle with an empty composer.
|
|
182
|
+
* Absent means the module cannot tell, and the session is never judged ready.
|
|
183
|
+
*/
|
|
184
|
+
nudge?: {
|
|
185
|
+
readiness(view: NudgeView): NudgeReadiness;
|
|
186
|
+
queueKey?: string;
|
|
187
|
+
/** The composer and footer text to compare across paints while a turn runs. */
|
|
188
|
+
composerBlock?: (rows: readonly string[], cursor?: CursorPosition) => string;
|
|
189
|
+
/** A separately framed idle pane whose neighbours can repaint without holding up input. */
|
|
190
|
+
idlePane?: (view: NudgeView) => string | undefined;
|
|
191
|
+
};
|
|
192
|
+
/** Conversation id exported to a child tool by this agent, when available. */
|
|
193
|
+
resumeIdMarkers?: readonly string[];
|
|
194
|
+
env?: {
|
|
195
|
+
sessionMarkers: string[];
|
|
196
|
+
};
|
|
197
|
+
safety?: SafetyAdapter;
|
|
198
|
+
stalls?: StallSignature[];
|
|
199
|
+
matchesProgram?: (pattern: ProgramMatch, program: string) => boolean;
|
|
200
|
+
createPromptSettler?: () => PromptSettler;
|
|
201
|
+
readingRules?: ReadingRules;
|
|
202
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/agents/types.ts"],"names":[],"mappings":""}
|