camouflage-tui 2.2.2-beta.1 → 2.3.0-beta.1
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/package.json +1 -1
- package/src/binding.d.ts +2 -0
- package/src/binding.js +2 -0
- package/src/types.d.ts +27 -2
- package/src/types.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "camouflage-tui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0-beta.1",
|
|
4
4
|
"description": "High-performance terminal renderer for AI agent applications. A React Ink alternative built for streaming, persistence, and replay.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
package/src/binding.d.ts
CHANGED
|
@@ -212,6 +212,8 @@ export interface CamouflageHandle extends EventEmitter {
|
|
|
212
212
|
on(event: "wizardCancelled", listener: (resp: WizardCancelledEvent) => void): this;
|
|
213
213
|
on(event: "modeChangeRequested", listener: (resp: { direction: "next" | "prev" }) => void): this;
|
|
214
214
|
on(event: "cancelRequested", listener: () => void): this;
|
|
215
|
+
/** The user is typing a path after `@`; answer with MentionCandidatesRegistered { for_query, candidates }. */
|
|
216
|
+
on(event: "mentionQuery", listener: (q: { query: string }) => void): this;
|
|
215
217
|
on(event: "event", listener: (ev: Event) => void): this;
|
|
216
218
|
on(event: "invalid", listener: (info: InvalidEvent) => void): this;
|
|
217
219
|
on(event: "stderr", listener: (chunk: string) => void): this;
|
package/src/binding.js
CHANGED
|
@@ -342,6 +342,8 @@ export async function mount(opts = {}) {
|
|
|
342
342
|
process.stderr.write(`[sdk:esc] CancelRequested line arrived, emitting cancelRequested\n`);
|
|
343
343
|
}
|
|
344
344
|
handle.emit("cancelRequested", {});
|
|
345
|
+
} else if (ev.event_type === "MentionQuery") {
|
|
346
|
+
handle.emit("mentionQuery", { query: ev.payload?.query ?? "" });
|
|
345
347
|
}
|
|
346
348
|
// Always also emit the raw Event for advanced consumers.
|
|
347
349
|
handle.emit("event", ev);
|
package/src/types.d.ts
CHANGED
|
@@ -51,7 +51,8 @@ export type EventType =
|
|
|
51
51
|
| "CancelRequested"
|
|
52
52
|
| "TranscriptCleared"
|
|
53
53
|
| "Splash"
|
|
54
|
-
| "ShowToast"
|
|
54
|
+
| "ShowToast"
|
|
55
|
+
| "MentionQuery";
|
|
55
56
|
|
|
56
57
|
export type Direction = "inbound" | "outbound";
|
|
57
58
|
|
|
@@ -194,16 +195,32 @@ export type MentionCandidate = {
|
|
|
194
195
|
label?: string;
|
|
195
196
|
kind?: string;
|
|
196
197
|
};
|
|
197
|
-
export type MentionCandidatesRegistered = {
|
|
198
|
+
export type MentionCandidatesRegistered = {
|
|
199
|
+
candidates: MentionCandidate[];
|
|
200
|
+
/** Set when answering a MentionQuery: the directory part these entries are
|
|
201
|
+
* for (e.g. "../"). Without it the list replaces the default candidates. */
|
|
202
|
+
for_query?: string;
|
|
203
|
+
};
|
|
198
204
|
|
|
199
205
|
export type SelectListOption = {
|
|
200
206
|
value: string;
|
|
201
207
|
label: string;
|
|
208
|
+
/** Dim text after the label; also searched. */
|
|
202
209
|
description?: string;
|
|
210
|
+
/** Group header shown above the first option of each group (hidden while searching). */
|
|
211
|
+
section?: string;
|
|
212
|
+
/** Values drawn in aligned columns after the label, e.g. ["256k", "$0.60 / $2.50"]. */
|
|
213
|
+
columns?: string[];
|
|
214
|
+
/** Draws an on/off badge, e.g. for enabled skills. */
|
|
215
|
+
state?: "on" | "off";
|
|
216
|
+
/** Extra text the search matches against. */
|
|
217
|
+
keywords?: string;
|
|
203
218
|
};
|
|
204
219
|
export type ShowSelectList = {
|
|
205
220
|
id: string;
|
|
206
221
|
prompt: string;
|
|
222
|
+
/** A dim line under the prompt. */
|
|
223
|
+
subtitle?: string;
|
|
207
224
|
options: SelectListOption[];
|
|
208
225
|
default?: string;
|
|
209
226
|
allow_filter?: boolean;
|
|
@@ -325,6 +342,13 @@ export type ShowToast = {
|
|
|
325
342
|
ttl_ms?: number;
|
|
326
343
|
};
|
|
327
344
|
|
|
345
|
+
/**
|
|
346
|
+
* Renderer → host: the user is typing a path after `@` (`./`, `../`, `~`,
|
|
347
|
+
* `/`). Answer with MentionCandidatesRegistered `{ for_query, candidates }`
|
|
348
|
+
* listing that directory; folder tokens end in "/".
|
|
349
|
+
*/
|
|
350
|
+
export type MentionQuery = { query: string };
|
|
351
|
+
|
|
328
352
|
/** A diff to show inline: full before/after text, or a unified diff. */
|
|
329
353
|
export type DiffPayload = {
|
|
330
354
|
path: string;
|
|
@@ -378,6 +402,7 @@ export type Event = EnvelopeMeta &
|
|
|
378
402
|
| { event_type: "TranscriptCleared"; payload?: Record<string, never> }
|
|
379
403
|
| { event_type: "Splash"; payload: Splash }
|
|
380
404
|
| { event_type: "ShowToast"; payload: ShowToast }
|
|
405
|
+
| { event_type: "MentionQuery"; payload: MentionQuery }
|
|
381
406
|
);
|
|
382
407
|
|
|
383
408
|
/** The payload type for a given event type, e.g. `PayloadOf<"ShowToast">`. */
|
package/src/types.js
CHANGED
|
@@ -22,7 +22,7 @@ const KNOWN_TYPES = new Set([
|
|
|
22
22
|
"ShowForm", "FormResponse",
|
|
23
23
|
"ShowWizard", "WizardCompleted", "WizardCancelled",
|
|
24
24
|
"ModeChangeRequested", "CancelRequested",
|
|
25
|
-
"TranscriptCleared", "Splash", "ShowToast",
|
|
25
|
+
"TranscriptCleared", "Splash", "ShowToast", "MentionQuery",
|
|
26
26
|
]);
|
|
27
27
|
|
|
28
28
|
/**
|