@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.
Files changed (69) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +5 -0
  3. package/README.md +364 -2
  4. package/dist/bridge.d.ts +37 -0
  5. package/dist/bridge.d.ts.map +1 -0
  6. package/dist/bridge.js +96 -0
  7. package/dist/bridge.js.map +1 -0
  8. package/dist/channel.d.ts +26 -0
  9. package/dist/channel.d.ts.map +1 -0
  10. package/dist/channel.js +36 -0
  11. package/dist/channel.js.map +1 -0
  12. package/dist/contract.d.ts +137 -0
  13. package/dist/contract.d.ts.map +1 -0
  14. package/dist/contract.js +9 -0
  15. package/dist/contract.js.map +1 -0
  16. package/dist/correlator.d.ts +37 -0
  17. package/dist/correlator.d.ts.map +1 -0
  18. package/dist/correlator.js +75 -0
  19. package/dist/correlator.js.map +1 -0
  20. package/dist/guestBridge.d.ts +63 -0
  21. package/dist/guestBridge.d.ts.map +1 -0
  22. package/dist/guestBridge.js +156 -0
  23. package/dist/guestBridge.js.map +1 -0
  24. package/dist/hostModel.d.ts +159 -0
  25. package/dist/hostModel.d.ts.map +1 -0
  26. package/dist/hostModel.generated.d.ts +2373 -0
  27. package/dist/hostModel.generated.d.ts.map +1 -0
  28. package/dist/hostModel.generated.js +1746 -0
  29. package/dist/hostModel.generated.js.map +1 -0
  30. package/dist/hostModel.js +172 -0
  31. package/dist/hostModel.js.map +1 -0
  32. package/dist/index.d.ts +12 -0
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.js +12 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/protocol.d.ts +348 -0
  37. package/dist/protocol.d.ts.map +1 -0
  38. package/dist/protocol.js +145 -0
  39. package/dist/protocol.js.map +1 -0
  40. package/dist/service.d.ts +168 -0
  41. package/dist/service.d.ts.map +1 -0
  42. package/dist/service.js +196 -0
  43. package/dist/service.js.map +1 -0
  44. package/dist/signals.d.ts +21 -0
  45. package/dist/signals.d.ts.map +1 -0
  46. package/dist/signals.js +52 -0
  47. package/dist/signals.js.map +1 -0
  48. package/dist/tokens.d.ts +101 -0
  49. package/dist/tokens.d.ts.map +1 -0
  50. package/dist/tokens.js +164 -0
  51. package/dist/tokens.js.map +1 -0
  52. package/dist/watchers.d.ts +12 -0
  53. package/dist/watchers.d.ts.map +1 -0
  54. package/dist/watchers.js +18 -0
  55. package/dist/watchers.js.map +1 -0
  56. package/package.json +53 -4
  57. package/src/bridge.ts +116 -0
  58. package/src/channel.ts +48 -0
  59. package/src/contract.ts +157 -0
  60. package/src/correlator.ts +88 -0
  61. package/src/guestBridge.ts +261 -0
  62. package/src/hostModel.generated.ts +3155 -0
  63. package/src/hostModel.ts +213 -0
  64. package/src/index.ts +11 -0
  65. package/src/protocol.ts +485 -0
  66. package/src/service.ts +278 -0
  67. package/src/signals.ts +65 -0
  68. package/src/tokens.ts +171 -0
  69. package/src/watchers.ts +18 -0
@@ -0,0 +1,1746 @@
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
+ import { HostObject, Property, Signal } from "./hostModel.js";
6
+ /**
7
+ * The version of igni's host schema this file was generated from.
8
+ *
9
+ * It moves when igni's host model moves. The bridge carries it on the
10
+ * wire, so a host and a page can say which model they are speaking.
11
+ */
12
+ export const SCHEMA_VERSION = "1.13.0";
13
+ /** Key–value state of the extension's own, kept by the host across restarts. An extension sees only its own keys. */
14
+ export class HostAppState extends HostObject {
15
+ static PATH = "app.state";
16
+ /** Every key and value. */
17
+ values;
18
+ /** A key was set or deleted. */
19
+ changed;
20
+ /**
21
+ * The object igni hands a page, bound to a host and to the window
22
+ * or session it was reached through.
23
+ *
24
+ * A page never builds one of these: `bridge.host` is already the
25
+ * right one, and a second would be a second conversation.
26
+ *
27
+ * @param link — The link this object talks to the host through.
28
+ * @param window — The window it was reached through, or null for
29
+ * the one the page is in.
30
+ * @param session — The session it was reached through, or null for
31
+ * the one on screen.
32
+ */
33
+ constructor(link, window = null, session = null) {
34
+ super(link, "app.state", window, session);
35
+ this.values = new Property(this, "values", false);
36
+ this.changed = new Signal("app.state.changed");
37
+ }
38
+ /**
39
+ * One value, or `None`.
40
+ *
41
+ * @param key — The key to read the value of.
42
+ */
43
+ get(key) {
44
+ return this.call("get", { key });
45
+ }
46
+ /**
47
+ * Store one value.
48
+ *
49
+ * @param key — The key to store the value under.
50
+ * @param value — The value to store.
51
+ */
52
+ set(key, value) {
53
+ return this.call("set", { key, value });
54
+ }
55
+ /**
56
+ * Remove one key.
57
+ *
58
+ * @param key — The key to remove.
59
+ */
60
+ delete(key) {
61
+ return this.call("delete", { key });
62
+ }
63
+ }
64
+ /** 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. */
65
+ export class HostChatApprovals extends HostObject {
66
+ static PATH = "chat.approvals";
67
+ /** Requests not yet answered. */
68
+ waiting;
69
+ /** The agent asked. */
70
+ requested;
71
+ /** Somebody answered. */
72
+ resolved;
73
+ /** The reason arrived. */
74
+ details;
75
+ /** An approval appeared or went away, whoever answered and whenever — including after a restart. For an app following approvals through the API. */
76
+ changed;
77
+ /**
78
+ * The object igni hands a page, bound to a host and to the window
79
+ * or session it was reached through.
80
+ *
81
+ * A page never builds one of these: `bridge.host` is already the
82
+ * right one, and a second would be a second conversation.
83
+ *
84
+ * @param link — The link this object talks to the host through.
85
+ * @param window — The window it was reached through, or null for
86
+ * the one the page is in.
87
+ * @param session — The session it was reached through, or null for
88
+ * the one on screen.
89
+ */
90
+ constructor(link, window = null, session = null) {
91
+ super(link, "chat.approvals", window, session);
92
+ this.waiting = new Property(this, "waiting", false);
93
+ this.requested = new Signal("chat.approvals.requested");
94
+ this.resolved = new Signal("chat.approvals.resolved");
95
+ this.details = new Signal("chat.approvals.details");
96
+ this.changed = new Signal("chat.approvals.changed");
97
+ }
98
+ /**
99
+ * Answer one request, as the person's dialog does.
100
+ *
101
+ * @param requirement_id — The waiting request to answer, by its id.
102
+ * @param action — `confirm` or `reject`.
103
+ * @param choice — `once`, `always` or `similar`.
104
+ */
105
+ answer(requirement_id, action, choice) {
106
+ return this.call("answer", { requirement_id, action, choice });
107
+ }
108
+ /**
109
+ * Answer every request of a pause at once.
110
+ *
111
+ * @param answers — The answers to give, one per waiting request.
112
+ */
113
+ answer_all(answers) {
114
+ return this.call("answer_all", { answers });
115
+ }
116
+ }
117
+ /** 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. */
118
+ export class HostChatViews extends HostObject {
119
+ static PATH = "chat.views";
120
+ /** The views in the current session. */
121
+ list;
122
+ /** A view appeared or was replaced. */
123
+ shown;
124
+ /** The person used a control in a view. */
125
+ action;
126
+ /**
127
+ * The object igni hands a page, bound to a host and to the window
128
+ * or session it was reached through.
129
+ *
130
+ * A page never builds one of these: `bridge.host` is already the
131
+ * right one, and a second would be a second conversation.
132
+ *
133
+ * @param link — The link this object talks to the host through.
134
+ * @param window — The window it was reached through, or null for
135
+ * the one the page is in.
136
+ * @param session — The session it was reached through, or null for
137
+ * the one on screen.
138
+ */
139
+ constructor(link, window = null, session = null) {
140
+ super(link, "chat.views", window, session);
141
+ this.list = new Property(this, "list", false);
142
+ this.shown = new Signal("chat.views.shown");
143
+ this.action = new Signal("chat.views.action");
144
+ }
145
+ /**
146
+ * Act on a view as if the person had.
147
+ *
148
+ * @param view_id — The view the action was used on, by its id.
149
+ * @param action — The control's action name.
150
+ * @param params — The values the view attached to the action.
151
+ */
152
+ dispatch(view_id, action, params) {
153
+ return this.call("dispatch", { view_id, action, params });
154
+ }
155
+ }
156
+ /** igni itself: how it presents things, which version, whether it is connected. */
157
+ export class HostApp extends HostObject {
158
+ static PATH = "app";
159
+ /** `host.app.state`. Key–value state of the extension's own, kept by the host across restarts. An extension sees only its own keys. */
160
+ state;
161
+ /** Theme, verbosity, output style. */
162
+ display;
163
+ /** The igni version running. */
164
+ version;
165
+ /** A newer igni, as last checked; `None` when there is none or it was not checked yet. */
166
+ update_available;
167
+ /** Model and server reachability. */
168
+ connection;
169
+ /** Running, waiting on a person, or idle — what decides whether igni's process may be suspended. */
170
+ activity;
171
+ /** Verbosity or output style changed. */
172
+ display_changed;
173
+ /** The connection changed. */
174
+ connection_changed;
175
+ /** An update check answered. */
176
+ update_changed;
177
+ /** igni started or stopped doing something. */
178
+ activity_changed;
179
+ /**
180
+ * The object igni hands a page, bound to a host and to the window
181
+ * or session it was reached through.
182
+ *
183
+ * A page never builds one of these: `bridge.host` is already the
184
+ * right one, and a second would be a second conversation.
185
+ *
186
+ * @param link — The link this object talks to the host through.
187
+ * @param window — The window it was reached through, or null for
188
+ * the one the page is in.
189
+ * @param session — The session it was reached through, or null for
190
+ * the one on screen.
191
+ */
192
+ constructor(link, window = null, session = null) {
193
+ super(link, "app", window, session);
194
+ this.state = new HostAppState(link, window, session);
195
+ this.display = new Property(this, "display", false);
196
+ this.version = new Property(this, "version", false);
197
+ this.update_available = new Property(this, "update_available", false);
198
+ this.connection = new Property(this, "connection", false);
199
+ this.activity = new Property(this, "activity", false);
200
+ this.display_changed = new Signal("app.display_changed");
201
+ this.connection_changed = new Signal("app.connection_changed");
202
+ this.update_changed = new Signal("app.update_changed");
203
+ this.activity_changed = new Signal("app.activity_changed");
204
+ }
205
+ /**
206
+ * Show or hide routing detail.
207
+ *
208
+ * @param on — Whether routing detail is shown.
209
+ */
210
+ set_verbose(on) {
211
+ return this.call("set_verbose", { on });
212
+ }
213
+ /**
214
+ * Switch the output style, as `/output-style <name>` does.
215
+ *
216
+ * @param name — The output style to switch to, by its name.
217
+ */
218
+ set_output_style(name) {
219
+ return this.call("set_output_style", { name });
220
+ }
221
+ /** 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`. */
222
+ check_for_update() {
223
+ return this.call("check_for_update", {});
224
+ }
225
+ /**
226
+ * 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`).
227
+ *
228
+ * @param url — The link: `https://` only.
229
+ */
230
+ open_external(url) {
231
+ return this.call("open_external", { url });
232
+ }
233
+ }
234
+ /** Every open igni window. Address one window's UI with `host.windows.ui(id)`. */
235
+ export class HostWindows extends HostObject {
236
+ static PATH = "windows";
237
+ /** Every window connected now. */
238
+ list;
239
+ /** The window the person is using — the one with focus; `None` when igni is in the background. */
240
+ focused;
241
+ /** A window connected. */
242
+ opened;
243
+ /** A window went away. */
244
+ closed;
245
+ /** A window took focus or lost it; `focused` says which. */
246
+ focus_changed;
247
+ /**
248
+ * The object igni hands a page, bound to a host and to the window
249
+ * or session it was reached through.
250
+ *
251
+ * A page never builds one of these: `bridge.host` is already the
252
+ * right one, and a second would be a second conversation.
253
+ *
254
+ * @param link — The link this object talks to the host through.
255
+ * @param window — The window it was reached through, or null for
256
+ * the one the page is in.
257
+ * @param session — The session it was reached through, or null for
258
+ * the one on screen.
259
+ */
260
+ constructor(link, window = null, session = null) {
261
+ super(link, "windows", window, session);
262
+ this.list = new Property(this, "list", false);
263
+ this.focused = new Property(this, "focused", false);
264
+ this.opened = new Signal("windows.opened");
265
+ this.closed = new Signal("windows.closed");
266
+ this.focus_changed = new Signal("windows.focus_changed");
267
+ }
268
+ /**
269
+ * `host.ui` of one window, by its id.
270
+ *
271
+ * @param windowId — The window to reach, by its id.
272
+ */
273
+ ui(windowId) {
274
+ return new HostUi(this.link, windowId);
275
+ }
276
+ }
277
+ /** 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. */
278
+ export class HostUi extends HostObject {
279
+ static PATH = "ui";
280
+ /** The page stack; empty when the chat is showing. Writable: setting it navigates. */
281
+ route;
282
+ /** The panel open over the chat. Writable: setting it opens one, `None` closes it. */
283
+ panel;
284
+ /** The sidebar. Writable. */
285
+ sidebar;
286
+ /** The file previewed. Writable: `None` closes it. */
287
+ preview;
288
+ /** What is selected. Writable. */
289
+ selection;
290
+ /** The composer: draft, the files it refers to, its mode. Writable. */
291
+ composer;
292
+ /** Toasts on screen, oldest first. */
293
+ toasts;
294
+ /** The open dialog. */
295
+ dialog;
296
+ /** Where the transcript is. */
297
+ scroll;
298
+ /** The page stack changed. */
299
+ navigated;
300
+ /** A panel opened or closed. */
301
+ panel_changed;
302
+ /** The sidebar changed. */
303
+ sidebar_changed;
304
+ /** The preview opened, changed or closed. */
305
+ preview_changed;
306
+ /** The selection changed. */
307
+ selection_changed;
308
+ /** The draft changed. */
309
+ composer_changed;
310
+ /** A toast appeared. */
311
+ toast_shown;
312
+ /** A toast went away. */
313
+ toast_dismissed;
314
+ /** A dialog opened. */
315
+ dialog_opened;
316
+ /** A dialog closed, with the answer. */
317
+ dialog_closed;
318
+ /** The transcript came to rest somewhere else, or started or stopped following the newest message. */
319
+ scrolled;
320
+ /**
321
+ * The object igni hands a page, bound to a host and to the window
322
+ * or session it was reached through.
323
+ *
324
+ * A page never builds one of these: `bridge.host` is already the
325
+ * right one, and a second would be a second conversation.
326
+ *
327
+ * @param link — The link this object talks to the host through.
328
+ * @param window — The window it was reached through, or null for
329
+ * the one the page is in.
330
+ * @param session — The session it was reached through, or null for
331
+ * the one on screen.
332
+ */
333
+ constructor(link, window = null, session = null) {
334
+ super(link, "ui", window, session);
335
+ this.route = new Property(this, "route", true);
336
+ this.panel = new Property(this, "panel", true);
337
+ this.sidebar = new Property(this, "sidebar", true);
338
+ this.preview = new Property(this, "preview", true);
339
+ this.selection = new Property(this, "selection", true);
340
+ this.composer = new Property(this, "composer", true);
341
+ this.toasts = new Property(this, "toasts", false);
342
+ this.dialog = new Property(this, "dialog", false);
343
+ this.scroll = new Property(this, "scroll", false);
344
+ this.navigated = new Signal("ui.navigated");
345
+ this.panel_changed = new Signal("ui.panel_changed");
346
+ this.sidebar_changed = new Signal("ui.sidebar_changed");
347
+ this.preview_changed = new Signal("ui.preview_changed");
348
+ this.selection_changed = new Signal("ui.selection_changed");
349
+ this.composer_changed = new Signal("ui.composer_changed");
350
+ this.toast_shown = new Signal("ui.toast_shown");
351
+ this.toast_dismissed = new Signal("ui.toast_dismissed");
352
+ this.dialog_opened = new Signal("ui.dialog_opened");
353
+ this.dialog_closed = new Signal("ui.dialog_closed");
354
+ this.scrolled = new Signal("ui.scrolled");
355
+ }
356
+ /**
357
+ * Open a page at the top of the stack, as a header link does.
358
+ *
359
+ * @param page — A page kind: `plugins`, `extensions`, an extension's page.
360
+ * @param params — The page's parameters.
361
+ */
362
+ navigate(page, params) {
363
+ return this.call("navigate", { page, params });
364
+ }
365
+ /** Go back one level; at the root, back to the chat. */
366
+ back() {
367
+ return this.call("back", {});
368
+ }
369
+ /**
370
+ * Open a panel over the chat, closing the one that was open.
371
+ *
372
+ * @param kind — `notifications`, `search`, `login` or `dir-picker`.
373
+ * @param params — The panel's own parameters: what the panel shows, in the panel's own shape.
374
+ */
375
+ open_panel(kind, params) {
376
+ return this.call("open_panel", { kind, params });
377
+ }
378
+ /** Close the panel. */
379
+ close_panel() {
380
+ return this.call("close_panel", {});
381
+ }
382
+ /**
383
+ * Open or close the sidebar, and size it or bring a section into view.
384
+ *
385
+ * @param open — Whether the sidebar is open.
386
+ * @param width — In pixels, 180 to 600.
387
+ * @param section — `links` or `sessions`.
388
+ */
389
+ set_sidebar(open, width, section) {
390
+ return this.call("set_sidebar", { open, width, section });
391
+ }
392
+ /**
393
+ * Preview a file of the project. (`preview` is the property.)
394
+ *
395
+ * @param path — The file to preview, by its path in the project.
396
+ */
397
+ open_preview(path) {
398
+ return this.call("open_preview", { path });
399
+ }
400
+ /** Close the preview. */
401
+ close_preview() {
402
+ return this.call("close_preview", {});
403
+ }
404
+ /**
405
+ * Select a message, text or file. The parts left out are cleared.
406
+ *
407
+ * @param selection — What is selected: a message, text or a file; the parts left out are cleared.
408
+ */
409
+ select(selection) {
410
+ return this.call("select", { selection });
411
+ }
412
+ /**
413
+ * Replace the draft.
414
+ *
415
+ * @param text — The draft to put in the composer.
416
+ * @param attachments — Files to refer to: each becomes an `@path` the draft does not already have.
417
+ * @param mode — `chat`, `command` or `shell`; unchanged if left out.
418
+ */
419
+ set_composer(text, attachments, mode) {
420
+ return this.call("set_composer", { text, attachments, mode });
421
+ }
422
+ /**
423
+ * Show a transient message, labelled as this extension's.
424
+ *
425
+ * @param text — The toast's first line.
426
+ * @param kind — `info` (default), `success`, `warning`, `error`.
427
+ * @param body — A second line.
428
+ * @param target — Where clicking it goes.
429
+ */
430
+ toast(text, kind, body, target) {
431
+ return this.call("toast", { text, kind, body, target });
432
+ }
433
+ /**
434
+ * Take one of this extension's toasts away.
435
+ *
436
+ * @param toast_id — The toast to take away, by its id.
437
+ */
438
+ dismiss_toast(toast_id) {
439
+ return this.call("dismiss_toast", { toast_id });
440
+ }
441
+ /**
442
+ * 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.)
443
+ *
444
+ * @param spec — The dialog to show: its title, body, buttons and input.
445
+ */
446
+ show_dialog(spec) {
447
+ return this.call("show_dialog", { spec });
448
+ }
449
+ /**
450
+ * Scroll the transcript to a message, by its run; `bottom` for the newest.
451
+ *
452
+ * @param message_id — The message to scroll to, named by the run it belongs to; `bottom` for the newest.
453
+ */
454
+ scroll_to(message_id) {
455
+ return this.call("scroll_to", { message_id });
456
+ }
457
+ }
458
+ /** 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)`. */
459
+ export class HostSessions extends HostObject {
460
+ static PATH = "sessions";
461
+ /** Every session, newest first. */
462
+ list;
463
+ /** The session the active window shows. Writable: setting it switches, and is refused where the person's switch would be. */
464
+ current;
465
+ /** A window moved to another session. */
466
+ current_changed;
467
+ /** The session list was read. */
468
+ listed;
469
+ /** `/clear` renewed a session. */
470
+ cleared;
471
+ /** A session got its name. */
472
+ named;
473
+ /**
474
+ * The object igni hands a page, bound to a host and to the window
475
+ * or session it was reached through.
476
+ *
477
+ * A page never builds one of these: `bridge.host` is already the
478
+ * right one, and a second would be a second conversation.
479
+ *
480
+ * @param link — The link this object talks to the host through.
481
+ * @param window — The window it was reached through, or null for
482
+ * the one the page is in.
483
+ * @param session — The session it was reached through, or null for
484
+ * the one on screen.
485
+ */
486
+ constructor(link, window = null, session = null) {
487
+ super(link, "sessions", window, session);
488
+ this.list = new Property(this, "list", false);
489
+ this.current = new Property(this, "current", true);
490
+ this.current_changed = new Signal("session.switched");
491
+ this.listed = new Signal("sessions.listed");
492
+ this.cleared = new Signal("sessions.cleared");
493
+ this.named = new Signal("sessions.named");
494
+ }
495
+ /**
496
+ * Show a session in the active window.
497
+ *
498
+ * @param session_id — The session to open, by its id.
499
+ */
500
+ open(session_id) {
501
+ return this.call("open", { session_id });
502
+ }
503
+ /**
504
+ * 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.
505
+ *
506
+ * @param project_dir — The folder the new session works in; this project when left out.
507
+ * @param title — Its name in the session list.
508
+ * @param focus — Show it in the caller's window — a page's own, else the active one. False by default.
509
+ */
510
+ create(project_dir, title, focus) {
511
+ return this.call("create", { project_dir, title, focus });
512
+ }
513
+ /**
514
+ * Make sure a session is live, without showing it.
515
+ *
516
+ * @param session_id — The session to make live, by its id.
517
+ * @param project_dir — The folder the session works in; it must belong to that session.
518
+ */
519
+ attach(session_id, project_dir) {
520
+ return this.call("attach", { session_id, project_dir });
521
+ }
522
+ /**
523
+ * `host.chat` of any session of this project, by its id, without showing it. The session on screen's id is `host.chat` itself.
524
+ *
525
+ * @param sessionId — The session to reach, by its id.
526
+ */
527
+ chat(sessionId) {
528
+ return new HostChat(this.link, null, sessionId);
529
+ }
530
+ }
531
+ /** 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. */
532
+ export class HostChat extends HostObject {
533
+ static PATH = "chat";
534
+ /** `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. */
535
+ approvals;
536
+ /** `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. */
537
+ views;
538
+ /** The current session. */
539
+ session_id;
540
+ /** The transcript, turn by turn. */
541
+ messages;
542
+ /** Messages waiting for a turn. */
543
+ pending;
544
+ /** Whether a run is going. */
545
+ processing;
546
+ /** The status line. */
547
+ status;
548
+ /** Seconds a run may take. */
549
+ timeout;
550
+ /** Runs that stopped part-way. */
551
+ interrupted_runs;
552
+ /** Token counts and what fills them. */
553
+ context;
554
+ /** A message was posted — by the person, an extension, or an extension's service (`from_service`). */
555
+ message_added;
556
+ /** The agent's answer, streaming. */
557
+ content_delta;
558
+ /** The agent started thinking. */
559
+ reasoning_started;
560
+ /** A run started. */
561
+ run_started;
562
+ /** A run finished, with the files it changed. */
563
+ run_completed;
564
+ /** A run stopped with an error. */
565
+ run_error;
566
+ /** A run is waiting for approvals. */
567
+ run_paused;
568
+ /** The answer finished streaming. */
569
+ streaming_done;
570
+ /** Somebody's draft, live. */
571
+ typing;
572
+ /** The status line changed. */
573
+ status_changed;
574
+ /** An info line. */
575
+ info;
576
+ /** An error line. */
577
+ error;
578
+ /** The agent called a tool. */
579
+ tool_started;
580
+ /** A tool call finished. */
581
+ tool_completed;
582
+ /** A tool call failed. */
583
+ tool_error;
584
+ /** A model call finished. */
585
+ model_completed;
586
+ /** The agent wrote a file. */
587
+ file_edited;
588
+ /** A sub-agent or team moved on. */
589
+ agent_event;
590
+ /** A network call is being retried. */
591
+ retry;
592
+ /** Turns were truncated or discarded. */
593
+ history_changed;
594
+ /**
595
+ * The object igni hands a page, bound to a host and to the window
596
+ * or session it was reached through.
597
+ *
598
+ * A page never builds one of these: `bridge.host` is already the
599
+ * right one, and a second would be a second conversation.
600
+ *
601
+ * @param link — The link this object talks to the host through.
602
+ * @param window — The window it was reached through, or null for
603
+ * the one the page is in.
604
+ * @param session — The session it was reached through, or null for
605
+ * the one on screen.
606
+ */
607
+ constructor(link, window = null, session = null) {
608
+ super(link, "chat", window, session);
609
+ this.approvals = new HostChatApprovals(link, window, session);
610
+ this.views = new HostChatViews(link, window, session);
611
+ this.session_id = new Property(this, "session_id", false);
612
+ this.messages = new Property(this, "messages", false);
613
+ this.pending = new Property(this, "pending", false);
614
+ this.processing = new Property(this, "processing", false);
615
+ this.status = new Property(this, "status", false);
616
+ this.timeout = new Property(this, "timeout", false);
617
+ this.interrupted_runs = new Property(this, "interrupted_runs", false);
618
+ this.context = new Property(this, "context", false);
619
+ this.message_added = new Signal("chat.message_added");
620
+ this.content_delta = new Signal("chat.content_delta");
621
+ this.reasoning_started = new Signal("chat.reasoning_started");
622
+ this.run_started = new Signal("chat.run_started");
623
+ this.run_completed = new Signal("chat.run_completed");
624
+ this.run_error = new Signal("chat.run_error");
625
+ this.run_paused = new Signal("chat.run_paused");
626
+ this.streaming_done = new Signal("chat.streaming_done");
627
+ this.typing = new Signal("chat.typing");
628
+ this.status_changed = new Signal("chat.status_changed");
629
+ this.info = new Signal("chat.info");
630
+ this.error = new Signal("chat.error");
631
+ this.tool_started = new Signal("chat.tool_started");
632
+ this.tool_completed = new Signal("chat.tool_completed");
633
+ this.tool_error = new Signal("chat.tool_error");
634
+ this.model_completed = new Signal("chat.model_completed");
635
+ this.file_edited = new Signal("chat.file_edited");
636
+ this.agent_event = new Signal("chat.agent_event");
637
+ this.retry = new Signal("chat.retry");
638
+ this.history_changed = new Signal("chat.history_changed");
639
+ }
640
+ /**
641
+ * 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.
642
+ *
643
+ * @param text — The message to post, labelled as this extension's.
644
+ * @param attachments — Path → content.
645
+ */
646
+ post(text, attachments) {
647
+ return this.call("post", { text, attachments });
648
+ }
649
+ /**
650
+ * Post a message for the next turn, labelled as this extension.
651
+ *
652
+ * @param text — The message to queue for the next turn.
653
+ */
654
+ queue(text) {
655
+ return this.call("queue", { text });
656
+ }
657
+ /**
658
+ * Show a json-render block in the transcript. Shown to the person, never sent to the model. Returns its id.
659
+ *
660
+ * @param view — A json-render spec: `{root, elements}`.
661
+ * @param title — The view's title, as it is shown in the transcript.
662
+ */
663
+ append(view, title) {
664
+ return this.call("append", { view, title });
665
+ }
666
+ /**
667
+ * Replace a block this extension appended.
668
+ *
669
+ * @param view_id — The view to replace, by the id `append` returned.
670
+ * @param view — The new json-render spec: `{root, elements}`.
671
+ * @param title — The view's new title.
672
+ */
673
+ replace(view_id, view, title) {
674
+ return this.call("replace", { view_id, view, title });
675
+ }
676
+ /**
677
+ * Search the transcript.
678
+ *
679
+ * @param query — The text to find in the transcript.
680
+ * @param limit — At most this many; 50 by default.
681
+ */
682
+ search(query, limit) {
683
+ return this.call("search", { query, limit });
684
+ }
685
+ /** Stop the run. */
686
+ cancel() {
687
+ return this.call("cancel", {});
688
+ }
689
+ /**
690
+ * Stop one sub-agent's run.
691
+ *
692
+ * @param run_id — The sub-agent's run to stop, by its id.
693
+ */
694
+ cancel_agent(run_id) {
695
+ return this.call("cancel_agent", { run_id });
696
+ }
697
+ /**
698
+ * Remove a run and everything after it.
699
+ *
700
+ * @param run_id — The run to remove, with every run after it.
701
+ */
702
+ truncate(run_id) {
703
+ return this.call("truncate", { run_id });
704
+ }
705
+ /** Compact the conversation if it needs it, as igni does after a run. */
706
+ compact() {
707
+ return this.call("compact", {});
708
+ }
709
+ /**
710
+ * Have the agent note what a turn taught it.
711
+ *
712
+ * @param user_msg — The turn's message, the one the person wrote.
713
+ * @param assistant_msg — The turn's answer, the one the agent gave.
714
+ */
715
+ extract_learnings(user_msg, assistant_msg) {
716
+ return this.call("extract_learnings", { user_msg, assistant_msg });
717
+ }
718
+ /**
719
+ * Forget an interrupted run.
720
+ *
721
+ * @param message_id — The interrupted run to forget, named by the message that started it.
722
+ */
723
+ discard_interrupted(message_id) {
724
+ return this.call("discard_interrupted", { message_id });
725
+ }
726
+ /**
727
+ * Forget a message whose run never finished.
728
+ *
729
+ * @param message_id — The pending message to forget, by its id.
730
+ */
731
+ discard_pending(message_id) {
732
+ return this.call("discard_pending", { message_id });
733
+ }
734
+ /**
735
+ * Upload an attachment for a later `post`.
736
+ *
737
+ * @param filename — The file's name, made safe for the disk.
738
+ * @param content_base64 — The file's bytes, base64-encoded.
739
+ */
740
+ upload(filename, content_base64) {
741
+ return this.call("upload", { filename, content_base64 });
742
+ }
743
+ }
744
+ /** Plan mode: the plan the agent proposed. */
745
+ export class HostPlan extends HostObject {
746
+ static PATH = "plan";
747
+ /** The latest plan. */
748
+ latest;
749
+ /** A plan was submitted or decided. */
750
+ changed;
751
+ /**
752
+ * The object igni hands a page, bound to a host and to the window
753
+ * or session it was reached through.
754
+ *
755
+ * A page never builds one of these: `bridge.host` is already the
756
+ * right one, and a second would be a second conversation.
757
+ *
758
+ * @param link — The link this object talks to the host through.
759
+ * @param window — The window it was reached through, or null for
760
+ * the one the page is in.
761
+ * @param session — The session it was reached through, or null for
762
+ * the one on screen.
763
+ */
764
+ constructor(link, window = null, session = null) {
765
+ super(link, "plan", window, session);
766
+ this.latest = new Property(this, "latest", false);
767
+ this.changed = new Signal("plan.changed");
768
+ }
769
+ /**
770
+ * Approve the plan.
771
+ *
772
+ * @param run_id — The run that submitted the plan.
773
+ */
774
+ approve(run_id) {
775
+ return this.call("approve", { run_id });
776
+ }
777
+ /**
778
+ * Send the plan back.
779
+ *
780
+ * @param run_id — The run that submitted the plan.
781
+ */
782
+ dismiss(run_id) {
783
+ return this.call("dismiss", { run_id });
784
+ }
785
+ }
786
+ /** The agent's todo list and its sub-agent tasks. */
787
+ export class HostTasks extends HostObject {
788
+ static PATH = "tasks";
789
+ /** The todo list. */
790
+ todos;
791
+ /** A task was created. */
792
+ created;
793
+ /** A task changed. */
794
+ updated;
795
+ /** A task loop moved on. */
796
+ iteration;
797
+ /** Every task, as it now stands. */
798
+ snapshot;
799
+ /** The todo list changed. */
800
+ todos_changed;
801
+ /**
802
+ * The object igni hands a page, bound to a host and to the window
803
+ * or session it was reached through.
804
+ *
805
+ * A page never builds one of these: `bridge.host` is already the
806
+ * right one, and a second would be a second conversation.
807
+ *
808
+ * @param link — The link this object talks to the host through.
809
+ * @param window — The window it was reached through, or null for
810
+ * the one the page is in.
811
+ * @param session — The session it was reached through, or null for
812
+ * the one on screen.
813
+ */
814
+ constructor(link, window = null, session = null) {
815
+ super(link, "tasks", window, session);
816
+ this.todos = new Property(this, "todos", false);
817
+ this.created = new Signal("tasks.created");
818
+ this.updated = new Signal("tasks.updated");
819
+ this.iteration = new Signal("tasks.iteration");
820
+ this.snapshot = new Signal("tasks.snapshot");
821
+ this.todos_changed = new Signal("tasks.todos_changed");
822
+ }
823
+ }
824
+ /** `/loop`: a prompt repeated until done. */
825
+ export class HostLoop extends HostObject {
826
+ static PATH = "loop";
827
+ /** Where it is. */
828
+ status;
829
+ /** It paused, resumed, advanced or stopped. */
830
+ changed;
831
+ /**
832
+ * The object igni hands a page, bound to a host and to the window
833
+ * or session it was reached through.
834
+ *
835
+ * A page never builds one of these: `bridge.host` is already the
836
+ * right one, and a second would be a second conversation.
837
+ *
838
+ * @param link — The link this object talks to the host through.
839
+ * @param window — The window it was reached through, or null for
840
+ * the one the page is in.
841
+ * @param session — The session it was reached through, or null for
842
+ * the one on screen.
843
+ */
844
+ constructor(link, window = null, session = null) {
845
+ super(link, "loop", window, session);
846
+ this.status = new Property(this, "status", false);
847
+ this.changed = new Signal("loop.changed");
848
+ }
849
+ /** Pause after this iteration. */
850
+ pause() {
851
+ return this.call("pause", {});
852
+ }
853
+ /** Carry on. */
854
+ resume() {
855
+ return this.call("resume", {});
856
+ }
857
+ /** Stop the loop. */
858
+ cancel_pending() {
859
+ return this.call("cancel_pending", {});
860
+ }
861
+ /** Take the next iteration. */
862
+ pop_pending() {
863
+ return this.call("pop_pending", {});
864
+ }
865
+ }
866
+ /** Slash commands and skills. */
867
+ export class HostCommands extends HostObject {
868
+ static PATH = "commands";
869
+ /** Every slash command. */
870
+ list;
871
+ /** Skill names. */
872
+ skills;
873
+ /** Each skill's description and prompt. */
874
+ skill_definitions;
875
+ /** Each skill's details. */
876
+ skill_details;
877
+ /**
878
+ * The object igni hands a page, bound to a host and to the window
879
+ * or session it was reached through.
880
+ *
881
+ * A page never builds one of these: `bridge.host` is already the
882
+ * right one, and a second would be a second conversation.
883
+ *
884
+ * @param link — The link this object talks to the host through.
885
+ * @param window — The window it was reached through, or null for
886
+ * the one the page is in.
887
+ * @param session — The session it was reached through, or null for
888
+ * the one on screen.
889
+ */
890
+ constructor(link, window = null, session = null) {
891
+ super(link, "commands", window, session);
892
+ this.list = new Property(this, "list", false);
893
+ this.skills = new Property(this, "skills", false);
894
+ this.skill_definitions = new Property(this, "skill_definitions", false);
895
+ this.skill_details = new Property(this, "skill_details", false);
896
+ }
897
+ /**
898
+ * Run a slash command, as the extension. The answer comes back here.
899
+ *
900
+ * @param command — With its slash: `/ctx`.
901
+ */
902
+ run(command) {
903
+ return this.call("run", { command });
904
+ }
905
+ }
906
+ /** Agent definitions. */
907
+ export class HostAgents extends HostObject {
908
+ static PATH = "agents";
909
+ /** Every agent. */
910
+ details;
911
+ /** An agent was promoted or discarded. */
912
+ changed;
913
+ /**
914
+ * The object igni hands a page, bound to a host and to the window
915
+ * or session it was reached through.
916
+ *
917
+ * A page never builds one of these: `bridge.host` is already the
918
+ * right one, and a second would be a second conversation.
919
+ *
920
+ * @param link — The link this object talks to the host through.
921
+ * @param window — The window it was reached through, or null for
922
+ * the one the page is in.
923
+ * @param session — The session it was reached through, or null for
924
+ * the one on screen.
925
+ */
926
+ constructor(link, window = null, session = null) {
927
+ super(link, "agents", window, session);
928
+ this.details = new Property(this, "details", false);
929
+ this.changed = new Signal("agents.changed");
930
+ }
931
+ /**
932
+ * Keep an agent made for one task, as `/agents promote` does.
933
+ *
934
+ * @param name — The agent to keep, by its name.
935
+ * @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`.
936
+ */
937
+ promote_ephemeral(name, target) {
938
+ return this.call("promote_ephemeral", { name, target });
939
+ }
940
+ /**
941
+ * Drop an agent made for one task.
942
+ *
943
+ * @param name — The agent to drop, by its name.
944
+ */
945
+ discard_ephemeral(name) {
946
+ return this.call("discard_ephemeral", { name });
947
+ }
948
+ }
949
+ /** Workflows: scripted runs. */
950
+ export class HostWorkflows extends HostObject {
951
+ static PATH = "workflows";
952
+ /** Every workflow. */
953
+ list;
954
+ /** A workflow run moved on. */
955
+ changed;
956
+ /**
957
+ * The object igni hands a page, bound to a host and to the window
958
+ * or session it was reached through.
959
+ *
960
+ * A page never builds one of these: `bridge.host` is already the
961
+ * right one, and a second would be a second conversation.
962
+ *
963
+ * @param link — The link this object talks to the host through.
964
+ * @param window — The window it was reached through, or null for
965
+ * the one the page is in.
966
+ * @param session — The session it was reached through, or null for
967
+ * the one on screen.
968
+ */
969
+ constructor(link, window = null, session = null) {
970
+ super(link, "workflows", window, session);
971
+ this.list = new Property(this, "list", false);
972
+ this.changed = new Signal("workflows.changed");
973
+ }
974
+ /**
975
+ * Start a workflow.
976
+ *
977
+ * @param name — The workflow to start, by its name.
978
+ * @param input — The workflow's input, a JSON object it reads as it defines.
979
+ */
980
+ run(name, input) {
981
+ return this.call("run", { name, input });
982
+ }
983
+ /**
984
+ * Stop a workflow run.
985
+ *
986
+ * @param workflow_run_id — The run to stop, by its id.
987
+ */
988
+ cancel(workflow_run_id) {
989
+ return this.call("cancel", { workflow_run_id });
990
+ }
991
+ }
992
+ /** Scheduled tasks. */
993
+ export class HostScheduler extends HostObject {
994
+ static PATH = "scheduler";
995
+ /** Every scheduled task. */
996
+ tasks;
997
+ /** A task started, finished or changed. */
998
+ event;
999
+ /**
1000
+ * The object igni hands a page, bound to a host and to the window
1001
+ * or session it was reached through.
1002
+ *
1003
+ * A page never builds one of these: `bridge.host` is already the
1004
+ * right one, and a second would be a second conversation.
1005
+ *
1006
+ * @param link — The link this object talks to the host through.
1007
+ * @param window — The window it was reached through, or null for
1008
+ * the one the page is in.
1009
+ * @param session — The session it was reached through, or null for
1010
+ * the one on screen.
1011
+ */
1012
+ constructor(link, window = null, session = null) {
1013
+ super(link, "scheduler", window, session);
1014
+ this.tasks = new Property(this, "tasks", false);
1015
+ this.event = new Signal("scheduler.event");
1016
+ }
1017
+ /** Start the scheduler. */
1018
+ start() {
1019
+ return this.call("start", {});
1020
+ }
1021
+ /**
1022
+ * Run a scheduled task now.
1023
+ *
1024
+ * @param task_id — The scheduled task to run now, by its id.
1025
+ */
1026
+ run_now(task_id) {
1027
+ return this.call("run_now", { task_id });
1028
+ }
1029
+ /**
1030
+ * Cancel a scheduled task.
1031
+ *
1032
+ * @param task_id — The scheduled task to cancel, by its id.
1033
+ */
1034
+ cancel(task_id) {
1035
+ return this.call("cancel", { task_id });
1036
+ }
1037
+ }
1038
+ /** Background shells. */
1039
+ export class HostProcesses extends HostObject {
1040
+ static PATH = "processes";
1041
+ /** Every background shell. */
1042
+ list;
1043
+ /** A shell started, printed or exited. */
1044
+ changed;
1045
+ /**
1046
+ * The object igni hands a page, bound to a host and to the window
1047
+ * or session it was reached through.
1048
+ *
1049
+ * A page never builds one of these: `bridge.host` is already the
1050
+ * right one, and a second would be a second conversation.
1051
+ *
1052
+ * @param link — The link this object talks to the host through.
1053
+ * @param window — The window it was reached through, or null for
1054
+ * the one the page is in.
1055
+ * @param session — The session it was reached through, or null for
1056
+ * the one on screen.
1057
+ */
1058
+ constructor(link, window = null, session = null) {
1059
+ super(link, "processes", window, session);
1060
+ this.list = new Property(this, "list", false);
1061
+ this.changed = new Signal("processes.changed");
1062
+ }
1063
+ /**
1064
+ * A shell's last lines.
1065
+ *
1066
+ * @param pid — The shell to read the last lines of, by its process id.
1067
+ * @param lines — 200 by default.
1068
+ */
1069
+ tail(pid, lines) {
1070
+ return this.call("tail", { pid, lines });
1071
+ }
1072
+ /**
1073
+ * Stop a shell.
1074
+ *
1075
+ * @param pid — The shell to stop, by its process id.
1076
+ */
1077
+ stop(pid) {
1078
+ return this.call("stop", { pid });
1079
+ }
1080
+ /**
1081
+ * Run a command in the project and wait for it.
1082
+ *
1083
+ * @param command — The command line to run in the project.
1084
+ */
1085
+ run(command) {
1086
+ return this.call("run", { command });
1087
+ }
1088
+ }
1089
+ /** The project, as far as the extension's workspace grant reaches. */
1090
+ export class HostWorkspace extends HostObject {
1091
+ static PATH = "workspace";
1092
+ /** The project directory. */
1093
+ root;
1094
+ /** Git HEAD; `None` outside a repository. */
1095
+ head;
1096
+ /** HEAD moved. */
1097
+ head_changed;
1098
+ /** Files changed, as git sees them, within the grant. */
1099
+ files_changed;
1100
+ /**
1101
+ * The object igni hands a page, bound to a host and to the window
1102
+ * or session it was reached through.
1103
+ *
1104
+ * A page never builds one of these: `bridge.host` is already the
1105
+ * right one, and a second would be a second conversation.
1106
+ *
1107
+ * @param link — The link this object talks to the host through.
1108
+ * @param window — The window it was reached through, or null for
1109
+ * the one the page is in.
1110
+ * @param session — The session it was reached through, or null for
1111
+ * the one on screen.
1112
+ */
1113
+ constructor(link, window = null, session = null) {
1114
+ super(link, "workspace", window, session);
1115
+ this.root = new Property(this, "root", false);
1116
+ this.head = new Property(this, "head", false);
1117
+ this.head_changed = new Signal("workspace.head-changed");
1118
+ this.files_changed = new Signal("workspace.files-changed");
1119
+ }
1120
+ /**
1121
+ * Read a file in the project.
1122
+ *
1123
+ * @param path — The file to read, by its path in the project.
1124
+ */
1125
+ read(path) {
1126
+ return this.call("read", { path });
1127
+ }
1128
+ /**
1129
+ * List a directory in the project.
1130
+ *
1131
+ * @param dir — The directory to list, by its path in the project; the project itself when left out.
1132
+ */
1133
+ list(dir) {
1134
+ return this.call("list", { dir });
1135
+ }
1136
+ /**
1137
+ * Complete a path, as `@` does.
1138
+ *
1139
+ * @param prefix — The path typed so far after `@`.
1140
+ */
1141
+ complete(prefix) {
1142
+ return this.call("complete", { prefix });
1143
+ }
1144
+ /**
1145
+ * Search the code.
1146
+ *
1147
+ * @param query — The text to search the code for.
1148
+ */
1149
+ search(query) {
1150
+ return this.call("search", { query });
1151
+ }
1152
+ /** Ask the person to pick a folder. */
1153
+ pick_dir() {
1154
+ return this.call("pick_dir", {});
1155
+ }
1156
+ /**
1157
+ * 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.
1158
+ *
1159
+ * @param path — Relative to the project, or absolute inside it.
1160
+ */
1161
+ open(path) {
1162
+ return this.call("open", { path });
1163
+ }
1164
+ }
1165
+ /** Models. */
1166
+ export class HostModels extends HostObject {
1167
+ static PATH = "models";
1168
+ /** Every model igni knows. */
1169
+ registry;
1170
+ /** The model in use. Writable: setting it switches. */
1171
+ current;
1172
+ /** The model in use changed. */
1173
+ changed;
1174
+ /**
1175
+ * The object igni hands a page, bound to a host and to the window
1176
+ * or session it was reached through.
1177
+ *
1178
+ * A page never builds one of these: `bridge.host` is already the
1179
+ * right one, and a second would be a second conversation.
1180
+ *
1181
+ * @param link — The link this object talks to the host through.
1182
+ * @param window — The window it was reached through, or null for
1183
+ * the one the page is in.
1184
+ * @param session — The session it was reached through, or null for
1185
+ * the one on screen.
1186
+ */
1187
+ constructor(link, window = null, session = null) {
1188
+ super(link, "models", window, session);
1189
+ this.registry = new Property(this, "registry", false);
1190
+ this.current = new Property(this, "current", true);
1191
+ this.changed = new Signal("models.changed");
1192
+ }
1193
+ }
1194
+ /** MCP servers. */
1195
+ export class HostMcp extends HostObject {
1196
+ static PATH = "mcp";
1197
+ /** Every server. */
1198
+ servers;
1199
+ /** Each server's status. */
1200
+ status;
1201
+ /** Each server's tools and details. */
1202
+ details;
1203
+ /** A server connected, disconnected or changed tools. */
1204
+ changed;
1205
+ /**
1206
+ * The object igni hands a page, bound to a host and to the window
1207
+ * or session it was reached through.
1208
+ *
1209
+ * A page never builds one of these: `bridge.host` is already the
1210
+ * right one, and a second would be a second conversation.
1211
+ *
1212
+ * @param link — The link this object talks to the host through.
1213
+ * @param window — The window it was reached through, or null for
1214
+ * the one the page is in.
1215
+ * @param session — The session it was reached through, or null for
1216
+ * the one on screen.
1217
+ */
1218
+ constructor(link, window = null, session = null) {
1219
+ super(link, "mcp", window, session);
1220
+ this.servers = new Property(this, "servers", false);
1221
+ this.status = new Property(this, "status", false);
1222
+ this.details = new Property(this, "details", false);
1223
+ this.changed = new Signal("mcp.changed");
1224
+ }
1225
+ /**
1226
+ * Connect a server.
1227
+ *
1228
+ * @param name — The server to connect, by its name in the MCP configuration.
1229
+ */
1230
+ connect(name) {
1231
+ return this.call("connect", { name });
1232
+ }
1233
+ /**
1234
+ * Disconnect a server.
1235
+ *
1236
+ * @param name — The server to disconnect, by its name in the MCP configuration.
1237
+ */
1238
+ disconnect(name) {
1239
+ return this.call("disconnect", { name });
1240
+ }
1241
+ /** Start the servers that should be running. */
1242
+ ensure() {
1243
+ return this.call("ensure", {});
1244
+ }
1245
+ /**
1246
+ * Offer or withhold one tool.
1247
+ *
1248
+ * @param server — The server the tool belongs to, by its name.
1249
+ * @param tool — The tool to offer or withhold, by its name.
1250
+ * @param on — Whether the tool is offered.
1251
+ */
1252
+ set_tool_enabled(server, tool, on) {
1253
+ return this.call("set_tool_enabled", { server, tool, on });
1254
+ }
1255
+ }
1256
+ /** Plugins and marketplaces. */
1257
+ export class HostPlugins extends HostObject {
1258
+ static PATH = "plugins";
1259
+ /** Every installed plugin. */
1260
+ installed;
1261
+ /** Every marketplace. */
1262
+ marketplaces;
1263
+ /** A plugin or marketplace changed. */
1264
+ changed;
1265
+ /**
1266
+ * The object igni hands a page, bound to a host and to the window
1267
+ * or session it was reached through.
1268
+ *
1269
+ * A page never builds one of these: `bridge.host` is already the
1270
+ * right one, and a second would be a second conversation.
1271
+ *
1272
+ * @param link — The link this object talks to the host through.
1273
+ * @param window — The window it was reached through, or null for
1274
+ * the one the page is in.
1275
+ * @param session — The session it was reached through, or null for
1276
+ * the one on screen.
1277
+ */
1278
+ constructor(link, window = null, session = null) {
1279
+ super(link, "plugins", window, session);
1280
+ this.installed = new Property(this, "installed", false);
1281
+ this.marketplaces = new Property(this, "marketplaces", false);
1282
+ this.changed = new Signal("plugins.changed");
1283
+ }
1284
+ /**
1285
+ * What a plugin carries.
1286
+ *
1287
+ * @param name — The installed plugin to describe, by its name.
1288
+ */
1289
+ contents(name) {
1290
+ return this.call("contents", { name });
1291
+ }
1292
+ /**
1293
+ * What a plugin would install.
1294
+ *
1295
+ * @param source — The plugin's git URL, optionally followed by a subfolder.
1296
+ * @param branch — The branch, tag or commit to read; the default branch when left out.
1297
+ * @param subdir — The plugin's folder inside the repository, which wins over one in `source`.
1298
+ */
1299
+ preview(source, branch, subdir) {
1300
+ return this.call("preview", { source, branch, subdir });
1301
+ }
1302
+ /**
1303
+ * Install a plugin.
1304
+ *
1305
+ * @param ref — The plugin to install: a git URL or `@<marketplace>/<plugin>`.
1306
+ * @param install_ref — The branch, tag or commit to check out; the marketplace's, or the default branch, when left out.
1307
+ */
1308
+ install(ref, install_ref) {
1309
+ return this.call("install", { ref, install_ref });
1310
+ }
1311
+ /**
1312
+ * Update a plugin.
1313
+ *
1314
+ * @param name — The installed plugin to move, by its name.
1315
+ * @param install_ref — The branch, tag or commit to move to; the remote's default branch when left out.
1316
+ */
1317
+ update(name, install_ref) {
1318
+ return this.call("update", { name, install_ref });
1319
+ }
1320
+ /**
1321
+ * Remove a plugin.
1322
+ *
1323
+ * @param name — The installed plugin to remove, by its name.
1324
+ */
1325
+ remove(name) {
1326
+ return this.call("remove", { name });
1327
+ }
1328
+ /**
1329
+ * Enable or disable a plugin.
1330
+ *
1331
+ * @param name — The installed plugin to switch on or off, by its name.
1332
+ * @param on — Whether the plugin is enabled.
1333
+ */
1334
+ set_enabled(name, on) {
1335
+ return this.call("set_enabled", { name, on });
1336
+ }
1337
+ /**
1338
+ * Add a marketplace.
1339
+ *
1340
+ * @param url — The marketplace's git URL.
1341
+ */
1342
+ add_marketplace(url) {
1343
+ return this.call("add_marketplace", { url });
1344
+ }
1345
+ /**
1346
+ * Remove a marketplace.
1347
+ *
1348
+ * @param name — The marketplace to forget, by its name.
1349
+ */
1350
+ remove_marketplace(name) {
1351
+ return this.call("remove_marketplace", { name });
1352
+ }
1353
+ /**
1354
+ * Refresh marketplaces.
1355
+ *
1356
+ * @param name — The marketplace to fetch again; every one of them when left out.
1357
+ */
1358
+ refresh_marketplaces(name) {
1359
+ return this.call("refresh_marketplaces", { name });
1360
+ }
1361
+ }
1362
+ /** Installed extensions. Read-only, apart from this extension's own settings. */
1363
+ export class HostExtensions extends HostObject {
1364
+ static PATH = "extensions";
1365
+ /** Every installed extension. */
1366
+ installed;
1367
+ /** An extension's health moved. */
1368
+ state_changed;
1369
+ /**
1370
+ * The object igni hands a page, bound to a host and to the window
1371
+ * or session it was reached through.
1372
+ *
1373
+ * A page never builds one of these: `bridge.host` is already the
1374
+ * right one, and a second would be a second conversation.
1375
+ *
1376
+ * @param link — The link this object talks to the host through.
1377
+ * @param window — The window it was reached through, or null for
1378
+ * the one the page is in.
1379
+ * @param session — The session it was reached through, or null for
1380
+ * the one on screen.
1381
+ */
1382
+ constructor(link, window = null, session = null) {
1383
+ super(link, "extensions", window, session);
1384
+ this.installed = new Property(this, "installed", false);
1385
+ this.state_changed = new Signal("extension.state-changed");
1386
+ }
1387
+ /**
1388
+ * Change this extension's own settings.
1389
+ *
1390
+ * @param values — The settings to change, as key to value.
1391
+ */
1392
+ set_settings(values) {
1393
+ return this.call("set_settings", { values });
1394
+ }
1395
+ }
1396
+ /** Hooks. */
1397
+ export class HostHooks extends HostObject {
1398
+ static PATH = "hooks";
1399
+ /** Every hook. */
1400
+ details;
1401
+ /** Hooks were reloaded. */
1402
+ changed;
1403
+ /**
1404
+ * The object igni hands a page, bound to a host and to the window
1405
+ * or session it was reached through.
1406
+ *
1407
+ * A page never builds one of these: `bridge.host` is already the
1408
+ * right one, and a second would be a second conversation.
1409
+ *
1410
+ * @param link — The link this object talks to the host through.
1411
+ * @param window — The window it was reached through, or null for
1412
+ * the one the page is in.
1413
+ * @param session — The session it was reached through, or null for
1414
+ * the one on screen.
1415
+ */
1416
+ constructor(link, window = null, session = null) {
1417
+ super(link, "hooks", window, session);
1418
+ this.details = new Property(this, "details", false);
1419
+ this.changed = new Signal("hooks.changed");
1420
+ }
1421
+ /** Reload hooks. */
1422
+ reload() {
1423
+ return this.call("reload", {});
1424
+ }
1425
+ /** Run the session-start hooks. */
1426
+ fire_session_start() {
1427
+ return this.call("fire_session_start", {});
1428
+ }
1429
+ }
1430
+ /** What the agent may do without asking. */
1431
+ export class HostPermissions extends HostObject {
1432
+ static PATH = "permissions";
1433
+ /** `default`, `plan`, `acceptEdits` or `bypassPermissions`. */
1434
+ mode;
1435
+ /** The mode changed. */
1436
+ mode_changed;
1437
+ /**
1438
+ * The object igni hands a page, bound to a host and to the window
1439
+ * or session it was reached through.
1440
+ *
1441
+ * A page never builds one of these: `bridge.host` is already the
1442
+ * right one, and a second would be a second conversation.
1443
+ *
1444
+ * @param link — The link this object talks to the host through.
1445
+ * @param window — The window it was reached through, or null for
1446
+ * the one the page is in.
1447
+ * @param session — The session it was reached through, or null for
1448
+ * the one on screen.
1449
+ */
1450
+ constructor(link, window = null, session = null) {
1451
+ super(link, "permissions", window, session);
1452
+ this.mode = new Property(this, "mode", false);
1453
+ this.mode_changed = new Signal("permissions.mode_changed");
1454
+ }
1455
+ /**
1456
+ * Would this tool call be allowed, asked or denied? One of `allow`, `ask` or `deny`.
1457
+ *
1458
+ * @param tool_name — The tool the call would use, by its name.
1459
+ * @param func_name — The function of that tool the call would reach.
1460
+ * @param tool_args — The call's arguments, which argument rules match against.
1461
+ */
1462
+ check(tool_name, func_name, tool_args) {
1463
+ return this.call("check", { tool_name, func_name, tool_args });
1464
+ }
1465
+ /**
1466
+ * Save a permission rule.
1467
+ *
1468
+ * @param rule — The rule to save: `Bash(git status)`, a tool name.
1469
+ * @param level — `allow`, `ask` or `deny`.
1470
+ */
1471
+ save_rule(rule, level) {
1472
+ return this.call("save_rule", { rule, level });
1473
+ }
1474
+ }
1475
+ /** The group policy in force. */
1476
+ export class HostPolicy extends HostObject {
1477
+ static PATH = "policy";
1478
+ /** The group's policy pack. */
1479
+ pack;
1480
+ /**
1481
+ * The object igni hands a page, bound to a host and to the window
1482
+ * or session it was reached through.
1483
+ *
1484
+ * A page never builds one of these: `bridge.host` is already the
1485
+ * right one, and a second would be a second conversation.
1486
+ *
1487
+ * @param link — The link this object talks to the host through.
1488
+ * @param window — The window it was reached through, or null for
1489
+ * the one the page is in.
1490
+ * @param session — The session it was reached through, or null for
1491
+ * the one on screen.
1492
+ */
1493
+ constructor(link, window = null, session = null) {
1494
+ super(link, "policy", window, session);
1495
+ this.pack = new Property(this, "pack", false);
1496
+ }
1497
+ }
1498
+ /** Whether the person is signed in to igni. Never their session or a credential. */
1499
+ export class HostAccount extends HostObject {
1500
+ static PATH = "account";
1501
+ /** Who is signed in. */
1502
+ status;
1503
+ /** Someone signed in or out. */
1504
+ changed;
1505
+ /**
1506
+ * The object igni hands a page, bound to a host and to the window
1507
+ * or session it was reached through.
1508
+ *
1509
+ * A page never builds one of these: `bridge.host` is already the
1510
+ * right one, and a second would be a second conversation.
1511
+ *
1512
+ * @param link — The link this object talks to the host through.
1513
+ * @param window — The window it was reached through, or null for
1514
+ * the one the page is in.
1515
+ * @param session — The session it was reached through, or null for
1516
+ * the one on screen.
1517
+ */
1518
+ constructor(link, window = null, session = null) {
1519
+ super(link, "account", window, session);
1520
+ this.status = new Property(this, "status", false);
1521
+ this.changed = new Signal("account.changed");
1522
+ }
1523
+ /** Start the person's own sign-in. Its result is theirs. */
1524
+ sign_in() {
1525
+ return this.call("sign_in", {});
1526
+ }
1527
+ /** Sign the person out. */
1528
+ sign_out() {
1529
+ return this.call("sign_out", {});
1530
+ }
1531
+ }
1532
+ /** The floor's notifications. Its own always; everyone's with `notifications`. */
1533
+ export class HostNotifications extends HostObject {
1534
+ static PATH = "notifications";
1535
+ /** Newest first. */
1536
+ list;
1537
+ /** Unread counts. */
1538
+ unread;
1539
+ /** The counts moved. */
1540
+ changed;
1541
+ /**
1542
+ * The object igni hands a page, bound to a host and to the window
1543
+ * or session it was reached through.
1544
+ *
1545
+ * A page never builds one of these: `bridge.host` is already the
1546
+ * right one, and a second would be a second conversation.
1547
+ *
1548
+ * @param link — The link this object talks to the host through.
1549
+ * @param window — The window it was reached through, or null for
1550
+ * the one the page is in.
1551
+ * @param session — The session it was reached through, or null for
1552
+ * the one on screen.
1553
+ */
1554
+ constructor(link, window = null, session = null) {
1555
+ super(link, "notifications", window, session);
1556
+ this.list = new Property(this, "list", false);
1557
+ this.unread = new Property(this, "unread", false);
1558
+ this.changed = new Signal("notifications.changed");
1559
+ }
1560
+ /**
1561
+ * Tell the person at this machine something. It never leaves the machine.
1562
+ *
1563
+ * @param notification — What to tell the person at this machine.
1564
+ */
1565
+ notify(notification) {
1566
+ return this.call("notify", { notification });
1567
+ }
1568
+ /**
1569
+ * Mark notifications read: these ids, one source, or all of them.
1570
+ *
1571
+ * @param ids — The notifications to mark read, by their ids.
1572
+ * @param source — The source whose notifications to mark read; every one of them when left out.
1573
+ */
1574
+ mark_read(ids, source) {
1575
+ return this.call("mark_read", { ids, source });
1576
+ }
1577
+ }
1578
+ /** This extension, as the host sees it. */
1579
+ export class HostSelf extends HostObject {
1580
+ static PATH = "self";
1581
+ /** Its manifest id. */
1582
+ id;
1583
+ /** Its settings. Writable. */
1584
+ settings;
1585
+ /** Its own entry. */
1586
+ state;
1587
+ /** Its home on the web: its service's URL, when it has one. */
1588
+ web_url;
1589
+ /** Its settings changed. */
1590
+ settings_changed;
1591
+ /** Its health moved. */
1592
+ state_changed;
1593
+ /**
1594
+ * The object igni hands a page, bound to a host and to the window
1595
+ * or session it was reached through.
1596
+ *
1597
+ * A page never builds one of these: `bridge.host` is already the
1598
+ * right one, and a second would be a second conversation.
1599
+ *
1600
+ * @param link — The link this object talks to the host through.
1601
+ * @param window — The window it was reached through, or null for
1602
+ * the one the page is in.
1603
+ * @param session — The session it was reached through, or null for
1604
+ * the one on screen.
1605
+ */
1606
+ constructor(link, window = null, session = null) {
1607
+ super(link, "self", window, session);
1608
+ this.id = new Property(this, "id", false);
1609
+ this.settings = new Property(this, "settings", true);
1610
+ this.state = new Property(this, "state", false);
1611
+ this.web_url = new Property(this, "web_url", false);
1612
+ this.settings_changed = new Signal("self.settings_changed");
1613
+ this.state_changed = new Signal("self.state_changed");
1614
+ }
1615
+ /**
1616
+ * 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`.
1617
+ *
1618
+ * @param reason — Why the extension is working inside igni's process.
1619
+ * @param ttl_seconds — Default and at most 600.
1620
+ */
1621
+ busy(reason, ttl_seconds) {
1622
+ return this.call("busy", { reason, ttl_seconds });
1623
+ }
1624
+ /**
1625
+ * Let go of the lease `busy` took for `reason`. Nothing happens if there is none.
1626
+ *
1627
+ * @param reason — The reason the lease was taken for.
1628
+ */
1629
+ done(reason) {
1630
+ return this.call("done", { reason });
1631
+ }
1632
+ }
1633
+ /** 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. */
1634
+ export class Host extends HostObject {
1635
+ static PATH = "";
1636
+ /** `host.app`. igni itself: how it presents things, which version, whether it is connected. */
1637
+ app;
1638
+ /** `host.windows`. Every open igni window. Address one window's UI with `host.windows.ui(id)`. */
1639
+ windows;
1640
+ /** `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. */
1641
+ ui;
1642
+ /** `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)`. */
1643
+ sessions;
1644
+ /** `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. */
1645
+ chat;
1646
+ /** `host.plan`. Plan mode: the plan the agent proposed. */
1647
+ plan;
1648
+ /** `host.tasks`. The agent's todo list and its sub-agent tasks. */
1649
+ tasks;
1650
+ /** `host.loop`. `/loop`: a prompt repeated until done. */
1651
+ loop;
1652
+ /** `host.commands`. Slash commands and skills. */
1653
+ commands;
1654
+ /** `host.agents`. Agent definitions. */
1655
+ agents;
1656
+ /** `host.workflows`. Workflows: scripted runs. */
1657
+ workflows;
1658
+ /** `host.scheduler`. Scheduled tasks. */
1659
+ scheduler;
1660
+ /** `host.processes`. Background shells. */
1661
+ processes;
1662
+ /** `host.workspace`. The project, as far as the extension's workspace grant reaches. */
1663
+ workspace;
1664
+ /** `host.models`. Models. */
1665
+ models;
1666
+ /** `host.mcp`. MCP servers. */
1667
+ mcp;
1668
+ /** `host.plugins`. Plugins and marketplaces. */
1669
+ plugins;
1670
+ /** `host.extensions`. Installed extensions. Read-only, apart from this extension's own settings. */
1671
+ extensions;
1672
+ /** `host.hooks`. Hooks. */
1673
+ hooks;
1674
+ /** `host.permissions`. What the agent may do without asking. */
1675
+ permissions;
1676
+ /** `host.policy`. The group policy in force. */
1677
+ policy;
1678
+ /** `host.account`. Whether the person is signed in to igni. Never their session or a credential. */
1679
+ account;
1680
+ /** `host.notifications`. The floor's notifications. Its own always; everyone's with `notifications`. */
1681
+ notifications;
1682
+ /** `host.self`. This extension, as the host sees it. */
1683
+ self;
1684
+ /** Anything changed. Carries the member's path and its new value. */
1685
+ changed;
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(link, window = null, session = null) {
1700
+ super(link, "", window, session);
1701
+ this.app = new HostApp(link, window, session);
1702
+ this.windows = new HostWindows(link, window, session);
1703
+ this.ui = new HostUi(link, window, session);
1704
+ this.sessions = new HostSessions(link, window, session);
1705
+ this.chat = new HostChat(link, window, session);
1706
+ this.plan = new HostPlan(link, window, session);
1707
+ this.tasks = new HostTasks(link, window, session);
1708
+ this.loop = new HostLoop(link, window, session);
1709
+ this.commands = new HostCommands(link, window, session);
1710
+ this.agents = new HostAgents(link, window, session);
1711
+ this.workflows = new HostWorkflows(link, window, session);
1712
+ this.scheduler = new HostScheduler(link, window, session);
1713
+ this.processes = new HostProcesses(link, window, session);
1714
+ this.workspace = new HostWorkspace(link, window, session);
1715
+ this.models = new HostModels(link, window, session);
1716
+ this.mcp = new HostMcp(link, window, session);
1717
+ this.plugins = new HostPlugins(link, window, session);
1718
+ this.extensions = new HostExtensions(link, window, session);
1719
+ this.hooks = new HostHooks(link, window, session);
1720
+ this.permissions = new HostPermissions(link, window, session);
1721
+ this.policy = new HostPolicy(link, window, session);
1722
+ this.account = new HostAccount(link, window, session);
1723
+ this.notifications = new HostNotifications(link, window, session);
1724
+ this.self = new HostSelf(link, window, session);
1725
+ this.changed = new Signal("changed");
1726
+ }
1727
+ /**
1728
+ * 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.
1729
+ *
1730
+ * @param context — Named text fields.
1731
+ * @param questions — The questions to ask, each with its own text and answer type.
1732
+ */
1733
+ decide(context, questions) {
1734
+ return this.call("decide", { context, questions });
1735
+ }
1736
+ /**
1737
+ * `decide` for up to 16 contexts at once, sharing forward passes. One decision per context, in order.
1738
+ *
1739
+ * @param contexts — The contexts to ask about, one decision each, in order.
1740
+ * @param questions — The questions to ask of every context.
1741
+ */
1742
+ decide_batch(contexts, questions) {
1743
+ return this.call("decide_batch", { contexts, questions });
1744
+ }
1745
+ }
1746
+ //# sourceMappingURL=hostModel.generated.js.map