copilotkit 3.0.4 → 4.0.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 (2) hide show
  1. package/index.js +1284 -867
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -45,7 +45,6 @@ var config_exports = {};
45
45
  __export(config_exports, {
46
46
  getBuildInfo: () => getBuildInfo,
47
47
  getC15tBackendUrl: () => getC15tBackendUrl,
48
- getHostedApiKey: () => getHostedApiKey,
49
48
  getHostedGatewayUrl: () => getHostedGatewayUrl,
50
49
  getHostedRuntimeUrl: () => getHostedRuntimeUrl,
51
50
  getHostedSlEnabled: () => getHostedSlEnabled,
@@ -79,9 +78,9 @@ function getTelemetryEndpointUrl() {
79
78
  }
80
79
  function getBuildInfo() {
81
80
  return {
82
- version: true ? "3.0.4" : "dev",
83
- buildNumber: true ? "27576739464" : "dev",
84
- commitSha: true ? "06965d1eb7e99562803841975dc7f4dfc25a56c2" : "dev"
81
+ version: true ? "4.0.0" : "dev",
82
+ buildNumber: true ? "27795169012" : "dev",
83
+ commitSha: true ? "bb3701070c6c9458489e478195f40e7e8c5d5c9d" : "dev"
85
84
  };
86
85
  }
87
86
  function getTemplateRef() {
@@ -96,9 +95,6 @@ function getHostedRuntimeUrl() {
96
95
  function getHostedGatewayUrl() {
97
96
  return true ? "wss://realtime.intelligence.copilotkit.ai" : "";
98
97
  }
99
- function getHostedApiKey() {
100
- return true ? "cpk_sPRVSEED_seed0privat0longtoken00" : "";
101
- }
102
98
  function getHostedSlEnabled() {
103
99
  return true;
104
100
  }
@@ -625,7 +621,7 @@ var init_types = __esm({
625
621
  // in `agent/.env`, and the agent accepts either OpenAI (`OPENAI_API_KEY`)
626
622
  // or Azure OpenAI (`AZURE_OPENAI_ENDPOINT`, optionally `AZURE_OPENAI_API_KEY`
627
623
  // or `az login`). The dev preflight only reads the root `.env`, so any fixed
628
- // key requirement here would falsely hard-block valid Azure/`agent/.env`
624
+ // key requirement here would falsely warn on valid Azure/`agent/.env`
629
625
  // setups. Credential guidance lives in the template README.
630
626
  environment: []
631
627
  },
@@ -792,6 +788,10 @@ function classifyError(err) {
792
788
  }
793
789
  const code = err.code;
794
790
  if (typeof code === "string") {
791
+ if (code === "CLI_REQUEST_TIMEOUT")
792
+ return "timeout";
793
+ if (code === "CLI_REQUEST_FAILED")
794
+ return "network";
795
795
  if (code === "TEMPLATE_FETCH_FAILED")
796
796
  return "template_fetch";
797
797
  if (code === "GIT_FAILED")
@@ -873,16 +873,16 @@ function processSegment(segment, parts) {
873
873
  }
874
874
  return true;
875
875
  }
876
- function parsePath(path15) {
877
- if (typeof path15 !== "string") {
878
- throw new TypeError(`Expected a string, got ${typeof path15}`);
876
+ function parsePath(path16) {
877
+ if (typeof path16 !== "string") {
878
+ throw new TypeError(`Expected a string, got ${typeof path16}`);
879
879
  }
880
880
  const parts = [];
881
881
  let currentSegment = "";
882
882
  let currentPart = "start";
883
883
  let isEscaping = false;
884
884
  let position = 0;
885
- for (const character of path15) {
885
+ for (const character of path16) {
886
886
  position++;
887
887
  if (isEscaping) {
888
888
  currentSegment += character;
@@ -992,13 +992,13 @@ function parsePath(path15) {
992
992
  }
993
993
  return parts;
994
994
  }
995
- function normalizePath(path15) {
996
- if (typeof path15 === "string") {
997
- return parsePath(path15);
995
+ function normalizePath(path16) {
996
+ if (typeof path16 === "string") {
997
+ return parsePath(path16);
998
998
  }
999
- if (Array.isArray(path15)) {
999
+ if (Array.isArray(path16)) {
1000
1000
  const normalized = [];
1001
- for (const [index, segment] of path15.entries()) {
1001
+ for (const [index, segment] of path16.entries()) {
1002
1002
  if (typeof segment !== "string" && typeof segment !== "number") {
1003
1003
  throw new TypeError(`Expected a string or number for path segment at index ${index}, got ${typeof segment}`);
1004
1004
  }
@@ -1018,11 +1018,11 @@ function normalizePath(path15) {
1018
1018
  }
1019
1019
  return [];
1020
1020
  }
1021
- function getProperty(object2, path15, value) {
1022
- if (!isObject(object2) || typeof path15 !== "string" && !Array.isArray(path15)) {
1021
+ function getProperty(object2, path16, value) {
1022
+ if (!isObject(object2) || typeof path16 !== "string" && !Array.isArray(path16)) {
1023
1023
  return value === void 0 ? object2 : value;
1024
1024
  }
1025
- const pathArray = normalizePath(path15);
1025
+ const pathArray = normalizePath(path16);
1026
1026
  if (pathArray.length === 0) {
1027
1027
  return value;
1028
1028
  }
@@ -1038,12 +1038,12 @@ function getProperty(object2, path15, value) {
1038
1038
  }
1039
1039
  return object2 === void 0 ? value : object2;
1040
1040
  }
1041
- function setProperty(object2, path15, value) {
1042
- if (!isObject(object2) || typeof path15 !== "string" && !Array.isArray(path15)) {
1041
+ function setProperty(object2, path16, value) {
1042
+ if (!isObject(object2) || typeof path16 !== "string" && !Array.isArray(path16)) {
1043
1043
  return object2;
1044
1044
  }
1045
1045
  const root = object2;
1046
- const pathArray = normalizePath(path15);
1046
+ const pathArray = normalizePath(path16);
1047
1047
  if (pathArray.length === 0) {
1048
1048
  return object2;
1049
1049
  }
@@ -1060,11 +1060,11 @@ function setProperty(object2, path15, value) {
1060
1060
  }
1061
1061
  return root;
1062
1062
  }
1063
- function deleteProperty(object2, path15) {
1064
- if (!isObject(object2) || typeof path15 !== "string" && !Array.isArray(path15)) {
1063
+ function deleteProperty(object2, path16) {
1064
+ if (!isObject(object2) || typeof path16 !== "string" && !Array.isArray(path16)) {
1065
1065
  return false;
1066
1066
  }
1067
- const pathArray = normalizePath(path15);
1067
+ const pathArray = normalizePath(path16);
1068
1068
  if (pathArray.length === 0) {
1069
1069
  return false;
1070
1070
  }
@@ -1084,11 +1084,11 @@ function deleteProperty(object2, path15) {
1084
1084
  }
1085
1085
  }
1086
1086
  }
1087
- function hasProperty(object2, path15) {
1088
- if (!isObject(object2) || typeof path15 !== "string" && !Array.isArray(path15)) {
1087
+ function hasProperty(object2, path16) {
1088
+ if (!isObject(object2) || typeof path16 !== "string" && !Array.isArray(path16)) {
1089
1089
  return false;
1090
1090
  }
1091
- const pathArray = normalizePath(path15);
1091
+ const pathArray = normalizePath(path16);
1092
1092
  if (pathArray.length === 0) {
1093
1093
  return false;
1094
1094
  }
@@ -4902,8 +4902,8 @@ var require_utils = __commonJS({
4902
4902
  }
4903
4903
  return ind;
4904
4904
  }
4905
- function removeDotSegments(path15) {
4906
- let input = path15;
4905
+ function removeDotSegments(path16) {
4906
+ let input = path16;
4907
4907
  const output = [];
4908
4908
  let nextSlash = -1;
4909
4909
  let len = 0;
@@ -5102,8 +5102,8 @@ var require_schemes = __commonJS({
5102
5102
  wsComponent.secure = void 0;
5103
5103
  }
5104
5104
  if (wsComponent.resourceName) {
5105
- const [path15, query] = wsComponent.resourceName.split("?");
5106
- wsComponent.path = path15 && path15 !== "/" ? path15 : void 0;
5105
+ const [path16, query] = wsComponent.resourceName.split("?");
5106
+ wsComponent.path = path16 && path16 !== "/" ? path16 : void 0;
5107
5107
  wsComponent.query = query;
5108
5108
  wsComponent.resourceName = void 0;
5109
5109
  }
@@ -9290,12 +9290,12 @@ var require_dist = __commonJS({
9290
9290
  throw new Error(`Unknown format "${name}"`);
9291
9291
  return f;
9292
9292
  };
9293
- function addFormats(ajv, list, fs16, exportName) {
9293
+ function addFormats(ajv, list, fs17, exportName) {
9294
9294
  var _a2;
9295
9295
  var _b;
9296
9296
  (_a2 = (_b = ajv.opts.code).formats) !== null && _a2 !== void 0 ? _a2 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
9297
9297
  for (const f of list)
9298
- ajv.addFormat(f, fs16[f]);
9298
+ ajv.addFormat(f, fs17[f]);
9299
9299
  }
9300
9300
  module.exports = exports = formatsPlugin;
9301
9301
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -12427,8 +12427,8 @@ var require_req = __commonJS({
12427
12427
  if (req.originalUrl) {
12428
12428
  _req.url = req.originalUrl;
12429
12429
  } else {
12430
- const path15 = req.path;
12431
- _req.url = typeof path15 === "string" ? path15 : req.url ? req.url.path || req.url : void 0;
12430
+ const path16 = req.path;
12431
+ _req.url = typeof path16 === "string" ? path16 : req.url ? req.url.path || req.url : void 0;
12432
12432
  }
12433
12433
  if (req.query) {
12434
12434
  _req.query = req.query;
@@ -12596,14 +12596,14 @@ var require_redact = __commonJS({
12596
12596
  }
12597
12597
  return obj;
12598
12598
  }
12599
- function parsePath2(path15) {
12599
+ function parsePath2(path16) {
12600
12600
  const parts = [];
12601
12601
  let current = "";
12602
12602
  let inBrackets = false;
12603
12603
  let inQuotes = false;
12604
12604
  let quoteChar = "";
12605
- for (let i = 0; i < path15.length; i++) {
12606
- const char = path15[i];
12605
+ for (let i = 0; i < path16.length; i++) {
12606
+ const char = path16[i];
12607
12607
  if (!inBrackets && char === ".") {
12608
12608
  if (current) {
12609
12609
  parts.push(current);
@@ -12734,10 +12734,10 @@ var require_redact = __commonJS({
12734
12734
  return current;
12735
12735
  }
12736
12736
  function redactPaths(obj, paths, censor, remove = false) {
12737
- for (const path15 of paths) {
12738
- const parts = parsePath2(path15);
12737
+ for (const path16 of paths) {
12738
+ const parts = parsePath2(path16);
12739
12739
  if (parts.includes("*")) {
12740
- redactWildcardPath(obj, parts, censor, path15, remove);
12740
+ redactWildcardPath(obj, parts, censor, path16, remove);
12741
12741
  } else {
12742
12742
  if (remove) {
12743
12743
  removeKey(obj, parts);
@@ -12824,8 +12824,8 @@ var require_redact = __commonJS({
12824
12824
  }
12825
12825
  } else {
12826
12826
  if (afterWildcard.includes("*")) {
12827
- const wrappedCensor = typeof censor === "function" ? (value, path15) => {
12828
- const fullPath = [...pathArray.slice(0, pathLength), ...path15];
12827
+ const wrappedCensor = typeof censor === "function" ? (value, path16) => {
12828
+ const fullPath = [...pathArray.slice(0, pathLength), ...path16];
12829
12829
  return censor(value, fullPath);
12830
12830
  } : censor;
12831
12831
  redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove);
@@ -12862,8 +12862,8 @@ var require_redact = __commonJS({
12862
12862
  return null;
12863
12863
  }
12864
12864
  const pathStructure = /* @__PURE__ */ new Map();
12865
- for (const path15 of pathsToClone) {
12866
- const parts = parsePath2(path15);
12865
+ for (const path16 of pathsToClone) {
12866
+ const parts = parsePath2(path16);
12867
12867
  let current = pathStructure;
12868
12868
  for (let i = 0; i < parts.length; i++) {
12869
12869
  const part = parts[i];
@@ -12915,24 +12915,24 @@ var require_redact = __commonJS({
12915
12915
  }
12916
12916
  return cloneSelectively(obj, pathStructure);
12917
12917
  }
12918
- function validatePath(path15) {
12919
- if (typeof path15 !== "string") {
12918
+ function validatePath(path16) {
12919
+ if (typeof path16 !== "string") {
12920
12920
  throw new Error("Paths must be (non-empty) strings");
12921
12921
  }
12922
- if (path15 === "") {
12922
+ if (path16 === "") {
12923
12923
  throw new Error("Invalid redaction path ()");
12924
12924
  }
12925
- if (path15.includes("..")) {
12926
- throw new Error(`Invalid redaction path (${path15})`);
12925
+ if (path16.includes("..")) {
12926
+ throw new Error(`Invalid redaction path (${path16})`);
12927
12927
  }
12928
- if (path15.includes(",")) {
12929
- throw new Error(`Invalid redaction path (${path15})`);
12928
+ if (path16.includes(",")) {
12929
+ throw new Error(`Invalid redaction path (${path16})`);
12930
12930
  }
12931
12931
  let bracketCount = 0;
12932
12932
  let inQuotes = false;
12933
12933
  let quoteChar = "";
12934
- for (let i = 0; i < path15.length; i++) {
12935
- const char = path15[i];
12934
+ for (let i = 0; i < path16.length; i++) {
12935
+ const char = path16[i];
12936
12936
  if ((char === '"' || char === "'") && bracketCount > 0) {
12937
12937
  if (!inQuotes) {
12938
12938
  inQuotes = true;
@@ -12946,20 +12946,20 @@ var require_redact = __commonJS({
12946
12946
  } else if (char === "]" && !inQuotes) {
12947
12947
  bracketCount--;
12948
12948
  if (bracketCount < 0) {
12949
- throw new Error(`Invalid redaction path (${path15})`);
12949
+ throw new Error(`Invalid redaction path (${path16})`);
12950
12950
  }
12951
12951
  }
12952
12952
  }
12953
12953
  if (bracketCount !== 0) {
12954
- throw new Error(`Invalid redaction path (${path15})`);
12954
+ throw new Error(`Invalid redaction path (${path16})`);
12955
12955
  }
12956
12956
  }
12957
12957
  function validatePaths(paths) {
12958
12958
  if (!Array.isArray(paths)) {
12959
12959
  throw new TypeError("paths must be an array");
12960
12960
  }
12961
- for (const path15 of paths) {
12962
- validatePath(path15);
12961
+ for (const path16 of paths) {
12962
+ validatePath(path16);
12963
12963
  }
12964
12964
  }
12965
12965
  function slowRedact(options = {}) {
@@ -13127,8 +13127,8 @@ var require_redaction = __commonJS({
13127
13127
  if (shape[k] === null) {
13128
13128
  o[k] = (value) => topCensor(value, [k]);
13129
13129
  } else {
13130
- const wrappedCensor = typeof censor === "function" ? (value, path15) => {
13131
- return censor(value, [k, ...path15]);
13130
+ const wrappedCensor = typeof censor === "function" ? (value, path16) => {
13131
+ return censor(value, [k, ...path16]);
13132
13132
  } : censor;
13133
13133
  o[k] = Redact({
13134
13134
  paths: shape[k],
@@ -13349,10 +13349,10 @@ var require_atomic_sleep = __commonJS({
13349
13349
  var require_sonic_boom = __commonJS({
13350
13350
  "node_modules/.pnpm/sonic-boom@4.2.1/node_modules/sonic-boom/index.js"(exports, module) {
13351
13351
  "use strict";
13352
- var fs16 = __require("fs");
13352
+ var fs17 = __require("fs");
13353
13353
  var EventEmitter3 = __require("events");
13354
13354
  var inherits = __require("util").inherits;
13355
- var path15 = __require("path");
13355
+ var path16 = __require("path");
13356
13356
  var sleep = require_atomic_sleep();
13357
13357
  var assert3 = __require("assert");
13358
13358
  var BUSY_WRITE_TIMEOUT = 100;
@@ -13407,21 +13407,21 @@ var require_sonic_boom = __commonJS({
13407
13407
  if (sonic.sync) {
13408
13408
  try {
13409
13409
  if (sonic.mkdir)
13410
- fs16.mkdirSync(path15.dirname(file2), { recursive: true });
13411
- const fd = fs16.openSync(file2, flags, mode);
13410
+ fs17.mkdirSync(path16.dirname(file2), { recursive: true });
13411
+ const fd = fs17.openSync(file2, flags, mode);
13412
13412
  fileOpened(null, fd);
13413
13413
  } catch (err) {
13414
13414
  fileOpened(err);
13415
13415
  throw err;
13416
13416
  }
13417
13417
  } else if (sonic.mkdir) {
13418
- fs16.mkdir(path15.dirname(file2), { recursive: true }, (err) => {
13418
+ fs17.mkdir(path16.dirname(file2), { recursive: true }, (err) => {
13419
13419
  if (err)
13420
13420
  return fileOpened(err);
13421
- fs16.open(file2, flags, mode, fileOpened);
13421
+ fs17.open(file2, flags, mode, fileOpened);
13422
13422
  });
13423
13423
  } else {
13424
- fs16.open(file2, flags, mode, fileOpened);
13424
+ fs17.open(file2, flags, mode, fileOpened);
13425
13425
  }
13426
13426
  }
13427
13427
  function SonicBoom(opts) {
@@ -13462,8 +13462,8 @@ var require_sonic_boom = __commonJS({
13462
13462
  this.flush = flushBuffer;
13463
13463
  this.flushSync = flushBufferSync;
13464
13464
  this._actualWrite = actualWriteBuffer;
13465
- fsWriteSync = () => fs16.writeSync(this.fd, this._writingBuf);
13466
- fsWrite = () => fs16.write(this.fd, this._writingBuf, this.release);
13465
+ fsWriteSync = () => fs17.writeSync(this.fd, this._writingBuf);
13466
+ fsWrite = () => fs17.write(this.fd, this._writingBuf, this.release);
13467
13467
  } else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
13468
13468
  this._writingBuf = "";
13469
13469
  this.write = write;
@@ -13472,15 +13472,15 @@ var require_sonic_boom = __commonJS({
13472
13472
  this._actualWrite = actualWrite;
13473
13473
  fsWriteSync = () => {
13474
13474
  if (Buffer.isBuffer(this._writingBuf)) {
13475
- return fs16.writeSync(this.fd, this._writingBuf);
13475
+ return fs17.writeSync(this.fd, this._writingBuf);
13476
13476
  }
13477
- return fs16.writeSync(this.fd, this._writingBuf, "utf8");
13477
+ return fs17.writeSync(this.fd, this._writingBuf, "utf8");
13478
13478
  };
13479
13479
  fsWrite = () => {
13480
13480
  if (Buffer.isBuffer(this._writingBuf)) {
13481
- return fs16.write(this.fd, this._writingBuf, this.release);
13481
+ return fs17.write(this.fd, this._writingBuf, this.release);
13482
13482
  }
13483
- return fs16.write(this.fd, this._writingBuf, "utf8", this.release);
13483
+ return fs17.write(this.fd, this._writingBuf, "utf8", this.release);
13484
13484
  };
13485
13485
  } else {
13486
13486
  throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
@@ -13537,7 +13537,7 @@ var require_sonic_boom = __commonJS({
13537
13537
  }
13538
13538
  }
13539
13539
  if (this._fsync) {
13540
- fs16.fsyncSync(this.fd);
13540
+ fs17.fsyncSync(this.fd);
13541
13541
  }
13542
13542
  const len = this._len;
13543
13543
  if (this._reopening) {
@@ -13652,7 +13652,7 @@ var require_sonic_boom = __commonJS({
13652
13652
  const onDrain = () => {
13653
13653
  if (!this._fsync) {
13654
13654
  try {
13655
- fs16.fsync(this.fd, (err) => {
13655
+ fs17.fsync(this.fd, (err) => {
13656
13656
  this._flushPending = false;
13657
13657
  cb(err);
13658
13658
  });
@@ -13754,7 +13754,7 @@ var require_sonic_boom = __commonJS({
13754
13754
  const fd = this.fd;
13755
13755
  this.once("ready", () => {
13756
13756
  if (fd !== this.fd) {
13757
- fs16.close(fd, (err) => {
13757
+ fs17.close(fd, (err) => {
13758
13758
  if (err) {
13759
13759
  return this.emit("error", err);
13760
13760
  }
@@ -13803,7 +13803,7 @@ var require_sonic_boom = __commonJS({
13803
13803
  buf = this._bufs[0];
13804
13804
  }
13805
13805
  try {
13806
- const n = Buffer.isBuffer(buf) ? fs16.writeSync(this.fd, buf) : fs16.writeSync(this.fd, buf, "utf8");
13806
+ const n = Buffer.isBuffer(buf) ? fs17.writeSync(this.fd, buf) : fs17.writeSync(this.fd, buf, "utf8");
13807
13807
  const releasedBufObj = releaseWritingBuf(buf, this._len, n);
13808
13808
  buf = releasedBufObj.writingBuf;
13809
13809
  this._len = releasedBufObj.len;
@@ -13819,7 +13819,7 @@ var require_sonic_boom = __commonJS({
13819
13819
  }
13820
13820
  }
13821
13821
  try {
13822
- fs16.fsyncSync(this.fd);
13822
+ fs17.fsyncSync(this.fd);
13823
13823
  } catch {
13824
13824
  }
13825
13825
  }
@@ -13840,7 +13840,7 @@ var require_sonic_boom = __commonJS({
13840
13840
  buf = mergeBuf(this._bufs[0], this._lens[0]);
13841
13841
  }
13842
13842
  try {
13843
- const n = fs16.writeSync(this.fd, buf);
13843
+ const n = fs17.writeSync(this.fd, buf);
13844
13844
  buf = buf.subarray(n);
13845
13845
  this._len = Math.max(this._len - n, 0);
13846
13846
  if (buf.length <= 0) {
@@ -13868,13 +13868,13 @@ var require_sonic_boom = __commonJS({
13868
13868
  this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
13869
13869
  if (this.sync) {
13870
13870
  try {
13871
- const written = Buffer.isBuffer(this._writingBuf) ? fs16.writeSync(this.fd, this._writingBuf) : fs16.writeSync(this.fd, this._writingBuf, "utf8");
13871
+ const written = Buffer.isBuffer(this._writingBuf) ? fs17.writeSync(this.fd, this._writingBuf) : fs17.writeSync(this.fd, this._writingBuf, "utf8");
13872
13872
  release(null, written);
13873
13873
  } catch (err) {
13874
13874
  release(err);
13875
13875
  }
13876
13876
  } else {
13877
- fs16.write(this.fd, this._writingBuf, release);
13877
+ fs17.write(this.fd, this._writingBuf, release);
13878
13878
  }
13879
13879
  }
13880
13880
  function actualWriteBuffer() {
@@ -13883,7 +13883,7 @@ var require_sonic_boom = __commonJS({
13883
13883
  this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
13884
13884
  if (this.sync) {
13885
13885
  try {
13886
- const written = fs16.writeSync(this.fd, this._writingBuf);
13886
+ const written = fs17.writeSync(this.fd, this._writingBuf);
13887
13887
  release(null, written);
13888
13888
  } catch (err) {
13889
13889
  release(err);
@@ -13892,7 +13892,7 @@ var require_sonic_boom = __commonJS({
13892
13892
  if (kCopyBuffer) {
13893
13893
  this._writingBuf = Buffer.from(this._writingBuf);
13894
13894
  }
13895
- fs16.write(this.fd, this._writingBuf, release);
13895
+ fs17.write(this.fd, this._writingBuf, release);
13896
13896
  }
13897
13897
  }
13898
13898
  function actualClose(sonic) {
@@ -13908,12 +13908,12 @@ var require_sonic_boom = __commonJS({
13908
13908
  sonic._lens = [];
13909
13909
  assert3(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
13910
13910
  try {
13911
- fs16.fsync(sonic.fd, closeWrapped);
13911
+ fs17.fsync(sonic.fd, closeWrapped);
13912
13912
  } catch {
13913
13913
  }
13914
13914
  function closeWrapped() {
13915
13915
  if (sonic.fd !== 1 && sonic.fd !== 2) {
13916
- fs16.close(sonic.fd, done);
13916
+ fs17.close(sonic.fd, done);
13917
13917
  } else {
13918
13918
  done();
13919
13919
  }
@@ -14160,7 +14160,7 @@ var require_thread_stream = __commonJS({
14160
14160
  var { version: version2 } = require_package();
14161
14161
  var { EventEmitter: EventEmitter3 } = __require("events");
14162
14162
  var { Worker } = __require("worker_threads");
14163
- var { join: join9 } = __require("path");
14163
+ var { join: join10 } = __require("path");
14164
14164
  var { pathToFileURL } = __require("url");
14165
14165
  var { wait } = require_wait();
14166
14166
  var {
@@ -14196,7 +14196,7 @@ var require_thread_stream = __commonJS({
14196
14196
  function createWorker(stream, opts) {
14197
14197
  const { filename, workerData } = opts;
14198
14198
  const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
14199
- const toExecute = bundlerOverrides["thread-stream-worker"] || join9(__dirname, "lib", "worker.js");
14199
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join10(__dirname, "lib", "worker.js");
14200
14200
  const worker = new Worker(toExecute, {
14201
14201
  ...opts.workerOpts,
14202
14202
  trackUnmanagedFds: false,
@@ -14585,9 +14585,9 @@ var require_transport = __commonJS({
14585
14585
  "node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/transport.js"(exports, module) {
14586
14586
  "use strict";
14587
14587
  var { createRequire } = __require("module");
14588
- var { existsSync: existsSync7 } = __require("node:fs");
14588
+ var { existsSync: existsSync8 } = __require("node:fs");
14589
14589
  var getCallers = require_caller();
14590
- var { join: join9, isAbsolute, sep } = __require("node:path");
14590
+ var { join: join10, isAbsolute, sep } = __require("node:path");
14591
14591
  var { fileURLToPath: fileURLToPath3 } = __require("node:url");
14592
14592
  var sleep = require_atomic_sleep();
14593
14593
  var onExit = require_on_exit_leak_free();
@@ -14651,15 +14651,15 @@ var require_transport = __commonJS({
14651
14651
  if (!unquoted) {
14652
14652
  return false;
14653
14653
  }
14654
- let path15 = unquoted;
14655
- if (path15.startsWith("file://")) {
14654
+ let path16 = unquoted;
14655
+ if (path16.startsWith("file://")) {
14656
14656
  try {
14657
- path15 = fileURLToPath3(path15);
14657
+ path16 = fileURLToPath3(path16);
14658
14658
  } catch {
14659
14659
  return false;
14660
14660
  }
14661
14661
  }
14662
- return isAbsolute(path15) && !existsSync7(path15);
14662
+ return isAbsolute(path16) && !existsSync8(path16);
14663
14663
  }
14664
14664
  function stripQuotes(value) {
14665
14665
  const first = value[0];
@@ -14740,7 +14740,7 @@ var require_transport = __commonJS({
14740
14740
  throw new Error("only one of target or targets can be specified");
14741
14741
  }
14742
14742
  if (targets) {
14743
- target = bundlerOverrides["pino-worker"] || join9(__dirname, "worker.js");
14743
+ target = bundlerOverrides["pino-worker"] || join10(__dirname, "worker.js");
14744
14744
  options.targets = targets.filter((dest) => dest.target).map((dest) => {
14745
14745
  return {
14746
14746
  ...dest,
@@ -14758,7 +14758,7 @@ var require_transport = __commonJS({
14758
14758
  });
14759
14759
  });
14760
14760
  } else if (pipeline) {
14761
- target = bundlerOverrides["pino-worker"] || join9(__dirname, "worker.js");
14761
+ target = bundlerOverrides["pino-worker"] || join10(__dirname, "worker.js");
14762
14762
  options.pipelines = [pipeline.map((dest) => {
14763
14763
  return {
14764
14764
  ...dest,
@@ -14781,7 +14781,7 @@ var require_transport = __commonJS({
14781
14781
  return origin;
14782
14782
  }
14783
14783
  if (origin === "pino/file") {
14784
- return join9(__dirname, "..", "file.js");
14784
+ return join10(__dirname, "..", "file.js");
14785
14785
  }
14786
14786
  let fixTarget2;
14787
14787
  for (const filePath of callers) {
@@ -15772,7 +15772,7 @@ var require_safe_stable_stringify = __commonJS({
15772
15772
  return circularValue;
15773
15773
  }
15774
15774
  let res = "";
15775
- let join9 = ",";
15775
+ let join10 = ",";
15776
15776
  const originalIndentation = indentation;
15777
15777
  if (Array.isArray(value)) {
15778
15778
  if (value.length === 0) {
@@ -15786,7 +15786,7 @@ var require_safe_stable_stringify = __commonJS({
15786
15786
  indentation += spacer;
15787
15787
  res += `
15788
15788
  ${indentation}`;
15789
- join9 = `,
15789
+ join10 = `,
15790
15790
  ${indentation}`;
15791
15791
  }
15792
15792
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -15794,13 +15794,13 @@ ${indentation}`;
15794
15794
  for (; i < maximumValuesToStringify - 1; i++) {
15795
15795
  const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
15796
15796
  res += tmp2 !== void 0 ? tmp2 : "null";
15797
- res += join9;
15797
+ res += join10;
15798
15798
  }
15799
15799
  const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
15800
15800
  res += tmp !== void 0 ? tmp : "null";
15801
15801
  if (value.length - 1 > maximumBreadth) {
15802
15802
  const removedKeys = value.length - maximumBreadth - 1;
15803
- res += `${join9}"... ${getItemCount(removedKeys)} not stringified"`;
15803
+ res += `${join10}"... ${getItemCount(removedKeys)} not stringified"`;
15804
15804
  }
15805
15805
  if (spacer !== "") {
15806
15806
  res += `
@@ -15821,7 +15821,7 @@ ${originalIndentation}`;
15821
15821
  let separator = "";
15822
15822
  if (spacer !== "") {
15823
15823
  indentation += spacer;
15824
- join9 = `,
15824
+ join10 = `,
15825
15825
  ${indentation}`;
15826
15826
  whitespace = " ";
15827
15827
  }
@@ -15835,13 +15835,13 @@ ${indentation}`;
15835
15835
  const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
15836
15836
  if (tmp !== void 0) {
15837
15837
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
15838
- separator = join9;
15838
+ separator = join10;
15839
15839
  }
15840
15840
  }
15841
15841
  if (keyLength > maximumBreadth) {
15842
15842
  const removedKeys = keyLength - maximumBreadth;
15843
15843
  res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
15844
- separator = join9;
15844
+ separator = join10;
15845
15845
  }
15846
15846
  if (spacer !== "" && separator.length > 1) {
15847
15847
  res = `
@@ -15881,7 +15881,7 @@ ${originalIndentation}`;
15881
15881
  }
15882
15882
  const originalIndentation = indentation;
15883
15883
  let res = "";
15884
- let join9 = ",";
15884
+ let join10 = ",";
15885
15885
  if (Array.isArray(value)) {
15886
15886
  if (value.length === 0) {
15887
15887
  return "[]";
@@ -15894,7 +15894,7 @@ ${originalIndentation}`;
15894
15894
  indentation += spacer;
15895
15895
  res += `
15896
15896
  ${indentation}`;
15897
- join9 = `,
15897
+ join10 = `,
15898
15898
  ${indentation}`;
15899
15899
  }
15900
15900
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -15902,13 +15902,13 @@ ${indentation}`;
15902
15902
  for (; i < maximumValuesToStringify - 1; i++) {
15903
15903
  const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
15904
15904
  res += tmp2 !== void 0 ? tmp2 : "null";
15905
- res += join9;
15905
+ res += join10;
15906
15906
  }
15907
15907
  const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
15908
15908
  res += tmp !== void 0 ? tmp : "null";
15909
15909
  if (value.length - 1 > maximumBreadth) {
15910
15910
  const removedKeys = value.length - maximumBreadth - 1;
15911
- res += `${join9}"... ${getItemCount(removedKeys)} not stringified"`;
15911
+ res += `${join10}"... ${getItemCount(removedKeys)} not stringified"`;
15912
15912
  }
15913
15913
  if (spacer !== "") {
15914
15914
  res += `
@@ -15921,7 +15921,7 @@ ${originalIndentation}`;
15921
15921
  let whitespace = "";
15922
15922
  if (spacer !== "") {
15923
15923
  indentation += spacer;
15924
- join9 = `,
15924
+ join10 = `,
15925
15925
  ${indentation}`;
15926
15926
  whitespace = " ";
15927
15927
  }
@@ -15930,7 +15930,7 @@ ${indentation}`;
15930
15930
  const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
15931
15931
  if (tmp !== void 0) {
15932
15932
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
15933
- separator = join9;
15933
+ separator = join10;
15934
15934
  }
15935
15935
  }
15936
15936
  if (spacer !== "" && separator.length > 1) {
@@ -15987,20 +15987,20 @@ ${originalIndentation}`;
15987
15987
  indentation += spacer;
15988
15988
  let res2 = `
15989
15989
  ${indentation}`;
15990
- const join10 = `,
15990
+ const join11 = `,
15991
15991
  ${indentation}`;
15992
15992
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
15993
15993
  let i = 0;
15994
15994
  for (; i < maximumValuesToStringify - 1; i++) {
15995
15995
  const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
15996
15996
  res2 += tmp2 !== void 0 ? tmp2 : "null";
15997
- res2 += join10;
15997
+ res2 += join11;
15998
15998
  }
15999
15999
  const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
16000
16000
  res2 += tmp !== void 0 ? tmp : "null";
16001
16001
  if (value.length - 1 > maximumBreadth) {
16002
16002
  const removedKeys = value.length - maximumBreadth - 1;
16003
- res2 += `${join10}"... ${getItemCount(removedKeys)} not stringified"`;
16003
+ res2 += `${join11}"... ${getItemCount(removedKeys)} not stringified"`;
16004
16004
  }
16005
16005
  res2 += `
16006
16006
  ${originalIndentation}`;
@@ -16016,16 +16016,16 @@ ${originalIndentation}`;
16016
16016
  return '"[Object]"';
16017
16017
  }
16018
16018
  indentation += spacer;
16019
- const join9 = `,
16019
+ const join10 = `,
16020
16020
  ${indentation}`;
16021
16021
  let res = "";
16022
16022
  let separator = "";
16023
16023
  let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
16024
16024
  if (isTypedArrayWithEntries(value)) {
16025
- res += stringifyTypedArray(value, join9, maximumBreadth);
16025
+ res += stringifyTypedArray(value, join10, maximumBreadth);
16026
16026
  keys = keys.slice(value.length);
16027
16027
  maximumPropertiesToStringify -= value.length;
16028
- separator = join9;
16028
+ separator = join10;
16029
16029
  }
16030
16030
  if (deterministic) {
16031
16031
  keys = sort(keys, comparator);
@@ -16036,13 +16036,13 @@ ${indentation}`;
16036
16036
  const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
16037
16037
  if (tmp !== void 0) {
16038
16038
  res += `${separator}${strEscape(key2)}: ${tmp}`;
16039
- separator = join9;
16039
+ separator = join10;
16040
16040
  }
16041
16041
  }
16042
16042
  if (keyLength > maximumBreadth) {
16043
16043
  const removedKeys = keyLength - maximumBreadth;
16044
16044
  res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
16045
- separator = join9;
16045
+ separator = join10;
16046
16046
  }
16047
16047
  if (separator !== "") {
16048
16048
  res = `
@@ -16965,20 +16965,20 @@ function removeTrailingSlashes(str) {
16965
16965
  i--;
16966
16966
  return str.slice(0, i);
16967
16967
  }
16968
- function resolveUrl(backendURL, path15) {
16968
+ function resolveUrl(backendURL, path16) {
16969
16969
  if (ABSOLUTE_URL_REGEX.test(backendURL)) {
16970
16970
  const backendURLObj = new URL(backendURL);
16971
16971
  const basePath = removeTrailingSlashes(backendURLObj.pathname);
16972
- const cleanPath2 = path15.replace(constants_LEADING_SLASHES_REGEX, "");
16972
+ const cleanPath2 = path16.replace(constants_LEADING_SLASHES_REGEX, "");
16973
16973
  const newPath = `${basePath}/${cleanPath2}`;
16974
16974
  backendURLObj.pathname = newPath;
16975
16975
  return backendURLObj.toString();
16976
16976
  }
16977
16977
  const cleanBase = removeTrailingSlashes(backendURL);
16978
- const cleanPath = path15.replace(constants_LEADING_SLASHES_REGEX, "");
16978
+ const cleanPath = path16.replace(constants_LEADING_SLASHES_REGEX, "");
16979
16979
  return `${cleanBase}/${cleanPath}`;
16980
16980
  }
16981
- async function fetcher(context, path15, options) {
16981
+ async function fetcher(context, path16, options) {
16982
16982
  const finalRetryConfig = {
16983
16983
  ...context.retryConfig,
16984
16984
  ...options?.retryConfig || {},
@@ -16992,7 +16992,7 @@ async function fetcher(context, path15, options) {
16992
16992
  while (attemptsMade <= (maxRetries ?? 0)) {
16993
16993
  const requestId = generateUUID();
16994
16994
  const fetchImpl = context.customFetch || globalThis.fetch;
16995
- const resolvedUrl = resolveUrl(context.backendURL, path15);
16995
+ const resolvedUrl = resolveUrl(context.backendURL, path16);
16996
16996
  let url2;
16997
16997
  try {
16998
16998
  url2 = new URL(resolvedUrl);
@@ -17037,7 +17037,7 @@ async function fetcher(context, path15, options) {
17037
17037
  code: "PARSE_ERROR",
17038
17038
  cause: parseError
17039
17039
  }, response);
17040
- options?.onError?.(errorResponse2, path15);
17040
+ options?.onError?.(errorResponse2, path16);
17041
17041
  if (options?.throw)
17042
17042
  throw new Error("Failed to parse response");
17043
17043
  return errorResponse2;
@@ -17058,7 +17058,7 @@ async function fetcher(context, path15, options) {
17058
17058
  lastErrorResponse = errorResponse;
17059
17059
  let shouldRetryThisRequest = false;
17060
17060
  if (nonRetryableStatusCodes?.includes(response.status)) {
17061
- getDebugLogger().debug(`Not retrying request to ${path15} with status ${response.status} (nonRetryableStatusCodes)`);
17061
+ getDebugLogger().debug(`Not retrying request to ${path16} with status ${response.status} (nonRetryableStatusCodes)`);
17062
17062
  shouldRetryThisRequest = false;
17063
17063
  } else if ("function" == typeof finalRetryConfig.shouldRetry)
17064
17064
  try {
@@ -17067,17 +17067,17 @@ async function fetcher(context, path15, options) {
17067
17067
  url: url2.toString(),
17068
17068
  method: requestOptions.method || "GET"
17069
17069
  });
17070
- getDebugLogger().debug(`Custom retry strategy for ${path15} with status ${response.status}: ${shouldRetryThisRequest}`);
17070
+ getDebugLogger().debug(`Custom retry strategy for ${path16} with status ${response.status}: ${shouldRetryThisRequest}`);
17071
17071
  } catch {
17072
17072
  shouldRetryThisRequest = retryableStatusCodes?.includes(response.status) ?? false;
17073
17073
  getDebugLogger().debug(`Custom retry strategy failed, falling back to status code check: ${shouldRetryThisRequest}`);
17074
17074
  }
17075
17075
  else {
17076
17076
  shouldRetryThisRequest = retryableStatusCodes?.includes(response.status) ?? false;
17077
- getDebugLogger().debug(`Standard retry check for ${path15} with status ${response.status}: ${shouldRetryThisRequest}`);
17077
+ getDebugLogger().debug(`Standard retry check for ${path16} with status ${response.status}: ${shouldRetryThisRequest}`);
17078
17078
  }
17079
17079
  if (!shouldRetryThisRequest || attemptsMade >= (maxRetries ?? 0)) {
17080
- options?.onError?.(errorResponse, path15);
17080
+ options?.onError?.(errorResponse, path16);
17081
17081
  if (options?.throw)
17082
17082
  throw new Error(errorResponse.error?.message || "Request failed");
17083
17083
  return errorResponse;
@@ -17098,7 +17098,7 @@ async function fetcher(context, path15, options) {
17098
17098
  lastErrorResponse = errorResponse;
17099
17099
  const shouldRetryThisRequest = isNetworkError && retryOnNetworkError;
17100
17100
  if (!shouldRetryThisRequest || attemptsMade >= (maxRetries ?? 0)) {
17101
- options?.onError?.(errorResponse, path15);
17101
+ options?.onError?.(errorResponse, path16);
17102
17102
  if (options?.throw)
17103
17103
  throw fetchError;
17104
17104
  return errorResponse;
@@ -17113,7 +17113,7 @@ async function fetcher(context, path15, options) {
17113
17113
  status: 0,
17114
17114
  code: "MAX_RETRIES_EXCEEDED"
17115
17115
  }, null);
17116
- options?.onError?.(maxRetriesErrorResponse, path15);
17116
+ options?.onError?.(maxRetriesErrorResponse, path16);
17117
17117
  if (options?.throw)
17118
17118
  throw new Error(`Request failed after ${maxRetries} retries`);
17119
17119
  return maxRetriesErrorResponse;
@@ -17606,9 +17606,9 @@ async function identifyUser(context, storageConfig, options) {
17606
17606
  identityProvider: body.identityProvider
17607
17607
  }
17608
17608
  }, void 0, storageConfig);
17609
- const path15 = `${API_ENDPOINTS.PATCH_SUBJECT}/${subjectId}`;
17609
+ const path16 = `${API_ENDPOINTS.PATCH_SUBJECT}/${subjectId}`;
17610
17610
  const { subjectId: _subjectId, id: _legacySubjectId, ...patchBody } = body;
17611
- return withFallback(context, path15, "PATCH", {
17611
+ return withFallback(context, path16, "PATCH", {
17612
17612
  ...restOptions,
17613
17613
  body: patchBody
17614
17614
  }, async (fallbackOptions) => {
@@ -17817,9 +17817,9 @@ async function processPendingIdentifySubmissions(context, submissions) {
17817
17817
  }
17818
17818
  try {
17819
17819
  getDebugLogger().log("Retrying identify user submission:", submission);
17820
- const path15 = `${API_ENDPOINTS.PATCH_SUBJECT}/${subjectId}`;
17820
+ const path16 = `${API_ENDPOINTS.PATCH_SUBJECT}/${subjectId}`;
17821
17821
  const { subjectId: _subjectId, id: _legacySubjectId, ...patchBody } = submission;
17822
- const response = await fetcher(context, path15, {
17822
+ const response = await fetcher(context, path16, {
17823
17823
  method: "PATCH",
17824
17824
  body: patchBody
17825
17825
  });
@@ -18160,8 +18160,8 @@ var init_dist5 = __esm({
18160
18160
  async identifyUser(options) {
18161
18161
  return identifyUser(this.fetcherContext, this.storageConfig, options);
18162
18162
  }
18163
- async $fetch(path15, options) {
18164
- return fetcher(this.fetcherContext, path15, options);
18163
+ async $fetch(path16, options) {
18164
+ return fetcher(this.fetcherContext, path16, options);
18165
18165
  }
18166
18166
  checkPendingConsentSubmissions() {
18167
18167
  checkPendingConsentSubmissions(this.fetcherContext, (submissions) => this.processPendingConsentSubmissions(submissions));
@@ -18434,10 +18434,10 @@ function mergeDefs(...defs) {
18434
18434
  function cloneDef(schema) {
18435
18435
  return mergeDefs(schema._zod.def);
18436
18436
  }
18437
- function getElementAtPath(obj, path15) {
18438
- if (!path15)
18437
+ function getElementAtPath(obj, path16) {
18438
+ if (!path16)
18439
18439
  return obj;
18440
- return path15.reduce((acc, key) => acc?.[key], obj);
18440
+ return path16.reduce((acc, key) => acc?.[key], obj);
18441
18441
  }
18442
18442
  function promiseAllObject(promisesObj) {
18443
18443
  const keys = Object.keys(promisesObj);
@@ -18749,11 +18749,11 @@ function aborted(x, startIndex = 0) {
18749
18749
  }
18750
18750
  return false;
18751
18751
  }
18752
- function prefixIssues(path15, issues) {
18752
+ function prefixIssues(path16, issues) {
18753
18753
  return issues.map((iss) => {
18754
18754
  var _a2;
18755
18755
  (_a2 = iss).path ?? (_a2.path = []);
18756
- iss.path.unshift(path15);
18756
+ iss.path.unshift(path16);
18757
18757
  return iss;
18758
18758
  });
18759
18759
  }
@@ -18996,7 +18996,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
18996
18996
  }
18997
18997
  function treeifyError(error48, mapper = (issue2) => issue2.message) {
18998
18998
  const result = { errors: [] };
18999
- const processError = (error49, path15 = []) => {
18999
+ const processError = (error49, path16 = []) => {
19000
19000
  var _a2, _b;
19001
19001
  for (const issue2 of error49.issues) {
19002
19002
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -19006,7 +19006,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
19006
19006
  } else if (issue2.code === "invalid_element") {
19007
19007
  processError({ issues: issue2.issues }, issue2.path);
19008
19008
  } else {
19009
- const fullpath = [...path15, ...issue2.path];
19009
+ const fullpath = [...path16, ...issue2.path];
19010
19010
  if (fullpath.length === 0) {
19011
19011
  result.errors.push(mapper(issue2));
19012
19012
  continue;
@@ -19038,8 +19038,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
19038
19038
  }
19039
19039
  function toDotPath(_path) {
19040
19040
  const segs = [];
19041
- const path15 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
19042
- for (const seg of path15) {
19041
+ const path16 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
19042
+ for (const seg of path16) {
19043
19043
  if (typeof seg === "number")
19044
19044
  segs.push(`[${seg}]`);
19045
19045
  else if (typeof seg === "symbol")
@@ -31802,13 +31802,13 @@ function resolveRef(ref, ctx) {
31802
31802
  if (!ref.startsWith("#")) {
31803
31803
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
31804
31804
  }
31805
- const path15 = ref.slice(1).split("/").filter(Boolean);
31806
- if (path15.length === 0) {
31805
+ const path16 = ref.slice(1).split("/").filter(Boolean);
31806
+ if (path16.length === 0) {
31807
31807
  return ctx.rootSchema;
31808
31808
  }
31809
31809
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
31810
- if (path15[0] === defsKey) {
31811
- const key = path15[1];
31810
+ if (path16[0] === defsKey) {
31811
+ const key = path16[1];
31812
31812
  if (!key || !ctx.defs[key]) {
31813
31813
  throw new Error(`Reference not found: ${ref}`);
31814
31814
  }
@@ -46224,11 +46224,11 @@ var require_react_reconciler_development = __commonJS({
46224
46224
  fiber = fiber.next, id--;
46225
46225
  return fiber;
46226
46226
  }
46227
- function copyWithSetImpl(obj, path15, index, value) {
46228
- if (index >= path15.length)
46227
+ function copyWithSetImpl(obj, path16, index, value) {
46228
+ if (index >= path16.length)
46229
46229
  return value;
46230
- var key = path15[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
46231
- updated[key] = copyWithSetImpl(obj[key], path15, index + 1, value);
46230
+ var key = path16[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
46231
+ updated[key] = copyWithSetImpl(obj[key], path16, index + 1, value);
46232
46232
  return updated;
46233
46233
  }
46234
46234
  function copyWithRename(obj, oldPath, newPath) {
@@ -46255,11 +46255,11 @@ var require_react_reconciler_development = __commonJS({
46255
46255
  );
46256
46256
  return updated;
46257
46257
  }
46258
- function copyWithDeleteImpl(obj, path15, index) {
46259
- var key = path15[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
46260
- if (index + 1 === path15.length)
46258
+ function copyWithDeleteImpl(obj, path16, index) {
46259
+ var key = path16[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
46260
+ if (index + 1 === path16.length)
46261
46261
  return isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], updated;
46262
- updated[key] = copyWithDeleteImpl(obj[key], path15, index + 1);
46262
+ updated[key] = copyWithDeleteImpl(obj[key], path16, index + 1);
46263
46263
  return updated;
46264
46264
  }
46265
46265
  function shouldSuspendImpl() {
@@ -59685,29 +59685,29 @@ var require_react_reconciler_development = __commonJS({
59685
59685
  var didWarnAboutNestedUpdates = false;
59686
59686
  var didWarnAboutFindNodeInStrictMode = {};
59687
59687
  var overrideHookState = null, overrideHookStateDeletePath = null, overrideHookStateRenamePath = null, overrideProps = null, overridePropsDeletePath = null, overridePropsRenamePath = null, scheduleUpdate = null, scheduleRetry = null, setErrorHandler = null, setSuspenseHandler = null;
59688
- overrideHookState = function(fiber, id, path15, value) {
59688
+ overrideHookState = function(fiber, id, path16, value) {
59689
59689
  id = findHook(fiber, id);
59690
- null !== id && (path15 = copyWithSetImpl(id.memoizedState, path15, 0, value), id.memoizedState = path15, id.baseState = path15, fiber.memoizedProps = assign({}, fiber.memoizedProps), path15 = enqueueConcurrentRenderForLane(fiber, 2), null !== path15 && scheduleUpdateOnFiber(path15, fiber, 2));
59690
+ null !== id && (path16 = copyWithSetImpl(id.memoizedState, path16, 0, value), id.memoizedState = path16, id.baseState = path16, fiber.memoizedProps = assign({}, fiber.memoizedProps), path16 = enqueueConcurrentRenderForLane(fiber, 2), null !== path16 && scheduleUpdateOnFiber(path16, fiber, 2));
59691
59691
  };
59692
- overrideHookStateDeletePath = function(fiber, id, path15) {
59692
+ overrideHookStateDeletePath = function(fiber, id, path16) {
59693
59693
  id = findHook(fiber, id);
59694
- null !== id && (path15 = copyWithDeleteImpl(id.memoizedState, path15, 0), id.memoizedState = path15, id.baseState = path15, fiber.memoizedProps = assign({}, fiber.memoizedProps), path15 = enqueueConcurrentRenderForLane(fiber, 2), null !== path15 && scheduleUpdateOnFiber(path15, fiber, 2));
59694
+ null !== id && (path16 = copyWithDeleteImpl(id.memoizedState, path16, 0), id.memoizedState = path16, id.baseState = path16, fiber.memoizedProps = assign({}, fiber.memoizedProps), path16 = enqueueConcurrentRenderForLane(fiber, 2), null !== path16 && scheduleUpdateOnFiber(path16, fiber, 2));
59695
59695
  };
59696
59696
  overrideHookStateRenamePath = function(fiber, id, oldPath, newPath) {
59697
59697
  id = findHook(fiber, id);
59698
59698
  null !== id && (oldPath = copyWithRename(id.memoizedState, oldPath, newPath), id.memoizedState = oldPath, id.baseState = oldPath, fiber.memoizedProps = assign({}, fiber.memoizedProps), oldPath = enqueueConcurrentRenderForLane(fiber, 2), null !== oldPath && scheduleUpdateOnFiber(oldPath, fiber, 2));
59699
59699
  };
59700
- overrideProps = function(fiber, path15, value) {
59701
- fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path15, 0, value);
59700
+ overrideProps = function(fiber, path16, value) {
59701
+ fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path16, 0, value);
59702
59702
  fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
59703
- path15 = enqueueConcurrentRenderForLane(fiber, 2);
59704
- null !== path15 && scheduleUpdateOnFiber(path15, fiber, 2);
59703
+ path16 = enqueueConcurrentRenderForLane(fiber, 2);
59704
+ null !== path16 && scheduleUpdateOnFiber(path16, fiber, 2);
59705
59705
  };
59706
- overridePropsDeletePath = function(fiber, path15) {
59707
- fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path15, 0);
59706
+ overridePropsDeletePath = function(fiber, path16) {
59707
+ fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path16, 0);
59708
59708
  fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
59709
- path15 = enqueueConcurrentRenderForLane(fiber, 2);
59710
- null !== path15 && scheduleUpdateOnFiber(path15, fiber, 2);
59709
+ path16 = enqueueConcurrentRenderForLane(fiber, 2);
59710
+ null !== path16 && scheduleUpdateOnFiber(path16, fiber, 2);
59711
59711
  };
59712
59712
  overridePropsRenamePath = function(fiber, oldPath, newPath) {
59713
59713
  fiber.pendingProps = copyWithRename(
@@ -69699,8 +69699,8 @@ var require_backend = __commonJS({
69699
69699
  }
69700
69700
  return false;
69701
69701
  }
69702
- function utils_getInObject(object2, path15) {
69703
- return path15.reduce(function(reduced, attr) {
69702
+ function utils_getInObject(object2, path16) {
69703
+ return path16.reduce(function(reduced, attr) {
69704
69704
  if (reduced) {
69705
69705
  if (utils_hasOwnProperty.call(reduced, attr)) {
69706
69706
  return reduced[attr];
@@ -69712,11 +69712,11 @@ var require_backend = __commonJS({
69712
69712
  return null;
69713
69713
  }, object2);
69714
69714
  }
69715
- function deletePathInObject(object2, path15) {
69716
- var length = path15.length;
69717
- var last = path15[length - 1];
69715
+ function deletePathInObject(object2, path16) {
69716
+ var length = path16.length;
69717
+ var last = path16[length - 1];
69718
69718
  if (object2 != null) {
69719
- var parent = utils_getInObject(object2, path15.slice(0, length - 1));
69719
+ var parent = utils_getInObject(object2, path16.slice(0, length - 1));
69720
69720
  if (parent) {
69721
69721
  if (src_isArray(parent)) {
69722
69722
  parent.splice(last, 1);
@@ -69742,11 +69742,11 @@ var require_backend = __commonJS({
69742
69742
  }
69743
69743
  }
69744
69744
  }
69745
- function utils_setInObject(object2, path15, value) {
69746
- var length = path15.length;
69747
- var last = path15[length - 1];
69745
+ function utils_setInObject(object2, path16, value) {
69746
+ var length = path16.length;
69747
+ var last = path16[length - 1];
69748
69748
  if (object2 != null) {
69749
- var parent = utils_getInObject(object2, path15.slice(0, length - 1));
69749
+ var parent = utils_getInObject(object2, path16.slice(0, length - 1));
69750
69750
  if (parent) {
69751
69751
  parent[last] = value;
69752
69752
  }
@@ -70282,8 +70282,8 @@ var require_backend = __commonJS({
70282
70282
  unserializable: Symbol("unserializable")
70283
70283
  };
70284
70284
  var LEVEL_THRESHOLD = 2;
70285
- function createDehydrated(type, inspectable, data, cleaned, path15) {
70286
- cleaned.push(path15);
70285
+ function createDehydrated(type, inspectable, data, cleaned, path16) {
70286
+ cleaned.push(path16);
70287
70287
  var dehydrated = {
70288
70288
  inspectable,
70289
70289
  type,
@@ -70301,13 +70301,13 @@ var require_backend = __commonJS({
70301
70301
  }
70302
70302
  return dehydrated;
70303
70303
  }
70304
- function dehydrate(data, cleaned, unserializable, path15, isPathAllowed) {
70304
+ function dehydrate(data, cleaned, unserializable, path16, isPathAllowed) {
70305
70305
  var level = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0;
70306
70306
  var type = getDataType(data);
70307
70307
  var isPathAllowedCheck;
70308
70308
  switch (type) {
70309
70309
  case "html_element":
70310
- cleaned.push(path15);
70310
+ cleaned.push(path16);
70311
70311
  return {
70312
70312
  inspectable: false,
70313
70313
  preview_short: formatDataForPreview(data, false),
@@ -70316,7 +70316,7 @@ var require_backend = __commonJS({
70316
70316
  type
70317
70317
  };
70318
70318
  case "function":
70319
- cleaned.push(path15);
70319
+ cleaned.push(path16);
70320
70320
  return {
70321
70321
  inspectable: false,
70322
70322
  preview_short: formatDataForPreview(data, false),
@@ -70325,14 +70325,14 @@ var require_backend = __commonJS({
70325
70325
  type
70326
70326
  };
70327
70327
  case "string":
70328
- isPathAllowedCheck = isPathAllowed(path15);
70328
+ isPathAllowedCheck = isPathAllowed(path16);
70329
70329
  if (isPathAllowedCheck) {
70330
70330
  return data;
70331
70331
  } else {
70332
70332
  return data.length <= 500 ? data : data.slice(0, 500) + "...";
70333
70333
  }
70334
70334
  case "bigint":
70335
- cleaned.push(path15);
70335
+ cleaned.push(path16);
70336
70336
  return {
70337
70337
  inspectable: false,
70338
70338
  preview_short: formatDataForPreview(data, false),
@@ -70341,7 +70341,7 @@ var require_backend = __commonJS({
70341
70341
  type
70342
70342
  };
70343
70343
  case "symbol":
70344
- cleaned.push(path15);
70344
+ cleaned.push(path16);
70345
70345
  return {
70346
70346
  inspectable: false,
70347
70347
  preview_short: formatDataForPreview(data, false),
@@ -70350,9 +70350,9 @@ var require_backend = __commonJS({
70350
70350
  type
70351
70351
  };
70352
70352
  case "react_element": {
70353
- isPathAllowedCheck = isPathAllowed(path15);
70353
+ isPathAllowedCheck = isPathAllowed(path16);
70354
70354
  if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
70355
- cleaned.push(path15);
70355
+ cleaned.push(path16);
70356
70356
  return {
70357
70357
  inspectable: true,
70358
70358
  preview_short: formatDataForPreview(data, false),
@@ -70369,19 +70369,19 @@ var require_backend = __commonJS({
70369
70369
  preview_long: formatDataForPreview(data, true),
70370
70370
  name: getDisplayNameForReactElement(data) || "Unknown"
70371
70371
  };
70372
- unserializableValue.key = dehydrate(data.key, cleaned, unserializable, path15.concat(["key"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70372
+ unserializableValue.key = dehydrate(data.key, cleaned, unserializable, path16.concat(["key"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70373
70373
  if (data.$$typeof === REACT_LEGACY_ELEMENT_TYPE) {
70374
- unserializableValue.ref = dehydrate(data.ref, cleaned, unserializable, path15.concat(["ref"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70374
+ unserializableValue.ref = dehydrate(data.ref, cleaned, unserializable, path16.concat(["ref"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70375
70375
  }
70376
- unserializableValue.props = dehydrate(data.props, cleaned, unserializable, path15.concat(["props"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70377
- unserializable.push(path15);
70376
+ unserializableValue.props = dehydrate(data.props, cleaned, unserializable, path16.concat(["props"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70377
+ unserializable.push(path16);
70378
70378
  return unserializableValue;
70379
70379
  }
70380
70380
  case "react_lazy": {
70381
- isPathAllowedCheck = isPathAllowed(path15);
70381
+ isPathAllowedCheck = isPathAllowed(path16);
70382
70382
  var payload = data._payload;
70383
70383
  if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
70384
- cleaned.push(path15);
70384
+ cleaned.push(path16);
70385
70385
  var inspectable = payload !== null && hydration_typeof(payload) === "object" && (payload._status === 1 || payload._status === 2 || payload.status === "fulfilled" || payload.status === "rejected");
70386
70386
  return {
70387
70387
  inspectable,
@@ -70398,13 +70398,13 @@ var require_backend = __commonJS({
70398
70398
  preview_long: formatDataForPreview(data, true),
70399
70399
  name: "lazy()"
70400
70400
  };
70401
- _unserializableValue._payload = dehydrate(payload, cleaned, unserializable, path15.concat(["_payload"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70402
- unserializable.push(path15);
70401
+ _unserializableValue._payload = dehydrate(payload, cleaned, unserializable, path16.concat(["_payload"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70402
+ unserializable.push(path16);
70403
70403
  return _unserializableValue;
70404
70404
  }
70405
70405
  case "array_buffer":
70406
70406
  case "data_view":
70407
- cleaned.push(path15);
70407
+ cleaned.push(path16);
70408
70408
  return {
70409
70409
  inspectable: false,
70410
70410
  preview_short: formatDataForPreview(data, false),
@@ -70414,21 +70414,21 @@ var require_backend = __commonJS({
70414
70414
  type
70415
70415
  };
70416
70416
  case "array":
70417
- isPathAllowedCheck = isPathAllowed(path15);
70417
+ isPathAllowedCheck = isPathAllowed(path16);
70418
70418
  if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
70419
- return createDehydrated(type, true, data, cleaned, path15);
70419
+ return createDehydrated(type, true, data, cleaned, path16);
70420
70420
  }
70421
70421
  var arr = [];
70422
70422
  for (var i = 0; i < data.length; i++) {
70423
- arr[i] = dehydrateKey(data, i, cleaned, unserializable, path15.concat([i]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70423
+ arr[i] = dehydrateKey(data, i, cleaned, unserializable, path16.concat([i]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70424
70424
  }
70425
70425
  return arr;
70426
70426
  case "html_all_collection":
70427
70427
  case "typed_array":
70428
70428
  case "iterator":
70429
- isPathAllowedCheck = isPathAllowed(path15);
70429
+ isPathAllowedCheck = isPathAllowed(path16);
70430
70430
  if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
70431
- return createDehydrated(type, true, data, cleaned, path15);
70431
+ return createDehydrated(type, true, data, cleaned, path16);
70432
70432
  } else {
70433
70433
  var _unserializableValue2 = {
70434
70434
  unserializable: true,
@@ -70440,13 +70440,13 @@ var require_backend = __commonJS({
70440
70440
  name: typeof data.constructor !== "function" || typeof data.constructor.name !== "string" || data.constructor.name === "Object" ? "" : data.constructor.name
70441
70441
  };
70442
70442
  Array.from(data).forEach(function(item, i2) {
70443
- return _unserializableValue2[i2] = dehydrate(item, cleaned, unserializable, path15.concat([i2]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70443
+ return _unserializableValue2[i2] = dehydrate(item, cleaned, unserializable, path16.concat([i2]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70444
70444
  });
70445
- unserializable.push(path15);
70445
+ unserializable.push(path16);
70446
70446
  return _unserializableValue2;
70447
70447
  }
70448
70448
  case "opaque_iterator":
70449
- cleaned.push(path15);
70449
+ cleaned.push(path16);
70450
70450
  return {
70451
70451
  inspectable: false,
70452
70452
  preview_short: formatDataForPreview(data, false),
@@ -70455,7 +70455,7 @@ var require_backend = __commonJS({
70455
70455
  type
70456
70456
  };
70457
70457
  case "date":
70458
- cleaned.push(path15);
70458
+ cleaned.push(path16);
70459
70459
  return {
70460
70460
  inspectable: false,
70461
70461
  preview_short: formatDataForPreview(data, false),
@@ -70464,7 +70464,7 @@ var require_backend = __commonJS({
70464
70464
  type
70465
70465
  };
70466
70466
  case "regexp":
70467
- cleaned.push(path15);
70467
+ cleaned.push(path16);
70468
70468
  return {
70469
70469
  inspectable: false,
70470
70470
  preview_short: formatDataForPreview(data, false),
@@ -70473,9 +70473,9 @@ var require_backend = __commonJS({
70473
70473
  type
70474
70474
  };
70475
70475
  case "thenable":
70476
- isPathAllowedCheck = isPathAllowed(path15);
70476
+ isPathAllowedCheck = isPathAllowed(path16);
70477
70477
  if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
70478
- cleaned.push(path15);
70478
+ cleaned.push(path16);
70479
70479
  return {
70480
70480
  inspectable: data.status === "fulfilled" || data.status === "rejected",
70481
70481
  preview_short: formatDataForPreview(data, false),
@@ -70496,8 +70496,8 @@ var require_backend = __commonJS({
70496
70496
  preview_long: formatDataForPreview(data, true),
70497
70497
  name: "fulfilled Thenable"
70498
70498
  };
70499
- _unserializableValue3.value = dehydrate(data.value, cleaned, unserializable, path15.concat(["value"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70500
- unserializable.push(path15);
70499
+ _unserializableValue3.value = dehydrate(data.value, cleaned, unserializable, path16.concat(["value"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70500
+ unserializable.push(path16);
70501
70501
  return _unserializableValue3;
70502
70502
  }
70503
70503
  case "rejected": {
@@ -70508,12 +70508,12 @@ var require_backend = __commonJS({
70508
70508
  preview_long: formatDataForPreview(data, true),
70509
70509
  name: "rejected Thenable"
70510
70510
  };
70511
- _unserializableValue4.reason = dehydrate(data.reason, cleaned, unserializable, path15.concat(["reason"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70512
- unserializable.push(path15);
70511
+ _unserializableValue4.reason = dehydrate(data.reason, cleaned, unserializable, path16.concat(["reason"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70512
+ unserializable.push(path16);
70513
70513
  return _unserializableValue4;
70514
70514
  }
70515
70515
  default:
70516
- cleaned.push(path15);
70516
+ cleaned.push(path16);
70517
70517
  return {
70518
70518
  inspectable: false,
70519
70519
  preview_short: formatDataForPreview(data, false),
@@ -70523,21 +70523,21 @@ var require_backend = __commonJS({
70523
70523
  };
70524
70524
  }
70525
70525
  case "object":
70526
- isPathAllowedCheck = isPathAllowed(path15);
70526
+ isPathAllowedCheck = isPathAllowed(path16);
70527
70527
  if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
70528
- return createDehydrated(type, true, data, cleaned, path15);
70528
+ return createDehydrated(type, true, data, cleaned, path16);
70529
70529
  } else {
70530
70530
  var object2 = {};
70531
70531
  getAllEnumerableKeys(data).forEach(function(key) {
70532
70532
  var name = key.toString();
70533
- object2[name] = dehydrateKey(data, key, cleaned, unserializable, path15.concat([name]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70533
+ object2[name] = dehydrateKey(data, key, cleaned, unserializable, path16.concat([name]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70534
70534
  });
70535
70535
  return object2;
70536
70536
  }
70537
70537
  case "class_instance": {
70538
- isPathAllowedCheck = isPathAllowed(path15);
70538
+ isPathAllowedCheck = isPathAllowed(path16);
70539
70539
  if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
70540
- return createDehydrated(type, true, data, cleaned, path15);
70540
+ return createDehydrated(type, true, data, cleaned, path16);
70541
70541
  }
70542
70542
  var value = {
70543
70543
  unserializable: true,
@@ -70549,15 +70549,15 @@ var require_backend = __commonJS({
70549
70549
  };
70550
70550
  getAllEnumerableKeys(data).forEach(function(key) {
70551
70551
  var keyAsString = key.toString();
70552
- value[keyAsString] = dehydrate(data[key], cleaned, unserializable, path15.concat([keyAsString]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70552
+ value[keyAsString] = dehydrate(data[key], cleaned, unserializable, path16.concat([keyAsString]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70553
70553
  });
70554
- unserializable.push(path15);
70554
+ unserializable.push(path16);
70555
70555
  return value;
70556
70556
  }
70557
70557
  case "error": {
70558
- isPathAllowedCheck = isPathAllowed(path15);
70558
+ isPathAllowedCheck = isPathAllowed(path16);
70559
70559
  if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
70560
- return createDehydrated(type, true, data, cleaned, path15);
70560
+ return createDehydrated(type, true, data, cleaned, path16);
70561
70561
  }
70562
70562
  var _value = {
70563
70563
  unserializable: true,
@@ -70567,22 +70567,22 @@ var require_backend = __commonJS({
70567
70567
  preview_long: formatDataForPreview(data, true),
70568
70568
  name: data.name
70569
70569
  };
70570
- _value.message = dehydrate(data.message, cleaned, unserializable, path15.concat(["message"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70571
- _value.stack = dehydrate(data.stack, cleaned, unserializable, path15.concat(["stack"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70570
+ _value.message = dehydrate(data.message, cleaned, unserializable, path16.concat(["message"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70571
+ _value.stack = dehydrate(data.stack, cleaned, unserializable, path16.concat(["stack"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70572
70572
  if ("cause" in data) {
70573
- _value.cause = dehydrate(data.cause, cleaned, unserializable, path15.concat(["cause"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70573
+ _value.cause = dehydrate(data.cause, cleaned, unserializable, path16.concat(["cause"]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70574
70574
  }
70575
70575
  getAllEnumerableKeys(data).forEach(function(key) {
70576
70576
  var keyAsString = key.toString();
70577
- _value[keyAsString] = dehydrate(data[key], cleaned, unserializable, path15.concat([keyAsString]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70577
+ _value[keyAsString] = dehydrate(data[key], cleaned, unserializable, path16.concat([keyAsString]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1);
70578
70578
  });
70579
- unserializable.push(path15);
70579
+ unserializable.push(path16);
70580
70580
  return _value;
70581
70581
  }
70582
70582
  case "infinity":
70583
70583
  case "nan":
70584
70584
  case "undefined":
70585
- cleaned.push(path15);
70585
+ cleaned.push(path16);
70586
70586
  return {
70587
70587
  type
70588
70588
  };
@@ -70590,10 +70590,10 @@ var require_backend = __commonJS({
70590
70590
  return data;
70591
70591
  }
70592
70592
  }
70593
- function dehydrateKey(parent, key, cleaned, unserializable, path15, isPathAllowed) {
70593
+ function dehydrateKey(parent, key, cleaned, unserializable, path16, isPathAllowed) {
70594
70594
  var level = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : 0;
70595
70595
  try {
70596
- return dehydrate(parent[key], cleaned, unserializable, path15, isPathAllowed, level);
70596
+ return dehydrate(parent[key], cleaned, unserializable, path16, isPathAllowed, level);
70597
70597
  } catch (error48) {
70598
70598
  var preview = "";
70599
70599
  if (hydration_typeof(error48) === "object" && error48 !== null && typeof error48.stack === "string") {
@@ -70601,7 +70601,7 @@ var require_backend = __commonJS({
70601
70601
  } else if (typeof error48 === "string") {
70602
70602
  preview = error48;
70603
70603
  }
70604
- cleaned.push(path15);
70604
+ cleaned.push(path16);
70605
70605
  return {
70606
70606
  inspectable: false,
70607
70607
  preview_short: "[Exception]",
@@ -70611,8 +70611,8 @@ var require_backend = __commonJS({
70611
70611
  };
70612
70612
  }
70613
70613
  }
70614
- function fillInPath(object2, data, path15, value) {
70615
- var target = getInObject(object2, path15);
70614
+ function fillInPath(object2, data, path16, value) {
70615
+ var target = getInObject(object2, path16);
70616
70616
  if (target != null) {
70617
70617
  if (!target[meta3.unserializable]) {
70618
70618
  delete target[meta3.inspectable];
@@ -70627,9 +70627,9 @@ var require_backend = __commonJS({
70627
70627
  }
70628
70628
  if (value !== null && data.unserializable.length > 0) {
70629
70629
  var unserializablePath = data.unserializable[0];
70630
- var isMatch = unserializablePath.length === path15.length;
70631
- for (var i = 0; i < path15.length; i++) {
70632
- if (path15[i] !== unserializablePath[i]) {
70630
+ var isMatch = unserializablePath.length === path16.length;
70631
+ for (var i = 0; i < path16.length; i++) {
70632
+ if (path16[i] !== unserializablePath[i]) {
70633
70633
  isMatch = false;
70634
70634
  break;
70635
70635
  }
@@ -70638,13 +70638,13 @@ var require_backend = __commonJS({
70638
70638
  upgradeUnserializable(value, value);
70639
70639
  }
70640
70640
  }
70641
- setInObject(object2, path15, value);
70641
+ setInObject(object2, path16, value);
70642
70642
  }
70643
70643
  function hydrate(object2, cleaned, unserializable) {
70644
- cleaned.forEach(function(path15) {
70645
- var length = path15.length;
70646
- var last = path15[length - 1];
70647
- var parent = getInObject(object2, path15.slice(0, length - 1));
70644
+ cleaned.forEach(function(path16) {
70645
+ var length = path16.length;
70646
+ var last = path16[length - 1];
70647
+ var parent = getInObject(object2, path16.slice(0, length - 1));
70648
70648
  if (!parent || !parent.hasOwnProperty(last)) {
70649
70649
  return;
70650
70650
  }
@@ -70670,10 +70670,10 @@ var require_backend = __commonJS({
70670
70670
  parent[last] = replaced;
70671
70671
  }
70672
70672
  });
70673
- unserializable.forEach(function(path15) {
70674
- var length = path15.length;
70675
- var last = path15[length - 1];
70676
- var parent = getInObject(object2, path15.slice(0, length - 1));
70673
+ unserializable.forEach(function(path16) {
70674
+ var length = path16.length;
70675
+ var last = path16[length - 1];
70676
+ var parent = getInObject(object2, path16.slice(0, length - 1));
70677
70677
  if (!parent || !parent.hasOwnProperty(last)) {
70678
70678
  return;
70679
70679
  }
@@ -70796,11 +70796,11 @@ var require_backend = __commonJS({
70796
70796
  return gte(version2, FIRST_DEVTOOLS_BACKEND_LOCKSTEP_VER);
70797
70797
  }
70798
70798
  function cleanForBridge(data, isPathAllowed) {
70799
- var path15 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
70799
+ var path16 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
70800
70800
  if (data !== null) {
70801
70801
  var cleanedPaths = [];
70802
70802
  var unserializablePaths = [];
70803
- var cleanedData = dehydrate(data, cleanedPaths, unserializablePaths, path15, isPathAllowed);
70803
+ var cleanedData = dehydrate(data, cleanedPaths, unserializablePaths, path16, isPathAllowed);
70804
70804
  return {
70805
70805
  data: cleanedData,
70806
70806
  cleaned: cleanedPaths,
@@ -70810,18 +70810,18 @@ var require_backend = __commonJS({
70810
70810
  return null;
70811
70811
  }
70812
70812
  }
70813
- function copyWithDelete(obj, path15) {
70813
+ function copyWithDelete(obj, path16) {
70814
70814
  var index = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
70815
- var key = path15[index];
70815
+ var key = path16[index];
70816
70816
  var updated = shared_isArray(obj) ? obj.slice() : utils_objectSpread({}, obj);
70817
- if (index + 1 === path15.length) {
70817
+ if (index + 1 === path16.length) {
70818
70818
  if (shared_isArray(updated)) {
70819
70819
  updated.splice(key, 1);
70820
70820
  } else {
70821
70821
  delete updated[key];
70822
70822
  }
70823
70823
  } else {
70824
- updated[key] = copyWithDelete(obj[key], path15, index + 1);
70824
+ updated[key] = copyWithDelete(obj[key], path16, index + 1);
70825
70825
  }
70826
70826
  return updated;
70827
70827
  }
@@ -70842,14 +70842,14 @@ var require_backend = __commonJS({
70842
70842
  }
70843
70843
  return updated;
70844
70844
  }
70845
- function copyWithSet(obj, path15, value) {
70845
+ function copyWithSet(obj, path16, value) {
70846
70846
  var index = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
70847
- if (index >= path15.length) {
70847
+ if (index >= path16.length) {
70848
70848
  return value;
70849
70849
  }
70850
- var key = path15[index];
70850
+ var key = path16[index];
70851
70851
  var updated = shared_isArray(obj) ? obj.slice() : utils_objectSpread({}, obj);
70852
- updated[key] = copyWithSet(obj[key], path15, value, index + 1);
70852
+ updated[key] = copyWithSet(obj[key], path16, value, index + 1);
70853
70853
  return updated;
70854
70854
  }
70855
70855
  function getEffectDurations(root) {
@@ -72172,12 +72172,12 @@ var require_backend = __commonJS({
72172
72172
  }
72173
72173
  });
72174
72174
  bridge_defineProperty(_this, "overrideValueAtPath", function(_ref) {
72175
- var id = _ref.id, path15 = _ref.path, rendererID = _ref.rendererID, type = _ref.type, value = _ref.value;
72175
+ var id = _ref.id, path16 = _ref.path, rendererID = _ref.rendererID, type = _ref.type, value = _ref.value;
72176
72176
  switch (type) {
72177
72177
  case "context":
72178
72178
  _this.send("overrideContext", {
72179
72179
  id,
72180
- path: path15,
72180
+ path: path16,
72181
72181
  rendererID,
72182
72182
  wasForwarded: true,
72183
72183
  value
@@ -72186,7 +72186,7 @@ var require_backend = __commonJS({
72186
72186
  case "hooks":
72187
72187
  _this.send("overrideHookState", {
72188
72188
  id,
72189
- path: path15,
72189
+ path: path16,
72190
72190
  rendererID,
72191
72191
  wasForwarded: true,
72192
72192
  value
@@ -72195,7 +72195,7 @@ var require_backend = __commonJS({
72195
72195
  case "props":
72196
72196
  _this.send("overrideProps", {
72197
72197
  id,
72198
- path: path15,
72198
+ path: path16,
72199
72199
  rendererID,
72200
72200
  wasForwarded: true,
72201
72201
  value
@@ -72204,7 +72204,7 @@ var require_backend = __commonJS({
72204
72204
  case "state":
72205
72205
  _this.send("overrideState", {
72206
72206
  id,
72207
- path: path15,
72207
+ path: path16,
72208
72208
  rendererID,
72209
72209
  wasForwarded: true,
72210
72210
  value
@@ -72548,12 +72548,12 @@ var require_backend = __commonJS({
72548
72548
  }
72549
72549
  });
72550
72550
  agent_defineProperty(_this, "copyElementPath", function(_ref5) {
72551
- var id = _ref5.id, path15 = _ref5.path, rendererID = _ref5.rendererID;
72551
+ var id = _ref5.id, path16 = _ref5.path, rendererID = _ref5.rendererID;
72552
72552
  var renderer2 = _this._rendererInterfaces[rendererID];
72553
72553
  if (renderer2 == null) {
72554
72554
  console.warn('Invalid renderer id "'.concat(rendererID, '" for element "').concat(id, '"'));
72555
72555
  } else {
72556
- var value = renderer2.getSerializedElementValueByPath(id, path15);
72556
+ var value = renderer2.getSerializedElementValueByPath(id, path16);
72557
72557
  if (value != null) {
72558
72558
  _this._bridge.send("saveToClipboard", value);
72559
72559
  } else {
@@ -72562,12 +72562,12 @@ var require_backend = __commonJS({
72562
72562
  }
72563
72563
  });
72564
72564
  agent_defineProperty(_this, "deletePath", function(_ref6) {
72565
- var hookID = _ref6.hookID, id = _ref6.id, path15 = _ref6.path, rendererID = _ref6.rendererID, type = _ref6.type;
72565
+ var hookID = _ref6.hookID, id = _ref6.id, path16 = _ref6.path, rendererID = _ref6.rendererID, type = _ref6.type;
72566
72566
  var renderer2 = _this._rendererInterfaces[rendererID];
72567
72567
  if (renderer2 == null) {
72568
72568
  console.warn('Invalid renderer id "'.concat(rendererID, '" for element "').concat(id, '"'));
72569
72569
  } else {
72570
- renderer2.deletePath(type, id, hookID, path15);
72570
+ renderer2.deletePath(type, id, hookID, path16);
72571
72571
  }
72572
72572
  });
72573
72573
  agent_defineProperty(_this, "getBackendVersion", function() {
@@ -72604,12 +72604,12 @@ var require_backend = __commonJS({
72604
72604
  }
72605
72605
  });
72606
72606
  agent_defineProperty(_this, "inspectElement", function(_ref9) {
72607
- var forceFullData = _ref9.forceFullData, id = _ref9.id, path15 = _ref9.path, rendererID = _ref9.rendererID, requestID = _ref9.requestID;
72607
+ var forceFullData = _ref9.forceFullData, id = _ref9.id, path16 = _ref9.path, rendererID = _ref9.rendererID, requestID = _ref9.requestID;
72608
72608
  var renderer2 = _this._rendererInterfaces[rendererID];
72609
72609
  if (renderer2 == null) {
72610
72610
  console.warn('Invalid renderer id "'.concat(rendererID, '" for element "').concat(id, '"'));
72611
72611
  } else {
72612
- _this._bridge.send("inspectedElement", renderer2.inspectElement(requestID, id, path15, forceFullData));
72612
+ _this._bridge.send("inspectedElement", renderer2.inspectElement(requestID, id, path16, forceFullData));
72613
72613
  if (_this._persistedSelectionMatch === null || _this._persistedSelectionMatch.id !== id) {
72614
72614
  _this._persistedSelection = null;
72615
72615
  _this._persistedSelectionMatch = null;
@@ -72643,15 +72643,15 @@ var require_backend = __commonJS({
72643
72643
  }
72644
72644
  for (var rendererID in _this._rendererInterfaces) {
72645
72645
  var renderer2 = _this._rendererInterfaces[rendererID];
72646
- var path15 = null;
72646
+ var path16 = null;
72647
72647
  if (suspendedByPathIndex !== null && rendererPath !== null) {
72648
72648
  var suspendedByPathRendererIndex = suspendedByPathIndex - suspendedByOffset;
72649
72649
  var rendererHasRequestedSuspendedByPath = renderer2.getElementAttributeByPath(id, ["suspendedBy", suspendedByPathRendererIndex]) !== void 0;
72650
72650
  if (rendererHasRequestedSuspendedByPath) {
72651
- path15 = ["suspendedBy", suspendedByPathRendererIndex].concat(rendererPath);
72651
+ path16 = ["suspendedBy", suspendedByPathRendererIndex].concat(rendererPath);
72652
72652
  }
72653
72653
  }
72654
- var inspectedRootsPayload = renderer2.inspectElement(requestID, id, path15, forceFullData);
72654
+ var inspectedRootsPayload = renderer2.inspectElement(requestID, id, path16, forceFullData);
72655
72655
  switch (inspectedRootsPayload.type) {
72656
72656
  case "hydrated-path":
72657
72657
  inspectedRootsPayload.path[1] += suspendedByOffset;
@@ -72745,20 +72745,20 @@ var require_backend = __commonJS({
72745
72745
  }
72746
72746
  });
72747
72747
  agent_defineProperty(_this, "overrideValueAtPath", function(_ref15) {
72748
- var hookID = _ref15.hookID, id = _ref15.id, path15 = _ref15.path, rendererID = _ref15.rendererID, type = _ref15.type, value = _ref15.value;
72748
+ var hookID = _ref15.hookID, id = _ref15.id, path16 = _ref15.path, rendererID = _ref15.rendererID, type = _ref15.type, value = _ref15.value;
72749
72749
  var renderer2 = _this._rendererInterfaces[rendererID];
72750
72750
  if (renderer2 == null) {
72751
72751
  console.warn('Invalid renderer id "'.concat(rendererID, '" for element "').concat(id, '"'));
72752
72752
  } else {
72753
- renderer2.overrideValueAtPath(type, id, hookID, path15, value);
72753
+ renderer2.overrideValueAtPath(type, id, hookID, path16, value);
72754
72754
  }
72755
72755
  });
72756
72756
  agent_defineProperty(_this, "overrideContext", function(_ref16) {
72757
- var id = _ref16.id, path15 = _ref16.path, rendererID = _ref16.rendererID, wasForwarded = _ref16.wasForwarded, value = _ref16.value;
72757
+ var id = _ref16.id, path16 = _ref16.path, rendererID = _ref16.rendererID, wasForwarded = _ref16.wasForwarded, value = _ref16.value;
72758
72758
  if (!wasForwarded) {
72759
72759
  _this.overrideValueAtPath({
72760
72760
  id,
72761
- path: path15,
72761
+ path: path16,
72762
72762
  rendererID,
72763
72763
  type: "context",
72764
72764
  value
@@ -72766,11 +72766,11 @@ var require_backend = __commonJS({
72766
72766
  }
72767
72767
  });
72768
72768
  agent_defineProperty(_this, "overrideHookState", function(_ref17) {
72769
- var id = _ref17.id, hookID = _ref17.hookID, path15 = _ref17.path, rendererID = _ref17.rendererID, wasForwarded = _ref17.wasForwarded, value = _ref17.value;
72769
+ var id = _ref17.id, hookID = _ref17.hookID, path16 = _ref17.path, rendererID = _ref17.rendererID, wasForwarded = _ref17.wasForwarded, value = _ref17.value;
72770
72770
  if (!wasForwarded) {
72771
72771
  _this.overrideValueAtPath({
72772
72772
  id,
72773
- path: path15,
72773
+ path: path16,
72774
72774
  rendererID,
72775
72775
  type: "hooks",
72776
72776
  value
@@ -72778,11 +72778,11 @@ var require_backend = __commonJS({
72778
72778
  }
72779
72779
  });
72780
72780
  agent_defineProperty(_this, "overrideProps", function(_ref18) {
72781
- var id = _ref18.id, path15 = _ref18.path, rendererID = _ref18.rendererID, wasForwarded = _ref18.wasForwarded, value = _ref18.value;
72781
+ var id = _ref18.id, path16 = _ref18.path, rendererID = _ref18.rendererID, wasForwarded = _ref18.wasForwarded, value = _ref18.value;
72782
72782
  if (!wasForwarded) {
72783
72783
  _this.overrideValueAtPath({
72784
72784
  id,
72785
- path: path15,
72785
+ path: path16,
72786
72786
  rendererID,
72787
72787
  type: "props",
72788
72788
  value
@@ -72790,11 +72790,11 @@ var require_backend = __commonJS({
72790
72790
  }
72791
72791
  });
72792
72792
  agent_defineProperty(_this, "overrideState", function(_ref19) {
72793
- var id = _ref19.id, path15 = _ref19.path, rendererID = _ref19.rendererID, wasForwarded = _ref19.wasForwarded, value = _ref19.value;
72793
+ var id = _ref19.id, path16 = _ref19.path, rendererID = _ref19.rendererID, wasForwarded = _ref19.wasForwarded, value = _ref19.value;
72794
72794
  if (!wasForwarded) {
72795
72795
  _this.overrideValueAtPath({
72796
72796
  id,
72797
- path: path15,
72797
+ path: path16,
72798
72798
  rendererID,
72799
72799
  type: "state",
72800
72800
  value
@@ -72861,12 +72861,12 @@ var require_backend = __commonJS({
72861
72861
  _this._bridge.send("stopInspectingHost", selected);
72862
72862
  });
72863
72863
  agent_defineProperty(_this, "storeAsGlobal", function(_ref23) {
72864
- var count = _ref23.count, id = _ref23.id, path15 = _ref23.path, rendererID = _ref23.rendererID;
72864
+ var count = _ref23.count, id = _ref23.id, path16 = _ref23.path, rendererID = _ref23.rendererID;
72865
72865
  var renderer2 = _this._rendererInterfaces[rendererID];
72866
72866
  if (renderer2 == null) {
72867
72867
  console.warn('Invalid renderer id "'.concat(rendererID, '" for element "').concat(id, '"'));
72868
72868
  } else {
72869
- renderer2.storeAsGlobal(id, path15, count);
72869
+ renderer2.storeAsGlobal(id, path16, count);
72870
72870
  }
72871
72871
  });
72872
72872
  agent_defineProperty(_this, "updateHookSettings", function(settings) {
@@ -72883,12 +72883,12 @@ var require_backend = __commonJS({
72883
72883
  var rendererID = +rendererIDString;
72884
72884
  var renderer2 = _this._rendererInterfaces[rendererID];
72885
72885
  if (_this._lastSelectedRendererID === rendererID) {
72886
- var path15 = renderer2.getPathForElement(_this._lastSelectedElementID);
72887
- if (path15 !== null) {
72888
- renderer2.setTrackedPath(path15);
72886
+ var path16 = renderer2.getPathForElement(_this._lastSelectedElementID);
72887
+ if (path16 !== null) {
72888
+ renderer2.setTrackedPath(path16);
72889
72889
  _this._persistedSelection = {
72890
72890
  rendererID,
72891
- path: path15
72891
+ path: path16
72892
72892
  };
72893
72893
  }
72894
72894
  }
@@ -72963,11 +72963,11 @@ var require_backend = __commonJS({
72963
72963
  var rendererID = _this._lastSelectedRendererID;
72964
72964
  var id = _this._lastSelectedElementID;
72965
72965
  var renderer2 = _this._rendererInterfaces[rendererID];
72966
- var path15 = renderer2 != null ? renderer2.getPathForElement(id) : null;
72967
- if (path15 !== null) {
72966
+ var path16 = renderer2 != null ? renderer2.getPathForElement(id) : null;
72967
+ if (path16 !== null) {
72968
72968
  storage_sessionStorageSetItem(SESSION_STORAGE_LAST_SELECTION_KEY, JSON.stringify({
72969
72969
  rendererID,
72970
- path: path15
72970
+ path: path16
72971
72971
  }));
72972
72972
  } else {
72973
72973
  storage_sessionStorageRemoveItem(SESSION_STORAGE_LAST_SELECTION_KEY);
@@ -73700,7 +73700,7 @@ var require_backend = __commonJS({
73700
73700
  hasElementWithId: function hasElementWithId() {
73701
73701
  return false;
73702
73702
  },
73703
- inspectElement: function inspectElement(requestID, id, path15) {
73703
+ inspectElement: function inspectElement(requestID, id, path16) {
73704
73704
  return {
73705
73705
  id,
73706
73706
  responseID: requestID,
@@ -78997,9 +78997,9 @@ var require_backend = __commonJS({
78997
78997
  }
78998
78998
  return null;
78999
78999
  }
79000
- function getElementAttributeByPath(id, path15) {
79000
+ function getElementAttributeByPath(id, path16) {
79001
79001
  if (isMostRecentlyInspectedElement(id)) {
79002
- return utils_getInObject(mostRecentlyInspectedElement, path15);
79002
+ return utils_getInObject(mostRecentlyInspectedElement, path16);
79003
79003
  }
79004
79004
  return void 0;
79005
79005
  }
@@ -79706,9 +79706,9 @@ var require_backend = __commonJS({
79706
79706
  function isMostRecentlyInspectedElementCurrent(id) {
79707
79707
  return isMostRecentlyInspectedElement(id) && !hasElementUpdatedSinceLastInspected;
79708
79708
  }
79709
- function mergeInspectedPaths(path15) {
79709
+ function mergeInspectedPaths(path16) {
79710
79710
  var current = currentlyInspectedPaths;
79711
- path15.forEach(function(key) {
79711
+ path16.forEach(function(key) {
79712
79712
  if (!current[key]) {
79713
79713
  current[key] = {};
79714
79714
  }
@@ -79716,21 +79716,21 @@ var require_backend = __commonJS({
79716
79716
  });
79717
79717
  }
79718
79718
  function createIsPathAllowed(key, secondaryCategory) {
79719
- return function isPathAllowed(path15) {
79719
+ return function isPathAllowed(path16) {
79720
79720
  switch (secondaryCategory) {
79721
79721
  case "hooks":
79722
- if (path15.length === 1) {
79722
+ if (path16.length === 1) {
79723
79723
  return true;
79724
79724
  }
79725
- if (path15[path15.length - 2] === "hookSource" && path15[path15.length - 1] === "fileName") {
79725
+ if (path16[path16.length - 2] === "hookSource" && path16[path16.length - 1] === "fileName") {
79726
79726
  return true;
79727
79727
  }
79728
- if (path15[path15.length - 1] === "subHooks" || path15[path15.length - 2] === "subHooks") {
79728
+ if (path16[path16.length - 1] === "subHooks" || path16[path16.length - 2] === "subHooks") {
79729
79729
  return true;
79730
79730
  }
79731
79731
  break;
79732
79732
  case "suspendedBy":
79733
- if (path15.length < 5) {
79733
+ if (path16.length < 5) {
79734
79734
  return true;
79735
79735
  }
79736
79736
  break;
@@ -79741,8 +79741,8 @@ var require_backend = __commonJS({
79741
79741
  if (!current) {
79742
79742
  return false;
79743
79743
  }
79744
- for (var i = 0; i < path15.length; i++) {
79745
- current = current[path15[i]];
79744
+ for (var i = 0; i < path16.length; i++) {
79745
+ current = current[path16[i]];
79746
79746
  if (!current) {
79747
79747
  return false;
79748
79748
  }
@@ -79796,38 +79796,38 @@ var require_backend = __commonJS({
79796
79796
  break;
79797
79797
  }
79798
79798
  }
79799
- function storeAsGlobal(id, path15, count) {
79799
+ function storeAsGlobal(id, path16, count) {
79800
79800
  if (isMostRecentlyInspectedElement(id)) {
79801
- var value = utils_getInObject(mostRecentlyInspectedElement, path15);
79801
+ var value = utils_getInObject(mostRecentlyInspectedElement, path16);
79802
79802
  var key = "$reactTemp".concat(count);
79803
79803
  window[key] = value;
79804
79804
  console.log(key);
79805
79805
  console.log(value);
79806
79806
  }
79807
79807
  }
79808
- function getSerializedElementValueByPath(id, path15) {
79808
+ function getSerializedElementValueByPath(id, path16) {
79809
79809
  if (isMostRecentlyInspectedElement(id)) {
79810
- var valueToCopy = utils_getInObject(mostRecentlyInspectedElement, path15);
79810
+ var valueToCopy = utils_getInObject(mostRecentlyInspectedElement, path16);
79811
79811
  return serializeToString(valueToCopy);
79812
79812
  }
79813
79813
  }
79814
- function inspectElement(requestID, id, path15, forceFullData) {
79815
- if (path15 !== null) {
79816
- mergeInspectedPaths(path15);
79814
+ function inspectElement(requestID, id, path16, forceFullData) {
79815
+ if (path16 !== null) {
79816
+ mergeInspectedPaths(path16);
79817
79817
  }
79818
79818
  if (isMostRecentlyInspectedElement(id) && !forceFullData) {
79819
79819
  if (!hasElementUpdatedSinceLastInspected) {
79820
- if (path15 !== null) {
79820
+ if (path16 !== null) {
79821
79821
  var secondaryCategory = null;
79822
- if (path15[0] === "hooks" || path15[0] === "suspendedBy") {
79823
- secondaryCategory = path15[0];
79822
+ if (path16[0] === "hooks" || path16[0] === "suspendedBy") {
79823
+ secondaryCategory = path16[0];
79824
79824
  }
79825
79825
  return {
79826
79826
  id,
79827
79827
  responseID: requestID,
79828
79828
  type: "hydrated-path",
79829
- path: path15,
79830
- value: cleanForBridge(utils_getInObject(mostRecentlyInspectedElement, path15), createIsPathAllowed(null, secondaryCategory), path15)
79829
+ path: path16,
79830
+ value: cleanForBridge(utils_getInObject(mostRecentlyInspectedElement, path16), createIsPathAllowed(null, secondaryCategory), path16)
79831
79831
  };
79832
79832
  } else {
79833
79833
  return {
@@ -80016,7 +80016,7 @@ var require_backend = __commonJS({
80016
80016
  console.groupEnd();
80017
80017
  }
80018
80018
  }
80019
- function deletePath(type, id, hookID, path15) {
80019
+ function deletePath(type, id, hookID, path16) {
80020
80020
  var devtoolsInstance = idToDevToolsInstanceMap.get(id);
80021
80021
  if (devtoolsInstance === void 0) {
80022
80022
  console.warn('Could not find DevToolsInstance with id "'.concat(id, '"'));
@@ -80030,12 +80030,12 @@ var require_backend = __commonJS({
80030
80030
  var instance2 = fiber.stateNode;
80031
80031
  switch (type) {
80032
80032
  case "context":
80033
- path15 = path15.slice(1);
80033
+ path16 = path16.slice(1);
80034
80034
  switch (fiber.tag) {
80035
80035
  case ClassComponent:
80036
- if (path15.length === 0) {
80036
+ if (path16.length === 0) {
80037
80037
  } else {
80038
- deletePathInObject(instance2.context, path15);
80038
+ deletePathInObject(instance2.context, path16);
80039
80039
  }
80040
80040
  instance2.forceUpdate();
80041
80041
  break;
@@ -80045,21 +80045,21 @@ var require_backend = __commonJS({
80045
80045
  break;
80046
80046
  case "hooks":
80047
80047
  if (typeof overrideHookStateDeletePath === "function") {
80048
- overrideHookStateDeletePath(fiber, hookID, path15);
80048
+ overrideHookStateDeletePath(fiber, hookID, path16);
80049
80049
  }
80050
80050
  break;
80051
80051
  case "props":
80052
80052
  if (instance2 === null) {
80053
80053
  if (typeof overridePropsDeletePath === "function") {
80054
- overridePropsDeletePath(fiber, path15);
80054
+ overridePropsDeletePath(fiber, path16);
80055
80055
  }
80056
80056
  } else {
80057
- fiber.pendingProps = copyWithDelete(instance2.props, path15);
80057
+ fiber.pendingProps = copyWithDelete(instance2.props, path16);
80058
80058
  instance2.forceUpdate();
80059
80059
  }
80060
80060
  break;
80061
80061
  case "state":
80062
- deletePathInObject(instance2.state, path15);
80062
+ deletePathInObject(instance2.state, path16);
80063
80063
  instance2.forceUpdate();
80064
80064
  break;
80065
80065
  }
@@ -80115,7 +80115,7 @@ var require_backend = __commonJS({
80115
80115
  }
80116
80116
  }
80117
80117
  }
80118
- function overrideValueAtPath(type, id, hookID, path15, value) {
80118
+ function overrideValueAtPath(type, id, hookID, path16, value) {
80119
80119
  var devtoolsInstance = idToDevToolsInstanceMap.get(id);
80120
80120
  if (devtoolsInstance === void 0) {
80121
80121
  console.warn('Could not find DevToolsInstance with id "'.concat(id, '"'));
@@ -80129,13 +80129,13 @@ var require_backend = __commonJS({
80129
80129
  var instance2 = fiber.stateNode;
80130
80130
  switch (type) {
80131
80131
  case "context":
80132
- path15 = path15.slice(1);
80132
+ path16 = path16.slice(1);
80133
80133
  switch (fiber.tag) {
80134
80134
  case ClassComponent:
80135
- if (path15.length === 0) {
80135
+ if (path16.length === 0) {
80136
80136
  instance2.context = value;
80137
80137
  } else {
80138
- utils_setInObject(instance2.context, path15, value);
80138
+ utils_setInObject(instance2.context, path16, value);
80139
80139
  }
80140
80140
  instance2.forceUpdate();
80141
80141
  break;
@@ -80145,18 +80145,18 @@ var require_backend = __commonJS({
80145
80145
  break;
80146
80146
  case "hooks":
80147
80147
  if (typeof overrideHookState === "function") {
80148
- overrideHookState(fiber, hookID, path15, value);
80148
+ overrideHookState(fiber, hookID, path16, value);
80149
80149
  }
80150
80150
  break;
80151
80151
  case "props":
80152
80152
  switch (fiber.tag) {
80153
80153
  case ClassComponent:
80154
- fiber.pendingProps = copyWithSet(instance2.props, path15, value);
80154
+ fiber.pendingProps = copyWithSet(instance2.props, path16, value);
80155
80155
  instance2.forceUpdate();
80156
80156
  break;
80157
80157
  default:
80158
80158
  if (typeof overrideProps === "function") {
80159
- overrideProps(fiber, path15, value);
80159
+ overrideProps(fiber, path16, value);
80160
80160
  }
80161
80161
  break;
80162
80162
  }
@@ -80164,7 +80164,7 @@ var require_backend = __commonJS({
80164
80164
  case "state":
80165
80165
  switch (fiber.tag) {
80166
80166
  case ClassComponent:
80167
- utils_setInObject(instance2.state, path15, value);
80167
+ utils_setInObject(instance2.state, path16, value);
80168
80168
  instance2.forceUpdate();
80169
80169
  break;
80170
80170
  }
@@ -80450,14 +80450,14 @@ var require_backend = __commonJS({
80450
80450
  var trackedPathMatchInstance = null;
80451
80451
  var trackedPathMatchDepth = -1;
80452
80452
  var mightBeOnTrackedPath = false;
80453
- function setTrackedPath(path15) {
80454
- if (path15 === null) {
80453
+ function setTrackedPath(path16) {
80454
+ if (path16 === null) {
80455
80455
  trackedPathMatchFiber = null;
80456
80456
  trackedPathMatchInstance = null;
80457
80457
  trackedPathMatchDepth = -1;
80458
80458
  mightBeOnTrackedPath = false;
80459
80459
  }
80460
- trackedPath = path15;
80460
+ trackedPath = path16;
80461
80461
  }
80462
80462
  function updateTrackedPathStateBeforeMount(fiber, fiberInstance) {
80463
80463
  if (trackedPath === null || !mightBeOnTrackedPath) {
@@ -81227,9 +81227,9 @@ var require_backend = __commonJS({
81227
81227
  }
81228
81228
  var currentlyInspectedElementID = null;
81229
81229
  var currentlyInspectedPaths = {};
81230
- function mergeInspectedPaths(path15) {
81230
+ function mergeInspectedPaths(path16) {
81231
81231
  var current = currentlyInspectedPaths;
81232
- path15.forEach(function(key) {
81232
+ path16.forEach(function(key) {
81233
81233
  if (!current[key]) {
81234
81234
  current[key] = {};
81235
81235
  }
@@ -81237,13 +81237,13 @@ var require_backend = __commonJS({
81237
81237
  });
81238
81238
  }
81239
81239
  function createIsPathAllowed(key) {
81240
- return function isPathAllowed(path15) {
81240
+ return function isPathAllowed(path16) {
81241
81241
  var current = currentlyInspectedPaths[key];
81242
81242
  if (!current) {
81243
81243
  return false;
81244
81244
  }
81245
- for (var i = 0; i < path15.length; i++) {
81246
- current = current[path15[i]];
81245
+ for (var i = 0; i < path16.length; i++) {
81246
+ current = current[path16[i]];
81247
81247
  if (!current) {
81248
81248
  return false;
81249
81249
  }
@@ -81293,24 +81293,24 @@ var require_backend = __commonJS({
81293
81293
  break;
81294
81294
  }
81295
81295
  }
81296
- function storeAsGlobal(id, path15, count) {
81296
+ function storeAsGlobal(id, path16, count) {
81297
81297
  var inspectedElement = inspectElementRaw(id);
81298
81298
  if (inspectedElement !== null) {
81299
- var value = utils_getInObject(inspectedElement, path15);
81299
+ var value = utils_getInObject(inspectedElement, path16);
81300
81300
  var key = "$reactTemp".concat(count);
81301
81301
  window[key] = value;
81302
81302
  console.log(key);
81303
81303
  console.log(value);
81304
81304
  }
81305
81305
  }
81306
- function getSerializedElementValueByPath(id, path15) {
81306
+ function getSerializedElementValueByPath(id, path16) {
81307
81307
  var inspectedElement = inspectElementRaw(id);
81308
81308
  if (inspectedElement !== null) {
81309
- var valueToCopy = utils_getInObject(inspectedElement, path15);
81309
+ var valueToCopy = utils_getInObject(inspectedElement, path16);
81310
81310
  return serializeToString(valueToCopy);
81311
81311
  }
81312
81312
  }
81313
- function inspectElement(requestID, id, path15, forceFullData) {
81313
+ function inspectElement(requestID, id, path16, forceFullData) {
81314
81314
  if (forceFullData || currentlyInspectedElementID !== id) {
81315
81315
  currentlyInspectedElementID = id;
81316
81316
  currentlyInspectedPaths = {};
@@ -81323,8 +81323,8 @@ var require_backend = __commonJS({
81323
81323
  type: "not-found"
81324
81324
  };
81325
81325
  }
81326
- if (path15 !== null) {
81327
- mergeInspectedPaths(path15);
81326
+ if (path16 !== null) {
81327
+ mergeInspectedPaths(path16);
81328
81328
  }
81329
81329
  updateSelectedElement(id);
81330
81330
  inspectedElement.context = cleanForBridge(inspectedElement.context, createIsPathAllowed("context"));
@@ -81527,10 +81527,10 @@ var require_backend = __commonJS({
81527
81527
  console.groupEnd();
81528
81528
  }
81529
81529
  }
81530
- function getElementAttributeByPath(id, path15) {
81530
+ function getElementAttributeByPath(id, path16) {
81531
81531
  var inspectedElement = inspectElementRaw(id);
81532
81532
  if (inspectedElement !== null) {
81533
- return utils_getInObject(inspectedElement, path15);
81533
+ return utils_getInObject(inspectedElement, path16);
81534
81534
  }
81535
81535
  return void 0;
81536
81536
  }
@@ -81547,14 +81547,14 @@ var require_backend = __commonJS({
81547
81547
  }
81548
81548
  return element.type;
81549
81549
  }
81550
- function deletePath(type, id, hookID, path15) {
81550
+ function deletePath(type, id, hookID, path16) {
81551
81551
  var internalInstance = idToInternalInstanceMap.get(id);
81552
81552
  if (internalInstance != null) {
81553
81553
  var publicInstance = internalInstance._instance;
81554
81554
  if (publicInstance != null) {
81555
81555
  switch (type) {
81556
81556
  case "context":
81557
- deletePathInObject(publicInstance.context, path15);
81557
+ deletePathInObject(publicInstance.context, path16);
81558
81558
  forceUpdate(publicInstance);
81559
81559
  break;
81560
81560
  case "hooks":
@@ -81562,12 +81562,12 @@ var require_backend = __commonJS({
81562
81562
  case "props":
81563
81563
  var element = internalInstance._currentElement;
81564
81564
  internalInstance._currentElement = legacy_renderer_objectSpread(legacy_renderer_objectSpread({}, element), {}, {
81565
- props: copyWithDelete(element.props, path15)
81565
+ props: copyWithDelete(element.props, path16)
81566
81566
  });
81567
81567
  forceUpdate(publicInstance);
81568
81568
  break;
81569
81569
  case "state":
81570
- deletePathInObject(publicInstance.state, path15);
81570
+ deletePathInObject(publicInstance.state, path16);
81571
81571
  forceUpdate(publicInstance);
81572
81572
  break;
81573
81573
  }
@@ -81601,14 +81601,14 @@ var require_backend = __commonJS({
81601
81601
  }
81602
81602
  }
81603
81603
  }
81604
- function overrideValueAtPath(type, id, hookID, path15, value) {
81604
+ function overrideValueAtPath(type, id, hookID, path16, value) {
81605
81605
  var internalInstance = idToInternalInstanceMap.get(id);
81606
81606
  if (internalInstance != null) {
81607
81607
  var publicInstance = internalInstance._instance;
81608
81608
  if (publicInstance != null) {
81609
81609
  switch (type) {
81610
81610
  case "context":
81611
- utils_setInObject(publicInstance.context, path15, value);
81611
+ utils_setInObject(publicInstance.context, path16, value);
81612
81612
  forceUpdate(publicInstance);
81613
81613
  break;
81614
81614
  case "hooks":
@@ -81616,12 +81616,12 @@ var require_backend = __commonJS({
81616
81616
  case "props":
81617
81617
  var element = internalInstance._currentElement;
81618
81618
  internalInstance._currentElement = legacy_renderer_objectSpread(legacy_renderer_objectSpread({}, element), {}, {
81619
- props: copyWithSet(element.props, path15, value)
81619
+ props: copyWithSet(element.props, path16, value)
81620
81620
  });
81621
81621
  forceUpdate(publicInstance);
81622
81622
  break;
81623
81623
  case "state":
81624
- utils_setInObject(publicInstance.state, path15, value);
81624
+ utils_setInObject(publicInstance.state, path16, value);
81625
81625
  forceUpdate(publicInstance);
81626
81626
  break;
81627
81627
  }
@@ -81666,7 +81666,7 @@ var require_backend = __commonJS({
81666
81666
  }
81667
81667
  function setTraceUpdatesEnabled(enabled) {
81668
81668
  }
81669
- function setTrackedPath(path15) {
81669
+ function setTrackedPath(path16) {
81670
81670
  }
81671
81671
  function getOwnersList(id) {
81672
81672
  return null;
@@ -82953,8 +82953,8 @@ var init_devtools = __esm({
82953
82953
 
82954
82954
  // node_modules/.pnpm/ink@6.8.0_@types+react@19.2.14_react-devtools-core@7.0.1_react@19.2.4/node_modules/ink/build/reconciler.js
82955
82955
  async function loadPackageJson() {
82956
- const fs16 = await import("node:fs");
82957
- const content = fs16.readFileSync(new URL("../package.json", import.meta.url), "utf8");
82956
+ const fs17 = await import("node:fs");
82957
+ const content = fs17.readFileSync(new URL("../package.json", import.meta.url), "utf8");
82958
82958
  return JSON.parse(content);
82959
82959
  }
82960
82960
  var import_react_reconciler, import_constants8, Scheduler, import_react, diff, cleanupYogaNode, currentUpdatePriority, currentRootNode, packageJson, reconciler_default;
@@ -85931,8 +85931,8 @@ var init_ErrorOverview = __esm({
85931
85931
  init_dist8();
85932
85932
  init_Box();
85933
85933
  init_Text();
85934
- cleanupPath = (path15) => {
85935
- return path15?.replace(`file://${cwd()}/`, "");
85934
+ cleanupPath = (path16) => {
85935
+ return path16?.replace(`file://${cwd()}/`, "");
85936
85936
  };
85937
85937
  stackUtils = new import_stack_utils.default({
85938
85938
  cwd: cwd(),
@@ -89068,7 +89068,10 @@ function parseHostedProjectListResponse(response) {
89068
89068
  function parseHostedProjectResponse(response) {
89069
89069
  return hostedProjectResponseSchema.parse(response);
89070
89070
  }
89071
- var HOSTED_PROJECT_SLUG_PATTERN, hostedProjectSchema, hostedProjectListResponseSchema, createHostedProjectRequestSchema, hostedProjectResponseSchema;
89071
+ function parseHostedProjectApiKeyResponse(response) {
89072
+ return hostedProjectApiKeyResponseSchema.parse(response);
89073
+ }
89074
+ var HOSTED_PROJECT_SLUG_PATTERN, hostedProjectSchema, hostedProjectListResponseSchema, createHostedProjectRequestSchema, hostedProjectResponseSchema, hostedProjectApiKeySchema, hostedProjectApiKeyListItemSchema, hostedProjectApiKeyResponseSchema, hostedProjectApiKeyListResponseSchema, hostedProjectApiKeyDeleteResponseSchema, deleteHostedProjectApiKeyRequestSchema, createHostedApiKeyRequestSchema, hostedProjectThreadSchema, hostedProjectThreadListResponseSchema, hostedProjectThreadEventsResponseSchema, hostedProjectThreadDetailResponseSchema, updateHostedProjectThreadRequestSchema, hostedProjectThreadMutationResponseSchema, deleteHostedProjectThreadRequestSchema, hostedProjectThreadDeleteResponseSchema;
89072
89075
  var init_hosted_project = __esm({
89073
89076
  "libs/ops-contracts/src/hosted-project.ts"() {
89074
89077
  "use strict";
@@ -89091,6 +89094,74 @@ var init_hosted_project = __esm({
89091
89094
  hostedProjectResponseSchema = external_exports.object({
89092
89095
  project: hostedProjectSchema
89093
89096
  }).strict();
89097
+ hostedProjectApiKeySchema = external_exports.object({
89098
+ id: external_exports.string().min(1),
89099
+ name: external_exports.string().min(1),
89100
+ token: external_exports.string().min(1)
89101
+ }).strict();
89102
+ hostedProjectApiKeyListItemSchema = external_exports.object({
89103
+ id: external_exports.number().int().positive(),
89104
+ name: external_exports.string().min(1),
89105
+ short_token: external_exports.string().min(1),
89106
+ created_at: external_exports.string().datetime({ offset: true })
89107
+ }).strict();
89108
+ hostedProjectApiKeyResponseSchema = external_exports.object({
89109
+ apiKey: hostedProjectApiKeySchema
89110
+ }).strict();
89111
+ hostedProjectApiKeyListResponseSchema = external_exports.object({
89112
+ keys: external_exports.array(hostedProjectApiKeyListItemSchema),
89113
+ total: external_exports.number().int().nonnegative()
89114
+ }).strict();
89115
+ hostedProjectApiKeyDeleteResponseSchema = external_exports.object({
89116
+ deleted: external_exports.object({ id: external_exports.number().int().positive() }).strict()
89117
+ }).strict();
89118
+ deleteHostedProjectApiKeyRequestSchema = external_exports.object({
89119
+ reason: external_exports.string().trim().min(1).max(1e3)
89120
+ }).strict();
89121
+ createHostedApiKeyRequestSchema = external_exports.object({
89122
+ name: external_exports.string().trim().min(1).max(100)
89123
+ }).strict();
89124
+ hostedProjectThreadSchema = external_exports.object({
89125
+ agentId: external_exports.string(),
89126
+ archived: external_exports.boolean(),
89127
+ createdAt: external_exports.string().datetime({ offset: true }),
89128
+ createdById: external_exports.string().optional(),
89129
+ endUserId: external_exports.string().nullable(),
89130
+ id: external_exports.string().min(1),
89131
+ name: external_exports.string().nullable(),
89132
+ organizationId: external_exports.string().min(1).optional(),
89133
+ projectId: external_exports.number().int().positive(),
89134
+ updatedAt: external_exports.string().datetime({ offset: true })
89135
+ }).strict().transform(({ createdById, organizationId, ...thread }) => thread);
89136
+ hostedProjectThreadListResponseSchema = external_exports.object({
89137
+ nextCursor: external_exports.string().nullable(),
89138
+ threads: external_exports.array(hostedProjectThreadSchema)
89139
+ }).strict();
89140
+ hostedProjectThreadEventsResponseSchema = external_exports.object({
89141
+ decodeErrorRowIds: external_exports.array(external_exports.string()),
89142
+ events: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown())),
89143
+ truncated: external_exports.boolean()
89144
+ }).strict();
89145
+ hostedProjectThreadDetailResponseSchema = external_exports.object({
89146
+ events: hostedProjectThreadEventsResponseSchema,
89147
+ thread: hostedProjectThreadSchema
89148
+ }).strict();
89149
+ updateHostedProjectThreadRequestSchema = external_exports.object({
89150
+ archived: external_exports.boolean().optional(),
89151
+ name: external_exports.string().trim().min(1).max(255).optional()
89152
+ }).strict().refine(
89153
+ (value) => typeof value.archived !== "undefined" || typeof value.name !== "undefined",
89154
+ { message: "At least one thread update field is required." }
89155
+ );
89156
+ hostedProjectThreadMutationResponseSchema = external_exports.object({
89157
+ thread: hostedProjectThreadSchema
89158
+ }).strict();
89159
+ deleteHostedProjectThreadRequestSchema = external_exports.object({
89160
+ reason: external_exports.string().trim().min(1).max(1e3)
89161
+ }).strict();
89162
+ hostedProjectThreadDeleteResponseSchema = external_exports.object({
89163
+ deleted: external_exports.object({ id: external_exports.string().min(1) }).strict()
89164
+ }).strict();
89094
89165
  }
89095
89166
  });
89096
89167
 
@@ -89105,6 +89176,44 @@ async function readApiError(res) {
89105
89176
  const message = payload?.error?.message ?? `Request failed with status ${res.status}`;
89106
89177
  return new ApiClientError(res.status, message, payload?.error?.code);
89107
89178
  }
89179
+ function resolveRequestTimeoutMs() {
89180
+ const raw = process.env["COPILOTKIT_CLI_HTTP_TIMEOUT_MS"]?.trim();
89181
+ if (raw) {
89182
+ const parsed = Number(raw);
89183
+ if (Number.isFinite(parsed) && parsed > 0) {
89184
+ return parsed;
89185
+ }
89186
+ }
89187
+ return DEFAULT_REQUEST_TIMEOUT_MS;
89188
+ }
89189
+ function formatTimeout(ms) {
89190
+ return ms >= 1e3 ? `${Math.round(ms / 1e3)}s` : `${ms}ms`;
89191
+ }
89192
+ async function fetchWithTimeout(url2, init) {
89193
+ const timeoutMs = resolveRequestTimeoutMs();
89194
+ const controller = new AbortController();
89195
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
89196
+ timer.unref?.();
89197
+ try {
89198
+ return await fetch(url2, { ...init, signal: controller.signal });
89199
+ } catch (error48) {
89200
+ if (controller.signal.aborted) {
89201
+ throw new ApiClientError(
89202
+ 0,
89203
+ `Timed out after ${formatTimeout(timeoutMs)} connecting to CopilotKit at ${url2}. Check your network connection (VPN, proxy, or firewall) and try again.`,
89204
+ "CLI_REQUEST_TIMEOUT"
89205
+ );
89206
+ }
89207
+ const detail = error48 instanceof Error ? error48.message : String(error48);
89208
+ throw new ApiClientError(
89209
+ 0,
89210
+ `Could not reach CopilotKit at ${url2}: ${detail}. Check your network connection and try again.`,
89211
+ "CLI_REQUEST_FAILED"
89212
+ );
89213
+ } finally {
89214
+ clearTimeout(timer);
89215
+ }
89216
+ }
89108
89217
  function verifySessionResponseError(status, error48) {
89109
89218
  const organizationInvalid = error48.issues.some(
89110
89219
  (issue2) => issue2.path[0] === "organization"
@@ -89122,7 +89231,7 @@ function verifySessionResponseError(status, error48) {
89122
89231
  function createApiClient(baseUrl, token) {
89123
89232
  return {
89124
89233
  async exchangeClerkToken(clerkToken) {
89125
- const res = await fetch(`${baseUrl}/api/cli/auth/session`, {
89234
+ const res = await fetchWithTimeout(`${baseUrl}/api/cli/auth/session`, {
89126
89235
  method: "POST",
89127
89236
  headers: { "Content-Type": "application/json" },
89128
89237
  body: JSON.stringify({ clerkToken })
@@ -89133,7 +89242,7 @@ function createApiClient(baseUrl, token) {
89133
89242
  return res.json();
89134
89243
  },
89135
89244
  async verifySession() {
89136
- const res = await fetch(`${baseUrl}/api/cli/auth/verify`, {
89245
+ const res = await fetchWithTimeout(`${baseUrl}/api/cli/auth/verify`, {
89137
89246
  method: "GET",
89138
89247
  headers: { Authorization: `Bearer ${token}` }
89139
89248
  });
@@ -89147,7 +89256,7 @@ function createApiClient(baseUrl, token) {
89147
89256
  return parsed.data;
89148
89257
  },
89149
89258
  async logout() {
89150
- const res = await fetch(`${baseUrl}/api/cli/auth/logout`, {
89259
+ const res = await fetchWithTimeout(`${baseUrl}/api/cli/auth/logout`, {
89151
89260
  method: "POST",
89152
89261
  headers: { Authorization: `Bearer ${token}` }
89153
89262
  });
@@ -89156,7 +89265,7 @@ function createApiClient(baseUrl, token) {
89156
89265
  }
89157
89266
  },
89158
89267
  async listLicenses(scope) {
89159
- const res = await fetch(`${baseUrl}/api/cli/license?scope=${scope}`, {
89268
+ const res = await fetchWithTimeout(`${baseUrl}/api/cli/license?scope=${scope}`, {
89160
89269
  method: "GET",
89161
89270
  headers: {
89162
89271
  Authorization: `Bearer ${token}`
@@ -89169,7 +89278,7 @@ function createApiClient(baseUrl, token) {
89169
89278
  return payload.licenses;
89170
89279
  },
89171
89280
  async issueLicense() {
89172
- const res = await fetch(`${baseUrl}/api/cli/license`, {
89281
+ const res = await fetchWithTimeout(`${baseUrl}/api/cli/license`, {
89173
89282
  method: "POST",
89174
89283
  headers: {
89175
89284
  Authorization: `Bearer ${token}`
@@ -89182,7 +89291,7 @@ function createApiClient(baseUrl, token) {
89182
89291
  return { licenseKey, licenseId, telemetryId };
89183
89292
  },
89184
89293
  async listHostedProjects() {
89185
- const res = await fetch(`${baseUrl}/api/cli/projects`, {
89294
+ const res = await fetchWithTimeout(`${baseUrl}/api/cli/projects`, {
89186
89295
  method: "GET",
89187
89296
  headers: { Authorization: `Bearer ${token}` }
89188
89297
  });
@@ -89192,7 +89301,7 @@ function createApiClient(baseUrl, token) {
89192
89301
  return parseHostedProjectListResponse(await res.json());
89193
89302
  },
89194
89303
  async createHostedProject(name) {
89195
- const res = await fetch(`${baseUrl}/api/cli/projects`, {
89304
+ const res = await fetchWithTimeout(`${baseUrl}/api/cli/projects`, {
89196
89305
  method: "POST",
89197
89306
  headers: {
89198
89307
  "Content-Type": "application/json",
@@ -89204,10 +89313,23 @@ function createApiClient(baseUrl, token) {
89204
89313
  throw await readApiError(res);
89205
89314
  }
89206
89315
  return parseHostedProjectResponse(await res.json());
89316
+ },
89317
+ async provisionApiKey(projectId) {
89318
+ const res = await fetchWithTimeout(
89319
+ `${baseUrl}/api/cli/projects/${encodeURIComponent(projectId)}/api-keys`,
89320
+ {
89321
+ method: "POST",
89322
+ headers: { Authorization: `Bearer ${token}` }
89323
+ }
89324
+ );
89325
+ if (!res.ok) {
89326
+ throw await readApiError(res);
89327
+ }
89328
+ return parseHostedProjectApiKeyResponse(await res.json());
89207
89329
  }
89208
89330
  };
89209
89331
  }
89210
- var ApiClientError, verifySessionResponseSchema, NO_ORGANIZATION_MESSAGE;
89332
+ var ApiClientError, verifySessionResponseSchema, DEFAULT_REQUEST_TIMEOUT_MS, NO_ORGANIZATION_MESSAGE;
89211
89333
  var init_api_client = __esm({
89212
89334
  "apps/cli/src/services/api-client.ts"() {
89213
89335
  "use strict";
@@ -89241,6 +89363,7 @@ var init_api_client = __esm({
89241
89363
  organizationName: external_exports.string().optional()
89242
89364
  })
89243
89365
  });
89366
+ DEFAULT_REQUEST_TIMEOUT_MS = 15e3;
89244
89367
  NO_ORGANIZATION_MESSAGE = "No active organization for this session. Please log in again with `copilotkit login`.";
89245
89368
  }
89246
89369
  });
@@ -89576,15 +89699,15 @@ var init_wsl_utils = __esm({
89576
89699
  const { stdout } = await executePowerShell(command, { powerShellPath: psPath });
89577
89700
  return stdout.trim();
89578
89701
  };
89579
- convertWslPathToWindows = async (path15) => {
89580
- if (/^[a-z]+:\/\//i.test(path15)) {
89581
- return path15;
89702
+ convertWslPathToWindows = async (path16) => {
89703
+ if (/^[a-z]+:\/\//i.test(path16)) {
89704
+ return path16;
89582
89705
  }
89583
89706
  try {
89584
- const { stdout } = await execFile2("wslpath", ["-aw", path15], { encoding: "utf8" });
89707
+ const { stdout } = await execFile2("wslpath", ["-aw", path16], { encoding: "utf8" });
89585
89708
  return stdout.trim();
89586
89709
  } catch {
89587
- return path15;
89710
+ return path16;
89588
89711
  }
89589
89712
  };
89590
89713
  }
@@ -90959,12 +91082,11 @@ function CliTip({
90959
91082
  if (!visible || selectedTip === null) {
90960
91083
  return null;
90961
91084
  }
90962
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "gray", children: [
90963
- "Tip:",
90964
- " ",
90965
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "cyan", children: textSegments.map(
90966
- (segment, index) => segment.kind === "code" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, color: "white", children: segment.text }, `${segment.kind}-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "cyan", children: segment.text }, `${segment.kind}-${index}`)
90967
- ) })
91085
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
91086
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "Tip: " }),
91087
+ textSegments.map(
91088
+ (segment, index) => segment.kind === "code" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, children: segment.text }, `${segment.kind}-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: segment.text }, `${segment.kind}-${index}`)
91089
+ )
90968
91090
  ] }) });
90969
91091
  }
90970
91092
  var import_react33, import_jsx_runtime2, CLI_TIP_DEFAULT_DELAY_MS, CLI_TIP_DEFAULT_ROTATION_MS, CLI_TIP_DEFAULT_ROTATION_LIMIT, CLI_TIP_DEFAULT_ROTATION_POOL_LIMIT;
@@ -91017,6 +91139,26 @@ var init_spinner = __esm({
91017
91139
  }
91018
91140
  });
91019
91141
 
91142
+ // apps/cli/src/ui/success-text.tsx
91143
+ function SuccessText({
91144
+ children,
91145
+ marker
91146
+ }) {
91147
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { children: [
91148
+ marker ?? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: "green", children: "\u2713" }),
91149
+ " ",
91150
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { bold: true, children })
91151
+ ] });
91152
+ }
91153
+ var import_jsx_runtime4;
91154
+ var init_success_text = __esm({
91155
+ async "apps/cli/src/ui/success-text.tsx"() {
91156
+ "use strict";
91157
+ await init_build2();
91158
+ import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
91159
+ }
91160
+ });
91161
+
91020
91162
  // apps/cli/src/ui/browser-login.tsx
91021
91163
  function isBrowserLoginConfirmationInteractive() {
91022
91164
  return process.stdin.isTTY === true && process.stdout.isTTY === true;
@@ -91157,7 +91299,7 @@ function BrowserLoginProvider({
91157
91299
  }),
91158
91300
  [confirmBrowserLoginStart, runLogin2, state, submitManualClerkToken]
91159
91301
  );
91160
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BrowserLoginContext.Provider, { value, children });
91302
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BrowserLoginContext.Provider, { value, children });
91161
91303
  }
91162
91304
  function useBrowserLogin() {
91163
91305
  const context = (0, import_react35.useContext)(BrowserLoginContext);
@@ -91180,27 +91322,27 @@ function BrowserLoginConfirmation({
91180
91322
  return null;
91181
91323
  }
91182
91324
  if (state.phase === "confirming") {
91183
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { flexDirection: "column", children: [
91184
- reason ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { children: reason }) }) : null,
91185
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { children: BROWSER_LOGIN_CONFIRMATION_MESSAGE }),
91186
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: "gray", children: BROWSER_LOGIN_CONFIRMATION_PROMPT })
91325
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", children: [
91326
+ reason ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children: reason }) }) : null,
91327
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children: BROWSER_LOGIN_CONFIRMATION_MESSAGE }),
91328
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { dimColor: true, children: BROWSER_LOGIN_CONFIRMATION_PROMPT })
91187
91329
  ] });
91188
91330
  }
91189
91331
  if (state.phase === "waiting") {
91190
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { flexDirection: "column", children: [
91191
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, { label: "\u{1FA81} Waiting for browser sign-in\u2026" }),
91192
- state.loginUrl !== "" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { marginTop: 1, flexDirection: "column", children: [
91193
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: "gray", children: BROWSER_LOGIN_MANUAL_URL_LABEL }),
91194
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { children: state.loginUrl })
91332
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", children: [
91333
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner, { label: "\u{1FA81} Waiting for browser sign-in\u2026" }),
91334
+ state.loginUrl !== "" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { marginTop: 1, flexDirection: "column", children: [
91335
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { dimColor: true, children: BROWSER_LOGIN_MANUAL_URL_LABEL }),
91336
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children: state.loginUrl })
91195
91337
  ] }) : null,
91196
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { marginTop: 1, flexDirection: "column", children: [
91197
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: "gray", children: BROWSER_LOGIN_MANUAL_PASTE_LABEL }),
91198
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { children: [
91199
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { children: [
91338
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { marginTop: 1, flexDirection: "column", children: [
91339
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { dimColor: true, children: BROWSER_LOGIN_MANUAL_PASTE_LABEL }),
91340
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { children: [
91341
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
91200
91342
  ">",
91201
91343
  " "
91202
91344
  ] }),
91203
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
91345
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
91204
91346
  build_default,
91205
91347
  {
91206
91348
  value: manualTokenInput,
@@ -91214,43 +91356,43 @@ function BrowserLoginConfirmation({
91214
91356
  )
91215
91357
  ] })
91216
91358
  ] }),
91217
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CliTip, {})
91359
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CliTip, {})
91218
91360
  ] });
91219
91361
  }
91220
91362
  if (state.phase === "finalizing" && state.identity !== null) {
91221
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { flexDirection: "column", children: [
91222
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: "green", children: "Logged in successfully!" }),
91223
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { children: [
91363
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", children: [
91364
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SuccessText, { children: "Logged in successfully!" }),
91365
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
91224
91366
  "Email: ",
91225
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { bold: true, children: state.identity.email })
91367
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: true, children: state.identity.email })
91226
91368
  ] }),
91227
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { children: [
91369
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
91228
91370
  "Organization: ",
91229
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { bold: true, children: state.identity.organizationName })
91371
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: true, children: state.identity.organizationName })
91230
91372
  ] }),
91231
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, { label: "Wrapping up..." }) }),
91232
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CliTip, {})
91373
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner, { label: "Wrapping up..." }) }),
91374
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CliTip, {})
91233
91375
  ] });
91234
91376
  }
91235
91377
  if (state.phase === "success" && state.identity !== null) {
91236
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { flexDirection: "column", children: [
91237
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: "green", children: "Logged in successfully!" }),
91238
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { children: [
91378
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", children: [
91379
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SuccessText, { children: "Logged in successfully!" }),
91380
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
91239
91381
  "Email: ",
91240
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { bold: true, children: state.identity.email })
91382
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: true, children: state.identity.email })
91241
91383
  ] }),
91242
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { children: [
91384
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
91243
91385
  "Organization: ",
91244
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { bold: true, children: state.identity.organizationName })
91386
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: true, children: state.identity.organizationName })
91245
91387
  ] })
91246
91388
  ] });
91247
91389
  }
91248
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: "red", children: [
91390
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: "red", children: [
91249
91391
  "Login failed: ",
91250
91392
  state.errorMessage
91251
91393
  ] }) });
91252
91394
  }
91253
- var import_react35, import_jsx_runtime4, BROWSER_LOGIN_CONFIRMATION_MESSAGE, BROWSER_LOGIN_CONFIRMATION_PROMPT, MANUAL_PASTE_FINALIZING_MS, idleState, BrowserLoginContext, BROWSER_LOGIN_MANUAL_PASTE_LABEL, BROWSER_LOGIN_MANUAL_URL_LABEL;
91395
+ var import_react35, import_jsx_runtime5, BROWSER_LOGIN_CONFIRMATION_MESSAGE, BROWSER_LOGIN_CONFIRMATION_PROMPT, MANUAL_PASTE_FINALIZING_MS, idleState, BrowserLoginContext, BROWSER_LOGIN_MANUAL_PASTE_LABEL, BROWSER_LOGIN_MANUAL_URL_LABEL;
91254
91396
  var init_browser_login = __esm({
91255
91397
  async "apps/cli/src/ui/browser-login.tsx"() {
91256
91398
  "use strict";
@@ -91261,7 +91403,8 @@ var init_browser_login = __esm({
91261
91403
  init_cli_auth_diagnostics();
91262
91404
  await init_cli_tip();
91263
91405
  await init_spinner();
91264
- import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
91406
+ await init_success_text();
91407
+ import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
91265
91408
  BROWSER_LOGIN_CONFIRMATION_MESSAGE = "Sign in to your \u{1FA81} CopilotKit account in your browser.";
91266
91409
  BROWSER_LOGIN_CONFIRMATION_PROMPT = "Press Enter to continue...";
91267
91410
  MANUAL_PASTE_FINALIZING_MS = 6e3;
@@ -91700,28 +91843,28 @@ function LicenseCreateApp({ onIssued }) {
91700
91843
  };
91701
91844
  }, [browserLogin.runLogin, onIssued, exit]);
91702
91845
  if (shouldRenderLicenseCreateBrowserLoginConfirmation(browserLogin.state.phase)) {
91703
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BrowserLoginConfirmation, { reason: LICENSE_AUTH_REASON });
91846
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BrowserLoginConfirmation, { reason: LICENSE_AUTH_REASON });
91704
91847
  }
91705
91848
  if (phase === "auth") {
91706
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", children: [
91707
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
91708
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children: LICENSE_AUTH_REASON }),
91709
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "gray", children: "Sign in with your browser to continue." })
91849
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", children: [
91850
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
91851
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { children: LICENSE_AUTH_REASON }),
91852
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { dimColor: true, children: "Sign in with your browser to continue." })
91710
91853
  ] }),
91711
- authMessage ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "yellow", children: authMessage }) : null,
91712
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner, { label: "Verifying authentication\u2026" })
91854
+ authMessage ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: "yellow", children: authMessage }) : null,
91855
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, { label: "Verifying authentication\u2026" })
91713
91856
  ] });
91714
91857
  }
91715
91858
  if (phase === "issue") {
91716
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", children: [
91717
- authMessage ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "yellow", children: authMessage }) : null,
91718
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner, { label: "Issuing license key\u2026" })
91859
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", children: [
91860
+ authMessage ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: "yellow", children: authMessage }) : null,
91861
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, { label: "Issuing license key\u2026" })
91719
91862
  ] });
91720
91863
  }
91721
91864
  if (phase === "success") {
91722
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { flexDirection: "column", gap: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "green", children: "License key issued." }) });
91865
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { flexDirection: "column", gap: 1, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SuccessText, { children: "License key issued." }) });
91723
91866
  }
91724
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: "red", children: [
91867
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: "red", children: [
91725
91868
  "License failed: ",
91726
91869
  errorMessage
91727
91870
  ] }) });
@@ -91752,7 +91895,7 @@ async function runLicense(command) {
91752
91895
  const deliveryMode = command.envWrite === "offer" ? await promptYesNo("After issuing, write the license to ./.env?") ? "write" : "print" : command.envWrite;
91753
91896
  let issuedKey = null;
91754
91897
  const { waitUntilExit } = render_default(
91755
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BrowserLoginProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LicenseCreateApp, { onIssued: (k) => {
91898
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BrowserLoginProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(LicenseCreateApp, { onIssued: (k) => {
91756
91899
  issuedKey = k;
91757
91900
  } }) }),
91758
91901
  // Render the issuance UI (spinners, "License key issued.") to stderr so
@@ -91773,7 +91916,7 @@ async function runLicense(command) {
91773
91916
  writeStderr: (text) => process.stderr.write(text)
91774
91917
  });
91775
91918
  }
91776
- var import_react36, import_jsx_runtime5, LICENSE_AUTH_REASON;
91919
+ var import_react36, import_jsx_runtime6, LICENSE_AUTH_REASON;
91777
91920
  var init_license = __esm({
91778
91921
  async "apps/cli/src/commands/license.tsx"() {
91779
91922
  "use strict";
@@ -91785,10 +91928,11 @@ var init_license = __esm({
91785
91928
  init_config_service();
91786
91929
  await init_browser_login();
91787
91930
  await init_spinner();
91931
+ await init_success_text();
91788
91932
  init_config();
91789
91933
  init_project_scaffold();
91790
91934
  init_license_delivery();
91791
- import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
91935
+ import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
91792
91936
  LICENSE_AUTH_REASON = "A CopilotKit Intelligence license unlocks Threads and other licensed features. Sign in to issue a free license key for this project.";
91793
91937
  }
91794
91938
  });
@@ -91819,30 +91963,313 @@ var init_project_config = __esm({
91819
91963
  }
91820
91964
  });
91821
91965
 
91822
- // apps/cli/src/services/hosted-project.ts
91823
- async function selectOrCreateHostedProject(deps) {
91824
- const { apiClient, prompts } = deps;
91825
- const { projects } = await apiClient.listHostedProjects();
91826
- if (projects.length === 0) {
91827
- return await createFromName(apiClient, prompts);
91966
+ // apps/cli/src/services/vendor-key-predicate.ts
91967
+ var VENDOR_KEY_PREDICATE_SOURCE, bundle, readDotenvValue, isPlaceholderValue, resolveVendorKeyValue, findUnsatisfiedVendorKeys;
91968
+ var init_vendor_key_predicate = __esm({
91969
+ "apps/cli/src/services/vendor-key-predicate.ts"() {
91970
+ "use strict";
91971
+ VENDOR_KEY_PREDICATE_SOURCE = String.raw`
91972
+ function readDotenvValue(envFileContent, key) {
91973
+ const re = new RegExp('^\\s*(?:export\\s+)?' + key + '=(.*)$', 'gm');
91974
+ let match;
91975
+ let last = null;
91976
+ while ((match = re.exec(envFileContent)) !== null) {
91977
+ last = match;
91978
+ }
91979
+ if (!last) {
91980
+ return '';
91828
91981
  }
91829
- const choice = await prompts.chooseProject(projects);
91830
- if (choice === "cancel") {
91831
- return { canceled: true };
91982
+ const raw = last[1].trim();
91983
+ if (
91984
+ raw.length >= 2 &&
91985
+ ((raw.startsWith('"') && raw.endsWith('"')) ||
91986
+ (raw.startsWith("'") && raw.endsWith("'")))
91987
+ ) {
91988
+ return raw.slice(1, -1).trim();
91989
+ }
91990
+ if (raw.startsWith('#')) {
91991
+ return '';
91992
+ }
91993
+ return raw.replace(/\s+#.*$/, '').trim();
91994
+ }
91995
+
91996
+ function isPlaceholderValue(value) {
91997
+ return /^<.*>$/.test(value) || /^your[-_]/i.test(value) || /\.\.\.$/.test(value);
91998
+ }
91999
+
92000
+ function resolveVendorKeyValue(processEnv, envFileContent, key) {
92001
+ const fromProcess = ((processEnv && processEnv[key]) || '').trim();
92002
+ return fromProcess !== '' ? fromProcess : readDotenvValue(envFileContent, key);
92003
+ }
92004
+
92005
+ function findUnsatisfiedVendorKeys(processEnv, envFileContent, requirements) {
92006
+ return requirements
92007
+ .map((requirement) => ({
92008
+ requirement,
92009
+ value: resolveVendorKeyValue(processEnv, envFileContent, requirement.key),
92010
+ }))
92011
+ .filter(({ value }) => value === '' || isPlaceholderValue(value));
92012
+ }
92013
+ `;
92014
+ bundle = new Function(
92015
+ `${VENDOR_KEY_PREDICATE_SOURCE}
92016
+ return { readDotenvValue, isPlaceholderValue, resolveVendorKeyValue, findUnsatisfiedVendorKeys };`
92017
+ )();
92018
+ readDotenvValue = bundle.readDotenvValue;
92019
+ isPlaceholderValue = bundle.isPlaceholderValue;
92020
+ resolveVendorKeyValue = bundle.resolveVendorKeyValue;
92021
+ findUnsatisfiedVendorKeys = bundle.findUnsatisfiedVendorKeys;
92022
+ }
92023
+ });
92024
+
92025
+ // apps/cli/src/services/intelligence-activation.ts
92026
+ import * as fs15 from "node:fs";
92027
+ import * as path12 from "node:path";
92028
+ function withFsErrorTag(operation) {
92029
+ try {
92030
+ return operation();
92031
+ } catch (err) {
92032
+ if (err instanceof Error) {
92033
+ throw tagError(err, TELEMETRY_ERROR_CODES.FILESYSTEM_WRITE_FAILED);
92034
+ }
92035
+ throw err;
91832
92036
  }
91833
- if (choice === "create") {
91834
- return await createFromName(apiClient, prompts);
92037
+ }
92038
+ function activateIntelligence({
92039
+ projectDir,
92040
+ vendorEnvKeys = [],
92041
+ hosted
92042
+ }) {
92043
+ writeDevInfraScript(projectDir, vendorEnvKeys);
92044
+ const devScriptPatched = chainDevInfraScript(projectDir);
92045
+ if (hosted) {
92046
+ writeHostedEnvBlock(projectDir, hosted);
92047
+ }
92048
+ return { devScriptPatched };
92049
+ }
92050
+ function resolveHostedScaffoldConfig() {
92051
+ const apiUrl = getHostedRuntimeUrl();
92052
+ if (apiUrl === "") {
92053
+ return void 0;
91835
92054
  }
91836
92055
  return {
91837
- projectId: choice.id,
91838
- projectSlug: choice.slug,
91839
- organizationId: choice.organizationId
92056
+ apiUrl,
92057
+ gatewayWsUrl: getHostedGatewayUrl(),
92058
+ slEnabled: getHostedSlEnabled()
92059
+ };
92060
+ }
92061
+ function buildDevInfraScriptContent(vendorEnvKeys) {
92062
+ const validEnvKeyName = /^[A-Za-z_][A-Za-z0-9_]*$/;
92063
+ for (const entry of vendorEnvKeys) {
92064
+ if (!validEnvKeyName.test(entry.key)) {
92065
+ throw new Error(
92066
+ `Vendor env key "${entry.key}" is not a valid environment variable name; refusing to template it into the dev preflight script.`
92067
+ );
92068
+ }
92069
+ }
92070
+ const requiredEnvKeysJson = JSON.stringify(vendorEnvKeys, null, 2);
92071
+ return `#!/usr/bin/env node
92072
+ // Warns about missing LLM vendor API keys before \`npm run dev\`, then lets the
92073
+ // dev server start anyway (chat/generations will fail until the key is set).
92074
+ // Written by \`copilotkit init\`; safe to delete if you manage env validation
92075
+ // yourself.
92076
+ import { existsSync, readFileSync } from 'node:fs';
92077
+
92078
+ /** Vendor API keys this scaffold needs before chat and generations will work. */
92079
+ const REQUIRED_ENV_KEYS = ${requiredEnvKeysJson};
92080
+
92081
+ const envFileExists = existsSync('.env');
92082
+ const envFileContent = envFileExists ? readFileSync('.env', 'utf8') : '';
92083
+
92084
+ // Shared detection predicate \u2014 authored once in vendor-key-predicate.ts and
92085
+ // spliced here verbatim so the CLI pre-check (ENT-677) and this gate cannot
92086
+ // drift. Defines readDotenvValue / isPlaceholderValue / resolveVendorKeyValue /
92087
+ // findUnsatisfiedVendorKeys.
92088
+ ${VENDOR_KEY_PREDICATE_SOURCE}
92089
+
92090
+ const failedKeys = findUnsatisfiedVendorKeys(process.env, envFileContent, REQUIRED_ENV_KEYS)
92091
+ .map(({ requirement, value }) => ({ entry: requirement, value }));
92092
+
92093
+ if (failedKeys.length > 0) {
92094
+ for (const { entry, value } of failedKeys) {
92095
+ if (value === '') {
92096
+ console.warn(
92097
+ \`\u26A0 Missing API key: \${entry.key} \u2014 chat and generations will not work until you set it.\`,
92098
+ );
92099
+ } else {
92100
+ console.warn(
92101
+ \`\u26A0 Placeholder value for API key: \${entry.key} \u2014 chat and generations will not work until you replace it with your real key.\`,
92102
+ );
92103
+ }
92104
+ console.warn(\` \${entry.note}\`);
92105
+ console.warn(\` Get a key: \${entry.url}\`);
92106
+ console.warn(\` Add to .env: \${entry.key}=\${entry.example}\`);
92107
+ console.warn('');
92108
+ }
92109
+ if (!envFileExists) {
92110
+ console.warn(
92111
+ 'No .env file found in this directory; create one containing the line(s) above.',
92112
+ );
92113
+ }
92114
+ console.warn(
92115
+ 'Starting the dev server anyway \u2014 set the key(s) above and restart to enable chat.',
92116
+ );
92117
+ }
92118
+
92119
+ process.exit(0);
92120
+ `;
92121
+ }
92122
+ function writeDevInfraScript(projectDir, vendorEnvKeys) {
92123
+ const scriptPath = path12.join(projectDir, DEV_INFRA_SCRIPT_PATH);
92124
+ if (fs15.existsSync(scriptPath)) {
92125
+ return;
92126
+ }
92127
+ withFsErrorTag(() => {
92128
+ fs15.mkdirSync(path12.dirname(scriptPath), { recursive: true });
92129
+ fs15.writeFileSync(scriptPath, buildDevInfraScriptContent(vendorEnvKeys));
92130
+ });
92131
+ }
92132
+ function chainDevInfraScript(projectDir) {
92133
+ const packageJsonPath = path12.join(projectDir, "package.json");
92134
+ if (!fs15.existsSync(packageJsonPath)) {
92135
+ return false;
92136
+ }
92137
+ const packageJson2 = JSON.parse(fs15.readFileSync(packageJsonPath, "utf8"));
92138
+ const devScript = packageJson2.scripts?.dev;
92139
+ if (!devScript || devScript.includes("dev:infra")) {
92140
+ return false;
92141
+ }
92142
+ const scripts = {
92143
+ ...packageJson2.scripts,
92144
+ "dev:infra": `node ${DEV_INFRA_SCRIPT_PATH}`,
92145
+ dev: `npm run dev:infra && ${devScript}`
91840
92146
  };
92147
+ const updated = { ...packageJson2, scripts };
92148
+ withFsErrorTag(
92149
+ () => fs15.writeFileSync(packageJsonPath, `${JSON.stringify(updated, null, 2)}
92150
+ `)
92151
+ );
92152
+ return true;
92153
+ }
92154
+ function writeHostedEnvBlock(projectDir, hosted) {
92155
+ const envPath = path12.join(projectDir, ".env");
92156
+ const existingContent = fs15.existsSync(envPath) ? fs15.readFileSync(envPath, "utf8") : "";
92157
+ const candidates = [
92158
+ ["INTELLIGENCE_API_URL", hosted.apiUrl],
92159
+ ["INTELLIGENCE_GATEWAY_WS_URL", hosted.gatewayWsUrl],
92160
+ ["SL_ENABLED", hosted.slEnabled ? "true" : "false"]
92161
+ ];
92162
+ const assignments = candidates.filter(([, value]) => value !== "");
92163
+ withFsErrorTag(
92164
+ () => fs15.writeFileSync(
92165
+ envPath,
92166
+ upsertEnvAssignments(existingContent, assignments)
92167
+ )
92168
+ );
92169
+ }
92170
+ function writeHostedApiKey(projectDir, apiKey) {
92171
+ if (apiKey === "") {
92172
+ return;
92173
+ }
92174
+ const envPath = path12.join(projectDir, ".env");
92175
+ const existingContent = fs15.existsSync(envPath) ? fs15.readFileSync(envPath, "utf8") : "";
92176
+ withFsErrorTag(
92177
+ () => fs15.writeFileSync(
92178
+ envPath,
92179
+ upsertEnvAssignments(existingContent, [["INTELLIGENCE_API_KEY", apiKey]])
92180
+ )
92181
+ );
92182
+ }
92183
+ function upsertEnvAssignments(content, assignments) {
92184
+ const pending = new Map(
92185
+ assignments.map(([key, value]) => [key, value])
92186
+ );
92187
+ const lines = content === "" ? [] : content.split("\n");
92188
+ const rewritten = lines.map((line) => {
92189
+ const key = ENV_ASSIGNMENT_RE.exec(line)?.[1];
92190
+ const value = key === void 0 ? void 0 : pending.get(key);
92191
+ if (key !== void 0 && value !== void 0) {
92192
+ pending.delete(key);
92193
+ return `${key}=${value}`;
92194
+ }
92195
+ return line;
92196
+ });
92197
+ const toAppend = assignments.filter(([key]) => pending.has(key)).map(([key, value]) => `${key}=${value}`);
92198
+ if (toAppend.length === 0) {
92199
+ return ensureTrailingNewline(rewritten.join("\n"));
92200
+ }
92201
+ const body = ensureTrailingNewline(rewritten.join("\n"));
92202
+ const separator = body === "" ? "" : "\n";
92203
+ return `${body}${separator}${HOSTED_ENV_HEADER}
92204
+ ${toAppend.join("\n")}
92205
+ `;
92206
+ }
92207
+ function ensureTrailingNewline(value) {
92208
+ if (value === "") {
92209
+ return "";
92210
+ }
92211
+ return value.endsWith("\n") ? value : `${value}
92212
+ `;
92213
+ }
92214
+ var DEV_INFRA_SCRIPT_PATH, HOSTED_ENV_HEADER, ENV_ASSIGNMENT_RE;
92215
+ var init_intelligence_activation = __esm({
92216
+ "apps/cli/src/services/intelligence-activation.ts"() {
92217
+ "use strict";
92218
+ init_config();
92219
+ init_vendor_key_predicate();
92220
+ init_event_properties();
92221
+ DEV_INFRA_SCRIPT_PATH = "scripts/copilotkit-dev-infra.mjs";
92222
+ HOSTED_ENV_HEADER = "# CopilotKit Intelligence (managed service) \u2014 hosted credentials written by `copilotkit init`.\n# Swap these by editing the values here or exporting the matching env vars before `npm run dev`.";
92223
+ ENV_ASSIGNMENT_RE = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=/;
92224
+ }
92225
+ });
92226
+
92227
+ // apps/cli/src/services/hosted-project.ts
92228
+ async function selectOrCreateHostedProject(deps) {
92229
+ const { apiClient, prompts, telemetry } = deps;
92230
+ const { projects } = await apiClient.listHostedProjects();
92231
+ const projectCount = projects.length;
92232
+ if (projectCount === 0) {
92233
+ const result = await createFromName(apiClient, prompts, {
92234
+ canGoBack: false
92235
+ });
92236
+ if (result === "back") {
92237
+ telemetry?.onResolved?.("canceled", projectCount);
92238
+ return { canceled: true };
92239
+ }
92240
+ telemetry?.onResolved?.("created_new", projectCount);
92241
+ return result;
92242
+ }
92243
+ telemetry?.onPickerViewed?.(projectCount);
92244
+ for (; ; ) {
92245
+ const choice = await prompts.chooseProject(projects);
92246
+ if (choice === "cancel") {
92247
+ telemetry?.onResolved?.("canceled", projectCount);
92248
+ return { canceled: true };
92249
+ }
92250
+ if (choice !== "create") {
92251
+ telemetry?.onResolved?.("selected_existing", projectCount);
92252
+ return {
92253
+ projectId: choice.id,
92254
+ projectSlug: choice.slug,
92255
+ organizationId: choice.organizationId
92256
+ };
92257
+ }
92258
+ const result = await createFromName(apiClient, prompts, {
92259
+ canGoBack: true
92260
+ });
92261
+ if (result === "back") {
92262
+ telemetry?.onBack?.();
92263
+ continue;
92264
+ }
92265
+ telemetry?.onResolved?.("created_new", projectCount);
92266
+ return result;
92267
+ }
91841
92268
  }
91842
- async function createFromName(apiClient, prompts) {
91843
- const name = await prompts.promptProjectName();
91844
- if (name === null) {
91845
- return { canceled: true };
92269
+ async function createFromName(apiClient, prompts, options) {
92270
+ const name = await prompts.promptProjectName(options);
92271
+ if (name === "back") {
92272
+ return "back";
91846
92273
  }
91847
92274
  const { project } = await apiClient.createHostedProject(name);
91848
92275
  return {
@@ -91875,20 +92302,29 @@ function defer() {
91875
92302
  });
91876
92303
  return { promise: promise2, resolve: resolve2 };
91877
92304
  }
92305
+ function ProjectExplainer() {
92306
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "An Intelligence project is where this app's threads, messages, and analytics are stored." });
92307
+ }
91878
92308
  function HostedProjectSelect({
91879
92309
  apiClient,
91880
92310
  onResolved,
91881
92311
  onCanceled,
91882
- onError
92312
+ onError,
92313
+ defaultName = "",
92314
+ telemetry
91883
92315
  }) {
91884
92316
  const [view, setView] = (0, import_react37.useState)({ kind: "loading" });
91885
92317
  const nameBufferRef = (0, import_react37.useRef)("");
91886
92318
  const [nameDisplay, setNameDisplay] = (0, import_react37.useState)("");
92319
+ const nameDirtyRef = (0, import_react37.useRef)(false);
92320
+ const [nameDirty, setNameDirty] = (0, import_react37.useState)(false);
91887
92321
  const [nameError, setNameError] = (0, import_react37.useState)("");
91888
92322
  const pickerIndexRef = (0, import_react37.useRef)(0);
91889
92323
  const [pickerIndex, setPickerIndex] = (0, import_react37.useState)(0);
91890
92324
  const choiceRef = (0, import_react37.useRef)(null);
91891
92325
  const nameRef = (0, import_react37.useRef)(null);
92326
+ const [canGoBack, setCanGoBack] = (0, import_react37.useState)(false);
92327
+ const projectsRef = (0, import_react37.useRef)([]);
91892
92328
  const startedRef = (0, import_react37.useRef)(false);
91893
92329
  const firedRef = (0, import_react37.useRef)(false);
91894
92330
  (0, import_react37.useEffect)(() => {
@@ -91902,19 +92338,23 @@ function HostedProjectSelect({
91902
92338
  choiceRef.current = deferred;
91903
92339
  pickerIndexRef.current = 0;
91904
92340
  setPickerIndex(0);
92341
+ projectsRef.current = projects;
91905
92342
  setView({ kind: "choose", projects });
91906
92343
  return deferred.promise;
91907
92344
  },
91908
- promptProjectName: () => {
92345
+ promptProjectName: ({ canGoBack: back }) => {
91909
92346
  const deferred = defer();
91910
92347
  nameRef.current = deferred;
91911
- nameBufferRef.current = "";
91912
- setNameDisplay("");
92348
+ setCanGoBack(back);
92349
+ nameBufferRef.current = defaultName;
92350
+ setNameDisplay(defaultName);
92351
+ nameDirtyRef.current = false;
92352
+ setNameDirty(false);
91913
92353
  setView({ kind: "name" });
91914
92354
  return deferred.promise;
91915
92355
  }
91916
92356
  };
91917
- selectOrCreateHostedProject({ apiClient, prompts }).then((result) => {
92357
+ selectOrCreateHostedProject({ apiClient, prompts, telemetry }).then((result) => {
91918
92358
  if ("canceled" in result) {
91919
92359
  setView({ kind: "canceled" });
91920
92360
  } else {
@@ -91980,7 +92420,7 @@ function HostedProjectSelect({
91980
92420
  }
91981
92421
  if (view.kind === "name") {
91982
92422
  if (key.escape) {
91983
- nameRef.current?.resolve(null);
92423
+ nameRef.current?.resolve("back");
91984
92424
  return;
91985
92425
  }
91986
92426
  const crIdx = input.indexOf("\r");
@@ -91989,15 +92429,31 @@ function HostedProjectSelect({
91989
92429
  if (key.return || splitIdx !== -1) {
91990
92430
  const textBeforeNewline = splitIdx === -1 ? "" : input.slice(0, splitIdx);
91991
92431
  if (textBeforeNewline) {
91992
- nameBufferRef.current = nameBufferRef.current + textBeforeNewline;
92432
+ nameBufferRef.current = (nameDirtyRef.current ? nameBufferRef.current : "") + textBeforeNewline;
92433
+ nameDirtyRef.current = true;
92434
+ setNameDirty(true);
91993
92435
  }
91994
92436
  const trimmed = nameBufferRef.current.trim();
91995
92437
  if (trimmed === "") {
91996
- setNameError("Project name can't be empty.");
92438
+ setNameError("Intelligence project name can't be empty.");
92439
+ telemetry?.onCreateNameRejected?.("empty");
91997
92440
  return;
91998
92441
  }
91999
92442
  if (trimmed.length > 100) {
92000
- setNameError("Project name must be 100 characters or fewer.");
92443
+ setNameError(
92444
+ "Intelligence project name must be 100 characters or fewer."
92445
+ );
92446
+ telemetry?.onCreateNameRejected?.("too_long");
92447
+ return;
92448
+ }
92449
+ const duplicate = projectsRef.current.find(
92450
+ (project) => project.name.toLowerCase() === trimmed.toLowerCase()
92451
+ );
92452
+ if (duplicate) {
92453
+ setNameError(
92454
+ `You already have a project named "${duplicate.name}" \u2014 choose a different name, or cancel (Esc) and select it from the list.`
92455
+ );
92456
+ telemetry?.onCreateNameRejected?.("duplicate");
92001
92457
  return;
92002
92458
  }
92003
92459
  setNameError("");
@@ -92005,64 +92461,89 @@ function HostedProjectSelect({
92005
92461
  return;
92006
92462
  }
92007
92463
  if (key.backspace || key.delete) {
92008
- const updated = nameBufferRef.current.slice(0, -1);
92464
+ const updated = nameDirtyRef.current ? nameBufferRef.current.slice(0, -1) : "";
92465
+ nameDirtyRef.current = true;
92466
+ setNameDirty(true);
92009
92467
  nameBufferRef.current = updated;
92010
92468
  setNameDisplay(updated);
92011
92469
  return;
92012
92470
  }
92013
92471
  if (input && !key.ctrl && !key.meta) {
92014
- const updated = nameBufferRef.current + input;
92472
+ const base = nameDirtyRef.current ? nameBufferRef.current : "";
92473
+ nameDirtyRef.current = true;
92474
+ setNameDirty(true);
92475
+ const updated = base + input;
92015
92476
  nameBufferRef.current = updated;
92016
92477
  setNameDisplay(updated);
92017
92478
  }
92018
92479
  }
92019
92480
  });
92020
92481
  if (view.kind === "loading") {
92021
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { children: "Loading projects\u2026" });
92482
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "Loading projects\u2026" });
92022
92483
  }
92023
92484
  if (view.kind === "choose") {
92024
92485
  const { projects } = view;
92025
92486
  const items = [
92026
92487
  ...projects.map((project) => ({
92027
- label: `${project.name} (${project.slug})`,
92488
+ label: project.name,
92028
92489
  value: project.id
92029
92490
  })),
92030
92491
  { label: "Create a new project", value: "__create__" }
92031
92492
  ];
92032
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", children: [
92033
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { children: "Select a project (Esc to cancel):" }),
92034
- items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
92035
- index === pickerIndex ? "\u276F " : " ",
92036
- item.label
92037
- ] }, item.value))
92493
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", children: [
92494
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: true, children: "Connect this app to one of your existing projects, or create a new one." }),
92495
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ProjectExplainer, {}),
92496
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
92497
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "Select a project (\u2191/\u2193 to move, Enter to choose, Esc to cancel):" }),
92498
+ items.map((item, index) => {
92499
+ const selected = index === pickerIndex;
92500
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { bold: selected, children: [
92501
+ selected ? "\u276F " : "- ",
92502
+ item.label
92503
+ ] }, item.value);
92504
+ })
92038
92505
  ] });
92039
92506
  }
92040
92507
  if (view.kind === "name") {
92041
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", children: [
92042
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { children: "Project name (Esc to cancel):" }),
92043
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { children: nameDisplay }),
92044
- nameError ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: "red", children: nameError }) : null
92508
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", children: [
92509
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: "Name your hosted Intelligence project" }),
92510
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
92511
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ProjectExplainer, {}),
92512
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { dimColor: true, children: [
92513
+ "Pre-filled from your app name \u2014 press Enter to accept, or type to change it. Esc to ",
92514
+ canGoBack ? "go back to the project list" : "cancel",
92515
+ "."
92516
+ ] }),
92517
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { children: [
92518
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
92519
+ ">",
92520
+ " "
92521
+ ] }),
92522
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: !nameDirty, children: nameDisplay }),
92523
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { inverse: true, children: " " })
92524
+ ] }),
92525
+ nameError ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "red", children: nameError }) : null
92045
92526
  ] });
92046
92527
  }
92047
92528
  if (view.kind === "done") {
92048
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
92529
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
92049
92530
  "Selected project: ",
92050
92531
  view.selection.projectSlug
92051
92532
  ] });
92052
92533
  }
92053
92534
  if (view.kind === "canceled") {
92054
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { children: "Project selection canceled." });
92535
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "Project selection canceled." });
92055
92536
  }
92056
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { children: view.message });
92537
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: view.message });
92057
92538
  }
92058
- var import_react37, import_jsx_runtime6;
92539
+ var import_react37, import_jsx_runtime7;
92059
92540
  var init_hosted_project_select = __esm({
92060
92541
  async "apps/cli/src/ui/hosted-project-select.tsx"() {
92061
92542
  "use strict";
92062
92543
  import_react37 = __toESM(require_react(), 1);
92063
92544
  await init_build2();
92064
92545
  init_hosted_project2();
92065
- import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
92546
+ import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
92066
92547
  }
92067
92548
  });
92068
92549
 
@@ -92120,18 +92601,22 @@ async function driveProjectSelect() {
92120
92601
  }
92121
92602
  const apiClient = createApiClient(getOpsApiUrl(), auth.cliToken);
92122
92603
  let outcome = { kind: "canceled" };
92604
+ const capturedSelection = {
92605
+ value: null
92606
+ };
92123
92607
  const app = render_default(
92124
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
92608
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
92125
92609
  HostedProjectSelect,
92126
92610
  {
92127
92611
  apiClient,
92128
- onResolved: (selection) => {
92612
+ onResolved: (selection2) => {
92129
92613
  try {
92130
92614
  writeProjectConfig(process.cwd(), {
92131
- projectId: selection.projectId,
92132
- projectSlug: selection.projectSlug,
92133
- clerkOrgId: selection.organizationId
92615
+ projectId: selection2.projectId,
92616
+ projectSlug: selection2.projectSlug,
92617
+ clerkOrgId: selection2.organizationId
92134
92618
  });
92619
+ capturedSelection.value = selection2;
92135
92620
  outcome = { kind: "success" };
92136
92621
  } catch (error48) {
92137
92622
  process.stderr.write(
@@ -92155,6 +92640,18 @@ async function driveProjectSelect() {
92155
92640
  )
92156
92641
  );
92157
92642
  await app.waitUntilExit();
92643
+ const selection = capturedSelection.value;
92644
+ if (selection !== null) {
92645
+ try {
92646
+ const { apiKey } = await apiClient.provisionApiKey(selection.projectId);
92647
+ writeHostedApiKey(process.cwd(), apiKey.token);
92648
+ } catch (provisionError) {
92649
+ process.stderr.write(
92650
+ `Could not provision a project-scoped API key (${provisionError instanceof Error ? provisionError.message : String(provisionError)}); set INTELLIGENCE_API_KEY manually or re-run \`copilotkit project select\`.
92651
+ `
92652
+ );
92653
+ }
92654
+ }
92158
92655
  return outcome;
92159
92656
  }
92160
92657
  async function runProjectSelect() {
@@ -92164,7 +92661,7 @@ async function runProjectSelect() {
92164
92661
  throw exitError;
92165
92662
  }
92166
92663
  }
92167
- var import_jsx_runtime7;
92664
+ var import_jsx_runtime8;
92168
92665
  var init_project = __esm({
92169
92666
  async "apps/cli/src/commands/project.tsx"() {
92170
92667
  "use strict";
@@ -92173,9 +92670,10 @@ var init_project = __esm({
92173
92670
  init_api_client();
92174
92671
  init_config();
92175
92672
  init_project_config();
92673
+ init_intelligence_activation();
92176
92674
  await init_hosted_project_select();
92177
92675
  init_project_outcome();
92178
- import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
92676
+ import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
92179
92677
  }
92180
92678
  });
92181
92679
 
@@ -92328,26 +92826,26 @@ Start by inspecting my repo, then walk me through the setup.`;
92328
92826
 
92329
92827
  // apps/cli/src/ui/banner.tsx
92330
92828
  function Banner() {
92331
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
92332
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "magenta", children: KITE }),
92333
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "magenta", children: "~ Welcome to CopilotKit! ~" })
92829
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
92830
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "magenta", children: KITE }),
92831
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "magenta", children: "~ Welcome to CopilotKit! ~" })
92334
92832
  ] });
92335
92833
  }
92336
92834
  function IntelligenceFeatures() {
92337
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
92338
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: INTELLIGENCE_FEATURES_HEADING }),
92339
- INTELLIGENCE_FEATURES_BULLETS.map((bullet) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { color: "gray", children: [
92835
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
92836
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { children: INTELLIGENCE_FEATURES_HEADING }),
92837
+ INTELLIGENCE_FEATURES_BULLETS.map((bullet) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { dimColor: true, children: [
92340
92838
  " \u2022 ",
92341
92839
  bullet
92342
92840
  ] }, bullet))
92343
92841
  ] });
92344
92842
  }
92345
- var import_jsx_runtime8, KITE, INTELLIGENCE_FEATURES_HEADING, INTELLIGENCE_FEATURES_BULLETS;
92843
+ var import_jsx_runtime9, KITE, INTELLIGENCE_FEATURES_HEADING, INTELLIGENCE_FEATURES_BULLETS;
92346
92844
  var init_banner = __esm({
92347
92845
  async "apps/cli/src/ui/banner.tsx"() {
92348
92846
  "use strict";
92349
92847
  await init_build2();
92350
- import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
92848
+ import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
92351
92849
  KITE = `\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF
92352
92850
  \u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u281F\u2819\u28FF\u285B\u283B\u283F\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF
92353
92851
  \u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u280B\u2800\u2800\u2808\u28BF\u2844\u2800\u2800\u2800\u2808\u2809\u2819\u28FB\u28FF\u28FF\u28FF
@@ -92363,7 +92861,7 @@ var init_banner = __esm({
92363
92861
  \u28FF\u28FF\u283B\u28BF\u2877\u2800\u2801\u2834\u28FF\u28F7\u28FE\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u2844\u2800\u28FE\u2807\u28F4\u28FF\u28FF\u28FF\u28FF\u28FF
92364
92862
  \u287F\u281B\u2800\u2800\u28B4\u28FE\u28F7\u28F6\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28E4\u28FF\u28FE\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF
92365
92863
  \u28F7\u28FE\u28FF\u28E4\u28FE\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF`;
92366
- INTELLIGENCE_FEATURES_HEADING = "Every project includes CopilotKit Intelligence:";
92864
+ INTELLIGENCE_FEATURES_HEADING = "Every app includes CopilotKit Intelligence:";
92367
92865
  INTELLIGENCE_FEATURES_BULLETS = [
92368
92866
  "Durable threads & session persistence",
92369
92867
  "Interaction & event logging",
@@ -92460,31 +92958,31 @@ function SkillsOnboardApp({
92460
92958
  }
92461
92959
  }, [step, exit]);
92462
92960
  if (step === "authenticating" && shouldRenderBrowserLogin(browserLoginState.phase)) {
92463
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(BrowserLoginConfirmation, { reason: SKILLS_AUTH_REASON });
92961
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(BrowserLoginConfirmation, { reason: SKILLS_AUTH_REASON });
92464
92962
  }
92465
92963
  if (step === "authenticating") {
92466
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", children: [
92467
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "gray", children: "A free CopilotKit account is required \u2014 sign in with your browser to continue." }),
92468
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Spinner, { label: "\u{1FA81} Verifying authentication\u2026" })
92964
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", children: [
92965
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { dimColor: true, children: "A free CopilotKit account is required \u2014 sign in with your browser to continue." }),
92966
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Spinner, { label: "\u{1FA81} Verifying authentication\u2026" })
92469
92967
  ] });
92470
92968
  }
92471
92969
  if (step === "delivering") {
92472
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Spinner, { label: "Preparing your agent prompt\u2026" });
92970
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Spinner, { label: "Preparing your agent prompt\u2026" });
92473
92971
  }
92474
92972
  if (step === "error") {
92475
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: "red", children: [
92973
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { color: "red", children: [
92476
92974
  "Onboarding failed: ",
92477
92975
  errorMessage
92478
92976
  ] });
92479
92977
  }
92480
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", children: [
92481
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "green", children: "\u2713 CopilotKit skills installed." }),
92482
- copied ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
92483
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { children: "Your next step is copied to the clipboard." }),
92484
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "gray", children: "Paste it into your coding agent (Claude Code, Cursor, Codex, \u2026) to add CopilotKit to this project." })
92485
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
92486
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { children: "Paste this into your coding agent (Claude Code, Cursor, Codex, \u2026) to add CopilotKit to this project:" }),
92487
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { marginTop: 1, borderStyle: "round", paddingX: 1, flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { children: promptText }) })
92978
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", children: [
92979
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SuccessText, { children: "CopilotKit skills installed." }),
92980
+ copied ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
92981
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { children: "Your next step is copied to the clipboard." }),
92982
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { dimColor: true, children: "Paste it into your coding agent (Claude Code, Cursor, Codex, \u2026) to add CopilotKit to this project." })
92983
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
92984
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { children: "Paste this into your coding agent (Claude Code, Cursor, Codex, \u2026) to add CopilotKit to this project:" }),
92985
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box_default, { marginTop: 1, borderStyle: "round", paddingX: 1, flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { children: promptText }) })
92488
92986
  ] })
92489
92987
  ] });
92490
92988
  }
@@ -92506,14 +93004,14 @@ async function runSkills(flags) {
92506
93004
  return;
92507
93005
  }
92508
93006
  const { waitUntilExit } = render_default(
92509
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(BrowserLoginProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", children: [
92510
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Banner, {}),
92511
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SkillsOnboardApp, { noClipboard: flags.noClipboard ?? false })
93007
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(BrowserLoginProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", children: [
93008
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Banner, {}),
93009
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SkillsOnboardApp, { noClipboard: flags.noClipboard ?? false })
92512
93010
  ] }) })
92513
93011
  );
92514
93012
  await waitUntilExit();
92515
93013
  }
92516
- var import_react38, import_jsx_runtime9, SKILLS_AUTH_REASON, defaultOnboardDeps;
93014
+ var import_react38, import_jsx_runtime10, SKILLS_AUTH_REASON, defaultOnboardDeps;
92517
93015
  var init_skills = __esm({
92518
93016
  async "apps/cli/src/commands/skills.tsx"() {
92519
93017
  "use strict";
@@ -92526,7 +93024,8 @@ var init_skills = __esm({
92526
93024
  await init_banner();
92527
93025
  await init_browser_login();
92528
93026
  await init_spinner();
92529
- import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
93027
+ await init_success_text();
93028
+ import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
92530
93029
  SKILLS_AUTH_REASON = "A free CopilotKit account is required for agent-assisted onboarding.";
92531
93030
  defaultOnboardDeps = {
92532
93031
  verifyAndRefresh,
@@ -92700,251 +93199,6 @@ var init_docs = __esm({
92700
93199
  }
92701
93200
  });
92702
93201
 
92703
- // apps/cli/src/services/vendor-key-predicate.ts
92704
- var VENDOR_KEY_PREDICATE_SOURCE, bundle, readDotenvValue, isPlaceholderValue, resolveVendorKeyValue, findUnsatisfiedVendorKeys;
92705
- var init_vendor_key_predicate = __esm({
92706
- "apps/cli/src/services/vendor-key-predicate.ts"() {
92707
- "use strict";
92708
- VENDOR_KEY_PREDICATE_SOURCE = String.raw`
92709
- function readDotenvValue(envFileContent, key) {
92710
- const re = new RegExp('^\\s*(?:export\\s+)?' + key + '=(.*)$', 'gm');
92711
- let match;
92712
- let last = null;
92713
- while ((match = re.exec(envFileContent)) !== null) {
92714
- last = match;
92715
- }
92716
- if (!last) {
92717
- return '';
92718
- }
92719
- const raw = last[1].trim();
92720
- if (
92721
- raw.length >= 2 &&
92722
- ((raw.startsWith('"') && raw.endsWith('"')) ||
92723
- (raw.startsWith("'") && raw.endsWith("'")))
92724
- ) {
92725
- return raw.slice(1, -1).trim();
92726
- }
92727
- if (raw.startsWith('#')) {
92728
- return '';
92729
- }
92730
- return raw.replace(/\s+#.*$/, '').trim();
92731
- }
92732
-
92733
- function isPlaceholderValue(value) {
92734
- return /^<.*>$/.test(value) || /^your[-_]/i.test(value) || /\.\.\.$/.test(value);
92735
- }
92736
-
92737
- function resolveVendorKeyValue(processEnv, envFileContent, key) {
92738
- const fromProcess = ((processEnv && processEnv[key]) || '').trim();
92739
- return fromProcess !== '' ? fromProcess : readDotenvValue(envFileContent, key);
92740
- }
92741
-
92742
- function findUnsatisfiedVendorKeys(processEnv, envFileContent, requirements) {
92743
- return requirements
92744
- .map((requirement) => ({
92745
- requirement,
92746
- value: resolveVendorKeyValue(processEnv, envFileContent, requirement.key),
92747
- }))
92748
- .filter(({ value }) => value === '' || isPlaceholderValue(value));
92749
- }
92750
- `;
92751
- bundle = new Function(
92752
- `${VENDOR_KEY_PREDICATE_SOURCE}
92753
- return { readDotenvValue, isPlaceholderValue, resolveVendorKeyValue, findUnsatisfiedVendorKeys };`
92754
- )();
92755
- readDotenvValue = bundle.readDotenvValue;
92756
- isPlaceholderValue = bundle.isPlaceholderValue;
92757
- resolveVendorKeyValue = bundle.resolveVendorKeyValue;
92758
- findUnsatisfiedVendorKeys = bundle.findUnsatisfiedVendorKeys;
92759
- }
92760
- });
92761
-
92762
- // apps/cli/src/services/intelligence-activation.ts
92763
- import * as fs15 from "node:fs";
92764
- import * as path12 from "node:path";
92765
- function withFsErrorTag(operation) {
92766
- try {
92767
- return operation();
92768
- } catch (err) {
92769
- if (err instanceof Error) {
92770
- throw tagError(err, TELEMETRY_ERROR_CODES.FILESYSTEM_WRITE_FAILED);
92771
- }
92772
- throw err;
92773
- }
92774
- }
92775
- function activateIntelligence({
92776
- projectDir,
92777
- vendorEnvKeys = [],
92778
- hosted
92779
- }) {
92780
- writeDevInfraScript(projectDir, vendorEnvKeys);
92781
- const devScriptPatched = chainDevInfraScript(projectDir);
92782
- if (hosted) {
92783
- writeHostedEnvBlock(projectDir, hosted);
92784
- }
92785
- return { devScriptPatched };
92786
- }
92787
- function resolveHostedScaffoldConfig() {
92788
- const apiUrl = getHostedRuntimeUrl();
92789
- if (apiUrl === "") {
92790
- return void 0;
92791
- }
92792
- return {
92793
- apiUrl,
92794
- gatewayWsUrl: getHostedGatewayUrl(),
92795
- apiKey: getHostedApiKey(),
92796
- slEnabled: getHostedSlEnabled()
92797
- };
92798
- }
92799
- function buildDevInfraScriptContent(vendorEnvKeys) {
92800
- const validEnvKeyName = /^[A-Za-z_][A-Za-z0-9_]*$/;
92801
- for (const entry of vendorEnvKeys) {
92802
- if (!validEnvKeyName.test(entry.key)) {
92803
- throw new Error(
92804
- `Vendor env key "${entry.key}" is not a valid environment variable name; refusing to template it into the dev preflight script.`
92805
- );
92806
- }
92807
- }
92808
- const requiredEnvKeysJson = JSON.stringify(vendorEnvKeys, null, 2);
92809
- return `#!/usr/bin/env node
92810
- // Verifies required LLM vendor API keys before \`npm run dev\`. Written by
92811
- // \`copilotkit init\`; safe to delete if you manage env validation yourself.
92812
- import { existsSync, readFileSync } from 'node:fs';
92813
-
92814
- /** Vendor API keys this scaffold requires before the dev server is useful. */
92815
- const REQUIRED_ENV_KEYS = ${requiredEnvKeysJson};
92816
-
92817
- const envFileExists = existsSync('.env');
92818
- const envFileContent = envFileExists ? readFileSync('.env', 'utf8') : '';
92819
-
92820
- // Shared detection predicate \u2014 authored once in vendor-key-predicate.ts and
92821
- // spliced here verbatim so the CLI pre-check (ENT-677) and this gate cannot
92822
- // drift. Defines readDotenvValue / isPlaceholderValue / resolveVendorKeyValue /
92823
- // findUnsatisfiedVendorKeys.
92824
- ${VENDOR_KEY_PREDICATE_SOURCE}
92825
-
92826
- const failedKeys = findUnsatisfiedVendorKeys(process.env, envFileContent, REQUIRED_ENV_KEYS)
92827
- .map(({ requirement, value }) => ({ entry: requirement, value }));
92828
-
92829
- if (failedKeys.length > 0) {
92830
- for (const { entry, value } of failedKeys) {
92831
- if (value === '') {
92832
- console.error(\`\u2716 Missing required API key: \${entry.key}\`);
92833
- } else {
92834
- console.error(
92835
- \`\u2716 Placeholder value for required API key: \${entry.key} \u2014 replace it with your real key.\`,
92836
- );
92837
- }
92838
- console.error(\` \${entry.note}\`);
92839
- console.error(\` Get a key: \${entry.url}\`);
92840
- console.error(\` Add to .env: \${entry.key}=\${entry.example}\`);
92841
- console.error('');
92842
- }
92843
- if (!envFileExists) {
92844
- console.error(
92845
- 'No .env file found in this directory; create one containing the line(s) above.',
92846
- );
92847
- }
92848
- console.error('Then re-run: npm run dev');
92849
- process.exit(1);
92850
- }
92851
-
92852
- process.exit(0);
92853
- `;
92854
- }
92855
- function writeDevInfraScript(projectDir, vendorEnvKeys) {
92856
- const scriptPath = path12.join(projectDir, DEV_INFRA_SCRIPT_PATH);
92857
- if (fs15.existsSync(scriptPath)) {
92858
- return;
92859
- }
92860
- withFsErrorTag(() => {
92861
- fs15.mkdirSync(path12.dirname(scriptPath), { recursive: true });
92862
- fs15.writeFileSync(scriptPath, buildDevInfraScriptContent(vendorEnvKeys));
92863
- });
92864
- }
92865
- function chainDevInfraScript(projectDir) {
92866
- const packageJsonPath = path12.join(projectDir, "package.json");
92867
- if (!fs15.existsSync(packageJsonPath)) {
92868
- return false;
92869
- }
92870
- const packageJson2 = JSON.parse(fs15.readFileSync(packageJsonPath, "utf8"));
92871
- const devScript = packageJson2.scripts?.dev;
92872
- if (!devScript || devScript.includes("dev:infra")) {
92873
- return false;
92874
- }
92875
- const scripts = {
92876
- ...packageJson2.scripts,
92877
- "dev:infra": `node ${DEV_INFRA_SCRIPT_PATH}`,
92878
- dev: `npm run dev:infra && ${devScript}`
92879
- };
92880
- const updated = { ...packageJson2, scripts };
92881
- withFsErrorTag(
92882
- () => fs15.writeFileSync(packageJsonPath, `${JSON.stringify(updated, null, 2)}
92883
- `)
92884
- );
92885
- return true;
92886
- }
92887
- function writeHostedEnvBlock(projectDir, hosted) {
92888
- const envPath = path12.join(projectDir, ".env");
92889
- const existingContent = fs15.existsSync(envPath) ? fs15.readFileSync(envPath, "utf8") : "";
92890
- const candidates = [
92891
- ["INTELLIGENCE_API_URL", hosted.apiUrl],
92892
- ["INTELLIGENCE_GATEWAY_WS_URL", hosted.gatewayWsUrl],
92893
- ["INTELLIGENCE_API_KEY", hosted.apiKey],
92894
- ["SL_ENABLED", hosted.slEnabled ? "true" : "false"]
92895
- ];
92896
- const assignments = candidates.filter(([, value]) => value !== "");
92897
- withFsErrorTag(
92898
- () => fs15.writeFileSync(
92899
- envPath,
92900
- upsertEnvAssignments(existingContent, assignments)
92901
- )
92902
- );
92903
- }
92904
- function upsertEnvAssignments(content, assignments) {
92905
- const pending = new Map(
92906
- assignments.map(([key, value]) => [key, value])
92907
- );
92908
- const lines = content === "" ? [] : content.split("\n");
92909
- const rewritten = lines.map((line) => {
92910
- const key = ENV_ASSIGNMENT_RE.exec(line)?.[1];
92911
- const value = key === void 0 ? void 0 : pending.get(key);
92912
- if (key !== void 0 && value !== void 0) {
92913
- pending.delete(key);
92914
- return `${key}=${value}`;
92915
- }
92916
- return line;
92917
- });
92918
- const toAppend = assignments.filter(([key]) => pending.has(key)).map(([key, value]) => `${key}=${value}`);
92919
- if (toAppend.length === 0) {
92920
- return ensureTrailingNewline(rewritten.join("\n"));
92921
- }
92922
- const body = ensureTrailingNewline(rewritten.join("\n"));
92923
- const separator = body === "" ? "" : "\n";
92924
- return `${body}${separator}${HOSTED_ENV_HEADER}
92925
- ${toAppend.join("\n")}
92926
- `;
92927
- }
92928
- function ensureTrailingNewline(value) {
92929
- if (value === "") {
92930
- return "";
92931
- }
92932
- return value.endsWith("\n") ? value : `${value}
92933
- `;
92934
- }
92935
- var DEV_INFRA_SCRIPT_PATH, HOSTED_ENV_HEADER, ENV_ASSIGNMENT_RE;
92936
- var init_intelligence_activation = __esm({
92937
- "apps/cli/src/services/intelligence-activation.ts"() {
92938
- "use strict";
92939
- init_config();
92940
- init_vendor_key_predicate();
92941
- init_event_properties();
92942
- DEV_INFRA_SCRIPT_PATH = "scripts/copilotkit-dev-infra.mjs";
92943
- HOSTED_ENV_HEADER = "# CopilotKit Intelligence (managed service) \u2014 hosted credentials written by `copilotkit init`.\n# Swap these by editing the values here or exporting the matching env vars before `npm run dev`.";
92944
- ENV_ASSIGNMENT_RE = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=/;
92945
- }
92946
- });
92947
-
92948
93202
  // apps/cli/src/services/install-dependencies.ts
92949
93203
  import { spawn as spawn3 } from "node:child_process";
92950
93204
  import { StringDecoder } from "node:string_decoder";
@@ -93021,9 +93275,9 @@ var init_vendor_env_keys = __esm({
93021
93275
  // apps/cli/src/ui/init-flow.tsx
93022
93276
  function validateName(name) {
93023
93277
  if (name.length === 0)
93024
- return "Project name is required.";
93278
+ return "App name is required.";
93025
93279
  if (name.length > 30)
93026
- return "Project name must be 30 characters or fewer.";
93280
+ return "App name must be 30 characters or fewer.";
93027
93281
  if (DISALLOWED_NAME_CHAR_RE.test(name))
93028
93282
  return NAME_PATTERN_MESSAGE;
93029
93283
  if (name.startsWith("-") || name.endsWith("-"))
@@ -93105,30 +93359,30 @@ function InitFlow({
93105
93359
  const frameworkChoices = initialIntelligence === true ? FRAMEWORK_CHOICES.filter(
93106
93360
  (choice) => THREADS_FRAMEWORKS.has(choice.value)
93107
93361
  ) : FRAMEWORK_CHOICES;
93108
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", children: [
93109
- step === "name" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", children: [
93110
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { bold: true, children: "Project name" }),
93111
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: "gray", children: "Lowercase letters, numbers, hyphens \u2014 max 30 chars" }),
93112
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { children: [
93113
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { children: [
93362
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", children: [
93363
+ step === "name" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", children: [
93364
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { bold: true, children: "App name" }),
93365
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: "Names your new app and its folder \u2014 lowercase, numbers, hyphens, max 30" }),
93366
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { children: [
93367
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { children: [
93114
93368
  ">",
93115
93369
  " "
93116
93370
  ] }),
93117
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
93371
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
93118
93372
  build_default,
93119
93373
  {
93120
93374
  value: name,
93121
93375
  onChange: setName,
93122
93376
  onSubmit: handleNameSubmit,
93123
- placeholder: "my-project"
93377
+ placeholder: "my-app"
93124
93378
  }
93125
93379
  )
93126
93380
  ] }),
93127
- nameError !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: "red", children: nameError })
93381
+ nameError !== null && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: "red", children: nameError })
93128
93382
  ] }),
93129
- step === "framework" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", children: [
93130
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { bold: true, children: "Select agent framework" }),
93131
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
93383
+ step === "framework" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", children: [
93384
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { bold: true, children: "Select agent framework" }),
93385
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
93132
93386
  SelectInput_default,
93133
93387
  {
93134
93388
  items: frameworkChoices,
@@ -93138,7 +93392,7 @@ function InitFlow({
93138
93392
  ] })
93139
93393
  ] });
93140
93394
  }
93141
- var import_react39, import_jsx_runtime10, DISALLOWED_NAME_CHAR_RE, NAME_PATTERN_MESSAGE;
93395
+ var import_react39, import_jsx_runtime11, DISALLOWED_NAME_CHAR_RE, NAME_PATTERN_MESSAGE;
93142
93396
  var init_init_flow = __esm({
93143
93397
  async "apps/cli/src/ui/init-flow.tsx"() {
93144
93398
  "use strict";
@@ -93147,12 +93401,48 @@ var init_init_flow = __esm({
93147
93401
  await init_build3();
93148
93402
  await init_build4();
93149
93403
  init_types();
93150
- import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
93404
+ import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
93151
93405
  DISALLOWED_NAME_CHAR_RE = /[^a-z0-9-]/;
93152
93406
  NAME_PATTERN_MESSAGE = "Use only lowercase letters, numbers, and hyphens, and do not start or end with a hyphen.";
93153
93407
  }
93154
93408
  });
93155
93409
 
93410
+ // apps/cli/src/services/intelligence-readme.ts
93411
+ import * as fs16 from "node:fs";
93412
+ import * as path13 from "node:path";
93413
+ function buildSection(projectSlug) {
93414
+ return `${INTELLIGENCE_README_HEADING}
93415
+
93416
+ This app is connected to the CopilotKit Intelligence project **${projectSlug}**
93417
+ (recorded in \`.copilotkit/project.json\`). Intelligence adds durable threads,
93418
+ message & event persistence, and analytics for your agent.
93419
+
93420
+ - **License:** a token is stored as \`COPILOTKIT_LICENSE_TOKEN\` in your \`.env\`.
93421
+ - **Switch project:** run \`copilotkit project select\` from this directory.
93422
+ - **Run it:** follow "Getting Started" above \u2014 install dependencies, set your
93423
+ keys in \`.env\`, then \`npm run dev\`.
93424
+
93425
+ Learn more at https://docs.copilotkit.ai.
93426
+ `;
93427
+ }
93428
+ function appendIntelligenceReadme(dir, opts) {
93429
+ const readmePath = path13.join(dir, "README.md");
93430
+ const existing = fs16.existsSync(readmePath) ? fs16.readFileSync(readmePath, "utf8") : "";
93431
+ if (existing.includes(INTELLIGENCE_README_HEADING)) {
93432
+ return;
93433
+ }
93434
+ const section = buildSection(opts.projectSlug);
93435
+ const prefix = existing.length === 0 ? "" : existing.endsWith("\n") ? "\n" : "\n\n";
93436
+ fs16.writeFileSync(readmePath, existing + prefix + section);
93437
+ }
93438
+ var INTELLIGENCE_README_HEADING;
93439
+ var init_intelligence_readme = __esm({
93440
+ "apps/cli/src/services/intelligence-readme.ts"() {
93441
+ "use strict";
93442
+ INTELLIGENCE_README_HEADING = "## CopilotKit Intelligence";
93443
+ }
93444
+ });
93445
+
93156
93446
  // apps/cli/src/commands/init.tsx
93157
93447
  var init_exports = {};
93158
93448
  __export(init_exports, {
@@ -93172,11 +93462,11 @@ __export(init_exports, {
93172
93462
  import {
93173
93463
  accessSync,
93174
93464
  constants as constants2,
93175
- existsSync as existsSync6,
93176
- readFileSync as readFileSync5,
93465
+ existsSync as existsSync7,
93466
+ readFileSync as readFileSync6,
93177
93467
  rmSync as rmSync3
93178
93468
  } from "node:fs";
93179
- import * as path13 from "node:path";
93469
+ import * as path14 from "node:path";
93180
93470
  import { execSync as execSync2 } from "node:child_process";
93181
93471
  function shouldRenderInitBrowserLoginConfirmation(phase) {
93182
93472
  return phase === "confirming" || phase === "waiting" || phase === "finalizing";
@@ -93193,12 +93483,12 @@ async function initGit(projectDir) {
93193
93483
  function commandExists(command, environment = process.env, platform3 = process.platform) {
93194
93484
  const pathValue = environment.PATH ?? "";
93195
93485
  const pathExtensions = platform3 === "win32" ? (environment.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean) : [""];
93196
- for (const searchPath of pathValue.split(path13.delimiter)) {
93486
+ for (const searchPath of pathValue.split(path14.delimiter)) {
93197
93487
  if (!searchPath) {
93198
93488
  continue;
93199
93489
  }
93200
93490
  for (const extension of pathExtensions) {
93201
- const candidatePath = path13.join(searchPath, `${command}${extension}`);
93491
+ const candidatePath = path14.join(searchPath, `${command}${extension}`);
93202
93492
  try {
93203
93493
  accessSync(candidatePath, constants2.X_OK);
93204
93494
  return true;
@@ -93225,34 +93515,49 @@ function buildInitNextSteps(templateDefinition, projectName, result, unsatisfied
93225
93515
  const runtimeMissing = missingPrerequisites.filter(
93226
93516
  (p) => p.phase === "runtime"
93227
93517
  );
93228
- const steps = [`Directory: ${result.projectDir}`];
93518
+ const SEP2 = ": ";
93519
+ const steps = [];
93229
93520
  for (const prerequisite of missingPrerequisites) {
93230
- steps.push(`Missing ${prerequisite.label}: ${prerequisite.installHint}`);
93231
- }
93232
- for (const envNote of envNotes) {
93233
- steps.push(envNote);
93234
- }
93235
- for (const { requirement } of unsatisfiedKeys) {
93236
- steps.push(`Set ${requirement.key} before running: ${requirement.note}`);
93237
- steps.push(` Get a key: ${requirement.url}`);
93238
- steps.push(` Add to .env: ${requirement.key}=${requirement.example}`);
93521
+ steps.push({
93522
+ text: `Missing ${prerequisite.label}: ${prerequisite.installHint}`
93523
+ });
93239
93524
  }
93240
- let header = "Run these commands:";
93525
+ let header = "Here's how to get it running:";
93241
93526
  if (setupMissing.length > 0) {
93242
- header = "After installing setup prerequisites, run:";
93527
+ header = "Once those are installed, here's how to get it running:";
93243
93528
  } else if (runtimeMissing.length > 0) {
93244
- header = "After runtime prerequisites are ready, run:";
93529
+ header = "Once those are ready, here's how to get it running:";
93245
93530
  }
93246
- steps.push(header);
93247
- steps.push(` cd ${projectName}`);
93531
+ steps.push({ text: header });
93532
+ steps.push({
93533
+ text: ` Move into your new app${SEP2}`,
93534
+ code: `cd ${projectName}`
93535
+ });
93248
93536
  if (!installAlreadyRan) {
93249
- steps.push(` ${templateDefinition.installCommand}`);
93537
+ steps.push({
93538
+ text: ` Install the dependencies${SEP2}`,
93539
+ code: templateDefinition.installCommand
93540
+ });
93250
93541
  }
93251
93542
  for (const postInstallCommand of templateDefinition.postInstallCommands ?? []) {
93252
93543
  const formatted = postInstallCommand.startsWith("cd ") ? `(${postInstallCommand})` : postInstallCommand;
93253
- steps.push(` ${formatted}`);
93544
+ steps.push({ text: ` ${formatted}` });
93545
+ }
93546
+ for (const envNote of envNotes) {
93547
+ steps.push({ text: ` ${envNote}` });
93548
+ }
93549
+ for (const { requirement } of unsatisfiedKeys) {
93550
+ steps.push({ text: ` Set ${requirement.key} in .env:` });
93551
+ steps.push({ text: ` Get a key${SEP2}`, code: requirement.url });
93552
+ steps.push({
93553
+ text: ` Add the line${SEP2}`,
93554
+ code: `${requirement.key}=${requirement.example}`
93555
+ });
93254
93556
  }
93255
- steps.push(` ${templateDefinition.runCommand}`);
93557
+ steps.push({
93558
+ text: ` Start the dev server${SEP2}`,
93559
+ code: templateDefinition.runCommand
93560
+ });
93256
93561
  return steps;
93257
93562
  }
93258
93563
  async function ensureCliToken2(dependencies, onTerminalSessionInvalidation, onBrowserOpened, onAuthGateViewed) {
@@ -93359,7 +93664,8 @@ async function scaffoldInitProject(options, dependencies = defaultInitScaffoldDe
93359
93664
  );
93360
93665
  cliToken = ensuredToken;
93361
93666
  telemetry?.onAuthCompleted({ framework, alreadyAuthenticated });
93362
- const projectDirExistedBefore = existsSync6(projectDir);
93667
+ const projectDirExistedBefore = existsSync7(projectDir);
93668
+ let hostedConfig;
93363
93669
  try {
93364
93670
  onPhaseChange?.("scaffold");
93365
93671
  telemetry?.onScaffoldStarted({ framework });
@@ -93373,11 +93679,11 @@ async function scaffoldInitProject(options, dependencies = defaultInitScaffoldDe
93373
93679
  const envCreatedFromExample = dependencies.copyEnvExample(projectDir);
93374
93680
  if (templateDefinition.includesThreads) {
93375
93681
  onPhaseChange?.("activate-intelligence");
93376
- const hosted = dependencies.resolveHostedScaffoldConfig();
93682
+ hostedConfig = dependencies.resolveHostedScaffoldConfig();
93377
93683
  dependencies.activateIntelligence({
93378
93684
  projectDir,
93379
93685
  vendorEnvKeys: resolveVendorEnvKeys(templateDefinition),
93380
- ...hosted ? { hosted } : {}
93686
+ ...hostedConfig ? { hosted: hostedConfig } : {}
93381
93687
  });
93382
93688
  }
93383
93689
  onPhaseChange?.("git");
@@ -93385,7 +93691,7 @@ async function scaffoldInitProject(options, dependencies = defaultInitScaffoldDe
93385
93691
  await dependencies.initGit(projectDir);
93386
93692
  } catch {
93387
93693
  process.stderr.write(
93388
- "Warning: could not initialize git in the new project; scaffolding completed without an initial commit.\n"
93694
+ "Warning: could not initialize git in the new app; scaffolding completed without an initial commit.\n"
93389
93695
  );
93390
93696
  }
93391
93697
  if (!templateDefinition.provisionLicense) {
@@ -93419,6 +93725,7 @@ async function scaffoldInitProject(options, dependencies = defaultInitScaffoldDe
93419
93725
  );
93420
93726
  dependencies.writeLicenseKey(projectDir, licenseKey);
93421
93727
  licenseWritten = true;
93728
+ const warnings = [];
93422
93729
  if (templateDefinition.includesThreads) {
93423
93730
  onPhaseChange?.("select-project");
93424
93731
  try {
@@ -93428,11 +93735,39 @@ async function scaffoldInitProject(options, dependencies = defaultInitScaffoldDe
93428
93735
  projectSlug: selection.projectSlug,
93429
93736
  clerkOrgId: selection.organizationId
93430
93737
  });
93738
+ dependencies.appendIntelligenceReadme(projectDir, {
93739
+ projectSlug: selection.projectSlug
93740
+ });
93741
+ if (hostedConfig) {
93742
+ try {
93743
+ const apiClient = dependencies.createApiClient(
93744
+ dependencies.getOpsApiUrl(),
93745
+ cliToken ?? ""
93746
+ );
93747
+ const { apiKey } = await apiClient.provisionApiKey(
93748
+ selection.projectId
93749
+ );
93750
+ dependencies.writeHostedApiKey(projectDir, apiKey.token);
93751
+ } catch (provisionError) {
93752
+ const detail = provisionError instanceof Error ? provisionError.message : String(provisionError);
93753
+ warnings.push(
93754
+ `Could not provision a project-scoped API key (${detail}); no INTELLIGENCE_API_KEY was written. Re-run \`copilotkit project select\` in the project, or set INTELLIGENCE_API_KEY manually, before running the app.`
93755
+ );
93756
+ writeCliLog("error", {
93757
+ event: "init.provision_api_key_failed",
93758
+ detail
93759
+ });
93760
+ }
93761
+ }
93431
93762
  } catch (selectionError) {
93432
- process.stderr.write(
93433
- `Project not selected (${selectionError instanceof Error ? selectionError.message : String(selectionError)}); run \`copilotkit project select\` in the project to choose one.
93434
- `
93763
+ const detail = selectionError instanceof Error ? selectionError.message : String(selectionError);
93764
+ warnings.push(
93765
+ `Project not selected (${detail}); run \`copilotkit project select\` in the project to choose one.`
93435
93766
  );
93767
+ writeCliLog("error", {
93768
+ event: "init.project_select_failed",
93769
+ detail
93770
+ });
93436
93771
  }
93437
93772
  }
93438
93773
  telemetry?.onScaffoldSucceeded({ framework, telemetryId });
@@ -93440,7 +93775,8 @@ async function scaffoldInitProject(options, dependencies = defaultInitScaffoldDe
93440
93775
  projectDir,
93441
93776
  envCreatedFromExample,
93442
93777
  licenseWritten,
93443
- missingPrerequisites
93778
+ missingPrerequisites,
93779
+ warnings
93444
93780
  };
93445
93781
  } catch (error48) {
93446
93782
  if (!projectDirExistedBefore) {
@@ -93471,6 +93807,7 @@ function ScaffoldProgress({
93471
93807
  const scaffoldErrorRef = (0, import_react40.useRef)(null);
93472
93808
  const [authMessage, setAuthMessage] = (0, import_react40.useState)("");
93473
93809
  const [nextSteps, setNextSteps] = (0, import_react40.useState)([]);
93810
+ const [scaffoldWarnings, setScaffoldWarnings] = (0, import_react40.useState)([]);
93474
93811
  const [scaffoldResult, setScaffoldResult] = (0, import_react40.useState)(null);
93475
93812
  const [installError, setInstallError] = (0, import_react40.useState)(null);
93476
93813
  const isMountedRef = (0, import_react40.useRef)(true);
@@ -93498,8 +93835,13 @@ function ScaffoldProgress({
93498
93835
  );
93499
93836
  (0, import_react40.useEffect)(() => {
93500
93837
  if (phase === "success" || phase === "error") {
93501
- exit(resolveScaffoldExitError(phase, scaffoldErrorRef.current));
93838
+ const flushThenExit = setTimeout(
93839
+ () => exit(resolveScaffoldExitError(phase, scaffoldErrorRef.current)),
93840
+ 100
93841
+ );
93842
+ return () => clearTimeout(flushThenExit);
93502
93843
  }
93844
+ return void 0;
93503
93845
  }, [phase, exit]);
93504
93846
  (0, import_react40.useEffect)(
93505
93847
  () => () => {
@@ -93563,39 +93905,47 @@ function ScaffoldProgress({
93563
93905
  installAlreadyRan
93564
93906
  )
93565
93907
  );
93908
+ setScaffoldWarnings(result.warnings ?? []);
93566
93909
  setPhase("success");
93567
93910
  }
93568
93911
  if (shouldRenderInitBrowserLoginConfirmation(browserLogin.state.phase)) {
93569
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(BrowserLoginConfirmation, { reason: authReason });
93912
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BrowserLoginConfirmation, { reason: authReason });
93570
93913
  }
93571
93914
  if (phase === "auth") {
93572
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", children: [
93573
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
93574
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { children: authReason }),
93575
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: "gray", children: "Sign in with your browser to continue." })
93915
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", children: [
93916
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
93917
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { children: authReason }),
93918
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { dimColor: true, children: "Sign in with your browser to continue." })
93576
93919
  ] }),
93577
- authMessage ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: "yellow", children: authMessage }) : null,
93578
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Spinner, { label: "\u{1FA81} Verifying authentication\u2026" })
93920
+ authMessage ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { color: "yellow", children: authMessage }) : null,
93921
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Spinner, { label: "\u{1FA81} Verifying authentication\u2026" })
93579
93922
  ] });
93580
93923
  }
93581
93924
  if (phase === "license") {
93582
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", children: [
93583
- authMessage ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: "yellow", children: authMessage }) : null,
93584
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Spinner, { label: "\u{1FA81} Issuing license key\u2026" })
93925
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", children: [
93926
+ authMessage ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { color: "yellow", children: authMessage }) : null,
93927
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Spinner, { label: "\u{1FA81} Issuing license key\u2026" })
93585
93928
  ] });
93586
93929
  }
93587
93930
  if (phase === "scaffold") {
93588
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Spinner, { label: "\u{1FA81} Downloading template\u2026" }) });
93931
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Spinner, { label: "\u{1FA81} Downloading template\u2026" }) });
93589
93932
  }
93590
93933
  if (phase === "select-project") {
93591
93934
  const auth = authStore.get();
93592
93935
  if (auth === null) {
93593
93936
  return null;
93594
93937
  }
93595
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
93938
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
93596
93939
  HostedProjectSelect,
93597
93940
  {
93598
93941
  apiClient: createApiClient(getOpsApiUrl(), auth.cliToken),
93942
+ defaultName: options.name,
93943
+ telemetry: {
93944
+ onPickerViewed: (projectCount) => telemetry?.onProjectPickerViewed({ projectCount }),
93945
+ onResolved: (outcome, projectCount) => telemetry?.onProjectResolved({ outcome, projectCount }),
93946
+ onCreateNameRejected: (reason) => telemetry?.onProjectCreateNameRejected({ reason }),
93947
+ onBack: () => telemetry?.onProjectPickerBack()
93948
+ },
93599
93949
  onResolved: (selection) => selectionDeferredRef.current?.resolve(selection),
93600
93950
  onCanceled: () => selectionDeferredRef.current?.reject(
93601
93951
  new Error("Project selection canceled.")
@@ -93605,13 +93955,13 @@ function ScaffoldProgress({
93605
93955
  );
93606
93956
  }
93607
93957
  if (phase === "activate-intelligence") {
93608
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Spinner, { label: "\u{1FA81} Activating Intelligence\u2026" }) });
93958
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Spinner, { label: "\u{1FA81} Activating Intelligence\u2026" }) });
93609
93959
  }
93610
93960
  if (phase === "git") {
93611
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Spinner, { label: "Initializing git repository\u2026" }) });
93961
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Spinner, { label: "Initializing git repository\u2026" }) });
93612
93962
  }
93613
93963
  if (phase === "install-prompt" && scaffoldResult) {
93614
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
93964
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
93615
93965
  InstallPrompt,
93616
93966
  {
93617
93967
  installCommand: templateDefinition.installCommand,
@@ -93646,17 +93996,16 @@ function ScaffoldProgress({
93646
93996
  );
93647
93997
  }
93648
93998
  if (phase === "installing") {
93649
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Spinner, { label: "\u{1FA81} Installing dependencies\u2026" });
93999
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Spinner, { label: "\u{1FA81} Installing dependencies\u2026" });
93650
94000
  }
93651
94001
  if (phase === "success") {
93652
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", children: [
93653
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { color: "green", children: [
93654
- templateDefinition.successEmoji,
93655
- ' Project "',
94002
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", children: [
94003
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(SuccessText, { marker: templateDefinition.successEmoji, children: [
94004
+ 'App "',
93656
94005
  options.name,
93657
94006
  '" created successfully!'
93658
94007
  ] }),
93659
- installError ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { color: "yellow", children: [
94008
+ installError ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { color: "yellow", children: [
93660
94009
  "Install didn't finish (",
93661
94010
  installError.split("\n").slice(-1)[0],
93662
94011
  "). Run",
@@ -93664,13 +94013,34 @@ function ScaffoldProgress({
93664
94013
  templateDefinition.installCommand,
93665
94014
  " yourself."
93666
94015
  ] }) : null,
93667
- nextSteps.map((step, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: "gray", children: step }, `step-${index}`))
94016
+ scaffoldWarnings.map((warning, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { color: "yellow", children: [
94017
+ "\u26A0 ",
94018
+ warning
94019
+ ] }, `warn-${index}`)),
94020
+ nextSteps.map((step, index) => (
94021
+ // The builder hands us the split already: `text` is friendly prose
94022
+ // and the optional `code` tail is the command/value, emphasized like
94023
+ // inline code in markdown/Slack. Both render on the terminal's
94024
+ // inherited default foreground (no absolute color) so they stay
94025
+ // legible on both light and dark terminals — an absolute accent (cyan,
94026
+ // white) washes out on one background or the other. The `code` tail is
94027
+ // `bold` to stand out from prose; prose-only lines (headings, notes)
94028
+ // carry no `code`.
94029
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { children: [
94030
+ step.text,
94031
+ step.code !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { bold: true, children: step.code }) : null
94032
+ ] }, `step-${index}`)
94033
+ )),
94034
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { children: " " })
93668
94035
  ] });
93669
94036
  }
93670
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { color: "red", children: [
93671
- "Init failed: ",
93672
- errorMessage
93673
- ] }) });
94037
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", children: [
94038
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { color: "red", children: [
94039
+ "Init failed: ",
94040
+ errorMessage
94041
+ ] }),
94042
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { children: " " })
94043
+ ] });
93674
94044
  }
93675
94045
  function InstallPrompt({
93676
94046
  installCommand,
@@ -93688,14 +94058,16 @@ function InstallPrompt({
93688
94058
  onAnswer(false);
93689
94059
  }
93690
94060
  });
93691
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { children: [
93692
- "Install dependencies now? (",
94061
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { children: [
94062
+ "Want me to install the dependencies for you now? (",
93693
94063
  installCommand,
93694
- ") [Y/n]"
94064
+ ")",
94065
+ " ",
94066
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { bold: true, children: "[Y/n]" })
93695
94067
  ] }) });
93696
94068
  }
93697
94069
  function renderDefaultScaffoldProgress(options, telemetry) {
93698
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ScaffoldProgress, { options, telemetry });
94070
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ScaffoldProgress, { options, telemetry });
93699
94071
  }
93700
94072
  function resolvePrefilledOptions(name, intelligence, framework) {
93701
94073
  if (name === null)
@@ -93743,13 +94115,13 @@ function InitApp({
93743
94115
  }
93744
94116
  }
93745
94117
  }, []);
93746
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", children: [
93747
- !noBanner && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
93748
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Banner, {}),
93749
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IntelligenceFeatures, {})
94118
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", children: [
94119
+ !noBanner && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
94120
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Banner, {}),
94121
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IntelligenceFeatures, {})
93750
94122
  ] }),
93751
- options !== null ? renderScaffoldProgress(options, telemetry) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
93752
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
94123
+ options !== null ? renderScaffoldProgress(options, telemetry) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
94124
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
93753
94125
  InitFlow,
93754
94126
  {
93755
94127
  initialName,
@@ -93764,7 +94136,7 @@ function InitApp({
93764
94136
  }
93765
94137
  }
93766
94138
  ),
93767
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CliTip, {})
94139
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CliTip, {})
93768
94140
  ] })
93769
94141
  ] });
93770
94142
  }
@@ -93788,7 +94160,7 @@ async function runInit(flags, callbacks) {
93788
94160
  }
93789
94161
  const initialFramework = frameworkFlag;
93790
94162
  const { waitUntilExit } = render_default(
93791
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(BrowserLoginProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
94163
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BrowserLoginProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
93792
94164
  InitApp,
93793
94165
  {
93794
94166
  initialName,
@@ -93803,7 +94175,7 @@ async function runInit(flags, callbacks) {
93803
94175
  );
93804
94176
  await waitUntilExit();
93805
94177
  }
93806
- var import_react40, import_jsx_runtime11, PROJECT_CREATION_AUTH_HANDOFF, INIT_AUTH_REASON_WITH_LICENSE, INIT_AUTH_REASON_ACCOUNT_ONLY, defaultInitScaffoldDependencies;
94178
+ var import_react40, import_jsx_runtime12, PROJECT_CREATION_AUTH_HANDOFF, INIT_AUTH_REASON_WITH_LICENSE, INIT_AUTH_REASON_ACCOUNT_ONLY, defaultInitScaffoldDependencies;
93807
94179
  var init_init = __esm({
93808
94180
  async "apps/cli/src/commands/init.tsx"() {
93809
94181
  "use strict";
@@ -93819,21 +94191,24 @@ var init_init = __esm({
93819
94191
  init_vendor_env_keys();
93820
94192
  init_config_service();
93821
94193
  init_event_properties();
94194
+ init_cli_logs();
93822
94195
  await init_banner();
93823
94196
  await init_browser_login();
93824
94197
  await init_cli_tip();
93825
94198
  await init_init_flow();
93826
94199
  await init_spinner();
94200
+ await init_success_text();
93827
94201
  init_config();
93828
94202
  await init_hosted_project_select();
93829
94203
  init_project_config();
93830
- import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
94204
+ init_intelligence_readme();
94205
+ import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
93831
94206
  PROJECT_CREATION_AUTH_HANDOFF = {
93832
94207
  source: "cli",
93833
94208
  mode: "project_creation"
93834
94209
  };
93835
94210
  INIT_AUTH_REASON_WITH_LICENSE = "Threads and other Intelligence features need a free license, which is issued to your CopilotKit account.";
93836
- INIT_AUTH_REASON_ACCOUNT_ONLY = "A free CopilotKit account is required to link this project.";
94211
+ INIT_AUTH_REASON_ACCOUNT_ONLY = "A free CopilotKit account is required to link this app.";
93837
94212
  defaultInitScaffoldDependencies = {
93838
94213
  verifyAndRefresh,
93839
94214
  login,
@@ -93845,12 +94220,12 @@ var init_init = __esm({
93845
94220
  copyEnvExample,
93846
94221
  writeLicenseKey,
93847
94222
  commandExists,
93848
- resolveProjectDir: (projectName) => path13.resolve(process.cwd(), projectName),
94223
+ resolveProjectDir: (projectName) => path14.resolve(process.cwd(), projectName),
93849
94224
  activateIntelligence,
93850
94225
  installDependencies,
93851
94226
  readProjectEnvFile: (projectDir) => {
93852
- const envPath = path13.join(projectDir, ".env");
93853
- return existsSync6(envPath) ? readFileSync5(envPath, "utf8") : "";
94227
+ const envPath = path14.join(projectDir, ".env");
94228
+ return existsSync7(envPath) ? readFileSync6(envPath, "utf8") : "";
93854
94229
  },
93855
94230
  resolveHostedScaffoldConfig,
93856
94231
  selectHostedProject: () => {
@@ -93858,7 +94233,9 @@ var init_init = __esm({
93858
94233
  "selectHostedProject must be provided by the interactive init shell."
93859
94234
  );
93860
94235
  },
93861
- writeProjectConfig
94236
+ writeProjectConfig,
94237
+ appendIntelligenceReadme,
94238
+ writeHostedApiKey
93862
94239
  };
93863
94240
  }
93864
94241
  });
@@ -93899,15 +94276,15 @@ function LoginFlow({ onComplete }) {
93899
94276
  onComplete({ error: fallbackError, success: false });
93900
94277
  });
93901
94278
  }, [onComplete, runLogin2]);
93902
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BrowserLoginConfirmation, {});
94279
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BrowserLoginConfirmation, {});
93903
94280
  }
93904
- var import_react41, import_jsx_runtime12;
94281
+ var import_react41, import_jsx_runtime13;
93905
94282
  var init_login_flow = __esm({
93906
94283
  async "apps/cli/src/ui/login-flow.tsx"() {
93907
94284
  "use strict";
93908
94285
  import_react41 = __toESM(require_react(), 1);
93909
94286
  await init_browser_login();
93910
- import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
94287
+ import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
93911
94288
  }
93912
94289
  });
93913
94290
 
@@ -93919,7 +94296,7 @@ __export(login_exports, {
93919
94296
  async function runLogin() {
93920
94297
  return await new Promise((resolve2, reject) => {
93921
94298
  const { unmount } = render_default(
93922
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BrowserLoginProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
94299
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(BrowserLoginProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
93923
94300
  LoginFlow,
93924
94301
  {
93925
94302
  onComplete: (result) => {
@@ -93937,14 +94314,14 @@ async function runLogin() {
93937
94314
  );
93938
94315
  });
93939
94316
  }
93940
- var import_jsx_runtime13;
94317
+ var import_jsx_runtime14;
93941
94318
  var init_login = __esm({
93942
94319
  async "apps/cli/src/commands/login.tsx"() {
93943
94320
  "use strict";
93944
94321
  await init_build2();
93945
94322
  await init_login_flow();
93946
94323
  await init_browser_login();
93947
- import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
94324
+ import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
93948
94325
  }
93949
94326
  });
93950
94327
 
@@ -94195,16 +94572,16 @@ function KiteGame({
94195
94572
  setState((currentState) => flapKite(currentState));
94196
94573
  }
94197
94574
  });
94198
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Box_default, { flexDirection: "column", children: [
94199
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Text, { children: [
94575
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { flexDirection: "column", children: [
94576
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text, { children: [
94200
94577
  "CopilotKit Kite Score ",
94201
94578
  state.score,
94202
94579
  " High",
94203
94580
  " ",
94204
94581
  Math.max(highScore, state.score)
94205
94582
  ] }),
94206
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Box_default, { flexDirection: "column", borderStyle: "single", children: rows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { children: row }, `${index}-${row}`)) }),
94207
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { children: state.crashed ? "Crashed. Enter/r to reset. Space to restart. q/Esc to quit." : state.started ? "Space/up to send wind. q/Esc to quit." : "Ready. Space/up to start. q/Esc to quit." })
94583
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box_default, { flexDirection: "column", borderStyle: "single", children: rows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { children: row }, `${index}-${row}`)) }),
94584
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { children: state.crashed ? "Crashed. Enter/r to reset. Space to restart. q/Esc to quit." : state.started ? "Space/up to send wind. q/Esc to quit." : "Ready. Space/up to start. q/Esc to quit." })
94208
94585
  ] });
94209
94586
  }
94210
94587
  function useTerminalWidth(stdout) {
@@ -94228,7 +94605,7 @@ function getStdoutColumns(stdout) {
94228
94605
  function getPlayableWidth(terminalWidth) {
94229
94606
  return Math.max(MIN_PLAYABLE_WIDTH, terminalWidth - BORDER_COLUMNS);
94230
94607
  }
94231
- var import_react42, import_jsx_runtime14, DEFAULT_TICK_MS, MIN_PLAYABLE_WIDTH, BORDER_COLUMNS;
94608
+ var import_react42, import_jsx_runtime15, DEFAULT_TICK_MS, MIN_PLAYABLE_WIDTH, BORDER_COLUMNS;
94232
94609
  var init_kite_game = __esm({
94233
94610
  async "apps/cli/src/ui/kite-game.tsx"() {
94234
94611
  "use strict";
@@ -94236,7 +94613,7 @@ var init_kite_game = __esm({
94236
94613
  import_react42 = __toESM(require_react(), 1);
94237
94614
  init_kite_game_engine();
94238
94615
  init_kite_game_score();
94239
- import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
94616
+ import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
94240
94617
  DEFAULT_TICK_MS = 75;
94241
94618
  MIN_PLAYABLE_WIDTH = 32;
94242
94619
  BORDER_COLUMNS = 2;
@@ -94250,19 +94627,19 @@ __export(kite_exports, {
94250
94627
  });
94251
94628
  async function runKite() {
94252
94629
  return await new Promise((resolve2, reject) => {
94253
- const { waitUntilExit } = render_default(/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(KiteGame, { onExit: resolve2 }));
94630
+ const { waitUntilExit } = render_default(/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(KiteGame, { onExit: resolve2 }));
94254
94631
  waitUntilExit().then(() => {
94255
94632
  resolve2();
94256
94633
  }).catch(reject);
94257
94634
  });
94258
94635
  }
94259
- var import_jsx_runtime15;
94636
+ var import_jsx_runtime16;
94260
94637
  var init_kite = __esm({
94261
94638
  async "apps/cli/src/commands/kite.tsx"() {
94262
94639
  "use strict";
94263
94640
  await init_build2();
94264
94641
  await init_kite_game();
94265
- import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
94642
+ import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
94266
94643
  }
94267
94644
  });
94268
94645
 
@@ -94272,7 +94649,7 @@ init_types();
94272
94649
  await init_telemetry();
94273
94650
  import { parseArgs } from "node:util";
94274
94651
  import { realpathSync } from "node:fs";
94275
- import path14 from "node:path";
94652
+ import path15 from "node:path";
94276
94653
  import { fileURLToPath as fileURLToPath2 } from "node:url";
94277
94654
 
94278
94655
  // apps/cli/src/services/telemetry/init-events.ts
@@ -94344,6 +94721,34 @@ function buildScaffoldSucceededEvent(input) {
94344
94721
  }
94345
94722
  };
94346
94723
  }
94724
+ function buildProjectPickerViewedEvent(input) {
94725
+ return {
94726
+ event: "cli.init.project_picker_viewed",
94727
+ properties: { command: "init", project_count: input.projectCount }
94728
+ };
94729
+ }
94730
+ function buildProjectResolvedEvent(input) {
94731
+ return {
94732
+ event: "cli.init.project_resolved",
94733
+ properties: {
94734
+ command: "init",
94735
+ project_outcome: input.outcome,
94736
+ project_count: input.projectCount
94737
+ }
94738
+ };
94739
+ }
94740
+ function buildProjectCreateNameRejectedEvent(input) {
94741
+ return {
94742
+ event: "cli.init.project_create_name_rejected",
94743
+ properties: { command: "init", project_reject_reason: input.reason }
94744
+ };
94745
+ }
94746
+ function buildProjectPickerBackEvent() {
94747
+ return {
94748
+ event: "cli.init.project_picker_back",
94749
+ properties: { command: "init" }
94750
+ };
94751
+ }
94347
94752
  function createInitTelemetryCallbacks(deps) {
94348
94753
  const record2 = (event) => deps.record({
94349
94754
  ...event,
@@ -94372,6 +94777,18 @@ function createInitTelemetryCallbacks(deps) {
94372
94777
  },
94373
94778
  onScaffoldSucceeded(input) {
94374
94779
  record2(buildScaffoldSucceededEvent(input));
94780
+ },
94781
+ onProjectPickerViewed(input) {
94782
+ record2(buildProjectPickerViewedEvent(input));
94783
+ },
94784
+ onProjectResolved(input) {
94785
+ record2(buildProjectResolvedEvent(input));
94786
+ },
94787
+ onProjectCreateNameRejected(input) {
94788
+ record2(buildProjectCreateNameRejectedEvent(input));
94789
+ },
94790
+ onProjectPickerBack() {
94791
+ record2(buildProjectPickerBackEvent());
94375
94792
  }
94376
94793
  };
94377
94794
  }
@@ -94458,7 +94875,7 @@ Aliases:
94458
94875
  create Alias of init
94459
94876
 
94460
94877
  Options:
94461
- -n, --name <name> Project name
94878
+ -n, --name <name> App name (names the local app and its directory)
94462
94879
  -f, --framework <fw> Agent framework (prompted if omitted)
94463
94880
  -i, --intelligence Deprecated no-op: Intelligence (durable conversations,
94464
94881
  persistence, insights) ships with every supported
@@ -94745,7 +95162,7 @@ async function runWhoami() {
94745
95162
  `);
94746
95163
  return;
94747
95164
  }
94748
- if (error48 instanceof ApiClientError2) {
95165
+ if (error48 instanceof ApiClientError2 && error48.status > 0) {
94749
95166
  process.stdout.write(`${error48.message}
94750
95167
  `);
94751
95168
  return;
@@ -95272,7 +95689,7 @@ ${HELP_TEXT_BY_TOPIC.root}`
95272
95689
  await entry.run(commandArgv, command);
95273
95690
  }
95274
95691
  function resolveRealPath(candidatePath) {
95275
- const absolutePath = path14.resolve(candidatePath);
95692
+ const absolutePath = path15.resolve(candidatePath);
95276
95693
  try {
95277
95694
  return realpathSync.native(absolutePath);
95278
95695
  } catch {