@alisio/sdk 0.1.0-alpha.2 → 0.1.0-alpha.20
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/README.md +84 -42
- package/dist/index.d.ts +1370 -3
- package/dist/index.js +56 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,10 +10,278 @@ export interface ToolCall {
|
|
|
10
10
|
name: string;
|
|
11
11
|
arguments: string;
|
|
12
12
|
}
|
|
13
|
+
/** A node of a `{ kind: "tree" }` UI block. */
|
|
14
|
+
export interface TreeNode {
|
|
15
|
+
label: string;
|
|
16
|
+
children?: TreeNode[];
|
|
17
|
+
/** Optional annotation rendered after the label, e.g. a count or a status word. */
|
|
18
|
+
meta?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Alisio-owned structured rendering of a tool result, produced by core adapters (for example
|
|
22
|
+
* the MCP connector) when a tool returns structured data. It never carries MCP protocol types:
|
|
23
|
+
* plugins wanting a structured block build one of these shapes directly. The runner always
|
|
24
|
+
* keeps a plain-text projection alongside a `ui` part, so providers, compaction and headless
|
|
25
|
+
* output only ever see text; the block is a display hint for TUI rendering.
|
|
26
|
+
*/
|
|
27
|
+
export type UiBlock = {
|
|
28
|
+
kind: "table";
|
|
29
|
+
columns: string[];
|
|
30
|
+
rows: Array<Array<string>>;
|
|
31
|
+
caption?: string;
|
|
32
|
+
} | {
|
|
33
|
+
kind: "key-value";
|
|
34
|
+
entries: Array<[string, string]>;
|
|
35
|
+
caption?: string;
|
|
36
|
+
} | {
|
|
37
|
+
kind: "tree";
|
|
38
|
+
nodes: Array<TreeNode>;
|
|
39
|
+
} | {
|
|
40
|
+
kind: "code";
|
|
41
|
+
lang?: string;
|
|
42
|
+
code: string;
|
|
43
|
+
caption?: string;
|
|
44
|
+
} | {
|
|
45
|
+
kind: "markdown";
|
|
46
|
+
text: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A file change: a unified `patch`, or `before`/`after` contents when no patch is available.
|
|
50
|
+
* Producers bound the payload (about 200 KB).
|
|
51
|
+
*/
|
|
52
|
+
| {
|
|
53
|
+
kind: "diff";
|
|
54
|
+
path?: string;
|
|
55
|
+
patch?: string;
|
|
56
|
+
before?: string;
|
|
57
|
+
after?: string;
|
|
58
|
+
lang?: string;
|
|
59
|
+
caption?: string;
|
|
60
|
+
}
|
|
61
|
+
/** Output of a command. `output` may contain ANSI escapes; producers bound it (about 256 KB). */
|
|
62
|
+
| {
|
|
63
|
+
kind: "terminal";
|
|
64
|
+
command?: string;
|
|
65
|
+
cwd?: string;
|
|
66
|
+
output: string;
|
|
67
|
+
exitCode?: number;
|
|
68
|
+
durationMs?: number;
|
|
69
|
+
truncated?: boolean;
|
|
70
|
+
}
|
|
71
|
+
/** Mermaid diagram source; text surfaces show the source verbatim. */
|
|
72
|
+
| {
|
|
73
|
+
kind: "mermaid";
|
|
74
|
+
source: string;
|
|
75
|
+
title?: string;
|
|
76
|
+
}
|
|
77
|
+
/** A LaTeX formula; `display` requests block (not inline) layout. */
|
|
78
|
+
| {
|
|
79
|
+
kind: "math";
|
|
80
|
+
latex: string;
|
|
81
|
+
display?: boolean;
|
|
82
|
+
}
|
|
83
|
+
/** Any JSON value, shown as a collapsible tree by rich surfaces (bounded to about 256 KB). */
|
|
84
|
+
| {
|
|
85
|
+
kind: "json";
|
|
86
|
+
value: unknown;
|
|
87
|
+
collapsedDepth?: number;
|
|
88
|
+
caption?: string;
|
|
89
|
+
}
|
|
90
|
+
/** Test run results grouped by suite. */
|
|
91
|
+
| {
|
|
92
|
+
kind: "test-results";
|
|
93
|
+
framework?: string;
|
|
94
|
+
durationMs?: number;
|
|
95
|
+
suites: Array<{
|
|
96
|
+
name: string;
|
|
97
|
+
file?: string;
|
|
98
|
+
cases: TestCaseResult[];
|
|
99
|
+
}>;
|
|
100
|
+
}
|
|
101
|
+
/** A checklist of steps with their current status. */
|
|
102
|
+
| {
|
|
103
|
+
kind: "progress";
|
|
104
|
+
title?: string;
|
|
105
|
+
steps: ProgressStep[];
|
|
106
|
+
}
|
|
107
|
+
/** A published, downloadable artifact (`ToolContext.artifacts`). Text surfaces show one line. */
|
|
108
|
+
| {
|
|
109
|
+
kind: "artifact";
|
|
110
|
+
artifact: ArtifactRef;
|
|
111
|
+
};
|
|
112
|
+
/** Kind of a published artifact; decides the icon, the label and the renderer. */
|
|
113
|
+
export type ArtifactKind = "dashboard" | "document" | "spreadsheet" | "image" | "data" | "code" | "archive" | "file";
|
|
114
|
+
/** Public reference to a published artifact. Never carries absolute paths. */
|
|
115
|
+
export interface ArtifactRef {
|
|
116
|
+
/** `art_<ULID>`. */
|
|
117
|
+
id: string;
|
|
118
|
+
/** Root session that owns the artifact. */
|
|
119
|
+
sessionId: string;
|
|
120
|
+
title: string;
|
|
121
|
+
/** Download name, e.g. `report.md`, or `site.zip` for a multi-file artifact. */
|
|
122
|
+
fileName: string;
|
|
123
|
+
kind: ArtifactKind;
|
|
124
|
+
mimeType: string;
|
|
125
|
+
bytes: number;
|
|
126
|
+
/** More than 1 for multi-file dashboards. */
|
|
127
|
+
fileCount: number;
|
|
128
|
+
/** Decided by the host from the artifact kind and size. */
|
|
129
|
+
previewable: boolean;
|
|
130
|
+
createdAt: number;
|
|
131
|
+
/** Published from a failed execution (`publishOnError`). */
|
|
132
|
+
partial?: boolean;
|
|
133
|
+
status: "ready" | "deleted" | "expired";
|
|
134
|
+
}
|
|
135
|
+
/** Input of `ArtifactPublisher.publish`: files already written by the caller. */
|
|
136
|
+
export interface ArtifactPublishInput {
|
|
137
|
+
/** Absolute path of a file or a directory owned by the caller. */
|
|
138
|
+
source: string;
|
|
139
|
+
title?: string;
|
|
140
|
+
/** Entry file for a directory; defaults to `index.html` when present. */
|
|
141
|
+
entry?: string;
|
|
142
|
+
}
|
|
143
|
+
/** Publishes caller-owned files as downloadable artifacts of the current session. */
|
|
144
|
+
export interface ArtifactPublisher {
|
|
145
|
+
/** Validates, copies and registers; throws with a user-readable message on rejection. */
|
|
146
|
+
publish(input: ArtifactPublishInput): Promise<ArtifactRef>;
|
|
147
|
+
/** Creates a single-file artifact from text the tool already holds. */
|
|
148
|
+
publishText(input: {
|
|
149
|
+
fileName: string;
|
|
150
|
+
title?: string;
|
|
151
|
+
text: string;
|
|
152
|
+
}): Promise<ArtifactRef>;
|
|
153
|
+
}
|
|
154
|
+
/** Finer-grained permissions inside an effect (closed union; extended additively). */
|
|
155
|
+
export type AnalysisCapability = "analysis.run" | "analysis.install";
|
|
156
|
+
/**
|
|
157
|
+
* What an `analysis.install` approval shows (phase 4): the optional Python packages that would be
|
|
158
|
+
* installed, an estimate of the download and that it needs the network. Always asks, only `once`.
|
|
159
|
+
*/
|
|
160
|
+
export interface InstallPreview {
|
|
161
|
+
extras: "analysis" | "science";
|
|
162
|
+
/** Top-level packages, e.g. `pandas`, `numpy`. */
|
|
163
|
+
packages: string[];
|
|
164
|
+
/** Pinned distributions in the lockfile (the packages plus their dependencies). */
|
|
165
|
+
packageCount: number;
|
|
166
|
+
/** Rough download size (wheels only); an estimate, not a measurement. */
|
|
167
|
+
estimatedBytes: number;
|
|
168
|
+
network: true;
|
|
169
|
+
}
|
|
170
|
+
/** What a tool asks the host to approve before installing packages (capability `analysis.install`). */
|
|
171
|
+
export type InstallApprover = (request: InstallPreview) => Promise<"once" | "deny">;
|
|
172
|
+
/** A persisted capability decision as exposed by the web API. */
|
|
173
|
+
export interface CapabilityGrantWire {
|
|
174
|
+
id: string;
|
|
175
|
+
capability: AnalysisCapability;
|
|
176
|
+
sessionId: string;
|
|
177
|
+
scope: "once" | "session";
|
|
178
|
+
decision: "allow" | "deny";
|
|
179
|
+
source: "tui" | "web" | "flag" | "headless-grant";
|
|
180
|
+
createdAt: number;
|
|
181
|
+
revokedAt?: number;
|
|
182
|
+
}
|
|
183
|
+
/** Tabular formats the data tools ingest into one SQLite file per dataset. */
|
|
184
|
+
export type DatasetFormat = "csv" | "tsv" | "json" | "jsonl" | "xlsx";
|
|
185
|
+
/** A dataset (a CSV/TSV/JSON/JSONL/XLSX file ingested into SQLite). Never carries paths. */
|
|
186
|
+
export interface DatasetRef {
|
|
187
|
+
/** `ds_<ULID>`. */
|
|
188
|
+
id: string;
|
|
189
|
+
/** Original file name. */
|
|
190
|
+
name: string;
|
|
191
|
+
format: DatasetFormat;
|
|
192
|
+
bytes: number;
|
|
193
|
+
sha256: string;
|
|
194
|
+
sheets: Array<{
|
|
195
|
+
name: string;
|
|
196
|
+
table: string;
|
|
197
|
+
rows: number;
|
|
198
|
+
columns: number;
|
|
199
|
+
}>;
|
|
200
|
+
}
|
|
201
|
+
/** Column of a dataset table with the statistics computed at ingestion. */
|
|
202
|
+
export interface DatasetColumnWire {
|
|
203
|
+
name: string;
|
|
204
|
+
/** Original header text. */
|
|
205
|
+
label: string;
|
|
206
|
+
/** A hint (`integer`, `real`, `date`, `boolean`, `text`); values are stored without conversion. */
|
|
207
|
+
type: string;
|
|
208
|
+
nulls: number;
|
|
209
|
+
distinct: number;
|
|
210
|
+
distinctExact: boolean;
|
|
211
|
+
min?: string;
|
|
212
|
+
max?: string;
|
|
213
|
+
mean?: number;
|
|
214
|
+
textFallbacks: number;
|
|
215
|
+
top: Array<{
|
|
216
|
+
value: string;
|
|
217
|
+
count: number;
|
|
218
|
+
}>;
|
|
219
|
+
}
|
|
220
|
+
/** `GET /api/datasets/:did`: the dataset with the schema and statistics of every sheet. */
|
|
221
|
+
export interface DatasetDetailWire extends DatasetRef {
|
|
222
|
+
ingestVersion: number;
|
|
223
|
+
encoding?: string;
|
|
224
|
+
delimiter?: string;
|
|
225
|
+
sheetDetails: Array<{
|
|
226
|
+
name: string;
|
|
227
|
+
table: string;
|
|
228
|
+
rows: number;
|
|
229
|
+
columns: DatasetColumnWire[];
|
|
230
|
+
}>;
|
|
231
|
+
/** Sorting and filtering are disabled above this many rows (`analysis.data.maxInteractiveRows`). */
|
|
232
|
+
maxInteractiveRows: number;
|
|
233
|
+
}
|
|
234
|
+
/** `GET /api/datasets/:did/rows`: one page of a sheet (keyset-paginated). */
|
|
235
|
+
export interface DatasetRowsPage {
|
|
236
|
+
columns: Array<{
|
|
237
|
+
name: string;
|
|
238
|
+
label: string;
|
|
239
|
+
type: string;
|
|
240
|
+
}>;
|
|
241
|
+
/** Cell values as stored: numbers stay numbers, everything else is text, empty cells are null. */
|
|
242
|
+
rows: Array<Array<string | number | null>>;
|
|
243
|
+
/** 1-based position of the first row in the (unfiltered, unsorted) sheet, per row. */
|
|
244
|
+
rowids: number[];
|
|
245
|
+
/** Opaque cursor for the next page; absent on the last page. */
|
|
246
|
+
next?: string;
|
|
247
|
+
/** Rows in the sheet. */
|
|
248
|
+
total: number;
|
|
249
|
+
/** Rows matching the filter (first page only). */
|
|
250
|
+
matched?: number;
|
|
251
|
+
/** Sorting and filtering were ignored because the sheet exceeds `maxInteractiveRows`. */
|
|
252
|
+
interactive: boolean;
|
|
253
|
+
}
|
|
254
|
+
/** One case of a `{ kind: "test-results" }` UI block. */
|
|
255
|
+
export interface TestCaseResult {
|
|
256
|
+
name: string;
|
|
257
|
+
status: "passed" | "failed" | "skipped" | "todo";
|
|
258
|
+
durationMs?: number;
|
|
259
|
+
error?: string;
|
|
260
|
+
line?: number;
|
|
261
|
+
}
|
|
262
|
+
/** One step of a `{ kind: "progress" }` UI block. */
|
|
263
|
+
export interface ProgressStep {
|
|
264
|
+
label: string;
|
|
265
|
+
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
266
|
+
detail?: string;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Every `UiBlock` kind, for surfaces that dispatch on the kind at runtime (renderer registries,
|
|
270
|
+
* validators). Surfaces must still render an unknown kind as text: blocks persisted by a newer
|
|
271
|
+
* Alisio can be replayed by an older one.
|
|
272
|
+
*/
|
|
273
|
+
export declare const UI_BLOCK_KINDS: readonly ["table", "key-value", "tree", "code", "markdown", "diff", "terminal", "mermaid", "math", "json", "test-results", "progress", "artifact"];
|
|
13
274
|
export interface ToolResult {
|
|
14
275
|
content: Array<{
|
|
15
276
|
type: "text";
|
|
16
277
|
text: string;
|
|
278
|
+
} | {
|
|
279
|
+
type: "image";
|
|
280
|
+
mimeType: string;
|
|
281
|
+
data: string;
|
|
282
|
+
} | {
|
|
283
|
+
type: "ui";
|
|
284
|
+
block: UiBlock;
|
|
17
285
|
}>;
|
|
18
286
|
isError?: boolean;
|
|
19
287
|
}
|
|
@@ -25,7 +293,11 @@ export interface ToolResult {
|
|
|
25
293
|
export interface Attachment {
|
|
26
294
|
kind: "image";
|
|
27
295
|
mimeType: string;
|
|
28
|
-
/**
|
|
296
|
+
/**
|
|
297
|
+
* Base64-encoded bytes, no `data:` prefix. Required: providers and plugins read it directly,
|
|
298
|
+
* and no runtime check yet guarantees an alternative source. Content-addressed uploads travel
|
|
299
|
+
* as `BlobRef` and are resolved to `data` by the host before they reach an `Attachment`.
|
|
300
|
+
*/
|
|
29
301
|
data: string;
|
|
30
302
|
bytes: number;
|
|
31
303
|
width?: number;
|
|
@@ -42,11 +314,19 @@ export type Message =
|
|
|
42
314
|
summary?: boolean;
|
|
43
315
|
display?: string;
|
|
44
316
|
attachments?: Attachment[];
|
|
317
|
+
/** Datasets attached to this prompt (UI chips); the model sees their text summary in `text`. */
|
|
318
|
+
datasets?: DatasetRef[];
|
|
45
319
|
} | {
|
|
46
320
|
role: "assistant";
|
|
47
321
|
text: string;
|
|
48
322
|
calls: ToolCall[];
|
|
49
323
|
providerData?: unknown[];
|
|
324
|
+
/**
|
|
325
|
+
* The provider reported `finish_reason: "length"` (or an equivalent incomplete-stop signal):
|
|
326
|
+
* the response was cut by the output token budget. Per-answer text and tool calls are
|
|
327
|
+
* complete as far as they went; consumers decide whether to warn or accept a partial result.
|
|
328
|
+
*/
|
|
329
|
+
truncated?: boolean;
|
|
50
330
|
} | {
|
|
51
331
|
role: "tool";
|
|
52
332
|
callId: string;
|
|
@@ -131,6 +411,12 @@ export interface ModelProvider {
|
|
|
131
411
|
* that does not support one may ignore this or let the provider reject it.
|
|
132
412
|
*/
|
|
133
413
|
nativeTools?: Array<Record<string, unknown>>;
|
|
414
|
+
/**
|
|
415
|
+
* Provider-declared reasoning effort level (a value from `ModelInfo.effort.supportedLevels`).
|
|
416
|
+
* Providers that advertise effort levels map it to their request field (for example DeepSeek
|
|
417
|
+
* `reasoning_effort`); providers without a concept ignore it.
|
|
418
|
+
*/
|
|
419
|
+
reasoningEffort?: string;
|
|
134
420
|
}): AsyncIterable<ProviderEvent>;
|
|
135
421
|
/** Optional model catalog. Implementations must not expose credentials. */
|
|
136
422
|
listModels?(signal: AbortSignal): Promise<ModelInfo[]>;
|
|
@@ -181,6 +467,23 @@ export interface ToolContext {
|
|
|
181
467
|
session?: string;
|
|
182
468
|
/** Who is asking, e.g. an agent path such as "general › explore" (child sessions only). */
|
|
183
469
|
label?: string;
|
|
470
|
+
/**
|
|
471
|
+
* Resolves a tool path under the session's mediated path policy (workspace plus declared extra
|
|
472
|
+
* directories). Out-of-root paths ask for directory approval when the host allows it; hosts that
|
|
473
|
+
* do not inject this fall back to the workspace-only `safePath` policy.
|
|
474
|
+
*/
|
|
475
|
+
resolvePath?: (path: string) => Promise<string>;
|
|
476
|
+
/** Run and tool call that issued this execution, when run by the agent loop. */
|
|
477
|
+
runId?: string;
|
|
478
|
+
callId?: string;
|
|
479
|
+
/** Present when the host has an artifact store for this session (built-in tools only in v1). */
|
|
480
|
+
artifacts?: ArtifactPublisher;
|
|
481
|
+
/**
|
|
482
|
+
* Asks the user to approve installing the optional Python packages (capability
|
|
483
|
+
* `analysis.install`; built-in tools only). Resolves `deny` where nobody can be asked
|
|
484
|
+
* (headless, `--read-only`), because no flag grants an installation.
|
|
485
|
+
*/
|
|
486
|
+
approveInstall?: InstallApprover;
|
|
184
487
|
}
|
|
185
488
|
export interface ToolDefinition {
|
|
186
489
|
name: string;
|
|
@@ -191,17 +494,269 @@ export interface ToolDefinition {
|
|
|
191
494
|
/** May run concurrently with other read/concurrent calls of the same turn (e.g. delegation). */
|
|
192
495
|
concurrent?: boolean;
|
|
193
496
|
paths?: (input: Record<string, unknown>) => string[];
|
|
497
|
+
/**
|
|
498
|
+
* Finer-grained permission inside `effect`: a broad grant of `effect` covers it, a grant of the
|
|
499
|
+
* capability never widens `effect`. Honored for built-in tools only (ignored for plugins in v1).
|
|
500
|
+
*/
|
|
501
|
+
capability?: AnalysisCapability;
|
|
194
502
|
execute(input: Record<string, unknown>, context: ToolContext): Promise<ToolResult>;
|
|
195
503
|
}
|
|
504
|
+
/**
|
|
505
|
+
* One event of an agent run, as delivered to `onEvent`, plugins and `alisio run --json` (JSONL).
|
|
506
|
+
* `schemaVersion` stays `1` while changes are additive (new optional fields, new event types);
|
|
507
|
+
* consumers must ignore unknown fields and unknown `type` values. See `KnownRunEvent` for the
|
|
508
|
+
* typed payloads of the events the core emits today.
|
|
509
|
+
*/
|
|
196
510
|
export interface RunEvent {
|
|
197
511
|
schemaVersion: 1;
|
|
198
512
|
runId: string;
|
|
199
513
|
sessionId: string;
|
|
514
|
+
/** Per-run counter starting at 1 (restarts on every run; not unique within a session). */
|
|
200
515
|
seq: number;
|
|
201
516
|
type: string;
|
|
202
517
|
timestamp: string;
|
|
203
518
|
data: unknown;
|
|
519
|
+
/**
|
|
520
|
+
* Stable id of a durable event: the persisted global `events.seq`, as a decimal string. Absent
|
|
521
|
+
* for ephemeral events (`EphemeralRunEventType`) and when the host store does not report it.
|
|
522
|
+
*/
|
|
523
|
+
eventId?: string;
|
|
524
|
+
/** Embedder-supplied correlation id (for example an HTTP `X-Request-Id`), when given. */
|
|
525
|
+
correlationId?: string;
|
|
526
|
+
}
|
|
527
|
+
/** What a `run_failed` event with `code: "timeout"` says about the limit that stopped the run. */
|
|
528
|
+
export interface RunTimeoutInfo {
|
|
529
|
+
/** `run`: the whole-run limit (`limits.timeoutMs`); `first_token`: a silent request (`limits.firstTokenTimeoutMs`). */
|
|
530
|
+
kind: "run" | "first_token";
|
|
531
|
+
/** The limit that was reached, in milliseconds. */
|
|
532
|
+
ms: number;
|
|
533
|
+
/** Model the run was using, when known. */
|
|
534
|
+
model?: string;
|
|
535
|
+
/** Short provider label (the host of an OpenAI-compatible endpoint), when known. */
|
|
536
|
+
provider?: string;
|
|
537
|
+
/** What the run was doing: waiting for the first token of a request, streaming, or running a tool. */
|
|
538
|
+
stage: "waiting_model" | "streaming" | "tool" | "other";
|
|
539
|
+
/** The tool that was running when `stage` is `tool`. */
|
|
540
|
+
tool?: string;
|
|
541
|
+
/** Nothing had been produced yet: the very first model request of the run got no answer. */
|
|
542
|
+
firstRequest?: boolean;
|
|
543
|
+
/**
|
|
544
|
+
* `first_token` only: how many times the same request was sent (the first try plus the silent
|
|
545
|
+
* retries of `limits.firstTokenRetries`); `1` when retrying is disabled.
|
|
546
|
+
*/
|
|
547
|
+
attempts?: number;
|
|
548
|
+
}
|
|
549
|
+
/** What a `run_failed` event with `code: "output_truncated"` says about the limit that cut it. */
|
|
550
|
+
export interface RunTruncationInfo {
|
|
551
|
+
/** How many responses were cut off (the first plus every recovery). */
|
|
552
|
+
attempts: number;
|
|
553
|
+
/** The output-token budget of the cut requests (the effective one, see `source`). */
|
|
554
|
+
maxOutputTokens: number;
|
|
555
|
+
/** Where that budget came from: the user, the model's catalog, or the default. */
|
|
556
|
+
source?: "user" | "model" | "default";
|
|
557
|
+
/** The model whose responses were cut. */
|
|
558
|
+
model?: string;
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Payload of each event type the core emits today, keyed by `RunEvent.type`. Additive: new
|
|
562
|
+
* types and new optional fields may appear; existing fields keep their meaning.
|
|
563
|
+
*/
|
|
564
|
+
export interface RunEventDataMap {
|
|
565
|
+
run_started: {
|
|
566
|
+
model: string;
|
|
567
|
+
};
|
|
568
|
+
text_delta: {
|
|
569
|
+
delta: string;
|
|
570
|
+
};
|
|
571
|
+
/** Provider-visible reasoning text; display only, never persisted. */
|
|
572
|
+
reasoning_delta: {
|
|
573
|
+
delta: string;
|
|
574
|
+
};
|
|
575
|
+
turn_completed: {
|
|
576
|
+
/** 1-based turn number within the run. */
|
|
577
|
+
turn: number;
|
|
578
|
+
/** Cumulative input + output tokens of the run so far. */
|
|
579
|
+
tokens: number;
|
|
580
|
+
calls: number;
|
|
581
|
+
model: string;
|
|
582
|
+
usage?: Usage;
|
|
583
|
+
/** Milliseconds from sending the provider request to its completed response. */
|
|
584
|
+
durationMs?: number;
|
|
585
|
+
/** Milliseconds to the first streamed text/reasoning delta; absent when nothing streamed. */
|
|
586
|
+
ttftMs?: number;
|
|
587
|
+
};
|
|
588
|
+
tool_started: {
|
|
589
|
+
id: string;
|
|
590
|
+
name: string;
|
|
591
|
+
arguments: string;
|
|
592
|
+
effect: Effect;
|
|
593
|
+
};
|
|
594
|
+
/** `data` is whatever the tool passed to `ToolContext.emit`. */
|
|
595
|
+
tool_progress: {
|
|
596
|
+
id: string;
|
|
597
|
+
data: unknown;
|
|
598
|
+
};
|
|
599
|
+
tool_completed: {
|
|
600
|
+
id: string;
|
|
601
|
+
name: string;
|
|
602
|
+
isError: boolean;
|
|
603
|
+
durationMs: number;
|
|
604
|
+
/** Text projection of the result, capped at 2,000 characters. */
|
|
605
|
+
preview: string;
|
|
606
|
+
};
|
|
607
|
+
approval_requested: {
|
|
608
|
+
id: string;
|
|
609
|
+
name: string;
|
|
610
|
+
effect: "write" | "process" | "external";
|
|
611
|
+
label?: string;
|
|
612
|
+
/** The approval is for this capability (not the whole effect). */
|
|
613
|
+
capability?: AnalysisCapability;
|
|
614
|
+
/** `analysis.install` approvals: the packages, the size estimate and the network need. */
|
|
615
|
+
install?: InstallPreview;
|
|
616
|
+
};
|
|
617
|
+
approval_resolved: {
|
|
618
|
+
id: string;
|
|
619
|
+
name: string;
|
|
620
|
+
effect: "write" | "process" | "external";
|
|
621
|
+
decision: "once" | "session" | "deny";
|
|
622
|
+
capability?: AnalysisCapability;
|
|
623
|
+
/** A `session` capability decision was stored and survives restarts. */
|
|
624
|
+
persisted?: boolean;
|
|
625
|
+
};
|
|
626
|
+
/**
|
|
627
|
+
* A tool published an artifact. `path` is the absolute local path of the file (or the entry of a
|
|
628
|
+
* multi-file artifact) for local consumers (TUI, JSONL); web clients ignore it.
|
|
629
|
+
*/
|
|
630
|
+
artifact_published: {
|
|
631
|
+
artifact: ArtifactRef;
|
|
632
|
+
path: string;
|
|
633
|
+
callId?: string;
|
|
634
|
+
executionId?: string;
|
|
635
|
+
};
|
|
636
|
+
run_completed: {
|
|
637
|
+
tokens: number;
|
|
638
|
+
text: string;
|
|
639
|
+
truncated?: boolean;
|
|
640
|
+
};
|
|
641
|
+
/**
|
|
642
|
+
* `maxOutputTokens` is the effective budget of the cut request; `source` says whether it was
|
|
643
|
+
* set by the user, taken from the model's catalog, or the default.
|
|
644
|
+
*/
|
|
645
|
+
response_truncated: {
|
|
646
|
+
turn: number;
|
|
647
|
+
maxOutputTokens: number;
|
|
648
|
+
source?: "user" | "model" | "default";
|
|
649
|
+
};
|
|
650
|
+
/**
|
|
651
|
+
* A model request stayed completely silent for `limits.firstTokenTimeoutMs` and the same
|
|
652
|
+
* request is sent again (no new turn, nothing appended to the session). `attempt` is the
|
|
653
|
+
* retry about to start (1-based), `of` the retries allowed (`limits.firstTokenRetries`) and
|
|
654
|
+
* `afterMs` how long the aborted request had been silent.
|
|
655
|
+
*/
|
|
656
|
+
request_retry: {
|
|
657
|
+
attempt: number;
|
|
658
|
+
of: number;
|
|
659
|
+
reason: "first_token_timeout";
|
|
660
|
+
afterMs: number;
|
|
661
|
+
};
|
|
662
|
+
/**
|
|
663
|
+
* A model response was cut off by the output-token limit before it was usable (no text and no
|
|
664
|
+
* tool call, or a tool call whose arguments are incomplete) and the same turn is requested
|
|
665
|
+
* again with a short continuation notice. The truncated tool calls were discarded, never
|
|
666
|
+
* executed or persisted, and the retry is not a turn. `attempt` is the recovery about to start
|
|
667
|
+
* (1-based), `of` the recoveries allowed (`limits.truncationRecoveries`), `reason` what was
|
|
668
|
+
* lost, and `effort` the lowered reasoning effort of that request, when one was applied.
|
|
669
|
+
*/
|
|
670
|
+
truncation_recovery: {
|
|
671
|
+
attempt: number;
|
|
672
|
+
of: number;
|
|
673
|
+
reason: "tool_call_cut" | "empty_response";
|
|
674
|
+
maxOutputTokens: number;
|
|
675
|
+
effort?: string;
|
|
676
|
+
};
|
|
677
|
+
run_turns_exceeded: {
|
|
678
|
+
turns: number;
|
|
679
|
+
maxTurns: number;
|
|
680
|
+
};
|
|
681
|
+
/**
|
|
682
|
+
* The run failed. `error` is always a human-readable message. `code: "timeout"` (with `timeout`)
|
|
683
|
+
* marks a run stopped by a time limit instead of a provider or tool error;
|
|
684
|
+
* `code: "output_truncated"` (with `truncation`) a run whose responses kept being cut off by
|
|
685
|
+
* the output-token limit after the allowed recoveries. These fields are additive and absent
|
|
686
|
+
* for every other failure.
|
|
687
|
+
*/
|
|
688
|
+
run_failed: {
|
|
689
|
+
error: string;
|
|
690
|
+
code?: "timeout" | "output_truncated";
|
|
691
|
+
timeout?: RunTimeoutInfo;
|
|
692
|
+
truncation?: RunTruncationInfo;
|
|
693
|
+
};
|
|
694
|
+
run_cancelled: {
|
|
695
|
+
error: string;
|
|
696
|
+
};
|
|
697
|
+
model_changed: {
|
|
698
|
+
model: string;
|
|
699
|
+
previous: string;
|
|
700
|
+
};
|
|
701
|
+
compaction_started: {
|
|
702
|
+
reason: "manual" | "auto";
|
|
703
|
+
before: number;
|
|
704
|
+
messages: number;
|
|
705
|
+
};
|
|
706
|
+
compaction_completed: {
|
|
707
|
+
reason: "manual" | "auto";
|
|
708
|
+
before: number;
|
|
709
|
+
after: number;
|
|
710
|
+
replaced: number;
|
|
711
|
+
structured: boolean;
|
|
712
|
+
summarizedTokens: number;
|
|
713
|
+
checkpointTokens: number;
|
|
714
|
+
/** Per-plugin `CompactionOutcome.report`, keyed by plugin id. */
|
|
715
|
+
plugins: Record<string, Record<string, unknown>>;
|
|
716
|
+
/** The summary hit its output budget and was accepted as partial. */
|
|
717
|
+
partial?: true;
|
|
718
|
+
};
|
|
719
|
+
compaction_skipped: {
|
|
720
|
+
reason: "manual" | "auto";
|
|
721
|
+
before: number;
|
|
722
|
+
detail: string;
|
|
723
|
+
};
|
|
724
|
+
compaction_failed: {
|
|
725
|
+
reason: "manual" | "auto";
|
|
726
|
+
error: string;
|
|
727
|
+
};
|
|
728
|
+
/** Tool results clipped in place to fit the context budget. */
|
|
729
|
+
context_reduced: {
|
|
730
|
+
messages: number;
|
|
731
|
+
};
|
|
732
|
+
session_context_injected: {
|
|
733
|
+
tokens: number;
|
|
734
|
+
sources: string[];
|
|
735
|
+
};
|
|
736
|
+
plugin_hook_failed: {
|
|
737
|
+
source: string;
|
|
738
|
+
hook: string;
|
|
739
|
+
error: string;
|
|
740
|
+
continued: true;
|
|
741
|
+
};
|
|
204
742
|
}
|
|
743
|
+
/** Every `RunEvent.type` the core emits today. `RunEvent.type` itself stays `string`. */
|
|
744
|
+
export type RunEventType = keyof RunEventDataMap;
|
|
745
|
+
/** Event types never persisted to the session store (and therefore without `eventId`). */
|
|
746
|
+
export type EphemeralRunEventType = "text_delta" | "reasoning_delta" | "tool_progress";
|
|
747
|
+
export declare const EPHEMERAL_RUN_EVENT_TYPES: readonly EphemeralRunEventType[];
|
|
748
|
+
/** True for streaming-only event types that are never persisted. */
|
|
749
|
+
export declare function isEphemeralRunEventType(type: string): type is EphemeralRunEventType;
|
|
750
|
+
/**
|
|
751
|
+
* Discriminated view of `RunEvent` with typed `data`, for consumers that narrow on `type`.
|
|
752
|
+
* Every member is assignable to `RunEvent`; events of unknown types remain plain `RunEvent`s.
|
|
753
|
+
*/
|
|
754
|
+
export type KnownRunEvent = {
|
|
755
|
+
[K in RunEventType]: RunEvent & {
|
|
756
|
+
type: K;
|
|
757
|
+
data: RunEventDataMap[K];
|
|
758
|
+
};
|
|
759
|
+
}[RunEventType];
|
|
205
760
|
/** Generic structured checkpoint produced by core context compaction. */
|
|
206
761
|
export interface CompactionCheckpoint {
|
|
207
762
|
goal: string;
|
|
@@ -270,6 +825,8 @@ export interface CompletionRequest {
|
|
|
270
825
|
model?: string;
|
|
271
826
|
/** Session whose provider binding should be used when model is omitted. */
|
|
272
827
|
sessionId?: string;
|
|
828
|
+
/** Reasoning effort level when the target model advertises `ModelInfo.effort`. */
|
|
829
|
+
reasoningEffort?: string;
|
|
273
830
|
signal?: AbortSignal;
|
|
274
831
|
}
|
|
275
832
|
export type SqlValue = string | number | bigint | null | Uint8Array;
|
|
@@ -314,14 +871,33 @@ export interface MascotProvider {
|
|
|
314
871
|
id: string;
|
|
315
872
|
render(ctx: MascotContext): string | string[];
|
|
316
873
|
}
|
|
317
|
-
|
|
874
|
+
/**
|
|
875
|
+
* Catalog grouping a plugin declares in its manifest; the host derives `"model-provider"` from
|
|
876
|
+
* provider registrations. The TUI groups `/plugins` by the first declared category. Accepted
|
|
877
|
+
* values:
|
|
878
|
+
* - `"model-provider"` — registers model providers.
|
|
879
|
+
* - `"methodology-harness"` — bundles a development-methodology workflow.
|
|
880
|
+
* - `"memory"` — persistent memory, recollection and session summaries.
|
|
881
|
+
* - `"subagents"` — delegation, child sessions and agent management.
|
|
882
|
+
* - `"search"` — web or vector search providers.
|
|
883
|
+
* - `"tools"` — general-purpose tool collections.
|
|
884
|
+
* - `"security"` — audit, sandbox or permission tooling.
|
|
885
|
+
* - `"analytics"` — usage/metrics instrumentation (session stats, cost tracking).
|
|
886
|
+
* - `"mcp"` — MCP-server management or bundling helpers.
|
|
887
|
+
* - `"storage"` — durable storage backends beyond the default SQLite state.
|
|
888
|
+
* - `"ui"` — TUI presentation providers (startup screens, mascots, panels).
|
|
889
|
+
*/
|
|
890
|
+
export type PluginCategory = "model-provider" | "methodology-harness" | "memory" | "subagents" | "search" | "tools" | "security" | "analytics" | "mcp" | "storage" | "ui";
|
|
318
891
|
export interface PluginMetadata {
|
|
319
892
|
id: string;
|
|
320
893
|
version: string;
|
|
321
894
|
builtin: boolean;
|
|
322
895
|
name?: string;
|
|
323
896
|
description?: string;
|
|
324
|
-
/**
|
|
897
|
+
/**
|
|
898
|
+
* Categories declared by the plugin or derived by the host from its registrations; any value of
|
|
899
|
+
* the `PluginCategory` union.
|
|
900
|
+
*/
|
|
325
901
|
categories?: PluginCategory[];
|
|
326
902
|
}
|
|
327
903
|
export interface StartupFact {
|
|
@@ -401,6 +977,8 @@ export interface ChildSessionSpec {
|
|
|
401
977
|
maxTurns?: number;
|
|
402
978
|
timeoutMs?: number;
|
|
403
979
|
maxTokens?: number;
|
|
980
|
+
/** Per-call output token budget for the child; beats the global agent-loop budget. */
|
|
981
|
+
maxOutputTokens?: number;
|
|
404
982
|
}
|
|
405
983
|
export interface ChildSessionInfo {
|
|
406
984
|
id: string;
|
|
@@ -434,6 +1012,8 @@ export interface ChildRunResult {
|
|
|
434
1012
|
output: number;
|
|
435
1013
|
};
|
|
436
1014
|
error?: string;
|
|
1015
|
+
/** True when the child hit its turn limit: `text` is a usable partial result, not an error. */
|
|
1016
|
+
turnsExceeded?: boolean;
|
|
437
1017
|
}
|
|
438
1018
|
/** Generic tree node contributed to an interactive panel (e.g. running agents). */
|
|
439
1019
|
export interface PanelNode {
|
|
@@ -623,6 +1203,7 @@ export interface Plugin {
|
|
|
623
1203
|
/** Provider-neutral catalog metadata. Hosts may derive additional categories from registrations. */
|
|
624
1204
|
name?: string;
|
|
625
1205
|
description?: string;
|
|
1206
|
+
/** Optional catalog categories; any value of the `PluginCategory` union. */
|
|
626
1207
|
categories?: PluginCategory[];
|
|
627
1208
|
/** Declarative sugar for `api.extensions.register(point, provider)` at priority 0. */
|
|
628
1209
|
extensions?: {
|
|
@@ -631,5 +1212,791 @@ export interface Plugin {
|
|
|
631
1212
|
setup(api: PluginAPI): void | Promise<void>;
|
|
632
1213
|
dispose?(): void | Promise<void>;
|
|
633
1214
|
}
|
|
1215
|
+
/** Derived status of a root session as shown by web clients (never persisted). */
|
|
1216
|
+
export type SessionUiStatus = "idle" | "queued" | "running" | "awaiting_input" | "locked" | "error";
|
|
1217
|
+
/** A content-addressed upload (for example an image attached from the web composer). */
|
|
1218
|
+
export interface BlobRef {
|
|
1219
|
+
/** Lowercase hex sha256 of the bytes. */
|
|
1220
|
+
hash: string;
|
|
1221
|
+
mimeType: string;
|
|
1222
|
+
bytes: number;
|
|
1223
|
+
width?: number;
|
|
1224
|
+
height?: number;
|
|
1225
|
+
}
|
|
1226
|
+
/** One entry of `GET /api/workspaces/:wid/tree` (paths are workspace-relative, `/`-separated). */
|
|
1227
|
+
export interface FileEntry {
|
|
1228
|
+
name: string;
|
|
1229
|
+
path: string;
|
|
1230
|
+
type: "file" | "dir" | "symlink" | "other";
|
|
1231
|
+
/** Bytes, for files. */
|
|
1232
|
+
size?: number;
|
|
1233
|
+
/** Last modification, ms epoch. */
|
|
1234
|
+
mtime?: number;
|
|
1235
|
+
}
|
|
1236
|
+
/** A page of a directory listing; `next` is an opaque cursor for the following page. */
|
|
1237
|
+
export interface FileTreePage {
|
|
1238
|
+
entries: FileEntry[];
|
|
1239
|
+
next?: string;
|
|
1240
|
+
}
|
|
1241
|
+
/** A file the session changed (write-effect tool calls), for the Changes dock. */
|
|
1242
|
+
export interface SessionChange {
|
|
1243
|
+
path: string;
|
|
1244
|
+
lastRunId?: string;
|
|
1245
|
+
effect: "write";
|
|
1246
|
+
/** `git status --porcelain` code when the workspace is a git repository (`M`, `A`, `D`, `??`…). */
|
|
1247
|
+
gitStatus?: string;
|
|
1248
|
+
}
|
|
1249
|
+
/** Session metadata carried by snapshot frames. */
|
|
1250
|
+
export interface SessionDetailWire {
|
|
1251
|
+
id: string;
|
|
1252
|
+
/** Opaque, stable workspace id (never a filesystem path in URLs). */
|
|
1253
|
+
workspaceId: string;
|
|
1254
|
+
/** Absolute workspace path, for display. */
|
|
1255
|
+
workspace: string;
|
|
1256
|
+
provider: string;
|
|
1257
|
+
model: string;
|
|
1258
|
+
status: SessionUiStatus;
|
|
1259
|
+
title?: string;
|
|
1260
|
+
parentId?: string;
|
|
1261
|
+
/** Persisted child-session status, shown verbatim for child sessions. */
|
|
1262
|
+
childStatus?: SessionStatus;
|
|
1263
|
+
createdAt?: number;
|
|
1264
|
+
updatedAt?: number;
|
|
1265
|
+
}
|
|
1266
|
+
/** In-flight state of a running run, rebuilt by the server for snapshots. */
|
|
1267
|
+
export interface InflightState {
|
|
1268
|
+
runId: string;
|
|
1269
|
+
status: "queued" | "running";
|
|
1270
|
+
/** Epoch milliseconds when the run started executing; lets a reloaded client show elapsed time. */
|
|
1271
|
+
startedAt?: number;
|
|
1272
|
+
/** Assistant text streamed since the last `turn_completed`. */
|
|
1273
|
+
text: string;
|
|
1274
|
+
/** Reasoning streamed since the last `turn_completed` (never persisted). */
|
|
1275
|
+
reasoning: string;
|
|
1276
|
+
tools: Array<{
|
|
1277
|
+
id: string;
|
|
1278
|
+
name: string;
|
|
1279
|
+
arguments: string;
|
|
1280
|
+
effect: Effect;
|
|
1281
|
+
startedAt: number;
|
|
1282
|
+
/** Latest progress output, bounded. */
|
|
1283
|
+
tail: string;
|
|
1284
|
+
}>;
|
|
1285
|
+
}
|
|
1286
|
+
/** An approval waiting for a decision from a web client. */
|
|
1287
|
+
export interface PendingApproval {
|
|
1288
|
+
/** `<sessionId>:<callId>` for tool effects; `<sessionId>:dir:<uuid>` for directories. */
|
|
1289
|
+
approvalId: string;
|
|
1290
|
+
sessionId: string;
|
|
1291
|
+
/** Root of `sessionId`, so child-session approvals show in the root session view. */
|
|
1292
|
+
rootSessionId: string;
|
|
1293
|
+
runId?: string;
|
|
1294
|
+
kind: "effect" | "directory";
|
|
1295
|
+
callId?: string;
|
|
1296
|
+
name?: string;
|
|
1297
|
+
effect?: "write" | "process" | "external";
|
|
1298
|
+
label?: string;
|
|
1299
|
+
directory?: string;
|
|
1300
|
+
/** Pretty-printed tool input, truncated to 4 KB. */
|
|
1301
|
+
input: string;
|
|
1302
|
+
expiresAt?: number;
|
|
1303
|
+
/** The approval is for this capability (for example running Python), not the whole effect. */
|
|
1304
|
+
capability?: AnalysisCapability;
|
|
1305
|
+
/** A short preview for capability approvals (the first 40 lines of the script). */
|
|
1306
|
+
preview?: string;
|
|
1307
|
+
/** Capability approvals: `managed` (not sandboxed) or `oci` (container). */
|
|
1308
|
+
runtime?: "managed" | "oci";
|
|
1309
|
+
/** `analysis.install` approvals: only `once` and `deny` are offered. */
|
|
1310
|
+
install?: InstallPreview;
|
|
1311
|
+
}
|
|
1312
|
+
/** A plugin UI request (`ui.select` / `ui.askQuestions`) waiting for a web client. */
|
|
1313
|
+
export interface PendingInteraction {
|
|
1314
|
+
interactionId: string;
|
|
1315
|
+
/** Present when the request names a session (`AskQuestionsRequest.session`). */
|
|
1316
|
+
sessionId?: string;
|
|
1317
|
+
workspaceId: string;
|
|
1318
|
+
request: {
|
|
1319
|
+
kind: "select";
|
|
1320
|
+
select: SelectRequest;
|
|
1321
|
+
} | {
|
|
1322
|
+
kind: "questions";
|
|
1323
|
+
questions: Question[];
|
|
1324
|
+
label?: string;
|
|
1325
|
+
};
|
|
1326
|
+
}
|
|
1327
|
+
/** One entry of the shared slash-command catalog. */
|
|
1328
|
+
export interface CommandDescriptor {
|
|
1329
|
+
name: string;
|
|
1330
|
+
description: string;
|
|
1331
|
+
aliases?: string[];
|
|
1332
|
+
argumentHint?: string;
|
|
1333
|
+
source: "builtin" | "plugin" | "prompt" | "skill" | "agent";
|
|
1334
|
+
/** Plugin id or resource owner, when not built in. */
|
|
1335
|
+
owner?: string;
|
|
1336
|
+
surfaces: Array<"tui" | "web" | "api">;
|
|
1337
|
+
/** `core` commands run through the catalog; `surface` commands are handled by each UI. */
|
|
1338
|
+
execution: "core" | "surface";
|
|
1339
|
+
}
|
|
1340
|
+
/** One JSON object per SSE `data:` line. Clients ignore unknown `t` values. */
|
|
1341
|
+
export type ServerFrame = {
|
|
1342
|
+
t: "hello";
|
|
1343
|
+
protocolVersion: 1;
|
|
1344
|
+
streamId: string;
|
|
1345
|
+
serverTime: number;
|
|
1346
|
+
} | {
|
|
1347
|
+
t: "snapshot";
|
|
1348
|
+
sessionId: string;
|
|
1349
|
+
/** `MAX(events.seq)` of the session when the snapshot was taken. */
|
|
1350
|
+
cursor: number;
|
|
1351
|
+
session: SessionDetailWire;
|
|
1352
|
+
messages: {
|
|
1353
|
+
items: Array<{
|
|
1354
|
+
seq: number;
|
|
1355
|
+
message: Message;
|
|
1356
|
+
compacted: boolean;
|
|
1357
|
+
}>;
|
|
1358
|
+
hasMore: boolean;
|
|
1359
|
+
};
|
|
1360
|
+
inflight?: InflightState;
|
|
1361
|
+
pending: {
|
|
1362
|
+
approvals: PendingApproval[];
|
|
1363
|
+
interactions: PendingInteraction[];
|
|
1364
|
+
};
|
|
1365
|
+
}
|
|
1366
|
+
/** Durable event; its SSE `id` is `event.eventId`. */
|
|
1367
|
+
| {
|
|
1368
|
+
t: "event";
|
|
1369
|
+
sessionId: string;
|
|
1370
|
+
event: RunEvent;
|
|
1371
|
+
}
|
|
1372
|
+
/** Coalesced ephemeral output; carries no SSE `id`. */
|
|
1373
|
+
| {
|
|
1374
|
+
t: "delta";
|
|
1375
|
+
sessionId: string;
|
|
1376
|
+
runId: string;
|
|
1377
|
+
text?: string;
|
|
1378
|
+
reasoning?: string;
|
|
1379
|
+
progress?: Array<{
|
|
1380
|
+
toolId: string;
|
|
1381
|
+
chunk: string;
|
|
1382
|
+
}>;
|
|
1383
|
+
} | {
|
|
1384
|
+
t: "tool_result";
|
|
1385
|
+
sessionId: string;
|
|
1386
|
+
runId: string;
|
|
1387
|
+
callId: string;
|
|
1388
|
+
result: ToolResult;
|
|
1389
|
+
truncated?: boolean;
|
|
1390
|
+
} | {
|
|
1391
|
+
t: "message";
|
|
1392
|
+
sessionId: string;
|
|
1393
|
+
seq: number;
|
|
1394
|
+
message: Message;
|
|
1395
|
+
} | {
|
|
1396
|
+
t: "approval";
|
|
1397
|
+
approval: PendingApproval;
|
|
1398
|
+
} | {
|
|
1399
|
+
t: "approval_withdrawn";
|
|
1400
|
+
approvalId: string;
|
|
1401
|
+
reason: "cancelled" | "timeout" | "resolved_elsewhere";
|
|
1402
|
+
} | {
|
|
1403
|
+
t: "interaction";
|
|
1404
|
+
interaction: PendingInteraction;
|
|
1405
|
+
} | {
|
|
1406
|
+
t: "interaction_withdrawn";
|
|
1407
|
+
interactionId: string;
|
|
1408
|
+
} | {
|
|
1409
|
+
t: "session_status";
|
|
1410
|
+
sessionId: string;
|
|
1411
|
+
workspaceId: string;
|
|
1412
|
+
status: SessionUiStatus;
|
|
1413
|
+
title?: string;
|
|
1414
|
+
updatedAt?: number;
|
|
1415
|
+
} | {
|
|
1416
|
+
t: "catalog_changed";
|
|
1417
|
+
workspaceId: string;
|
|
1418
|
+
scope: "commands" | "plugins" | "skills" | "mcp" | "models" | "agents";
|
|
1419
|
+
} | {
|
|
1420
|
+
t: "resync";
|
|
1421
|
+
sessionId?: string;
|
|
1422
|
+
reason: "overflow" | "gap" | "server_restart";
|
|
1423
|
+
}
|
|
1424
|
+
/** A persisted capability grant of this root session was added or revoked. */
|
|
1425
|
+
| {
|
|
1426
|
+
t: "capabilities_changed";
|
|
1427
|
+
sessionId: string;
|
|
1428
|
+
}
|
|
1429
|
+
/** A dataset uploaded from the web finished ingesting (root session). */
|
|
1430
|
+
| {
|
|
1431
|
+
t: "dataset_ready";
|
|
1432
|
+
sessionId: string;
|
|
1433
|
+
dataset: DatasetRef;
|
|
1434
|
+
}
|
|
1435
|
+
/** A dataset upload could not be ingested. */
|
|
1436
|
+
| {
|
|
1437
|
+
t: "dataset_failed";
|
|
1438
|
+
sessionId: string;
|
|
1439
|
+
name: string;
|
|
1440
|
+
error: string;
|
|
1441
|
+
};
|
|
1442
|
+
export type ApiErrorCode = "unauthorized" | "forbidden_origin" | "forbidden_host" | "validation_failed" | "not_found" | "unknown_command" | "session_busy" | "session_locked" | "workspace_limit"
|
|
1443
|
+
/** A known workspace whose folder was deleted, moved or is no longer accessible (404). */
|
|
1444
|
+
| "workspace_missing" | "payload_too_large" | "unsupported_media_type" | "path_outside_workspace" | "not_a_git_repo" | "approval_resolved" | "capability_ceiling" | "not_manageable" | "mcp_not_permitted" | "runs_active" | "provider_unavailable" | "protocol_mismatch" | "shutting_down"
|
|
1445
|
+
/** Too many concurrent event streams (SSE) for this server. */
|
|
1446
|
+
| "stream_limit"
|
|
1447
|
+
/** The workspace is archived: unarchive it before starting new sessions (409). */
|
|
1448
|
+
| "workspace_archived"
|
|
1449
|
+
/** A native folder dialog is already open on the server machine (409). */
|
|
1450
|
+
| "picker_busy"
|
|
1451
|
+
/** No native folder dialog / folder browser on this server (remote bind, no desktop) (503). */
|
|
1452
|
+
| "picker_unavailable"
|
|
1453
|
+
/** The server user may not read that directory (403). */
|
|
1454
|
+
| "permission_denied"
|
|
1455
|
+
/** The request was cancelled before it finished, e.g. a `/btw` side question (409). */
|
|
1456
|
+
| "cancelled"
|
|
1457
|
+
/** The artifact does not exist or belongs to another session (404). */
|
|
1458
|
+
| "artifact_not_found"
|
|
1459
|
+
/** The artifact exceeds a size limit for this operation (413). */
|
|
1460
|
+
| "artifact_too_large"
|
|
1461
|
+
/** No usable Python runtime (503). */
|
|
1462
|
+
| "runtime_unavailable"
|
|
1463
|
+
/** The file is not a supported dataset, or needs a runtime that is missing (415/503 body code). */
|
|
1464
|
+
| "dataset_unsupported"
|
|
1465
|
+
/** A data query was rejected by the read-only guard (400). */
|
|
1466
|
+
| "query_rejected"
|
|
1467
|
+
/** A data query exceeded `analysis.data.queryTimeoutMs` (408). */
|
|
1468
|
+
| "query_timeout" | "internal";
|
|
1469
|
+
/** `GET /api/health` (the only unauthenticated API route). */
|
|
1470
|
+
export interface HealthInfo {
|
|
1471
|
+
name: "alisio";
|
|
1472
|
+
version: string;
|
|
1473
|
+
protocolVersion: 1;
|
|
1474
|
+
capabilities: {
|
|
1475
|
+
sse: boolean;
|
|
1476
|
+
websocket: boolean;
|
|
1477
|
+
multiWorkspace: boolean;
|
|
1478
|
+
attachments: boolean;
|
|
1479
|
+
uiBlocks: string[];
|
|
1480
|
+
mcpApps: boolean;
|
|
1481
|
+
automation: boolean;
|
|
1482
|
+
/** The server listens on a non-loopback address (`--allow-remote`). */
|
|
1483
|
+
remote: boolean;
|
|
1484
|
+
/**
|
|
1485
|
+
* `POST /api/workspaces/pick` can open a native folder dialog on this machine (loopback only,
|
|
1486
|
+
* with a desktop session and a dialog tool). Absent on older servers.
|
|
1487
|
+
*/
|
|
1488
|
+
nativePicker?: boolean;
|
|
1489
|
+
/** `GET /api/fs/dirs` lists directory names for the in-app folder browser (loopback only). */
|
|
1490
|
+
folderBrowser?: boolean;
|
|
1491
|
+
};
|
|
1492
|
+
}
|
|
1493
|
+
/** `POST /api/workspaces/pick`: the folder chosen in the native dialog, or a cancellation. */
|
|
1494
|
+
export type FolderPickResult = {
|
|
1495
|
+
path: string;
|
|
1496
|
+
} | {
|
|
1497
|
+
cancelled: true;
|
|
1498
|
+
};
|
|
1499
|
+
/** One page of the in-app folder browser (`GET /api/fs/dirs`): subdirectory names only. */
|
|
1500
|
+
export interface DirectoryListing {
|
|
1501
|
+
/** Absolute path listed (the server's own separators; `""` for the drive list on Windows). */
|
|
1502
|
+
path: string;
|
|
1503
|
+
/** Parent directory, absent at a filesystem root (and at the drive list). */
|
|
1504
|
+
parent?: string;
|
|
1505
|
+
/** Breadcrumbs from the root to `path`, built by the server (no separator assumptions). */
|
|
1506
|
+
segments: Array<{
|
|
1507
|
+
name: string;
|
|
1508
|
+
path: string;
|
|
1509
|
+
}>;
|
|
1510
|
+
/** Subdirectories (names and absolute paths; never files, never contents). */
|
|
1511
|
+
entries: Array<{
|
|
1512
|
+
name: string;
|
|
1513
|
+
path: string;
|
|
1514
|
+
hidden: boolean;
|
|
1515
|
+
}>;
|
|
1516
|
+
/** The server user's home directory (where browsing starts). */
|
|
1517
|
+
home: string;
|
|
1518
|
+
/** Path separator of the server platform. */
|
|
1519
|
+
separator: "/" | "\\";
|
|
1520
|
+
/** More than the listing cap: the rest is not shown. */
|
|
1521
|
+
truncated?: boolean;
|
|
1522
|
+
}
|
|
1523
|
+
/** A workspace known to the server (`GET /api/workspaces`). */
|
|
1524
|
+
export interface WorkspaceInfo {
|
|
1525
|
+
/** Opaque, stable id: a short sha256 of the canonical path. */
|
|
1526
|
+
id: string;
|
|
1527
|
+
/** Canonical absolute path (display only; URLs use `id`). */
|
|
1528
|
+
path: string;
|
|
1529
|
+
label?: string;
|
|
1530
|
+
pinned: boolean;
|
|
1531
|
+
/** An `Application` is open for it in the server right now. */
|
|
1532
|
+
open: boolean;
|
|
1533
|
+
/**
|
|
1534
|
+
* The folder is still an accessible directory. A workspace known from old sessions may have been
|
|
1535
|
+
* deleted or moved: its sessions stay readable, but it cannot be opened (`workspace_missing`).
|
|
1536
|
+
*/
|
|
1537
|
+
exists: boolean;
|
|
1538
|
+
/** Project resources load (trusted from the terminal or by a launch flag). */
|
|
1539
|
+
trusted: boolean;
|
|
1540
|
+
/** The directory has project resources that are not trusted (shown as "untrusted"). */
|
|
1541
|
+
untrustedResources: boolean;
|
|
1542
|
+
/** Archived: hidden from the default list; its sessions stay readable, new ones are refused. */
|
|
1543
|
+
archived: boolean;
|
|
1544
|
+
lastOpenedAt?: number;
|
|
1545
|
+
}
|
|
1546
|
+
/** Permission presets of the web composer (RF-08). */
|
|
1547
|
+
export type PermissionPresetId = "read-only" | "ask" | "workspace-write" | "full-access";
|
|
1548
|
+
export interface PermissionPresetInfo {
|
|
1549
|
+
id: PermissionPresetId;
|
|
1550
|
+
/** Selectable under the server's launch flags (its capability ceiling). */
|
|
1551
|
+
available: boolean;
|
|
1552
|
+
/** Why it is unavailable, or which effects still ask because of the ceiling. */
|
|
1553
|
+
reason?: string;
|
|
1554
|
+
/** Effects allowed without asking once the ceiling is applied. */
|
|
1555
|
+
policy: {
|
|
1556
|
+
write: boolean;
|
|
1557
|
+
process: boolean;
|
|
1558
|
+
external: boolean;
|
|
1559
|
+
};
|
|
1560
|
+
/** Whether non-allowed effects ask for approval (false: they are denied). */
|
|
1561
|
+
approvals: boolean;
|
|
1562
|
+
}
|
|
1563
|
+
/** A row of the session list (`GET /api/sessions`). */
|
|
1564
|
+
export interface SessionSummary extends SessionDetailWire {
|
|
1565
|
+
pinned: boolean;
|
|
1566
|
+
archived: boolean;
|
|
1567
|
+
}
|
|
1568
|
+
/** `GET /api/sessions/:sid` and the result of creating or patching a session. */
|
|
1569
|
+
export interface SessionDetail extends SessionSummary {
|
|
1570
|
+
preset: PermissionPresetId;
|
|
1571
|
+
effort?: string;
|
|
1572
|
+
agent?: string;
|
|
1573
|
+
presets: PermissionPresetInfo[];
|
|
1574
|
+
children: SessionDetailWire[];
|
|
1575
|
+
}
|
|
1576
|
+
/** Answer of `POST /api/sessions/:sid/prompts`. */
|
|
1577
|
+
export type PromptAccepted = {
|
|
1578
|
+
runId: string;
|
|
1579
|
+
status: "queued" | "running";
|
|
1580
|
+
duplicate?: false;
|
|
1581
|
+
} | {
|
|
1582
|
+
runId: string;
|
|
1583
|
+
status: string;
|
|
1584
|
+
duplicate: true;
|
|
1585
|
+
} | {
|
|
1586
|
+
status: "enqueued";
|
|
1587
|
+
duplicate?: boolean;
|
|
1588
|
+
};
|
|
1589
|
+
/**
|
|
1590
|
+
* Answer of `POST /api/sessions/:sid/commands`. A command either reports (`output`, Markdown),
|
|
1591
|
+
* points the client at another session (`/clear`, `/resume`) or expands into a prompt the client
|
|
1592
|
+
* sends through `POST .../prompts` (prompt templates, skills, `/ask`). A repeated `requestId`
|
|
1593
|
+
* answers `{duplicate: true}` without running the command again.
|
|
1594
|
+
*/
|
|
1595
|
+
export interface CommandOutcome {
|
|
1596
|
+
output?: string;
|
|
1597
|
+
/** `notice` is a short status line; `info` (default) a report. */
|
|
1598
|
+
tone?: "info" | "notice";
|
|
1599
|
+
sessionId?: string;
|
|
1600
|
+
prompt?: {
|
|
1601
|
+
text: string;
|
|
1602
|
+
display: string;
|
|
1603
|
+
};
|
|
1604
|
+
/** What changed, e.g. `"model"` or `"effort"`, so clients refresh the session. */
|
|
1605
|
+
effects?: string[];
|
|
1606
|
+
duplicate?: boolean;
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* One `/btw` side question: a tool-less question about a session answered outside its
|
|
1610
|
+
* conversation (never persisted as messages, events, runs or session usage). Answer of
|
|
1611
|
+
* `POST /api/sessions/:sid/btw`; `GET /api/sessions/:sid/btw` lists them, oldest first.
|
|
1612
|
+
*/
|
|
1613
|
+
export interface SideQuestionEntry {
|
|
1614
|
+
id: string;
|
|
1615
|
+
question: string;
|
|
1616
|
+
/** Markdown answer. */
|
|
1617
|
+
answer: string;
|
|
1618
|
+
/** Model that answered (the session's model at the time). */
|
|
1619
|
+
model: string;
|
|
1620
|
+
usage: {
|
|
1621
|
+
input: number;
|
|
1622
|
+
output: number;
|
|
1623
|
+
};
|
|
1624
|
+
/** Epoch milliseconds. */
|
|
1625
|
+
createdAt: number;
|
|
1626
|
+
/** The provider cut the answer at the output-token budget. */
|
|
1627
|
+
truncated?: boolean;
|
|
1628
|
+
}
|
|
1629
|
+
/** `GET /api/sessions/:sid/models`: models of the session's provider (credential-free). */
|
|
1630
|
+
export interface SessionModels {
|
|
1631
|
+
provider: string;
|
|
1632
|
+
model: string;
|
|
1633
|
+
/** Session reasoning effort, when set. */
|
|
1634
|
+
effort?: string;
|
|
1635
|
+
models: ModelInfo[];
|
|
1636
|
+
/** The provider could not list its models (the current model still works). */
|
|
1637
|
+
unavailable: boolean;
|
|
1638
|
+
}
|
|
1639
|
+
/** `GET /api/sessions/:sid/context`: estimated tokens of the next request and the budget. */
|
|
1640
|
+
export interface SessionContextUsage {
|
|
1641
|
+
estimated: number;
|
|
1642
|
+
/** Model context window, when known. */
|
|
1643
|
+
total?: number;
|
|
1644
|
+
basis: "window" | "unknown";
|
|
1645
|
+
/** Percentage of `total` at which auto-compaction triggers. */
|
|
1646
|
+
compactionAt: number;
|
|
1647
|
+
}
|
|
1648
|
+
/** `GET /api/plugins`: one plugin of a workspace (credential- and path-safe). */
|
|
1649
|
+
export interface PluginInfo {
|
|
1650
|
+
id: string;
|
|
1651
|
+
name: string;
|
|
1652
|
+
description: string;
|
|
1653
|
+
version?: string;
|
|
1654
|
+
categories: string[];
|
|
1655
|
+
builtin: boolean;
|
|
1656
|
+
source: string;
|
|
1657
|
+
status: "active" | "inactive" | "failed" | "restart-required";
|
|
1658
|
+
enabled: boolean;
|
|
1659
|
+
/** Whether the web may toggle it (else `diagnostic` says why). */
|
|
1660
|
+
manageable: boolean;
|
|
1661
|
+
diagnostic?: string;
|
|
1662
|
+
/** Tools it contributes, without the namespacing prefix. */
|
|
1663
|
+
tools: string[];
|
|
1664
|
+
/** Slash commands it contributes. */
|
|
1665
|
+
commands: string[];
|
|
1666
|
+
/** Prefix of its namespaced tool names (`p_<hash>`), to label tool calls. */
|
|
1667
|
+
toolPrefix: string;
|
|
1668
|
+
}
|
|
1669
|
+
/** `GET /api/skills`: one discovered skill (no file paths). */
|
|
1670
|
+
export interface SkillInfo {
|
|
1671
|
+
id: string;
|
|
1672
|
+
name: string;
|
|
1673
|
+
displayId: string;
|
|
1674
|
+
description: string;
|
|
1675
|
+
scope: "project" | "config" | "user" | "plugin";
|
|
1676
|
+
source: string;
|
|
1677
|
+
owner?: {
|
|
1678
|
+
id: string;
|
|
1679
|
+
name: string;
|
|
1680
|
+
};
|
|
1681
|
+
manageable: boolean;
|
|
1682
|
+
locked: boolean;
|
|
1683
|
+
enabled: boolean;
|
|
1684
|
+
effective: boolean;
|
|
1685
|
+
shadowedBy?: string;
|
|
1686
|
+
approximateTokens: number;
|
|
1687
|
+
}
|
|
1688
|
+
/** One MCP server of a workspace; commands, arguments and URLs are never sent. */
|
|
1689
|
+
export interface McpServerWire {
|
|
1690
|
+
name: string;
|
|
1691
|
+
displayName: string;
|
|
1692
|
+
/** Configuration layer that defines it (`global`, `project`, …). */
|
|
1693
|
+
source: string;
|
|
1694
|
+
status: string;
|
|
1695
|
+
enabled: boolean;
|
|
1696
|
+
transport: "stdio" | "http";
|
|
1697
|
+
capabilities: string[];
|
|
1698
|
+
counts: {
|
|
1699
|
+
tools: number;
|
|
1700
|
+
resources: number;
|
|
1701
|
+
prompts: number;
|
|
1702
|
+
};
|
|
1703
|
+
diagnostic?: string;
|
|
1704
|
+
}
|
|
1705
|
+
/**
|
|
1706
|
+
* `GET /api/analysis`: the state of the data-analysis runtime for Settings (read only). Never
|
|
1707
|
+
* carries a script or a repository path; interpreter paths are the user's own.
|
|
1708
|
+
*/
|
|
1709
|
+
export interface AnalysisStatus {
|
|
1710
|
+
/** `analysis.enabled` and not `--read-only`: python_run is registered. */
|
|
1711
|
+
enabled: boolean;
|
|
1712
|
+
readOnly: boolean;
|
|
1713
|
+
mode: "managed" | "oci";
|
|
1714
|
+
/** The discovered (or `--python`) interpreter and the extras environment. */
|
|
1715
|
+
python: {
|
|
1716
|
+
found: true;
|
|
1717
|
+
path: string;
|
|
1718
|
+
version: string;
|
|
1719
|
+
source: string;
|
|
1720
|
+
extras: string[];
|
|
1721
|
+
runtimeVersion?: string;
|
|
1722
|
+
} | {
|
|
1723
|
+
found: false;
|
|
1724
|
+
reason: string;
|
|
1725
|
+
/** Installation guidance for this system (commands are shown, never run). */
|
|
1726
|
+
hints: {
|
|
1727
|
+
system: string;
|
|
1728
|
+
heading?: string;
|
|
1729
|
+
primary: string;
|
|
1730
|
+
alternatives: string[];
|
|
1731
|
+
notes: string[];
|
|
1732
|
+
};
|
|
1733
|
+
};
|
|
1734
|
+
/** Container settings; `available` is probed only when the mode is `oci` or an image is set. */
|
|
1735
|
+
oci: {
|
|
1736
|
+
engine: "docker" | "podman";
|
|
1737
|
+
image?: string;
|
|
1738
|
+
memoryMb: number;
|
|
1739
|
+
cpus: number;
|
|
1740
|
+
available?: boolean;
|
|
1741
|
+
version?: string;
|
|
1742
|
+
reason?: string;
|
|
1743
|
+
};
|
|
1744
|
+
limits: {
|
|
1745
|
+
timeoutMs: number;
|
|
1746
|
+
};
|
|
1747
|
+
retention: {
|
|
1748
|
+
jobsDays: number;
|
|
1749
|
+
intermediateDays: number;
|
|
1750
|
+
artifactsDays: number;
|
|
1751
|
+
lastSweep?: number;
|
|
1752
|
+
};
|
|
1753
|
+
}
|
|
1754
|
+
/** `GET /api/mcp`: the workspace's MCP runtime permission and servers. */
|
|
1755
|
+
export interface McpOverview {
|
|
1756
|
+
permission: "granted" | "not-granted" | "read-only";
|
|
1757
|
+
/** Global consent (`mcp.allow`) is persisted for this user. */
|
|
1758
|
+
persisted: boolean;
|
|
1759
|
+
servers: McpServerWire[];
|
|
1760
|
+
}
|
|
1761
|
+
/** `GET /api/agents`: a selectable main-session agent. */
|
|
1762
|
+
export interface AgentInfo {
|
|
1763
|
+
id: string;
|
|
1764
|
+
name: string;
|
|
1765
|
+
description: string;
|
|
1766
|
+
instructions?: string;
|
|
1767
|
+
model?: string;
|
|
1768
|
+
readOnly?: boolean;
|
|
1769
|
+
source: "builtin" | "user" | "plugin";
|
|
1770
|
+
/** The workspace default (`agents.active`) used by sessions without their own agent. */
|
|
1771
|
+
default: boolean;
|
|
1772
|
+
}
|
|
1773
|
+
/** One user-facing setting (`SettableSettingKey`) and its effective value. */
|
|
1774
|
+
export interface SettingInfo {
|
|
1775
|
+
key: string;
|
|
1776
|
+
kind: "boolean" | "number" | "string" | "enum";
|
|
1777
|
+
options?: string[];
|
|
1778
|
+
value?: string | number | boolean;
|
|
1779
|
+
}
|
|
1780
|
+
/** `GET /api/settings`: effective settings and where configuration lives. */
|
|
1781
|
+
export interface SettingsOverview {
|
|
1782
|
+
/** Highest-priority configuration file of the workspace (it may not exist yet). */
|
|
1783
|
+
configPath: string;
|
|
1784
|
+
/** Global file that setting changes are written to. */
|
|
1785
|
+
settingsPath: string;
|
|
1786
|
+
/** Provider profiles (`providers.json`); credentials live apart, never shown. */
|
|
1787
|
+
providersPath: string;
|
|
1788
|
+
trusted: boolean;
|
|
1789
|
+
readOnly: boolean;
|
|
1790
|
+
settings: SettingInfo[];
|
|
1791
|
+
}
|
|
1792
|
+
/** A credential as the web sees it: never the value, at most a short masked tail. */
|
|
1793
|
+
export interface CredentialStatus {
|
|
1794
|
+
configured: boolean;
|
|
1795
|
+
source?: "file" | "env";
|
|
1796
|
+
/** Last characters behind an ellipsis (`…71B`), only for long stored secrets. */
|
|
1797
|
+
tail?: string;
|
|
1798
|
+
}
|
|
1799
|
+
/** One stored provider profile (non-secret values only). */
|
|
1800
|
+
export interface ProviderProfileInfo {
|
|
1801
|
+
name: string;
|
|
1802
|
+
provider: string;
|
|
1803
|
+
model: string;
|
|
1804
|
+
values: Record<string, ProviderConfigurationValue>;
|
|
1805
|
+
/** The globally active profile (`providers.json`). */
|
|
1806
|
+
active: boolean;
|
|
1807
|
+
credentials: Record<string, CredentialStatus>;
|
|
1808
|
+
}
|
|
1809
|
+
/** A provider type a profile can use, with its configuration fields. */
|
|
1810
|
+
export interface ProviderTypeInfo {
|
|
1811
|
+
id: string;
|
|
1812
|
+
name: string;
|
|
1813
|
+
description?: string;
|
|
1814
|
+
fields: ProviderConfigurationField[];
|
|
1815
|
+
}
|
|
1816
|
+
/** `GET /api/providers`. */
|
|
1817
|
+
export interface ProvidersOverview {
|
|
1818
|
+
active?: string;
|
|
1819
|
+
profiles: ProviderProfileInfo[];
|
|
1820
|
+
/** Provider types of the requested workspace (empty without `?workspace=`). */
|
|
1821
|
+
types: ProviderTypeInfo[];
|
|
1822
|
+
/** What the requested workspace's application currently runs. */
|
|
1823
|
+
current?: {
|
|
1824
|
+
provider: string;
|
|
1825
|
+
model: string;
|
|
1826
|
+
profile?: string;
|
|
1827
|
+
};
|
|
1828
|
+
}
|
|
1829
|
+
/** `GET /api/models`: models of every configured profile (credential-free). */
|
|
1830
|
+
export interface ProviderModelsInfo {
|
|
1831
|
+
profile: string;
|
|
1832
|
+
provider: string;
|
|
1833
|
+
title: string;
|
|
1834
|
+
configuredModel: string;
|
|
1835
|
+
models: ModelInfo[];
|
|
1836
|
+
unavailable: boolean;
|
|
1837
|
+
}
|
|
1838
|
+
/** Output format of an agent's answers (`text.format.type`). */
|
|
1839
|
+
export type AgentTextFormatType = "text" | "json_object" | "json_schema";
|
|
1840
|
+
/** Reasoning summary preference of an agent (`reasoning.summary`). */
|
|
1841
|
+
export type AgentReasoningSummary = "auto" | "none" | "concise" | "detailed";
|
|
1842
|
+
/** Answer verbosity preference of an agent (`text.verbosity`). */
|
|
1843
|
+
export type AgentVerbosity = "low" | "medium" | "high";
|
|
1844
|
+
/**
|
|
1845
|
+
* Where a user agent file lives: `project` is `<workspace>/.agents/agents/<id>.md`, `global` is
|
|
1846
|
+
* `~/.agents/agents/<id>.md`. A project agent overrides a global one with the same id.
|
|
1847
|
+
*/
|
|
1848
|
+
export type AgentScope = "project" | "global";
|
|
1849
|
+
/** Body of `POST /api/agents` and `PUT /api/agents/:id`: a user agent definition. */
|
|
1850
|
+
export interface AgentDefinitionInput {
|
|
1851
|
+
/** Display name; the stable id is derived from it once, on creation. */
|
|
1852
|
+
name: string;
|
|
1853
|
+
description?: string;
|
|
1854
|
+
/** System prompt appended to the session instructions when the agent is active. */
|
|
1855
|
+
instructions?: string;
|
|
1856
|
+
/** Model selector (`provider/model` or an unambiguous model id). */
|
|
1857
|
+
model: string;
|
|
1858
|
+
reasoning?: {
|
|
1859
|
+
effort?: string;
|
|
1860
|
+
summary?: AgentReasoningSummary;
|
|
1861
|
+
};
|
|
1862
|
+
text?: {
|
|
1863
|
+
format?: {
|
|
1864
|
+
type: AgentTextFormatType;
|
|
1865
|
+
};
|
|
1866
|
+
verbosity?: AgentVerbosity;
|
|
1867
|
+
};
|
|
1868
|
+
}
|
|
1869
|
+
/** A stored user agent definition (`GET /api/agents/definitions`). Times are epoch ms. */
|
|
1870
|
+
export interface AgentDefinitionInfo extends AgentDefinitionInput {
|
|
1871
|
+
/** File slug: the frontmatter `name` other harnesses use as the agent identifier. */
|
|
1872
|
+
id: string;
|
|
1873
|
+
scope: AgentScope;
|
|
1874
|
+
description: string;
|
|
1875
|
+
instructions: string;
|
|
1876
|
+
/** Absolute path of the Markdown file. */
|
|
1877
|
+
path: string;
|
|
1878
|
+
createdAt: number;
|
|
1879
|
+
updatedAt: number;
|
|
1880
|
+
/** A project agent that takes precedence over the global agent with the same id. */
|
|
1881
|
+
overridesGlobal?: boolean;
|
|
1882
|
+
/** A global agent hidden by the project agent with the same id. */
|
|
1883
|
+
overriddenByProject?: boolean;
|
|
1884
|
+
}
|
|
1885
|
+
/**
|
|
1886
|
+
* Answer of agent writes. `live`: the running Alisio already uses the change (its agent registry
|
|
1887
|
+
* reloaded and loaded the file); false means it is saved but needs a restart (or a trusted
|
|
1888
|
+
* workspace / the subagents plugin) before sessions can use it.
|
|
1889
|
+
*/
|
|
1890
|
+
export interface AgentSaveResult {
|
|
1891
|
+
agent: AgentDefinitionInfo;
|
|
1892
|
+
live: boolean;
|
|
1893
|
+
}
|
|
1894
|
+
/** `GET /api/agents/definitions`: both scopes merged, plus where new agents go by default. */
|
|
1895
|
+
export interface AgentDefinitionsOverview {
|
|
1896
|
+
agents: AgentDefinitionInfo[];
|
|
1897
|
+
scopes: AgentScope[];
|
|
1898
|
+
defaultScope: AgentScope;
|
|
1899
|
+
/** Directory of each available scope. */
|
|
1900
|
+
dirs: Partial<Record<AgentScope, string>>;
|
|
1901
|
+
/** Project agents load only in trusted workspaces. */
|
|
1902
|
+
trusted: boolean;
|
|
1903
|
+
}
|
|
1904
|
+
/** A predefined starting point for a new agent (`GET /api/agents/templates`). */
|
|
1905
|
+
export interface AgentTemplateInfo {
|
|
1906
|
+
id: string;
|
|
1907
|
+
name: string;
|
|
1908
|
+
description: string;
|
|
1909
|
+
instructions: string;
|
|
1910
|
+
reasoning?: {
|
|
1911
|
+
effort?: string;
|
|
1912
|
+
summary?: AgentReasoningSummary;
|
|
1913
|
+
};
|
|
1914
|
+
text?: {
|
|
1915
|
+
format?: {
|
|
1916
|
+
type: AgentTextFormatType;
|
|
1917
|
+
};
|
|
1918
|
+
verbosity?: AgentVerbosity;
|
|
1919
|
+
};
|
|
1920
|
+
}
|
|
1921
|
+
/** What a model supports for the agent editor, derived from its catalog metadata. */
|
|
1922
|
+
export interface AgentModelCapabilities {
|
|
1923
|
+
/** The catalog declared any capability metadata; otherwise every option is offered. */
|
|
1924
|
+
known: boolean;
|
|
1925
|
+
reasoning: boolean;
|
|
1926
|
+
/** Reasoning effort levels to offer (empty when reasoning is unsupported). */
|
|
1927
|
+
effortLevels: string[];
|
|
1928
|
+
defaultEffort?: string;
|
|
1929
|
+
summary: boolean;
|
|
1930
|
+
verbosity: boolean;
|
|
1931
|
+
textFormats: AgentTextFormatType[];
|
|
1932
|
+
/** Declared tool calling support; absent when unknown. */
|
|
1933
|
+
tools?: boolean;
|
|
1934
|
+
/** Declared image input support; absent when unknown. */
|
|
1935
|
+
vision?: boolean;
|
|
1936
|
+
}
|
|
1937
|
+
/** A configured model the agent editor can select (`GET /api/agents/models`). */
|
|
1938
|
+
export interface AgentModelOption {
|
|
1939
|
+
/** Canonical selector `<provider>/<model>`. */
|
|
1940
|
+
reference: string;
|
|
1941
|
+
provider: string;
|
|
1942
|
+
profile: string;
|
|
1943
|
+
providerName: string;
|
|
1944
|
+
id: string;
|
|
1945
|
+
name?: string;
|
|
1946
|
+
/** The workspace application runs this model right now. */
|
|
1947
|
+
active: boolean;
|
|
1948
|
+
capabilities: AgentModelCapabilities;
|
|
1949
|
+
/** Short capability labels such as "Reasoning", "Tools", "Vision". */
|
|
1950
|
+
labels: string[];
|
|
1951
|
+
}
|
|
1952
|
+
/** Answer of `POST /api/agents/draft`: a definition drafted by the active model. */
|
|
1953
|
+
export interface AgentDraft {
|
|
1954
|
+
name: string;
|
|
1955
|
+
description: string;
|
|
1956
|
+
instructions: string;
|
|
1957
|
+
reasoning?: {
|
|
1958
|
+
effort?: string;
|
|
1959
|
+
summary?: AgentReasoningSummary;
|
|
1960
|
+
};
|
|
1961
|
+
text?: {
|
|
1962
|
+
format?: {
|
|
1963
|
+
type: AgentTextFormatType;
|
|
1964
|
+
};
|
|
1965
|
+
verbosity?: AgentVerbosity;
|
|
1966
|
+
};
|
|
1967
|
+
/** The model that wrote the draft. */
|
|
1968
|
+
generatedBy: string;
|
|
1969
|
+
/** Authoring guidance used: `skill:<name>` (a discovered skill) or `bundled:create-agent`. */
|
|
1970
|
+
guidance: string;
|
|
1971
|
+
}
|
|
1972
|
+
/** Body of every non-2xx web API response. */
|
|
1973
|
+
export interface ApiError {
|
|
1974
|
+
error: {
|
|
1975
|
+
code: ApiErrorCode;
|
|
1976
|
+
message: string;
|
|
1977
|
+
details?: unknown;
|
|
1978
|
+
};
|
|
1979
|
+
correlationId: string;
|
|
1980
|
+
}
|
|
634
1981
|
export declare function definePlugin<T extends Plugin>(plugin: T): T;
|
|
1982
|
+
/** `OutputTruncatedError.code`: a provider's reply was cut off by the output-token limit. */
|
|
1983
|
+
export declare const OUTPUT_TRUNCATED_CODE = "output_truncated";
|
|
1984
|
+
/**
|
|
1985
|
+
* A provider that cannot yield a usable `completed` message because the output-token limit cut
|
|
1986
|
+
* the response before anything usable existed (no text and no complete tool call) throws this,
|
|
1987
|
+
* so the host can recover instead of failing the run. Hosts match on `code` (not `instanceof`),
|
|
1988
|
+
* because a plugin may bundle its own copy of this package. Prefer yielding `completed` with
|
|
1989
|
+
* `truncated: true` whenever the partial message is representable.
|
|
1990
|
+
*/
|
|
1991
|
+
export declare class OutputTruncatedError extends Error {
|
|
1992
|
+
readonly code = "output_truncated";
|
|
1993
|
+
constructor(message?: string);
|
|
1994
|
+
}
|
|
635
1995
|
export declare const textResult: (text: string, isError?: boolean) => ToolResult;
|
|
1996
|
+
/**
|
|
1997
|
+
* Text-only view of a tool result: the content filtered to its text parts, order preserved.
|
|
1998
|
+
* This is what the runner hands to providers, what compaction summarizes and what headless
|
|
1999
|
+
* output shows; `ui`/`image` parts stay only in the persisted transcript for TUI replay, so
|
|
2000
|
+
* raw bytes or structured blocks never reach the model prompt.
|
|
2001
|
+
*/
|
|
2002
|
+
export declare function textProjection(result: ToolResult): ToolResult;
|