@chatu-ai/builder-sdk 0.8.4 → 0.8.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 CHANGED
@@ -157,7 +157,7 @@ export interface SandboxMeta {
157
157
  };
158
158
  } | null;
159
159
  }
160
- /** 沙箱启动进度:step 0 调度 1 网络 2 拉镜像 3 启动容器 4 健康检查 5 就绪 */
160
+ /** 沙箱启动进度:step 0 调度 1 网络 2 拉镜像 3 启动容器 4 配置环境 5 恢复数据 6 启动应用 7 就绪 */
161
161
  export interface SandboxStartup {
162
162
  ok: boolean;
163
163
  state?: string;
@@ -165,6 +165,9 @@ export interface SandboxStartup {
165
165
  phase?: string | null;
166
166
  ready?: boolean;
167
167
  containerState?: string | null;
168
+ /** 编排阶段(Pod Running 之后):assigning | restoring | starting-devserver | ready | failed */
169
+ orchestrationPhase?: string | null;
170
+ phaseMessage?: string | null;
168
171
  startedAt?: string | null;
169
172
  elapsedMs?: number;
170
173
  step?: number;
@@ -536,9 +539,17 @@ export interface BuilderClient {
536
539
  }>;
537
540
  };
538
541
  logs: {
539
- /** dev server 最近日志(沙箱未运行返回空) */
540
- tail(conversationId: string, lines?: number): Promise<{
542
+ /**
543
+ * dev server 日志(沙箱未运行时读落盘快照)。
544
+ * 传 `since`(上次返回的 nextSeq)只取新增行;`truncated=true` 表示需整体替换(首次/缓冲区已滚动/来自快照)。
545
+ */
546
+ tail(conversationId: string, lines?: number, opts?: {
547
+ since?: number | null;
548
+ }): Promise<{
541
549
  lines: string[];
550
+ nextSeq?: number | null;
551
+ truncated?: boolean;
552
+ source?: string;
542
553
  }>;
543
554
  };
544
555
  export: {
package/dist/client.js CHANGED
@@ -129,9 +129,13 @@ export function createBuilderClient(options) {
129
129
  export: (id, env) => req(`/${id}/data/export?env=${env ?? 'prod'}`),
130
130
  },
131
131
  logs: {
132
- tail: async (id, lines) => {
133
- const r = await req(`/${id}/logs?tail=${lines ?? 200}`);
134
- return { lines: Array.isArray(r) ? r : (r.lines ?? []) };
132
+ tail: async (id, lines, opts) => {
133
+ const since = opts?.since;
134
+ const q = `tail=${lines ?? 200}${since === undefined || since === null ? '' : `&since=${since}`}`;
135
+ const r = await req(`/${id}/logs?${q}`);
136
+ if (Array.isArray(r))
137
+ return { lines: r, truncated: true };
138
+ return { lines: r.lines ?? [], nextSeq: r.nextSeq ?? null, truncated: r.truncated ?? since === undefined, source: r.source };
135
139
  },
136
140
  },
137
141
  export: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatu-ai/builder-sdk",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
4
4
  "description": "ChatU Builder client SDK core: REST + streaming client, zod event schemas, seq resume",
5
5
  "license": "MIT",
6
6
  "type": "module",