@kevisual/cnb 0.0.70 → 0.0.71

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/cli.js CHANGED
@@ -65175,7 +65175,7 @@ app.route({
65175
65175
  };
65176
65176
  }).addTo(app);
65177
65177
 
65178
- // node_modules/.pnpm/@ai-sdk+gateway@3.0.93_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
65178
+ // node_modules/.pnpm/@ai-sdk+gateway@3.0.95_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
65179
65179
  var import_oidc = __toESM(require_dist(), 1);
65180
65180
  var import_oidc2 = __toESM(require_dist(), 1);
65181
65181
  var marker17 = "vercel.ai.gateway.error";
@@ -66471,7 +66471,7 @@ async function getVercelRequestId() {
66471
66471
  var _a92;
66472
66472
  return (_a92 = import_oidc.getContext().headers) == null ? undefined : _a92["x-vercel-id"];
66473
66473
  }
66474
- var VERSION3 = "3.0.93";
66474
+ var VERSION3 = "3.0.95";
66475
66475
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
66476
66476
  function createGatewayProvider(options = {}) {
66477
66477
  var _a92, _b92;
@@ -66658,7 +66658,7 @@ async function getGatewayAuthToken(options) {
66658
66658
  };
66659
66659
  }
66660
66660
 
66661
- // node_modules/.pnpm/ai@6.0.153_zod@4.3.6/node_modules/ai/dist/index.mjs
66661
+ // node_modules/.pnpm/ai@6.0.156_zod@4.3.6/node_modules/ai/dist/index.mjs
66662
66662
  var import_api = __toESM(require_src(), 1);
66663
66663
  var import_api2 = __toESM(require_src(), 1);
66664
66664
  var __defProp4 = Object.defineProperty;
@@ -67229,7 +67229,7 @@ function detectMediaType({
67229
67229
  }
67230
67230
  return;
67231
67231
  }
67232
- var VERSION4 = "6.0.153";
67232
+ var VERSION4 = "6.0.156";
67233
67233
  var download = async ({
67234
67234
  url: url4,
67235
67235
  maxBytes,
@@ -69608,7 +69608,7 @@ async function toResponseMessages({
69608
69608
  type: "tool-call",
69609
69609
  toolCallId: part.toolCallId,
69610
69610
  toolName: part.toolName,
69611
- input: part.input,
69611
+ input: part.invalid && typeof part.input !== "object" ? {} : part.input,
69612
69612
  providerExecuted: part.providerExecuted,
69613
69613
  providerOptions: part.providerMetadata
69614
69614
  });
package/dist/npc.js CHANGED
@@ -63116,7 +63116,7 @@ app.route({
63116
63116
  };
63117
63117
  }).addTo(app);
63118
63118
 
63119
- // node_modules/.pnpm/@ai-sdk+gateway@3.0.93_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
63119
+ // node_modules/.pnpm/@ai-sdk+gateway@3.0.95_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
63120
63120
  var import_oidc = __toESM(require_dist(), 1);
63121
63121
  var import_oidc2 = __toESM(require_dist(), 1);
63122
63122
  var marker17 = "vercel.ai.gateway.error";
@@ -64412,7 +64412,7 @@ async function getVercelRequestId() {
64412
64412
  var _a92;
64413
64413
  return (_a92 = import_oidc.getContext().headers) == null ? undefined : _a92["x-vercel-id"];
64414
64414
  }
64415
- var VERSION3 = "3.0.93";
64415
+ var VERSION3 = "3.0.95";
64416
64416
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
64417
64417
  function createGatewayProvider(options = {}) {
64418
64418
  var _a92, _b92;
@@ -64599,7 +64599,7 @@ async function getGatewayAuthToken(options) {
64599
64599
  };
64600
64600
  }
64601
64601
 
64602
- // node_modules/.pnpm/ai@6.0.153_zod@4.3.6/node_modules/ai/dist/index.mjs
64602
+ // node_modules/.pnpm/ai@6.0.156_zod@4.3.6/node_modules/ai/dist/index.mjs
64603
64603
  var import_api = __toESM(require_src(), 1);
64604
64604
  var import_api2 = __toESM(require_src(), 1);
64605
64605
  var __defProp4 = Object.defineProperty;
@@ -65170,7 +65170,7 @@ function detectMediaType({
65170
65170
  }
65171
65171
  return;
65172
65172
  }
65173
- var VERSION4 = "6.0.153";
65173
+ var VERSION4 = "6.0.156";
65174
65174
  var download = async ({
65175
65175
  url: url4,
65176
65176
  maxBytes,
@@ -67549,7 +67549,7 @@ async function toResponseMessages({
67549
67549
  type: "tool-call",
67550
67550
  toolCallId: part.toolCallId,
67551
67551
  toolName: part.toolName,
67552
- input: part.input,
67552
+ input: part.invalid && typeof part.input !== "object" ? {} : part.input,
67553
67553
  providerExecuted: part.providerExecuted,
67554
67554
  providerOptions: part.providerMetadata
67555
67555
  });
package/dist/opencode.js CHANGED
@@ -63082,7 +63082,7 @@ app.route({
63082
63082
  };
63083
63083
  }).addTo(app);
63084
63084
 
63085
- // node_modules/.pnpm/@ai-sdk+gateway@3.0.93_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
63085
+ // node_modules/.pnpm/@ai-sdk+gateway@3.0.95_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
63086
63086
  var import_oidc = __toESM(require_dist(), 1);
63087
63087
  var import_oidc2 = __toESM(require_dist(), 1);
63088
63088
  var marker17 = "vercel.ai.gateway.error";
@@ -64378,7 +64378,7 @@ async function getVercelRequestId() {
64378
64378
  var _a92;
64379
64379
  return (_a92 = import_oidc.getContext().headers) == null ? undefined : _a92["x-vercel-id"];
64380
64380
  }
64381
- var VERSION3 = "3.0.93";
64381
+ var VERSION3 = "3.0.95";
64382
64382
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
64383
64383
  function createGatewayProvider(options = {}) {
64384
64384
  var _a92, _b92;
@@ -64565,7 +64565,7 @@ async function getGatewayAuthToken(options) {
64565
64565
  };
64566
64566
  }
64567
64567
 
64568
- // node_modules/.pnpm/ai@6.0.153_zod@4.3.6/node_modules/ai/dist/index.mjs
64568
+ // node_modules/.pnpm/ai@6.0.156_zod@4.3.6/node_modules/ai/dist/index.mjs
64569
64569
  var import_api = __toESM(require_src(), 1);
64570
64570
  var import_api2 = __toESM(require_src(), 1);
64571
64571
  var __defProp4 = Object.defineProperty;
@@ -65136,7 +65136,7 @@ function detectMediaType({
65136
65136
  }
65137
65137
  return;
65138
65138
  }
65139
- var VERSION4 = "6.0.153";
65139
+ var VERSION4 = "6.0.156";
65140
65140
  var download = async ({
65141
65141
  url: url4,
65142
65142
  maxBytes,
@@ -67515,7 +67515,7 @@ async function toResponseMessages({
67515
67515
  type: "tool-call",
67516
67516
  toolCallId: part.toolCallId,
67517
67517
  toolName: part.toolName,
67518
- input: part.input,
67518
+ input: part.invalid && typeof part.input !== "object" ? {} : part.input,
67519
67519
  providerExecuted: part.providerExecuted,
67520
67520
  providerOptions: part.providerMetadata
67521
67521
  });
package/dist/routes.js CHANGED
@@ -63082,7 +63082,7 @@ app.route({
63082
63082
  };
63083
63083
  }).addTo(app);
63084
63084
 
63085
- // node_modules/.pnpm/@ai-sdk+gateway@3.0.93_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
63085
+ // node_modules/.pnpm/@ai-sdk+gateway@3.0.95_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
63086
63086
  var import_oidc = __toESM(require_dist(), 1);
63087
63087
  var import_oidc2 = __toESM(require_dist(), 1);
63088
63088
  var marker17 = "vercel.ai.gateway.error";
@@ -64378,7 +64378,7 @@ async function getVercelRequestId() {
64378
64378
  var _a92;
64379
64379
  return (_a92 = import_oidc.getContext().headers) == null ? undefined : _a92["x-vercel-id"];
64380
64380
  }
64381
- var VERSION3 = "3.0.93";
64381
+ var VERSION3 = "3.0.95";
64382
64382
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
64383
64383
  function createGatewayProvider(options = {}) {
64384
64384
  var _a92, _b92;
@@ -64565,7 +64565,7 @@ async function getGatewayAuthToken(options) {
64565
64565
  };
64566
64566
  }
64567
64567
 
64568
- // node_modules/.pnpm/ai@6.0.153_zod@4.3.6/node_modules/ai/dist/index.mjs
64568
+ // node_modules/.pnpm/ai@6.0.156_zod@4.3.6/node_modules/ai/dist/index.mjs
64569
64569
  var import_api = __toESM(require_src(), 1);
64570
64570
  var import_api2 = __toESM(require_src(), 1);
64571
64571
  var __defProp4 = Object.defineProperty;
@@ -65136,7 +65136,7 @@ function detectMediaType({
65136
65136
  }
65137
65137
  return;
65138
65138
  }
65139
- var VERSION4 = "6.0.153";
65139
+ var VERSION4 = "6.0.156";
65140
65140
  var download = async ({
65141
65141
  url: url4,
65142
65142
  maxBytes,
@@ -67515,7 +67515,7 @@ async function toResponseMessages({
67515
67515
  type: "tool-call",
67516
67516
  toolCallId: part.toolCallId,
67517
67517
  toolName: part.toolName,
67518
- input: part.input,
67518
+ input: part.invalid && typeof part.input !== "object" ? {} : part.input,
67519
67519
  providerExecuted: part.providerExecuted,
67520
67520
  providerOptions: part.providerMetadata
67521
67521
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevisual/cnb",
3
- "version": "0.0.70",
3
+ "version": "0.0.71",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "basename": "/root/cnb",
@@ -35,17 +35,17 @@
35
35
  "devDependencies": {
36
36
  "@ai-sdk/openai-compatible": "^2.0.41",
37
37
  "@kevisual/ai": "^0.0.30",
38
- "@kevisual/api": "^0.0.66",
38
+ "@kevisual/api": "^0.0.67",
39
39
  "@kevisual/code-builder": "^0.0.7",
40
40
  "@kevisual/context": "^0.0.8",
41
41
  "@kevisual/dts": "^0.0.4",
42
42
  "@kevisual/remote-app": "^0.0.7",
43
- "@kevisual/types": "^0.0.12",
44
- "@opencode-ai/plugin": "^1.4.0",
43
+ "@kevisual/types": "^0.0.14",
44
+ "@opencode-ai/plugin": "^1.4.3",
45
45
  "@types/bun": "^1.3.11",
46
- "@types/node": "^25.5.2",
46
+ "@types/node": "^25.6.0",
47
47
  "@types/ws": "^8.18.1",
48
- "ai": "^6.0.153",
48
+ "ai": "^6.0.156",
49
49
  "commander": "^14.0.3",
50
50
  "dayjs": "^1.11.20",
51
51
  "dotenv": "^17.4.1",
@@ -62,7 +62,7 @@
62
62
  "@kevisual/query": "^0.0.55",
63
63
  "@kevisual/router": "^0.2.5",
64
64
  "@kevisual/use-config": "^1.0.30",
65
- "@opencode-ai/sdk": "^1.4.0",
65
+ "@opencode-ai/sdk": "^1.4.3",
66
66
  "es-toolkit": "^1.45.1",
67
67
  "form-data": "^4.0.5",
68
68
  "nanoid": "^5.1.7",
@@ -76,6 +76,7 @@
76
76
  "./keep.ts": "./src/keep.ts",
77
77
  "./keep-file-live.ts": "./src/workspace/keep-file-live.ts",
78
78
  "./routes": "./dist/routes.js",
79
+ "./download.ts": "./src/repo/download.ts",
79
80
  "./src/*": "./src/*",
80
81
  "./agent/*": "./agent/*"
81
82
  }
@@ -0,0 +1,46 @@
1
+ type DownloadFn = (url: string, opts?: { headers?: any, hash?: string, token?: string }) => Promise<{ code: number; buffer: Buffer | null }>
2
+
3
+ /**
4
+ * 下载文件内容,使用CNB API,支持文件未修改时返回304状态码
5
+ * @param url https://api.cnb.cool/${REPO}/-/git/contents/${FILE_PATH}
6
+ * @param opts
7
+ * @returns
8
+ */
9
+ export const downloadByCNBApi: DownloadFn = async (url, opts) => {
10
+ const hash = opts?.hash;
11
+ const headers = opts?.token ? { Authorization: `${opts.token}` } : {};
12
+ const res = await fetch(url, {
13
+ headers: {
14
+ Accept: "application/vnd.cnb.api+json",
15
+ ...headers,
16
+ ...opts?.headers
17
+ }
18
+ });
19
+ type CNBResponse = {
20
+ type?: 'blob' | 'file' | 'dir';
21
+ size?: number;
22
+ path: string;
23
+ name: string;
24
+ sha?: string;
25
+ encoding?: string;
26
+ content?: string;
27
+ }
28
+ let resJson: CNBResponse;
29
+ try {
30
+ resJson = await res.json() as CNBResponse;
31
+ } catch (e) {
32
+ console.error(`下载失败 ${url}: ${res.statusText}`, e);
33
+ return { code: res.status, buffer: null };
34
+ }
35
+ if (res.ok && resJson.type === 'blob' && resJson.encoding === 'base64' && resJson.content) {
36
+ if (hash && resJson.sha === hash) {
37
+ // 文件未修改,跳过下载
38
+ return { code: 304, buffer: null };
39
+ }
40
+ const buffer = Buffer.from(resJson.content, 'base64');
41
+ return { code: 200, buffer };
42
+ } else {
43
+ console.error(`下载失败 ${url}: ${res.statusText}`, resJson);
44
+ return { code: res.status, buffer: null };
45
+ }
46
+ }