copilotkit 3.0.4 → 4.0.1

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 +1545 -896
  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.1" : "dev",
82
+ buildNumber: true ? "27840207129" : "dev",
83
+ commitSha: true ? "e5f3dcfef0b6d5732bd9c436285eab0e650303f8" : "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
  }
@@ -1241,9 +1241,9 @@ var init_retryify_async = __esm({
1241
1241
  throw error48;
1242
1242
  if (Date.now() >= timestamp)
1243
1243
  throw error48;
1244
- const delay2 = Math.round(interval * Math.random());
1245
- if (delay2 > 0) {
1246
- const delayPromise = new Promise((resolve2) => setTimeout(resolve2, delay2));
1244
+ const delay3 = Math.round(interval * Math.random());
1245
+ if (delay3 > 0) {
1246
+ const delayPromise = new Promise((resolve2) => setTimeout(resolve2, delay3));
1247
1247
  return delayPromise.then(() => attempt.apply(void 0, args));
1248
1248
  } else {
1249
1249
  return attempt.apply(void 0, args);
@@ -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;
@@ -91418,6 +91561,21 @@ function copyEnvExample(projectDir) {
91418
91561
  }
91419
91562
  return false;
91420
91563
  }
91564
+ function removeTestHarnessArtifacts(projectDir) {
91565
+ const markerPath = path9.join(projectDir, "docker-compose.test.yml");
91566
+ if (!fs13.existsSync(markerPath)) {
91567
+ return [];
91568
+ }
91569
+ const removed = [];
91570
+ for (const artifact of TEST_HARNESS_ARTIFACTS) {
91571
+ const target = path9.join(projectDir, artifact);
91572
+ if (fs13.existsSync(target)) {
91573
+ fs13.rmSync(target, { recursive: true, force: true });
91574
+ removed.push(artifact);
91575
+ }
91576
+ }
91577
+ return removed;
91578
+ }
91421
91579
  function writeEnvLicenseKey(projectDir, licenseKey) {
91422
91580
  const envPath = path9.join(projectDir, ".env");
91423
91581
  const envExamplePath = path9.join(projectDir, ".env.example");
@@ -91462,11 +91620,18 @@ async function commitInitial(projectDir) {
91462
91620
  stdio: "pipe"
91463
91621
  });
91464
91622
  }
91465
- var LICENSE_TOKEN_LINE_RE;
91623
+ var TEST_HARNESS_ARTIFACTS, LICENSE_TOKEN_LINE_RE;
91466
91624
  var init_project_scaffold = __esm({
91467
91625
  "apps/cli/src/services/project-scaffold.ts"() {
91468
91626
  "use strict";
91469
91627
  init_event_properties();
91628
+ TEST_HARNESS_ARTIFACTS = [
91629
+ "docker",
91630
+ ".dockerignore",
91631
+ "docker-compose.test.yml",
91632
+ "Dockerfile",
91633
+ "docker-route-override.ts"
91634
+ ];
91470
91635
  LICENSE_TOKEN_LINE_RE = /^[ \t]*(?:export\s+)?COPILOTKIT_LICENSE_TOKEN=.*$/m;
91471
91636
  }
91472
91637
  });
@@ -91700,28 +91865,28 @@ function LicenseCreateApp({ onIssued }) {
91700
91865
  };
91701
91866
  }, [browserLogin.runLogin, onIssued, exit]);
91702
91867
  if (shouldRenderLicenseCreateBrowserLoginConfirmation(browserLogin.state.phase)) {
91703
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BrowserLoginConfirmation, { reason: LICENSE_AUTH_REASON });
91868
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BrowserLoginConfirmation, { reason: LICENSE_AUTH_REASON });
91704
91869
  }
91705
91870
  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." })
91871
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", children: [
91872
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
91873
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { children: LICENSE_AUTH_REASON }),
91874
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { dimColor: true, children: "Sign in with your browser to continue." })
91710
91875
  ] }),
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" })
91876
+ authMessage ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: "yellow", children: authMessage }) : null,
91877
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, { label: "Verifying authentication\u2026" })
91713
91878
  ] });
91714
91879
  }
91715
91880
  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" })
91881
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", children: [
91882
+ authMessage ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: "yellow", children: authMessage }) : null,
91883
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, { label: "Issuing license key\u2026" })
91719
91884
  ] });
91720
91885
  }
91721
91886
  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." }) });
91887
+ 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
91888
  }
91724
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: "red", children: [
91889
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: "red", children: [
91725
91890
  "License failed: ",
91726
91891
  errorMessage
91727
91892
  ] }) });
@@ -91752,7 +91917,7 @@ async function runLicense(command) {
91752
91917
  const deliveryMode = command.envWrite === "offer" ? await promptYesNo("After issuing, write the license to ./.env?") ? "write" : "print" : command.envWrite;
91753
91918
  let issuedKey = null;
91754
91919
  const { waitUntilExit } = render_default(
91755
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BrowserLoginProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LicenseCreateApp, { onIssued: (k) => {
91920
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BrowserLoginProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(LicenseCreateApp, { onIssued: (k) => {
91756
91921
  issuedKey = k;
91757
91922
  } }) }),
91758
91923
  // Render the issuance UI (spinners, "License key issued.") to stderr so
@@ -91773,7 +91938,7 @@ async function runLicense(command) {
91773
91938
  writeStderr: (text) => process.stderr.write(text)
91774
91939
  });
91775
91940
  }
91776
- var import_react36, import_jsx_runtime5, LICENSE_AUTH_REASON;
91941
+ var import_react36, import_jsx_runtime6, LICENSE_AUTH_REASON;
91777
91942
  var init_license = __esm({
91778
91943
  async "apps/cli/src/commands/license.tsx"() {
91779
91944
  "use strict";
@@ -91785,10 +91950,11 @@ var init_license = __esm({
91785
91950
  init_config_service();
91786
91951
  await init_browser_login();
91787
91952
  await init_spinner();
91953
+ await init_success_text();
91788
91954
  init_config();
91789
91955
  init_project_scaffold();
91790
91956
  init_license_delivery();
91791
- import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
91957
+ import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
91792
91958
  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
91959
  }
91794
91960
  });
@@ -91819,30 +91985,366 @@ var init_project_config = __esm({
91819
91985
  }
91820
91986
  });
91821
91987
 
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);
91988
+ // apps/cli/src/services/vendor-key-predicate.ts
91989
+ var VENDOR_KEY_PREDICATE_SOURCE, bundle, readDotenvValue, isPlaceholderValue, resolveVendorKeyValue, findUnsatisfiedVendorKeys;
91990
+ var init_vendor_key_predicate = __esm({
91991
+ "apps/cli/src/services/vendor-key-predicate.ts"() {
91992
+ "use strict";
91993
+ VENDOR_KEY_PREDICATE_SOURCE = String.raw`
91994
+ function readDotenvValue(envFileContent, key) {
91995
+ const re = new RegExp('^\\s*(?:export\\s+)?' + key + '=(.*)$', 'gm');
91996
+ let match;
91997
+ let last = null;
91998
+ while ((match = re.exec(envFileContent)) !== null) {
91999
+ last = match;
91828
92000
  }
91829
- const choice = await prompts.chooseProject(projects);
91830
- if (choice === "cancel") {
91831
- return { canceled: true };
92001
+ if (!last) {
92002
+ return '';
92003
+ }
92004
+ const raw = last[1].trim();
92005
+ if (
92006
+ raw.length >= 2 &&
92007
+ ((raw.startsWith('"') && raw.endsWith('"')) ||
92008
+ (raw.startsWith("'") && raw.endsWith("'")))
92009
+ ) {
92010
+ return raw.slice(1, -1).trim();
91832
92011
  }
91833
- if (choice === "create") {
91834
- return await createFromName(apiClient, prompts);
92012
+ if (raw.startsWith('#')) {
92013
+ return '';
92014
+ }
92015
+ return raw.replace(/\s+#.*$/, '').trim();
92016
+ }
92017
+
92018
+ function isPlaceholderValue(value) {
92019
+ return /^<.*>$/.test(value) || /^your[-_]/i.test(value) || /\.\.\.$/.test(value);
92020
+ }
92021
+
92022
+ function resolveVendorKeyValue(processEnv, envFileContent, key) {
92023
+ const fromProcess = ((processEnv && processEnv[key]) || '').trim();
92024
+ return fromProcess !== '' ? fromProcess : readDotenvValue(envFileContent, key);
92025
+ }
92026
+
92027
+ function findUnsatisfiedVendorKeys(processEnv, envFileContent, requirements) {
92028
+ return requirements
92029
+ .map((requirement) => ({
92030
+ requirement,
92031
+ value: resolveVendorKeyValue(processEnv, envFileContent, requirement.key),
92032
+ }))
92033
+ .filter(({ value }) => value === '' || isPlaceholderValue(value));
92034
+ }
92035
+ `;
92036
+ bundle = new Function(
92037
+ `${VENDOR_KEY_PREDICATE_SOURCE}
92038
+ return { readDotenvValue, isPlaceholderValue, resolveVendorKeyValue, findUnsatisfiedVendorKeys };`
92039
+ )();
92040
+ readDotenvValue = bundle.readDotenvValue;
92041
+ isPlaceholderValue = bundle.isPlaceholderValue;
92042
+ resolveVendorKeyValue = bundle.resolveVendorKeyValue;
92043
+ findUnsatisfiedVendorKeys = bundle.findUnsatisfiedVendorKeys;
92044
+ }
92045
+ });
92046
+
92047
+ // apps/cli/src/services/intelligence-activation.ts
92048
+ import * as fs15 from "node:fs";
92049
+ import * as path12 from "node:path";
92050
+ function withFsErrorTag(operation) {
92051
+ try {
92052
+ return operation();
92053
+ } catch (err) {
92054
+ if (err instanceof Error) {
92055
+ throw tagError(err, TELEMETRY_ERROR_CODES.FILESYSTEM_WRITE_FAILED);
92056
+ }
92057
+ throw err;
92058
+ }
92059
+ }
92060
+ function buildIntelligenceEnvKeys(hosted) {
92061
+ const keys = [];
92062
+ if (hosted.apiUrl !== "") {
92063
+ keys.push({ key: "INTELLIGENCE_API_URL" });
92064
+ }
92065
+ if (hosted.gatewayWsUrl !== "") {
92066
+ keys.push({ key: "INTELLIGENCE_GATEWAY_WS_URL" });
92067
+ }
92068
+ keys.push({ key: "INTELLIGENCE_API_KEY" });
92069
+ return keys;
92070
+ }
92071
+ function activateIntelligence({
92072
+ projectDir,
92073
+ vendorEnvKeys = [],
92074
+ hosted
92075
+ }) {
92076
+ const intelligenceEnvKeys = hosted ? buildIntelligenceEnvKeys(hosted) : [];
92077
+ writeDevInfraScript(projectDir, vendorEnvKeys, intelligenceEnvKeys);
92078
+ const devScriptPatched = chainDevInfraScript(projectDir);
92079
+ if (hosted) {
92080
+ writeHostedEnvBlock(projectDir, hosted);
92081
+ }
92082
+ return { devScriptPatched };
92083
+ }
92084
+ function resolveHostedScaffoldConfig() {
92085
+ const apiUrl = getHostedRuntimeUrl();
92086
+ if (apiUrl === "") {
92087
+ return void 0;
91835
92088
  }
91836
92089
  return {
91837
- projectId: choice.id,
91838
- projectSlug: choice.slug,
91839
- organizationId: choice.organizationId
92090
+ apiUrl,
92091
+ gatewayWsUrl: getHostedGatewayUrl(),
92092
+ slEnabled: getHostedSlEnabled()
91840
92093
  };
91841
92094
  }
91842
- async function createFromName(apiClient, prompts) {
91843
- const name = await prompts.promptProjectName();
91844
- if (name === null) {
91845
- return { canceled: true };
92095
+ function buildDevInfraScriptContent(vendorEnvKeys, intelligenceEnvKeys) {
92096
+ const validEnvKeyName = /^[A-Za-z_][A-Za-z0-9_]*$/;
92097
+ for (const entry of [...vendorEnvKeys, ...intelligenceEnvKeys]) {
92098
+ if (!validEnvKeyName.test(entry.key)) {
92099
+ throw new Error(
92100
+ `Env key "${entry.key}" is not a valid environment variable name; refusing to template it into the dev preflight script.`
92101
+ );
92102
+ }
92103
+ }
92104
+ const requiredEnvKeysJson = JSON.stringify(vendorEnvKeys, null, 2);
92105
+ const requiredIntelligenceKeysJson = JSON.stringify(
92106
+ intelligenceEnvKeys,
92107
+ null,
92108
+ 2
92109
+ );
92110
+ return `#!/usr/bin/env node
92111
+ // Warns about missing LLM vendor API keys and missing CopilotKit Intelligence
92112
+ // configuration before \`npm run dev\`, then lets the dev server start anyway
92113
+ // (chat/generations and Intelligence features fail until the values are set).
92114
+ // Written by \`copilotkit init\`; safe to delete if you manage env validation
92115
+ // yourself.
92116
+ import { existsSync, readFileSync } from 'node:fs';
92117
+
92118
+ /** Vendor API keys this scaffold needs before chat and generations will work. */
92119
+ const REQUIRED_ENV_KEYS = ${requiredEnvKeysJson};
92120
+
92121
+ /**
92122
+ * Hosted CopilotKit Intelligence env var NAMES this scaffold was generated with
92123
+ * (no values \u2014 those live only in .env). Empty for a non-hosted build. A
92124
+ * missing/blank value means the generated .env was overwritten.
92125
+ */
92126
+ const REQUIRED_INTELLIGENCE_KEYS = ${requiredIntelligenceKeysJson};
92127
+
92128
+ const envFileExists = existsSync('.env');
92129
+ const envFileContent = envFileExists ? readFileSync('.env', 'utf8') : '';
92130
+
92131
+ // Shared detection predicate \u2014 authored once in vendor-key-predicate.ts and
92132
+ // spliced here verbatim so the CLI pre-check (ENT-677) and this gate cannot
92133
+ // drift. Defines readDotenvValue / isPlaceholderValue / resolveVendorKeyValue /
92134
+ // findUnsatisfiedVendorKeys.
92135
+ ${VENDOR_KEY_PREDICATE_SOURCE}
92136
+
92137
+ const failedKeys = findUnsatisfiedVendorKeys(process.env, envFileContent, REQUIRED_ENV_KEYS)
92138
+ .map(({ requirement, value }) => ({ entry: requirement, value }));
92139
+
92140
+ if (failedKeys.length > 0) {
92141
+ for (const { entry, value } of failedKeys) {
92142
+ if (value === '') {
92143
+ console.warn(
92144
+ \`\u26A0 Missing API key: \${entry.key} \u2014 chat and generations will not work until you set it.\`,
92145
+ );
92146
+ } else {
92147
+ console.warn(
92148
+ \`\u26A0 Placeholder value for API key: \${entry.key} \u2014 chat and generations will not work until you replace it with your real key.\`,
92149
+ );
92150
+ }
92151
+ console.warn(\` \${entry.note}\`);
92152
+ console.warn(\` Get a key: \${entry.url}\`);
92153
+ console.warn(\` Add to .env: \${entry.key}=\${entry.example}\`);
92154
+ console.warn('');
92155
+ }
92156
+ if (!envFileExists) {
92157
+ console.warn(
92158
+ 'No .env file found in this directory; create one containing the line(s) above.',
92159
+ );
92160
+ }
92161
+ console.warn(
92162
+ 'Starting the dev server anyway \u2014 set the key(s) above and restart to enable chat.',
92163
+ );
92164
+ }
92165
+
92166
+ // Hosted Intelligence config check (ENT-949). Reuses the shared predicate above:
92167
+ // a key is unsatisfied when missing/blank in both process.env and .env \u2014 the
92168
+ // symptom of an overwritten generated .env. Names the missing keys only; the
92169
+ // values belong solely in .env, so the fix is to restore it or re-run init.
92170
+ const intelligenceFailures = findUnsatisfiedVendorKeys(
92171
+ process.env,
92172
+ envFileContent,
92173
+ REQUIRED_INTELLIGENCE_KEYS,
92174
+ ).map(({ requirement }) => requirement);
92175
+
92176
+ if (intelligenceFailures.length > 0) {
92177
+ console.warn(
92178
+ '\u26A0 CopilotKit Intelligence is not configured \u2014 your .env may have been overwritten.',
92179
+ );
92180
+ for (const entry of intelligenceFailures) {
92181
+ console.warn(\` Missing: \${entry.key}\`);
92182
+ }
92183
+ console.warn(
92184
+ 'Restore the value(s) in .env, or re-run \`copilotkit init\` to reconfigure.',
92185
+ );
92186
+ console.warn(
92187
+ 'Starting the dev server anyway \u2014 Intelligence features will not work until these are set.',
92188
+ );
92189
+ }
92190
+
92191
+ process.exit(0);
92192
+ `;
92193
+ }
92194
+ function writeDevInfraScript(projectDir, vendorEnvKeys, intelligenceEnvKeys) {
92195
+ const scriptPath = path12.join(projectDir, DEV_INFRA_SCRIPT_PATH);
92196
+ if (fs15.existsSync(scriptPath)) {
92197
+ return;
92198
+ }
92199
+ withFsErrorTag(() => {
92200
+ fs15.mkdirSync(path12.dirname(scriptPath), { recursive: true });
92201
+ fs15.writeFileSync(
92202
+ scriptPath,
92203
+ buildDevInfraScriptContent(vendorEnvKeys, intelligenceEnvKeys)
92204
+ );
92205
+ });
92206
+ }
92207
+ function chainDevInfraScript(projectDir) {
92208
+ const packageJsonPath = path12.join(projectDir, "package.json");
92209
+ if (!fs15.existsSync(packageJsonPath)) {
92210
+ return false;
92211
+ }
92212
+ const packageJson2 = JSON.parse(fs15.readFileSync(packageJsonPath, "utf8"));
92213
+ const devScript = packageJson2.scripts?.dev;
92214
+ if (!devScript || devScript.includes("dev:infra")) {
92215
+ return false;
92216
+ }
92217
+ const scripts = {
92218
+ ...packageJson2.scripts,
92219
+ "dev:infra": `node ${DEV_INFRA_SCRIPT_PATH}`,
92220
+ dev: `npm run dev:infra && ${devScript}`
92221
+ };
92222
+ const updated = { ...packageJson2, scripts };
92223
+ withFsErrorTag(
92224
+ () => fs15.writeFileSync(packageJsonPath, `${JSON.stringify(updated, null, 2)}
92225
+ `)
92226
+ );
92227
+ return true;
92228
+ }
92229
+ function writeHostedEnvBlock(projectDir, hosted) {
92230
+ const envPath = path12.join(projectDir, ".env");
92231
+ const existingContent = fs15.existsSync(envPath) ? fs15.readFileSync(envPath, "utf8") : "";
92232
+ const candidates = [
92233
+ ["INTELLIGENCE_API_URL", hosted.apiUrl],
92234
+ ["INTELLIGENCE_GATEWAY_WS_URL", hosted.gatewayWsUrl],
92235
+ ["SL_ENABLED", hosted.slEnabled ? "true" : "false"]
92236
+ ];
92237
+ const assignments = candidates.filter(([, value]) => value !== "");
92238
+ withFsErrorTag(
92239
+ () => fs15.writeFileSync(
92240
+ envPath,
92241
+ upsertEnvAssignments(existingContent, assignments)
92242
+ )
92243
+ );
92244
+ }
92245
+ function writeHostedApiKey(projectDir, apiKey) {
92246
+ if (apiKey === "") {
92247
+ return;
92248
+ }
92249
+ const envPath = path12.join(projectDir, ".env");
92250
+ const existingContent = fs15.existsSync(envPath) ? fs15.readFileSync(envPath, "utf8") : "";
92251
+ withFsErrorTag(
92252
+ () => fs15.writeFileSync(
92253
+ envPath,
92254
+ upsertEnvAssignments(existingContent, [["INTELLIGENCE_API_KEY", apiKey]])
92255
+ )
92256
+ );
92257
+ }
92258
+ function upsertEnvAssignments(content, assignments) {
92259
+ const pending = new Map(
92260
+ assignments.map(([key, value]) => [key, value])
92261
+ );
92262
+ const lines = content === "" ? [] : content.split("\n");
92263
+ const rewritten = lines.map((line) => {
92264
+ const key = ENV_ASSIGNMENT_RE.exec(line)?.[1];
92265
+ const value = key === void 0 ? void 0 : pending.get(key);
92266
+ if (key !== void 0 && value !== void 0) {
92267
+ pending.delete(key);
92268
+ return `${key}=${value}`;
92269
+ }
92270
+ return line;
92271
+ });
92272
+ const toAppend = assignments.filter(([key]) => pending.has(key)).map(([key, value]) => `${key}=${value}`);
92273
+ if (toAppend.length === 0) {
92274
+ return ensureTrailingNewline(rewritten.join("\n"));
92275
+ }
92276
+ const body = ensureTrailingNewline(rewritten.join("\n"));
92277
+ const separator = body === "" ? "" : "\n";
92278
+ return `${body}${separator}${HOSTED_ENV_HEADER}
92279
+ ${toAppend.join("\n")}
92280
+ `;
92281
+ }
92282
+ function ensureTrailingNewline(value) {
92283
+ if (value === "") {
92284
+ return "";
92285
+ }
92286
+ return value.endsWith("\n") ? value : `${value}
92287
+ `;
92288
+ }
92289
+ var DEV_INFRA_SCRIPT_PATH, HOSTED_ENV_HEADER, ENV_ASSIGNMENT_RE;
92290
+ var init_intelligence_activation = __esm({
92291
+ "apps/cli/src/services/intelligence-activation.ts"() {
92292
+ "use strict";
92293
+ init_config();
92294
+ init_vendor_key_predicate();
92295
+ init_event_properties();
92296
+ DEV_INFRA_SCRIPT_PATH = "scripts/copilotkit-dev-infra.mjs";
92297
+ 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`.";
92298
+ ENV_ASSIGNMENT_RE = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=/;
92299
+ }
92300
+ });
92301
+
92302
+ // apps/cli/src/services/hosted-project.ts
92303
+ async function selectOrCreateHostedProject(deps) {
92304
+ const { apiClient, prompts, telemetry } = deps;
92305
+ const { projects } = await apiClient.listHostedProjects();
92306
+ const projectCount = projects.length;
92307
+ if (projectCount === 0) {
92308
+ const result = await createFromName(apiClient, prompts, {
92309
+ canGoBack: false
92310
+ });
92311
+ if (result === "back") {
92312
+ telemetry?.onResolved?.("canceled", projectCount);
92313
+ return { canceled: true };
92314
+ }
92315
+ telemetry?.onResolved?.("created_new", projectCount);
92316
+ return result;
92317
+ }
92318
+ telemetry?.onPickerViewed?.(projectCount);
92319
+ for (; ; ) {
92320
+ const choice = await prompts.chooseProject(projects);
92321
+ if (choice === "cancel") {
92322
+ telemetry?.onResolved?.("canceled", projectCount);
92323
+ return { canceled: true };
92324
+ }
92325
+ if (choice !== "create") {
92326
+ telemetry?.onResolved?.("selected_existing", projectCount);
92327
+ return {
92328
+ projectId: choice.id,
92329
+ projectSlug: choice.slug,
92330
+ organizationId: choice.organizationId
92331
+ };
92332
+ }
92333
+ const result = await createFromName(apiClient, prompts, {
92334
+ canGoBack: true
92335
+ });
92336
+ if (result === "back") {
92337
+ telemetry?.onBack?.();
92338
+ continue;
92339
+ }
92340
+ telemetry?.onResolved?.("created_new", projectCount);
92341
+ return result;
92342
+ }
92343
+ }
92344
+ async function createFromName(apiClient, prompts, options) {
92345
+ const name = await prompts.promptProjectName(options);
92346
+ if (name === "back") {
92347
+ return "back";
91846
92348
  }
91847
92349
  const { project } = await apiClient.createHostedProject(name);
91848
92350
  return {
@@ -91867,6 +92369,21 @@ var init_hosted_project2 = __esm({
91867
92369
  }
91868
92370
  });
91869
92371
 
92372
+ // apps/cli/src/ui/theme.ts
92373
+ var theme;
92374
+ var init_theme = __esm({
92375
+ "apps/cli/src/ui/theme.ts"() {
92376
+ "use strict";
92377
+ theme = {
92378
+ /**
92379
+ * Brand violet accent — used for the product name, selected picker rows, and
92380
+ * primary marks. A single source of truth so the shade is tuned in one place.
92381
+ */
92382
+ accent: "#6B5CFF"
92383
+ };
92384
+ }
92385
+ });
92386
+
91870
92387
  // apps/cli/src/ui/hosted-project-select.tsx
91871
92388
  function defer() {
91872
92389
  let resolve2;
@@ -91875,20 +92392,29 @@ function defer() {
91875
92392
  });
91876
92393
  return { promise: promise2, resolve: resolve2 };
91877
92394
  }
92395
+ function ProjectExplainer({ dim = false }) {
92396
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: dim, children: "An Intelligence project is where this app's threads, messages, and analytics are stored." });
92397
+ }
91878
92398
  function HostedProjectSelect({
91879
92399
  apiClient,
91880
92400
  onResolved,
91881
92401
  onCanceled,
91882
- onError
92402
+ onError,
92403
+ defaultName = "",
92404
+ telemetry
91883
92405
  }) {
91884
92406
  const [view, setView] = (0, import_react37.useState)({ kind: "loading" });
91885
92407
  const nameBufferRef = (0, import_react37.useRef)("");
91886
92408
  const [nameDisplay, setNameDisplay] = (0, import_react37.useState)("");
92409
+ const nameDirtyRef = (0, import_react37.useRef)(false);
92410
+ const [nameDirty, setNameDirty] = (0, import_react37.useState)(false);
91887
92411
  const [nameError, setNameError] = (0, import_react37.useState)("");
91888
92412
  const pickerIndexRef = (0, import_react37.useRef)(0);
91889
92413
  const [pickerIndex, setPickerIndex] = (0, import_react37.useState)(0);
91890
92414
  const choiceRef = (0, import_react37.useRef)(null);
91891
92415
  const nameRef = (0, import_react37.useRef)(null);
92416
+ const [canGoBack, setCanGoBack] = (0, import_react37.useState)(false);
92417
+ const projectsRef = (0, import_react37.useRef)([]);
91892
92418
  const startedRef = (0, import_react37.useRef)(false);
91893
92419
  const firedRef = (0, import_react37.useRef)(false);
91894
92420
  (0, import_react37.useEffect)(() => {
@@ -91902,19 +92428,23 @@ function HostedProjectSelect({
91902
92428
  choiceRef.current = deferred;
91903
92429
  pickerIndexRef.current = 0;
91904
92430
  setPickerIndex(0);
92431
+ projectsRef.current = projects;
91905
92432
  setView({ kind: "choose", projects });
91906
92433
  return deferred.promise;
91907
92434
  },
91908
- promptProjectName: () => {
92435
+ promptProjectName: ({ canGoBack: back }) => {
91909
92436
  const deferred = defer();
91910
92437
  nameRef.current = deferred;
91911
- nameBufferRef.current = "";
91912
- setNameDisplay("");
92438
+ setCanGoBack(back);
92439
+ nameBufferRef.current = defaultName;
92440
+ setNameDisplay(defaultName);
92441
+ nameDirtyRef.current = false;
92442
+ setNameDirty(false);
91913
92443
  setView({ kind: "name" });
91914
92444
  return deferred.promise;
91915
92445
  }
91916
92446
  };
91917
- selectOrCreateHostedProject({ apiClient, prompts }).then((result) => {
92447
+ selectOrCreateHostedProject({ apiClient, prompts, telemetry }).then((result) => {
91918
92448
  if ("canceled" in result) {
91919
92449
  setView({ kind: "canceled" });
91920
92450
  } else {
@@ -91980,7 +92510,7 @@ function HostedProjectSelect({
91980
92510
  }
91981
92511
  if (view.kind === "name") {
91982
92512
  if (key.escape) {
91983
- nameRef.current?.resolve(null);
92513
+ nameRef.current?.resolve("back");
91984
92514
  return;
91985
92515
  }
91986
92516
  const crIdx = input.indexOf("\r");
@@ -91989,15 +92519,31 @@ function HostedProjectSelect({
91989
92519
  if (key.return || splitIdx !== -1) {
91990
92520
  const textBeforeNewline = splitIdx === -1 ? "" : input.slice(0, splitIdx);
91991
92521
  if (textBeforeNewline) {
91992
- nameBufferRef.current = nameBufferRef.current + textBeforeNewline;
92522
+ nameBufferRef.current = (nameDirtyRef.current ? nameBufferRef.current : "") + textBeforeNewline;
92523
+ nameDirtyRef.current = true;
92524
+ setNameDirty(true);
91993
92525
  }
91994
92526
  const trimmed = nameBufferRef.current.trim();
91995
92527
  if (trimmed === "") {
91996
- setNameError("Project name can't be empty.");
92528
+ setNameError("Intelligence project name can't be empty.");
92529
+ telemetry?.onCreateNameRejected?.("empty");
91997
92530
  return;
91998
92531
  }
91999
92532
  if (trimmed.length > 100) {
92000
- setNameError("Project name must be 100 characters or fewer.");
92533
+ setNameError(
92534
+ "Intelligence project name must be 100 characters or fewer."
92535
+ );
92536
+ telemetry?.onCreateNameRejected?.("too_long");
92537
+ return;
92538
+ }
92539
+ const duplicate = projectsRef.current.find(
92540
+ (project) => project.name.toLowerCase() === trimmed.toLowerCase()
92541
+ );
92542
+ if (duplicate) {
92543
+ setNameError(
92544
+ `You already have a project named "${duplicate.name}" \u2014 choose a different name, or cancel (Esc) and select it from the list.`
92545
+ );
92546
+ telemetry?.onCreateNameRejected?.("duplicate");
92001
92547
  return;
92002
92548
  }
92003
92549
  setNameError("");
@@ -92005,64 +92551,98 @@ function HostedProjectSelect({
92005
92551
  return;
92006
92552
  }
92007
92553
  if (key.backspace || key.delete) {
92008
- const updated = nameBufferRef.current.slice(0, -1);
92554
+ const updated = nameDirtyRef.current ? nameBufferRef.current.slice(0, -1) : "";
92555
+ nameDirtyRef.current = true;
92556
+ setNameDirty(true);
92009
92557
  nameBufferRef.current = updated;
92010
92558
  setNameDisplay(updated);
92011
92559
  return;
92012
92560
  }
92013
92561
  if (input && !key.ctrl && !key.meta) {
92014
- const updated = nameBufferRef.current + input;
92562
+ const base = nameDirtyRef.current ? nameBufferRef.current : "";
92563
+ nameDirtyRef.current = true;
92564
+ setNameDirty(true);
92565
+ const updated = base + input;
92015
92566
  nameBufferRef.current = updated;
92016
92567
  setNameDisplay(updated);
92017
92568
  }
92018
92569
  }
92019
92570
  });
92020
92571
  if (view.kind === "loading") {
92021
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { children: "Loading projects\u2026" });
92572
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "Loading projects\u2026" });
92022
92573
  }
92023
92574
  if (view.kind === "choose") {
92024
92575
  const { projects } = view;
92025
92576
  const items = [
92026
92577
  ...projects.map((project) => ({
92027
- label: `${project.name} (${project.slug})`,
92578
+ label: project.name,
92028
92579
  value: project.id
92029
92580
  })),
92030
92581
  { label: "Create a new project", value: "__create__" }
92031
92582
  ];
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))
92583
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", children: [
92584
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "Connect this app to one of your existing projects, or create a new one." }),
92585
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ProjectExplainer, { dim: true }),
92586
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
92587
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "Select a project (\u2191/\u2193 to move, Enter to choose, Esc to cancel):" }),
92588
+ items.map((item, index) => {
92589
+ const selected = index === pickerIndex;
92590
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
92591
+ Text,
92592
+ {
92593
+ color: selected ? theme.accent : void 0,
92594
+ bold: selected,
92595
+ children: [
92596
+ selected ? "\u276F " : "- ",
92597
+ item.label
92598
+ ]
92599
+ },
92600
+ item.value
92601
+ );
92602
+ })
92038
92603
  ] });
92039
92604
  }
92040
92605
  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
92606
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", children: [
92607
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: "Name your hosted Intelligence project" }),
92608
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
92609
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ProjectExplainer, {}),
92610
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { dimColor: true, children: [
92611
+ "Pre-filled from your app name \u2014 press Enter to accept, or type to change it. Esc to ",
92612
+ canGoBack ? "go back to the project list" : "cancel",
92613
+ "."
92614
+ ] }),
92615
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { children: [
92616
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
92617
+ ">",
92618
+ " "
92619
+ ] }),
92620
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: !nameDirty, children: nameDisplay }),
92621
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { inverse: true, children: " " })
92622
+ ] }),
92623
+ nameError ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "red", children: nameError }) : null
92045
92624
  ] });
92046
92625
  }
92047
92626
  if (view.kind === "done") {
92048
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
92627
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
92049
92628
  "Selected project: ",
92050
92629
  view.selection.projectSlug
92051
92630
  ] });
92052
92631
  }
92053
92632
  if (view.kind === "canceled") {
92054
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { children: "Project selection canceled." });
92633
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "Project selection canceled." });
92055
92634
  }
92056
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { children: view.message });
92635
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: view.message });
92057
92636
  }
92058
- var import_react37, import_jsx_runtime6;
92637
+ var import_react37, import_jsx_runtime7;
92059
92638
  var init_hosted_project_select = __esm({
92060
92639
  async "apps/cli/src/ui/hosted-project-select.tsx"() {
92061
92640
  "use strict";
92062
92641
  import_react37 = __toESM(require_react(), 1);
92063
92642
  await init_build2();
92064
92643
  init_hosted_project2();
92065
- import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
92644
+ init_theme();
92645
+ import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
92066
92646
  }
92067
92647
  });
92068
92648
 
@@ -92120,18 +92700,22 @@ async function driveProjectSelect() {
92120
92700
  }
92121
92701
  const apiClient = createApiClient(getOpsApiUrl(), auth.cliToken);
92122
92702
  let outcome = { kind: "canceled" };
92703
+ const capturedSelection = {
92704
+ value: null
92705
+ };
92123
92706
  const app = render_default(
92124
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
92707
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
92125
92708
  HostedProjectSelect,
92126
92709
  {
92127
92710
  apiClient,
92128
- onResolved: (selection) => {
92711
+ onResolved: (selection2) => {
92129
92712
  try {
92130
92713
  writeProjectConfig(process.cwd(), {
92131
- projectId: selection.projectId,
92132
- projectSlug: selection.projectSlug,
92133
- clerkOrgId: selection.organizationId
92714
+ projectId: selection2.projectId,
92715
+ projectSlug: selection2.projectSlug,
92716
+ clerkOrgId: selection2.organizationId
92134
92717
  });
92718
+ capturedSelection.value = selection2;
92135
92719
  outcome = { kind: "success" };
92136
92720
  } catch (error48) {
92137
92721
  process.stderr.write(
@@ -92155,6 +92739,18 @@ async function driveProjectSelect() {
92155
92739
  )
92156
92740
  );
92157
92741
  await app.waitUntilExit();
92742
+ const selection = capturedSelection.value;
92743
+ if (selection !== null) {
92744
+ try {
92745
+ const { apiKey } = await apiClient.provisionApiKey(selection.projectId);
92746
+ writeHostedApiKey(process.cwd(), apiKey.token);
92747
+ } catch (provisionError) {
92748
+ process.stderr.write(
92749
+ `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\`.
92750
+ `
92751
+ );
92752
+ }
92753
+ }
92158
92754
  return outcome;
92159
92755
  }
92160
92756
  async function runProjectSelect() {
@@ -92164,7 +92760,7 @@ async function runProjectSelect() {
92164
92760
  throw exitError;
92165
92761
  }
92166
92762
  }
92167
- var import_jsx_runtime7;
92763
+ var import_jsx_runtime8;
92168
92764
  var init_project = __esm({
92169
92765
  async "apps/cli/src/commands/project.tsx"() {
92170
92766
  "use strict";
@@ -92173,9 +92769,10 @@ var init_project = __esm({
92173
92769
  init_api_client();
92174
92770
  init_config();
92175
92771
  init_project_config();
92772
+ init_intelligence_activation();
92176
92773
  await init_hosted_project_select();
92177
92774
  init_project_outcome();
92178
- import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
92775
+ import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
92179
92776
  }
92180
92777
  });
92181
92778
 
@@ -92328,26 +92925,31 @@ Start by inspecting my repo, then walk me through the setup.`;
92328
92925
 
92329
92926
  // apps/cli/src/ui/banner.tsx
92330
92927
  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! ~" })
92928
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
92929
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: theme.accent, children: KITE }),
92930
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { bold: true, children: [
92931
+ "~ Welcome to ",
92932
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: theme.accent, children: "CopilotKit" }),
92933
+ "! ~"
92934
+ ] })
92334
92935
  ] });
92335
92936
  }
92336
92937
  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: [
92938
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
92939
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { children: INTELLIGENCE_FEATURES_HEADING }),
92940
+ INTELLIGENCE_FEATURES_BULLETS.map((bullet) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { dimColor: true, children: [
92340
92941
  " \u2022 ",
92341
92942
  bullet
92342
92943
  ] }, bullet))
92343
92944
  ] });
92344
92945
  }
92345
- var import_jsx_runtime8, KITE, INTELLIGENCE_FEATURES_HEADING, INTELLIGENCE_FEATURES_BULLETS;
92946
+ var import_jsx_runtime9, KITE, INTELLIGENCE_FEATURES_HEADING, INTELLIGENCE_FEATURES_BULLETS;
92346
92947
  var init_banner = __esm({
92347
92948
  async "apps/cli/src/ui/banner.tsx"() {
92348
92949
  "use strict";
92349
92950
  await init_build2();
92350
- import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
92951
+ init_theme();
92952
+ import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
92351
92953
  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
92954
  \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
92955
  \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 +92965,7 @@ var init_banner = __esm({
92363
92965
  \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
92966
  \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
92967
  \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:";
92968
+ INTELLIGENCE_FEATURES_HEADING = "Every app includes CopilotKit Intelligence:";
92367
92969
  INTELLIGENCE_FEATURES_BULLETS = [
92368
92970
  "Durable threads & session persistence",
92369
92971
  "Interaction & event logging",
@@ -92460,31 +93062,31 @@ function SkillsOnboardApp({
92460
93062
  }
92461
93063
  }, [step, exit]);
92462
93064
  if (step === "authenticating" && shouldRenderBrowserLogin(browserLoginState.phase)) {
92463
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(BrowserLoginConfirmation, { reason: SKILLS_AUTH_REASON });
93065
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(BrowserLoginConfirmation, { reason: SKILLS_AUTH_REASON });
92464
93066
  }
92465
93067
  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" })
93068
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", children: [
93069
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { dimColor: true, children: "A free CopilotKit account is required \u2014 sign in with your browser to continue." }),
93070
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Spinner, { label: "\u{1FA81} Verifying authentication\u2026" })
92469
93071
  ] });
92470
93072
  }
92471
93073
  if (step === "delivering") {
92472
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Spinner, { label: "Preparing your agent prompt\u2026" });
93074
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Spinner, { label: "Preparing your agent prompt\u2026" });
92473
93075
  }
92474
93076
  if (step === "error") {
92475
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: "red", children: [
93077
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { color: "red", children: [
92476
93078
  "Onboarding failed: ",
92477
93079
  errorMessage
92478
93080
  ] });
92479
93081
  }
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 }) })
93082
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", children: [
93083
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SuccessText, { children: "CopilotKit skills installed." }),
93084
+ copied ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
93085
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { children: "Your next step is copied to the clipboard." }),
93086
+ /* @__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." })
93087
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
93088
+ /* @__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:" }),
93089
+ /* @__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
93090
  ] })
92489
93091
  ] });
92490
93092
  }
@@ -92506,14 +93108,14 @@ async function runSkills(flags) {
92506
93108
  return;
92507
93109
  }
92508
93110
  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 })
93111
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(BrowserLoginProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", children: [
93112
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Banner, {}),
93113
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SkillsOnboardApp, { noClipboard: flags.noClipboard ?? false })
92512
93114
  ] }) })
92513
93115
  );
92514
93116
  await waitUntilExit();
92515
93117
  }
92516
- var import_react38, import_jsx_runtime9, SKILLS_AUTH_REASON, defaultOnboardDeps;
93118
+ var import_react38, import_jsx_runtime10, SKILLS_AUTH_REASON, defaultOnboardDeps;
92517
93119
  var init_skills = __esm({
92518
93120
  async "apps/cli/src/commands/skills.tsx"() {
92519
93121
  "use strict";
@@ -92526,7 +93128,8 @@ var init_skills = __esm({
92526
93128
  await init_banner();
92527
93129
  await init_browser_login();
92528
93130
  await init_spinner();
92529
- import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
93131
+ await init_success_text();
93132
+ import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
92530
93133
  SKILLS_AUTH_REASON = "A free CopilotKit account is required for agent-assisted onboarding.";
92531
93134
  defaultOnboardDeps = {
92532
93135
  verifyAndRefresh,
@@ -92700,286 +93303,102 @@ var init_docs = __esm({
92700
93303
  }
92701
93304
  });
92702
93305
 
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
93306
  // apps/cli/src/services/install-dependencies.ts
92949
93307
  import { spawn as spawn3 } from "node:child_process";
92950
93308
  import { StringDecoder } from "node:string_decoder";
92951
- function installDependencies({
92952
- cwd: cwd2,
92953
- command
92954
- }) {
93309
+ function delay2(ms) {
93310
+ return new Promise((resolve2) => {
93311
+ setTimeout(resolve2, ms);
93312
+ });
93313
+ }
93314
+ function runInstallOnce(cwd2, command) {
92955
93315
  return new Promise((resolve2) => {
92956
- const child = spawn3(command, { cwd: cwd2, shell: true, stdio: ["ignore", "ignore", "pipe"] });
92957
- const decoder = new StringDecoder("utf8");
93316
+ const child = spawn3(command, { cwd: cwd2, shell: true, stdio: ["ignore", "pipe", "pipe"] });
93317
+ const stdoutDecoder = new StringDecoder("utf8");
93318
+ const stderrDecoder = new StringDecoder("utf8");
93319
+ let stdout = "";
92958
93320
  let stderr = "";
93321
+ child.stdout?.on("data", (chunk) => {
93322
+ stdout += stdoutDecoder.write(chunk);
93323
+ if (stdout.length > STDOUT_TAIL_LIMIT * 2) {
93324
+ stdout = stdout.slice(-STDOUT_TAIL_LIMIT);
93325
+ }
93326
+ });
92959
93327
  child.stderr?.on("data", (chunk) => {
92960
- stderr += decoder.write(chunk);
93328
+ stderr += stderrDecoder.write(chunk);
92961
93329
  if (stderr.length > STDERR_TAIL_LIMIT * 2) {
92962
93330
  stderr = stderr.slice(-STDERR_TAIL_LIMIT);
92963
93331
  }
92964
93332
  });
92965
93333
  child.once("error", (error48) => {
92966
- resolve2({ ok: false, stderrTail: error48.message });
93334
+ resolve2({
93335
+ ok: false,
93336
+ code: null,
93337
+ stdoutTail: "",
93338
+ stderrTail: "",
93339
+ spawnError: error48.message
93340
+ });
92967
93341
  });
92968
93342
  child.once("close", (code) => {
92969
- stderr += decoder.end();
92970
- if (code === 0) {
92971
- resolve2({ ok: true });
92972
- } else {
92973
- resolve2({ ok: false, stderrTail: stderr.slice(-STDERR_TAIL_LIMIT).trim() });
92974
- }
93343
+ stdout += stdoutDecoder.end();
93344
+ stderr += stderrDecoder.end();
93345
+ resolve2({
93346
+ ok: code === 0,
93347
+ code,
93348
+ stdoutTail: stdout.slice(-STDOUT_TAIL_LIMIT).trim(),
93349
+ stderrTail: stderr.slice(-STDERR_TAIL_LIMIT).trim()
93350
+ });
92975
93351
  });
92976
93352
  });
92977
93353
  }
92978
- var STDERR_TAIL_LIMIT;
93354
+ async function installDependencies({
93355
+ cwd: cwd2,
93356
+ command,
93357
+ log,
93358
+ retryDelayMs = DEFAULT_RETRY_DELAY_MS
93359
+ }) {
93360
+ let lastAttempt;
93361
+ for (let attempt = 1; attempt <= INSTALL_MAX_ATTEMPTS; attempt += 1) {
93362
+ if (attempt > 1 && retryDelayMs > 0) {
93363
+ await delay2(retryDelayMs);
93364
+ }
93365
+ lastAttempt = await runInstallOnce(cwd2, command);
93366
+ if (lastAttempt.ok) {
93367
+ if (attempt > 1) {
93368
+ log?.("info", {
93369
+ event: "install_succeeded_after_retry",
93370
+ command,
93371
+ cwd: cwd2,
93372
+ attempt
93373
+ });
93374
+ }
93375
+ return { ok: true };
93376
+ }
93377
+ log?.("error", {
93378
+ event: "install_failed",
93379
+ command,
93380
+ cwd: cwd2,
93381
+ attempt,
93382
+ maxAttempts: INSTALL_MAX_ATTEMPTS,
93383
+ exitCode: lastAttempt.code,
93384
+ ...lastAttempt.spawnError ? { spawnError: lastAttempt.spawnError } : {},
93385
+ stdoutTail: lastAttempt.stdoutTail,
93386
+ stderrTail: lastAttempt.stderrTail
93387
+ });
93388
+ }
93389
+ return {
93390
+ ok: false,
93391
+ stderrTail: lastAttempt?.spawnError ?? lastAttempt?.stderrTail ?? "install failed"
93392
+ };
93393
+ }
93394
+ var STDERR_TAIL_LIMIT, STDOUT_TAIL_LIMIT, INSTALL_MAX_ATTEMPTS, DEFAULT_RETRY_DELAY_MS;
92979
93395
  var init_install_dependencies = __esm({
92980
93396
  "apps/cli/src/services/install-dependencies.ts"() {
92981
93397
  "use strict";
92982
93398
  STDERR_TAIL_LIMIT = 2e3;
93399
+ STDOUT_TAIL_LIMIT = 4e3;
93400
+ INSTALL_MAX_ATTEMPTS = 2;
93401
+ DEFAULT_RETRY_DELAY_MS = 1e3;
92983
93402
  }
92984
93403
  });
92985
93404
 
@@ -93019,17 +93438,52 @@ var init_vendor_env_keys = __esm({
93019
93438
  });
93020
93439
 
93021
93440
  // apps/cli/src/ui/init-flow.tsx
93441
+ function FrameworkIndicator({ isSelected = false }) {
93442
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { marginRight: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: isSelected ? theme.accent : void 0, children: isSelected ? "\u276F" : " " }) });
93443
+ }
93444
+ function FrameworkItem({
93445
+ isSelected = false,
93446
+ label
93447
+ }) {
93448
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: isSelected ? theme.accent : void 0, bold: isSelected, children: label });
93449
+ }
93022
93450
  function validateName(name) {
93023
93451
  if (name.length === 0)
93024
- return "Project name is required.";
93452
+ return "App name is required.";
93025
93453
  if (name.length > 30)
93026
- return "Project name must be 30 characters or fewer.";
93454
+ return "App name must be 30 characters or fewer.";
93027
93455
  if (DISALLOWED_NAME_CHAR_RE.test(name))
93028
93456
  return NAME_PATTERN_MESSAGE;
93029
93457
  if (name.startsWith("-") || name.endsWith("-"))
93030
93458
  return NAME_PATTERN_MESSAGE;
93031
93459
  return null;
93032
93460
  }
93461
+ function computeFrameworkPickerLimit(rows, itemCount) {
93462
+ if (!Number.isFinite(rows) || rows <= 0)
93463
+ return itemCount;
93464
+ const available = rows - FRAMEWORK_PICKER_RESERVED_ROWS;
93465
+ return Math.max(
93466
+ MIN_FRAMEWORK_PICKER_VISIBLE,
93467
+ Math.min(itemCount, available, MAX_FRAMEWORK_PICKER_VISIBLE)
93468
+ );
93469
+ }
93470
+ function useStdoutRows() {
93471
+ const { stdout } = use_stdout_default();
93472
+ const readRows = () => stdout && Number.isFinite(stdout.rows) && stdout.rows > 0 ? stdout.rows : 0;
93473
+ const [rows, setRows] = (0, import_react39.useState)(readRows);
93474
+ (0, import_react39.useEffect)(() => {
93475
+ if (!stdout)
93476
+ return;
93477
+ const update = () => {
93478
+ setRows(readRows());
93479
+ };
93480
+ stdout.on("resize", update);
93481
+ return () => {
93482
+ stdout.off("resize", update);
93483
+ };
93484
+ }, [stdout]);
93485
+ return rows;
93486
+ }
93033
93487
  function InitFlow({
93034
93488
  initialName,
93035
93489
  initialIntelligence,
@@ -93048,6 +93502,7 @@ function InitFlow({
93048
93502
  return "framework";
93049
93503
  }
93050
93504
  const [step, setStep] = (0, import_react39.useState)(firstStep);
93505
+ const stdoutRows = useStdoutRows();
93051
93506
  (0, import_react39.useEffect)(() => {
93052
93507
  if (initialFramework !== null) {
93053
93508
  onFrameworkSelected?.({
@@ -93105,40 +93560,53 @@ function InitFlow({
93105
93560
  const frameworkChoices = initialIntelligence === true ? FRAMEWORK_CHOICES.filter(
93106
93561
  (choice) => THREADS_FRAMEWORKS.has(choice.value)
93107
93562
  ) : 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: [
93563
+ const frameworkLimit = computeFrameworkPickerLimit(
93564
+ stdoutRows,
93565
+ frameworkChoices.length
93566
+ );
93567
+ const frameworkIsScrolling = frameworkLimit < frameworkChoices.length;
93568
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", children: [
93569
+ step === "name" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", children: [
93570
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { bold: true, children: "App name" }),
93571
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: "Names your new app and its folder \u2014 lowercase, numbers, hyphens, max 30" }),
93572
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { children: [
93573
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { children: [
93114
93574
  ">",
93115
93575
  " "
93116
93576
  ] }),
93117
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
93577
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
93118
93578
  build_default,
93119
93579
  {
93120
93580
  value: name,
93121
93581
  onChange: setName,
93122
93582
  onSubmit: handleNameSubmit,
93123
- placeholder: "my-project"
93583
+ placeholder: "my-app"
93124
93584
  }
93125
93585
  )
93126
93586
  ] }),
93127
- nameError !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: "red", children: nameError })
93587
+ nameError !== null && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: "red", children: nameError })
93128
93588
  ] }),
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)(
93589
+ step === "framework" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", children: [
93590
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { bold: true, children: "Select agent framework" }),
93591
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
93132
93592
  SelectInput_default,
93133
93593
  {
93134
93594
  items: frameworkChoices,
93135
- onSelect: handleFrameworkSelect
93595
+ onSelect: handleFrameworkSelect,
93596
+ indicatorComponent: FrameworkIndicator,
93597
+ itemComponent: FrameworkItem,
93598
+ limit: frameworkLimit
93136
93599
  }
93137
- )
93600
+ ),
93601
+ frameworkIsScrolling && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { dimColor: true, children: [
93602
+ "\u2191\u2193 to browse all ",
93603
+ frameworkChoices.length,
93604
+ " \xB7 \u21B5 select"
93605
+ ] })
93138
93606
  ] })
93139
93607
  ] });
93140
93608
  }
93141
- var import_react39, import_jsx_runtime10, DISALLOWED_NAME_CHAR_RE, NAME_PATTERN_MESSAGE;
93609
+ var import_react39, import_jsx_runtime11, DISALLOWED_NAME_CHAR_RE, NAME_PATTERN_MESSAGE, FRAMEWORK_PICKER_RESERVED_ROWS, MIN_FRAMEWORK_PICKER_VISIBLE, MAX_FRAMEWORK_PICKER_VISIBLE;
93142
93610
  var init_init_flow = __esm({
93143
93611
  async "apps/cli/src/ui/init-flow.tsx"() {
93144
93612
  "use strict";
@@ -93147,9 +93615,49 @@ var init_init_flow = __esm({
93147
93615
  await init_build3();
93148
93616
  await init_build4();
93149
93617
  init_types();
93150
- import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
93618
+ init_theme();
93619
+ import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
93151
93620
  DISALLOWED_NAME_CHAR_RE = /[^a-z0-9-]/;
93152
93621
  NAME_PATTERN_MESSAGE = "Use only lowercase letters, numbers, and hyphens, and do not start or end with a hyphen.";
93622
+ FRAMEWORK_PICKER_RESERVED_ROWS = 4;
93623
+ MIN_FRAMEWORK_PICKER_VISIBLE = 3;
93624
+ MAX_FRAMEWORK_PICKER_VISIBLE = 6;
93625
+ }
93626
+ });
93627
+
93628
+ // apps/cli/src/services/intelligence-readme.ts
93629
+ import * as fs16 from "node:fs";
93630
+ import * as path13 from "node:path";
93631
+ function buildSection(projectSlug) {
93632
+ return `${INTELLIGENCE_README_HEADING}
93633
+
93634
+ This app is connected to the CopilotKit Intelligence project **${projectSlug}**
93635
+ (recorded in \`.copilotkit/project.json\`). Intelligence adds durable threads,
93636
+ message & event persistence, and analytics for your agent.
93637
+
93638
+ - **License:** a token is stored as \`COPILOTKIT_LICENSE_TOKEN\` in your \`.env\`.
93639
+ - **Switch project:** run \`copilotkit project select\` from this directory.
93640
+ - **Run it:** follow "Getting Started" above \u2014 install dependencies, set your
93641
+ keys in \`.env\`, then \`npm run dev\`.
93642
+
93643
+ Learn more at https://docs.copilotkit.ai.
93644
+ `;
93645
+ }
93646
+ function appendIntelligenceReadme(dir, opts) {
93647
+ const readmePath = path13.join(dir, "README.md");
93648
+ const existing = fs16.existsSync(readmePath) ? fs16.readFileSync(readmePath, "utf8") : "";
93649
+ if (existing.includes(INTELLIGENCE_README_HEADING)) {
93650
+ return;
93651
+ }
93652
+ const section = buildSection(opts.projectSlug);
93653
+ const prefix = existing.length === 0 ? "" : existing.endsWith("\n") ? "\n" : "\n\n";
93654
+ fs16.writeFileSync(readmePath, existing + prefix + section);
93655
+ }
93656
+ var INTELLIGENCE_README_HEADING;
93657
+ var init_intelligence_readme = __esm({
93658
+ "apps/cli/src/services/intelligence-readme.ts"() {
93659
+ "use strict";
93660
+ INTELLIGENCE_README_HEADING = "## CopilotKit Intelligence";
93153
93661
  }
93154
93662
  });
93155
93663
 
@@ -93172,11 +93680,11 @@ __export(init_exports, {
93172
93680
  import {
93173
93681
  accessSync,
93174
93682
  constants as constants2,
93175
- existsSync as existsSync6,
93176
- readFileSync as readFileSync5,
93683
+ existsSync as existsSync7,
93684
+ readFileSync as readFileSync6,
93177
93685
  rmSync as rmSync3
93178
93686
  } from "node:fs";
93179
- import * as path13 from "node:path";
93687
+ import * as path14 from "node:path";
93180
93688
  import { execSync as execSync2 } from "node:child_process";
93181
93689
  function shouldRenderInitBrowserLoginConfirmation(phase) {
93182
93690
  return phase === "confirming" || phase === "waiting" || phase === "finalizing";
@@ -93193,12 +93701,12 @@ async function initGit(projectDir) {
93193
93701
  function commandExists(command, environment = process.env, platform3 = process.platform) {
93194
93702
  const pathValue = environment.PATH ?? "";
93195
93703
  const pathExtensions = platform3 === "win32" ? (environment.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean) : [""];
93196
- for (const searchPath of pathValue.split(path13.delimiter)) {
93704
+ for (const searchPath of pathValue.split(path14.delimiter)) {
93197
93705
  if (!searchPath) {
93198
93706
  continue;
93199
93707
  }
93200
93708
  for (const extension of pathExtensions) {
93201
- const candidatePath = path13.join(searchPath, `${command}${extension}`);
93709
+ const candidatePath = path14.join(searchPath, `${command}${extension}`);
93202
93710
  try {
93203
93711
  accessSync(candidatePath, constants2.X_OK);
93204
93712
  return true;
@@ -93225,34 +93733,49 @@ function buildInitNextSteps(templateDefinition, projectName, result, unsatisfied
93225
93733
  const runtimeMissing = missingPrerequisites.filter(
93226
93734
  (p) => p.phase === "runtime"
93227
93735
  );
93228
- const steps = [`Directory: ${result.projectDir}`];
93736
+ const SEP2 = ": ";
93737
+ const steps = [];
93229
93738
  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}`);
93739
+ steps.push({
93740
+ text: `Missing ${prerequisite.label}: ${prerequisite.installHint}`
93741
+ });
93239
93742
  }
93240
- let header = "Run these commands:";
93743
+ let header = "Here's how to get it running:";
93241
93744
  if (setupMissing.length > 0) {
93242
- header = "After installing setup prerequisites, run:";
93745
+ header = "Once those are installed, here's how to get it running:";
93243
93746
  } else if (runtimeMissing.length > 0) {
93244
- header = "After runtime prerequisites are ready, run:";
93747
+ header = "Once those are ready, here's how to get it running:";
93245
93748
  }
93246
- steps.push(header);
93247
- steps.push(` cd ${projectName}`);
93749
+ steps.push({ text: header });
93750
+ steps.push({
93751
+ text: ` Move into your new app${SEP2}`,
93752
+ code: `cd ${projectName}`
93753
+ });
93248
93754
  if (!installAlreadyRan) {
93249
- steps.push(` ${templateDefinition.installCommand}`);
93755
+ steps.push({
93756
+ text: ` Install the dependencies${SEP2}`,
93757
+ code: templateDefinition.installCommand
93758
+ });
93250
93759
  }
93251
93760
  for (const postInstallCommand of templateDefinition.postInstallCommands ?? []) {
93252
93761
  const formatted = postInstallCommand.startsWith("cd ") ? `(${postInstallCommand})` : postInstallCommand;
93253
- steps.push(` ${formatted}`);
93762
+ steps.push({ text: ` ${formatted}` });
93763
+ }
93764
+ for (const envNote of envNotes) {
93765
+ steps.push({ text: ` ${envNote}` });
93766
+ }
93767
+ for (const { requirement } of unsatisfiedKeys) {
93768
+ steps.push({ text: ` Set ${requirement.key} in .env:` });
93769
+ steps.push({ text: ` Get a key${SEP2}`, code: requirement.url });
93770
+ steps.push({
93771
+ text: ` Add the line${SEP2}`,
93772
+ code: `${requirement.key}=${requirement.example}`
93773
+ });
93254
93774
  }
93255
- steps.push(` ${templateDefinition.runCommand}`);
93775
+ steps.push({
93776
+ text: ` Start the dev server${SEP2}`,
93777
+ code: templateDefinition.runCommand
93778
+ });
93256
93779
  return steps;
93257
93780
  }
93258
93781
  async function ensureCliToken2(dependencies, onTerminalSessionInvalidation, onBrowserOpened, onAuthGateViewed) {
@@ -93359,7 +93882,8 @@ async function scaffoldInitProject(options, dependencies = defaultInitScaffoldDe
93359
93882
  );
93360
93883
  cliToken = ensuredToken;
93361
93884
  telemetry?.onAuthCompleted({ framework, alreadyAuthenticated });
93362
- const projectDirExistedBefore = existsSync6(projectDir);
93885
+ const projectDirExistedBefore = existsSync7(projectDir);
93886
+ let hostedConfig;
93363
93887
  try {
93364
93888
  onPhaseChange?.("scaffold");
93365
93889
  telemetry?.onScaffoldStarted({ framework });
@@ -93373,19 +93897,28 @@ async function scaffoldInitProject(options, dependencies = defaultInitScaffoldDe
93373
93897
  const envCreatedFromExample = dependencies.copyEnvExample(projectDir);
93374
93898
  if (templateDefinition.includesThreads) {
93375
93899
  onPhaseChange?.("activate-intelligence");
93376
- const hosted = dependencies.resolveHostedScaffoldConfig();
93900
+ hostedConfig = dependencies.resolveHostedScaffoldConfig();
93377
93901
  dependencies.activateIntelligence({
93378
93902
  projectDir,
93379
93903
  vendorEnvKeys: resolveVendorEnvKeys(templateDefinition),
93380
- ...hosted ? { hosted } : {}
93904
+ ...hostedConfig ? { hosted: hostedConfig } : {}
93381
93905
  });
93382
93906
  }
93907
+ try {
93908
+ dependencies.cleanupTestHarness(projectDir);
93909
+ } catch (cleanupError) {
93910
+ const detail = cleanupError instanceof Error ? cleanupError.message : String(cleanupError);
93911
+ process.stderr.write(
93912
+ `Warning: could not remove docker test-harness artifacts from the new app (${detail}); they remain in the scaffold.
93913
+ `
93914
+ );
93915
+ }
93383
93916
  onPhaseChange?.("git");
93384
93917
  try {
93385
93918
  await dependencies.initGit(projectDir);
93386
93919
  } catch {
93387
93920
  process.stderr.write(
93388
- "Warning: could not initialize git in the new project; scaffolding completed without an initial commit.\n"
93921
+ "Warning: could not initialize git in the new app; scaffolding completed without an initial commit.\n"
93389
93922
  );
93390
93923
  }
93391
93924
  if (!templateDefinition.provisionLicense) {
@@ -93419,6 +93952,7 @@ async function scaffoldInitProject(options, dependencies = defaultInitScaffoldDe
93419
93952
  );
93420
93953
  dependencies.writeLicenseKey(projectDir, licenseKey);
93421
93954
  licenseWritten = true;
93955
+ const warnings = [];
93422
93956
  if (templateDefinition.includesThreads) {
93423
93957
  onPhaseChange?.("select-project");
93424
93958
  try {
@@ -93428,11 +93962,39 @@ async function scaffoldInitProject(options, dependencies = defaultInitScaffoldDe
93428
93962
  projectSlug: selection.projectSlug,
93429
93963
  clerkOrgId: selection.organizationId
93430
93964
  });
93965
+ dependencies.appendIntelligenceReadme(projectDir, {
93966
+ projectSlug: selection.projectSlug
93967
+ });
93968
+ if (hostedConfig) {
93969
+ try {
93970
+ const apiClient = dependencies.createApiClient(
93971
+ dependencies.getOpsApiUrl(),
93972
+ cliToken ?? ""
93973
+ );
93974
+ const { apiKey } = await apiClient.provisionApiKey(
93975
+ selection.projectId
93976
+ );
93977
+ dependencies.writeHostedApiKey(projectDir, apiKey.token);
93978
+ } catch (provisionError) {
93979
+ const detail = provisionError instanceof Error ? provisionError.message : String(provisionError);
93980
+ warnings.push(
93981
+ `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.`
93982
+ );
93983
+ writeCliLog("error", {
93984
+ event: "init.provision_api_key_failed",
93985
+ detail
93986
+ });
93987
+ }
93988
+ }
93431
93989
  } 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
- `
93990
+ const detail = selectionError instanceof Error ? selectionError.message : String(selectionError);
93991
+ warnings.push(
93992
+ `Project not selected (${detail}); run \`copilotkit project select\` in the project to choose one.`
93435
93993
  );
93994
+ writeCliLog("error", {
93995
+ event: "init.project_select_failed",
93996
+ detail
93997
+ });
93436
93998
  }
93437
93999
  }
93438
94000
  telemetry?.onScaffoldSucceeded({ framework, telemetryId });
@@ -93440,7 +94002,8 @@ async function scaffoldInitProject(options, dependencies = defaultInitScaffoldDe
93440
94002
  projectDir,
93441
94003
  envCreatedFromExample,
93442
94004
  licenseWritten,
93443
- missingPrerequisites
94005
+ missingPrerequisites,
94006
+ warnings
93444
94007
  };
93445
94008
  } catch (error48) {
93446
94009
  if (!projectDirExistedBefore) {
@@ -93471,6 +94034,7 @@ function ScaffoldProgress({
93471
94034
  const scaffoldErrorRef = (0, import_react40.useRef)(null);
93472
94035
  const [authMessage, setAuthMessage] = (0, import_react40.useState)("");
93473
94036
  const [nextSteps, setNextSteps] = (0, import_react40.useState)([]);
94037
+ const [scaffoldWarnings, setScaffoldWarnings] = (0, import_react40.useState)([]);
93474
94038
  const [scaffoldResult, setScaffoldResult] = (0, import_react40.useState)(null);
93475
94039
  const [installError, setInstallError] = (0, import_react40.useState)(null);
93476
94040
  const isMountedRef = (0, import_react40.useRef)(true);
@@ -93498,8 +94062,13 @@ function ScaffoldProgress({
93498
94062
  );
93499
94063
  (0, import_react40.useEffect)(() => {
93500
94064
  if (phase === "success" || phase === "error") {
93501
- exit(resolveScaffoldExitError(phase, scaffoldErrorRef.current));
94065
+ const flushThenExit = setTimeout(
94066
+ () => exit(resolveScaffoldExitError(phase, scaffoldErrorRef.current)),
94067
+ 100
94068
+ );
94069
+ return () => clearTimeout(flushThenExit);
93502
94070
  }
94071
+ return void 0;
93503
94072
  }, [phase, exit]);
93504
94073
  (0, import_react40.useEffect)(
93505
94074
  () => () => {
@@ -93563,39 +94132,47 @@ function ScaffoldProgress({
93563
94132
  installAlreadyRan
93564
94133
  )
93565
94134
  );
94135
+ setScaffoldWarnings(result.warnings ?? []);
93566
94136
  setPhase("success");
93567
94137
  }
93568
94138
  if (shouldRenderInitBrowserLoginConfirmation(browserLogin.state.phase)) {
93569
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(BrowserLoginConfirmation, { reason: authReason });
94139
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BrowserLoginConfirmation, { reason: authReason });
93570
94140
  }
93571
94141
  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." })
94142
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", children: [
94143
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
94144
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { children: authReason }),
94145
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { dimColor: true, children: "Sign in with your browser to continue." })
93576
94146
  ] }),
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" })
94147
+ authMessage ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { color: "yellow", children: authMessage }) : null,
94148
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Spinner, { label: "\u{1FA81} Verifying authentication\u2026" })
93579
94149
  ] });
93580
94150
  }
93581
94151
  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" })
94152
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", children: [
94153
+ authMessage ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { color: "yellow", children: authMessage }) : null,
94154
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Spinner, { label: "\u{1FA81} Issuing license key\u2026" })
93585
94155
  ] });
93586
94156
  }
93587
94157
  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" }) });
94158
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Spinner, { label: "\u{1FA81} Downloading template\u2026" }) });
93589
94159
  }
93590
94160
  if (phase === "select-project") {
93591
94161
  const auth = authStore.get();
93592
94162
  if (auth === null) {
93593
94163
  return null;
93594
94164
  }
93595
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
94165
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
93596
94166
  HostedProjectSelect,
93597
94167
  {
93598
94168
  apiClient: createApiClient(getOpsApiUrl(), auth.cliToken),
94169
+ defaultName: options.name,
94170
+ telemetry: {
94171
+ onPickerViewed: (projectCount) => telemetry?.onProjectPickerViewed({ projectCount }),
94172
+ onResolved: (outcome, projectCount) => telemetry?.onProjectResolved({ outcome, projectCount }),
94173
+ onCreateNameRejected: (reason) => telemetry?.onProjectCreateNameRejected({ reason }),
94174
+ onBack: () => telemetry?.onProjectPickerBack()
94175
+ },
93599
94176
  onResolved: (selection) => selectionDeferredRef.current?.resolve(selection),
93600
94177
  onCanceled: () => selectionDeferredRef.current?.reject(
93601
94178
  new Error("Project selection canceled.")
@@ -93605,13 +94182,13 @@ function ScaffoldProgress({
93605
94182
  );
93606
94183
  }
93607
94184
  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" }) });
94185
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Spinner, { label: "\u{1FA81} Activating Intelligence\u2026" }) });
93609
94186
  }
93610
94187
  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" }) });
94188
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Spinner, { label: "Initializing git repository\u2026" }) });
93612
94189
  }
93613
94190
  if (phase === "install-prompt" && scaffoldResult) {
93614
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
94191
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
93615
94192
  InstallPrompt,
93616
94193
  {
93617
94194
  installCommand: templateDefinition.installCommand,
@@ -93623,7 +94200,8 @@ function ScaffoldProgress({
93623
94200
  setPhase("installing");
93624
94201
  scaffoldDependencies.installDependencies({
93625
94202
  cwd: scaffoldResult.projectDir,
93626
- command: templateDefinition.installCommand
94203
+ command: templateDefinition.installCommand,
94204
+ log: writeCliLog
93627
94205
  }).then((r) => {
93628
94206
  if (r.ok)
93629
94207
  return true;
@@ -93646,31 +94224,54 @@ function ScaffoldProgress({
93646
94224
  );
93647
94225
  }
93648
94226
  if (phase === "installing") {
93649
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Spinner, { label: "\u{1FA81} Installing dependencies\u2026" });
94227
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Spinner, { label: "\u{1FA81} Installing dependencies\u2026" });
93650
94228
  }
93651
94229
  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 "',
94230
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", children: [
94231
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(SuccessText, { marker: templateDefinition.successEmoji, children: [
94232
+ 'App "',
93656
94233
  options.name,
93657
94234
  '" created successfully!'
93658
94235
  ] }),
93659
- installError ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { color: "yellow", children: [
93660
- "Install didn't finish (",
93661
- installError.split("\n").slice(-1)[0],
93662
- "). Run",
93663
- " ",
93664
- templateDefinition.installCommand,
93665
- " yourself."
93666
- ] }) : null,
93667
- nextSteps.map((step, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: "gray", children: step }, `step-${index}`))
94236
+ installError ? (
94237
+ // The error detail is not inlined here — it goes to the CLI log; the
94238
+ // second line points the user at the full captured output.
94239
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
94240
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { color: "yellow", children: "Install didn't finish after a retry." }),
94241
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { color: "yellow", children: [
94242
+ "Full output: ",
94243
+ getCliLogPath()
94244
+ ] })
94245
+ ] })
94246
+ ) : null,
94247
+ scaffoldWarnings.map((warning, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { color: "yellow", children: [
94248
+ "\u26A0 ",
94249
+ warning
94250
+ ] }, `warn-${index}`)),
94251
+ nextSteps.map((step, index) => (
94252
+ // The builder hands us the split already: `text` is friendly prose
94253
+ // and the optional `code` tail is the command/value, emphasized like
94254
+ // inline code in markdown/Slack. Both render on the terminal's
94255
+ // inherited default foreground (no absolute color) so they stay
94256
+ // legible on both light and dark terminals — an absolute accent (cyan,
94257
+ // white) washes out on one background or the other. The `code` tail is
94258
+ // `bold` to stand out from prose; prose-only lines (headings, notes)
94259
+ // carry no `code`.
94260
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { children: [
94261
+ step.text,
94262
+ step.code !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { bold: true, children: step.code }) : null
94263
+ ] }, `step-${index}`)
94264
+ )),
94265
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { children: " " })
93668
94266
  ] });
93669
94267
  }
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
- ] }) });
94268
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", children: [
94269
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { color: "red", children: [
94270
+ "Init failed: ",
94271
+ errorMessage
94272
+ ] }),
94273
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { children: " " })
94274
+ ] });
93674
94275
  }
93675
94276
  function InstallPrompt({
93676
94277
  installCommand,
@@ -93688,14 +94289,16 @@ function InstallPrompt({
93688
94289
  onAnswer(false);
93689
94290
  }
93690
94291
  });
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? (",
94292
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { children: [
94293
+ "Want me to install the dependencies for you now? (",
93693
94294
  installCommand,
93694
- ") [Y/n]"
94295
+ ")",
94296
+ " ",
94297
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { bold: true, children: "[Y/n]" })
93695
94298
  ] }) });
93696
94299
  }
93697
94300
  function renderDefaultScaffoldProgress(options, telemetry) {
93698
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ScaffoldProgress, { options, telemetry });
94301
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ScaffoldProgress, { options, telemetry });
93699
94302
  }
93700
94303
  function resolvePrefilledOptions(name, intelligence, framework) {
93701
94304
  if (name === null)
@@ -93743,13 +94346,13 @@ function InitApp({
93743
94346
  }
93744
94347
  }
93745
94348
  }, []);
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, {})
94349
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", children: [
94350
+ !noBanner && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
94351
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Banner, {}),
94352
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IntelligenceFeatures, {})
93750
94353
  ] }),
93751
- options !== null ? renderScaffoldProgress(options, telemetry) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
93752
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
94354
+ options !== null ? renderScaffoldProgress(options, telemetry) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
94355
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
93753
94356
  InitFlow,
93754
94357
  {
93755
94358
  initialName,
@@ -93764,7 +94367,7 @@ function InitApp({
93764
94367
  }
93765
94368
  }
93766
94369
  ),
93767
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CliTip, {})
94370
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CliTip, {})
93768
94371
  ] })
93769
94372
  ] });
93770
94373
  }
@@ -93788,7 +94391,7 @@ async function runInit(flags, callbacks) {
93788
94391
  }
93789
94392
  const initialFramework = frameworkFlag;
93790
94393
  const { waitUntilExit } = render_default(
93791
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(BrowserLoginProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
94394
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BrowserLoginProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
93792
94395
  InitApp,
93793
94396
  {
93794
94397
  initialName,
@@ -93803,7 +94406,7 @@ async function runInit(flags, callbacks) {
93803
94406
  );
93804
94407
  await waitUntilExit();
93805
94408
  }
93806
- var import_react40, import_jsx_runtime11, PROJECT_CREATION_AUTH_HANDOFF, INIT_AUTH_REASON_WITH_LICENSE, INIT_AUTH_REASON_ACCOUNT_ONLY, defaultInitScaffoldDependencies;
94409
+ var import_react40, import_jsx_runtime12, PROJECT_CREATION_AUTH_HANDOFF, INIT_AUTH_REASON_WITH_LICENSE, INIT_AUTH_REASON_ACCOUNT_ONLY, defaultInitScaffoldDependencies;
93807
94410
  var init_init = __esm({
93808
94411
  async "apps/cli/src/commands/init.tsx"() {
93809
94412
  "use strict";
@@ -93819,21 +94422,24 @@ var init_init = __esm({
93819
94422
  init_vendor_env_keys();
93820
94423
  init_config_service();
93821
94424
  init_event_properties();
94425
+ init_cli_logs();
93822
94426
  await init_banner();
93823
94427
  await init_browser_login();
93824
94428
  await init_cli_tip();
93825
94429
  await init_init_flow();
93826
94430
  await init_spinner();
94431
+ await init_success_text();
93827
94432
  init_config();
93828
94433
  await init_hosted_project_select();
93829
94434
  init_project_config();
93830
- import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
94435
+ init_intelligence_readme();
94436
+ import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
93831
94437
  PROJECT_CREATION_AUTH_HANDOFF = {
93832
94438
  source: "cli",
93833
94439
  mode: "project_creation"
93834
94440
  };
93835
94441
  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.";
94442
+ INIT_AUTH_REASON_ACCOUNT_ONLY = "A free CopilotKit account is required to link this app.";
93837
94443
  defaultInitScaffoldDependencies = {
93838
94444
  verifyAndRefresh,
93839
94445
  login,
@@ -93843,14 +94449,15 @@ var init_init = __esm({
93843
94449
  scaffoldProject,
93844
94450
  initGit,
93845
94451
  copyEnvExample,
94452
+ cleanupTestHarness: removeTestHarnessArtifacts,
93846
94453
  writeLicenseKey,
93847
94454
  commandExists,
93848
- resolveProjectDir: (projectName) => path13.resolve(process.cwd(), projectName),
94455
+ resolveProjectDir: (projectName) => path14.resolve(process.cwd(), projectName),
93849
94456
  activateIntelligence,
93850
94457
  installDependencies,
93851
94458
  readProjectEnvFile: (projectDir) => {
93852
- const envPath = path13.join(projectDir, ".env");
93853
- return existsSync6(envPath) ? readFileSync5(envPath, "utf8") : "";
94459
+ const envPath = path14.join(projectDir, ".env");
94460
+ return existsSync7(envPath) ? readFileSync6(envPath, "utf8") : "";
93854
94461
  },
93855
94462
  resolveHostedScaffoldConfig,
93856
94463
  selectHostedProject: () => {
@@ -93858,7 +94465,9 @@ var init_init = __esm({
93858
94465
  "selectHostedProject must be provided by the interactive init shell."
93859
94466
  );
93860
94467
  },
93861
- writeProjectConfig
94468
+ writeProjectConfig,
94469
+ appendIntelligenceReadme,
94470
+ writeHostedApiKey
93862
94471
  };
93863
94472
  }
93864
94473
  });
@@ -93899,15 +94508,15 @@ function LoginFlow({ onComplete }) {
93899
94508
  onComplete({ error: fallbackError, success: false });
93900
94509
  });
93901
94510
  }, [onComplete, runLogin2]);
93902
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BrowserLoginConfirmation, {});
94511
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BrowserLoginConfirmation, {});
93903
94512
  }
93904
- var import_react41, import_jsx_runtime12;
94513
+ var import_react41, import_jsx_runtime13;
93905
94514
  var init_login_flow = __esm({
93906
94515
  async "apps/cli/src/ui/login-flow.tsx"() {
93907
94516
  "use strict";
93908
94517
  import_react41 = __toESM(require_react(), 1);
93909
94518
  await init_browser_login();
93910
- import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
94519
+ import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
93911
94520
  }
93912
94521
  });
93913
94522
 
@@ -93919,7 +94528,7 @@ __export(login_exports, {
93919
94528
  async function runLogin() {
93920
94529
  return await new Promise((resolve2, reject) => {
93921
94530
  const { unmount } = render_default(
93922
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BrowserLoginProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
94531
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(BrowserLoginProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
93923
94532
  LoginFlow,
93924
94533
  {
93925
94534
  onComplete: (result) => {
@@ -93937,14 +94546,14 @@ async function runLogin() {
93937
94546
  );
93938
94547
  });
93939
94548
  }
93940
- var import_jsx_runtime13;
94549
+ var import_jsx_runtime14;
93941
94550
  var init_login = __esm({
93942
94551
  async "apps/cli/src/commands/login.tsx"() {
93943
94552
  "use strict";
93944
94553
  await init_build2();
93945
94554
  await init_login_flow();
93946
94555
  await init_browser_login();
93947
- import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
94556
+ import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
93948
94557
  }
93949
94558
  });
93950
94559
 
@@ -94195,16 +94804,16 @@ function KiteGame({
94195
94804
  setState((currentState) => flapKite(currentState));
94196
94805
  }
94197
94806
  });
94198
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Box_default, { flexDirection: "column", children: [
94199
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Text, { children: [
94807
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { flexDirection: "column", children: [
94808
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text, { children: [
94200
94809
  "CopilotKit Kite Score ",
94201
94810
  state.score,
94202
94811
  " High",
94203
94812
  " ",
94204
94813
  Math.max(highScore, state.score)
94205
94814
  ] }),
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." })
94815
+ /* @__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}`)) }),
94816
+ /* @__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
94817
  ] });
94209
94818
  }
94210
94819
  function useTerminalWidth(stdout) {
@@ -94228,7 +94837,7 @@ function getStdoutColumns(stdout) {
94228
94837
  function getPlayableWidth(terminalWidth) {
94229
94838
  return Math.max(MIN_PLAYABLE_WIDTH, terminalWidth - BORDER_COLUMNS);
94230
94839
  }
94231
- var import_react42, import_jsx_runtime14, DEFAULT_TICK_MS, MIN_PLAYABLE_WIDTH, BORDER_COLUMNS;
94840
+ var import_react42, import_jsx_runtime15, DEFAULT_TICK_MS, MIN_PLAYABLE_WIDTH, BORDER_COLUMNS;
94232
94841
  var init_kite_game = __esm({
94233
94842
  async "apps/cli/src/ui/kite-game.tsx"() {
94234
94843
  "use strict";
@@ -94236,7 +94845,7 @@ var init_kite_game = __esm({
94236
94845
  import_react42 = __toESM(require_react(), 1);
94237
94846
  init_kite_game_engine();
94238
94847
  init_kite_game_score();
94239
- import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
94848
+ import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
94240
94849
  DEFAULT_TICK_MS = 75;
94241
94850
  MIN_PLAYABLE_WIDTH = 32;
94242
94851
  BORDER_COLUMNS = 2;
@@ -94250,19 +94859,19 @@ __export(kite_exports, {
94250
94859
  });
94251
94860
  async function runKite() {
94252
94861
  return await new Promise((resolve2, reject) => {
94253
- const { waitUntilExit } = render_default(/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(KiteGame, { onExit: resolve2 }));
94862
+ const { waitUntilExit } = render_default(/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(KiteGame, { onExit: resolve2 }));
94254
94863
  waitUntilExit().then(() => {
94255
94864
  resolve2();
94256
94865
  }).catch(reject);
94257
94866
  });
94258
94867
  }
94259
- var import_jsx_runtime15;
94868
+ var import_jsx_runtime16;
94260
94869
  var init_kite = __esm({
94261
94870
  async "apps/cli/src/commands/kite.tsx"() {
94262
94871
  "use strict";
94263
94872
  await init_build2();
94264
94873
  await init_kite_game();
94265
- import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
94874
+ import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
94266
94875
  }
94267
94876
  });
94268
94877
 
@@ -94272,7 +94881,7 @@ init_types();
94272
94881
  await init_telemetry();
94273
94882
  import { parseArgs } from "node:util";
94274
94883
  import { realpathSync } from "node:fs";
94275
- import path14 from "node:path";
94884
+ import path15 from "node:path";
94276
94885
  import { fileURLToPath as fileURLToPath2 } from "node:url";
94277
94886
 
94278
94887
  // apps/cli/src/services/telemetry/init-events.ts
@@ -94344,6 +94953,34 @@ function buildScaffoldSucceededEvent(input) {
94344
94953
  }
94345
94954
  };
94346
94955
  }
94956
+ function buildProjectPickerViewedEvent(input) {
94957
+ return {
94958
+ event: "cli.init.project_picker_viewed",
94959
+ properties: { command: "init", project_count: input.projectCount }
94960
+ };
94961
+ }
94962
+ function buildProjectResolvedEvent(input) {
94963
+ return {
94964
+ event: "cli.init.project_resolved",
94965
+ properties: {
94966
+ command: "init",
94967
+ project_outcome: input.outcome,
94968
+ project_count: input.projectCount
94969
+ }
94970
+ };
94971
+ }
94972
+ function buildProjectCreateNameRejectedEvent(input) {
94973
+ return {
94974
+ event: "cli.init.project_create_name_rejected",
94975
+ properties: { command: "init", project_reject_reason: input.reason }
94976
+ };
94977
+ }
94978
+ function buildProjectPickerBackEvent() {
94979
+ return {
94980
+ event: "cli.init.project_picker_back",
94981
+ properties: { command: "init" }
94982
+ };
94983
+ }
94347
94984
  function createInitTelemetryCallbacks(deps) {
94348
94985
  const record2 = (event) => deps.record({
94349
94986
  ...event,
@@ -94372,6 +95009,18 @@ function createInitTelemetryCallbacks(deps) {
94372
95009
  },
94373
95010
  onScaffoldSucceeded(input) {
94374
95011
  record2(buildScaffoldSucceededEvent(input));
95012
+ },
95013
+ onProjectPickerViewed(input) {
95014
+ record2(buildProjectPickerViewedEvent(input));
95015
+ },
95016
+ onProjectResolved(input) {
95017
+ record2(buildProjectResolvedEvent(input));
95018
+ },
95019
+ onProjectCreateNameRejected(input) {
95020
+ record2(buildProjectCreateNameRejectedEvent(input));
95021
+ },
95022
+ onProjectPickerBack() {
95023
+ record2(buildProjectPickerBackEvent());
94375
95024
  }
94376
95025
  };
94377
95026
  }
@@ -94458,7 +95107,7 @@ Aliases:
94458
95107
  create Alias of init
94459
95108
 
94460
95109
  Options:
94461
- -n, --name <name> Project name
95110
+ -n, --name <name> App name (names the local app and its directory)
94462
95111
  -f, --framework <fw> Agent framework (prompted if omitted)
94463
95112
  -i, --intelligence Deprecated no-op: Intelligence (durable conversations,
94464
95113
  persistence, insights) ships with every supported
@@ -94745,7 +95394,7 @@ async function runWhoami() {
94745
95394
  `);
94746
95395
  return;
94747
95396
  }
94748
- if (error48 instanceof ApiClientError2) {
95397
+ if (error48 instanceof ApiClientError2 && error48.status > 0) {
94749
95398
  process.stdout.write(`${error48.message}
94750
95399
  `);
94751
95400
  return;
@@ -95272,7 +95921,7 @@ ${HELP_TEXT_BY_TOPIC.root}`
95272
95921
  await entry.run(commandArgv, command);
95273
95922
  }
95274
95923
  function resolveRealPath(candidatePath) {
95275
- const absolutePath = path14.resolve(candidatePath);
95924
+ const absolutePath = path15.resolve(candidatePath);
95276
95925
  try {
95277
95926
  return realpathSync.native(absolutePath);
95278
95927
  } catch {