@chatu-ai/builder-sdk 0.9.4 → 0.9.6
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 +17 -0
- package/dist/client.js +2 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -315,6 +315,23 @@ export interface BuilderClient {
|
|
|
315
315
|
state?: SandboxState | string;
|
|
316
316
|
}>;
|
|
317
317
|
/** 一次性预览 token(06 §6.1):返回可直接作 iframe src 的带 ?t= 的 URL */
|
|
318
|
+
/** 快照清单(新→旧):沙箱信息面板展示"有几个快照、多大、什么时候" */
|
|
319
|
+
snapshots(conversationId: string): Promise<{
|
|
320
|
+
ok: boolean;
|
|
321
|
+
error?: string;
|
|
322
|
+
snapshots: Array<{
|
|
323
|
+
key: string;
|
|
324
|
+
bytes: number;
|
|
325
|
+
createdAt: number;
|
|
326
|
+
}>;
|
|
327
|
+
}>;
|
|
328
|
+
/** 恢复到指定快照(覆盖工作区文件并重启 dev server);AI 生成中返回 ok:false, error:'BUSY' */
|
|
329
|
+
restoreSnapshot(conversationId: string, key: string): Promise<{
|
|
330
|
+
ok: boolean;
|
|
331
|
+
error?: string;
|
|
332
|
+
message?: string;
|
|
333
|
+
key?: string;
|
|
334
|
+
}>;
|
|
318
335
|
/** port:应用自己起的第二个服务(多端口预览);不传即 dev server */
|
|
319
336
|
previewToken(conversationId: string, opts?: {
|
|
320
337
|
port?: number | null;
|
package/dist/client.js
CHANGED
|
@@ -57,6 +57,8 @@ export function createBuilderClient(options) {
|
|
|
57
57
|
body: JSON.stringify(opts),
|
|
58
58
|
}),
|
|
59
59
|
previewToken: (id, opts) => req(`/${id}/preview-token?${qs({ port: opts?.port ?? undefined })}`),
|
|
60
|
+
snapshots: id => req(`/sandbox/${id}/snapshots`),
|
|
61
|
+
restoreSnapshot: (id, key) => req(`/sandbox/${id}/snapshots/restore`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ key }) }),
|
|
60
62
|
wake: id => req(`/sandbox/${id}/wake`, { method: 'POST' }),
|
|
61
63
|
share: (id, ttlHours) => req(`/${id}/preview-share`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ ttlHours }) }),
|
|
62
64
|
revokeShare: (id, token) => req(`/${id}/preview-share/revoke`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ token }) }),
|