@kevisual/cli 0.1.31 → 0.1.33

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/bin/cli.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ import '../dist/cli.js';
package/bun.config.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { buildWithBun } from '@kevisual/code-builder';
2
+
3
+ await buildWithBun({ naming: 'envision', entry: 'src/oldindex.ts',});
4
+ await buildWithBun({ naming: 'cli', entry: 'src/cli.ts' });
5
+
@@ -23714,7 +23714,7 @@ var require_lib2 = __commonJS((exports, module) => {
23714
23714
  };
23715
23715
  });
23716
23716
 
23717
- // ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/router.js
23717
+ // ../node_modules/.pnpm/@kevisual+router@0.2.2/node_modules/@kevisual/router/dist/router.js
23718
23718
  import { createRequire as createRequire2 } from "node:module";
23719
23719
  import { webcrypto as crypto2 } from "node:crypto";
23720
23720
  import http from "node:http";
@@ -40963,7 +40963,7 @@ var fromJSONSchema2 = (args = {}, opts) => {
40963
40963
  }
40964
40964
  return resultArgs;
40965
40965
  };
40966
- var pickValue = ["path", "key", "id", "description", "type", "middleware", "metadata"];
40966
+ var pickValue = ["path", "key", "rid", "description", "type", "middleware", "metadata"];
40967
40967
  var tool = {
40968
40968
  schema: exports_external
40969
40969
  };
@@ -40983,7 +40983,7 @@ var createSkill = (skill) => {
40983
40983
  class Route {
40984
40984
  path;
40985
40985
  key;
40986
- id;
40986
+ rid;
40987
40987
  run;
40988
40988
  nextRoute;
40989
40989
  description;
@@ -41001,7 +41001,7 @@ class Route {
41001
41001
  this.key = key;
41002
41002
  const pathKey = `${path}$$${key}`;
41003
41003
  if (opts) {
41004
- this.id = opts.id || hashIdMd5Sync(pathKey);
41004
+ this.rid = opts.rid || hashIdMd5Sync(pathKey);
41005
41005
  this.run = opts.run;
41006
41006
  this.nextRoute = opts.nextRoute;
41007
41007
  this.description = opts.description;
@@ -41013,8 +41013,8 @@ class Route {
41013
41013
  } else {
41014
41014
  this.middleware = [];
41015
41015
  }
41016
- if (!this.id) {
41017
- this.id = hashIdMd5Sync(pathKey);
41016
+ if (!this.rid) {
41017
+ this.rid = hashIdMd5Sync(pathKey);
41018
41018
  }
41019
41019
  this.isDebug = opts?.isDebug ?? false;
41020
41020
  }
@@ -41120,14 +41120,14 @@ class QueryRouter {
41120
41120
  this.routes = this.routes.filter((r) => r.path === route.path && r.key == route.key);
41121
41121
  }
41122
41122
  removeById(uniqueId) {
41123
- this.routes = this.routes.filter((r) => r.id !== uniqueId);
41123
+ this.routes = this.routes.filter((r) => r.rid !== uniqueId);
41124
41124
  }
41125
41125
  async runRoute(path, key, ctx) {
41126
41126
  const route = this.routes.find((r) => r.path === path && r.key === key);
41127
41127
  const maxNextRoute = this.maxNextRoute;
41128
41128
  ctx = ctx || {};
41129
41129
  ctx.currentPath = path;
41130
- ctx.currentId = route?.id;
41130
+ ctx.currentId = route?.rid;
41131
41131
  ctx.currentKey = key;
41132
41132
  ctx.currentRoute = route;
41133
41133
  ctx.index = (ctx.index || 0) + 1;
@@ -41154,11 +41154,11 @@ class QueryRouter {
41154
41154
  let route2;
41155
41155
  const isString2 = typeof item === "string";
41156
41156
  if (isString2) {
41157
- route2 = this.routes.find((r) => r.id === item);
41157
+ route2 = this.routes.find((r) => r.rid === item);
41158
41158
  } else {
41159
41159
  route2 = this.routes.find((r) => {
41160
- if (item.id) {
41161
- return r.id === item.id;
41160
+ if (item.rid) {
41161
+ return r.rid === item.rid;
41162
41162
  } else {
41163
41163
  return r.path === item.path && r.key == item.key;
41164
41164
  }
@@ -41207,8 +41207,8 @@ class QueryRouter {
41207
41207
  ctx.message = e.message;
41208
41208
  ctx.body = null;
41209
41209
  } else {
41210
- console.error(`[router error] fn:${route.path}-${route.key}:${route.id}`);
41211
- console.error(`[router error] middleware:${middleware.path}-${middleware.key}:${middleware.id}`);
41210
+ console.error(`[router error] fn:${route.path}-${route.key}:${route.rid}`);
41211
+ console.error(`[router error] middleware:${middleware.path}-${middleware.key}:${middleware.rid}`);
41212
41212
  console.error(e);
41213
41213
  ctx.code = 500;
41214
41214
  ctx.message = "Internal Server Error";
@@ -41236,7 +41236,7 @@ class QueryRouter {
41236
41236
  ctx.code = e.code;
41237
41237
  ctx.message = e.message;
41238
41238
  } else {
41239
- console.error(`[router error] fn:${route.path}-${route.key}:${route.id}`);
41239
+ console.error(`[router error] fn:${route.path}-${route.key}:${route.rid}`);
41240
41240
  console.error(`[router error] error`, e);
41241
41241
  ctx.code = 500;
41242
41242
  ctx.message = "Internal Server Error";
@@ -41252,8 +41252,8 @@ class QueryRouter {
41252
41252
  if (route.nextRoute.path || route.nextRoute.key) {
41253
41253
  path2 = route.nextRoute.path;
41254
41254
  key2 = route.nextRoute.key;
41255
- } else if (route.nextRoute.id) {
41256
- const nextRoute = this.routes.find((r) => r.id === route.nextRoute.id);
41255
+ } else if (route.nextRoute.rid) {
41256
+ const nextRoute = this.routes.find((r) => r.rid === route.nextRoute.rid);
41257
41257
  if (nextRoute) {
41258
41258
  path2 = nextRoute.path;
41259
41259
  key2 = nextRoute.key;
@@ -41317,8 +41317,8 @@ class QueryRouter {
41317
41317
  let key = message.key;
41318
41318
  if (path) {
41319
41319
  return await this.parse({ ...message, path, key }, { ...this.context, ...ctx });
41320
- } else if (message.id) {
41321
- const route = this.routes.find((r) => r.id === message.id);
41320
+ } else if (message.rid) {
41321
+ const route = this.routes.find((r) => r.rid === message.rid);
41322
41322
  if (route) {
41323
41323
  path = route.path;
41324
41324
  key = route.key;
@@ -41391,10 +41391,10 @@ class QueryRouter {
41391
41391
  return this.routes.find((r) => r.path === path && r.key === key);
41392
41392
  }
41393
41393
  findRoute(opts) {
41394
- const { path, key, id } = opts || {};
41394
+ const { path, key, rid } = opts || {};
41395
41395
  return this.routes.find((r) => {
41396
- if (id) {
41397
- return r.id === id;
41396
+ if (rid) {
41397
+ return r.rid === rid;
41398
41398
  }
41399
41399
  if (path) {
41400
41400
  if (key !== undefined) {
@@ -41415,14 +41415,14 @@ class QueryRouter {
41415
41415
  const tokenUser = ctx.state;
41416
41416
  let isUser = !!tokenUser;
41417
41417
  const list = this.getList(opts?.filter).filter((item) => {
41418
- if (item.id === "auth" || item.id === "auth-can" || item.id === "check-auth-admin" || item.id === "auth-admin") {
41418
+ if (item.rid === "auth" || item.rid === "auth-can" || item.rid === "check-auth-admin" || item.rid === "auth-admin") {
41419
41419
  return false;
41420
41420
  }
41421
41421
  return true;
41422
41422
  });
41423
41423
  ctx.body = {
41424
41424
  list: list.map((item) => {
41425
- const route = pick(item, ["id", "path", "key", "description", "middleware", "metadata"]);
41425
+ const route = pick(item, ["rid", "path", "key", "description", "middleware", "metadata"]);
41426
41426
  return toJSONSchemaRoute(route);
41427
41427
  }),
41428
41428
  isUser
@@ -41492,14 +41492,14 @@ class QueryRouterServer extends QueryRouter {
41492
41492
  return super.run(msg, ctx);
41493
41493
  }
41494
41494
  async runAction(api2, payload, ctx) {
41495
- const { path, key, id } = api2;
41496
- return this.run({ path, key, id, payload }, ctx);
41495
+ const { path, key, rid } = api2;
41496
+ return this.run({ path, key, rid, payload }, ctx);
41497
41497
  }
41498
41498
  async createAuth(fun) {
41499
41499
  this.route({
41500
41500
  path: "auth",
41501
41501
  key: "auth",
41502
- id: "auth",
41502
+ rid: "auth",
41503
41503
  description: "token验证"
41504
41504
  }).define(async (ctx) => {
41505
41505
  if (fun) {
@@ -41509,7 +41509,7 @@ class QueryRouterServer extends QueryRouter {
41509
41509
  this.route({
41510
41510
  path: "auth-admin",
41511
41511
  key: "auth-admin",
41512
- id: "auth-admin",
41512
+ rid: "auth-admin",
41513
41513
  description: "admin token验证",
41514
41514
  middleware: ["auth"]
41515
41515
  }).define(async (ctx) => {
@@ -41520,7 +41520,7 @@ class QueryRouterServer extends QueryRouter {
41520
41520
  this.route({
41521
41521
  path: "auth-can",
41522
41522
  key: "auth-can",
41523
- id: "auth-can",
41523
+ rid: "auth-can",
41524
41524
  description: "权限验证"
41525
41525
  }).define(async (ctx) => {
41526
41526
  if (fun) {
@@ -42452,7 +42452,7 @@ class App extends QueryRouterServer {
42452
42452
  }
42453
42453
  }
42454
42454
 
42455
- // ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/router-simple.js
42455
+ // ../node_modules/.pnpm/@kevisual+router@0.2.2/node_modules/@kevisual/router/dist/router-simple.js
42456
42456
  import url3 from "node:url";
42457
42457
  var __create3 = Object.create;
42458
42458
  var __getProtoOf3 = Object.getPrototypeOf;
@@ -52991,7 +52991,7 @@ class Query {
52991
52991
  }
52992
52992
  }
52993
52993
 
52994
- // ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/router-browser.js
52994
+ // ../node_modules/.pnpm/@kevisual+router@0.2.2/node_modules/@kevisual/router/dist/router-browser.js
52995
52995
  var __create5 = Object.create;
52996
52996
  var __getProtoOf5 = Object.getPrototypeOf;
52997
52997
  var __defProp5 = Object.defineProperty;
@@ -85808,7 +85808,7 @@ function filter(data, query) {
85808
85808
  return executor.execute(ast, data);
85809
85809
  }
85810
85810
 
85811
- // ../node_modules/.pnpm/@kevisual+api@0.0.64_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-proxy/router-api-proxy.ts
85811
+ // ../node_modules/.pnpm/@kevisual+api@0.0.65_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-proxy/router-api-proxy.ts
85812
85812
  var initApi = async (opts) => {
85813
85813
  const router = opts?.router;
85814
85814
  const item = opts?.item;
@@ -100926,7 +100926,7 @@ class Query2 {
100926
100926
  }
100927
100927
  }
100928
100928
 
100929
- // ../node_modules/.pnpm/@kevisual+api@0.0.64_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/dist/query-login-node.js
100929
+ // ../node_modules/.pnpm/@kevisual+api@0.0.65_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/dist/query-login-node.js
100930
100930
  import { homedir as homedir2 } from "node:os";
100931
100931
  import { join, dirname } from "node:path";
100932
100932
  import fs13 from "node:fs";
@@ -100936,15 +100936,29 @@ var __getProtoOf6 = Object.getPrototypeOf;
100936
100936
  var __defProp6 = Object.defineProperty;
100937
100937
  var __getOwnPropNames6 = Object.getOwnPropertyNames;
100938
100938
  var __hasOwnProp6 = Object.prototype.hasOwnProperty;
100939
+ function __accessProp5(key) {
100940
+ return this[key];
100941
+ }
100942
+ var __toESMCache_node5;
100943
+ var __toESMCache_esm5;
100939
100944
  var __toESM6 = (mod, isNodeMode, target) => {
100945
+ var canCache = mod != null && typeof mod === "object";
100946
+ if (canCache) {
100947
+ var cache = isNodeMode ? __toESMCache_node5 ??= new WeakMap : __toESMCache_esm5 ??= new WeakMap;
100948
+ var cached4 = cache.get(mod);
100949
+ if (cached4)
100950
+ return cached4;
100951
+ }
100940
100952
  target = mod != null ? __create6(__getProtoOf6(mod)) : {};
100941
100953
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp6(target, "default", { value: mod, enumerable: true }) : target;
100942
100954
  for (let key of __getOwnPropNames6(mod))
100943
100955
  if (!__hasOwnProp6.call(to, key))
100944
100956
  __defProp6(to, key, {
100945
- get: () => mod[key],
100957
+ get: __accessProp5.bind(mod, key),
100946
100958
  enumerable: true
100947
100959
  });
100960
+ if (canCache)
100961
+ cache.set(mod, to);
100948
100962
  return to;
100949
100963
  };
100950
100964
  var __commonJS6 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
@@ -101326,10 +101340,6 @@ class Query3 {
101326
101340
  });
101327
101341
  }
101328
101342
  }
101329
- const headers2 = req.headers || {};
101330
- if (options?.token && !headers2["Authorization"]) {
101331
- headers2["Authorization"] = `Bearer ${options.token}`;
101332
- }
101333
101343
  } catch (e) {
101334
101344
  console.error("request beforeFn error", e, req);
101335
101345
  return wrapperError3({
@@ -101390,20 +101400,20 @@ class Query3 {
101390
101400
  this.afterResponse = fn;
101391
101401
  }
101392
101402
  async fetchText(urlOrOptions, options) {
101393
- let _options = { method: "GET", ...options };
101403
+ let _options = { ...options };
101394
101404
  if (typeof urlOrOptions === "string" && !_options.url) {
101395
101405
  _options.url = urlOrOptions;
101396
101406
  }
101397
101407
  if (typeof urlOrOptions === "object") {
101398
101408
  _options = { ...urlOrOptions, ..._options };
101399
101409
  }
101400
- const headers = { ...this.headers, ..._options.headers };
101401
- if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
101402
- headers["Authorization"] = `Bearer ${options.token}`;
101403
- }
101404
101410
  const res = await adapter3({
101411
+ method: "GET",
101405
101412
  ..._options,
101406
- headers
101413
+ headers: {
101414
+ ...this.headers,
101415
+ ..._options?.headers || {}
101416
+ }
101407
101417
  });
101408
101418
  if (res && !res.code) {
101409
101419
  return {
@@ -102272,6 +102282,9 @@ class QueryLogin extends BaseQuery {
102272
102282
  const res = await this.refreshLoginUser();
102273
102283
  if (res.code === 200) {
102274
102284
  return res.data?.accessToken || null;
102285
+ } else {
102286
+ this.storage.removeItem("token");
102287
+ await this.cacheStore.clearCurrentUser();
102275
102288
  }
102276
102289
  return null;
102277
102290
  }
@@ -103470,7 +103483,7 @@ var simpleRouter = useContextKey("simpleRouter", () => {
103470
103483
  });
103471
103484
  app.createRouteList();
103472
103485
 
103473
- // ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/opencode.js
103486
+ // ../node_modules/.pnpm/@kevisual+router@0.2.2/node_modules/@kevisual/router/dist/opencode.js
103474
103487
  import { createRequire as createRequire4 } from "node:module";
103475
103488
  import { webcrypto as crypto4 } from "node:crypto";
103476
103489
  var __create7 = Object.create;
@@ -103478,15 +103491,15 @@ var __getProtoOf7 = Object.getPrototypeOf;
103478
103491
  var __defProp7 = Object.defineProperty;
103479
103492
  var __getOwnPropNames7 = Object.getOwnPropertyNames;
103480
103493
  var __hasOwnProp7 = Object.prototype.hasOwnProperty;
103481
- function __accessProp5(key) {
103494
+ function __accessProp6(key) {
103482
103495
  return this[key];
103483
103496
  }
103484
- var __toESMCache_node5;
103485
- var __toESMCache_esm5;
103497
+ var __toESMCache_node6;
103498
+ var __toESMCache_esm6;
103486
103499
  var __toESM7 = (mod, isNodeMode, target) => {
103487
103500
  var canCache = mod != null && typeof mod === "object";
103488
103501
  if (canCache) {
103489
- var cache2 = isNodeMode ? __toESMCache_node5 ??= new WeakMap : __toESMCache_esm5 ??= new WeakMap;
103502
+ var cache2 = isNodeMode ? __toESMCache_node6 ??= new WeakMap : __toESMCache_esm6 ??= new WeakMap;
103490
103503
  var cached4 = cache2.get(mod);
103491
103504
  if (cached4)
103492
103505
  return cached4;
@@ -103496,7 +103509,7 @@ var __toESM7 = (mod, isNodeMode, target) => {
103496
103509
  for (let key of __getOwnPropNames7(mod))
103497
103510
  if (!__hasOwnProp7.call(to, key))
103498
103511
  __defProp7(to, key, {
103499
- get: __accessProp5.bind(mod, key),
103512
+ get: __accessProp6.bind(mod, key),
103500
103513
  enumerable: true
103501
103514
  });
103502
103515
  if (canCache)
@@ -118591,10 +118604,10 @@ var createRouterAgentPluginFn = (opts) => {
118591
118604
  addCallFn(router);
118592
118605
  }
118593
118606
  if (router) {
118594
- router.route({ path: "auth", key: "", id: "auth", description: "认证" }).define(async (ctx) => {}).addTo(router, {
118607
+ router.route({ path: "auth", key: "", rid: "auth", description: "认证" }).define(async (ctx) => {}).addTo(router, {
118595
118608
  overwrite: false
118596
118609
  });
118597
- router.route({ path: "auth-admin", key: "", id: "auth-admin", description: "认证" }).define(async (ctx) => {}).addTo(router, {
118610
+ router.route({ path: "auth-admin", key: "", rid: "auth-admin", description: "认证" }).define(async (ctx) => {}).addTo(router, {
118598
118611
  overwrite: false
118599
118612
  });
118600
118613
  }
@@ -120492,7 +120505,7 @@ app.route({
120492
120505
  }).addTo(app, {
120493
120506
  overwrite: false
120494
120507
  });
120495
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.27/node_modules/@opencode-ai/sdk/dist/gen/core/serverSentEvents.gen.js
120508
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.3.0/node_modules/@opencode-ai/sdk/dist/gen/core/serverSentEvents.gen.js
120496
120509
  var createSseClient = ({ onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url: url4, ...options }) => {
120497
120510
  let lastEventId;
120498
120511
  const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
@@ -120601,7 +120614,7 @@ var createSseClient = ({ onSseError, onSseEvent, responseTransformer, responseVa
120601
120614
  return { stream: stream2 };
120602
120615
  };
120603
120616
 
120604
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.27/node_modules/@opencode-ai/sdk/dist/gen/core/auth.gen.js
120617
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.3.0/node_modules/@opencode-ai/sdk/dist/gen/core/auth.gen.js
120605
120618
  var getAuthToken = async (auth, callback) => {
120606
120619
  const token = typeof callback === "function" ? await callback(auth) : callback;
120607
120620
  if (!token) {
@@ -120616,12 +120629,12 @@ var getAuthToken = async (auth, callback) => {
120616
120629
  return token;
120617
120630
  };
120618
120631
 
120619
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.27/node_modules/@opencode-ai/sdk/dist/gen/core/bodySerializer.gen.js
120632
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.3.0/node_modules/@opencode-ai/sdk/dist/gen/core/bodySerializer.gen.js
120620
120633
  var jsonBodySerializer = {
120621
120634
  bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
120622
120635
  };
120623
120636
 
120624
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.27/node_modules/@opencode-ai/sdk/dist/gen/core/pathSerializer.gen.js
120637
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.3.0/node_modules/@opencode-ai/sdk/dist/gen/core/pathSerializer.gen.js
120625
120638
  var separatorArrayExplode = (style) => {
120626
120639
  switch (style) {
120627
120640
  case "label":
@@ -120724,7 +120737,7 @@ var serializeObjectParam = ({ allowReserved, explode, name, style, value, valueO
120724
120737
  return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
120725
120738
  };
120726
120739
 
120727
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.27/node_modules/@opencode-ai/sdk/dist/gen/core/utils.gen.js
120740
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.3.0/node_modules/@opencode-ai/sdk/dist/gen/core/utils.gen.js
120728
120741
  var PATH_PARAM_RE = /\{[^{}]+\}/g;
120729
120742
  var defaultPathSerializer = ({ path: path14, url: _url5 }) => {
120730
120743
  let url4 = _url5;
@@ -120792,7 +120805,7 @@ var getUrl = ({ baseUrl, path: path14, query: query2, querySerializer, url: _url
120792
120805
  return url4;
120793
120806
  };
120794
120807
 
120795
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.27/node_modules/@opencode-ai/sdk/dist/gen/client/utils.gen.js
120808
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.3.0/node_modules/@opencode-ai/sdk/dist/gen/client/utils.gen.js
120796
120809
  var createQuerySerializer = ({ allowReserved, array: array6, object: object5 } = {}) => {
120797
120810
  const querySerializer = (queryParams) => {
120798
120811
  const search = [];
@@ -121000,7 +121013,7 @@ var createConfig = (override = {}) => ({
121000
121013
  ...override
121001
121014
  });
121002
121015
 
121003
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.27/node_modules/@opencode-ai/sdk/dist/gen/client/client.gen.js
121016
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.3.0/node_modules/@opencode-ai/sdk/dist/gen/client/client.gen.js
121004
121017
  var createClient = (config7 = {}) => {
121005
121018
  let _config = mergeConfigs(createConfig(), config7);
121006
121019
  const getConfig2 = () => ({ ..._config });
@@ -121147,7 +121160,7 @@ var createClient = (config7 = {}) => {
121147
121160
  trace: makeMethod("TRACE")
121148
121161
  };
121149
121162
  };
121150
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.27/node_modules/@opencode-ai/sdk/dist/gen/core/params.gen.js
121163
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.3.0/node_modules/@opencode-ai/sdk/dist/gen/core/params.gen.js
121151
121164
  var extraPrefixesMap = {
121152
121165
  $body_: "body",
121153
121166
  $headers_: "headers",
@@ -121155,12 +121168,12 @@ var extraPrefixesMap = {
121155
121168
  $query_: "query"
121156
121169
  };
121157
121170
  var extraPrefixes = Object.entries(extraPrefixesMap);
121158
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.27/node_modules/@opencode-ai/sdk/dist/gen/client.gen.js
121171
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.3.0/node_modules/@opencode-ai/sdk/dist/gen/client.gen.js
121159
121172
  var client = createClient(createConfig({
121160
121173
  baseUrl: "http://localhost:4096"
121161
121174
  }));
121162
121175
 
121163
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.27/node_modules/@opencode-ai/sdk/dist/gen/sdk.gen.js
121176
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.3.0/node_modules/@opencode-ai/sdk/dist/gen/sdk.gen.js
121164
121177
  class _HeyApiClient {
121165
121178
  _client = client;
121166
121179
  constructor(args2) {
@@ -121830,7 +121843,7 @@ class OpencodeClient extends _HeyApiClient {
121830
121843
  event = new Event({ client: this._client });
121831
121844
  }
121832
121845
 
121833
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.27/node_modules/@opencode-ai/sdk/dist/client.js
121846
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.3.0/node_modules/@opencode-ai/sdk/dist/client.js
121834
121847
  function createOpencodeClient(config7) {
121835
121848
  if (!config7?.fetch) {
121836
121849
  const customFetch = (req) => {
@@ -121851,7 +121864,7 @@ function createOpencodeClient(config7) {
121851
121864
  const client2 = createClient(config7);
121852
121865
  return new OpencodeClient({ client: client2 });
121853
121866
  }
121854
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.27/node_modules/@opencode-ai/sdk/dist/server.js
121867
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.3.0/node_modules/@opencode-ai/sdk/dist/server.js
121855
121868
  import { spawn as spawn3 } from "node:child_process";
121856
121869
  async function createOpencodeServer(options) {
121857
121870
  options = Object.assign({
@@ -121920,7 +121933,7 @@ Server output: ${output}`;
121920
121933
  }
121921
121934
  };
121922
121935
  }
121923
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.27/node_modules/@opencode-ai/sdk/dist/index.js
121936
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.3.0/node_modules/@opencode-ai/sdk/dist/index.js
121924
121937
  async function createOpencode(options) {
121925
121938
  const server2 = await createOpencodeServer({
121926
121939
  ...options
@@ -121934,7 +121947,7 @@ async function createOpencode(options) {
121934
121947
  };
121935
121948
  }
121936
121949
 
121937
- // ../node_modules/.pnpm/get-port@7.1.0/node_modules/get-port/index.js
121950
+ // ../node_modules/.pnpm/get-port@7.2.0/node_modules/get-port/index.js
121938
121951
  import net from "node:net";
121939
121952
  import os5 from "node:os";
121940
121953
 
@@ -121948,6 +121961,7 @@ var lockedPorts = {
121948
121961
  young: new Set
121949
121962
  };
121950
121963
  var releaseOldLockedPortsIntervalMs = 1000 * 15;
121964
+ var reservedPorts = new Set;
121951
121965
  var timeout2;
121952
121966
  var getLocalHosts = () => {
121953
121967
  const interfaces = os5.networkInterfaces();
@@ -121985,6 +121999,7 @@ var getAvailablePort = async (options, hosts) => {
121985
121999
  }
121986
122000
  return options.port;
121987
122001
  };
122002
+ var isLockedPort = (port) => lockedPorts.old.has(port) || lockedPorts.young.has(port) || reservedPorts.has(port);
121988
122003
  var portCheckSequence = function* (ports) {
121989
122004
  if (ports) {
121990
122005
  yield* ports;
@@ -122014,6 +122029,7 @@ async function getPorts(options) {
122014
122029
  exclude = new Set(excludeIterable);
122015
122030
  }
122016
122031
  }
122032
+ const { reserve, ...netOptions } = options ?? {};
122017
122033
  if (timeout2 === undefined) {
122018
122034
  timeout2 = setTimeout(() => {
122019
122035
  timeout2 = undefined;
@@ -122030,14 +122046,18 @@ async function getPorts(options) {
122030
122046
  if (exclude.has(port)) {
122031
122047
  continue;
122032
122048
  }
122033
- let availablePort = await getAvailablePort({ ...options, port }, hosts);
122034
- while (lockedPorts.old.has(availablePort) || lockedPorts.young.has(availablePort)) {
122049
+ let availablePort = await getAvailablePort({ ...netOptions, port }, hosts);
122050
+ while (isLockedPort(availablePort)) {
122035
122051
  if (port !== 0) {
122036
122052
  throw new Locked(port);
122037
122053
  }
122038
- availablePort = await getAvailablePort({ ...options, port }, hosts);
122054
+ availablePort = await getAvailablePort({ ...netOptions, port }, hosts);
122055
+ }
122056
+ if (reserve) {
122057
+ reservedPorts.add(availablePort);
122058
+ } else {
122059
+ lockedPorts.young.add(availablePort);
122039
122060
  }
122040
- lockedPorts.young.add(availablePort);
122041
122061
  return availablePort;
122042
122062
  } catch (error111) {
122043
122063
  if (!["EADDRINUSE", "EACCES"].includes(error111.code) && !(error111 instanceof Locked)) {
@@ -124151,7 +124171,7 @@ var checkAuth = async (ctx, isAdmin = false) => {
124151
124171
  };
124152
124172
  app.route({
124153
124173
  path: "auth",
124154
- id: "auth",
124174
+ rid: "auth",
124155
124175
  description: "获取当前登录用户信息, 第一个登录的用户为管理员用户"
124156
124176
  }).define(async (ctx) => {
124157
124177
  if (!ctx.query?.token && ctx.appId === app.appId) {
@@ -124164,7 +124184,7 @@ app.route({
124164
124184
  }).addTo(app);
124165
124185
  app.route({
124166
124186
  path: "auth-admin",
124167
- id: "auth-admin",
124187
+ rid: "auth-admin",
124168
124188
  description: "管理员鉴权, 获取用户信息,并验证是否为管理员。"
124169
124189
  }).define(async (ctx) => {
124170
124190
  if (!ctx.query?.token && ctx.appId === app.appId) {
@@ -124182,7 +124202,7 @@ var import_busboy = __toESM(require_lib2(), 1);
124182
124202
  import path16 from "path";
124183
124203
  import fs19 from "fs";
124184
124204
 
124185
- // ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/src/server/cookie.ts
124205
+ // ../node_modules/.pnpm/@kevisual+router@0.2.2/node_modules/@kevisual/router/src/server/cookie.ts
124186
124206
  var NullObject2 = /* @__PURE__ */ (() => {
124187
124207
  const C2 = function() {};
124188
124208
  C2.prototype = Object.create(null);