@chatu-ai/builder-sdk-vue 0.9.2 → 0.9.4
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/usePreviewUrl.d.ts
CHANGED
|
@@ -6,7 +6,9 @@ import type { BuilderClient } from '@chatu-ai/builder-sdk';
|
|
|
6
6
|
* - 授权失效(预览域授权页 postMessage)时调用 refresh() 重取
|
|
7
7
|
* token 一次性:每次 refresh 都签发新 token,旧 iframe 已兑换为 cookie 不受影响
|
|
8
8
|
*/
|
|
9
|
-
export declare function usePreviewUrl(client: BuilderClient, conversationId: string, rawPreviewUrl: Ref<string | undefined
|
|
9
|
+
export declare function usePreviewUrl(client: BuilderClient, conversationId: string, rawPreviewUrl: Ref<string | undefined>,
|
|
10
|
+
/** 预览端口(应用自己起的第二个服务);变化时自动重取 token 与地址 */
|
|
11
|
+
port?: Ref<number | null | undefined>): {
|
|
10
12
|
src: Ref<string | undefined, string | undefined>;
|
|
11
13
|
error: Ref<string | null, string | null>;
|
|
12
14
|
refresh: () => Promise<void>;
|
package/dist/usePreviewUrl.js
CHANGED
|
@@ -5,7 +5,9 @@ import { ref, watch } from 'vue';
|
|
|
5
5
|
* - 授权失效(预览域授权页 postMessage)时调用 refresh() 重取
|
|
6
6
|
* token 一次性:每次 refresh 都签发新 token,旧 iframe 已兑换为 cookie 不受影响
|
|
7
7
|
*/
|
|
8
|
-
export function usePreviewUrl(client, conversationId, rawPreviewUrl
|
|
8
|
+
export function usePreviewUrl(client, conversationId, rawPreviewUrl,
|
|
9
|
+
/** 预览端口(应用自己起的第二个服务);变化时自动重取 token 与地址 */
|
|
10
|
+
port) {
|
|
9
11
|
const src = ref(undefined);
|
|
10
12
|
const error = ref(null);
|
|
11
13
|
let seq = 0;
|
|
@@ -16,7 +18,7 @@ export function usePreviewUrl(client, conversationId, rawPreviewUrl) {
|
|
|
16
18
|
}
|
|
17
19
|
const my = ++seq;
|
|
18
20
|
try {
|
|
19
|
-
const { previewUrl } = await client.sandbox.previewToken(conversationId);
|
|
21
|
+
const { previewUrl } = await client.sandbox.previewToken(conversationId, { port: port?.value ?? null });
|
|
20
22
|
if (my === seq) {
|
|
21
23
|
src.value = previewUrl || rawPreviewUrl.value;
|
|
22
24
|
error.value = previewUrl ? null : 'preview-token 响应缺少 previewUrl';
|
|
@@ -30,6 +32,6 @@ export function usePreviewUrl(client, conversationId, rawPreviewUrl) {
|
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
|
-
watch(rawPreviewUrl, () => void refresh(), { immediate: true });
|
|
35
|
+
watch([rawPreviewUrl, () => port?.value], () => void refresh(), { immediate: true });
|
|
34
36
|
return { src, error, refresh };
|
|
35
37
|
}
|
|
@@ -27,6 +27,7 @@ export declare function useSandboxStatus(client: BuilderClient, conversationId:
|
|
|
27
27
|
readonly ready?: boolean | undefined;
|
|
28
28
|
readonly startingForMs?: number | null | undefined;
|
|
29
29
|
readonly lastError?: string | null | undefined;
|
|
30
|
+
readonly ports?: readonly number[] | null | undefined;
|
|
30
31
|
readonly crash?: {
|
|
31
32
|
readonly at?: string | null | undefined;
|
|
32
33
|
readonly exitCode?: number | null | undefined;
|
|
@@ -51,6 +52,7 @@ export declare function useSandboxStatus(client: BuilderClient, conversationId:
|
|
|
51
52
|
readonly ready?: boolean | undefined;
|
|
52
53
|
readonly startingForMs?: number | null | undefined;
|
|
53
54
|
readonly lastError?: string | null | undefined;
|
|
55
|
+
readonly ports?: readonly number[] | null | undefined;
|
|
54
56
|
readonly crash?: {
|
|
55
57
|
readonly at?: string | null | undefined;
|
|
56
58
|
readonly exitCode?: number | null | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatu-ai/builder-sdk-vue",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"description": "Vue 3 bindings for @chatu-ai/builder-sdk: useBuilderChat / useSandboxStatus / usePreviewUrl",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"node": ">=18"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@chatu-ai/builder-sdk": "0.9.
|
|
44
|
+
"@chatu-ai/builder-sdk": "0.9.4"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"vue": "^3.4.0"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"typescript": "^5.7.0",
|
|
51
51
|
"vue": "^3.5.0",
|
|
52
52
|
"vitest": "^3.0.0",
|
|
53
|
-
"@chatu-ai/builder-sdk-mock": "0.9.
|
|
53
|
+
"@chatu-ai/builder-sdk-mock": "0.9.4"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "tsc -p tsconfig.json",
|