copilotkit 4.23.1 → 4.24.0

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.
Files changed (94) hide show
  1. package/README.md +91 -5
  2. package/cli-build-info.json +8 -8
  3. package/exporters/langgraph/README.md +33 -0
  4. package/exporters/langgraph/export_checkpointer.py +16 -0
  5. package/index.js +4380 -3586
  6. package/onboarding/index.json +2 -1
  7. package/onboarding/prompts/authenticate/start.md +15 -12
  8. package/onboarding/prompts/conversion/plan.md +3 -3
  9. package/onboarding/prompts/credentials/finalize-plan.md +8 -8
  10. package/onboarding/prompts/credentials/plan.md +23 -23
  11. package/onboarding/prompts/credentials/settle-credentials.md +14 -5
  12. package/onboarding/prompts/credentials/write-plan.md +6 -6
  13. package/onboarding/prompts/deployment/choose-local.md +24 -13
  14. package/onboarding/prompts/deployment/local-evaluation.md +31 -7
  15. package/onboarding/prompts/fallback/best-effort.md +8 -8
  16. package/onboarding/prompts/feature/a2ui/implement.md +6 -6
  17. package/onboarding/prompts/feature/a2ui/plan.md +4 -4
  18. package/onboarding/prompts/feature/a2ui/proof.md +5 -5
  19. package/onboarding/prompts/feature/a2ui/start.md +25 -8
  20. package/onboarding/prompts/feature/channels/implement.md +7 -7
  21. package/onboarding/prompts/feature/channels/plan.md +4 -4
  22. package/onboarding/prompts/feature/channels/proof.md +5 -5
  23. package/onboarding/prompts/feature/channels/start.md +23 -19
  24. package/onboarding/prompts/feature/chat-suggestions/implement.md +6 -6
  25. package/onboarding/prompts/feature/chat-suggestions/plan.md +4 -4
  26. package/onboarding/prompts/feature/chat-suggestions/proof.md +5 -5
  27. package/onboarding/prompts/feature/chat-suggestions/start.md +25 -8
  28. package/onboarding/prompts/feature/complete.md +2 -2
  29. package/onboarding/prompts/feature/learning/implement.md +13 -13
  30. package/onboarding/prompts/feature/learning/plan.md +4 -4
  31. package/onboarding/prompts/feature/learning/proof.md +49 -6
  32. package/onboarding/prompts/feature/learning/start.md +25 -8
  33. package/onboarding/prompts/feature/open-generative-ui/implement.md +6 -6
  34. package/onboarding/prompts/feature/open-generative-ui/plan.md +4 -4
  35. package/onboarding/prompts/feature/open-generative-ui/proof.md +5 -5
  36. package/onboarding/prompts/feature/open-generative-ui/start.md +25 -8
  37. package/onboarding/prompts/feature/realtime-sync/implement.md +7 -7
  38. package/onboarding/prompts/feature/realtime-sync/plan.md +4 -4
  39. package/onboarding/prompts/feature/realtime-sync/proof.md +5 -5
  40. package/onboarding/prompts/feature/realtime-sync/start.md +24 -7
  41. package/onboarding/prompts/feature/rich-threads/implement.md +8 -8
  42. package/onboarding/prompts/feature/rich-threads/plan.md +4 -4
  43. package/onboarding/prompts/feature/rich-threads/proof.md +5 -5
  44. package/onboarding/prompts/feature/rich-threads/start.md +24 -7
  45. package/onboarding/prompts/feature/stop.md +3 -3
  46. package/onboarding/prompts/feature/voice/implement.md +6 -6
  47. package/onboarding/prompts/feature/voice/plan.md +5 -5
  48. package/onboarding/prompts/feature/voice/proof.md +5 -5
  49. package/onboarding/prompts/feature/voice/start.md +25 -8
  50. package/onboarding/prompts/framework/ag2.md +2 -2
  51. package/onboarding/prompts/framework/agno.md +2 -2
  52. package/onboarding/prompts/framework/built-in.md +2 -2
  53. package/onboarding/prompts/framework/claude-sdk-python.md +2 -2
  54. package/onboarding/prompts/framework/claude-sdk-typescript.md +2 -2
  55. package/onboarding/prompts/framework/crewai-flows.md +2 -2
  56. package/onboarding/prompts/framework/custom-ag-ui.md +2 -2
  57. package/onboarding/prompts/framework/deep-agents.md +2 -2
  58. package/onboarding/prompts/framework/google-adk.md +2 -2
  59. package/onboarding/prompts/framework/langgraph-fastapi.md +2 -2
  60. package/onboarding/prompts/framework/langgraph-python.md +2 -2
  61. package/onboarding/prompts/framework/langgraph-typescript.md +2 -2
  62. package/onboarding/prompts/framework/llamaindex.md +2 -2
  63. package/onboarding/prompts/framework/mastra.md +2 -2
  64. package/onboarding/prompts/framework/ms-agent-dotnet.md +3 -3
  65. package/onboarding/prompts/framework/ms-agent-harness-dotnet.md +3 -3
  66. package/onboarding/prompts/framework/ms-agent-python.md +2 -2
  67. package/onboarding/prompts/framework/pydantic-ai.md +2 -2
  68. package/onboarding/prompts/framework/strands-python.md +2 -2
  69. package/onboarding/prompts/framework/strands-typescript.md +2 -2
  70. package/onboarding/prompts/frontend/angular.md +3 -3
  71. package/onboarding/prompts/frontend/nextjs.md +3 -3
  72. package/onboarding/prompts/frontend/plan.md +7 -7
  73. package/onboarding/prompts/frontend/react-native.md +2 -2
  74. package/onboarding/prompts/frontend/react-spa.md +2 -2
  75. package/onboarding/prompts/frontend/vue.md +2 -2
  76. package/onboarding/prompts/implementation/build-and-validate.md +16 -14
  77. package/onboarding/prompts/proof/complete.md +3 -3
  78. package/onboarding/prompts/proof/oss-baseline.md +5 -5
  79. package/onboarding/prompts/proof/round-trip.md +8 -8
  80. package/onboarding/prompts/research/gather.md +5 -5
  81. package/onboarding/prompts/research/merge.md +2 -2
  82. package/onboarding/prompts/research/preflight.md +2 -2
  83. package/onboarding/prompts/research/route.md +5 -5
  84. package/onboarding/prompts/starter/clone.md +92 -7
  85. package/onboarding/prompts/stopped/run-failed.md +2 -2
  86. package/onboarding/prompts/subagent/create-plan.md +2 -2
  87. package/onboarding/prompts/subagent/implement-and-validate.md +2 -2
  88. package/onboarding/prompts/subagent/inspect-repository.md +1 -1
  89. package/onboarding/prompts/subagent/prove-oss-baseline.md +1 -1
  90. package/onboarding/prompts/subagent/prove-round-trip.md +8 -6
  91. package/onboarding/prompts/unsupported/no-validated-path.md +2 -2
  92. package/package.json +1 -1
  93. package/release/release-tool.js +12 -1
  94. package/services/local-auth-worker.js +175 -159
@@ -100,7 +100,7 @@ var require_polyfills = __commonJS({
100
100
  fs2.fstatSync = statFixSync(fs2.fstatSync);
101
101
  fs2.lstatSync = statFixSync(fs2.lstatSync);
102
102
  if (fs2.chmod && !fs2.lchmod) {
103
- fs2.lchmod = function(path2, mode, cb) {
103
+ fs2.lchmod = function(path3, mode, cb) {
104
104
  if (cb)
105
105
  process.nextTick(cb);
106
106
  };
@@ -108,7 +108,7 @@ var require_polyfills = __commonJS({
108
108
  };
109
109
  }
110
110
  if (fs2.chown && !fs2.lchown) {
111
- fs2.lchown = function(path2, uid, gid, cb) {
111
+ fs2.lchown = function(path3, uid, gid, cb) {
112
112
  if (cb)
113
113
  process.nextTick(cb);
114
114
  };
@@ -179,9 +179,9 @@ var require_polyfills = __commonJS({
179
179
  };
180
180
  }(fs2.readSync);
181
181
  function patchLchmod(fs3) {
182
- fs3.lchmod = function(path2, mode, callback) {
182
+ fs3.lchmod = function(path3, mode, callback) {
183
183
  fs3.open(
184
- path2,
184
+ path3,
185
185
  constants3.O_WRONLY | constants3.O_SYMLINK,
186
186
  mode,
187
187
  function(err, fd) {
@@ -199,8 +199,8 @@ var require_polyfills = __commonJS({
199
199
  }
200
200
  );
201
201
  };
202
- fs3.lchmodSync = function(path2, mode) {
203
- var fd = fs3.openSync(path2, constants3.O_WRONLY | constants3.O_SYMLINK, mode);
202
+ fs3.lchmodSync = function(path3, mode) {
203
+ var fd = fs3.openSync(path3, constants3.O_WRONLY | constants3.O_SYMLINK, mode);
204
204
  var threw = true;
205
205
  var ret;
206
206
  try {
@@ -221,8 +221,8 @@ var require_polyfills = __commonJS({
221
221
  }
222
222
  function patchLutimes(fs3) {
223
223
  if (constants3.hasOwnProperty("O_SYMLINK") && fs3.futimes) {
224
- fs3.lutimes = function(path2, at, mt, cb) {
225
- fs3.open(path2, constants3.O_SYMLINK, function(er, fd) {
224
+ fs3.lutimes = function(path3, at, mt, cb) {
225
+ fs3.open(path3, constants3.O_SYMLINK, function(er, fd) {
226
226
  if (er) {
227
227
  if (cb)
228
228
  cb(er);
@@ -236,8 +236,8 @@ var require_polyfills = __commonJS({
236
236
  });
237
237
  });
238
238
  };
239
- fs3.lutimesSync = function(path2, at, mt) {
240
- var fd = fs3.openSync(path2, constants3.O_SYMLINK);
239
+ fs3.lutimesSync = function(path3, at, mt) {
240
+ var fd = fs3.openSync(path3, constants3.O_SYMLINK);
241
241
  var ret;
242
242
  var threw = true;
243
243
  try {
@@ -375,12 +375,12 @@ var require_legacy_streams = __commonJS({
375
375
  ReadStream,
376
376
  WriteStream
377
377
  };
378
- function ReadStream(path2, options) {
378
+ function ReadStream(path3, options) {
379
379
  if (!(this instanceof ReadStream))
380
- return new ReadStream(path2, options);
380
+ return new ReadStream(path3, options);
381
381
  Stream.call(this);
382
382
  var self = this;
383
- this.path = path2;
383
+ this.path = path3;
384
384
  this.fd = null;
385
385
  this.readable = true;
386
386
  this.paused = false;
@@ -426,11 +426,11 @@ var require_legacy_streams = __commonJS({
426
426
  self._read();
427
427
  });
428
428
  }
429
- function WriteStream(path2, options) {
429
+ function WriteStream(path3, options) {
430
430
  if (!(this instanceof WriteStream))
431
- return new WriteStream(path2, options);
431
+ return new WriteStream(path3, options);
432
432
  Stream.call(this);
433
- this.path = path2;
433
+ this.path = path3;
434
434
  this.fd = null;
435
435
  this.writable = true;
436
436
  this.flags = "w";
@@ -576,14 +576,14 @@ var require_graceful_fs = __commonJS({
576
576
  fs3.createWriteStream = createWriteStream;
577
577
  var fs$readFile = fs3.readFile;
578
578
  fs3.readFile = readFile3;
579
- function readFile3(path2, options, cb) {
579
+ function readFile3(path3, options, cb) {
580
580
  if (typeof options === "function")
581
581
  cb = options, options = null;
582
- return go$readFile(path2, options, cb);
583
- function go$readFile(path3, options2, cb2, startTime) {
584
- return fs$readFile(path3, options2, function(err) {
582
+ return go$readFile(path3, options, cb);
583
+ function go$readFile(path4, options2, cb2, startTime) {
584
+ return fs$readFile(path4, options2, function(err) {
585
585
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
586
- enqueue([go$readFile, [path3, options2, cb2], err, startTime || Date.now(), Date.now()]);
586
+ enqueue([go$readFile, [path4, options2, cb2], err, startTime || Date.now(), Date.now()]);
587
587
  else {
588
588
  if (typeof cb2 === "function")
589
589
  cb2.apply(this, arguments);
@@ -593,14 +593,14 @@ var require_graceful_fs = __commonJS({
593
593
  }
594
594
  var fs$writeFile = fs3.writeFile;
595
595
  fs3.writeFile = writeFile;
596
- function writeFile(path2, data, options, cb) {
596
+ function writeFile(path3, data, options, cb) {
597
597
  if (typeof options === "function")
598
598
  cb = options, options = null;
599
- return go$writeFile(path2, data, options, cb);
600
- function go$writeFile(path3, data2, options2, cb2, startTime) {
601
- return fs$writeFile(path3, data2, options2, function(err) {
599
+ return go$writeFile(path3, data, options, cb);
600
+ function go$writeFile(path4, data2, options2, cb2, startTime) {
601
+ return fs$writeFile(path4, data2, options2, function(err) {
602
602
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
603
- enqueue([go$writeFile, [path3, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
603
+ enqueue([go$writeFile, [path4, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
604
604
  else {
605
605
  if (typeof cb2 === "function")
606
606
  cb2.apply(this, arguments);
@@ -611,14 +611,14 @@ var require_graceful_fs = __commonJS({
611
611
  var fs$appendFile = fs3.appendFile;
612
612
  if (fs$appendFile)
613
613
  fs3.appendFile = appendFile;
614
- function appendFile(path2, data, options, cb) {
614
+ function appendFile(path3, data, options, cb) {
615
615
  if (typeof options === "function")
616
616
  cb = options, options = null;
617
- return go$appendFile(path2, data, options, cb);
618
- function go$appendFile(path3, data2, options2, cb2, startTime) {
619
- return fs$appendFile(path3, data2, options2, function(err) {
617
+ return go$appendFile(path3, data, options, cb);
618
+ function go$appendFile(path4, data2, options2, cb2, startTime) {
619
+ return fs$appendFile(path4, data2, options2, function(err) {
620
620
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
621
- enqueue([go$appendFile, [path3, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
621
+ enqueue([go$appendFile, [path4, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
622
622
  else {
623
623
  if (typeof cb2 === "function")
624
624
  cb2.apply(this, arguments);
@@ -649,31 +649,31 @@ var require_graceful_fs = __commonJS({
649
649
  var fs$readdir = fs3.readdir;
650
650
  fs3.readdir = readdir;
651
651
  var noReaddirOptionVersions = /^v[0-5]\./;
652
- function readdir(path2, options, cb) {
652
+ function readdir(path3, options, cb) {
653
653
  if (typeof options === "function")
654
654
  cb = options, options = null;
655
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path3, options2, cb2, startTime) {
656
- return fs$readdir(path3, fs$readdirCallback(
657
- path3,
655
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path4, options2, cb2, startTime) {
656
+ return fs$readdir(path4, fs$readdirCallback(
657
+ path4,
658
658
  options2,
659
659
  cb2,
660
660
  startTime
661
661
  ));
662
- } : function go$readdir2(path3, options2, cb2, startTime) {
663
- return fs$readdir(path3, options2, fs$readdirCallback(
664
- path3,
662
+ } : function go$readdir2(path4, options2, cb2, startTime) {
663
+ return fs$readdir(path4, options2, fs$readdirCallback(
664
+ path4,
665
665
  options2,
666
666
  cb2,
667
667
  startTime
668
668
  ));
669
669
  };
670
- return go$readdir(path2, options, cb);
671
- function fs$readdirCallback(path3, options2, cb2, startTime) {
670
+ return go$readdir(path3, options, cb);
671
+ function fs$readdirCallback(path4, options2, cb2, startTime) {
672
672
  return function(err, files) {
673
673
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
674
674
  enqueue([
675
675
  go$readdir,
676
- [path3, options2, cb2],
676
+ [path4, options2, cb2],
677
677
  err,
678
678
  startTime || Date.now(),
679
679
  Date.now()
@@ -744,7 +744,7 @@ var require_graceful_fs = __commonJS({
744
744
  enumerable: true,
745
745
  configurable: true
746
746
  });
747
- function ReadStream(path2, options) {
747
+ function ReadStream(path3, options) {
748
748
  if (this instanceof ReadStream)
749
749
  return fs$ReadStream.apply(this, arguments), this;
750
750
  else
@@ -764,7 +764,7 @@ var require_graceful_fs = __commonJS({
764
764
  }
765
765
  });
766
766
  }
767
- function WriteStream(path2, options) {
767
+ function WriteStream(path3, options) {
768
768
  if (this instanceof WriteStream)
769
769
  return fs$WriteStream.apply(this, arguments), this;
770
770
  else
@@ -782,22 +782,22 @@ var require_graceful_fs = __commonJS({
782
782
  }
783
783
  });
784
784
  }
785
- function createReadStream(path2, options) {
786
- return new fs3.ReadStream(path2, options);
785
+ function createReadStream(path3, options) {
786
+ return new fs3.ReadStream(path3, options);
787
787
  }
788
- function createWriteStream(path2, options) {
789
- return new fs3.WriteStream(path2, options);
788
+ function createWriteStream(path3, options) {
789
+ return new fs3.WriteStream(path3, options);
790
790
  }
791
791
  var fs$open = fs3.open;
792
792
  fs3.open = open3;
793
- function open3(path2, flags, mode, cb) {
793
+ function open3(path3, flags, mode, cb) {
794
794
  if (typeof mode === "function")
795
795
  cb = mode, mode = null;
796
- return go$open(path2, flags, mode, cb);
797
- function go$open(path3, flags2, mode2, cb2, startTime) {
798
- return fs$open(path3, flags2, mode2, function(err, fd) {
796
+ return go$open(path3, flags, mode, cb);
797
+ function go$open(path4, flags2, mode2, cb2, startTime) {
798
+ return fs$open(path4, flags2, mode2, function(err, fd) {
799
799
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
800
- enqueue([go$open, [path3, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
800
+ enqueue([go$open, [path4, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
801
801
  else {
802
802
  if (typeof cb2 === "function")
803
803
  cb2.apply(this, arguments);
@@ -1338,7 +1338,7 @@ var require_lockfile = __commonJS({
1338
1338
  "node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js"(exports, module) {
1339
1339
  "use strict";
1340
1340
  init_define_CLI_LOCAL_EVALUATION_SUPPORT();
1341
- var path2 = __require("path");
1341
+ var path3 = __require("path");
1342
1342
  var fs2 = require_graceful_fs();
1343
1343
  var retry = require_retry2();
1344
1344
  var onExit = require_signal_exit();
@@ -1349,7 +1349,7 @@ var require_lockfile = __commonJS({
1349
1349
  }
1350
1350
  function resolveCanonicalPath(file2, options, callback) {
1351
1351
  if (!options.realpath) {
1352
- return callback(null, path2.resolve(file2));
1352
+ return callback(null, path3.resolve(file2));
1353
1353
  }
1354
1354
  options.fs.realpath(file2, callback);
1355
1355
  }
@@ -1945,8 +1945,8 @@ var require_req = __commonJS({
1945
1945
  if (req.originalUrl) {
1946
1946
  _req.url = req.originalUrl;
1947
1947
  } else {
1948
- const path2 = req.path;
1949
- _req.url = typeof path2 === "string" ? path2 : req.url ? req.url.path || req.url : void 0;
1948
+ const path3 = req.path;
1949
+ _req.url = typeof path3 === "string" ? path3 : req.url ? req.url.path || req.url : void 0;
1950
1950
  }
1951
1951
  if (req.query) {
1952
1952
  _req.query = req.query;
@@ -2118,14 +2118,14 @@ var require_redact = __commonJS({
2118
2118
  }
2119
2119
  return obj;
2120
2120
  }
2121
- function parsePath(path2) {
2121
+ function parsePath(path3) {
2122
2122
  const parts = [];
2123
2123
  let current = "";
2124
2124
  let inBrackets = false;
2125
2125
  let inQuotes = false;
2126
2126
  let quoteChar = "";
2127
- for (let i = 0; i < path2.length; i++) {
2128
- const char = path2[i];
2127
+ for (let i = 0; i < path3.length; i++) {
2128
+ const char = path3[i];
2129
2129
  if (!inBrackets && char === ".") {
2130
2130
  if (current) {
2131
2131
  parts.push(current);
@@ -2256,10 +2256,10 @@ var require_redact = __commonJS({
2256
2256
  return current;
2257
2257
  }
2258
2258
  function redactPaths(obj, paths, censor, remove = false) {
2259
- for (const path2 of paths) {
2260
- const parts = parsePath(path2);
2259
+ for (const path3 of paths) {
2260
+ const parts = parsePath(path3);
2261
2261
  if (parts.includes("*")) {
2262
- redactWildcardPath(obj, parts, censor, path2, remove);
2262
+ redactWildcardPath(obj, parts, censor, path3, remove);
2263
2263
  } else {
2264
2264
  if (remove) {
2265
2265
  removeKey(obj, parts);
@@ -2346,8 +2346,8 @@ var require_redact = __commonJS({
2346
2346
  }
2347
2347
  } else {
2348
2348
  if (afterWildcard.includes("*")) {
2349
- const wrappedCensor = typeof censor === "function" ? (value, path2) => {
2350
- const fullPath = [...pathArray.slice(0, pathLength), ...path2];
2349
+ const wrappedCensor = typeof censor === "function" ? (value, path3) => {
2350
+ const fullPath = [...pathArray.slice(0, pathLength), ...path3];
2351
2351
  return censor(value, fullPath);
2352
2352
  } : censor;
2353
2353
  redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove);
@@ -2384,8 +2384,8 @@ var require_redact = __commonJS({
2384
2384
  return null;
2385
2385
  }
2386
2386
  const pathStructure = /* @__PURE__ */ new Map();
2387
- for (const path2 of pathsToClone) {
2388
- const parts = parsePath(path2);
2387
+ for (const path3 of pathsToClone) {
2388
+ const parts = parsePath(path3);
2389
2389
  let current = pathStructure;
2390
2390
  for (let i = 0; i < parts.length; i++) {
2391
2391
  const part = parts[i];
@@ -2437,24 +2437,24 @@ var require_redact = __commonJS({
2437
2437
  }
2438
2438
  return cloneSelectively(obj, pathStructure);
2439
2439
  }
2440
- function validatePath(path2) {
2441
- if (typeof path2 !== "string") {
2440
+ function validatePath(path3) {
2441
+ if (typeof path3 !== "string") {
2442
2442
  throw new Error("Paths must be (non-empty) strings");
2443
2443
  }
2444
- if (path2 === "") {
2444
+ if (path3 === "") {
2445
2445
  throw new Error("Invalid redaction path ()");
2446
2446
  }
2447
- if (path2.includes("..")) {
2448
- throw new Error(`Invalid redaction path (${path2})`);
2447
+ if (path3.includes("..")) {
2448
+ throw new Error(`Invalid redaction path (${path3})`);
2449
2449
  }
2450
- if (path2.includes(",")) {
2451
- throw new Error(`Invalid redaction path (${path2})`);
2450
+ if (path3.includes(",")) {
2451
+ throw new Error(`Invalid redaction path (${path3})`);
2452
2452
  }
2453
2453
  let bracketCount = 0;
2454
2454
  let inQuotes = false;
2455
2455
  let quoteChar = "";
2456
- for (let i = 0; i < path2.length; i++) {
2457
- const char = path2[i];
2456
+ for (let i = 0; i < path3.length; i++) {
2457
+ const char = path3[i];
2458
2458
  if ((char === '"' || char === "'") && bracketCount > 0) {
2459
2459
  if (!inQuotes) {
2460
2460
  inQuotes = true;
@@ -2468,20 +2468,20 @@ var require_redact = __commonJS({
2468
2468
  } else if (char === "]" && !inQuotes) {
2469
2469
  bracketCount--;
2470
2470
  if (bracketCount < 0) {
2471
- throw new Error(`Invalid redaction path (${path2})`);
2471
+ throw new Error(`Invalid redaction path (${path3})`);
2472
2472
  }
2473
2473
  }
2474
2474
  }
2475
2475
  if (bracketCount !== 0) {
2476
- throw new Error(`Invalid redaction path (${path2})`);
2476
+ throw new Error(`Invalid redaction path (${path3})`);
2477
2477
  }
2478
2478
  }
2479
2479
  function validatePaths(paths) {
2480
2480
  if (!Array.isArray(paths)) {
2481
2481
  throw new TypeError("paths must be an array");
2482
2482
  }
2483
- for (const path2 of paths) {
2484
- validatePath(path2);
2483
+ for (const path3 of paths) {
2484
+ validatePath(path3);
2485
2485
  }
2486
2486
  }
2487
2487
  function slowRedact(options = {}) {
@@ -2651,8 +2651,8 @@ var require_redaction = __commonJS({
2651
2651
  if (shape[k] === null) {
2652
2652
  o[k] = (value) => topCensor(value, [k]);
2653
2653
  } else {
2654
- const wrappedCensor = typeof censor === "function" ? (value, path2) => {
2655
- return censor(value, [k, ...path2]);
2654
+ const wrappedCensor = typeof censor === "function" ? (value, path3) => {
2655
+ return censor(value, [k, ...path3]);
2656
2656
  } : censor;
2657
2657
  o[k] = Redact({
2658
2658
  paths: shape[k],
@@ -2880,7 +2880,7 @@ var require_sonic_boom = __commonJS({
2880
2880
  var fs2 = __require("fs");
2881
2881
  var EventEmitter = __require("events");
2882
2882
  var inherits = __require("util").inherits;
2883
- var path2 = __require("path");
2883
+ var path3 = __require("path");
2884
2884
  var sleep = require_atomic_sleep();
2885
2885
  var assert2 = __require("assert");
2886
2886
  var BUSY_WRITE_TIMEOUT = 100;
@@ -2935,7 +2935,7 @@ var require_sonic_boom = __commonJS({
2935
2935
  if (sonic.sync) {
2936
2936
  try {
2937
2937
  if (sonic.mkdir)
2938
- fs2.mkdirSync(path2.dirname(file2), { recursive: true });
2938
+ fs2.mkdirSync(path3.dirname(file2), { recursive: true });
2939
2939
  const fd = fs2.openSync(file2, flags, mode);
2940
2940
  fileOpened(null, fd);
2941
2941
  } catch (err) {
@@ -2943,7 +2943,7 @@ var require_sonic_boom = __commonJS({
2943
2943
  throw err;
2944
2944
  }
2945
2945
  } else if (sonic.mkdir) {
2946
- fs2.mkdir(path2.dirname(file2), { recursive: true }, (err) => {
2946
+ fs2.mkdir(path3.dirname(file2), { recursive: true }, (err) => {
2947
2947
  if (err)
2948
2948
  return fileOpened(err);
2949
2949
  fs2.open(file2, flags, mode, fileOpened);
@@ -3692,7 +3692,7 @@ var require_thread_stream = __commonJS({
3692
3692
  var { version: version3 } = require_package();
3693
3693
  var { EventEmitter } = __require("events");
3694
3694
  var { Worker } = __require("worker_threads");
3695
- var { join: join7 } = __require("path");
3695
+ var { join: join8 } = __require("path");
3696
3696
  var { pathToFileURL } = __require("url");
3697
3697
  var { wait } = require_wait();
3698
3698
  var {
@@ -3728,7 +3728,7 @@ var require_thread_stream = __commonJS({
3728
3728
  function createWorker(stream, opts) {
3729
3729
  const { filename, workerData } = opts;
3730
3730
  const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
3731
- const toExecute = bundlerOverrides["thread-stream-worker"] || join7(__dirname, "lib", "worker.js");
3731
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join8(__dirname, "lib", "worker.js");
3732
3732
  const worker = new Worker(toExecute, {
3733
3733
  ...opts.workerOpts,
3734
3734
  trackUnmanagedFds: false,
@@ -4120,7 +4120,7 @@ var require_transport = __commonJS({
4120
4120
  var { createRequire } = __require("module");
4121
4121
  var { existsSync: existsSync2 } = __require("node:fs");
4122
4122
  var getCallers = require_caller();
4123
- var { join: join7, isAbsolute, sep } = __require("node:path");
4123
+ var { join: join8, isAbsolute: isAbsolute2, sep } = __require("node:path");
4124
4124
  var { fileURLToPath } = __require("node:url");
4125
4125
  var sleep = require_atomic_sleep();
4126
4126
  var onExit = require_on_exit_leak_free();
@@ -4184,15 +4184,15 @@ var require_transport = __commonJS({
4184
4184
  if (!unquoted) {
4185
4185
  return false;
4186
4186
  }
4187
- let path2 = unquoted;
4188
- if (path2.startsWith("file://")) {
4187
+ let path3 = unquoted;
4188
+ if (path3.startsWith("file://")) {
4189
4189
  try {
4190
- path2 = fileURLToPath(path2);
4190
+ path3 = fileURLToPath(path3);
4191
4191
  } catch {
4192
4192
  return false;
4193
4193
  }
4194
4194
  }
4195
- return isAbsolute(path2) && !existsSync2(path2);
4195
+ return isAbsolute2(path3) && !existsSync2(path3);
4196
4196
  }
4197
4197
  function stripQuotes(value) {
4198
4198
  const first = value[0];
@@ -4273,7 +4273,7 @@ var require_transport = __commonJS({
4273
4273
  throw new Error("only one of target or targets can be specified");
4274
4274
  }
4275
4275
  if (targets) {
4276
- target = bundlerOverrides["pino-worker"] || join7(__dirname, "worker.js");
4276
+ target = bundlerOverrides["pino-worker"] || join8(__dirname, "worker.js");
4277
4277
  options.targets = targets.filter((dest) => dest.target).map((dest) => {
4278
4278
  return {
4279
4279
  ...dest,
@@ -4291,7 +4291,7 @@ var require_transport = __commonJS({
4291
4291
  });
4292
4292
  });
4293
4293
  } else if (pipeline) {
4294
- target = bundlerOverrides["pino-worker"] || join7(__dirname, "worker.js");
4294
+ target = bundlerOverrides["pino-worker"] || join8(__dirname, "worker.js");
4295
4295
  options.pipelines = [pipeline.map((dest) => {
4296
4296
  return {
4297
4297
  ...dest,
@@ -4310,11 +4310,11 @@ var require_transport = __commonJS({
4310
4310
  return buildStream(fixTarget(target), options, worker, sync, name);
4311
4311
  function fixTarget(origin) {
4312
4312
  origin = bundlerOverrides[origin] || origin;
4313
- if (isAbsolute(origin) || origin.indexOf("file://") === 0) {
4313
+ if (isAbsolute2(origin) || origin.indexOf("file://") === 0) {
4314
4314
  return origin;
4315
4315
  }
4316
4316
  if (origin === "pino/file") {
4317
- return join7(__dirname, "..", "file.js");
4317
+ return join8(__dirname, "..", "file.js");
4318
4318
  }
4319
4319
  let fixTarget2;
4320
4320
  for (const filePath of callers) {
@@ -5311,7 +5311,7 @@ var require_safe_stable_stringify = __commonJS({
5311
5311
  return circularValue;
5312
5312
  }
5313
5313
  let res = "";
5314
- let join7 = ",";
5314
+ let join8 = ",";
5315
5315
  const originalIndentation = indentation;
5316
5316
  if (Array.isArray(value)) {
5317
5317
  if (value.length === 0) {
@@ -5325,7 +5325,7 @@ var require_safe_stable_stringify = __commonJS({
5325
5325
  indentation += spacer;
5326
5326
  res += `
5327
5327
  ${indentation}`;
5328
- join7 = `,
5328
+ join8 = `,
5329
5329
  ${indentation}`;
5330
5330
  }
5331
5331
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -5333,13 +5333,13 @@ ${indentation}`;
5333
5333
  for (; i < maximumValuesToStringify - 1; i++) {
5334
5334
  const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
5335
5335
  res += tmp2 !== void 0 ? tmp2 : "null";
5336
- res += join7;
5336
+ res += join8;
5337
5337
  }
5338
5338
  const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
5339
5339
  res += tmp !== void 0 ? tmp : "null";
5340
5340
  if (value.length - 1 > maximumBreadth) {
5341
5341
  const removedKeys = value.length - maximumBreadth - 1;
5342
- res += `${join7}"... ${getItemCount(removedKeys)} not stringified"`;
5342
+ res += `${join8}"... ${getItemCount(removedKeys)} not stringified"`;
5343
5343
  }
5344
5344
  if (spacer !== "") {
5345
5345
  res += `
@@ -5360,7 +5360,7 @@ ${originalIndentation}`;
5360
5360
  let separator = "";
5361
5361
  if (spacer !== "") {
5362
5362
  indentation += spacer;
5363
- join7 = `,
5363
+ join8 = `,
5364
5364
  ${indentation}`;
5365
5365
  whitespace = " ";
5366
5366
  }
@@ -5374,13 +5374,13 @@ ${indentation}`;
5374
5374
  const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
5375
5375
  if (tmp !== void 0) {
5376
5376
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
5377
- separator = join7;
5377
+ separator = join8;
5378
5378
  }
5379
5379
  }
5380
5380
  if (keyLength > maximumBreadth) {
5381
5381
  const removedKeys = keyLength - maximumBreadth;
5382
5382
  res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
5383
- separator = join7;
5383
+ separator = join8;
5384
5384
  }
5385
5385
  if (spacer !== "" && separator.length > 1) {
5386
5386
  res = `
@@ -5420,7 +5420,7 @@ ${originalIndentation}`;
5420
5420
  }
5421
5421
  const originalIndentation = indentation;
5422
5422
  let res = "";
5423
- let join7 = ",";
5423
+ let join8 = ",";
5424
5424
  if (Array.isArray(value)) {
5425
5425
  if (value.length === 0) {
5426
5426
  return "[]";
@@ -5433,7 +5433,7 @@ ${originalIndentation}`;
5433
5433
  indentation += spacer;
5434
5434
  res += `
5435
5435
  ${indentation}`;
5436
- join7 = `,
5436
+ join8 = `,
5437
5437
  ${indentation}`;
5438
5438
  }
5439
5439
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -5441,13 +5441,13 @@ ${indentation}`;
5441
5441
  for (; i < maximumValuesToStringify - 1; i++) {
5442
5442
  const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
5443
5443
  res += tmp2 !== void 0 ? tmp2 : "null";
5444
- res += join7;
5444
+ res += join8;
5445
5445
  }
5446
5446
  const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
5447
5447
  res += tmp !== void 0 ? tmp : "null";
5448
5448
  if (value.length - 1 > maximumBreadth) {
5449
5449
  const removedKeys = value.length - maximumBreadth - 1;
5450
- res += `${join7}"... ${getItemCount(removedKeys)} not stringified"`;
5450
+ res += `${join8}"... ${getItemCount(removedKeys)} not stringified"`;
5451
5451
  }
5452
5452
  if (spacer !== "") {
5453
5453
  res += `
@@ -5460,7 +5460,7 @@ ${originalIndentation}`;
5460
5460
  let whitespace = "";
5461
5461
  if (spacer !== "") {
5462
5462
  indentation += spacer;
5463
- join7 = `,
5463
+ join8 = `,
5464
5464
  ${indentation}`;
5465
5465
  whitespace = " ";
5466
5466
  }
@@ -5469,7 +5469,7 @@ ${indentation}`;
5469
5469
  const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
5470
5470
  if (tmp !== void 0) {
5471
5471
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
5472
- separator = join7;
5472
+ separator = join8;
5473
5473
  }
5474
5474
  }
5475
5475
  if (spacer !== "" && separator.length > 1) {
@@ -5526,20 +5526,20 @@ ${originalIndentation}`;
5526
5526
  indentation += spacer;
5527
5527
  let res2 = `
5528
5528
  ${indentation}`;
5529
- const join8 = `,
5529
+ const join9 = `,
5530
5530
  ${indentation}`;
5531
5531
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
5532
5532
  let i = 0;
5533
5533
  for (; i < maximumValuesToStringify - 1; i++) {
5534
5534
  const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
5535
5535
  res2 += tmp2 !== void 0 ? tmp2 : "null";
5536
- res2 += join8;
5536
+ res2 += join9;
5537
5537
  }
5538
5538
  const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
5539
5539
  res2 += tmp !== void 0 ? tmp : "null";
5540
5540
  if (value.length - 1 > maximumBreadth) {
5541
5541
  const removedKeys = value.length - maximumBreadth - 1;
5542
- res2 += `${join8}"... ${getItemCount(removedKeys)} not stringified"`;
5542
+ res2 += `${join9}"... ${getItemCount(removedKeys)} not stringified"`;
5543
5543
  }
5544
5544
  res2 += `
5545
5545
  ${originalIndentation}`;
@@ -5555,16 +5555,16 @@ ${originalIndentation}`;
5555
5555
  return '"[Object]"';
5556
5556
  }
5557
5557
  indentation += spacer;
5558
- const join7 = `,
5558
+ const join8 = `,
5559
5559
  ${indentation}`;
5560
5560
  let res = "";
5561
5561
  let separator = "";
5562
5562
  let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
5563
5563
  if (isTypedArrayWithEntries(value)) {
5564
- res += stringifyTypedArray(value, join7, maximumBreadth);
5564
+ res += stringifyTypedArray(value, join8, maximumBreadth);
5565
5565
  keys = keys.slice(value.length);
5566
5566
  maximumPropertiesToStringify -= value.length;
5567
- separator = join7;
5567
+ separator = join8;
5568
5568
  }
5569
5569
  if (deterministic) {
5570
5570
  keys = sort(keys, comparator);
@@ -5575,13 +5575,13 @@ ${indentation}`;
5575
5575
  const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
5576
5576
  if (tmp !== void 0) {
5577
5577
  res += `${separator}${strEscape(key2)}: ${tmp}`;
5578
- separator = join7;
5578
+ separator = join8;
5579
5579
  }
5580
5580
  }
5581
5581
  if (keyLength > maximumBreadth) {
5582
5582
  const removedKeys = keyLength - maximumBreadth;
5583
5583
  res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
5584
- separator = join7;
5584
+ separator = join8;
5585
5585
  }
5586
5586
  if (separator !== "") {
5587
5587
  res = `
@@ -6116,7 +6116,7 @@ init_define_CLI_LOCAL_EVALUATION_SUPPORT();
6116
6116
  var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
6117
6117
  import { setTimeout as delay } from "node:timers/promises";
6118
6118
  import { mkdir as mkdir2, chmod as chmod4 } from "node:fs/promises";
6119
- import { join as join6 } from "node:path";
6119
+ import { join as join7 } from "node:path";
6120
6120
 
6121
6121
  // node_modules/.pnpm/zod@4.3.6/node_modules/zod/index.js
6122
6122
  init_define_CLI_LOCAL_EVALUATION_SUPPORT();
@@ -6898,10 +6898,10 @@ function mergeDefs(...defs) {
6898
6898
  function cloneDef(schema) {
6899
6899
  return mergeDefs(schema._zod.def);
6900
6900
  }
6901
- function getElementAtPath(obj, path2) {
6902
- if (!path2)
6901
+ function getElementAtPath(obj, path3) {
6902
+ if (!path3)
6903
6903
  return obj;
6904
- return path2.reduce((acc, key) => acc?.[key], obj);
6904
+ return path3.reduce((acc, key) => acc?.[key], obj);
6905
6905
  }
6906
6906
  function promiseAllObject(promisesObj) {
6907
6907
  const keys = Object.keys(promisesObj);
@@ -7284,11 +7284,11 @@ function aborted(x, startIndex = 0) {
7284
7284
  }
7285
7285
  return false;
7286
7286
  }
7287
- function prefixIssues(path2, issues) {
7287
+ function prefixIssues(path3, issues) {
7288
7288
  return issues.map((iss) => {
7289
7289
  var _a2;
7290
7290
  (_a2 = iss).path ?? (_a2.path = []);
7291
- iss.path.unshift(path2);
7291
+ iss.path.unshift(path3);
7292
7292
  return iss;
7293
7293
  });
7294
7294
  }
@@ -7471,7 +7471,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
7471
7471
  }
7472
7472
  function treeifyError(error48, mapper = (issue2) => issue2.message) {
7473
7473
  const result = { errors: [] };
7474
- const processError = (error49, path2 = []) => {
7474
+ const processError = (error49, path3 = []) => {
7475
7475
  var _a2, _b;
7476
7476
  for (const issue2 of error49.issues) {
7477
7477
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -7481,7 +7481,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
7481
7481
  } else if (issue2.code === "invalid_element") {
7482
7482
  processError({ issues: issue2.issues }, issue2.path);
7483
7483
  } else {
7484
- const fullpath = [...path2, ...issue2.path];
7484
+ const fullpath = [...path3, ...issue2.path];
7485
7485
  if (fullpath.length === 0) {
7486
7486
  result.errors.push(mapper(issue2));
7487
7487
  continue;
@@ -7513,8 +7513,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
7513
7513
  }
7514
7514
  function toDotPath(_path) {
7515
7515
  const segs = [];
7516
- const path2 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
7517
- for (const seg of path2) {
7516
+ const path3 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
7517
+ for (const seg of path3) {
7518
7518
  if (typeof seg === "number")
7519
7519
  segs.push(`[${seg}]`);
7520
7520
  else if (typeof seg === "symbol")
@@ -19568,13 +19568,13 @@ function resolveRef(ref, ctx) {
19568
19568
  if (!ref.startsWith("#")) {
19569
19569
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
19570
19570
  }
19571
- const path2 = ref.slice(1).split("/").filter(Boolean);
19572
- if (path2.length === 0) {
19571
+ const path3 = ref.slice(1).split("/").filter(Boolean);
19572
+ if (path3.length === 0) {
19573
19573
  return ctx.rootSchema;
19574
19574
  }
19575
19575
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
19576
- if (path2[0] === defsKey) {
19577
- const key = path2[1];
19576
+ if (path3[0] === defsKey) {
19577
+ const key = path3[1];
19578
19578
  if (!key || !ctx.defs[key]) {
19579
19579
  throw new Error(`Reference not found: ${ref}`);
19580
19580
  }
@@ -20082,7 +20082,7 @@ async function localAuthHosts(record2, run) {
20082
20082
  }
20083
20083
 
20084
20084
  // apps/cli/src/services/local-auth-provider.ts
20085
- import { join as join4 } from "node:path";
20085
+ import { join as join5 } from "node:path";
20086
20086
 
20087
20087
  // apps/cli/src/services/local-oidc.ts
20088
20088
  init_define_CLI_LOCAL_EVALUATION_SUPPORT();
@@ -20399,24 +20399,24 @@ var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
20399
20399
  import { randomUUID } from "node:crypto";
20400
20400
  import { mkdir, chmod, open, realpath, rename, rm, stat } from "node:fs/promises";
20401
20401
  import { dirname, join } from "node:path";
20402
- async function writeLocalJson(path2, value) {
20403
- await mkdir(dirname(path2), { recursive: true, mode: 448 });
20404
- await chmod(dirname(path2), 448);
20405
- await writeLocalFile(path2, `${JSON.stringify(value, null, 2)}
20402
+ async function writeLocalJson(path3, value) {
20403
+ await mkdir(dirname(path3), { recursive: true, mode: 448 });
20404
+ await chmod(dirname(path3), 448);
20405
+ await writeLocalFile(path3, `${JSON.stringify(value, null, 2)}
20406
20406
  `);
20407
20407
  }
20408
- async function resolveWriteTarget(path2) {
20408
+ async function resolveWriteTarget(path3) {
20409
20409
  try {
20410
- const target = await realpath(path2);
20410
+ const target = await realpath(path3);
20411
20411
  return { target, mode: (await stat(target)).mode & 511 };
20412
20412
  } catch (error48) {
20413
20413
  if (error48 instanceof Error && "code" in error48 && error48.code === "ENOENT")
20414
- return { target: path2 };
20414
+ return { target: path3 };
20415
20415
  throw error48;
20416
20416
  }
20417
20417
  }
20418
- async function writeLocalFile(path2, content) {
20419
- const { target, mode } = await resolveWriteTarget(path2);
20418
+ async function writeLocalFile(path3, content) {
20419
+ const { target, mode } = await resolveWriteTarget(path3);
20420
20420
  const temporary = join(dirname(target), `.cpki-${randomUUID()}.tmp`);
20421
20421
  const file2 = await open(temporary, "wx", 384);
20422
20422
  try {
@@ -20462,10 +20462,10 @@ var identitySchema = external_exports.object({
20462
20462
  })
20463
20463
  }).strict();
20464
20464
  async function loadIdentity(directory, requestedPort) {
20465
- const path2 = join2(directory, "cli-oidc-identity.json");
20465
+ const path3 = join2(directory, "cli-oidc-identity.json");
20466
20466
  try {
20467
20467
  const identity2 = identitySchema.parse(
20468
- JSON.parse(await readFile(path2, "utf8"))
20468
+ JSON.parse(await readFile(path3, "utf8"))
20469
20469
  );
20470
20470
  if (requestedPort !== void 0 && identity2.port !== requestedPort)
20471
20471
  throw new Error("Saved auth port differs.");
@@ -20495,7 +20495,7 @@ async function loadIdentity(directory, requestedPort) {
20495
20495
  use: "sig"
20496
20496
  }
20497
20497
  });
20498
- await writeLocalJson(path2, identity);
20498
+ await writeLocalJson(path3, identity);
20499
20499
  return identity;
20500
20500
  }
20501
20501
  async function startLocalOidc(options) {
@@ -20819,11 +20819,11 @@ var credentialSchema = external_exports.object({
20819
20819
  dashboardPassword: external_exports.string().optional(),
20820
20820
  apiKey: external_exports.string().regex(/^cpk-local_[a-f0-9]{16}_[a-f0-9]{64}$/)
20821
20821
  }).strict();
20822
- async function loadLocalSecrets(path2, allowCreate = true) {
20822
+ async function loadLocalSecrets(path3, allowCreate = true) {
20823
20823
  try {
20824
- const existing = JSON.parse(await readFile2(path2, "utf8"));
20824
+ const existing = JSON.parse(await readFile2(path3, "utf8"));
20825
20825
  credentialSchema.parse(existing);
20826
- await chmod2(path2, 384);
20826
+ await chmod2(path3, 384);
20827
20827
  return existing;
20828
20828
  } catch (error48) {
20829
20829
  if (!(error48 instanceof Error && "code" in error48 && error48.code === "ENOENT")) {
@@ -20836,7 +20836,7 @@ async function loadLocalSecrets(path2, allowCreate = true) {
20836
20836
  ...Object.fromEntries(credentialNames.map((name) => [name, randomBytes3(32).toString("hex")])),
20837
20837
  apiKey: `cpk-local_${randomBytes3(8).toString("hex")}_${randomBytes3(32).toString("hex")}`
20838
20838
  };
20839
- await writeLocalJson(path2, credentials2);
20839
+ await writeLocalJson(path3, credentials2);
20840
20840
  return credentials2;
20841
20841
  }
20842
20842
 
@@ -20855,20 +20855,36 @@ init_define_CLI_LOCAL_EVALUATION_SUPPORT();
20855
20855
  var import_pino = __toESM(require_pino(), 1);
20856
20856
  import * as fs from "node:fs";
20857
20857
  import * as os from "node:os";
20858
+ import * as path2 from "node:path";
20859
+
20860
+ // apps/cli/src/services/cli-config-directory.ts
20861
+ init_define_CLI_LOCAL_EVALUATION_SUPPORT();
20858
20862
  import * as path from "node:path";
20863
+ var CLI_CONFIG_DIRECTORY_ENV = "COPILOTKIT_CONFIG_DIR";
20864
+ function cliConfigDirectory(env = process.env) {
20865
+ const value = env[CLI_CONFIG_DIRECTORY_ENV]?.trim() ?? "";
20866
+ return value !== "" && path.isAbsolute(value) ? value : void 0;
20867
+ }
20868
+
20869
+ // apps/cli/src/services/cli-logs.ts
20859
20870
  var CLI_LOG_DIRECTORY_MODE = 448;
20860
20871
  var CLI_LOG_FILE_MODE = 384;
20861
20872
  var CLI_LOG_FILE_NAME = "cli.log";
20862
20873
  var CLI_LOG_TAIL_CHUNK_BYTES = 64 * 1024;
20863
20874
  var CLI_LOG_OPEN_FLAGS = fs.constants.O_WRONLY | fs.constants.O_APPEND | fs.constants.O_CREAT | (fs.constants.O_NOFOLLOW ?? 0);
20864
- var HOME_CLI_LOG_DIRECTORY = path.join(
20875
+ var HOME_CLI_LOG_DIRECTORY = path2.join(
20865
20876
  process.env["XDG_STATE_HOME"] ?? os.homedir(),
20866
20877
  process.env["XDG_STATE_HOME"] ? "copilotkit" : ".copilotkit"
20867
20878
  );
20879
+ var CONFIGURED_CLI_LOG_DIRECTORY = (() => {
20880
+ const directory = cliConfigDirectory();
20881
+ return directory === void 0 ? void 0 : path2.join(directory, "logs");
20882
+ })();
20868
20883
  var CLI_LOG_TARGET = openCliLogTarget([
20884
+ ...CONFIGURED_CLI_LOG_DIRECTORY === void 0 ? [] : [{ directory: CONFIGURED_CLI_LOG_DIRECTORY, shared: false }],
20869
20885
  { directory: HOME_CLI_LOG_DIRECTORY, shared: false },
20870
20886
  {
20871
- directory: path.join(os.tmpdir(), `copilotkit-${process.getuid?.() ?? "user"}`),
20887
+ directory: path2.join(os.tmpdir(), `copilotkit-${process.getuid?.() ?? "user"}`),
20872
20888
  shared: true
20873
20889
  }
20874
20890
  ]);
@@ -20888,10 +20904,10 @@ function openCliLogTarget(locations) {
20888
20904
  for (const location of locations) {
20889
20905
  const fileDescriptor = openPrivateCliLogFile(location);
20890
20906
  if (fileDescriptor !== null) {
20891
- return { path: path.join(location.directory, CLI_LOG_FILE_NAME), fileDescriptor };
20907
+ return { path: path2.join(location.directory, CLI_LOG_FILE_NAME), fileDescriptor };
20892
20908
  }
20893
20909
  }
20894
- return { path: path.join(HOME_CLI_LOG_DIRECTORY, CLI_LOG_FILE_NAME), fileDescriptor: null };
20910
+ return { path: path2.join(HOME_CLI_LOG_DIRECTORY, CLI_LOG_FILE_NAME), fileDescriptor: null };
20895
20911
  }
20896
20912
  function openPrivateCliLogFile(location) {
20897
20913
  try {
@@ -20904,7 +20920,7 @@ function openPrivateCliLogFile(location) {
20904
20920
  }
20905
20921
  tryChmod(() => fs.chmodSync(location.directory, CLI_LOG_DIRECTORY_MODE));
20906
20922
  const fileDescriptor = fs.openSync(
20907
- path.join(location.directory, CLI_LOG_FILE_NAME),
20923
+ path2.join(location.directory, CLI_LOG_FILE_NAME),
20908
20924
  CLI_LOG_OPEN_FLAGS,
20909
20925
  CLI_LOG_FILE_MODE
20910
20926
  );
@@ -21007,7 +21023,7 @@ async function runLocalAuthProvider(record2, directory, options) {
21007
21023
  await assertLocalRuntime(options.run);
21008
21024
  await assertLocalClusterOwnership(record2, options.run);
21009
21025
  const hosts = await localAuthHosts(record2, options.run);
21010
- const secrets = await loadLocalSecrets(join4(directory, "secrets.json"), false);
21026
+ const secrets = await loadLocalSecrets(join5(directory, "secrets.json"), false);
21011
21027
  const server = await startLocalOidc({
21012
21028
  directory,
21013
21029
  port: record2.ports.auth,
@@ -21131,7 +21147,7 @@ import { randomBytes as randomBytes4, randomUUID as randomUUID3, timingSafeEqual
21131
21147
  import { chmod as chmod3, lstat, mkdtemp, open as open2, rm as rm2 } from "node:fs/promises";
21132
21148
  import { constants as constants2 } from "node:fs";
21133
21149
  import { connect, createServer as createServer2 } from "node:net";
21134
- import { join as join5 } from "node:path";
21150
+ import { join as join6 } from "node:path";
21135
21151
  var MAX_FRAME = 8192;
21136
21152
  var stateSchema = external_exports.object({
21137
21153
  socket: external_exports.string().regex(/^\/tmp\/cpki-auth-[A-Za-z0-9]+\/control.sock$/),
@@ -21162,7 +21178,7 @@ async function readLocalAuthServiceState(directory) {
21162
21178
  let file2;
21163
21179
  try {
21164
21180
  file2 = await open2(
21165
- join5(directory, "cli-auth-service.json"),
21181
+ join6(directory, "cli-auth-service.json"),
21166
21182
  constants2.O_RDONLY | constants2.O_NOFOLLOW
21167
21183
  );
21168
21184
  } catch (error48) {
@@ -21188,7 +21204,7 @@ async function serveLocalAuthControl(directory, handlers) {
21188
21204
  const socketDirectory = await mkdtemp("/tmp/cpki-auth-");
21189
21205
  await chmod3(socketDirectory, 448);
21190
21206
  const state = {
21191
- socket: join5(socketDirectory, "control.sock"),
21207
+ socket: join6(socketDirectory, "control.sock"),
21192
21208
  capability: randomBytes4(32).toString("hex"),
21193
21209
  instance: randomUUID3(),
21194
21210
  pid: process.pid
@@ -21266,7 +21282,7 @@ async function serveLocalAuthControl(directory, handlers) {
21266
21282
  await new Promise((resolve) => server.close(() => resolve()));
21267
21283
  try {
21268
21284
  if ((await readLocalAuthServiceState(directory))?.instance === state.instance)
21269
- await rm2(join5(directory, "cli-auth-service.json"));
21285
+ await rm2(join6(directory, "cli-auth-service.json"));
21270
21286
  } finally {
21271
21287
  await rm2(socketDirectory, { recursive: true, force: true });
21272
21288
  }
@@ -21280,7 +21296,7 @@ async function serveLocalAuthControl(directory, handlers) {
21280
21296
  });
21281
21297
  });
21282
21298
  await chmod3(state.socket, 384);
21283
- await writeLocalJson(join5(directory, "cli-auth-service.json"), state);
21299
+ await writeLocalJson(join6(directory, "cli-auth-service.json"), state);
21284
21300
  return { close: close2 };
21285
21301
  } catch {
21286
21302
  await close2();
@@ -21354,7 +21370,7 @@ async function runLocalAuthWorker(record2, directory) {
21354
21370
  while (!release) {
21355
21371
  controller.signal.throwIfAborted();
21356
21372
  try {
21357
- release = await (0, import_proper_lockfile2.lock)(join6(directory, "cli-auth-service-owner"), {
21373
+ release = await (0, import_proper_lockfile2.lock)(join7(directory, "cli-auth-service-owner"), {
21358
21374
  realpath: false,
21359
21375
  stale: 1e4,
21360
21376
  update: 2e3,