slexkit 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.slexkit.md +29 -0
- package/CHANGELOG.md +90 -0
- package/LICENSE +21 -0
- package/README.md +165 -0
- package/README.zh-CN.md +165 -0
- package/dist/ai/llms-authoring.txt +44 -0
- package/dist/ai/llms-components.txt +669 -0
- package/dist/ai/llms-full.txt +6586 -0
- package/dist/ai/llms-runtime.txt +1475 -0
- package/dist/ai/llms-toolhost.txt +295 -0
- package/dist/ai/llms.txt +69 -0
- package/dist/ai/slexkit-ai-manifest.json +2922 -0
- package/dist/base.css +621 -0
- package/dist/chunks/accordion-5f0nvjjm.js +376 -0
- package/dist/chunks/accordion-830dw78f.js +221 -0
- package/dist/chunks/accordion-cfjyxw93.js +630 -0
- package/dist/chunks/accordion-cw5r75jm.js +424 -0
- package/dist/chunks/accordion-ehnhpeca.js +492 -0
- package/dist/chunks/accordion-hzyrngd6.js +2377 -0
- package/dist/chunks/accordion-nw12ytps.js +6823 -0
- package/dist/components/accordion.js +163 -0
- package/dist/components/badge.js +80 -0
- package/dist/components/button.css +114 -0
- package/dist/components/button.js +16 -0
- package/dist/components/callout.js +154 -0
- package/dist/components/card.js +95 -0
- package/dist/components/checkbox.js +114 -0
- package/dist/components/choice.css +165 -0
- package/dist/components/code-block.js +264 -0
- package/dist/components/collapsible.js +111 -0
- package/dist/components/column.js +49 -0
- package/dist/components/content.css +474 -0
- package/dist/components/disclosure.css +162 -0
- package/dist/components/display.css +259 -0
- package/dist/components/divider.js +98 -0
- package/dist/components/feedback.css +219 -0
- package/dist/components/grid.js +67 -0
- package/dist/components/index.js +13364 -0
- package/dist/components/input.css +1247 -0
- package/dist/components/input.js +384 -0
- package/dist/components/link.js +77 -0
- package/dist/components/progress.js +111 -0
- package/dist/components/radio-group.js +189 -0
- package/dist/components/row.js +200 -0
- package/dist/components/section.js +161 -0
- package/dist/components/select.css +260 -0
- package/dist/components/select.js +16 -0
- package/dist/components/slider.css +125 -0
- package/dist/components/slider.js +175 -0
- package/dist/components/specs.js +1090 -0
- package/dist/components/stat.js +178 -0
- package/dist/components/submit.css +9 -0
- package/dist/components/submit.js +77 -0
- package/dist/components/switch.css +114 -0
- package/dist/components/switch.js +114 -0
- package/dist/components/table.js +157 -0
- package/dist/components/tabs.css +192 -0
- package/dist/components/tabs.js +17 -0
- package/dist/components/text-input.css +245 -0
- package/dist/components/text.js +50 -0
- package/dist/components/toast.js +240 -0
- package/dist/components/tooling.css +1009 -0
- package/dist/components/tooling.js +48951 -0
- package/dist/runtime.cjs +3728 -0
- package/dist/runtime.js +3686 -0
- package/dist/slexkit.cjs +18539 -0
- package/dist/slexkit.css +4776 -0
- package/dist/slexkit.js +18497 -0
- package/dist/tooling.js +59141 -0
- package/dist/types/components/accordion.d.ts +2 -0
- package/dist/types/components/badge.d.ts +2 -0
- package/dist/types/components/button.d.ts +2 -0
- package/dist/types/components/callout.d.ts +2 -0
- package/dist/types/components/card.d.ts +2 -0
- package/dist/types/components/checkbox.d.ts +2 -0
- package/dist/types/components/code-block.d.ts +2 -0
- package/dist/types/components/collapsible.d.ts +2 -0
- package/dist/types/components/column.d.ts +2 -0
- package/dist/types/components/divider.d.ts +2 -0
- package/dist/types/components/entries/accordion.d.ts +3 -0
- package/dist/types/components/entries/badge.d.ts +3 -0
- package/dist/types/components/entries/button.d.ts +3 -0
- package/dist/types/components/entries/callout.d.ts +3 -0
- package/dist/types/components/entries/card.d.ts +3 -0
- package/dist/types/components/entries/checkbox.d.ts +3 -0
- package/dist/types/components/entries/code-block.d.ts +3 -0
- package/dist/types/components/entries/collapsible.d.ts +3 -0
- package/dist/types/components/entries/column.d.ts +3 -0
- package/dist/types/components/entries/divider.d.ts +3 -0
- package/dist/types/components/entries/grid.d.ts +3 -0
- package/dist/types/components/entries/input.d.ts +3 -0
- package/dist/types/components/entries/link.d.ts +3 -0
- package/dist/types/components/entries/progress.d.ts +3 -0
- package/dist/types/components/entries/radio-group.d.ts +3 -0
- package/dist/types/components/entries/row.d.ts +3 -0
- package/dist/types/components/entries/section.d.ts +3 -0
- package/dist/types/components/entries/select.d.ts +3 -0
- package/dist/types/components/entries/slider.d.ts +3 -0
- package/dist/types/components/entries/specs.d.ts +1 -0
- package/dist/types/components/entries/stat.d.ts +3 -0
- package/dist/types/components/entries/submit.d.ts +3 -0
- package/dist/types/components/entries/switch.d.ts +3 -0
- package/dist/types/components/entries/table.d.ts +3 -0
- package/dist/types/components/entries/tabs.d.ts +3 -0
- package/dist/types/components/entries/text.d.ts +3 -0
- package/dist/types/components/entries/toast.d.ts +3 -0
- package/dist/types/components/entries/tooling.d.ts +1 -0
- package/dist/types/components/grid.d.ts +2 -0
- package/dist/types/components/index.d.ts +6 -0
- package/dist/types/components/input.d.ts +2 -0
- package/dist/types/components/link.d.ts +2 -0
- package/dist/types/components/progress.d.ts +2 -0
- package/dist/types/components/radio-group.d.ts +2 -0
- package/dist/types/components/row.d.ts +2 -0
- package/dist/types/components/section.d.ts +2 -0
- package/dist/types/components/select.d.ts +2 -0
- package/dist/types/components/slider.d.ts +2 -0
- package/dist/types/components/spec-helpers.d.ts +23 -0
- package/dist/types/components/spec-registry.d.ts +12 -0
- package/dist/types/components/spec-schema.d.ts +74 -0
- package/dist/types/components/specs.d.ts +2 -0
- package/dist/types/components/stat.d.ts +2 -0
- package/dist/types/components/submit.d.ts +2 -0
- package/dist/types/components/svelte/adapter.d.ts +3 -0
- package/dist/types/components/svelte/bindProps.d.ts +2 -0
- package/dist/types/components/svelte/helpers.d.ts +33 -0
- package/dist/types/components/svelte/layout/balancedTiles.d.ts +14 -0
- package/dist/types/components/svelte/types.d.ts +12 -0
- package/dist/types/components/switch.d.ts +2 -0
- package/dist/types/components/table.d.ts +2 -0
- package/dist/types/components/tabs.d.ts +2 -0
- package/dist/types/components/text.d.ts +2 -0
- package/dist/types/components/toast.d.ts +2 -0
- package/dist/types/components/tooling.d.ts +2 -0
- package/dist/types/components-svelte.d.ts +5 -0
- package/dist/types/engine/component-scope.d.ts +14 -0
- package/dist/types/engine/component-state.d.ts +9 -0
- package/dist/types/engine/diagnostics.d.ts +24 -0
- package/dist/types/engine/engineering.d.ts +11 -0
- package/dist/types/engine/eval.d.ts +5 -0
- package/dist/types/engine/index.d.ts +26 -0
- package/dist/types/engine/markdown-runtime.d.ts +33 -0
- package/dist/types/engine/merge.d.ts +1 -0
- package/dist/types/engine/reactive.d.ts +11 -0
- package/dist/types/engine/registry.d.ts +4 -0
- package/dist/types/engine/renderer.d.ts +6 -0
- package/dist/types/engine/sandbox-runner.d.ts +2 -0
- package/dist/types/engine/secure-runtime.d.ts +214 -0
- package/dist/types/engine/store.d.ts +12 -0
- package/dist/types/engine/types.d.ts +58 -0
- package/dist/types/icons/manager.d.ts +17 -0
- package/dist/types/icons/phosphor.d.ts +45 -0
- package/dist/types/index.d.ts +61 -0
- package/dist/types/runtime.d.ts +32 -0
- package/dist/types/toolhost/index.d.ts +78 -0
- package/dist/types/tooling-umd.d.ts +47 -0
- package/dist/types/version.d.ts +8 -0
- package/dist/umd/slexkit.tooling.umd.js +66553 -0
- package/dist/umd/slexkit.umd.js +18552 -0
- package/package.json +136 -0
- package/scripts/cli.mjs +47 -0
- package/skills/slexkit/SKILL.md +27 -0
- package/skills/slexkit-author/SKILL.md +50 -0
- package/skills/slexkit-host-integration/SKILL.md +33 -0
- package/skills/slexkit-secure-runtime/SKILL.md +31 -0
- package/skills/slexkit-toolhost/SKILL.md +38 -0
- package/skills/slexkit-update/SKILL.md +23 -0
- package/src/components/svelte/InlineIcon.svelte +66 -0
- package/src/components/svelte/adapter.ts +76 -0
- package/src/components/svelte/bindProps.ts +9 -0
- package/src/components/svelte/content/Badge.svelte +19 -0
- package/src/components/svelte/content/Callout.svelte +57 -0
- package/src/components/svelte/content/CodeBlock.svelte +130 -0
- package/src/components/svelte/content/Divider.svelte +21 -0
- package/src/components/svelte/content/Link.svelte +21 -0
- package/src/components/svelte/content/Section.svelte +24 -0
- package/src/components/svelte/content/Table.svelte +44 -0
- package/src/components/svelte/disclosure/Accordion.svelte +100 -0
- package/src/components/svelte/disclosure/Collapsible.svelte +45 -0
- package/src/components/svelte/display/Stat.svelte +102 -0
- package/src/components/svelte/display/Text.svelte +11 -0
- package/src/components/svelte/feedback/Progress.svelte +34 -0
- package/src/components/svelte/feedback/Toast.svelte +105 -0
- package/src/components/svelte/helpers.ts +148 -0
- package/src/components/svelte/input/Button.svelte +78 -0
- package/src/components/svelte/input/Checkbox.svelte +52 -0
- package/src/components/svelte/input/Input.svelte +202 -0
- package/src/components/svelte/input/RadioGroup.svelte +71 -0
- package/src/components/svelte/input/Select.svelte +220 -0
- package/src/components/svelte/input/Slider.svelte +96 -0
- package/src/components/svelte/input/Submit.svelte +32 -0
- package/src/components/svelte/input/Switch.svelte +53 -0
- package/src/components/svelte/input/Tabs.svelte +188 -0
- package/src/components/svelte/layout/Card.svelte +17 -0
- package/src/components/svelte/layout/Column.svelte +15 -0
- package/src/components/svelte/layout/Grid.svelte +26 -0
- package/src/components/svelte/layout/Row.svelte +105 -0
- package/src/components/svelte/layout/balancedTiles.ts +85 -0
- package/src/components/svelte/tooling/CodeMirror.svelte +91 -0
- package/src/components/svelte/tooling/Playground.svelte +765 -0
- package/src/components/svelte/tooling/PlaygroundMarkdown.svelte +26 -0
- package/src/components/svelte/tooling/PlaygroundSlexCode.svelte +76 -0
- package/src/components/svelte/types.ts +17 -0
- package/src/styles/animation.css +98 -0
- package/src/styles/components/button.css +114 -0
- package/src/styles/components/choice.css +165 -0
- package/src/styles/components/select.css +260 -0
- package/src/styles/components/slider.css +125 -0
- package/src/styles/components/submit.css +9 -0
- package/src/styles/components/switch.css +114 -0
- package/src/styles/components/tabs.css +192 -0
- package/src/styles/components/text-input.css +245 -0
- package/src/styles/content.css +474 -0
- package/src/styles/disclosure.css +162 -0
- package/src/styles/display.css +259 -0
- package/src/styles/entry.css +34 -0
- package/src/styles/feedback.css +219 -0
- package/src/styles/input.css +8 -0
- package/src/styles/layout.css +365 -0
- package/src/styles/theme.css +31 -0
- package/src/styles/tooling.css +1009 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LayoutNode, ForContext, RenderContext, MountOptions, ComponentStateMap, ComponentTypeMap } from "./types";
|
|
2
|
+
type RenderOptions = Required<Pick<MountOptions, "labels">> & {
|
|
3
|
+
dir: RenderContext["dir"];
|
|
4
|
+
};
|
|
5
|
+
export declare function renderTree(layout: LayoutNode, container: HTMLElement, g: Record<string, unknown>, components: ComponentStateMap, componentTypes: ComponentTypeMap, forCtx?: ForContext, ns?: string, api?: Record<string, unknown>, options?: RenderOptions, prepare?: boolean): void;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import type { MountOptions } from "./types";
|
|
2
|
+
export type NetworkMethod = "GET" | "POST";
|
|
3
|
+
export type RuntimeCredentials = "omit" | "same-origin" | "include";
|
|
4
|
+
export type HostRuntimePolicy = {
|
|
5
|
+
network?: {
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
methods: NetworkMethod[];
|
|
8
|
+
allowOrigins: string[];
|
|
9
|
+
allowHeaders?: string[];
|
|
10
|
+
allowContentTypes?: string[];
|
|
11
|
+
credentials: RuntimeCredentials;
|
|
12
|
+
timeoutMs: number;
|
|
13
|
+
maxBodyBytes: number;
|
|
14
|
+
maxResponseBytes?: number;
|
|
15
|
+
};
|
|
16
|
+
timer?: {
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
maxTimers: number;
|
|
19
|
+
minIntervalMs: number;
|
|
20
|
+
};
|
|
21
|
+
animation?: {
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
};
|
|
24
|
+
canvas?: {
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
maxCanvases?: number;
|
|
27
|
+
maxPixels?: number;
|
|
28
|
+
allowedContexts?: RuntimeCanvasContextId[];
|
|
29
|
+
};
|
|
30
|
+
execution?: {
|
|
31
|
+
heartbeatIntervalMs?: number;
|
|
32
|
+
maxUnresponsiveMs?: number;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export type RuntimeCanvasContextId = "2d" | "webgl" | "webgl2" | "bitmaprenderer";
|
|
36
|
+
export type RuntimeCanvasContext = CanvasRenderingContext2D | WebGLRenderingContext | WebGL2RenderingContext | ImageBitmapRenderingContext;
|
|
37
|
+
export type NetworkOptions = {
|
|
38
|
+
method?: NetworkMethod;
|
|
39
|
+
headers?: Record<string, string>;
|
|
40
|
+
body?: unknown;
|
|
41
|
+
timeoutMs?: number;
|
|
42
|
+
credentials?: RuntimeCredentials;
|
|
43
|
+
};
|
|
44
|
+
export type NetworkResult = {
|
|
45
|
+
ok: boolean;
|
|
46
|
+
status: number;
|
|
47
|
+
statusText: string;
|
|
48
|
+
url: string;
|
|
49
|
+
headers: Record<string, string>;
|
|
50
|
+
text?: string;
|
|
51
|
+
data?: unknown;
|
|
52
|
+
elapsedMs: number;
|
|
53
|
+
};
|
|
54
|
+
export type TimerId = number;
|
|
55
|
+
export type RafId = number;
|
|
56
|
+
export type HostFetchRequest = {
|
|
57
|
+
method: NetworkMethod;
|
|
58
|
+
url: string;
|
|
59
|
+
headers?: Record<string, string>;
|
|
60
|
+
body?: unknown;
|
|
61
|
+
credentials: RuntimeCredentials;
|
|
62
|
+
timeoutMs: number;
|
|
63
|
+
};
|
|
64
|
+
export type RuntimeNetworkLogEvent = {
|
|
65
|
+
phase: "request" | "response" | "error";
|
|
66
|
+
request: HostFetchRequest;
|
|
67
|
+
result?: NetworkResult;
|
|
68
|
+
error?: SerializedRuntimeError;
|
|
69
|
+
elapsedMs?: number;
|
|
70
|
+
};
|
|
71
|
+
export type RuntimeErrorEvent = {
|
|
72
|
+
phase: "timer" | "interval" | "raf" | "dispose";
|
|
73
|
+
error: SerializedRuntimeError;
|
|
74
|
+
};
|
|
75
|
+
export type HostRuntimeAdapter = {
|
|
76
|
+
fetch?: (request: HostFetchRequest) => Promise<NetworkResult>;
|
|
77
|
+
onNetworkLog?: (event: RuntimeNetworkLogEvent) => void;
|
|
78
|
+
onRuntimeError?: (event: RuntimeErrorEvent) => void;
|
|
79
|
+
now?: () => number;
|
|
80
|
+
setTimeout?: (fn: () => void, ms: number) => TimerId;
|
|
81
|
+
clearTimeout?: (id: TimerId) => void;
|
|
82
|
+
setInterval?: (fn: () => void, ms: number) => TimerId;
|
|
83
|
+
clearInterval?: (id: TimerId) => void;
|
|
84
|
+
requestAnimationFrame?: (fn: (time: number) => void) => RafId;
|
|
85
|
+
cancelAnimationFrame?: (id: RafId) => void;
|
|
86
|
+
};
|
|
87
|
+
export type SlexKitRuntimeApi = {
|
|
88
|
+
now: () => number;
|
|
89
|
+
get: (url: string, options?: Omit<NetworkOptions, "method" | "body">) => Promise<NetworkResult>;
|
|
90
|
+
post: (url: string, body?: unknown, options?: Omit<NetworkOptions, "method" | "body">) => Promise<NetworkResult>;
|
|
91
|
+
fetch: (url: string, options?: NetworkOptions) => Promise<NetworkResult>;
|
|
92
|
+
setTimeout: (fn: () => void, ms: number) => TimerId;
|
|
93
|
+
clearTimeout: (id: TimerId) => void;
|
|
94
|
+
setInterval: (fn: () => void, ms: number) => TimerId;
|
|
95
|
+
clearInterval: (id: TimerId) => void;
|
|
96
|
+
raf: (fn: (time: number) => void) => RafId;
|
|
97
|
+
cancelRaf: (id: RafId) => void;
|
|
98
|
+
createCanvas: (width: number, height: number) => HTMLCanvasElement;
|
|
99
|
+
getCanvasContext: (canvas: HTMLCanvasElement, contextId?: RuntimeCanvasContextId, options?: CanvasRenderingContext2DSettings | WebGLContextAttributes | ImageBitmapRenderingContextSettings) => RuntimeCanvasContext;
|
|
100
|
+
onDispose: (fn: () => void) => void;
|
|
101
|
+
isTimeoutError: (error: unknown) => boolean;
|
|
102
|
+
isNetworkError: (error: unknown) => boolean;
|
|
103
|
+
isPolicyError: (error: unknown) => boolean;
|
|
104
|
+
errorMessage: (error: unknown) => string;
|
|
105
|
+
};
|
|
106
|
+
export type SecureRuntimeHandle = {
|
|
107
|
+
api: SlexKitRuntimeApi;
|
|
108
|
+
dispose: () => void;
|
|
109
|
+
};
|
|
110
|
+
export type SecureFrameOptions = {
|
|
111
|
+
className?: string;
|
|
112
|
+
title?: string;
|
|
113
|
+
sandbox?: string;
|
|
114
|
+
unsafeAllowSameOrigin?: boolean;
|
|
115
|
+
runtimeUrl?: string;
|
|
116
|
+
loadTimeoutMs?: number;
|
|
117
|
+
/**
|
|
118
|
+
* @deprecated Use runtimeUrl. The runner is now shipped inside the main SlexKit runtime module.
|
|
119
|
+
*/
|
|
120
|
+
runnerUrl?: string;
|
|
121
|
+
};
|
|
122
|
+
export type SecureMountOptions = Omit<MountOptions, "api"> & {
|
|
123
|
+
policy: HostRuntimePolicy;
|
|
124
|
+
hostAdapter?: HostRuntimeAdapter;
|
|
125
|
+
frame?: boolean | SecureFrameOptions;
|
|
126
|
+
unsafeInlineExecution?: boolean;
|
|
127
|
+
artifactSlots?: SecureArtifactSlot[];
|
|
128
|
+
};
|
|
129
|
+
export type SecureArtifactSlot = {
|
|
130
|
+
id: string;
|
|
131
|
+
container: HTMLElement;
|
|
132
|
+
};
|
|
133
|
+
export type SandboxMountMessage = {
|
|
134
|
+
channel: "slexkit-secure";
|
|
135
|
+
type: "mount";
|
|
136
|
+
id: string;
|
|
137
|
+
token: string;
|
|
138
|
+
input: unknown;
|
|
139
|
+
policy: HostRuntimePolicy;
|
|
140
|
+
theme?: MountOptions["theme"];
|
|
141
|
+
colorMode?: "light" | "dark";
|
|
142
|
+
dir?: MountOptions["dir"];
|
|
143
|
+
labels?: MountOptions["labels"];
|
|
144
|
+
};
|
|
145
|
+
export type SandboxDisposeMessage = {
|
|
146
|
+
channel: "slexkit-secure";
|
|
147
|
+
type: "dispose";
|
|
148
|
+
id: string;
|
|
149
|
+
token: string;
|
|
150
|
+
};
|
|
151
|
+
export type SandboxFetchRequestMessage = {
|
|
152
|
+
channel: "slexkit-secure";
|
|
153
|
+
type: "fetch";
|
|
154
|
+
id: string;
|
|
155
|
+
token: string;
|
|
156
|
+
requestId: string;
|
|
157
|
+
request: HostFetchRequest;
|
|
158
|
+
};
|
|
159
|
+
export type SandboxFetchResponseMessage = {
|
|
160
|
+
channel: "slexkit-secure";
|
|
161
|
+
type: "fetch-result";
|
|
162
|
+
id: string;
|
|
163
|
+
token: string;
|
|
164
|
+
requestId: string;
|
|
165
|
+
result?: NetworkResult;
|
|
166
|
+
error?: SerializedRuntimeError;
|
|
167
|
+
};
|
|
168
|
+
export type SandboxSlotsMessage = {
|
|
169
|
+
channel: "slexkit-secure";
|
|
170
|
+
type: "slots";
|
|
171
|
+
id: string;
|
|
172
|
+
token: string;
|
|
173
|
+
slots: Array<{
|
|
174
|
+
id: string;
|
|
175
|
+
left: number;
|
|
176
|
+
top: number;
|
|
177
|
+
width: number;
|
|
178
|
+
height: number;
|
|
179
|
+
}>;
|
|
180
|
+
};
|
|
181
|
+
export type SandboxSlotSizeMessage = {
|
|
182
|
+
channel: "slexkit-secure";
|
|
183
|
+
type: "slot-size";
|
|
184
|
+
id: string;
|
|
185
|
+
token: string;
|
|
186
|
+
slotId: string;
|
|
187
|
+
height: number;
|
|
188
|
+
};
|
|
189
|
+
export type SandboxStatusMessage = {
|
|
190
|
+
channel: "slexkit-secure";
|
|
191
|
+
type: "ready" | "mounted" | "heartbeat" | "disposed" | "error";
|
|
192
|
+
id?: string;
|
|
193
|
+
token?: string;
|
|
194
|
+
error?: SerializedRuntimeError;
|
|
195
|
+
};
|
|
196
|
+
export type SandboxHostMessage = SandboxMountMessage | SandboxDisposeMessage | SandboxFetchResponseMessage | SandboxSlotsMessage;
|
|
197
|
+
export type SandboxRunnerMessage = SandboxFetchRequestMessage | SandboxSlotSizeMessage | SandboxStatusMessage;
|
|
198
|
+
export type SerializedRuntimeError = {
|
|
199
|
+
name: string;
|
|
200
|
+
message: string;
|
|
201
|
+
kind?: RuntimeErrorKind;
|
|
202
|
+
code?: string;
|
|
203
|
+
elapsedMs?: number;
|
|
204
|
+
};
|
|
205
|
+
export type RuntimeErrorKind = "policy" | "network" | "timeout";
|
|
206
|
+
export declare class SlexKitRuntimeError extends Error {
|
|
207
|
+
kind: RuntimeErrorKind;
|
|
208
|
+
code: string;
|
|
209
|
+
elapsedMs?: number;
|
|
210
|
+
constructor(kind: RuntimeErrorKind, code: string, message: string, elapsedMs?: number);
|
|
211
|
+
}
|
|
212
|
+
export declare function serializeRuntimeError(error: unknown): SerializedRuntimeError;
|
|
213
|
+
export declare function deserializeRuntimeError(error: SerializedRuntimeError): Error;
|
|
214
|
+
export declare function createSecureRuntime(policy: HostRuntimePolicy, hostAdapter?: HostRuntimeAdapter): SecureRuntimeHandle;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ComponentStateMap, ComponentTypeMap, LayoutNode } from "./types";
|
|
2
|
+
export type Store = {
|
|
3
|
+
g: Record<string, unknown>;
|
|
4
|
+
components: ComponentStateMap;
|
|
5
|
+
componentTypes: ComponentTypeMap;
|
|
6
|
+
layouts: LayoutNode[];
|
|
7
|
+
roots: Map<HTMLElement, HTMLElement>;
|
|
8
|
+
cleanups: Map<HTMLElement, () => void>;
|
|
9
|
+
};
|
|
10
|
+
export declare function getStore(ns: string): Store;
|
|
11
|
+
export declare function peekStore(ns: string): Store | undefined;
|
|
12
|
+
export declare function deleteStore(ns: string): boolean;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export type SlexExpression = {
|
|
2
|
+
slex?: string;
|
|
3
|
+
namespace?: string;
|
|
4
|
+
g?: Record<string, unknown>;
|
|
5
|
+
layout?: LayoutNode;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
/** @deprecated Use SlexExpression instead. */
|
|
9
|
+
export type DSL = SlexExpression;
|
|
10
|
+
export type LayoutNode = Record<string, unknown>;
|
|
11
|
+
export type ComponentState = Record<string, unknown>;
|
|
12
|
+
export type ComponentStateMap = Record<string, ComponentState>;
|
|
13
|
+
export type ComponentTypeMap = Record<string, string>;
|
|
14
|
+
export type ComponentStateMode = "value" | "checked" | "enabled" | "readable" | "none";
|
|
15
|
+
export type ComponentRegistrationOptions = {
|
|
16
|
+
state?: ComponentStateMode;
|
|
17
|
+
};
|
|
18
|
+
export type ForContext = {
|
|
19
|
+
$item?: unknown;
|
|
20
|
+
$index?: number | (() => number);
|
|
21
|
+
$key?: unknown;
|
|
22
|
+
[identifier: string]: unknown;
|
|
23
|
+
};
|
|
24
|
+
export type ForSlot = {
|
|
25
|
+
key: unknown;
|
|
26
|
+
el: HTMLElement;
|
|
27
|
+
forCtx: ForContext;
|
|
28
|
+
index: number;
|
|
29
|
+
item: unknown;
|
|
30
|
+
props: Record<string, unknown>;
|
|
31
|
+
children: Record<string, unknown>;
|
|
32
|
+
indexSignal?: [() => number, (v: number) => void];
|
|
33
|
+
revision?: number;
|
|
34
|
+
revisionSignal?: [() => number, (v: number) => void];
|
|
35
|
+
dispose?: () => void;
|
|
36
|
+
};
|
|
37
|
+
export type ComponentRenderer = (props: Record<string, unknown>, name: string, ctx: RenderContext) => HTMLElement | void;
|
|
38
|
+
export type ThemeMode = "auto" | "host-shadcn" | "uno" | "flowbite";
|
|
39
|
+
export type DirectionMode = "ltr" | "rtl" | "auto";
|
|
40
|
+
export type RuntimeLabels = Partial<Record<string, string>>;
|
|
41
|
+
export type MountOptions = {
|
|
42
|
+
theme?: ThemeMode;
|
|
43
|
+
dir?: DirectionMode;
|
|
44
|
+
labels?: RuntimeLabels;
|
|
45
|
+
api?: Record<string, unknown>;
|
|
46
|
+
};
|
|
47
|
+
export type RenderContext = {
|
|
48
|
+
g: Record<string, unknown>;
|
|
49
|
+
api?: Record<string, unknown>;
|
|
50
|
+
dir: Exclude<DirectionMode, "auto">;
|
|
51
|
+
labels: RuntimeLabels;
|
|
52
|
+
document: Document;
|
|
53
|
+
forCtx?: ForContext;
|
|
54
|
+
children: Record<string, unknown>;
|
|
55
|
+
renderTree: (layout: LayoutNode, container: HTMLElement, forCtx?: ForContext) => void;
|
|
56
|
+
emit: (eventName: string, data?: unknown) => void;
|
|
57
|
+
id: string | null;
|
|
58
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { iconCacheKey, iconifySvgUrl, resolveIconifyIcon } from "./phosphor";
|
|
2
|
+
import type { PhosphorIconState, PhosphorIconWeight } from "./phosphor";
|
|
3
|
+
export type IconWeight = PhosphorIconWeight;
|
|
4
|
+
export type IconState = PhosphorIconState;
|
|
5
|
+
export interface RegisterIconOptions {
|
|
6
|
+
aliases?: string[];
|
|
7
|
+
weight?: IconWeight;
|
|
8
|
+
}
|
|
9
|
+
export declare function normalizeIconName(name: string): string;
|
|
10
|
+
export declare function registerIcon(name: string, svg: string, options?: RegisterIconOptions): void;
|
|
11
|
+
export declare function registerIcons(icons: Record<string, string>, options?: RegisterIconOptions): void;
|
|
12
|
+
export declare function clearRegisteredIcons(): void;
|
|
13
|
+
export declare function getRegisteredIcon(name: string, state?: IconWeight | IconState): string;
|
|
14
|
+
export declare function getIcon(name: string, state?: IconWeight | IconState): string;
|
|
15
|
+
export declare function loadIcon(name: string, state?: IconWeight | IconState): Promise<string>;
|
|
16
|
+
export { iconCacheKey, iconifySvgUrl, resolveIconifyIcon };
|
|
17
|
+
export declare function resolveIconWeight(state?: IconWeight | IconState): IconWeight;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export declare const phosphorIcons: {
|
|
2
|
+
readonly "caret-down": string;
|
|
3
|
+
readonly check: string;
|
|
4
|
+
readonly "circle-half": string;
|
|
5
|
+
readonly list: string;
|
|
6
|
+
readonly moon: string;
|
|
7
|
+
readonly sun: string;
|
|
8
|
+
readonly code: string;
|
|
9
|
+
readonly "book-open-text": string;
|
|
10
|
+
readonly "cursor-click": string;
|
|
11
|
+
readonly "gear-six": string;
|
|
12
|
+
readonly nut: string;
|
|
13
|
+
readonly screwdriver: string;
|
|
14
|
+
readonly sparkle: string;
|
|
15
|
+
readonly "terminal-window": string;
|
|
16
|
+
readonly wrench: string;
|
|
17
|
+
readonly copy: string;
|
|
18
|
+
readonly eye: string;
|
|
19
|
+
readonly "arrow-square-out": string;
|
|
20
|
+
readonly "split-horizontal": string;
|
|
21
|
+
readonly "square-half": string;
|
|
22
|
+
readonly "square-split-horizontal": string;
|
|
23
|
+
readonly file: string;
|
|
24
|
+
readonly "markdown-logo": string;
|
|
25
|
+
readonly x: string;
|
|
26
|
+
};
|
|
27
|
+
export type PhosphorIconName = keyof typeof phosphorIcons;
|
|
28
|
+
export type PhosphorIconWeight = "regular" | "duotone";
|
|
29
|
+
export interface PhosphorIconState {
|
|
30
|
+
weight?: PhosphorIconWeight | null;
|
|
31
|
+
selected?: unknown;
|
|
32
|
+
active?: unknown;
|
|
33
|
+
pressed?: unknown;
|
|
34
|
+
current?: unknown;
|
|
35
|
+
}
|
|
36
|
+
export declare function normalizePhosphorIconName(name: string): string;
|
|
37
|
+
export declare function resolveIconifyIcon(name: string, state?: PhosphorIconWeight | PhosphorIconState): {
|
|
38
|
+
prefix: string;
|
|
39
|
+
name: string;
|
|
40
|
+
} | null;
|
|
41
|
+
export declare function resolvePhosphorIconWeight(state?: PhosphorIconWeight | PhosphorIconState): PhosphorIconWeight;
|
|
42
|
+
export declare function getPhosphorIcon(name: string, state?: PhosphorIconWeight | PhosphorIconState): string;
|
|
43
|
+
export declare function iconCacheKey(name: string, state?: PhosphorIconWeight | PhosphorIconState): string;
|
|
44
|
+
export declare function iconifySvgUrl(name: string, state?: PhosphorIconWeight | PhosphorIconState): string;
|
|
45
|
+
export declare function loadPhosphorIcon(name: string, state?: PhosphorIconWeight | PhosphorIconState): Promise<string>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { mount, ingest, boot, disposeNamespace, register, getRenderer, diagnoseSlexKitSource, SlexKitSyntaxError, formatSlexKitDiagnostic, mountSecureArtifact, parseSlexSource, createSecureRuntime, SlexKitRuntimeError, getSlexKitRuntimeUrl, setSlexKitRuntimeUrl, createSlexKitMarkdownRuntimeHost, getSlexKitMarkdownRuntimeHost, installSlexKitMarkdownRuntimeHost } from "./engine/index";
|
|
2
|
+
import { registerAll, registerSvelteComponent, registerSubset } from "./components/index";
|
|
3
|
+
import { renderToolCall, registerToolTemplate } from "./toolhost/index";
|
|
4
|
+
import { startSlexKitSandboxRunner } from "./engine/sandbox-runner";
|
|
5
|
+
import { clearRegisteredIcons, getIcon, getRegisteredIcon, iconifySvgUrl, loadIcon, normalizeIconName, registerIcon, registerIcons, resolveIconifyIcon, resolveIconWeight } from "./icons/manager";
|
|
6
|
+
import { attachComponentDisposer, configureComponentScope } from "./engine/component-scope";
|
|
7
|
+
import { getSlexKitInfo, SLEXKIT_COMPONENTS_VERSION, SLEXKIT_VERSION, SLEX_PROTOCOL_VERSION } from "./version";
|
|
8
|
+
declare const mountApi: typeof mount;
|
|
9
|
+
declare const ingestApi: typeof ingest;
|
|
10
|
+
declare const bootApi: typeof boot;
|
|
11
|
+
declare const disposeNamespaceApi: typeof disposeNamespace;
|
|
12
|
+
declare const registerApi: typeof register;
|
|
13
|
+
declare const getRendererApi: typeof getRenderer;
|
|
14
|
+
declare const diagnoseSlexKitSourceApi: typeof diagnoseSlexKitSource;
|
|
15
|
+
declare const SlexKitSyntaxErrorApi: typeof SlexKitSyntaxError;
|
|
16
|
+
declare const formatSlexKitDiagnosticApi: typeof formatSlexKitDiagnostic;
|
|
17
|
+
declare const mountSecureArtifactApi: typeof mountSecureArtifact;
|
|
18
|
+
declare const parseSlexSourceApi: typeof parseSlexSource;
|
|
19
|
+
declare const parseSlexKitDslApi: typeof parseSlexSource;
|
|
20
|
+
declare const createSecureRuntimeApi: typeof createSecureRuntime;
|
|
21
|
+
declare const SlexKitRuntimeErrorApi: typeof SlexKitRuntimeError;
|
|
22
|
+
declare const getSlexKitRuntimeUrlApi: typeof getSlexKitRuntimeUrl;
|
|
23
|
+
declare const setSlexKitRuntimeUrlApi: typeof setSlexKitRuntimeUrl;
|
|
24
|
+
declare const createSlexKitMarkdownRuntimeHostApi: typeof createSlexKitMarkdownRuntimeHost;
|
|
25
|
+
declare const getSlexKitMarkdownRuntimeHostApi: typeof getSlexKitMarkdownRuntimeHost;
|
|
26
|
+
declare const installSlexKitMarkdownRuntimeHostApi: typeof installSlexKitMarkdownRuntimeHost;
|
|
27
|
+
declare const registerAllApi: typeof registerAll;
|
|
28
|
+
declare const registerSvelteComponentApi: typeof registerSvelteComponent;
|
|
29
|
+
declare const registerSubsetApi: typeof registerSubset;
|
|
30
|
+
declare const renderToolCallApi: typeof renderToolCall;
|
|
31
|
+
declare const registerToolTemplateApi: typeof registerToolTemplate;
|
|
32
|
+
declare const startSlexKitSandboxRunnerApi: typeof startSlexKitSandboxRunner;
|
|
33
|
+
declare const clearRegisteredIconsApi: typeof clearRegisteredIcons;
|
|
34
|
+
declare const getIconApi: typeof getIcon;
|
|
35
|
+
declare const getRegisteredIconApi: typeof getRegisteredIcon;
|
|
36
|
+
declare const loadIconApi: typeof loadIcon;
|
|
37
|
+
declare const normalizeIconNameApi: typeof normalizeIconName;
|
|
38
|
+
declare const registerIconApi: typeof registerIcon;
|
|
39
|
+
declare const registerIconsApi: typeof registerIcons;
|
|
40
|
+
declare const resolveIconifyIconApi: typeof resolveIconifyIcon;
|
|
41
|
+
declare const iconifySvgUrlApi: typeof iconifySvgUrl;
|
|
42
|
+
declare const resolveIconWeightApi: typeof resolveIconWeight;
|
|
43
|
+
declare const attachComponentDisposerApi: typeof attachComponentDisposer;
|
|
44
|
+
declare const configureComponentScopeApi: typeof configureComponentScope;
|
|
45
|
+
declare const getSlexKitInfoApi: typeof getSlexKitInfo;
|
|
46
|
+
export { SLEXKIT_VERSION, SLEX_PROTOCOL_VERSION, SLEXKIT_COMPONENTS_VERSION, getSlexKitInfoApi as getSlexKitInfo, mountApi as mount, ingestApi as ingest, bootApi as boot, disposeNamespaceApi as disposeNamespace, registerApi as register, getRendererApi as getRenderer, diagnoseSlexKitSourceApi as diagnoseSlexKitSource, SlexKitSyntaxErrorApi as SlexKitSyntaxError, formatSlexKitDiagnosticApi as formatSlexKitDiagnostic, mountSecureArtifactApi as mountSecureArtifact, parseSlexSourceApi as parseSlexSource, parseSlexKitDslApi as parseSlexKitDsl, createSecureRuntimeApi as createSecureRuntime, SlexKitRuntimeErrorApi as SlexKitRuntimeError, getSlexKitRuntimeUrlApi as getSlexKitRuntimeUrl, setSlexKitRuntimeUrlApi as setSlexKitRuntimeUrl, createSlexKitMarkdownRuntimeHostApi as createSlexKitMarkdownRuntimeHost, getSlexKitMarkdownRuntimeHostApi as getSlexKitMarkdownRuntimeHost, installSlexKitMarkdownRuntimeHostApi as installSlexKitMarkdownRuntimeHost, };
|
|
47
|
+
export type { BootOptions } from "./engine/index";
|
|
48
|
+
export type { SlexKitParseResult, SlexKitSourceDiagnostic } from "./engine/index";
|
|
49
|
+
export type { SlexKitRuntimeApi, HostFetchRequest, HostRuntimeAdapter, HostRuntimePolicy, NetworkOptions, NetworkResult, RafId, RuntimeCanvasContext, RuntimeCanvasContextId, RuntimeErrorEvent, RuntimeErrorKind, RuntimeNetworkLogEvent, SandboxSlotSizeMessage, SandboxSlotsMessage, SandboxFetchRequestMessage, SandboxFetchResponseMessage, SandboxHostMessage, SandboxMountMessage, SandboxRunnerMessage, SandboxStatusMessage, SecureFrameOptions, SecureArtifactSlot, SecureMountOptions, SecureRuntimeHandle, SerializedRuntimeError, TimerId, } from "./engine/index";
|
|
50
|
+
export type { SlexKitMarkdownBlock, SlexKitMarkdownRuntimeHost, SlexKitMarkdownRuntimeMode, SlexKitMarkdownRuntimeOptions, } from "./engine/index";
|
|
51
|
+
export type { ComponentRenderer, RenderContext, SlexExpression, DSL } from "./engine/types";
|
|
52
|
+
export { registerAllApi as registerAll, registerSvelteComponentApi as registerSvelteComponent, registerSubsetApi as registerSubset, };
|
|
53
|
+
export { renderToolCallApi as renderToolCall, registerToolTemplateApi as registerToolTemplate };
|
|
54
|
+
export { startSlexKitSandboxRunnerApi as startSlexKitSandboxRunner };
|
|
55
|
+
export { clearRegisteredIconsApi as clearRegisteredIcons, getIconApi as getIcon, getRegisteredIconApi as getRegisteredIcon, iconifySvgUrlApi as iconifySvgUrl, loadIconApi as loadIcon, normalizeIconNameApi as normalizeIconName, registerIconApi as registerIcon, registerIconsApi as registerIcons, resolveIconifyIconApi as resolveIconifyIcon, resolveIconWeightApi as resolveIconWeight, };
|
|
56
|
+
export { attachComponentDisposerApi as attachComponentDisposer, configureComponentScopeApi as configureComponentScope, };
|
|
57
|
+
export type { IconState, IconWeight, RegisterIconOptions } from "./icons/manager";
|
|
58
|
+
export { componentSpecs, getComponentSpec, getLocalizedComponentSpec, hashSpecText, localizeComponentSpec, localizeComponentSpecs, publicComponentTypes, } from "./components/spec-registry";
|
|
59
|
+
export type { ChildrenSpec, ComponentDocsSpec, ComponentExampleSpec, ComponentSpec, ComponentSpecCategory, ComponentSpecLocaleEntry, ComponentSpecLocaleOverlay, ComponentSpecStatus, LocalizedComponentSpec, LocalizedChildrenSpec, LocalizedPropSpec, LocalizedText, PropSpec, } from "./components/spec-schema";
|
|
60
|
+
export type { ChooseOptionsArguments, ConfirmActionArguments, FillFormArguments, FormField, FormFieldType, ToolCall, ToolRenderHandle, ToolResult, ToolResultStatus, ToolRuntime, ToolTemplateCompiler, OptionListArguments, OptionListItem, } from "./toolhost/index";
|
|
61
|
+
import "./components/index";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { mount, ingest, boot, disposeNamespace, register, getRenderer, diagnoseSlexKitSource, SlexKitSyntaxError, formatSlexKitDiagnostic, mountSecureArtifact, parseSlexSource, createSecureRuntime, SlexKitRuntimeError, getSlexKitRuntimeUrl, setSlexKitRuntimeUrl, createSlexKitMarkdownRuntimeHost, getSlexKitMarkdownRuntimeHost, installSlexKitMarkdownRuntimeHost } from "./engine/index";
|
|
2
|
+
import { attachComponentDisposer, configureComponentScope } from "./engine/component-scope";
|
|
3
|
+
import { startSlexKitSandboxRunner } from "./engine/sandbox-runner";
|
|
4
|
+
import { getSlexKitInfo, SLEXKIT_COMPONENTS_VERSION, SLEXKIT_VERSION, SLEX_PROTOCOL_VERSION } from "./version";
|
|
5
|
+
export type { BootOptions } from "./engine/index";
|
|
6
|
+
export type { SlexKitParseResult, SlexKitSourceDiagnostic } from "./engine/index";
|
|
7
|
+
export type { ComponentRenderer, ComponentRegistrationOptions, ComponentStateMode, RenderContext, SlexExpression, DSL, SlexKitRuntimeApi, HostFetchRequest, HostRuntimeAdapter, HostRuntimePolicy, NetworkOptions, NetworkResult, RafId, RuntimeCanvasContext, RuntimeCanvasContextId, RuntimeErrorEvent, RuntimeErrorKind, RuntimeNetworkLogEvent, SandboxSlotSizeMessage, SandboxSlotsMessage, SandboxFetchRequestMessage, SandboxFetchResponseMessage, SandboxHostMessage, SandboxMountMessage, SandboxRunnerMessage, SandboxStatusMessage, SecureFrameOptions, SecureArtifactSlot, SecureMountOptions, SecureRuntimeHandle, SerializedRuntimeError, TimerId, } from "./engine/index";
|
|
8
|
+
export type { SlexKitMarkdownBlock, SlexKitMarkdownRuntimeHost, SlexKitMarkdownRuntimeMode, SlexKitMarkdownRuntimeOptions, } from "./engine/index";
|
|
9
|
+
declare const mountApi: typeof mount;
|
|
10
|
+
declare const ingestApi: typeof ingest;
|
|
11
|
+
declare const bootApi: typeof boot;
|
|
12
|
+
declare const disposeNamespaceApi: typeof disposeNamespace;
|
|
13
|
+
declare const registerApi: typeof register;
|
|
14
|
+
declare const getRendererApi: typeof getRenderer;
|
|
15
|
+
declare const diagnoseSlexKitSourceApi: typeof diagnoseSlexKitSource;
|
|
16
|
+
declare const SlexKitSyntaxErrorApi: typeof SlexKitSyntaxError;
|
|
17
|
+
declare const formatSlexKitDiagnosticApi: typeof formatSlexKitDiagnostic;
|
|
18
|
+
declare const mountSecureArtifactApi: typeof mountSecureArtifact;
|
|
19
|
+
declare const parseSlexSourceApi: typeof parseSlexSource;
|
|
20
|
+
declare const parseSlexKitDslApi: typeof parseSlexSource;
|
|
21
|
+
declare const createSecureRuntimeApi: typeof createSecureRuntime;
|
|
22
|
+
declare const SlexKitRuntimeErrorApi: typeof SlexKitRuntimeError;
|
|
23
|
+
declare const getSlexKitRuntimeUrlApi: typeof getSlexKitRuntimeUrl;
|
|
24
|
+
declare const setSlexKitRuntimeUrlApi: typeof setSlexKitRuntimeUrl;
|
|
25
|
+
declare const createSlexKitMarkdownRuntimeHostApi: typeof createSlexKitMarkdownRuntimeHost;
|
|
26
|
+
declare const getSlexKitMarkdownRuntimeHostApi: typeof getSlexKitMarkdownRuntimeHost;
|
|
27
|
+
declare const installSlexKitMarkdownRuntimeHostApi: typeof installSlexKitMarkdownRuntimeHost;
|
|
28
|
+
declare const attachComponentDisposerApi: typeof attachComponentDisposer;
|
|
29
|
+
declare const configureComponentScopeApi: typeof configureComponentScope;
|
|
30
|
+
declare const startSlexKitSandboxRunnerApi: typeof startSlexKitSandboxRunner;
|
|
31
|
+
declare const getSlexKitInfoApi: typeof getSlexKitInfo;
|
|
32
|
+
export { SLEXKIT_VERSION, SLEX_PROTOCOL_VERSION, SLEXKIT_COMPONENTS_VERSION, getSlexKitInfoApi as getSlexKitInfo, mountApi as mount, ingestApi as ingest, bootApi as boot, disposeNamespaceApi as disposeNamespace, registerApi as register, getRendererApi as getRenderer, diagnoseSlexKitSourceApi as diagnoseSlexKitSource, SlexKitSyntaxErrorApi as SlexKitSyntaxError, formatSlexKitDiagnosticApi as formatSlexKitDiagnostic, mountSecureArtifactApi as mountSecureArtifact, parseSlexSourceApi as parseSlexSource, parseSlexKitDslApi as parseSlexKitDsl, createSecureRuntimeApi as createSecureRuntime, SlexKitRuntimeErrorApi as SlexKitRuntimeError, getSlexKitRuntimeUrlApi as getSlexKitRuntimeUrl, setSlexKitRuntimeUrlApi as setSlexKitRuntimeUrl, createSlexKitMarkdownRuntimeHostApi as createSlexKitMarkdownRuntimeHost, getSlexKitMarkdownRuntimeHostApi as getSlexKitMarkdownRuntimeHost, installSlexKitMarkdownRuntimeHostApi as installSlexKitMarkdownRuntimeHost, attachComponentDisposerApi as attachComponentDisposer, configureComponentScopeApi as configureComponentScope, startSlexKitSandboxRunnerApi as startSlexKitSandboxRunner, };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { SlexExpression } from "../engine/types";
|
|
2
|
+
export type ToolCall = {
|
|
3
|
+
id?: string;
|
|
4
|
+
name: string;
|
|
5
|
+
arguments?: Record<string, unknown>;
|
|
6
|
+
};
|
|
7
|
+
export type ToolResultStatus = "submitted" | "ignored";
|
|
8
|
+
export type ToolResult = {
|
|
9
|
+
toolCallId?: string;
|
|
10
|
+
toolName: string;
|
|
11
|
+
status: ToolResultStatus;
|
|
12
|
+
value: Record<string, unknown> | null;
|
|
13
|
+
};
|
|
14
|
+
export type ToolRenderHandle = {
|
|
15
|
+
promise: Promise<ToolResult>;
|
|
16
|
+
dispose: () => void;
|
|
17
|
+
};
|
|
18
|
+
export type ToolRuntime = {
|
|
19
|
+
submit: (value: Record<string, unknown>) => void;
|
|
20
|
+
ignore: () => void;
|
|
21
|
+
};
|
|
22
|
+
export type ToolTemplateCompiler<TArgs extends Record<string, unknown> = Record<string, unknown>> = (args: TArgs, runtime: ToolRuntime, call: ToolCall) => SlexExpression;
|
|
23
|
+
export type OptionListItem = {
|
|
24
|
+
id?: string;
|
|
25
|
+
value?: string;
|
|
26
|
+
label: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
selected?: boolean;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
};
|
|
31
|
+
export type ChooseOptionsArguments = {
|
|
32
|
+
title?: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
options?: OptionListItem[];
|
|
35
|
+
items?: OptionListItem[];
|
|
36
|
+
multiple?: boolean;
|
|
37
|
+
selected?: string[];
|
|
38
|
+
minSelected?: number;
|
|
39
|
+
maxSelected?: number;
|
|
40
|
+
submitLabel?: string;
|
|
41
|
+
ignoreLabel?: string;
|
|
42
|
+
};
|
|
43
|
+
export type OptionListArguments = ChooseOptionsArguments;
|
|
44
|
+
export type ConfirmActionArguments = {
|
|
45
|
+
title?: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
confirmLabel?: string;
|
|
48
|
+
ignoreLabel?: string;
|
|
49
|
+
requireReason?: boolean;
|
|
50
|
+
reasonLabel?: string;
|
|
51
|
+
reasonPlaceholder?: string;
|
|
52
|
+
};
|
|
53
|
+
export type FormFieldType = "text" | "number" | "engineering" | "select" | "checkbox" | "switch";
|
|
54
|
+
export type FormField = {
|
|
55
|
+
name: string;
|
|
56
|
+
label?: string;
|
|
57
|
+
type?: FormFieldType;
|
|
58
|
+
description?: string;
|
|
59
|
+
placeholder?: string;
|
|
60
|
+
required?: boolean;
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
value?: unknown;
|
|
63
|
+
options?: Array<{
|
|
64
|
+
label: string;
|
|
65
|
+
value: string;
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
}>;
|
|
68
|
+
};
|
|
69
|
+
export type FillFormArguments = {
|
|
70
|
+
title?: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
fields?: FormField[];
|
|
73
|
+
values?: Record<string, unknown>;
|
|
74
|
+
submitLabel?: string;
|
|
75
|
+
ignoreLabel?: string;
|
|
76
|
+
};
|
|
77
|
+
export declare function registerToolTemplate(name: string, compiler: ToolTemplateCompiler): void;
|
|
78
|
+
export declare function renderToolCall(call: ToolCall, container: HTMLElement): ToolRenderHandle;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { mount, ingest, boot, disposeNamespace, register, getRenderer, diagnoseSlexKitSource, SlexKitSyntaxError, formatSlexKitDiagnostic, mountSecureArtifact, parseSlexSource, createSecureRuntime, SlexKitRuntimeError, getSlexKitRuntimeUrl, setSlexKitRuntimeUrl, createSlexKitMarkdownRuntimeHost, getSlexKitMarkdownRuntimeHost, installSlexKitMarkdownRuntimeHost } from "./engine/index";
|
|
2
|
+
import { registerAll, registerSvelteComponent, registerSubset } from "./components/index";
|
|
3
|
+
import { registerTooling } from "./components/tooling";
|
|
4
|
+
import { renderToolCall, registerToolTemplate } from "./toolhost/index";
|
|
5
|
+
import { startSlexKitSandboxRunner } from "./engine/sandbox-runner";
|
|
6
|
+
import { clearRegisteredIcons, getIcon, getRegisteredIcon, iconifySvgUrl, loadIcon, normalizeIconName, registerIcon, registerIcons, resolveIconifyIcon, resolveIconWeight } from "./icons/manager";
|
|
7
|
+
import { attachComponentDisposer } from "./engine/component-scope";
|
|
8
|
+
import "./components/index";
|
|
9
|
+
import "./components/tooling";
|
|
10
|
+
declare const mountApi: typeof mount;
|
|
11
|
+
declare const ingestApi: typeof ingest;
|
|
12
|
+
declare const bootApi: typeof boot;
|
|
13
|
+
declare const disposeNamespaceApi: typeof disposeNamespace;
|
|
14
|
+
declare const registerApi: typeof register;
|
|
15
|
+
declare const getRendererApi: typeof getRenderer;
|
|
16
|
+
declare const diagnoseSlexKitSourceApi: typeof diagnoseSlexKitSource;
|
|
17
|
+
declare const SlexKitSyntaxErrorApi: typeof SlexKitSyntaxError;
|
|
18
|
+
declare const formatSlexKitDiagnosticApi: typeof formatSlexKitDiagnostic;
|
|
19
|
+
declare const mountSecureArtifactApi: typeof mountSecureArtifact;
|
|
20
|
+
declare const parseSlexSourceApi: typeof parseSlexSource;
|
|
21
|
+
declare const parseSlexKitDslApi: typeof parseSlexSource;
|
|
22
|
+
declare const createSecureRuntimeApi: typeof createSecureRuntime;
|
|
23
|
+
declare const SlexKitRuntimeErrorApi: typeof SlexKitRuntimeError;
|
|
24
|
+
declare const getSlexKitRuntimeUrlApi: typeof getSlexKitRuntimeUrl;
|
|
25
|
+
declare const setSlexKitRuntimeUrlApi: typeof setSlexKitRuntimeUrl;
|
|
26
|
+
declare const createSlexKitMarkdownRuntimeHostApi: typeof createSlexKitMarkdownRuntimeHost;
|
|
27
|
+
declare const getSlexKitMarkdownRuntimeHostApi: typeof getSlexKitMarkdownRuntimeHost;
|
|
28
|
+
declare const installSlexKitMarkdownRuntimeHostApi: typeof installSlexKitMarkdownRuntimeHost;
|
|
29
|
+
declare const registerAllApi: typeof registerAll;
|
|
30
|
+
declare const registerSvelteComponentApi: typeof registerSvelteComponent;
|
|
31
|
+
declare const registerSubsetApi: typeof registerSubset;
|
|
32
|
+
declare const registerToolingApi: typeof registerTooling;
|
|
33
|
+
declare const renderToolCallApi: typeof renderToolCall;
|
|
34
|
+
declare const registerToolTemplateApi: typeof registerToolTemplate;
|
|
35
|
+
declare const startSlexKitSandboxRunnerApi: typeof startSlexKitSandboxRunner;
|
|
36
|
+
declare const clearRegisteredIconsApi: typeof clearRegisteredIcons;
|
|
37
|
+
declare const getIconApi: typeof getIcon;
|
|
38
|
+
declare const getRegisteredIconApi: typeof getRegisteredIcon;
|
|
39
|
+
declare const iconifySvgUrlApi: typeof iconifySvgUrl;
|
|
40
|
+
declare const loadIconApi: typeof loadIcon;
|
|
41
|
+
declare const normalizeIconNameApi: typeof normalizeIconName;
|
|
42
|
+
declare const registerIconApi: typeof registerIcon;
|
|
43
|
+
declare const registerIconsApi: typeof registerIcons;
|
|
44
|
+
declare const resolveIconifyIconApi: typeof resolveIconifyIcon;
|
|
45
|
+
declare const resolveIconWeightApi: typeof resolveIconWeight;
|
|
46
|
+
declare const attachComponentDisposerApi: typeof attachComponentDisposer;
|
|
47
|
+
export { mountApi as mount, ingestApi as ingest, bootApi as boot, disposeNamespaceApi as disposeNamespace, registerApi as register, getRendererApi as getRenderer, diagnoseSlexKitSourceApi as diagnoseSlexKitSource, SlexKitSyntaxErrorApi as SlexKitSyntaxError, formatSlexKitDiagnosticApi as formatSlexKitDiagnostic, mountSecureArtifactApi as mountSecureArtifact, parseSlexSourceApi as parseSlexSource, parseSlexKitDslApi as parseSlexKitDsl, createSecureRuntimeApi as createSecureRuntime, SlexKitRuntimeErrorApi as SlexKitRuntimeError, getSlexKitRuntimeUrlApi as getSlexKitRuntimeUrl, setSlexKitRuntimeUrlApi as setSlexKitRuntimeUrl, createSlexKitMarkdownRuntimeHostApi as createSlexKitMarkdownRuntimeHost, getSlexKitMarkdownRuntimeHostApi as getSlexKitMarkdownRuntimeHost, installSlexKitMarkdownRuntimeHostApi as installSlexKitMarkdownRuntimeHost, registerAllApi as registerAll, registerSvelteComponentApi as registerSvelteComponent, registerSubsetApi as registerSubset, registerToolingApi as registerTooling, renderToolCallApi as renderToolCall, registerToolTemplateApi as registerToolTemplate, startSlexKitSandboxRunnerApi as startSlexKitSandboxRunner, clearRegisteredIconsApi as clearRegisteredIcons, getIconApi as getIcon, getRegisteredIconApi as getRegisteredIcon, iconifySvgUrlApi as iconifySvgUrl, loadIconApi as loadIcon, normalizeIconNameApi as normalizeIconName, registerIconApi as registerIcon, registerIconsApi as registerIcons, resolveIconifyIconApi as resolveIconifyIcon, resolveIconWeightApi as resolveIconWeight, attachComponentDisposerApi as attachComponentDisposer, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const SLEXKIT_VERSION = "0.2.0";
|
|
2
|
+
export declare const SLEX_PROTOCOL_VERSION = "0.1";
|
|
3
|
+
export declare const SLEXKIT_COMPONENTS_VERSION = "0.2.0";
|
|
4
|
+
export declare function getSlexKitInfo(): {
|
|
5
|
+
version: string;
|
|
6
|
+
protocolVersion: string;
|
|
7
|
+
componentsVersion: string;
|
|
8
|
+
};
|