@codexhost/cli-win32-arm64 0.14.0 → 0.15.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.
@@ -3516,10 +3516,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3516
3516
  const shape = def.shape;
3517
3517
  const propValues = {};
3518
3518
  for (const key in shape) {
3519
- const field = shape[key]._zod;
3520
- if (field.values) {
3519
+ const field2 = shape[key]._zod;
3520
+ if (field2.values) {
3521
3521
  propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
3522
- for (const v of field.values)
3522
+ for (const v of field2.values)
3523
3523
  propValues[key].add(v);
3524
3524
  }
3525
3525
  }
@@ -15266,6 +15266,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
15266
15266
  var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
15267
15267
  var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
15268
15268
 
15269
+ // ../../shared-contracts/dist/thread-questions.js
15270
+ var field = external_exports.discriminatedUnion("type", [
15271
+ external_exports.object({
15272
+ id: external_exports.string().min(1),
15273
+ type: external_exports.literal("choice"),
15274
+ prompt: external_exports.string(),
15275
+ options: external_exports.array(external_exports.object({
15276
+ value: external_exports.string().min(1),
15277
+ label: external_exports.string(),
15278
+ description: external_exports.string().optional()
15279
+ })).min(1),
15280
+ multiple: external_exports.boolean(),
15281
+ allowOther: external_exports.boolean(),
15282
+ optional: external_exports.boolean()
15283
+ }),
15284
+ external_exports.object({
15285
+ id: external_exports.string().min(1),
15286
+ type: external_exports.literal("text"),
15287
+ prompt: external_exports.string(),
15288
+ multiline: external_exports.boolean(),
15289
+ secret: external_exports.literal(false),
15290
+ optional: external_exports.boolean(),
15291
+ placeholder: external_exports.string().optional(),
15292
+ prefill: external_exports.string().optional()
15293
+ })
15294
+ ]);
15295
+ var threadQuestionSchema = external_exports.object({
15296
+ interactionId: external_exports.string().min(1),
15297
+ turnId: external_exports.string().min(1),
15298
+ title: external_exports.string().optional(),
15299
+ questions: external_exports.array(field).min(1)
15300
+ }).refine(({ questions }) => questions.some((q) => q.type === "choice" && q.multiple), {
15301
+ message: "Shared cards require at least one multi-select question"
15302
+ });
15303
+ var threadQuestionsListParamsSchema = external_exports.strictObject({ threadId: external_exports.string().min(1) });
15304
+ var threadQuestionsResultSchema = external_exports.object({ questions: external_exports.array(threadQuestionSchema) });
15305
+ var threadQuestionRespondParamsSchema = external_exports.strictObject({
15306
+ threadId: external_exports.string().min(1),
15307
+ turnId: external_exports.string().min(1),
15308
+ interactionId: external_exports.string().min(1),
15309
+ answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
15310
+ cancelled: external_exports.boolean().default(false)
15311
+ });
15312
+ var threadQuestionRespondResultSchema = external_exports.object({ accepted: external_exports.literal(true) });
15313
+
15269
15314
  // ../../shared-contracts/dist/console.js
15270
15315
  var consoleAnnouncementSchema = external_exports.strictObject({
15271
15316
  title: external_exports.string().trim().min(1).max(200),
@@ -16616,26 +16661,26 @@ function parseHostUsage(value) {
16616
16661
  }
16617
16662
  }
16618
16663
  const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
16619
- for (const field of [
16664
+ for (const field2 of [
16620
16665
  "totalCredits",
16621
16666
  "contextUsagePercent",
16622
16667
  "apiOutputTokensPerSecond"
16623
16668
  ]) {
16624
- const candidate = value[field];
16669
+ const candidate = value[field2];
16625
16670
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
16626
- throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
16671
+ throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
16627
16672
  }
16628
16673
  }
16629
- for (const field of tokenFields) {
16630
- const candidate = value[field];
16674
+ for (const field2 of tokenFields) {
16675
+ const candidate = value[field2];
16631
16676
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
16632
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
16677
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
16633
16678
  }
16634
16679
  }
16635
- for (const field of safeIntegerFields) {
16636
- const candidate = value[field];
16680
+ for (const field2 of safeIntegerFields) {
16681
+ const candidate = value[field2];
16637
16682
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
16638
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
16683
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
16639
16684
  }
16640
16685
  }
16641
16686
  if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
@@ -16644,10 +16689,10 @@ function parseHostUsage(value) {
16644
16689
  if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
16645
16690
  throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
16646
16691
  }
16647
- for (const field of percentFields) {
16648
- const candidate = value[field];
16692
+ for (const field2 of percentFields) {
16693
+ const candidate = value[field2];
16649
16694
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
16650
- throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
16695
+ throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
16651
16696
  }
16652
16697
  }
16653
16698
  if (value.sessionCacheUsage !== void 0) {
@@ -16718,19 +16763,19 @@ function parseHostUsageRequest(value) {
16718
16763
  if (typeof value.requestId !== "string" || value.requestId.length === 0) {
16719
16764
  throw new Error("Harness Usage request 'requestId' must be a non-empty string");
16720
16765
  }
16721
- for (const field of ["model", "provider"]) {
16722
- const candidate = value[field];
16766
+ for (const field2 of ["model", "provider"]) {
16767
+ const candidate = value[field2];
16723
16768
  if (candidate !== void 0 && (typeof candidate !== "string" || candidate.length === 0)) {
16724
- throw new Error(`Harness Usage request '${field}' must be a non-empty string`);
16769
+ throw new Error(`Harness Usage request '${field2}' must be a non-empty string`);
16725
16770
  }
16726
16771
  }
16727
16772
  if (value.historical !== void 0 && typeof value.historical !== "boolean") {
16728
16773
  throw new Error("Harness Usage request 'historical' must be a boolean");
16729
16774
  }
16730
- for (const field of requestTokenFields) {
16731
- const candidate = value[field];
16775
+ for (const field2 of requestTokenFields) {
16776
+ const candidate = value[field2];
16732
16777
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
16733
- throw new Error(`Harness Usage request '${field}' must be a non-negative safe integer`);
16778
+ throw new Error(`Harness Usage request '${field2}' must be a non-negative safe integer`);
16734
16779
  }
16735
16780
  }
16736
16781
  if (value.inputTokens === void 0 || value.outputTokens === void 0) {
@@ -25264,6 +25309,7 @@ var HARNESS_BROKER_PROTOCOL_VERSION = 1;
25264
25309
  var HARNESS_BROKER_MAX_FRAME_BYTES = 8 * 1024 * 1024;
25265
25310
  var HARNESS_BROKER_MAX_PENDING_REQUESTS = 32;
25266
25311
  var HARNESS_BROKER_REQUEST_TIMEOUT_MS = 15e3;
25312
+ var HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE = 100;
25267
25313
  var HARNESS_BROKER_IDLE_TIMEOUT_MS = 60 * 60 * 1e3;
25268
25314
  var HARNESS_BROKER_RETIRING_ERROR_CODE = "brokerRetiring";
25269
25315
  var harnessBrokerMethodSchema = external_exports.enum([
@@ -25271,6 +25317,8 @@ var harnessBrokerMethodSchema = external_exports.enum([
25271
25317
  "adapter.inspectAccount",
25272
25318
  "adapter.credits",
25273
25319
  "adapter.open",
25320
+ "adapter.sessionImport.list",
25321
+ "adapter.sessionImport.resolve",
25274
25322
  "adapter.subagent.readSnapshot",
25275
25323
  "session.readSnapshot",
25276
25324
  "session.readCapabilities",
@@ -25373,30 +25421,6 @@ function consumeBrokerFrames(socket, onFrame, onError) {
25373
25421
  });
25374
25422
  }
25375
25423
 
25376
- // ../../harness-broker/dist/paths.js
25377
- import os2 from "node:os";
25378
- import path11 from "node:path";
25379
- var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
25380
- var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
25381
- function defaultHarnessBrokerDirectory(environment = process.env) {
25382
- const home = environment.HOME || os2.homedir();
25383
- return path11.join(home, ".codexhost", "harness-broker");
25384
- }
25385
- function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
25386
- harnessPluginIdSchema.parse(harnessId);
25387
- if (harnessId !== "claude-code")
25388
- return path11.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
25389
- return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path11.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
25390
- }
25391
- function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
25392
- harnessPluginIdSchema.parse(harnessId);
25393
- return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
25394
- }
25395
- function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
25396
- const home = environment.HOME || os2.homedir();
25397
- return path11.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
25398
- }
25399
-
25400
25424
  // ../../harness-broker/dist/validation.js
25401
25425
  var cwdSchema = external_exports.string().min(1).max(16384);
25402
25426
  var brokerEnvironmentSchema = external_exports.object({
@@ -25447,7 +25471,31 @@ var brokerOpenInputSchema = external_exports.discriminatedUnion("kind", [
25447
25471
  forkSchema,
25448
25472
  rollbackSchema
25449
25473
  ]);
25450
- var brokerInspectInputSchema = external_exports.object({ cwd: cwdSchema.optional(), refresh: external_exports.boolean().optional() }).strict();
25474
+ var brokerInspectInputSchema = external_exports.object({
25475
+ cwd: cwdSchema.optional(),
25476
+ refresh: external_exports.boolean().optional(),
25477
+ purpose: external_exports.literal("availability").optional()
25478
+ }).strict();
25479
+ var brokerSessionImportListParamsSchema = external_exports.object({
25480
+ offset: external_exports.number().int().nonnegative().safe(),
25481
+ limit: external_exports.number().int().min(1).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE)
25482
+ }).strict();
25483
+ var brokerSessionImportResolveParamsSchema = external_exports.object({ nativeSessionId: harnessSessionImportIdSchema }).strict();
25484
+ var brokerSessionImportPageSchema = external_exports.object({
25485
+ candidates: external_exports.array(harnessSessionImportCandidateSchema).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE),
25486
+ total: external_exports.number().int().nonnegative().safe()
25487
+ }).strict();
25488
+ var brokerSessionImportSourceSchema = external_exports.object({
25489
+ candidate: harnessSessionImportCandidateSchema,
25490
+ nativeRef: nativeSessionRefSchema
25491
+ }).strict().superRefine((source, context) => {
25492
+ if (source.nativeRef.nativeSessionId !== source.candidate.nativeSessionId) {
25493
+ context.addIssue({
25494
+ code: "custom",
25495
+ message: "Session import source identity does not match"
25496
+ });
25497
+ }
25498
+ });
25451
25499
  var textInputSchema = external_exports.object({ type: external_exports.literal("text"), text: external_exports.string().max(4e6) }).strict();
25452
25500
  var turnStartSchema = external_exports.object({
25453
25501
  type: external_exports.literal("turn.start"),
@@ -25618,6 +25666,107 @@ var harnessOutputSchema = external_exports.custom((value) => {
25618
25666
  return false;
25619
25667
  });
25620
25668
 
25669
+ // ../../harness-broker/dist/session-import-client.js
25670
+ function createBrokerSessionImportCapability(input) {
25671
+ let listing = null;
25672
+ const closed = () => ({
25673
+ ok: false,
25674
+ error: { code: "invalidState", message: "Harness broker adapter is closed", retryable: false }
25675
+ });
25676
+ const invalid = () => ({
25677
+ ok: false,
25678
+ error: {
25679
+ code: "protocolError",
25680
+ message: "Harness broker returned invalid Session import metadata",
25681
+ retryable: false
25682
+ }
25683
+ });
25684
+ const list = async () => {
25685
+ try {
25686
+ const candidates = [];
25687
+ const identities = /* @__PURE__ */ new Set();
25688
+ let total;
25689
+ for (; ; ) {
25690
+ if (input.isClosed())
25691
+ return closed();
25692
+ const result = await input.request("adapter.sessionImport.list", {
25693
+ offset: candidates.length,
25694
+ limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
25695
+ });
25696
+ if (input.isClosed())
25697
+ return closed();
25698
+ if (!result.ok)
25699
+ return result;
25700
+ const page = brokerSessionImportPageSchema.safeParse(result.value);
25701
+ if (!page.success || total !== void 0 && total !== page.data.total || page.data.total < candidates.length + page.data.candidates.length || page.data.candidates.length === 0 && candidates.length < page.data.total)
25702
+ return invalid();
25703
+ total = page.data.total;
25704
+ for (const candidate of page.data.candidates) {
25705
+ if (identities.has(candidate.nativeSessionId))
25706
+ return invalid();
25707
+ identities.add(candidate.nativeSessionId);
25708
+ candidates.push(candidate);
25709
+ }
25710
+ if (candidates.length === total)
25711
+ return { ok: true, value: candidates };
25712
+ }
25713
+ } catch (error51) {
25714
+ return { ok: false, error: input.error(error51) };
25715
+ }
25716
+ };
25717
+ return {
25718
+ listCandidates() {
25719
+ if (input.isClosed())
25720
+ return Promise.resolve(closed());
25721
+ listing ??= list().finally(() => {
25722
+ listing = null;
25723
+ });
25724
+ return listing;
25725
+ },
25726
+ async resolveCandidate(nativeSessionId) {
25727
+ if (input.isClosed())
25728
+ return closed();
25729
+ try {
25730
+ const result = await input.request("adapter.sessionImport.resolve", { nativeSessionId });
25731
+ if (input.isClosed())
25732
+ return closed();
25733
+ if (!result.ok)
25734
+ return result;
25735
+ const source = brokerSessionImportSourceSchema.safeParse(result.value);
25736
+ if (!source.success || source.data.nativeRef.harnessId !== input.harnessId || source.data.candidate.nativeSessionId !== nativeSessionId)
25737
+ return invalid();
25738
+ return { ok: true, value: source.data };
25739
+ } catch (error51) {
25740
+ return { ok: false, error: input.error(error51) };
25741
+ }
25742
+ }
25743
+ };
25744
+ }
25745
+
25746
+ // ../../harness-broker/dist/paths.js
25747
+ import os2 from "node:os";
25748
+ import path11 from "node:path";
25749
+ var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
25750
+ var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
25751
+ function defaultHarnessBrokerDirectory(environment = process.env) {
25752
+ const home = environment.HOME || os2.homedir();
25753
+ return path11.join(home, ".codexhost", "harness-broker");
25754
+ }
25755
+ function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
25756
+ harnessPluginIdSchema.parse(harnessId);
25757
+ if (harnessId !== "claude-code")
25758
+ return path11.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
25759
+ return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path11.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
25760
+ }
25761
+ function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
25762
+ harnessPluginIdSchema.parse(harnessId);
25763
+ return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
25764
+ }
25765
+ function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
25766
+ const home = environment.HOME || os2.homedir();
25767
+ return path11.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
25768
+ }
25769
+
25621
25770
  // ../../harness-broker/dist/client.js
25622
25771
  function unavailable(message, retryable = true) {
25623
25772
  return { code: "unavailable", message, retryable, stage: "harnessBroker" };
@@ -26154,6 +26303,7 @@ var BrokeredHarnessAdapter = class {
26154
26303
  commandCatalog;
26155
26304
  liveCommandCatalog;
26156
26305
  harnessId;
26306
+ sessionImport;
26157
26307
  credits;
26158
26308
  refreshCredits;
26159
26309
  #descriptorPath;
@@ -26176,6 +26326,14 @@ var BrokeredHarnessAdapter = class {
26176
26326
  };
26177
26327
  constructor(input = {}) {
26178
26328
  this.harnessId = harnessPluginIdSchema.parse(input.harnessId ?? "claude-code");
26329
+ if (input.sessionImport) {
26330
+ this.sessionImport = createBrokerSessionImportCapability({
26331
+ harnessId: this.harnessId,
26332
+ request: async (method, params) => parseHarnessResult(await this.#request(method, params, method === "adapter.sessionImport.resolve")),
26333
+ isClosed: () => this.#closed,
26334
+ error: (error51) => this.#error(error51)
26335
+ });
26336
+ }
26179
26337
  if (input.accountCredits !== false) {
26180
26338
  this.credits = () => this.#credits;
26181
26339
  this.refreshCredits = () => this.#refreshAccountCredits();
@@ -26363,6 +26521,7 @@ function createHarnessAdapter(context) {
26363
26521
  if (context.platform === "darwin" && context.managedRemoteHost) {
26364
26522
  const environment2 = { ...context.environment };
26365
26523
  return new BrokeredHarnessAdapter({
26524
+ sessionImport: true,
26366
26525
  accountCredits: false,
26367
26526
  harnessId: "codebuddy",
26368
26527
  forwardDelegationEnvironment: true,
@@ -3034,10 +3034,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3034
3034
  const shape = def.shape;
3035
3035
  const propValues = {};
3036
3036
  for (const key2 in shape) {
3037
- const field = shape[key2]._zod;
3038
- if (field.values) {
3037
+ const field2 = shape[key2]._zod;
3038
+ if (field2.values) {
3039
3039
  propValues[key2] ?? (propValues[key2] = /* @__PURE__ */ new Set());
3040
- for (const v of field.values)
3040
+ for (const v of field2.values)
3041
3041
  propValues[key2].add(v);
3042
3042
  }
3043
3043
  }
@@ -14784,6 +14784,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
14784
14784
  var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
14785
14785
  var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
14786
14786
 
14787
+ // ../../shared-contracts/dist/thread-questions.js
14788
+ var field = external_exports.discriminatedUnion("type", [
14789
+ external_exports.object({
14790
+ id: external_exports.string().min(1),
14791
+ type: external_exports.literal("choice"),
14792
+ prompt: external_exports.string(),
14793
+ options: external_exports.array(external_exports.object({
14794
+ value: external_exports.string().min(1),
14795
+ label: external_exports.string(),
14796
+ description: external_exports.string().optional()
14797
+ })).min(1),
14798
+ multiple: external_exports.boolean(),
14799
+ allowOther: external_exports.boolean(),
14800
+ optional: external_exports.boolean()
14801
+ }),
14802
+ external_exports.object({
14803
+ id: external_exports.string().min(1),
14804
+ type: external_exports.literal("text"),
14805
+ prompt: external_exports.string(),
14806
+ multiline: external_exports.boolean(),
14807
+ secret: external_exports.literal(false),
14808
+ optional: external_exports.boolean(),
14809
+ placeholder: external_exports.string().optional(),
14810
+ prefill: external_exports.string().optional()
14811
+ })
14812
+ ]);
14813
+ var threadQuestionSchema = external_exports.object({
14814
+ interactionId: external_exports.string().min(1),
14815
+ turnId: external_exports.string().min(1),
14816
+ title: external_exports.string().optional(),
14817
+ questions: external_exports.array(field).min(1)
14818
+ }).refine(({ questions }) => questions.some((q) => q.type === "choice" && q.multiple), {
14819
+ message: "Shared cards require at least one multi-select question"
14820
+ });
14821
+ var threadQuestionsListParamsSchema = external_exports.strictObject({ threadId: external_exports.string().min(1) });
14822
+ var threadQuestionsResultSchema = external_exports.object({ questions: external_exports.array(threadQuestionSchema) });
14823
+ var threadQuestionRespondParamsSchema = external_exports.strictObject({
14824
+ threadId: external_exports.string().min(1),
14825
+ turnId: external_exports.string().min(1),
14826
+ interactionId: external_exports.string().min(1),
14827
+ answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
14828
+ cancelled: external_exports.boolean().default(false)
14829
+ });
14830
+ var threadQuestionRespondResultSchema = external_exports.object({ accepted: external_exports.literal(true) });
14831
+
14787
14832
  // ../../shared-contracts/dist/console.js
14788
14833
  var consoleAnnouncementSchema = external_exports.strictObject({
14789
14834
  title: external_exports.string().trim().min(1).max(200),
@@ -16018,13 +16063,13 @@ function parseHarnessUsageEntry(value) {
16018
16063
  }
16019
16064
  if (!tokenCount(entry.inputTokens) || !tokenCount(entry.outputTokens))
16020
16065
  return null;
16021
- for (const field of [
16066
+ for (const field2 of [
16022
16067
  "cachedInputTokens",
16023
16068
  "cacheWriteInputTokens",
16024
16069
  "cacheWrite1hInputTokens",
16025
16070
  "reasoningOutputTokens"
16026
16071
  ]) {
16027
- if (entry[field] !== void 0 && !tokenCount(entry[field]))
16072
+ if (entry[field2] !== void 0 && !tokenCount(entry[field2]))
16028
16073
  return null;
16029
16074
  }
16030
16075
  const cached2 = entry.cachedInputTokens ?? 0;
@@ -16118,8 +16163,8 @@ function usage(value) {
16118
16163
  if (!row)
16119
16164
  return null;
16120
16165
  const result = { values: [], known: 0 };
16121
- for (const [i, field] of fields.entries()) {
16122
- const n = row[field];
16166
+ for (const [i, field2] of fields.entries()) {
16167
+ const n = row[field2];
16123
16168
  if (n !== void 0 && n !== null) {
16124
16169
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 0)
16125
16170
  return null;
@@ -17004,26 +17049,26 @@ function parseHostUsage(value) {
17004
17049
  }
17005
17050
  }
17006
17051
  const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
17007
- for (const field of [
17052
+ for (const field2 of [
17008
17053
  "totalCredits",
17009
17054
  "contextUsagePercent",
17010
17055
  "apiOutputTokensPerSecond"
17011
17056
  ]) {
17012
- const candidate = value[field];
17057
+ const candidate = value[field2];
17013
17058
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
17014
- throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
17059
+ throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
17015
17060
  }
17016
17061
  }
17017
- for (const field of tokenFields) {
17018
- const candidate = value[field];
17062
+ for (const field2 of tokenFields) {
17063
+ const candidate = value[field2];
17019
17064
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
17020
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
17065
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
17021
17066
  }
17022
17067
  }
17023
- for (const field of safeIntegerFields) {
17024
- const candidate = value[field];
17068
+ for (const field2 of safeIntegerFields) {
17069
+ const candidate = value[field2];
17025
17070
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
17026
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
17071
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
17027
17072
  }
17028
17073
  }
17029
17074
  if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
@@ -17032,10 +17077,10 @@ function parseHostUsage(value) {
17032
17077
  if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
17033
17078
  throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
17034
17079
  }
17035
- for (const field of percentFields) {
17036
- const candidate = value[field];
17080
+ for (const field2 of percentFields) {
17081
+ const candidate = value[field2];
17037
17082
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
17038
- throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
17083
+ throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
17039
17084
  }
17040
17085
  }
17041
17086
  if (value.sessionCacheUsage !== void 0) {
@@ -17106,19 +17151,19 @@ function parseHostUsageRequest(value) {
17106
17151
  if (typeof value.requestId !== "string" || value.requestId.length === 0) {
17107
17152
  throw new Error("Harness Usage request 'requestId' must be a non-empty string");
17108
17153
  }
17109
- for (const field of ["model", "provider"]) {
17110
- const candidate = value[field];
17154
+ for (const field2 of ["model", "provider"]) {
17155
+ const candidate = value[field2];
17111
17156
  if (candidate !== void 0 && (typeof candidate !== "string" || candidate.length === 0)) {
17112
- throw new Error(`Harness Usage request '${field}' must be a non-empty string`);
17157
+ throw new Error(`Harness Usage request '${field2}' must be a non-empty string`);
17113
17158
  }
17114
17159
  }
17115
17160
  if (value.historical !== void 0 && typeof value.historical !== "boolean") {
17116
17161
  throw new Error("Harness Usage request 'historical' must be a boolean");
17117
17162
  }
17118
- for (const field of requestTokenFields) {
17119
- const candidate = value[field];
17163
+ for (const field2 of requestTokenFields) {
17164
+ const candidate = value[field2];
17120
17165
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
17121
- throw new Error(`Harness Usage request '${field}' must be a non-negative safe integer`);
17166
+ throw new Error(`Harness Usage request '${field2}' must be a non-negative safe integer`);
17122
17167
  }
17123
17168
  }
17124
17169
  if (value.inputTokens === void 0 || value.outputTokens === void 0) {
@@ -17152,7 +17197,7 @@ function tokenSnapshot(value) {
17152
17197
  const total = object2(token.total);
17153
17198
  const last = object2(token.last);
17154
17199
  const result = {};
17155
- for (const field of [
17200
+ for (const field2 of [
17156
17201
  "totalTokens",
17157
17202
  "inputTokens",
17158
17203
  "cachedInputTokens",
@@ -17160,9 +17205,9 @@ function tokenSnapshot(value) {
17160
17205
  "outputTokens",
17161
17206
  "reasoningOutputTokens"
17162
17207
  ]) {
17163
- const n = integer2(total?.[field]);
17208
+ const n = integer2(total?.[field2]);
17164
17209
  if (n !== void 0)
17165
- result[field] = n;
17210
+ result[field2] = n;
17166
17211
  }
17167
17212
  const used = integer2(last?.totalTokens);
17168
17213
  const window = integer2(token.modelContextWindow);