@kevisual/cnb 0.0.67 → 0.0.68

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/opencode.js CHANGED
@@ -61647,7 +61647,7 @@ app.route({
61647
61647
  ctx.body = { content: `当前cnb工作空间的cookie环境变量为:${cookie2}` };
61648
61648
  }).addTo(app);
61649
61649
 
61650
- // ../../node_modules/.pnpm/@kevisual+ai@0.0.29/node_modules/@kevisual/ai/dist/ai-provider-browser.js
61650
+ // ../../node_modules/.pnpm/@kevisual+ai@0.0.30/node_modules/@kevisual/ai/dist/ai-provider-browser.js
61651
61651
  class AIUtils {
61652
61652
  static extractJsonFromMarkdown(str) {
61653
61653
  const jsonRegex = /```json\s*([\s\S]*?)\s*```/;
@@ -69375,7 +69375,7 @@ function filter2(data, query) {
69375
69375
  return executor.execute(ast, data);
69376
69376
  }
69377
69377
 
69378
- // ../../node_modules/.pnpm/@kevisual+ai@0.0.29/node_modules/@kevisual/ai/dist/agent.js
69378
+ // ../../node_modules/.pnpm/@kevisual+ai@0.0.30/node_modules/@kevisual/ai/dist/agent.js
69379
69379
  var createTool = async (app2, message) => {
69380
69380
  const route = app2.findRoute({ path: message.path, key: message.key });
69381
69381
  if (!route) {
@@ -69395,9 +69395,10 @@ var createTool = async (app2, message) => {
69395
69395
  return _tool;
69396
69396
  };
69397
69397
  var createTools = async (opts) => {
69398
- const { app: app2, token: token2 } = opts;
69398
+ const { app: app2, token: token2, routes } = opts;
69399
69399
  const tools = {};
69400
- for (const route of app2.routes) {
69400
+ const targetRoutes = routes || app2.routes;
69401
+ for (const route of targetRoutes) {
69401
69402
  const rid = route.rid;
69402
69403
  const _tool = await createTool(app2, { path: route.path, key: route.key, token: token2 });
69403
69404
  if (_tool && rid) {
@@ -69428,7 +69429,7 @@ var runAgent = async (opts) => {
69428
69429
  if (opts.query) {
69429
69430
  routes = filter2(routes, opts.query);
69430
69431
  }
69431
- const tools = await createTools({ app: app2, token: opts.token });
69432
+ const tools = await createTools({ app: app2, token: opts.token, routes });
69432
69433
  return await reCallAgent({ messages, tools, languageModel });
69433
69434
  };
69434
69435
 
@@ -69471,10 +69472,12 @@ app.route({
69471
69472
  }
69472
69473
  return true;
69473
69474
  });
69475
+ const _routes = isChatBot ? [] : routes;
69476
+ console.log("可用的路由列表", _routes.map((r) => ({ path: r.path, key: r.key })), messages);
69474
69477
  const result = await runAgent({
69475
69478
  app,
69476
69479
  messages,
69477
- routes: isChatBot ? [] : routes,
69480
+ routes: _routes,
69478
69481
  languageModel: cnbAi(model),
69479
69482
  token: "",
69480
69483
  query: queryRouterFilter
package/dist/routes.js CHANGED
@@ -61647,7 +61647,7 @@ app.route({
61647
61647
  ctx.body = { content: `当前cnb工作空间的cookie环境变量为:${cookie2}` };
61648
61648
  }).addTo(app);
61649
61649
 
61650
- // ../../node_modules/.pnpm/@kevisual+ai@0.0.29/node_modules/@kevisual/ai/dist/ai-provider-browser.js
61650
+ // ../../node_modules/.pnpm/@kevisual+ai@0.0.30/node_modules/@kevisual/ai/dist/ai-provider-browser.js
61651
61651
  class AIUtils {
61652
61652
  static extractJsonFromMarkdown(str) {
61653
61653
  const jsonRegex = /```json\s*([\s\S]*?)\s*```/;
@@ -69375,7 +69375,7 @@ function filter2(data, query) {
69375
69375
  return executor.execute(ast, data);
69376
69376
  }
69377
69377
 
69378
- // ../../node_modules/.pnpm/@kevisual+ai@0.0.29/node_modules/@kevisual/ai/dist/agent.js
69378
+ // ../../node_modules/.pnpm/@kevisual+ai@0.0.30/node_modules/@kevisual/ai/dist/agent.js
69379
69379
  var createTool = async (app2, message) => {
69380
69380
  const route = app2.findRoute({ path: message.path, key: message.key });
69381
69381
  if (!route) {
@@ -69395,9 +69395,10 @@ var createTool = async (app2, message) => {
69395
69395
  return _tool;
69396
69396
  };
69397
69397
  var createTools = async (opts) => {
69398
- const { app: app2, token: token2 } = opts;
69398
+ const { app: app2, token: token2, routes } = opts;
69399
69399
  const tools = {};
69400
- for (const route of app2.routes) {
69400
+ const targetRoutes = routes || app2.routes;
69401
+ for (const route of targetRoutes) {
69401
69402
  const rid = route.rid;
69402
69403
  const _tool = await createTool(app2, { path: route.path, key: route.key, token: token2 });
69403
69404
  if (_tool && rid) {
@@ -69428,7 +69429,7 @@ var runAgent = async (opts) => {
69428
69429
  if (opts.query) {
69429
69430
  routes = filter2(routes, opts.query);
69430
69431
  }
69431
- const tools = await createTools({ app: app2, token: opts.token });
69432
+ const tools = await createTools({ app: app2, token: opts.token, routes });
69432
69433
  return await reCallAgent({ messages, tools, languageModel });
69433
69434
  };
69434
69435
 
@@ -69471,10 +69472,12 @@ app.route({
69471
69472
  }
69472
69473
  return true;
69473
69474
  });
69475
+ const _routes = isChatBot ? [] : routes;
69476
+ console.log("可用的路由列表", _routes.map((r) => ({ path: r.path, key: r.key })), messages);
69474
69477
  const result = await runAgent({
69475
69478
  app,
69476
69479
  messages,
69477
- routes: isChatBot ? [] : routes,
69480
+ routes: _routes,
69478
69481
  languageModel: cnbAi(model),
69479
69482
  token: "",
69480
69483
  query: queryRouterFilter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevisual/cnb",
3
- "version": "0.0.67",
3
+ "version": "0.0.68",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "basename": "/root/cnb",
@@ -34,7 +34,7 @@
34
34
  "type": "module",
35
35
  "devDependencies": {
36
36
  "@ai-sdk/openai-compatible": "^2.0.38",
37
- "@kevisual/ai": "^0.0.29",
37
+ "@kevisual/ai": "^0.0.30",
38
38
  "@kevisual/api": "^0.0.66",
39
39
  "@kevisual/code-builder": "^0.0.7",
40
40
  "@kevisual/context": "^0.0.8",