@botconnector/bccli 0.5.0-rc.4 → 0.5.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/cli.mjs +14 -6
- package/legacy/LICENSE +21 -0
- package/legacy/README.en.md +253 -0
- package/legacy/README.md +250 -0
- package/legacy/dist/abort.d.ts +5 -0
- package/legacy/dist/acp-HWHF25KU.js +221 -0
- package/legacy/dist/acp.d.ts +44 -0
- package/legacy/dist/agent.d.ts +158 -0
- package/legacy/dist/agents.d.ts +4 -0
- package/legacy/dist/args-XA77XUMD.js +13 -0
- package/legacy/dist/args.d.ts +59 -0
- package/legacy/dist/budget.d.ts +26 -0
- package/legacy/dist/checkpoints.d.ts +35 -0
- package/legacy/dist/chunk-2IP5F3EK.js +56 -0
- package/legacy/dist/chunk-5CVHTYBQ.js +270 -0
- package/legacy/dist/chunk-6LO6YRDY.js +216 -0
- package/legacy/dist/chunk-6PJRWKVI.js +50 -0
- package/legacy/dist/chunk-7OTFZK4B.js +159 -0
- package/legacy/dist/chunk-7U7CMKKI.js +861 -0
- package/legacy/dist/chunk-A3NBWIEQ.js +2706 -0
- package/legacy/dist/chunk-FY543EQW.js +50 -0
- package/legacy/dist/chunk-IDZLHEVL.js +524 -0
- package/legacy/dist/chunk-IF5RNXBI.js +341 -0
- package/legacy/dist/chunk-M5T4AM4I.js +256 -0
- package/legacy/dist/chunk-NGFWBVHD.js +71 -0
- package/legacy/dist/chunk-OCEQ2TRJ.js +1075 -0
- package/legacy/dist/chunk-OK2USAXX.js +88 -0
- package/legacy/dist/chunk-PSO7R5AD.js +10 -0
- package/legacy/dist/chunk-RLSQAZBT.js +78 -0
- package/legacy/dist/chunk-VPFCIUC6.js +91 -0
- package/legacy/dist/chunk-XP5MTJN2.js +8 -0
- package/legacy/dist/chunk-YGBTNDPK.js +202 -0
- package/legacy/dist/chunk-YYTFJUO2.js +148 -0
- package/legacy/dist/chunk-ZXWRLN7E.js +378 -0
- package/legacy/dist/cli.d.ts +1 -0
- package/legacy/dist/cli.js +233 -0
- package/legacy/dist/clipboardImage.d.ts +17 -0
- package/legacy/dist/commands.d.ts +16 -0
- package/legacy/dist/completion-IRVEVW6H.js +125 -0
- package/legacy/dist/completion.d.ts +14 -0
- package/legacy/dist/config-OVWCUVY7.js +25 -0
- package/legacy/dist/config-S3CZUIBB.js +34 -0
- package/legacy/dist/config.d.ts +99 -0
- package/legacy/dist/context.d.ts +13 -0
- package/legacy/dist/contextWindow.d.ts +3 -0
- package/legacy/dist/diff.d.ts +7 -0
- package/legacy/dist/exit.d.ts +9 -0
- package/legacy/dist/extensions.d.ts +34 -0
- package/legacy/dist/ghBotCli-FYKJDJOD.js +680 -0
- package/legacy/dist/ghBotCli.d.ts +9 -0
- package/legacy/dist/ghBotDispatch.d.ts +68 -0
- package/legacy/dist/ghBotRunner.d.ts +82 -0
- package/legacy/dist/ghBotServe.d.ts +21 -0
- package/legacy/dist/ghBotWebhook.d.ts +45 -0
- package/legacy/dist/hooks.d.ts +27 -0
- package/legacy/dist/i18n/id.d.ts +1 -0
- package/legacy/dist/i18n.d.ts +16 -0
- package/legacy/dist/integrationCli-GY73S2K7.js +876 -0
- package/legacy/dist/integrationCli.d.ts +9 -0
- package/legacy/dist/keybinds.d.ts +22 -0
- package/legacy/dist/login-KSN63EM4.js +18 -0
- package/legacy/dist/login.d.ts +21 -0
- package/legacy/dist/lsp.d.ts +73 -0
- package/legacy/dist/mcp/catalog.d.ts +14 -0
- package/legacy/dist/mcp/config.d.ts +36 -0
- package/legacy/dist/mcp/manager.d.ts +52 -0
- package/legacy/dist/mcp/oauth.d.ts +82 -0
- package/legacy/dist/mcpCli-VWSCCDWT.js +113 -0
- package/legacy/dist/mcpCli.d.ts +3 -0
- package/legacy/dist/mcpServer/serve.d.ts +8 -0
- package/legacy/dist/mcpServer/server.d.ts +19 -0
- package/legacy/dist/models.d.ts +13 -0
- package/legacy/dist/modelsCli-4Q6KFWV2.js +36 -0
- package/legacy/dist/modelsCli.d.ts +15 -0
- package/legacy/dist/npmRunner-LU43GM3W.js +46 -0
- package/legacy/dist/npmRunner.d.ts +21 -0
- package/legacy/dist/oauthLogin-JWXQZTMZ.js +210 -0
- package/legacy/dist/oauthLogin.d.ts +47 -0
- package/legacy/dist/permissions.d.ts +30 -0
- package/legacy/dist/pluginSpec.d.ts +25 -0
- package/legacy/dist/plugins.d.ts +45 -0
- package/legacy/dist/pluginsCli-7XWDLJEL.js +288 -0
- package/legacy/dist/pluginsCli.d.ts +16 -0
- package/legacy/dist/prCli-FH7N26D4.js +94 -0
- package/legacy/dist/prCli.d.ts +46 -0
- package/legacy/dist/presets.d.ts +8 -0
- package/legacy/dist/print.d.ts +17 -0
- package/legacy/dist/provider.d.ts +145 -0
- package/legacy/dist/providerCli-YMG4G56R.js +15 -0
- package/legacy/dist/providerCli.d.ts +17 -0
- package/legacy/dist/providers.d.ts +6 -0
- package/legacy/dist/reasoning.d.ts +12 -0
- package/legacy/dist/repomap.d.ts +10 -0
- package/legacy/dist/sdk.d.ts +61 -0
- package/legacy/dist/sdk.js +6532 -0
- package/legacy/dist/serve-HSFF6MGB.js +178 -0
- package/legacy/dist/serve-HUQNVOSP.js +532 -0
- package/legacy/dist/serve.d.ts +37 -0
- package/legacy/dist/serveHeartbeat.d.ts +14 -0
- package/legacy/dist/serveProtocol.d.ts +47 -0
- package/legacy/dist/session-YM36TGU7.js +12 -0
- package/legacy/dist/session.d.ts +33 -0
- package/legacy/dist/setup-3YB6EKYX.js +24 -0
- package/legacy/dist/setup.d.ts +79 -0
- package/legacy/dist/slash/copy.d.ts +1 -0
- package/legacy/dist/slash/diff.d.ts +1 -0
- package/legacy/dist/slash/doctor.d.ts +18 -0
- package/legacy/dist/slash/export.d.ts +2 -0
- package/legacy/dist/slash/info.d.ts +46 -0
- package/legacy/dist/slash/memory.d.ts +10 -0
- package/legacy/dist/statsCli-I4TSDU3X.js +353 -0
- package/legacy/dist/statsCli.d.ts +62 -0
- package/legacy/dist/textToolCalls.d.ts +6 -0
- package/legacy/dist/thinking.d.ts +17 -0
- package/legacy/dist/tokenBudget.d.ts +22 -0
- package/legacy/dist/tools/bash.d.ts +54 -0
- package/legacy/dist/tools/diagnostics.d.ts +13 -0
- package/legacy/dist/tools/edit.d.ts +12 -0
- package/legacy/dist/tools/fetch.d.ts +41 -0
- package/legacy/dist/tools/glob.d.ts +5 -0
- package/legacy/dist/tools/globSafety.d.ts +7 -0
- package/legacy/dist/tools/grep.d.ts +25 -0
- package/legacy/dist/tools/ignore.d.ts +2 -0
- package/legacy/dist/tools/index.d.ts +12 -0
- package/legacy/dist/tools/memory.d.ts +13 -0
- package/legacy/dist/tools/paths.d.ts +4 -0
- package/legacy/dist/tools/plan.d.ts +10 -0
- package/legacy/dist/tools/read.d.ts +16 -0
- package/legacy/dist/tools/repomap.d.ts +2 -0
- package/legacy/dist/tools/sandbox.d.ts +15 -0
- package/legacy/dist/tools/shell.d.ts +18 -0
- package/legacy/dist/tools/skill.d.ts +3 -0
- package/legacy/dist/tools/task.d.ts +28 -0
- package/legacy/dist/tools/todo.d.ts +13 -0
- package/legacy/dist/tools/types.d.ts +52 -0
- package/legacy/dist/tools/websearch.d.ts +9 -0
- package/legacy/dist/tools/write.d.ts +5 -0
- package/legacy/dist/transferCli-3B4LMOYI.js +73 -0
- package/legacy/dist/transferCli.d.ts +23 -0
- package/legacy/dist/ui/App.d.ts +7 -0
- package/legacy/dist/ui/DiffView.d.ts +3 -0
- package/legacy/dist/ui/EditableText.d.ts +7 -0
- package/legacy/dist/ui/LinePrompt.d.ts +6 -0
- package/legacy/dist/ui/ListPicker.d.ts +11 -0
- package/legacy/dist/ui/Markdown.d.ts +8 -0
- package/legacy/dist/ui/McpMenu.d.ts +11 -0
- package/legacy/dist/ui/ModelPicker.d.ts +6 -0
- package/legacy/dist/ui/PermissionPrompt.d.ts +5 -0
- package/legacy/dist/ui/PlanApproval.d.ts +5 -0
- package/legacy/dist/ui/PromptInput.d.ts +20 -0
- package/legacy/dist/ui/ProviderMenu.d.ts +10 -0
- package/legacy/dist/ui/Spinner.d.ts +4 -0
- package/legacy/dist/ui/StatusBar.d.ts +14 -0
- package/legacy/dist/ui/TodoList.d.ts +4 -0
- package/legacy/dist/ui/ToolBlock.d.ts +14 -0
- package/legacy/dist/ui/complete.d.ts +8 -0
- package/legacy/dist/ui/index.d.ts +7 -0
- package/legacy/dist/ui/lineEdit.d.ts +42 -0
- package/legacy/dist/ui/liveCap.d.ts +29 -0
- package/legacy/dist/ui/markdownLayout.d.ts +23 -0
- package/legacy/dist/ui/replay.d.ts +4 -0
- package/legacy/dist/ui/stdinFilter.d.ts +18 -0
- package/legacy/dist/ui/table.d.ts +20 -0
- package/legacy/dist/ui/theme.d.ts +5 -0
- package/legacy/dist/ui/thinkingMouse.d.ts +38 -0
- package/legacy/dist/ui/transcript.d.ts +55 -0
- package/legacy/dist/ui/tty.d.ts +11 -0
- package/legacy/dist/ui/vim.d.ts +26 -0
- package/legacy/dist/ui-TAZMRXRI.js +3044 -0
- package/legacy/dist/update-5V425FIK.js +145 -0
- package/legacy/dist/update.d.ts +30 -0
- package/legacy/dist/verify.d.ts +16 -0
- package/legacy/dist/version.d.ts +1 -0
- package/legacy/dist/webBudget.d.ts +25 -0
- package/legacy/dist/worktree.d.ts +12 -0
- package/legacy/package.json +77 -0
- package/legacy-compat.mjs +42 -0
- package/package.json +24 -4
- package/provider-cli.mjs +1 -2
- package/providers.mjs +19 -6
- package/startup-menu.mjs +14 -13
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SubLine } from './transcript';
|
|
2
|
+
export interface ToolBlockProps {
|
|
3
|
+
tool: string;
|
|
4
|
+
target: string;
|
|
5
|
+
output?: string;
|
|
6
|
+
display?: string;
|
|
7
|
+
isError?: boolean;
|
|
8
|
+
done: boolean;
|
|
9
|
+
expanded?: boolean;
|
|
10
|
+
sub?: SubLine[];
|
|
11
|
+
/** Display spec of the "show full output" keybind, so the hint follows a rebound key. */
|
|
12
|
+
moreBind?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function ToolBlock({ tool, target, output, display, isError, done, expanded, sub, moreBind }: ToolBlockProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function listFileSuggestions(value: string, cwd: string, limit?: number): string[];
|
|
2
|
+
export declare function applyFileSuggestion(value: string, pick: string): string;
|
|
3
|
+
export declare function completeFile(value: string, cwd: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* Pre-attaches small non-secret project files referenced via `@path/to/file` in a user prompt,
|
|
6
|
+
* and records them in `readFiles` so the model can inspect or edit them without an extra tool turn.
|
|
7
|
+
*/
|
|
8
|
+
export declare function expandAtFileMentions(prompt: string, cwd: string, readFiles?: Set<string>): string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface LineState {
|
|
2
|
+
value: string;
|
|
3
|
+
cursor: number;
|
|
4
|
+
}
|
|
5
|
+
export interface EditKey {
|
|
6
|
+
leftArrow?: boolean;
|
|
7
|
+
rightArrow?: boolean;
|
|
8
|
+
home?: boolean;
|
|
9
|
+
end?: boolean;
|
|
10
|
+
backspace?: boolean;
|
|
11
|
+
delete?: boolean;
|
|
12
|
+
ctrl?: boolean;
|
|
13
|
+
meta?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function prevBoundary(text: string, pos: number): number;
|
|
16
|
+
export declare function nextBoundary(text: string, pos: number): number;
|
|
17
|
+
/** Start of the word before the cursor: skips spaces, then the word itself. */
|
|
18
|
+
export declare function wordLeft(text: string, pos: number): number;
|
|
19
|
+
/** End of the word after the cursor: skips spaces, then the word itself. */
|
|
20
|
+
export declare function wordRight(text: string, pos: number): number;
|
|
21
|
+
export declare const lineStart: (text: string, pos: number) => number;
|
|
22
|
+
export declare function lineEnd(text: string, pos: number): number;
|
|
23
|
+
export declare const lineCount: (text: string) => number;
|
|
24
|
+
/** Moves to the same column one line up or down; undefined when there is no such line. */
|
|
25
|
+
export declare function moveLine(text: string, pos: number, direction: -1 | 1): number | undefined;
|
|
26
|
+
export declare const atEnd: (s: LineState) => boolean;
|
|
27
|
+
export declare function insert(s: LineState, text: string): LineState;
|
|
28
|
+
/**
|
|
29
|
+
* The result of an editing key, or undefined when the key is not one of them (Enter, Esc, Tab and the arrows that
|
|
30
|
+
* walk through history belong to the caller). Printable text goes through `insert`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function applyEditKey(s: LineState, input: string, key: EditKey): LineState | undefined;
|
|
33
|
+
/** What to draw: the text before the cursor, the character under it (a space at the end or on a line break), the rest. */
|
|
34
|
+
export declare function splitAtCursor(s: LineState): {
|
|
35
|
+
before: string;
|
|
36
|
+
at: string;
|
|
37
|
+
after: string;
|
|
38
|
+
};
|
|
39
|
+
/** The characters of a text as the user sees them. */
|
|
40
|
+
export declare const graphemes: (text: string) => string[];
|
|
41
|
+
/** The same cursor over a hidden text (an API key): one dot per character. */
|
|
42
|
+
export declare function masked(s: LineState): LineState;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits a frame budget between the live entries, newest first, so the entry being streamed is never the one dropped.
|
|
3
|
+
* A per-entry cap is not enough: an open thinking block and a streaming answer each fitting the budget still add up
|
|
4
|
+
* to a frame twice as tall as the terminal, and Ink rewrites (and duplicates) such a frame on every render.
|
|
5
|
+
*/
|
|
6
|
+
export declare function liveRowCaps(wanted: number[], budget: number): number[];
|
|
7
|
+
/**
|
|
8
|
+
* Plain-text twin of `capLiveMarkdown`: keeps the tail that fits `maxRows` terminal rows and announces the rest.
|
|
9
|
+
* Used for thinking and tool output, which are drawn as plain wrapped text rather than markdown.
|
|
10
|
+
*/
|
|
11
|
+
export declare function capLiveText(raw: string, options: {
|
|
12
|
+
isRealTty: boolean;
|
|
13
|
+
maxRows: number;
|
|
14
|
+
width: number;
|
|
15
|
+
}): string;
|
|
16
|
+
/**
|
|
17
|
+
* Live assistant text is drawn inside the Ink frame, so on a real terminal it is capped to the rows left after the
|
|
18
|
+
* prompt and status bar; the hidden part is announced instead of silently dropped. Piped stdout has no rows to
|
|
19
|
+
* respect (`bccli | tee log`, CI harnesses), so the text is kept whole there.
|
|
20
|
+
*
|
|
21
|
+
* The budget is in terminal rows, not source lines: a 40-line answer at 100 columns is 120 rows, and an Ink frame
|
|
22
|
+
* taller than the terminal makes every render rewrite the whole screen, which stamps duplicate copies of the same
|
|
23
|
+
* block into the scrollback.
|
|
24
|
+
*/
|
|
25
|
+
export declare function capLiveMarkdown(raw: string, options: {
|
|
26
|
+
isRealTty: boolean;
|
|
27
|
+
maxRows: number;
|
|
28
|
+
width: number;
|
|
29
|
+
}): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The line shapes `Markdown` draws. They live here so the renderer and the row counter below share one parse order:
|
|
3
|
+
* a drift between the two is what makes a live frame taller than the terminal believes.
|
|
4
|
+
*/
|
|
5
|
+
export declare const HEADING: RegExp;
|
|
6
|
+
export declare const RULE: RegExp;
|
|
7
|
+
export declare const QUOTE: RegExp;
|
|
8
|
+
export declare const BULLET: RegExp;
|
|
9
|
+
export declare const NUMBERED: RegExp;
|
|
10
|
+
export declare const BULLETS: string[];
|
|
11
|
+
/** Marker width for a list item indented by `spaces`, matching `bulletFor` in Markdown.tsx. */
|
|
12
|
+
export declare const bulletFor: (spaces: number) => string;
|
|
13
|
+
/** Text rows a single unwrapped line occupies at `width` columns; Ink wraps on spaces, so this is the safe bound. */
|
|
14
|
+
export declare function wrappedRows(text: string, width: number): number;
|
|
15
|
+
/**
|
|
16
|
+
* Rows `Markdown` will draw for `text` at `width`. It mirrors the render loop in Markdown.tsx line for line —
|
|
17
|
+
* `markdownLayout.test.ts` renders real markdown and compares, so the two cannot drift unnoticed.
|
|
18
|
+
*
|
|
19
|
+
* A live assistant message has to be sized in the rows it really occupies, not in the lines its source has: at
|
|
20
|
+
* 100 columns a single paragraph is three rows, and a live frame that is taller than the terminal makes Ink rewrite
|
|
21
|
+
* the whole screen on every render, which stamps copies of the same answer into the scrollback.
|
|
22
|
+
*/
|
|
23
|
+
export declare function markdownRowCount(text: string, width: number): number;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ChatMessage } from '../provider';
|
|
2
|
+
import { type Entry } from './transcript';
|
|
3
|
+
/** The screen rows for a resumed conversation: a notice, then every user and assistant text message in order. */
|
|
4
|
+
export declare function replayEntries(history: ChatMessage[]): Entry[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminals without SGR support answer mouse tracking (`\x1b[?1000h`, which bccli only turns on while the Thinking
|
|
3
|
+
* block is clickable) with legacy X10 reports: `ESC [ M` followed by three raw bytes. Ink 8 drops the `ESC [ M`
|
|
4
|
+
* prefix but passes those three bytes to `useInput` as if typed, so they land in the prompt as punctuation.
|
|
5
|
+
* Remove the whole report here, where the prefix is still visible.
|
|
6
|
+
*
|
|
7
|
+
* `carry` is the tail of a report split across chunks; feed it back as the second argument on the next chunk.
|
|
8
|
+
*/
|
|
9
|
+
export declare function stripLegacyMouseReports(chunk: string, carry?: string): {
|
|
10
|
+
text: string;
|
|
11
|
+
carry: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Ink owns the input stream, so a report can only be kept out of `useInput` if it never reaches Ink's reader.
|
|
15
|
+
* Ink 8 reads stdin with `read()`, so the filter wraps that single method: everything that is not an X10 report is
|
|
16
|
+
* forwarded byte for byte and every other stream property (raw mode, TTY flags, event handlers) stays the real one.
|
|
17
|
+
*/
|
|
18
|
+
export declare function installLegacyMouseFilter(source: NodeJS.ReadStream): () => void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type Style = 'plain' | 'bold' | 'italic' | 'strike' | 'link' | 'code' | 'dim';
|
|
2
|
+
export interface Seg {
|
|
3
|
+
text: string;
|
|
4
|
+
style: Style;
|
|
5
|
+
}
|
|
6
|
+
export type Align = 'left' | 'center' | 'right';
|
|
7
|
+
export interface TableData {
|
|
8
|
+
header: Seg[][];
|
|
9
|
+
align: Align[];
|
|
10
|
+
rows: Seg[][][];
|
|
11
|
+
}
|
|
12
|
+
export declare function charWidth(cp: number): number;
|
|
13
|
+
export declare function displayWidth(text: string): number;
|
|
14
|
+
export declare function parseInline(text: string): Seg[];
|
|
15
|
+
/** A table starting at lines[start] (header row, separator row, body rows), or undefined. `end` is the next line to read. */
|
|
16
|
+
export declare function parseTable(lines: string[], start: number): {
|
|
17
|
+
table: TableData;
|
|
18
|
+
end: number;
|
|
19
|
+
} | undefined;
|
|
20
|
+
export declare function layoutTable(table: TableData, width: number): Seg[][];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const THEMES: readonly ['default', 'blue', 'amber', 'magenta', 'mono'];
|
|
2
|
+
export declare function setTheme(name: string): void;
|
|
3
|
+
export declare function currentTheme(): string;
|
|
4
|
+
export declare function color(name: string): string | undefined;
|
|
5
|
+
export declare const ACCENT = "green";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** SGR terminal mouse position (1-based), used only for the live Thinking status. */
|
|
2
|
+
export interface MousePress {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function parseMousePress(value: string): MousePress | undefined;
|
|
7
|
+
export declare function parseCursorPosition(value: string): {
|
|
8
|
+
row: number;
|
|
9
|
+
col: number;
|
|
10
|
+
} | undefined;
|
|
11
|
+
/** Ink returns local element positions, not viewport coordinates. The cursor rests after the live frame. */
|
|
12
|
+
export declare function clickedThinking(click: MousePress, cursorRow: number, rootHeight: number, target: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
}): boolean;
|
|
18
|
+
/** Detect raw SGR wheel packets in a raw stdin data chunk (before ESC is stripped), used to suspend mouse capture. */
|
|
19
|
+
export declare function hasMouseWheelSequence(chunk: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Sequence fragments Ink 8 does not recognise (mouse, cursor reports) are dropped when complete, but an incomplete
|
|
22
|
+
* escape is flushed as literal input after ~20 ms. That fragment must never be typed into a prompt or filter.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isControlReportFragment(input: string): boolean;
|
|
25
|
+
/** Tokenize split/coalesced Windows ConPTY SGR presses and cursor reports. */
|
|
26
|
+
export declare function parseThinkingReports(value: string): {
|
|
27
|
+
events: Array<{
|
|
28
|
+
type: 'mouse';
|
|
29
|
+
press: MousePress;
|
|
30
|
+
} | {
|
|
31
|
+
type: 'cursor';
|
|
32
|
+
cursor: {
|
|
33
|
+
row: number;
|
|
34
|
+
col: number;
|
|
35
|
+
};
|
|
36
|
+
}>;
|
|
37
|
+
rest: string;
|
|
38
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { AgentEvent } from '../agent';
|
|
2
|
+
export interface SubLine {
|
|
3
|
+
id: string;
|
|
4
|
+
tool: string;
|
|
5
|
+
target: string;
|
|
6
|
+
done: boolean;
|
|
7
|
+
isError?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type Entry = {
|
|
10
|
+
id: number;
|
|
11
|
+
} & ({
|
|
12
|
+
kind: 'header';
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'user';
|
|
15
|
+
text: string;
|
|
16
|
+
}
|
|
17
|
+
/** cont: continuation of the entry above (no bullet); flushed: chars of this completion already moved to scrollback. */
|
|
18
|
+
| {
|
|
19
|
+
kind: 'assistant';
|
|
20
|
+
text: string;
|
|
21
|
+
cont?: boolean;
|
|
22
|
+
flushed?: number;
|
|
23
|
+
}
|
|
24
|
+
/** open: fixed state for a reprint; otherwise follows the ctrl+t toggle. */
|
|
25
|
+
| {
|
|
26
|
+
kind: 'thinking';
|
|
27
|
+
text: string;
|
|
28
|
+
open?: boolean;
|
|
29
|
+
} | {
|
|
30
|
+
kind: 'tool';
|
|
31
|
+
callId: string;
|
|
32
|
+
tool: string;
|
|
33
|
+
target: string;
|
|
34
|
+
output?: string;
|
|
35
|
+
display?: string;
|
|
36
|
+
isError?: boolean;
|
|
37
|
+
done: boolean;
|
|
38
|
+
sub?: SubLine[];
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'notice';
|
|
41
|
+
text: string;
|
|
42
|
+
tone: 'info' | 'warn' | 'error';
|
|
43
|
+
});
|
|
44
|
+
/** done = printed once to scrollback (Ink <Static>); live = still changing, redrawn every frame. */
|
|
45
|
+
export interface Transcript {
|
|
46
|
+
done: Entry[];
|
|
47
|
+
live: Entry[];
|
|
48
|
+
}
|
|
49
|
+
type EntryInput = Entry extends infer E ? (E extends {
|
|
50
|
+
id: number;
|
|
51
|
+
} ? Omit<E, 'id'> : never) : never;
|
|
52
|
+
export declare const entry: (e: EntryInput) => Entry;
|
|
53
|
+
export declare function endTurn(t: Transcript): Transcript;
|
|
54
|
+
export declare function applyEvent(t: Transcript, event: AgentEvent): Transcript;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** True when the stream reports itself as a TTY (fake test streams may still report `true`). */
|
|
2
|
+
export declare function isTtyStream(stream: unknown): boolean;
|
|
3
|
+
/** True only for a real terminal: a TTY that also exposes a file descriptor. */
|
|
4
|
+
export declare function isRealTty(stream: unknown): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Terminal width at render time. Reading it instead of listening to `resize` keeps the app to the single resize
|
|
7
|
+
* listener Ink already owns (it re-renders the tree on resize), instead of one listener per rendered message.
|
|
8
|
+
*/
|
|
9
|
+
export declare function streamColumns(stream: unknown): number;
|
|
10
|
+
/** Terminal height at render time; same reasoning as `streamColumns`. */
|
|
11
|
+
export declare function streamRows(stream: unknown): number;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type LineState } from './lineEdit';
|
|
2
|
+
export type VimMode = 'normal' | 'insert';
|
|
3
|
+
/** The subset of ink's key flags applyVim looks at (EditKey is too narrow for Esc/Enter/arrows). */
|
|
4
|
+
export interface VimKey {
|
|
5
|
+
escape?: boolean;
|
|
6
|
+
upArrow?: boolean;
|
|
7
|
+
downArrow?: boolean;
|
|
8
|
+
leftArrow?: boolean;
|
|
9
|
+
rightArrow?: boolean;
|
|
10
|
+
ctrl?: boolean;
|
|
11
|
+
meta?: boolean;
|
|
12
|
+
tab?: boolean;
|
|
13
|
+
return?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface VimResult {
|
|
16
|
+
state: LineState;
|
|
17
|
+
mode: VimMode;
|
|
18
|
+
/** Set by "d" or "c" so the next key picks the text object (dd, dw, cc, cw). */
|
|
19
|
+
pending?: string;
|
|
20
|
+
handled: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Vim key handling for the prompt. Returns handled=false for keys the host input loop
|
|
24
|
+
* should process itself (insert-mode typing, arrows, ctrl/meta combos, Enter).
|
|
25
|
+
*/
|
|
26
|
+
export declare function applyVim(s: LineState, mode: VimMode, input: string, key: VimKey, pending?: string): VimResult;
|