@alisio/sdk 0.1.0-alpha.13 → 0.1.0-alpha.15

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/dist/index.d.ts CHANGED
@@ -44,7 +44,86 @@ export type UiBlock = {
44
44
  } | {
45
45
  kind: "markdown";
46
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[];
47
106
  };
107
+ /** One case of a `{ kind: "test-results" }` UI block. */
108
+ export interface TestCaseResult {
109
+ name: string;
110
+ status: "passed" | "failed" | "skipped" | "todo";
111
+ durationMs?: number;
112
+ error?: string;
113
+ line?: number;
114
+ }
115
+ /** One step of a `{ kind: "progress" }` UI block. */
116
+ export interface ProgressStep {
117
+ label: string;
118
+ status: "pending" | "running" | "completed" | "failed" | "cancelled";
119
+ detail?: string;
120
+ }
121
+ /**
122
+ * Every `UiBlock` kind, for surfaces that dispatch on the kind at runtime (renderer registries,
123
+ * validators). Surfaces must still render an unknown kind as text: blocks persisted by a newer
124
+ * Alisio can be replayed by an older one.
125
+ */
126
+ export declare const UI_BLOCK_KINDS: readonly ["table", "key-value", "tree", "code", "markdown", "diff", "terminal", "mermaid", "math", "json", "test-results", "progress"];
48
127
  export interface ToolResult {
49
128
  content: Array<{
50
129
  type: "text";
@@ -67,7 +146,11 @@ export interface ToolResult {
67
146
  export interface Attachment {
68
147
  kind: "image";
69
148
  mimeType: string;
70
- /** Base64-encoded bytes, no `data:` prefix. */
149
+ /**
150
+ * Base64-encoded bytes, no `data:` prefix. Required: providers and plugins read it directly,
151
+ * and no runtime check yet guarantees an alternative source. Content-addressed uploads travel
152
+ * as `BlobRef` and are resolved to `data` by the host before they reach an `Attachment`.
153
+ */
71
154
  data: string;
72
155
  bytes: number;
73
156
  width?: number;
@@ -253,15 +336,170 @@ export interface ToolDefinition {
253
336
  paths?: (input: Record<string, unknown>) => string[];
254
337
  execute(input: Record<string, unknown>, context: ToolContext): Promise<ToolResult>;
255
338
  }
339
+ /**
340
+ * One event of an agent run, as delivered to `onEvent`, plugins and `alisio run --json` (JSONL).
341
+ * `schemaVersion` stays `1` while changes are additive (new optional fields, new event types);
342
+ * consumers must ignore unknown fields and unknown `type` values. See `KnownRunEvent` for the
343
+ * typed payloads of the events the core emits today.
344
+ */
256
345
  export interface RunEvent {
257
346
  schemaVersion: 1;
258
347
  runId: string;
259
348
  sessionId: string;
349
+ /** Per-run counter starting at 1 (restarts on every run; not unique within a session). */
260
350
  seq: number;
261
351
  type: string;
262
352
  timestamp: string;
263
353
  data: unknown;
354
+ /**
355
+ * Stable id of a durable event: the persisted global `events.seq`, as a decimal string. Absent
356
+ * for ephemeral events (`EphemeralRunEventType`) and when the host store does not report it.
357
+ */
358
+ eventId?: string;
359
+ /** Embedder-supplied correlation id (for example an HTTP `X-Request-Id`), when given. */
360
+ correlationId?: string;
361
+ }
362
+ /**
363
+ * Payload of each event type the core emits today, keyed by `RunEvent.type`. Additive: new
364
+ * types and new optional fields may appear; existing fields keep their meaning.
365
+ */
366
+ export interface RunEventDataMap {
367
+ run_started: {
368
+ model: string;
369
+ };
370
+ text_delta: {
371
+ delta: string;
372
+ };
373
+ /** Provider-visible reasoning text; display only, never persisted. */
374
+ reasoning_delta: {
375
+ delta: string;
376
+ };
377
+ turn_completed: {
378
+ /** 1-based turn number within the run. */
379
+ turn: number;
380
+ /** Cumulative input + output tokens of the run so far. */
381
+ tokens: number;
382
+ calls: number;
383
+ model: string;
384
+ usage?: Usage;
385
+ /** Milliseconds from sending the provider request to its completed response. */
386
+ durationMs?: number;
387
+ /** Milliseconds to the first streamed text/reasoning delta; absent when nothing streamed. */
388
+ ttftMs?: number;
389
+ };
390
+ tool_started: {
391
+ id: string;
392
+ name: string;
393
+ arguments: string;
394
+ effect: Effect;
395
+ };
396
+ /** `data` is whatever the tool passed to `ToolContext.emit`. */
397
+ tool_progress: {
398
+ id: string;
399
+ data: unknown;
400
+ };
401
+ tool_completed: {
402
+ id: string;
403
+ name: string;
404
+ isError: boolean;
405
+ durationMs: number;
406
+ /** Text projection of the result, capped at 2,000 characters. */
407
+ preview: string;
408
+ };
409
+ approval_requested: {
410
+ id: string;
411
+ name: string;
412
+ effect: "write" | "process" | "external";
413
+ label?: string;
414
+ };
415
+ approval_resolved: {
416
+ id: string;
417
+ name: string;
418
+ effect: "write" | "process" | "external";
419
+ decision: "once" | "session" | "deny";
420
+ };
421
+ run_completed: {
422
+ tokens: number;
423
+ text: string;
424
+ truncated?: boolean;
425
+ };
426
+ response_truncated: {
427
+ turn: number;
428
+ maxOutputTokens: number;
429
+ };
430
+ run_turns_exceeded: {
431
+ turns: number;
432
+ maxTurns: number;
433
+ };
434
+ run_failed: {
435
+ error: string;
436
+ };
437
+ run_cancelled: {
438
+ error: string;
439
+ };
440
+ model_changed: {
441
+ model: string;
442
+ previous: string;
443
+ };
444
+ compaction_started: {
445
+ reason: "manual" | "auto";
446
+ before: number;
447
+ messages: number;
448
+ };
449
+ compaction_completed: {
450
+ reason: "manual" | "auto";
451
+ before: number;
452
+ after: number;
453
+ replaced: number;
454
+ structured: boolean;
455
+ summarizedTokens: number;
456
+ checkpointTokens: number;
457
+ /** Per-plugin `CompactionOutcome.report`, keyed by plugin id. */
458
+ plugins: Record<string, Record<string, unknown>>;
459
+ /** The summary hit its output budget and was accepted as partial. */
460
+ partial?: true;
461
+ };
462
+ compaction_skipped: {
463
+ reason: "manual" | "auto";
464
+ before: number;
465
+ detail: string;
466
+ };
467
+ compaction_failed: {
468
+ reason: "manual" | "auto";
469
+ error: string;
470
+ };
471
+ /** Tool results clipped in place to fit the context budget. */
472
+ context_reduced: {
473
+ messages: number;
474
+ };
475
+ session_context_injected: {
476
+ tokens: number;
477
+ sources: string[];
478
+ };
479
+ plugin_hook_failed: {
480
+ source: string;
481
+ hook: string;
482
+ error: string;
483
+ continued: true;
484
+ };
264
485
  }
486
+ /** Every `RunEvent.type` the core emits today. `RunEvent.type` itself stays `string`. */
487
+ export type RunEventType = keyof RunEventDataMap;
488
+ /** Event types never persisted to the session store (and therefore without `eventId`). */
489
+ export type EphemeralRunEventType = "text_delta" | "reasoning_delta" | "tool_progress";
490
+ export declare const EPHEMERAL_RUN_EVENT_TYPES: readonly EphemeralRunEventType[];
491
+ /** True for streaming-only event types that are never persisted. */
492
+ export declare function isEphemeralRunEventType(type: string): type is EphemeralRunEventType;
493
+ /**
494
+ * Discriminated view of `RunEvent` with typed `data`, for consumers that narrow on `type`.
495
+ * Every member is assignable to `RunEvent`; events of unknown types remain plain `RunEvent`s.
496
+ */
497
+ export type KnownRunEvent = {
498
+ [K in RunEventType]: RunEvent & {
499
+ type: K;
500
+ data: RunEventDataMap[K];
501
+ };
502
+ }[RunEventType];
265
503
  /** Generic structured checkpoint produced by core context compaction. */
266
504
  export interface CompactionCheckpoint {
267
505
  goal: string;
@@ -717,6 +955,472 @@ export interface Plugin {
717
955
  setup(api: PluginAPI): void | Promise<void>;
718
956
  dispose?(): void | Promise<void>;
719
957
  }
958
+ /** Derived status of a root session as shown by web clients (never persisted). */
959
+ export type SessionUiStatus = "idle" | "queued" | "running" | "awaiting_input" | "locked" | "error";
960
+ /** A content-addressed upload (for example an image attached from the web composer). */
961
+ export interface BlobRef {
962
+ /** Lowercase hex sha256 of the bytes. */
963
+ hash: string;
964
+ mimeType: string;
965
+ bytes: number;
966
+ width?: number;
967
+ height?: number;
968
+ }
969
+ /** One entry of `GET /api/workspaces/:wid/tree` (paths are workspace-relative, `/`-separated). */
970
+ export interface FileEntry {
971
+ name: string;
972
+ path: string;
973
+ type: "file" | "dir" | "symlink" | "other";
974
+ /** Bytes, for files. */
975
+ size?: number;
976
+ /** Last modification, ms epoch. */
977
+ mtime?: number;
978
+ }
979
+ /** A page of a directory listing; `next` is an opaque cursor for the following page. */
980
+ export interface FileTreePage {
981
+ entries: FileEntry[];
982
+ next?: string;
983
+ }
984
+ /** A file the session changed (write-effect tool calls), for the Changes dock. */
985
+ export interface SessionChange {
986
+ path: string;
987
+ lastRunId?: string;
988
+ effect: "write";
989
+ /** `git status --porcelain` code when the workspace is a git repository (`M`, `A`, `D`, `??`…). */
990
+ gitStatus?: string;
991
+ }
992
+ /** Session metadata carried by snapshot frames. */
993
+ export interface SessionDetailWire {
994
+ id: string;
995
+ /** Opaque, stable workspace id (never a filesystem path in URLs). */
996
+ workspaceId: string;
997
+ /** Absolute workspace path, for display. */
998
+ workspace: string;
999
+ provider: string;
1000
+ model: string;
1001
+ status: SessionUiStatus;
1002
+ title?: string;
1003
+ parentId?: string;
1004
+ /** Persisted child-session status, shown verbatim for child sessions. */
1005
+ childStatus?: SessionStatus;
1006
+ createdAt?: number;
1007
+ updatedAt?: number;
1008
+ }
1009
+ /** In-flight state of a running run, rebuilt by the server for snapshots. */
1010
+ export interface InflightState {
1011
+ runId: string;
1012
+ status: "queued" | "running";
1013
+ /** Assistant text streamed since the last `turn_completed`. */
1014
+ text: string;
1015
+ /** Reasoning streamed since the last `turn_completed` (never persisted). */
1016
+ reasoning: string;
1017
+ tools: Array<{
1018
+ id: string;
1019
+ name: string;
1020
+ arguments: string;
1021
+ effect: Effect;
1022
+ startedAt: number;
1023
+ /** Latest progress output, bounded. */
1024
+ tail: string;
1025
+ }>;
1026
+ }
1027
+ /** An approval waiting for a decision from a web client. */
1028
+ export interface PendingApproval {
1029
+ /** `<sessionId>:<callId>` for tool effects; `<sessionId>:dir:<uuid>` for directories. */
1030
+ approvalId: string;
1031
+ sessionId: string;
1032
+ /** Root of `sessionId`, so child-session approvals show in the root session view. */
1033
+ rootSessionId: string;
1034
+ runId?: string;
1035
+ kind: "effect" | "directory";
1036
+ callId?: string;
1037
+ name?: string;
1038
+ effect?: "write" | "process" | "external";
1039
+ label?: string;
1040
+ directory?: string;
1041
+ /** Pretty-printed tool input, truncated to 4 KB. */
1042
+ input: string;
1043
+ expiresAt?: number;
1044
+ }
1045
+ /** A plugin UI request (`ui.select` / `ui.askQuestions`) waiting for a web client. */
1046
+ export interface PendingInteraction {
1047
+ interactionId: string;
1048
+ /** Present when the request names a session (`AskQuestionsRequest.session`). */
1049
+ sessionId?: string;
1050
+ workspaceId: string;
1051
+ request: {
1052
+ kind: "select";
1053
+ select: SelectRequest;
1054
+ } | {
1055
+ kind: "questions";
1056
+ questions: Question[];
1057
+ label?: string;
1058
+ };
1059
+ }
1060
+ /** One entry of the shared slash-command catalog. */
1061
+ export interface CommandDescriptor {
1062
+ name: string;
1063
+ description: string;
1064
+ aliases?: string[];
1065
+ argumentHint?: string;
1066
+ source: "builtin" | "plugin" | "prompt" | "skill";
1067
+ /** Plugin id or resource owner, when not built in. */
1068
+ owner?: string;
1069
+ surfaces: Array<"tui" | "web" | "api">;
1070
+ /** `core` commands run through the catalog; `surface` commands are handled by each UI. */
1071
+ execution: "core" | "surface";
1072
+ }
1073
+ /** One JSON object per SSE `data:` line. Clients ignore unknown `t` values. */
1074
+ export type ServerFrame = {
1075
+ t: "hello";
1076
+ protocolVersion: 1;
1077
+ streamId: string;
1078
+ serverTime: number;
1079
+ } | {
1080
+ t: "snapshot";
1081
+ sessionId: string;
1082
+ /** `MAX(events.seq)` of the session when the snapshot was taken. */
1083
+ cursor: number;
1084
+ session: SessionDetailWire;
1085
+ messages: {
1086
+ items: Array<{
1087
+ seq: number;
1088
+ message: Message;
1089
+ compacted: boolean;
1090
+ }>;
1091
+ hasMore: boolean;
1092
+ };
1093
+ inflight?: InflightState;
1094
+ pending: {
1095
+ approvals: PendingApproval[];
1096
+ interactions: PendingInteraction[];
1097
+ };
1098
+ }
1099
+ /** Durable event; its SSE `id` is `event.eventId`. */
1100
+ | {
1101
+ t: "event";
1102
+ sessionId: string;
1103
+ event: RunEvent;
1104
+ }
1105
+ /** Coalesced ephemeral output; carries no SSE `id`. */
1106
+ | {
1107
+ t: "delta";
1108
+ sessionId: string;
1109
+ runId: string;
1110
+ text?: string;
1111
+ reasoning?: string;
1112
+ progress?: Array<{
1113
+ toolId: string;
1114
+ chunk: string;
1115
+ }>;
1116
+ } | {
1117
+ t: "tool_result";
1118
+ sessionId: string;
1119
+ runId: string;
1120
+ callId: string;
1121
+ result: ToolResult;
1122
+ truncated?: boolean;
1123
+ } | {
1124
+ t: "message";
1125
+ sessionId: string;
1126
+ seq: number;
1127
+ message: Message;
1128
+ } | {
1129
+ t: "approval";
1130
+ approval: PendingApproval;
1131
+ } | {
1132
+ t: "approval_withdrawn";
1133
+ approvalId: string;
1134
+ reason: "cancelled" | "timeout" | "resolved_elsewhere";
1135
+ } | {
1136
+ t: "interaction";
1137
+ interaction: PendingInteraction;
1138
+ } | {
1139
+ t: "interaction_withdrawn";
1140
+ interactionId: string;
1141
+ } | {
1142
+ t: "session_status";
1143
+ sessionId: string;
1144
+ workspaceId: string;
1145
+ status: SessionUiStatus;
1146
+ title?: string;
1147
+ updatedAt?: number;
1148
+ } | {
1149
+ t: "catalog_changed";
1150
+ workspaceId: string;
1151
+ scope: "commands" | "plugins" | "skills" | "mcp" | "models" | "agents";
1152
+ } | {
1153
+ t: "resync";
1154
+ sessionId?: string;
1155
+ reason: "overflow" | "gap" | "server_restart";
1156
+ };
1157
+ export type ApiErrorCode = "unauthorized" | "forbidden_origin" | "forbidden_host" | "validation_failed" | "not_found" | "unknown_command" | "session_busy" | "session_locked" | "workspace_limit" | "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"
1158
+ /** Too many concurrent event streams (SSE) for this server. */
1159
+ | "stream_limit" | "internal";
1160
+ /** `GET /api/health` (the only unauthenticated API route). */
1161
+ export interface HealthInfo {
1162
+ name: "alisio";
1163
+ version: string;
1164
+ protocolVersion: 1;
1165
+ capabilities: {
1166
+ sse: boolean;
1167
+ websocket: boolean;
1168
+ multiWorkspace: boolean;
1169
+ attachments: boolean;
1170
+ uiBlocks: string[];
1171
+ mcpApps: boolean;
1172
+ automation: boolean;
1173
+ /** The server listens on a non-loopback address (`--allow-remote`). */
1174
+ remote: boolean;
1175
+ };
1176
+ }
1177
+ /** A workspace known to the server (`GET /api/workspaces`). */
1178
+ export interface WorkspaceInfo {
1179
+ /** Opaque, stable id: a short sha256 of the canonical path. */
1180
+ id: string;
1181
+ /** Canonical absolute path (display only; URLs use `id`). */
1182
+ path: string;
1183
+ label?: string;
1184
+ pinned: boolean;
1185
+ /** An `Application` is open for it in the server right now. */
1186
+ open: boolean;
1187
+ /** Project resources load (trusted from the terminal or by a launch flag). */
1188
+ trusted: boolean;
1189
+ /** The directory has project resources that are not trusted (shown as "untrusted"). */
1190
+ untrustedResources: boolean;
1191
+ lastOpenedAt?: number;
1192
+ }
1193
+ /** Permission presets of the web composer (RF-08). */
1194
+ export type PermissionPresetId = "read-only" | "ask" | "workspace-write" | "full-access";
1195
+ export interface PermissionPresetInfo {
1196
+ id: PermissionPresetId;
1197
+ /** Selectable under the server's launch flags (its capability ceiling). */
1198
+ available: boolean;
1199
+ /** Why it is unavailable, or which effects still ask because of the ceiling. */
1200
+ reason?: string;
1201
+ /** Effects allowed without asking once the ceiling is applied. */
1202
+ policy: {
1203
+ write: boolean;
1204
+ process: boolean;
1205
+ external: boolean;
1206
+ };
1207
+ /** Whether non-allowed effects ask for approval (false: they are denied). */
1208
+ approvals: boolean;
1209
+ }
1210
+ /** A row of the session list (`GET /api/sessions`). */
1211
+ export interface SessionSummary extends SessionDetailWire {
1212
+ pinned: boolean;
1213
+ archived: boolean;
1214
+ }
1215
+ /** `GET /api/sessions/:sid` and the result of creating or patching a session. */
1216
+ export interface SessionDetail extends SessionSummary {
1217
+ preset: PermissionPresetId;
1218
+ effort?: string;
1219
+ agent?: string;
1220
+ presets: PermissionPresetInfo[];
1221
+ children: SessionDetailWire[];
1222
+ }
1223
+ /** Answer of `POST /api/sessions/:sid/prompts`. */
1224
+ export type PromptAccepted = {
1225
+ runId: string;
1226
+ status: "queued" | "running";
1227
+ duplicate?: false;
1228
+ } | {
1229
+ runId: string;
1230
+ status: string;
1231
+ duplicate: true;
1232
+ } | {
1233
+ status: "enqueued";
1234
+ duplicate?: boolean;
1235
+ };
1236
+ /**
1237
+ * Answer of `POST /api/sessions/:sid/commands`. A command either reports (`output`, Markdown),
1238
+ * points the client at another session (`/clear`, `/resume`) or expands into a prompt the client
1239
+ * sends through `POST .../prompts` (prompt templates, skills, `/ask`). A repeated `requestId`
1240
+ * answers `{duplicate: true}` without running the command again.
1241
+ */
1242
+ export interface CommandOutcome {
1243
+ output?: string;
1244
+ /** `notice` is a short status line; `info` (default) a report. */
1245
+ tone?: "info" | "notice";
1246
+ sessionId?: string;
1247
+ prompt?: {
1248
+ text: string;
1249
+ display: string;
1250
+ };
1251
+ /** What changed, e.g. `"model"` or `"effort"`, so clients refresh the session. */
1252
+ effects?: string[];
1253
+ duplicate?: boolean;
1254
+ }
1255
+ /** `GET /api/sessions/:sid/models`: models of the session's provider (credential-free). */
1256
+ export interface SessionModels {
1257
+ provider: string;
1258
+ model: string;
1259
+ /** Session reasoning effort, when set. */
1260
+ effort?: string;
1261
+ models: ModelInfo[];
1262
+ /** The provider could not list its models (the current model still works). */
1263
+ unavailable: boolean;
1264
+ }
1265
+ /** `GET /api/sessions/:sid/context`: estimated tokens of the next request and the budget. */
1266
+ export interface SessionContextUsage {
1267
+ estimated: number;
1268
+ /** Model context window, when known. */
1269
+ total?: number;
1270
+ basis: "window" | "unknown";
1271
+ /** Percentage of `total` at which auto-compaction triggers. */
1272
+ compactionAt: number;
1273
+ }
1274
+ /** `GET /api/plugins`: one plugin of a workspace (credential- and path-safe). */
1275
+ export interface PluginInfo {
1276
+ id: string;
1277
+ name: string;
1278
+ description: string;
1279
+ version?: string;
1280
+ categories: string[];
1281
+ builtin: boolean;
1282
+ source: string;
1283
+ status: "active" | "inactive" | "failed" | "restart-required";
1284
+ enabled: boolean;
1285
+ /** Whether the web may toggle it (else `diagnostic` says why). */
1286
+ manageable: boolean;
1287
+ diagnostic?: string;
1288
+ /** Tools it contributes, without the namespacing prefix. */
1289
+ tools: string[];
1290
+ /** Slash commands it contributes. */
1291
+ commands: string[];
1292
+ /** Prefix of its namespaced tool names (`p_<hash>`), to label tool calls. */
1293
+ toolPrefix: string;
1294
+ }
1295
+ /** `GET /api/skills`: one discovered skill (no file paths). */
1296
+ export interface SkillInfo {
1297
+ id: string;
1298
+ name: string;
1299
+ displayId: string;
1300
+ description: string;
1301
+ scope: "project" | "config" | "user" | "plugin";
1302
+ source: string;
1303
+ owner?: {
1304
+ id: string;
1305
+ name: string;
1306
+ };
1307
+ manageable: boolean;
1308
+ locked: boolean;
1309
+ enabled: boolean;
1310
+ effective: boolean;
1311
+ shadowedBy?: string;
1312
+ approximateTokens: number;
1313
+ }
1314
+ /** One MCP server of a workspace; commands, arguments and URLs are never sent. */
1315
+ export interface McpServerWire {
1316
+ name: string;
1317
+ displayName: string;
1318
+ /** Configuration layer that defines it (`global`, `project`, …). */
1319
+ source: string;
1320
+ status: string;
1321
+ enabled: boolean;
1322
+ transport: "stdio" | "http";
1323
+ capabilities: string[];
1324
+ counts: {
1325
+ tools: number;
1326
+ resources: number;
1327
+ prompts: number;
1328
+ };
1329
+ diagnostic?: string;
1330
+ }
1331
+ /** `GET /api/mcp`: the workspace's MCP runtime permission and servers. */
1332
+ export interface McpOverview {
1333
+ permission: "granted" | "not-granted" | "read-only";
1334
+ /** Global consent (`mcp.allow`) is persisted for this user. */
1335
+ persisted: boolean;
1336
+ servers: McpServerWire[];
1337
+ }
1338
+ /** `GET /api/agents`: a selectable main-session agent. */
1339
+ export interface AgentInfo {
1340
+ id: string;
1341
+ name: string;
1342
+ description: string;
1343
+ instructions?: string;
1344
+ model?: string;
1345
+ readOnly?: boolean;
1346
+ source: "builtin" | "user" | "plugin";
1347
+ /** The workspace default (`agents.active`) used by sessions without their own agent. */
1348
+ default: boolean;
1349
+ }
1350
+ /** One user-facing setting (`SettableSettingKey`) and its effective value. */
1351
+ export interface SettingInfo {
1352
+ key: string;
1353
+ kind: "boolean" | "number" | "string" | "enum";
1354
+ options?: string[];
1355
+ value?: string | number | boolean;
1356
+ }
1357
+ /** `GET /api/settings`: effective settings and where configuration lives. */
1358
+ export interface SettingsOverview {
1359
+ /** Highest-priority configuration file of the workspace (it may not exist yet). */
1360
+ configPath: string;
1361
+ /** Global file that setting changes are written to. */
1362
+ settingsPath: string;
1363
+ /** Provider profiles (`providers.json`); credentials live apart, never shown. */
1364
+ providersPath: string;
1365
+ trusted: boolean;
1366
+ readOnly: boolean;
1367
+ settings: SettingInfo[];
1368
+ }
1369
+ /** A credential as the web sees it: never the value, at most a short masked tail. */
1370
+ export interface CredentialStatus {
1371
+ configured: boolean;
1372
+ source?: "file" | "env";
1373
+ /** Last characters behind an ellipsis (`…71B`), only for long stored secrets. */
1374
+ tail?: string;
1375
+ }
1376
+ /** One stored provider profile (non-secret values only). */
1377
+ export interface ProviderProfileInfo {
1378
+ name: string;
1379
+ provider: string;
1380
+ model: string;
1381
+ values: Record<string, ProviderConfigurationValue>;
1382
+ /** The globally active profile (`providers.json`). */
1383
+ active: boolean;
1384
+ credentials: Record<string, CredentialStatus>;
1385
+ }
1386
+ /** A provider type a profile can use, with its configuration fields. */
1387
+ export interface ProviderTypeInfo {
1388
+ id: string;
1389
+ name: string;
1390
+ description?: string;
1391
+ fields: ProviderConfigurationField[];
1392
+ }
1393
+ /** `GET /api/providers`. */
1394
+ export interface ProvidersOverview {
1395
+ active?: string;
1396
+ profiles: ProviderProfileInfo[];
1397
+ /** Provider types of the requested workspace (empty without `?workspace=`). */
1398
+ types: ProviderTypeInfo[];
1399
+ /** What the requested workspace's application currently runs. */
1400
+ current?: {
1401
+ provider: string;
1402
+ model: string;
1403
+ profile?: string;
1404
+ };
1405
+ }
1406
+ /** `GET /api/models`: models of every configured profile (credential-free). */
1407
+ export interface ProviderModelsInfo {
1408
+ profile: string;
1409
+ provider: string;
1410
+ title: string;
1411
+ configuredModel: string;
1412
+ models: ModelInfo[];
1413
+ unavailable: boolean;
1414
+ }
1415
+ /** Body of every non-2xx web API response. */
1416
+ export interface ApiError {
1417
+ error: {
1418
+ code: ApiErrorCode;
1419
+ message: string;
1420
+ details?: unknown;
1421
+ };
1422
+ correlationId: string;
1423
+ }
720
1424
  export declare function definePlugin<T extends Plugin>(plugin: T): T;
721
1425
  export declare const textResult: (text: string, isError?: boolean) => ToolResult;
722
1426
  /**
package/dist/index.js CHANGED
@@ -1,3 +1,31 @@
1
+ /**
2
+ * Every `UiBlock` kind, for surfaces that dispatch on the kind at runtime (renderer registries,
3
+ * validators). Surfaces must still render an unknown kind as text: blocks persisted by a newer
4
+ * Alisio can be replayed by an older one.
5
+ */
6
+ export const UI_BLOCK_KINDS = [
7
+ "table",
8
+ "key-value",
9
+ "tree",
10
+ "code",
11
+ "markdown",
12
+ "diff",
13
+ "terminal",
14
+ "mermaid",
15
+ "math",
16
+ "json",
17
+ "test-results",
18
+ "progress",
19
+ ];
20
+ export const EPHEMERAL_RUN_EVENT_TYPES = [
21
+ "text_delta",
22
+ "reasoning_delta",
23
+ "tool_progress",
24
+ ];
25
+ /** True for streaming-only event types that are never persisted. */
26
+ export function isEphemeralRunEventType(type) {
27
+ return EPHEMERAL_RUN_EVENT_TYPES.includes(type);
28
+ }
1
29
  export function definePlugin(plugin) {
2
30
  return plugin;
3
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alisio/sdk",
3
- "version": "0.1.0-alpha.13",
3
+ "version": "0.1.0-alpha.15",
4
4
  "description": "Typed plugin SDK for Alisio: the stable contract for tools, commands, context, compaction and session hooks, model completions and storage. Types only plus tiny helpers; zero runtime dependencies.",
5
5
  "author": "Gustavo Gutiérrez",
6
6
  "license": "MIT",