@ignite-ember/extension-bridge 0.0.0-stage → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +364 -2
- package/dist/bridge.d.ts +37 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +96 -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 +137 -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 +75 -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 +159 -0
- package/dist/hostModel.d.ts.map +1 -0
- package/dist/hostModel.generated.d.ts +2373 -0
- package/dist/hostModel.generated.d.ts.map +1 -0
- package/dist/hostModel.generated.js +1746 -0
- package/dist/hostModel.generated.js.map +1 -0
- package/dist/hostModel.js +172 -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 +348 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +145 -0
- package/dist/protocol.js.map +1 -0
- package/dist/service.d.ts +168 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +196 -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 +101 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +164 -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 +116 -0
- package/src/channel.ts +48 -0
- package/src/contract.ts +157 -0
- package/src/correlator.ts +88 -0
- package/src/guestBridge.ts +261 -0
- package/src/hostModel.generated.ts +3155 -0
- package/src/hostModel.ts +213 -0
- package/src/index.ts +11 -0
- package/src/protocol.ts +485 -0
- package/src/service.ts +278 -0
- package/src/signals.ts +65 -0
- package/src/tokens.ts +171 -0
- package/src/watchers.ts +18 -0
|
@@ -0,0 +1,3155 @@
|
|
|
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
|
+
// igni-core's `docs/HOST_OBJECT_MODEL.md` (https://github.com/ignite-ember/igni-core/blob/main/docs/HOST_OBJECT_MODEL.md) 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
|
+
* @param link — The link this object talks to the host through.
|
|
1181
|
+
* @param window — The window it was reached through, or null for
|
|
1182
|
+
* the one the page is in.
|
|
1183
|
+
* @param session — The session it was reached through, or null for
|
|
1184
|
+
* the one on screen.
|
|
1185
|
+
*/
|
|
1186
|
+
constructor(
|
|
1187
|
+
link: HostLink,
|
|
1188
|
+
window: string | null = null,
|
|
1189
|
+
session: string | null = null,
|
|
1190
|
+
) {
|
|
1191
|
+
super(link, "app.state", window, session);
|
|
1192
|
+
this.values = new Property(this, "values", false);
|
|
1193
|
+
this.changed = new Signal("app.state.changed");
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
/**
|
|
1197
|
+
* One value, or `None`.
|
|
1198
|
+
*
|
|
1199
|
+
* @param key — The key to read the value of.
|
|
1200
|
+
*/
|
|
1201
|
+
get(key: string): Promise<string | null> {
|
|
1202
|
+
return this.call<string | null>("get", { key });
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
/**
|
|
1206
|
+
* Store one value.
|
|
1207
|
+
*
|
|
1208
|
+
* @param key — The key to store the value under.
|
|
1209
|
+
* @param value — The value to store.
|
|
1210
|
+
*/
|
|
1211
|
+
set(key: string, value: string): Promise<void> {
|
|
1212
|
+
return this.call<void>("set", { key, value });
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
/**
|
|
1216
|
+
* Remove one key.
|
|
1217
|
+
*
|
|
1218
|
+
* @param key — The key to remove.
|
|
1219
|
+
*/
|
|
1220
|
+
delete(key: string): Promise<void> {
|
|
1221
|
+
return this.call<void>("delete", { key });
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
/** 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. */
|
|
1226
|
+
export class HostChatApprovals extends HostObject {
|
|
1227
|
+
static readonly PATH = "chat.approvals";
|
|
1228
|
+
/** Requests not yet answered. */
|
|
1229
|
+
readonly waiting: Property<Approval[]>;
|
|
1230
|
+
/** The agent asked. */
|
|
1231
|
+
readonly requested: Signal<Approval>;
|
|
1232
|
+
/** Somebody answered. */
|
|
1233
|
+
readonly resolved: Signal<ApprovalResolved>;
|
|
1234
|
+
/** The reason arrived. */
|
|
1235
|
+
readonly details: Signal<ApprovalDetails>;
|
|
1236
|
+
/** An approval appeared or went away, whoever answered and whenever — including after a restart. For an app following approvals through the API. */
|
|
1237
|
+
readonly changed: Signal<ApprovalChange>;
|
|
1238
|
+
|
|
1239
|
+
/**
|
|
1240
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1241
|
+
* or session it was reached through.
|
|
1242
|
+
*
|
|
1243
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1244
|
+
* right one, and a second would be a second conversation.
|
|
1245
|
+
*
|
|
1246
|
+
* @param link — The link this object talks to the host through.
|
|
1247
|
+
* @param window — The window it was reached through, or null for
|
|
1248
|
+
* the one the page is in.
|
|
1249
|
+
* @param session — The session it was reached through, or null for
|
|
1250
|
+
* the one on screen.
|
|
1251
|
+
*/
|
|
1252
|
+
constructor(
|
|
1253
|
+
link: HostLink,
|
|
1254
|
+
window: string | null = null,
|
|
1255
|
+
session: string | null = null,
|
|
1256
|
+
) {
|
|
1257
|
+
super(link, "chat.approvals", window, session);
|
|
1258
|
+
this.waiting = new Property(this, "waiting", false);
|
|
1259
|
+
this.requested = new Signal("chat.approvals.requested");
|
|
1260
|
+
this.resolved = new Signal("chat.approvals.resolved");
|
|
1261
|
+
this.details = new Signal("chat.approvals.details");
|
|
1262
|
+
this.changed = new Signal("chat.approvals.changed");
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
/**
|
|
1266
|
+
* Answer one request, as the person's dialog does.
|
|
1267
|
+
*
|
|
1268
|
+
* @param requirement_id — The waiting request to answer, by its id.
|
|
1269
|
+
* @param action — `confirm` or `reject`.
|
|
1270
|
+
* @param choice — `once`, `always` or `similar`.
|
|
1271
|
+
*/
|
|
1272
|
+
answer(requirement_id: string, action: string, choice?: string): Promise<void> {
|
|
1273
|
+
return this.call<void>("answer", { requirement_id, action, choice });
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
/**
|
|
1277
|
+
* Answer every request of a pause at once.
|
|
1278
|
+
*
|
|
1279
|
+
* @param answers — The answers to give, one per waiting request.
|
|
1280
|
+
*/
|
|
1281
|
+
answer_all(answers: ApprovalAnswer[]): Promise<void> {
|
|
1282
|
+
return this.call<void>("answer_all", { answers });
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
/** 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. */
|
|
1287
|
+
export class HostChatViews extends HostObject {
|
|
1288
|
+
static readonly PATH = "chat.views";
|
|
1289
|
+
/** The views in the current session. */
|
|
1290
|
+
readonly list: Property<View[]>;
|
|
1291
|
+
/** A view appeared or was replaced. */
|
|
1292
|
+
readonly shown: Signal<View>;
|
|
1293
|
+
/** The person used a control in a view. */
|
|
1294
|
+
readonly action: Signal<ViewAction>;
|
|
1295
|
+
|
|
1296
|
+
/**
|
|
1297
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1298
|
+
* or session it was reached through.
|
|
1299
|
+
*
|
|
1300
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1301
|
+
* right one, and a second would be a second conversation.
|
|
1302
|
+
*
|
|
1303
|
+
* @param link — The link this object talks to the host through.
|
|
1304
|
+
* @param window — The window it was reached through, or null for
|
|
1305
|
+
* the one the page is in.
|
|
1306
|
+
* @param session — The session it was reached through, or null for
|
|
1307
|
+
* the one on screen.
|
|
1308
|
+
*/
|
|
1309
|
+
constructor(
|
|
1310
|
+
link: HostLink,
|
|
1311
|
+
window: string | null = null,
|
|
1312
|
+
session: string | null = null,
|
|
1313
|
+
) {
|
|
1314
|
+
super(link, "chat.views", window, session);
|
|
1315
|
+
this.list = new Property(this, "list", false);
|
|
1316
|
+
this.shown = new Signal("chat.views.shown");
|
|
1317
|
+
this.action = new Signal("chat.views.action");
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
/**
|
|
1321
|
+
* Act on a view as if the person had.
|
|
1322
|
+
*
|
|
1323
|
+
* @param view_id — The view the action was used on, by its id.
|
|
1324
|
+
* @param action — The control's action name.
|
|
1325
|
+
* @param params — The values the view attached to the action.
|
|
1326
|
+
*/
|
|
1327
|
+
dispatch(view_id: string, action: string, params?: Record<string, JsonValue>): Promise<JsonValue> {
|
|
1328
|
+
return this.call<JsonValue>("dispatch", { view_id, action, params });
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
/** igni itself: how it presents things, which version, whether it is connected. */
|
|
1333
|
+
export class HostApp extends HostObject {
|
|
1334
|
+
static readonly PATH = "app";
|
|
1335
|
+
/** `host.app.state`. Key–value state of the extension's own, kept by the host across restarts. An extension sees only its own keys. */
|
|
1336
|
+
readonly state: HostAppState;
|
|
1337
|
+
/** Theme, verbosity, output style. */
|
|
1338
|
+
readonly display: Property<Display>;
|
|
1339
|
+
/** The igni version running. */
|
|
1340
|
+
readonly version: Property<string>;
|
|
1341
|
+
/** A newer igni, as last checked; `None` when there is none or it was not checked yet. */
|
|
1342
|
+
readonly update_available: Property<UpdateInfo | null>;
|
|
1343
|
+
/** Model and server reachability. */
|
|
1344
|
+
readonly connection: Property<Connection>;
|
|
1345
|
+
/** Running, waiting on a person, or idle — what decides whether igni's process may be suspended. */
|
|
1346
|
+
readonly activity: Property<Activity>;
|
|
1347
|
+
/** Verbosity or output style changed. */
|
|
1348
|
+
readonly display_changed: Signal<Display>;
|
|
1349
|
+
/** The connection changed. */
|
|
1350
|
+
readonly connection_changed: Signal<Connection>;
|
|
1351
|
+
/** An update check answered. */
|
|
1352
|
+
readonly update_changed: Signal<UpdateInfo | null>;
|
|
1353
|
+
/** igni started or stopped doing something. */
|
|
1354
|
+
readonly activity_changed: Signal<Activity>;
|
|
1355
|
+
|
|
1356
|
+
/**
|
|
1357
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1358
|
+
* or session it was reached through.
|
|
1359
|
+
*
|
|
1360
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1361
|
+
* right one, and a second would be a second conversation.
|
|
1362
|
+
*
|
|
1363
|
+
* @param link — The link this object talks to the host through.
|
|
1364
|
+
* @param window — The window it was reached through, or null for
|
|
1365
|
+
* the one the page is in.
|
|
1366
|
+
* @param session — The session it was reached through, or null for
|
|
1367
|
+
* the one on screen.
|
|
1368
|
+
*/
|
|
1369
|
+
constructor(
|
|
1370
|
+
link: HostLink,
|
|
1371
|
+
window: string | null = null,
|
|
1372
|
+
session: string | null = null,
|
|
1373
|
+
) {
|
|
1374
|
+
super(link, "app", window, session);
|
|
1375
|
+
this.state = new HostAppState(link, window, session);
|
|
1376
|
+
this.display = new Property(this, "display", false);
|
|
1377
|
+
this.version = new Property(this, "version", false);
|
|
1378
|
+
this.update_available = new Property(this, "update_available", false);
|
|
1379
|
+
this.connection = new Property(this, "connection", false);
|
|
1380
|
+
this.activity = new Property(this, "activity", false);
|
|
1381
|
+
this.display_changed = new Signal("app.display_changed");
|
|
1382
|
+
this.connection_changed = new Signal("app.connection_changed");
|
|
1383
|
+
this.update_changed = new Signal("app.update_changed");
|
|
1384
|
+
this.activity_changed = new Signal("app.activity_changed");
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
/**
|
|
1388
|
+
* Show or hide routing detail.
|
|
1389
|
+
*
|
|
1390
|
+
* @param on — Whether routing detail is shown.
|
|
1391
|
+
*/
|
|
1392
|
+
set_verbose(on: boolean): Promise<Display> {
|
|
1393
|
+
return this.call<Display>("set_verbose", { on });
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
/**
|
|
1397
|
+
* Switch the output style, as `/output-style <name>` does.
|
|
1398
|
+
*
|
|
1399
|
+
* @param name — The output style to switch to, by its name.
|
|
1400
|
+
*/
|
|
1401
|
+
set_output_style(name: string): Promise<Display> {
|
|
1402
|
+
return this.call<Display>("set_output_style", { name });
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
/** 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`. */
|
|
1406
|
+
check_for_update(): Promise<UpdateInfo | null> {
|
|
1407
|
+
return this.call<UpdateInfo | null>("check_for_update", {});
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
/**
|
|
1411
|
+
* 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`).
|
|
1412
|
+
*
|
|
1413
|
+
* @param url — The link: `https://` only.
|
|
1414
|
+
*/
|
|
1415
|
+
open_external(url: string): Promise<void> {
|
|
1416
|
+
return this.call<void>("open_external", { url });
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
/** Every open igni window. Address one window's UI with `host.windows.ui(id)`. */
|
|
1421
|
+
export class HostWindows extends HostObject {
|
|
1422
|
+
static readonly PATH = "windows";
|
|
1423
|
+
/** Every window connected now. */
|
|
1424
|
+
readonly list: Property<WindowInfo[]>;
|
|
1425
|
+
/** The window the person is using — the one with focus; `None` when igni is in the background. */
|
|
1426
|
+
readonly focused: Property<string | null>;
|
|
1427
|
+
/** A window connected. */
|
|
1428
|
+
readonly opened: Signal<WindowInfo>;
|
|
1429
|
+
/** A window went away. */
|
|
1430
|
+
readonly closed: Signal<WindowInfo>;
|
|
1431
|
+
/** A window took focus or lost it; `focused` says which. */
|
|
1432
|
+
readonly focus_changed: Signal<WindowInfo>;
|
|
1433
|
+
|
|
1434
|
+
/**
|
|
1435
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1436
|
+
* or session it was reached through.
|
|
1437
|
+
*
|
|
1438
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1439
|
+
* right one, and a second would be a second conversation.
|
|
1440
|
+
*
|
|
1441
|
+
* @param link — The link this object talks to the host through.
|
|
1442
|
+
* @param window — The window it was reached through, or null for
|
|
1443
|
+
* the one the page is in.
|
|
1444
|
+
* @param session — The session it was reached through, or null for
|
|
1445
|
+
* the one on screen.
|
|
1446
|
+
*/
|
|
1447
|
+
constructor(
|
|
1448
|
+
link: HostLink,
|
|
1449
|
+
window: string | null = null,
|
|
1450
|
+
session: string | null = null,
|
|
1451
|
+
) {
|
|
1452
|
+
super(link, "windows", window, session);
|
|
1453
|
+
this.list = new Property(this, "list", false);
|
|
1454
|
+
this.focused = new Property(this, "focused", false);
|
|
1455
|
+
this.opened = new Signal("windows.opened");
|
|
1456
|
+
this.closed = new Signal("windows.closed");
|
|
1457
|
+
this.focus_changed = new Signal("windows.focus_changed");
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
/**
|
|
1461
|
+
* `host.ui` of one window, by its id.
|
|
1462
|
+
*
|
|
1463
|
+
* @param windowId — The window to reach, by its id.
|
|
1464
|
+
*/
|
|
1465
|
+
ui(windowId: string): HostUi {
|
|
1466
|
+
return new HostUi(this.link, windowId);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
/** 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. */
|
|
1471
|
+
export class HostUi extends HostObject {
|
|
1472
|
+
static readonly PATH = "ui";
|
|
1473
|
+
/** The page stack; empty when the chat is showing. Writable: setting it navigates. */
|
|
1474
|
+
readonly route: Property<Page[]>;
|
|
1475
|
+
/** The panel open over the chat. Writable: setting it opens one, `None` closes it. */
|
|
1476
|
+
readonly panel: Property<Panel | null>;
|
|
1477
|
+
/** The sidebar. Writable. */
|
|
1478
|
+
readonly sidebar: Property<Sidebar>;
|
|
1479
|
+
/** The file previewed. Writable: `None` closes it. */
|
|
1480
|
+
readonly preview: Property<Preview | null>;
|
|
1481
|
+
/** What is selected. Writable. */
|
|
1482
|
+
readonly selection: Property<SelectionState>;
|
|
1483
|
+
/** The composer: draft, the files it refers to, its mode. Writable. */
|
|
1484
|
+
readonly composer: Property<Composer>;
|
|
1485
|
+
/** Toasts on screen, oldest first. */
|
|
1486
|
+
readonly toasts: Property<Toast[]>;
|
|
1487
|
+
/** The open dialog. */
|
|
1488
|
+
readonly dialog: Property<Dialog | null>;
|
|
1489
|
+
/** Where the transcript is. */
|
|
1490
|
+
readonly scroll: Property<Scroll>;
|
|
1491
|
+
/** The page stack changed. */
|
|
1492
|
+
readonly navigated: Signal<Route>;
|
|
1493
|
+
/** A panel opened or closed. */
|
|
1494
|
+
readonly panel_changed: Signal<PanelChange>;
|
|
1495
|
+
/** The sidebar changed. */
|
|
1496
|
+
readonly sidebar_changed: Signal<SidebarChange>;
|
|
1497
|
+
/** The preview opened, changed or closed. */
|
|
1498
|
+
readonly preview_changed: Signal<PreviewChange>;
|
|
1499
|
+
/** The selection changed. */
|
|
1500
|
+
readonly selection_changed: Signal<SelectionChange>;
|
|
1501
|
+
/** The draft changed. */
|
|
1502
|
+
readonly composer_changed: Signal<ComposerChange>;
|
|
1503
|
+
/** A toast appeared. */
|
|
1504
|
+
readonly toast_shown: Signal<ToastChange>;
|
|
1505
|
+
/** A toast went away. */
|
|
1506
|
+
readonly toast_dismissed: Signal<ToastChange>;
|
|
1507
|
+
/** A dialog opened. */
|
|
1508
|
+
readonly dialog_opened: Signal<DialogChange>;
|
|
1509
|
+
/** A dialog closed, with the answer. */
|
|
1510
|
+
readonly dialog_closed: Signal<DialogChange>;
|
|
1511
|
+
/** The transcript came to rest somewhere else, or started or stopped following the newest message. */
|
|
1512
|
+
readonly scrolled: Signal<Scroll>;
|
|
1513
|
+
|
|
1514
|
+
/**
|
|
1515
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1516
|
+
* or session it was reached through.
|
|
1517
|
+
*
|
|
1518
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1519
|
+
* right one, and a second would be a second conversation.
|
|
1520
|
+
*
|
|
1521
|
+
* @param link — The link this object talks to the host through.
|
|
1522
|
+
* @param window — The window it was reached through, or null for
|
|
1523
|
+
* the one the page is in.
|
|
1524
|
+
* @param session — The session it was reached through, or null for
|
|
1525
|
+
* the one on screen.
|
|
1526
|
+
*/
|
|
1527
|
+
constructor(
|
|
1528
|
+
link: HostLink,
|
|
1529
|
+
window: string | null = null,
|
|
1530
|
+
session: string | null = null,
|
|
1531
|
+
) {
|
|
1532
|
+
super(link, "ui", window, session);
|
|
1533
|
+
this.route = new Property(this, "route", true);
|
|
1534
|
+
this.panel = new Property(this, "panel", true);
|
|
1535
|
+
this.sidebar = new Property(this, "sidebar", true);
|
|
1536
|
+
this.preview = new Property(this, "preview", true);
|
|
1537
|
+
this.selection = new Property(this, "selection", true);
|
|
1538
|
+
this.composer = new Property(this, "composer", true);
|
|
1539
|
+
this.toasts = new Property(this, "toasts", false);
|
|
1540
|
+
this.dialog = new Property(this, "dialog", false);
|
|
1541
|
+
this.scroll = new Property(this, "scroll", false);
|
|
1542
|
+
this.navigated = new Signal("ui.navigated");
|
|
1543
|
+
this.panel_changed = new Signal("ui.panel_changed");
|
|
1544
|
+
this.sidebar_changed = new Signal("ui.sidebar_changed");
|
|
1545
|
+
this.preview_changed = new Signal("ui.preview_changed");
|
|
1546
|
+
this.selection_changed = new Signal("ui.selection_changed");
|
|
1547
|
+
this.composer_changed = new Signal("ui.composer_changed");
|
|
1548
|
+
this.toast_shown = new Signal("ui.toast_shown");
|
|
1549
|
+
this.toast_dismissed = new Signal("ui.toast_dismissed");
|
|
1550
|
+
this.dialog_opened = new Signal("ui.dialog_opened");
|
|
1551
|
+
this.dialog_closed = new Signal("ui.dialog_closed");
|
|
1552
|
+
this.scrolled = new Signal("ui.scrolled");
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
/**
|
|
1556
|
+
* Open a page at the top of the stack, as a header link does.
|
|
1557
|
+
*
|
|
1558
|
+
* @param page — A page kind: `plugins`, `extensions`, an extension's page.
|
|
1559
|
+
* @param params — The page's parameters.
|
|
1560
|
+
*/
|
|
1561
|
+
navigate(page: string, params?: Record<string, string>): Promise<Page[]> {
|
|
1562
|
+
return this.call<Page[]>("navigate", { page, params });
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
/** Go back one level; at the root, back to the chat. */
|
|
1566
|
+
back(): Promise<Page[]> {
|
|
1567
|
+
return this.call<Page[]>("back", {});
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
/**
|
|
1571
|
+
* Open a panel over the chat, closing the one that was open.
|
|
1572
|
+
*
|
|
1573
|
+
* @param kind — `notifications`, `search`, `login` or `dir-picker`.
|
|
1574
|
+
* @param params — The panel's own parameters: what the panel shows, in the panel's own shape.
|
|
1575
|
+
*/
|
|
1576
|
+
open_panel(kind: string, params?: Record<string, JsonValue>): Promise<Panel> {
|
|
1577
|
+
return this.call<Panel>("open_panel", { kind, params });
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
/** Close the panel. */
|
|
1581
|
+
close_panel(): Promise<void> {
|
|
1582
|
+
return this.call<void>("close_panel", {});
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
/**
|
|
1586
|
+
* Open or close the sidebar, and size it or bring a section into view.
|
|
1587
|
+
*
|
|
1588
|
+
* @param open — Whether the sidebar is open.
|
|
1589
|
+
* @param width — In pixels, 180 to 600.
|
|
1590
|
+
* @param section — `links` or `sessions`.
|
|
1591
|
+
*/
|
|
1592
|
+
set_sidebar(open: boolean, width?: number, section?: string): Promise<Sidebar> {
|
|
1593
|
+
return this.call<Sidebar>("set_sidebar", { open, width, section });
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
/**
|
|
1597
|
+
* Preview a file of the project. (`preview` is the property.)
|
|
1598
|
+
*
|
|
1599
|
+
* @param path — The file to preview, by its path in the project.
|
|
1600
|
+
*/
|
|
1601
|
+
open_preview(path: string): Promise<Preview> {
|
|
1602
|
+
return this.call<Preview>("open_preview", { path });
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
/** Close the preview. */
|
|
1606
|
+
close_preview(): Promise<void> {
|
|
1607
|
+
return this.call<void>("close_preview", {});
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
/**
|
|
1611
|
+
* Select a message, text or file. The parts left out are cleared.
|
|
1612
|
+
*
|
|
1613
|
+
* @param selection — What is selected: a message, text or a file; the parts left out are cleared.
|
|
1614
|
+
*/
|
|
1615
|
+
select(selection: SelectionState): Promise<SelectionState> {
|
|
1616
|
+
return this.call<SelectionState>("select", { selection });
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
/**
|
|
1620
|
+
* Replace the draft.
|
|
1621
|
+
*
|
|
1622
|
+
* @param text — The draft to put in the composer.
|
|
1623
|
+
* @param attachments — Files to refer to: each becomes an `@path` the draft does not already have.
|
|
1624
|
+
* @param mode — `chat`, `command` or `shell`; unchanged if left out.
|
|
1625
|
+
*/
|
|
1626
|
+
set_composer(text: string, attachments?: string[], mode?: string): Promise<Composer> {
|
|
1627
|
+
return this.call<Composer>("set_composer", { text, attachments, mode });
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
/**
|
|
1631
|
+
* Show a transient message, labelled as this extension's.
|
|
1632
|
+
*
|
|
1633
|
+
* @param text — The toast's first line.
|
|
1634
|
+
* @param kind — `info` (default), `success`, `warning`, `error`.
|
|
1635
|
+
* @param body — A second line.
|
|
1636
|
+
* @param target — Where clicking it goes.
|
|
1637
|
+
*/
|
|
1638
|
+
toast(text: string, kind?: string, body?: string, target?: Page): Promise<Toast> {
|
|
1639
|
+
return this.call<Toast>("toast", { text, kind, body, target });
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
/**
|
|
1643
|
+
* Take one of this extension's toasts away.
|
|
1644
|
+
*
|
|
1645
|
+
* @param toast_id — The toast to take away, by its id.
|
|
1646
|
+
*/
|
|
1647
|
+
dismiss_toast(toast_id: string): Promise<void> {
|
|
1648
|
+
return this.call<void>("dismiss_toast", { toast_id });
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
/**
|
|
1652
|
+
* 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.)
|
|
1653
|
+
*
|
|
1654
|
+
* @param spec — The dialog to show: its title, body, buttons and input.
|
|
1655
|
+
*/
|
|
1656
|
+
show_dialog(spec: JsonValue): Promise<JsonValue> {
|
|
1657
|
+
return this.call<JsonValue>("show_dialog", { spec });
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
/**
|
|
1661
|
+
* Scroll the transcript to a message, by its run; `bottom` for the newest.
|
|
1662
|
+
*
|
|
1663
|
+
* @param message_id — The message to scroll to, named by the run it belongs to; `bottom` for the newest.
|
|
1664
|
+
*/
|
|
1665
|
+
scroll_to(message_id: string): Promise<Scroll> {
|
|
1666
|
+
return this.call<Scroll>("scroll_to", { message_id });
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
/** 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)`. */
|
|
1671
|
+
export class HostSessions extends HostObject {
|
|
1672
|
+
static readonly PATH = "sessions";
|
|
1673
|
+
/** Every session, newest first. */
|
|
1674
|
+
readonly list: Property<SessionInfo[]>;
|
|
1675
|
+
/** The session the active window shows. Writable: setting it switches, and is refused where the person's switch would be. */
|
|
1676
|
+
readonly current: Property<string>;
|
|
1677
|
+
/** A window moved to another session. */
|
|
1678
|
+
readonly current_changed: Signal<SessionChange>;
|
|
1679
|
+
/** The session list was read. */
|
|
1680
|
+
readonly listed: Signal<SessionList>;
|
|
1681
|
+
/** `/clear` renewed a session. */
|
|
1682
|
+
readonly cleared: Signal<SessionCleared>;
|
|
1683
|
+
/** A session got its name. */
|
|
1684
|
+
readonly named: Signal<SessionNamed>;
|
|
1685
|
+
|
|
1686
|
+
/**
|
|
1687
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1688
|
+
* or session it was reached through.
|
|
1689
|
+
*
|
|
1690
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1691
|
+
* right one, and a second would be a second conversation.
|
|
1692
|
+
*
|
|
1693
|
+
* @param link — The link this object talks to the host through.
|
|
1694
|
+
* @param window — The window it was reached through, or null for
|
|
1695
|
+
* the one the page is in.
|
|
1696
|
+
* @param session — The session it was reached through, or null for
|
|
1697
|
+
* the one on screen.
|
|
1698
|
+
*/
|
|
1699
|
+
constructor(
|
|
1700
|
+
link: HostLink,
|
|
1701
|
+
window: string | null = null,
|
|
1702
|
+
session: string | null = null,
|
|
1703
|
+
) {
|
|
1704
|
+
super(link, "sessions", window, session);
|
|
1705
|
+
this.list = new Property(this, "list", false);
|
|
1706
|
+
this.current = new Property(this, "current", true);
|
|
1707
|
+
this.current_changed = new Signal("session.switched");
|
|
1708
|
+
this.listed = new Signal("sessions.listed");
|
|
1709
|
+
this.cleared = new Signal("sessions.cleared");
|
|
1710
|
+
this.named = new Signal("sessions.named");
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
/**
|
|
1714
|
+
* Show a session in the active window.
|
|
1715
|
+
*
|
|
1716
|
+
* @param session_id — The session to open, by its id.
|
|
1717
|
+
*/
|
|
1718
|
+
open(session_id: string): Promise<SessionChange> {
|
|
1719
|
+
return this.call<SessionChange>("open", { session_id });
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
/**
|
|
1723
|
+
* 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.
|
|
1724
|
+
*
|
|
1725
|
+
* @param project_dir — The folder the new session works in; this project when left out.
|
|
1726
|
+
* @param title — Its name in the session list.
|
|
1727
|
+
* @param focus — Show it in the caller's window — a page's own, else the active one. False by default.
|
|
1728
|
+
*/
|
|
1729
|
+
create(project_dir?: string, title?: string, focus?: boolean): Promise<SessionAttached> {
|
|
1730
|
+
return this.call<SessionAttached>("create", { project_dir, title, focus });
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
/**
|
|
1734
|
+
* Make sure a session is live, without showing it.
|
|
1735
|
+
*
|
|
1736
|
+
* @param session_id — The session to make live, by its id.
|
|
1737
|
+
* @param project_dir — The folder the session works in; it must belong to that session.
|
|
1738
|
+
*/
|
|
1739
|
+
attach(session_id: string, project_dir?: string): Promise<SessionAttached> {
|
|
1740
|
+
return this.call<SessionAttached>("attach", { session_id, project_dir });
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
/**
|
|
1744
|
+
* `host.chat` of any session of this project, by its id, without showing it. The session on screen's id is `host.chat` itself.
|
|
1745
|
+
*
|
|
1746
|
+
* @param sessionId — The session to reach, by its id.
|
|
1747
|
+
*/
|
|
1748
|
+
chat(sessionId: string): HostChat {
|
|
1749
|
+
return new HostChat(this.link, null, sessionId);
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
/** 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. */
|
|
1754
|
+
export class HostChat extends HostObject {
|
|
1755
|
+
static readonly PATH = "chat";
|
|
1756
|
+
/** `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. */
|
|
1757
|
+
readonly approvals: HostChatApprovals;
|
|
1758
|
+
/** `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. */
|
|
1759
|
+
readonly views: HostChatViews;
|
|
1760
|
+
/** The current session. */
|
|
1761
|
+
readonly session_id: Property<string>;
|
|
1762
|
+
/** The transcript, turn by turn. */
|
|
1763
|
+
readonly messages: Property<JsonValue[]>;
|
|
1764
|
+
/** Messages waiting for a turn. */
|
|
1765
|
+
readonly pending: Property<JsonValue[]>;
|
|
1766
|
+
/** Whether a run is going. */
|
|
1767
|
+
readonly processing: Property<boolean>;
|
|
1768
|
+
/** The status line. */
|
|
1769
|
+
readonly status: Property<Status>;
|
|
1770
|
+
/** Seconds a run may take. */
|
|
1771
|
+
readonly timeout: Property<number>;
|
|
1772
|
+
/** Runs that stopped part-way. */
|
|
1773
|
+
readonly interrupted_runs: Property<JsonValue[]>;
|
|
1774
|
+
/** Token counts and what fills them. */
|
|
1775
|
+
readonly context: Property<ContextUsage>;
|
|
1776
|
+
/** A message was posted — by the person, an extension, or an extension's service (`from_service`). */
|
|
1777
|
+
readonly message_added: Signal<ChatMessage>;
|
|
1778
|
+
/** The agent's answer, streaming. */
|
|
1779
|
+
readonly content_delta: Signal<ContentDelta>;
|
|
1780
|
+
/** The agent started thinking. */
|
|
1781
|
+
readonly reasoning_started: Signal<RunRef>;
|
|
1782
|
+
/** A run started. */
|
|
1783
|
+
readonly run_started: Signal<RunStart>;
|
|
1784
|
+
/** A run finished, with the files it changed. */
|
|
1785
|
+
readonly run_completed: Signal<Run>;
|
|
1786
|
+
/** A run stopped with an error. */
|
|
1787
|
+
readonly run_error: Signal<RunFailure>;
|
|
1788
|
+
/** A run is waiting for approvals. */
|
|
1789
|
+
readonly run_paused: Signal<RunPause>;
|
|
1790
|
+
/** The answer finished streaming. */
|
|
1791
|
+
readonly streaming_done: Signal<RunRef>;
|
|
1792
|
+
/** Somebody's draft, live. */
|
|
1793
|
+
readonly typing: Signal<Typing>;
|
|
1794
|
+
/** The status line changed. */
|
|
1795
|
+
readonly status_changed: Signal<Status>;
|
|
1796
|
+
/** An info line. */
|
|
1797
|
+
readonly info: Signal<Notice>;
|
|
1798
|
+
/** An error line. */
|
|
1799
|
+
readonly error: Signal<Notice>;
|
|
1800
|
+
/** The agent called a tool. */
|
|
1801
|
+
readonly tool_started: Signal<ToolCall>;
|
|
1802
|
+
/** A tool call finished. */
|
|
1803
|
+
readonly tool_completed: Signal<ToolResult>;
|
|
1804
|
+
/** A tool call failed. */
|
|
1805
|
+
readonly tool_error: Signal<ToolFailure>;
|
|
1806
|
+
/** A model call finished. */
|
|
1807
|
+
readonly model_completed: Signal<ModelUsage>;
|
|
1808
|
+
/** The agent wrote a file. */
|
|
1809
|
+
readonly file_edited: Signal<FileEdited>;
|
|
1810
|
+
/** A sub-agent or team moved on. */
|
|
1811
|
+
readonly agent_event: Signal<AgentEvent>;
|
|
1812
|
+
/** A network call is being retried. */
|
|
1813
|
+
readonly retry: Signal<Retry>;
|
|
1814
|
+
/** Turns were truncated or discarded. */
|
|
1815
|
+
readonly history_changed: Signal<HistoryChange>;
|
|
1816
|
+
|
|
1817
|
+
/**
|
|
1818
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1819
|
+
* or session it was reached through.
|
|
1820
|
+
*
|
|
1821
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1822
|
+
* right one, and a second would be a second conversation.
|
|
1823
|
+
*
|
|
1824
|
+
* @param link — The link this object talks to the host through.
|
|
1825
|
+
* @param window — The window it was reached through, or null for
|
|
1826
|
+
* the one the page is in.
|
|
1827
|
+
* @param session — The session it was reached through, or null for
|
|
1828
|
+
* the one on screen.
|
|
1829
|
+
*/
|
|
1830
|
+
constructor(
|
|
1831
|
+
link: HostLink,
|
|
1832
|
+
window: string | null = null,
|
|
1833
|
+
session: string | null = null,
|
|
1834
|
+
) {
|
|
1835
|
+
super(link, "chat", window, session);
|
|
1836
|
+
this.approvals = new HostChatApprovals(link, window, session);
|
|
1837
|
+
this.views = new HostChatViews(link, window, session);
|
|
1838
|
+
this.session_id = new Property(this, "session_id", false);
|
|
1839
|
+
this.messages = new Property(this, "messages", false);
|
|
1840
|
+
this.pending = new Property(this, "pending", false);
|
|
1841
|
+
this.processing = new Property(this, "processing", false);
|
|
1842
|
+
this.status = new Property(this, "status", false);
|
|
1843
|
+
this.timeout = new Property(this, "timeout", false);
|
|
1844
|
+
this.interrupted_runs = new Property(this, "interrupted_runs", false);
|
|
1845
|
+
this.context = new Property(this, "context", false);
|
|
1846
|
+
this.message_added = new Signal("chat.message_added");
|
|
1847
|
+
this.content_delta = new Signal("chat.content_delta");
|
|
1848
|
+
this.reasoning_started = new Signal("chat.reasoning_started");
|
|
1849
|
+
this.run_started = new Signal("chat.run_started");
|
|
1850
|
+
this.run_completed = new Signal("chat.run_completed");
|
|
1851
|
+
this.run_error = new Signal("chat.run_error");
|
|
1852
|
+
this.run_paused = new Signal("chat.run_paused");
|
|
1853
|
+
this.streaming_done = new Signal("chat.streaming_done");
|
|
1854
|
+
this.typing = new Signal("chat.typing");
|
|
1855
|
+
this.status_changed = new Signal("chat.status_changed");
|
|
1856
|
+
this.info = new Signal("chat.info");
|
|
1857
|
+
this.error = new Signal("chat.error");
|
|
1858
|
+
this.tool_started = new Signal("chat.tool_started");
|
|
1859
|
+
this.tool_completed = new Signal("chat.tool_completed");
|
|
1860
|
+
this.tool_error = new Signal("chat.tool_error");
|
|
1861
|
+
this.model_completed = new Signal("chat.model_completed");
|
|
1862
|
+
this.file_edited = new Signal("chat.file_edited");
|
|
1863
|
+
this.agent_event = new Signal("chat.agent_event");
|
|
1864
|
+
this.retry = new Signal("chat.retry");
|
|
1865
|
+
this.history_changed = new Signal("chat.history_changed");
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
/**
|
|
1869
|
+
* 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.
|
|
1870
|
+
*
|
|
1871
|
+
* @param text — The message to post, labelled as this extension's.
|
|
1872
|
+
* @param attachments — Path → content.
|
|
1873
|
+
*/
|
|
1874
|
+
post(text: string, attachments?: Record<string, string>): Promise<void> {
|
|
1875
|
+
return this.call<void>("post", { text, attachments });
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
/**
|
|
1879
|
+
* Post a message for the next turn, labelled as this extension.
|
|
1880
|
+
*
|
|
1881
|
+
* @param text — The message to queue for the next turn.
|
|
1882
|
+
*/
|
|
1883
|
+
queue(text: string): Promise<void> {
|
|
1884
|
+
return this.call<void>("queue", { text });
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
/**
|
|
1888
|
+
* Show a json-render block in the transcript. Shown to the person, never sent to the model. Returns its id.
|
|
1889
|
+
*
|
|
1890
|
+
* @param view — A json-render spec: `{root, elements}`.
|
|
1891
|
+
* @param title — The view's title, as it is shown in the transcript.
|
|
1892
|
+
*/
|
|
1893
|
+
append(view: JsonValue, title?: string): Promise<string> {
|
|
1894
|
+
return this.call<string>("append", { view, title });
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
/**
|
|
1898
|
+
* Replace a block this extension appended.
|
|
1899
|
+
*
|
|
1900
|
+
* @param view_id — The view to replace, by the id `append` returned.
|
|
1901
|
+
* @param view — The new json-render spec: `{root, elements}`.
|
|
1902
|
+
* @param title — The view's new title.
|
|
1903
|
+
*/
|
|
1904
|
+
replace(view_id: string, view: JsonValue, title?: string): Promise<void> {
|
|
1905
|
+
return this.call<void>("replace", { view_id, view, title });
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
/**
|
|
1909
|
+
* Search the transcript.
|
|
1910
|
+
*
|
|
1911
|
+
* @param query — The text to find in the transcript.
|
|
1912
|
+
* @param limit — At most this many; 50 by default.
|
|
1913
|
+
*/
|
|
1914
|
+
search(query: string, limit?: number): Promise<JsonValue[]> {
|
|
1915
|
+
return this.call<JsonValue[]>("search", { query, limit });
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
/** Stop the run. */
|
|
1919
|
+
cancel(): Promise<void> {
|
|
1920
|
+
return this.call<void>("cancel", {});
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1923
|
+
/**
|
|
1924
|
+
* Stop one sub-agent's run.
|
|
1925
|
+
*
|
|
1926
|
+
* @param run_id — The sub-agent's run to stop, by its id.
|
|
1927
|
+
*/
|
|
1928
|
+
cancel_agent(run_id: string): Promise<void> {
|
|
1929
|
+
return this.call<void>("cancel_agent", { run_id });
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
/**
|
|
1933
|
+
* Remove a run and everything after it.
|
|
1934
|
+
*
|
|
1935
|
+
* @param run_id — The run to remove, with every run after it.
|
|
1936
|
+
*/
|
|
1937
|
+
truncate(run_id: string): Promise<JsonValue> {
|
|
1938
|
+
return this.call<JsonValue>("truncate", { run_id });
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
/** Compact the conversation if it needs it, as igni does after a run. */
|
|
1942
|
+
compact(): Promise<SessionCleared | null> {
|
|
1943
|
+
return this.call<SessionCleared | null>("compact", {});
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
/**
|
|
1947
|
+
* Have the agent note what a turn taught it.
|
|
1948
|
+
*
|
|
1949
|
+
* @param user_msg — The turn's message, the one the person wrote.
|
|
1950
|
+
* @param assistant_msg — The turn's answer, the one the agent gave.
|
|
1951
|
+
*/
|
|
1952
|
+
extract_learnings(user_msg: string, assistant_msg: string): Promise<void> {
|
|
1953
|
+
return this.call<void>("extract_learnings", { user_msg, assistant_msg });
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
/**
|
|
1957
|
+
* Forget an interrupted run.
|
|
1958
|
+
*
|
|
1959
|
+
* @param message_id — The interrupted run to forget, named by the message that started it.
|
|
1960
|
+
*/
|
|
1961
|
+
discard_interrupted(message_id: string): Promise<JsonValue> {
|
|
1962
|
+
return this.call<JsonValue>("discard_interrupted", { message_id });
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
/**
|
|
1966
|
+
* Forget a message whose run never finished.
|
|
1967
|
+
*
|
|
1968
|
+
* @param message_id — The pending message to forget, by its id.
|
|
1969
|
+
*/
|
|
1970
|
+
discard_pending(message_id: string): Promise<JsonValue> {
|
|
1971
|
+
return this.call<JsonValue>("discard_pending", { message_id });
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
/**
|
|
1975
|
+
* Upload an attachment for a later `post`.
|
|
1976
|
+
*
|
|
1977
|
+
* @param filename — The file's name, made safe for the disk.
|
|
1978
|
+
* @param content_base64 — The file's bytes, base64-encoded.
|
|
1979
|
+
*/
|
|
1980
|
+
upload(filename: string, content_base64: string): Promise<JsonValue> {
|
|
1981
|
+
return this.call<JsonValue>("upload", { filename, content_base64 });
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
/** Plan mode: the plan the agent proposed. */
|
|
1986
|
+
export class HostPlan extends HostObject {
|
|
1987
|
+
static readonly PATH = "plan";
|
|
1988
|
+
/** The latest plan. */
|
|
1989
|
+
readonly latest: Property<Plan>;
|
|
1990
|
+
/** A plan was submitted or decided. */
|
|
1991
|
+
readonly changed: Signal<PlanChange>;
|
|
1992
|
+
|
|
1993
|
+
/**
|
|
1994
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1995
|
+
* or session it was reached through.
|
|
1996
|
+
*
|
|
1997
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1998
|
+
* right one, and a second would be a second conversation.
|
|
1999
|
+
*
|
|
2000
|
+
* @param link — The link this object talks to the host through.
|
|
2001
|
+
* @param window — The window it was reached through, or null for
|
|
2002
|
+
* the one the page is in.
|
|
2003
|
+
* @param session — The session it was reached through, or null for
|
|
2004
|
+
* the one on screen.
|
|
2005
|
+
*/
|
|
2006
|
+
constructor(
|
|
2007
|
+
link: HostLink,
|
|
2008
|
+
window: string | null = null,
|
|
2009
|
+
session: string | null = null,
|
|
2010
|
+
) {
|
|
2011
|
+
super(link, "plan", window, session);
|
|
2012
|
+
this.latest = new Property(this, "latest", false);
|
|
2013
|
+
this.changed = new Signal("plan.changed");
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
/**
|
|
2017
|
+
* Approve the plan.
|
|
2018
|
+
*
|
|
2019
|
+
* @param run_id — The run that submitted the plan.
|
|
2020
|
+
*/
|
|
2021
|
+
approve(run_id?: string): Promise<PlanDecision> {
|
|
2022
|
+
return this.call<PlanDecision>("approve", { run_id });
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
/**
|
|
2026
|
+
* Send the plan back.
|
|
2027
|
+
*
|
|
2028
|
+
* @param run_id — The run that submitted the plan.
|
|
2029
|
+
*/
|
|
2030
|
+
dismiss(run_id?: string): Promise<PlanDecision> {
|
|
2031
|
+
return this.call<PlanDecision>("dismiss", { run_id });
|
|
2032
|
+
}
|
|
2033
|
+
}
|
|
2034
|
+
|
|
2035
|
+
/** The agent's todo list and its sub-agent tasks. */
|
|
2036
|
+
export class HostTasks extends HostObject {
|
|
2037
|
+
static readonly PATH = "tasks";
|
|
2038
|
+
/** The todo list. */
|
|
2039
|
+
readonly todos: Property<TodoItem[]>;
|
|
2040
|
+
/** A task was created. */
|
|
2041
|
+
readonly created: Signal<TaskEvent>;
|
|
2042
|
+
/** A task changed. */
|
|
2043
|
+
readonly updated: Signal<TaskEvent>;
|
|
2044
|
+
/** A task loop moved on. */
|
|
2045
|
+
readonly iteration: Signal<TaskIteration>;
|
|
2046
|
+
/** Every task, as it now stands. */
|
|
2047
|
+
readonly snapshot: Signal<TaskSnapshot>;
|
|
2048
|
+
/** The todo list changed. */
|
|
2049
|
+
readonly todos_changed: Signal<Todos>;
|
|
2050
|
+
|
|
2051
|
+
/**
|
|
2052
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2053
|
+
* or session it was reached through.
|
|
2054
|
+
*
|
|
2055
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2056
|
+
* right one, and a second would be a second conversation.
|
|
2057
|
+
*
|
|
2058
|
+
* @param link — The link this object talks to the host through.
|
|
2059
|
+
* @param window — The window it was reached through, or null for
|
|
2060
|
+
* the one the page is in.
|
|
2061
|
+
* @param session — The session it was reached through, or null for
|
|
2062
|
+
* the one on screen.
|
|
2063
|
+
*/
|
|
2064
|
+
constructor(
|
|
2065
|
+
link: HostLink,
|
|
2066
|
+
window: string | null = null,
|
|
2067
|
+
session: string | null = null,
|
|
2068
|
+
) {
|
|
2069
|
+
super(link, "tasks", window, session);
|
|
2070
|
+
this.todos = new Property(this, "todos", false);
|
|
2071
|
+
this.created = new Signal("tasks.created");
|
|
2072
|
+
this.updated = new Signal("tasks.updated");
|
|
2073
|
+
this.iteration = new Signal("tasks.iteration");
|
|
2074
|
+
this.snapshot = new Signal("tasks.snapshot");
|
|
2075
|
+
this.todos_changed = new Signal("tasks.todos_changed");
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
/** `/loop`: a prompt repeated until done. */
|
|
2080
|
+
export class HostLoop extends HostObject {
|
|
2081
|
+
static readonly PATH = "loop";
|
|
2082
|
+
/** Where it is. */
|
|
2083
|
+
readonly status: Property<LoopStatus>;
|
|
2084
|
+
/** It paused, resumed, advanced or stopped. */
|
|
2085
|
+
readonly changed: Signal<LoopStatus>;
|
|
2086
|
+
|
|
2087
|
+
/**
|
|
2088
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2089
|
+
* or session it was reached through.
|
|
2090
|
+
*
|
|
2091
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2092
|
+
* right one, and a second would be a second conversation.
|
|
2093
|
+
*
|
|
2094
|
+
* @param link — The link this object talks to the host through.
|
|
2095
|
+
* @param window — The window it was reached through, or null for
|
|
2096
|
+
* the one the page is in.
|
|
2097
|
+
* @param session — The session it was reached through, or null for
|
|
2098
|
+
* the one on screen.
|
|
2099
|
+
*/
|
|
2100
|
+
constructor(
|
|
2101
|
+
link: HostLink,
|
|
2102
|
+
window: string | null = null,
|
|
2103
|
+
session: string | null = null,
|
|
2104
|
+
) {
|
|
2105
|
+
super(link, "loop", window, session);
|
|
2106
|
+
this.status = new Property(this, "status", false);
|
|
2107
|
+
this.changed = new Signal("loop.changed");
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
/** Pause after this iteration. */
|
|
2111
|
+
pause(): Promise<boolean> {
|
|
2112
|
+
return this.call<boolean>("pause", {});
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
/** Carry on. */
|
|
2116
|
+
resume(): Promise<string> {
|
|
2117
|
+
return this.call<string>("resume", {});
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
/** Stop the loop. */
|
|
2121
|
+
cancel_pending(): Promise<boolean> {
|
|
2122
|
+
return this.call<boolean>("cancel_pending", {});
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2125
|
+
/** Take the next iteration. */
|
|
2126
|
+
pop_pending(): Promise<LoopAdvance | null> {
|
|
2127
|
+
return this.call<LoopAdvance | null>("pop_pending", {});
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2131
|
+
/** Slash commands and skills. */
|
|
2132
|
+
export class HostCommands extends HostObject {
|
|
2133
|
+
static readonly PATH = "commands";
|
|
2134
|
+
/** Every slash command. */
|
|
2135
|
+
readonly list: Property<SlashCommand[]>;
|
|
2136
|
+
/** Skill names. */
|
|
2137
|
+
readonly skills: Property<string[]>;
|
|
2138
|
+
/** Each skill's description and prompt. */
|
|
2139
|
+
readonly skill_definitions: Property<SkillDefinition[]>;
|
|
2140
|
+
/** Each skill's details. */
|
|
2141
|
+
readonly skill_details: Property<SkillDetails[]>;
|
|
2142
|
+
|
|
2143
|
+
/**
|
|
2144
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2145
|
+
* or session it was reached through.
|
|
2146
|
+
*
|
|
2147
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2148
|
+
* right one, and a second would be a second conversation.
|
|
2149
|
+
*
|
|
2150
|
+
* @param link — The link this object talks to the host through.
|
|
2151
|
+
* @param window — The window it was reached through, or null for
|
|
2152
|
+
* the one the page is in.
|
|
2153
|
+
* @param session — The session it was reached through, or null for
|
|
2154
|
+
* the one on screen.
|
|
2155
|
+
*/
|
|
2156
|
+
constructor(
|
|
2157
|
+
link: HostLink,
|
|
2158
|
+
window: string | null = null,
|
|
2159
|
+
session: string | null = null,
|
|
2160
|
+
) {
|
|
2161
|
+
super(link, "commands", window, session);
|
|
2162
|
+
this.list = new Property(this, "list", false);
|
|
2163
|
+
this.skills = new Property(this, "skills", false);
|
|
2164
|
+
this.skill_definitions = new Property(this, "skill_definitions", false);
|
|
2165
|
+
this.skill_details = new Property(this, "skill_details", false);
|
|
2166
|
+
}
|
|
2167
|
+
|
|
2168
|
+
/**
|
|
2169
|
+
* Run a slash command, as the extension. The answer comes back here.
|
|
2170
|
+
*
|
|
2171
|
+
* @param command — With its slash: `/ctx`.
|
|
2172
|
+
*/
|
|
2173
|
+
run(command: string): Promise<CommandOutcome> {
|
|
2174
|
+
return this.call<CommandOutcome>("run", { command });
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
|
|
2178
|
+
/** Agent definitions. */
|
|
2179
|
+
export class HostAgents extends HostObject {
|
|
2180
|
+
static readonly PATH = "agents";
|
|
2181
|
+
/** Every agent. */
|
|
2182
|
+
readonly details: Property<AgentInfo[]>;
|
|
2183
|
+
/** An agent was promoted or discarded. */
|
|
2184
|
+
readonly changed: Signal<CollectionChange>;
|
|
2185
|
+
|
|
2186
|
+
/**
|
|
2187
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2188
|
+
* or session it was reached through.
|
|
2189
|
+
*
|
|
2190
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2191
|
+
* right one, and a second would be a second conversation.
|
|
2192
|
+
*
|
|
2193
|
+
* @param link — The link this object talks to the host through.
|
|
2194
|
+
* @param window — The window it was reached through, or null for
|
|
2195
|
+
* the one the page is in.
|
|
2196
|
+
* @param session — The session it was reached through, or null for
|
|
2197
|
+
* the one on screen.
|
|
2198
|
+
*/
|
|
2199
|
+
constructor(
|
|
2200
|
+
link: HostLink,
|
|
2201
|
+
window: string | null = null,
|
|
2202
|
+
session: string | null = null,
|
|
2203
|
+
) {
|
|
2204
|
+
super(link, "agents", window, session);
|
|
2205
|
+
this.details = new Property(this, "details", false);
|
|
2206
|
+
this.changed = new Signal("agents.changed");
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2209
|
+
/**
|
|
2210
|
+
* Keep an agent made for one task, as `/agents promote` does.
|
|
2211
|
+
*
|
|
2212
|
+
* @param name — The agent to keep, by its name.
|
|
2213
|
+
* @param target — `project` (the default): `.igni/agents/`, committed and the team's, as `--project`; or `personal`: `.igni/agents.local/`, kept out of git and yours only, as `--personal`.
|
|
2214
|
+
*/
|
|
2215
|
+
promote_ephemeral(name: string, target?: string): Promise<PromoteResult> {
|
|
2216
|
+
return this.call<PromoteResult>("promote_ephemeral", { name, target });
|
|
2217
|
+
}
|
|
2218
|
+
|
|
2219
|
+
/**
|
|
2220
|
+
* Drop an agent made for one task.
|
|
2221
|
+
*
|
|
2222
|
+
* @param name — The agent to drop, by its name.
|
|
2223
|
+
*/
|
|
2224
|
+
discard_ephemeral(name: string): Promise<DiscardResult> {
|
|
2225
|
+
return this.call<DiscardResult>("discard_ephemeral", { name });
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
/** Workflows: scripted runs. */
|
|
2230
|
+
export class HostWorkflows extends HostObject {
|
|
2231
|
+
static readonly PATH = "workflows";
|
|
2232
|
+
/** Every workflow. */
|
|
2233
|
+
readonly list: Property<Workflow[]>;
|
|
2234
|
+
/** A workflow run moved on. */
|
|
2235
|
+
readonly changed: Signal<CollectionChange>;
|
|
2236
|
+
|
|
2237
|
+
/**
|
|
2238
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2239
|
+
* or session it was reached through.
|
|
2240
|
+
*
|
|
2241
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2242
|
+
* right one, and a second would be a second conversation.
|
|
2243
|
+
*
|
|
2244
|
+
* @param link — The link this object talks to the host through.
|
|
2245
|
+
* @param window — The window it was reached through, or null for
|
|
2246
|
+
* the one the page is in.
|
|
2247
|
+
* @param session — The session it was reached through, or null for
|
|
2248
|
+
* the one on screen.
|
|
2249
|
+
*/
|
|
2250
|
+
constructor(
|
|
2251
|
+
link: HostLink,
|
|
2252
|
+
window: string | null = null,
|
|
2253
|
+
session: string | null = null,
|
|
2254
|
+
) {
|
|
2255
|
+
super(link, "workflows", window, session);
|
|
2256
|
+
this.list = new Property(this, "list", false);
|
|
2257
|
+
this.changed = new Signal("workflows.changed");
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
/**
|
|
2261
|
+
* Start a workflow.
|
|
2262
|
+
*
|
|
2263
|
+
* @param name — The workflow to start, by its name.
|
|
2264
|
+
* @param input — The workflow's input, a JSON object it reads as it defines.
|
|
2265
|
+
*/
|
|
2266
|
+
run(name: string, input?: Record<string, JsonValue>): Promise<WorkflowRun> {
|
|
2267
|
+
return this.call<WorkflowRun>("run", { name, input });
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
/**
|
|
2271
|
+
* Stop a workflow run.
|
|
2272
|
+
*
|
|
2273
|
+
* @param workflow_run_id — The run to stop, by its id.
|
|
2274
|
+
*/
|
|
2275
|
+
cancel(workflow_run_id: string): Promise<boolean> {
|
|
2276
|
+
return this.call<boolean>("cancel", { workflow_run_id });
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2280
|
+
/** Scheduled tasks. */
|
|
2281
|
+
export class HostScheduler extends HostObject {
|
|
2282
|
+
static readonly PATH = "scheduler";
|
|
2283
|
+
/** Every scheduled task. */
|
|
2284
|
+
readonly tasks: Property<ScheduledTask[]>;
|
|
2285
|
+
/** A task started, finished or changed. */
|
|
2286
|
+
readonly event: Signal<SchedulerEvent>;
|
|
2287
|
+
|
|
2288
|
+
/**
|
|
2289
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2290
|
+
* or session it was reached through.
|
|
2291
|
+
*
|
|
2292
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2293
|
+
* right one, and a second would be a second conversation.
|
|
2294
|
+
*
|
|
2295
|
+
* @param link — The link this object talks to the host through.
|
|
2296
|
+
* @param window — The window it was reached through, or null for
|
|
2297
|
+
* the one the page is in.
|
|
2298
|
+
* @param session — The session it was reached through, or null for
|
|
2299
|
+
* the one on screen.
|
|
2300
|
+
*/
|
|
2301
|
+
constructor(
|
|
2302
|
+
link: HostLink,
|
|
2303
|
+
window: string | null = null,
|
|
2304
|
+
session: string | null = null,
|
|
2305
|
+
) {
|
|
2306
|
+
super(link, "scheduler", window, session);
|
|
2307
|
+
this.tasks = new Property(this, "tasks", false);
|
|
2308
|
+
this.event = new Signal("scheduler.event");
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
/** Start the scheduler. */
|
|
2312
|
+
start(): Promise<void> {
|
|
2313
|
+
return this.call<void>("start", {});
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2316
|
+
/**
|
|
2317
|
+
* Run a scheduled task now.
|
|
2318
|
+
*
|
|
2319
|
+
* @param task_id — The scheduled task to run now, by its id.
|
|
2320
|
+
*/
|
|
2321
|
+
run_now(task_id: string): Promise<string> {
|
|
2322
|
+
return this.call<string>("run_now", { task_id });
|
|
2323
|
+
}
|
|
2324
|
+
|
|
2325
|
+
/**
|
|
2326
|
+
* Cancel a scheduled task.
|
|
2327
|
+
*
|
|
2328
|
+
* @param task_id — The scheduled task to cancel, by its id.
|
|
2329
|
+
*/
|
|
2330
|
+
cancel(task_id: string): Promise<void> {
|
|
2331
|
+
return this.call<void>("cancel", { task_id });
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
/** Background shells. */
|
|
2336
|
+
export class HostProcesses extends HostObject {
|
|
2337
|
+
static readonly PATH = "processes";
|
|
2338
|
+
/** Every background shell. */
|
|
2339
|
+
readonly list: Property<ProcessRow[]>;
|
|
2340
|
+
/** A shell started, printed or exited. */
|
|
2341
|
+
readonly changed: Signal<ProcessEvent>;
|
|
2342
|
+
|
|
2343
|
+
/**
|
|
2344
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2345
|
+
* or session it was reached through.
|
|
2346
|
+
*
|
|
2347
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2348
|
+
* right one, and a second would be a second conversation.
|
|
2349
|
+
*
|
|
2350
|
+
* @param link — The link this object talks to the host through.
|
|
2351
|
+
* @param window — The window it was reached through, or null for
|
|
2352
|
+
* the one the page is in.
|
|
2353
|
+
* @param session — The session it was reached through, or null for
|
|
2354
|
+
* the one on screen.
|
|
2355
|
+
*/
|
|
2356
|
+
constructor(
|
|
2357
|
+
link: HostLink,
|
|
2358
|
+
window: string | null = null,
|
|
2359
|
+
session: string | null = null,
|
|
2360
|
+
) {
|
|
2361
|
+
super(link, "processes", window, session);
|
|
2362
|
+
this.list = new Property(this, "list", false);
|
|
2363
|
+
this.changed = new Signal("processes.changed");
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
/**
|
|
2367
|
+
* A shell's last lines.
|
|
2368
|
+
*
|
|
2369
|
+
* @param pid — The shell to read the last lines of, by its process id.
|
|
2370
|
+
* @param lines — 200 by default.
|
|
2371
|
+
*/
|
|
2372
|
+
tail(pid: number, lines?: number): Promise<ProcessTail> {
|
|
2373
|
+
return this.call<ProcessTail>("tail", { pid, lines });
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
/**
|
|
2377
|
+
* Stop a shell.
|
|
2378
|
+
*
|
|
2379
|
+
* @param pid — The shell to stop, by its process id.
|
|
2380
|
+
*/
|
|
2381
|
+
stop(pid: number): Promise<ProcessStop> {
|
|
2382
|
+
return this.call<ProcessStop>("stop", { pid });
|
|
2383
|
+
}
|
|
2384
|
+
|
|
2385
|
+
/**
|
|
2386
|
+
* Run a command in the project and wait for it.
|
|
2387
|
+
*
|
|
2388
|
+
* @param command — The command line to run in the project.
|
|
2389
|
+
*/
|
|
2390
|
+
run(command: string): Promise<ShellResult> {
|
|
2391
|
+
return this.call<ShellResult>("run", { command });
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
/** The project, as far as the extension's workspace grant reaches. */
|
|
2396
|
+
export class HostWorkspace extends HostObject {
|
|
2397
|
+
static readonly PATH = "workspace";
|
|
2398
|
+
/** The project directory. */
|
|
2399
|
+
readonly root: Property<string>;
|
|
2400
|
+
/** Git HEAD; `None` outside a repository. */
|
|
2401
|
+
readonly head: Property<Head | null>;
|
|
2402
|
+
/** HEAD moved. */
|
|
2403
|
+
readonly head_changed: Signal<Head>;
|
|
2404
|
+
/** Files changed, as git sees them, within the grant. */
|
|
2405
|
+
readonly files_changed: Signal<FilesChanged>;
|
|
2406
|
+
|
|
2407
|
+
/**
|
|
2408
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2409
|
+
* or session it was reached through.
|
|
2410
|
+
*
|
|
2411
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2412
|
+
* right one, and a second would be a second conversation.
|
|
2413
|
+
*
|
|
2414
|
+
* @param link — The link this object talks to the host through.
|
|
2415
|
+
* @param window — The window it was reached through, or null for
|
|
2416
|
+
* the one the page is in.
|
|
2417
|
+
* @param session — The session it was reached through, or null for
|
|
2418
|
+
* the one on screen.
|
|
2419
|
+
*/
|
|
2420
|
+
constructor(
|
|
2421
|
+
link: HostLink,
|
|
2422
|
+
window: string | null = null,
|
|
2423
|
+
session: string | null = null,
|
|
2424
|
+
) {
|
|
2425
|
+
super(link, "workspace", window, session);
|
|
2426
|
+
this.root = new Property(this, "root", false);
|
|
2427
|
+
this.head = new Property(this, "head", false);
|
|
2428
|
+
this.head_changed = new Signal("workspace.head-changed");
|
|
2429
|
+
this.files_changed = new Signal("workspace.files-changed");
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2432
|
+
/**
|
|
2433
|
+
* Read a file in the project.
|
|
2434
|
+
*
|
|
2435
|
+
* @param path — The file to read, by its path in the project.
|
|
2436
|
+
*/
|
|
2437
|
+
read(path: string): Promise<JsonValue> {
|
|
2438
|
+
return this.call<JsonValue>("read", { path });
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
/**
|
|
2442
|
+
* List a directory in the project.
|
|
2443
|
+
*
|
|
2444
|
+
* @param dir — The directory to list, by its path in the project; the project itself when left out.
|
|
2445
|
+
*/
|
|
2446
|
+
list(dir?: string): Promise<JsonValue> {
|
|
2447
|
+
return this.call<JsonValue>("list", { dir });
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
/**
|
|
2451
|
+
* Complete a path, as `@` does.
|
|
2452
|
+
*
|
|
2453
|
+
* @param prefix — The path typed so far after `@`.
|
|
2454
|
+
*/
|
|
2455
|
+
complete(prefix: string): Promise<JsonValue> {
|
|
2456
|
+
return this.call<JsonValue>("complete", { prefix });
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
/**
|
|
2460
|
+
* Search the code.
|
|
2461
|
+
*
|
|
2462
|
+
* @param query — The text to search the code for.
|
|
2463
|
+
*/
|
|
2464
|
+
search(query: string): Promise<JsonValue> {
|
|
2465
|
+
return this.call<JsonValue>("search", { query });
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
/** Ask the person to pick a folder. */
|
|
2469
|
+
pick_dir(): Promise<JsonValue> {
|
|
2470
|
+
return this.call<JsonValue>("pick_dir", {});
|
|
2471
|
+
}
|
|
2472
|
+
|
|
2473
|
+
/**
|
|
2474
|
+
* 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.
|
|
2475
|
+
*
|
|
2476
|
+
* @param path — Relative to the project, or absolute inside it.
|
|
2477
|
+
*/
|
|
2478
|
+
open(path: string): Promise<void> {
|
|
2479
|
+
return this.call<void>("open", { path });
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2483
|
+
/** Models. */
|
|
2484
|
+
export class HostModels extends HostObject {
|
|
2485
|
+
static readonly PATH = "models";
|
|
2486
|
+
/** Every model igni knows. */
|
|
2487
|
+
readonly registry: Property<ModelRegistry>;
|
|
2488
|
+
/** The model in use. Writable: setting it switches. */
|
|
2489
|
+
readonly current: Property<string>;
|
|
2490
|
+
/** The model in use changed. */
|
|
2491
|
+
readonly changed: Signal<ModelChange>;
|
|
2492
|
+
|
|
2493
|
+
/**
|
|
2494
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2495
|
+
* or session it was reached through.
|
|
2496
|
+
*
|
|
2497
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2498
|
+
* right one, and a second would be a second conversation.
|
|
2499
|
+
*
|
|
2500
|
+
* @param link — The link this object talks to the host through.
|
|
2501
|
+
* @param window — The window it was reached through, or null for
|
|
2502
|
+
* the one the page is in.
|
|
2503
|
+
* @param session — The session it was reached through, or null for
|
|
2504
|
+
* the one on screen.
|
|
2505
|
+
*/
|
|
2506
|
+
constructor(
|
|
2507
|
+
link: HostLink,
|
|
2508
|
+
window: string | null = null,
|
|
2509
|
+
session: string | null = null,
|
|
2510
|
+
) {
|
|
2511
|
+
super(link, "models", window, session);
|
|
2512
|
+
this.registry = new Property(this, "registry", false);
|
|
2513
|
+
this.current = new Property(this, "current", true);
|
|
2514
|
+
this.changed = new Signal("models.changed");
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2517
|
+
|
|
2518
|
+
/** MCP servers. */
|
|
2519
|
+
export class HostMcp extends HostObject {
|
|
2520
|
+
static readonly PATH = "mcp";
|
|
2521
|
+
/** Every server. */
|
|
2522
|
+
readonly servers: Property<McpServer[]>;
|
|
2523
|
+
/** Each server's status. */
|
|
2524
|
+
readonly status: Property<McpServer[]>;
|
|
2525
|
+
/** Each server's tools and details. */
|
|
2526
|
+
readonly details: Property<McpServerDetails[]>;
|
|
2527
|
+
/** A server connected, disconnected or changed tools. */
|
|
2528
|
+
readonly changed: Signal<CollectionChange>;
|
|
2529
|
+
|
|
2530
|
+
/**
|
|
2531
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2532
|
+
* or session it was reached through.
|
|
2533
|
+
*
|
|
2534
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2535
|
+
* right one, and a second would be a second conversation.
|
|
2536
|
+
*
|
|
2537
|
+
* @param link — The link this object talks to the host through.
|
|
2538
|
+
* @param window — The window it was reached through, or null for
|
|
2539
|
+
* the one the page is in.
|
|
2540
|
+
* @param session — The session it was reached through, or null for
|
|
2541
|
+
* the one on screen.
|
|
2542
|
+
*/
|
|
2543
|
+
constructor(
|
|
2544
|
+
link: HostLink,
|
|
2545
|
+
window: string | null = null,
|
|
2546
|
+
session: string | null = null,
|
|
2547
|
+
) {
|
|
2548
|
+
super(link, "mcp", window, session);
|
|
2549
|
+
this.servers = new Property(this, "servers", false);
|
|
2550
|
+
this.status = new Property(this, "status", false);
|
|
2551
|
+
this.details = new Property(this, "details", false);
|
|
2552
|
+
this.changed = new Signal("mcp.changed");
|
|
2553
|
+
}
|
|
2554
|
+
|
|
2555
|
+
/**
|
|
2556
|
+
* Connect a server.
|
|
2557
|
+
*
|
|
2558
|
+
* @param name — The server to connect, by its name in the MCP configuration.
|
|
2559
|
+
*/
|
|
2560
|
+
connect(name: string): Promise<void> {
|
|
2561
|
+
return this.call<void>("connect", { name });
|
|
2562
|
+
}
|
|
2563
|
+
|
|
2564
|
+
/**
|
|
2565
|
+
* Disconnect a server.
|
|
2566
|
+
*
|
|
2567
|
+
* @param name — The server to disconnect, by its name in the MCP configuration.
|
|
2568
|
+
*/
|
|
2569
|
+
disconnect(name: string): Promise<void> {
|
|
2570
|
+
return this.call<void>("disconnect", { name });
|
|
2571
|
+
}
|
|
2572
|
+
|
|
2573
|
+
/** Start the servers that should be running. */
|
|
2574
|
+
ensure(): Promise<McpInit> {
|
|
2575
|
+
return this.call<McpInit>("ensure", {});
|
|
2576
|
+
}
|
|
2577
|
+
|
|
2578
|
+
/**
|
|
2579
|
+
* Offer or withhold one tool.
|
|
2580
|
+
*
|
|
2581
|
+
* @param server — The server the tool belongs to, by its name.
|
|
2582
|
+
* @param tool — The tool to offer or withhold, by its name.
|
|
2583
|
+
* @param on — Whether the tool is offered.
|
|
2584
|
+
*/
|
|
2585
|
+
set_tool_enabled(server: string, tool: string, on: boolean): Promise<McpToolToggle> {
|
|
2586
|
+
return this.call<McpToolToggle>("set_tool_enabled", { server, tool, on });
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2589
|
+
|
|
2590
|
+
/** Plugins and marketplaces. */
|
|
2591
|
+
export class HostPlugins extends HostObject {
|
|
2592
|
+
static readonly PATH = "plugins";
|
|
2593
|
+
/** Every installed plugin. */
|
|
2594
|
+
readonly installed: Property<PluginInfo[]>;
|
|
2595
|
+
/** Every marketplace. */
|
|
2596
|
+
readonly marketplaces: Property<Marketplace[]>;
|
|
2597
|
+
/** A plugin or marketplace changed. */
|
|
2598
|
+
readonly changed: Signal<CollectionChange>;
|
|
2599
|
+
|
|
2600
|
+
/**
|
|
2601
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2602
|
+
* or session it was reached through.
|
|
2603
|
+
*
|
|
2604
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2605
|
+
* right one, and a second would be a second conversation.
|
|
2606
|
+
*
|
|
2607
|
+
* @param link — The link this object talks to the host through.
|
|
2608
|
+
* @param window — The window it was reached through, or null for
|
|
2609
|
+
* the one the page is in.
|
|
2610
|
+
* @param session — The session it was reached through, or null for
|
|
2611
|
+
* the one on screen.
|
|
2612
|
+
*/
|
|
2613
|
+
constructor(
|
|
2614
|
+
link: HostLink,
|
|
2615
|
+
window: string | null = null,
|
|
2616
|
+
session: string | null = null,
|
|
2617
|
+
) {
|
|
2618
|
+
super(link, "plugins", window, session);
|
|
2619
|
+
this.installed = new Property(this, "installed", false);
|
|
2620
|
+
this.marketplaces = new Property(this, "marketplaces", false);
|
|
2621
|
+
this.changed = new Signal("plugins.changed");
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
/**
|
|
2625
|
+
* What a plugin carries.
|
|
2626
|
+
*
|
|
2627
|
+
* @param name — The installed plugin to describe, by its name.
|
|
2628
|
+
*/
|
|
2629
|
+
contents(name: string): Promise<PluginContents> {
|
|
2630
|
+
return this.call<PluginContents>("contents", { name });
|
|
2631
|
+
}
|
|
2632
|
+
|
|
2633
|
+
/**
|
|
2634
|
+
* What a plugin would install.
|
|
2635
|
+
*
|
|
2636
|
+
* @param source — The plugin's git URL, optionally followed by a subfolder.
|
|
2637
|
+
* @param branch — The branch, tag or commit to read; the default branch when left out.
|
|
2638
|
+
* @param subdir — The plugin's folder inside the repository, which wins over one in `source`.
|
|
2639
|
+
*/
|
|
2640
|
+
preview(source: string, branch?: string, subdir?: string): Promise<PluginContents> {
|
|
2641
|
+
return this.call<PluginContents>("preview", { source, branch, subdir });
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2644
|
+
/**
|
|
2645
|
+
* Install a plugin.
|
|
2646
|
+
*
|
|
2647
|
+
* @param ref — The plugin to install: a git URL or `@<marketplace>/<plugin>`.
|
|
2648
|
+
* @param install_ref — The branch, tag or commit to check out; the marketplace's, or the default branch, when left out.
|
|
2649
|
+
*/
|
|
2650
|
+
install(ref: string, install_ref?: string): Promise<void> {
|
|
2651
|
+
return this.call<void>("install", { ref, install_ref });
|
|
2652
|
+
}
|
|
2653
|
+
|
|
2654
|
+
/**
|
|
2655
|
+
* Update a plugin.
|
|
2656
|
+
*
|
|
2657
|
+
* @param name — The installed plugin to move, by its name.
|
|
2658
|
+
* @param install_ref — The branch, tag or commit to move to; the remote's default branch when left out.
|
|
2659
|
+
*/
|
|
2660
|
+
update(name: string, install_ref?: string): Promise<void> {
|
|
2661
|
+
return this.call<void>("update", { name, install_ref });
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2664
|
+
/**
|
|
2665
|
+
* Remove a plugin.
|
|
2666
|
+
*
|
|
2667
|
+
* @param name — The installed plugin to remove, by its name.
|
|
2668
|
+
*/
|
|
2669
|
+
remove(name: string): Promise<void> {
|
|
2670
|
+
return this.call<void>("remove", { name });
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2673
|
+
/**
|
|
2674
|
+
* Enable or disable a plugin.
|
|
2675
|
+
*
|
|
2676
|
+
* @param name — The installed plugin to switch on or off, by its name.
|
|
2677
|
+
* @param on — Whether the plugin is enabled.
|
|
2678
|
+
*/
|
|
2679
|
+
set_enabled(name: string, on: boolean): Promise<void> {
|
|
2680
|
+
return this.call<void>("set_enabled", { name, on });
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2683
|
+
/**
|
|
2684
|
+
* Add a marketplace.
|
|
2685
|
+
*
|
|
2686
|
+
* @param url — The marketplace's git URL.
|
|
2687
|
+
*/
|
|
2688
|
+
add_marketplace(url: string): Promise<void> {
|
|
2689
|
+
return this.call<void>("add_marketplace", { url });
|
|
2690
|
+
}
|
|
2691
|
+
|
|
2692
|
+
/**
|
|
2693
|
+
* Remove a marketplace.
|
|
2694
|
+
*
|
|
2695
|
+
* @param name — The marketplace to forget, by its name.
|
|
2696
|
+
*/
|
|
2697
|
+
remove_marketplace(name: string): Promise<void> {
|
|
2698
|
+
return this.call<void>("remove_marketplace", { name });
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
/**
|
|
2702
|
+
* Refresh marketplaces.
|
|
2703
|
+
*
|
|
2704
|
+
* @param name — The marketplace to fetch again; every one of them when left out.
|
|
2705
|
+
*/
|
|
2706
|
+
refresh_marketplaces(name?: string): Promise<void> {
|
|
2707
|
+
return this.call<void>("refresh_marketplaces", { name });
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
|
|
2711
|
+
/** Installed extensions. Read-only, apart from this extension's own settings. */
|
|
2712
|
+
export class HostExtensions extends HostObject {
|
|
2713
|
+
static readonly PATH = "extensions";
|
|
2714
|
+
/** Every installed extension. */
|
|
2715
|
+
readonly installed: Property<ExtensionInfo[]>;
|
|
2716
|
+
/** An extension's health moved. */
|
|
2717
|
+
readonly state_changed: Signal<ExtensionStateChange>;
|
|
2718
|
+
|
|
2719
|
+
/**
|
|
2720
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2721
|
+
* or session it was reached through.
|
|
2722
|
+
*
|
|
2723
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2724
|
+
* right one, and a second would be a second conversation.
|
|
2725
|
+
*
|
|
2726
|
+
* @param link — The link this object talks to the host through.
|
|
2727
|
+
* @param window — The window it was reached through, or null for
|
|
2728
|
+
* the one the page is in.
|
|
2729
|
+
* @param session — The session it was reached through, or null for
|
|
2730
|
+
* the one on screen.
|
|
2731
|
+
*/
|
|
2732
|
+
constructor(
|
|
2733
|
+
link: HostLink,
|
|
2734
|
+
window: string | null = null,
|
|
2735
|
+
session: string | null = null,
|
|
2736
|
+
) {
|
|
2737
|
+
super(link, "extensions", window, session);
|
|
2738
|
+
this.installed = new Property(this, "installed", false);
|
|
2739
|
+
this.state_changed = new Signal("extension.state-changed");
|
|
2740
|
+
}
|
|
2741
|
+
|
|
2742
|
+
/**
|
|
2743
|
+
* Change this extension's own settings.
|
|
2744
|
+
*
|
|
2745
|
+
* @param values — The settings to change, as key to value.
|
|
2746
|
+
*/
|
|
2747
|
+
set_settings(values: Record<string, JsonValue>): Promise<SettingsChange> {
|
|
2748
|
+
return this.call<SettingsChange>("set_settings", { values });
|
|
2749
|
+
}
|
|
2750
|
+
}
|
|
2751
|
+
|
|
2752
|
+
/** Hooks. */
|
|
2753
|
+
export class HostHooks extends HostObject {
|
|
2754
|
+
static readonly PATH = "hooks";
|
|
2755
|
+
/** Every hook. */
|
|
2756
|
+
readonly details: Property<HookEntry[]>;
|
|
2757
|
+
/** Hooks were reloaded. */
|
|
2758
|
+
readonly changed: Signal<CollectionChange>;
|
|
2759
|
+
|
|
2760
|
+
/**
|
|
2761
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2762
|
+
* or session it was reached through.
|
|
2763
|
+
*
|
|
2764
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2765
|
+
* right one, and a second would be a second conversation.
|
|
2766
|
+
*
|
|
2767
|
+
* @param link — The link this object talks to the host through.
|
|
2768
|
+
* @param window — The window it was reached through, or null for
|
|
2769
|
+
* the one the page is in.
|
|
2770
|
+
* @param session — The session it was reached through, or null for
|
|
2771
|
+
* the one on screen.
|
|
2772
|
+
*/
|
|
2773
|
+
constructor(
|
|
2774
|
+
link: HostLink,
|
|
2775
|
+
window: string | null = null,
|
|
2776
|
+
session: string | null = null,
|
|
2777
|
+
) {
|
|
2778
|
+
super(link, "hooks", window, session);
|
|
2779
|
+
this.details = new Property(this, "details", false);
|
|
2780
|
+
this.changed = new Signal("hooks.changed");
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2783
|
+
/** Reload hooks. */
|
|
2784
|
+
reload(): Promise<void> {
|
|
2785
|
+
return this.call<void>("reload", {});
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2788
|
+
/** Run the session-start hooks. */
|
|
2789
|
+
fire_session_start(): Promise<void> {
|
|
2790
|
+
return this.call<void>("fire_session_start", {});
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
|
|
2794
|
+
/** What the agent may do without asking. */
|
|
2795
|
+
export class HostPermissions extends HostObject {
|
|
2796
|
+
static readonly PATH = "permissions";
|
|
2797
|
+
/** `default`, `plan`, `acceptEdits` or `bypassPermissions`. */
|
|
2798
|
+
readonly mode: Property<string>;
|
|
2799
|
+
/** The mode changed. */
|
|
2800
|
+
readonly mode_changed: Signal<PermissionModeChange>;
|
|
2801
|
+
|
|
2802
|
+
/**
|
|
2803
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2804
|
+
* or session it was reached through.
|
|
2805
|
+
*
|
|
2806
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2807
|
+
* right one, and a second would be a second conversation.
|
|
2808
|
+
*
|
|
2809
|
+
* @param link — The link this object talks to the host through.
|
|
2810
|
+
* @param window — The window it was reached through, or null for
|
|
2811
|
+
* the one the page is in.
|
|
2812
|
+
* @param session — The session it was reached through, or null for
|
|
2813
|
+
* the one on screen.
|
|
2814
|
+
*/
|
|
2815
|
+
constructor(
|
|
2816
|
+
link: HostLink,
|
|
2817
|
+
window: string | null = null,
|
|
2818
|
+
session: string | null = null,
|
|
2819
|
+
) {
|
|
2820
|
+
super(link, "permissions", window, session);
|
|
2821
|
+
this.mode = new Property(this, "mode", false);
|
|
2822
|
+
this.mode_changed = new Signal("permissions.mode_changed");
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
/**
|
|
2826
|
+
* Would this tool call be allowed, asked or denied? One of `allow`, `ask` or `deny`.
|
|
2827
|
+
*
|
|
2828
|
+
* @param tool_name — The tool the call would use, by its name.
|
|
2829
|
+
* @param func_name — The function of that tool the call would reach.
|
|
2830
|
+
* @param tool_args — The call's arguments, which argument rules match against.
|
|
2831
|
+
*/
|
|
2832
|
+
check(tool_name: string, func_name: string, tool_args?: Record<string, JsonValue>): Promise<string> {
|
|
2833
|
+
return this.call<string>("check", { tool_name, func_name, tool_args });
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
/**
|
|
2837
|
+
* Save a permission rule.
|
|
2838
|
+
*
|
|
2839
|
+
* @param rule — The rule to save: `Bash(git status)`, a tool name.
|
|
2840
|
+
* @param level — `allow`, `ask` or `deny`.
|
|
2841
|
+
*/
|
|
2842
|
+
save_rule(rule: string, level: string): Promise<void> {
|
|
2843
|
+
return this.call<void>("save_rule", { rule, level });
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2847
|
+
/** The group policy in force. */
|
|
2848
|
+
export class HostPolicy extends HostObject {
|
|
2849
|
+
static readonly PATH = "policy";
|
|
2850
|
+
/** The group's policy pack. */
|
|
2851
|
+
readonly pack: Property<PolicyPack>;
|
|
2852
|
+
|
|
2853
|
+
/**
|
|
2854
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2855
|
+
* or session it was reached through.
|
|
2856
|
+
*
|
|
2857
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2858
|
+
* right one, and a second would be a second conversation.
|
|
2859
|
+
*
|
|
2860
|
+
* @param link — The link this object talks to the host through.
|
|
2861
|
+
* @param window — The window it was reached through, or null for
|
|
2862
|
+
* the one the page is in.
|
|
2863
|
+
* @param session — The session it was reached through, or null for
|
|
2864
|
+
* the one on screen.
|
|
2865
|
+
*/
|
|
2866
|
+
constructor(
|
|
2867
|
+
link: HostLink,
|
|
2868
|
+
window: string | null = null,
|
|
2869
|
+
session: string | null = null,
|
|
2870
|
+
) {
|
|
2871
|
+
super(link, "policy", window, session);
|
|
2872
|
+
this.pack = new Property(this, "pack", false);
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
/** Whether the person is signed in to igni. Never their session or a credential. */
|
|
2877
|
+
export class HostAccount extends HostObject {
|
|
2878
|
+
static readonly PATH = "account";
|
|
2879
|
+
/** Who is signed in. */
|
|
2880
|
+
readonly status: Property<Account>;
|
|
2881
|
+
/** Someone signed in or out. */
|
|
2882
|
+
readonly changed: Signal<Account>;
|
|
2883
|
+
|
|
2884
|
+
/**
|
|
2885
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2886
|
+
* or session it was reached through.
|
|
2887
|
+
*
|
|
2888
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2889
|
+
* right one, and a second would be a second conversation.
|
|
2890
|
+
*
|
|
2891
|
+
* @param link — The link this object talks to the host through.
|
|
2892
|
+
* @param window — The window it was reached through, or null for
|
|
2893
|
+
* the one the page is in.
|
|
2894
|
+
* @param session — The session it was reached through, or null for
|
|
2895
|
+
* the one on screen.
|
|
2896
|
+
*/
|
|
2897
|
+
constructor(
|
|
2898
|
+
link: HostLink,
|
|
2899
|
+
window: string | null = null,
|
|
2900
|
+
session: string | null = null,
|
|
2901
|
+
) {
|
|
2902
|
+
super(link, "account", window, session);
|
|
2903
|
+
this.status = new Property(this, "status", false);
|
|
2904
|
+
this.changed = new Signal("account.changed");
|
|
2905
|
+
}
|
|
2906
|
+
|
|
2907
|
+
/** Start the person's own sign-in. Its result is theirs. */
|
|
2908
|
+
sign_in(): Promise<void> {
|
|
2909
|
+
return this.call<void>("sign_in", {});
|
|
2910
|
+
}
|
|
2911
|
+
|
|
2912
|
+
/** Sign the person out. */
|
|
2913
|
+
sign_out(): Promise<Account> {
|
|
2914
|
+
return this.call<Account>("sign_out", {});
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
|
|
2918
|
+
/** The floor's notifications. Its own always; everyone's with `notifications`. */
|
|
2919
|
+
export class HostNotifications extends HostObject {
|
|
2920
|
+
static readonly PATH = "notifications";
|
|
2921
|
+
/** Newest first. */
|
|
2922
|
+
readonly list: Property<NotificationEntry[]>;
|
|
2923
|
+
/** Unread counts. */
|
|
2924
|
+
readonly unread: Property<NotificationCounts>;
|
|
2925
|
+
/** The counts moved. */
|
|
2926
|
+
readonly changed: Signal<NotificationCounts>;
|
|
2927
|
+
|
|
2928
|
+
/**
|
|
2929
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2930
|
+
* or session it was reached through.
|
|
2931
|
+
*
|
|
2932
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2933
|
+
* right one, and a second would be a second conversation.
|
|
2934
|
+
*
|
|
2935
|
+
* @param link — The link this object talks to the host through.
|
|
2936
|
+
* @param window — The window it was reached through, or null for
|
|
2937
|
+
* the one the page is in.
|
|
2938
|
+
* @param session — The session it was reached through, or null for
|
|
2939
|
+
* the one on screen.
|
|
2940
|
+
*/
|
|
2941
|
+
constructor(
|
|
2942
|
+
link: HostLink,
|
|
2943
|
+
window: string | null = null,
|
|
2944
|
+
session: string | null = null,
|
|
2945
|
+
) {
|
|
2946
|
+
super(link, "notifications", window, session);
|
|
2947
|
+
this.list = new Property(this, "list", false);
|
|
2948
|
+
this.unread = new Property(this, "unread", false);
|
|
2949
|
+
this.changed = new Signal("notifications.changed");
|
|
2950
|
+
}
|
|
2951
|
+
|
|
2952
|
+
/**
|
|
2953
|
+
* Tell the person at this machine something. It never leaves the machine.
|
|
2954
|
+
*
|
|
2955
|
+
* @param notification — What to tell the person at this machine.
|
|
2956
|
+
*/
|
|
2957
|
+
notify(notification: LocalNotification): Promise<void> {
|
|
2958
|
+
return this.call<void>("notify", { notification });
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
/**
|
|
2962
|
+
* Mark notifications read: these ids, one source, or all of them.
|
|
2963
|
+
*
|
|
2964
|
+
* @param ids — The notifications to mark read, by their ids.
|
|
2965
|
+
* @param source — The source whose notifications to mark read; every one of them when left out.
|
|
2966
|
+
*/
|
|
2967
|
+
mark_read(ids?: string[], source?: string): Promise<NotificationCounts> {
|
|
2968
|
+
return this.call<NotificationCounts>("mark_read", { ids, source });
|
|
2969
|
+
}
|
|
2970
|
+
}
|
|
2971
|
+
|
|
2972
|
+
/** This extension, as the host sees it. */
|
|
2973
|
+
export class HostSelf extends HostObject {
|
|
2974
|
+
static readonly PATH = "self";
|
|
2975
|
+
/** Its manifest id. */
|
|
2976
|
+
readonly id: Property<string>;
|
|
2977
|
+
/** Its settings. Writable. */
|
|
2978
|
+
readonly settings: Property<Record<string, JsonValue>>;
|
|
2979
|
+
/** Its own entry. */
|
|
2980
|
+
readonly state: Property<ExtensionInfo>;
|
|
2981
|
+
/** Its home on the web: its service's URL, when it has one. */
|
|
2982
|
+
readonly web_url: Property<string | null>;
|
|
2983
|
+
/** Its settings changed. */
|
|
2984
|
+
readonly settings_changed: Signal<SettingsChange>;
|
|
2985
|
+
/** Its health moved. */
|
|
2986
|
+
readonly state_changed: Signal<ExtensionStateChange>;
|
|
2987
|
+
|
|
2988
|
+
/**
|
|
2989
|
+
* The object igni hands a page, bound to a host and to the window
|
|
2990
|
+
* or session it was reached through.
|
|
2991
|
+
*
|
|
2992
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
2993
|
+
* right one, and a second would be a second conversation.
|
|
2994
|
+
*
|
|
2995
|
+
* @param link — The link this object talks to the host through.
|
|
2996
|
+
* @param window — The window it was reached through, or null for
|
|
2997
|
+
* the one the page is in.
|
|
2998
|
+
* @param session — The session it was reached through, or null for
|
|
2999
|
+
* the one on screen.
|
|
3000
|
+
*/
|
|
3001
|
+
constructor(
|
|
3002
|
+
link: HostLink,
|
|
3003
|
+
window: string | null = null,
|
|
3004
|
+
session: string | null = null,
|
|
3005
|
+
) {
|
|
3006
|
+
super(link, "self", window, session);
|
|
3007
|
+
this.id = new Property(this, "id", false);
|
|
3008
|
+
this.settings = new Property(this, "settings", true);
|
|
3009
|
+
this.state = new Property(this, "state", false);
|
|
3010
|
+
this.web_url = new Property(this, "web_url", false);
|
|
3011
|
+
this.settings_changed = new Signal("self.settings_changed");
|
|
3012
|
+
this.state_changed = new Signal("self.state_changed");
|
|
3013
|
+
}
|
|
3014
|
+
|
|
3015
|
+
/**
|
|
3016
|
+
* 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`.
|
|
3017
|
+
*
|
|
3018
|
+
* @param reason — Why the extension is working inside igni's process.
|
|
3019
|
+
* @param ttl_seconds — Default and at most 600.
|
|
3020
|
+
*/
|
|
3021
|
+
busy(reason: string, ttl_seconds?: number): Promise<BusyLease> {
|
|
3022
|
+
return this.call<BusyLease>("busy", { reason, ttl_seconds });
|
|
3023
|
+
}
|
|
3024
|
+
|
|
3025
|
+
/**
|
|
3026
|
+
* Let go of the lease `busy` took for `reason`. Nothing happens if there is none.
|
|
3027
|
+
*
|
|
3028
|
+
* @param reason — The reason the lease was taken for.
|
|
3029
|
+
*/
|
|
3030
|
+
done(reason: string): Promise<void> {
|
|
3031
|
+
return this.call<void>("done", { reason });
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
|
|
3035
|
+
/** 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. */
|
|
3036
|
+
export class Host extends HostObject {
|
|
3037
|
+
static readonly PATH = "";
|
|
3038
|
+
/** `host.app`. igni itself: how it presents things, which version, whether it is connected. */
|
|
3039
|
+
readonly app: HostApp;
|
|
3040
|
+
/** `host.windows`. Every open igni window. Address one window's UI with `host.windows.ui(id)`. */
|
|
3041
|
+
readonly windows: HostWindows;
|
|
3042
|
+
/** `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. */
|
|
3043
|
+
readonly ui: HostUi;
|
|
3044
|
+
/** `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)`. */
|
|
3045
|
+
readonly sessions: HostSessions;
|
|
3046
|
+
/** `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. */
|
|
3047
|
+
readonly chat: HostChat;
|
|
3048
|
+
/** `host.plan`. Plan mode: the plan the agent proposed. */
|
|
3049
|
+
readonly plan: HostPlan;
|
|
3050
|
+
/** `host.tasks`. The agent's todo list and its sub-agent tasks. */
|
|
3051
|
+
readonly tasks: HostTasks;
|
|
3052
|
+
/** `host.loop`. `/loop`: a prompt repeated until done. */
|
|
3053
|
+
readonly loop: HostLoop;
|
|
3054
|
+
/** `host.commands`. Slash commands and skills. */
|
|
3055
|
+
readonly commands: HostCommands;
|
|
3056
|
+
/** `host.agents`. Agent definitions. */
|
|
3057
|
+
readonly agents: HostAgents;
|
|
3058
|
+
/** `host.workflows`. Workflows: scripted runs. */
|
|
3059
|
+
readonly workflows: HostWorkflows;
|
|
3060
|
+
/** `host.scheduler`. Scheduled tasks. */
|
|
3061
|
+
readonly scheduler: HostScheduler;
|
|
3062
|
+
/** `host.processes`. Background shells. */
|
|
3063
|
+
readonly processes: HostProcesses;
|
|
3064
|
+
/** `host.workspace`. The project, as far as the extension's workspace grant reaches. */
|
|
3065
|
+
readonly workspace: HostWorkspace;
|
|
3066
|
+
/** `host.models`. Models. */
|
|
3067
|
+
readonly models: HostModels;
|
|
3068
|
+
/** `host.mcp`. MCP servers. */
|
|
3069
|
+
readonly mcp: HostMcp;
|
|
3070
|
+
/** `host.plugins`. Plugins and marketplaces. */
|
|
3071
|
+
readonly plugins: HostPlugins;
|
|
3072
|
+
/** `host.extensions`. Installed extensions. Read-only, apart from this extension's own settings. */
|
|
3073
|
+
readonly extensions: HostExtensions;
|
|
3074
|
+
/** `host.hooks`. Hooks. */
|
|
3075
|
+
readonly hooks: HostHooks;
|
|
3076
|
+
/** `host.permissions`. What the agent may do without asking. */
|
|
3077
|
+
readonly permissions: HostPermissions;
|
|
3078
|
+
/** `host.policy`. The group policy in force. */
|
|
3079
|
+
readonly policy: HostPolicy;
|
|
3080
|
+
/** `host.account`. Whether the person is signed in to igni. Never their session or a credential. */
|
|
3081
|
+
readonly account: HostAccount;
|
|
3082
|
+
/** `host.notifications`. The floor's notifications. Its own always; everyone's with `notifications`. */
|
|
3083
|
+
readonly notifications: HostNotifications;
|
|
3084
|
+
/** `host.self`. This extension, as the host sees it. */
|
|
3085
|
+
readonly self: HostSelf;
|
|
3086
|
+
/** Anything changed. Carries the member's path and its new value. */
|
|
3087
|
+
readonly changed: Signal<Change>;
|
|
3088
|
+
|
|
3089
|
+
/**
|
|
3090
|
+
* The object igni hands a page, bound to a host and to the window
|
|
3091
|
+
* or session it was reached through.
|
|
3092
|
+
*
|
|
3093
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
3094
|
+
* right one, and a second would be a second conversation.
|
|
3095
|
+
*
|
|
3096
|
+
* @param link — The link this object talks to the host through.
|
|
3097
|
+
* @param window — The window it was reached through, or null for
|
|
3098
|
+
* the one the page is in.
|
|
3099
|
+
* @param session — The session it was reached through, or null for
|
|
3100
|
+
* the one on screen.
|
|
3101
|
+
*/
|
|
3102
|
+
constructor(
|
|
3103
|
+
link: HostLink,
|
|
3104
|
+
window: string | null = null,
|
|
3105
|
+
session: string | null = null,
|
|
3106
|
+
) {
|
|
3107
|
+
super(link, "", window, session);
|
|
3108
|
+
this.app = new HostApp(link, window, session);
|
|
3109
|
+
this.windows = new HostWindows(link, window, session);
|
|
3110
|
+
this.ui = new HostUi(link, window, session);
|
|
3111
|
+
this.sessions = new HostSessions(link, window, session);
|
|
3112
|
+
this.chat = new HostChat(link, window, session);
|
|
3113
|
+
this.plan = new HostPlan(link, window, session);
|
|
3114
|
+
this.tasks = new HostTasks(link, window, session);
|
|
3115
|
+
this.loop = new HostLoop(link, window, session);
|
|
3116
|
+
this.commands = new HostCommands(link, window, session);
|
|
3117
|
+
this.agents = new HostAgents(link, window, session);
|
|
3118
|
+
this.workflows = new HostWorkflows(link, window, session);
|
|
3119
|
+
this.scheduler = new HostScheduler(link, window, session);
|
|
3120
|
+
this.processes = new HostProcesses(link, window, session);
|
|
3121
|
+
this.workspace = new HostWorkspace(link, window, session);
|
|
3122
|
+
this.models = new HostModels(link, window, session);
|
|
3123
|
+
this.mcp = new HostMcp(link, window, session);
|
|
3124
|
+
this.plugins = new HostPlugins(link, window, session);
|
|
3125
|
+
this.extensions = new HostExtensions(link, window, session);
|
|
3126
|
+
this.hooks = new HostHooks(link, window, session);
|
|
3127
|
+
this.permissions = new HostPermissions(link, window, session);
|
|
3128
|
+
this.policy = new HostPolicy(link, window, session);
|
|
3129
|
+
this.account = new HostAccount(link, window, session);
|
|
3130
|
+
this.notifications = new HostNotifications(link, window, session);
|
|
3131
|
+
this.self = new HostSelf(link, window, session);
|
|
3132
|
+
this.changed = new Signal("changed");
|
|
3133
|
+
}
|
|
3134
|
+
|
|
3135
|
+
/**
|
|
3136
|
+
* 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.
|
|
3137
|
+
*
|
|
3138
|
+
* @param context — Named text fields.
|
|
3139
|
+
* @param questions — The questions to ask, each with its own text and answer type.
|
|
3140
|
+
*/
|
|
3141
|
+
decide(context: Record<string, string>, questions: DecisionQuestion[]): Promise<Decision> {
|
|
3142
|
+
return this.call<Decision>("decide", { context, questions });
|
|
3143
|
+
}
|
|
3144
|
+
|
|
3145
|
+
/**
|
|
3146
|
+
* `decide` for up to 16 contexts at once, sharing forward passes. One decision per context, in order.
|
|
3147
|
+
*
|
|
3148
|
+
* @param contexts — The contexts to ask about, one decision each, in order.
|
|
3149
|
+
* @param questions — The questions to ask of every context.
|
|
3150
|
+
*/
|
|
3151
|
+
decide_batch(contexts: (Record<string, string>)[], questions: DecisionQuestion[]): Promise<Decision[]> {
|
|
3152
|
+
return this.call<Decision[]>("decide_batch", { contexts, questions });
|
|
3153
|
+
}
|
|
3154
|
+
}
|
|
3155
|
+
|