@alisio/sdk 0.1.0-alpha.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/index.d.ts +1565 -3
- package/dist/index.js +53 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,59 @@
|
|
|
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
|
+
"artifact",
|
|
20
|
+
];
|
|
21
|
+
export const EPHEMERAL_RUN_EVENT_TYPES = [
|
|
22
|
+
"text_delta",
|
|
23
|
+
"reasoning_delta",
|
|
24
|
+
"tool_progress",
|
|
25
|
+
];
|
|
26
|
+
/** True for streaming-only event types that are never persisted. */
|
|
27
|
+
export function isEphemeralRunEventType(type) {
|
|
28
|
+
return EPHEMERAL_RUN_EVENT_TYPES.includes(type);
|
|
29
|
+
}
|
|
30
|
+
/** `ViewDefinition.handler` failure caused by the caller's parameters (becomes a 400). */
|
|
31
|
+
export class ViewParamsError extends Error {
|
|
32
|
+
code = "view_invalid_params";
|
|
33
|
+
constructor(message = "Invalid view parameters") {
|
|
34
|
+
super(message);
|
|
35
|
+
this.name = "ViewParamsError";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
1
38
|
export function definePlugin(plugin) {
|
|
2
39
|
return plugin;
|
|
3
40
|
}
|
|
41
|
+
/** `OutputTruncatedError.code`: a provider's reply was cut off by the output-token limit. */
|
|
42
|
+
export const OUTPUT_TRUNCATED_CODE = "output_truncated";
|
|
43
|
+
/**
|
|
44
|
+
* A provider that cannot yield a usable `completed` message because the output-token limit cut
|
|
45
|
+
* the response before anything usable existed (no text and no complete tool call) throws this,
|
|
46
|
+
* so the host can recover instead of failing the run. Hosts match on `code` (not `instanceof`),
|
|
47
|
+
* because a plugin may bundle its own copy of this package. Prefer yielding `completed` with
|
|
48
|
+
* `truncated: true` whenever the partial message is representable.
|
|
49
|
+
*/
|
|
50
|
+
export class OutputTruncatedError extends Error {
|
|
51
|
+
code = OUTPUT_TRUNCATED_CODE;
|
|
52
|
+
constructor(message = "The response was cut off by the output-token limit.") {
|
|
53
|
+
super(message);
|
|
54
|
+
this.name = "OutputTruncatedError";
|
|
55
|
+
}
|
|
56
|
+
}
|
|
4
57
|
export const textResult = (text, isError = false) => ({
|
|
5
58
|
content: [{ type: "text", text }],
|
|
6
59
|
...(isError ? { isError: true } : {}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alisio/sdk",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.0",
|
|
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",
|