copilotkit 4.8.1 → 4.8.2

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.
@@ -2,20 +2,20 @@
2
2
  "schemaVersion": 1,
3
3
  "package": {
4
4
  "name": "copilotkit",
5
- "version": "4.8.1"
5
+ "version": "4.8.2"
6
6
  },
7
7
  "intelligence": {
8
- "commit": "7e4dbf17af5094cde256eeaecdbef1869ebd13e4"
8
+ "commit": "fca6bc8954118609a6aa51d8635e632e72626706"
9
9
  },
10
10
  "copilotKit": {
11
- "submittedInput": "7e502dd4a452",
12
- "commit": "7e502dd4a452feee7d26c6355fd262948f8c25e6"
11
+ "submittedInput": "53cf7e6575e8eae2a0dcaf64a7c3c2baf3e6dd04",
12
+ "commit": "53cf7e6575e8eae2a0dcaf64a7c3c2baf3e6dd04"
13
13
  },
14
14
  "channel": "production",
15
- "triggeringActor": "BenTaylorDev",
15
+ "triggeringActor": "MikeRyanDev",
16
16
  "workflow": {
17
- "runId": "31032635990",
18
- "runUrl": "https://github.com/CopilotKit/Intelligence/actions/runs/31032635990"
17
+ "runId": "31119700532",
18
+ "runUrl": "https://github.com/CopilotKit/Intelligence/actions/runs/31119700532"
19
19
  },
20
20
  "validationResult": "passed",
21
21
  "ag2": {
@@ -24,5 +24,5 @@
24
24
  "revision": "main",
25
25
  "pinned": false
26
26
  },
27
- "builtAt": "2026-08-05T18:01:39Z"
27
+ "builtAt": "2026-08-06T22:05:24Z"
28
28
  }
package/index.js CHANGED
@@ -87,14 +87,14 @@ function getTelemetryEndpointUrl() {
87
87
  }
88
88
  function getBuildInfo() {
89
89
  return {
90
- version: true ? "4.8.1" : "dev",
91
- buildNumber: true ? "31032635990" : "dev",
92
- commitSha: true ? "7e4dbf17af5094cde256eeaecdbef1869ebd13e4" : "dev",
90
+ version: true ? "4.8.2" : "dev",
91
+ buildNumber: true ? "31119700532" : "dev",
92
+ commitSha: true ? "fca6bc8954118609a6aa51d8635e632e72626706" : "dev",
93
93
  copilotKitCommit: getTemplateRef()
94
94
  };
95
95
  }
96
96
  function getTemplateRef() {
97
- return true ? "7e502dd4a452feee7d26c6355fd262948f8c25e6" : "main";
97
+ return true ? "53cf7e6575e8eae2a0dcaf64a7c3c2baf3e6dd04" : "main";
98
98
  }
99
99
  function getC15tBackendUrl() {
100
100
  return true ? "https://calm-hazelnut-joy-copilotkit.inth.app" : "";
@@ -939,7 +939,7 @@ function deriveSkillsSelection(flags) {
939
939
  agent_count: agentCount
940
940
  };
941
941
  }
942
- function classifyError(err) {
942
+ function classifyError(err, depth = 0) {
943
943
  if (!(err instanceof Error)) {
944
944
  return "unknown";
945
945
  }
@@ -994,9 +994,13 @@ function classifyError(err) {
994
994
  return "network";
995
995
  }
996
996
  }
997
+ const cause = err.cause;
998
+ if (cause !== void 0 && cause !== null && depth < MAX_CAUSE_DEPTH) {
999
+ return classifyError(cause, depth + 1);
1000
+ }
997
1001
  return "unknown";
998
1002
  }
999
- var TELEMETRY_ERROR_CODES, CI_INDICATOR_VARS;
1003
+ var TELEMETRY_ERROR_CODES, CI_INDICATOR_VARS, MAX_CAUSE_DEPTH;
1000
1004
  var init_event_properties = __esm({
1001
1005
  "apps/cli/src/services/telemetry/event-properties.ts"() {
1002
1006
  "use strict";
@@ -1021,6 +1025,7 @@ var init_event_properties = __esm({
1021
1025
  "JENKINS_URL",
1022
1026
  "TF_BUILD"
1023
1027
  ];
1028
+ MAX_CAUSE_DEPTH = 4;
1024
1029
  }
1025
1030
  });
1026
1031
 
@@ -28248,6 +28253,46 @@ var init_config_service = __esm({
28248
28253
  }
28249
28254
  });
28250
28255
 
28256
+ // apps/cli/src/services/project-config.ts
28257
+ import * as fs6 from "node:fs";
28258
+ import * as path8 from "node:path";
28259
+ function projectConfigPath(dir) {
28260
+ return path8.join(dir, ".copilotkit", "project.json");
28261
+ }
28262
+ function readProjectConfig(dir) {
28263
+ const configPath = projectConfigPath(dir);
28264
+ if (!fs6.existsSync(configPath)) {
28265
+ return void 0;
28266
+ }
28267
+ let parsed;
28268
+ try {
28269
+ parsed = JSON.parse(fs6.readFileSync(configPath, "utf8"));
28270
+ } catch {
28271
+ return void 0;
28272
+ }
28273
+ const validated = projectConfigSchema.safeParse(parsed);
28274
+ return validated.success ? validated.data : void 0;
28275
+ }
28276
+ function writeProjectConfig(dir, config2) {
28277
+ const validated = projectConfigSchema.parse(config2);
28278
+ const configPath = projectConfigPath(dir);
28279
+ fs6.mkdirSync(path8.dirname(configPath), { recursive: true });
28280
+ fs6.writeFileSync(configPath, `${JSON.stringify(validated, null, 2)}
28281
+ `);
28282
+ }
28283
+ var projectConfigSchema;
28284
+ var init_project_config = __esm({
28285
+ "apps/cli/src/services/project-config.ts"() {
28286
+ "use strict";
28287
+ init_zod();
28288
+ projectConfigSchema = external_exports.object({
28289
+ projectId: external_exports.string().min(1),
28290
+ projectSlug: external_exports.string().min(1),
28291
+ clerkOrgId: external_exports.string().min(1)
28292
+ }).strict();
28293
+ }
28294
+ });
28295
+
28251
28296
  // node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err-helpers.js
28252
28297
  var require_err_helpers = __commonJS({
28253
28298
  "node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err-helpers.js"(exports2, module2) {
@@ -32669,19 +32714,19 @@ __export(cli_logs_exports, {
32669
32714
  setCliLogsVerbose: () => setCliLogsVerbose,
32670
32715
  writeCliLog: () => writeCliLog
32671
32716
  });
32672
- import * as fs6 from "node:fs";
32717
+ import * as fs7 from "node:fs";
32673
32718
  import * as os2 from "node:os";
32674
- import * as path8 from "node:path";
32719
+ import * as path9 from "node:path";
32675
32720
  function ensurePrivateCliLogPath() {
32676
- fs6.mkdirSync(CLI_LOG_DIRECTORY, {
32721
+ fs7.mkdirSync(CLI_LOG_DIRECTORY, {
32677
32722
  mode: CLI_LOG_DIRECTORY_MODE,
32678
32723
  recursive: true
32679
32724
  });
32680
- fs6.chmodSync(CLI_LOG_DIRECTORY, CLI_LOG_DIRECTORY_MODE);
32681
- if (!fs6.existsSync(CLI_LOG_PATH)) {
32682
- fs6.closeSync(fs6.openSync(CLI_LOG_PATH, "a", CLI_LOG_FILE_MODE));
32725
+ fs7.chmodSync(CLI_LOG_DIRECTORY, CLI_LOG_DIRECTORY_MODE);
32726
+ if (!fs7.existsSync(CLI_LOG_PATH)) {
32727
+ fs7.closeSync(fs7.openSync(CLI_LOG_PATH, "a", CLI_LOG_FILE_MODE));
32683
32728
  }
32684
- fs6.chmodSync(CLI_LOG_PATH, CLI_LOG_FILE_MODE);
32729
+ fs7.chmodSync(CLI_LOG_PATH, CLI_LOG_FILE_MODE);
32685
32730
  }
32686
32731
  function countNewlines(value) {
32687
32732
  let newlineCount = 0;
@@ -32712,11 +32757,11 @@ function maybeWriteCliVerboseLine(prefix, phase, details) {
32712
32757
  `);
32713
32758
  }
32714
32759
  function readCliLogTail(count) {
32715
- if (!fs6.existsSync(CLI_LOG_PATH)) {
32760
+ if (!fs7.existsSync(CLI_LOG_PATH)) {
32716
32761
  return [];
32717
32762
  }
32718
- const fileDescriptor = fs6.openSync(CLI_LOG_PATH, "r");
32719
- const fileSize = fs6.fstatSync(fileDescriptor).size;
32763
+ const fileDescriptor = fs7.openSync(CLI_LOG_PATH, "r");
32764
+ const fileSize = fs7.fstatSync(fileDescriptor).size;
32720
32765
  let position = fileSize;
32721
32766
  let newlineCount = 0;
32722
32767
  const chunks = [];
@@ -32725,13 +32770,13 @@ function readCliLogTail(count) {
32725
32770
  const bytesToRead = Math.min(CLI_LOG_TAIL_CHUNK_BYTES, position);
32726
32771
  const buffer = Buffer.alloc(bytesToRead);
32727
32772
  position -= bytesToRead;
32728
- fs6.readSync(fileDescriptor, buffer, 0, bytesToRead, position);
32773
+ fs7.readSync(fileDescriptor, buffer, 0, bytesToRead, position);
32729
32774
  const chunk = buffer.toString("utf8");
32730
32775
  chunks.unshift(chunk);
32731
32776
  newlineCount += countNewlines(chunk);
32732
32777
  }
32733
32778
  } finally {
32734
- fs6.closeSync(fileDescriptor);
32779
+ fs7.closeSync(fileDescriptor);
32735
32780
  }
32736
32781
  const content = chunks.join("");
32737
32782
  const lines = content.split("\n").filter((line) => line.length > 0);
@@ -32742,11 +32787,11 @@ var init_cli_logs = __esm({
32742
32787
  "apps/cli/src/services/cli-logs.ts"() {
32743
32788
  "use strict";
32744
32789
  import_pino = __toESM(require_pino(), 1);
32745
- CLI_LOG_DIRECTORY = path8.join(
32790
+ CLI_LOG_DIRECTORY = path9.join(
32746
32791
  process.env["XDG_STATE_HOME"] ?? os2.homedir(),
32747
32792
  process.env["XDG_STATE_HOME"] ? "copilotkit" : ".copilotkit"
32748
32793
  );
32749
- CLI_LOG_PATH = path8.join(CLI_LOG_DIRECTORY, "cli.log");
32794
+ CLI_LOG_PATH = path9.join(CLI_LOG_DIRECTORY, "cli.log");
32750
32795
  CLI_LOG_DIRECTORY_MODE = 448;
32751
32796
  CLI_LOG_FILE_MODE = 384;
32752
32797
  CLI_LOG_TAIL_CHUNK_BYTES = 64 * 1024;
@@ -38887,7 +38932,7 @@ var init_wrap_ansi = __esm({
38887
38932
  // node_modules/.pnpm/terminal-size@4.0.1/node_modules/terminal-size/index.js
38888
38933
  import process10 from "node:process";
38889
38934
  import { execFileSync } from "node:child_process";
38890
- import fs7 from "node:fs";
38935
+ import fs8 from "node:fs";
38891
38936
  import tty from "node:tty";
38892
38937
  function terminalSize() {
38893
38938
  const { env: env5, stdout, stderr } = process10;
@@ -38944,7 +38989,7 @@ var init_terminal_size = __esm({
38944
38989
  return true;
38945
38990
  }
38946
38991
  try {
38947
- const statContents = fs7.readFileSync("/proc/self/stat", "utf8");
38992
+ const statContents = fs8.readFileSync("/proc/self/stat", "utf8");
38948
38993
  const closingParenthesisIndex = statContents.lastIndexOf(") ");
38949
38994
  if (closingParenthesisIndex === -1) {
38950
38995
  return false;
@@ -38965,8 +39010,8 @@ var init_terminal_size = __esm({
38965
39010
  };
38966
39011
  devTty = () => {
38967
39012
  try {
38968
- const flags = process10.platform === "darwin" ? fs7.constants.O_EVTONLY | fs7.constants.O_NONBLOCK : fs7.constants.O_NONBLOCK;
38969
- const { columns, rows } = tty.WriteStream(fs7.openSync("/dev/tty", flags));
39013
+ const flags = process10.platform === "darwin" ? fs8.constants.O_EVTONLY | fs8.constants.O_NONBLOCK : fs8.constants.O_NONBLOCK;
39014
+ const { columns, rows } = tty.WriteStream(fs8.openSync("/dev/tty", flags));
38970
39015
  return { columns, rows };
38971
39016
  } catch {
38972
39017
  }
@@ -87517,7 +87562,7 @@ var init_Text = __esm({
87517
87562
  });
87518
87563
 
87519
87564
  // 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/components/ErrorOverview.js
87520
- import * as fs8 from "node:fs";
87565
+ import * as fs9 from "node:fs";
87521
87566
  import { cwd } from "node:process";
87522
87567
  function ErrorOverview({ error: error48 }) {
87523
87568
  const stack = error48.stack ? error48.stack.split("\n").slice(1) : void 0;
@@ -87525,8 +87570,8 @@ function ErrorOverview({ error: error48 }) {
87525
87570
  const filePath = cleanupPath(origin?.file);
87526
87571
  let excerpt;
87527
87572
  let lineWidth = 0;
87528
- if (filePath && origin?.line && fs8.existsSync(filePath)) {
87529
- const sourceCode = fs8.readFileSync(filePath, "utf8");
87573
+ if (filePath && origin?.line && fs9.existsSync(filePath)) {
87574
+ const sourceCode = fs9.readFileSync(filePath, "utf8");
87530
87575
  excerpt = dist_default4(sourceCode, origin.line);
87531
87576
  if (excerpt) {
87532
87577
  for (const { line } of excerpt) {
@@ -90568,6 +90613,27 @@ var init_installation_id = __esm({
90568
90613
  }
90569
90614
  });
90570
90615
 
90616
+ // apps/cli/src/services/telemetry/cli-state.ts
90617
+ function resolveCliStateProperties(deps) {
90618
+ const hasProjectSelection = deps.hasProjectSelection;
90619
+ return {
90620
+ authenticated: safeRead(deps.hasStoredAuth),
90621
+ ...hasProjectSelection === null ? {} : { has_selected_project: safeRead(hasProjectSelection) }
90622
+ };
90623
+ }
90624
+ function safeRead(read) {
90625
+ try {
90626
+ return read();
90627
+ } catch {
90628
+ return false;
90629
+ }
90630
+ }
90631
+ var init_cli_state = __esm({
90632
+ "apps/cli/src/services/telemetry/cli-state.ts"() {
90633
+ "use strict";
90634
+ }
90635
+ });
90636
+
90571
90637
  // apps/cli/src/services/telemetry/notice.ts
90572
90638
  var notice_exports = {};
90573
90639
  __export(notice_exports, {
@@ -90588,7 +90654,8 @@ function clearTelemetryNoticeMarker(store) {
90588
90654
  }
90589
90655
  function formatTelemetryNotice(privacyPolicyUrl) {
90590
90656
  return [
90591
- "The CopilotKit CLI collects anonymous usage data to help improve the product.",
90657
+ "The CopilotKit CLI collects usage data to help improve the product.",
90658
+ "While you are signed in, that data is linked to your CopilotKit account.",
90592
90659
  "",
90593
90660
  " Disable anytime: copilotkit telemetry disable (or set DO_NOT_TRACK=1)",
90594
90661
  ` Privacy policy: ${privacyPolicyUrl}`,
@@ -90600,7 +90667,7 @@ var TELEMETRY_NOTICE_SHOWN_KEY;
90600
90667
  var init_notice = __esm({
90601
90668
  "apps/cli/src/services/telemetry/notice.ts"() {
90602
90669
  "use strict";
90603
- TELEMETRY_NOTICE_SHOWN_KEY = "telemetry.noticeShownAt";
90670
+ TELEMETRY_NOTICE_SHOWN_KEY = "telemetry.noticeShownAt.v2";
90604
90671
  }
90605
90672
  });
90606
90673
 
@@ -90737,11 +90804,12 @@ __export(telemetry_exports, {
90737
90804
  __resetTelemetryForTests: () => __resetTelemetryForTests,
90738
90805
  __setConsentProviderForTests: () => __setConsentProviderForTests,
90739
90806
  cliLogTelemetryLogger: () => cliLogTelemetryLogger,
90807
+ currentCliStateProperties: () => currentCliStateProperties,
90740
90808
  exitWithFlush: () => exitWithFlush,
90741
90809
  flushTelemetry: () => flushTelemetry,
90742
90810
  getCliConsentProvider: () => getCliConsentProvider,
90811
+ getLinkableInstallationId: () => getLinkableInstallationId,
90743
90812
  getTelemetry: () => getTelemetry,
90744
- getTelemetryDistinctIdForUrlPropagation: () => getTelemetryDistinctIdForUrlPropagation,
90745
90813
  linkConsentSubjectToUser: () => linkConsentSubjectToUser,
90746
90814
  recordTelemetryEvent: () => recordTelemetryEvent,
90747
90815
  withTelemetry: () => withTelemetry
@@ -90802,6 +90870,15 @@ function getTelemetry() {
90802
90870
  });
90803
90871
  return instance;
90804
90872
  }
90873
+ function currentCliStateProperties(command) {
90874
+ return resolveCliStateProperties({
90875
+ hasStoredAuth: () => authStore.get() !== null,
90876
+ // `init` creates the project directory it is about to fill, and runs from
90877
+ // that directory's parent, so a cwd reading would describe the wrong
90878
+ // directory. Omitted rather than reported as a misleading `false`.
90879
+ hasProjectSelection: command === "init" ? null : () => readProjectConfig(process.cwd()) !== void 0
90880
+ });
90881
+ }
90805
90882
  function recordTelemetryEvent(event) {
90806
90883
  const buildInfo = getBuildInfo();
90807
90884
  const provider = getConsentProvider();
@@ -90850,12 +90927,19 @@ async function withTelemetry(base, fn) {
90850
90927
  extra = { ...extra, ...next };
90851
90928
  }
90852
90929
  };
90853
- recordTelemetryEvent({ properties: { ...base, outcome: "started" } });
90930
+ recordTelemetryEvent({
90931
+ properties: {
90932
+ ...base,
90933
+ ...currentCliStateProperties(base.command),
90934
+ outcome: "started"
90935
+ }
90936
+ });
90854
90937
  try {
90855
90938
  const result = await fn(ctx);
90856
90939
  recordTelemetryEvent({
90857
90940
  properties: {
90858
90941
  ...base,
90942
+ ...currentCliStateProperties(base.command),
90859
90943
  ...extra,
90860
90944
  outcome: "succeeded",
90861
90945
  duration_ms: Date.now() - startedAt
@@ -90866,6 +90950,7 @@ async function withTelemetry(base, fn) {
90866
90950
  recordTelemetryEvent({
90867
90951
  properties: {
90868
90952
  ...base,
90953
+ ...currentCliStateProperties(base.command),
90869
90954
  ...extra,
90870
90955
  outcome: "failed",
90871
90956
  duration_ms: Date.now() - startedAt,
@@ -90889,7 +90974,7 @@ function linkConsentSubjectToUser() {
90889
90974
  authSnapshot: () => authStore.get()
90890
90975
  });
90891
90976
  }
90892
- function getTelemetryDistinctIdForUrlPropagation() {
90977
+ function getLinkableInstallationId() {
90893
90978
  const buildInfo = getBuildInfo();
90894
90979
  if (isTelemetrySuppressedByBuildOrPreference(buildInfo.version))
90895
90980
  return null;
@@ -90916,6 +91001,7 @@ var init_telemetry = __esm({
90916
91001
  "use strict";
90917
91002
  init_config();
90918
91003
  init_config_service();
91004
+ init_project_config();
90919
91005
  init_cli_logs();
90920
91006
  init_dist5();
90921
91007
  init_c15t_consent_provider();
@@ -90924,6 +91010,7 @@ var init_telemetry = __esm({
90924
91010
  init_gate();
90925
91011
  init_event_properties();
90926
91012
  init_installation_id();
91013
+ init_cli_state();
90927
91014
  init_notice();
90928
91015
  init_opt_out();
90929
91016
  init_telemetry_service();
@@ -90955,7 +91042,14 @@ function buildChannelsStageProperties(input) {
90955
91042
  function recordChannelsStage(input) {
90956
91043
  recordTelemetryEvent({
90957
91044
  event: CHANNELS_SETUP_STAGE_EVENT,
90958
- properties: buildChannelsStageProperties(input)
91045
+ properties: {
91046
+ ...buildChannelsStageProperties(input),
91047
+ // Merged here, in the recorder, rather than inside the pure builder:
91048
+ // the builder writes every key explicitly from its input so customer
91049
+ // content cannot leak in by construction, and reading ambient process
91050
+ // state inside it would break that guarantee. Both values are booleans.
91051
+ ...currentCliStateProperties(input.command ?? "channels")
91052
+ }
90959
91053
  });
90960
91054
  }
90961
91055
  function channelsStageFromEnvelope(envelope2) {
@@ -91255,23 +91349,30 @@ function createApiClient(baseUrl, token, options = {}) {
91255
91349
  return await fetchWithTimeout(url3, { ...init, headers: retryHeaders });
91256
91350
  }
91257
91351
  return {
91258
- async exchangeClerkToken(clerkToken) {
91352
+ async exchangeClerkToken(clerkToken, telemetryInstallationId) {
91259
91353
  const res = await fetchWithTimeout(`${baseUrl}/api/cli/auth/session`, {
91260
91354
  method: "POST",
91261
91355
  headers: { "Content-Type": "application/json" },
91262
- body: JSON.stringify({ clerkToken })
91356
+ body: JSON.stringify({
91357
+ clerkToken,
91358
+ ...telemetryInstallationId === void 0 ? {} : { telemetryInstallationId }
91359
+ })
91263
91360
  });
91264
91361
  if (!res.ok) {
91265
91362
  throw await readApiError(res);
91266
91363
  }
91267
91364
  return res.json();
91268
91365
  },
91269
- async verifySession() {
91366
+ async verifySession(telemetryInstallationId) {
91367
+ const query = telemetryInstallationId === void 0 ? "" : `?telemetryInstallationId=${encodeURIComponent(telemetryInstallationId)}`;
91270
91368
  const res = await retryTransient(async () => {
91271
- const r2 = await fetchWithTimeout(`${baseUrl}/api/cli/auth/verify`, {
91272
- method: "GET",
91273
- headers: { Authorization: `Bearer ${token}` }
91274
- });
91369
+ const r2 = await fetchWithTimeout(
91370
+ `${baseUrl}/api/cli/auth/verify${query}`,
91371
+ {
91372
+ method: "GET",
91373
+ headers: { Authorization: `Bearer ${token}` }
91374
+ }
91375
+ );
91275
91376
  if (!r2.ok) {
91276
91377
  throw await readApiError(r2);
91277
91378
  }
@@ -91567,10 +91668,10 @@ var init_cli_auth_diagnostics = __esm({
91567
91668
  });
91568
91669
 
91569
91670
  // node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.js
91570
- import fs9 from "node:fs";
91671
+ import fs10 from "node:fs";
91571
91672
  function hasDockerEnv() {
91572
91673
  try {
91573
- fs9.statSync("/.dockerenv");
91674
+ fs10.statSync("/.dockerenv");
91574
91675
  return true;
91575
91676
  } catch {
91576
91677
  return false;
@@ -91578,7 +91679,7 @@ function hasDockerEnv() {
91578
91679
  }
91579
91680
  function hasDockerCGroup() {
91580
91681
  try {
91581
- return fs9.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
91682
+ return fs10.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
91582
91683
  } catch {
91583
91684
  return false;
91584
91685
  }
@@ -91597,7 +91698,7 @@ var init_is_docker = __esm({
91597
91698
  });
91598
91699
 
91599
91700
  // node_modules/.pnpm/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
91600
- import fs10 from "node:fs";
91701
+ import fs11 from "node:fs";
91601
91702
  function isInsideContainer() {
91602
91703
  if (cachedResult === void 0) {
91603
91704
  cachedResult = hasContainerEnv() || isDocker();
@@ -91611,7 +91712,7 @@ var init_is_inside_container = __esm({
91611
91712
  init_is_docker();
91612
91713
  hasContainerEnv = () => {
91613
91714
  try {
91614
- fs10.statSync("/run/.containerenv");
91715
+ fs11.statSync("/run/.containerenv");
91615
91716
  return true;
91616
91717
  } catch {
91617
91718
  return false;
@@ -91623,7 +91724,7 @@ var init_is_inside_container = __esm({
91623
91724
  // node_modules/.pnpm/is-wsl@3.1.1/node_modules/is-wsl/index.js
91624
91725
  import process22 from "node:process";
91625
91726
  import os5 from "node:os";
91626
- import fs11 from "node:fs";
91727
+ import fs12 from "node:fs";
91627
91728
  var isWsl, is_wsl_default;
91628
91729
  var init_is_wsl = __esm({
91629
91730
  "node_modules/.pnpm/is-wsl@3.1.1/node_modules/is-wsl/index.js"() {
@@ -91640,12 +91741,12 @@ var init_is_wsl = __esm({
91640
91741
  return true;
91641
91742
  }
91642
91743
  try {
91643
- if (fs11.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
91744
+ if (fs12.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
91644
91745
  return !isInsideContainer();
91645
91746
  }
91646
91747
  } catch {
91647
91748
  }
91648
- if (fs11.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs11.existsSync("/run/WSL")) {
91749
+ if (fs12.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs12.existsSync("/run/WSL")) {
91649
91750
  return !isInsideContainer();
91650
91751
  }
91651
91752
  return false;
@@ -91717,7 +91818,7 @@ var init_utilities3 = __esm({
91717
91818
  // node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/index.js
91718
91819
  import { promisify as promisify3 } from "node:util";
91719
91820
  import childProcess2 from "node:child_process";
91720
- import fs12, { constants as fsConstants } from "node:fs/promises";
91821
+ import fs13, { constants as fsConstants } from "node:fs/promises";
91721
91822
  var execFile2, wslDrivesMountPoint, powerShellPathFromWsl, powerShellPath2, canAccessPowerShellPromise, canAccessPowerShell, wslDefaultBrowser, convertWslPathToWindows;
91722
91823
  var init_wsl_utils = __esm({
91723
91824
  "node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/index.js"() {
@@ -91737,14 +91838,14 @@ var init_wsl_utils = __esm({
91737
91838
  const configFilePath = "/etc/wsl.conf";
91738
91839
  let isConfigFileExists = false;
91739
91840
  try {
91740
- await fs12.access(configFilePath, fsConstants.F_OK);
91841
+ await fs13.access(configFilePath, fsConstants.F_OK);
91741
91842
  isConfigFileExists = true;
91742
91843
  } catch {
91743
91844
  }
91744
91845
  if (!isConfigFileExists) {
91745
91846
  return defaultMountPoint;
91746
91847
  }
91747
- const configContent = await fs12.readFile(configFilePath, { encoding: "utf8" });
91848
+ const configContent = await fs13.readFile(configFilePath, { encoding: "utf8" });
91748
91849
  const parsedMountPoint = parseMountPointFromConfig(configContent);
91749
91850
  if (parsedMountPoint === void 0) {
91750
91851
  return defaultMountPoint;
@@ -91763,7 +91864,7 @@ var init_wsl_utils = __esm({
91763
91864
  canAccessPowerShellPromise ??= (async () => {
91764
91865
  try {
91765
91866
  const psPath = await powerShellPath2();
91766
- await fs12.access(psPath, fsConstants.X_OK);
91867
+ await fs13.access(psPath, fsConstants.X_OK);
91767
91868
  return true;
91768
91869
  } catch {
91769
91870
  return false;
@@ -91978,10 +92079,10 @@ __export(open_exports, {
91978
92079
  openApp: () => openApp
91979
92080
  });
91980
92081
  import process28 from "node:process";
91981
- import path9 from "node:path";
92082
+ import path10 from "node:path";
91982
92083
  import { fileURLToPath } from "node:url";
91983
92084
  import childProcess3 from "node:child_process";
91984
- import fs13, { constants as fsConstants2 } from "node:fs/promises";
92085
+ import fs14, { constants as fsConstants2 } from "node:fs/promises";
91985
92086
  function detectArchBinary(binary2) {
91986
92087
  if (typeof binary2 === "string" || Array.isArray(binary2)) {
91987
92088
  return binary2;
@@ -92012,8 +92113,8 @@ var init_open = __esm({
92012
92113
  init_is_inside_container();
92013
92114
  init_is_in_ssh();
92014
92115
  fallbackAttemptSymbol = Symbol("fallbackAttempt");
92015
- __dirname2 = import.meta.url ? path9.dirname(fileURLToPath(import.meta.url)) : "";
92016
- localXdgOpenPath = path9.join(__dirname2, "xdg-open");
92116
+ __dirname2 = import.meta.url ? path10.dirname(fileURLToPath(import.meta.url)) : "";
92117
+ localXdgOpenPath = path10.join(__dirname2, "xdg-open");
92017
92118
  ({ platform: platform2, arch } = process28);
92018
92119
  tryEachApp = async (apps2, opener) => {
92019
92120
  if (apps2.length === 0) {
@@ -92161,7 +92262,7 @@ var init_open = __esm({
92161
92262
  const isBundled = !__dirname2 || __dirname2 === "/";
92162
92263
  let exeLocalXdgOpen = false;
92163
92264
  try {
92164
- await fs13.access(localXdgOpenPath, fsConstants2.X_OK);
92265
+ await fs14.access(localXdgOpenPath, fsConstants2.X_OK);
92165
92266
  exeLocalXdgOpen = true;
92166
92267
  } catch {
92167
92268
  }
@@ -92467,7 +92568,7 @@ async function login(options = {}) {
92467
92568
  let tokenSource = null;
92468
92569
  try {
92469
92570
  const callbackUrl = `http://127.0.0.1:${port}/callback`;
92470
- const posthogDistinctId = getTelemetryDistinctIdForUrlPropagation();
92571
+ const posthogDistinctId = getLinkableInstallationId();
92471
92572
  const loginParams = new URLSearchParams({
92472
92573
  callback: callbackUrl,
92473
92574
  state,
@@ -92507,10 +92608,15 @@ async function login(options = {}) {
92507
92608
  tokenSource: source
92508
92609
  });
92509
92610
  const apiClient = createApiClient(getOpsApiUrl());
92611
+ const previousUserId = authStore.get()?.userId ?? null;
92612
+ const bindDuringExchange = previousUserId === null ? getLinkableInstallationId() ?? void 0 : void 0;
92510
92613
  let authPayload;
92511
92614
  try {
92512
92615
  diagnostics.logPhase("login.exchange-start");
92513
- authPayload = await apiClient.exchangeClerkToken(clerkToken);
92616
+ authPayload = await apiClient.exchangeClerkToken(
92617
+ clerkToken,
92618
+ bindDuringExchange
92619
+ );
92514
92620
  diagnostics.logPhase("login.exchange-complete", {
92515
92621
  organizationId: authPayload.organization.clerkOrgId,
92516
92622
  userId: authPayload.user.id
@@ -92522,9 +92628,16 @@ async function login(options = {}) {
92522
92628
  "Failed to exchange the browser session for a CLI session."
92523
92629
  );
92524
92630
  throw new Error(
92525
- `Browser sign-in completed, but CLI session exchange failed: ${concreteError.message}`
92631
+ `Browser sign-in completed, but CLI session exchange failed: ${concreteError.message}`,
92632
+ { cause: error48 }
92526
92633
  );
92527
92634
  }
92635
+ if (previousUserId !== null && previousUserId !== authPayload.user.id) {
92636
+ rotateInstallationId({ configStore });
92637
+ diagnostics.logPhase("login.installation-id-rotated", {
92638
+ reason: "different_user"
92639
+ });
92640
+ }
92528
92641
  try {
92529
92642
  authStore.save({
92530
92643
  cliToken: authPayload.cliToken,
@@ -92546,7 +92659,10 @@ async function login(options = {}) {
92546
92659
  error48,
92547
92660
  "Failed to persist CLI credentials."
92548
92661
  );
92549
- throw new Error(`CLI login succeeded, but credentials could not be saved: ${concreteError.message}`);
92662
+ throw new Error(
92663
+ `CLI login succeeded, but credentials could not be saved: ${concreteError.message}`,
92664
+ { cause: error48 }
92665
+ );
92550
92666
  }
92551
92667
  diagnostics.logPhase("login.complete", {
92552
92668
  email: authPayload.user.email,
@@ -92592,7 +92708,9 @@ async function verifyAndRefresh(options = {}) {
92592
92708
  const apiClient = createApiClient(getOpsApiUrl(), token);
92593
92709
  let result;
92594
92710
  try {
92595
- result = await apiClient.verifySession();
92711
+ result = await apiClient.verifySession(
92712
+ getLinkableInstallationId() ?? void 0
92713
+ );
92596
92714
  } catch (error48) {
92597
92715
  if (clearAuthOnTerminalSessionInvalidation(error48)) {
92598
92716
  if (options.throwOnInvalid) {
@@ -93499,12 +93617,12 @@ var init_browser_login = __esm({
93499
93617
  });
93500
93618
 
93501
93619
  // apps/cli/src/services/project-scaffold.ts
93502
- import * as fs14 from "node:fs";
93503
- import * as path10 from "node:path";
93620
+ import * as fs15 from "node:fs";
93621
+ import * as path11 from "node:path";
93504
93622
  import * as os6 from "node:os";
93505
93623
  import { execFileSync as execFileSync3 } from "node:child_process";
93506
93624
  function isProjectDirOccupied(projectDir) {
93507
- return fs14.existsSync(projectDir) && fs14.readdirSync(projectDir).length > 0;
93625
+ return fs15.existsSync(projectDir) && fs15.readdirSync(projectDir).length > 0;
93508
93626
  }
93509
93627
  function assertProjectDirAvailable(projectDir) {
93510
93628
  if (isProjectDirOccupied(projectDir)) {
@@ -93519,7 +93637,7 @@ async function scaffoldProject(options) {
93519
93637
  assertProjectDirAvailable(projectDir);
93520
93638
  const localTemplateDir = process.env["COPILOTKIT_TEMPLATE_DIR"];
93521
93639
  if (localTemplateDir !== void 0 && localTemplateDir !== "") {
93522
- if (!fs14.existsSync(localTemplateDir)) {
93640
+ if (!fs15.existsSync(localTemplateDir)) {
93523
93641
  throw tagError(
93524
93642
  new Error(
93525
93643
  `COPILOTKIT_TEMPLATE_DIR points at a path that does not exist: ${localTemplateDir}`
@@ -93527,7 +93645,7 @@ async function scaffoldProject(options) {
93527
93645
  TELEMETRY_ERROR_CODES.TEMPLATE_FETCH_FAILED
93528
93646
  );
93529
93647
  }
93530
- fs14.mkdirSync(projectDir, { recursive: true });
93648
+ fs15.mkdirSync(projectDir, { recursive: true });
93531
93649
  await copyDirectory(localTemplateDir, projectDir, true);
93532
93650
  return;
93533
93651
  }
@@ -93542,7 +93660,7 @@ async function scaffoldProject(options) {
93542
93660
  }
93543
93661
  function pathEntryExists(entryPath) {
93544
93662
  try {
93545
- fs14.lstatSync(entryPath);
93663
+ fs15.lstatSync(entryPath);
93546
93664
  return true;
93547
93665
  } catch (error48) {
93548
93666
  if (error48 instanceof Error && "code" in error48 && error48.code === "ENOENT") {
@@ -93553,7 +93671,7 @@ function pathEntryExists(entryPath) {
93553
93671
  }
93554
93672
  async function cloneTemplate(source, destinationPath) {
93555
93673
  const { owner, repo, revision, subdirectoryPath, mode } = source;
93556
- const tempDir = fs14.mkdtempSync(path10.join(os6.tmpdir(), "copilotkit-clone-"));
93674
+ const tempDir = fs15.mkdtempSync(path11.join(os6.tmpdir(), "copilotkit-clone-"));
93557
93675
  const isWholeRepo = mode === "whole-repository";
93558
93676
  const destinationExisted = pathEntryExists(destinationPath);
93559
93677
  try {
@@ -93573,8 +93691,8 @@ async function cloneTemplate(source, destinationPath) {
93573
93691
  { cwd: tempDir, stdio: "pipe" },
93574
93692
  TELEMETRY_ERROR_CODES.GIT_FAILED
93575
93693
  );
93576
- fs14.writeFileSync(
93577
- path10.join(tempDir, ".git/info/sparse-checkout"),
93694
+ fs15.writeFileSync(
93695
+ path11.join(tempDir, ".git/info/sparse-checkout"),
93578
93696
  subdirectoryPath
93579
93697
  );
93580
93698
  }
@@ -93588,8 +93706,8 @@ async function cloneTemplate(source, destinationPath) {
93588
93706
  { cwd: tempDir, stdio: "pipe" },
93589
93707
  TELEMETRY_ERROR_CODES.GIT_FAILED
93590
93708
  );
93591
- const sourcePath = isWholeRepo ? tempDir : path10.join(tempDir, subdirectoryPath);
93592
- if (!isWholeRepo && !fs14.existsSync(sourcePath)) {
93709
+ const sourcePath = isWholeRepo ? tempDir : path11.join(tempDir, subdirectoryPath);
93710
+ if (!isWholeRepo && !fs15.existsSync(sourcePath)) {
93593
93711
  throw tagError(
93594
93712
  new Error(
93595
93713
  `Template directory '${subdirectoryPath}' not found in the repository.`
@@ -93597,11 +93715,11 @@ async function cloneTemplate(source, destinationPath) {
93597
93715
  TELEMETRY_ERROR_CODES.TEMPLATE_FETCH_FAILED
93598
93716
  );
93599
93717
  }
93600
- fs14.mkdirSync(destinationPath, { recursive: true });
93718
+ fs15.mkdirSync(destinationPath, { recursive: true });
93601
93719
  await copyDirectory(sourcePath, destinationPath, isWholeRepo);
93602
93720
  } catch (cause) {
93603
93721
  if (!destinationExisted) {
93604
- fs14.rmSync(destinationPath, { recursive: true, force: true });
93722
+ fs15.rmSync(destinationPath, { recursive: true, force: true });
93605
93723
  }
93606
93724
  const error48 = cause instanceof Error ? cause : new Error("Starter template checkout failed");
93607
93725
  const code = error48.code;
@@ -93611,26 +93729,26 @@ async function cloneTemplate(source, destinationPath) {
93611
93729
  throw tagError(error48, TELEMETRY_ERROR_CODES.TEMPLATE_FETCH_FAILED);
93612
93730
  } finally {
93613
93731
  try {
93614
- fs14.rmSync(tempDir, { recursive: true, force: true });
93732
+ fs15.rmSync(tempDir, { recursive: true, force: true });
93615
93733
  } catch {
93616
93734
  }
93617
93735
  }
93618
93736
  }
93619
93737
  async function copyDirectory(source, destination, excludeGit = false) {
93620
- if (!fs14.existsSync(destination)) {
93621
- fs14.mkdirSync(destination, { recursive: true });
93738
+ if (!fs15.existsSync(destination)) {
93739
+ fs15.mkdirSync(destination, { recursive: true });
93622
93740
  }
93623
- const entries = fs14.readdirSync(source, { withFileTypes: true });
93741
+ const entries = fs15.readdirSync(source, { withFileTypes: true });
93624
93742
  for (const entry of entries) {
93625
93743
  if (excludeGit && entry.name === ".git") {
93626
93744
  continue;
93627
93745
  }
93628
- const srcPath = path10.join(source, entry.name);
93629
- const destPath = path10.join(destination, entry.name);
93746
+ const srcPath = path11.join(source, entry.name);
93747
+ const destPath = path11.join(destination, entry.name);
93630
93748
  if (entry.isDirectory()) {
93631
93749
  await copyDirectory(srcPath, destPath, excludeGit);
93632
93750
  } else {
93633
- fs14.copyFileSync(srcPath, destPath);
93751
+ fs15.copyFileSync(srcPath, destPath);
93634
93752
  }
93635
93753
  }
93636
93754
  }
@@ -93668,37 +93786,37 @@ function parseGitHubUrl(githubUrl) {
93668
93786
  };
93669
93787
  }
93670
93788
  function copyEnvExample(projectDir) {
93671
- const envPath = path10.join(projectDir, ".env");
93672
- const envExamplePath = path10.join(projectDir, ".env.example");
93673
- if (fs14.existsSync(envExamplePath) && !fs14.existsSync(envPath)) {
93674
- fs14.copyFileSync(envExamplePath, envPath);
93789
+ const envPath = path11.join(projectDir, ".env");
93790
+ const envExamplePath = path11.join(projectDir, ".env.example");
93791
+ if (fs15.existsSync(envExamplePath) && !fs15.existsSync(envPath)) {
93792
+ fs15.copyFileSync(envExamplePath, envPath);
93675
93793
  return true;
93676
93794
  }
93677
93795
  return false;
93678
93796
  }
93679
93797
  function removeTestHarnessArtifacts(projectDir) {
93680
- const markerPath = path10.join(projectDir, "docker-compose.test.yml");
93681
- if (!fs14.existsSync(markerPath)) {
93798
+ const markerPath = path11.join(projectDir, "docker-compose.test.yml");
93799
+ if (!fs15.existsSync(markerPath)) {
93682
93800
  return [];
93683
93801
  }
93684
93802
  const removed = [];
93685
93803
  for (const artifact of TEST_HARNESS_ARTIFACTS) {
93686
- const target = path10.join(projectDir, artifact);
93687
- if (fs14.existsSync(target)) {
93688
- fs14.rmSync(target, { recursive: true, force: true });
93804
+ const target = path11.join(projectDir, artifact);
93805
+ if (fs15.existsSync(target)) {
93806
+ fs15.rmSync(target, { recursive: true, force: true });
93689
93807
  removed.push(artifact);
93690
93808
  }
93691
93809
  }
93692
93810
  return removed;
93693
93811
  }
93694
93812
  function writeEnvLicenseKey(projectDir, licenseKey) {
93695
- const envPath = path10.join(projectDir, ".env");
93696
- const envExamplePath = path10.join(projectDir, ".env.example");
93697
- if (fs14.existsSync(envExamplePath) && !fs14.existsSync(envPath)) {
93698
- fs14.copyFileSync(envExamplePath, envPath);
93813
+ const envPath = path11.join(projectDir, ".env");
93814
+ const envExamplePath = path11.join(projectDir, ".env.example");
93815
+ if (fs15.existsSync(envExamplePath) && !fs15.existsSync(envPath)) {
93816
+ fs15.copyFileSync(envExamplePath, envPath);
93699
93817
  }
93700
- if (fs14.existsSync(envPath)) {
93701
- let content = fs14.readFileSync(envPath, "utf8");
93818
+ if (fs15.existsSync(envPath)) {
93819
+ let content = fs15.readFileSync(envPath, "utf8");
93702
93820
  const licenseLine = `COPILOTKIT_LICENSE_TOKEN=${licenseKey}`;
93703
93821
  if (LICENSE_TOKEN_LINE_RE.test(content)) {
93704
93822
  content = content.replace(LICENSE_TOKEN_LINE_RE, () => licenseLine);
@@ -93707,9 +93825,9 @@ function writeEnvLicenseKey(projectDir, licenseKey) {
93707
93825
  content = `${content}${separator}${licenseLine}
93708
93826
  `;
93709
93827
  }
93710
- fs14.writeFileSync(envPath, content);
93828
+ fs15.writeFileSync(envPath, content);
93711
93829
  } else {
93712
- fs14.writeFileSync(envPath, `COPILOTKIT_LICENSE_TOKEN=${licenseKey}
93830
+ fs15.writeFileSync(envPath, `COPILOTKIT_LICENSE_TOKEN=${licenseKey}
93713
93831
  `);
93714
93832
  }
93715
93833
  }
@@ -93759,7 +93877,7 @@ __export(license_delivery_exports, {
93759
93877
  promptYesNo: () => promptYesNo,
93760
93878
  resolveLicenseEnvWriteMode: () => resolveLicenseEnvWriteMode
93761
93879
  });
93762
- import * as path11 from "node:path";
93880
+ import * as path12 from "node:path";
93763
93881
  import { createInterface } from "node:readline/promises";
93764
93882
  function resolveLicenseEnvWriteMode(flags, interactive) {
93765
93883
  if (flags.write) {
@@ -93779,7 +93897,7 @@ function applyLicenseDelivery(mode, licenseKey, deps) {
93779
93897
  };
93780
93898
  const write = () => {
93781
93899
  const dir = deps.cwd();
93782
- const envPath = path11.join(dir, ".env");
93900
+ const envPath = path12.join(dir, ".env");
93783
93901
  try {
93784
93902
  deps.writeEnvLicenseKey(dir, licenseKey);
93785
93903
  } catch (error48) {
@@ -94205,46 +94323,6 @@ var init_framework_list = __esm({
94205
94323
  }
94206
94324
  });
94207
94325
 
94208
- // apps/cli/src/services/project-config.ts
94209
- import * as fs15 from "node:fs";
94210
- import * as path12 from "node:path";
94211
- function projectConfigPath(dir) {
94212
- return path12.join(dir, ".copilotkit", "project.json");
94213
- }
94214
- function readProjectConfig(dir) {
94215
- const configPath = projectConfigPath(dir);
94216
- if (!fs15.existsSync(configPath)) {
94217
- return void 0;
94218
- }
94219
- let parsed;
94220
- try {
94221
- parsed = JSON.parse(fs15.readFileSync(configPath, "utf8"));
94222
- } catch {
94223
- return void 0;
94224
- }
94225
- const validated = projectConfigSchema.safeParse(parsed);
94226
- return validated.success ? validated.data : void 0;
94227
- }
94228
- function writeProjectConfig(dir, config2) {
94229
- const validated = projectConfigSchema.parse(config2);
94230
- const configPath = projectConfigPath(dir);
94231
- fs15.mkdirSync(path12.dirname(configPath), { recursive: true });
94232
- fs15.writeFileSync(configPath, `${JSON.stringify(validated, null, 2)}
94233
- `);
94234
- }
94235
- var projectConfigSchema;
94236
- var init_project_config = __esm({
94237
- "apps/cli/src/services/project-config.ts"() {
94238
- "use strict";
94239
- init_zod();
94240
- projectConfigSchema = external_exports.object({
94241
- projectId: external_exports.string().min(1),
94242
- projectSlug: external_exports.string().min(1),
94243
- clerkOrgId: external_exports.string().min(1)
94244
- }).strict();
94245
- }
94246
- });
94247
-
94248
94326
  // apps/cli/src/services/intelligence-activation.ts
94249
94327
  import * as fs16 from "node:fs";
94250
94328
  import * as path13 from "node:path";
@@ -359049,7 +359127,7 @@ async function scaffoldInitProject(options, dependencies = defaultInitScaffoldDe
359049
359127
  );
359050
359128
  }
359051
359129
  if (!templateDefinition.provisionLicense) {
359052
- telemetry?.onScaffoldSucceeded({ framework });
359130
+ telemetry?.onScaffoldSucceeded({ framework, scaffoldChannel: "none" });
359053
359131
  return {
359054
359132
  projectDir,
359055
359133
  envCreatedFromExample,
@@ -359145,7 +359223,16 @@ async function scaffoldInitProject(options, dependencies = defaultInitScaffoldDe
359145
359223
  });
359146
359224
  }
359147
359225
  }
359148
- telemetry?.onScaffoldSucceeded({ framework, telemetryId });
359226
+ telemetry?.onScaffoldSucceeded({
359227
+ framework,
359228
+ telemetryId,
359229
+ // `channel` is the outcome of the offer that ran above: undefined when
359230
+ // it was declined, skipped, or never reached. Reporting the provider the
359231
+ // run actually produced is what the parse-time `channel_flag` cannot do,
359232
+ // since an interactively-chosen Channel leaves that flag `unset`.
359233
+ scaffoldChannel: channel2 === void 0 ? "none" : channel2.adapter,
359234
+ ...channel2 === void 0 ? {} : { scaffoldChannelAttached: channel2.attached }
359235
+ });
359149
359236
  return {
359150
359237
  projectDir,
359151
359238
  envCreatedFromExample,
@@ -361032,6 +361119,10 @@ Usage: copilotkit channels providers [--json]
361032
361119
  adapterFlag === void 0 ? void 0 : String(adapterFlag)
361033
361120
  ) ? String(adapterFlag) : "slack";
361034
361121
  const driver = asJson ? "agent" : "interactive";
361122
+ try {
361123
+ await verifyAndRefresh();
361124
+ } catch {
361125
+ }
361035
361126
  recordChannelsStage({
361036
361127
  driver,
361037
361128
  provider: adapter2,
@@ -361263,6 +361354,7 @@ var init_channels2 = __esm({
361263
361354
  init_api_client();
361264
361355
  init_clipboard();
361265
361356
  init_config_service();
361357
+ await init_auth_service();
361266
361358
  init_channel_artifacts();
361267
361359
  init_channel_credential_cleanup();
361268
361360
  init_channel_code_half();
@@ -361704,6 +361796,13 @@ function buildScaffoldSucceededEvent(input) {
361704
361796
  properties: {
361705
361797
  command: "init",
361706
361798
  framework: input.framework,
361799
+ // Unconditional, `none` included: an absent value must mean "older CLI",
361800
+ // never "this scaffold had no Channel".
361801
+ scaffold_channel: input.scaffoldChannel,
361802
+ // Only meaningful alongside a Channel. Emitted whenever one was produced,
361803
+ // including `false`, so a declared-but-unattached Channel is countable
361804
+ // rather than indistinguishable from a finished one.
361805
+ ...input.scaffoldChannel === "none" || input.scaffoldChannelAttached === void 0 ? {} : { channel_attached: input.scaffoldChannelAttached },
361707
361806
  ...input.telemetryId ? { telemetry_id: input.telemetryId } : {}
361708
361807
  }
361709
361808
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "copilotkit",
3
- "version": "4.8.1",
3
+ "version": "4.8.2",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14683,7 +14683,7 @@ import * as path4 from "node:path";
14683
14683
 
14684
14684
  // apps/cli/src/config.ts
14685
14685
  function getTemplateRef() {
14686
- return true ? "7e502dd4a452feee7d26c6355fd262948f8c25e6" : "main";
14686
+ return true ? "53cf7e6575e8eae2a0dcaf64a7c3c2baf3e6dd04" : "main";
14687
14687
  }
14688
14688
 
14689
14689
  // apps/cli/src/services/agentcore-config.ts