@docyrus/docyrus 0.0.44 → 0.0.46

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/server-loader.js CHANGED
@@ -1228,11 +1228,11 @@ var require_commonjs3 = __commonJS({
1228
1228
  return (f) => f.length === len && f !== "." && f !== "..";
1229
1229
  };
1230
1230
  var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
1231
- var path3 = {
1231
+ var path4 = {
1232
1232
  win32: { sep: "\\" },
1233
1233
  posix: { sep: "/" }
1234
1234
  };
1235
- exports2.sep = defaultPlatform === "win32" ? path3.win32.sep : path3.posix.sep;
1235
+ exports2.sep = defaultPlatform === "win32" ? path4.win32.sep : path4.posix.sep;
1236
1236
  exports2.minimatch.sep = exports2.sep;
1237
1237
  exports2.GLOBSTAR = /* @__PURE__ */ Symbol("globstar **");
1238
1238
  exports2.minimatch.GLOBSTAR = exports2.GLOBSTAR;
@@ -2002,8 +2002,8 @@ var require_commonjs3 = __commonJS({
2002
2002
  var require_lib = __commonJS({
2003
2003
  "../../node_modules/.pnpm/ignore-walk@8.0.0/node_modules/ignore-walk/lib/index.js"(exports2, module2) {
2004
2004
  "use strict";
2005
- var fs4 = require("fs");
2006
- var path3 = require("path");
2005
+ var fs5 = require("fs");
2006
+ var path4 = require("path");
2007
2007
  var EE = require("events").EventEmitter;
2008
2008
  var Minimatch = require_commonjs3().Minimatch;
2009
2009
  var Walker = class _Walker extends EE {
@@ -2012,7 +2012,7 @@ var require_lib = __commonJS({
2012
2012
  super(opts);
2013
2013
  this.isSymbolicLink = opts.isSymbolicLink;
2014
2014
  this.path = opts.path || process.cwd();
2015
- this.basename = path3.basename(this.path);
2015
+ this.basename = path4.basename(this.path);
2016
2016
  this.ignoreFiles = opts.ignoreFiles || [".ignore"];
2017
2017
  this.ignoreRules = {};
2018
2018
  this.parent = opts.parent || null;
@@ -2045,7 +2045,7 @@ var require_lib = __commonJS({
2045
2045
  return ret;
2046
2046
  }
2047
2047
  start() {
2048
- fs4.readdir(this.path, (er, entries) => er ? this.emit("error", er) : this.onReaddir(entries));
2048
+ fs5.readdir(this.path, (er, entries) => er ? this.emit("error", er) : this.onReaddir(entries));
2049
2049
  return this;
2050
2050
  }
2051
2051
  isIgnoreFile(e) {
@@ -2078,8 +2078,8 @@ var require_lib = __commonJS({
2078
2078
  newIg.forEach((e) => this.addIgnoreFile(e, then));
2079
2079
  }
2080
2080
  addIgnoreFile(file, then) {
2081
- const ig = path3.resolve(this.path, file);
2082
- fs4.readFile(ig, "utf8", (er, data) => er ? this.emit("error", er) : this.onReadIgnoreFile(file, data, then));
2081
+ const ig = path4.resolve(this.path, file);
2082
+ fs5.readFile(ig, "utf8", (er, data) => er ? this.emit("error", er) : this.onReadIgnoreFile(file, data, then));
2083
2083
  }
2084
2084
  onReadIgnoreFile(file, data, then) {
2085
2085
  const mmopt = {
@@ -2134,13 +2134,13 @@ var require_lib = __commonJS({
2134
2134
  }
2135
2135
  stat({ entry, file, dir }, then) {
2136
2136
  const abs = this.path + "/" + entry;
2137
- fs4.lstat(abs, (lstatErr, lstatResult) => {
2137
+ fs5.lstat(abs, (lstatErr, lstatResult) => {
2138
2138
  if (lstatErr) {
2139
2139
  this.emit("error", lstatErr);
2140
2140
  } else {
2141
2141
  const isSymbolicLink = lstatResult.isSymbolicLink();
2142
2142
  if (this.follow && isSymbolicLink) {
2143
- fs4.stat(abs, (statErr, statResult) => {
2143
+ fs5.stat(abs, (statErr, statResult) => {
2144
2144
  if (statErr) {
2145
2145
  this.emit("error", statErr);
2146
2146
  } else {
@@ -2196,19 +2196,19 @@ var require_lib = __commonJS({
2196
2196
  };
2197
2197
  var WalkerSync = class _WalkerSync extends Walker {
2198
2198
  start() {
2199
- this.onReaddir(fs4.readdirSync(this.path));
2199
+ this.onReaddir(fs5.readdirSync(this.path));
2200
2200
  return this;
2201
2201
  }
2202
2202
  addIgnoreFile(file, then) {
2203
- const ig = path3.resolve(this.path, file);
2204
- this.onReadIgnoreFile(file, fs4.readFileSync(ig, "utf8"), then);
2203
+ const ig = path4.resolve(this.path, file);
2204
+ this.onReadIgnoreFile(file, fs5.readFileSync(ig, "utf8"), then);
2205
2205
  }
2206
2206
  stat({ entry, file, dir }, then) {
2207
2207
  const abs = this.path + "/" + entry;
2208
- let st = fs4.lstatSync(abs);
2208
+ let st = fs5.lstatSync(abs);
2209
2209
  const isSymbolicLink = st.isSymbolicLink();
2210
2210
  if (this.follow && isSymbolicLink) {
2211
- st = fs4.statSync(abs);
2211
+ st = fs5.statSync(abs);
2212
2212
  }
2213
2213
  this.onstat({ st, entry, file, dir, isSymbolicLink }, then);
2214
2214
  }
@@ -10577,8 +10577,8 @@ function assertNonEmpty(part, name2) {
10577
10577
  throw new Error("`" + name2 + "` cannot be empty");
10578
10578
  }
10579
10579
  }
10580
- function assertPath(path3, name2) {
10581
- if (!path3) {
10580
+ function assertPath(path4, name2) {
10581
+ if (!path4) {
10582
10582
  throw new Error("Setting `" + name2 + "` requires `path` to be set too");
10583
10583
  }
10584
10584
  }
@@ -10764,13 +10764,13 @@ var init_lib9 = __esm({
10764
10764
  * @returns {undefined}
10765
10765
  * Nothing.
10766
10766
  */
10767
- set path(path3) {
10768
- if (isUrl(path3)) {
10769
- path3 = (0, import_node_url.fileURLToPath)(path3);
10767
+ set path(path4) {
10768
+ if (isUrl(path4)) {
10769
+ path4 = (0, import_node_url.fileURLToPath)(path4);
10770
10770
  }
10771
- assertNonEmpty(path3, "path");
10772
- if (this.path !== path3) {
10773
- this.history.push(path3);
10771
+ assertNonEmpty(path4, "path");
10772
+ if (this.path !== path4) {
10773
+ this.history.push(path4);
10774
10774
  }
10775
10775
  }
10776
10776
  /**
@@ -12525,8 +12525,8 @@ var require_dist = __commonJS({
12525
12525
  };
12526
12526
  Object.defineProperty(exports2, "__esModule", { value: true });
12527
12527
  exports2.load = exports2.currentTarget = void 0;
12528
- var path3 = __importStar(require("path"));
12529
- var fs4 = __importStar(require("fs"));
12528
+ var path4 = __importStar(require("path"));
12529
+ var fs5 = __importStar(require("fs"));
12530
12530
  function currentTarget() {
12531
12531
  let os = null;
12532
12532
  switch (process.platform) {
@@ -12591,8 +12591,8 @@ var require_dist = __commonJS({
12591
12591
  return typeof header === "object" && !!header && "glibcVersionRuntime" in header;
12592
12592
  }
12593
12593
  function load(dirname9) {
12594
- const m = path3.join(dirname9, "index.node");
12595
- return fs4.existsSync(m) ? require(m) : null;
12594
+ const m = path4.join(dirname9, "index.node");
12595
+ return fs5.existsSync(m) ? require(m) : null;
12596
12596
  }
12597
12597
  exports2.load = load;
12598
12598
  }
@@ -12618,11 +12618,11 @@ var require_process = __commonJS({
12618
12618
  var require_filesystem = __commonJS({
12619
12619
  "../../node_modules/.pnpm/detect-libc@2.0.2/node_modules/detect-libc/lib/filesystem.js"(exports2, module2) {
12620
12620
  "use strict";
12621
- var fs4 = require("fs");
12621
+ var fs5 = require("fs");
12622
12622
  var LDD_PATH = "/usr/bin/ldd";
12623
- var readFileSync5 = (path3) => fs4.readFileSync(path3, "utf-8");
12624
- var readFile13 = (path3) => new Promise((resolve4, reject) => {
12625
- fs4.readFile(path3, "utf-8", (err2, data) => {
12623
+ var readFileSync5 = (path4) => fs5.readFileSync(path4, "utf-8");
12624
+ var readFile13 = (path4) => new Promise((resolve4, reject) => {
12625
+ fs5.readFile(path4, "utf-8", (err2, data) => {
12626
12626
  if (err2) {
12627
12627
  reject(err2);
12628
12628
  } else {
@@ -12963,7 +12963,7 @@ var require_promise = __commonJS({
12963
12963
  * @constructor
12964
12964
  * @param {string} path - Path to the database file.
12965
12965
  */
12966
- constructor(path3, opts) {
12966
+ constructor(path4, opts) {
12967
12967
  const encryptionCipher = opts?.encryptionCipher ?? "aes256cbc";
12968
12968
  if (opts && opts.syncUrl) {
12969
12969
  var authToken = "";
@@ -12977,15 +12977,15 @@ var require_promise = __commonJS({
12977
12977
  const syncPeriod = opts?.syncPeriod ?? 0;
12978
12978
  const offline = opts?.offline ?? false;
12979
12979
  const remoteEncryptionKey = opts?.remoteEncryptionKey ?? "";
12980
- this.db = databaseOpenWithSync(path3, opts.syncUrl, authToken, encryptionCipher, encryptionKey, syncPeriod, offline, remoteEncryptionKey);
12980
+ this.db = databaseOpenWithSync(path4, opts.syncUrl, authToken, encryptionCipher, encryptionKey, syncPeriod, offline, remoteEncryptionKey);
12981
12981
  } else {
12982
12982
  const authToken2 = opts?.authToken ?? "";
12983
12983
  const encryptionKey = opts?.encryptionKey ?? "";
12984
12984
  const timeout = opts?.timeout ?? 0;
12985
12985
  const remoteEncryptionKey = opts?.remoteEncryptionKey ?? "";
12986
- this.db = databaseOpen(path3, authToken2, encryptionCipher, encryptionKey, timeout, remoteEncryptionKey);
12986
+ this.db = databaseOpen(path4, authToken2, encryptionCipher, encryptionKey, timeout, remoteEncryptionKey);
12987
12987
  }
12988
- this.memory = path3 === ":memory:";
12988
+ this.memory = path4 === ":memory:";
12989
12989
  this.readonly = false;
12990
12990
  this.name = "";
12991
12991
  this.open = true;
@@ -13921,7 +13921,7 @@ var init_dist = __esm({
13921
13921
  });
13922
13922
 
13923
13923
  // src/server/server-loader.ts
13924
- var import_node_fs10 = require("node:fs");
13924
+ var import_node_fs11 = require("node:fs");
13925
13925
  var import_node_url2 = require("node:url");
13926
13926
  var import_node_path19 = require("node:path");
13927
13927
  var import_picocolors2 = __toESM(require_picocolors());
@@ -14028,7 +14028,7 @@ var AgentEnvStore = class {
14028
14028
  // src/agent/packagedExtensions.ts
14029
14029
  var import_node_fs = require("node:fs");
14030
14030
  var import_node_path2 = require("node:path");
14031
- var SERVER_ONLY_PACKAGED_EXTENSION_NAMES = /* @__PURE__ */ new Set(["docyrus-web-browser"]);
14031
+ var SERVER_ONLY_PACKAGED_EXTENSION_NAMES = /* @__PURE__ */ new Set(["docyrus-web-browser", "server-auto-commit"]);
14032
14032
  function isPackagedExtensionEntry(entryName, isDirectory) {
14033
14033
  return isDirectory || entryName.endsWith(".ts") || entryName.endsWith(".js");
14034
14034
  }
@@ -14171,26 +14171,26 @@ var handleParsingNestedValues = (form, key, value2) => {
14171
14171
  };
14172
14172
 
14173
14173
  // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/utils/url.js
14174
- var splitPath = (path3) => {
14175
- const paths = path3.split("/");
14174
+ var splitPath = (path4) => {
14175
+ const paths = path4.split("/");
14176
14176
  if (paths[0] === "") {
14177
14177
  paths.shift();
14178
14178
  }
14179
14179
  return paths;
14180
14180
  };
14181
14181
  var splitRoutingPath = (routePath) => {
14182
- const { groups, path: path3 } = extractGroupsFromPath(routePath);
14183
- const paths = splitPath(path3);
14182
+ const { groups, path: path4 } = extractGroupsFromPath(routePath);
14183
+ const paths = splitPath(path4);
14184
14184
  return replaceGroupMarks(paths, groups);
14185
14185
  };
14186
- var extractGroupsFromPath = (path3) => {
14186
+ var extractGroupsFromPath = (path4) => {
14187
14187
  const groups = [];
14188
- path3 = path3.replace(/\{[^}]+\}/g, (match2, index2) => {
14188
+ path4 = path4.replace(/\{[^}]+\}/g, (match2, index2) => {
14189
14189
  const mark = `@${index2}`;
14190
14190
  groups.push([mark, match2]);
14191
14191
  return mark;
14192
14192
  });
14193
- return { groups, path: path3 };
14193
+ return { groups, path: path4 };
14194
14194
  };
14195
14195
  var replaceGroupMarks = (paths, groups) => {
14196
14196
  for (let i2 = groups.length - 1; i2 >= 0; i2--) {
@@ -14247,8 +14247,8 @@ var getPath = (request) => {
14247
14247
  const queryIndex = url.indexOf("?", i2);
14248
14248
  const hashIndex = url.indexOf("#", i2);
14249
14249
  const end = queryIndex === -1 ? hashIndex === -1 ? void 0 : hashIndex : hashIndex === -1 ? queryIndex : Math.min(queryIndex, hashIndex);
14250
- const path3 = url.slice(start2, end);
14251
- return tryDecodeURI(path3.includes("%25") ? path3.replace(/%25/g, "%2525") : path3);
14250
+ const path4 = url.slice(start2, end);
14251
+ return tryDecodeURI(path4.includes("%25") ? path4.replace(/%25/g, "%2525") : path4);
14252
14252
  } else if (charCode === 63 || charCode === 35) {
14253
14253
  break;
14254
14254
  }
@@ -14265,11 +14265,11 @@ var mergePath = (base, sub, ...rest) => {
14265
14265
  }
14266
14266
  return `${base?.[0] === "/" ? "" : "/"}${base}${sub === "/" ? "" : `${base?.at(-1) === "/" ? "" : "/"}${sub?.[0] === "/" ? sub.slice(1) : sub}`}`;
14267
14267
  };
14268
- var checkOptionalParameter = (path3) => {
14269
- if (path3.charCodeAt(path3.length - 1) !== 63 || !path3.includes(":")) {
14268
+ var checkOptionalParameter = (path4) => {
14269
+ if (path4.charCodeAt(path4.length - 1) !== 63 || !path4.includes(":")) {
14270
14270
  return null;
14271
14271
  }
14272
- const segments = path3.split("/");
14272
+ const segments = path4.split("/");
14273
14273
  const results = [];
14274
14274
  let basePath = "";
14275
14275
  segments.forEach((segment) => {
@@ -14410,9 +14410,9 @@ var HonoRequest = class {
14410
14410
  */
14411
14411
  path;
14412
14412
  bodyCache = {};
14413
- constructor(request, path3 = "/", matchResult = [[]]) {
14413
+ constructor(request, path4 = "/", matchResult = [[]]) {
14414
14414
  this.raw = request;
14415
- this.path = path3;
14415
+ this.path = path4;
14416
14416
  this.#matchResult = matchResult;
14417
14417
  this.#validatedData = {};
14418
14418
  }
@@ -15149,8 +15149,8 @@ var Hono = class _Hono {
15149
15149
  return this;
15150
15150
  };
15151
15151
  });
15152
- this.on = (method, path3, ...handlers) => {
15153
- for (const p of [path3].flat()) {
15152
+ this.on = (method, path4, ...handlers) => {
15153
+ for (const p of [path4].flat()) {
15154
15154
  this.#path = p;
15155
15155
  for (const m of [method].flat()) {
15156
15156
  handlers.map((handler2) => {
@@ -15207,8 +15207,8 @@ var Hono = class _Hono {
15207
15207
  * app.route("/api", app2) // GET /api/user
15208
15208
  * ```
15209
15209
  */
15210
- route(path3, app) {
15211
- const subApp = this.basePath(path3);
15210
+ route(path4, app) {
15211
+ const subApp = this.basePath(path4);
15212
15212
  app.routes.map((r) => {
15213
15213
  let handler2;
15214
15214
  if (app.errorHandler === errorHandler) {
@@ -15234,9 +15234,9 @@ var Hono = class _Hono {
15234
15234
  * const api = new Hono().basePath('/api')
15235
15235
  * ```
15236
15236
  */
15237
- basePath(path3) {
15237
+ basePath(path4) {
15238
15238
  const subApp = this.#clone();
15239
- subApp._basePath = mergePath(this._basePath, path3);
15239
+ subApp._basePath = mergePath(this._basePath, path4);
15240
15240
  return subApp;
15241
15241
  }
15242
15242
  /**
@@ -15310,7 +15310,7 @@ var Hono = class _Hono {
15310
15310
  * })
15311
15311
  * ```
15312
15312
  */
15313
- mount(path3, applicationHandler, options) {
15313
+ mount(path4, applicationHandler, options) {
15314
15314
  let replaceRequest;
15315
15315
  let optionHandler;
15316
15316
  if (options) {
@@ -15337,7 +15337,7 @@ var Hono = class _Hono {
15337
15337
  return [c.env, executionContext];
15338
15338
  };
15339
15339
  replaceRequest ||= (() => {
15340
- const mergedPath = mergePath(this._basePath, path3);
15340
+ const mergedPath = mergePath(this._basePath, path4);
15341
15341
  const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
15342
15342
  return (request) => {
15343
15343
  const url = new URL(request.url);
@@ -15352,14 +15352,14 @@ var Hono = class _Hono {
15352
15352
  }
15353
15353
  await next();
15354
15354
  };
15355
- this.#addRoute(METHOD_NAME_ALL, mergePath(path3, "*"), handler2);
15355
+ this.#addRoute(METHOD_NAME_ALL, mergePath(path4, "*"), handler2);
15356
15356
  return this;
15357
15357
  }
15358
- #addRoute(method, path3, handler2) {
15358
+ #addRoute(method, path4, handler2) {
15359
15359
  method = method.toUpperCase();
15360
- path3 = mergePath(this._basePath, path3);
15361
- const r = { basePath: this._basePath, path: path3, method, handler: handler2 };
15362
- this.router.add(method, path3, [handler2, r]);
15360
+ path4 = mergePath(this._basePath, path4);
15361
+ const r = { basePath: this._basePath, path: path4, method, handler: handler2 };
15362
+ this.router.add(method, path4, [handler2, r]);
15363
15363
  this.routes.push(r);
15364
15364
  }
15365
15365
  #handleError(err2, c) {
@@ -15372,10 +15372,10 @@ var Hono = class _Hono {
15372
15372
  if (method === "HEAD") {
15373
15373
  return (async () => new Response(null, await this.#dispatch(request, executionCtx, env, "GET")))();
15374
15374
  }
15375
- const path3 = this.getPath(request, { env });
15376
- const matchResult = this.router.match(method, path3);
15375
+ const path4 = this.getPath(request, { env });
15376
+ const matchResult = this.router.match(method, path4);
15377
15377
  const c = new Context(request, {
15378
- path: path3,
15378
+ path: path4,
15379
15379
  matchResult,
15380
15380
  env,
15381
15381
  executionCtx,
@@ -15475,7 +15475,7 @@ var Hono = class _Hono {
15475
15475
 
15476
15476
  // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/router/reg-exp-router/matcher.js
15477
15477
  var emptyParam = [];
15478
- function match(method, path3) {
15478
+ function match(method, path4) {
15479
15479
  const matchers = this.buildAllMatchers();
15480
15480
  const match2 = ((method2, path22) => {
15481
15481
  const matcher = matchers[method2] || matchers[METHOD_NAME_ALL];
@@ -15491,7 +15491,7 @@ function match(method, path3) {
15491
15491
  return [matcher[1][index2], match3];
15492
15492
  });
15493
15493
  this.match = match2;
15494
- return match2(method, path3);
15494
+ return match2(method, path4);
15495
15495
  }
15496
15496
 
15497
15497
  // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/router/reg-exp-router/node.js
@@ -15606,12 +15606,12 @@ var Node = class _Node {
15606
15606
  var Trie = class {
15607
15607
  #context = { varIndex: 0 };
15608
15608
  #root = new Node();
15609
- insert(path3, index2, pathErrorCheckOnly) {
15609
+ insert(path4, index2, pathErrorCheckOnly) {
15610
15610
  const paramAssoc = [];
15611
15611
  const groups = [];
15612
15612
  for (let i2 = 0; ; ) {
15613
15613
  let replaced = false;
15614
- path3 = path3.replace(/\{[^}]+\}/g, (m) => {
15614
+ path4 = path4.replace(/\{[^}]+\}/g, (m) => {
15615
15615
  const mark = `@\\${i2}`;
15616
15616
  groups[i2] = [mark, m];
15617
15617
  i2++;
@@ -15622,7 +15622,7 @@ var Trie = class {
15622
15622
  break;
15623
15623
  }
15624
15624
  }
15625
- const tokens = path3.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
15625
+ const tokens = path4.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
15626
15626
  for (let i2 = groups.length - 1; i2 >= 0; i2--) {
15627
15627
  const [mark] = groups[i2];
15628
15628
  for (let j = tokens.length - 1; j >= 0; j--) {
@@ -15661,9 +15661,9 @@ var Trie = class {
15661
15661
  // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/router/reg-exp-router/router.js
15662
15662
  var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
15663
15663
  var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
15664
- function buildWildcardRegExp(path3) {
15665
- return wildcardRegExpCache[path3] ??= new RegExp(
15666
- path3 === "*" ? "" : `^${path3.replace(
15664
+ function buildWildcardRegExp(path4) {
15665
+ return wildcardRegExpCache[path4] ??= new RegExp(
15666
+ path4 === "*" ? "" : `^${path4.replace(
15667
15667
  /\/\*$|([.\\+*[^\]$()])/g,
15668
15668
  (_, metaChar) => metaChar ? `\\${metaChar}` : "(?:|/.*)"
15669
15669
  )}$`
@@ -15685,17 +15685,17 @@ function buildMatcherFromPreprocessedRoutes(routes) {
15685
15685
  );
15686
15686
  const staticMap = /* @__PURE__ */ Object.create(null);
15687
15687
  for (let i2 = 0, j = -1, len = routesWithStaticPathFlag.length; i2 < len; i2++) {
15688
- const [pathErrorCheckOnly, path3, handlers] = routesWithStaticPathFlag[i2];
15688
+ const [pathErrorCheckOnly, path4, handlers] = routesWithStaticPathFlag[i2];
15689
15689
  if (pathErrorCheckOnly) {
15690
- staticMap[path3] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
15690
+ staticMap[path4] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
15691
15691
  } else {
15692
15692
  j++;
15693
15693
  }
15694
15694
  let paramAssoc;
15695
15695
  try {
15696
- paramAssoc = trie.insert(path3, j, pathErrorCheckOnly);
15696
+ paramAssoc = trie.insert(path4, j, pathErrorCheckOnly);
15697
15697
  } catch (e) {
15698
- throw e === PATH_ERROR ? new UnsupportedPathError(path3) : e;
15698
+ throw e === PATH_ERROR ? new UnsupportedPathError(path4) : e;
15699
15699
  }
15700
15700
  if (pathErrorCheckOnly) {
15701
15701
  continue;
@@ -15729,12 +15729,12 @@ function buildMatcherFromPreprocessedRoutes(routes) {
15729
15729
  }
15730
15730
  return [regexp, handlerMap, staticMap];
15731
15731
  }
15732
- function findMiddleware(middleware, path3) {
15732
+ function findMiddleware(middleware, path4) {
15733
15733
  if (!middleware) {
15734
15734
  return void 0;
15735
15735
  }
15736
15736
  for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) {
15737
- if (buildWildcardRegExp(k).test(path3)) {
15737
+ if (buildWildcardRegExp(k).test(path4)) {
15738
15738
  return [...middleware[k]];
15739
15739
  }
15740
15740
  }
@@ -15748,7 +15748,7 @@ var RegExpRouter = class {
15748
15748
  this.#middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
15749
15749
  this.#routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
15750
15750
  }
15751
- add(method, path3, handler2) {
15751
+ add(method, path4, handler2) {
15752
15752
  const middleware = this.#middleware;
15753
15753
  const routes = this.#routes;
15754
15754
  if (!middleware || !routes) {
@@ -15763,18 +15763,18 @@ var RegExpRouter = class {
15763
15763
  });
15764
15764
  });
15765
15765
  }
15766
- if (path3 === "/*") {
15767
- path3 = "*";
15766
+ if (path4 === "/*") {
15767
+ path4 = "*";
15768
15768
  }
15769
- const paramCount = (path3.match(/\/:/g) || []).length;
15770
- if (/\*$/.test(path3)) {
15771
- const re = buildWildcardRegExp(path3);
15769
+ const paramCount = (path4.match(/\/:/g) || []).length;
15770
+ if (/\*$/.test(path4)) {
15771
+ const re = buildWildcardRegExp(path4);
15772
15772
  if (method === METHOD_NAME_ALL) {
15773
15773
  Object.keys(middleware).forEach((m) => {
15774
- middleware[m][path3] ||= findMiddleware(middleware[m], path3) || findMiddleware(middleware[METHOD_NAME_ALL], path3) || [];
15774
+ middleware[m][path4] ||= findMiddleware(middleware[m], path4) || findMiddleware(middleware[METHOD_NAME_ALL], path4) || [];
15775
15775
  });
15776
15776
  } else {
15777
- middleware[method][path3] ||= findMiddleware(middleware[method], path3) || findMiddleware(middleware[METHOD_NAME_ALL], path3) || [];
15777
+ middleware[method][path4] ||= findMiddleware(middleware[method], path4) || findMiddleware(middleware[METHOD_NAME_ALL], path4) || [];
15778
15778
  }
15779
15779
  Object.keys(middleware).forEach((m) => {
15780
15780
  if (method === METHOD_NAME_ALL || method === m) {
@@ -15792,7 +15792,7 @@ var RegExpRouter = class {
15792
15792
  });
15793
15793
  return;
15794
15794
  }
15795
- const paths = checkOptionalParameter(path3) || [path3];
15795
+ const paths = checkOptionalParameter(path4) || [path4];
15796
15796
  for (let i2 = 0, len = paths.length; i2 < len; i2++) {
15797
15797
  const path22 = paths[i2];
15798
15798
  Object.keys(routes).forEach((m) => {
@@ -15819,13 +15819,13 @@ var RegExpRouter = class {
15819
15819
  const routes = [];
15820
15820
  let hasOwnRoute = method === METHOD_NAME_ALL;
15821
15821
  [this.#middleware, this.#routes].forEach((r) => {
15822
- const ownRoute = r[method] ? Object.keys(r[method]).map((path3) => [path3, r[method][path3]]) : [];
15822
+ const ownRoute = r[method] ? Object.keys(r[method]).map((path4) => [path4, r[method][path4]]) : [];
15823
15823
  if (ownRoute.length !== 0) {
15824
15824
  hasOwnRoute ||= true;
15825
15825
  routes.push(...ownRoute);
15826
15826
  } else if (method !== METHOD_NAME_ALL) {
15827
15827
  routes.push(
15828
- ...Object.keys(r[METHOD_NAME_ALL]).map((path3) => [path3, r[METHOD_NAME_ALL][path3]])
15828
+ ...Object.keys(r[METHOD_NAME_ALL]).map((path4) => [path4, r[METHOD_NAME_ALL][path4]])
15829
15829
  );
15830
15830
  }
15831
15831
  });
@@ -15845,13 +15845,13 @@ var SmartRouter = class {
15845
15845
  constructor(init2) {
15846
15846
  this.#routers = init2.routers;
15847
15847
  }
15848
- add(method, path3, handler2) {
15848
+ add(method, path4, handler2) {
15849
15849
  if (!this.#routes) {
15850
15850
  throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
15851
15851
  }
15852
- this.#routes.push([method, path3, handler2]);
15852
+ this.#routes.push([method, path4, handler2]);
15853
15853
  }
15854
- match(method, path3) {
15854
+ match(method, path4) {
15855
15855
  if (!this.#routes) {
15856
15856
  throw new Error("Fatal error");
15857
15857
  }
@@ -15866,7 +15866,7 @@ var SmartRouter = class {
15866
15866
  for (let i22 = 0, len2 = routes.length; i22 < len2; i22++) {
15867
15867
  router.add(...routes[i22]);
15868
15868
  }
15869
- res = router.match(method, path3);
15869
+ res = router.match(method, path4);
15870
15870
  } catch (e) {
15871
15871
  if (e instanceof UnsupportedPathError) {
15872
15872
  continue;
@@ -15916,10 +15916,10 @@ var Node2 = class _Node2 {
15916
15916
  }
15917
15917
  this.#patterns = [];
15918
15918
  }
15919
- insert(method, path3, handler2) {
15919
+ insert(method, path4, handler2) {
15920
15920
  this.#order = ++this.#order;
15921
15921
  let curNode = this;
15922
- const parts2 = splitRoutingPath(path3);
15922
+ const parts2 = splitRoutingPath(path4);
15923
15923
  const possibleKeys = [];
15924
15924
  for (let i2 = 0, len = parts2.length; i2 < len; i2++) {
15925
15925
  const p = parts2[i2];
@@ -15968,12 +15968,12 @@ var Node2 = class _Node2 {
15968
15968
  }
15969
15969
  }
15970
15970
  }
15971
- search(method, path3) {
15971
+ search(method, path4) {
15972
15972
  const handlerSets = [];
15973
15973
  this.#params = emptyParams;
15974
15974
  const curNode = this;
15975
15975
  let curNodes = [curNode];
15976
- const parts2 = splitPath(path3);
15976
+ const parts2 = splitPath(path4);
15977
15977
  const curNodesQueue = [];
15978
15978
  const len = parts2.length;
15979
15979
  let partOffsets = null;
@@ -16015,13 +16015,13 @@ var Node2 = class _Node2 {
16015
16015
  if (matcher instanceof RegExp) {
16016
16016
  if (partOffsets === null) {
16017
16017
  partOffsets = new Array(len);
16018
- let offset = path3[0] === "/" ? 1 : 0;
16018
+ let offset = path4[0] === "/" ? 1 : 0;
16019
16019
  for (let p = 0; p < len; p++) {
16020
16020
  partOffsets[p] = offset;
16021
16021
  offset += parts2[p].length + 1;
16022
16022
  }
16023
16023
  }
16024
- const restPathString = path3.substring(partOffsets[i2]);
16024
+ const restPathString = path4.substring(partOffsets[i2]);
16025
16025
  const m = matcher.exec(restPathString);
16026
16026
  if (m) {
16027
16027
  params[name2] = m[0];
@@ -16074,18 +16074,18 @@ var TrieRouter = class {
16074
16074
  constructor() {
16075
16075
  this.#node = new Node2();
16076
16076
  }
16077
- add(method, path3, handler2) {
16078
- const results = checkOptionalParameter(path3);
16077
+ add(method, path4, handler2) {
16078
+ const results = checkOptionalParameter(path4);
16079
16079
  if (results) {
16080
16080
  for (let i2 = 0, len = results.length; i2 < len; i2++) {
16081
16081
  this.#node.insert(method, results[i2], handler2);
16082
16082
  }
16083
16083
  return;
16084
16084
  }
16085
- this.#node.insert(method, path3, handler2);
16085
+ this.#node.insert(method, path4, handler2);
16086
16086
  }
16087
- match(method, path3) {
16088
- return this.#node.search(method, path3);
16087
+ match(method, path4) {
16088
+ return this.#node.search(method, path4);
16089
16089
  }
16090
16090
  };
16091
16091
 
@@ -18944,11 +18944,11 @@ var Module2 = (() => {
18944
18944
  throw toThrow;
18945
18945
  }, "quit_");
18946
18946
  var scriptDirectory = "";
18947
- function locateFile(path3) {
18947
+ function locateFile(path4) {
18948
18948
  if (Module["locateFile"]) {
18949
- return Module["locateFile"](path3, scriptDirectory);
18949
+ return Module["locateFile"](path4, scriptDirectory);
18950
18950
  }
18951
- return scriptDirectory + path3;
18951
+ return scriptDirectory + path4;
18952
18952
  }
18953
18953
  __name(locateFile, "locateFile");
18954
18954
  var readAsync, readBinary;
@@ -24911,9 +24911,9 @@ async function readJsonFile2(filePath) {
24911
24911
  }
24912
24912
  }
24913
24913
  async function loadMcpServerConfig(agentDir, cwd) {
24914
- const configPath = getMcpConfigPath(agentDir);
24914
+ const configPath2 = getMcpConfigPath(agentDir);
24915
24915
  let config = { mcpServers: {} };
24916
- const raw2 = await readJsonFile2(configPath);
24916
+ const raw2 = await readJsonFile2(configPath2);
24917
24917
  if (raw2) {
24918
24918
  config = parseConfigFile(raw2);
24919
24919
  }
@@ -24937,7 +24937,7 @@ async function loadMcpServerConfig(agentDir, cwd) {
24937
24937
  }
24938
24938
  }
24939
24939
  const projectPath = (0, import_node_path16.resolve)(cwd, PROJECT_CONFIG_NAME);
24940
- if (projectPath !== configPath) {
24940
+ if (projectPath !== configPath2) {
24941
24941
  const projectRaw = await readJsonFile2(projectPath);
24942
24942
  if (projectRaw) {
24943
24943
  const validated = parseConfigFile(projectRaw);
@@ -25046,9 +25046,9 @@ async function getServerProvenance(agentDir, cwd) {
25046
25046
  return provenance;
25047
25047
  }
25048
25048
  async function readUserConfig(agentDir) {
25049
- const configPath = getMcpConfigPath(agentDir);
25049
+ const configPath2 = getMcpConfigPath(agentDir);
25050
25050
  let raw2 = {};
25051
- const parsed = await readJsonFile2(configPath);
25051
+ const parsed = await readJsonFile2(configPath2);
25052
25052
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
25053
25053
  raw2 = parsed;
25054
25054
  }
@@ -25056,11 +25056,11 @@ async function readUserConfig(agentDir) {
25056
25056
  return { raw: raw2, config };
25057
25057
  }
25058
25058
  async function writeUserConfig(agentDir, raw2) {
25059
- const configPath = getMcpConfigPath(agentDir);
25060
- await (0, import_promises12.mkdir)((0, import_node_path16.dirname)(configPath), { recursive: true });
25061
- const tmpPath = `${configPath}.${process.pid}.tmp`;
25059
+ const configPath2 = getMcpConfigPath(agentDir);
25060
+ await (0, import_promises12.mkdir)((0, import_node_path16.dirname)(configPath2), { recursive: true });
25061
+ const tmpPath = `${configPath2}.${process.pid}.tmp`;
25062
25062
  await (0, import_promises12.writeFile)(tmpPath, JSON.stringify(raw2, null, 2) + "\n", "utf-8");
25063
- await (0, import_promises12.rename)(tmpPath, configPath);
25063
+ await (0, import_promises12.rename)(tmpPath, configPath2);
25064
25064
  }
25065
25065
  async function addMcpServer(agentDir, name2, entry) {
25066
25066
  const { raw: raw2, config } = await readUserConfig(agentDir);
@@ -25140,9 +25140,9 @@ function parseFrontmatter2(content3) {
25140
25140
  const body2 = content3.slice(endIndex + 4).trimStart();
25141
25141
  return { frontmatter: frontmatter2, body: body2 };
25142
25142
  }
25143
- async function dirExists(path3) {
25143
+ async function dirExists(path4) {
25144
25144
  try {
25145
- const s = await (0, import_promises13.stat)(path3);
25145
+ const s = await (0, import_promises13.stat)(path4);
25146
25146
  return s.isDirectory();
25147
25147
  } catch {
25148
25148
  return false;
@@ -25307,6 +25307,30 @@ async function listAllTools(params) {
25307
25307
  return tools;
25308
25308
  }
25309
25309
 
25310
+ // src/server/sessionConfig.ts
25311
+ var import_node_fs10 = require("node:fs");
25312
+ var path3 = __toESM(require("node:path"));
25313
+ var DEFAULT_CONFIG = { autoCommit: false };
25314
+ function configPath(agentDir, sessionId) {
25315
+ return path3.join(agentDir, "session-config", `${sessionId}.json`);
25316
+ }
25317
+ async function readSessionConfig(agentDir, sessionId) {
25318
+ try {
25319
+ const raw2 = await import_node_fs10.promises.readFile(configPath(agentDir, sessionId), "utf-8");
25320
+ return { ...DEFAULT_CONFIG, ...JSON.parse(raw2) };
25321
+ } catch {
25322
+ return { ...DEFAULT_CONFIG };
25323
+ }
25324
+ }
25325
+ async function writeSessionConfig(agentDir, sessionId, patch) {
25326
+ const dir = path3.join(agentDir, "session-config");
25327
+ await import_node_fs10.promises.mkdir(dir, { recursive: true });
25328
+ const current = await readSessionConfig(agentDir, sessionId);
25329
+ const next = { ...current, ...patch };
25330
+ await import_node_fs10.promises.writeFile(configPath(agentDir, sessionId), JSON.stringify(next, null, 2), "utf-8");
25331
+ return next;
25332
+ }
25333
+
25310
25334
  // src/server/agentServer.ts
25311
25335
  function generateMessageId() {
25312
25336
  return `msg_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
@@ -26009,6 +26033,7 @@ async function createAgentServer(params) {
26009
26033
  });
26010
26034
  app.post("/api/sessions", async (c) => {
26011
26035
  try {
26036
+ const body2 = await c.req.json().catch(() => ({}));
26012
26037
  if (activeSession.isStreaming) {
26013
26038
  await activeSession.abort();
26014
26039
  await waitForIdle(activeSession);
@@ -26019,6 +26044,9 @@ async function createAgentServer(params) {
26019
26044
  if (!sessionId) {
26020
26045
  return c.json({ error: "Created session is missing an id" }, 500);
26021
26046
  }
26047
+ if (body2.autoCommit !== void 0) {
26048
+ await writeSessionConfig(context.agentDir, sessionId, { autoCommit: body2.autoCommit });
26049
+ }
26022
26050
  const sessions = await sessionManager.list();
26023
26051
  const match2 = sessions.find((session) => session.id === sessionId);
26024
26052
  return c.json({
@@ -26026,13 +26054,35 @@ async function createAgentServer(params) {
26026
26054
  sessionId,
26027
26055
  sessionName: match2?.name ?? null,
26028
26056
  cwd: match2?.cwd ?? context.cwd,
26029
- model: activeSession.model ? { provider: activeSession.model.provider, id: activeSession.model.id } : null
26057
+ model: activeSession.model ? { provider: activeSession.model.provider, id: activeSession.model.id } : null,
26058
+ autoCommit: body2.autoCommit ?? false
26030
26059
  });
26031
26060
  } catch (error) {
26032
26061
  const message = error instanceof Error ? error.message : String(error);
26033
26062
  return c.json({ error: message }, 500);
26034
26063
  }
26035
26064
  });
26065
+ app.get("/api/sessions/:sessionId/config", async (c) => {
26066
+ const sessionId = c.req.param("sessionId");
26067
+ try {
26068
+ const config = await readSessionConfig(context.agentDir, sessionId);
26069
+ return c.json({ sessionId, ...config });
26070
+ } catch (error) {
26071
+ const message = error instanceof Error ? error.message : String(error);
26072
+ return c.json({ error: message }, 500);
26073
+ }
26074
+ });
26075
+ app.patch("/api/sessions/:sessionId/config", async (c) => {
26076
+ const sessionId = c.req.param("sessionId");
26077
+ try {
26078
+ const body2 = await c.req.json();
26079
+ const config = await writeSessionConfig(context.agentDir, sessionId, body2);
26080
+ return c.json({ ok: true, sessionId, ...config });
26081
+ } catch (error) {
26082
+ const message = error instanceof Error ? error.message : String(error);
26083
+ return c.json({ error: message }, 500);
26084
+ }
26085
+ });
26036
26086
  app.get("/api/sessions/:sessionId/messages", async (c) => {
26037
26087
  const sessionId = c.req.param("sessionId");
26038
26088
  try {
@@ -27788,7 +27838,7 @@ function resolvePackagedPiResourceRoot() {
27788
27838
  (0, import_node_path19.resolve)(__dirname, "resources/pi-agent"),
27789
27839
  (0, import_node_path19.resolve)(process.cwd(), "dist/apps/api-cli/resources/pi-agent")
27790
27840
  ];
27791
- const resolved = candidates.find((candidate) => (0, import_node_fs10.existsSync)(candidate));
27841
+ const resolved = candidates.find((candidate) => (0, import_node_fs11.existsSync)(candidate));
27792
27842
  if (!resolved) {
27793
27843
  throw new Error(`Unable to locate pi agent resources. Checked: ${candidates.join(", ")}`);
27794
27844
  }
@@ -27960,7 +28010,7 @@ async function main() {
27960
28010
  port: request.port,
27961
28011
  sessionManager: {
27962
28012
  list: () => pi.SessionManager.list(cwd, request.sessionDir),
27963
- open: (path3) => pi.SessionManager.open(path3, request.sessionDir)
28013
+ open: (path4) => pi.SessionManager.open(path4, request.sessionDir)
27964
28014
  },
27965
28015
  modelRegistry,
27966
28016
  authRuntime: {