@liberseek/boft-cli-win32-arm64 0.8.3 → 0.8.4

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 (34) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +58 -5
  4. package/app/console-web.js +436 -67
  5. package/app/desktop-controller.mjs +72 -9
  6. package/app/host-runtime.mjs +772 -218
  7. package/app/plugins/antigravity/plugin.mjs +91 -13
  8. package/app/plugins/claude-code/plugin.mjs +404 -26
  9. package/app/plugins/codebuddy/plugin.mjs +117 -22
  10. package/app/plugins/codex-usage/plugin.mjs +176 -74
  11. package/app/plugins/copilot/assets/icon.png +0 -0
  12. package/app/plugins/copilot/manifest.json +26 -0
  13. package/app/plugins/copilot/plugin.mjs +34601 -0
  14. package/app/plugins/cursor-cli/plugin.mjs +20794 -44912
  15. package/app/plugins/deepseek-harness/plugin.mjs +83 -11
  16. package/app/plugins/enabled.json +1 -0
  17. package/app/plugins/grok/plugin.mjs +214 -24
  18. package/app/plugins/hermes/plugin.mjs +80 -9
  19. package/app/plugins/kimi-code/plugin.mjs +76 -7
  20. package/app/plugins/kiro-cli/plugin.mjs +76 -7
  21. package/app/plugins/muse/plugin.mjs +73 -5
  22. package/app/plugins/omp/plugin.mjs +2155 -2000
  23. package/app/plugins/opencode/plugin.mjs +85 -11
  24. package/app/plugins/pi/plugin.mjs +2515 -2298
  25. package/app/plugins/qoder/plugin.mjs +83 -11
  26. package/app/plugins/qoder-cn/plugin.mjs +83 -11
  27. package/app/plugins/workbuddy/plugin.mjs +378 -46
  28. package/app/plugins/zcode/plugin.mjs +84 -11
  29. package/app/renderer-extension.js +833 -162
  30. package/bin/boft.exe +0 -0
  31. package/libexec/boft-node-repl.exe +0 -0
  32. package/libexec/boft-shim.exe +0 -0
  33. package/libexec/boft-updater.exe +0 -0
  34. package/package.json +1 -1
@@ -4209,10 +4209,13 @@ function usageSessionTitle(value) {
4209
4209
  return void 0;
4210
4210
  if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
4211
4211
  return normalized;
4212
- const characters = [...normalized];
4213
- if (characters.length <= MAX_SESSION_TITLE_LENGTH)
4214
- return normalized;
4215
- return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
4212
+ let title = "";
4213
+ for (const character of normalized) {
4214
+ if (title.length + character.length >= MAX_SESSION_TITLE_LENGTH)
4215
+ break;
4216
+ title += character;
4217
+ }
4218
+ return `${title.trimEnd()}…`;
4216
4219
  }
4217
4220
  function sessionIdOk(value) {
4218
4221
  return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
@@ -18900,10 +18903,19 @@ var model = external_exports.string().min(1).max(512);
18900
18903
  var project = external_exports.string().min(1).max(4096);
18901
18904
  var usageStatisticsParamsSchema = external_exports.strictObject({
18902
18905
  range: external_exports.enum(USAGE_STATISTICS_RANGES),
18906
+ /** Display timezone for ranges, dates and hourly buckets; omitted means the Host's local zone. */
18907
+ timeZone: external_exports.string().min(1).max(128).refine((value) => {
18908
+ try {
18909
+ new Intl.DateTimeFormat("en", { timeZone: value });
18910
+ return true;
18911
+ } catch {
18912
+ return false;
18913
+ }
18914
+ }, "Unsupported usage statistics timezone").optional(),
18903
18915
  harness: harness.optional(),
18904
18916
  model: model.nullable().optional(),
18905
18917
  project: project.nullable().optional(),
18906
- /** One local date inside the range. */
18918
+ /** One date in the query timezone inside the range. */
18907
18919
  date: localDate.optional()
18908
18920
  });
18909
18921
  var usageStatisticsTotalsSchema = external_exports.strictObject({
@@ -18939,7 +18951,7 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
18939
18951
  });
18940
18952
  var usageStatisticsResultSchema = external_exports.strictObject({
18941
18953
  range: external_exports.enum(USAGE_STATISTICS_RANGES),
18942
- /** First local date of the range; null for all time. */
18954
+ /** First date in the query timezone (Host local when omitted); null for all time. */
18943
18955
  from: localDate.nullable(),
18944
18956
  to: localDate,
18945
18957
  /** The filters these figures apply, echoed so a late answer to older filters is recognised. */
@@ -18979,7 +18991,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
18979
18991
  totals: usageStatisticsTotalsSchema,
18980
18992
  /** Each date and Harness of the range: every filter except the day. */
18981
18993
  daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
18982
- /** Local weekday (0 = Sunday) and hour, all filters applied. */
18994
+ /** Weekday (0 = Sunday) and hour in the query timezone, all filters applied. */
18983
18995
  hourly: external_exports.array(external_exports.strictObject({
18984
18996
  weekday: external_exports.number().int().min(0).max(6),
18985
18997
  hour: external_exports.number().int().min(0).max(23),
@@ -19121,6 +19133,8 @@ var CONSOLE_HOST_METHODS = Object.freeze([
19121
19133
  "codexhost/harness/display-settings/set",
19122
19134
  "codexhost/harness/inspect",
19123
19135
  "codexhost/harness/installation",
19136
+ "codexhost/harness/installation/start",
19137
+ "codexhost/harness/installation/status",
19124
19138
  "codexhost/harness/launch-settings/get",
19125
19139
  "codexhost/harness/launch-settings/set",
19126
19140
  HARNESS_LONG_CONTEXT_GET_METHOD,
@@ -19198,7 +19212,18 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
19198
19212
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
19199
19213
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
19200
19214
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
19215
+ var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
19216
+ var composerIndicatorsSchema = external_exports.array(external_exports.object({
19217
+ kind: external_exports.literal("countdown"),
19218
+ id: external_exports.string().min(1).max(64),
19219
+ expiresAtUnix: nonNegativeSafeIntegerSchema,
19220
+ label: indicatorTextSchema(256).optional(),
19221
+ tooltip: indicatorTextSchema(1024).optional()
19222
+ }).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
19223
+ message: "Composer indicator IDs must be unique"
19224
+ });
19201
19225
  var threadUsageSnapshotSchema = external_exports.object({
19226
+ composerIndicators: composerIndicatorsSchema.optional(),
19202
19227
  inputTokens: nonNegativeSafeIntegerSchema.optional(),
19203
19228
  cachedInputTokens: nonNegativeSafeIntegerSchema.optional(),
19204
19229
  cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
@@ -19624,7 +19649,9 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
19624
19649
  }).strict().optional(),
19625
19650
  input: external_exports.object({
19626
19651
  image: external_exports.boolean()
19627
- }).strict().optional()
19652
+ }).strict().optional(),
19653
+ /** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
19654
+ steer: external_exports.boolean().optional()
19628
19655
  }).strict();
19629
19656
  var harnessConfigurationStateSchema = external_exports.object({
19630
19657
  effectiveModel: harnessModelRefSchema.optional(),
@@ -19671,7 +19698,9 @@ var harnessInspectionSchema = external_exports.union([
19671
19698
  var harnessInspectParamsSchema = external_exports.object({
19672
19699
  harnessId: harnessIdSchema,
19673
19700
  cwd: nonBlankTextSchema2.max(16384).optional(),
19674
- refresh: external_exports.boolean().optional()
19701
+ refresh: external_exports.boolean().optional(),
19702
+ /** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
19703
+ purpose: external_exports.literal("availability").optional()
19675
19704
  }).strict();
19676
19705
  var harnessWebUiOpenParamsSchema = external_exports.object({
19677
19706
  harnessId: harnessIdSchema
@@ -19756,6 +19785,15 @@ var threadOwnershipListResultSchema = external_exports.object({
19756
19785
  seen.add(thread.threadId);
19757
19786
  }
19758
19787
  });
19788
+ var threadSteeringInspectParamsSchema = external_exports.object({
19789
+ threadId: hostThreadIdSchema,
19790
+ /** The text about to be steered; a Harness command always stops and restarts. */
19791
+ text: external_exports.string().optional()
19792
+ }).strict();
19793
+ var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
19794
+ var threadSteeringInspectResultSchema = external_exports.object({
19795
+ delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
19796
+ }).strict();
19759
19797
 
19760
19798
  // ../../shared-contracts/dist/harness-route.js
19761
19799
  var harnessPluginRouteSchema = external_exports.object({
@@ -19788,6 +19826,10 @@ var harnessInstallationStateSchema = external_exports.object({
19788
19826
  latestVersion: external_exports.string().min(1).max(128),
19789
19827
  updateAvailable: external_exports.boolean(),
19790
19828
  canUpdate: external_exports.boolean(),
19829
+ /** Defaults to CLI; some Harnesses ship only inside a desktop application. */
19830
+ versionKind: external_exports.enum(["cli", "application"]).optional(),
19831
+ /** Official download opened by the user; does not imply an automatic installation. */
19832
+ manualUpdateUrl: external_exports.url().max(2048).refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Manual updates require a credential-free HTTPS URL").optional(),
19791
19833
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
19792
19834
  message: external_exports.string().max(2048).optional(),
19793
19835
  messageCode: external_exports.string().min(1).max(128).optional(),
@@ -19795,6 +19837,20 @@ var harnessInstallationStateSchema = external_exports.object({
19795
19837
  notice: harnessLocalizedTextSchema.optional(),
19796
19838
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
19797
19839
  }).strict();
19840
+ var harnessInstallationTaskParamsSchema = external_exports.object({ taskId: external_exports.string().uuid() }).strict();
19841
+ var harnessInstallationTaskSchema = external_exports.discriminatedUnion("status", [
19842
+ external_exports.object({ taskId: external_exports.string().uuid(), status: external_exports.literal("running") }).strict(),
19843
+ external_exports.object({
19844
+ taskId: external_exports.string().uuid(),
19845
+ status: external_exports.literal("succeeded"),
19846
+ result: harnessInstallationStateSchema
19847
+ }).strict(),
19848
+ external_exports.object({
19849
+ taskId: external_exports.string().uuid(),
19850
+ status: external_exports.literal("failed"),
19851
+ error: external_exports.object({ code: external_exports.number().int(), message: external_exports.string().min(1).max(2048) }).strict()
19852
+ }).strict()
19853
+ ]);
19798
19854
 
19799
19855
  // ../../shared-contracts/dist/codex-accounts.js
19800
19856
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
@@ -20318,6 +20374,18 @@ function sanitizeDiagnosticTail(value) {
20318
20374
  return redacted.length <= DIAGNOSTIC_TAIL_MAX_LENGTH ? redacted : redacted.slice(-DIAGNOSTIC_TAIL_MAX_LENGTH);
20319
20375
  }
20320
20376
 
20377
+ // ../../harness-adapter/dist/steer.js
20378
+ function unsupportedSteer(harnessLabel) {
20379
+ return {
20380
+ ok: false,
20381
+ error: {
20382
+ code: "unsupported",
20383
+ message: `${harnessLabel} cannot steer an active Turn natively`,
20384
+ retryable: false
20385
+ }
20386
+ };
20387
+ }
20388
+
20321
20389
  // ../../harness-adapter/dist/usage.js
20322
20390
  var tokenFields = [
20323
20391
  "inputTokens",
@@ -20345,6 +20413,7 @@ var usageFields = /* @__PURE__ */ new Set([
20345
20413
  ...safeIntegerFields,
20346
20414
  ...percentFields,
20347
20415
  "sessionCacheUsage",
20416
+ "composerIndicators",
20348
20417
  "totalCostUsd",
20349
20418
  "totalCredits",
20350
20419
  "contextUsagePercent",
@@ -20367,6 +20436,7 @@ function parseHostUsage(value) {
20367
20436
  throw new Error(`Harness Usage contains unknown field '${key}'`);
20368
20437
  }
20369
20438
  }
20439
+ const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
20370
20440
  for (const field of [
20371
20441
  "totalCredits",
20372
20442
  "contextUsagePercent",
@@ -20443,9 +20513,9 @@ function parseHostUsage(value) {
20443
20513
  if (value.costSource !== "publicPrice") {
20444
20514
  throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
20445
20515
  }
20446
- return { ...value, unpricedModels: [...models] };
20516
+ return { ...value, ...indicators, unpricedModels: [...models] };
20447
20517
  }
20448
- return { ...value };
20518
+ return { ...value, ...indicators };
20449
20519
  }
20450
20520
  var requestTokenFields = [
20451
20521
  "inputTokens",
@@ -28833,6 +28903,8 @@ var ModernHarnessSession = class {
28833
28903
  switch (command.type) {
28834
28904
  case "turn.start":
28835
28905
  return this.#start(command);
28906
+ case "turn.steer":
28907
+ return Promise.resolve(unsupportedSteer("DeepSeek Harness"));
28836
28908
  case "turn.cancel":
28837
28909
  return this.#cancel(command);
28838
28910
  case "interaction.respond":
@@ -18,6 +18,7 @@
18
18
  "qoder-cn",
19
19
  "kimi-code",
20
20
  "zcode",
21
+ "copilot",
21
22
  "codex-usage"
22
23
  ]
23
24
  }
@@ -393,10 +393,13 @@ function usageSessionTitle(value) {
393
393
  return void 0;
394
394
  if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
395
395
  return normalized;
396
- const characters = [...normalized];
397
- if (characters.length <= MAX_SESSION_TITLE_LENGTH)
398
- return normalized;
399
- return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
396
+ let title = "";
397
+ for (const character of normalized) {
398
+ if (title.length + character.length >= MAX_SESSION_TITLE_LENGTH)
399
+ break;
400
+ title += character;
401
+ }
402
+ return `${title.trimEnd()}…`;
400
403
  }
401
404
  function sessionIdOk(value) {
402
405
  return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
@@ -19414,10 +19417,19 @@ var model = external_exports.string().min(1).max(512);
19414
19417
  var project = external_exports.string().min(1).max(4096);
19415
19418
  var usageStatisticsParamsSchema = external_exports.strictObject({
19416
19419
  range: external_exports.enum(USAGE_STATISTICS_RANGES),
19420
+ /** Display timezone for ranges, dates and hourly buckets; omitted means the Host's local zone. */
19421
+ timeZone: external_exports.string().min(1).max(128).refine((value) => {
19422
+ try {
19423
+ new Intl.DateTimeFormat("en", { timeZone: value });
19424
+ return true;
19425
+ } catch {
19426
+ return false;
19427
+ }
19428
+ }, "Unsupported usage statistics timezone").optional(),
19417
19429
  harness: harness.optional(),
19418
19430
  model: model.nullable().optional(),
19419
19431
  project: project.nullable().optional(),
19420
- /** One local date inside the range. */
19432
+ /** One date in the query timezone inside the range. */
19421
19433
  date: localDate.optional()
19422
19434
  });
19423
19435
  var usageStatisticsTotalsSchema = external_exports.strictObject({
@@ -19453,7 +19465,7 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
19453
19465
  });
19454
19466
  var usageStatisticsResultSchema = external_exports.strictObject({
19455
19467
  range: external_exports.enum(USAGE_STATISTICS_RANGES),
19456
- /** First local date of the range; null for all time. */
19468
+ /** First date in the query timezone (Host local when omitted); null for all time. */
19457
19469
  from: localDate.nullable(),
19458
19470
  to: localDate,
19459
19471
  /** The filters these figures apply, echoed so a late answer to older filters is recognised. */
@@ -19493,7 +19505,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
19493
19505
  totals: usageStatisticsTotalsSchema,
19494
19506
  /** Each date and Harness of the range: every filter except the day. */
19495
19507
  daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
19496
- /** Local weekday (0 = Sunday) and hour, all filters applied. */
19508
+ /** Weekday (0 = Sunday) and hour in the query timezone, all filters applied. */
19497
19509
  hourly: external_exports.array(external_exports.strictObject({
19498
19510
  weekday: external_exports.number().int().min(0).max(6),
19499
19511
  hour: external_exports.number().int().min(0).max(23),
@@ -19635,6 +19647,8 @@ var CONSOLE_HOST_METHODS = Object.freeze([
19635
19647
  "codexhost/harness/display-settings/set",
19636
19648
  "codexhost/harness/inspect",
19637
19649
  "codexhost/harness/installation",
19650
+ "codexhost/harness/installation/start",
19651
+ "codexhost/harness/installation/status",
19638
19652
  "codexhost/harness/launch-settings/get",
19639
19653
  "codexhost/harness/launch-settings/set",
19640
19654
  HARNESS_LONG_CONTEXT_GET_METHOD,
@@ -19712,7 +19726,18 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
19712
19726
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
19713
19727
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
19714
19728
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
19729
+ var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
19730
+ var composerIndicatorsSchema = external_exports.array(external_exports.object({
19731
+ kind: external_exports.literal("countdown"),
19732
+ id: external_exports.string().min(1).max(64),
19733
+ expiresAtUnix: nonNegativeSafeIntegerSchema,
19734
+ label: indicatorTextSchema(256).optional(),
19735
+ tooltip: indicatorTextSchema(1024).optional()
19736
+ }).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
19737
+ message: "Composer indicator IDs must be unique"
19738
+ });
19715
19739
  var threadUsageSnapshotSchema = external_exports.object({
19740
+ composerIndicators: composerIndicatorsSchema.optional(),
19716
19741
  inputTokens: nonNegativeSafeIntegerSchema.optional(),
19717
19742
  cachedInputTokens: nonNegativeSafeIntegerSchema.optional(),
19718
19743
  cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
@@ -20138,7 +20163,9 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
20138
20163
  }).strict().optional(),
20139
20164
  input: external_exports.object({
20140
20165
  image: external_exports.boolean()
20141
- }).strict().optional()
20166
+ }).strict().optional(),
20167
+ /** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
20168
+ steer: external_exports.boolean().optional()
20142
20169
  }).strict();
20143
20170
  var harnessConfigurationStateSchema = external_exports.object({
20144
20171
  effectiveModel: harnessModelRefSchema.optional(),
@@ -20185,7 +20212,9 @@ var harnessInspectionSchema = external_exports.union([
20185
20212
  var harnessInspectParamsSchema = external_exports.object({
20186
20213
  harnessId: harnessIdSchema,
20187
20214
  cwd: nonBlankTextSchema2.max(16384).optional(),
20188
- refresh: external_exports.boolean().optional()
20215
+ refresh: external_exports.boolean().optional(),
20216
+ /** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
20217
+ purpose: external_exports.literal("availability").optional()
20189
20218
  }).strict();
20190
20219
  var harnessWebUiOpenParamsSchema = external_exports.object({
20191
20220
  harnessId: harnessIdSchema
@@ -20270,6 +20299,15 @@ var threadOwnershipListResultSchema = external_exports.object({
20270
20299
  seen.add(thread.threadId);
20271
20300
  }
20272
20301
  });
20302
+ var threadSteeringInspectParamsSchema = external_exports.object({
20303
+ threadId: hostThreadIdSchema,
20304
+ /** The text about to be steered; a Harness command always stops and restarts. */
20305
+ text: external_exports.string().optional()
20306
+ }).strict();
20307
+ var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
20308
+ var threadSteeringInspectResultSchema = external_exports.object({
20309
+ delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
20310
+ }).strict();
20273
20311
 
20274
20312
  // ../../shared-contracts/dist/harness-route.js
20275
20313
  var harnessPluginRouteSchema = external_exports.object({
@@ -20302,6 +20340,10 @@ var harnessInstallationStateSchema = external_exports.object({
20302
20340
  latestVersion: external_exports.string().min(1).max(128),
20303
20341
  updateAvailable: external_exports.boolean(),
20304
20342
  canUpdate: external_exports.boolean(),
20343
+ /** Defaults to CLI; some Harnesses ship only inside a desktop application. */
20344
+ versionKind: external_exports.enum(["cli", "application"]).optional(),
20345
+ /** Official download opened by the user; does not imply an automatic installation. */
20346
+ manualUpdateUrl: external_exports.url().max(2048).refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Manual updates require a credential-free HTTPS URL").optional(),
20305
20347
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
20306
20348
  message: external_exports.string().max(2048).optional(),
20307
20349
  messageCode: external_exports.string().min(1).max(128).optional(),
@@ -20309,6 +20351,20 @@ var harnessInstallationStateSchema = external_exports.object({
20309
20351
  notice: harnessLocalizedTextSchema.optional(),
20310
20352
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
20311
20353
  }).strict();
20354
+ var harnessInstallationTaskParamsSchema = external_exports.object({ taskId: external_exports.string().uuid() }).strict();
20355
+ var harnessInstallationTaskSchema = external_exports.discriminatedUnion("status", [
20356
+ external_exports.object({ taskId: external_exports.string().uuid(), status: external_exports.literal("running") }).strict(),
20357
+ external_exports.object({
20358
+ taskId: external_exports.string().uuid(),
20359
+ status: external_exports.literal("succeeded"),
20360
+ result: harnessInstallationStateSchema
20361
+ }).strict(),
20362
+ external_exports.object({
20363
+ taskId: external_exports.string().uuid(),
20364
+ status: external_exports.literal("failed"),
20365
+ error: external_exports.object({ code: external_exports.number().int(), message: external_exports.string().min(1).max(2048) }).strict()
20366
+ }).strict()
20367
+ ]);
20312
20368
 
20313
20369
  // ../../shared-contracts/dist/codex-accounts.js
20314
20370
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
@@ -20806,6 +20862,18 @@ function sanitizeDiagnosticTail(value) {
20806
20862
  return redacted.length <= DIAGNOSTIC_TAIL_MAX_LENGTH ? redacted : redacted.slice(-DIAGNOSTIC_TAIL_MAX_LENGTH);
20807
20863
  }
20808
20864
 
20865
+ // ../../harness-adapter/dist/steer.js
20866
+ function unsupportedSteer(harnessLabel) {
20867
+ return {
20868
+ ok: false,
20869
+ error: {
20870
+ code: "unsupported",
20871
+ message: `${harnessLabel} cannot steer an active Turn natively`,
20872
+ retryable: false
20873
+ }
20874
+ };
20875
+ }
20876
+
20809
20877
  // ../../harness-adapter/dist/usage.js
20810
20878
  var tokenFields = [
20811
20879
  "inputTokens",
@@ -20833,6 +20901,7 @@ var usageFields = /* @__PURE__ */ new Set([
20833
20901
  ...safeIntegerFields,
20834
20902
  ...percentFields,
20835
20903
  "sessionCacheUsage",
20904
+ "composerIndicators",
20836
20905
  "totalCostUsd",
20837
20906
  "totalCredits",
20838
20907
  "contextUsagePercent",
@@ -20855,6 +20924,7 @@ function parseHostUsage(value) {
20855
20924
  throw new Error(`Harness Usage contains unknown field '${key}'`);
20856
20925
  }
20857
20926
  }
20927
+ const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
20858
20928
  for (const field of [
20859
20929
  "totalCredits",
20860
20930
  "contextUsagePercent",
@@ -20931,9 +21001,9 @@ function parseHostUsage(value) {
20931
21001
  if (value.costSource !== "publicPrice") {
20932
21002
  throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
20933
21003
  }
20934
- return { ...value, unpricedModels: [...models] };
21004
+ return { ...value, ...indicators, unpricedModels: [...models] };
20935
21005
  }
20936
- return { ...value };
21006
+ return { ...value, ...indicators };
20937
21007
  }
20938
21008
  var requestTokenFields = [
20939
21009
  "inputTokens",
@@ -23606,6 +23676,53 @@ function grokPermissionModeSessionMeta(permissionMode) {
23606
23676
  };
23607
23677
  }
23608
23678
 
23679
+ // dist/permission-confirmation.js
23680
+ import { stripVTControlCharacters } from "node:util";
23681
+ var GROK_PERMISSION_MODE_METHOD = "_x.ai/yolo_mode_changed";
23682
+ var permissionManagerLog = "xai_grok_workspace::permission::manager=info";
23683
+ function grokPermissionLogFilter(existing) {
23684
+ return existing ? `${existing},${permissionManagerLog}` : permissionManagerLog;
23685
+ }
23686
+ var GrokPermissionConfirmation = class {
23687
+ #expected;
23688
+ #completion = Promise.withResolvers();
23689
+ #yolo;
23690
+ #auto;
23691
+ #buffer = "";
23692
+ constructor(mode) {
23693
+ this.#expected = grokPermissionModeSessionMeta(mode);
23694
+ }
23695
+ get completed() {
23696
+ return this.#completion.promise;
23697
+ }
23698
+ accept(chunk) {
23699
+ this.#buffer += chunk;
23700
+ let newline2;
23701
+ while ((newline2 = this.#buffer.indexOf("\n")) !== -1) {
23702
+ const line = stripVTControlCharacters(this.#buffer.slice(0, newline2)).trimEnd();
23703
+ this.#buffer = this.#buffer.slice(newline2 + 1);
23704
+ const match = /^\d{4}-\d{2}-\d{2}T\S+\s+INFO\s+(?:.*?: )?(always-approve|auto permission mode) set to: (true|false)$/.exec(line);
23705
+ if (!match)
23706
+ continue;
23707
+ const value = match[2] === "true";
23708
+ if (match[1] === "always-approve")
23709
+ this.#yolo = value;
23710
+ else
23711
+ this.#auto = value;
23712
+ if (this.#yolo !== void 0 && this.#yolo !== this.#expected.yoloMode || this.#auto !== void 0 && this.#auto !== this.#expected.autoMode) {
23713
+ this.reject(new Error("Grok did not apply the requested Permission Mode"));
23714
+ } else if (this.#yolo !== void 0 && this.#auto !== void 0) {
23715
+ this.#completion.resolve(void 0);
23716
+ }
23717
+ }
23718
+ if (this.#buffer.length > 16384)
23719
+ this.#buffer = "";
23720
+ }
23721
+ reject(error53) {
23722
+ this.#completion.reject(error53);
23723
+ }
23724
+ };
23725
+
23609
23726
  // dist/acp-transport.js
23610
23727
  var GrokTransportError = class extends Error {
23611
23728
  kind;
@@ -23882,6 +23999,8 @@ var GrokAcpTransport = class {
23882
23999
  #child = null;
23883
24000
  #closed = false;
23884
24001
  #closing = false;
24002
+ #closePromise = null;
24003
+ #permissionConfirmation = null;
23885
24004
  #connection = null;
23886
24005
  #initialize = null;
23887
24006
  #replay = null;
@@ -24081,7 +24200,11 @@ var GrokAcpTransport = class {
24081
24200
  const invocation = grokInvocation(executable, process.platform, this.#startupModelId);
24082
24201
  const child = spawn(invocation.command, invocation.arguments, {
24083
24202
  cwd: this.#options.cwd,
24084
- env: { ...process.env, ...this.#options.environment },
24203
+ env: {
24204
+ ...process.env,
24205
+ ...this.#options.environment,
24206
+ RUST_LOG: grokPermissionLogFilter(this.#options.environment?.RUST_LOG ?? process.env.RUST_LOG)
24207
+ },
24085
24208
  detached: process.platform !== "win32",
24086
24209
  stdio: ["pipe", "pipe", "pipe"],
24087
24210
  windowsHide: true,
@@ -24090,6 +24213,7 @@ var GrokAcpTransport = class {
24090
24213
  this.#child = child;
24091
24214
  child.stderr.on("data", (chunk) => {
24092
24215
  this.#stderrTail = sanitizeDiagnosticTail(`${this.#stderrTail}${chunk.toString()}`);
24216
+ this.#permissionConfirmation?.accept(chunk.toString());
24093
24217
  });
24094
24218
  await withTimeout(new Promise((resolve, reject) => {
24095
24219
  child.once("spawn", resolve);
@@ -24127,6 +24251,8 @@ var GrokAcpTransport = class {
24127
24251
  }
24128
24252
  if (this.#activePrompt)
24129
24253
  throw new Error("Grok ACP Session already has an active Prompt");
24254
+ if (this.#permissionConfirmation)
24255
+ throw new GrokTransportError("unavailable", "Grok ACP Session has an active operation");
24130
24256
  const active = { onEvent, onPermission, onExtension };
24131
24257
  this.#activePrompt = active;
24132
24258
  try {
@@ -24145,7 +24271,7 @@ var GrokAcpTransport = class {
24145
24271
  if (!connection || !this.#sessionId || this.#closed || this.#closing) {
24146
24272
  throw new GrokTransportError("unavailable", "Grok ACP Session is unavailable");
24147
24273
  }
24148
- if (this.#activePrompt || this.#activeCompact) {
24274
+ if (this.#activePrompt || this.#activeCompact || this.#permissionConfirmation) {
24149
24275
  throw new GrokTransportError("unavailable", "Grok ACP Session already has an active operation");
24150
24276
  }
24151
24277
  const active = { onEvent, cancellationRequested: false };
@@ -24178,6 +24304,8 @@ var GrokAcpTransport = class {
24178
24304
  const connection = this.#connection;
24179
24305
  if (!connection || !this.#sessionId)
24180
24306
  throw new Error("Grok ACP Session is unavailable");
24307
+ if (this.#permissionConfirmation)
24308
+ throw new GrokTransportError("unavailable", "Grok ACP Session has an active operation");
24181
24309
  const response = await connection.request("session/set_model", {
24182
24310
  sessionId: this.#sessionId,
24183
24311
  modelId,
@@ -24201,14 +24329,57 @@ var GrokAcpTransport = class {
24201
24329
  this.#activeCompact.cancellationRequested = true;
24202
24330
  return connection.cancel({ sessionId: this.#sessionId });
24203
24331
  }
24204
- async close() {
24332
+ async setPermissionMode(permissionModeId) {
24333
+ const mode = decodeGrokPermissionModeId(permissionModeId);
24334
+ const connection = this.#connection;
24335
+ const sessionId = this.#sessionId;
24336
+ if (!connection || !sessionId || this.#closed || this.#closing) {
24337
+ throw new GrokTransportError("unavailable", "Grok ACP Session is unavailable");
24338
+ }
24339
+ if (this.#activePrompt || this.#activeCompact || this.#permissionConfirmation) {
24340
+ throw new GrokTransportError("unavailable", "Grok ACP Session has an active operation");
24341
+ }
24342
+ const confirmation = new GrokPermissionConfirmation(mode);
24343
+ this.#permissionConfirmation = confirmation;
24344
+ try {
24345
+ await withTimeout(Promise.all([
24346
+ confirmation.completed,
24347
+ (async () => {
24348
+ const flags = grokPermissionModeSessionMeta(mode);
24349
+ await connection.notify(GROK_PERMISSION_MODE_METHOD, {
24350
+ yolo_mode: flags.yoloMode,
24351
+ auto_mode: flags.autoMode,
24352
+ permission_mode: mode
24353
+ });
24354
+ const response = await connection.request("_x.ai/session/info", { sessionId });
24355
+ if (!isRecord14(response) || !isRecord14(response.result) || response.result.sessionId !== sessionId) {
24356
+ throw new Error("Grok did not confirm the target Session");
24357
+ }
24358
+ })()
24359
+ ]), this.#options.commandTimeoutMs, "Grok Permission Mode confirmation");
24360
+ if (this.#closed || this.#closing)
24361
+ throw new Error("Grok Session closed during configuration");
24362
+ } catch (cause) {
24363
+ const error53 = new GrokTransportError("protocolError", "Grok Permission Mode could not be confirmed; reopen the Session to continue", { cause });
24364
+ this.#fault(error53);
24365
+ await this.close();
24366
+ throw error53;
24367
+ } finally {
24368
+ this.#permissionConfirmation = null;
24369
+ }
24370
+ }
24371
+ close() {
24372
+ return this.#closePromise ??= this.#close();
24373
+ }
24374
+ async #close() {
24205
24375
  if (this.#closed)
24206
24376
  return;
24207
24377
  this.#closing = true;
24378
+ this.#permissionConfirmation?.reject(new Error("Grok Session closed during configuration"));
24208
24379
  const child = this.#child;
24209
24380
  const connection = this.#connection;
24210
24381
  if (connection && this.#sessionId && this.#initialize?.agentCapabilities?.sessionCapabilities?.close) {
24211
- await connection.closeSession({ sessionId: this.#sessionId }).catch(() => void 0);
24382
+ await withTimeout(connection.closeSession({ sessionId: this.#sessionId }), this.#options.closeTimeoutMs, "Grok Session close").catch(() => void 0);
24212
24383
  }
24213
24384
  if (child?.stdin.writable)
24214
24385
  child.stdin.end();
@@ -24272,6 +24443,7 @@ var GrokAcpTransport = class {
24272
24443
  throw RequestError.methodNotFound(method);
24273
24444
  }
24274
24445
  #fault(error53) {
24446
+ this.#permissionConfirmation?.reject(error53);
24275
24447
  if (this.#closing || this.#closed)
24276
24448
  return;
24277
24449
  this.#options.onFault?.(error53);
@@ -25374,7 +25546,7 @@ function capabilitiesForModels(modelState) {
25374
25546
  selectModel: modelState.catalog.models.length > 0,
25375
25547
  selectThinkingOption: modelState.catalog.thinkingOptions.length > 0,
25376
25548
  selectPermissionMode: true,
25377
- permissionModeScope: "atCreate"
25549
+ permissionModeScope: "live"
25378
25550
  },
25379
25551
  history: { fork: true, forkAcrossCwd: true, rollbackLastTurn: true },
25380
25552
  subagents: { observe: true, readTranscript: true }
@@ -25529,6 +25701,8 @@ var GrokHarnessSession = class {
25529
25701
  return { ok: false, error: invalidState("Grok Session is not open") };
25530
25702
  if ("commandId" in command)
25531
25703
  return this.#executeHarnessCommand(command);
25704
+ if (command.type === "turn.steer")
25705
+ return unsupportedSteer("Grok");
25532
25706
  if (command.type === "turn.cancel")
25533
25707
  return this.#cancel(command);
25534
25708
  if (command.type === "interaction.respond")
@@ -25810,14 +25984,29 @@ var GrokHarnessSession = class {
25810
25984
  }
25811
25985
  };
25812
25986
  }
25813
- return {
25814
- ok: false,
25815
- error: {
25816
- code: "invalidRequest",
25817
- message: "Grok Permission Mode is fixed at Session creation",
25818
- retryable: false
25819
- }
25820
- };
25987
+ if (this.#active || this.#configuring) {
25988
+ return {
25989
+ ok: false,
25990
+ error: {
25991
+ code: "sessionBusy",
25992
+ message: "Grok Session cannot configure permissions during another operation",
25993
+ retryable: true
25994
+ }
25995
+ };
25996
+ }
25997
+ this.#configuring = true;
25998
+ try {
25999
+ await this.#transport.setPermissionMode(command.permissionModeId);
26000
+ if (this.#phase !== "open")
26001
+ return { ok: false, error: invalidState("Grok Session is closed") };
26002
+ this.#state = { ...this.#state, effectivePermissionModeId: command.permissionModeId };
26003
+ this.#event({ type: "session.state.changed", state: this.#state });
26004
+ return { ok: true, value: { completed: true } };
26005
+ } catch (error53) {
26006
+ return { ok: false, error: normalizeError(error53, "nativeFailure") };
26007
+ } finally {
26008
+ this.#configuring = false;
26009
+ }
25821
26010
  }
25822
26011
  async #cancel(command) {
25823
26012
  const active = this.#active;
@@ -26809,6 +26998,7 @@ var GrokAdapter = class {
26809
26998
  ]);
26810
26999
  }
26811
27000
  }
27001
+ await transport.setPermissionMode(initialPermissionModeId);
26812
27002
  const history = await transport.getHistory();
26813
27003
  let initialUsage = input.kind === "resume" || input.kind === "fork" || input.kind === "rollbackLastTurn" ? combineUsage(sessionUsageFromHistory(history), usageFromSignals(opened.signals)) : null;
26814
27004
  if (contextWindow !== void 0 && initialUsage?.contextUsedTokens !== void 0) {