@chatu-ai/builder-sdk 0.9.2 → 0.9.3

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/client.d.ts CHANGED
@@ -38,6 +38,8 @@ export interface SandboxStatus {
38
38
  ready?: boolean;
39
39
  startingForMs?: number | null;
40
40
  lastError?: string | null;
41
+ /** 沙箱内处于 LISTEN 的端口,首个为 dev server;用于多端口预览切换 */
42
+ ports?: number[] | null;
41
43
  /** 最近一次异常退出;gaveUp=true 表示 runtime 已停止自动重启,需要修代码后手动重启 */
42
44
  crash?: {
43
45
  at?: string | null;
@@ -296,7 +298,10 @@ export interface BuilderClient {
296
298
  state?: SandboxState | string;
297
299
  }>;
298
300
  /** 一次性预览 token(06 §6.1):返回可直接作 iframe src 的带 ?t= 的 URL */
299
- previewToken(conversationId: string): Promise<{
301
+ /** port:应用自己起的第二个服务(多端口预览);不传即 dev server */
302
+ previewToken(conversationId: string, opts?: {
303
+ port?: number | null;
304
+ }): Promise<{
300
305
  token: string;
301
306
  previewUrl: string;
302
307
  }>;
package/dist/client.js CHANGED
@@ -56,7 +56,7 @@ export function createBuilderClient(options) {
56
56
  headers: { 'content-type': 'application/json' },
57
57
  body: JSON.stringify(opts),
58
58
  }),
59
- previewToken: id => req(`/${id}/preview-token`),
59
+ previewToken: (id, opts) => req(`/${id}/preview-token?${qs({ port: opts?.port ?? undefined })}`),
60
60
  wake: id => req(`/sandbox/${id}/wake`, { method: 'POST' }),
61
61
  share: (id, ttlHours) => req(`/${id}/preview-share`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ ttlHours }) }),
62
62
  revokeShare: (id, token) => req(`/${id}/preview-share/revoke`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ token }) }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatu-ai/builder-sdk",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "ChatU Builder client SDK core: REST + streaming client, zod event schemas, seq resume",
5
5
  "license": "MIT",
6
6
  "type": "module",