@karlorz/codexhost-cli-win32-x64 0.14.0-3 → 0.14.0-5

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.
@@ -3580,10 +3580,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3580
3580
  const shape = def.shape;
3581
3581
  const propValues = {};
3582
3582
  for (const key in shape) {
3583
- const field = shape[key]._zod;
3584
- if (field.values) {
3583
+ const field2 = shape[key]._zod;
3584
+ if (field2.values) {
3585
3585
  propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
3586
- for (const v of field.values)
3586
+ for (const v of field2.values)
3587
3587
  propValues[key].add(v);
3588
3588
  }
3589
3589
  }
@@ -15410,6 +15410,62 @@ var CONSOLE_HOST_METHODS = Object.freeze([
15410
15410
  // ../../shared-contracts/dist/version.js
15411
15411
  var WORKSPACE_CONTRACT_VERSION = 1;
15412
15412
 
15413
+ // ../../shared-contracts/dist/thread-questions.js
15414
+ var threadQuestionsParamsSchema = external_exports.strictObject({ threadId: hostThreadIdSchema });
15415
+ var field = { id: external_exports.string().min(1), prompt: external_exports.string(), optional: external_exports.boolean() };
15416
+ var questionAutoResolutionSchema = external_exports.strictObject({
15417
+ deadlineUnixMs: external_exports.number().int().min(0).max(864e13),
15418
+ action: external_exports.enum(["recommended", "decline"]),
15419
+ resetOnActivity: external_exports.boolean().optional()
15420
+ });
15421
+ var threadQuestionSchema = external_exports.strictObject({
15422
+ interactionId: hostInteractionIdSchema,
15423
+ turnId: hostTurnIdSchema,
15424
+ title: external_exports.string().optional(),
15425
+ expiresAt: external_exports.string().optional(),
15426
+ autoResolution: questionAutoResolutionSchema.optional(),
15427
+ questions: external_exports.array(external_exports.discriminatedUnion("type", [
15428
+ external_exports.strictObject({
15429
+ ...field,
15430
+ type: external_exports.literal("choice"),
15431
+ multiple: external_exports.boolean(),
15432
+ allowOther: external_exports.boolean(),
15433
+ options: external_exports.array(external_exports.strictObject({
15434
+ value: external_exports.string().min(1),
15435
+ label: external_exports.string(),
15436
+ description: external_exports.string().optional()
15437
+ })).min(1)
15438
+ }),
15439
+ external_exports.strictObject({
15440
+ ...field,
15441
+ type: external_exports.literal("text"),
15442
+ multiline: external_exports.boolean(),
15443
+ secret: external_exports.literal(false),
15444
+ placeholder: external_exports.string().optional(),
15445
+ prefill: external_exports.string().optional()
15446
+ })
15447
+ ])).min(1)
15448
+ });
15449
+ var threadQuestionsResultSchema = external_exports.strictObject({
15450
+ questions: external_exports.array(threadQuestionSchema)
15451
+ });
15452
+ var threadQuestionRespondParamsSchema = external_exports.strictObject({
15453
+ threadId: hostThreadIdSchema,
15454
+ interactionId: hostInteractionIdSchema,
15455
+ turnId: hostTurnIdSchema,
15456
+ answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
15457
+ cancelled: external_exports.boolean().optional()
15458
+ });
15459
+ var threadQuestionRespondResultSchema = external_exports.strictObject({ accepted: external_exports.literal(true) });
15460
+ var threadQuestionActivityParamsSchema = external_exports.strictObject({
15461
+ threadId: hostThreadIdSchema,
15462
+ interactionId: hostInteractionIdSchema,
15463
+ turnId: hostTurnIdSchema
15464
+ });
15465
+ var threadQuestionActivityResultSchema = external_exports.strictObject({
15466
+ autoResolution: questionAutoResolutionSchema.nullable()
15467
+ });
15468
+
15413
15469
  // ../../shared-contracts/dist/idle-release.js
15414
15470
  var IDLE_RELEASE_TIMEOUT_MINUTES_MIN = 5;
15415
15471
  var IDLE_RELEASE_TIMEOUT_MINUTES_MAX = 1440;
@@ -16621,6 +16677,9 @@ function validateHostQuestionResponse(interaction, response) {
16621
16677
  }
16622
16678
  for (const question of interaction.questions) {
16623
16679
  const answers = response.answers[question.id] ?? [];
16680
+ if (new Set(answers).size !== answers.length) {
16681
+ return invalidRequest2("Question Response contains duplicate answers");
16682
+ }
16624
16683
  if (!question.optional && answers.length === 0) {
16625
16684
  return invalidRequest2("Question Response omits a required answer");
16626
16685
  }
@@ -16762,26 +16821,26 @@ function parseHostUsage(value) {
16762
16821
  }
16763
16822
  }
16764
16823
  const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
16765
- for (const field of [
16824
+ for (const field2 of [
16766
16825
  "totalCredits",
16767
16826
  "contextUsagePercent",
16768
16827
  "apiOutputTokensPerSecond"
16769
16828
  ]) {
16770
- const candidate2 = value[field];
16829
+ const candidate2 = value[field2];
16771
16830
  if (candidate2 !== void 0 && (typeof candidate2 !== "number" || !Number.isFinite(candidate2) || candidate2 < 0)) {
16772
- throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
16831
+ throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
16773
16832
  }
16774
16833
  }
16775
- for (const field of tokenFields) {
16776
- const candidate2 = value[field];
16834
+ for (const field2 of tokenFields) {
16835
+ const candidate2 = value[field2];
16777
16836
  if (candidate2 !== void 0 && (typeof candidate2 !== "number" || !Number.isSafeInteger(candidate2) || candidate2 < 0)) {
16778
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
16837
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
16779
16838
  }
16780
16839
  }
16781
- for (const field of safeIntegerFields) {
16782
- const candidate2 = value[field];
16840
+ for (const field2 of safeIntegerFields) {
16841
+ const candidate2 = value[field2];
16783
16842
  if (candidate2 !== void 0 && (typeof candidate2 !== "number" || !Number.isSafeInteger(candidate2) || candidate2 < 0)) {
16784
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
16843
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
16785
16844
  }
16786
16845
  }
16787
16846
  if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
@@ -16790,10 +16849,10 @@ function parseHostUsage(value) {
16790
16849
  if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
16791
16850
  throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
16792
16851
  }
16793
- for (const field of percentFields) {
16794
- const candidate2 = value[field];
16852
+ for (const field2 of percentFields) {
16853
+ const candidate2 = value[field2];
16795
16854
  if (candidate2 !== void 0 && (typeof candidate2 !== "number" || !Number.isFinite(candidate2) || candidate2 < 0 || candidate2 > 100)) {
16796
- throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
16855
+ throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
16797
16856
  }
16798
16857
  }
16799
16858
  if (value.sessionCacheUsage !== void 0) {
@@ -16864,19 +16923,19 @@ function parseHostUsageRequest(value) {
16864
16923
  if (typeof value.requestId !== "string" || value.requestId.length === 0) {
16865
16924
  throw new Error("Harness Usage request 'requestId' must be a non-empty string");
16866
16925
  }
16867
- for (const field of ["model", "provider"]) {
16868
- const candidate2 = value[field];
16926
+ for (const field2 of ["model", "provider"]) {
16927
+ const candidate2 = value[field2];
16869
16928
  if (candidate2 !== void 0 && (typeof candidate2 !== "string" || candidate2.length === 0)) {
16870
- throw new Error(`Harness Usage request '${field}' must be a non-empty string`);
16929
+ throw new Error(`Harness Usage request '${field2}' must be a non-empty string`);
16871
16930
  }
16872
16931
  }
16873
16932
  if (value.historical !== void 0 && typeof value.historical !== "boolean") {
16874
16933
  throw new Error("Harness Usage request 'historical' must be a boolean");
16875
16934
  }
16876
- for (const field of requestTokenFields) {
16877
- const candidate2 = value[field];
16935
+ for (const field2 of requestTokenFields) {
16936
+ const candidate2 = value[field2];
16878
16937
  if (candidate2 !== void 0 && (typeof candidate2 !== "number" || !Number.isSafeInteger(candidate2) || candidate2 < 0)) {
16879
- throw new Error(`Harness Usage request '${field}' must be a non-negative safe integer`);
16938
+ throw new Error(`Harness Usage request '${field2}' must be a non-negative safe integer`);
16880
16939
  }
16881
16940
  }
16882
16941
  if (value.inputTokens === void 0 || value.outputTokens === void 0) {
@@ -18270,24 +18329,24 @@ var buildClientParams = (args, fields) => {
18270
18329
  }
18271
18330
  if ("in" in config2) {
18272
18331
  if (config2.key) {
18273
- const field = map2.get(config2.key);
18274
- const name = field.map || config2.key;
18275
- if (field.in) {
18332
+ const field2 = map2.get(config2.key);
18333
+ const name = field2.map || config2.key;
18334
+ if (field2.in) {
18276
18335
  ;
18277
- params[field.in][name] = arg;
18336
+ params[field2.in][name] = arg;
18278
18337
  }
18279
18338
  } else {
18280
18339
  params.body = arg;
18281
18340
  }
18282
18341
  } else {
18283
18342
  for (const [key, value] of Object.entries(arg ?? {})) {
18284
- const field = map2.get(key);
18285
- if (field) {
18286
- if (field.in) {
18287
- const name = field.map || key;
18288
- params[field.in][name] = value;
18343
+ const field2 = map2.get(key);
18344
+ if (field2) {
18345
+ if (field2.in) {
18346
+ const name = field2.map || key;
18347
+ params[field2.in][name] = value;
18289
18348
  } else {
18290
- params[field.map] = value;
18349
+ params[field2.map] = value;
18291
18350
  }
18292
18351
  } else {
18293
18352
  const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix));
@@ -24420,8 +24479,8 @@ var OpenCodeHarnessSession = class {
24420
24479
  this.#event({ type: "item.started", turnId: active.turnId, item });
24421
24480
  }
24422
24481
  }
24423
- #appendPartDelta(active, partID, field, delta) {
24424
- if (field !== "text" || !delta)
24482
+ #appendPartDelta(active, partID, field2, delta) {
24483
+ if (field2 !== "text" || !delta)
24425
24484
  return;
24426
24485
  const existing = active.items.get(partID);
24427
24486
  if (!existing)
@@ -27416,16 +27475,16 @@ function permissionInteraction(request, turnId) {
27416
27475
  };
27417
27476
  }
27418
27477
  function formInteraction(form, turnId) {
27419
- const questions = form.fields.map((field) => {
27420
- if (field.type === "external" || field.hidden || field.when?.length) {
27478
+ const questions = form.fields.map((field2) => {
27479
+ if (field2.type === "external" || field2.hidden || field2.when?.length) {
27421
27480
  throw new Error("OpenCode v2 external, hidden or conditional form fields require its native UI");
27422
27481
  }
27423
27482
  const base = {
27424
- id: field.key,
27425
- prompt: [field.title, field.description].filter(Boolean).join("\n") || field.key,
27426
- optional: !field.required
27483
+ id: field2.key,
27484
+ prompt: [field2.title, field2.description].filter(Boolean).join("\n") || field2.key,
27485
+ optional: !field2.required
27427
27486
  };
27428
- if (field.type === "boolean")
27487
+ if (field2.type === "boolean")
27429
27488
  return {
27430
27489
  ...base,
27431
27490
  type: "choice",
@@ -27436,22 +27495,22 @@ function formInteraction(form, turnId) {
27436
27495
  { value: "false", label: "No" }
27437
27496
  ]
27438
27497
  };
27439
- if (field.type === "multiselect" || field.type === "string" && field.options?.length) {
27498
+ if (field2.type === "multiselect" || field2.type === "string" && field2.options?.length) {
27440
27499
  return {
27441
27500
  ...base,
27442
27501
  type: "choice",
27443
- multiple: field.type === "multiselect",
27444
- allowOther: field.custom ?? false,
27445
- options: field.options ?? []
27502
+ multiple: field2.type === "multiselect",
27503
+ allowOther: field2.custom ?? false,
27504
+ options: field2.options ?? []
27446
27505
  };
27447
27506
  }
27448
27507
  return {
27449
27508
  ...base,
27450
27509
  type: "text",
27451
- multiline: field.type === "string",
27510
+ multiline: field2.type === "string",
27452
27511
  secret: false,
27453
- ...field.type === "string" && field.placeholder ? { placeholder: field.placeholder } : {},
27454
- ...field.default !== void 0 ? { prefill: String(field.default) } : {}
27512
+ ...field2.type === "string" && field2.placeholder ? { placeholder: field2.placeholder } : {},
27513
+ ...field2.default !== void 0 ? { prefill: String(field2.default) } : {}
27455
27514
  };
27456
27515
  });
27457
27516
  return {
@@ -27494,24 +27553,24 @@ async function replyInteraction(client2, pending, command) {
27494
27553
  return;
27495
27554
  }
27496
27555
  const answer = {};
27497
- for (const field of form.fields) {
27498
- const values = command.response.answers[field.key] ?? [];
27556
+ for (const field2 of form.fields) {
27557
+ const values = command.response.answers[field2.key] ?? [];
27499
27558
  if (!values.length)
27500
27559
  continue;
27501
27560
  const value = values[0];
27502
27561
  if (value === void 0)
27503
27562
  continue;
27504
- if (field.type === "multiselect")
27505
- answer[field.key] = values;
27506
- else if (field.type === "boolean")
27507
- answer[field.key] = value === "true";
27508
- else if (field.type === "number" || field.type === "integer") {
27563
+ if (field2.type === "multiselect")
27564
+ answer[field2.key] = values;
27565
+ else if (field2.type === "boolean")
27566
+ answer[field2.key] = value === "true";
27567
+ else if (field2.type === "number" || field2.type === "integer") {
27509
27568
  const number4 = Number(value);
27510
- if (!value.trim() || !Number.isFinite(number4) || field.type === "integer" && !Number.isInteger(number4))
27511
- throw new Error(`Invalid number for ${field.key}`);
27512
- answer[field.key] = number4;
27569
+ if (!value.trim() || !Number.isFinite(number4) || field2.type === "integer" && !Number.isInteger(number4))
27570
+ throw new Error(`Invalid number for ${field2.key}`);
27571
+ answer[field2.key] = number4;
27513
27572
  } else
27514
- answer[field.key] = value;
27573
+ answer[field2.key] = value;
27515
27574
  }
27516
27575
  await client2.session.form.reply({ sessionID: form.sessionID, formID: form.id, answer });
27517
27576
  }
@@ -3580,10 +3580,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3580
3580
  const shape = def.shape;
3581
3581
  const propValues = {};
3582
3582
  for (const key in shape) {
3583
- const field = shape[key]._zod;
3584
- if (field.values) {
3583
+ const field2 = shape[key]._zod;
3584
+ if (field2.values) {
3585
3585
  propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
3586
- for (const v of field.values)
3586
+ for (const v of field2.values)
3587
3587
  propValues[key].add(v);
3588
3588
  }
3589
3589
  }
@@ -15410,6 +15410,62 @@ var CONSOLE_HOST_METHODS = Object.freeze([
15410
15410
  // ../../shared-contracts/dist/version.js
15411
15411
  var WORKSPACE_CONTRACT_VERSION = 1;
15412
15412
 
15413
+ // ../../shared-contracts/dist/thread-questions.js
15414
+ var threadQuestionsParamsSchema = external_exports.strictObject({ threadId: hostThreadIdSchema });
15415
+ var field = { id: external_exports.string().min(1), prompt: external_exports.string(), optional: external_exports.boolean() };
15416
+ var questionAutoResolutionSchema = external_exports.strictObject({
15417
+ deadlineUnixMs: external_exports.number().int().min(0).max(864e13),
15418
+ action: external_exports.enum(["recommended", "decline"]),
15419
+ resetOnActivity: external_exports.boolean().optional()
15420
+ });
15421
+ var threadQuestionSchema = external_exports.strictObject({
15422
+ interactionId: hostInteractionIdSchema,
15423
+ turnId: hostTurnIdSchema,
15424
+ title: external_exports.string().optional(),
15425
+ expiresAt: external_exports.string().optional(),
15426
+ autoResolution: questionAutoResolutionSchema.optional(),
15427
+ questions: external_exports.array(external_exports.discriminatedUnion("type", [
15428
+ external_exports.strictObject({
15429
+ ...field,
15430
+ type: external_exports.literal("choice"),
15431
+ multiple: external_exports.boolean(),
15432
+ allowOther: external_exports.boolean(),
15433
+ options: external_exports.array(external_exports.strictObject({
15434
+ value: external_exports.string().min(1),
15435
+ label: external_exports.string(),
15436
+ description: external_exports.string().optional()
15437
+ })).min(1)
15438
+ }),
15439
+ external_exports.strictObject({
15440
+ ...field,
15441
+ type: external_exports.literal("text"),
15442
+ multiline: external_exports.boolean(),
15443
+ secret: external_exports.literal(false),
15444
+ placeholder: external_exports.string().optional(),
15445
+ prefill: external_exports.string().optional()
15446
+ })
15447
+ ])).min(1)
15448
+ });
15449
+ var threadQuestionsResultSchema = external_exports.strictObject({
15450
+ questions: external_exports.array(threadQuestionSchema)
15451
+ });
15452
+ var threadQuestionRespondParamsSchema = external_exports.strictObject({
15453
+ threadId: hostThreadIdSchema,
15454
+ interactionId: hostInteractionIdSchema,
15455
+ turnId: hostTurnIdSchema,
15456
+ answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
15457
+ cancelled: external_exports.boolean().optional()
15458
+ });
15459
+ var threadQuestionRespondResultSchema = external_exports.strictObject({ accepted: external_exports.literal(true) });
15460
+ var threadQuestionActivityParamsSchema = external_exports.strictObject({
15461
+ threadId: hostThreadIdSchema,
15462
+ interactionId: hostInteractionIdSchema,
15463
+ turnId: hostTurnIdSchema
15464
+ });
15465
+ var threadQuestionActivityResultSchema = external_exports.strictObject({
15466
+ autoResolution: questionAutoResolutionSchema.nullable()
15467
+ });
15468
+
15413
15469
  // ../../shared-contracts/dist/idle-release.js
15414
15470
  var IDLE_RELEASE_TIMEOUT_MINUTES_MIN = 5;
15415
15471
  var IDLE_RELEASE_TIMEOUT_MINUTES_MAX = 1440;
@@ -16921,6 +16977,9 @@ function validateHostQuestionResponse(interaction, response) {
16921
16977
  }
16922
16978
  for (const question of interaction.questions) {
16923
16979
  const answers = response.answers[question.id] ?? [];
16980
+ if (new Set(answers).size !== answers.length) {
16981
+ return invalidRequest("Question Response contains duplicate answers");
16982
+ }
16924
16983
  if (!question.optional && answers.length === 0) {
16925
16984
  return invalidRequest("Question Response omits a required answer");
16926
16985
  }
@@ -17062,26 +17121,26 @@ function parseHostUsage(value) {
17062
17121
  }
17063
17122
  }
17064
17123
  const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
17065
- for (const field of [
17124
+ for (const field2 of [
17066
17125
  "totalCredits",
17067
17126
  "contextUsagePercent",
17068
17127
  "apiOutputTokensPerSecond"
17069
17128
  ]) {
17070
- const candidate = value[field];
17129
+ const candidate = value[field2];
17071
17130
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
17072
- throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
17131
+ throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
17073
17132
  }
17074
17133
  }
17075
- for (const field of tokenFields) {
17076
- const candidate = value[field];
17134
+ for (const field2 of tokenFields) {
17135
+ const candidate = value[field2];
17077
17136
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
17078
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
17137
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
17079
17138
  }
17080
17139
  }
17081
- for (const field of safeIntegerFields) {
17082
- const candidate = value[field];
17140
+ for (const field2 of safeIntegerFields) {
17141
+ const candidate = value[field2];
17083
17142
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
17084
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
17143
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
17085
17144
  }
17086
17145
  }
17087
17146
  if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
@@ -17090,10 +17149,10 @@ function parseHostUsage(value) {
17090
17149
  if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
17091
17150
  throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
17092
17151
  }
17093
- for (const field of percentFields) {
17094
- const candidate = value[field];
17152
+ for (const field2 of percentFields) {
17153
+ const candidate = value[field2];
17095
17154
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
17096
- throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
17155
+ throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
17097
17156
  }
17098
17157
  }
17099
17158
  if (value.sessionCacheUsage !== void 0) {
@@ -17164,19 +17223,19 @@ function parseHostUsageRequest(value) {
17164
17223
  if (typeof value.requestId !== "string" || value.requestId.length === 0) {
17165
17224
  throw new Error("Harness Usage request 'requestId' must be a non-empty string");
17166
17225
  }
17167
- for (const field of ["model", "provider"]) {
17168
- const candidate = value[field];
17226
+ for (const field2 of ["model", "provider"]) {
17227
+ const candidate = value[field2];
17169
17228
  if (candidate !== void 0 && (typeof candidate !== "string" || candidate.length === 0)) {
17170
- throw new Error(`Harness Usage request '${field}' must be a non-empty string`);
17229
+ throw new Error(`Harness Usage request '${field2}' must be a non-empty string`);
17171
17230
  }
17172
17231
  }
17173
17232
  if (value.historical !== void 0 && typeof value.historical !== "boolean") {
17174
17233
  throw new Error("Harness Usage request 'historical' must be a boolean");
17175
17234
  }
17176
- for (const field of requestTokenFields) {
17177
- const candidate = value[field];
17235
+ for (const field2 of requestTokenFields) {
17236
+ const candidate = value[field2];
17178
17237
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
17179
- throw new Error(`Harness Usage request '${field}' must be a non-negative safe integer`);
17238
+ throw new Error(`Harness Usage request '${field2}' must be a non-negative safe integer`);
17180
17239
  }
17181
17240
  }
17182
17241
  if (value.inputTokens === void 0 || value.outputTokens === void 0) {
@@ -17903,9 +17962,9 @@ function nestedToolString(value, keys, allowEmpty = false) {
17903
17962
  if (!isRecord3(value))
17904
17963
  return void 0;
17905
17964
  for (const key of keys) {
17906
- const field = value[key];
17907
- if (typeof field === "string" && (allowEmpty || field.length > 0))
17908
- return field;
17965
+ const field2 = value[key];
17966
+ if (typeof field2 === "string" && (allowEmpty || field2.length > 0))
17967
+ return field2;
17909
17968
  }
17910
17969
  for (const wrapper of ["input", "arguments", "params", "details"]) {
17911
17970
  const nested = nestedToolString(value[wrapper], keys, allowEmpty);
@@ -17918,15 +17977,15 @@ function patchFromResult(result) {
17918
17977
  if (!isRecord3(result))
17919
17978
  return void 0;
17920
17979
  for (const key of ["patch", "diff", "unifiedDiff"]) {
17921
- const field = result[key];
17922
- if (typeof field === "string" && field.length > 0)
17923
- return field;
17980
+ const field2 = result[key];
17981
+ if (typeof field2 === "string" && field2.length > 0)
17982
+ return field2;
17924
17983
  }
17925
17984
  if (isRecord3(result.details)) {
17926
17985
  for (const key of ["patch", "diff", "unifiedDiff"]) {
17927
- const field = result.details[key];
17928
- if (typeof field === "string" && field.length > 0)
17929
- return field;
17986
+ const field2 = result.details[key];
17987
+ if (typeof field2 === "string" && field2.length > 0)
17988
+ return field2;
17930
17989
  }
17931
17990
  }
17932
17991
  return void 0;
@@ -18420,8 +18479,8 @@ function parsePiSubagentInspection(value) {
18420
18479
  return null;
18421
18480
  if (parsed.error !== void 0 && (!record3(parsed.error) || typeof parsed.error.code !== "string" || typeof parsed.error.message !== "string"))
18422
18481
  return null;
18423
- for (const field of ["asyncId", "childId", "status", "task", "finalOutput"]) {
18424
- if (parsed[field] !== void 0 && typeof parsed[field] !== "string")
18482
+ for (const field2 of ["asyncId", "childId", "status", "task", "finalOutput"]) {
18483
+ if (parsed[field2] !== void 0 && typeof parsed[field2] !== "string")
18425
18484
  return null;
18426
18485
  }
18427
18486
  if (parsed.messages !== void 0 && (!Array.isArray(parsed.messages) || parsed.messages.length > 200 || parsed.messages.some((entry) => !record3(entry) || typeof entry.role !== "string" || typeof entry.text !== "string" || !["text", "toolCall", "toolResult"].includes(String(entry.kind)) || entry.name !== void 0 && typeof entry.name !== "string")))
@@ -21590,9 +21649,9 @@ function outputText(output) {
21590
21649
  function stringField(value, key) {
21591
21650
  if (!isRecord9(value))
21592
21651
  return void 0;
21593
- const field = value[key];
21594
- if (typeof field === "string" && field.length > 0)
21595
- return field;
21652
+ const field2 = value[key];
21653
+ if (typeof field2 === "string" && field2.length > 0)
21654
+ return field2;
21596
21655
  if (isRecord9(value.input)) {
21597
21656
  const nested = value.input[key];
21598
21657
  if (typeof nested === "string" && nested.length > 0)
@@ -21608,8 +21667,8 @@ function stringField(value, key) {
21608
21667
  function numberField(value, key) {
21609
21668
  if (!isRecord9(value))
21610
21669
  return void 0;
21611
- const field = value[key];
21612
- return typeof field === "number" || field === null ? field : void 0;
21670
+ const field2 = value[key];
21671
+ return typeof field2 === "number" || field2 === null ? field2 : void 0;
21613
21672
  }
21614
21673
  function normalizeToolName(name) {
21615
21674
  const lower = name.toLowerCase();