@ignite-ember/extension-bridge 0.0.0-stage → 0.2.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/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +303 -2
- package/dist/bridge.d.ts +33 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +92 -0
- package/dist/bridge.js.map +1 -0
- package/dist/channel.d.ts +26 -0
- package/dist/channel.d.ts.map +1 -0
- package/dist/channel.js +36 -0
- package/dist/channel.js.map +1 -0
- package/dist/contract.d.ts +110 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/contract.js +9 -0
- package/dist/contract.js.map +1 -0
- package/dist/correlator.d.ts +37 -0
- package/dist/correlator.d.ts.map +1 -0
- package/dist/correlator.js +67 -0
- package/dist/correlator.js.map +1 -0
- package/dist/guestBridge.d.ts +63 -0
- package/dist/guestBridge.d.ts.map +1 -0
- package/dist/guestBridge.js +156 -0
- package/dist/guestBridge.js.map +1 -0
- package/dist/hostModel.d.ts +155 -0
- package/dist/hostModel.d.ts.map +1 -0
- package/dist/hostModel.generated.d.ts +1870 -0
- package/dist/hostModel.generated.d.ts.map +1 -0
- package/dist/hostModel.generated.js +1241 -0
- package/dist/hostModel.generated.js.map +1 -0
- package/dist/hostModel.js +168 -0
- package/dist/hostModel.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol.d.ts +338 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +135 -0
- package/dist/protocol.js.map +1 -0
- package/dist/service.d.ts +143 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +179 -0
- package/dist/service.js.map +1 -0
- package/dist/signals.d.ts +21 -0
- package/dist/signals.d.ts.map +1 -0
- package/dist/signals.js +52 -0
- package/dist/signals.js.map +1 -0
- package/dist/tokens.d.ts +95 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +158 -0
- package/dist/tokens.js.map +1 -0
- package/dist/watchers.d.ts +12 -0
- package/dist/watchers.d.ts.map +1 -0
- package/dist/watchers.js +18 -0
- package/dist/watchers.js.map +1 -0
- package/package.json +53 -4
- package/src/bridge.ts +112 -0
- package/src/channel.ts +48 -0
- package/src/contract.ts +130 -0
- package/src/correlator.ts +81 -0
- package/src/guestBridge.ts +261 -0
- package/src/hostModel.generated.ts +2649 -0
- package/src/hostModel.ts +209 -0
- package/src/index.ts +11 -0
- package/src/protocol.ts +475 -0
- package/src/service.ts +253 -0
- package/src/signals.ts +65 -0
- package/src/tokens.ts +165 -0
- package/src/watchers.ts +18 -0
|
@@ -0,0 +1,2649 @@
|
|
|
1
|
+
// GENERATED from the igni host schema 1.13.0 by igni-sdk's tools/host_codegen.py — do not edit. Run `make host-sdks` after refreshing contracts/host-schema.json.
|
|
2
|
+
//
|
|
3
|
+
// `bridge.host` as an extension's page sees it. Read
|
|
4
|
+
// `docs/HOST_OBJECT_MODEL.md` in igni for what each object is.
|
|
5
|
+
|
|
6
|
+
import { HostObject, Property, Signal, type HostLink, type JsonValue } from "./hostModel.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The version of igni's host schema this file was generated from.
|
|
10
|
+
*
|
|
11
|
+
* It moves when igni's host model moves. The bridge carries it on the
|
|
12
|
+
* wire, so a host and a page can say which model they are speaking.
|
|
13
|
+
*/
|
|
14
|
+
export const SCHEMA_VERSION = "1.13.0";
|
|
15
|
+
|
|
16
|
+
/** One change anywhere in the model, as `host.changed` reports it. */
|
|
17
|
+
export interface Change {
|
|
18
|
+
/** The member that changed, `object.member`. */
|
|
19
|
+
path: string;
|
|
20
|
+
/** Its new value. */
|
|
21
|
+
value: JsonValue;
|
|
22
|
+
/** The window, for a per-window member. */
|
|
23
|
+
window?: string | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** How igni presents the conversation. */
|
|
27
|
+
export interface Display {
|
|
28
|
+
/** Whether routing detail is shown. */
|
|
29
|
+
verbose: boolean;
|
|
30
|
+
/** The active output style; empty for none. */
|
|
31
|
+
output_style: string;
|
|
32
|
+
/** The styles that can be chosen. */
|
|
33
|
+
output_styles: string[];
|
|
34
|
+
/** `auto`, `light` or `dark`. */
|
|
35
|
+
color_theme: string;
|
|
36
|
+
show_reasoning: boolean;
|
|
37
|
+
show_tool_calls: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Whether igni can reach a model and its server. */
|
|
41
|
+
export interface Connection {
|
|
42
|
+
cloud_connected: boolean;
|
|
43
|
+
/** False when runs would reach no model. */
|
|
44
|
+
model_configured: boolean;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** A newer igni than the one running. */
|
|
48
|
+
export interface UpdateInfo {
|
|
49
|
+
current_version: string;
|
|
50
|
+
latest_version: string;
|
|
51
|
+
download_url: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** One key of an extension's own state. */
|
|
55
|
+
export interface StateChange {
|
|
56
|
+
key: string;
|
|
57
|
+
/** `None` when the key was deleted. */
|
|
58
|
+
value?: string | null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** One igni window: a desktop window or a browser tab. */
|
|
62
|
+
export interface WindowInfo {
|
|
63
|
+
/** Stable across reloads of the same window. */
|
|
64
|
+
id: string;
|
|
65
|
+
/** `tauri` or `web`. */
|
|
66
|
+
kind: string;
|
|
67
|
+
connected: boolean;
|
|
68
|
+
/** Whether the person is using this window: it has focus. */
|
|
69
|
+
focused: boolean;
|
|
70
|
+
/** The session it shows. */
|
|
71
|
+
session_id?: string | null;
|
|
72
|
+
project_dir?: string | null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** One level of a window's page stack. */
|
|
76
|
+
export interface Page {
|
|
77
|
+
/** `plugins`, `extensions`, an extension's page kind, … */
|
|
78
|
+
kind: string;
|
|
79
|
+
label: string;
|
|
80
|
+
params?: Record<string, string>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Where a window is: its page stack, empty for the chat. */
|
|
84
|
+
export interface Route {
|
|
85
|
+
window: string;
|
|
86
|
+
pages: Page[];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** The panel open over a window's chat: `notifications`, `search` (find in the conversation), `login` or `dir-picker`. One at a time. */
|
|
90
|
+
export interface Panel {
|
|
91
|
+
kind: string;
|
|
92
|
+
params?: Record<string, JsonValue>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** A window's panel opened or closed. */
|
|
96
|
+
export interface PanelChange {
|
|
97
|
+
window: string;
|
|
98
|
+
panel?: Panel | null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** A window's sidebar. */
|
|
102
|
+
export interface Sidebar {
|
|
103
|
+
open: boolean;
|
|
104
|
+
/** Its width in pixels; `None` for igni's own. */
|
|
105
|
+
width?: number | null;
|
|
106
|
+
/** The part of it in view: `links` (the destinations) or `sessions`. */
|
|
107
|
+
section?: string | null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** A window's sidebar changed. */
|
|
111
|
+
export interface SidebarChange {
|
|
112
|
+
window: string;
|
|
113
|
+
sidebar: Sidebar;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** The file previewed in a window. */
|
|
117
|
+
export interface Preview {
|
|
118
|
+
path: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** A window's preview changed. */
|
|
122
|
+
export interface PreviewChange {
|
|
123
|
+
window: string;
|
|
124
|
+
preview?: Preview | null;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** What is selected in a window. Each part is independent; `None` for nothing. */
|
|
128
|
+
export interface SelectionState {
|
|
129
|
+
/** The highlighted message, by the run it belongs to (`run_id` in `chat.messages` and the run signals). */
|
|
130
|
+
message_id?: string | null;
|
|
131
|
+
/** Text selected in the transcript. */
|
|
132
|
+
text?: string | null;
|
|
133
|
+
/** The file last picked: a file pill, a reference. */
|
|
134
|
+
file?: string | null;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** A window's selection changed. */
|
|
138
|
+
export interface SelectionChange {
|
|
139
|
+
window: string;
|
|
140
|
+
selection: SelectionState;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** A window's composer. */
|
|
144
|
+
export interface Composer {
|
|
145
|
+
/** The draft, without the mode's `/` or `$`. */
|
|
146
|
+
text: string;
|
|
147
|
+
/** The files the draft refers to (`@path`), in order. */
|
|
148
|
+
attachments?: string[];
|
|
149
|
+
/** `chat`, `command` (a slash command) or `shell` (a `$` line). */
|
|
150
|
+
mode?: string | null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** A window's draft changed. */
|
|
154
|
+
export interface ComposerChange {
|
|
155
|
+
window: string;
|
|
156
|
+
composer: Composer;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** A transient message on screen. */
|
|
160
|
+
export interface Toast {
|
|
161
|
+
/** Always `toast`: what this is. */
|
|
162
|
+
type: string;
|
|
163
|
+
id: string;
|
|
164
|
+
/** Its first line. */
|
|
165
|
+
text: string;
|
|
166
|
+
/** `info`, `success`, `warning` or `error`. */
|
|
167
|
+
kind: string;
|
|
168
|
+
/** A second line. */
|
|
169
|
+
body?: string | null;
|
|
170
|
+
/** Where clicking it goes. */
|
|
171
|
+
target?: Page | null;
|
|
172
|
+
/** The extension that showed it; `None` for igni. */
|
|
173
|
+
source?: string | null;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** A toast appeared or went away. */
|
|
177
|
+
export interface ToastChange {
|
|
178
|
+
window: string;
|
|
179
|
+
toast: Toast;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** A dialog on screen: igni's own (`spec.kind` is `update`) or an extension's (`show_dialog`). One at a time; a new one replaces the last, which closes unanswered. */
|
|
183
|
+
export interface Dialog {
|
|
184
|
+
/** Always `dialog`: what this is. */
|
|
185
|
+
type: string;
|
|
186
|
+
id: string;
|
|
187
|
+
spec: JsonValue;
|
|
188
|
+
/** The extension that asked; `None` for igni. */
|
|
189
|
+
source?: string | null;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/** A dialog opened or closed. */
|
|
193
|
+
export interface DialogChange {
|
|
194
|
+
window: string;
|
|
195
|
+
dialog: Dialog;
|
|
196
|
+
/** What the person answered, when it closed: `{button, value}`; `None` when it was dismissed or replaced. */
|
|
197
|
+
answer?: JsonValue;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** Where a window's transcript is scrolled to. */
|
|
201
|
+
export interface Scroll {
|
|
202
|
+
/** The message at the top of the view, by its run; `None` for none. */
|
|
203
|
+
message_id?: string | null;
|
|
204
|
+
/** Following the newest message. */
|
|
205
|
+
at_bottom: boolean;
|
|
206
|
+
/** The window, in a signal. */
|
|
207
|
+
window?: string | null;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/** One session, as the session list shows it. */
|
|
211
|
+
export interface SessionInfo {
|
|
212
|
+
session_id: string;
|
|
213
|
+
name: string;
|
|
214
|
+
created_at: number;
|
|
215
|
+
updated_at: number;
|
|
216
|
+
run_count: number;
|
|
217
|
+
summary: string;
|
|
218
|
+
agent_name: string;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** A window moved to another session. */
|
|
222
|
+
export interface SessionChange {
|
|
223
|
+
session_id: string;
|
|
224
|
+
window?: string | null;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** The session list, as it was just read. */
|
|
228
|
+
export interface SessionList {
|
|
229
|
+
sessions: SessionInfo[];
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** `/clear`: a session carries on under a new id. */
|
|
233
|
+
export interface SessionCleared {
|
|
234
|
+
session_id: string;
|
|
235
|
+
new_session_id: string;
|
|
236
|
+
summary: string;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/** A session was given its name. */
|
|
240
|
+
export interface SessionNamed {
|
|
241
|
+
session_id: string;
|
|
242
|
+
name: string;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** A session bound, and the folder it works in. */
|
|
246
|
+
export interface SessionAttached {
|
|
247
|
+
session_id: string;
|
|
248
|
+
project_dir: string;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** A message posted in a chat. */
|
|
252
|
+
export interface ChatMessage {
|
|
253
|
+
session_id: string;
|
|
254
|
+
text: string;
|
|
255
|
+
/** For the next turn rather than now. */
|
|
256
|
+
queued: boolean;
|
|
257
|
+
/** The extension that posted it, or whose service sent it; `None` for the person. */
|
|
258
|
+
from_extension?: string | null;
|
|
259
|
+
/** The client id of the service that sent it, when the extension's service did (a message item, posted as sent); `None` for a post an extension made itself and for the person's. */
|
|
260
|
+
from_service?: string | null;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/** Turns were removed from a session's history. */
|
|
264
|
+
export interface HistoryChange {
|
|
265
|
+
session_id: string;
|
|
266
|
+
/** `truncated` or `discarded`. */
|
|
267
|
+
what: string;
|
|
268
|
+
/** The run removed from, or the message discarded. */
|
|
269
|
+
run_id: string;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** A piece of the agent's answer as it streams. */
|
|
273
|
+
export interface ContentDelta {
|
|
274
|
+
session_id: string;
|
|
275
|
+
text: string;
|
|
276
|
+
thinking: boolean;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/** Which run. */
|
|
280
|
+
export interface RunRef {
|
|
281
|
+
session_id: string;
|
|
282
|
+
run_id: string;
|
|
283
|
+
/** Set for a sub-agent's run. */
|
|
284
|
+
parent_run_id: string;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/** A run started. */
|
|
288
|
+
export interface RunStart {
|
|
289
|
+
session_id: string;
|
|
290
|
+
run_id: string;
|
|
291
|
+
parent_run_id: string;
|
|
292
|
+
agent_name: string;
|
|
293
|
+
model: string;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/** A finished run. */
|
|
297
|
+
export interface Run {
|
|
298
|
+
session_id: string;
|
|
299
|
+
run_id: string;
|
|
300
|
+
parent_run_id: string;
|
|
301
|
+
input_tokens: number;
|
|
302
|
+
output_tokens: number;
|
|
303
|
+
reasoning_tokens: number;
|
|
304
|
+
/** Seconds. */
|
|
305
|
+
duration: number;
|
|
306
|
+
/** Files the run edited, relative to the project — only those within the extension's workspace grant, and none without one. */
|
|
307
|
+
changed_files: string[];
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/** A run stopped with an error. */
|
|
311
|
+
export interface RunFailure {
|
|
312
|
+
session_id: string;
|
|
313
|
+
error: string;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/** The agent asking to act. */
|
|
317
|
+
export interface Approval {
|
|
318
|
+
requirement_id: string;
|
|
319
|
+
session_id: string;
|
|
320
|
+
tool_name: string;
|
|
321
|
+
friendly_name: string;
|
|
322
|
+
tool_args: JsonValue;
|
|
323
|
+
details: string;
|
|
324
|
+
/** Which sub-agent is asking, outermost first. */
|
|
325
|
+
agent_path: string[];
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/** A run waiting on approvals. */
|
|
329
|
+
export interface RunPause {
|
|
330
|
+
session_id: string;
|
|
331
|
+
run_id: string;
|
|
332
|
+
requirements: Approval[];
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/** An approval was answered, by anyone. */
|
|
336
|
+
export interface ApprovalResolved {
|
|
337
|
+
session_id: string;
|
|
338
|
+
requirement_id: string;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/** An approval began or stopped waiting on a person — however it ended: answered in a window or through the API, after a restart, or dropped with its run. */
|
|
342
|
+
export interface ApprovalChange {
|
|
343
|
+
session_id: string;
|
|
344
|
+
requirement_id: string;
|
|
345
|
+
run_id: string;
|
|
346
|
+
/** `waiting` or `resolved`. */
|
|
347
|
+
state: string;
|
|
348
|
+
/** `main` (the main agent) or `sub_agent`. */
|
|
349
|
+
origin: string;
|
|
350
|
+
/** The tool asked about; empty when resolved. */
|
|
351
|
+
tool_name: string;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/** One session's share of `Activity`. */
|
|
355
|
+
export interface SessionActivity {
|
|
356
|
+
session_id: string;
|
|
357
|
+
/** `idle`, `waiting` or `running`. */
|
|
358
|
+
state: string;
|
|
359
|
+
waiting_approvals: number;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/** Whether igni is doing anything. A run waiting only on a person — on an approval, its own or a sub-agent's — is `waiting`, not `running`: nothing happens until the decision, so the process may be suspended and the decision wakes it. */
|
|
363
|
+
export interface Activity {
|
|
364
|
+
/** `idle`, `waiting` or `running`. */
|
|
365
|
+
state: string;
|
|
366
|
+
/** Nothing is running and nothing is busy. */
|
|
367
|
+
suspendable: boolean;
|
|
368
|
+
waiting_approvals: number;
|
|
369
|
+
sessions: SessionActivity[];
|
|
370
|
+
/** What holds igni busy outside a run's turn: calls out, scheduled tasks, processes, extensions that said they are working (`self.busy`). */
|
|
371
|
+
busy: BusyLease[];
|
|
372
|
+
/** When something is next due while nothing runs (ISO 8601, UTC): when a suspended igni should be woken. */
|
|
373
|
+
wake_at: string | null;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/** One thing igni is busy with. A lease with `expires_at` stops counting then, whether or not it was let go. */
|
|
377
|
+
export interface BusyLease {
|
|
378
|
+
id: string;
|
|
379
|
+
/** `post_run`, `model_call`, `http_call`, `mcp_call`, `extension_call`, `scheduled_task`, `process`, `monitor`, `extension` or `background`. */
|
|
380
|
+
kind: string;
|
|
381
|
+
/** Who holds it: an extension id, a server, a task. */
|
|
382
|
+
holder: string;
|
|
383
|
+
reason: string;
|
|
384
|
+
/** ISO 8601. */
|
|
385
|
+
since: string;
|
|
386
|
+
/** ISO 8601; `None` until let go. */
|
|
387
|
+
expires_at: string | null;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/** The reason for an approval, arriving after it. */
|
|
391
|
+
export interface ApprovalDetails {
|
|
392
|
+
session_id: string;
|
|
393
|
+
requirement_id: string;
|
|
394
|
+
details: string;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/** One answer to one approval. */
|
|
398
|
+
export interface ApprovalAnswer {
|
|
399
|
+
requirement_id: string;
|
|
400
|
+
/** `confirm` or `reject`. */
|
|
401
|
+
action: string;
|
|
402
|
+
/** `once`, `always` or `similar`; empty with `reject`. */
|
|
403
|
+
choice?: string;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/** The agent started calling a tool. */
|
|
407
|
+
export interface ToolCall {
|
|
408
|
+
session_id: string;
|
|
409
|
+
run_id: string;
|
|
410
|
+
parent_run_id: string;
|
|
411
|
+
tool_name: string;
|
|
412
|
+
friendly_name: string;
|
|
413
|
+
args_summary: string;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/** A tool call finished. */
|
|
417
|
+
export interface ToolResult {
|
|
418
|
+
session_id: string;
|
|
419
|
+
run_id: string;
|
|
420
|
+
parent_run_id: string;
|
|
421
|
+
summary: string;
|
|
422
|
+
is_error: boolean;
|
|
423
|
+
is_rejected: boolean;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/** A tool call failed. */
|
|
427
|
+
export interface ToolFailure {
|
|
428
|
+
session_id: string;
|
|
429
|
+
run_id: string;
|
|
430
|
+
parent_run_id: string;
|
|
431
|
+
error: string;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/** One model call's tokens. */
|
|
435
|
+
export interface ModelUsage {
|
|
436
|
+
session_id: string;
|
|
437
|
+
run_id: string;
|
|
438
|
+
parent_run_id: string;
|
|
439
|
+
input_tokens: number;
|
|
440
|
+
output_tokens: number;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/** Someone's draft in a session, live. */
|
|
444
|
+
export interface Typing {
|
|
445
|
+
session_id: string;
|
|
446
|
+
text: string;
|
|
447
|
+
window?: string | null;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/** A session's status line. */
|
|
451
|
+
export interface Status {
|
|
452
|
+
session_id: string;
|
|
453
|
+
model: string;
|
|
454
|
+
model_configured: boolean;
|
|
455
|
+
permission_mode: string;
|
|
456
|
+
input_tokens: number;
|
|
457
|
+
output_tokens: number;
|
|
458
|
+
context_tokens: number;
|
|
459
|
+
max_context: number;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/** An info or error line in a session. */
|
|
463
|
+
export interface Notice {
|
|
464
|
+
session_id: string;
|
|
465
|
+
text: string;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/** How full the context is, and with what. */
|
|
469
|
+
export interface ContextUsage {
|
|
470
|
+
tokens: number;
|
|
471
|
+
max: number;
|
|
472
|
+
breakdown: JsonValue;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/** The agent wrote a file. */
|
|
476
|
+
export interface FileEdited {
|
|
477
|
+
session_id: string;
|
|
478
|
+
/** Relative to the project; only within the workspace grant. */
|
|
479
|
+
path: string;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/** Progress of a sub-agent or a team, as the transcript shows it. */
|
|
483
|
+
export interface AgentEvent {
|
|
484
|
+
session_id: string;
|
|
485
|
+
kind: string;
|
|
486
|
+
payload: JsonValue;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/** A network call being retried, and whether it recovered. */
|
|
490
|
+
export interface Retry {
|
|
491
|
+
session_id: string;
|
|
492
|
+
/** `attempt` or `succeeded`. */
|
|
493
|
+
kind: string;
|
|
494
|
+
payload: JsonValue;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/** A json-render block in the transcript. */
|
|
498
|
+
export interface View {
|
|
499
|
+
view_id: string;
|
|
500
|
+
session_id: string;
|
|
501
|
+
title: string;
|
|
502
|
+
/** A json-render spec: `{root, elements}`. */
|
|
503
|
+
spec: JsonValue;
|
|
504
|
+
/** `visualizer`, or the extension that appended it. */
|
|
505
|
+
source: string;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/** The person used a control inside a view. */
|
|
509
|
+
export interface ViewAction {
|
|
510
|
+
session_id: string;
|
|
511
|
+
action: string;
|
|
512
|
+
params: JsonValue;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/** The plan the agent proposed in plan mode. */
|
|
516
|
+
export interface Plan {
|
|
517
|
+
latest: string;
|
|
518
|
+
history: string[];
|
|
519
|
+
/** The todo list the plan carries. */
|
|
520
|
+
tasks: TodoItem[];
|
|
521
|
+
/** `pending`, or empty when there is none. */
|
|
522
|
+
state: string;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/** A plan was submitted or decided. */
|
|
526
|
+
export interface PlanChange {
|
|
527
|
+
session_id: string;
|
|
528
|
+
/** `submitted` or `decided`. */
|
|
529
|
+
kind: string;
|
|
530
|
+
payload: JsonValue;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/** A sub-agent task created or updated. */
|
|
534
|
+
export interface TaskEvent {
|
|
535
|
+
session_id: string;
|
|
536
|
+
task_id: string;
|
|
537
|
+
title: string;
|
|
538
|
+
assignee: string;
|
|
539
|
+
status: string;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/** A task loop's iteration count. */
|
|
543
|
+
export interface TaskIteration {
|
|
544
|
+
session_id: string;
|
|
545
|
+
iteration: number;
|
|
546
|
+
max_iterations: number;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/** Every task, as it now stands. */
|
|
550
|
+
export interface TaskSnapshot {
|
|
551
|
+
session_id: string;
|
|
552
|
+
tasks: JsonValue[];
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/** The agent's todo list. */
|
|
556
|
+
export interface Todos {
|
|
557
|
+
session_id: string;
|
|
558
|
+
todos: TodoItem[];
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/** `/loop`, as it stands. */
|
|
562
|
+
export interface LoopStatus {
|
|
563
|
+
active: boolean;
|
|
564
|
+
paused: boolean;
|
|
565
|
+
prompt: string;
|
|
566
|
+
iteration_index: number;
|
|
567
|
+
iterations_remaining: number;
|
|
568
|
+
cap_explicit: boolean;
|
|
569
|
+
/** How many iterations were announced, when it is known. */
|
|
570
|
+
announced_total: number | null;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/** What a slash command answered. */
|
|
574
|
+
export interface CommandOutcome {
|
|
575
|
+
kind: string;
|
|
576
|
+
content: string;
|
|
577
|
+
display_content: string;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/** Something in a collection changed; read it again. */
|
|
581
|
+
export interface CollectionChange {
|
|
582
|
+
/** What happened: `connected`, `installed`, `event`, … */
|
|
583
|
+
what: string;
|
|
584
|
+
/** Which item, when there is one. */
|
|
585
|
+
name?: string | null;
|
|
586
|
+
/** The host's report of it. */
|
|
587
|
+
payload?: JsonValue;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/** A workflow started. */
|
|
591
|
+
export interface WorkflowRun {
|
|
592
|
+
workflow_run_id: string;
|
|
593
|
+
name: string;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
/** A scheduled task started, finished or changed. */
|
|
597
|
+
export interface SchedulerEvent {
|
|
598
|
+
kind: string;
|
|
599
|
+
task_id: string;
|
|
600
|
+
description: string;
|
|
601
|
+
result: string;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/** A background shell started, printed, or exited. */
|
|
605
|
+
export interface ProcessEvent {
|
|
606
|
+
/** `started`, `line`, `exited` or `done`. */
|
|
607
|
+
kind: string;
|
|
608
|
+
payload: JsonValue;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
/** The project's git HEAD. */
|
|
612
|
+
export interface Head {
|
|
613
|
+
commit_sha: string;
|
|
614
|
+
branch: string;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/** Files git sees as changed, within the extension's workspace grant. */
|
|
618
|
+
export interface FilesChanged {
|
|
619
|
+
paths: string[];
|
|
620
|
+
/** The list was capped: rescan rather than trust it. */
|
|
621
|
+
truncated: boolean;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/** The model in use changed. */
|
|
625
|
+
export interface ModelChange {
|
|
626
|
+
current: string;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
/** An installed extension. */
|
|
630
|
+
export interface ExtensionInfo {
|
|
631
|
+
id: string;
|
|
632
|
+
name: string;
|
|
633
|
+
version: string;
|
|
634
|
+
/** `PREPARING`, `READY`, `FAILED` or `DISABLED`. */
|
|
635
|
+
state: string;
|
|
636
|
+
/** Why it is not READY, and what to do. */
|
|
637
|
+
reason: string;
|
|
638
|
+
/** Its home on the web — its service's URL, which is the service's `client_uri` — when one is known. */
|
|
639
|
+
web_url?: string | null;
|
|
640
|
+
/** What it does not get: a collision with an extension higher in the super admin's priority order (the reason begins `lower priority than <extension>`), or an override whose text lacks the sections its manifest declares. */
|
|
641
|
+
switched_off: Withheld[];
|
|
642
|
+
/** Its prompt edits that land nowhere: another extension overrides that prompt, and its override has no section the edit names. */
|
|
643
|
+
dropped: Withheld[];
|
|
644
|
+
/** Why it is faulty — its calls timed out or crashed three times in a row, so igni restarted it and does not wait on its hooks — or empty while it answers. The first answer after the restart clears it. */
|
|
645
|
+
faulty: string;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
/** One thing an extension declared and does not get, and why. */
|
|
649
|
+
export interface Withheld {
|
|
650
|
+
/** `prompt:main`, `prompt:main#workflow`, `prompt:agent:explorer+notes`, `command:/review`, `anchor:NAME`. */
|
|
651
|
+
claim: string;
|
|
652
|
+
reason: string;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
/** An extension's health moved. */
|
|
656
|
+
export interface ExtensionStateChange {
|
|
657
|
+
extension_id: string;
|
|
658
|
+
state: string;
|
|
659
|
+
reason: string;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/** The session's permission mode changed. */
|
|
663
|
+
export interface PermissionModeChange {
|
|
664
|
+
mode: string;
|
|
665
|
+
/** The mode before this one; `None` when the push named none. */
|
|
666
|
+
previous?: string | null;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
/** Who is signed in to igni, without any credential. */
|
|
670
|
+
export interface Account {
|
|
671
|
+
signed_in: boolean;
|
|
672
|
+
email: string;
|
|
673
|
+
name: string;
|
|
674
|
+
org: string;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
/** Where opening a notification goes: one of an extension's pages. */
|
|
678
|
+
export interface NotificationTarget {
|
|
679
|
+
page: string;
|
|
680
|
+
params?: Record<string, string>;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
/** One notification, from igni server or from an extension on this machine. */
|
|
684
|
+
export interface NotificationEntry {
|
|
685
|
+
id: string;
|
|
686
|
+
/** `server` or `local`. */
|
|
687
|
+
origin: string;
|
|
688
|
+
/** The extension it belongs to. */
|
|
689
|
+
source: string;
|
|
690
|
+
kind: string;
|
|
691
|
+
title: string;
|
|
692
|
+
body: string;
|
|
693
|
+
actor: string;
|
|
694
|
+
target?: NotificationTarget | null;
|
|
695
|
+
/** ISO 8601. */
|
|
696
|
+
created_at?: string | null;
|
|
697
|
+
read: boolean;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/** Unread notifications, in all and per extension. */
|
|
701
|
+
export interface NotificationCounts {
|
|
702
|
+
unread: number;
|
|
703
|
+
by_source: Record<string, number>;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
/** Something to tell the person at this machine. It never leaves it. */
|
|
707
|
+
export interface LocalNotification {
|
|
708
|
+
/** The extension's word for what happened. */
|
|
709
|
+
kind: string;
|
|
710
|
+
title: string;
|
|
711
|
+
/** One line. */
|
|
712
|
+
body?: string;
|
|
713
|
+
/** One of this extension's pages. */
|
|
714
|
+
target: NotificationTarget;
|
|
715
|
+
/** The same event is shown once, however often it is sent. */
|
|
716
|
+
event_key: string;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
/** An extension's settings, as now configured. */
|
|
720
|
+
export interface SettingsChange {
|
|
721
|
+
values: Record<string, JsonValue>;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
/** One typed question about a context. It quotes the context's fields by name in backticks, as in: Is `diff` only a refactor? */
|
|
725
|
+
export interface DecisionQuestion {
|
|
726
|
+
/** Its name in the answers: a lowercase name. */
|
|
727
|
+
id: string;
|
|
728
|
+
/** `choice` (one of `options`), `score` (one of `levels`, lowest first) or `noul` (yes or no — Laya's name for it). */
|
|
729
|
+
kind: string;
|
|
730
|
+
/** The question, up to 500 characters. */
|
|
731
|
+
question: string;
|
|
732
|
+
/** `choice` only: 2–20 labels, each to what it means (empty when the label says it). */
|
|
733
|
+
options?: Record<string, string> | null;
|
|
734
|
+
/** `score` only: 2–10 level labels, lowest first. */
|
|
735
|
+
levels?: string[] | null;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/** One question's answer, with the probabilities it came from. */
|
|
739
|
+
export interface DecisionAnswer {
|
|
740
|
+
kind: string;
|
|
741
|
+
/** The option chosen, the level reached, or `yes` / `no`. */
|
|
742
|
+
answer: string;
|
|
743
|
+
/** The probability of that answer. */
|
|
744
|
+
confidence: number;
|
|
745
|
+
/** Every option's, level's, or `yes` and `no`'s probability. */
|
|
746
|
+
probabilities: Record<string, number>;
|
|
747
|
+
/** `score` only: the expected level, 0 the lowest. */
|
|
748
|
+
score?: number | null;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
/** Every question's answer about one context. */
|
|
752
|
+
export interface Decision {
|
|
753
|
+
/** By question id. */
|
|
754
|
+
answers: Record<string, DecisionAnswer>;
|
|
755
|
+
/** The Laya checkpoint that answered: `english` or `multilingual`. */
|
|
756
|
+
model: string;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/** Every model igni knows: the default, the ceiling, and the rows. */
|
|
760
|
+
export interface ModelRegistry {
|
|
761
|
+
/** The model used unless another is chosen. */
|
|
762
|
+
default: string;
|
|
763
|
+
/** The largest context window any model has. */
|
|
764
|
+
max_context_window: number;
|
|
765
|
+
/** The rows, by model id. */
|
|
766
|
+
registry: Record<string, ModelEntry>;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/** One model in the registry — and never its credential: only whether it has a key. */
|
|
770
|
+
export interface ModelEntry {
|
|
771
|
+
model_id: string;
|
|
772
|
+
provider: string;
|
|
773
|
+
/** The endpoint, when the provider names one. */
|
|
774
|
+
url: string | null;
|
|
775
|
+
/** Whether the entry says where its key comes from. Never the key, never the environment variable, never the command. */
|
|
776
|
+
has_api_key: boolean;
|
|
777
|
+
temperature: number | null;
|
|
778
|
+
max_tokens: number | null;
|
|
779
|
+
/** Seconds before a request to it is given up on. */
|
|
780
|
+
timeout: number;
|
|
781
|
+
/** Whether it reads images. */
|
|
782
|
+
vision: boolean;
|
|
783
|
+
context_window: number | null;
|
|
784
|
+
/** How it is asked to think. */
|
|
785
|
+
thinking: Record<string, JsonValue> | null;
|
|
786
|
+
effort: string | null;
|
|
787
|
+
prompt_caching: boolean;
|
|
788
|
+
/** Where the entry came from: `cloud` or the local configuration. */
|
|
789
|
+
source: string;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
/** One MCP server: its name, and whether it is connected. */
|
|
793
|
+
export interface McpServer {
|
|
794
|
+
name: string;
|
|
795
|
+
connected: boolean;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
/** One MCP server and what it carries. */
|
|
799
|
+
export interface McpServerDetails {
|
|
800
|
+
name: string;
|
|
801
|
+
connected: boolean;
|
|
802
|
+
transport: string;
|
|
803
|
+
/** The tools it offers. */
|
|
804
|
+
tool_names: string[];
|
|
805
|
+
/** What each tool says it does. */
|
|
806
|
+
tool_descriptions: Record<string, string>;
|
|
807
|
+
/** The tools withheld from the agent. */
|
|
808
|
+
tools_disabled: string[];
|
|
809
|
+
/** The resources it offers. */
|
|
810
|
+
resources: McpResource[];
|
|
811
|
+
/** The prompts it offers. */
|
|
812
|
+
prompts: McpPrompt[];
|
|
813
|
+
/** Why it is not working, when it is not. */
|
|
814
|
+
error: string;
|
|
815
|
+
/** Whether the group's policy forbade it. */
|
|
816
|
+
policy_blocked: boolean;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
/** One resource an MCP server offers. */
|
|
820
|
+
export interface McpResource {
|
|
821
|
+
uri: string;
|
|
822
|
+
name: string;
|
|
823
|
+
description: string;
|
|
824
|
+
mime_type: string;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
/** One prompt an MCP server offers. */
|
|
828
|
+
export interface McpPrompt {
|
|
829
|
+
name: string;
|
|
830
|
+
description: string;
|
|
831
|
+
/** The arguments it takes. */
|
|
832
|
+
arguments: string[];
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
/** What starting the MCP servers did. */
|
|
836
|
+
export interface McpInit {
|
|
837
|
+
/** The servers that are now connected. */
|
|
838
|
+
connected: string[];
|
|
839
|
+
/** The servers that did not, and why. */
|
|
840
|
+
failed: Record<string, string>;
|
|
841
|
+
/** Whether the clients were rebuilt. */
|
|
842
|
+
rebuilt: boolean;
|
|
843
|
+
/** Why nothing was started, when nothing was: `already_initialized`, `no_configured_servers` or `no_clients_connected`. */
|
|
844
|
+
skipped_reason: string | null;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
/** One tool of one server, offered or withheld. */
|
|
848
|
+
export interface McpToolToggle {
|
|
849
|
+
server: string;
|
|
850
|
+
tool: string;
|
|
851
|
+
enabled: boolean;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
/** One installed plugin. */
|
|
855
|
+
export interface PluginInfo {
|
|
856
|
+
name: string;
|
|
857
|
+
version: string;
|
|
858
|
+
description: string;
|
|
859
|
+
/** Where it was installed from. */
|
|
860
|
+
source_root: string;
|
|
861
|
+
/** Where it lives on this machine. */
|
|
862
|
+
path: string;
|
|
863
|
+
enabled: boolean;
|
|
864
|
+
has_skills: boolean;
|
|
865
|
+
has_agents: boolean;
|
|
866
|
+
has_hooks: boolean;
|
|
867
|
+
has_mcp: boolean;
|
|
868
|
+
has_tools: boolean;
|
|
869
|
+
has_lsp: boolean;
|
|
870
|
+
has_monitors: boolean;
|
|
871
|
+
/** Whether igni keeps it up to date itself. */
|
|
872
|
+
managed: boolean;
|
|
873
|
+
/** The version it is pinned to, when it is. */
|
|
874
|
+
pin: string;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
/** One marketplace of plugins. */
|
|
878
|
+
export interface Marketplace {
|
|
879
|
+
name: string;
|
|
880
|
+
url: string;
|
|
881
|
+
/** When it was last read. */
|
|
882
|
+
last_fetched: string;
|
|
883
|
+
/** The plugins it offers. */
|
|
884
|
+
plugins: MarketplacePlugin[];
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
/** One plugin a marketplace offers. */
|
|
888
|
+
export interface MarketplacePlugin {
|
|
889
|
+
name: string;
|
|
890
|
+
source: string;
|
|
891
|
+
description: string;
|
|
892
|
+
version: string;
|
|
893
|
+
branch: string;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
/** What a plugin carries. */
|
|
897
|
+
export interface PluginContents {
|
|
898
|
+
name: string;
|
|
899
|
+
/** Where it lives on this machine. */
|
|
900
|
+
root_path: string;
|
|
901
|
+
skills: PluginSkill[];
|
|
902
|
+
agents: PluginAgent[];
|
|
903
|
+
hooks: PluginHook[];
|
|
904
|
+
mcp_servers: PluginMcpServer[];
|
|
905
|
+
tools: PluginTool[];
|
|
906
|
+
readme: string;
|
|
907
|
+
/** Why it could not be read, when it could not. */
|
|
908
|
+
error: string;
|
|
909
|
+
/** Where it would come from. */
|
|
910
|
+
preview_source: PluginPreviewSource | null;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
/** One skill a plugin carries. */
|
|
914
|
+
export interface PluginSkill {
|
|
915
|
+
name: string;
|
|
916
|
+
description: string;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
/** One agent a plugin carries. */
|
|
920
|
+
export interface PluginAgent {
|
|
921
|
+
name: string;
|
|
922
|
+
description: string;
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
/** One hook a plugin carries: the event, and how many it registers. */
|
|
926
|
+
export interface PluginHook {
|
|
927
|
+
event: string;
|
|
928
|
+
count: number;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
/** One MCP server a plugin carries. */
|
|
932
|
+
export interface PluginMcpServer {
|
|
933
|
+
name: string;
|
|
934
|
+
transport: string;
|
|
935
|
+
command: string;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
/** One tool a plugin carries. */
|
|
939
|
+
export interface PluginTool {
|
|
940
|
+
name: string;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
/** Where a plugin would come from. */
|
|
944
|
+
export interface PluginPreviewSource {
|
|
945
|
+
url: string;
|
|
946
|
+
subdir: string;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
/** One hook igni has. */
|
|
950
|
+
export interface HookEntry {
|
|
951
|
+
event: string;
|
|
952
|
+
/** How it runs: `command`, `url` or another. */
|
|
953
|
+
type: string;
|
|
954
|
+
command: string;
|
|
955
|
+
url: string;
|
|
956
|
+
/** What it matches, when it matches something. */
|
|
957
|
+
matcher: string;
|
|
958
|
+
timeout_ms: number;
|
|
959
|
+
background: boolean;
|
|
960
|
+
/** The names of the headers an `http` hook sends. Never their values, which may be credentials. */
|
|
961
|
+
header_names: string[];
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
/** The group's policy pack. */
|
|
965
|
+
export interface PolicyPack {
|
|
966
|
+
group_id: string | null;
|
|
967
|
+
group_name: string | null;
|
|
968
|
+
fetched_at: string | null;
|
|
969
|
+
/** How many rules it holds. */
|
|
970
|
+
entry_count: number;
|
|
971
|
+
/** The model it points every group at. */
|
|
972
|
+
default_model: string | null;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
/** What was decided about a plan. */
|
|
976
|
+
export interface PlanDecision {
|
|
977
|
+
/** The run the plan belonged to. */
|
|
978
|
+
run_id: string;
|
|
979
|
+
/** `approved` or `dismissed`. */
|
|
980
|
+
decision: string;
|
|
981
|
+
/** What the plan mode says now. */
|
|
982
|
+
mode_status: string;
|
|
983
|
+
ok: boolean;
|
|
984
|
+
/** Why it went wrong, when it did. */
|
|
985
|
+
error: string | null;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
/** One item of the agent's todo list. */
|
|
989
|
+
export interface TodoItem {
|
|
990
|
+
/** What is to be done, as an imperative. */
|
|
991
|
+
content: string;
|
|
992
|
+
/** `pending`, `in_progress` or `completed`. */
|
|
993
|
+
status: string;
|
|
994
|
+
/** What is shown while it is in progress — the gerund, e.g. `Running tests`. */
|
|
995
|
+
activeForm: string;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
/** One iteration of a loop, taken. */
|
|
999
|
+
export interface LoopAdvance {
|
|
1000
|
+
/** `completed`, `safety_paused` or `step`. */
|
|
1001
|
+
kind: string;
|
|
1002
|
+
completed: boolean;
|
|
1003
|
+
total_iterations: number;
|
|
1004
|
+
safety_cap_paused: boolean;
|
|
1005
|
+
prompt: string;
|
|
1006
|
+
display_prompt: string;
|
|
1007
|
+
iteration: number;
|
|
1008
|
+
remaining: number;
|
|
1009
|
+
/** Whether the cap was asked for. */
|
|
1010
|
+
cap_explicit: boolean;
|
|
1011
|
+
/** Whether the cap was extended by itself. */
|
|
1012
|
+
auto_extended: boolean;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
/** One slash command. */
|
|
1016
|
+
export interface SlashCommand {
|
|
1017
|
+
/** `builtin`, `markdown`, `skill` or `extension`. */
|
|
1018
|
+
source: string;
|
|
1019
|
+
/** With its slash: `/ctx`. */
|
|
1020
|
+
name: string;
|
|
1021
|
+
description: string;
|
|
1022
|
+
/** What it takes, as a hint. */
|
|
1023
|
+
argument_hint: string;
|
|
1024
|
+
/** The extension that answers it, when an extension does. */
|
|
1025
|
+
owner?: string | null;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
/** One skill, as the agent is given it. */
|
|
1029
|
+
export interface SkillDefinition {
|
|
1030
|
+
name: string;
|
|
1031
|
+
description: string;
|
|
1032
|
+
/** Its body: what the agent is told to do. */
|
|
1033
|
+
prompt: string;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
/** One skill, as the person sees it. */
|
|
1037
|
+
export interface SkillDetails {
|
|
1038
|
+
name: string;
|
|
1039
|
+
description: string;
|
|
1040
|
+
version: string;
|
|
1041
|
+
category: string;
|
|
1042
|
+
argument_hint: string;
|
|
1043
|
+
context: string;
|
|
1044
|
+
agent: string;
|
|
1045
|
+
/** Whether the person may invoke it as `/name`. */
|
|
1046
|
+
user_invocable: boolean;
|
|
1047
|
+
body: string;
|
|
1048
|
+
/** Where it lives on this machine. */
|
|
1049
|
+
source_dir: string;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
/** One agent. */
|
|
1053
|
+
export interface AgentInfo {
|
|
1054
|
+
name: string;
|
|
1055
|
+
description: string;
|
|
1056
|
+
/** The tools it may use. */
|
|
1057
|
+
tools: string[];
|
|
1058
|
+
model: string;
|
|
1059
|
+
color: string;
|
|
1060
|
+
/** Whether it may run other agents. */
|
|
1061
|
+
can_orchestrate: boolean;
|
|
1062
|
+
/** The MCP servers it is given. */
|
|
1063
|
+
mcp_servers: string[];
|
|
1064
|
+
tags: string[];
|
|
1065
|
+
system_prompt: string;
|
|
1066
|
+
/** Where it lives on this machine. */
|
|
1067
|
+
source_path: string;
|
|
1068
|
+
/** Whether it was made for one task only. */
|
|
1069
|
+
is_ephemeral: boolean;
|
|
1070
|
+
/** The tools it names that do not exist. */
|
|
1071
|
+
unknown_tools: string[];
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
/** What became of an agent made for one task. */
|
|
1075
|
+
export interface PromoteResult {
|
|
1076
|
+
ok: boolean;
|
|
1077
|
+
name: string;
|
|
1078
|
+
/** Where it was kept, when it was. */
|
|
1079
|
+
dest: string;
|
|
1080
|
+
/** Why it was not, when it was not. */
|
|
1081
|
+
reason: string;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
/** What became of an agent made for one task, dropped. */
|
|
1085
|
+
export interface DiscardResult {
|
|
1086
|
+
ok: boolean;
|
|
1087
|
+
name: string;
|
|
1088
|
+
/** Why it was not, when it was not. */
|
|
1089
|
+
reason: string;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
/** One workflow. */
|
|
1093
|
+
export interface Workflow {
|
|
1094
|
+
name: string;
|
|
1095
|
+
description: string;
|
|
1096
|
+
/** When the agent should reach for it. */
|
|
1097
|
+
whenToUse: string;
|
|
1098
|
+
/** The phases it runs through. */
|
|
1099
|
+
phases: WorkflowPhase[];
|
|
1100
|
+
/** Where it lives on this machine. */
|
|
1101
|
+
path: string;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
/** One phase of a workflow. */
|
|
1105
|
+
export interface WorkflowPhase {
|
|
1106
|
+
title: string;
|
|
1107
|
+
detail: string;
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
/** One scheduled task. */
|
|
1111
|
+
export interface ScheduledTask {
|
|
1112
|
+
id: string;
|
|
1113
|
+
/** What the agent is asked to do. */
|
|
1114
|
+
description: string;
|
|
1115
|
+
/** ISO 8601, when it is next due. */
|
|
1116
|
+
scheduled_at: string;
|
|
1117
|
+
/** ISO 8601, when it was made. */
|
|
1118
|
+
created_at: string;
|
|
1119
|
+
/** `pending`, `running`, `completed`, `failed` or `cancelled`. */
|
|
1120
|
+
status: string;
|
|
1121
|
+
/** What it left behind, when it has run. */
|
|
1122
|
+
result: string;
|
|
1123
|
+
/** Why it failed, when it did. */
|
|
1124
|
+
error: string;
|
|
1125
|
+
/** How it repeats, when it does. */
|
|
1126
|
+
recurrence: string;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
/** One background shell. */
|
|
1130
|
+
export interface ProcessRow {
|
|
1131
|
+
pid: number;
|
|
1132
|
+
cmd: string;
|
|
1133
|
+
elapsed_seconds: number;
|
|
1134
|
+
is_running: boolean;
|
|
1135
|
+
/** How it ended, when it has. */
|
|
1136
|
+
exit_code: number | null;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
/** A background shell's last lines. */
|
|
1140
|
+
export interface ProcessTail {
|
|
1141
|
+
pid: number;
|
|
1142
|
+
output: string;
|
|
1143
|
+
is_running: boolean;
|
|
1144
|
+
/** How it ended, when it has. */
|
|
1145
|
+
exit_code: number | null;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
/** What stopping a background shell did. */
|
|
1149
|
+
export interface ProcessStop {
|
|
1150
|
+
pid: number;
|
|
1151
|
+
killed: boolean;
|
|
1152
|
+
message: string;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
/** What a command in the project printed. */
|
|
1156
|
+
export interface ShellResult {
|
|
1157
|
+
output: string;
|
|
1158
|
+
exit_code: number;
|
|
1159
|
+
/** The process's id, once it started; `null` when it could not. */
|
|
1160
|
+
pid: number | null;
|
|
1161
|
+
/** `true` when the command is still running, in the background. */
|
|
1162
|
+
backgrounded: boolean;
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
/** Key–value state of the extension's own, kept by the host across restarts. An extension sees only its own keys. */
|
|
1166
|
+
export class HostAppState extends HostObject {
|
|
1167
|
+
static readonly PATH = "app.state";
|
|
1168
|
+
/** Every key and value. */
|
|
1169
|
+
readonly values: Property<Record<string, string>>;
|
|
1170
|
+
/** A key was set or deleted. */
|
|
1171
|
+
readonly changed: Signal<StateChange>;
|
|
1172
|
+
|
|
1173
|
+
/**
|
|
1174
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1175
|
+
* or session it was reached through.
|
|
1176
|
+
*
|
|
1177
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1178
|
+
* right one, and a second would be a second conversation.
|
|
1179
|
+
*/
|
|
1180
|
+
constructor(
|
|
1181
|
+
link: HostLink,
|
|
1182
|
+
window: string | null = null,
|
|
1183
|
+
session: string | null = null,
|
|
1184
|
+
) {
|
|
1185
|
+
super(link, "app.state", window, session);
|
|
1186
|
+
this.values = new Property(this, "values", false);
|
|
1187
|
+
this.changed = new Signal("app.state.changed");
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
/** One value, or `None`. */
|
|
1191
|
+
get(key: string): Promise<string | null> {
|
|
1192
|
+
return this.call<string | null>("get", { key });
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
/** Store one value. */
|
|
1196
|
+
set(key: string, value: string): Promise<void> {
|
|
1197
|
+
return this.call<void>("set", { key, value });
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
/** Remove one key. */
|
|
1201
|
+
delete(key: string): Promise<void> {
|
|
1202
|
+
return this.call<void>("delete", { key });
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
/** The agent asking to act, and the answers. Through `host.sessions.chat(id)` `waiting` reads that session; an approval is answered only in the session on screen. */
|
|
1207
|
+
export class HostChatApprovals extends HostObject {
|
|
1208
|
+
static readonly PATH = "chat.approvals";
|
|
1209
|
+
/** Requests not yet answered. */
|
|
1210
|
+
readonly waiting: Property<Approval[]>;
|
|
1211
|
+
/** The agent asked. */
|
|
1212
|
+
readonly requested: Signal<Approval>;
|
|
1213
|
+
/** Somebody answered. */
|
|
1214
|
+
readonly resolved: Signal<ApprovalResolved>;
|
|
1215
|
+
/** The reason arrived. */
|
|
1216
|
+
readonly details: Signal<ApprovalDetails>;
|
|
1217
|
+
/** An approval appeared or went away, whoever answered and whenever — including after a restart. For an app following approvals through the API. */
|
|
1218
|
+
readonly changed: Signal<ApprovalChange>;
|
|
1219
|
+
|
|
1220
|
+
/**
|
|
1221
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1222
|
+
* or session it was reached through.
|
|
1223
|
+
*
|
|
1224
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1225
|
+
* right one, and a second would be a second conversation.
|
|
1226
|
+
*/
|
|
1227
|
+
constructor(
|
|
1228
|
+
link: HostLink,
|
|
1229
|
+
window: string | null = null,
|
|
1230
|
+
session: string | null = null,
|
|
1231
|
+
) {
|
|
1232
|
+
super(link, "chat.approvals", window, session);
|
|
1233
|
+
this.waiting = new Property(this, "waiting", false);
|
|
1234
|
+
this.requested = new Signal("chat.approvals.requested");
|
|
1235
|
+
this.resolved = new Signal("chat.approvals.resolved");
|
|
1236
|
+
this.details = new Signal("chat.approvals.details");
|
|
1237
|
+
this.changed = new Signal("chat.approvals.changed");
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
/** Answer one request, as the person's dialog does. */
|
|
1241
|
+
answer(requirement_id: string, action: string, choice?: string): Promise<void> {
|
|
1242
|
+
return this.call<void>("answer", { requirement_id, action, choice });
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
/** Answer every request of a pause at once. */
|
|
1246
|
+
answer_all(answers: ApprovalAnswer[]): Promise<void> {
|
|
1247
|
+
return this.call<void>("answer_all", { answers });
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
/** json-render blocks in the transcript — the visualizer's and extensions'. Through `host.sessions.chat(id)` `list` reads that session; `dispatch` acts only in the session on screen. */
|
|
1252
|
+
export class HostChatViews extends HostObject {
|
|
1253
|
+
static readonly PATH = "chat.views";
|
|
1254
|
+
/** The views in the current session. */
|
|
1255
|
+
readonly list: Property<View[]>;
|
|
1256
|
+
/** A view appeared or was replaced. */
|
|
1257
|
+
readonly shown: Signal<View>;
|
|
1258
|
+
/** The person used a control in a view. */
|
|
1259
|
+
readonly action: Signal<ViewAction>;
|
|
1260
|
+
|
|
1261
|
+
/**
|
|
1262
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1263
|
+
* or session it was reached through.
|
|
1264
|
+
*
|
|
1265
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1266
|
+
* right one, and a second would be a second conversation.
|
|
1267
|
+
*/
|
|
1268
|
+
constructor(
|
|
1269
|
+
link: HostLink,
|
|
1270
|
+
window: string | null = null,
|
|
1271
|
+
session: string | null = null,
|
|
1272
|
+
) {
|
|
1273
|
+
super(link, "chat.views", window, session);
|
|
1274
|
+
this.list = new Property(this, "list", false);
|
|
1275
|
+
this.shown = new Signal("chat.views.shown");
|
|
1276
|
+
this.action = new Signal("chat.views.action");
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
/** Act on a view as if the person had. */
|
|
1280
|
+
dispatch(view_id: string, action: string, params?: Record<string, JsonValue>): Promise<JsonValue> {
|
|
1281
|
+
return this.call<JsonValue>("dispatch", { view_id, action, params });
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
/** igni itself: how it presents things, which version, whether it is connected. */
|
|
1286
|
+
export class HostApp extends HostObject {
|
|
1287
|
+
static readonly PATH = "app";
|
|
1288
|
+
/** `host.app.state`. Key–value state of the extension's own, kept by the host across restarts. An extension sees only its own keys. */
|
|
1289
|
+
readonly state: HostAppState;
|
|
1290
|
+
/** Theme, verbosity, output style. */
|
|
1291
|
+
readonly display: Property<Display>;
|
|
1292
|
+
/** The igni version running. */
|
|
1293
|
+
readonly version: Property<string>;
|
|
1294
|
+
/** A newer igni, as last checked; `None` when there is none or it was not checked yet. */
|
|
1295
|
+
readonly update_available: Property<UpdateInfo | null>;
|
|
1296
|
+
/** Model and server reachability. */
|
|
1297
|
+
readonly connection: Property<Connection>;
|
|
1298
|
+
/** Running, waiting on a person, or idle — what decides whether igni's process may be suspended. */
|
|
1299
|
+
readonly activity: Property<Activity>;
|
|
1300
|
+
/** Verbosity or output style changed. */
|
|
1301
|
+
readonly display_changed: Signal<Display>;
|
|
1302
|
+
/** The connection changed. */
|
|
1303
|
+
readonly connection_changed: Signal<Connection>;
|
|
1304
|
+
/** An update check answered. */
|
|
1305
|
+
readonly update_changed: Signal<UpdateInfo | null>;
|
|
1306
|
+
/** igni started or stopped doing something. */
|
|
1307
|
+
readonly activity_changed: Signal<Activity>;
|
|
1308
|
+
|
|
1309
|
+
/**
|
|
1310
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1311
|
+
* or session it was reached through.
|
|
1312
|
+
*
|
|
1313
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1314
|
+
* right one, and a second would be a second conversation.
|
|
1315
|
+
*/
|
|
1316
|
+
constructor(
|
|
1317
|
+
link: HostLink,
|
|
1318
|
+
window: string | null = null,
|
|
1319
|
+
session: string | null = null,
|
|
1320
|
+
) {
|
|
1321
|
+
super(link, "app", window, session);
|
|
1322
|
+
this.state = new HostAppState(link, window, session);
|
|
1323
|
+
this.display = new Property(this, "display", false);
|
|
1324
|
+
this.version = new Property(this, "version", false);
|
|
1325
|
+
this.update_available = new Property(this, "update_available", false);
|
|
1326
|
+
this.connection = new Property(this, "connection", false);
|
|
1327
|
+
this.activity = new Property(this, "activity", false);
|
|
1328
|
+
this.display_changed = new Signal("app.display_changed");
|
|
1329
|
+
this.connection_changed = new Signal("app.connection_changed");
|
|
1330
|
+
this.update_changed = new Signal("app.update_changed");
|
|
1331
|
+
this.activity_changed = new Signal("app.activity_changed");
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
/** Show or hide routing detail. */
|
|
1335
|
+
set_verbose(on: boolean): Promise<Display> {
|
|
1336
|
+
return this.call<Display>("set_verbose", { on });
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
/** Switch the output style, as `/output-style <name>` does. */
|
|
1340
|
+
set_output_style(name: string): Promise<Display> {
|
|
1341
|
+
return this.call<Display>("set_output_style", { name });
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
/** Ask whether a newer igni exists: `None` when none does. A check that could not reach an answer (offline, an HTTP error, an unreadable reply) is refused (`refused`) rather than answered `None`. */
|
|
1345
|
+
check_for_update(): Promise<UpdateInfo | null> {
|
|
1346
|
+
return this.call<UpdateInfo | null>("check_for_update", {});
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
/** Open an https link in the person's browser, the way igni opens every link outside it. The window asked about opens it: a page's own, else the active one. Anything but an absolute `https://` URL with a host and no credentials in it is refused (`invalid`). */
|
|
1350
|
+
open_external(url: string): Promise<void> {
|
|
1351
|
+
return this.call<void>("open_external", { url });
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
/** Every open igni window. Address one window's UI with `host.windows.ui(id)`. */
|
|
1356
|
+
export class HostWindows extends HostObject {
|
|
1357
|
+
static readonly PATH = "windows";
|
|
1358
|
+
/** Every window connected now. */
|
|
1359
|
+
readonly list: Property<WindowInfo[]>;
|
|
1360
|
+
/** The window the person is using — the one with focus; `None` when igni is in the background. */
|
|
1361
|
+
readonly focused: Property<string | null>;
|
|
1362
|
+
/** A window connected. */
|
|
1363
|
+
readonly opened: Signal<WindowInfo>;
|
|
1364
|
+
/** A window went away. */
|
|
1365
|
+
readonly closed: Signal<WindowInfo>;
|
|
1366
|
+
/** A window took focus or lost it; `focused` says which. */
|
|
1367
|
+
readonly focus_changed: Signal<WindowInfo>;
|
|
1368
|
+
|
|
1369
|
+
/**
|
|
1370
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1371
|
+
* or session it was reached through.
|
|
1372
|
+
*
|
|
1373
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1374
|
+
* right one, and a second would be a second conversation.
|
|
1375
|
+
*/
|
|
1376
|
+
constructor(
|
|
1377
|
+
link: HostLink,
|
|
1378
|
+
window: string | null = null,
|
|
1379
|
+
session: string | null = null,
|
|
1380
|
+
) {
|
|
1381
|
+
super(link, "windows", window, session);
|
|
1382
|
+
this.list = new Property(this, "list", false);
|
|
1383
|
+
this.focused = new Property(this, "focused", false);
|
|
1384
|
+
this.opened = new Signal("windows.opened");
|
|
1385
|
+
this.closed = new Signal("windows.closed");
|
|
1386
|
+
this.focus_changed = new Signal("windows.focus_changed");
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
/** `host.ui` of one window, by its id. */
|
|
1390
|
+
ui(windowId: string): HostUi {
|
|
1391
|
+
return new HostUi(this.link, windowId);
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
/** What a window shows — the model its views bind to. `host.ui` is the active window, the one the person last used; `host.windows.ui(id)` any window. igni's own views write here too, by the same path, so every change below is a signal whoever made it. */
|
|
1396
|
+
export class HostUi extends HostObject {
|
|
1397
|
+
static readonly PATH = "ui";
|
|
1398
|
+
/** The page stack; empty when the chat is showing. Writable: setting it navigates. */
|
|
1399
|
+
readonly route: Property<Page[]>;
|
|
1400
|
+
/** The panel open over the chat. Writable: setting it opens one, `None` closes it. */
|
|
1401
|
+
readonly panel: Property<Panel | null>;
|
|
1402
|
+
/** The sidebar. Writable. */
|
|
1403
|
+
readonly sidebar: Property<Sidebar>;
|
|
1404
|
+
/** The file previewed. Writable: `None` closes it. */
|
|
1405
|
+
readonly preview: Property<Preview | null>;
|
|
1406
|
+
/** What is selected. Writable. */
|
|
1407
|
+
readonly selection: Property<SelectionState>;
|
|
1408
|
+
/** The composer: draft, the files it refers to, its mode. Writable. */
|
|
1409
|
+
readonly composer: Property<Composer>;
|
|
1410
|
+
/** Toasts on screen, oldest first. */
|
|
1411
|
+
readonly toasts: Property<Toast[]>;
|
|
1412
|
+
/** The open dialog. */
|
|
1413
|
+
readonly dialog: Property<Dialog | null>;
|
|
1414
|
+
/** Where the transcript is. */
|
|
1415
|
+
readonly scroll: Property<Scroll>;
|
|
1416
|
+
/** The page stack changed. */
|
|
1417
|
+
readonly navigated: Signal<Route>;
|
|
1418
|
+
/** A panel opened or closed. */
|
|
1419
|
+
readonly panel_changed: Signal<PanelChange>;
|
|
1420
|
+
/** The sidebar changed. */
|
|
1421
|
+
readonly sidebar_changed: Signal<SidebarChange>;
|
|
1422
|
+
/** The preview opened, changed or closed. */
|
|
1423
|
+
readonly preview_changed: Signal<PreviewChange>;
|
|
1424
|
+
/** The selection changed. */
|
|
1425
|
+
readonly selection_changed: Signal<SelectionChange>;
|
|
1426
|
+
/** The draft changed. */
|
|
1427
|
+
readonly composer_changed: Signal<ComposerChange>;
|
|
1428
|
+
/** A toast appeared. */
|
|
1429
|
+
readonly toast_shown: Signal<ToastChange>;
|
|
1430
|
+
/** A toast went away. */
|
|
1431
|
+
readonly toast_dismissed: Signal<ToastChange>;
|
|
1432
|
+
/** A dialog opened. */
|
|
1433
|
+
readonly dialog_opened: Signal<DialogChange>;
|
|
1434
|
+
/** A dialog closed, with the answer. */
|
|
1435
|
+
readonly dialog_closed: Signal<DialogChange>;
|
|
1436
|
+
/** The transcript came to rest somewhere else, or started or stopped following the newest message. */
|
|
1437
|
+
readonly scrolled: Signal<Scroll>;
|
|
1438
|
+
|
|
1439
|
+
/**
|
|
1440
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1441
|
+
* or session it was reached through.
|
|
1442
|
+
*
|
|
1443
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1444
|
+
* right one, and a second would be a second conversation.
|
|
1445
|
+
*/
|
|
1446
|
+
constructor(
|
|
1447
|
+
link: HostLink,
|
|
1448
|
+
window: string | null = null,
|
|
1449
|
+
session: string | null = null,
|
|
1450
|
+
) {
|
|
1451
|
+
super(link, "ui", window, session);
|
|
1452
|
+
this.route = new Property(this, "route", true);
|
|
1453
|
+
this.panel = new Property(this, "panel", true);
|
|
1454
|
+
this.sidebar = new Property(this, "sidebar", true);
|
|
1455
|
+
this.preview = new Property(this, "preview", true);
|
|
1456
|
+
this.selection = new Property(this, "selection", true);
|
|
1457
|
+
this.composer = new Property(this, "composer", true);
|
|
1458
|
+
this.toasts = new Property(this, "toasts", false);
|
|
1459
|
+
this.dialog = new Property(this, "dialog", false);
|
|
1460
|
+
this.scroll = new Property(this, "scroll", false);
|
|
1461
|
+
this.navigated = new Signal("ui.navigated");
|
|
1462
|
+
this.panel_changed = new Signal("ui.panel_changed");
|
|
1463
|
+
this.sidebar_changed = new Signal("ui.sidebar_changed");
|
|
1464
|
+
this.preview_changed = new Signal("ui.preview_changed");
|
|
1465
|
+
this.selection_changed = new Signal("ui.selection_changed");
|
|
1466
|
+
this.composer_changed = new Signal("ui.composer_changed");
|
|
1467
|
+
this.toast_shown = new Signal("ui.toast_shown");
|
|
1468
|
+
this.toast_dismissed = new Signal("ui.toast_dismissed");
|
|
1469
|
+
this.dialog_opened = new Signal("ui.dialog_opened");
|
|
1470
|
+
this.dialog_closed = new Signal("ui.dialog_closed");
|
|
1471
|
+
this.scrolled = new Signal("ui.scrolled");
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
/** Open a page at the top of the stack, as a header link does. */
|
|
1475
|
+
navigate(page: string, params?: Record<string, string>): Promise<Page[]> {
|
|
1476
|
+
return this.call<Page[]>("navigate", { page, params });
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
/** Go back one level; at the root, back to the chat. */
|
|
1480
|
+
back(): Promise<Page[]> {
|
|
1481
|
+
return this.call<Page[]>("back", {});
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
/** Open a panel over the chat, closing the one that was open. */
|
|
1485
|
+
open_panel(kind: string, params?: Record<string, JsonValue>): Promise<Panel> {
|
|
1486
|
+
return this.call<Panel>("open_panel", { kind, params });
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
/** Close the panel. */
|
|
1490
|
+
close_panel(): Promise<void> {
|
|
1491
|
+
return this.call<void>("close_panel", {});
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
/** Open or close the sidebar, and size it or bring a section into view. */
|
|
1495
|
+
set_sidebar(open: boolean, width?: number, section?: string): Promise<Sidebar> {
|
|
1496
|
+
return this.call<Sidebar>("set_sidebar", { open, width, section });
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
/** Preview a file of the project. (`preview` is the property.) */
|
|
1500
|
+
open_preview(path: string): Promise<Preview> {
|
|
1501
|
+
return this.call<Preview>("open_preview", { path });
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
/** Close the preview. */
|
|
1505
|
+
close_preview(): Promise<void> {
|
|
1506
|
+
return this.call<void>("close_preview", {});
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
/** Select a message, text or file. The parts left out are cleared. */
|
|
1510
|
+
select(selection: SelectionState): Promise<SelectionState> {
|
|
1511
|
+
return this.call<SelectionState>("select", { selection });
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
/** Replace the draft. */
|
|
1515
|
+
set_composer(text: string, attachments?: string[], mode?: string): Promise<Composer> {
|
|
1516
|
+
return this.call<Composer>("set_composer", { text, attachments, mode });
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
/** Show a transient message, labelled as this extension's. */
|
|
1520
|
+
toast(text: string, kind?: string, body?: string, target?: Page): Promise<Toast> {
|
|
1521
|
+
return this.call<Toast>("toast", { text, kind, body, target });
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
/** Take one of this extension's toasts away. */
|
|
1525
|
+
dismiss_toast(toast_id: string): Promise<void> {
|
|
1526
|
+
return this.call<void>("dismiss_toast", { toast_id });
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
/** Show a dialog and wait for the person's answer. `spec` is `{title, body, buttons: [{id, label, primary}], input: {label, placeholder, value}}` — `buttons` defaults to one OK, `input` is optional. Answers `{button, value}`, or `None` when the dialog was dismissed, or replaced by another. (`dialog` is the property.) */
|
|
1530
|
+
show_dialog(spec: JsonValue): Promise<JsonValue> {
|
|
1531
|
+
return this.call<JsonValue>("show_dialog", { spec });
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
/** Scroll the transcript to a message, by its run; `bottom` for the newest. */
|
|
1535
|
+
scroll_to(message_id: string): Promise<Scroll> {
|
|
1536
|
+
return this.call<Scroll>("scroll_to", { message_id });
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
/** The sessions of this project, and which one the active window shows. Reach any session's chat, without showing it, with `host.sessions.chat(id)`. */
|
|
1541
|
+
export class HostSessions extends HostObject {
|
|
1542
|
+
static readonly PATH = "sessions";
|
|
1543
|
+
/** Every session, newest first. */
|
|
1544
|
+
readonly list: Property<SessionInfo[]>;
|
|
1545
|
+
/** The session the active window shows. Writable: setting it switches, and is refused where the person's switch would be. */
|
|
1546
|
+
readonly current: Property<string>;
|
|
1547
|
+
/** A window moved to another session. */
|
|
1548
|
+
readonly current_changed: Signal<SessionChange>;
|
|
1549
|
+
/** The session list was read. */
|
|
1550
|
+
readonly listed: Signal<SessionList>;
|
|
1551
|
+
/** `/clear` renewed a session. */
|
|
1552
|
+
readonly cleared: Signal<SessionCleared>;
|
|
1553
|
+
/** A session got its name. */
|
|
1554
|
+
readonly named: Signal<SessionNamed>;
|
|
1555
|
+
|
|
1556
|
+
/**
|
|
1557
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1558
|
+
* or session it was reached through.
|
|
1559
|
+
*
|
|
1560
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1561
|
+
* right one, and a second would be a second conversation.
|
|
1562
|
+
*/
|
|
1563
|
+
constructor(
|
|
1564
|
+
link: HostLink,
|
|
1565
|
+
window: string | null = null,
|
|
1566
|
+
session: string | null = null,
|
|
1567
|
+
) {
|
|
1568
|
+
super(link, "sessions", window, session);
|
|
1569
|
+
this.list = new Property(this, "list", false);
|
|
1570
|
+
this.current = new Property(this, "current", true);
|
|
1571
|
+
this.current_changed = new Signal("session.switched");
|
|
1572
|
+
this.listed = new Signal("sessions.listed");
|
|
1573
|
+
this.cleared = new Signal("sessions.cleared");
|
|
1574
|
+
this.named = new Signal("sessions.named");
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
/** Show a session in the active window. */
|
|
1578
|
+
open(session_id: string): Promise<SessionChange> {
|
|
1579
|
+
return this.call<SessionChange>("open", { session_id });
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
/** Start a new session, in a folder or in this project. It moves no window unless `focus` is true: reach it with `host.sessions.chat(session_id)`. A `title` names it at once, kept as a service's chat title is, so no auto-name replaces it. */
|
|
1583
|
+
create(project_dir?: string, title?: string, focus?: boolean): Promise<SessionAttached> {
|
|
1584
|
+
return this.call<SessionAttached>("create", { project_dir, title, focus });
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
/** Make sure a session is live, without showing it. */
|
|
1588
|
+
attach(session_id: string, project_dir?: string): Promise<SessionAttached> {
|
|
1589
|
+
return this.call<SessionAttached>("attach", { session_id, project_dir });
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
/** `host.chat` of any session of this project, by its id, without showing it. The session on screen's id is `host.chat` itself. */
|
|
1593
|
+
chat(sessionId: string): HostChat {
|
|
1594
|
+
return new HostChat(this.link, null, sessionId);
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
/** The conversation in the current session. Signals carry the session they happened in, and arrive for every live session. `host.sessions.chat(id)` is the same object for any session of this project, without showing it: its properties read that session, and `post`, `queue`, `append` and `replace` write there (with `sessions.post` as well). A message posted there starts a run, or waits for the run already going there — never answering an approval. Its other methods act only on the session on screen. */
|
|
1599
|
+
export class HostChat extends HostObject {
|
|
1600
|
+
static readonly PATH = "chat";
|
|
1601
|
+
/** `host.chat.approvals`. The agent asking to act, and the answers. Through `host.sessions.chat(id)` `waiting` reads that session; an approval is answered only in the session on screen. */
|
|
1602
|
+
readonly approvals: HostChatApprovals;
|
|
1603
|
+
/** `host.chat.views`. json-render blocks in the transcript — the visualizer's and extensions'. Through `host.sessions.chat(id)` `list` reads that session; `dispatch` acts only in the session on screen. */
|
|
1604
|
+
readonly views: HostChatViews;
|
|
1605
|
+
/** The current session. */
|
|
1606
|
+
readonly session_id: Property<string>;
|
|
1607
|
+
/** The transcript, turn by turn. */
|
|
1608
|
+
readonly messages: Property<JsonValue[]>;
|
|
1609
|
+
/** Messages waiting for a turn. */
|
|
1610
|
+
readonly pending: Property<JsonValue[]>;
|
|
1611
|
+
/** Whether a run is going. */
|
|
1612
|
+
readonly processing: Property<boolean>;
|
|
1613
|
+
/** The status line. */
|
|
1614
|
+
readonly status: Property<Status>;
|
|
1615
|
+
/** Seconds a run may take. */
|
|
1616
|
+
readonly timeout: Property<number>;
|
|
1617
|
+
/** Runs that stopped part-way. */
|
|
1618
|
+
readonly interrupted_runs: Property<JsonValue[]>;
|
|
1619
|
+
/** Token counts and what fills them. */
|
|
1620
|
+
readonly context: Property<ContextUsage>;
|
|
1621
|
+
/** A message was posted — by the person, an extension, or an extension's service (`from_service`). */
|
|
1622
|
+
readonly message_added: Signal<ChatMessage>;
|
|
1623
|
+
/** The agent's answer, streaming. */
|
|
1624
|
+
readonly content_delta: Signal<ContentDelta>;
|
|
1625
|
+
/** The agent started thinking. */
|
|
1626
|
+
readonly reasoning_started: Signal<RunRef>;
|
|
1627
|
+
/** A run started. */
|
|
1628
|
+
readonly run_started: Signal<RunStart>;
|
|
1629
|
+
/** A run finished, with the files it changed. */
|
|
1630
|
+
readonly run_completed: Signal<Run>;
|
|
1631
|
+
/** A run stopped with an error. */
|
|
1632
|
+
readonly run_error: Signal<RunFailure>;
|
|
1633
|
+
/** A run is waiting for approvals. */
|
|
1634
|
+
readonly run_paused: Signal<RunPause>;
|
|
1635
|
+
/** The answer finished streaming. */
|
|
1636
|
+
readonly streaming_done: Signal<RunRef>;
|
|
1637
|
+
/** Somebody's draft, live. */
|
|
1638
|
+
readonly typing: Signal<Typing>;
|
|
1639
|
+
/** The status line changed. */
|
|
1640
|
+
readonly status_changed: Signal<Status>;
|
|
1641
|
+
/** An info line. */
|
|
1642
|
+
readonly info: Signal<Notice>;
|
|
1643
|
+
/** An error line. */
|
|
1644
|
+
readonly error: Signal<Notice>;
|
|
1645
|
+
/** The agent called a tool. */
|
|
1646
|
+
readonly tool_started: Signal<ToolCall>;
|
|
1647
|
+
/** A tool call finished. */
|
|
1648
|
+
readonly tool_completed: Signal<ToolResult>;
|
|
1649
|
+
/** A tool call failed. */
|
|
1650
|
+
readonly tool_error: Signal<ToolFailure>;
|
|
1651
|
+
/** A model call finished. */
|
|
1652
|
+
readonly model_completed: Signal<ModelUsage>;
|
|
1653
|
+
/** The agent wrote a file. */
|
|
1654
|
+
readonly file_edited: Signal<FileEdited>;
|
|
1655
|
+
/** A sub-agent or team moved on. */
|
|
1656
|
+
readonly agent_event: Signal<AgentEvent>;
|
|
1657
|
+
/** A network call is being retried. */
|
|
1658
|
+
readonly retry: Signal<Retry>;
|
|
1659
|
+
/** Turns were truncated or discarded. */
|
|
1660
|
+
readonly history_changed: Signal<HistoryChange>;
|
|
1661
|
+
|
|
1662
|
+
/**
|
|
1663
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1664
|
+
* or session it was reached through.
|
|
1665
|
+
*
|
|
1666
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1667
|
+
* right one, and a second would be a second conversation.
|
|
1668
|
+
*/
|
|
1669
|
+
constructor(
|
|
1670
|
+
link: HostLink,
|
|
1671
|
+
window: string | null = null,
|
|
1672
|
+
session: string | null = null,
|
|
1673
|
+
) {
|
|
1674
|
+
super(link, "chat", window, session);
|
|
1675
|
+
this.approvals = new HostChatApprovals(link, window, session);
|
|
1676
|
+
this.views = new HostChatViews(link, window, session);
|
|
1677
|
+
this.session_id = new Property(this, "session_id", false);
|
|
1678
|
+
this.messages = new Property(this, "messages", false);
|
|
1679
|
+
this.pending = new Property(this, "pending", false);
|
|
1680
|
+
this.processing = new Property(this, "processing", false);
|
|
1681
|
+
this.status = new Property(this, "status", false);
|
|
1682
|
+
this.timeout = new Property(this, "timeout", false);
|
|
1683
|
+
this.interrupted_runs = new Property(this, "interrupted_runs", false);
|
|
1684
|
+
this.context = new Property(this, "context", false);
|
|
1685
|
+
this.message_added = new Signal("chat.message_added");
|
|
1686
|
+
this.content_delta = new Signal("chat.content_delta");
|
|
1687
|
+
this.reasoning_started = new Signal("chat.reasoning_started");
|
|
1688
|
+
this.run_started = new Signal("chat.run_started");
|
|
1689
|
+
this.run_completed = new Signal("chat.run_completed");
|
|
1690
|
+
this.run_error = new Signal("chat.run_error");
|
|
1691
|
+
this.run_paused = new Signal("chat.run_paused");
|
|
1692
|
+
this.streaming_done = new Signal("chat.streaming_done");
|
|
1693
|
+
this.typing = new Signal("chat.typing");
|
|
1694
|
+
this.status_changed = new Signal("chat.status_changed");
|
|
1695
|
+
this.info = new Signal("chat.info");
|
|
1696
|
+
this.error = new Signal("chat.error");
|
|
1697
|
+
this.tool_started = new Signal("chat.tool_started");
|
|
1698
|
+
this.tool_completed = new Signal("chat.tool_completed");
|
|
1699
|
+
this.tool_error = new Signal("chat.tool_error");
|
|
1700
|
+
this.model_completed = new Signal("chat.model_completed");
|
|
1701
|
+
this.file_edited = new Signal("chat.file_edited");
|
|
1702
|
+
this.agent_event = new Signal("chat.agent_event");
|
|
1703
|
+
this.retry = new Signal("chat.retry");
|
|
1704
|
+
this.history_changed = new Signal("chat.history_changed");
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
/** Post a message in the chat, labelled as this extension. The agent sees it and answers in the chat as usual. In a session that is not on screen it starts a run, or is queued for the run going there (working or waiting on an approval) — then without attachments. */
|
|
1708
|
+
post(text: string, attachments?: Record<string, string>): Promise<void> {
|
|
1709
|
+
return this.call<void>("post", { text, attachments });
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
/** Post a message for the next turn, labelled as this extension. */
|
|
1713
|
+
queue(text: string): Promise<void> {
|
|
1714
|
+
return this.call<void>("queue", { text });
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
/** Show a json-render block in the transcript. Shown to the person, never sent to the model. Returns its id. */
|
|
1718
|
+
append(view: JsonValue, title?: string): Promise<string> {
|
|
1719
|
+
return this.call<string>("append", { view, title });
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
/** Replace a block this extension appended. */
|
|
1723
|
+
replace(view_id: string, view: JsonValue, title?: string): Promise<void> {
|
|
1724
|
+
return this.call<void>("replace", { view_id, view, title });
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
/** Search the transcript. */
|
|
1728
|
+
search(query: string, limit?: number): Promise<JsonValue[]> {
|
|
1729
|
+
return this.call<JsonValue[]>("search", { query, limit });
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
/** Stop the run. */
|
|
1733
|
+
cancel(): Promise<void> {
|
|
1734
|
+
return this.call<void>("cancel", {});
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
/** Stop one sub-agent's run. */
|
|
1738
|
+
cancel_agent(run_id: string): Promise<void> {
|
|
1739
|
+
return this.call<void>("cancel_agent", { run_id });
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
/** Remove a run and everything after it. */
|
|
1743
|
+
truncate(run_id: string): Promise<JsonValue> {
|
|
1744
|
+
return this.call<JsonValue>("truncate", { run_id });
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
/** Compact the conversation if it needs it, as igni does after a run. */
|
|
1748
|
+
compact(): Promise<SessionCleared | null> {
|
|
1749
|
+
return this.call<SessionCleared | null>("compact", {});
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
/** Have the agent note what a turn taught it. */
|
|
1753
|
+
extract_learnings(user_msg: string, assistant_msg: string): Promise<void> {
|
|
1754
|
+
return this.call<void>("extract_learnings", { user_msg, assistant_msg });
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
/** Forget an interrupted run. */
|
|
1758
|
+
discard_interrupted(message_id: string): Promise<JsonValue> {
|
|
1759
|
+
return this.call<JsonValue>("discard_interrupted", { message_id });
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
/** Upload an attachment for a later `post`. */
|
|
1763
|
+
upload(filename: string, content_base64: string): Promise<JsonValue> {
|
|
1764
|
+
return this.call<JsonValue>("upload", { filename, content_base64 });
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
/** Plan mode: the plan the agent proposed. */
|
|
1769
|
+
export class HostPlan extends HostObject {
|
|
1770
|
+
static readonly PATH = "plan";
|
|
1771
|
+
/** The latest plan. */
|
|
1772
|
+
readonly latest: Property<Plan>;
|
|
1773
|
+
/** A plan was submitted or decided. */
|
|
1774
|
+
readonly changed: Signal<PlanChange>;
|
|
1775
|
+
|
|
1776
|
+
/**
|
|
1777
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1778
|
+
* or session it was reached through.
|
|
1779
|
+
*
|
|
1780
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1781
|
+
* right one, and a second would be a second conversation.
|
|
1782
|
+
*/
|
|
1783
|
+
constructor(
|
|
1784
|
+
link: HostLink,
|
|
1785
|
+
window: string | null = null,
|
|
1786
|
+
session: string | null = null,
|
|
1787
|
+
) {
|
|
1788
|
+
super(link, "plan", window, session);
|
|
1789
|
+
this.latest = new Property(this, "latest", false);
|
|
1790
|
+
this.changed = new Signal("plan.changed");
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
/** Approve the plan. */
|
|
1794
|
+
approve(run_id?: string): Promise<PlanDecision> {
|
|
1795
|
+
return this.call<PlanDecision>("approve", { run_id });
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
/** Send the plan back. */
|
|
1799
|
+
dismiss(run_id?: string): Promise<PlanDecision> {
|
|
1800
|
+
return this.call<PlanDecision>("dismiss", { run_id });
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
/** The agent's todo list and its sub-agent tasks. */
|
|
1805
|
+
export class HostTasks extends HostObject {
|
|
1806
|
+
static readonly PATH = "tasks";
|
|
1807
|
+
/** The todo list. */
|
|
1808
|
+
readonly todos: Property<TodoItem[]>;
|
|
1809
|
+
/** A task was created. */
|
|
1810
|
+
readonly created: Signal<TaskEvent>;
|
|
1811
|
+
/** A task changed. */
|
|
1812
|
+
readonly updated: Signal<TaskEvent>;
|
|
1813
|
+
/** A task loop moved on. */
|
|
1814
|
+
readonly iteration: Signal<TaskIteration>;
|
|
1815
|
+
/** Every task, as it now stands. */
|
|
1816
|
+
readonly snapshot: Signal<TaskSnapshot>;
|
|
1817
|
+
/** The todo list changed. */
|
|
1818
|
+
readonly todos_changed: Signal<Todos>;
|
|
1819
|
+
|
|
1820
|
+
/**
|
|
1821
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1822
|
+
* or session it was reached through.
|
|
1823
|
+
*
|
|
1824
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1825
|
+
* right one, and a second would be a second conversation.
|
|
1826
|
+
*/
|
|
1827
|
+
constructor(
|
|
1828
|
+
link: HostLink,
|
|
1829
|
+
window: string | null = null,
|
|
1830
|
+
session: string | null = null,
|
|
1831
|
+
) {
|
|
1832
|
+
super(link, "tasks", window, session);
|
|
1833
|
+
this.todos = new Property(this, "todos", false);
|
|
1834
|
+
this.created = new Signal("tasks.created");
|
|
1835
|
+
this.updated = new Signal("tasks.updated");
|
|
1836
|
+
this.iteration = new Signal("tasks.iteration");
|
|
1837
|
+
this.snapshot = new Signal("tasks.snapshot");
|
|
1838
|
+
this.todos_changed = new Signal("tasks.todos_changed");
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
/** `/loop`: a prompt repeated until done. */
|
|
1843
|
+
export class HostLoop extends HostObject {
|
|
1844
|
+
static readonly PATH = "loop";
|
|
1845
|
+
/** Where it is. */
|
|
1846
|
+
readonly status: Property<LoopStatus>;
|
|
1847
|
+
/** It paused, resumed, advanced or stopped. */
|
|
1848
|
+
readonly changed: Signal<LoopStatus>;
|
|
1849
|
+
|
|
1850
|
+
/**
|
|
1851
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1852
|
+
* or session it was reached through.
|
|
1853
|
+
*
|
|
1854
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1855
|
+
* right one, and a second would be a second conversation.
|
|
1856
|
+
*/
|
|
1857
|
+
constructor(
|
|
1858
|
+
link: HostLink,
|
|
1859
|
+
window: string | null = null,
|
|
1860
|
+
session: string | null = null,
|
|
1861
|
+
) {
|
|
1862
|
+
super(link, "loop", window, session);
|
|
1863
|
+
this.status = new Property(this, "status", false);
|
|
1864
|
+
this.changed = new Signal("loop.changed");
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
/** Pause after this iteration. */
|
|
1868
|
+
pause(): Promise<boolean> {
|
|
1869
|
+
return this.call<boolean>("pause", {});
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
/** Carry on. */
|
|
1873
|
+
resume(): Promise<string> {
|
|
1874
|
+
return this.call<string>("resume", {});
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
/** Stop the loop. */
|
|
1878
|
+
cancel_pending(): Promise<boolean> {
|
|
1879
|
+
return this.call<boolean>("cancel_pending", {});
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
/** Take the next iteration. */
|
|
1883
|
+
pop_pending(): Promise<LoopAdvance | null> {
|
|
1884
|
+
return this.call<LoopAdvance | null>("pop_pending", {});
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
/** Slash commands and skills. */
|
|
1889
|
+
export class HostCommands extends HostObject {
|
|
1890
|
+
static readonly PATH = "commands";
|
|
1891
|
+
/** Every slash command. */
|
|
1892
|
+
readonly list: Property<SlashCommand[]>;
|
|
1893
|
+
/** Skill names. */
|
|
1894
|
+
readonly skills: Property<string[]>;
|
|
1895
|
+
/** Each skill's description and prompt. */
|
|
1896
|
+
readonly skill_definitions: Property<SkillDefinition[]>;
|
|
1897
|
+
/** Each skill's details. */
|
|
1898
|
+
readonly skill_details: Property<SkillDetails[]>;
|
|
1899
|
+
|
|
1900
|
+
/**
|
|
1901
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1902
|
+
* or session it was reached through.
|
|
1903
|
+
*
|
|
1904
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1905
|
+
* right one, and a second would be a second conversation.
|
|
1906
|
+
*/
|
|
1907
|
+
constructor(
|
|
1908
|
+
link: HostLink,
|
|
1909
|
+
window: string | null = null,
|
|
1910
|
+
session: string | null = null,
|
|
1911
|
+
) {
|
|
1912
|
+
super(link, "commands", window, session);
|
|
1913
|
+
this.list = new Property(this, "list", false);
|
|
1914
|
+
this.skills = new Property(this, "skills", false);
|
|
1915
|
+
this.skill_definitions = new Property(this, "skill_definitions", false);
|
|
1916
|
+
this.skill_details = new Property(this, "skill_details", false);
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
/** Run a slash command, as the extension. The answer comes back here. */
|
|
1920
|
+
run(command: string): Promise<CommandOutcome> {
|
|
1921
|
+
return this.call<CommandOutcome>("run", { command });
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
/** Agent definitions. */
|
|
1926
|
+
export class HostAgents extends HostObject {
|
|
1927
|
+
static readonly PATH = "agents";
|
|
1928
|
+
/** Every agent. */
|
|
1929
|
+
readonly details: Property<AgentInfo[]>;
|
|
1930
|
+
/** An agent was promoted or discarded. */
|
|
1931
|
+
readonly changed: Signal<CollectionChange>;
|
|
1932
|
+
|
|
1933
|
+
/**
|
|
1934
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1935
|
+
* or session it was reached through.
|
|
1936
|
+
*
|
|
1937
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1938
|
+
* right one, and a second would be a second conversation.
|
|
1939
|
+
*/
|
|
1940
|
+
constructor(
|
|
1941
|
+
link: HostLink,
|
|
1942
|
+
window: string | null = null,
|
|
1943
|
+
session: string | null = null,
|
|
1944
|
+
) {
|
|
1945
|
+
super(link, "agents", window, session);
|
|
1946
|
+
this.details = new Property(this, "details", false);
|
|
1947
|
+
this.changed = new Signal("agents.changed");
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
/** Keep an agent made for one task, as `/agents promote` does. */
|
|
1951
|
+
promote_ephemeral(name: string, target?: string): Promise<PromoteResult> {
|
|
1952
|
+
return this.call<PromoteResult>("promote_ephemeral", { name, target });
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
/** Drop an agent made for one task. */
|
|
1956
|
+
discard_ephemeral(name: string): Promise<DiscardResult> {
|
|
1957
|
+
return this.call<DiscardResult>("discard_ephemeral", { name });
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
/** Workflows: scripted runs. */
|
|
1962
|
+
export class HostWorkflows extends HostObject {
|
|
1963
|
+
static readonly PATH = "workflows";
|
|
1964
|
+
/** Every workflow. */
|
|
1965
|
+
readonly list: Property<Workflow[]>;
|
|
1966
|
+
/** A workflow run moved on. */
|
|
1967
|
+
readonly changed: Signal<CollectionChange>;
|
|
1968
|
+
|
|
1969
|
+
/**
|
|
1970
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1971
|
+
* or session it was reached through.
|
|
1972
|
+
*
|
|
1973
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1974
|
+
* right one, and a second would be a second conversation.
|
|
1975
|
+
*/
|
|
1976
|
+
constructor(
|
|
1977
|
+
link: HostLink,
|
|
1978
|
+
window: string | null = null,
|
|
1979
|
+
session: string | null = null,
|
|
1980
|
+
) {
|
|
1981
|
+
super(link, "workflows", window, session);
|
|
1982
|
+
this.list = new Property(this, "list", false);
|
|
1983
|
+
this.changed = new Signal("workflows.changed");
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
/** Start a workflow. */
|
|
1987
|
+
run(name: string, input?: Record<string, JsonValue>): Promise<WorkflowRun> {
|
|
1988
|
+
return this.call<WorkflowRun>("run", { name, input });
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
/** Stop a workflow run. */
|
|
1992
|
+
cancel(workflow_run_id: string): Promise<boolean> {
|
|
1993
|
+
return this.call<boolean>("cancel", { workflow_run_id });
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
/** Scheduled tasks. */
|
|
1998
|
+
export class HostScheduler extends HostObject {
|
|
1999
|
+
static readonly PATH = "scheduler";
|
|
2000
|
+
/** Every scheduled task. */
|
|
2001
|
+
readonly tasks: Property<ScheduledTask[]>;
|
|
2002
|
+
/** A task started, finished or changed. */
|
|
2003
|
+
readonly event: Signal<SchedulerEvent>;
|
|
2004
|
+
|
|
2005
|
+
/**
|
|
2006
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2007
|
+
* or session it was reached through.
|
|
2008
|
+
*
|
|
2009
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2010
|
+
* right one, and a second would be a second conversation.
|
|
2011
|
+
*/
|
|
2012
|
+
constructor(
|
|
2013
|
+
link: HostLink,
|
|
2014
|
+
window: string | null = null,
|
|
2015
|
+
session: string | null = null,
|
|
2016
|
+
) {
|
|
2017
|
+
super(link, "scheduler", window, session);
|
|
2018
|
+
this.tasks = new Property(this, "tasks", false);
|
|
2019
|
+
this.event = new Signal("scheduler.event");
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
/** Start the scheduler. */
|
|
2023
|
+
start(): Promise<void> {
|
|
2024
|
+
return this.call<void>("start", {});
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
|
+
/** Run a scheduled task now. */
|
|
2028
|
+
run_now(task_id: string): Promise<string> {
|
|
2029
|
+
return this.call<string>("run_now", { task_id });
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
/** Cancel a scheduled task. */
|
|
2033
|
+
cancel(task_id: string): Promise<void> {
|
|
2034
|
+
return this.call<void>("cancel", { task_id });
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2038
|
+
/** Background shells. */
|
|
2039
|
+
export class HostProcesses extends HostObject {
|
|
2040
|
+
static readonly PATH = "processes";
|
|
2041
|
+
/** Every background shell. */
|
|
2042
|
+
readonly list: Property<ProcessRow[]>;
|
|
2043
|
+
/** A shell started, printed or exited. */
|
|
2044
|
+
readonly changed: Signal<ProcessEvent>;
|
|
2045
|
+
|
|
2046
|
+
/**
|
|
2047
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2048
|
+
* or session it was reached through.
|
|
2049
|
+
*
|
|
2050
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2051
|
+
* right one, and a second would be a second conversation.
|
|
2052
|
+
*/
|
|
2053
|
+
constructor(
|
|
2054
|
+
link: HostLink,
|
|
2055
|
+
window: string | null = null,
|
|
2056
|
+
session: string | null = null,
|
|
2057
|
+
) {
|
|
2058
|
+
super(link, "processes", window, session);
|
|
2059
|
+
this.list = new Property(this, "list", false);
|
|
2060
|
+
this.changed = new Signal("processes.changed");
|
|
2061
|
+
}
|
|
2062
|
+
|
|
2063
|
+
/** A shell's last lines. */
|
|
2064
|
+
tail(pid: number, lines?: number): Promise<ProcessTail> {
|
|
2065
|
+
return this.call<ProcessTail>("tail", { pid, lines });
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
/** Stop a shell. */
|
|
2069
|
+
stop(pid: number): Promise<ProcessStop> {
|
|
2070
|
+
return this.call<ProcessStop>("stop", { pid });
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
/** Run a command in the project and wait for it. */
|
|
2074
|
+
run(command: string): Promise<ShellResult> {
|
|
2075
|
+
return this.call<ShellResult>("run", { command });
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
/** The project, as far as the extension's workspace grant reaches. */
|
|
2080
|
+
export class HostWorkspace extends HostObject {
|
|
2081
|
+
static readonly PATH = "workspace";
|
|
2082
|
+
/** The project directory. */
|
|
2083
|
+
readonly root: Property<string>;
|
|
2084
|
+
/** Git HEAD; `None` outside a repository. */
|
|
2085
|
+
readonly head: Property<Head | null>;
|
|
2086
|
+
/** HEAD moved. */
|
|
2087
|
+
readonly head_changed: Signal<Head>;
|
|
2088
|
+
/** Files changed, as git sees them, within the grant. */
|
|
2089
|
+
readonly files_changed: Signal<FilesChanged>;
|
|
2090
|
+
|
|
2091
|
+
/**
|
|
2092
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2093
|
+
* or session it was reached through.
|
|
2094
|
+
*
|
|
2095
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2096
|
+
* right one, and a second would be a second conversation.
|
|
2097
|
+
*/
|
|
2098
|
+
constructor(
|
|
2099
|
+
link: HostLink,
|
|
2100
|
+
window: string | null = null,
|
|
2101
|
+
session: string | null = null,
|
|
2102
|
+
) {
|
|
2103
|
+
super(link, "workspace", window, session);
|
|
2104
|
+
this.root = new Property(this, "root", false);
|
|
2105
|
+
this.head = new Property(this, "head", false);
|
|
2106
|
+
this.head_changed = new Signal("workspace.head-changed");
|
|
2107
|
+
this.files_changed = new Signal("workspace.files-changed");
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
/** Read a file in the project. */
|
|
2111
|
+
read(path: string): Promise<JsonValue> {
|
|
2112
|
+
return this.call<JsonValue>("read", { path });
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
/** List a directory in the project. */
|
|
2116
|
+
list(dir?: string): Promise<JsonValue> {
|
|
2117
|
+
return this.call<JsonValue>("list", { dir });
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
/** Complete a path, as `@` does. */
|
|
2121
|
+
complete(prefix: string): Promise<JsonValue> {
|
|
2122
|
+
return this.call<JsonValue>("complete", { prefix });
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2125
|
+
/** Search the code. */
|
|
2126
|
+
search(query: string): Promise<JsonValue> {
|
|
2127
|
+
return this.call<JsonValue>("search", { query });
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
/** Ask the person to pick a folder. */
|
|
2131
|
+
pick_dir(): Promise<JsonValue> {
|
|
2132
|
+
return this.call<JsonValue>("pick_dir", {});
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2135
|
+
/** Open a file in the project with the application this machine opens it with — what an extension whose process is sandboxed cannot do itself. Only a file the workspace grant reaches (`refused` outside the project, `not_granted` outside `workspacePaths`), and only a document: `.csv`, `.gif`, `.htm`, `.html`, `.jpeg`, `.jpg`, `.md`, `.pdf`, `.png`, `.svg`, `.txt`, `.webp` (`invalid` otherwise, and for an executable file). `failed` when nothing here opened it. */
|
|
2136
|
+
open(path: string): Promise<void> {
|
|
2137
|
+
return this.call<void>("open", { path });
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
|
|
2141
|
+
/** Models. */
|
|
2142
|
+
export class HostModels extends HostObject {
|
|
2143
|
+
static readonly PATH = "models";
|
|
2144
|
+
/** Every model igni knows. */
|
|
2145
|
+
readonly registry: Property<ModelRegistry>;
|
|
2146
|
+
/** The model in use. Writable: setting it switches. */
|
|
2147
|
+
readonly current: Property<string>;
|
|
2148
|
+
/** The model in use changed. */
|
|
2149
|
+
readonly changed: Signal<ModelChange>;
|
|
2150
|
+
|
|
2151
|
+
/**
|
|
2152
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2153
|
+
* or session it was reached through.
|
|
2154
|
+
*
|
|
2155
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2156
|
+
* right one, and a second would be a second conversation.
|
|
2157
|
+
*/
|
|
2158
|
+
constructor(
|
|
2159
|
+
link: HostLink,
|
|
2160
|
+
window: string | null = null,
|
|
2161
|
+
session: string | null = null,
|
|
2162
|
+
) {
|
|
2163
|
+
super(link, "models", window, session);
|
|
2164
|
+
this.registry = new Property(this, "registry", false);
|
|
2165
|
+
this.current = new Property(this, "current", true);
|
|
2166
|
+
this.changed = new Signal("models.changed");
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
/** MCP servers. */
|
|
2171
|
+
export class HostMcp extends HostObject {
|
|
2172
|
+
static readonly PATH = "mcp";
|
|
2173
|
+
/** Every server. */
|
|
2174
|
+
readonly servers: Property<McpServer[]>;
|
|
2175
|
+
/** Each server's status. */
|
|
2176
|
+
readonly status: Property<McpServer[]>;
|
|
2177
|
+
/** Each server's tools and details. */
|
|
2178
|
+
readonly details: Property<McpServerDetails[]>;
|
|
2179
|
+
/** A server connected, disconnected or changed tools. */
|
|
2180
|
+
readonly changed: Signal<CollectionChange>;
|
|
2181
|
+
|
|
2182
|
+
/**
|
|
2183
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2184
|
+
* or session it was reached through.
|
|
2185
|
+
*
|
|
2186
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2187
|
+
* right one, and a second would be a second conversation.
|
|
2188
|
+
*/
|
|
2189
|
+
constructor(
|
|
2190
|
+
link: HostLink,
|
|
2191
|
+
window: string | null = null,
|
|
2192
|
+
session: string | null = null,
|
|
2193
|
+
) {
|
|
2194
|
+
super(link, "mcp", window, session);
|
|
2195
|
+
this.servers = new Property(this, "servers", false);
|
|
2196
|
+
this.status = new Property(this, "status", false);
|
|
2197
|
+
this.details = new Property(this, "details", false);
|
|
2198
|
+
this.changed = new Signal("mcp.changed");
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2201
|
+
/** Connect a server. */
|
|
2202
|
+
connect(name: string): Promise<void> {
|
|
2203
|
+
return this.call<void>("connect", { name });
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
/** Disconnect a server. */
|
|
2207
|
+
disconnect(name: string): Promise<void> {
|
|
2208
|
+
return this.call<void>("disconnect", { name });
|
|
2209
|
+
}
|
|
2210
|
+
|
|
2211
|
+
/** Start the servers that should be running. */
|
|
2212
|
+
ensure(): Promise<McpInit> {
|
|
2213
|
+
return this.call<McpInit>("ensure", {});
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2216
|
+
/** Offer or withhold one tool. */
|
|
2217
|
+
set_tool_enabled(server: string, tool: string, on: boolean): Promise<McpToolToggle> {
|
|
2218
|
+
return this.call<McpToolToggle>("set_tool_enabled", { server, tool, on });
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
/** Plugins and marketplaces. */
|
|
2223
|
+
export class HostPlugins extends HostObject {
|
|
2224
|
+
static readonly PATH = "plugins";
|
|
2225
|
+
/** Every installed plugin. */
|
|
2226
|
+
readonly installed: Property<PluginInfo[]>;
|
|
2227
|
+
/** Every marketplace. */
|
|
2228
|
+
readonly marketplaces: Property<Marketplace[]>;
|
|
2229
|
+
/** A plugin or marketplace changed. */
|
|
2230
|
+
readonly changed: Signal<CollectionChange>;
|
|
2231
|
+
|
|
2232
|
+
/**
|
|
2233
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2234
|
+
* or session it was reached through.
|
|
2235
|
+
*
|
|
2236
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2237
|
+
* right one, and a second would be a second conversation.
|
|
2238
|
+
*/
|
|
2239
|
+
constructor(
|
|
2240
|
+
link: HostLink,
|
|
2241
|
+
window: string | null = null,
|
|
2242
|
+
session: string | null = null,
|
|
2243
|
+
) {
|
|
2244
|
+
super(link, "plugins", window, session);
|
|
2245
|
+
this.installed = new Property(this, "installed", false);
|
|
2246
|
+
this.marketplaces = new Property(this, "marketplaces", false);
|
|
2247
|
+
this.changed = new Signal("plugins.changed");
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
/** What a plugin carries. */
|
|
2251
|
+
contents(name: string): Promise<PluginContents> {
|
|
2252
|
+
return this.call<PluginContents>("contents", { name });
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
/** What a plugin would install. */
|
|
2256
|
+
preview(source: string, branch?: string, subdir?: string): Promise<PluginContents> {
|
|
2257
|
+
return this.call<PluginContents>("preview", { source, branch, subdir });
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
/** Install a plugin. */
|
|
2261
|
+
install(ref: string, install_ref?: string): Promise<void> {
|
|
2262
|
+
return this.call<void>("install", { ref, install_ref });
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
/** Update a plugin. */
|
|
2266
|
+
update(name: string, install_ref?: string): Promise<void> {
|
|
2267
|
+
return this.call<void>("update", { name, install_ref });
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
/** Remove a plugin. */
|
|
2271
|
+
remove(name: string): Promise<void> {
|
|
2272
|
+
return this.call<void>("remove", { name });
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
/** Enable or disable a plugin. */
|
|
2276
|
+
set_enabled(name: string, on: boolean): Promise<void> {
|
|
2277
|
+
return this.call<void>("set_enabled", { name, on });
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2280
|
+
/** Add a marketplace. */
|
|
2281
|
+
add_marketplace(url: string): Promise<void> {
|
|
2282
|
+
return this.call<void>("add_marketplace", { url });
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
/** Remove a marketplace. */
|
|
2286
|
+
remove_marketplace(name: string): Promise<void> {
|
|
2287
|
+
return this.call<void>("remove_marketplace", { name });
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
/** Refresh marketplaces. */
|
|
2291
|
+
refresh_marketplaces(name?: string): Promise<void> {
|
|
2292
|
+
return this.call<void>("refresh_marketplaces", { name });
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
/** Installed extensions. Read-only, apart from this extension's own settings. */
|
|
2297
|
+
export class HostExtensions extends HostObject {
|
|
2298
|
+
static readonly PATH = "extensions";
|
|
2299
|
+
/** Every installed extension. */
|
|
2300
|
+
readonly installed: Property<ExtensionInfo[]>;
|
|
2301
|
+
/** An extension's health moved. */
|
|
2302
|
+
readonly state_changed: Signal<ExtensionStateChange>;
|
|
2303
|
+
|
|
2304
|
+
/**
|
|
2305
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2306
|
+
* or session it was reached through.
|
|
2307
|
+
*
|
|
2308
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2309
|
+
* right one, and a second would be a second conversation.
|
|
2310
|
+
*/
|
|
2311
|
+
constructor(
|
|
2312
|
+
link: HostLink,
|
|
2313
|
+
window: string | null = null,
|
|
2314
|
+
session: string | null = null,
|
|
2315
|
+
) {
|
|
2316
|
+
super(link, "extensions", window, session);
|
|
2317
|
+
this.installed = new Property(this, "installed", false);
|
|
2318
|
+
this.state_changed = new Signal("extension.state-changed");
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
/** Change this extension's own settings. */
|
|
2322
|
+
set_settings(values: Record<string, JsonValue>): Promise<SettingsChange> {
|
|
2323
|
+
return this.call<SettingsChange>("set_settings", { values });
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
/** Hooks. */
|
|
2328
|
+
export class HostHooks extends HostObject {
|
|
2329
|
+
static readonly PATH = "hooks";
|
|
2330
|
+
/** Every hook. */
|
|
2331
|
+
readonly details: Property<HookEntry[]>;
|
|
2332
|
+
/** Hooks were reloaded. */
|
|
2333
|
+
readonly changed: Signal<CollectionChange>;
|
|
2334
|
+
|
|
2335
|
+
/**
|
|
2336
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2337
|
+
* or session it was reached through.
|
|
2338
|
+
*
|
|
2339
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2340
|
+
* right one, and a second would be a second conversation.
|
|
2341
|
+
*/
|
|
2342
|
+
constructor(
|
|
2343
|
+
link: HostLink,
|
|
2344
|
+
window: string | null = null,
|
|
2345
|
+
session: string | null = null,
|
|
2346
|
+
) {
|
|
2347
|
+
super(link, "hooks", window, session);
|
|
2348
|
+
this.details = new Property(this, "details", false);
|
|
2349
|
+
this.changed = new Signal("hooks.changed");
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
/** Reload hooks. */
|
|
2353
|
+
reload(): Promise<void> {
|
|
2354
|
+
return this.call<void>("reload", {});
|
|
2355
|
+
}
|
|
2356
|
+
|
|
2357
|
+
/** Run the session-start hooks. */
|
|
2358
|
+
fire_session_start(): Promise<void> {
|
|
2359
|
+
return this.call<void>("fire_session_start", {});
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
/** What the agent may do without asking. */
|
|
2364
|
+
export class HostPermissions extends HostObject {
|
|
2365
|
+
static readonly PATH = "permissions";
|
|
2366
|
+
/** `default`, `plan`, `acceptEdits` or `bypassPermissions`. */
|
|
2367
|
+
readonly mode: Property<string>;
|
|
2368
|
+
/** The mode changed. */
|
|
2369
|
+
readonly mode_changed: Signal<PermissionModeChange>;
|
|
2370
|
+
|
|
2371
|
+
/**
|
|
2372
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2373
|
+
* or session it was reached through.
|
|
2374
|
+
*
|
|
2375
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2376
|
+
* right one, and a second would be a second conversation.
|
|
2377
|
+
*/
|
|
2378
|
+
constructor(
|
|
2379
|
+
link: HostLink,
|
|
2380
|
+
window: string | null = null,
|
|
2381
|
+
session: string | null = null,
|
|
2382
|
+
) {
|
|
2383
|
+
super(link, "permissions", window, session);
|
|
2384
|
+
this.mode = new Property(this, "mode", false);
|
|
2385
|
+
this.mode_changed = new Signal("permissions.mode_changed");
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
/** Would this tool call be allowed, asked or denied? One of `allow`, `ask` or `deny`. */
|
|
2389
|
+
check(tool_name: string, func_name: string, tool_args?: Record<string, JsonValue>): Promise<string> {
|
|
2390
|
+
return this.call<string>("check", { tool_name, func_name, tool_args });
|
|
2391
|
+
}
|
|
2392
|
+
|
|
2393
|
+
/** Save a permission rule. */
|
|
2394
|
+
save_rule(rule: string, level: string): Promise<void> {
|
|
2395
|
+
return this.call<void>("save_rule", { rule, level });
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
/** The group policy in force. */
|
|
2400
|
+
export class HostPolicy extends HostObject {
|
|
2401
|
+
static readonly PATH = "policy";
|
|
2402
|
+
/** The group's policy pack. */
|
|
2403
|
+
readonly pack: Property<PolicyPack>;
|
|
2404
|
+
|
|
2405
|
+
/**
|
|
2406
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2407
|
+
* or session it was reached through.
|
|
2408
|
+
*
|
|
2409
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2410
|
+
* right one, and a second would be a second conversation.
|
|
2411
|
+
*/
|
|
2412
|
+
constructor(
|
|
2413
|
+
link: HostLink,
|
|
2414
|
+
window: string | null = null,
|
|
2415
|
+
session: string | null = null,
|
|
2416
|
+
) {
|
|
2417
|
+
super(link, "policy", window, session);
|
|
2418
|
+
this.pack = new Property(this, "pack", false);
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
|
|
2422
|
+
/** Whether the person is signed in to igni. Never their session or a credential. */
|
|
2423
|
+
export class HostAccount extends HostObject {
|
|
2424
|
+
static readonly PATH = "account";
|
|
2425
|
+
/** Who is signed in. */
|
|
2426
|
+
readonly status: Property<Account>;
|
|
2427
|
+
/** Someone signed in or out. */
|
|
2428
|
+
readonly changed: Signal<Account>;
|
|
2429
|
+
|
|
2430
|
+
/**
|
|
2431
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2432
|
+
* or session it was reached through.
|
|
2433
|
+
*
|
|
2434
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2435
|
+
* right one, and a second would be a second conversation.
|
|
2436
|
+
*/
|
|
2437
|
+
constructor(
|
|
2438
|
+
link: HostLink,
|
|
2439
|
+
window: string | null = null,
|
|
2440
|
+
session: string | null = null,
|
|
2441
|
+
) {
|
|
2442
|
+
super(link, "account", window, session);
|
|
2443
|
+
this.status = new Property(this, "status", false);
|
|
2444
|
+
this.changed = new Signal("account.changed");
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
/** Start the person's own sign-in. Its result is theirs. */
|
|
2448
|
+
sign_in(): Promise<void> {
|
|
2449
|
+
return this.call<void>("sign_in", {});
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2452
|
+
/** Sign the person out. */
|
|
2453
|
+
sign_out(): Promise<Account> {
|
|
2454
|
+
return this.call<Account>("sign_out", {});
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2457
|
+
|
|
2458
|
+
/** The floor's notifications. Its own always; everyone's with `notifications`. */
|
|
2459
|
+
export class HostNotifications extends HostObject {
|
|
2460
|
+
static readonly PATH = "notifications";
|
|
2461
|
+
/** Newest first. */
|
|
2462
|
+
readonly list: Property<NotificationEntry[]>;
|
|
2463
|
+
/** Unread counts. */
|
|
2464
|
+
readonly unread: Property<NotificationCounts>;
|
|
2465
|
+
/** The counts moved. */
|
|
2466
|
+
readonly changed: Signal<NotificationCounts>;
|
|
2467
|
+
|
|
2468
|
+
/**
|
|
2469
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2470
|
+
* or session it was reached through.
|
|
2471
|
+
*
|
|
2472
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2473
|
+
* right one, and a second would be a second conversation.
|
|
2474
|
+
*/
|
|
2475
|
+
constructor(
|
|
2476
|
+
link: HostLink,
|
|
2477
|
+
window: string | null = null,
|
|
2478
|
+
session: string | null = null,
|
|
2479
|
+
) {
|
|
2480
|
+
super(link, "notifications", window, session);
|
|
2481
|
+
this.list = new Property(this, "list", false);
|
|
2482
|
+
this.unread = new Property(this, "unread", false);
|
|
2483
|
+
this.changed = new Signal("notifications.changed");
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2486
|
+
/** Tell the person at this machine something. It never leaves the machine. */
|
|
2487
|
+
notify(notification: LocalNotification): Promise<void> {
|
|
2488
|
+
return this.call<void>("notify", { notification });
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
/** Mark notifications read: these ids, one source, or all of them. */
|
|
2492
|
+
mark_read(ids?: string[], source?: string): Promise<NotificationCounts> {
|
|
2493
|
+
return this.call<NotificationCounts>("mark_read", { ids, source });
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
|
|
2497
|
+
/** This extension, as the host sees it. */
|
|
2498
|
+
export class HostSelf extends HostObject {
|
|
2499
|
+
static readonly PATH = "self";
|
|
2500
|
+
/** Its manifest id. */
|
|
2501
|
+
readonly id: Property<string>;
|
|
2502
|
+
/** Its settings. Writable. */
|
|
2503
|
+
readonly settings: Property<Record<string, JsonValue>>;
|
|
2504
|
+
/** Its own entry. */
|
|
2505
|
+
readonly state: Property<ExtensionInfo>;
|
|
2506
|
+
/** Its home on the web: its service's URL, when it has one. */
|
|
2507
|
+
readonly web_url: Property<string | null>;
|
|
2508
|
+
/** Its settings changed. */
|
|
2509
|
+
readonly settings_changed: Signal<SettingsChange>;
|
|
2510
|
+
/** Its health moved. */
|
|
2511
|
+
readonly state_changed: Signal<ExtensionStateChange>;
|
|
2512
|
+
|
|
2513
|
+
/**
|
|
2514
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2515
|
+
* or session it was reached through.
|
|
2516
|
+
*
|
|
2517
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2518
|
+
* right one, and a second would be a second conversation.
|
|
2519
|
+
*/
|
|
2520
|
+
constructor(
|
|
2521
|
+
link: HostLink,
|
|
2522
|
+
window: string | null = null,
|
|
2523
|
+
session: string | null = null,
|
|
2524
|
+
) {
|
|
2525
|
+
super(link, "self", window, session);
|
|
2526
|
+
this.id = new Property(this, "id", false);
|
|
2527
|
+
this.settings = new Property(this, "settings", true);
|
|
2528
|
+
this.state = new Property(this, "state", false);
|
|
2529
|
+
this.web_url = new Property(this, "web_url", false);
|
|
2530
|
+
this.settings_changed = new Signal("self.settings_changed");
|
|
2531
|
+
this.state_changed = new Signal("self.state_changed");
|
|
2532
|
+
}
|
|
2533
|
+
|
|
2534
|
+
/** Say this extension is working inside igni's process, so the process is not suspended under it (in the cloud, its VM). A lease for `reason`: it expires after `ttl_seconds` (default and at most 600) unless renewed by calling again with the same reason, so an extension that stops answering cannot keep igni awake. Shown in `app.activity`'s `busy`. */
|
|
2535
|
+
busy(reason: string, ttl_seconds?: number): Promise<BusyLease> {
|
|
2536
|
+
return this.call<BusyLease>("busy", { reason, ttl_seconds });
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
/** Let go of the lease `busy` took for `reason`. Nothing happens if there is none. */
|
|
2540
|
+
done(reason: string): Promise<void> {
|
|
2541
|
+
return this.call<void>("done", { reason });
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
/** The root. `changed` reports every change anywhere in the model, for an extension that wants to see all of it; each delivery needs the grant of the member that changed. */
|
|
2546
|
+
export class Host extends HostObject {
|
|
2547
|
+
static readonly PATH = "";
|
|
2548
|
+
/** `host.app`. igni itself: how it presents things, which version, whether it is connected. */
|
|
2549
|
+
readonly app: HostApp;
|
|
2550
|
+
/** `host.windows`. Every open igni window. Address one window's UI with `host.windows.ui(id)`. */
|
|
2551
|
+
readonly windows: HostWindows;
|
|
2552
|
+
/** `host.ui`. What a window shows — the model its views bind to. `host.ui` is the active window, the one the person last used; `host.windows.ui(id)` any window. igni's own views write here too, by the same path, so every change below is a signal whoever made it. */
|
|
2553
|
+
readonly ui: HostUi;
|
|
2554
|
+
/** `host.sessions`. The sessions of this project, and which one the active window shows. Reach any session's chat, without showing it, with `host.sessions.chat(id)`. */
|
|
2555
|
+
readonly sessions: HostSessions;
|
|
2556
|
+
/** `host.chat`. The conversation in the current session. Signals carry the session they happened in, and arrive for every live session. `host.sessions.chat(id)` is the same object for any session of this project, without showing it: its properties read that session, and `post`, `queue`, `append` and `replace` write there (with `sessions.post` as well). A message posted there starts a run, or waits for the run already going there — never answering an approval. Its other methods act only on the session on screen. */
|
|
2557
|
+
readonly chat: HostChat;
|
|
2558
|
+
/** `host.plan`. Plan mode: the plan the agent proposed. */
|
|
2559
|
+
readonly plan: HostPlan;
|
|
2560
|
+
/** `host.tasks`. The agent's todo list and its sub-agent tasks. */
|
|
2561
|
+
readonly tasks: HostTasks;
|
|
2562
|
+
/** `host.loop`. `/loop`: a prompt repeated until done. */
|
|
2563
|
+
readonly loop: HostLoop;
|
|
2564
|
+
/** `host.commands`. Slash commands and skills. */
|
|
2565
|
+
readonly commands: HostCommands;
|
|
2566
|
+
/** `host.agents`. Agent definitions. */
|
|
2567
|
+
readonly agents: HostAgents;
|
|
2568
|
+
/** `host.workflows`. Workflows: scripted runs. */
|
|
2569
|
+
readonly workflows: HostWorkflows;
|
|
2570
|
+
/** `host.scheduler`. Scheduled tasks. */
|
|
2571
|
+
readonly scheduler: HostScheduler;
|
|
2572
|
+
/** `host.processes`. Background shells. */
|
|
2573
|
+
readonly processes: HostProcesses;
|
|
2574
|
+
/** `host.workspace`. The project, as far as the extension's workspace grant reaches. */
|
|
2575
|
+
readonly workspace: HostWorkspace;
|
|
2576
|
+
/** `host.models`. Models. */
|
|
2577
|
+
readonly models: HostModels;
|
|
2578
|
+
/** `host.mcp`. MCP servers. */
|
|
2579
|
+
readonly mcp: HostMcp;
|
|
2580
|
+
/** `host.plugins`. Plugins and marketplaces. */
|
|
2581
|
+
readonly plugins: HostPlugins;
|
|
2582
|
+
/** `host.extensions`. Installed extensions. Read-only, apart from this extension's own settings. */
|
|
2583
|
+
readonly extensions: HostExtensions;
|
|
2584
|
+
/** `host.hooks`. Hooks. */
|
|
2585
|
+
readonly hooks: HostHooks;
|
|
2586
|
+
/** `host.permissions`. What the agent may do without asking. */
|
|
2587
|
+
readonly permissions: HostPermissions;
|
|
2588
|
+
/** `host.policy`. The group policy in force. */
|
|
2589
|
+
readonly policy: HostPolicy;
|
|
2590
|
+
/** `host.account`. Whether the person is signed in to igni. Never their session or a credential. */
|
|
2591
|
+
readonly account: HostAccount;
|
|
2592
|
+
/** `host.notifications`. The floor's notifications. Its own always; everyone's with `notifications`. */
|
|
2593
|
+
readonly notifications: HostNotifications;
|
|
2594
|
+
/** `host.self`. This extension, as the host sees it. */
|
|
2595
|
+
readonly self: HostSelf;
|
|
2596
|
+
/** Anything changed. Carries the member's path and its new value. */
|
|
2597
|
+
readonly changed: Signal<Change>;
|
|
2598
|
+
|
|
2599
|
+
/**
|
|
2600
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2601
|
+
* or session it was reached through.
|
|
2602
|
+
*
|
|
2603
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2604
|
+
* right one, and a second would be a second conversation.
|
|
2605
|
+
*/
|
|
2606
|
+
constructor(
|
|
2607
|
+
link: HostLink,
|
|
2608
|
+
window: string | null = null,
|
|
2609
|
+
session: string | null = null,
|
|
2610
|
+
) {
|
|
2611
|
+
super(link, "", window, session);
|
|
2612
|
+
this.app = new HostApp(link, window, session);
|
|
2613
|
+
this.windows = new HostWindows(link, window, session);
|
|
2614
|
+
this.ui = new HostUi(link, window, session);
|
|
2615
|
+
this.sessions = new HostSessions(link, window, session);
|
|
2616
|
+
this.chat = new HostChat(link, window, session);
|
|
2617
|
+
this.plan = new HostPlan(link, window, session);
|
|
2618
|
+
this.tasks = new HostTasks(link, window, session);
|
|
2619
|
+
this.loop = new HostLoop(link, window, session);
|
|
2620
|
+
this.commands = new HostCommands(link, window, session);
|
|
2621
|
+
this.agents = new HostAgents(link, window, session);
|
|
2622
|
+
this.workflows = new HostWorkflows(link, window, session);
|
|
2623
|
+
this.scheduler = new HostScheduler(link, window, session);
|
|
2624
|
+
this.processes = new HostProcesses(link, window, session);
|
|
2625
|
+
this.workspace = new HostWorkspace(link, window, session);
|
|
2626
|
+
this.models = new HostModels(link, window, session);
|
|
2627
|
+
this.mcp = new HostMcp(link, window, session);
|
|
2628
|
+
this.plugins = new HostPlugins(link, window, session);
|
|
2629
|
+
this.extensions = new HostExtensions(link, window, session);
|
|
2630
|
+
this.hooks = new HostHooks(link, window, session);
|
|
2631
|
+
this.permissions = new HostPermissions(link, window, session);
|
|
2632
|
+
this.policy = new HostPolicy(link, window, session);
|
|
2633
|
+
this.account = new HostAccount(link, window, session);
|
|
2634
|
+
this.notifications = new HostNotifications(link, window, session);
|
|
2635
|
+
this.self = new HostSelf(link, window, session);
|
|
2636
|
+
this.changed = new Signal("changed");
|
|
2637
|
+
}
|
|
2638
|
+
|
|
2639
|
+
/** Ask igni's local decision model (Laya) typed questions about a context, in one pass on this machine. `context` is named text fields — at most 8, 6,000 characters in all — that the questions quote in backticks; `questions` are 1–16 `DecisionQuestion`s. A context the model would have to cut is refused (`invalid`), never answered from part of it; a model that cannot be loaded answers `unavailable`. Zero-shot accuracy is modest: measure it on your own data before acting on an answer, and use the probabilities, not just the answer. */
|
|
2640
|
+
decide(context: Record<string, string>, questions: DecisionQuestion[]): Promise<Decision> {
|
|
2641
|
+
return this.call<Decision>("decide", { context, questions });
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2644
|
+
/** `decide` for up to 16 contexts at once, sharing forward passes. One decision per context, in order. */
|
|
2645
|
+
decide_batch(contexts: (Record<string, string>)[], questions: DecisionQuestion[]): Promise<Decision[]> {
|
|
2646
|
+
return this.call<Decision[]>("decide_batch", { contexts, questions });
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
|