@codexhost/cli-win32-arm64 0.10.2 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ var __export = (target, all) => {
7
7
 
8
8
  // dist/kiro-adapter.js
9
9
  import { randomUUID } from "node:crypto";
10
- import path6 from "node:path";
10
+ import path7 from "node:path";
11
11
 
12
12
  // ../../../node_modules/zod/v4/classic/external.js
13
13
  var external_exports = {};
@@ -775,10 +775,10 @@ function mergeDefs(...defs) {
775
775
  function cloneDef(schema) {
776
776
  return mergeDefs(schema._zod.def);
777
777
  }
778
- function getElementAtPath(obj, path7) {
779
- if (!path7)
778
+ function getElementAtPath(obj, path8) {
779
+ if (!path8)
780
780
  return obj;
781
- return path7.reduce((acc, key) => acc?.[key], obj);
781
+ return path8.reduce((acc, key) => acc?.[key], obj);
782
782
  }
783
783
  function promiseAllObject(promisesObj) {
784
784
  const keys = Object.keys(promisesObj);
@@ -1187,11 +1187,11 @@ function explicitlyAborted(x, startIndex = 0) {
1187
1187
  }
1188
1188
  return false;
1189
1189
  }
1190
- function prefixIssues(path7, issues) {
1190
+ function prefixIssues(path8, issues) {
1191
1191
  return issues.map((iss) => {
1192
1192
  var _a3;
1193
1193
  (_a3 = iss).path ?? (_a3.path = []);
1194
- iss.path.unshift(path7);
1194
+ iss.path.unshift(path8);
1195
1195
  return iss;
1196
1196
  });
1197
1197
  }
@@ -1338,16 +1338,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
1338
1338
  }
1339
1339
  function formatError(error51, mapper = (issue2) => issue2.message) {
1340
1340
  const fieldErrors = { _errors: [] };
1341
- const processError = (error52, path7 = []) => {
1341
+ const processError = (error52, path8 = []) => {
1342
1342
  for (const issue2 of error52.issues) {
1343
1343
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1344
- issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
1344
+ issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
1345
1345
  } else if (issue2.code === "invalid_key") {
1346
- processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1346
+ processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1347
1347
  } else if (issue2.code === "invalid_element") {
1348
- processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1348
+ processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1349
1349
  } else {
1350
- const fullpath = [...path7, ...issue2.path];
1350
+ const fullpath = [...path8, ...issue2.path];
1351
1351
  if (fullpath.length === 0) {
1352
1352
  fieldErrors._errors.push(mapper(issue2));
1353
1353
  } else {
@@ -1374,17 +1374,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
1374
1374
  }
1375
1375
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
1376
1376
  const result = { errors: [] };
1377
- const processError = (error52, path7 = []) => {
1377
+ const processError = (error52, path8 = []) => {
1378
1378
  var _a3, _b;
1379
1379
  for (const issue2 of error52.issues) {
1380
1380
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1381
- issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
1381
+ issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
1382
1382
  } else if (issue2.code === "invalid_key") {
1383
- processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1383
+ processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1384
1384
  } else if (issue2.code === "invalid_element") {
1385
- processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1385
+ processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1386
1386
  } else {
1387
- const fullpath = [...path7, ...issue2.path];
1387
+ const fullpath = [...path8, ...issue2.path];
1388
1388
  if (fullpath.length === 0) {
1389
1389
  result.errors.push(mapper(issue2));
1390
1390
  continue;
@@ -1416,8 +1416,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
1416
1416
  }
1417
1417
  function toDotPath(_path) {
1418
1418
  const segs = [];
1419
- const path7 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1420
- for (const seg of path7) {
1419
+ const path8 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1420
+ for (const seg of path8) {
1421
1421
  if (typeof seg === "number")
1422
1422
  segs.push(`[${seg}]`);
1423
1423
  else if (typeof seg === "symbol")
@@ -14109,13 +14109,13 @@ function resolveRef(ref, ctx) {
14109
14109
  if (!ref.startsWith("#")) {
14110
14110
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
14111
14111
  }
14112
- const path7 = ref.slice(1).split("/").filter(Boolean);
14113
- if (path7.length === 0) {
14112
+ const path8 = ref.slice(1).split("/").filter(Boolean);
14113
+ if (path8.length === 0) {
14114
14114
  return ctx.rootSchema;
14115
14115
  }
14116
14116
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14117
- if (path7[0] === defsKey) {
14118
- const key = path7[1];
14117
+ if (path8[0] === defsKey) {
14118
+ const key = path8[1];
14119
14119
  if (!key || !ctx.defs[key]) {
14120
14120
  throw new Error(`Reference not found: ${ref}`);
14121
14121
  }
@@ -14578,6 +14578,55 @@ var credentialImportsParamsSchema = external_exports.object({
14578
14578
  request: credentialImportsRequestSchema
14579
14579
  }).strict();
14580
14580
 
14581
+ // ../../shared-contracts/dist/harness-display-settings.js
14582
+ var harnessDisplayEntriesSchema = external_exports.array(external_exports.strictObject({
14583
+ agent: external_exports.string().min(1).max(128),
14584
+ section: external_exports.enum(["main", "more", "auto"])
14585
+ })).max(256).refine((entries) => new Set(entries.map((entry) => entry.agent)).size === entries.length, "Duplicate Harness IDs");
14586
+ var harnessDisplaySettingsSchema = external_exports.strictObject({
14587
+ entries: harnessDisplayEntriesSchema.nullable()
14588
+ });
14589
+ var harnessDisplayGetSchema = external_exports.strictObject({});
14590
+ var harnessDisplaySetSchema = external_exports.strictObject({
14591
+ entries: harnessDisplayEntriesSchema,
14592
+ /** Import legacy Desktop preferences only if no shared settings exist yet. */
14593
+ initializeOnly: external_exports.boolean().optional()
14594
+ });
14595
+
14596
+ // ../../shared-contracts/dist/console.js
14597
+ var consoleAnnouncementSchema = external_exports.strictObject({
14598
+ title: external_exports.string().trim().min(1).max(200),
14599
+ type: external_exports.enum(["info", "warning", "danger"]),
14600
+ body: external_exports.string().trim().min(1).max(16 * 1024)
14601
+ });
14602
+ var consoleOpenParamsSchema = external_exports.strictObject({});
14603
+ var consoleOpenResultSchema = external_exports.strictObject({
14604
+ /** The console address. */
14605
+ url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
14606
+ });
14607
+ var CONSOLE_HOST_METHODS = Object.freeze([
14608
+ "codexhost/harness/plugins/list",
14609
+ "codexhost/harness/display-settings/get",
14610
+ "codexhost/harness/display-settings/set",
14611
+ "codexhost/harness/inspect",
14612
+ "codexhost/harness/launch-settings/get",
14613
+ "codexhost/harness/launch-settings/set",
14614
+ "codexhost/harness/web-ui/open",
14615
+ "codexhost/harness/accounts/sources",
14616
+ "codexhost/harness/accounts/list",
14617
+ "codexhost/harness/accounts/inspect",
14618
+ "codexhost/harness/credential-imports",
14619
+ "codexhost/harness/session-import/sources",
14620
+ "codexhost/harness/session-import/list",
14621
+ "codexhost/harness/session-import/import",
14622
+ "codexhost/account/list",
14623
+ "codexhost/account/refresh",
14624
+ "codexhost/account/usage/inspect",
14625
+ "codexhost/update/check",
14626
+ "codexhost/update/start",
14627
+ "codexhost/update/status"
14628
+ ]);
14629
+
14581
14630
  // ../../shared-contracts/dist/version.js
14582
14631
  var WORKSPACE_CONTRACT_VERSION = 1;
14583
14632
 
@@ -14631,6 +14680,12 @@ var hostTurnIdSchema = opaqueIdSchema.brand();
14631
14680
  var hostItemIdSchema = opaqueIdSchema.brand();
14632
14681
  var hostInteractionIdSchema = opaqueIdSchema.brand();
14633
14682
 
14683
+ // ../../shared-contracts/dist/manual-compaction.js
14684
+ var threadManualCompactionStartedSchema = external_exports.strictObject({
14685
+ threadId: hostThreadIdSchema,
14686
+ turnId: hostTurnIdSchema
14687
+ });
14688
+
14634
14689
  // ../../shared-contracts/dist/thread-usage.js
14635
14690
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
14636
14691
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
@@ -14691,6 +14746,10 @@ var threadUsageSnapshotSchema = external_exports.object({
14691
14746
  var usagePercentSchema = external_exports.number().finite().min(0).max(100);
14692
14747
  var accountCreditsProductUsageSchema = external_exports.object({
14693
14748
  product: external_exports.string().min(1),
14749
+ used: external_exports.number().finite().nonnegative().optional(),
14750
+ // Zero is a real empty cap, not an absent field.
14751
+ limit: external_exports.number().finite().nonnegative().optional(),
14752
+ unit: external_exports.string().min(1).max(32).optional(),
14694
14753
  usagePercent: usagePercentSchema,
14695
14754
  resetsAt: external_exports.string().min(1).optional()
14696
14755
  }).strict();
@@ -14700,6 +14759,10 @@ var accountResetCreditsSchema = external_exports.object({
14700
14759
  expiresAt: external_exports.array(external_exports.string().min(1)).min(1).max(32).optional()
14701
14760
  }).strict();
14702
14761
  var accountCreditsSnapshotSchema = external_exports.object({
14762
+ used: external_exports.number().finite().nonnegative().optional(),
14763
+ // Zero is a real empty cap, not an absent field.
14764
+ limit: external_exports.number().finite().nonnegative().optional(),
14765
+ unit: external_exports.string().min(1).max(32).optional(),
14703
14766
  /** Native label when the primary limit is scoped to a model or product group. */
14704
14767
  label: external_exports.string().min(1).optional(),
14705
14768
  usedPercent: usagePercentSchema,
@@ -14719,12 +14782,27 @@ var threadUsageInspectionSchema = external_exports.object({
14719
14782
  }).strict();
14720
14783
 
14721
14784
  // ../../shared-contracts/dist/harness-accounts.js
14722
- var harnessAccountSnapshotSchema = external_exports.object({
14785
+ var accountBalanceSnapshotSchema = external_exports.object({
14786
+ amount: external_exports.number().finite().nonnegative(),
14787
+ /** ISO 4217 code as reported by the Provider, for example `CNY`. */
14788
+ currency: external_exports.string().trim().min(1).max(8),
14789
+ /** Native label when the Harness exposes several Billing Sources. */
14790
+ label: external_exports.string().trim().min(1).max(128).optional()
14791
+ }).strict();
14792
+ var harnessAccountSnapshotObject = external_exports.object({
14723
14793
  email: external_exports.string().trim().min(1).max(320).optional(),
14724
14794
  label: external_exports.string().trim().min(1).max(256).optional(),
14725
14795
  plan: external_exports.string().trim().min(1).max(128).optional(),
14726
- credits: accountCreditsSnapshotSchema
14796
+ credits: accountCreditsSnapshotSchema.optional(),
14797
+ balance: accountBalanceSnapshotSchema.optional()
14727
14798
  }).strict();
14799
+ function requireReportedQuota(schema) {
14800
+ return schema.refine((value) => {
14801
+ const reported = value;
14802
+ return reported.credits !== void 0 || reported.balance !== void 0;
14803
+ }, { message: "Account must report either credits or a balance" });
14804
+ }
14805
+ var harnessAccountSnapshotSchema = requireReportedQuota(harnessAccountSnapshotObject);
14728
14806
  var harnessAccountIdentityShape = {
14729
14807
  harnessId: harnessIdSchema,
14730
14808
  harnessName: external_exports.string().trim().min(1).max(128)
@@ -14735,11 +14813,13 @@ var harnessAccountSourceListResultSchema = external_exports.object({ sources: ex
14735
14813
  var harnessAccountInspectParamsSchema = external_exports.object({ harnessId: harnessIdSchema, refresh: external_exports.boolean().optional() }).strict();
14736
14814
  var harnessAccountInspectResultSchema = external_exports.object({
14737
14815
  ...harnessAccountIdentityShape,
14738
- account: harnessAccountSnapshotSchema.nullable()
14816
+ account: harnessAccountSnapshotSchema.nullable(),
14817
+ /** Every Billing Source from one Harness; `account` remains the first for older clients. */
14818
+ accounts: external_exports.array(harnessAccountSnapshotSchema).max(8).optional()
14739
14819
  }).strict();
14740
14820
  var harnessAccountListParamsSchema = external_exports.object({ refresh: external_exports.boolean().optional() }).strict();
14741
14821
  var harnessAccountListResultSchema = external_exports.object({
14742
- accounts: external_exports.array(harnessAccountSnapshotSchema.extend(harnessAccountIdentityShape)).max(128)
14822
+ accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
14743
14823
  }).strict();
14744
14824
 
14745
14825
  // ../../shared-contracts/dist/json-value.js
@@ -14877,6 +14957,8 @@ var harnessModelSchema = external_exports.object({
14877
14957
  ref: harnessModelRefSchema,
14878
14958
  label: nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH),
14879
14959
  resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
14960
+ /** Optional opaque selection for this same Model with priority processing enabled. */
14961
+ fastModel: harnessModelRefSchema.optional(),
14880
14962
  supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
14881
14963
  }).strict();
14882
14964
  var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
@@ -14909,6 +14991,16 @@ var harnessModelCatalogSchema = external_exports.object({
14909
14991
  });
14910
14992
  }
14911
14993
  refs.add(model.ref.id);
14994
+ if (model.fastModel) {
14995
+ if (refs.has(model.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model.fastModel?.id)) {
14996
+ context.addIssue({
14997
+ code: "custom",
14998
+ message: "Fast Model refs must be distinct and unique",
14999
+ path: ["models", index, "fastModel"]
15000
+ });
15001
+ }
15002
+ refs.add(model.fastModel.id);
15003
+ }
14912
15004
  const supportedThinkingIds = /* @__PURE__ */ new Set();
14913
15005
  for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
14914
15006
  if (supportedThinkingIds.has(optionId)) {
@@ -15028,11 +15120,13 @@ var threadThinkingSelectParamsSchema = external_exports.object({
15028
15120
  thinkingOptionId: harnessThinkingOptionIdSchema
15029
15121
  }).strict();
15030
15122
  var threadInspectionParamsSchema = external_exports.object({
15031
- threadId: hostThreadIdSchema
15123
+ threadId: hostThreadIdSchema,
15124
+ includeReferenceCapability: external_exports.boolean().optional()
15032
15125
  }).strict();
15033
15126
  var codexThreadInspectionSchema = external_exports.object({
15034
15127
  owner: external_exports.literal("codex"),
15035
- locked: external_exports.literal(true)
15128
+ locked: external_exports.literal(true),
15129
+ supportsThreadReferences: external_exports.literal(true).optional()
15036
15130
  }).strict();
15037
15131
  var externalThreadInspectionSchema = external_exports.object({
15038
15132
  owner: external_exports.literal("external"),
@@ -15158,6 +15252,19 @@ var harnessLaunchSettingsSchema = external_exports.object({
15158
15252
  restartRequired: external_exports.boolean()
15159
15253
  }).strict();
15160
15254
 
15255
+ // ../../shared-contracts/dist/harness-installation.js
15256
+ var harnessInstallationParamsSchema = external_exports.object({
15257
+ harnessId: harnessIdSchema,
15258
+ action: external_exports.enum(["check", "update"])
15259
+ }).strict();
15260
+ var harnessInstallationStateSchema = external_exports.object({
15261
+ currentVersion: external_exports.string().min(1).max(128),
15262
+ latestVersion: external_exports.string().min(1).max(128),
15263
+ updateAvailable: external_exports.boolean(),
15264
+ canUpdate: external_exports.boolean(),
15265
+ message: external_exports.string().max(2048).optional()
15266
+ }).strict();
15267
+
15161
15268
  // ../../shared-contracts/dist/codex-accounts.js
15162
15269
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
15163
15270
  var nonBlankTextSchema3 = external_exports.string().trim().min(1);
@@ -15773,7 +15880,7 @@ function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
15773
15880
  // dist/acp-transport.js
15774
15881
  import { spawn, spawnSync } from "node:child_process";
15775
15882
  import { Readable, Writable } from "node:stream";
15776
- import { execFile } from "node:child_process";
15883
+ import { execFile as execFile2 } from "node:child_process";
15777
15884
  import { promisify } from "node:util";
15778
15885
  import { setTimeout as delay } from "node:timers/promises";
15779
15886
 
@@ -15839,6 +15946,20 @@ function commandInvocation(command, arguments_, environment, platform = process.
15839
15946
  };
15840
15947
  }
15841
15948
 
15949
+ // ../../harness-discovery/dist/node-runtime.js
15950
+ import path3 from "node:path";
15951
+ function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
15952
+ const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
15953
+ const delimiter = platform === "win32" ? ";" : ":";
15954
+ const runtimeDirectory = path3.dirname(runtimeExecutable);
15955
+ const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
15956
+ const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
15957
+ if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
15958
+ directories.push(runtimeDirectory);
15959
+ }
15960
+ return { ...environment, [pathKey]: directories.join(delimiter) };
15961
+ }
15962
+
15842
15963
  // ../../harness-discovery/dist/resolve.js
15843
15964
  import os from "node:os";
15844
15965
 
@@ -16002,6 +16123,40 @@ function resolveHarnessExecutable(spec, input, dependencies = {}) {
16002
16123
  return void 0;
16003
16124
  }
16004
16125
 
16126
+ // ../../harness-discovery/dist/installation.js
16127
+ import { execFile } from "node:child_process";
16128
+ import { homedir } from "node:os";
16129
+ function runInstallationCommand(command, args, environment, timeout = 3e4) {
16130
+ const env = withNodeRuntimeOnPath(environment);
16131
+ const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
16132
+ return new Promise((resolve, reject) => {
16133
+ const child = execFile(invocation.command, invocation.arguments, {
16134
+ env,
16135
+ cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
16136
+ encoding: "utf8",
16137
+ timeout,
16138
+ killSignal: "SIGKILL",
16139
+ maxBuffer: 1024 * 1024,
16140
+ windowsHide: true,
16141
+ windowsVerbatimArguments: invocation.windowsVerbatimArguments
16142
+ }, (error51, stdout, stderr) => {
16143
+ if (error51)
16144
+ reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
16145
+ else
16146
+ resolve((stdout || stderr).trim());
16147
+ });
16148
+ child.stdin?.end();
16149
+ });
16150
+ }
16151
+ function installationVersion(value) {
16152
+ if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
16153
+ throw new Error("Harness returned an invalid version");
16154
+ return value.trim().replace(/^v/, "");
16155
+ }
16156
+ function versionFromOutput(output) {
16157
+ return installationVersion(output.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
16158
+ }
16159
+
16005
16160
  // ../../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
16006
16161
  var AGENT_METHODS = {
16007
16162
  initialize: "initialize",
@@ -20196,7 +20351,7 @@ function kiroLiveCommands(native) {
20196
20351
  }
20197
20352
 
20198
20353
  // dist/command.js
20199
- import path3 from "node:path";
20354
+ import path4 from "node:path";
20200
20355
  var KiroExecutableError = class extends Error {
20201
20356
  code = "KIRO_NOT_FOUND";
20202
20357
  };
@@ -20225,7 +20380,7 @@ function resolveKiroExecutable(input = {}, dependencies = {}) {
20225
20380
  }, dependencies);
20226
20381
  if (!resolution)
20227
20382
  throw new KiroExecutableError("Kiro CLI is not installed");
20228
- return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path3.resolve(resolution.executable);
20383
+ return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path4.resolve(resolution.executable);
20229
20384
  }
20230
20385
  function kiroInvocation(command, platform = process.platform) {
20231
20386
  return commandInvocation(command, ["acp", "--agent-engine", "v3", "--auth-method", "cli"], process.env, platform);
@@ -20482,7 +20637,7 @@ var KiroAcpTransport = class {
20482
20637
  environment
20483
20638
  });
20484
20639
  const invocation = commandInvocation(executable, ["chat", "--list-models", "--format", "json"], environment, process.platform);
20485
- const { stdout } = await promisify(execFile)(invocation.command, invocation.arguments, {
20640
+ const { stdout } = await promisify(execFile2)(invocation.command, invocation.arguments, {
20486
20641
  cwd: this.#options.cwd,
20487
20642
  env: environment,
20488
20643
  windowsHide: true,
@@ -21071,7 +21226,7 @@ ${fence}`;
21071
21226
 
21072
21227
  // dist/file-diff.js
21073
21228
  import { Buffer as Buffer2 } from "node:buffer";
21074
- import path4 from "node:path";
21229
+ import path5 from "node:path";
21075
21230
  import { fileURLToPath } from "node:url";
21076
21231
 
21077
21232
  // ../../../node_modules/diff/libesm/diff/base.js
@@ -21174,16 +21329,16 @@ var Diff = class {
21174
21329
  }
21175
21330
  }
21176
21331
  }
21177
- addToPath(path7, added, removed, oldPosInc, options) {
21178
- const last = path7.lastComponent;
21332
+ addToPath(path8, added, removed, oldPosInc, options) {
21333
+ const last = path8.lastComponent;
21179
21334
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
21180
21335
  return {
21181
- oldPos: path7.oldPos + oldPosInc,
21336
+ oldPos: path8.oldPos + oldPosInc,
21182
21337
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
21183
21338
  };
21184
21339
  } else {
21185
21340
  return {
21186
- oldPos: path7.oldPos + oldPosInc,
21341
+ oldPos: path8.oldPos + oldPosInc,
21187
21342
  lastComponent: { count: 1, added, removed, previousComponent: last }
21188
21343
  };
21189
21344
  }
@@ -21503,23 +21658,23 @@ function resolveFilePath(candidate) {
21503
21658
  }
21504
21659
  try {
21505
21660
  if (candidate.startsWith("file:")) {
21506
- return path4.resolve(fileURLToPath(new URL(candidate)));
21661
+ return path5.resolve(fileURLToPath(new URL(candidate)));
21507
21662
  }
21508
- return path4.resolve(candidate);
21663
+ return path5.resolve(candidate);
21509
21664
  } catch {
21510
21665
  try {
21511
21666
  const withoutScheme = candidate.replace(/^file:\/\/\/?/iu, "");
21512
- return path4.resolve(decodeURIComponent(withoutScheme));
21667
+ return path5.resolve(decodeURIComponent(withoutScheme));
21513
21668
  } catch {
21514
21669
  return null;
21515
21670
  }
21516
21671
  }
21517
21672
  }
21518
21673
  function displayPath(nativePath, cwd) {
21519
- const resolvedCwd = path4.resolve(cwd);
21520
- const resolvedPath = path4.resolve(nativePath);
21521
- const relative = path4.relative(resolvedCwd, resolvedPath);
21522
- const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path4.sep}`);
21674
+ const resolvedCwd = path5.resolve(cwd);
21675
+ const resolvedPath = path5.resolve(nativePath);
21676
+ const relative = path5.relative(resolvedCwd, resolvedPath);
21677
+ const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path5.sep}`);
21523
21678
  const selected = inside ? relative : resolvedPath;
21524
21679
  const normalized = selected.replaceAll("\\", "/");
21525
21680
  if (normalized.length === 0 || normalized === ".")
@@ -22125,7 +22280,7 @@ var KiroUsage = class {
22125
22280
  // dist/history.js
22126
22281
  import { access, readdir, readFile } from "node:fs/promises";
22127
22282
  import os2 from "node:os";
22128
- import path5 from "node:path";
22283
+ import path6 from "node:path";
22129
22284
 
22130
22285
  // dist/permission-modes.js
22131
22286
  var KIRO_DEFAULT_PERMISSION_MODE_ID = harnessPermissionModeIdSchema.parse("autopilot");
@@ -22161,12 +22316,12 @@ function isRecord10(value) {
22161
22316
  }
22162
22317
  function kiroHomeDir(environment = process.env) {
22163
22318
  const home = environment.HOME ?? environment.USERPROFILE ?? os2.homedir();
22164
- return environment.KIRO_HOME ?? path5.join(home, ".kiro");
22319
+ return environment.KIRO_HOME ?? path6.join(home, ".kiro");
22165
22320
  }
22166
22321
  async function locateKiroNativeSession(input, sessionId) {
22167
22322
  if (!sessionId || sessionId.trim().length === 0)
22168
22323
  return null;
22169
- const root = path5.join(input.homeDirectory ?? kiroHomeDir(input.environment), "sessions");
22324
+ const root = path6.join(input.homeDirectory ?? kiroHomeDir(input.environment), "sessions");
22170
22325
  let entries;
22171
22326
  try {
22172
22327
  entries = await readdir(root, { withFileTypes: true });
@@ -22176,14 +22331,14 @@ async function locateKiroNativeSession(input, sessionId) {
22176
22331
  for (const entry of entries) {
22177
22332
  if (!entry.isDirectory() || entry.name === "cli")
22178
22333
  continue;
22179
- const sessionDir = path5.join(root, entry.name, sessionId);
22180
- const metaFile = path5.join(sessionDir, "session.json");
22334
+ const sessionDir = path6.join(root, entry.name, sessionId);
22335
+ const metaFile = path6.join(sessionDir, "session.json");
22181
22336
  try {
22182
22337
  await access(metaFile);
22183
22338
  const content = await readFile(metaFile, "utf8");
22184
22339
  const meta3 = JSON.parse(content);
22185
22340
  if (meta3 && meta3.id === sessionId) {
22186
- const cwd = Array.isArray(meta3.workspacePaths) && meta3.workspacePaths.length > 0 ? path5.resolve(meta3.workspacePaths[0]) : process.cwd();
22341
+ const cwd = Array.isArray(meta3.workspacePaths) && meta3.workspacePaths.length > 0 ? path6.resolve(meta3.workspacePaths[0]) : process.cwd();
22187
22342
  return {
22188
22343
  sessionDirectory: sessionDir,
22189
22344
  sessionMeta: meta3,
@@ -22197,7 +22352,7 @@ async function locateKiroNativeSession(input, sessionId) {
22197
22352
  return null;
22198
22353
  }
22199
22354
  async function readKiroNativeMessages(sessionDirectory) {
22200
- const messagesFile = path5.join(sessionDirectory, "messages.jsonl");
22355
+ const messagesFile = path6.join(sessionDirectory, "messages.jsonl");
22201
22356
  const raw = await readFile(messagesFile, "utf8");
22202
22357
  return raw.split("\n").map((line) => line.trim()).filter((line) => line.length > 0).map((line) => {
22203
22358
  const row = JSON.parse(line);
@@ -22218,7 +22373,7 @@ async function readKiroSessionMessages(location, ancestors = /* @__PURE__ */ new
22218
22373
  if (first?.payload.operationType !== "Summary" || !location.sessionMeta.parentSessionId) {
22219
22374
  return rows;
22220
22375
  }
22221
- const parent = await locateKiroNativeSession({ homeDirectory: path5.resolve(location.sessionDirectory, "../../..") }, location.sessionMeta.parentSessionId);
22376
+ const parent = await locateKiroNativeSession({ homeDirectory: path6.resolve(location.sessionDirectory, "../../..") }, location.sessionMeta.parentSessionId);
22222
22377
  if (!parent)
22223
22378
  throw new Error("Kiro fork's archived parent history was not found");
22224
22379
  const parentRows = await readKiroSessionMessages(parent, ancestors);
@@ -22501,7 +22656,7 @@ var KiroAdapter = class {
22501
22656
  this.#deps = deps;
22502
22657
  }
22503
22658
  async inspect(input = {}) {
22504
- const cwd = path6.resolve(input.cwd ?? process.cwd());
22659
+ const cwd = path7.resolve(input.cwd ?? process.cwd());
22505
22660
  const cached2 = this.#inspectionCache.get(cwd);
22506
22661
  if (!input.refresh && cached2) {
22507
22662
  if (cached2.refreshAfter <= Date.now()) {
@@ -23613,14 +23768,31 @@ var KiroSession = class {
23613
23768
  }
23614
23769
  };
23615
23770
 
23771
+ // dist/installation.js
23772
+ function createKiroInstallation(environment, command) {
23773
+ return async (action) => {
23774
+ if (action === "update")
23775
+ throw new Error("Use Kiro CLI's original installer to update");
23776
+ const executable = resolveKiroExecutable({ environment, ...command ? { command } : {} });
23777
+ const currentVersion = versionFromOutput(await runInstallationCommand(executable, ["--version"], environment));
23778
+ return {
23779
+ currentVersion,
23780
+ latestVersion: "Unknown",
23781
+ updateAvailable: false,
23782
+ canUpdate: false,
23783
+ message: "Use Kiro CLI's original installer or native updater to check for and install updates."
23784
+ };
23785
+ };
23786
+ }
23787
+
23616
23788
  // dist/plugin.js
23617
23789
  var CODEXHOST_KIRO_COMMAND = "CODEXHOST_KIRO_COMMAND";
23618
23790
  function createHarnessAdapter(context) {
23619
23791
  const environment = { ...context.environment };
23620
- return new KiroAdapter({
23792
+ return Object.assign(new KiroAdapter({
23621
23793
  ...environment[CODEXHOST_KIRO_COMMAND] ? { command: environment[CODEXHOST_KIRO_COMMAND] } : {},
23622
23794
  environment
23623
- });
23795
+ }), { installation: createKiroInstallation(environment, environment[CODEXHOST_KIRO_COMMAND]) });
23624
23796
  }
23625
23797
  export {
23626
23798
  CODEXHOST_KIRO_COMMAND,