@codexhost/cli-linux-arm64 0.13.2 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +94 -8
  4. package/app/console-web.js +537 -146
  5. package/app/desktop-controller.mjs +108 -12
  6. package/app/host-runtime.mjs +847 -235
  7. package/app/plugins/antigravity/plugin.mjs +143 -20
  8. package/app/plugins/claude-code/plugin.mjs +601 -71
  9. package/app/plugins/codebuddy/plugin.mjs +227 -30
  10. package/app/plugins/codex-usage/plugin.mjs +212 -77
  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 +34546 -0
  14. package/app/plugins/cursor-cli/plugin.mjs +20805 -44862
  15. package/app/plugins/deepseek-harness/manifest.json +2 -2
  16. package/app/plugins/deepseek-harness/plugin.mjs +202 -21
  17. package/app/plugins/enabled.json +1 -0
  18. package/app/plugins/grok/plugin.mjs +278 -29
  19. package/app/plugins/hermes/plugin.mjs +143 -12
  20. package/app/plugins/kimi-code/plugin.mjs +140 -16
  21. package/app/plugins/kiro-cli/plugin.mjs +121 -10
  22. package/app/plugins/omp/plugin.mjs +2200 -2002
  23. package/app/plugins/opencode/plugin.mjs +137 -16
  24. package/app/plugins/pi/plugin.mjs +2563 -2282
  25. package/app/plugins/qoder/plugin.mjs +133 -14
  26. package/app/plugins/qoder-cn/plugin.mjs +133 -14
  27. package/app/plugins/workbuddy/plugin.mjs +603 -56
  28. package/app/plugins/zcode/plugin.mjs +133 -14
  29. package/app/renderer-extension.js +1171 -529
  30. package/bin/codexhost +0 -0
  31. package/libexec/codexhost-shim +0 -0
  32. package/libexec/codexhost-updater +0 -0
  33. package/package.json +1 -1
@@ -14598,6 +14598,15 @@ var harnessDisplaySetSchema = external_exports.strictObject({
14598
14598
  initializeOnly: external_exports.boolean().optional()
14599
14599
  });
14600
14600
 
14601
+ // ../../shared-contracts/dist/harness-presentation.js
14602
+ var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
14603
+ var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
14604
+ var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
14605
+ label: displayText(256).optional(),
14606
+ description: displayText(1024).optional()
14607
+ }).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
14608
+ var harnessLocalizedTextSchema = external_exports.record(localeSchema, displayText(4096)).refine((entries) => typeof entries.en === "string", "English fallback is required").refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
14609
+
14601
14610
  // ../../shared-contracts/dist/model-price-overrides.js
14602
14611
  var usdPerMillionTokens = external_exports.number().finite().nonnegative();
14603
14612
  var modelPriceOverrideSchema = external_exports.strictObject({
@@ -14647,10 +14656,19 @@ var model = external_exports.string().min(1).max(512);
14647
14656
  var project = external_exports.string().min(1).max(4096);
14648
14657
  var usageStatisticsParamsSchema = external_exports.strictObject({
14649
14658
  range: external_exports.enum(USAGE_STATISTICS_RANGES),
14659
+ /** Display timezone for ranges, dates and hourly buckets; omitted means the Host's local zone. */
14660
+ timeZone: external_exports.string().min(1).max(128).refine((value) => {
14661
+ try {
14662
+ new Intl.DateTimeFormat("en", { timeZone: value });
14663
+ return true;
14664
+ } catch {
14665
+ return false;
14666
+ }
14667
+ }, "Unsupported usage statistics timezone").optional(),
14650
14668
  harness: harness.optional(),
14651
14669
  model: model.nullable().optional(),
14652
14670
  project: project.nullable().optional(),
14653
- /** One local date inside the range. */
14671
+ /** One date in the query timezone inside the range. */
14654
14672
  date: localDate.optional()
14655
14673
  });
14656
14674
  var usageStatisticsTotalsSchema = external_exports.strictObject({
@@ -14686,7 +14704,7 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
14686
14704
  });
14687
14705
  var usageStatisticsResultSchema = external_exports.strictObject({
14688
14706
  range: external_exports.enum(USAGE_STATISTICS_RANGES),
14689
- /** First local date of the range; null for all time. */
14707
+ /** First date in the query timezone (Host local when omitted); null for all time. */
14690
14708
  from: localDate.nullable(),
14691
14709
  to: localDate,
14692
14710
  /** The filters these figures apply, echoed so a late answer to older filters is recognised. */
@@ -14726,7 +14744,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
14726
14744
  totals: usageStatisticsTotalsSchema,
14727
14745
  /** Each date and Harness of the range: every filter except the day. */
14728
14746
  daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
14729
- /** Local weekday (0 = Sunday) and hour, all filters applied. */
14747
+ /** Weekday (0 = Sunday) and hour in the query timezone, all filters applied. */
14730
14748
  hourly: external_exports.array(external_exports.strictObject({
14731
14749
  weekday: external_exports.number().int().min(0).max(6),
14732
14750
  hour: external_exports.number().int().min(0).max(23),
@@ -14786,6 +14804,8 @@ var CONSOLE_HOST_METHODS = Object.freeze([
14786
14804
  "codexhost/harness/display-settings/set",
14787
14805
  "codexhost/harness/inspect",
14788
14806
  "codexhost/harness/installation",
14807
+ "codexhost/harness/installation/start",
14808
+ "codexhost/harness/installation/status",
14789
14809
  "codexhost/harness/launch-settings/get",
14790
14810
  "codexhost/harness/launch-settings/set",
14791
14811
  "codexhost/harness/web-ui/open",
@@ -14861,7 +14881,18 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
14861
14881
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
14862
14882
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
14863
14883
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
14884
+ var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text2) => text2.length <= maximum));
14885
+ var composerIndicatorsSchema = external_exports.array(external_exports.object({
14886
+ kind: external_exports.literal("countdown"),
14887
+ id: external_exports.string().min(1).max(64),
14888
+ expiresAtUnix: nonNegativeSafeIntegerSchema,
14889
+ label: indicatorTextSchema(256).optional(),
14890
+ tooltip: indicatorTextSchema(1024).optional()
14891
+ }).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
14892
+ message: "Composer indicator IDs must be unique"
14893
+ });
14864
14894
  var threadUsageSnapshotSchema = external_exports.object({
14895
+ composerIndicators: composerIndicatorsSchema.optional(),
14865
14896
  inputTokens: nonNegativeSafeIntegerSchema.optional(),
14866
14897
  cachedInputTokens: nonNegativeSafeIntegerSchema.optional(),
14867
14898
  cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
@@ -14934,8 +14965,24 @@ var threadUsageSnapshotSchema = external_exports.object({
14934
14965
  }
14935
14966
  });
14936
14967
  var usagePercentSchema = external_exports.number().finite().min(0).max(100);
14968
+ var accountCreditsPeriodSchema = external_exports.enum([
14969
+ "weekly",
14970
+ "monthly",
14971
+ "five_hour",
14972
+ "seven_day",
14973
+ "unknown"
14974
+ ]);
14975
+ var accountCreditsScopeSchema = external_exports.object({
14976
+ id: external_exports.string().min(1).max(256),
14977
+ label: external_exports.string().min(1).max(256),
14978
+ localizations: harnessLocalizationsSchema.optional()
14979
+ }).strict();
14937
14980
  var accountCreditsProductUsageSchema = external_exports.object({
14938
14981
  product: external_exports.string().min(1),
14982
+ /** Native period and scope, never inferred from the display name. */
14983
+ periodType: accountCreditsPeriodSchema.optional(),
14984
+ scope: accountCreditsScopeSchema.optional(),
14985
+ localizations: harnessLocalizationsSchema.optional(),
14939
14986
  used: external_exports.number().finite().nonnegative().optional(),
14940
14987
  // Zero is a real empty cap, not an absent field.
14941
14988
  limit: external_exports.number().finite().nonnegative().optional(),
@@ -14955,9 +15002,11 @@ var accountCreditsSnapshotSchema = external_exports.object({
14955
15002
  unit: external_exports.string().min(1).max(32).optional(),
14956
15003
  /** Native label when the primary limit is scoped to a model or product group. */
14957
15004
  label: external_exports.string().min(1).optional(),
15005
+ scope: accountCreditsScopeSchema.optional(),
15006
+ localizations: harnessLocalizationsSchema.optional(),
14958
15007
  usedPercent: usagePercentSchema,
14959
15008
  resetsAt: external_exports.string().min(1).optional(),
14960
- periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
15009
+ periodType: accountCreditsPeriodSchema,
14961
15010
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
14962
15011
  resetCredits: accountResetCreditsSchema.optional()
14963
15012
  }).strict();
@@ -14968,7 +15017,9 @@ var threadUsageInspectionParamsSchema = external_exports.object({
14968
15017
  var threadUsageInspectionSchema = external_exports.object({
14969
15018
  threadId: hostThreadIdSchema,
14970
15019
  usage: threadUsageSnapshotSchema.nullable(),
14971
- accountCredits: accountCreditsSnapshotSchema.optional()
15020
+ accountCredits: accountCreditsSnapshotSchema.optional(),
15021
+ /** Whether this source can provide cached account quota independently of usage. */
15022
+ accountCreditsSupported: external_exports.boolean().optional()
14972
15023
  }).strict();
14973
15024
 
14974
15025
  // ../../shared-contracts/dist/harness-accounts.js
@@ -15095,7 +15146,8 @@ var harnessPermissionModeSchema = external_exports.object({
15095
15146
  id: harnessPermissionModeIdSchema,
15096
15147
  label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
15097
15148
  description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
15098
- dangerous: external_exports.boolean().optional()
15149
+ dangerous: external_exports.boolean().optional(),
15150
+ localizations: harnessLocalizationsSchema.optional()
15099
15151
  }).strict();
15100
15152
  var harnessPermissionModeCatalogSchema = external_exports.object({
15101
15153
  modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
@@ -15248,7 +15300,9 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
15248
15300
  }).strict().optional(),
15249
15301
  autonomousTurns: external_exports.object({
15250
15302
  observe: external_exports.boolean()
15251
- }).strict().optional()
15303
+ }).strict().optional(),
15304
+ /** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
15305
+ steer: external_exports.boolean().optional()
15252
15306
  }).strict();
15253
15307
  var harnessConfigurationStateSchema = external_exports.object({
15254
15308
  effectiveModel: harnessModelRefSchema.optional(),
@@ -15295,7 +15349,9 @@ var harnessInspectionSchema = external_exports.union([
15295
15349
  var harnessInspectParamsSchema = external_exports.object({
15296
15350
  harnessId: harnessIdSchema,
15297
15351
  cwd: nonBlankTextSchema2.max(16384).optional(),
15298
- refresh: external_exports.boolean().optional()
15352
+ refresh: external_exports.boolean().optional(),
15353
+ /** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
15354
+ purpose: external_exports.literal("availability").optional()
15299
15355
  }).strict();
15300
15356
  var harnessWebUiOpenParamsSchema = external_exports.object({
15301
15357
  harnessId: harnessIdSchema
@@ -15378,6 +15434,15 @@ var threadOwnershipListResultSchema = external_exports.object({
15378
15434
  seen.add(thread.threadId);
15379
15435
  }
15380
15436
  });
15437
+ var threadSteeringInspectParamsSchema = external_exports.object({
15438
+ threadId: hostThreadIdSchema,
15439
+ /** The text about to be steered; a Harness command always stops and restarts. */
15440
+ text: external_exports.string().optional()
15441
+ }).strict();
15442
+ var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
15443
+ var threadSteeringInspectResultSchema = external_exports.object({
15444
+ delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
15445
+ }).strict();
15381
15446
 
15382
15447
  // ../../shared-contracts/dist/harness-plugins.js
15383
15448
  var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
@@ -15479,11 +15544,31 @@ var harnessInstallationStateSchema = external_exports.object({
15479
15544
  latestVersion: external_exports.string().min(1).max(128),
15480
15545
  updateAvailable: external_exports.boolean(),
15481
15546
  canUpdate: external_exports.boolean(),
15547
+ /** Defaults to CLI; some Harnesses ship only inside a desktop application. */
15548
+ versionKind: external_exports.enum(["cli", "application"]).optional(),
15549
+ /** Official download opened by the user; does not imply an automatic installation. */
15550
+ manualUpdateUrl: external_exports.url().max(2048).refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Manual updates require a credential-free HTTPS URL").optional(),
15482
15551
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
15483
15552
  message: external_exports.string().max(2048).optional(),
15484
15553
  messageCode: external_exports.string().min(1).max(128).optional(),
15554
+ /** Safe plugin-owned explanation, distinct from raw diagnostic message. */
15555
+ notice: harnessLocalizedTextSchema.optional(),
15485
15556
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
15486
15557
  }).strict();
15558
+ var harnessInstallationTaskParamsSchema = external_exports.object({ taskId: external_exports.string().uuid() }).strict();
15559
+ var harnessInstallationTaskSchema = external_exports.discriminatedUnion("status", [
15560
+ external_exports.object({ taskId: external_exports.string().uuid(), status: external_exports.literal("running") }).strict(),
15561
+ external_exports.object({
15562
+ taskId: external_exports.string().uuid(),
15563
+ status: external_exports.literal("succeeded"),
15564
+ result: harnessInstallationStateSchema
15565
+ }).strict(),
15566
+ external_exports.object({
15567
+ taskId: external_exports.string().uuid(),
15568
+ status: external_exports.literal("failed"),
15569
+ error: external_exports.object({ code: external_exports.number().int(), message: external_exports.string().min(1).max(2048) }).strict()
15570
+ }).strict()
15571
+ ]);
15487
15572
 
15488
15573
  // ../../shared-contracts/dist/codex-accounts.js
15489
15574
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
@@ -15608,6 +15693,7 @@ var harnessCommandDescriptorSchema = external_exports.object({
15608
15693
  invocation: commandInvocationSchema,
15609
15694
  label: commandLabelSchema,
15610
15695
  description: commandDescriptionSchema.optional(),
15696
+ localizations: harnessLocalizationsSchema.optional(),
15611
15697
  argumentMode: external_exports.enum(["none", "text"]),
15612
15698
  /**
15613
15699
  * Native distinction reported by the Harness. Omitted when the Harness does
@@ -15871,6 +15957,13 @@ import { setImmediate as yieldToEventLoop } from "node:timers/promises";
15871
15957
  // ../../harness-adapter/dist/usage-statistics.js
15872
15958
  import { createReadStream } from "node:fs";
15873
15959
  import { createInterface } from "node:readline";
15960
+ var HarnessUsageSourceChangedError = class extends Error {
15961
+ code = "HARNESS_USAGE_SOURCE_CHANGED";
15962
+ /** Plugins may bundle their own copy of this contract, so instanceof is insufficient. */
15963
+ static is(error51) {
15964
+ return typeof error51 === "object" && error51 !== null && "code" in error51 && error51.code === "HARNESS_USAGE_SOURCE_CHANGED";
15965
+ }
15966
+ };
15874
15967
  var MAX_SESSION_ID_LENGTH = 512;
15875
15968
  var MAX_CWD_LENGTH = 4096;
15876
15969
  var MAX_SESSION_TITLE_LENGTH = 200;
@@ -15882,10 +15975,13 @@ function usageSessionTitle(value) {
15882
15975
  return void 0;
15883
15976
  if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
15884
15977
  return normalized;
15885
- const characters = [...normalized];
15886
- if (characters.length <= MAX_SESSION_TITLE_LENGTH)
15887
- return normalized;
15888
- return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
15978
+ let title = "";
15979
+ for (const character of normalized) {
15980
+ if (title.length + character.length >= MAX_SESSION_TITLE_LENGTH)
15981
+ break;
15982
+ title += character;
15983
+ }
15984
+ return `${title.trimEnd()}…`;
15889
15985
  }
15890
15986
  function sessionIdOk(value) {
15891
15987
  return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
@@ -16388,8 +16484,9 @@ var CodexCounters = class {
16388
16484
  // dist/rollout-io.js
16389
16485
  import { createReadStream as createReadStream2 } from "node:fs";
16390
16486
  import { StringDecoder } from "node:string_decoder";
16391
- import { promisify } from "node:util";
16392
- import { zstdDecompress } from "node:zlib";
16487
+ import { pipeline } from "node:stream/promises";
16488
+ import { Readable } from "node:stream";
16489
+ import { constants as zstdConstants, createZstdDecompress } from "node:zlib";
16393
16490
  /*!
16394
16491
  * Rollout reading: zstd frame walking, streaming copy-prefix comparison.
16395
16492
  *
@@ -16412,74 +16509,103 @@ import { zstdDecompress } from "node:zlib";
16412
16509
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
16413
16510
  * SOFTWARE.
16414
16511
  */
16415
- var decompress = promisify(zstdDecompress);
16416
- var MAX_FRAME = 64 * 1024 * 1024;
16417
16512
  var MAX_LINE = 128 * 1024 * 1024;
16418
- function frameSize(data) {
16419
- if (data.length < 8)
16420
- return null;
16421
- const magic = data.readUInt32LE(0);
16422
- if ((magic & 4294967280) === 407710288) {
16423
- const size = 8 + data.readUInt32LE(4);
16424
- if (size > MAX_FRAME)
16425
- throw new Error("Codex zstd frame exceeds the safety limit");
16426
- return data.length >= size ? { size, skip: true } : null;
16427
- }
16428
- if (magic !== 4247762216)
16429
- throw new Error("Invalid Codex zstd frame");
16430
- const descriptor = data.readUInt8(4);
16431
- if (descriptor & 8)
16432
- throw new Error("Reserved Codex zstd frame header");
16433
- const single = descriptor >> 5 & 1;
16434
- let offset = 5 + (single ? 0 : 1) + ([0, 1, 2, 4][descriptor & 3] ?? 0) + ([single, 2, 4, 8][descriptor >> 6] ?? 0);
16435
- for (; ; ) {
16436
- if (offset + 3 > data.length)
16437
- return null;
16438
- const block = data.readUIntLE(offset, 3);
16439
- const type = block >> 1 & 3;
16440
- if (type === 3)
16441
- throw new Error("Reserved Codex zstd block");
16442
- offset += 3 + (type === 1 ? 1 : block >>> 3);
16443
- if (offset > MAX_FRAME)
16444
- throw new Error("Codex zstd frame exceeds the safety limit");
16445
- if (block & 1)
16446
- break;
16447
- }
16448
- if (descriptor & 4)
16449
- offset += 4;
16450
- return data.length >= offset ? { size: offset, skip: false } : null;
16451
- }
16452
16513
  async function* rolloutBytes(file2, signal) {
16453
16514
  signal.throwIfAborted();
16454
16515
  const stream = createReadStream2(file2, { signal });
16455
- let pending = Buffer.alloc(0);
16456
16516
  try {
16457
- for await (const value of stream) {
16458
- signal.throwIfAborted();
16459
- const chunk = value;
16460
- if (!file2.endsWith(".zst")) {
16517
+ if (!file2.endsWith(".zst")) {
16518
+ for await (const chunk of stream) {
16519
+ signal.throwIfAborted();
16461
16520
  yield chunk;
16521
+ }
16522
+ return;
16523
+ }
16524
+ const input = stream[Symbol.asyncIterator]();
16525
+ let pending = Buffer.alloc(0);
16526
+ async function readExact(size, allowEof = false) {
16527
+ const parts = [];
16528
+ let length = 0;
16529
+ while (length < size) {
16530
+ signal.throwIfAborted();
16531
+ if (!pending.length) {
16532
+ const next = await input.next();
16533
+ if (next.done) {
16534
+ if (allowEof && !length)
16535
+ return Buffer.alloc(0);
16536
+ throw new Error("Truncated Codex zstd rollout");
16537
+ }
16538
+ pending = next.value;
16539
+ }
16540
+ const count2 = Math.min(size - length, pending.length);
16541
+ parts.push(pending.subarray(0, count2));
16542
+ pending = pending.subarray(count2);
16543
+ length += count2;
16544
+ }
16545
+ return Buffer.concat(parts, length);
16546
+ }
16547
+ for (; ; ) {
16548
+ const magicBytes = await readExact(4, true);
16549
+ if (!magicBytes.length)
16550
+ break;
16551
+ const magic = magicBytes.readUInt32LE(0);
16552
+ if ((magic & 4294967280) === 407710288) {
16553
+ let size = (await readExact(4)).readUInt32LE(0);
16554
+ while (size) {
16555
+ const count2 = Math.min(size, 64 * 1024);
16556
+ await readExact(count2);
16557
+ size -= count2;
16558
+ }
16462
16559
  continue;
16463
16560
  }
16464
- pending = Buffer.concat([pending, chunk]);
16465
- for (; ; ) {
16466
- const frame = frameSize(pending);
16467
- if (!frame)
16468
- break;
16469
- if (!frame.skip) {
16470
- const decoded = await decompress(pending.subarray(0, frame.size), {
16471
- maxOutputLength: 128 * 1024 * 1024
16472
- });
16561
+ if (magic !== 4247762216)
16562
+ throw new Error("Invalid Codex zstd frame");
16563
+ const descriptorBytes = await readExact(1);
16564
+ const descriptor = descriptorBytes.readUInt8(0);
16565
+ if (descriptor & 8)
16566
+ throw new Error("Reserved Codex zstd frame header");
16567
+ const single = descriptor >> 5 & 1;
16568
+ const headerSize = (single ? 0 : 1) + ([0, 1, 2, 4][descriptor & 3] ?? 0) + ([single, 2, 4, 8][descriptor >> 6] ?? 0);
16569
+ const header = Buffer.concat([magicBytes, descriptorBytes, await readExact(headerSize)]);
16570
+ async function* frameChunks() {
16571
+ yield header;
16572
+ for (; ; ) {
16573
+ const blockBytes = await readExact(3);
16574
+ const block = blockBytes.readUIntLE(0, 3);
16575
+ const type = block >> 1 & 3;
16576
+ if (type === 3)
16577
+ throw new Error("Reserved Codex zstd block");
16578
+ const blockSize = block >>> 3;
16579
+ if (blockSize > 128 * 1024)
16580
+ throw new Error("Invalid Codex zstd block size");
16581
+ yield blockBytes;
16582
+ yield await readExact(type === 1 ? 1 : blockSize);
16583
+ if (block & 1)
16584
+ break;
16585
+ }
16586
+ if (descriptor & 4)
16587
+ yield await readExact(4);
16588
+ }
16589
+ const frame = Readable.from(frameChunks(), { objectMode: false });
16590
+ const decoder = createZstdDecompress({
16591
+ chunkSize: 64 * 1024,
16592
+ params: { [zstdConstants.ZSTD_d_windowLogMax]: 27 }
16593
+ });
16594
+ const completed = pipeline(frame, decoder, { signal }).then(() => null, (error51) => error51);
16595
+ try {
16596
+ for await (const chunk of decoder) {
16473
16597
  signal.throwIfAborted();
16474
- yield decoded;
16598
+ yield chunk;
16475
16599
  }
16476
- pending = pending.subarray(frame.size);
16600
+ const error51 = await completed;
16601
+ if (error51)
16602
+ throw error51;
16603
+ } finally {
16604
+ frame.destroy();
16605
+ decoder.destroy();
16606
+ await completed;
16477
16607
  }
16478
- if (pending.length > MAX_FRAME)
16479
- throw new Error("Codex zstd frame exceeds the safety limit");
16480
16608
  }
16481
- if (pending.length)
16482
- throw new Error("Truncated Codex zstd rollout");
16483
16609
  } finally {
16484
16610
  stream.destroy();
16485
16611
  }
@@ -16553,12 +16679,17 @@ var ROW_KINDS = /* @__PURE__ */ new Set([
16553
16679
  ]);
16554
16680
  var HEAD_TYPE = /"type"\s*:\s*"([^"]+)"/u;
16555
16681
  var TAIL_TYPE = /"type"\s*:\s*"([^"]+)"\s*\}\s*$/u;
16682
+ var USER_ROLE = /"role"\s*:\s*"user"/u;
16683
+ var EVENT_OF_INTEREST = /"type"\s*:\s*"(?:token_count|task_started|thread_settings_applied|user_message)"/u;
16556
16684
  function rowKind(line) {
16557
16685
  const head = HEAD_TYPE.exec(line.slice(0, 1024))?.[1];
16558
16686
  if (head && ROW_KINDS.has(head))
16559
16687
  return head;
16560
16688
  return TAIL_TYPE.exec(line.slice(-1024))?.[1] ?? head;
16561
16689
  }
16690
+ function markerIn(pattern, line) {
16691
+ return pattern.test(line.slice(0, 1024)) || pattern.test(line.slice(-1024));
16692
+ }
16562
16693
  async function stamp(file2) {
16563
16694
  const s = await lstat(file2, { bigint: true });
16564
16695
  if (!s.isFile())
@@ -16622,9 +16753,9 @@ async function readCodexRollouts(files, thread, signal, options = {}) {
16622
16753
  options.onIncomplete?.();
16623
16754
  if (!kind || !ROW_KINDS.has(kind))
16624
16755
  continue;
16625
- if (kind === "response_item" && !/"role"\s*:\s*"user"/u.test(line.slice(0, 1024)))
16756
+ if (kind === "response_item" && !markerIn(USER_ROLE, line))
16626
16757
  continue;
16627
- if (kind === "event_msg" && !/"type"\s*:\s*"(?:token_count|task_started|thread_settings_applied|user_message)"/u.test(line.slice(0, 1024)))
16758
+ if (kind === "event_msg" && !markerIn(EVENT_OF_INTEREST, line))
16628
16759
  continue;
16629
16760
  let row;
16630
16761
  try {
@@ -16675,8 +16806,10 @@ async function readCodexRollouts(files, thread, signal, options = {}) {
16675
16806
  break;
16676
16807
  }
16677
16808
  case "response_item":
16678
- counters.boundary();
16679
- firstPrompt ??= userItemPrompt(p);
16809
+ if (p.type === "message" && p.role === "user") {
16810
+ counters.boundary();
16811
+ firstPrompt ??= userItemPrompt(p);
16812
+ }
16680
16813
  break;
16681
16814
  case "event_msg":
16682
16815
  if (p.type === "task_started") {
@@ -16806,7 +16939,7 @@ function createCodexUsageStatistics(environment, options = {}) {
16806
16939
  const entries = await readCodexRollouts(kept.map(({ file: file2 }) => file2), group.thread, signal, options);
16807
16940
  for (const file2 of group.files)
16808
16941
  if (await stamp(file2.file) !== file2.fingerprint)
16809
- throw new Error("Codex rollout changed while reading; refresh to retry");
16942
+ throw new HarnessUsageSourceChangedError("Codex rollout changed while reading; refresh to retry");
16810
16943
  const named = options.sessionId ? void 0 : (await threadNames(signal)).get(group.thread);
16811
16944
  return named ? entries.map((entry) => withUsageSession(entry, {
16812
16945
  sessionId: entry.sessionId,
@@ -16847,6 +16980,7 @@ var usageFields = /* @__PURE__ */ new Set([
16847
16980
  ...safeIntegerFields,
16848
16981
  ...percentFields,
16849
16982
  "sessionCacheUsage",
16983
+ "composerIndicators",
16850
16984
  "totalCostUsd",
16851
16985
  "totalCredits",
16852
16986
  "contextUsagePercent",
@@ -16869,6 +17003,7 @@ function parseHostUsage(value) {
16869
17003
  throw new Error(`Harness Usage contains unknown field '${key2}'`);
16870
17004
  }
16871
17005
  }
17006
+ const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
16872
17007
  for (const field of [
16873
17008
  "totalCredits",
16874
17009
  "contextUsagePercent",
@@ -16939,9 +17074,9 @@ function parseHostUsage(value) {
16939
17074
  if (value.costSource !== "publicPrice") {
16940
17075
  throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
16941
17076
  }
16942
- return { ...value, unpricedModels: [...models] };
17077
+ return { ...value, ...indicators, unpricedModels: [...models] };
16943
17078
  }
16944
- return { ...value };
17079
+ return { ...value, ...indicators };
16945
17080
  }
16946
17081
  var requestTokenFields = [
16947
17082
  "inputTokens",
@@ -0,0 +1,26 @@
1
+ {
2
+ "manifestVersion": 1,
3
+ "id": "copilot",
4
+ "name": "GitHub Copilot",
5
+ "version": "0.0.0",
6
+ "installation": {
7
+ "commands": [
8
+ {
9
+ "terminal": "npm · macOS / Linux / Windows",
10
+ "command": "npm install -g @github/copilot"
11
+ }
12
+ ],
13
+ "after": {
14
+ "en": "Run copilot; use /login only if authentication is unavailable. Existing native authentication on the target Host can be reused. CODEXHOST_COPILOT_COMMAND selects an existing CLI installation. Windows npm launchers resolve to that installation's actual JavaScript or executable entrypoint; arbitrary shell wrappers are not supported.",
15
+ "zh-CN": "运行 copilot;若缺少认证,再使用 /login。可复用目标 Host 已有的原生登录;CODEXHOST_COPILOT_COMMAND 可指定已有 CLI 安装。Windows npm 启动器会解析到同一安装的实际 JavaScript 或可执行入口,不支持任意 shell 包装脚本。"
16
+ }
17
+ },
18
+ "links": {
19
+ "website": "https://github.com/features/copilot",
20
+ "documentation": "https://docs.github.com/en/copilot/get-started/cli-quickstart",
21
+ "installation": "https://docs.github.com/en/copilot/how-tos/copilot-cli/set-up-copilot-cli/install-copilot-cli"
22
+ },
23
+ "adapterApiVersion": 1,
24
+ "entry": "plugin.mjs",
25
+ "icon": "./assets/icon.png"
26
+ }