@chatu-ai/builder-sdk 0.7.4 → 0.7.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 +25 -0
- package/dist/client.js +3 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -39,6 +39,12 @@ export interface SandboxStatus {
|
|
|
39
39
|
startingForMs?: number | null;
|
|
40
40
|
lastError?: string | null;
|
|
41
41
|
} | null;
|
|
42
|
+
/** runtime 内是否仍有生成在跑(上一轮连接中断后后台继续):xid 可用于取消 */
|
|
43
|
+
agent?: {
|
|
44
|
+
executing: boolean;
|
|
45
|
+
xid?: string | null;
|
|
46
|
+
sinceMs?: number | null;
|
|
47
|
+
} | null;
|
|
42
48
|
}
|
|
43
49
|
export interface VersionInfo {
|
|
44
50
|
sha: string;
|
|
@@ -183,6 +189,25 @@ export interface BuilderClient {
|
|
|
183
189
|
revokeShare(conversationId: string, token: string): Promise<{
|
|
184
190
|
ok: boolean;
|
|
185
191
|
}>;
|
|
192
|
+
/** 重启 dev server(clean=true 先清 .next/.turbo 构建缓存);服务端立即返回,就绪状态用 status().devServer.ready 轮询 */
|
|
193
|
+
restartDevServer(conversationId: string, opts?: {
|
|
194
|
+
clean?: boolean;
|
|
195
|
+
}): Promise<{
|
|
196
|
+
ok: boolean;
|
|
197
|
+
ready?: boolean;
|
|
198
|
+
cleaned?: boolean;
|
|
199
|
+
}>;
|
|
200
|
+
/** 休眠:保存快照后关闭 Pod(下次进入/发消息自动唤醒) */
|
|
201
|
+
hibernate(conversationId: string): Promise<{
|
|
202
|
+
ok: boolean;
|
|
203
|
+
state?: string;
|
|
204
|
+
skipped?: boolean;
|
|
205
|
+
}>;
|
|
206
|
+
/** 强制关闭 Pod:不做新快照,立即删除(沙箱卡死时用;保留已有快照) */
|
|
207
|
+
terminate(conversationId: string): Promise<{
|
|
208
|
+
ok: boolean;
|
|
209
|
+
state?: string;
|
|
210
|
+
}>;
|
|
186
211
|
};
|
|
187
212
|
versions: {
|
|
188
213
|
list(conversationId: string, opts?: {
|
package/dist/client.js
CHANGED
|
@@ -60,6 +60,9 @@ export function createBuilderClient(options) {
|
|
|
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 }) }),
|
|
63
|
+
restartDevServer: (id, opts) => req(`/${id}/devserver/restart?clean=${opts?.clean ? 'true' : 'false'}`, { method: 'POST' }),
|
|
64
|
+
hibernate: id => req(`/sandbox/${id}/hibernate`, { method: 'POST' }),
|
|
65
|
+
terminate: id => req(`/sandbox/${id}/terminate`, { method: 'POST' }),
|
|
63
66
|
},
|
|
64
67
|
versions: {
|
|
65
68
|
// 服务端形状:{ versions: VersionInfo[] }(runtime 透传)
|