@chatu-ai/builder-sdk 0.9.1 → 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,16 @@ 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;
43
+ /** 最近一次异常退出;gaveUp=true 表示 runtime 已停止自动重启,需要修代码后手动重启 */
44
+ crash?: {
45
+ at?: string | null;
46
+ exitCode?: number | null;
47
+ restart?: number;
48
+ gaveUp?: boolean;
49
+ errors?: string[];
50
+ } | null;
41
51
  } | null;
42
52
  /** runtime 内是否仍有生成在跑(上一轮连接中断后后台继续):xid 可用于取消 */
43
53
  agent?: {
@@ -288,7 +298,10 @@ export interface BuilderClient {
288
298
  state?: SandboxState | string;
289
299
  }>;
290
300
  /** 一次性预览 token(06 §6.1):返回可直接作 iframe src 的带 ?t= 的 URL */
291
- previewToken(conversationId: string): Promise<{
301
+ /** port:应用自己起的第二个服务(多端口预览);不传即 dev server */
302
+ previewToken(conversationId: string, opts?: {
303
+ port?: number | null;
304
+ }): Promise<{
292
305
  token: string;
293
306
  previewUrl: string;
294
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.1",
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",