@namzu/cli 14.3.0 → 15.0.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 +107 -17
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +26 -26
- package/dist/cli.js.map +1 -1
- package/dist/commands/acp.js +1 -1
- package/dist/commands/acp.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +2 -0
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/login.d.ts +2 -0
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +45 -7
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +22 -9
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/{stubs.d.ts → serve.d.ts} +1 -10
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/{stubs.js → serve.js} +1 -24
- package/dist/commands/serve.js.map +1 -0
- package/dist/commands/skills.d.ts +19 -0
- package/dist/commands/skills.d.ts.map +1 -0
- package/dist/commands/skills.js +107 -0
- package/dist/commands/skills.js.map +1 -0
- package/dist/integrations/mcp/servers.d.ts +7 -0
- package/dist/integrations/mcp/servers.d.ts.map +1 -1
- package/dist/integrations/mcp/servers.js +33 -8
- package/dist/integrations/mcp/servers.js.map +1 -1
- package/dist/integrations/sessions/store.d.ts +8 -0
- package/dist/integrations/sessions/store.d.ts.map +1 -1
- package/dist/integrations/sessions/store.js +15 -0
- package/dist/integrations/sessions/store.js.map +1 -1
- package/dist/integrations/subagents/runtime.d.ts +2 -0
- package/dist/integrations/subagents/runtime.d.ts.map +1 -1
- package/dist/integrations/subagents/runtime.js +86 -13
- package/dist/integrations/subagents/runtime.js.map +1 -1
- package/dist/integrations/updates.d.ts.map +1 -1
- package/dist/integrations/updates.js +29 -4
- package/dist/integrations/updates.js.map +1 -1
- package/dist/tui/App.d.ts +10 -1
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/App.js +1003 -186
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/ChoicePicker.d.ts +2 -1
- package/dist/tui/ChoicePicker.d.ts.map +1 -1
- package/dist/tui/ChoicePicker.js +10 -6
- package/dist/tui/ChoicePicker.js.map +1 -1
- package/dist/tui/Composer.d.ts +19 -2
- package/dist/tui/Composer.d.ts.map +1 -1
- package/dist/tui/Composer.js +526 -70
- package/dist/tui/Composer.js.map +1 -1
- package/dist/tui/CopyPicker.d.ts.map +1 -1
- package/dist/tui/CopyPicker.js +3 -4
- package/dist/tui/CopyPicker.js.map +1 -1
- package/dist/tui/EditPromptPicker.d.ts.map +1 -1
- package/dist/tui/EditPromptPicker.js +3 -4
- package/dist/tui/EditPromptPicker.js.map +1 -1
- package/dist/tui/Markdown.d.ts +3 -1
- package/dist/tui/Markdown.d.ts.map +1 -1
- package/dist/tui/Markdown.js +11 -9
- package/dist/tui/Markdown.js.map +1 -1
- package/dist/tui/PermissionOverlay.d.ts +11 -6
- package/dist/tui/PermissionOverlay.d.ts.map +1 -1
- package/dist/tui/PermissionOverlay.js +13 -20
- package/dist/tui/PermissionOverlay.js.map +1 -1
- package/dist/tui/Picker.d.ts.map +1 -1
- package/dist/tui/Picker.js +47 -11
- package/dist/tui/Picker.js.map +1 -1
- package/dist/tui/ResumePicker.d.ts.map +1 -1
- package/dist/tui/ResumePicker.js +6 -1
- package/dist/tui/ResumePicker.js.map +1 -1
- package/dist/tui/TextPrompt.d.ts +21 -0
- package/dist/tui/TextPrompt.d.ts.map +1 -0
- package/dist/tui/TextPrompt.js +139 -0
- package/dist/tui/TextPrompt.js.map +1 -0
- package/dist/tui/Transcript.d.ts +3 -3
- package/dist/tui/Transcript.d.ts.map +1 -1
- package/dist/tui/Transcript.js +4 -4
- package/dist/tui/Transcript.js.map +1 -1
- package/dist/tui/agent.d.ts +24 -20
- package/dist/tui/agent.d.ts.map +1 -1
- package/dist/tui/agent.js +98 -74
- package/dist/tui/agent.js.map +1 -1
- package/dist/tui/exit-summary.d.ts.map +1 -1
- package/dist/tui/exit-summary.js +2 -1
- package/dist/tui/exit-summary.js.map +1 -1
- package/dist/tui/external-editor.d.ts +25 -0
- package/dist/tui/external-editor.d.ts.map +1 -0
- package/dist/tui/external-editor.js +169 -0
- package/dist/tui/external-editor.js.map +1 -0
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +4 -0
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/login-prompt.d.ts +2 -0
- package/dist/tui/login-prompt.d.ts.map +1 -1
- package/dist/tui/login-prompt.js +8 -1
- package/dist/tui/login-prompt.js.map +1 -1
- package/dist/tui/mentions.d.ts +19 -0
- package/dist/tui/mentions.d.ts.map +1 -1
- package/dist/tui/mentions.js +96 -5
- package/dist/tui/mentions.js.map +1 -1
- package/dist/tui/permission-review.d.ts +59 -0
- package/dist/tui/permission-review.d.ts.map +1 -0
- package/dist/tui/permission-review.js +219 -0
- package/dist/tui/permission-review.js.map +1 -0
- package/dist/tui/selection-window.d.ts +18 -0
- package/dist/tui/selection-window.d.ts.map +1 -0
- package/dist/tui/selection-window.js +37 -0
- package/dist/tui/selection-window.js.map +1 -0
- package/dist/tui/slashCommands.d.ts +48 -8
- package/dist/tui/slashCommands.d.ts.map +1 -1
- package/dist/tui/slashCommands.js +129 -47
- package/dist/tui/slashCommands.js.map +1 -1
- package/dist/tui/terminal-hyperlinks.d.ts +20 -0
- package/dist/tui/terminal-hyperlinks.d.ts.map +1 -0
- package/dist/tui/terminal-hyperlinks.js +70 -0
- package/dist/tui/terminal-hyperlinks.js.map +1 -0
- package/dist/tui/types.d.ts +2 -0
- package/dist/tui/types.d.ts.map +1 -1
- package/dist/tui/use-selection-index.d.ts +8 -0
- package/dist/tui/use-selection-index.d.ts.map +1 -0
- package/dist/tui/use-selection-index.js +13 -0
- package/dist/tui/use-selection-index.js.map +1 -0
- package/dist/tui/workspace-review.d.ts +15 -0
- package/dist/tui/workspace-review.d.ts.map +1 -0
- package/dist/tui/workspace-review.js +67 -0
- package/dist/tui/workspace-review.js.map +1 -0
- package/dist/version.d.ts +10 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +23 -0
- package/dist/version.js.map +1 -0
- package/package.json +6 -5
- package/dist/commands/stubs.d.ts.map +0 -1
- package/dist/commands/stubs.js.map +0 -1
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { terminalDisplayText } from './terminal-display.js';
|
|
2
|
+
/**
|
|
3
|
+
* Maximum exact permission envelope handed to an interactive reviewer.
|
|
4
|
+
*
|
|
5
|
+
* This is a refusal boundary, not a display truncation boundary. A call above
|
|
6
|
+
* it is not offered for approval and is not executed. Keeping the limit on the
|
|
7
|
+
* complete batch also prevents many individually-small calls from turning one
|
|
8
|
+
* consent prompt into an unbounded allocation.
|
|
9
|
+
*/
|
|
10
|
+
export const MAX_PERMISSION_REVIEW_BYTES = 8_000;
|
|
11
|
+
/** Physical rows kept visible in the exact-input pager. */
|
|
12
|
+
export const PERMISSION_REVIEW_PAGE_ROWS = 8;
|
|
13
|
+
/** Actionable fail-closed feedback for a TUI review that cannot be exact. */
|
|
14
|
+
export function permissionReviewRefusal(reason) {
|
|
15
|
+
return reason === 'too_large'
|
|
16
|
+
? `Refused: the complete tool batch exceeds the ${MAX_PERMISSION_REVIEW_BYTES}-byte interactive review limit. Split it into smaller calls or add an explicit allow rule after reviewing the operation another way.`
|
|
17
|
+
: 'Refused: this tool batch contains input the interactive permission protocol cannot represent exactly. Use JSON-compatible input or add an explicit allow rule after reviewing the operation another way.';
|
|
18
|
+
}
|
|
19
|
+
class ReviewLimitError extends Error {
|
|
20
|
+
}
|
|
21
|
+
class ReviewShapeError extends Error {
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Serialize the exact executable batch without invoking getters or `toJSON`.
|
|
25
|
+
*
|
|
26
|
+
* `ToolRegistry.prepareExecution()` already publishes detached JSON values,
|
|
27
|
+
* but this is a host boundary and structural SDK implementations can still
|
|
28
|
+
* supply `unknown`. Ordinary `JSON.stringify` would execute an accessor and
|
|
29
|
+
* could silently turn a Date/Map/custom object into something other than the
|
|
30
|
+
* value being approved. The bounded writer accepts only the JSON graph the
|
|
31
|
+
* permission protocol can preserve and stops building as soon as the complete
|
|
32
|
+
* envelope crosses the limit.
|
|
33
|
+
*/
|
|
34
|
+
export function buildPermissionReview(calls, maxBytes = MAX_PERMISSION_REVIEW_BYTES) {
|
|
35
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes < 1) {
|
|
36
|
+
return { ok: false, reason: 'unrepresentable' };
|
|
37
|
+
}
|
|
38
|
+
const chunks = [];
|
|
39
|
+
let bytes = 0;
|
|
40
|
+
const active = new WeakSet();
|
|
41
|
+
const append = (chunk) => {
|
|
42
|
+
bytes += Buffer.byteLength(chunk, 'utf8');
|
|
43
|
+
if (bytes > maxBytes)
|
|
44
|
+
throw new ReviewLimitError();
|
|
45
|
+
chunks.push(chunk);
|
|
46
|
+
};
|
|
47
|
+
const appendString = (value) => {
|
|
48
|
+
// JSON escaping only grows a string. Avoid materialising an escaped copy
|
|
49
|
+
// when the source alone has already crossed the complete-envelope cap.
|
|
50
|
+
if (Buffer.byteLength(value, 'utf8') > maxBytes - bytes)
|
|
51
|
+
throw new ReviewLimitError();
|
|
52
|
+
append(JSON.stringify(value));
|
|
53
|
+
};
|
|
54
|
+
const write = (value, indent) => {
|
|
55
|
+
if (value === null) {
|
|
56
|
+
append('null');
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
switch (typeof value) {
|
|
60
|
+
case 'string':
|
|
61
|
+
appendString(value);
|
|
62
|
+
return;
|
|
63
|
+
case 'boolean':
|
|
64
|
+
append(value ? 'true' : 'false');
|
|
65
|
+
return;
|
|
66
|
+
case 'number':
|
|
67
|
+
if (!Number.isFinite(value) || Object.is(value, -0))
|
|
68
|
+
throw new ReviewShapeError();
|
|
69
|
+
append(String(value));
|
|
70
|
+
return;
|
|
71
|
+
case 'object':
|
|
72
|
+
break;
|
|
73
|
+
default:
|
|
74
|
+
throw new ReviewShapeError();
|
|
75
|
+
}
|
|
76
|
+
const object = value;
|
|
77
|
+
if (active.has(object))
|
|
78
|
+
throw new ReviewShapeError();
|
|
79
|
+
active.add(object);
|
|
80
|
+
try {
|
|
81
|
+
if (Array.isArray(value)) {
|
|
82
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
83
|
+
if (Object.getOwnPropertySymbols(value).length > 0)
|
|
84
|
+
throw new ReviewShapeError();
|
|
85
|
+
const names = Object.getOwnPropertyNames(value);
|
|
86
|
+
if (names.some((name) => name !== 'length' && (!/^(0|[1-9]\d*)$/.test(name) || Number(name) >= value.length)))
|
|
87
|
+
throw new ReviewShapeError();
|
|
88
|
+
append('[');
|
|
89
|
+
if (value.length > 0)
|
|
90
|
+
append('\n');
|
|
91
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
92
|
+
const descriptor = descriptors[String(index)];
|
|
93
|
+
if (!descriptor || !('value' in descriptor) || !descriptor.enumerable)
|
|
94
|
+
throw new ReviewShapeError();
|
|
95
|
+
append(' '.repeat(indent + 2));
|
|
96
|
+
write(descriptor.value, indent + 2);
|
|
97
|
+
append(index === value.length - 1 ? '\n' : ',\n');
|
|
98
|
+
}
|
|
99
|
+
if (value.length > 0)
|
|
100
|
+
append(' '.repeat(indent));
|
|
101
|
+
append(']');
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const prototype = Object.getPrototypeOf(value);
|
|
105
|
+
if (prototype !== Object.prototype && prototype !== null)
|
|
106
|
+
throw new ReviewShapeError();
|
|
107
|
+
if (Object.getOwnPropertySymbols(value).length > 0)
|
|
108
|
+
throw new ReviewShapeError();
|
|
109
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
110
|
+
const entries = Object.keys(value);
|
|
111
|
+
for (const name of Object.getOwnPropertyNames(value)) {
|
|
112
|
+
const descriptor = descriptors[name];
|
|
113
|
+
if (!descriptor || !descriptor.enumerable || !('value' in descriptor))
|
|
114
|
+
throw new ReviewShapeError();
|
|
115
|
+
}
|
|
116
|
+
append('{');
|
|
117
|
+
if (entries.length > 0)
|
|
118
|
+
append('\n');
|
|
119
|
+
for (let index = 0; index < entries.length; index += 1) {
|
|
120
|
+
const key = entries[index];
|
|
121
|
+
const descriptor = descriptors[key];
|
|
122
|
+
if (!descriptor || !('value' in descriptor))
|
|
123
|
+
throw new ReviewShapeError();
|
|
124
|
+
append(' '.repeat(indent + 2));
|
|
125
|
+
appendString(key);
|
|
126
|
+
append(': ');
|
|
127
|
+
write(descriptor.value, indent + 2);
|
|
128
|
+
append(index === entries.length - 1 ? '\n' : ',\n');
|
|
129
|
+
}
|
|
130
|
+
if (entries.length > 0)
|
|
131
|
+
append(' '.repeat(indent));
|
|
132
|
+
append('}');
|
|
133
|
+
}
|
|
134
|
+
finally {
|
|
135
|
+
active.delete(object);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
try {
|
|
139
|
+
const exactCalls = calls.map((call) => {
|
|
140
|
+
const prototype = Object.getPrototypeOf(call);
|
|
141
|
+
if (prototype !== Object.prototype && prototype !== null)
|
|
142
|
+
throw new ReviewShapeError();
|
|
143
|
+
if (Object.getOwnPropertySymbols(call).length > 0)
|
|
144
|
+
throw new ReviewShapeError();
|
|
145
|
+
const descriptors = Object.getOwnPropertyDescriptors(call);
|
|
146
|
+
const id = descriptors.id;
|
|
147
|
+
const name = descriptors.name;
|
|
148
|
+
const input = descriptors.input;
|
|
149
|
+
const isDestructive = descriptors.isDestructive;
|
|
150
|
+
if (!id ||
|
|
151
|
+
!('value' in id) ||
|
|
152
|
+
typeof id.value !== 'string' ||
|
|
153
|
+
!name ||
|
|
154
|
+
!('value' in name) ||
|
|
155
|
+
typeof name.value !== 'string' ||
|
|
156
|
+
!input ||
|
|
157
|
+
!('value' in input) ||
|
|
158
|
+
!isDestructive ||
|
|
159
|
+
!('value' in isDestructive) ||
|
|
160
|
+
typeof isDestructive.value !== 'boolean')
|
|
161
|
+
throw new ReviewShapeError();
|
|
162
|
+
return {
|
|
163
|
+
id: id.value,
|
|
164
|
+
name: name.value,
|
|
165
|
+
input: input.value,
|
|
166
|
+
isDestructive: isDestructive.value,
|
|
167
|
+
};
|
|
168
|
+
});
|
|
169
|
+
write({
|
|
170
|
+
calls: exactCalls,
|
|
171
|
+
}, 0);
|
|
172
|
+
return { ok: true, text: chunks.join(''), bytes };
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
return {
|
|
176
|
+
ok: false,
|
|
177
|
+
reason: error instanceof ReviewLimitError ? 'too_large' : 'unrepresentable',
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Project and wrap exact review text into PHYSICAL terminal rows.
|
|
183
|
+
*
|
|
184
|
+
* JSON strings can contain thousands of characters on one logical line. Ink
|
|
185
|
+
* would wrap that line after pagination, leaving the suffix below the viewport
|
|
186
|
+
* while the pager still believed there was only one row. Wrapping first makes
|
|
187
|
+
* the pager's unit the same row the operator sees. Non-ASCII code points count
|
|
188
|
+
* conservatively as two cells; overestimating produces shorter rows, never a
|
|
189
|
+
* hidden tail.
|
|
190
|
+
*/
|
|
191
|
+
export function permissionReviewRows(review, terminalColumns) {
|
|
192
|
+
// App padding (2), border (2), horizontal padding (2), inner indentation
|
|
193
|
+
// (2) and the row marker (2) are outside the source text. Keep wrapping at
|
|
194
|
+
// one cell even in an unusually narrow terminal; truncating would make the
|
|
195
|
+
// exact approval envelope incomplete precisely where it matters most.
|
|
196
|
+
const width = Math.max(1, (terminalColumns ?? 80) - 10);
|
|
197
|
+
const visible = terminalDisplayText(review);
|
|
198
|
+
const rows = [];
|
|
199
|
+
for (const logical of visible.split('\n')) {
|
|
200
|
+
let text = '';
|
|
201
|
+
let cells = 0;
|
|
202
|
+
let continuation = false;
|
|
203
|
+
for (const point of logical) {
|
|
204
|
+
const codePoint = point.codePointAt(0);
|
|
205
|
+
const pointCells = codePoint !== undefined && codePoint <= 0x7e ? 1 : 2;
|
|
206
|
+
if (text.length > 0 && cells + pointCells > width) {
|
|
207
|
+
rows.push({ index: rows.length, text, continuation });
|
|
208
|
+
text = '';
|
|
209
|
+
cells = 0;
|
|
210
|
+
continuation = true;
|
|
211
|
+
}
|
|
212
|
+
text += point;
|
|
213
|
+
cells += pointCells;
|
|
214
|
+
}
|
|
215
|
+
rows.push({ index: rows.length, text, continuation });
|
|
216
|
+
}
|
|
217
|
+
return rows;
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=permission-review.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission-review.js","sourceRoot":"","sources":["../../src/tui/permission-review.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAA;AAEhD,2DAA2D;AAC3D,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAA;AAa5C,6EAA6E;AAC7E,MAAM,UAAU,uBAAuB,CAAC,MAAuC;IAC9E,OAAO,MAAM,KAAK,WAAW;QAC5B,CAAC,CAAC,gDAAgD,2BAA2B,sIAAsI;QACnN,CAAC,CAAC,0MAA0M,CAAA;AAC9M,CAAC;AAWD,MAAM,gBAAiB,SAAQ,KAAK;CAAG;AACvC,MAAM,gBAAiB,SAAQ,KAAK;CAAG;AAEvC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,qBAAqB,CACpC,KAAsC,EACtC,QAAQ,GAAG,2BAA2B;IAEtC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;QACrD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAA;IAChD,CAAC;IAED,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,IAAI,KAAK,GAAG,CAAC,CAAA;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AG,IAAI,CAAA;YACpB,CAAC;YACD,IAAI,IAAI,KAAK,CAAA;YACb,KAAK,IAAI,UAAU,CAAA;QACpB,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAA;IACtD,CAAC;IAED,OAAO,IAAI,CAAA;AACZ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Default number of finite choices kept visible in terminal overlays. */
|
|
2
|
+
export declare const SELECTION_WINDOW_SIZE = 7;
|
|
3
|
+
export type SelectionMovement = 'previous' | 'next' | 'previous-page' | 'next-page' | 'first' | 'last';
|
|
4
|
+
export interface SelectionWindow<T> {
|
|
5
|
+
readonly start: number;
|
|
6
|
+
readonly items: readonly T[];
|
|
7
|
+
}
|
|
8
|
+
/** Move an absolute finite-list cursor without letting a UI invent its own page size. */
|
|
9
|
+
export declare function moveSelection(selected: number, itemCount: number, movement: SelectionMovement, pageSize?: number): number;
|
|
10
|
+
/**
|
|
11
|
+
* Keep an absolute selection inside a bounded, centred terminal window.
|
|
12
|
+
*
|
|
13
|
+
* The cursor remains in the caller's full-list coordinate space. Returning
|
|
14
|
+
* the absolute start beside the slice prevents a rendered row from being
|
|
15
|
+
* submitted as the wrong item after the first page scrolls away.
|
|
16
|
+
*/
|
|
17
|
+
export declare function selectionWindow<T>(items: readonly T[], selected: number, windowSize?: number): SelectionWindow<T>;
|
|
18
|
+
//# sourceMappingURL=selection-window.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-window.d.ts","sourceRoot":"","sources":["../../src/tui/selection-window.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,eAAO,MAAM,qBAAqB,IAAI,CAAA;AAEtC,MAAM,MAAM,iBAAiB,GAC1B,UAAU,GACV,MAAM,GACN,eAAe,GACf,WAAW,GACX,OAAO,GACP,MAAM,CAAA;AAET,MAAM,WAAW,eAAe,CAAC,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAA;CAC5B;AAED,yFAAyF;AACzF,wBAAgB,aAAa,CAC5B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,iBAAiB,EAC3B,QAAQ,SAAwB,GAC9B,MAAM,CAiBR;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAChC,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,QAAQ,EAAE,MAAM,EAChB,UAAU,SAAwB,GAChC,eAAe,CAAC,CAAC,CAAC,CAQpB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Default number of finite choices kept visible in terminal overlays. */
|
|
2
|
+
export const SELECTION_WINDOW_SIZE = 7;
|
|
3
|
+
/** Move an absolute finite-list cursor without letting a UI invent its own page size. */
|
|
4
|
+
export function moveSelection(selected, itemCount, movement, pageSize = SELECTION_WINDOW_SIZE) {
|
|
5
|
+
if (itemCount <= 0)
|
|
6
|
+
return 0;
|
|
7
|
+
const current = Math.max(0, Math.min(selected, itemCount - 1));
|
|
8
|
+
switch (movement) {
|
|
9
|
+
case 'previous':
|
|
10
|
+
return Math.max(0, current - 1);
|
|
11
|
+
case 'next':
|
|
12
|
+
return Math.min(itemCount - 1, current + 1);
|
|
13
|
+
case 'previous-page':
|
|
14
|
+
return Math.max(0, current - Math.max(1, pageSize));
|
|
15
|
+
case 'next-page':
|
|
16
|
+
return Math.min(itemCount - 1, current + Math.max(1, pageSize));
|
|
17
|
+
case 'first':
|
|
18
|
+
return 0;
|
|
19
|
+
case 'last':
|
|
20
|
+
return itemCount - 1;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Keep an absolute selection inside a bounded, centred terminal window.
|
|
25
|
+
*
|
|
26
|
+
* The cursor remains in the caller's full-list coordinate space. Returning
|
|
27
|
+
* the absolute start beside the slice prevents a rendered row from being
|
|
28
|
+
* submitted as the wrong item after the first page scrolls away.
|
|
29
|
+
*/
|
|
30
|
+
export function selectionWindow(items, selected, windowSize = SELECTION_WINDOW_SIZE) {
|
|
31
|
+
if (items.length === 0 || windowSize <= 0)
|
|
32
|
+
return { start: 0, items: [] };
|
|
33
|
+
const clamped = Math.max(0, Math.min(selected, items.length - 1));
|
|
34
|
+
const start = Math.max(0, Math.min(clamped - Math.floor(windowSize / 2), items.length - windowSize));
|
|
35
|
+
return { start, items: items.slice(start, start + windowSize) };
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=selection-window.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-window.js","sourceRoot":"","sources":["../../src/tui/selection-window.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAA;AAetC,yFAAyF;AACzF,MAAM,UAAU,aAAa,CAC5B,QAAgB,EAChB,SAAiB,EACjB,QAA2B,EAC3B,QAAQ,GAAG,qBAAqB;IAEhC,IAAI,SAAS,IAAI,CAAC;QAAE,OAAO,CAAC,CAAA;IAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,SAAS,GAAG,CAAC,CAAC,CAAC,CAAA;IAC9D,QAAQ,QAAQ,EAAE,CAAC;QAClB,KAAK,UAAU;YACd,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,CAAA;QAChC,KAAK,MAAM;YACV,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,CAAA;QAC5C,KAAK,eAAe;YACnB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAA;QACpD,KAAK,WAAW;YACf,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAA;QAChE,KAAK,OAAO;YACX,OAAO,CAAC,CAAA;QACT,KAAK,MAAM;YACV,OAAO,SAAS,GAAG,CAAC,CAAA;IACtB,CAAC;AACF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC9B,KAAmB,EACnB,QAAgB,EAChB,UAAU,GAAG,qBAAqB;IAElC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,IAAI,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;IACzE,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAA;IACjE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CACrB,CAAC,EACD,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,UAAU,CAAC,CACzE,CAAA;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,CAAC,EAAE,CAAA;AAChE,CAAC"}
|
|
@@ -27,10 +27,22 @@ import { type ConfigDebugSnapshot } from '../config/debug.js';
|
|
|
27
27
|
import type { SandboxSummary } from '../context/sandbox.js';
|
|
28
28
|
import { type PermissionMode } from '../permissions/mode.js';
|
|
29
29
|
import { type UserCommand } from '../user-commands/store.js';
|
|
30
|
+
/** One row in the interactive `/help` command palette. */
|
|
31
|
+
export interface CommandPickerEntry {
|
|
32
|
+
readonly name: string;
|
|
33
|
+
readonly description: string;
|
|
34
|
+
/** Present when a discovered command file exists but cannot be executed. */
|
|
35
|
+
readonly problem?: string;
|
|
36
|
+
}
|
|
30
37
|
export type SlashAction = {
|
|
31
38
|
kind: 'message';
|
|
32
39
|
role: 'system';
|
|
33
40
|
content: string;
|
|
41
|
+
}
|
|
42
|
+
/** Choose and dispatch one exact command from the session's live vocabulary. */
|
|
43
|
+
| {
|
|
44
|
+
kind: 'command-picker';
|
|
45
|
+
commands: readonly CommandPickerEntry[];
|
|
34
46
|
} | {
|
|
35
47
|
kind: 'exit';
|
|
36
48
|
}
|
|
@@ -38,10 +50,19 @@ export type SlashAction = {
|
|
|
38
50
|
| {
|
|
39
51
|
kind: 'clear-screen';
|
|
40
52
|
}
|
|
53
|
+
/** Replace the command invocation with an operator-editable composer draft. */
|
|
54
|
+
| {
|
|
55
|
+
kind: 'composer-draft';
|
|
56
|
+
text: string;
|
|
57
|
+
}
|
|
41
58
|
/** Start a fresh conversation, optionally clearing the rendered transcript too. */
|
|
42
59
|
| {
|
|
43
60
|
kind: 'new-conversation';
|
|
44
61
|
clearScreen: boolean;
|
|
62
|
+
}
|
|
63
|
+
/** Confirm before making the current durable conversation read-only and exiting. */
|
|
64
|
+
| {
|
|
65
|
+
kind: 'archive-picker';
|
|
45
66
|
} | {
|
|
46
67
|
kind: 'repick';
|
|
47
68
|
}
|
|
@@ -62,6 +83,11 @@ export type SlashAction = {
|
|
|
62
83
|
/** Open the current model's finite reasoning-effort chooser. */
|
|
63
84
|
| {
|
|
64
85
|
kind: 'reasoning-effort-picker';
|
|
86
|
+
}
|
|
87
|
+
/** Open the finite good/bad chooser for one exact assistant message. */
|
|
88
|
+
| {
|
|
89
|
+
kind: 'feedback-picker';
|
|
90
|
+
messageId: string;
|
|
65
91
|
} | {
|
|
66
92
|
kind: 'remember';
|
|
67
93
|
text: string;
|
|
@@ -69,6 +95,8 @@ export type SlashAction = {
|
|
|
69
95
|
kind: 'show-memory';
|
|
70
96
|
} | {
|
|
71
97
|
kind: 'list-skills';
|
|
98
|
+
} | {
|
|
99
|
+
kind: 'skill-picker';
|
|
72
100
|
} | {
|
|
73
101
|
kind: 'load-skill';
|
|
74
102
|
name: string;
|
|
@@ -76,12 +104,12 @@ export type SlashAction = {
|
|
|
76
104
|
kind: 'resume';
|
|
77
105
|
}
|
|
78
106
|
/**
|
|
79
|
-
* Name this conversation,
|
|
107
|
+
* Name this conversation, open its name editor, or take the name away.
|
|
80
108
|
*
|
|
81
109
|
* Its own kind rather than a message, because the write touches the
|
|
82
|
-
* session store and this union is pure. An empty `title` means "
|
|
83
|
-
* an explicit clear is the literal word, so a person cannot erase
|
|
84
|
-
* by pressing enter on a half-typed command.
|
|
110
|
+
* session store and this union is pure. An empty `title` means "open the
|
|
111
|
+
* editor"; an explicit clear is the literal word, so a person cannot erase
|
|
112
|
+
* a name by pressing enter on a half-typed command.
|
|
85
113
|
*/
|
|
86
114
|
| {
|
|
87
115
|
kind: 'title';
|
|
@@ -117,10 +145,14 @@ export type SlashAction = {
|
|
|
117
145
|
kind: 'raw';
|
|
118
146
|
enabled: boolean | 'toggle';
|
|
119
147
|
}
|
|
148
|
+
/** Choose whether the verified Markdown projection goes to the clipboard or a file. */
|
|
149
|
+
| {
|
|
150
|
+
kind: 'export-picker';
|
|
151
|
+
}
|
|
120
152
|
/** Write a verified, no-clobber Markdown projection of this conversation. */
|
|
121
153
|
| {
|
|
122
154
|
kind: 'export';
|
|
123
|
-
path
|
|
155
|
+
path: string;
|
|
124
156
|
}
|
|
125
157
|
/**
|
|
126
158
|
* Show what is uncommitted in the working tree.
|
|
@@ -140,6 +172,7 @@ export type SlashAction = {
|
|
|
140
172
|
*/
|
|
141
173
|
| {
|
|
142
174
|
kind: 'review';
|
|
175
|
+
instructions?: string;
|
|
143
176
|
}
|
|
144
177
|
/**
|
|
145
178
|
* A command the KERNEL registered, to be dispatched and rendered.
|
|
@@ -206,10 +239,13 @@ export type SlashAction = {
|
|
|
206
239
|
pasted?: string;
|
|
207
240
|
} | {
|
|
208
241
|
kind: 'logout';
|
|
242
|
+
target?: 'anthropic' | 'codex' | 'all';
|
|
209
243
|
} | {
|
|
210
244
|
kind: 'none';
|
|
211
245
|
};
|
|
212
246
|
export interface SlashContext {
|
|
247
|
+
/** Canonical working directory owned by this TUI session. */
|
|
248
|
+
readonly cwd: string;
|
|
213
249
|
/**
|
|
214
250
|
* Every tool the agent can call, read when the command runs.
|
|
215
251
|
*
|
|
@@ -233,13 +269,13 @@ export interface SlashContext {
|
|
|
233
269
|
*/
|
|
234
270
|
readonly sandbox: SandboxSummary | null;
|
|
235
271
|
/**
|
|
236
|
-
* Tool servers
|
|
272
|
+
* Tool servers as they stand when the command runs.
|
|
237
273
|
*
|
|
238
274
|
* `null` before a session exists. Reported at connect time as transcript
|
|
239
275
|
* rows that scroll away, and nowhere else — so an operator ten minutes into
|
|
240
276
|
* a session had no way to ask which servers answered and which did not.
|
|
241
277
|
*/
|
|
242
|
-
readonly mcp: {
|
|
278
|
+
readonly mcp: () => {
|
|
243
279
|
readonly connected: readonly {
|
|
244
280
|
readonly name: string;
|
|
245
281
|
readonly tools: readonly string[];
|
|
@@ -501,7 +537,11 @@ export declare function renderCost(usage: SlashContext['usage']): string;
|
|
|
501
537
|
* review of whatever fitted.
|
|
502
538
|
*/
|
|
503
539
|
export declare function reviewPrompt(stat: string, untracked: readonly string[]): string;
|
|
504
|
-
|
|
540
|
+
/** Review a branch comparison already resolved by the host to an immutable commit. */
|
|
541
|
+
export declare function baseBranchReviewPrompt(mergeBaseSha: string): string;
|
|
542
|
+
/** Review one immutable commit without asking the model to resolve a mutable ref. */
|
|
543
|
+
export declare function commitReviewPrompt(sha: string): string;
|
|
544
|
+
export declare function renderMcp(mcp: ReturnType<SlashContext['mcp']>): string;
|
|
505
545
|
export declare function renderStatus(ctx: SlashContext): string;
|
|
506
546
|
export declare function renderPermissions(permissions: SlashContext['permissions']): string;
|
|
507
547
|
/** Render the exact session control without inventing a global effort menu. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slashCommands.d.ts","sourceRoot":"","sources":["../../src/tui/slashCommands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAE5B,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,KAAK,mBAAmB,EAAqB,MAAM,oBAAoB,CAAA;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,KAAK,cAAc,EAAoB,MAAM,wBAAwB,CAAA;AAC9E,OAAO,EAAE,KAAK,WAAW,EAAiB,MAAM,2BAA2B,CAAA;AAG3E,MAAM,MAAM,WAAW,GACpB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"slashCommands.d.ts","sourceRoot":"","sources":["../../src/tui/slashCommands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAE5B,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,KAAK,mBAAmB,EAAqB,MAAM,oBAAoB,CAAA;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,KAAK,cAAc,EAAoB,MAAM,wBAAwB,CAAA;AAC9E,OAAO,EAAE,KAAK,WAAW,EAAiB,MAAM,2BAA2B,CAAA;AAG3E,0DAA0D;AAC1D,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,IA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