@kubuild/ai 0.8.0 → 0.8.2
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/{chunk-3DRAVYU3.js → chunk-BNGDJQ73.js} +2 -2
- package/dist/chunk-BNGDJQ73.js.map +1 -0
- package/dist/{chunk-CCV6S4YN.js → chunk-I7HYQEMW.js} +1 -1
- package/dist/chunk-I7HYQEMW.js.map +1 -0
- package/dist/{chunk-ILLNRABB.js → chunk-LBSLMWKD.js} +1 -1
- package/dist/chunk-LBSLMWKD.js.map +1 -0
- package/dist/{chunk-ORA6BS4P.js → chunk-WDLMKCLQ.js} +1 -1
- package/dist/chunk-WDLMKCLQ.js.map +1 -0
- package/dist/client/ai-client.d.cts +85 -0
- package/dist/client/ai-client.d.cts.map +1 -0
- package/dist/client/ai-client.d.ts +1 -1
- package/dist/client/ai-client.d.ts.map +1 -1
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +2 -0
- package/dist/client/index.d.cts.map +1 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/core/document-outline.d.cts +60 -0
- package/dist/core/document-outline.d.cts.map +1 -0
- package/dist/core/index.d.cts +5 -0
- package/dist/core/index.d.cts.map +1 -0
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/messages.d.cts +18 -0
- package/dist/core/messages.d.cts.map +1 -0
- package/dist/core/messages.d.ts +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/normalizer.d.cts +9 -0
- package/dist/core/normalizer.d.cts.map +1 -0
- package/dist/core/prompt-compiler.d.cts +50 -0
- package/dist/core/prompt-compiler.d.cts.map +1 -0
- package/dist/core/prompt-compiler.d.ts +1 -1
- package/dist/core/prompt-compiler.d.ts.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +4 -0
- package/dist/react/index.d.cts.map +1 -0
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/use-ai-agent.d.cts +52 -0
- package/dist/react/use-ai-agent.d.cts.map +1 -0
- package/dist/react/use-ai-agent.d.ts +2 -2
- package/dist/react/use-ai-agent.d.ts.map +1 -1
- package/dist/react/use-ai-chat.d.cts +69 -0
- package/dist/react/use-ai-chat.d.cts.map +1 -0
- package/dist/react/use-ai-chat.d.ts +2 -2
- package/dist/react/use-ai-chat.d.ts.map +1 -1
- package/dist/react/use-ai-generator.d.cts +20 -0
- package/dist/react/use-ai-generator.d.cts.map +1 -0
- package/dist/react/use-ai-generator.d.ts +2 -2
- package/dist/react/use-ai-generator.d.ts.map +1 -1
- package/dist/server/adapters/anthropic.d.cts +30 -0
- package/dist/server/adapters/anthropic.d.cts.map +1 -0
- package/dist/server/adapters/anthropic.d.ts +1 -1
- package/dist/server/adapters/anthropic.d.ts.map +1 -1
- package/dist/server/adapters/base.d.cts +2 -0
- package/dist/server/adapters/base.d.cts.map +1 -0
- package/dist/server/adapters/base.d.ts +1 -1
- package/dist/server/adapters/base.d.ts.map +1 -1
- package/dist/server/adapters/custom.d.cts +18 -0
- package/dist/server/adapters/custom.d.cts.map +1 -0
- package/dist/server/adapters/custom.d.ts +1 -1
- package/dist/server/adapters/custom.d.ts.map +1 -1
- package/dist/server/adapters/gemini.d.cts +22 -0
- package/dist/server/adapters/gemini.d.cts.map +1 -0
- package/dist/server/adapters/gemini.d.ts +1 -1
- package/dist/server/adapters/gemini.d.ts.map +1 -1
- package/dist/server/adapters/index.cjs.map +1 -1
- package/dist/server/adapters/index.d.cts +6 -0
- package/dist/server/adapters/index.d.cts.map +1 -0
- package/dist/server/adapters/index.d.ts +5 -5
- package/dist/server/adapters/index.d.ts.map +1 -1
- package/dist/server/adapters/index.js +2 -2
- package/dist/server/adapters/openai.d.cts +51 -0
- package/dist/server/adapters/openai.d.cts.map +1 -0
- package/dist/server/adapters/openai.d.ts +1 -1
- package/dist/server/adapters/openai.d.ts.map +1 -1
- package/dist/server/adapters/stream-utils.d.cts +12 -0
- package/dist/server/adapters/stream-utils.d.cts.map +1 -0
- package/dist/server/agent.d.cts +59 -0
- package/dist/server/agent.d.cts.map +1 -0
- package/dist/server/agent.d.ts +3 -3
- package/dist/server/agent.d.ts.map +1 -1
- package/dist/server/engine.d.cts +69 -0
- package/dist/server/engine.d.cts.map +1 -0
- package/dist/server/engine.d.ts +1 -1
- package/dist/server/engine.d.ts.map +1 -1
- package/dist/server/handler.d.cts +111 -0
- package/dist/server/handler.d.cts.map +1 -0
- package/dist/server/handler.d.ts +3 -3
- package/dist/server/handler.d.ts.map +1 -1
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +6 -0
- package/dist/server/index.d.cts.map +1 -0
- package/dist/server/index.d.ts +5 -5
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +3 -3
- package/dist/server/index.js.map +1 -1
- package/dist/server/tools/helpers.d.cts +66 -0
- package/dist/server/tools/helpers.d.cts.map +1 -0
- package/dist/server/tools/helpers.d.ts +2 -2
- package/dist/server/tools/helpers.d.ts.map +1 -1
- package/dist/server/tools/index.d.cts +25 -0
- package/dist/server/tools/index.d.cts.map +1 -0
- package/dist/server/tools/index.d.ts +6 -6
- package/dist/server/tools/index.d.ts.map +1 -1
- package/dist/server/tools/read-tools.d.cts +3 -0
- package/dist/server/tools/read-tools.d.cts.map +1 -0
- package/dist/server/tools/read-tools.d.ts +1 -1
- package/dist/server/tools/read-tools.d.ts.map +1 -1
- package/dist/server/tools/types.d.cts +51 -0
- package/dist/server/tools/types.d.cts.map +1 -0
- package/dist/server/tools/types.d.ts +1 -1
- package/dist/server/tools/types.d.ts.map +1 -1
- package/dist/server/tools/write-tools.d.cts +3 -0
- package/dist/server/tools/write-tools.d.cts.map +1 -0
- package/dist/server/tools/write-tools.d.ts +1 -1
- package/dist/server/tools/write-tools.d.ts.map +1 -1
- package/dist/types.d.cts +463 -0
- package/dist/types.d.cts.map +1 -0
- package/package.json +49 -24
- package/dist/chunk-3DRAVYU3.js.map +0 -1
- package/dist/chunk-CCV6S4YN.js.map +0 -1
- package/dist/chunk-ILLNRABB.js.map +0 -1
- package/dist/chunk-ORA6BS4P.js.map +0 -1
package/dist/types.d.cts
ADDED
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
import type { Node, PageDocument, DocumentMetadata } from '@kubuild/schema';
|
|
2
|
+
import type { DocumentSecurityLimits } from '@kubuild/core';
|
|
3
|
+
export type AiGenerationMode = 'full-page' | 'section' | 'refactor' | 'chat' | 'agent' | 'plan';
|
|
4
|
+
/** Plain text content block. */
|
|
5
|
+
export interface AiTextBlock {
|
|
6
|
+
type: 'text';
|
|
7
|
+
text: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A tool invocation requested by the model (STORA-530). Provider-agnostic shape: the
|
|
11
|
+
* OpenAI adapter maps this to `assistant.tool_calls`, Anthropic to a `tool_use` block.
|
|
12
|
+
*/
|
|
13
|
+
export interface AiToolUseBlock {
|
|
14
|
+
type: 'tool_use';
|
|
15
|
+
/** Provider-issued call id — echoed back on the matching `tool_result`. */
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
input: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
/** The host's answer to an `AiToolUseBlock`, fed back into the next model turn. */
|
|
21
|
+
export interface AiToolResultBlock {
|
|
22
|
+
type: 'tool_result';
|
|
23
|
+
/** Must match the `id` of the `tool_use` block being answered. */
|
|
24
|
+
toolUseId: string;
|
|
25
|
+
/** Serialized result payload (JSON string for structured results). */
|
|
26
|
+
content: string;
|
|
27
|
+
/** True when the tool failed — the model is expected to self-correct and retry. */
|
|
28
|
+
isError?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export type AiContentBlock = AiTextBlock | AiToolUseBlock | AiToolResultBlock;
|
|
31
|
+
export interface AiChatMessage {
|
|
32
|
+
role: 'user' | 'assistant' | 'system';
|
|
33
|
+
/**
|
|
34
|
+
* Either a plain string (every pre-STORA-530 call site) or a list of content blocks
|
|
35
|
+
* carrying tool calls/results. Adapters that don't support tool calling only ever see
|
|
36
|
+
* the string form, since `tools` is never passed to them.
|
|
37
|
+
*/
|
|
38
|
+
content: string | AiContentBlock[];
|
|
39
|
+
timestamp?: number;
|
|
40
|
+
}
|
|
41
|
+
export interface AiChatRequest {
|
|
42
|
+
messages: AiChatMessage[];
|
|
43
|
+
currentDocument?: PageDocument;
|
|
44
|
+
selectedNodeId?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Extra host/user instructions, appended AFTER the built-in system prompt (never
|
|
47
|
+
* replacing it — the base prompt carries the output-format, safety and tool rules).
|
|
48
|
+
* Over HTTP, `createAiHandler` caps its length and can disable it entirely
|
|
49
|
+
* (`allowClientInstructions` / `maxClientInstructionsLength`).
|
|
50
|
+
*/
|
|
51
|
+
instructions?: string;
|
|
52
|
+
/** @deprecated Alias of `instructions` — appended, never a replacement for the base prompt. */
|
|
53
|
+
systemPrompt?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface AiChatResponse {
|
|
56
|
+
message: AiChatMessage;
|
|
57
|
+
}
|
|
58
|
+
export interface PlannedSection {
|
|
59
|
+
type: string;
|
|
60
|
+
title: string;
|
|
61
|
+
prompt: string;
|
|
62
|
+
}
|
|
63
|
+
export interface PagePlan {
|
|
64
|
+
title?: string;
|
|
65
|
+
description?: string;
|
|
66
|
+
pageStyles?: Node['styles'];
|
|
67
|
+
sections?: PlannedSection[];
|
|
68
|
+
/**
|
|
69
|
+
* `true` when the model's plan could not be parsed and the engine substituted its
|
|
70
|
+
* generic default plan (hero/features/testimonials/cta/footer). The plan is still
|
|
71
|
+
* usable, but hosts should tell the user it is not tailored to their prompt.
|
|
72
|
+
*/
|
|
73
|
+
usedFallback?: boolean;
|
|
74
|
+
}
|
|
75
|
+
export interface AiPlanPageRequest {
|
|
76
|
+
prompt: string;
|
|
77
|
+
stylePreference?: string;
|
|
78
|
+
tone?: string;
|
|
79
|
+
locale?: string;
|
|
80
|
+
sectionCount?: number | {
|
|
81
|
+
min?: number;
|
|
82
|
+
max?: number;
|
|
83
|
+
};
|
|
84
|
+
conversationHistory?: AiChatMessage[];
|
|
85
|
+
/**
|
|
86
|
+
* Extra host/user instructions, appended AFTER the built-in system prompt (never
|
|
87
|
+
* replacing it — the base prompt carries the output-format, safety and tool rules).
|
|
88
|
+
* Over HTTP, `createAiHandler` caps its length and can disable it entirely
|
|
89
|
+
* (`allowClientInstructions` / `maxClientInstructionsLength`).
|
|
90
|
+
*/
|
|
91
|
+
instructions?: string;
|
|
92
|
+
}
|
|
93
|
+
export interface AiGeneratePageRequest {
|
|
94
|
+
prompt: string;
|
|
95
|
+
stylePreference?: string;
|
|
96
|
+
tone?: string;
|
|
97
|
+
locale?: string;
|
|
98
|
+
metadata?: Partial<DocumentMetadata>;
|
|
99
|
+
stream?: boolean;
|
|
100
|
+
/** Prior conversation history from chat mode so generator keeps full context. */
|
|
101
|
+
conversationHistory?: AiChatMessage[];
|
|
102
|
+
/** Desired number of sections or range. */
|
|
103
|
+
sectionCount?: number | {
|
|
104
|
+
min?: number;
|
|
105
|
+
max?: number;
|
|
106
|
+
};
|
|
107
|
+
/** Pre-confirmed plan to generate directly without re-planning. */
|
|
108
|
+
plan?: PagePlan;
|
|
109
|
+
/**
|
|
110
|
+
* Extra host/user instructions, appended AFTER the built-in system prompt (never
|
|
111
|
+
* replacing it — the base prompt carries the output-format, safety and tool rules).
|
|
112
|
+
* Over HTTP, `createAiHandler` caps its length and can disable it entirely
|
|
113
|
+
* (`allowClientInstructions` / `maxClientInstructionsLength`).
|
|
114
|
+
*/
|
|
115
|
+
instructions?: string;
|
|
116
|
+
}
|
|
117
|
+
export interface AiGenerateSectionRequest {
|
|
118
|
+
prompt: string;
|
|
119
|
+
stylePreference?: string;
|
|
120
|
+
targetSectionType?: string;
|
|
121
|
+
parentContext?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Extra host/user instructions, appended AFTER the built-in system prompt (never
|
|
124
|
+
* replacing it — the base prompt carries the output-format, safety and tool rules).
|
|
125
|
+
* Over HTTP, `createAiHandler` caps its length and can disable it entirely
|
|
126
|
+
* (`allowClientInstructions` / `maxClientInstructionsLength`).
|
|
127
|
+
*/
|
|
128
|
+
instructions?: string;
|
|
129
|
+
}
|
|
130
|
+
export interface AiRefactorNodeRequest {
|
|
131
|
+
node: Node;
|
|
132
|
+
instruction: string;
|
|
133
|
+
stylePreference?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Extra host/user instructions, appended AFTER the built-in system prompt (never
|
|
136
|
+
* replacing it — the base prompt carries the output-format, safety and tool rules).
|
|
137
|
+
* Over HTTP, `createAiHandler` caps its length and can disable it entirely
|
|
138
|
+
* (`allowClientInstructions` / `maxClientInstructionsLength`).
|
|
139
|
+
*/
|
|
140
|
+
instructions?: string;
|
|
141
|
+
}
|
|
142
|
+
export type AiStreamEvent = {
|
|
143
|
+
type: 'status';
|
|
144
|
+
message: string;
|
|
145
|
+
} | {
|
|
146
|
+
type: 'metadata';
|
|
147
|
+
metadata: DocumentMetadata;
|
|
148
|
+
rootPageNode: Node;
|
|
149
|
+
} | {
|
|
150
|
+
type: 'section';
|
|
151
|
+
index: number;
|
|
152
|
+
total: number;
|
|
153
|
+
section: Node;
|
|
154
|
+
} | {
|
|
155
|
+
type: 'complete';
|
|
156
|
+
document: PageDocument;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Token-level chat streaming (STORA-515). `delta` is the newly-arrived text fragment,
|
|
160
|
+
* `content` is the full accumulated assistant message so far — consumers that only
|
|
161
|
+
* care about the running text (e.g. rendering a live-updating bubble) can just use
|
|
162
|
+
* `content` and ignore `delta`.
|
|
163
|
+
*/
|
|
164
|
+
| {
|
|
165
|
+
type: 'chat-chunk';
|
|
166
|
+
delta: string;
|
|
167
|
+
content: string;
|
|
168
|
+
}
|
|
169
|
+
/** Terminal event for a chat stream — mirrors `complete` for `streamPage`. */
|
|
170
|
+
| {
|
|
171
|
+
type: 'chat-complete';
|
|
172
|
+
message: AiChatMessage;
|
|
173
|
+
}
|
|
174
|
+
/** Agent mode (STORA-530): a new reasoning step has begun. */
|
|
175
|
+
| {
|
|
176
|
+
type: 'agent-step';
|
|
177
|
+
step: number;
|
|
178
|
+
maxSteps: number;
|
|
179
|
+
}
|
|
180
|
+
/** Agent mode: the model asked to run a tool. */
|
|
181
|
+
| {
|
|
182
|
+
type: 'tool-call';
|
|
183
|
+
id: string;
|
|
184
|
+
name: string;
|
|
185
|
+
input: Record<string, unknown>;
|
|
186
|
+
}
|
|
187
|
+
/** Agent mode: the tool finished (or failed — the model then self-corrects). */
|
|
188
|
+
| {
|
|
189
|
+
type: 'tool-result';
|
|
190
|
+
id: string;
|
|
191
|
+
name: string;
|
|
192
|
+
ok: boolean;
|
|
193
|
+
summary: string;
|
|
194
|
+
}
|
|
195
|
+
/** Agent mode terminal event: the patch the client replays through the store. */
|
|
196
|
+
| {
|
|
197
|
+
type: 'agent-complete';
|
|
198
|
+
result: AiAgentRunResult;
|
|
199
|
+
} | {
|
|
200
|
+
type: 'error';
|
|
201
|
+
error: {
|
|
202
|
+
code: string;
|
|
203
|
+
message: string;
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
export interface AiStreamCallbacks {
|
|
207
|
+
onStatus?: (message: string) => void;
|
|
208
|
+
onMetadata?: (metadata: DocumentMetadata, rootPage: Node) => void;
|
|
209
|
+
onSection?: (section: Node, index: number, total: number) => void;
|
|
210
|
+
onComplete?: (document: PageDocument) => void;
|
|
211
|
+
/** Fired for every partial chunk of a streaming chat response (STORA-515/516). */
|
|
212
|
+
onChatChunk?: (delta: string, content: string) => void;
|
|
213
|
+
/** Fired once, when a streaming chat response has finished assembling. */
|
|
214
|
+
onChatComplete?: (message: AiChatMessage) => void;
|
|
215
|
+
/** Agent mode (STORA-530). */
|
|
216
|
+
onAgentStep?: (step: number, maxSteps: number) => void;
|
|
217
|
+
onToolCall?: (call: {
|
|
218
|
+
id: string;
|
|
219
|
+
name: string;
|
|
220
|
+
input: Record<string, unknown>;
|
|
221
|
+
}) => void;
|
|
222
|
+
onToolResult?: (result: {
|
|
223
|
+
id: string;
|
|
224
|
+
name: string;
|
|
225
|
+
ok: boolean;
|
|
226
|
+
summary: string;
|
|
227
|
+
}) => void;
|
|
228
|
+
onAgentComplete?: (result: AiAgentRunResult) => void;
|
|
229
|
+
onError?: (error: Error) => void;
|
|
230
|
+
}
|
|
231
|
+
export interface AiErrorDetail {
|
|
232
|
+
code: string;
|
|
233
|
+
message: string;
|
|
234
|
+
details?: unknown;
|
|
235
|
+
}
|
|
236
|
+
export interface AiGenerateResponse<T = PageDocument | Node> {
|
|
237
|
+
success: boolean;
|
|
238
|
+
data?: T;
|
|
239
|
+
error?: AiErrorDetail;
|
|
240
|
+
rawModelResponse?: string;
|
|
241
|
+
usage?: {
|
|
242
|
+
promptTokens?: number;
|
|
243
|
+
completionTokens?: number;
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* `true` when `success` is true but the engine had to substitute a default result
|
|
247
|
+
* (currently: `planPage` when the model's plan JSON could not be parsed).
|
|
248
|
+
*/
|
|
249
|
+
usedFallback?: boolean;
|
|
250
|
+
/** Non-fatal diagnostics for a successful response (e.g. `PLAN_FALLBACK`). */
|
|
251
|
+
warnings?: AiErrorDetail[];
|
|
252
|
+
}
|
|
253
|
+
export interface AiCompiledComponentProp {
|
|
254
|
+
name: string;
|
|
255
|
+
type: string;
|
|
256
|
+
defaultValue?: unknown;
|
|
257
|
+
options?: unknown[];
|
|
258
|
+
description?: string;
|
|
259
|
+
}
|
|
260
|
+
export interface AiCompiledComponentSpec {
|
|
261
|
+
type: string;
|
|
262
|
+
label: string;
|
|
263
|
+
category: string;
|
|
264
|
+
description?: string;
|
|
265
|
+
acceptsChildren: boolean;
|
|
266
|
+
allowedChildren?: string[];
|
|
267
|
+
disallowedParents?: string[];
|
|
268
|
+
defaultProps?: Record<string, unknown>;
|
|
269
|
+
props?: AiCompiledComponentProp[];
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* A tool the model may call (STORA-530). `inputSchema` is a JSON Schema object describing
|
|
273
|
+
* the tool's arguments — passed through verbatim to the provider (OpenAI
|
|
274
|
+
* `function.parameters`, Anthropic `input_schema`, Gemini `parameters`).
|
|
275
|
+
*/
|
|
276
|
+
export interface AiToolDefinition {
|
|
277
|
+
name: string;
|
|
278
|
+
description: string;
|
|
279
|
+
inputSchema: Record<string, unknown>;
|
|
280
|
+
}
|
|
281
|
+
export type AiToolChoice = 'auto' | 'none' | 'required' | {
|
|
282
|
+
name: string;
|
|
283
|
+
};
|
|
284
|
+
export interface AiProviderGenerateParams {
|
|
285
|
+
systemPrompt: string;
|
|
286
|
+
userPrompt: string;
|
|
287
|
+
messages?: AiChatMessage[];
|
|
288
|
+
jsonSchema?: Record<string, unknown>;
|
|
289
|
+
signal?: AbortSignal;
|
|
290
|
+
/**
|
|
291
|
+
* Tools the model may call this turn. Adapters that don't implement tool calling ignore
|
|
292
|
+
* this field entirely, so passing it can never break an older adapter — but the agent
|
|
293
|
+
* loop refuses to run against such an adapter (see `KubuildAiAgent`).
|
|
294
|
+
*/
|
|
295
|
+
tools?: AiToolDefinition[];
|
|
296
|
+
toolChoice?: AiToolChoice;
|
|
297
|
+
/** Overrides the adapter's configured sampling temperature for this call. */
|
|
298
|
+
temperature?: number;
|
|
299
|
+
}
|
|
300
|
+
/** Why the model stopped generating — drives the agent loop's continue/stop decision. */
|
|
301
|
+
export type AiStopReason = 'stop' | 'tool_calls' | 'length' | 'content_filter' | 'unknown';
|
|
302
|
+
export interface AiProviderGenerateResult {
|
|
303
|
+
text: string;
|
|
304
|
+
usage?: {
|
|
305
|
+
promptTokens?: number;
|
|
306
|
+
completionTokens?: number;
|
|
307
|
+
};
|
|
308
|
+
/**
|
|
309
|
+
* Tool invocations requested by the model. Non-empty only when `params.tools` was given
|
|
310
|
+
* and the adapter supports tool calling.
|
|
311
|
+
*/
|
|
312
|
+
toolCalls?: AiToolUseBlock[];
|
|
313
|
+
stopReason?: AiStopReason;
|
|
314
|
+
}
|
|
315
|
+
export interface AiProviderAdapter {
|
|
316
|
+
readonly name: string;
|
|
317
|
+
/**
|
|
318
|
+
* Whether this adapter forwards `params.tools` to its provider and parses tool calls
|
|
319
|
+
* back out (STORA-530). Adapters predating tool calling simply omit it, which reads as
|
|
320
|
+
* `false` — `KubuildAiAgent` refuses to start rather than silently running a tool-less
|
|
321
|
+
* loop that can never edit anything.
|
|
322
|
+
*/
|
|
323
|
+
readonly supportsTools?: boolean;
|
|
324
|
+
generate(params: AiProviderGenerateParams): Promise<AiProviderGenerateResult>;
|
|
325
|
+
/**
|
|
326
|
+
* Optional token-level streaming variant (STORA-515). Adapters whose provider API
|
|
327
|
+
* supports incremental streaming (OpenAI, Anthropic, Gemini) should implement this as
|
|
328
|
+
* an async generator that `yield`s each text delta as it arrives over the wire, and
|
|
329
|
+
* `return`s the final `AiProviderGenerateResult` (full text + usage, mirroring
|
|
330
|
+
* `generate`) once the stream ends.
|
|
331
|
+
*
|
|
332
|
+
* Adapters that omit this are treated by `KubuildAiEngine` as non-streaming-capable:
|
|
333
|
+
* the engine falls back to a single `generate()` call and emits the whole response as
|
|
334
|
+
* one chunk through the same streaming interface, so callers never need to branch on
|
|
335
|
+
* adapter capability themselves.
|
|
336
|
+
*/
|
|
337
|
+
generateStream?(params: AiProviderGenerateParams): AsyncGenerator<string, AiProviderGenerateResult, void>;
|
|
338
|
+
}
|
|
339
|
+
export interface ComponentDefinitionLike {
|
|
340
|
+
type: string;
|
|
341
|
+
label?: string;
|
|
342
|
+
category?: string;
|
|
343
|
+
description?: string;
|
|
344
|
+
acceptsChildren?: boolean;
|
|
345
|
+
allowedChildren?: string[];
|
|
346
|
+
disallowedParents?: string[];
|
|
347
|
+
defaultProps?: Record<string, unknown>;
|
|
348
|
+
propFields?: Array<{
|
|
349
|
+
name: string;
|
|
350
|
+
label?: string;
|
|
351
|
+
type?: string;
|
|
352
|
+
defaultValue?: unknown;
|
|
353
|
+
options?: Array<{
|
|
354
|
+
label: string;
|
|
355
|
+
value: unknown;
|
|
356
|
+
}>;
|
|
357
|
+
description?: string;
|
|
358
|
+
}>;
|
|
359
|
+
}
|
|
360
|
+
export interface ComponentRegistryLike {
|
|
361
|
+
list(): ComponentDefinitionLike[];
|
|
362
|
+
get?(type: string): ComponentDefinitionLike | undefined;
|
|
363
|
+
has?(type: string): boolean;
|
|
364
|
+
}
|
|
365
|
+
export interface KubuildAiEngineOptions {
|
|
366
|
+
registry?: ComponentRegistryLike;
|
|
367
|
+
adapter: AiProviderAdapter;
|
|
368
|
+
securityLimits?: DocumentSecurityLimits;
|
|
369
|
+
systemPromptPrefix?: string;
|
|
370
|
+
/** Agent loop step ceiling (STORA-530). Default: 8. */
|
|
371
|
+
maxAgentSteps?: number;
|
|
372
|
+
debug?: boolean;
|
|
373
|
+
logger?: (level: 'info' | 'warn' | 'error' | 'debug', message: string, meta?: unknown) => void;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* A single, surgical document mutation produced by an agent tool call. Deliberately
|
|
377
|
+
* mirrors the editor store's existing action surface (`updateNodeProps`,
|
|
378
|
+
* `updateNodeStyle`, `insertComponent`, `moveComponent`, `deleteComponent`,
|
|
379
|
+
* `duplicateComponent`, `replaceNodeSubtree`) so the client can replay a whole run
|
|
380
|
+
* through the exact same code path manual editing uses — and therefore inherit
|
|
381
|
+
* `DocumentHistoryManager` undo for free.
|
|
382
|
+
*
|
|
383
|
+
* The agent never returns a whole regenerated document; it returns a list of these.
|
|
384
|
+
*/
|
|
385
|
+
export type AgentOp = {
|
|
386
|
+
kind: 'update-props';
|
|
387
|
+
nodeId: string;
|
|
388
|
+
props: Record<string, unknown>;
|
|
389
|
+
merge: boolean;
|
|
390
|
+
} | {
|
|
391
|
+
kind: 'update-styles';
|
|
392
|
+
nodeId: string;
|
|
393
|
+
styles: Record<string, unknown>;
|
|
394
|
+
/** Set for a breakpoint layer write. Mutually exclusive with `state`. */
|
|
395
|
+
breakpoint?: 'base' | 'desktop' | 'tablet' | 'mobile';
|
|
396
|
+
/** Set for a pseudo-state layer write (e.g. ':hover'). Mutually exclusive with `breakpoint`. */
|
|
397
|
+
state?: string;
|
|
398
|
+
merge: boolean;
|
|
399
|
+
} | {
|
|
400
|
+
kind: 'insert-node';
|
|
401
|
+
parentId: string;
|
|
402
|
+
index?: number;
|
|
403
|
+
node: Node;
|
|
404
|
+
} | {
|
|
405
|
+
kind: 'move-node';
|
|
406
|
+
nodeId: string;
|
|
407
|
+
targetParentId: string;
|
|
408
|
+
index?: number;
|
|
409
|
+
} | {
|
|
410
|
+
kind: 'delete-node';
|
|
411
|
+
nodeId: string;
|
|
412
|
+
} | {
|
|
413
|
+
kind: 'duplicate-node';
|
|
414
|
+
nodeId: string;
|
|
415
|
+
targetParentId?: string;
|
|
416
|
+
index?: number;
|
|
417
|
+
} | {
|
|
418
|
+
kind: 'replace-node';
|
|
419
|
+
nodeId: string;
|
|
420
|
+
node: Node;
|
|
421
|
+
};
|
|
422
|
+
/** An `AgentOp` plus the metadata the review UI needs before the user hits Apply. */
|
|
423
|
+
export interface AgentOpRecord {
|
|
424
|
+
id: string;
|
|
425
|
+
op: AgentOp;
|
|
426
|
+
/** Human-readable one-liner, e.g. `Update props of tombol "cta-btn"`. */
|
|
427
|
+
summary: string;
|
|
428
|
+
/**
|
|
429
|
+
* True for ops that can destroy user content (`delete-node`, `replace-node`). The
|
|
430
|
+
* editor never auto-applies these, even with auto-apply turned on.
|
|
431
|
+
*/
|
|
432
|
+
destructive: boolean;
|
|
433
|
+
}
|
|
434
|
+
export interface AiAgentRequest {
|
|
435
|
+
messages: AiChatMessage[];
|
|
436
|
+
/** The canvas document the agent reasons about and mutates a snapshot of. */
|
|
437
|
+
document: PageDocument;
|
|
438
|
+
selectedNodeId?: string;
|
|
439
|
+
/**
|
|
440
|
+
* Extra host/user instructions, appended AFTER the built-in system prompt (never
|
|
441
|
+
* replacing it — the base prompt carries the output-format, safety and tool rules).
|
|
442
|
+
* Over HTTP, `createAiHandler` caps its length and can disable it entirely
|
|
443
|
+
* (`allowClientInstructions` / `maxClientInstructionsLength`).
|
|
444
|
+
*/
|
|
445
|
+
instructions?: string;
|
|
446
|
+
/** @deprecated Alias of `instructions` — appended, never a replacement for the base prompt. */
|
|
447
|
+
systemPrompt?: string;
|
|
448
|
+
stylePreference?: string;
|
|
449
|
+
/** Overrides the engine's configured step ceiling for this run. */
|
|
450
|
+
maxSteps?: number;
|
|
451
|
+
}
|
|
452
|
+
export interface AiAgentRunResult {
|
|
453
|
+
ops: AgentOpRecord[];
|
|
454
|
+
/** The agent's closing natural-language message. */
|
|
455
|
+
summary: string;
|
|
456
|
+
stepsUsed: number;
|
|
457
|
+
stoppedBy: 'complete' | 'max-steps' | 'aborted' | 'error';
|
|
458
|
+
usage?: {
|
|
459
|
+
promptTokens?: number;
|
|
460
|
+
completionTokens?: number;
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
//# sourceMappingURL=types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE5D,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAEhG,gCAAgC;AAChC,MAAM,WAAW,WAAW;IAC1B,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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubuild/ai",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "Component-aware AI generation engine and adapters for KUBUILD",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -8,29 +8,54 @@
|
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.cts",
|
|
17
|
+
"default": "./dist/index.cjs"
|
|
18
|
+
}
|
|
14
19
|
},
|
|
15
20
|
"./server": {
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./dist/server/index.d.ts",
|
|
23
|
+
"default": "./dist/server/index.js"
|
|
24
|
+
},
|
|
25
|
+
"require": {
|
|
26
|
+
"types": "./dist/server/index.d.cts",
|
|
27
|
+
"default": "./dist/server/index.cjs"
|
|
28
|
+
}
|
|
19
29
|
},
|
|
20
30
|
"./client": {
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
"import": {
|
|
32
|
+
"types": "./dist/client/index.d.ts",
|
|
33
|
+
"default": "./dist/client/index.js"
|
|
34
|
+
},
|
|
35
|
+
"require": {
|
|
36
|
+
"types": "./dist/client/index.d.cts",
|
|
37
|
+
"default": "./dist/client/index.cjs"
|
|
38
|
+
}
|
|
24
39
|
},
|
|
25
40
|
"./react": {
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
41
|
+
"import": {
|
|
42
|
+
"types": "./dist/react/index.d.ts",
|
|
43
|
+
"default": "./dist/react/index.js"
|
|
44
|
+
},
|
|
45
|
+
"require": {
|
|
46
|
+
"types": "./dist/react/index.d.cts",
|
|
47
|
+
"default": "./dist/react/index.cjs"
|
|
48
|
+
}
|
|
29
49
|
},
|
|
30
50
|
"./adapters": {
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
51
|
+
"import": {
|
|
52
|
+
"types": "./dist/server/adapters/index.d.ts",
|
|
53
|
+
"default": "./dist/server/adapters/index.js"
|
|
54
|
+
},
|
|
55
|
+
"require": {
|
|
56
|
+
"types": "./dist/server/adapters/index.d.cts",
|
|
57
|
+
"default": "./dist/server/adapters/index.cjs"
|
|
58
|
+
}
|
|
34
59
|
}
|
|
35
60
|
},
|
|
36
61
|
"files": [
|
|
@@ -58,12 +83,12 @@
|
|
|
58
83
|
"author": "KUBUILD",
|
|
59
84
|
"license": "MIT",
|
|
60
85
|
"dependencies": {
|
|
61
|
-
"@kubuild/core": "0.8.
|
|
62
|
-
"@kubuild/schema": "0.8.
|
|
86
|
+
"@kubuild/core": "0.8.2",
|
|
87
|
+
"@kubuild/schema": "0.8.2"
|
|
63
88
|
},
|
|
64
89
|
"peerDependencies": {
|
|
65
90
|
"react": "^18.0.0 || ^19.0.0",
|
|
66
|
-
"@kubuild/components": "0.8.
|
|
91
|
+
"@kubuild/components": "0.8.2"
|
|
67
92
|
},
|
|
68
93
|
"peerDependenciesMeta": {
|
|
69
94
|
"@kubuild/components": {
|
|
@@ -75,17 +100,17 @@
|
|
|
75
100
|
},
|
|
76
101
|
"devDependencies": {
|
|
77
102
|
"@types/node": "^26.2.0",
|
|
78
|
-
"@types/react": "^19.
|
|
103
|
+
"@types/react": "^19.3.0",
|
|
79
104
|
"@types/react-test-renderer": "^18.3.0",
|
|
80
|
-
"react": "^19.
|
|
81
|
-
"react-test-renderer": "^19.
|
|
105
|
+
"react": "^19.3.0",
|
|
106
|
+
"react-test-renderer": "^19.3.0",
|
|
82
107
|
"tsup": "^8.3.6",
|
|
83
108
|
"typescript": "^6.0.0",
|
|
84
109
|
"vitest": "^3.0.5",
|
|
85
|
-
"@kubuild/components": "0.8.
|
|
110
|
+
"@kubuild/components": "0.8.2"
|
|
86
111
|
},
|
|
87
112
|
"scripts": {
|
|
88
|
-
"build": "tsup && tsc --emitDeclarationOnly",
|
|
113
|
+
"build": "tsup && tsc --emitDeclarationOnly && node ../../scripts/emit-cjs-dts.mjs",
|
|
89
114
|
"dev": "tsup --watch",
|
|
90
115
|
"typecheck": "tsc --noEmit",
|
|
91
116
|
"lint": "eslint src",
|