gaunt-sloth 2.0.0-alpha.2 → 2.0.0-alpha.21
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 +55 -5
- package/cli.js +43 -10
- package/dist/cli.js +33 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/adkEvalRunner.d.ts +66 -0
- package/dist/commands/adkEvalRunner.js +69 -0
- package/dist/commands/adkEvalRunner.js.map +1 -0
- package/dist/commands/agUiEvalRunner.d.ts +73 -0
- package/dist/commands/agUiEvalRunner.js +216 -0
- package/dist/commands/agUiEvalRunner.js.map +1 -0
- package/dist/commands/askCommand.d.ts +3 -2
- package/dist/commands/askCommand.js +26 -7
- package/dist/commands/askCommand.js.map +1 -1
- package/dist/commands/batchCommand.d.ts +78 -0
- package/dist/commands/batchCommand.js +245 -0
- package/dist/commands/batchCommand.js.map +1 -0
- package/dist/commands/cliOptionParsers.d.ts +12 -0
- package/dist/commands/cliOptionParsers.js +18 -0
- package/dist/commands/cliOptionParsers.js.map +1 -0
- package/dist/commands/commandIntrospection.d.ts +6 -6
- package/dist/commands/commandIntrospection.js +12 -12
- package/dist/commands/commandIntrospection.js.map +1 -1
- package/dist/commands/commandUtils.d.ts +16 -16
- package/dist/commands/commandUtils.js +20 -20
- package/dist/commands/commandUtils.js.map +1 -1
- package/dist/commands/configCommand.d.ts +24 -0
- package/dist/commands/configCommand.js +117 -0
- package/dist/commands/configCommand.js.map +1 -0
- package/dist/commands/configSetup.d.ts +1 -1
- package/dist/commands/configSetup.js +17 -2
- package/dist/commands/configSetup.js.map +1 -1
- package/dist/commands/evalCommand.d.ts +41 -0
- package/dist/commands/evalCommand.js +483 -0
- package/dist/commands/evalCommand.js.map +1 -0
- package/dist/commands/execCommand.js +4 -1
- package/dist/commands/execCommand.js.map +1 -1
- package/dist/commands/firstRunDialog.d.ts +39 -5
- package/dist/commands/firstRunDialog.js +72 -10
- package/dist/commands/firstRunDialog.js.map +1 -1
- package/dist/commands/getCommand.js +7 -7
- package/dist/commands/getCommand.js.map +1 -1
- package/dist/commands/historyCommand.d.ts +17 -0
- package/dist/commands/historyCommand.js +102 -0
- package/dist/commands/historyCommand.js.map +1 -0
- package/dist/commands/initCommand.d.ts +3 -0
- package/dist/commands/initCommand.js +9 -4
- package/dist/commands/initCommand.js.map +1 -1
- package/dist/commands/insightsCommand.d.ts +8 -0
- package/dist/commands/insightsCommand.js +32 -0
- package/dist/commands/insightsCommand.js.map +1 -0
- package/dist/commands/modelsCommand.d.ts +25 -0
- package/dist/commands/modelsCommand.js +96 -0
- package/dist/commands/modelsCommand.js.map +1 -0
- package/dist/commands/prCommand.js +14 -15
- package/dist/commands/prCommand.js.map +1 -1
- package/dist/commands/prDiscovery.d.ts +2 -2
- package/dist/commands/prDiscovery.js +27 -29
- package/dist/commands/prDiscovery.js.map +1 -1
- package/dist/commands/reviewCommand.js +15 -10
- package/dist/commands/reviewCommand.js.map +1 -1
- package/dist/commands/workflowCommand.d.ts +19 -0
- package/dist/commands/workflowCommand.js +77 -0
- package/dist/commands/workflowCommand.js.map +1 -0
- package/dist/helpers/jira/jiraLogWork.js.map +1 -1
- package/dist/modules/startSession.js +9 -7
- package/dist/modules/startSession.js.map +1 -1
- package/dist/tools/gthJiraLogWorkTool.js +3 -3
- package/dist/tools/gthJiraLogWorkTool.js.map +1 -1
- package/dist/tui/components/App.js +321 -21
- package/dist/tui/components/App.js.map +1 -1
- package/dist/tui/components/ApprovalPrompt.d.ts +18 -0
- package/dist/tui/components/ApprovalPrompt.js +26 -0
- package/dist/tui/components/ApprovalPrompt.js.map +1 -0
- package/dist/tui/components/DebugPanel.d.ts +29 -9
- package/dist/tui/components/DebugPanel.js +46 -23
- package/dist/tui/components/DebugPanel.js.map +1 -1
- package/dist/tui/components/FetchProgress.d.ts +36 -0
- package/dist/tui/components/FetchProgress.js +39 -0
- package/dist/tui/components/FetchProgress.js.map +1 -0
- package/dist/tui/components/LiveTurn.d.ts +26 -4
- package/dist/tui/components/LiveTurn.js +104 -18
- package/dist/tui/components/LiveTurn.js.map +1 -1
- package/dist/tui/components/NoticeBar.d.ts +32 -0
- package/dist/tui/components/NoticeBar.js +39 -0
- package/dist/tui/components/NoticeBar.js.map +1 -0
- package/dist/tui/components/PromptInput.d.ts +26 -1
- package/dist/tui/components/PromptInput.js +93 -7
- package/dist/tui/components/PromptInput.js.map +1 -1
- package/dist/tui/components/Rule.js.map +1 -1
- package/dist/tui/components/SelectList.d.ts +98 -9
- package/dist/tui/components/SelectList.js +209 -26
- package/dist/tui/components/SelectList.js.map +1 -1
- package/dist/tui/components/SlashCommandMenu.d.ts +20 -0
- package/dist/tui/components/SlashCommandMenu.js +28 -0
- package/dist/tui/components/SlashCommandMenu.js.map +1 -0
- package/dist/tui/components/StatusBar.d.ts +7 -1
- package/dist/tui/components/StatusBar.js +7 -3
- package/dist/tui/components/StatusBar.js.map +1 -1
- package/dist/tui/components/Transcript.js +6 -1
- package/dist/tui/components/Transcript.js.map +1 -1
- package/dist/tui/debugRender.d.ts +41 -6
- package/dist/tui/debugRender.js +126 -12
- package/dist/tui/debugRender.js.map +1 -1
- package/dist/tui/debugSearch.d.ts +40 -0
- package/dist/tui/debugSearch.js +73 -0
- package/dist/tui/debugSearch.js.map +1 -0
- package/dist/tui/markdown.js +0 -0
- package/dist/tui/markdown.js.map +1 -1
- package/dist/tui/pasteParser.d.ts +21 -0
- package/dist/tui/pasteParser.js +24 -0
- package/dist/tui/pasteParser.js.map +1 -0
- package/dist/tui/selectCancelled.d.ts +13 -0
- package/dist/tui/selectCancelled.js +17 -0
- package/dist/tui/selectCancelled.js.map +1 -0
- package/dist/tui/slashCommands.d.ts +220 -1
- package/dist/tui/slashCommands.js +408 -1
- package/dist/tui/slashCommands.js.map +1 -1
- package/dist/tui/tuiSessionModule.js +249 -24
- package/dist/tui/tuiSessionModule.js.map +1 -1
- package/dist/tui/types.d.ts +96 -7
- package/dist/tui/viewModel.d.ts +34 -0
- package/dist/tui/viewModel.js +67 -0
- package/dist/tui/viewModel.js.map +1 -1
- package/dist/utils/stdinPolicy.d.ts +31 -0
- package/dist/utils/stdinPolicy.js +37 -0
- package/dist/utils/stdinPolicy.js.map +1 -0
- package/package.json +21 -17
|
@@ -7,9 +7,13 @@ import Spinner from 'ink-spinner';
|
|
|
7
7
|
* and a turn counter — on a single dim line. Streaming progress itself is shown by the live
|
|
8
8
|
* turn, not here, so this bar stays stable (one line) and does not flicker.
|
|
9
9
|
*/
|
|
10
|
-
export function StatusBar({ running, mode, modelDisplayName, turnCount, debugHint, }) {
|
|
10
|
+
export function StatusBar({ running, mode, modelDisplayName, turnCount, debugHint, autoApprove, }) {
|
|
11
|
+
// A single, always-visible badge so the user can never lose track of the fact that shell
|
|
12
|
+
// commands are auto-approved (rendered next to the spinner while running, in the status line
|
|
13
|
+
// when idle). Kept terse so it fits the one-line status bar.
|
|
14
|
+
const autoApproveBadge = autoApprove ? (_jsx(Text, { color: "yellow", bold: true, children: ' ⚡ auto-approve ON' })) : null;
|
|
11
15
|
if (running) {
|
|
12
|
-
return (
|
|
16
|
+
return (_jsxs(Box, { children: [_jsxs(Text, { color: "yellow", children: [_jsx(Spinner, { type: "dots" }), " Thinking\u2026 (Esc to interrupt)"] }), autoApproveBadge] }));
|
|
13
17
|
}
|
|
14
18
|
const segments = [
|
|
15
19
|
mode,
|
|
@@ -17,6 +21,6 @@ export function StatusBar({ running, mode, modelDisplayName, turnCount, debugHin
|
|
|
17
21
|
`turns: ${turnCount ?? 0}`,
|
|
18
22
|
'ready',
|
|
19
23
|
].filter(Boolean);
|
|
20
|
-
return (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: segments.join(' · ') }), debugHint ? _jsx(Text, { dimColor: true, children: ' · Tab: focus debug panel' }) : null] }));
|
|
24
|
+
return (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: segments.join(' · ') }), autoApproveBadge, debugHint ? _jsx(Text, { dimColor: true, children: ' · Tab: focus debug panel' }) : null] }));
|
|
21
25
|
}
|
|
22
26
|
//# sourceMappingURL=StatusBar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBar.js","sourceRoot":"","sources":["../../../src/tui/components/StatusBar.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,EACxB,OAAO,EACP,IAAI,EACJ,gBAAgB,EAChB,SAAS,EACT,SAAS,
|
|
1
|
+
{"version":3,"file":"StatusBar.js","sourceRoot":"","sources":["../../../src/tui/components/StatusBar.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,EACxB,OAAO,EACP,IAAI,EACJ,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,WAAW,GAcZ;IACC,yFAAyF;IACzF,6FAA6F;IAC7F,6DAA6D;IAC7D,MAAM,gBAAgB,GAAG,WAAW,CAAC,CAAC,CAAC,CACrC,KAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,kBACtB,oBAAoB,GAChB,CACR,CAAC,CAAC,CAAC,IAAI,CAAC;IAET,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CACL,MAAC,GAAG,eACF,MAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,aAClB,KAAC,OAAO,IAAC,IAAI,EAAC,MAAM,GAAG,0CAClB,EACN,gBAAgB,IACb,CACP,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG;QACf,IAAI;QACJ,gBAAgB,CAAC,CAAC,CAAC,UAAU,gBAAgB,EAAE,CAAC,CAAC,CAAC,IAAI;QACtD,UAAU,SAAS,IAAI,CAAC,EAAE;QAC1B,OAAO;KACR,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAElB,OAAO,CACL,MAAC,GAAG,eACF,KAAC,IAAI,IAAC,QAAQ,kBAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,GAAQ,EAC7C,gBAAgB,EAChB,SAAS,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,QAAQ,kBAAE,6BAA6B,GAAQ,CAAC,CAAC,CAAC,IAAI,IACrE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Static, Text } from 'ink';
|
|
3
|
-
import { LiveTurn } from '#src/tui/components/LiveTurn.js';
|
|
3
|
+
import { LiveTurn, ReasoningPanel } from '#src/tui/components/LiveTurn.js';
|
|
4
4
|
import { Rule } from '#src/tui/components/Rule.js';
|
|
5
5
|
import { CommandNotice } from '#src/tui/components/CommandNotice.js';
|
|
6
6
|
/**
|
|
@@ -32,6 +32,11 @@ function renderItem(item, toolsExpanded) {
|
|
|
32
32
|
case 'notice':
|
|
33
33
|
// Structured command feedback (TUI-C14): a noticeable title + explanatory body lines.
|
|
34
34
|
return _jsx(CommandNotice, { title: item.title, lines: item.lines, tone: item.tone });
|
|
35
|
+
case 'reasoning':
|
|
36
|
+
// TUI-C18 — `/reasoning` reprint: a dim Rule brackets it like a notice, then the shared
|
|
37
|
+
// TUI-C15 ReasoningPanel (expanded, non-live) reuses the 💭/gutter styling, tagged with the
|
|
38
|
+
// turn it was recalled from so the block is self-describing.
|
|
39
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Rule, {}), _jsx(ReasoningPanel, { reasoning: item.reasoning, expanded: true, live: false, label: `Thinking · turn ${item.turnNumber} (recalled)` })] }));
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
//# sourceMappingURL=Transcript.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transcript.js","sourceRoot":"","sources":["../../../src/tui/components/Transcript.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"Transcript.js","sourceRoot":"","sources":["../../../src/tui/components/Transcript.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,KAAK,EACL,aAAa,GAAG,KAAK,GAKtB;IACC,uFAAuF;IACvF,mCAAmC;IACnC,MAAM,cAAc,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;IAEjE,OAAO,CACL,KAAC,MAAM,IAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,YACzD,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;YACnB,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,KAAK,cAAc,CAAC;YACnE,OAAO,CACL,MAAC,GAAG,IAAe,aAAa,EAAC,QAAQ,aACtC,SAAS,CAAC,CAAC,CAAC,KAAC,IAAI,KAAG,CAAC,CAAC,CAAC,IAAI,EAC3B,UAAU,CAAC,IAAI,EAAE,aAAa,CAAC,KAFxB,IAAI,CAAC,EA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|
import type { DebugRequestExtras } from '@gaunt-sloth/agent/core/debugCapture.js';
|
|
3
|
+
import type { GthConfig } from '@gaunt-sloth/core/config.js';
|
|
4
|
+
import type { AgentResolvers, McpServerInstruction, McpConnectionFailure } from '@gaunt-sloth/core/core/types.js';
|
|
3
5
|
/**
|
|
4
6
|
* Pure renderers turning the deep agent's debug captures into the JSON strings the `/debug`
|
|
5
7
|
* panel shows. Kept React-free so they are unit-testable in isolation; the panel just splits
|
|
@@ -19,10 +21,43 @@ export declare function renderHistory(messages: BaseMessage[]): string;
|
|
|
19
21
|
*/
|
|
20
22
|
export declare function renderResponse(response: unknown): string;
|
|
21
23
|
/**
|
|
22
|
-
* Render "
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* Render the "System prompt" tab (TUI-C16): the non-message, non-tool parts that also shape a
|
|
25
|
+
* turn — the scalar model params, the tool-choice config and the system prompt itself. The tool
|
|
26
|
+
* catalogue lives on its own tab (see {@link renderToolDetails}) so the system prompt stands
|
|
27
|
+
* alone. These come pre-filtered (key-free) from the capture site; this renderer only formats
|
|
28
|
+
* them readably. Each part degrades to a note rather than throwing, so the `/debug` panel never
|
|
29
|
+
* blanks on an odd payload. Long content that TUI-C4's maximise makes usable.
|
|
27
30
|
*/
|
|
28
|
-
export declare function
|
|
31
|
+
export declare function renderSystemDetails(extras: DebugRequestExtras | undefined): string;
|
|
32
|
+
/**
|
|
33
|
+
* Render the "Tools" tab (TUI-C16 (3)): the tool catalogue the model may call this turn. Leads
|
|
34
|
+
* with a compact list of tool NAMES as an at-a-glance overview of what the model can call, then
|
|
35
|
+
* the full per-tool descriptors (description + JSON-schema params) below. Split out of the system
|
|
36
|
+
* view so you no longer scroll past the whole system prompt to reach the tools.
|
|
37
|
+
*/
|
|
38
|
+
export declare function renderToolDetails(extras: DebugRequestExtras | undefined): string;
|
|
39
|
+
/**
|
|
40
|
+
* TUI-C20: gather the session-stable inputs the MCP debug tab needs — the configured MCP server
|
|
41
|
+
* list and each server's captured discovery instructions. Instructions come from EXT-32's
|
|
42
|
+
* {@link AgentResolvers.getMcpServerInstructions} accessor (captured once during tool resolution and
|
|
43
|
+
* reused here, NOT re-queried), so the tab shows exactly the same instruction text the system prompt
|
|
44
|
+
* was composed with. React-free + defensive (missing config / accessor → empty) so it is unit
|
|
45
|
+
* testable and can never blank or crash the panel. The per-server tool grouping is left to
|
|
46
|
+
* {@link renderMcpDetails}, which reads the live per-request tool catalogue.
|
|
47
|
+
*/
|
|
48
|
+
export declare function collectMcpOverview(config: Pick<GthConfig, 'mcpServers'> | undefined, resolvers: Pick<AgentResolvers, 'getMcpServerInstructions' | 'getMcpConnectionFailures'> | undefined): {
|
|
49
|
+
servers: string[];
|
|
50
|
+
instructions: McpServerInstruction[];
|
|
51
|
+
failures: McpConnectionFailure[];
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Render the "MCP" tab (TUI-C20): a per-server overview of the connected MCP servers. Under each
|
|
55
|
+
* server it shows (a) its discovery `instructions` (from EXT-32's captured accessor, threaded in via
|
|
56
|
+
* `instructions`; a server that supplied none gets a neutral line, never an empty block) and (b) its
|
|
57
|
+
* contributed tools by their server-prefixed name (`mcp__<server>__<tool>`) with a one-line
|
|
58
|
+
* description. Tool SCHEMAS are deliberately NOT rendered here — the intro points at the Tools tab
|
|
59
|
+
* for those. `servers` is the full configured server list; `extras.tools` is the live per-turn tool
|
|
60
|
+
* catalogue, regrouped by the shared {@link MCP_TOOL_NAME_PREFIX} prefix so the grouping can't drift
|
|
61
|
+
* from how the resolver named them. No servers → a neutral empty state (never a throw).
|
|
62
|
+
*/
|
|
63
|
+
export declare function renderMcpDetails(extras: DebugRequestExtras | undefined, servers: string[], instructions: McpServerInstruction[], failures?: McpConnectionFailure[]): string;
|
package/dist/tui/debugRender.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { mapChatMessagesToStoredMessages } from '@langchain/core/messages';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
import { MCP_TOOL_NAME_PREFIX } from '@gaunt-sloth/core/constants.js';
|
|
3
4
|
/**
|
|
4
5
|
* Pure renderers turning the deep agent's debug captures into the JSON strings the `/debug`
|
|
5
6
|
* panel shows. Kept React-free so they are unit-testable in isolation; the panel just splits
|
|
@@ -14,12 +15,14 @@ import { z } from 'zod';
|
|
|
14
15
|
export function renderHistory(messages) {
|
|
15
16
|
try {
|
|
16
17
|
const stored = mapChatMessagesToStoredMessages(messages);
|
|
17
|
-
return JSON.stringify(stored, null, 2);
|
|
18
|
+
return withDescription(HISTORY_TAB_DESCRIPTION, JSON.stringify(stored, null, 2));
|
|
18
19
|
}
|
|
19
20
|
catch (err) {
|
|
20
21
|
return `(could not render history: ${err instanceof Error ? err.message : String(err)})`;
|
|
21
22
|
}
|
|
22
23
|
}
|
|
24
|
+
const HISTORY_TAB_DESCRIPTION = 'The message list sent to the model at call time, each message as a JSON-stable record. The ' +
|
|
25
|
+
'system prompt is shown separately on the System prompt tab.';
|
|
23
26
|
/**
|
|
24
27
|
* Render "Raw model response": the resolved `AIMessage` returned by the handler. We try the
|
|
25
28
|
* stored-message form first (consistent with the history view); if the value is not a chat
|
|
@@ -37,13 +40,27 @@ export function renderResponse(response) {
|
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
42
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* readably. Each part degrades to a note rather than throwing, so the `/debug` panel never
|
|
44
|
-
* blanks on an odd payload. This is the long content TUI-C4's maximise makes usable.
|
|
43
|
+
* TUI-C16 (2): a short, plain-language note leading each "Sent to model" tab — what this slice of
|
|
44
|
+
* the request is and why it shapes the turn. It is set off from the content by a rule but scrolls
|
|
45
|
+
* WITH it (not a fixed header), so it costs no permanent screen estate.
|
|
45
46
|
*/
|
|
46
|
-
|
|
47
|
+
function withDescription(description, body) {
|
|
48
|
+
return `${description}\n${'─'.repeat(8)}\n\n${body}`;
|
|
49
|
+
}
|
|
50
|
+
const SYSTEM_TAB_DESCRIPTION = 'System prompt and params. The standing instructions and scalar settings that frame every ' +
|
|
51
|
+
'turn: model params, the tool-choice policy, then the system prompt itself. Sent once per ' +
|
|
52
|
+
'call, ahead of the conversation.';
|
|
53
|
+
const TOOLS_TAB_DESCRIPTION = 'Tools the model may call this turn. Names first, for an at-a-glance overview; then each ' +
|
|
54
|
+
"tool's full description and parameter schema below.";
|
|
55
|
+
/**
|
|
56
|
+
* Render the "System prompt" tab (TUI-C16): the non-message, non-tool parts that also shape a
|
|
57
|
+
* turn — the scalar model params, the tool-choice config and the system prompt itself. The tool
|
|
58
|
+
* catalogue lives on its own tab (see {@link renderToolDetails}) so the system prompt stands
|
|
59
|
+
* alone. These come pre-filtered (key-free) from the capture site; this renderer only formats
|
|
60
|
+
* them readably. Each part degrades to a note rather than throwing, so the `/debug` panel never
|
|
61
|
+
* blanks on an odd payload. Long content that TUI-C4's maximise makes usable.
|
|
62
|
+
*/
|
|
63
|
+
export function renderSystemDetails(extras) {
|
|
47
64
|
if (!extras)
|
|
48
65
|
return '(no request details captured yet)';
|
|
49
66
|
const sections = [];
|
|
@@ -57,16 +74,113 @@ export function renderRequestDetails(extras) {
|
|
|
57
74
|
sections.push('');
|
|
58
75
|
sections.push('=== SYSTEM PROMPT ===');
|
|
59
76
|
sections.push(extras.systemPrompt ? extras.systemPrompt : '(no system prompt captured)');
|
|
60
|
-
sections.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
77
|
+
return withDescription(SYSTEM_TAB_DESCRIPTION, sections.join('\n'));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Render the "Tools" tab (TUI-C16 (3)): the tool catalogue the model may call this turn. Leads
|
|
81
|
+
* with a compact list of tool NAMES as an at-a-glance overview of what the model can call, then
|
|
82
|
+
* the full per-tool descriptors (description + JSON-schema params) below. Split out of the system
|
|
83
|
+
* view so you no longer scroll past the whole system prompt to reach the tools.
|
|
84
|
+
*/
|
|
85
|
+
export function renderToolDetails(extras) {
|
|
86
|
+
if (!extras)
|
|
87
|
+
return '(no request details captured yet)';
|
|
88
|
+
const tools = extras.tools ?? [];
|
|
89
|
+
const sections = [];
|
|
90
|
+
sections.push(`=== TOOLS (${tools.length}) ===`);
|
|
91
|
+
if (tools.length > 0) {
|
|
92
|
+
// (3) at-a-glance name list first …
|
|
93
|
+
for (const tool of tools)
|
|
94
|
+
sections.push(`• ${tool.name}`);
|
|
95
|
+
// … then the full descriptors below.
|
|
96
|
+
sections.push('');
|
|
97
|
+
sections.push('=== TOOL DEFINITIONS ===');
|
|
98
|
+
for (const tool of tools) {
|
|
99
|
+
sections.push('');
|
|
64
100
|
sections.push(renderToolDef(tool));
|
|
101
|
+
}
|
|
65
102
|
}
|
|
66
103
|
else {
|
|
67
104
|
sections.push('(no tools captured)');
|
|
68
105
|
}
|
|
69
|
-
return sections.join('\n');
|
|
106
|
+
return withDescription(TOOLS_TAB_DESCRIPTION, sections.join('\n'));
|
|
107
|
+
}
|
|
108
|
+
const MCP_TAB_DESCRIPTION = 'MCP server overview. For each connected MCP server: its discovery instructions and the tools it ' +
|
|
109
|
+
'contributes (shown with the same server-prefixed names the model calls). This is the overview, ' +
|
|
110
|
+
"not the schemas. For a tool's full description and parameter schema, see the Tools tab.";
|
|
111
|
+
/**
|
|
112
|
+
* TUI-C20: gather the session-stable inputs the MCP debug tab needs — the configured MCP server
|
|
113
|
+
* list and each server's captured discovery instructions. Instructions come from EXT-32's
|
|
114
|
+
* {@link AgentResolvers.getMcpServerInstructions} accessor (captured once during tool resolution and
|
|
115
|
+
* reused here, NOT re-queried), so the tab shows exactly the same instruction text the system prompt
|
|
116
|
+
* was composed with. React-free + defensive (missing config / accessor → empty) so it is unit
|
|
117
|
+
* testable and can never blank or crash the panel. The per-server tool grouping is left to
|
|
118
|
+
* {@link renderMcpDetails}, which reads the live per-request tool catalogue.
|
|
119
|
+
*/
|
|
120
|
+
export function collectMcpOverview(config, resolvers) {
|
|
121
|
+
const servers = Object.keys(config?.mcpServers ?? {});
|
|
122
|
+
const instructions = resolvers?.getMcpServerInstructions?.() ?? [];
|
|
123
|
+
const failures = resolvers?.getMcpConnectionFailures?.() ?? [];
|
|
124
|
+
return { servers, instructions, failures };
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Render the "MCP" tab (TUI-C20): a per-server overview of the connected MCP servers. Under each
|
|
128
|
+
* server it shows (a) its discovery `instructions` (from EXT-32's captured accessor, threaded in via
|
|
129
|
+
* `instructions`; a server that supplied none gets a neutral line, never an empty block) and (b) its
|
|
130
|
+
* contributed tools by their server-prefixed name (`mcp__<server>__<tool>`) with a one-line
|
|
131
|
+
* description. Tool SCHEMAS are deliberately NOT rendered here — the intro points at the Tools tab
|
|
132
|
+
* for those. `servers` is the full configured server list; `extras.tools` is the live per-turn tool
|
|
133
|
+
* catalogue, regrouped by the shared {@link MCP_TOOL_NAME_PREFIX} prefix so the grouping can't drift
|
|
134
|
+
* from how the resolver named them. No servers → a neutral empty state (never a throw).
|
|
135
|
+
*/
|
|
136
|
+
export function renderMcpDetails(extras, servers, instructions, failures = []) {
|
|
137
|
+
const sections = [];
|
|
138
|
+
sections.push(`=== MCP SERVERS (${servers.length}) ===`);
|
|
139
|
+
if (servers.length === 0) {
|
|
140
|
+
sections.push('(no MCP servers configured)');
|
|
141
|
+
return withDescription(MCP_TAB_DESCRIPTION, sections.join('\n'));
|
|
142
|
+
}
|
|
143
|
+
const instructionByServer = new Map(instructions.map((i) => [i.server, i.instructions]));
|
|
144
|
+
const failureByServer = new Map(failures.map((f) => [f.server, f.reason]));
|
|
145
|
+
const tools = extras?.tools ?? [];
|
|
146
|
+
for (const server of servers) {
|
|
147
|
+
sections.push('');
|
|
148
|
+
sections.push(`── ${server} ──`);
|
|
149
|
+
// A server that failed to connect contributes no tools — say so, with the reason, instead of
|
|
150
|
+
// leaving a bare "(no tools loaded)" line that reads as "connected, but empty". Shown first so
|
|
151
|
+
// the failure is the headline for this server; instructions/tools are naturally empty below.
|
|
152
|
+
const failureReason = failureByServer.get(server);
|
|
153
|
+
if (failureReason) {
|
|
154
|
+
sections.push(` ⚠ connection failed: ${failureReason}`);
|
|
155
|
+
}
|
|
156
|
+
// (a) discovery instructions — the SAME text EXT-32 injected into the system prompt.
|
|
157
|
+
const serverInstructions = instructionByServer.get(server);
|
|
158
|
+
sections.push('instructions:');
|
|
159
|
+
if (serverInstructions) {
|
|
160
|
+
for (const line of serverInstructions.split('\n'))
|
|
161
|
+
sections.push(` ${line}`);
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
sections.push(' (no instructions provided)');
|
|
165
|
+
}
|
|
166
|
+
// (b) the server's tools by their server-prefixed name + a one-line description.
|
|
167
|
+
const prefix = `${MCP_TOOL_NAME_PREFIX}__${server}__`;
|
|
168
|
+
const serverTools = tools.filter((t) => t.name.startsWith(prefix));
|
|
169
|
+
sections.push(`tools (${serverTools.length}):`);
|
|
170
|
+
if (serverTools.length > 0) {
|
|
171
|
+
for (const tool of serverTools) {
|
|
172
|
+
const oneLine = tool.description ? tool.description.split('\n')[0].trim() : '';
|
|
173
|
+
sections.push(oneLine ? ` • ${tool.name}: ${oneLine}` : ` • ${tool.name}`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
else if (failureReason) {
|
|
177
|
+
sections.push(' (none — server unavailable, see above)');
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
sections.push(' (no tools loaded for this server)');
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return withDescription(MCP_TAB_DESCRIPTION, sections.join('\n'));
|
|
70
184
|
}
|
|
71
185
|
/** Format one tool definition: name, description, then its JSON-schema params. */
|
|
72
186
|
function renderToolDef(tool) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugRender.js","sourceRoot":"","sources":["../../src/tui/debugRender.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAC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incremental-search model for the docked `/debug` pane (TUI-C21).
|
|
3
|
+
*
|
|
4
|
+
* The search operates over the ACTIVE tab's rendered line model — the same `string[]` that
|
|
5
|
+
* `debugPanelLines()` produces and that TUI-C11's viewport/scroll math already windows — so it
|
|
6
|
+
* applies to every tab uniformly with ONE implementation (not a per-tab search) and can reuse the
|
|
7
|
+
* existing scroll offset to jump the viewport to a match. Everything here is pure and
|
|
8
|
+
* side-effect-free so it is unit-testable without rendering Ink; `<App>` owns the state and the
|
|
9
|
+
* `<DebugPanel>` consumes the highlight segments.
|
|
10
|
+
*/
|
|
11
|
+
/** A run of a line, tagged whether it is part of a search match (for highlight rendering). */
|
|
12
|
+
export interface HighlightSegment {
|
|
13
|
+
text: string;
|
|
14
|
+
match: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Indices of the lines that contain `query`, case-insensitively. An empty query matches nothing
|
|
18
|
+
* (so highlights and the count clear the moment the query is emptied). Matching is a plain
|
|
19
|
+
* substring test — no regex, no smart-case (YAGNI, and it keeps the `less` idiom predictable).
|
|
20
|
+
*/
|
|
21
|
+
export declare function findMatches(lines: string[], query: string): number[];
|
|
22
|
+
/**
|
|
23
|
+
* Step the current-match cursor with wrap-around. `current` and the return value are indices INTO
|
|
24
|
+
* the `matches` array (0..n-1), not line indices; `dir` is +1 (next, `n`) or -1 (previous, `N`).
|
|
25
|
+
* Past the last match wraps to the first and vice-versa. Returns -1 when there are no matches.
|
|
26
|
+
*/
|
|
27
|
+
export declare function stepMatch(matches: number[], current: number, dir: number): number;
|
|
28
|
+
/**
|
|
29
|
+
* The scroll offset (top visible line) that brings `lineIndex` into view, clamped to the real
|
|
30
|
+
* maximum exactly as TUI-C11's `clampDebugScroll` does — so jumping to a match can never push the
|
|
31
|
+
* viewport past the end. The matched line is placed at the top of the window (or as close as the
|
|
32
|
+
* clamp allows for matches near the end of the content).
|
|
33
|
+
*/
|
|
34
|
+
export declare function scrollOffsetForLine(lineIndex: number, viewportHeight: number, lineCount: number): number;
|
|
35
|
+
/**
|
|
36
|
+
* Split `line` into alternating non-match / match runs for highlight rendering. Handles multiple
|
|
37
|
+
* occurrences on one line; an empty query yields a single non-match segment (the whole line).
|
|
38
|
+
* Case-insensitive, so the returned `text` preserves the ORIGINAL casing of the line.
|
|
39
|
+
*/
|
|
40
|
+
export declare function highlightSegments(line: string, query: string): HighlightSegment[];
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure `less`-style incremental-search model for the docked `/debug` pane (TUI-C21).
|
|
3
|
+
*
|
|
4
|
+
* The search operates over the ACTIVE tab's rendered line model — the same `string[]` that
|
|
5
|
+
* `debugPanelLines()` produces and that TUI-C11's viewport/scroll math already windows — so it
|
|
6
|
+
* applies to every tab uniformly with ONE implementation (not a per-tab search) and can reuse the
|
|
7
|
+
* existing scroll offset to jump the viewport to a match. Everything here is pure and
|
|
8
|
+
* side-effect-free so it is unit-testable without rendering Ink; `<App>` owns the state and the
|
|
9
|
+
* `<DebugPanel>` consumes the highlight segments.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Indices of the lines that contain `query`, case-insensitively. An empty query matches nothing
|
|
13
|
+
* (so highlights and the count clear the moment the query is emptied). Matching is a plain
|
|
14
|
+
* substring test — no regex, no smart-case (YAGNI, and it keeps the `less` idiom predictable).
|
|
15
|
+
*/
|
|
16
|
+
export function findMatches(lines, query) {
|
|
17
|
+
if (query.length === 0)
|
|
18
|
+
return [];
|
|
19
|
+
const needle = query.toLowerCase();
|
|
20
|
+
const out = [];
|
|
21
|
+
for (let i = 0; i < lines.length; i++) {
|
|
22
|
+
if (lines[i].toLowerCase().includes(needle))
|
|
23
|
+
out.push(i);
|
|
24
|
+
}
|
|
25
|
+
return out;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Step the current-match cursor with wrap-around. `current` and the return value are indices INTO
|
|
29
|
+
* the `matches` array (0..n-1), not line indices; `dir` is +1 (next, `n`) or -1 (previous, `N`).
|
|
30
|
+
* Past the last match wraps to the first and vice-versa. Returns -1 when there are no matches.
|
|
31
|
+
*/
|
|
32
|
+
export function stepMatch(matches, current, dir) {
|
|
33
|
+
const n = matches.length;
|
|
34
|
+
if (n === 0)
|
|
35
|
+
return -1;
|
|
36
|
+
return (((current + dir) % n) + n) % n;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The scroll offset (top visible line) that brings `lineIndex` into view, clamped to the real
|
|
40
|
+
* maximum exactly as TUI-C11's `clampDebugScroll` does — so jumping to a match can never push the
|
|
41
|
+
* viewport past the end. The matched line is placed at the top of the window (or as close as the
|
|
42
|
+
* clamp allows for matches near the end of the content).
|
|
43
|
+
*/
|
|
44
|
+
export function scrollOffsetForLine(lineIndex, viewportHeight, lineCount) {
|
|
45
|
+
const maxOffset = Math.max(0, lineCount - viewportHeight);
|
|
46
|
+
return Math.min(Math.max(0, lineIndex), maxOffset);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Split `line` into alternating non-match / match runs for highlight rendering. Handles multiple
|
|
50
|
+
* occurrences on one line; an empty query yields a single non-match segment (the whole line).
|
|
51
|
+
* Case-insensitive, so the returned `text` preserves the ORIGINAL casing of the line.
|
|
52
|
+
*/
|
|
53
|
+
export function highlightSegments(line, query) {
|
|
54
|
+
if (query.length === 0)
|
|
55
|
+
return [{ text: line, match: false }];
|
|
56
|
+
const needle = query.toLowerCase();
|
|
57
|
+
const hay = line.toLowerCase();
|
|
58
|
+
const segs = [];
|
|
59
|
+
let i = 0;
|
|
60
|
+
while (i < line.length) {
|
|
61
|
+
const idx = hay.indexOf(needle, i);
|
|
62
|
+
if (idx === -1) {
|
|
63
|
+
segs.push({ text: line.slice(i), match: false });
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
if (idx > i)
|
|
67
|
+
segs.push({ text: line.slice(i, idx), match: false });
|
|
68
|
+
segs.push({ text: line.slice(idx, idx + query.length), match: true });
|
|
69
|
+
i = idx + query.length;
|
|
70
|
+
}
|
|
71
|
+
return segs;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=debugSearch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debugSearch.js","sourceRoot":"","sources":["../../src/tui/debugSearch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,KAAe,EAAE,KAAa;IACxD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IACnC,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,OAAiB,EAAE,OAAe,EAAE,GAAW;IACvE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IACzB,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC,CAAC;IACvB,OAAO,CAAC,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,SAAiB,EACjB,cAAsB,EACtB,SAAiB;IAEjB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,GAAG,cAAc,CAAC,CAAC;IAC1D,OAAO,IAAI,CAAC,GAAG,CAAC,I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,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAC1C,GAAG,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACzE,SAAS;QACX,CAAC;QAED,gDAAgD;QAChD,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TUI-C24 — pure, React-free helper for pasted text.
|
|
3
|
+
*
|
|
4
|
+
* A terminal in **bracketed paste mode** (`\x1b[?2004h`) wraps pasted content between `\x1b[200~`
|
|
5
|
+
* and `\x1b[201~`, so a multi-line paste is distinguishable from typed keystrokes (its embedded
|
|
6
|
+
* newlines are NOT Enter presses and must not submit the prompt). Ink 7.1.0 already tokenizes that
|
|
7
|
+
* protocol internally and delivers the payload via its `usePaste` hook, which is what the TUI wires
|
|
8
|
+
* up in production (see `PromptInput.tsx`) — so the live tokenizing is Ink's job, not ours.
|
|
9
|
+
*
|
|
10
|
+
* What remains ours is normalizing the payload's line breaks, which is genuinely on the runtime
|
|
11
|
+
* path: the `usePaste` handler runs every pasted payload through {@link normalizePastedText} before
|
|
12
|
+
* inserting it into the buffer. Kept free of any Ink/React dependency so it stays unit-testable by
|
|
13
|
+
* feeding strings and asserting the result.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Collapse `\r\n` (CRLF) and standalone `\r` (CR) to `\n` so pasted line breaks match how the rest
|
|
17
|
+
* of the buffer stores them. Terminals variously deliver pasted newlines as `\r`, `\r\n`, or `\n`;
|
|
18
|
+
* normalizing to `\n` is what stops a multi-line paste from either jamming onto one line or
|
|
19
|
+
* splitting inconsistently. Idempotent and safe on single-line text (returns it unchanged).
|
|
20
|
+
*/
|
|
21
|
+
export declare function normalizePastedText(text: string): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TUI-C24 — pure, React-free helper for pasted text.
|
|
3
|
+
*
|
|
4
|
+
* A terminal in **bracketed paste mode** (`\x1b[?2004h`) wraps pasted content between `\x1b[200~`
|
|
5
|
+
* and `\x1b[201~`, so a multi-line paste is distinguishable from typed keystrokes (its embedded
|
|
6
|
+
* newlines are NOT Enter presses and must not submit the prompt). Ink 7.1.0 already tokenizes that
|
|
7
|
+
* protocol internally and delivers the payload via its `usePaste` hook, which is what the TUI wires
|
|
8
|
+
* up in production (see `PromptInput.tsx`) — so the live tokenizing is Ink's job, not ours.
|
|
9
|
+
*
|
|
10
|
+
* What remains ours is normalizing the payload's line breaks, which is genuinely on the runtime
|
|
11
|
+
* path: the `usePaste` handler runs every pasted payload through {@link normalizePastedText} before
|
|
12
|
+
* inserting it into the buffer. Kept free of any Ink/React dependency so it stays unit-testable by
|
|
13
|
+
* feeding strings and asserting the result.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Collapse `\r\n` (CRLF) and standalone `\r` (CR) to `\n` so pasted line breaks match how the rest
|
|
17
|
+
* of the buffer stores them. Terminals variously deliver pasted newlines as `\r`, `\r\n`, or `\n`;
|
|
18
|
+
* normalizing to `\n` is what stops a multi-line paste from either jamming onto one line or
|
|
19
|
+
* splitting inconsistently. Idempotent and safe on single-line text (returns it unchanged).
|
|
20
|
+
*/
|
|
21
|
+
export function normalizePastedText(text) {
|
|
22
|
+
return text.replace(/\r\n?/g, '\n');
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=pasteParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pasteParser.js","sourceRoot":"","sources":["../../src/tui/pasteParser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CFG-20 — the abort signal shared by the {@link SelectFn} seam.
|
|
3
|
+
*
|
|
4
|
+
* The Ink `runInkSelect` host rejects its promise with this error when the user aborts a
|
|
5
|
+
* selection (Ctrl+C at any time, or Esc with an empty filter), and `runFirstRunDialog`
|
|
6
|
+
* catches it once around the whole flow to abort cleanly — no config written, no false
|
|
7
|
+
* "Configured …" success line. Kept in its OWN tiny, Ink-free module (not in
|
|
8
|
+
* `SelectList.tsx`, which statically imports `ink`) so the dialog can `import` the class
|
|
9
|
+
* for a shared `instanceof` identity without pulling React/Ink into a readline-only run.
|
|
10
|
+
*/
|
|
11
|
+
export declare class SelectCancelledError extends Error {
|
|
12
|
+
constructor(message?: string);
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CFG-20 — the abort signal shared by the {@link SelectFn} seam.
|
|
3
|
+
*
|
|
4
|
+
* The Ink `runInkSelect` host rejects its promise with this error when the user aborts a
|
|
5
|
+
* selection (Ctrl+C at any time, or Esc with an empty filter), and `runFirstRunDialog`
|
|
6
|
+
* catches it once around the whole flow to abort cleanly — no config written, no false
|
|
7
|
+
* "Configured …" success line. Kept in its OWN tiny, Ink-free module (not in
|
|
8
|
+
* `SelectList.tsx`, which statically imports `ink`) so the dialog can `import` the class
|
|
9
|
+
* for a shared `instanceof` identity without pulling React/Ink into a readline-only run.
|
|
10
|
+
*/
|
|
11
|
+
export class SelectCancelledError extends Error {
|
|
12
|
+
constructor(message = 'Selection cancelled') {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = 'SelectCancelledError';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=selectCancelled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectCancelled.js","sourceRoot":"","sources":["../../src/tui/selectCancelled.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAO,GAAG,qBAAqB;QACzC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF"}
|