@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/agent/npc.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { app } from './index.ts';
2
- import { parse } from '@kevisual/router/src/commander.ts';
2
+ import { parse } from '@kevisual/router/commander';
3
3
 
4
4
  import { useIssueEnv, useCommentEnv, useRepoInfoEnv, IssueLabelItem, IssueComment } from '../src/index.ts'
5
5
  import { pick } from 'es-toolkit';
@@ -41,10 +41,12 @@ app.route({
41
41
  }
42
42
  return true
43
43
  });
44
+ const _routes = isChatBot ? [] : routes;
45
+ console.log('可用的路由列表', _routes.map(r => ({ path: r.path, key: r.key })), messages);
44
46
  const result = await runAgent({
45
47
  app,
46
48
  messages: messages,
47
- routes: isChatBot ? [] : routes,
49
+ routes: _routes,
48
50
  languageModel: cnbAi(model),
49
51
  token: '',
50
52
  query: queryRouterFilter
package/dist/cli.js CHANGED
@@ -63740,7 +63740,7 @@ app.route({
63740
63740
  ctx.body = { content: `当前cnb工作空间的cookie环境变量为:${cookie2}` };
63741
63741
  }).addTo(app);
63742
63742
 
63743
- // ../../node_modules/.pnpm/@kevisual+ai@0.0.29/node_modules/@kevisual/ai/dist/ai-provider-browser.js
63743
+ // ../../node_modules/.pnpm/@kevisual+ai@0.0.30/node_modules/@kevisual/ai/dist/ai-provider-browser.js
63744
63744
  class AIUtils {
63745
63745
  static extractJsonFromMarkdown(str) {
63746
63746
  const jsonRegex = /```json\s*([\s\S]*?)\s*```/;
@@ -71468,7 +71468,7 @@ function filter2(data, query) {
71468
71468
  return executor.execute(ast, data);
71469
71469
  }
71470
71470
 
71471
- // ../../node_modules/.pnpm/@kevisual+ai@0.0.29/node_modules/@kevisual/ai/dist/agent.js
71471
+ // ../../node_modules/.pnpm/@kevisual+ai@0.0.30/node_modules/@kevisual/ai/dist/agent.js
71472
71472
  var createTool = async (app2, message) => {
71473
71473
  const route = app2.findRoute({ path: message.path, key: message.key });
71474
71474
  if (!route) {
@@ -71488,9 +71488,10 @@ var createTool = async (app2, message) => {
71488
71488
  return _tool;
71489
71489
  };
71490
71490
  var createTools = async (opts) => {
71491
- const { app: app2, token: token2 } = opts;
71491
+ const { app: app2, token: token2, routes } = opts;
71492
71492
  const tools = {};
71493
- for (const route of app2.routes) {
71493
+ const targetRoutes = routes || app2.routes;
71494
+ for (const route of targetRoutes) {
71494
71495
  const rid = route.rid;
71495
71496
  const _tool = await createTool(app2, { path: route.path, key: route.key, token: token2 });
71496
71497
  if (_tool && rid) {
@@ -71521,7 +71522,7 @@ var runAgent = async (opts) => {
71521
71522
  if (opts.query) {
71522
71523
  routes = filter2(routes, opts.query);
71523
71524
  }
71524
- const tools = await createTools({ app: app2, token: opts.token });
71525
+ const tools = await createTools({ app: app2, token: opts.token, routes });
71525
71526
  return await reCallAgent({ messages, tools, languageModel });
71526
71527
  };
71527
71528
 
@@ -71564,10 +71565,12 @@ app.route({
71564
71565
  }
71565
71566
  return true;
71566
71567
  });
71568
+ const _routes = isChatBot ? [] : routes;
71569
+ console.log("可用的路由列表", _routes.map((r) => ({ path: r.path, key: r.key })), messages);
71567
71570
  const result = await runAgent({
71568
71571
  app,
71569
71572
  messages,
71570
- routes: isChatBot ? [] : routes,
71573
+ routes: _routes,
71571
71574
  languageModel: cnbAi(model),
71572
71575
  token: "",
71573
71576
  query: queryRouterFilter