@chatu-ai/builder-sdk 0.8.0 → 0.8.2

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
@@ -116,6 +116,43 @@ export interface DataUsage {
116
116
  rates?: Record<string, number>;
117
117
  error?: string;
118
118
  }
119
+ /** 沙箱诊断信息(技术方案 08):用于判断 Pod 是否已使用最新镜像、是否加载了预期能力 */
120
+ export interface SandboxMeta {
121
+ ok: boolean;
122
+ sandbox?: {
123
+ sandboxId?: string;
124
+ state?: string;
125
+ podName?: string | null;
126
+ machineType?: string | null;
127
+ createdAt?: string | null;
128
+ lastActivity?: string | null;
129
+ lastAgentActivity?: string | null;
130
+ hasSnapshot?: boolean;
131
+ snapshotKey?: string | null;
132
+ };
133
+ /** 平台当前配置的 Builder 镜像(与 runtime.version 对照可判断 Pod 是否为最新) */
134
+ configuredImage?: string | null;
135
+ runtime?: {
136
+ ok?: boolean;
137
+ error?: string;
138
+ message?: string;
139
+ version?: string | null;
140
+ image?: string | null;
141
+ node?: string;
142
+ startedAt?: string;
143
+ uptimeMs?: number;
144
+ workspaceDir?: string;
145
+ appSdkVersion?: string | null;
146
+ skills?: string[];
147
+ clis?: Record<string, string | null>;
148
+ devServer?: Record<string, unknown>;
149
+ agent?: {
150
+ executing?: boolean;
151
+ xid?: string | null;
152
+ sinceMs?: number | null;
153
+ };
154
+ } | null;
155
+ }
119
156
  export type FunctionProvider = 'aliyun-fc' | 'tencent-scf' | 'volc-vefaas';
120
157
  /** 函数计算部署(技术方案 17):凭据二选一 credentialId(凭据库 aliyun/tencent/volcengine)或 accessKeyId+accessKeySecret */
121
158
  export interface FunctionDeployInput {
@@ -251,6 +288,8 @@ export interface BuilderClient {
251
288
  ok: boolean;
252
289
  state?: string;
253
290
  }>;
291
+ /** 沙箱诊断信息:编排侧(状态/Pod/机型/时间/快照)+ runtime(版本/Node/Skills/CLI)+ 平台配置镜像 */
292
+ meta(conversationId: string): Promise<SandboxMeta>;
254
293
  };
255
294
  versions: {
256
295
  list(conversationId: string, opts?: {
@@ -353,6 +392,40 @@ export interface BuilderClient {
353
392
  removed?: boolean;
354
393
  }>;
355
394
  };
395
+ /** 资源面板:文档集合浏览(技术方案 19) */
396
+ db: {
397
+ collections(conversationId: string, env?: 'dev' | 'prod'): Promise<{
398
+ ok: boolean;
399
+ collections: Array<{
400
+ name: string;
401
+ count: number;
402
+ }>;
403
+ }>;
404
+ query(conversationId: string, collection: string, opts?: {
405
+ env?: 'dev' | 'prod';
406
+ filter?: Record<string, unknown>;
407
+ sort?: Record<string, 1 | -1>;
408
+ skip?: number;
409
+ limit?: number;
410
+ }): Promise<{
411
+ ok: boolean;
412
+ docs: Array<Record<string, unknown>>;
413
+ total: number;
414
+ nextSkip: number | null;
415
+ }>;
416
+ replace(conversationId: string, collection: string, id: string, doc: Record<string, unknown>, env?: 'dev' | 'prod'): Promise<{
417
+ ok: boolean;
418
+ doc?: Record<string, unknown>;
419
+ }>;
420
+ remove(conversationId: string, collection: string, id: string, env?: 'dev' | 'prod'): Promise<{
421
+ ok: boolean;
422
+ removed?: boolean;
423
+ }>;
424
+ drop(conversationId: string, collection: string, env?: 'dev' | 'prod'): Promise<{
425
+ ok: boolean;
426
+ dropped?: boolean;
427
+ }>;
428
+ };
356
429
  /** 资源面板:对象存储浏览 */
357
430
  storage: {
358
431
  list(conversationId: string, opts?: {
@@ -400,6 +473,7 @@ export interface BuilderClient {
400
473
  overwrite?: boolean;
401
474
  kv?: boolean;
402
475
  storage?: boolean;
476
+ db?: boolean;
403
477
  }): Promise<{
404
478
  ok: boolean;
405
479
  error?: string;
@@ -412,6 +486,10 @@ export interface BuilderClient {
412
486
  skipped: number;
413
487
  bytes: number;
414
488
  } | null;
489
+ db?: {
490
+ copied: number;
491
+ skipped: number;
492
+ } | null;
415
493
  }>;
416
494
  /** 导出数据:KV 键值 + 对象清单(1 小时下载地址) */
417
495
  export(conversationId: string, env?: 'dev' | 'prod'): Promise<{
package/dist/client.js CHANGED
@@ -63,6 +63,7 @@ export function createBuilderClient(options) {
63
63
  restartDevServer: (id, opts) => req(`/${id}/devserver/restart?clean=${opts?.clean ? 'true' : 'false'}`, { method: 'POST' }),
64
64
  hibernate: id => req(`/sandbox/${id}/hibernate`, { method: 'POST' }),
65
65
  terminate: id => req(`/sandbox/${id}/terminate`, { method: 'POST' }),
66
+ meta: id => req(`/sandbox/${id}/meta`),
66
67
  },
67
68
  versions: {
68
69
  // 服务端形状:{ versions: VersionInfo[] }(runtime 透传)
@@ -110,6 +111,13 @@ export function createBuilderClient(options) {
110
111
  set: (id, key, value, o) => req(`/${id}/data/kv/${encPath(key)}?${qs({ env: o?.env })}`, { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ value, ex: o?.ex }) }),
111
112
  remove: (id, key, env) => req(`/${id}/data/kv/${encPath(key)}?${qs({ env })}`, { method: 'DELETE' }),
112
113
  },
114
+ db: {
115
+ collections: (id, env) => req(`/${id}/data/db?${qs({ env })}`),
116
+ query: (id, coll, o) => req(`/${id}/data/db/${encPath(coll)}/query?${qs({ env: o?.env })}`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ filter: o?.filter, sort: o?.sort, skip: o?.skip, limit: o?.limit }) }),
117
+ replace: (id, coll, docId, doc, env) => req(`/${id}/data/db/${encPath(coll)}/${encPath(docId)}?${qs({ env })}`, { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify(doc) }),
118
+ remove: (id, coll, docId, env) => req(`/${id}/data/db/${encPath(coll)}/${encPath(docId)}?${qs({ env })}`, { method: 'DELETE' }),
119
+ drop: (id, coll, env) => req(`/${id}/data/db/${encPath(coll)}?${qs({ env })}`, { method: 'DELETE' }),
120
+ },
113
121
  storage: {
114
122
  list: (id, o) => req(`/${id}/data/storage?${qs({ env: o?.env, prefix: o?.prefix, cursor: o?.cursor ?? undefined, limit: o?.limit })}`),
115
123
  sign: (id, key, o) => req(`/${id}/data/storage/sign?${qs({ env: o?.env })}`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ key, expiresIn: o?.expiresIn, downloadName: o?.downloadName }) }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatu-ai/builder-sdk",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "ChatU Builder client SDK core: REST + streaming client, zod event schemas, seq resume",
5
5
  "license": "MIT",
6
6
  "type": "module",