@chatu-ai/builder-sdk 0.6.2 → 0.7.0

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
@@ -175,6 +175,11 @@ export interface BuilderClient {
175
175
  ref?: string;
176
176
  }): Promise<string>;
177
177
  downloadUrl(conversationId: string): string;
178
+ /** 原样下载单个文件(图片/PDF 等预览用),返回 Blob 与 content-type */
179
+ download(conversationId: string, path: string): Promise<{
180
+ blob: Blob;
181
+ contentType: string;
182
+ }>;
178
183
  };
179
184
  /** 凭据库(技术方案 14 §2):列表脱敏,永不返回明文 */
180
185
  credentials: {
package/dist/client.js CHANGED
@@ -75,6 +75,12 @@ export function createBuilderClient(options) {
75
75
  },
76
76
  read: (id, path, opts) => req(`/${id}/files/read?${qs({ path, ...opts })}`),
77
77
  downloadUrl: id => `${restBase}/${id}/files/download`,
78
+ download: async (id, path) => {
79
+ const res = await doFetch(`${restBase}/${id}/files/download?path=${encodeURIComponent(path)}`, auth.apply({}));
80
+ if (!res.ok)
81
+ throw new BuilderApiError(res.status, await res.text().catch(() => ''));
82
+ return { blob: await res.blob(), contentType: res.headers.get('content-type') ?? 'application/octet-stream' };
83
+ },
78
84
  },
79
85
  credentials: {
80
86
  list: conversationId => req(`/credentials${conversationId ? `?conversationId=${encodeURIComponent(conversationId)}` : ''}`),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatu-ai/builder-sdk",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "description": "ChatU Builder client SDK core: REST + streaming client, zod event schemas, seq resume",
5
5
  "license": "MIT",
6
6
  "type": "module",