@alisio/sdk 0.1.0-alpha.7 → 0.1.0-alpha.9

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
@@ -10,10 +10,52 @@ 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
+ };
13
48
  export interface ToolResult {
14
49
  content: Array<{
15
50
  type: "text";
16
51
  text: string;
52
+ } | {
53
+ type: "image";
54
+ mimeType: string;
55
+ data: string;
56
+ } | {
57
+ type: "ui";
58
+ block: UiBlock;
17
59
  }>;
18
60
  isError?: boolean;
19
61
  }
@@ -137,6 +179,12 @@ export interface ModelProvider {
137
179
  * that does not support one may ignore this or let the provider reject it.
138
180
  */
139
181
  nativeTools?: Array<Record<string, unknown>>;
182
+ /**
183
+ * Provider-declared reasoning effort level (a value from `ModelInfo.effort.supportedLevels`).
184
+ * Providers that advertise effort levels map it to their request field (for example DeepSeek
185
+ * `reasoning_effort`); providers without a concept ignore it.
186
+ */
187
+ reasoningEffort?: string;
140
188
  }): AsyncIterable<ProviderEvent>;
141
189
  /** Optional model catalog. Implementations must not expose credentials. */
142
190
  listModels?(signal: AbortSignal): Promise<ModelInfo[]>;
@@ -276,6 +324,8 @@ export interface CompletionRequest {
276
324
  model?: string;
277
325
  /** Session whose provider binding should be used when model is omitted. */
278
326
  sessionId?: string;
327
+ /** Reasoning effort level when the target model advertises `ModelInfo.effort`. */
328
+ reasoningEffort?: string;
279
329
  signal?: AbortSignal;
280
330
  }
281
331
  export type SqlValue = string | number | bigint | null | Uint8Array;
@@ -643,3 +693,10 @@ export interface Plugin {
643
693
  }
644
694
  export declare function definePlugin<T extends Plugin>(plugin: T): T;
645
695
  export declare const textResult: (text: string, isError?: boolean) => ToolResult;
696
+ /**
697
+ * Text-only view of a tool result: the content filtered to its text parts, order preserved.
698
+ * This is what the runner hands to providers, what compaction summarizes and what headless
699
+ * output shows; `ui`/`image` parts stay only in the persisted transcript for TUI replay, so
700
+ * raw bytes or structured blocks never reach the model prompt.
701
+ */
702
+ export declare function textProjection(result: ToolResult): ToolResult;
package/dist/index.js CHANGED
@@ -5,3 +5,14 @@ export const textResult = (text, isError = false) => ({
5
5
  content: [{ type: "text", text }],
6
6
  ...(isError ? { isError: true } : {}),
7
7
  });
8
+ /**
9
+ * Text-only view of a tool result: the content filtered to its text parts, order preserved.
10
+ * This is what the runner hands to providers, what compaction summarizes and what headless
11
+ * output shows; `ui`/`image` parts stay only in the persisted transcript for TUI replay, so
12
+ * raw bytes or structured blocks never reach the model prompt.
13
+ */
14
+ export function textProjection(result) {
15
+ if (result.content.every((part) => part.type === "text"))
16
+ return result;
17
+ return { ...result, content: result.content.filter((part) => part.type === "text") };
18
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alisio/sdk",
3
- "version": "0.1.0-alpha.7",
3
+ "version": "0.1.0-alpha.9",
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",