@ignite-ember/extension-bridge 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +303 -2
- package/dist/bridge.d.ts +33 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +92 -0
- package/dist/bridge.js.map +1 -0
- package/dist/channel.d.ts +26 -0
- package/dist/channel.d.ts.map +1 -0
- package/dist/channel.js +36 -0
- package/dist/channel.js.map +1 -0
- package/dist/contract.d.ts +110 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/contract.js +9 -0
- package/dist/contract.js.map +1 -0
- package/dist/correlator.d.ts +37 -0
- package/dist/correlator.d.ts.map +1 -0
- package/dist/correlator.js +67 -0
- package/dist/correlator.js.map +1 -0
- package/dist/guestBridge.d.ts +63 -0
- package/dist/guestBridge.d.ts.map +1 -0
- package/dist/guestBridge.js +156 -0
- package/dist/guestBridge.js.map +1 -0
- package/dist/hostModel.d.ts +155 -0
- package/dist/hostModel.d.ts.map +1 -0
- package/dist/hostModel.generated.d.ts +1870 -0
- package/dist/hostModel.generated.d.ts.map +1 -0
- package/dist/hostModel.generated.js +1241 -0
- package/dist/hostModel.generated.js.map +1 -0
- package/dist/hostModel.js +168 -0
- package/dist/hostModel.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol.d.ts +338 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +135 -0
- package/dist/protocol.js.map +1 -0
- package/dist/service.d.ts +143 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +179 -0
- package/dist/service.js.map +1 -0
- package/dist/signals.d.ts +21 -0
- package/dist/signals.d.ts.map +1 -0
- package/dist/signals.js +52 -0
- package/dist/signals.js.map +1 -0
- package/dist/tokens.d.ts +95 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +158 -0
- package/dist/tokens.js.map +1 -0
- package/dist/watchers.d.ts +12 -0
- package/dist/watchers.d.ts.map +1 -0
- package/dist/watchers.js +18 -0
- package/dist/watchers.js.map +1 -0
- package/package.json +53 -4
- package/src/bridge.ts +112 -0
- package/src/channel.ts +48 -0
- package/src/contract.ts +130 -0
- package/src/correlator.ts +81 -0
- package/src/guestBridge.ts +261 -0
- package/src/hostModel.generated.ts +2649 -0
- package/src/hostModel.ts +209 -0
- package/src/index.ts +11 -0
- package/src/protocol.ts +475 -0
- package/src/service.ts +253 -0
- package/src/signals.ts +65 -0
- package/src/tokens.ts +165 -0
- package/src/watchers.ts +18 -0
|
@@ -0,0 +1,1241 @@
|
|
|
1
|
+
// GENERATED from the igni host schema 1.13.0 by igni-sdk's tools/host_codegen.py — do not edit. Run `make host-sdks` after refreshing contracts/host-schema.json.
|
|
2
|
+
//
|
|
3
|
+
// `bridge.host` as an extension's page sees it. Read
|
|
4
|
+
// `docs/HOST_OBJECT_MODEL.md` in igni for what each object is.
|
|
5
|
+
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
|
+
constructor(link, window = null, session = null) {
|
|
28
|
+
super(link, "app.state", window, session);
|
|
29
|
+
this.values = new Property(this, "values", false);
|
|
30
|
+
this.changed = new Signal("app.state.changed");
|
|
31
|
+
}
|
|
32
|
+
/** One value, or `None`. */
|
|
33
|
+
get(key) {
|
|
34
|
+
return this.call("get", { key });
|
|
35
|
+
}
|
|
36
|
+
/** Store one value. */
|
|
37
|
+
set(key, value) {
|
|
38
|
+
return this.call("set", { key, value });
|
|
39
|
+
}
|
|
40
|
+
/** Remove one key. */
|
|
41
|
+
delete(key) {
|
|
42
|
+
return this.call("delete", { key });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/** 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. */
|
|
46
|
+
export class HostChatApprovals extends HostObject {
|
|
47
|
+
static PATH = "chat.approvals";
|
|
48
|
+
/** Requests not yet answered. */
|
|
49
|
+
waiting;
|
|
50
|
+
/** The agent asked. */
|
|
51
|
+
requested;
|
|
52
|
+
/** Somebody answered. */
|
|
53
|
+
resolved;
|
|
54
|
+
/** The reason arrived. */
|
|
55
|
+
details;
|
|
56
|
+
/** An approval appeared or went away, whoever answered and whenever — including after a restart. For an app following approvals through the API. */
|
|
57
|
+
changed;
|
|
58
|
+
/**
|
|
59
|
+
* The object igni hands a page, bound to a host and to the window
|
|
60
|
+
* or session it was reached through.
|
|
61
|
+
*
|
|
62
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
63
|
+
* right one, and a second would be a second conversation.
|
|
64
|
+
*/
|
|
65
|
+
constructor(link, window = null, session = null) {
|
|
66
|
+
super(link, "chat.approvals", window, session);
|
|
67
|
+
this.waiting = new Property(this, "waiting", false);
|
|
68
|
+
this.requested = new Signal("chat.approvals.requested");
|
|
69
|
+
this.resolved = new Signal("chat.approvals.resolved");
|
|
70
|
+
this.details = new Signal("chat.approvals.details");
|
|
71
|
+
this.changed = new Signal("chat.approvals.changed");
|
|
72
|
+
}
|
|
73
|
+
/** Answer one request, as the person's dialog does. */
|
|
74
|
+
answer(requirement_id, action, choice) {
|
|
75
|
+
return this.call("answer", { requirement_id, action, choice });
|
|
76
|
+
}
|
|
77
|
+
/** Answer every request of a pause at once. */
|
|
78
|
+
answer_all(answers) {
|
|
79
|
+
return this.call("answer_all", { answers });
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** 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. */
|
|
83
|
+
export class HostChatViews extends HostObject {
|
|
84
|
+
static PATH = "chat.views";
|
|
85
|
+
/** The views in the current session. */
|
|
86
|
+
list;
|
|
87
|
+
/** A view appeared or was replaced. */
|
|
88
|
+
shown;
|
|
89
|
+
/** The person used a control in a view. */
|
|
90
|
+
action;
|
|
91
|
+
/**
|
|
92
|
+
* The object igni hands a page, bound to a host and to the window
|
|
93
|
+
* or session it was reached through.
|
|
94
|
+
*
|
|
95
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
96
|
+
* right one, and a second would be a second conversation.
|
|
97
|
+
*/
|
|
98
|
+
constructor(link, window = null, session = null) {
|
|
99
|
+
super(link, "chat.views", window, session);
|
|
100
|
+
this.list = new Property(this, "list", false);
|
|
101
|
+
this.shown = new Signal("chat.views.shown");
|
|
102
|
+
this.action = new Signal("chat.views.action");
|
|
103
|
+
}
|
|
104
|
+
/** Act on a view as if the person had. */
|
|
105
|
+
dispatch(view_id, action, params) {
|
|
106
|
+
return this.call("dispatch", { view_id, action, params });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/** igni itself: how it presents things, which version, whether it is connected. */
|
|
110
|
+
export class HostApp extends HostObject {
|
|
111
|
+
static PATH = "app";
|
|
112
|
+
/** `host.app.state`. Key–value state of the extension's own, kept by the host across restarts. An extension sees only its own keys. */
|
|
113
|
+
state;
|
|
114
|
+
/** Theme, verbosity, output style. */
|
|
115
|
+
display;
|
|
116
|
+
/** The igni version running. */
|
|
117
|
+
version;
|
|
118
|
+
/** A newer igni, as last checked; `None` when there is none or it was not checked yet. */
|
|
119
|
+
update_available;
|
|
120
|
+
/** Model and server reachability. */
|
|
121
|
+
connection;
|
|
122
|
+
/** Running, waiting on a person, or idle — what decides whether igni's process may be suspended. */
|
|
123
|
+
activity;
|
|
124
|
+
/** Verbosity or output style changed. */
|
|
125
|
+
display_changed;
|
|
126
|
+
/** The connection changed. */
|
|
127
|
+
connection_changed;
|
|
128
|
+
/** An update check answered. */
|
|
129
|
+
update_changed;
|
|
130
|
+
/** igni started or stopped doing something. */
|
|
131
|
+
activity_changed;
|
|
132
|
+
/**
|
|
133
|
+
* The object igni hands a page, bound to a host and to the window
|
|
134
|
+
* or session it was reached through.
|
|
135
|
+
*
|
|
136
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
137
|
+
* right one, and a second would be a second conversation.
|
|
138
|
+
*/
|
|
139
|
+
constructor(link, window = null, session = null) {
|
|
140
|
+
super(link, "app", window, session);
|
|
141
|
+
this.state = new HostAppState(link, window, session);
|
|
142
|
+
this.display = new Property(this, "display", false);
|
|
143
|
+
this.version = new Property(this, "version", false);
|
|
144
|
+
this.update_available = new Property(this, "update_available", false);
|
|
145
|
+
this.connection = new Property(this, "connection", false);
|
|
146
|
+
this.activity = new Property(this, "activity", false);
|
|
147
|
+
this.display_changed = new Signal("app.display_changed");
|
|
148
|
+
this.connection_changed = new Signal("app.connection_changed");
|
|
149
|
+
this.update_changed = new Signal("app.update_changed");
|
|
150
|
+
this.activity_changed = new Signal("app.activity_changed");
|
|
151
|
+
}
|
|
152
|
+
/** Show or hide routing detail. */
|
|
153
|
+
set_verbose(on) {
|
|
154
|
+
return this.call("set_verbose", { on });
|
|
155
|
+
}
|
|
156
|
+
/** Switch the output style, as `/output-style <name>` does. */
|
|
157
|
+
set_output_style(name) {
|
|
158
|
+
return this.call("set_output_style", { name });
|
|
159
|
+
}
|
|
160
|
+
/** 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`. */
|
|
161
|
+
check_for_update() {
|
|
162
|
+
return this.call("check_for_update", {});
|
|
163
|
+
}
|
|
164
|
+
/** 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`). */
|
|
165
|
+
open_external(url) {
|
|
166
|
+
return this.call("open_external", { url });
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/** Every open igni window. Address one window's UI with `host.windows.ui(id)`. */
|
|
170
|
+
export class HostWindows extends HostObject {
|
|
171
|
+
static PATH = "windows";
|
|
172
|
+
/** Every window connected now. */
|
|
173
|
+
list;
|
|
174
|
+
/** The window the person is using — the one with focus; `None` when igni is in the background. */
|
|
175
|
+
focused;
|
|
176
|
+
/** A window connected. */
|
|
177
|
+
opened;
|
|
178
|
+
/** A window went away. */
|
|
179
|
+
closed;
|
|
180
|
+
/** A window took focus or lost it; `focused` says which. */
|
|
181
|
+
focus_changed;
|
|
182
|
+
/**
|
|
183
|
+
* The object igni hands a page, bound to a host and to the window
|
|
184
|
+
* or session it was reached through.
|
|
185
|
+
*
|
|
186
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
187
|
+
* right one, and a second would be a second conversation.
|
|
188
|
+
*/
|
|
189
|
+
constructor(link, window = null, session = null) {
|
|
190
|
+
super(link, "windows", window, session);
|
|
191
|
+
this.list = new Property(this, "list", false);
|
|
192
|
+
this.focused = new Property(this, "focused", false);
|
|
193
|
+
this.opened = new Signal("windows.opened");
|
|
194
|
+
this.closed = new Signal("windows.closed");
|
|
195
|
+
this.focus_changed = new Signal("windows.focus_changed");
|
|
196
|
+
}
|
|
197
|
+
/** `host.ui` of one window, by its id. */
|
|
198
|
+
ui(windowId) {
|
|
199
|
+
return new HostUi(this.link, windowId);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/** 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. */
|
|
203
|
+
export class HostUi extends HostObject {
|
|
204
|
+
static PATH = "ui";
|
|
205
|
+
/** The page stack; empty when the chat is showing. Writable: setting it navigates. */
|
|
206
|
+
route;
|
|
207
|
+
/** The panel open over the chat. Writable: setting it opens one, `None` closes it. */
|
|
208
|
+
panel;
|
|
209
|
+
/** The sidebar. Writable. */
|
|
210
|
+
sidebar;
|
|
211
|
+
/** The file previewed. Writable: `None` closes it. */
|
|
212
|
+
preview;
|
|
213
|
+
/** What is selected. Writable. */
|
|
214
|
+
selection;
|
|
215
|
+
/** The composer: draft, the files it refers to, its mode. Writable. */
|
|
216
|
+
composer;
|
|
217
|
+
/** Toasts on screen, oldest first. */
|
|
218
|
+
toasts;
|
|
219
|
+
/** The open dialog. */
|
|
220
|
+
dialog;
|
|
221
|
+
/** Where the transcript is. */
|
|
222
|
+
scroll;
|
|
223
|
+
/** The page stack changed. */
|
|
224
|
+
navigated;
|
|
225
|
+
/** A panel opened or closed. */
|
|
226
|
+
panel_changed;
|
|
227
|
+
/** The sidebar changed. */
|
|
228
|
+
sidebar_changed;
|
|
229
|
+
/** The preview opened, changed or closed. */
|
|
230
|
+
preview_changed;
|
|
231
|
+
/** The selection changed. */
|
|
232
|
+
selection_changed;
|
|
233
|
+
/** The draft changed. */
|
|
234
|
+
composer_changed;
|
|
235
|
+
/** A toast appeared. */
|
|
236
|
+
toast_shown;
|
|
237
|
+
/** A toast went away. */
|
|
238
|
+
toast_dismissed;
|
|
239
|
+
/** A dialog opened. */
|
|
240
|
+
dialog_opened;
|
|
241
|
+
/** A dialog closed, with the answer. */
|
|
242
|
+
dialog_closed;
|
|
243
|
+
/** The transcript came to rest somewhere else, or started or stopped following the newest message. */
|
|
244
|
+
scrolled;
|
|
245
|
+
/**
|
|
246
|
+
* The object igni hands a page, bound to a host and to the window
|
|
247
|
+
* or session it was reached through.
|
|
248
|
+
*
|
|
249
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
250
|
+
* right one, and a second would be a second conversation.
|
|
251
|
+
*/
|
|
252
|
+
constructor(link, window = null, session = null) {
|
|
253
|
+
super(link, "ui", window, session);
|
|
254
|
+
this.route = new Property(this, "route", true);
|
|
255
|
+
this.panel = new Property(this, "panel", true);
|
|
256
|
+
this.sidebar = new Property(this, "sidebar", true);
|
|
257
|
+
this.preview = new Property(this, "preview", true);
|
|
258
|
+
this.selection = new Property(this, "selection", true);
|
|
259
|
+
this.composer = new Property(this, "composer", true);
|
|
260
|
+
this.toasts = new Property(this, "toasts", false);
|
|
261
|
+
this.dialog = new Property(this, "dialog", false);
|
|
262
|
+
this.scroll = new Property(this, "scroll", false);
|
|
263
|
+
this.navigated = new Signal("ui.navigated");
|
|
264
|
+
this.panel_changed = new Signal("ui.panel_changed");
|
|
265
|
+
this.sidebar_changed = new Signal("ui.sidebar_changed");
|
|
266
|
+
this.preview_changed = new Signal("ui.preview_changed");
|
|
267
|
+
this.selection_changed = new Signal("ui.selection_changed");
|
|
268
|
+
this.composer_changed = new Signal("ui.composer_changed");
|
|
269
|
+
this.toast_shown = new Signal("ui.toast_shown");
|
|
270
|
+
this.toast_dismissed = new Signal("ui.toast_dismissed");
|
|
271
|
+
this.dialog_opened = new Signal("ui.dialog_opened");
|
|
272
|
+
this.dialog_closed = new Signal("ui.dialog_closed");
|
|
273
|
+
this.scrolled = new Signal("ui.scrolled");
|
|
274
|
+
}
|
|
275
|
+
/** Open a page at the top of the stack, as a header link does. */
|
|
276
|
+
navigate(page, params) {
|
|
277
|
+
return this.call("navigate", { page, params });
|
|
278
|
+
}
|
|
279
|
+
/** Go back one level; at the root, back to the chat. */
|
|
280
|
+
back() {
|
|
281
|
+
return this.call("back", {});
|
|
282
|
+
}
|
|
283
|
+
/** Open a panel over the chat, closing the one that was open. */
|
|
284
|
+
open_panel(kind, params) {
|
|
285
|
+
return this.call("open_panel", { kind, params });
|
|
286
|
+
}
|
|
287
|
+
/** Close the panel. */
|
|
288
|
+
close_panel() {
|
|
289
|
+
return this.call("close_panel", {});
|
|
290
|
+
}
|
|
291
|
+
/** Open or close the sidebar, and size it or bring a section into view. */
|
|
292
|
+
set_sidebar(open, width, section) {
|
|
293
|
+
return this.call("set_sidebar", { open, width, section });
|
|
294
|
+
}
|
|
295
|
+
/** Preview a file of the project. (`preview` is the property.) */
|
|
296
|
+
open_preview(path) {
|
|
297
|
+
return this.call("open_preview", { path });
|
|
298
|
+
}
|
|
299
|
+
/** Close the preview. */
|
|
300
|
+
close_preview() {
|
|
301
|
+
return this.call("close_preview", {});
|
|
302
|
+
}
|
|
303
|
+
/** Select a message, text or file. The parts left out are cleared. */
|
|
304
|
+
select(selection) {
|
|
305
|
+
return this.call("select", { selection });
|
|
306
|
+
}
|
|
307
|
+
/** Replace the draft. */
|
|
308
|
+
set_composer(text, attachments, mode) {
|
|
309
|
+
return this.call("set_composer", { text, attachments, mode });
|
|
310
|
+
}
|
|
311
|
+
/** Show a transient message, labelled as this extension's. */
|
|
312
|
+
toast(text, kind, body, target) {
|
|
313
|
+
return this.call("toast", { text, kind, body, target });
|
|
314
|
+
}
|
|
315
|
+
/** Take one of this extension's toasts away. */
|
|
316
|
+
dismiss_toast(toast_id) {
|
|
317
|
+
return this.call("dismiss_toast", { toast_id });
|
|
318
|
+
}
|
|
319
|
+
/** 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.) */
|
|
320
|
+
show_dialog(spec) {
|
|
321
|
+
return this.call("show_dialog", { spec });
|
|
322
|
+
}
|
|
323
|
+
/** Scroll the transcript to a message, by its run; `bottom` for the newest. */
|
|
324
|
+
scroll_to(message_id) {
|
|
325
|
+
return this.call("scroll_to", { message_id });
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
/** 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)`. */
|
|
329
|
+
export class HostSessions extends HostObject {
|
|
330
|
+
static PATH = "sessions";
|
|
331
|
+
/** Every session, newest first. */
|
|
332
|
+
list;
|
|
333
|
+
/** The session the active window shows. Writable: setting it switches, and is refused where the person's switch would be. */
|
|
334
|
+
current;
|
|
335
|
+
/** A window moved to another session. */
|
|
336
|
+
current_changed;
|
|
337
|
+
/** The session list was read. */
|
|
338
|
+
listed;
|
|
339
|
+
/** `/clear` renewed a session. */
|
|
340
|
+
cleared;
|
|
341
|
+
/** A session got its name. */
|
|
342
|
+
named;
|
|
343
|
+
/**
|
|
344
|
+
* The object igni hands a page, bound to a host and to the window
|
|
345
|
+
* or session it was reached through.
|
|
346
|
+
*
|
|
347
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
348
|
+
* right one, and a second would be a second conversation.
|
|
349
|
+
*/
|
|
350
|
+
constructor(link, window = null, session = null) {
|
|
351
|
+
super(link, "sessions", window, session);
|
|
352
|
+
this.list = new Property(this, "list", false);
|
|
353
|
+
this.current = new Property(this, "current", true);
|
|
354
|
+
this.current_changed = new Signal("session.switched");
|
|
355
|
+
this.listed = new Signal("sessions.listed");
|
|
356
|
+
this.cleared = new Signal("sessions.cleared");
|
|
357
|
+
this.named = new Signal("sessions.named");
|
|
358
|
+
}
|
|
359
|
+
/** Show a session in the active window. */
|
|
360
|
+
open(session_id) {
|
|
361
|
+
return this.call("open", { session_id });
|
|
362
|
+
}
|
|
363
|
+
/** 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. */
|
|
364
|
+
create(project_dir, title, focus) {
|
|
365
|
+
return this.call("create", { project_dir, title, focus });
|
|
366
|
+
}
|
|
367
|
+
/** Make sure a session is live, without showing it. */
|
|
368
|
+
attach(session_id, project_dir) {
|
|
369
|
+
return this.call("attach", { session_id, project_dir });
|
|
370
|
+
}
|
|
371
|
+
/** `host.chat` of any session of this project, by its id, without showing it. The session on screen's id is `host.chat` itself. */
|
|
372
|
+
chat(sessionId) {
|
|
373
|
+
return new HostChat(this.link, null, sessionId);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
/** 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. */
|
|
377
|
+
export class HostChat extends HostObject {
|
|
378
|
+
static PATH = "chat";
|
|
379
|
+
/** `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. */
|
|
380
|
+
approvals;
|
|
381
|
+
/** `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. */
|
|
382
|
+
views;
|
|
383
|
+
/** The current session. */
|
|
384
|
+
session_id;
|
|
385
|
+
/** The transcript, turn by turn. */
|
|
386
|
+
messages;
|
|
387
|
+
/** Messages waiting for a turn. */
|
|
388
|
+
pending;
|
|
389
|
+
/** Whether a run is going. */
|
|
390
|
+
processing;
|
|
391
|
+
/** The status line. */
|
|
392
|
+
status;
|
|
393
|
+
/** Seconds a run may take. */
|
|
394
|
+
timeout;
|
|
395
|
+
/** Runs that stopped part-way. */
|
|
396
|
+
interrupted_runs;
|
|
397
|
+
/** Token counts and what fills them. */
|
|
398
|
+
context;
|
|
399
|
+
/** A message was posted — by the person, an extension, or an extension's service (`from_service`). */
|
|
400
|
+
message_added;
|
|
401
|
+
/** The agent's answer, streaming. */
|
|
402
|
+
content_delta;
|
|
403
|
+
/** The agent started thinking. */
|
|
404
|
+
reasoning_started;
|
|
405
|
+
/** A run started. */
|
|
406
|
+
run_started;
|
|
407
|
+
/** A run finished, with the files it changed. */
|
|
408
|
+
run_completed;
|
|
409
|
+
/** A run stopped with an error. */
|
|
410
|
+
run_error;
|
|
411
|
+
/** A run is waiting for approvals. */
|
|
412
|
+
run_paused;
|
|
413
|
+
/** The answer finished streaming. */
|
|
414
|
+
streaming_done;
|
|
415
|
+
/** Somebody's draft, live. */
|
|
416
|
+
typing;
|
|
417
|
+
/** The status line changed. */
|
|
418
|
+
status_changed;
|
|
419
|
+
/** An info line. */
|
|
420
|
+
info;
|
|
421
|
+
/** An error line. */
|
|
422
|
+
error;
|
|
423
|
+
/** The agent called a tool. */
|
|
424
|
+
tool_started;
|
|
425
|
+
/** A tool call finished. */
|
|
426
|
+
tool_completed;
|
|
427
|
+
/** A tool call failed. */
|
|
428
|
+
tool_error;
|
|
429
|
+
/** A model call finished. */
|
|
430
|
+
model_completed;
|
|
431
|
+
/** The agent wrote a file. */
|
|
432
|
+
file_edited;
|
|
433
|
+
/** A sub-agent or team moved on. */
|
|
434
|
+
agent_event;
|
|
435
|
+
/** A network call is being retried. */
|
|
436
|
+
retry;
|
|
437
|
+
/** Turns were truncated or discarded. */
|
|
438
|
+
history_changed;
|
|
439
|
+
/**
|
|
440
|
+
* The object igni hands a page, bound to a host and to the window
|
|
441
|
+
* or session it was reached through.
|
|
442
|
+
*
|
|
443
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
444
|
+
* right one, and a second would be a second conversation.
|
|
445
|
+
*/
|
|
446
|
+
constructor(link, window = null, session = null) {
|
|
447
|
+
super(link, "chat", window, session);
|
|
448
|
+
this.approvals = new HostChatApprovals(link, window, session);
|
|
449
|
+
this.views = new HostChatViews(link, window, session);
|
|
450
|
+
this.session_id = new Property(this, "session_id", false);
|
|
451
|
+
this.messages = new Property(this, "messages", false);
|
|
452
|
+
this.pending = new Property(this, "pending", false);
|
|
453
|
+
this.processing = new Property(this, "processing", false);
|
|
454
|
+
this.status = new Property(this, "status", false);
|
|
455
|
+
this.timeout = new Property(this, "timeout", false);
|
|
456
|
+
this.interrupted_runs = new Property(this, "interrupted_runs", false);
|
|
457
|
+
this.context = new Property(this, "context", false);
|
|
458
|
+
this.message_added = new Signal("chat.message_added");
|
|
459
|
+
this.content_delta = new Signal("chat.content_delta");
|
|
460
|
+
this.reasoning_started = new Signal("chat.reasoning_started");
|
|
461
|
+
this.run_started = new Signal("chat.run_started");
|
|
462
|
+
this.run_completed = new Signal("chat.run_completed");
|
|
463
|
+
this.run_error = new Signal("chat.run_error");
|
|
464
|
+
this.run_paused = new Signal("chat.run_paused");
|
|
465
|
+
this.streaming_done = new Signal("chat.streaming_done");
|
|
466
|
+
this.typing = new Signal("chat.typing");
|
|
467
|
+
this.status_changed = new Signal("chat.status_changed");
|
|
468
|
+
this.info = new Signal("chat.info");
|
|
469
|
+
this.error = new Signal("chat.error");
|
|
470
|
+
this.tool_started = new Signal("chat.tool_started");
|
|
471
|
+
this.tool_completed = new Signal("chat.tool_completed");
|
|
472
|
+
this.tool_error = new Signal("chat.tool_error");
|
|
473
|
+
this.model_completed = new Signal("chat.model_completed");
|
|
474
|
+
this.file_edited = new Signal("chat.file_edited");
|
|
475
|
+
this.agent_event = new Signal("chat.agent_event");
|
|
476
|
+
this.retry = new Signal("chat.retry");
|
|
477
|
+
this.history_changed = new Signal("chat.history_changed");
|
|
478
|
+
}
|
|
479
|
+
/** 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. */
|
|
480
|
+
post(text, attachments) {
|
|
481
|
+
return this.call("post", { text, attachments });
|
|
482
|
+
}
|
|
483
|
+
/** Post a message for the next turn, labelled as this extension. */
|
|
484
|
+
queue(text) {
|
|
485
|
+
return this.call("queue", { text });
|
|
486
|
+
}
|
|
487
|
+
/** Show a json-render block in the transcript. Shown to the person, never sent to the model. Returns its id. */
|
|
488
|
+
append(view, title) {
|
|
489
|
+
return this.call("append", { view, title });
|
|
490
|
+
}
|
|
491
|
+
/** Replace a block this extension appended. */
|
|
492
|
+
replace(view_id, view, title) {
|
|
493
|
+
return this.call("replace", { view_id, view, title });
|
|
494
|
+
}
|
|
495
|
+
/** Search the transcript. */
|
|
496
|
+
search(query, limit) {
|
|
497
|
+
return this.call("search", { query, limit });
|
|
498
|
+
}
|
|
499
|
+
/** Stop the run. */
|
|
500
|
+
cancel() {
|
|
501
|
+
return this.call("cancel", {});
|
|
502
|
+
}
|
|
503
|
+
/** Stop one sub-agent's run. */
|
|
504
|
+
cancel_agent(run_id) {
|
|
505
|
+
return this.call("cancel_agent", { run_id });
|
|
506
|
+
}
|
|
507
|
+
/** Remove a run and everything after it. */
|
|
508
|
+
truncate(run_id) {
|
|
509
|
+
return this.call("truncate", { run_id });
|
|
510
|
+
}
|
|
511
|
+
/** Compact the conversation if it needs it, as igni does after a run. */
|
|
512
|
+
compact() {
|
|
513
|
+
return this.call("compact", {});
|
|
514
|
+
}
|
|
515
|
+
/** Have the agent note what a turn taught it. */
|
|
516
|
+
extract_learnings(user_msg, assistant_msg) {
|
|
517
|
+
return this.call("extract_learnings", { user_msg, assistant_msg });
|
|
518
|
+
}
|
|
519
|
+
/** Forget an interrupted run. */
|
|
520
|
+
discard_interrupted(message_id) {
|
|
521
|
+
return this.call("discard_interrupted", { message_id });
|
|
522
|
+
}
|
|
523
|
+
/** Upload an attachment for a later `post`. */
|
|
524
|
+
upload(filename, content_base64) {
|
|
525
|
+
return this.call("upload", { filename, content_base64 });
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
/** Plan mode: the plan the agent proposed. */
|
|
529
|
+
export class HostPlan extends HostObject {
|
|
530
|
+
static PATH = "plan";
|
|
531
|
+
/** The latest plan. */
|
|
532
|
+
latest;
|
|
533
|
+
/** A plan was submitted or decided. */
|
|
534
|
+
changed;
|
|
535
|
+
/**
|
|
536
|
+
* The object igni hands a page, bound to a host and to the window
|
|
537
|
+
* or session it was reached through.
|
|
538
|
+
*
|
|
539
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
540
|
+
* right one, and a second would be a second conversation.
|
|
541
|
+
*/
|
|
542
|
+
constructor(link, window = null, session = null) {
|
|
543
|
+
super(link, "plan", window, session);
|
|
544
|
+
this.latest = new Property(this, "latest", false);
|
|
545
|
+
this.changed = new Signal("plan.changed");
|
|
546
|
+
}
|
|
547
|
+
/** Approve the plan. */
|
|
548
|
+
approve(run_id) {
|
|
549
|
+
return this.call("approve", { run_id });
|
|
550
|
+
}
|
|
551
|
+
/** Send the plan back. */
|
|
552
|
+
dismiss(run_id) {
|
|
553
|
+
return this.call("dismiss", { run_id });
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
/** The agent's todo list and its sub-agent tasks. */
|
|
557
|
+
export class HostTasks extends HostObject {
|
|
558
|
+
static PATH = "tasks";
|
|
559
|
+
/** The todo list. */
|
|
560
|
+
todos;
|
|
561
|
+
/** A task was created. */
|
|
562
|
+
created;
|
|
563
|
+
/** A task changed. */
|
|
564
|
+
updated;
|
|
565
|
+
/** A task loop moved on. */
|
|
566
|
+
iteration;
|
|
567
|
+
/** Every task, as it now stands. */
|
|
568
|
+
snapshot;
|
|
569
|
+
/** The todo list changed. */
|
|
570
|
+
todos_changed;
|
|
571
|
+
/**
|
|
572
|
+
* The object igni hands a page, bound to a host and to the window
|
|
573
|
+
* or session it was reached through.
|
|
574
|
+
*
|
|
575
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
576
|
+
* right one, and a second would be a second conversation.
|
|
577
|
+
*/
|
|
578
|
+
constructor(link, window = null, session = null) {
|
|
579
|
+
super(link, "tasks", window, session);
|
|
580
|
+
this.todos = new Property(this, "todos", false);
|
|
581
|
+
this.created = new Signal("tasks.created");
|
|
582
|
+
this.updated = new Signal("tasks.updated");
|
|
583
|
+
this.iteration = new Signal("tasks.iteration");
|
|
584
|
+
this.snapshot = new Signal("tasks.snapshot");
|
|
585
|
+
this.todos_changed = new Signal("tasks.todos_changed");
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
/** `/loop`: a prompt repeated until done. */
|
|
589
|
+
export class HostLoop extends HostObject {
|
|
590
|
+
static PATH = "loop";
|
|
591
|
+
/** Where it is. */
|
|
592
|
+
status;
|
|
593
|
+
/** It paused, resumed, advanced or stopped. */
|
|
594
|
+
changed;
|
|
595
|
+
/**
|
|
596
|
+
* The object igni hands a page, bound to a host and to the window
|
|
597
|
+
* or session it was reached through.
|
|
598
|
+
*
|
|
599
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
600
|
+
* right one, and a second would be a second conversation.
|
|
601
|
+
*/
|
|
602
|
+
constructor(link, window = null, session = null) {
|
|
603
|
+
super(link, "loop", window, session);
|
|
604
|
+
this.status = new Property(this, "status", false);
|
|
605
|
+
this.changed = new Signal("loop.changed");
|
|
606
|
+
}
|
|
607
|
+
/** Pause after this iteration. */
|
|
608
|
+
pause() {
|
|
609
|
+
return this.call("pause", {});
|
|
610
|
+
}
|
|
611
|
+
/** Carry on. */
|
|
612
|
+
resume() {
|
|
613
|
+
return this.call("resume", {});
|
|
614
|
+
}
|
|
615
|
+
/** Stop the loop. */
|
|
616
|
+
cancel_pending() {
|
|
617
|
+
return this.call("cancel_pending", {});
|
|
618
|
+
}
|
|
619
|
+
/** Take the next iteration. */
|
|
620
|
+
pop_pending() {
|
|
621
|
+
return this.call("pop_pending", {});
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
/** Slash commands and skills. */
|
|
625
|
+
export class HostCommands extends HostObject {
|
|
626
|
+
static PATH = "commands";
|
|
627
|
+
/** Every slash command. */
|
|
628
|
+
list;
|
|
629
|
+
/** Skill names. */
|
|
630
|
+
skills;
|
|
631
|
+
/** Each skill's description and prompt. */
|
|
632
|
+
skill_definitions;
|
|
633
|
+
/** Each skill's details. */
|
|
634
|
+
skill_details;
|
|
635
|
+
/**
|
|
636
|
+
* The object igni hands a page, bound to a host and to the window
|
|
637
|
+
* or session it was reached through.
|
|
638
|
+
*
|
|
639
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
640
|
+
* right one, and a second would be a second conversation.
|
|
641
|
+
*/
|
|
642
|
+
constructor(link, window = null, session = null) {
|
|
643
|
+
super(link, "commands", window, session);
|
|
644
|
+
this.list = new Property(this, "list", false);
|
|
645
|
+
this.skills = new Property(this, "skills", false);
|
|
646
|
+
this.skill_definitions = new Property(this, "skill_definitions", false);
|
|
647
|
+
this.skill_details = new Property(this, "skill_details", false);
|
|
648
|
+
}
|
|
649
|
+
/** Run a slash command, as the extension. The answer comes back here. */
|
|
650
|
+
run(command) {
|
|
651
|
+
return this.call("run", { command });
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
/** Agent definitions. */
|
|
655
|
+
export class HostAgents extends HostObject {
|
|
656
|
+
static PATH = "agents";
|
|
657
|
+
/** Every agent. */
|
|
658
|
+
details;
|
|
659
|
+
/** An agent was promoted or discarded. */
|
|
660
|
+
changed;
|
|
661
|
+
/**
|
|
662
|
+
* The object igni hands a page, bound to a host and to the window
|
|
663
|
+
* or session it was reached through.
|
|
664
|
+
*
|
|
665
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
666
|
+
* right one, and a second would be a second conversation.
|
|
667
|
+
*/
|
|
668
|
+
constructor(link, window = null, session = null) {
|
|
669
|
+
super(link, "agents", window, session);
|
|
670
|
+
this.details = new Property(this, "details", false);
|
|
671
|
+
this.changed = new Signal("agents.changed");
|
|
672
|
+
}
|
|
673
|
+
/** Keep an agent made for one task, as `/agents promote` does. */
|
|
674
|
+
promote_ephemeral(name, target) {
|
|
675
|
+
return this.call("promote_ephemeral", { name, target });
|
|
676
|
+
}
|
|
677
|
+
/** Drop an agent made for one task. */
|
|
678
|
+
discard_ephemeral(name) {
|
|
679
|
+
return this.call("discard_ephemeral", { name });
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
/** Workflows: scripted runs. */
|
|
683
|
+
export class HostWorkflows extends HostObject {
|
|
684
|
+
static PATH = "workflows";
|
|
685
|
+
/** Every workflow. */
|
|
686
|
+
list;
|
|
687
|
+
/** A workflow run moved on. */
|
|
688
|
+
changed;
|
|
689
|
+
/**
|
|
690
|
+
* The object igni hands a page, bound to a host and to the window
|
|
691
|
+
* or session it was reached through.
|
|
692
|
+
*
|
|
693
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
694
|
+
* right one, and a second would be a second conversation.
|
|
695
|
+
*/
|
|
696
|
+
constructor(link, window = null, session = null) {
|
|
697
|
+
super(link, "workflows", window, session);
|
|
698
|
+
this.list = new Property(this, "list", false);
|
|
699
|
+
this.changed = new Signal("workflows.changed");
|
|
700
|
+
}
|
|
701
|
+
/** Start a workflow. */
|
|
702
|
+
run(name, input) {
|
|
703
|
+
return this.call("run", { name, input });
|
|
704
|
+
}
|
|
705
|
+
/** Stop a workflow run. */
|
|
706
|
+
cancel(workflow_run_id) {
|
|
707
|
+
return this.call("cancel", { workflow_run_id });
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
/** Scheduled tasks. */
|
|
711
|
+
export class HostScheduler extends HostObject {
|
|
712
|
+
static PATH = "scheduler";
|
|
713
|
+
/** Every scheduled task. */
|
|
714
|
+
tasks;
|
|
715
|
+
/** A task started, finished or changed. */
|
|
716
|
+
event;
|
|
717
|
+
/**
|
|
718
|
+
* The object igni hands a page, bound to a host and to the window
|
|
719
|
+
* or session it was reached through.
|
|
720
|
+
*
|
|
721
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
722
|
+
* right one, and a second would be a second conversation.
|
|
723
|
+
*/
|
|
724
|
+
constructor(link, window = null, session = null) {
|
|
725
|
+
super(link, "scheduler", window, session);
|
|
726
|
+
this.tasks = new Property(this, "tasks", false);
|
|
727
|
+
this.event = new Signal("scheduler.event");
|
|
728
|
+
}
|
|
729
|
+
/** Start the scheduler. */
|
|
730
|
+
start() {
|
|
731
|
+
return this.call("start", {});
|
|
732
|
+
}
|
|
733
|
+
/** Run a scheduled task now. */
|
|
734
|
+
run_now(task_id) {
|
|
735
|
+
return this.call("run_now", { task_id });
|
|
736
|
+
}
|
|
737
|
+
/** Cancel a scheduled task. */
|
|
738
|
+
cancel(task_id) {
|
|
739
|
+
return this.call("cancel", { task_id });
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
/** Background shells. */
|
|
743
|
+
export class HostProcesses extends HostObject {
|
|
744
|
+
static PATH = "processes";
|
|
745
|
+
/** Every background shell. */
|
|
746
|
+
list;
|
|
747
|
+
/** A shell started, printed or exited. */
|
|
748
|
+
changed;
|
|
749
|
+
/**
|
|
750
|
+
* The object igni hands a page, bound to a host and to the window
|
|
751
|
+
* or session it was reached through.
|
|
752
|
+
*
|
|
753
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
754
|
+
* right one, and a second would be a second conversation.
|
|
755
|
+
*/
|
|
756
|
+
constructor(link, window = null, session = null) {
|
|
757
|
+
super(link, "processes", window, session);
|
|
758
|
+
this.list = new Property(this, "list", false);
|
|
759
|
+
this.changed = new Signal("processes.changed");
|
|
760
|
+
}
|
|
761
|
+
/** A shell's last lines. */
|
|
762
|
+
tail(pid, lines) {
|
|
763
|
+
return this.call("tail", { pid, lines });
|
|
764
|
+
}
|
|
765
|
+
/** Stop a shell. */
|
|
766
|
+
stop(pid) {
|
|
767
|
+
return this.call("stop", { pid });
|
|
768
|
+
}
|
|
769
|
+
/** Run a command in the project and wait for it. */
|
|
770
|
+
run(command) {
|
|
771
|
+
return this.call("run", { command });
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
/** The project, as far as the extension's workspace grant reaches. */
|
|
775
|
+
export class HostWorkspace extends HostObject {
|
|
776
|
+
static PATH = "workspace";
|
|
777
|
+
/** The project directory. */
|
|
778
|
+
root;
|
|
779
|
+
/** Git HEAD; `None` outside a repository. */
|
|
780
|
+
head;
|
|
781
|
+
/** HEAD moved. */
|
|
782
|
+
head_changed;
|
|
783
|
+
/** Files changed, as git sees them, within the grant. */
|
|
784
|
+
files_changed;
|
|
785
|
+
/**
|
|
786
|
+
* The object igni hands a page, bound to a host and to the window
|
|
787
|
+
* or session it was reached through.
|
|
788
|
+
*
|
|
789
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
790
|
+
* right one, and a second would be a second conversation.
|
|
791
|
+
*/
|
|
792
|
+
constructor(link, window = null, session = null) {
|
|
793
|
+
super(link, "workspace", window, session);
|
|
794
|
+
this.root = new Property(this, "root", false);
|
|
795
|
+
this.head = new Property(this, "head", false);
|
|
796
|
+
this.head_changed = new Signal("workspace.head-changed");
|
|
797
|
+
this.files_changed = new Signal("workspace.files-changed");
|
|
798
|
+
}
|
|
799
|
+
/** Read a file in the project. */
|
|
800
|
+
read(path) {
|
|
801
|
+
return this.call("read", { path });
|
|
802
|
+
}
|
|
803
|
+
/** List a directory in the project. */
|
|
804
|
+
list(dir) {
|
|
805
|
+
return this.call("list", { dir });
|
|
806
|
+
}
|
|
807
|
+
/** Complete a path, as `@` does. */
|
|
808
|
+
complete(prefix) {
|
|
809
|
+
return this.call("complete", { prefix });
|
|
810
|
+
}
|
|
811
|
+
/** Search the code. */
|
|
812
|
+
search(query) {
|
|
813
|
+
return this.call("search", { query });
|
|
814
|
+
}
|
|
815
|
+
/** Ask the person to pick a folder. */
|
|
816
|
+
pick_dir() {
|
|
817
|
+
return this.call("pick_dir", {});
|
|
818
|
+
}
|
|
819
|
+
/** 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. */
|
|
820
|
+
open(path) {
|
|
821
|
+
return this.call("open", { path });
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
/** Models. */
|
|
825
|
+
export class HostModels extends HostObject {
|
|
826
|
+
static PATH = "models";
|
|
827
|
+
/** Every model igni knows. */
|
|
828
|
+
registry;
|
|
829
|
+
/** The model in use. Writable: setting it switches. */
|
|
830
|
+
current;
|
|
831
|
+
/** The model in use changed. */
|
|
832
|
+
changed;
|
|
833
|
+
/**
|
|
834
|
+
* The object igni hands a page, bound to a host and to the window
|
|
835
|
+
* or session it was reached through.
|
|
836
|
+
*
|
|
837
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
838
|
+
* right one, and a second would be a second conversation.
|
|
839
|
+
*/
|
|
840
|
+
constructor(link, window = null, session = null) {
|
|
841
|
+
super(link, "models", window, session);
|
|
842
|
+
this.registry = new Property(this, "registry", false);
|
|
843
|
+
this.current = new Property(this, "current", true);
|
|
844
|
+
this.changed = new Signal("models.changed");
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
/** MCP servers. */
|
|
848
|
+
export class HostMcp extends HostObject {
|
|
849
|
+
static PATH = "mcp";
|
|
850
|
+
/** Every server. */
|
|
851
|
+
servers;
|
|
852
|
+
/** Each server's status. */
|
|
853
|
+
status;
|
|
854
|
+
/** Each server's tools and details. */
|
|
855
|
+
details;
|
|
856
|
+
/** A server connected, disconnected or changed tools. */
|
|
857
|
+
changed;
|
|
858
|
+
/**
|
|
859
|
+
* The object igni hands a page, bound to a host and to the window
|
|
860
|
+
* or session it was reached through.
|
|
861
|
+
*
|
|
862
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
863
|
+
* right one, and a second would be a second conversation.
|
|
864
|
+
*/
|
|
865
|
+
constructor(link, window = null, session = null) {
|
|
866
|
+
super(link, "mcp", window, session);
|
|
867
|
+
this.servers = new Property(this, "servers", false);
|
|
868
|
+
this.status = new Property(this, "status", false);
|
|
869
|
+
this.details = new Property(this, "details", false);
|
|
870
|
+
this.changed = new Signal("mcp.changed");
|
|
871
|
+
}
|
|
872
|
+
/** Connect a server. */
|
|
873
|
+
connect(name) {
|
|
874
|
+
return this.call("connect", { name });
|
|
875
|
+
}
|
|
876
|
+
/** Disconnect a server. */
|
|
877
|
+
disconnect(name) {
|
|
878
|
+
return this.call("disconnect", { name });
|
|
879
|
+
}
|
|
880
|
+
/** Start the servers that should be running. */
|
|
881
|
+
ensure() {
|
|
882
|
+
return this.call("ensure", {});
|
|
883
|
+
}
|
|
884
|
+
/** Offer or withhold one tool. */
|
|
885
|
+
set_tool_enabled(server, tool, on) {
|
|
886
|
+
return this.call("set_tool_enabled", { server, tool, on });
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
/** Plugins and marketplaces. */
|
|
890
|
+
export class HostPlugins extends HostObject {
|
|
891
|
+
static PATH = "plugins";
|
|
892
|
+
/** Every installed plugin. */
|
|
893
|
+
installed;
|
|
894
|
+
/** Every marketplace. */
|
|
895
|
+
marketplaces;
|
|
896
|
+
/** A plugin or marketplace changed. */
|
|
897
|
+
changed;
|
|
898
|
+
/**
|
|
899
|
+
* The object igni hands a page, bound to a host and to the window
|
|
900
|
+
* or session it was reached through.
|
|
901
|
+
*
|
|
902
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
903
|
+
* right one, and a second would be a second conversation.
|
|
904
|
+
*/
|
|
905
|
+
constructor(link, window = null, session = null) {
|
|
906
|
+
super(link, "plugins", window, session);
|
|
907
|
+
this.installed = new Property(this, "installed", false);
|
|
908
|
+
this.marketplaces = new Property(this, "marketplaces", false);
|
|
909
|
+
this.changed = new Signal("plugins.changed");
|
|
910
|
+
}
|
|
911
|
+
/** What a plugin carries. */
|
|
912
|
+
contents(name) {
|
|
913
|
+
return this.call("contents", { name });
|
|
914
|
+
}
|
|
915
|
+
/** What a plugin would install. */
|
|
916
|
+
preview(source, branch, subdir) {
|
|
917
|
+
return this.call("preview", { source, branch, subdir });
|
|
918
|
+
}
|
|
919
|
+
/** Install a plugin. */
|
|
920
|
+
install(ref, install_ref) {
|
|
921
|
+
return this.call("install", { ref, install_ref });
|
|
922
|
+
}
|
|
923
|
+
/** Update a plugin. */
|
|
924
|
+
update(name, install_ref) {
|
|
925
|
+
return this.call("update", { name, install_ref });
|
|
926
|
+
}
|
|
927
|
+
/** Remove a plugin. */
|
|
928
|
+
remove(name) {
|
|
929
|
+
return this.call("remove", { name });
|
|
930
|
+
}
|
|
931
|
+
/** Enable or disable a plugin. */
|
|
932
|
+
set_enabled(name, on) {
|
|
933
|
+
return this.call("set_enabled", { name, on });
|
|
934
|
+
}
|
|
935
|
+
/** Add a marketplace. */
|
|
936
|
+
add_marketplace(url) {
|
|
937
|
+
return this.call("add_marketplace", { url });
|
|
938
|
+
}
|
|
939
|
+
/** Remove a marketplace. */
|
|
940
|
+
remove_marketplace(name) {
|
|
941
|
+
return this.call("remove_marketplace", { name });
|
|
942
|
+
}
|
|
943
|
+
/** Refresh marketplaces. */
|
|
944
|
+
refresh_marketplaces(name) {
|
|
945
|
+
return this.call("refresh_marketplaces", { name });
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
/** Installed extensions. Read-only, apart from this extension's own settings. */
|
|
949
|
+
export class HostExtensions extends HostObject {
|
|
950
|
+
static PATH = "extensions";
|
|
951
|
+
/** Every installed extension. */
|
|
952
|
+
installed;
|
|
953
|
+
/** An extension's health moved. */
|
|
954
|
+
state_changed;
|
|
955
|
+
/**
|
|
956
|
+
* The object igni hands a page, bound to a host and to the window
|
|
957
|
+
* or session it was reached through.
|
|
958
|
+
*
|
|
959
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
960
|
+
* right one, and a second would be a second conversation.
|
|
961
|
+
*/
|
|
962
|
+
constructor(link, window = null, session = null) {
|
|
963
|
+
super(link, "extensions", window, session);
|
|
964
|
+
this.installed = new Property(this, "installed", false);
|
|
965
|
+
this.state_changed = new Signal("extension.state-changed");
|
|
966
|
+
}
|
|
967
|
+
/** Change this extension's own settings. */
|
|
968
|
+
set_settings(values) {
|
|
969
|
+
return this.call("set_settings", { values });
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
/** Hooks. */
|
|
973
|
+
export class HostHooks extends HostObject {
|
|
974
|
+
static PATH = "hooks";
|
|
975
|
+
/** Every hook. */
|
|
976
|
+
details;
|
|
977
|
+
/** Hooks were reloaded. */
|
|
978
|
+
changed;
|
|
979
|
+
/**
|
|
980
|
+
* The object igni hands a page, bound to a host and to the window
|
|
981
|
+
* or session it was reached through.
|
|
982
|
+
*
|
|
983
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
984
|
+
* right one, and a second would be a second conversation.
|
|
985
|
+
*/
|
|
986
|
+
constructor(link, window = null, session = null) {
|
|
987
|
+
super(link, "hooks", window, session);
|
|
988
|
+
this.details = new Property(this, "details", false);
|
|
989
|
+
this.changed = new Signal("hooks.changed");
|
|
990
|
+
}
|
|
991
|
+
/** Reload hooks. */
|
|
992
|
+
reload() {
|
|
993
|
+
return this.call("reload", {});
|
|
994
|
+
}
|
|
995
|
+
/** Run the session-start hooks. */
|
|
996
|
+
fire_session_start() {
|
|
997
|
+
return this.call("fire_session_start", {});
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
/** What the agent may do without asking. */
|
|
1001
|
+
export class HostPermissions extends HostObject {
|
|
1002
|
+
static PATH = "permissions";
|
|
1003
|
+
/** `default`, `plan`, `acceptEdits` or `bypassPermissions`. */
|
|
1004
|
+
mode;
|
|
1005
|
+
/** The mode changed. */
|
|
1006
|
+
mode_changed;
|
|
1007
|
+
/**
|
|
1008
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1009
|
+
* or session it was reached through.
|
|
1010
|
+
*
|
|
1011
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1012
|
+
* right one, and a second would be a second conversation.
|
|
1013
|
+
*/
|
|
1014
|
+
constructor(link, window = null, session = null) {
|
|
1015
|
+
super(link, "permissions", window, session);
|
|
1016
|
+
this.mode = new Property(this, "mode", false);
|
|
1017
|
+
this.mode_changed = new Signal("permissions.mode_changed");
|
|
1018
|
+
}
|
|
1019
|
+
/** Would this tool call be allowed, asked or denied? One of `allow`, `ask` or `deny`. */
|
|
1020
|
+
check(tool_name, func_name, tool_args) {
|
|
1021
|
+
return this.call("check", { tool_name, func_name, tool_args });
|
|
1022
|
+
}
|
|
1023
|
+
/** Save a permission rule. */
|
|
1024
|
+
save_rule(rule, level) {
|
|
1025
|
+
return this.call("save_rule", { rule, level });
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
/** The group policy in force. */
|
|
1029
|
+
export class HostPolicy extends HostObject {
|
|
1030
|
+
static PATH = "policy";
|
|
1031
|
+
/** The group's policy pack. */
|
|
1032
|
+
pack;
|
|
1033
|
+
/**
|
|
1034
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1035
|
+
* or session it was reached through.
|
|
1036
|
+
*
|
|
1037
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1038
|
+
* right one, and a second would be a second conversation.
|
|
1039
|
+
*/
|
|
1040
|
+
constructor(link, window = null, session = null) {
|
|
1041
|
+
super(link, "policy", window, session);
|
|
1042
|
+
this.pack = new Property(this, "pack", false);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
/** Whether the person is signed in to igni. Never their session or a credential. */
|
|
1046
|
+
export class HostAccount extends HostObject {
|
|
1047
|
+
static PATH = "account";
|
|
1048
|
+
/** Who is signed in. */
|
|
1049
|
+
status;
|
|
1050
|
+
/** Someone signed in or out. */
|
|
1051
|
+
changed;
|
|
1052
|
+
/**
|
|
1053
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1054
|
+
* or session it was reached through.
|
|
1055
|
+
*
|
|
1056
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1057
|
+
* right one, and a second would be a second conversation.
|
|
1058
|
+
*/
|
|
1059
|
+
constructor(link, window = null, session = null) {
|
|
1060
|
+
super(link, "account", window, session);
|
|
1061
|
+
this.status = new Property(this, "status", false);
|
|
1062
|
+
this.changed = new Signal("account.changed");
|
|
1063
|
+
}
|
|
1064
|
+
/** Start the person's own sign-in. Its result is theirs. */
|
|
1065
|
+
sign_in() {
|
|
1066
|
+
return this.call("sign_in", {});
|
|
1067
|
+
}
|
|
1068
|
+
/** Sign the person out. */
|
|
1069
|
+
sign_out() {
|
|
1070
|
+
return this.call("sign_out", {});
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
/** The floor's notifications. Its own always; everyone's with `notifications`. */
|
|
1074
|
+
export class HostNotifications extends HostObject {
|
|
1075
|
+
static PATH = "notifications";
|
|
1076
|
+
/** Newest first. */
|
|
1077
|
+
list;
|
|
1078
|
+
/** Unread counts. */
|
|
1079
|
+
unread;
|
|
1080
|
+
/** The counts moved. */
|
|
1081
|
+
changed;
|
|
1082
|
+
/**
|
|
1083
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1084
|
+
* or session it was reached through.
|
|
1085
|
+
*
|
|
1086
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1087
|
+
* right one, and a second would be a second conversation.
|
|
1088
|
+
*/
|
|
1089
|
+
constructor(link, window = null, session = null) {
|
|
1090
|
+
super(link, "notifications", window, session);
|
|
1091
|
+
this.list = new Property(this, "list", false);
|
|
1092
|
+
this.unread = new Property(this, "unread", false);
|
|
1093
|
+
this.changed = new Signal("notifications.changed");
|
|
1094
|
+
}
|
|
1095
|
+
/** Tell the person at this machine something. It never leaves the machine. */
|
|
1096
|
+
notify(notification) {
|
|
1097
|
+
return this.call("notify", { notification });
|
|
1098
|
+
}
|
|
1099
|
+
/** Mark notifications read: these ids, one source, or all of them. */
|
|
1100
|
+
mark_read(ids, source) {
|
|
1101
|
+
return this.call("mark_read", { ids, source });
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
/** This extension, as the host sees it. */
|
|
1105
|
+
export class HostSelf extends HostObject {
|
|
1106
|
+
static PATH = "self";
|
|
1107
|
+
/** Its manifest id. */
|
|
1108
|
+
id;
|
|
1109
|
+
/** Its settings. Writable. */
|
|
1110
|
+
settings;
|
|
1111
|
+
/** Its own entry. */
|
|
1112
|
+
state;
|
|
1113
|
+
/** Its home on the web: its service's URL, when it has one. */
|
|
1114
|
+
web_url;
|
|
1115
|
+
/** Its settings changed. */
|
|
1116
|
+
settings_changed;
|
|
1117
|
+
/** Its health moved. */
|
|
1118
|
+
state_changed;
|
|
1119
|
+
/**
|
|
1120
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1121
|
+
* or session it was reached through.
|
|
1122
|
+
*
|
|
1123
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1124
|
+
* right one, and a second would be a second conversation.
|
|
1125
|
+
*/
|
|
1126
|
+
constructor(link, window = null, session = null) {
|
|
1127
|
+
super(link, "self", window, session);
|
|
1128
|
+
this.id = new Property(this, "id", false);
|
|
1129
|
+
this.settings = new Property(this, "settings", true);
|
|
1130
|
+
this.state = new Property(this, "state", false);
|
|
1131
|
+
this.web_url = new Property(this, "web_url", false);
|
|
1132
|
+
this.settings_changed = new Signal("self.settings_changed");
|
|
1133
|
+
this.state_changed = new Signal("self.state_changed");
|
|
1134
|
+
}
|
|
1135
|
+
/** 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`. */
|
|
1136
|
+
busy(reason, ttl_seconds) {
|
|
1137
|
+
return this.call("busy", { reason, ttl_seconds });
|
|
1138
|
+
}
|
|
1139
|
+
/** Let go of the lease `busy` took for `reason`. Nothing happens if there is none. */
|
|
1140
|
+
done(reason) {
|
|
1141
|
+
return this.call("done", { reason });
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
/** 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. */
|
|
1145
|
+
export class Host extends HostObject {
|
|
1146
|
+
static PATH = "";
|
|
1147
|
+
/** `host.app`. igni itself: how it presents things, which version, whether it is connected. */
|
|
1148
|
+
app;
|
|
1149
|
+
/** `host.windows`. Every open igni window. Address one window's UI with `host.windows.ui(id)`. */
|
|
1150
|
+
windows;
|
|
1151
|
+
/** `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. */
|
|
1152
|
+
ui;
|
|
1153
|
+
/** `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)`. */
|
|
1154
|
+
sessions;
|
|
1155
|
+
/** `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. */
|
|
1156
|
+
chat;
|
|
1157
|
+
/** `host.plan`. Plan mode: the plan the agent proposed. */
|
|
1158
|
+
plan;
|
|
1159
|
+
/** `host.tasks`. The agent's todo list and its sub-agent tasks. */
|
|
1160
|
+
tasks;
|
|
1161
|
+
/** `host.loop`. `/loop`: a prompt repeated until done. */
|
|
1162
|
+
loop;
|
|
1163
|
+
/** `host.commands`. Slash commands and skills. */
|
|
1164
|
+
commands;
|
|
1165
|
+
/** `host.agents`. Agent definitions. */
|
|
1166
|
+
agents;
|
|
1167
|
+
/** `host.workflows`. Workflows: scripted runs. */
|
|
1168
|
+
workflows;
|
|
1169
|
+
/** `host.scheduler`. Scheduled tasks. */
|
|
1170
|
+
scheduler;
|
|
1171
|
+
/** `host.processes`. Background shells. */
|
|
1172
|
+
processes;
|
|
1173
|
+
/** `host.workspace`. The project, as far as the extension's workspace grant reaches. */
|
|
1174
|
+
workspace;
|
|
1175
|
+
/** `host.models`. Models. */
|
|
1176
|
+
models;
|
|
1177
|
+
/** `host.mcp`. MCP servers. */
|
|
1178
|
+
mcp;
|
|
1179
|
+
/** `host.plugins`. Plugins and marketplaces. */
|
|
1180
|
+
plugins;
|
|
1181
|
+
/** `host.extensions`. Installed extensions. Read-only, apart from this extension's own settings. */
|
|
1182
|
+
extensions;
|
|
1183
|
+
/** `host.hooks`. Hooks. */
|
|
1184
|
+
hooks;
|
|
1185
|
+
/** `host.permissions`. What the agent may do without asking. */
|
|
1186
|
+
permissions;
|
|
1187
|
+
/** `host.policy`. The group policy in force. */
|
|
1188
|
+
policy;
|
|
1189
|
+
/** `host.account`. Whether the person is signed in to igni. Never their session or a credential. */
|
|
1190
|
+
account;
|
|
1191
|
+
/** `host.notifications`. The floor's notifications. Its own always; everyone's with `notifications`. */
|
|
1192
|
+
notifications;
|
|
1193
|
+
/** `host.self`. This extension, as the host sees it. */
|
|
1194
|
+
self;
|
|
1195
|
+
/** Anything changed. Carries the member's path and its new value. */
|
|
1196
|
+
changed;
|
|
1197
|
+
/**
|
|
1198
|
+
* The object igni hands a page, bound to a host and to the window
|
|
1199
|
+
* or session it was reached through.
|
|
1200
|
+
*
|
|
1201
|
+
* A page never builds one of these: `bridge.host` is already the
|
|
1202
|
+
* right one, and a second would be a second conversation.
|
|
1203
|
+
*/
|
|
1204
|
+
constructor(link, window = null, session = null) {
|
|
1205
|
+
super(link, "", window, session);
|
|
1206
|
+
this.app = new HostApp(link, window, session);
|
|
1207
|
+
this.windows = new HostWindows(link, window, session);
|
|
1208
|
+
this.ui = new HostUi(link, window, session);
|
|
1209
|
+
this.sessions = new HostSessions(link, window, session);
|
|
1210
|
+
this.chat = new HostChat(link, window, session);
|
|
1211
|
+
this.plan = new HostPlan(link, window, session);
|
|
1212
|
+
this.tasks = new HostTasks(link, window, session);
|
|
1213
|
+
this.loop = new HostLoop(link, window, session);
|
|
1214
|
+
this.commands = new HostCommands(link, window, session);
|
|
1215
|
+
this.agents = new HostAgents(link, window, session);
|
|
1216
|
+
this.workflows = new HostWorkflows(link, window, session);
|
|
1217
|
+
this.scheduler = new HostScheduler(link, window, session);
|
|
1218
|
+
this.processes = new HostProcesses(link, window, session);
|
|
1219
|
+
this.workspace = new HostWorkspace(link, window, session);
|
|
1220
|
+
this.models = new HostModels(link, window, session);
|
|
1221
|
+
this.mcp = new HostMcp(link, window, session);
|
|
1222
|
+
this.plugins = new HostPlugins(link, window, session);
|
|
1223
|
+
this.extensions = new HostExtensions(link, window, session);
|
|
1224
|
+
this.hooks = new HostHooks(link, window, session);
|
|
1225
|
+
this.permissions = new HostPermissions(link, window, session);
|
|
1226
|
+
this.policy = new HostPolicy(link, window, session);
|
|
1227
|
+
this.account = new HostAccount(link, window, session);
|
|
1228
|
+
this.notifications = new HostNotifications(link, window, session);
|
|
1229
|
+
this.self = new HostSelf(link, window, session);
|
|
1230
|
+
this.changed = new Signal("changed");
|
|
1231
|
+
}
|
|
1232
|
+
/** 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. */
|
|
1233
|
+
decide(context, questions) {
|
|
1234
|
+
return this.call("decide", { context, questions });
|
|
1235
|
+
}
|
|
1236
|
+
/** `decide` for up to 16 contexts at once, sharing forward passes. One decision per context, in order. */
|
|
1237
|
+
decide_batch(contexts, questions) {
|
|
1238
|
+
return this.call("decide_batch", { contexts, questions });
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
//# sourceMappingURL=hostModel.generated.js.map
|