@puckeditor/plugin-ai 0.10.0-canary.8d2c27d9 → 0.10.0-canary.a3add942
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +13 -3
- package/dist/index.mjs +13 -3
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -4596,7 +4596,7 @@ var usePuck2 = (0, import_core5.createUsePuck)();
|
|
|
4596
4596
|
var DEFAULT_API_VERSION = "v2";
|
|
4597
4597
|
var BUILD_OP_DEBOUNCE_MS = 1e3 / 60;
|
|
4598
4598
|
var CLIENT_TOOL_ENDPOINT_UNAVAILABLE_ERROR_MESSAGE = "Unable to verify the page data. Please enable the `/chat/tool` endpoint on the server and try again.";
|
|
4599
|
-
var PLUGIN_AI_VERSION = true ? "0.10.0-canary.
|
|
4599
|
+
var PLUGIN_AI_VERSION = true ? "0.10.0-canary.a3add942" : "unknown";
|
|
4600
4600
|
var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${(0, import_ulid.ulid)()}`;
|
|
4601
4601
|
async function prepareRequestOptions(defaults, prepareRequest) {
|
|
4602
4602
|
if (!prepareRequest) return defaults;
|
|
@@ -4926,7 +4926,15 @@ function usePuckAiInternal({
|
|
|
4926
4926
|
if (options.isAbort || options.isDisconnect || options.isError) {
|
|
4927
4927
|
setToolStatus((current) => finishLoadingTools(current, "Interrupted"));
|
|
4928
4928
|
}
|
|
4929
|
-
settle().then(() =>
|
|
4929
|
+
settle().then(() => {
|
|
4930
|
+
onFinish?.(options);
|
|
4931
|
+
const addedAsset = (options.message?.parts ?? []).some(
|
|
4932
|
+
(part) => part.type === "tool-generateImage" && part.state === "output-available"
|
|
4933
|
+
);
|
|
4934
|
+
if (addedAsset) {
|
|
4935
|
+
window.dispatchEvent(new CustomEvent("puckeditor:assets-changed"));
|
|
4936
|
+
}
|
|
4937
|
+
});
|
|
4930
4938
|
}
|
|
4931
4939
|
});
|
|
4932
4940
|
const sendMessage = (0, import_react18.useCallback)(
|
|
@@ -5003,14 +5011,16 @@ function usePuckAiInternal({
|
|
|
5003
5011
|
body?.error ?? `Puck AI request failed: ${response.status} ${response.statusText}`
|
|
5004
5012
|
);
|
|
5005
5013
|
}
|
|
5014
|
+
let chatId;
|
|
5006
5015
|
for await (const part of iterateSSE(response.body)) {
|
|
5007
5016
|
if (controller.signal.aborted) throw abortError();
|
|
5008
5017
|
if (part.type === "error") throw new Error(part.errorText);
|
|
5018
|
+
if (part.type === "data-new-chat-created") chatId = part.data.chatId;
|
|
5009
5019
|
if (part.type === "data-build-op" || part.type === "data-puck-actions") {
|
|
5010
5020
|
changed = true;
|
|
5011
5021
|
}
|
|
5012
5022
|
await untilAborted(
|
|
5013
|
-
applyToEditor(part, { signal: controller.signal }),
|
|
5023
|
+
applyToEditor(part, { chatId, signal: controller.signal }),
|
|
5014
5024
|
controller.signal
|
|
5015
5025
|
);
|
|
5016
5026
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -4627,7 +4627,7 @@ var usePuck2 = createUsePuck2();
|
|
|
4627
4627
|
var DEFAULT_API_VERSION = "v2";
|
|
4628
4628
|
var BUILD_OP_DEBOUNCE_MS = 1e3 / 60;
|
|
4629
4629
|
var CLIENT_TOOL_ENDPOINT_UNAVAILABLE_ERROR_MESSAGE = "Unable to verify the page data. Please enable the `/chat/tool` endpoint on the server and try again.";
|
|
4630
|
-
var PLUGIN_AI_VERSION = true ? "0.10.0-canary.
|
|
4630
|
+
var PLUGIN_AI_VERSION = true ? "0.10.0-canary.a3add942" : "unknown";
|
|
4631
4631
|
var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${ulid()}`;
|
|
4632
4632
|
async function prepareRequestOptions(defaults, prepareRequest) {
|
|
4633
4633
|
if (!prepareRequest) return defaults;
|
|
@@ -4957,7 +4957,15 @@ function usePuckAiInternal({
|
|
|
4957
4957
|
if (options.isAbort || options.isDisconnect || options.isError) {
|
|
4958
4958
|
setToolStatus((current) => finishLoadingTools(current, "Interrupted"));
|
|
4959
4959
|
}
|
|
4960
|
-
settle().then(() =>
|
|
4960
|
+
settle().then(() => {
|
|
4961
|
+
onFinish?.(options);
|
|
4962
|
+
const addedAsset = (options.message?.parts ?? []).some(
|
|
4963
|
+
(part) => part.type === "tool-generateImage" && part.state === "output-available"
|
|
4964
|
+
);
|
|
4965
|
+
if (addedAsset) {
|
|
4966
|
+
window.dispatchEvent(new CustomEvent("puckeditor:assets-changed"));
|
|
4967
|
+
}
|
|
4968
|
+
});
|
|
4961
4969
|
}
|
|
4962
4970
|
});
|
|
4963
4971
|
const sendMessage = useCallback5(
|
|
@@ -5034,14 +5042,16 @@ function usePuckAiInternal({
|
|
|
5034
5042
|
body?.error ?? `Puck AI request failed: ${response.status} ${response.statusText}`
|
|
5035
5043
|
);
|
|
5036
5044
|
}
|
|
5045
|
+
let chatId;
|
|
5037
5046
|
for await (const part of iterateSSE(response.body)) {
|
|
5038
5047
|
if (controller.signal.aborted) throw abortError();
|
|
5039
5048
|
if (part.type === "error") throw new Error(part.errorText);
|
|
5049
|
+
if (part.type === "data-new-chat-created") chatId = part.data.chatId;
|
|
5040
5050
|
if (part.type === "data-build-op" || part.type === "data-puck-actions") {
|
|
5041
5051
|
changed = true;
|
|
5042
5052
|
}
|
|
5043
5053
|
await untilAborted(
|
|
5044
|
-
applyToEditor(part, { signal: controller.signal }),
|
|
5054
|
+
applyToEditor(part, { chatId, signal: controller.signal }),
|
|
5045
5055
|
controller.signal
|
|
5046
5056
|
);
|
|
5047
5057
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@puckeditor/plugin-ai",
|
|
3
|
-
"version": "0.10.0-canary.
|
|
3
|
+
"version": "0.10.0-canary.a3add942",
|
|
4
4
|
"author": "Chris Villa <chris@puckeditor.com>",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -54,12 +54,12 @@
|
|
|
54
54
|
"typescript": "^5.5.4",
|
|
55
55
|
"vite-tsconfig-paths": "^5.1.4",
|
|
56
56
|
"vitest": "^4.1.12",
|
|
57
|
-
"@puckeditor/ai-types": "0.10.0-canary.
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
57
|
+
"@puckeditor/ai-types": "0.10.0-canary.a3add942",
|
|
58
|
+
"@puckeditor/platform-types": "0.10.0-canary.a3add942",
|
|
59
|
+
"eslint-config-custom": "0.10.0-canary.a3add942",
|
|
60
|
+
"reducer": "0.10.0-canary.a3add942",
|
|
61
|
+
"tsconfig": "0.10.0-canary.a3add942",
|
|
62
|
+
"tsup-config": "0.10.0-canary.a3add942"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"@puckeditor/core": "^0",
|