strands-darwin 0.0.45 → 0.0.47
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 +4 -2
- package/README.zh-CN.md +4 -2
- package/dist/src/agent/permission.js +19 -2
- package/dist/src/agent/permission.js.map +1 -1
- package/dist/src/agent/runtime.d.ts +35 -1
- package/dist/src/agent/runtime.js +52 -3
- package/dist/src/agent/runtime.js.map +1 -1
- package/dist/src/cli-completion.d.ts +13 -0
- package/dist/src/cli-completion.js +161 -0
- package/dist/src/cli-completion.js.map +1 -0
- package/dist/src/cli-usage.d.ts +1 -1
- package/dist/src/cli-usage.js +1 -0
- package/dist/src/cli-usage.js.map +1 -1
- package/dist/src/cli.js +5 -1
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/custom-commands.d.ts +7 -0
- package/dist/src/commands/custom-commands.js +20 -0
- package/dist/src/commands/custom-commands.js.map +1 -1
- package/dist/src/dev-repl.js +4 -1
- package/dist/src/dev-repl.js.map +1 -1
- package/dist/src/headless-protocol.d.ts +1 -1
- package/dist/src/headless-protocol.js +5 -0
- package/dist/src/headless-protocol.js.map +1 -1
- package/dist/src/headless-runner.js +5 -0
- package/dist/src/headless-runner.js.map +1 -1
- package/dist/src/headless.js +5 -0
- package/dist/src/headless.js.map +1 -1
- package/dist/src/mcp/prompts.d.ts +179 -0
- package/dist/src/mcp/prompts.js +349 -0
- package/dist/src/mcp/prompts.js.map +1 -0
- package/dist/src/mcp/registry.d.ts +8 -1
- package/dist/src/mcp/registry.js +3 -1
- package/dist/src/mcp/registry.js.map +1 -1
- package/dist/src/tui/App.js +187 -12
- package/dist/src/tui/App.js.map +1 -1
- package/dist/src/tui/InputBox.d.ts +7 -1
- package/dist/src/tui/InputBox.js +5 -3
- package/dist/src/tui/InputBox.js.map +1 -1
- package/dist/src/tui/external-editor.d.ts +143 -0
- package/dist/src/tui/external-editor.js +482 -0
- package/dist/src/tui/external-editor.js.map +1 -0
- package/dist/src/tui/help-format.js +2 -2
- package/dist/src/tui/help-format.js.map +1 -1
- package/dist/src/tui/mcp-format.d.ts +2 -0
- package/dist/src/tui/mcp-format.js +23 -1
- package/dist/src/tui/mcp-format.js.map +1 -1
- package/dist/src/tui/prompt-editor.d.ts +6 -0
- package/dist/src/tui/prompt-editor.js +10 -0
- package/dist/src/tui/prompt-editor.js.map +1 -1
- package/package.json +1 -1
|
@@ -38,7 +38,7 @@ export interface CompletionWindow {
|
|
|
38
38
|
export declare function completionWindow(total: number, selected: number, capacity: number): CompletionWindow;
|
|
39
39
|
/** One counted row truthfully states every candidate outside the visible window. */
|
|
40
40
|
export declare function hiddenCompletionNotice(hiddenAbove: number, hiddenBelow: number): string;
|
|
41
|
-
export declare function InputBox({ layout, completions, completionKind, completionNote, selectedCompletion, editable, hint, attachment, recallIndicator, historySearch, rewindSearch, offset, maxRows, }: {
|
|
41
|
+
export declare function InputBox({ layout, completions, completionKind, completionNote, commandDescriptions, selectedCompletion, editable, hint, attachment, recallIndicator, historySearch, rewindSearch, offset, maxRows, }: {
|
|
42
42
|
readonly layout: EditorLayout;
|
|
43
43
|
readonly completions: readonly string[];
|
|
44
44
|
readonly completionKind: CompletionKind;
|
|
@@ -48,6 +48,12 @@ export declare function InputBox({ layout, completions, completionKind, completi
|
|
|
48
48
|
* never given one of its own (the frame budget counts rows, not intentions).
|
|
49
49
|
*/
|
|
50
50
|
readonly completionNote: string | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Descriptions for command rows that are not built-ins — the MCP prompt commands
|
|
53
|
+
* (SER-114): bounded server metadata plus the argument hint, drawn through the
|
|
54
|
+
* same control-escaping projection as every other completion row.
|
|
55
|
+
*/
|
|
56
|
+
readonly commandDescriptions?: ReadonlyMap<string, string>;
|
|
51
57
|
readonly selectedCompletion: number;
|
|
52
58
|
readonly editable: boolean;
|
|
53
59
|
readonly hint: string | undefined;
|
package/dist/src/tui/InputBox.js
CHANGED
|
@@ -61,7 +61,7 @@ function hiddenSearchNotice(hiddenAbove, hiddenBelow) {
|
|
|
61
61
|
parts.push(`${hiddenBelow} older`);
|
|
62
62
|
return `… ${hiddenAbove + hiddenBelow} matches not shown (${parts.join(', ')})`;
|
|
63
63
|
}
|
|
64
|
-
export function InputBox({ layout, completions, completionKind, completionNote, selectedCompletion, editable, hint, attachment, recallIndicator, historySearch, rewindSearch, offset, maxRows, }) {
|
|
64
|
+
export function InputBox({ layout, completions, completionKind, completionNote, commandDescriptions, selectedCompletion, editable, hint, attachment, recallIndicator, historySearch, rewindSearch, offset, maxRows, }) {
|
|
65
65
|
const activeSearch = rewindSearch ?? historySearch;
|
|
66
66
|
const offered = Math.min(completions.length, MAX_COMPLETIONS);
|
|
67
67
|
const plan = planPromptBox({
|
|
@@ -109,8 +109,10 @@ export function InputBox({ layout, completions, completionKind, completionNote,
|
|
|
109
109
|
const selected = menu.start + index === menu.selected;
|
|
110
110
|
// Only commands carry one: a path describes itself, and inventing a
|
|
111
111
|
// description would mean reading the file, which this feature never does.
|
|
112
|
-
const description = completionKind === 'command'
|
|
113
|
-
|
|
112
|
+
const description = completionKind === 'command'
|
|
113
|
+
? builtinCommandDescription(name) ?? commandDescriptions?.get(name)
|
|
114
|
+
: undefined;
|
|
115
|
+
return (_jsxs(Box, { children: [_jsxs(Text, { ...(selected ? { color: visualColor.active } : {}), bold: selected, dimColor: !selected, wrap: "truncate-end", children: [selected ? `${visualMarker.completion} ` : ' ', completionKind === 'command' ? '/' : '', searchPreview(name)] }), description !== undefined && (_jsxs(Text, { dimColor: true, wrap: "truncate-end", children: [' ', "\u2014 ", searchPreview(description)] }))] }, name));
|
|
114
116
|
}), plan.completionMore && (_jsxs(Text, { dimColor: true, wrap: "truncate-end", children: [' ', hiddenCompletionNotice(menu.hiddenAbove, menu.hiddenBelow)] }))] })), hint !== undefined && plan.hint && (_jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, wrap: "truncate-end", children: hint }) }))] }));
|
|
115
117
|
}
|
|
116
118
|
/**
|
|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,CAAC,IAC7B,CACR,KAlBO,IAAI,CAmBR,CACP,CAAC;oBACJ,CAAC,CAAC,EACD,IAAI,CAAC,cAAc,IAAI,CACtB,MAAC,IAAI,IAAC,QAAQ,QAAC,IAAI,EAAC,cAAc,aAC/B,IAAI,EAAE,sBAAsB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,IAC5D,CACR,IACG,CACP,EAEA,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,IAAI,CAClC,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,KAAC,IAAI,IAAC,QAAQ,QAAC,IAAI,EAAC,cAAc,YAAE,IAAI,GAAQ,GAC5C,CACP,IACG,CACP,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,IAAoB,EAAE,IAAwB;IAC5E,MAAM,IAAI,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC;IACvD,MAAM,IAAI,GAAG,gCAAgC,CAAC;IAC9C,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,IAAI,OAAO,IAAI,GAAG,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/** Draft and result cap in Unicode code points — the composer stash/yank cap. */
|
|
2
|
+
export declare const EXTERNAL_EDITOR_MAX_CODE_POINTS = 65536;
|
|
3
|
+
/** Draft and result cap in UTF-8 bytes (256 KiB). */
|
|
4
|
+
export declare const EXTERNAL_EDITOR_MAX_BYTES = 262144;
|
|
5
|
+
/** Longest `VISUAL`/`EDITOR` value parsed, in code points. */
|
|
6
|
+
export declare const EDITOR_COMMAND_MAX_CODE_POINTS = 1024;
|
|
7
|
+
/** Most argv entries (executable included) one editor command may yield. */
|
|
8
|
+
export declare const EDITOR_COMMAND_MAX_ARGS = 32;
|
|
9
|
+
/** Grace between the editor's SIGTERM and SIGKILL on darwin shutdown. */
|
|
10
|
+
export declare const EDITOR_KILL_GRACE_MS = 2000;
|
|
11
|
+
/** How long darwin keeps holding SIGINT/SIGQUIT listeners after the editor exits. */
|
|
12
|
+
export declare const TERMINAL_SIGNAL_GRACE_MS = 500;
|
|
13
|
+
/** Temporary directory prefix under the OS temp root; the file inside is fixed. */
|
|
14
|
+
export declare const EDITOR_TEMP_PREFIX = "darwin-editor-";
|
|
15
|
+
export declare const EDITOR_TEMP_FILE = "prompt.md";
|
|
16
|
+
/** The guidance when neither variable is set: no editor is ever guessed. */
|
|
17
|
+
export declare const EXTERNAL_EDITOR_UNSET_NOTICE: string;
|
|
18
|
+
/** Variables consulted, in precedence order. */
|
|
19
|
+
export declare const EDITOR_VARIABLES: readonly ['VISUAL', 'EDITOR'];
|
|
20
|
+
export type EditorVariable = (typeof EDITOR_VARIABLES)[number];
|
|
21
|
+
export type EditorCommand = {
|
|
22
|
+
readonly kind: 'command';
|
|
23
|
+
readonly source: EditorVariable;
|
|
24
|
+
readonly argv: readonly string[];
|
|
25
|
+
} | {
|
|
26
|
+
readonly kind: 'refused';
|
|
27
|
+
readonly source: EditorVariable;
|
|
28
|
+
readonly reason: string;
|
|
29
|
+
} | {
|
|
30
|
+
readonly kind: 'unset';
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* `VISUAL` first, then `EDITOR`; an unset or blank variable falls through. A set but
|
|
34
|
+
* unparseable value is refused rather than skipped: silently trying the other
|
|
35
|
+
* variable would run an editor the user did not choose.
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolveEditorCommand(env: NodeJS.ProcessEnv): EditorCommand;
|
|
38
|
+
/**
|
|
39
|
+
* POSIX-style word splitting without a shell: spaces/tabs separate words, single
|
|
40
|
+
* quotes are literal, double quotes allow `\"`/`\\`, an unquoted backslash escapes
|
|
41
|
+
* the next character. Shell syntax, control characters, unterminated quotes and
|
|
42
|
+
* over-cap values are refused with a reason that never echoes the value.
|
|
43
|
+
*/
|
|
44
|
+
export declare function parseEditorCommand(value: string): {
|
|
45
|
+
readonly ok: true;
|
|
46
|
+
readonly argv: readonly string[];
|
|
47
|
+
} | {
|
|
48
|
+
readonly ok: false;
|
|
49
|
+
readonly reason: string;
|
|
50
|
+
};
|
|
51
|
+
/** A bounded executable label for notices: basename only, never the arguments. */
|
|
52
|
+
export declare function editorLabel(argv: readonly string[]): string;
|
|
53
|
+
/** Composer-state facts the Ctrl+G eligibility check reads; all live App state. */
|
|
54
|
+
export interface ExternalEditorContext {
|
|
55
|
+
/** An editor is already running (the repeated chord): ignored, no second launch. */
|
|
56
|
+
readonly editorActive: boolean;
|
|
57
|
+
readonly idle: boolean;
|
|
58
|
+
/** The queue, the shared `draining` latch, `/clear` assembly or an owed goal action. */
|
|
59
|
+
readonly queued: number;
|
|
60
|
+
readonly draining: boolean;
|
|
61
|
+
readonly clearing: boolean;
|
|
62
|
+
readonly goalOwed: boolean;
|
|
63
|
+
readonly peerPending: number;
|
|
64
|
+
/** Live SDK background delegations: each settles into a wake that claims a turn. */
|
|
65
|
+
readonly liveDelegations: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Why Ctrl+G may not open the editor now: `'ignore'` for the repeated chord, a
|
|
69
|
+
* notice for a state that owns or is about to claim the session, `undefined` when
|
|
70
|
+
* eligible. Permission prompts, compaction and the two search modes never reach this
|
|
71
|
+
* — they own the key earlier in the input chain.
|
|
72
|
+
*/
|
|
73
|
+
export declare function externalEditorRefusal(context: ExternalEditorContext): 'ignore' | string | undefined;
|
|
74
|
+
export type ExternalEditorOutcome =
|
|
75
|
+
/** A valid result that differs from the draft: replaces it, unsent. */
|
|
76
|
+
{
|
|
77
|
+
readonly kind: 'changed';
|
|
78
|
+
readonly text: string;
|
|
79
|
+
readonly cleanupProblem?: string;
|
|
80
|
+
}
|
|
81
|
+
/** The editor exited cleanly and the normalized result equals the draft. */
|
|
82
|
+
| {
|
|
83
|
+
readonly kind: 'unchanged';
|
|
84
|
+
readonly cleanupProblem?: string;
|
|
85
|
+
}
|
|
86
|
+
/** Nothing launched: the draft or the storage cannot be used. */
|
|
87
|
+
| {
|
|
88
|
+
readonly kind: 'refused';
|
|
89
|
+
readonly reason: string;
|
|
90
|
+
readonly cleanupProblem?: string;
|
|
91
|
+
}
|
|
92
|
+
/** Launch failure, nonzero/signal exit, shutdown, or invalid output. */
|
|
93
|
+
| {
|
|
94
|
+
readonly kind: 'failed';
|
|
95
|
+
readonly reason: string;
|
|
96
|
+
readonly cleanupProblem?: string;
|
|
97
|
+
};
|
|
98
|
+
export interface ExternalEditorOptions {
|
|
99
|
+
readonly argv: readonly string[];
|
|
100
|
+
/** The session cwd (`runtime.info.projectRoot`). */
|
|
101
|
+
readonly cwd: string;
|
|
102
|
+
/** The sanitized child environment, already carrying `DARWIN=1`. */
|
|
103
|
+
readonly env: Readonly<Record<string, string>>;
|
|
104
|
+
/** Composer text policy applied to the result — `normalizeDraftText`, nothing else. */
|
|
105
|
+
readonly normalize: (text: string) => string;
|
|
106
|
+
/** The terminal descriptor the editor gets as stdin/stdout/stderr; default inherit. */
|
|
107
|
+
readonly terminalFd?: number;
|
|
108
|
+
/** Where the private directory is created; default `os.tmpdir()`. */
|
|
109
|
+
readonly tempRoot?: string;
|
|
110
|
+
/** Storage resolving inside this directory is refused (the repository). */
|
|
111
|
+
readonly projectRoot?: string;
|
|
112
|
+
/** Hold darwin's SIGINT/SIGQUIT listeners while the editor shares the terminal; default true. */
|
|
113
|
+
readonly ignoreTerminalSignals?: boolean;
|
|
114
|
+
}
|
|
115
|
+
export interface ExternalEditorRun {
|
|
116
|
+
readonly done: Promise<ExternalEditorOutcome>;
|
|
117
|
+
/** Darwin shutdown: TERM→KILL the editor and remove the storage now. */
|
|
118
|
+
kill(): void;
|
|
119
|
+
}
|
|
120
|
+
/** True when `text` fits both caps; checked before anything is created. */
|
|
121
|
+
export declare function withinEditorCaps(text: string): boolean;
|
|
122
|
+
/** Opens the editor on `text`; resolves once, after the storage is removed. */
|
|
123
|
+
export declare function runExternalEditor(text: string, options: ExternalEditorOptions): ExternalEditorRun;
|
|
124
|
+
/**
|
|
125
|
+
* Reads the edited file through one descriptor: no symlink follow, no blocking on a
|
|
126
|
+
* FIFO, regular files only, at most cap+1 bytes however large the file grows, strict
|
|
127
|
+
* UTF-8 (a BOM is kept as text, not silently dropped).
|
|
128
|
+
*/
|
|
129
|
+
export declare function readEditorResult(file: string): Promise<{
|
|
130
|
+
readonly ok: true;
|
|
131
|
+
readonly text: string;
|
|
132
|
+
} | {
|
|
133
|
+
readonly ok: false;
|
|
134
|
+
readonly reason: string;
|
|
135
|
+
}>;
|
|
136
|
+
/** True when {@link quiesceTerminalInput} can stop darwin's own terminal reads. */
|
|
137
|
+
export declare function canQuiesceTerminalInput(stream: NodeJS.ReadableStream): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Call inside the suspension: lets queued input ticks settle, stops the handle, and
|
|
140
|
+
* returns the restart to call after Ink has resumed. Idempotent restart; a handle Node
|
|
141
|
+
* already restarted itself is left alone.
|
|
142
|
+
*/
|
|
143
|
+
export declare function quiesceTerminalInput(stream: NodeJS.ReadableStream): Promise<() => void>;
|