@chatu-ai/builder-sdk 0.3.1 → 0.4.1

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
@@ -107,6 +107,29 @@ export interface DataUsage {
107
107
  rates?: Record<string, number>;
108
108
  error?: string;
109
109
  }
110
+ export interface DeployInput {
111
+ provider: 'edgeone';
112
+ projectName: string;
113
+ credentialId?: string;
114
+ token?: string;
115
+ save?: boolean;
116
+ label?: string;
117
+ env?: 'production' | 'preview';
118
+ includeAppEnv?: boolean;
119
+ includeDataAccess?: boolean;
120
+ }
121
+ export interface DeployResult {
122
+ ok: boolean;
123
+ error?: string;
124
+ state?: string;
125
+ projectName?: string;
126
+ env?: string;
127
+ url?: string;
128
+ output?: string;
129
+ envVarsApplied?: number;
130
+ envVarsFailed?: string[];
131
+ credentialId?: string | null;
132
+ }
110
133
  export interface BuilderClient {
111
134
  chat: {
112
135
  stream(conversationId: string, prompt: string, opts?: {
@@ -171,6 +194,8 @@ export interface BuilderClient {
171
194
  }): Promise<DeploySettingView>;
172
195
  /** 推送到用户 Git 仓库;沙箱未运行时 ok=false, error='SANDBOX_NOT_RUNNING' */
173
196
  pushGit(conversationId: string, input: GitPushInput): Promise<GitPushResult>;
197
+ /** 一键部署(P1:EdgeOne Pages);沙箱未运行时 ok=false, error='SANDBOX_NOT_RUNNING' */
198
+ deploy(conversationId: string, input: DeployInput): Promise<DeployResult>;
174
199
  };
175
200
  /** 平台数据能力接入信息(技术方案 15):线上部署所需环境变量;apiKey 为服务端密钥 */
176
201
  data: {
@@ -182,6 +207,41 @@ export interface BuilderClient {
182
207
  }>;
183
208
  /** 本月用量:dev/prod 原始计量与折算点数估算、只读状态、单价 */
184
209
  usage(conversationId: string): Promise<DataUsage>;
210
+ /** 复制命名空间(默认 dev→prod) */
211
+ promote(conversationId: string, input?: {
212
+ from?: 'dev' | 'prod';
213
+ to?: 'dev' | 'prod';
214
+ overwrite?: boolean;
215
+ kv?: boolean;
216
+ storage?: boolean;
217
+ }): Promise<{
218
+ ok: boolean;
219
+ error?: string;
220
+ kv?: {
221
+ copied: number;
222
+ skipped: number;
223
+ } | null;
224
+ storage?: {
225
+ copied: number;
226
+ skipped: number;
227
+ bytes: number;
228
+ } | null;
229
+ }>;
230
+ /** 导出数据:KV 键值 + 对象清单(1 小时下载地址) */
231
+ export(conversationId: string, env?: 'dev' | 'prod'): Promise<{
232
+ ok: boolean;
233
+ env: string;
234
+ kv: Array<{
235
+ key: string;
236
+ value: unknown;
237
+ ttl?: number | null;
238
+ }>;
239
+ storage: Array<{
240
+ key: string;
241
+ size: number;
242
+ url?: string | null;
243
+ }>;
244
+ }>;
185
245
  };
186
246
  export: {
187
247
  /**
package/dist/client.js CHANGED
@@ -85,10 +85,13 @@ export function createBuilderClient(options) {
85
85
  settings: id => req(`/${id}/deploy-settings`),
86
86
  saveSetting: (id, input) => req(`/${id}/deploy-settings`, { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify(input) }),
87
87
  pushGit: (id, input) => req(`/${id}/export/git`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(input) }),
88
+ deploy: (id, input) => req(`/${id}/export/deploy`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(input) }),
88
89
  },
89
90
  data: {
90
91
  access: id => req(`/${id}/data-access`),
91
92
  usage: id => req(`/${id}/data-usage`),
93
+ promote: (id, input) => req(`/${id}/data/promote`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(input ?? {}) }),
94
+ export: (id, env) => req(`/${id}/data/export?env=${env ?? 'prod'}`),
92
95
  },
93
96
  export: {
94
97
  zip: async (id) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatu-ai/builder-sdk",
3
- "version": "0.3.1",
3
+ "version": "0.4.1",
4
4
  "description": "ChatU Builder client SDK core: REST + streaming client, zod event schemas, seq resume",
5
5
  "license": "MIT",
6
6
  "type": "module",