@puckeditor/cloud-client 0.9.0-canary.d4a0bc62 → 0.9.0-canary.e1a77bb6
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-RQBVR6IF.mjs → chunk-KEZIMCET.mjs} +8 -25
- package/dist/experimental.d.mts +1 -2
- package/dist/experimental.d.ts +1 -2
- package/dist/experimental.js +8 -25
- package/dist/experimental.mjs +1 -1
- package/dist/index.d.mts +25 -69
- package/dist/index.d.ts +25 -69
- package/dist/index.js +8 -25
- package/dist/index.mjs +1 -1
- package/package.json +6 -6
|
@@ -22411,10 +22411,10 @@ async function fetchWithRetry(input, init) {
|
|
|
22411
22411
|
// src/lib/cloud-api.ts
|
|
22412
22412
|
var DEFAULT_API_VERSION = "v2";
|
|
22413
22413
|
var DEFAULT_V2_MODELS = {
|
|
22414
|
-
assembly: "openai/gpt-
|
|
22415
|
-
design: "openai/gpt-
|
|
22414
|
+
assembly: "openai/gpt-6-luna",
|
|
22415
|
+
design: "openai/gpt-6-luna"
|
|
22416
22416
|
};
|
|
22417
|
-
var CLOUD_CLIENT_VERSION = true ? "0.9.0-canary.
|
|
22417
|
+
var CLOUD_CLIENT_VERSION = true ? "0.9.0-canary.e1a77bb6" : "unknown";
|
|
22418
22418
|
var cloudApi = async (path, body, options = {}, onChunk, forwardHeaders) => {
|
|
22419
22419
|
const {
|
|
22420
22420
|
ai = {},
|
|
@@ -22427,7 +22427,7 @@ var cloudApi = async (path, body, options = {}, onChunk, forwardHeaders) => {
|
|
|
22427
22427
|
"No Puck API key specified. Set the PUCK_API_KEY environment variable, or provide one to the function"
|
|
22428
22428
|
);
|
|
22429
22429
|
}
|
|
22430
|
-
const { context, tools = {},
|
|
22430
|
+
const { context, tools = {}, designMode, providerOptions } = ai;
|
|
22431
22431
|
const bodyMode = "mode" in body ? body.mode : void 0;
|
|
22432
22432
|
const mode = bodyMode === "design" || bodyMode === void 0 && ai.mode === "design" ? "design" : "assembly";
|
|
22433
22433
|
const model = ai.model ?? (apiVersion === DEFAULT_API_VERSION ? DEFAULT_V2_MODELS[mode] : void 0);
|
|
@@ -22446,9 +22446,6 @@ var cloudApi = async (path, body, options = {}, onChunk, forwardHeaders) => {
|
|
|
22446
22446
|
...body,
|
|
22447
22447
|
context,
|
|
22448
22448
|
tools: prepareUserTools(tools),
|
|
22449
|
-
// Spread after the client body, so an explicit server-side declaration
|
|
22450
|
-
// wins over the one the plugin sends
|
|
22451
|
-
...fieldTypes && Object.keys(fieldTypes).length > 0 ? { fieldTypes } : {},
|
|
22452
22449
|
...designMode ? {
|
|
22453
22450
|
designMode
|
|
22454
22451
|
} : {},
|
|
@@ -22483,14 +22480,14 @@ var handleStreamError = (error48) => {
|
|
|
22483
22480
|
console.error(error48);
|
|
22484
22481
|
return error48 instanceof Error ? error48.message : "An error occurred.";
|
|
22485
22482
|
};
|
|
22486
|
-
function chatPrivate({ chatId, messages, config: config2, pageData, mode
|
|
22483
|
+
function chatPrivate({ chatId, messages, config: config2, pageData, mode }, options = {}, forwardHeaders) {
|
|
22487
22484
|
const resolvedMode = mode ?? options?.ai?.mode;
|
|
22488
22485
|
const stream = createUIMessageStream({
|
|
22489
22486
|
onError: handleStreamError,
|
|
22490
22487
|
execute: async ({ writer }) => {
|
|
22491
22488
|
await cloudApi(
|
|
22492
22489
|
"chat",
|
|
22493
|
-
{ chatId, config: config2, messages, pageData, mode: resolvedMode
|
|
22490
|
+
{ chatId, config: config2, messages, pageData, mode: resolvedMode },
|
|
22494
22491
|
options,
|
|
22495
22492
|
(chunk) => {
|
|
22496
22493
|
if (chunk.type === "data-finish") {
|
|
@@ -22536,7 +22533,6 @@ async function generate({
|
|
|
22536
22533
|
pageData,
|
|
22537
22534
|
context,
|
|
22538
22535
|
tools,
|
|
22539
|
-
fieldTypes,
|
|
22540
22536
|
mode,
|
|
22541
22537
|
designMode,
|
|
22542
22538
|
apiKey,
|
|
@@ -22548,15 +22544,7 @@ async function generate({
|
|
|
22548
22544
|
}) {
|
|
22549
22545
|
let result = null;
|
|
22550
22546
|
const options = {
|
|
22551
|
-
ai: {
|
|
22552
|
-
context,
|
|
22553
|
-
tools,
|
|
22554
|
-
fieldTypes,
|
|
22555
|
-
designMode,
|
|
22556
|
-
model,
|
|
22557
|
-
providerApiKey,
|
|
22558
|
-
providerOptions
|
|
22559
|
-
},
|
|
22547
|
+
ai: { context, tools, designMode, model, providerApiKey, providerOptions },
|
|
22560
22548
|
apiKey,
|
|
22561
22549
|
host
|
|
22562
22550
|
};
|
|
@@ -22573,12 +22561,7 @@ async function generate({
|
|
|
22573
22561
|
} else if (chunk.type === "error") {
|
|
22574
22562
|
throw new Error(chunk.errorText);
|
|
22575
22563
|
}
|
|
22576
|
-
}
|
|
22577
|
-
// No editor is in the loop, so the plugin that will render this output
|
|
22578
|
-
// can't identify itself. It must match this package's version (the
|
|
22579
|
-
// platform enforces the pairing), so that version stands in — and lets
|
|
22580
|
-
// the platform pick the field format the plugin can parse.
|
|
22581
|
-
{ pluginAiVersion: CLOUD_CLIENT_VERSION }
|
|
22564
|
+
}
|
|
22582
22565
|
);
|
|
22583
22566
|
} catch (error48) {
|
|
22584
22567
|
console.error(error48);
|
package/dist/experimental.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { PuckCloudOptions as PuckCloudOptions$1 } from './index.mjs';
|
|
2
|
-
export {
|
|
2
|
+
export { ChatParams, DesignModeOptions, Endpoint, GenerateParams, OnFinishCallback, OnFinishResult, PuckAiModel, PuckAiProviderOptions, UserTool, UserToolRegistry, chat, endpoints, generate, tool } from './index.mjs';
|
|
3
3
|
import { Data } from '@puckeditor/core';
|
|
4
|
-
export { JSONSchema } from 'zod/v4/core/json-schema';
|
|
5
4
|
import '@ai-sdk/provider';
|
|
6
5
|
import '@ai-sdk/provider-utils';
|
|
7
6
|
import 'zod/v4';
|
package/dist/experimental.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { PuckCloudOptions as PuckCloudOptions$1 } from './index.js';
|
|
2
|
-
export {
|
|
2
|
+
export { ChatParams, DesignModeOptions, Endpoint, GenerateParams, OnFinishCallback, OnFinishResult, PuckAiModel, PuckAiProviderOptions, UserTool, UserToolRegistry, chat, endpoints, generate, tool } from './index.js';
|
|
3
3
|
import { Data } from '@puckeditor/core';
|
|
4
|
-
export { JSONSchema } from 'zod/v4/core/json-schema';
|
|
5
4
|
import '@ai-sdk/provider';
|
|
6
5
|
import '@ai-sdk/provider-utils';
|
|
7
6
|
import 'zod/v4';
|
package/dist/experimental.js
CHANGED
|
@@ -22454,10 +22454,10 @@ async function fetchWithRetry(input, init) {
|
|
|
22454
22454
|
// src/lib/cloud-api.ts
|
|
22455
22455
|
var DEFAULT_API_VERSION = "v2";
|
|
22456
22456
|
var DEFAULT_V2_MODELS = {
|
|
22457
|
-
assembly: "openai/gpt-
|
|
22458
|
-
design: "openai/gpt-
|
|
22457
|
+
assembly: "openai/gpt-6-luna",
|
|
22458
|
+
design: "openai/gpt-6-luna"
|
|
22459
22459
|
};
|
|
22460
|
-
var CLOUD_CLIENT_VERSION = true ? "0.9.0-canary.
|
|
22460
|
+
var CLOUD_CLIENT_VERSION = true ? "0.9.0-canary.e1a77bb6" : "unknown";
|
|
22461
22461
|
var cloudApi = async (path, body, options = {}, onChunk, forwardHeaders) => {
|
|
22462
22462
|
const {
|
|
22463
22463
|
ai = {},
|
|
@@ -22470,7 +22470,7 @@ var cloudApi = async (path, body, options = {}, onChunk, forwardHeaders) => {
|
|
|
22470
22470
|
"No Puck API key specified. Set the PUCK_API_KEY environment variable, or provide one to the function"
|
|
22471
22471
|
);
|
|
22472
22472
|
}
|
|
22473
|
-
const { context, tools = {},
|
|
22473
|
+
const { context, tools = {}, designMode, providerOptions } = ai;
|
|
22474
22474
|
const bodyMode = "mode" in body ? body.mode : void 0;
|
|
22475
22475
|
const mode = bodyMode === "design" || bodyMode === void 0 && ai.mode === "design" ? "design" : "assembly";
|
|
22476
22476
|
const model = ai.model ?? (apiVersion === DEFAULT_API_VERSION ? DEFAULT_V2_MODELS[mode] : void 0);
|
|
@@ -22489,9 +22489,6 @@ var cloudApi = async (path, body, options = {}, onChunk, forwardHeaders) => {
|
|
|
22489
22489
|
...body,
|
|
22490
22490
|
context,
|
|
22491
22491
|
tools: prepareUserTools(tools),
|
|
22492
|
-
// Spread after the client body, so an explicit server-side declaration
|
|
22493
|
-
// wins over the one the plugin sends
|
|
22494
|
-
...fieldTypes && Object.keys(fieldTypes).length > 0 ? { fieldTypes } : {},
|
|
22495
22492
|
...designMode ? {
|
|
22496
22493
|
designMode
|
|
22497
22494
|
} : {},
|
|
@@ -22526,14 +22523,14 @@ var handleStreamError = (error48) => {
|
|
|
22526
22523
|
console.error(error48);
|
|
22527
22524
|
return error48 instanceof Error ? error48.message : "An error occurred.";
|
|
22528
22525
|
};
|
|
22529
|
-
function chatPrivate({ chatId, messages, config: config2, pageData, mode
|
|
22526
|
+
function chatPrivate({ chatId, messages, config: config2, pageData, mode }, options = {}, forwardHeaders) {
|
|
22530
22527
|
const resolvedMode = mode ?? options?.ai?.mode;
|
|
22531
22528
|
const stream = createUIMessageStream({
|
|
22532
22529
|
onError: handleStreamError,
|
|
22533
22530
|
execute: async ({ writer }) => {
|
|
22534
22531
|
await cloudApi(
|
|
22535
22532
|
"chat",
|
|
22536
|
-
{ chatId, config: config2, messages, pageData, mode: resolvedMode
|
|
22533
|
+
{ chatId, config: config2, messages, pageData, mode: resolvedMode },
|
|
22537
22534
|
options,
|
|
22538
22535
|
(chunk) => {
|
|
22539
22536
|
if (chunk.type === "data-finish") {
|
|
@@ -23065,7 +23062,6 @@ async function generate({
|
|
|
23065
23062
|
pageData,
|
|
23066
23063
|
context,
|
|
23067
23064
|
tools,
|
|
23068
|
-
fieldTypes,
|
|
23069
23065
|
mode,
|
|
23070
23066
|
designMode,
|
|
23071
23067
|
apiKey,
|
|
@@ -23077,15 +23073,7 @@ async function generate({
|
|
|
23077
23073
|
}) {
|
|
23078
23074
|
let result = null;
|
|
23079
23075
|
const options = {
|
|
23080
|
-
ai: {
|
|
23081
|
-
context,
|
|
23082
|
-
tools,
|
|
23083
|
-
fieldTypes,
|
|
23084
|
-
designMode,
|
|
23085
|
-
model,
|
|
23086
|
-
providerApiKey,
|
|
23087
|
-
providerOptions
|
|
23088
|
-
},
|
|
23076
|
+
ai: { context, tools, designMode, model, providerApiKey, providerOptions },
|
|
23089
23077
|
apiKey,
|
|
23090
23078
|
host
|
|
23091
23079
|
};
|
|
@@ -23102,12 +23090,7 @@ async function generate({
|
|
|
23102
23090
|
} else if (chunk.type === "error") {
|
|
23103
23091
|
throw new Error(chunk.errorText);
|
|
23104
23092
|
}
|
|
23105
|
-
}
|
|
23106
|
-
// No editor is in the loop, so the plugin that will render this output
|
|
23107
|
-
// can't identify itself. It must match this package's version (the
|
|
23108
|
-
// platform enforces the pairing), so that version stands in — and lets
|
|
23109
|
-
// the platform pick the field format the plugin can parse.
|
|
23110
|
-
{ pluginAiVersion: CLOUD_CLIENT_VERSION }
|
|
23093
|
+
}
|
|
23111
23094
|
);
|
|
23112
23095
|
} catch (error48) {
|
|
23113
23096
|
console.error(error48);
|
package/dist/experimental.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -4,15 +4,14 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
|
4
4
|
import z from 'zod/v4';
|
|
5
5
|
import { UIMessage } from 'ai';
|
|
6
6
|
import { Config, Data } from '@puckeditor/core';
|
|
7
|
-
export { JSONSchema } from 'zod/v4/core/json-schema';
|
|
8
7
|
|
|
9
|
-
type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-audio-preview-2025-06-03' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.3-chat-latest' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | (string & {});
|
|
8
|
+
type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-audio-preview-2025-06-03' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.3-chat-latest' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-6-astra' | (string & {});
|
|
10
9
|
|
|
11
10
|
type OpenAICompletionModelId = 'gpt-3.5-turbo-instruct' | 'gpt-3.5-turbo-instruct-0914' | (string & {});
|
|
12
11
|
|
|
13
12
|
type OpenAIEmbeddingModelId = 'text-embedding-3-small' | 'text-embedding-3-large' | 'text-embedding-ada-002' | (string & {});
|
|
14
13
|
|
|
15
|
-
type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'gpt-image-2' | 'chatgpt-image-latest' | (string & {});
|
|
14
|
+
type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'gpt-image-2' | 'gpt-image-2.5-flare' | 'gpt-image-2.5-flare-2026-09-08' | 'gpt-image-2.5-sunburst' | 'gpt-image-2.5-sunburst-2026-09-08' | 'chatgpt-image-latest' | (string & {});
|
|
16
15
|
|
|
17
16
|
declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
18
17
|
/**
|
|
@@ -82,8 +81,15 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWi
|
|
|
82
81
|
* Allowed domains for the search.
|
|
83
82
|
* If not provided, all domains are allowed.
|
|
84
83
|
* Subdomains of the provided domains are allowed as well.
|
|
84
|
+
* Omit the HTTP or HTTPS prefix. Maximum 100 domains.
|
|
85
85
|
*/
|
|
86
86
|
allowedDomains?: string[];
|
|
87
|
+
/**
|
|
88
|
+
* Blocked domains for the search.
|
|
89
|
+
* Subdomains of the provided domains are blocked as well.
|
|
90
|
+
* Omit the HTTP or HTTPS prefix. Maximum 100 domains.
|
|
91
|
+
*/
|
|
92
|
+
blockedDomains?: string[];
|
|
87
93
|
};
|
|
88
94
|
/**
|
|
89
95
|
* Search context size to use for the web search.
|
|
@@ -159,6 +165,11 @@ declare const customToolFactory: _ai_sdk_provider_utils.ProviderToolFactory<stri
|
|
|
159
165
|
* An optional description of what the tool does.
|
|
160
166
|
*/
|
|
161
167
|
description?: string;
|
|
168
|
+
/**
|
|
169
|
+
* Whether the model can continue generating after calling this tool
|
|
170
|
+
* without waiting for its result.
|
|
171
|
+
*/
|
|
172
|
+
async?: boolean;
|
|
162
173
|
/**
|
|
163
174
|
* The output format specification for the tool.
|
|
164
175
|
* Omit for unconstrained text output.
|
|
@@ -225,6 +236,7 @@ declare const openaiTools: {
|
|
|
225
236
|
*
|
|
226
237
|
* @param name - The name of the custom tool.
|
|
227
238
|
* @param description - An optional description of the tool.
|
|
239
|
+
* @param async - Whether the model can continue without waiting for the tool result.
|
|
228
240
|
* @param format - The output format constraint (grammar type, syntax, and definition).
|
|
229
241
|
*/
|
|
230
242
|
customTool: (args: Parameters<typeof customToolFactory>[0]) => _ai_sdk_provider_utils.Tool<string, unknown>;
|
|
@@ -292,7 +304,7 @@ declare const openaiTools: {
|
|
|
292
304
|
* @param outputCompression - Compression level for the output image (0-100).
|
|
293
305
|
* @param outputFormat - The output format of the generated image. One of 'png', 'jpeg', or 'webp'.
|
|
294
306
|
* @param partialImages - Number of partial images to generate in streaming mode (0-3).
|
|
295
|
-
* @param quality - The quality of the generated image. One of 'auto', 'low', 'medium', or '
|
|
307
|
+
* @param quality - The quality of the generated image. One of 'auto', 'low', 'medium', 'high', 'xhigh', or 'max'. 'xhigh' and 'max' require a GPT Image 2.5 model.
|
|
296
308
|
* @param size - The size of the generated image. One of 'auto', '1024x1024', '1024x1536', or '1536x1024'.
|
|
297
309
|
*/
|
|
298
310
|
imageGeneration: (args?: {
|
|
@@ -307,8 +319,8 @@ declare const openaiTools: {
|
|
|
307
319
|
outputCompression?: number;
|
|
308
320
|
outputFormat?: "png" | "jpeg" | "webp";
|
|
309
321
|
partialImages?: number;
|
|
310
|
-
quality?: "auto" | "low" | "medium" | "high";
|
|
311
|
-
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024";
|
|
322
|
+
quality?: "auto" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
323
|
+
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024" | (string & {});
|
|
312
324
|
}) => _ai_sdk_provider_utils.Tool<{}, {
|
|
313
325
|
result: string;
|
|
314
326
|
}>;
|
|
@@ -425,19 +437,7 @@ declare const openaiTools: {
|
|
|
425
437
|
type: "approximate";
|
|
426
438
|
country?: string;
|
|
427
439
|
city?: string;
|
|
428
|
-
region
|
|
429
|
-
/**
|
|
430
|
-
* Local shell is a tool that allows agents to run shell commands locally
|
|
431
|
-
* on a machine you or the user provides.
|
|
432
|
-
*
|
|
433
|
-
* Supported models: `gpt-5-codex`
|
|
434
|
-
*/
|
|
435
|
-
? /**
|
|
436
|
-
* Local shell is a tool that allows agents to run shell commands locally
|
|
437
|
-
* on a machine you or the user provides.
|
|
438
|
-
*
|
|
439
|
-
* Supported models: `gpt-5-codex`
|
|
440
|
-
*/: string;
|
|
440
|
+
region?: string;
|
|
441
441
|
timezone?: string;
|
|
442
442
|
};
|
|
443
443
|
}>;
|
|
@@ -533,7 +533,7 @@ declare const openaiTools: {
|
|
|
533
533
|
}>;
|
|
534
534
|
};
|
|
535
535
|
|
|
536
|
-
type OpenAIResponsesModelId$1 = 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.2-codex' | 'gpt-5.3-chat-latest' | 'gpt-5.3-codex' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
|
|
536
|
+
type OpenAIResponsesModelId$1 = 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.2-codex' | 'gpt-5.3-chat-latest' | 'gpt-5.3-codex' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-6-astra' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
|
|
537
537
|
|
|
538
538
|
type OpenAISpeechModelId = 'tts-1' | 'tts-1-1106' | 'tts-1-hd' | 'tts-1-hd-1106' | 'gpt-4o-mini-tts' | 'gpt-4o-mini-tts-2025-03-20' | 'gpt-4o-mini-tts-2025-12-15' | (string & {});
|
|
539
539
|
|
|
@@ -612,37 +612,6 @@ type UserTool<INPUT = any, OUTPUT = any> = {
|
|
|
612
612
|
execute: (_input: Infer<INPUT>) => Promise<Infer<OUTPUT>> | Infer<OUTPUT>;
|
|
613
613
|
mode?: "auto" | "preload" | "inline";
|
|
614
614
|
};
|
|
615
|
-
type AiFieldTypeShape<Value> = {
|
|
616
|
-
/** What the field represents, and any rules for using it */
|
|
617
|
-
description?: string;
|
|
618
|
-
/**
|
|
619
|
-
* JSON Schema for the field's value — the shape the model may write, at
|
|
620
|
-
* creation and in later edits. Without one the model never writes the
|
|
621
|
-
* field, like `ai.exclude`.
|
|
622
|
-
*/
|
|
623
|
-
schema?: Record<string, any>;
|
|
624
|
-
/**
|
|
625
|
-
* What a field the model designs starts as. When set, the model places the
|
|
626
|
-
* field and this value fills it; the model authors a value against `schema`
|
|
627
|
-
* only when this is absent.
|
|
628
|
-
*/
|
|
629
|
-
defaultValue?: Value;
|
|
630
|
-
};
|
|
631
|
-
/**
|
|
632
|
-
* A user field type registered by the developer's config. Puck can't infer a
|
|
633
|
-
* value shape for one, so a type carries `schema`, `defaultValue`, or both.
|
|
634
|
-
*/
|
|
635
|
-
type AiFieldType<Value = AiFieldTypeValue> = AiFieldTypeShape<Value> & ({
|
|
636
|
-
schema: Record<string, any>;
|
|
637
|
-
} | {
|
|
638
|
-
defaultValue: Value;
|
|
639
|
-
});
|
|
640
|
-
/**
|
|
641
|
-
* Any JSON-ish value. Spelled out rather than `unknown` so a union with a
|
|
642
|
-
* function form doesn't collapse, which would drop the callback's parameter
|
|
643
|
-
* types at the call site.
|
|
644
|
-
*/
|
|
645
|
-
type AiFieldTypeValue = string | number | boolean | null | readonly unknown[] | Record<string, unknown>;
|
|
646
615
|
type TokenUsage = {
|
|
647
616
|
inputTokens: number | undefined;
|
|
648
617
|
outputTokens: number | undefined;
|
|
@@ -656,8 +625,6 @@ type DataFinish = {
|
|
|
656
625
|
tokenUsage: TokenUsage;
|
|
657
626
|
};
|
|
658
627
|
|
|
659
|
-
/** Field types as a handler declares them: a default is a value, not a function */
|
|
660
|
-
type AiFieldTypeRegistry = Record<string, AiFieldType>;
|
|
661
628
|
type OnFinishResult = DataFinish;
|
|
662
629
|
type OnFinishCallback = (result: OnFinishResult) => void;
|
|
663
630
|
type UserToolRegistry = Record<string, UserTool>;
|
|
@@ -675,7 +642,7 @@ type DesignModeOptions = {
|
|
|
675
642
|
scripts?: boolean;
|
|
676
643
|
/**
|
|
677
644
|
* Model override for design-mode requests. Falls back to `ai.model`, or
|
|
678
|
-
* `openai/gpt-
|
|
645
|
+
* `openai/gpt-6-luna` when unset.
|
|
679
646
|
*/
|
|
680
647
|
model?: PuckAiModel;
|
|
681
648
|
/**
|
|
@@ -696,25 +663,15 @@ type PuckAiProviderOptions = {
|
|
|
696
663
|
type PuckAiOptions = {
|
|
697
664
|
context?: string;
|
|
698
665
|
tools?: UserToolRegistry;
|
|
699
|
-
/**
|
|
700
|
-
* Field types your config registers, keyed by field type. Each gives a
|
|
701
|
-
* `schema` the AI may write against, a `defaultValue` a designed field
|
|
702
|
-
* starts as, or both.
|
|
703
|
-
*
|
|
704
|
-
* In the editor, prefer declaring them on `createAiPlugin`, which sends them
|
|
705
|
-
* with each request and can derive a default per field. Declare them here
|
|
706
|
-
* for `generate`, which has no editor to send them.
|
|
707
|
-
*/
|
|
708
|
-
fieldTypes?: AiFieldTypeRegistry;
|
|
709
666
|
onFinish?: OnFinishCallback;
|
|
710
667
|
designMode?: DesignModeOptions;
|
|
711
668
|
mode?: "assembly" | "design";
|
|
712
669
|
/**
|
|
713
|
-
* Provider-qualified model id, e.g. "openai/gpt-
|
|
670
|
+
* Provider-qualified model id, e.g. "openai/gpt-6-luna". When explicitly
|
|
714
671
|
* configured, it runs on Puck's managed infrastructure (supported models
|
|
715
672
|
* only) unless a provider key is available, in which case it runs on your
|
|
716
673
|
* own provider account (BYOK).
|
|
717
|
-
* Defaults to `openai/gpt-
|
|
674
|
+
* Defaults to `openai/gpt-6-luna` in both assembly and design modes.
|
|
718
675
|
*/
|
|
719
676
|
model?: PuckAiModel;
|
|
720
677
|
/**
|
|
@@ -753,7 +710,6 @@ type GenerateParams = {
|
|
|
753
710
|
pageData?: Data;
|
|
754
711
|
context?: string;
|
|
755
712
|
tools?: UserToolRegistry;
|
|
756
|
-
fieldTypes?: AiFieldTypeRegistry;
|
|
757
713
|
mode?: "assembly" | "design";
|
|
758
714
|
designMode?: Omit<DesignModeOptions, "allowed">;
|
|
759
715
|
host?: string;
|
|
@@ -763,11 +719,11 @@ type GenerateParams = {
|
|
|
763
719
|
providerApiKey?: string;
|
|
764
720
|
providerOptions?: PuckAiProviderOptions;
|
|
765
721
|
};
|
|
766
|
-
declare function generate({ prompt, config, pageData, context, tools,
|
|
722
|
+
declare function generate({ prompt, config, pageData, context, tools, mode, designMode, apiKey, host, onFinish, model, providerApiKey, providerOptions, }: GenerateParams): Promise<null>;
|
|
767
723
|
|
|
768
724
|
declare function puckHandler(request: Request, options?: PuckCloudOptions): Promise<Response>;
|
|
769
725
|
|
|
770
726
|
declare const endpoints: readonly ["chat"];
|
|
771
727
|
type Endpoint = (typeof endpoints)[number];
|
|
772
728
|
|
|
773
|
-
export { type
|
|
729
|
+
export { type ChatParams, type DesignModeOptions, type Endpoint, type GenerateParams, type OnFinishCallback, type OnFinishResult, type PuckAiModel, type PuckAiProviderOptions, type PuckCloudOptions, type UserTool, type UserToolRegistry, chat, endpoints, generate, puckHandler, tool };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,15 +4,14 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
|
4
4
|
import z from 'zod/v4';
|
|
5
5
|
import { UIMessage } from 'ai';
|
|
6
6
|
import { Config, Data } from '@puckeditor/core';
|
|
7
|
-
export { JSONSchema } from 'zod/v4/core/json-schema';
|
|
8
7
|
|
|
9
|
-
type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-audio-preview-2025-06-03' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.3-chat-latest' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | (string & {});
|
|
8
|
+
type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-audio-preview-2025-06-03' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.3-chat-latest' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-6-astra' | (string & {});
|
|
10
9
|
|
|
11
10
|
type OpenAICompletionModelId = 'gpt-3.5-turbo-instruct' | 'gpt-3.5-turbo-instruct-0914' | (string & {});
|
|
12
11
|
|
|
13
12
|
type OpenAIEmbeddingModelId = 'text-embedding-3-small' | 'text-embedding-3-large' | 'text-embedding-ada-002' | (string & {});
|
|
14
13
|
|
|
15
|
-
type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'gpt-image-2' | 'chatgpt-image-latest' | (string & {});
|
|
14
|
+
type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'gpt-image-2' | 'gpt-image-2.5-flare' | 'gpt-image-2.5-flare-2026-09-08' | 'gpt-image-2.5-sunburst' | 'gpt-image-2.5-sunburst-2026-09-08' | 'chatgpt-image-latest' | (string & {});
|
|
16
15
|
|
|
17
16
|
declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
18
17
|
/**
|
|
@@ -82,8 +81,15 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWi
|
|
|
82
81
|
* Allowed domains for the search.
|
|
83
82
|
* If not provided, all domains are allowed.
|
|
84
83
|
* Subdomains of the provided domains are allowed as well.
|
|
84
|
+
* Omit the HTTP or HTTPS prefix. Maximum 100 domains.
|
|
85
85
|
*/
|
|
86
86
|
allowedDomains?: string[];
|
|
87
|
+
/**
|
|
88
|
+
* Blocked domains for the search.
|
|
89
|
+
* Subdomains of the provided domains are blocked as well.
|
|
90
|
+
* Omit the HTTP or HTTPS prefix. Maximum 100 domains.
|
|
91
|
+
*/
|
|
92
|
+
blockedDomains?: string[];
|
|
87
93
|
};
|
|
88
94
|
/**
|
|
89
95
|
* Search context size to use for the web search.
|
|
@@ -159,6 +165,11 @@ declare const customToolFactory: _ai_sdk_provider_utils.ProviderToolFactory<stri
|
|
|
159
165
|
* An optional description of what the tool does.
|
|
160
166
|
*/
|
|
161
167
|
description?: string;
|
|
168
|
+
/**
|
|
169
|
+
* Whether the model can continue generating after calling this tool
|
|
170
|
+
* without waiting for its result.
|
|
171
|
+
*/
|
|
172
|
+
async?: boolean;
|
|
162
173
|
/**
|
|
163
174
|
* The output format specification for the tool.
|
|
164
175
|
* Omit for unconstrained text output.
|
|
@@ -225,6 +236,7 @@ declare const openaiTools: {
|
|
|
225
236
|
*
|
|
226
237
|
* @param name - The name of the custom tool.
|
|
227
238
|
* @param description - An optional description of the tool.
|
|
239
|
+
* @param async - Whether the model can continue without waiting for the tool result.
|
|
228
240
|
* @param format - The output format constraint (grammar type, syntax, and definition).
|
|
229
241
|
*/
|
|
230
242
|
customTool: (args: Parameters<typeof customToolFactory>[0]) => _ai_sdk_provider_utils.Tool<string, unknown>;
|
|
@@ -292,7 +304,7 @@ declare const openaiTools: {
|
|
|
292
304
|
* @param outputCompression - Compression level for the output image (0-100).
|
|
293
305
|
* @param outputFormat - The output format of the generated image. One of 'png', 'jpeg', or 'webp'.
|
|
294
306
|
* @param partialImages - Number of partial images to generate in streaming mode (0-3).
|
|
295
|
-
* @param quality - The quality of the generated image. One of 'auto', 'low', 'medium', or '
|
|
307
|
+
* @param quality - The quality of the generated image. One of 'auto', 'low', 'medium', 'high', 'xhigh', or 'max'. 'xhigh' and 'max' require a GPT Image 2.5 model.
|
|
296
308
|
* @param size - The size of the generated image. One of 'auto', '1024x1024', '1024x1536', or '1536x1024'.
|
|
297
309
|
*/
|
|
298
310
|
imageGeneration: (args?: {
|
|
@@ -307,8 +319,8 @@ declare const openaiTools: {
|
|
|
307
319
|
outputCompression?: number;
|
|
308
320
|
outputFormat?: "png" | "jpeg" | "webp";
|
|
309
321
|
partialImages?: number;
|
|
310
|
-
quality?: "auto" | "low" | "medium" | "high";
|
|
311
|
-
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024";
|
|
322
|
+
quality?: "auto" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
323
|
+
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024" | (string & {});
|
|
312
324
|
}) => _ai_sdk_provider_utils.Tool<{}, {
|
|
313
325
|
result: string;
|
|
314
326
|
}>;
|
|
@@ -425,19 +437,7 @@ declare const openaiTools: {
|
|
|
425
437
|
type: "approximate";
|
|
426
438
|
country?: string;
|
|
427
439
|
city?: string;
|
|
428
|
-
region
|
|
429
|
-
/**
|
|
430
|
-
* Local shell is a tool that allows agents to run shell commands locally
|
|
431
|
-
* on a machine you or the user provides.
|
|
432
|
-
*
|
|
433
|
-
* Supported models: `gpt-5-codex`
|
|
434
|
-
*/
|
|
435
|
-
? /**
|
|
436
|
-
* Local shell is a tool that allows agents to run shell commands locally
|
|
437
|
-
* on a machine you or the user provides.
|
|
438
|
-
*
|
|
439
|
-
* Supported models: `gpt-5-codex`
|
|
440
|
-
*/: string;
|
|
440
|
+
region?: string;
|
|
441
441
|
timezone?: string;
|
|
442
442
|
};
|
|
443
443
|
}>;
|
|
@@ -533,7 +533,7 @@ declare const openaiTools: {
|
|
|
533
533
|
}>;
|
|
534
534
|
};
|
|
535
535
|
|
|
536
|
-
type OpenAIResponsesModelId$1 = 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.2-codex' | 'gpt-5.3-chat-latest' | 'gpt-5.3-codex' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
|
|
536
|
+
type OpenAIResponsesModelId$1 = 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.2-codex' | 'gpt-5.3-chat-latest' | 'gpt-5.3-codex' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-6-astra' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
|
|
537
537
|
|
|
538
538
|
type OpenAISpeechModelId = 'tts-1' | 'tts-1-1106' | 'tts-1-hd' | 'tts-1-hd-1106' | 'gpt-4o-mini-tts' | 'gpt-4o-mini-tts-2025-03-20' | 'gpt-4o-mini-tts-2025-12-15' | (string & {});
|
|
539
539
|
|
|
@@ -612,37 +612,6 @@ type UserTool<INPUT = any, OUTPUT = any> = {
|
|
|
612
612
|
execute: (_input: Infer<INPUT>) => Promise<Infer<OUTPUT>> | Infer<OUTPUT>;
|
|
613
613
|
mode?: "auto" | "preload" | "inline";
|
|
614
614
|
};
|
|
615
|
-
type AiFieldTypeShape<Value> = {
|
|
616
|
-
/** What the field represents, and any rules for using it */
|
|
617
|
-
description?: string;
|
|
618
|
-
/**
|
|
619
|
-
* JSON Schema for the field's value — the shape the model may write, at
|
|
620
|
-
* creation and in later edits. Without one the model never writes the
|
|
621
|
-
* field, like `ai.exclude`.
|
|
622
|
-
*/
|
|
623
|
-
schema?: Record<string, any>;
|
|
624
|
-
/**
|
|
625
|
-
* What a field the model designs starts as. When set, the model places the
|
|
626
|
-
* field and this value fills it; the model authors a value against `schema`
|
|
627
|
-
* only when this is absent.
|
|
628
|
-
*/
|
|
629
|
-
defaultValue?: Value;
|
|
630
|
-
};
|
|
631
|
-
/**
|
|
632
|
-
* A user field type registered by the developer's config. Puck can't infer a
|
|
633
|
-
* value shape for one, so a type carries `schema`, `defaultValue`, or both.
|
|
634
|
-
*/
|
|
635
|
-
type AiFieldType<Value = AiFieldTypeValue> = AiFieldTypeShape<Value> & ({
|
|
636
|
-
schema: Record<string, any>;
|
|
637
|
-
} | {
|
|
638
|
-
defaultValue: Value;
|
|
639
|
-
});
|
|
640
|
-
/**
|
|
641
|
-
* Any JSON-ish value. Spelled out rather than `unknown` so a union with a
|
|
642
|
-
* function form doesn't collapse, which would drop the callback's parameter
|
|
643
|
-
* types at the call site.
|
|
644
|
-
*/
|
|
645
|
-
type AiFieldTypeValue = string | number | boolean | null | readonly unknown[] | Record<string, unknown>;
|
|
646
615
|
type TokenUsage = {
|
|
647
616
|
inputTokens: number | undefined;
|
|
648
617
|
outputTokens: number | undefined;
|
|
@@ -656,8 +625,6 @@ type DataFinish = {
|
|
|
656
625
|
tokenUsage: TokenUsage;
|
|
657
626
|
};
|
|
658
627
|
|
|
659
|
-
/** Field types as a handler declares them: a default is a value, not a function */
|
|
660
|
-
type AiFieldTypeRegistry = Record<string, AiFieldType>;
|
|
661
628
|
type OnFinishResult = DataFinish;
|
|
662
629
|
type OnFinishCallback = (result: OnFinishResult) => void;
|
|
663
630
|
type UserToolRegistry = Record<string, UserTool>;
|
|
@@ -675,7 +642,7 @@ type DesignModeOptions = {
|
|
|
675
642
|
scripts?: boolean;
|
|
676
643
|
/**
|
|
677
644
|
* Model override for design-mode requests. Falls back to `ai.model`, or
|
|
678
|
-
* `openai/gpt-
|
|
645
|
+
* `openai/gpt-6-luna` when unset.
|
|
679
646
|
*/
|
|
680
647
|
model?: PuckAiModel;
|
|
681
648
|
/**
|
|
@@ -696,25 +663,15 @@ type PuckAiProviderOptions = {
|
|
|
696
663
|
type PuckAiOptions = {
|
|
697
664
|
context?: string;
|
|
698
665
|
tools?: UserToolRegistry;
|
|
699
|
-
/**
|
|
700
|
-
* Field types your config registers, keyed by field type. Each gives a
|
|
701
|
-
* `schema` the AI may write against, a `defaultValue` a designed field
|
|
702
|
-
* starts as, or both.
|
|
703
|
-
*
|
|
704
|
-
* In the editor, prefer declaring them on `createAiPlugin`, which sends them
|
|
705
|
-
* with each request and can derive a default per field. Declare them here
|
|
706
|
-
* for `generate`, which has no editor to send them.
|
|
707
|
-
*/
|
|
708
|
-
fieldTypes?: AiFieldTypeRegistry;
|
|
709
666
|
onFinish?: OnFinishCallback;
|
|
710
667
|
designMode?: DesignModeOptions;
|
|
711
668
|
mode?: "assembly" | "design";
|
|
712
669
|
/**
|
|
713
|
-
* Provider-qualified model id, e.g. "openai/gpt-
|
|
670
|
+
* Provider-qualified model id, e.g. "openai/gpt-6-luna". When explicitly
|
|
714
671
|
* configured, it runs on Puck's managed infrastructure (supported models
|
|
715
672
|
* only) unless a provider key is available, in which case it runs on your
|
|
716
673
|
* own provider account (BYOK).
|
|
717
|
-
* Defaults to `openai/gpt-
|
|
674
|
+
* Defaults to `openai/gpt-6-luna` in both assembly and design modes.
|
|
718
675
|
*/
|
|
719
676
|
model?: PuckAiModel;
|
|
720
677
|
/**
|
|
@@ -753,7 +710,6 @@ type GenerateParams = {
|
|
|
753
710
|
pageData?: Data;
|
|
754
711
|
context?: string;
|
|
755
712
|
tools?: UserToolRegistry;
|
|
756
|
-
fieldTypes?: AiFieldTypeRegistry;
|
|
757
713
|
mode?: "assembly" | "design";
|
|
758
714
|
designMode?: Omit<DesignModeOptions, "allowed">;
|
|
759
715
|
host?: string;
|
|
@@ -763,11 +719,11 @@ type GenerateParams = {
|
|
|
763
719
|
providerApiKey?: string;
|
|
764
720
|
providerOptions?: PuckAiProviderOptions;
|
|
765
721
|
};
|
|
766
|
-
declare function generate({ prompt, config, pageData, context, tools,
|
|
722
|
+
declare function generate({ prompt, config, pageData, context, tools, mode, designMode, apiKey, host, onFinish, model, providerApiKey, providerOptions, }: GenerateParams): Promise<null>;
|
|
767
723
|
|
|
768
724
|
declare function puckHandler(request: Request, options?: PuckCloudOptions): Promise<Response>;
|
|
769
725
|
|
|
770
726
|
declare const endpoints: readonly ["chat"];
|
|
771
727
|
type Endpoint = (typeof endpoints)[number];
|
|
772
728
|
|
|
773
|
-
export { type
|
|
729
|
+
export { type ChatParams, type DesignModeOptions, type Endpoint, type GenerateParams, type OnFinishCallback, type OnFinishResult, type PuckAiModel, type PuckAiProviderOptions, type PuckCloudOptions, type UserTool, type UserToolRegistry, chat, endpoints, generate, puckHandler, tool };
|
package/dist/index.js
CHANGED
|
@@ -22456,10 +22456,10 @@ async function fetchWithRetry(input, init) {
|
|
|
22456
22456
|
// src/lib/cloud-api.ts
|
|
22457
22457
|
var DEFAULT_API_VERSION = "v2";
|
|
22458
22458
|
var DEFAULT_V2_MODELS = {
|
|
22459
|
-
assembly: "openai/gpt-
|
|
22460
|
-
design: "openai/gpt-
|
|
22459
|
+
assembly: "openai/gpt-6-luna",
|
|
22460
|
+
design: "openai/gpt-6-luna"
|
|
22461
22461
|
};
|
|
22462
|
-
var CLOUD_CLIENT_VERSION = true ? "0.9.0-canary.
|
|
22462
|
+
var CLOUD_CLIENT_VERSION = true ? "0.9.0-canary.e1a77bb6" : "unknown";
|
|
22463
22463
|
var cloudApi = async (path, body, options = {}, onChunk, forwardHeaders) => {
|
|
22464
22464
|
const {
|
|
22465
22465
|
ai = {},
|
|
@@ -22472,7 +22472,7 @@ var cloudApi = async (path, body, options = {}, onChunk, forwardHeaders) => {
|
|
|
22472
22472
|
"No Puck API key specified. Set the PUCK_API_KEY environment variable, or provide one to the function"
|
|
22473
22473
|
);
|
|
22474
22474
|
}
|
|
22475
|
-
const { context, tools = {},
|
|
22475
|
+
const { context, tools = {}, designMode, providerOptions } = ai;
|
|
22476
22476
|
const bodyMode = "mode" in body ? body.mode : void 0;
|
|
22477
22477
|
const mode = bodyMode === "design" || bodyMode === void 0 && ai.mode === "design" ? "design" : "assembly";
|
|
22478
22478
|
const model = ai.model ?? (apiVersion === DEFAULT_API_VERSION ? DEFAULT_V2_MODELS[mode] : void 0);
|
|
@@ -22491,9 +22491,6 @@ var cloudApi = async (path, body, options = {}, onChunk, forwardHeaders) => {
|
|
|
22491
22491
|
...body,
|
|
22492
22492
|
context,
|
|
22493
22493
|
tools: prepareUserTools(tools),
|
|
22494
|
-
// Spread after the client body, so an explicit server-side declaration
|
|
22495
|
-
// wins over the one the plugin sends
|
|
22496
|
-
...fieldTypes && Object.keys(fieldTypes).length > 0 ? { fieldTypes } : {},
|
|
22497
22494
|
...designMode ? {
|
|
22498
22495
|
designMode
|
|
22499
22496
|
} : {},
|
|
@@ -22528,14 +22525,14 @@ var handleStreamError = (error48) => {
|
|
|
22528
22525
|
console.error(error48);
|
|
22529
22526
|
return error48 instanceof Error ? error48.message : "An error occurred.";
|
|
22530
22527
|
};
|
|
22531
|
-
function chatPrivate({ chatId, messages, config: config2, pageData, mode
|
|
22528
|
+
function chatPrivate({ chatId, messages, config: config2, pageData, mode }, options = {}, forwardHeaders) {
|
|
22532
22529
|
const resolvedMode = mode ?? options?.ai?.mode;
|
|
22533
22530
|
const stream = createUIMessageStream({
|
|
22534
22531
|
onError: handleStreamError,
|
|
22535
22532
|
execute: async ({ writer }) => {
|
|
22536
22533
|
await cloudApi(
|
|
22537
22534
|
"chat",
|
|
22538
|
-
{ chatId, config: config2, messages, pageData, mode: resolvedMode
|
|
22535
|
+
{ chatId, config: config2, messages, pageData, mode: resolvedMode },
|
|
22539
22536
|
options,
|
|
22540
22537
|
(chunk) => {
|
|
22541
22538
|
if (chunk.type === "data-finish") {
|
|
@@ -22581,7 +22578,6 @@ async function generate({
|
|
|
22581
22578
|
pageData,
|
|
22582
22579
|
context,
|
|
22583
22580
|
tools,
|
|
22584
|
-
fieldTypes,
|
|
22585
22581
|
mode,
|
|
22586
22582
|
designMode,
|
|
22587
22583
|
apiKey,
|
|
@@ -22593,15 +22589,7 @@ async function generate({
|
|
|
22593
22589
|
}) {
|
|
22594
22590
|
let result = null;
|
|
22595
22591
|
const options = {
|
|
22596
|
-
ai: {
|
|
22597
|
-
context,
|
|
22598
|
-
tools,
|
|
22599
|
-
fieldTypes,
|
|
22600
|
-
designMode,
|
|
22601
|
-
model,
|
|
22602
|
-
providerApiKey,
|
|
22603
|
-
providerOptions
|
|
22604
|
-
},
|
|
22592
|
+
ai: { context, tools, designMode, model, providerApiKey, providerOptions },
|
|
22605
22593
|
apiKey,
|
|
22606
22594
|
host
|
|
22607
22595
|
};
|
|
@@ -22618,12 +22606,7 @@ async function generate({
|
|
|
22618
22606
|
} else if (chunk.type === "error") {
|
|
22619
22607
|
throw new Error(chunk.errorText);
|
|
22620
22608
|
}
|
|
22621
|
-
}
|
|
22622
|
-
// No editor is in the loop, so the plugin that will render this output
|
|
22623
|
-
// can't identify itself. It must match this package's version (the
|
|
22624
|
-
// platform enforces the pairing), so that version stands in — and lets
|
|
22625
|
-
// the platform pick the field format the plugin can parse.
|
|
22626
|
-
{ pluginAiVersion: CLOUD_CLIENT_VERSION }
|
|
22609
|
+
}
|
|
22627
22610
|
);
|
|
22628
22611
|
} catch (error48) {
|
|
22629
22612
|
console.error(error48);
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@puckeditor/cloud-client",
|
|
3
|
-
"version": "0.9.0-canary.
|
|
3
|
+
"version": "0.9.0-canary.e1a77bb6",
|
|
4
4
|
"author": "Chris Villa <chris@puckeditor.com>",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@ai-sdk/openai": "^3.0.
|
|
40
|
-
"@puckeditor/core": "0.24.0-canary.
|
|
39
|
+
"@ai-sdk/openai": "^3.0.115",
|
|
40
|
+
"@puckeditor/core": "0.24.0-canary.90665dfb",
|
|
41
41
|
"@types/node": "^24.10.1",
|
|
42
42
|
"ai": "^6.0.228",
|
|
43
43
|
"eslint": "^9.39.4",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"vite-tsconfig-paths": "^5.1.4",
|
|
48
48
|
"vitest": "^4.1.11",
|
|
49
49
|
"zod": "^4.1.12",
|
|
50
|
-
"
|
|
51
|
-
"tsup-config": "0.9.0-canary.
|
|
52
|
-
"
|
|
50
|
+
"tsconfig": "0.9.0-canary.e1a77bb6",
|
|
51
|
+
"tsup-config": "0.9.0-canary.e1a77bb6",
|
|
52
|
+
"eslint-config-custom": "0.9.0-canary.e1a77bb6"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"lint": "eslint \"**/*.ts*\"",
|