@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.
@@ -7091,10 +7091,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
7091
7091
  const shape = def.shape;
7092
7092
  const propValues = {};
7093
7093
  for (const key in shape) {
7094
- const field = shape[key]._zod;
7095
- if (field.values) {
7094
+ const field2 = shape[key]._zod;
7095
+ if (field2.values) {
7096
7096
  propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
7097
- for (const v of field.values)
7097
+ for (const v of field2.values)
7098
7098
  propValues[key].add(v);
7099
7099
  }
7100
7100
  }
@@ -18841,6 +18841,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
18841
18841
  var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
18842
18842
  var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
18843
18843
 
18844
+ // ../../shared-contracts/dist/thread-questions.js
18845
+ var field = external_exports.discriminatedUnion("type", [
18846
+ external_exports.object({
18847
+ id: external_exports.string().min(1),
18848
+ type: external_exports.literal("choice"),
18849
+ prompt: external_exports.string(),
18850
+ options: external_exports.array(external_exports.object({
18851
+ value: external_exports.string().min(1),
18852
+ label: external_exports.string(),
18853
+ description: external_exports.string().optional()
18854
+ })).min(1),
18855
+ multiple: external_exports.boolean(),
18856
+ allowOther: external_exports.boolean(),
18857
+ optional: external_exports.boolean()
18858
+ }),
18859
+ external_exports.object({
18860
+ id: external_exports.string().min(1),
18861
+ type: external_exports.literal("text"),
18862
+ prompt: external_exports.string(),
18863
+ multiline: external_exports.boolean(),
18864
+ secret: external_exports.literal(false),
18865
+ optional: external_exports.boolean(),
18866
+ placeholder: external_exports.string().optional(),
18867
+ prefill: external_exports.string().optional()
18868
+ })
18869
+ ]);
18870
+ var threadQuestionSchema = external_exports.object({
18871
+ interactionId: external_exports.string().min(1),
18872
+ turnId: external_exports.string().min(1),
18873
+ title: external_exports.string().optional(),
18874
+ questions: external_exports.array(field).min(1)
18875
+ }).refine(({ questions }) => questions.some((q) => q.type === "choice" && q.multiple), {
18876
+ message: "Shared cards require at least one multi-select question"
18877
+ });
18878
+ var threadQuestionsListParamsSchema = external_exports.strictObject({ threadId: external_exports.string().min(1) });
18879
+ var threadQuestionsResultSchema = external_exports.object({ questions: external_exports.array(threadQuestionSchema) });
18880
+ var threadQuestionRespondParamsSchema = external_exports.strictObject({
18881
+ threadId: external_exports.string().min(1),
18882
+ turnId: external_exports.string().min(1),
18883
+ interactionId: external_exports.string().min(1),
18884
+ answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
18885
+ cancelled: external_exports.boolean().default(false)
18886
+ });
18887
+ var threadQuestionRespondResultSchema = external_exports.object({ accepted: external_exports.literal(true) });
18888
+
18844
18889
  // ../../shared-contracts/dist/console.js
18845
18890
  var consoleAnnouncementSchema = external_exports.strictObject({
18846
18891
  title: external_exports.string().trim().min(1).max(200),
@@ -27558,19 +27603,19 @@ var CopilotSession = class {
27558
27603
  }
27559
27604
  async _input(message, options2) {
27560
27605
  this.assertElicitation();
27561
- const field = { type: "string" };
27562
- if (options2?.title) field.title = options2.title;
27563
- if (options2?.description) field.description = options2.description;
27564
- if (options2?.minLength != null) field.minLength = options2.minLength;
27565
- if (options2?.maxLength != null) field.maxLength = options2.maxLength;
27566
- if (options2?.format) field.format = options2.format;
27567
- if (options2?.default != null) field.default = options2.default;
27606
+ const field2 = { type: "string" };
27607
+ if (options2?.title) field2.title = options2.title;
27608
+ if (options2?.description) field2.description = options2.description;
27609
+ if (options2?.minLength != null) field2.minLength = options2.minLength;
27610
+ if (options2?.maxLength != null) field2.maxLength = options2.maxLength;
27611
+ if (options2?.format) field2.format = options2.format;
27612
+ if (options2?.default != null) field2.default = options2.default;
27568
27613
  const result = await this.rpc.ui.elicitation({
27569
27614
  message,
27570
27615
  requestedSchema: {
27571
27616
  type: "object",
27572
27617
  properties: {
27573
- value: field
27618
+ value: field2
27574
27619
  },
27575
27620
  required: ["value"]
27576
27621
  }
@@ -28745,14 +28790,14 @@ function toolFilterListToArray(value) {
28745
28790
  }
28746
28791
  return value instanceof ToolSet ? value.toArray() : value;
28747
28792
  }
28748
- function validateToolFilterList(field, list) {
28793
+ function validateToolFilterList(field2, list) {
28749
28794
  if (!list) {
28750
28795
  return;
28751
28796
  }
28752
28797
  for (const entry of list) {
28753
28798
  if (entry === "*") {
28754
28799
  throw new Error(
28755
- `Invalid ${field} entry '*': there is no bare wildcard. Use one or more of \`new ToolSet().addBuiltIn('*')\`, \`.addMcp('*')\`, or \`.addCustom('*')\` to target a specific source.`
28800
+ `Invalid ${field2} entry '*': there is no bare wildcard. Use one or more of \`new ToolSet().addBuiltIn('*')\`, \`.addMcp('*')\`, or \`.addCustom('*')\` to target a specific source.`
28756
28801
  );
28757
28802
  }
28758
28803
  }
@@ -32163,26 +32208,26 @@ function parseHostUsage(value) {
32163
32208
  }
32164
32209
  }
32165
32210
  const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
32166
- for (const field of [
32211
+ for (const field2 of [
32167
32212
  "totalCredits",
32168
32213
  "contextUsagePercent",
32169
32214
  "apiOutputTokensPerSecond"
32170
32215
  ]) {
32171
- const candidate = value[field];
32216
+ const candidate = value[field2];
32172
32217
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
32173
- throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
32218
+ throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
32174
32219
  }
32175
32220
  }
32176
- for (const field of tokenFields) {
32177
- const candidate = value[field];
32221
+ for (const field2 of tokenFields) {
32222
+ const candidate = value[field2];
32178
32223
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
32179
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
32224
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
32180
32225
  }
32181
32226
  }
32182
- for (const field of safeIntegerFields) {
32183
- const candidate = value[field];
32227
+ for (const field2 of safeIntegerFields) {
32228
+ const candidate = value[field2];
32184
32229
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
32185
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
32230
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
32186
32231
  }
32187
32232
  }
32188
32233
  if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
@@ -32191,10 +32236,10 @@ function parseHostUsage(value) {
32191
32236
  if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
32192
32237
  throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
32193
32238
  }
32194
- for (const field of percentFields) {
32195
- const candidate = value[field];
32239
+ for (const field2 of percentFields) {
32240
+ const candidate = value[field2];
32196
32241
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
32197
- throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
32242
+ throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
32198
32243
  }
32199
32244
  }
32200
32245
  if (value.sessionCacheUsage !== void 0) {
@@ -32534,18 +32579,18 @@ function calendarDate(value) {
32534
32579
  const timestamp = Date.parse(value);
32535
32580
  return /^\d{4}-\d{2}-\d{2}$/u.test(value) && Number.isFinite(timestamp) && new Date(timestamp).toISOString().slice(0, 10) === value;
32536
32581
  }
32537
- function options(field) {
32538
- if (field.type === "boolean")
32582
+ function options(field2) {
32583
+ if (field2.type === "boolean")
32539
32584
  return [
32540
32585
  { value: "true", label: "Yes" },
32541
32586
  { value: "false", label: "No" }
32542
32587
  ];
32543
- if (field.type === "string" && "enum" in field)
32544
- return field.enum.map((value, index) => ({ value, label: field.enumNames?.[index] ?? value }));
32545
- if (field.type === "string" && "oneOf" in field)
32546
- return field.oneOf.map((option) => ({ value: option.const, label: option.title }));
32547
- if (field.type === "array") {
32548
- return "enum" in field.items ? field.items.enum.map((value) => ({ value, label: value })) : field.items.anyOf.map((option) => ({ value: option.const, label: option.title }));
32588
+ if (field2.type === "string" && "enum" in field2)
32589
+ return field2.enum.map((value, index) => ({ value, label: field2.enumNames?.[index] ?? value }));
32590
+ if (field2.type === "string" && "oneOf" in field2)
32591
+ return field2.oneOf.map((option) => ({ value: option.const, label: option.title }));
32592
+ if (field2.type === "array") {
32593
+ return "enum" in field2.items ? field2.items.enum.map((value) => ({ value, label: value })) : field2.items.anyOf.map((option) => ({ value: option.const, label: option.title }));
32549
32594
  }
32550
32595
  }
32551
32596
  function elicitationForm(context) {
@@ -32554,22 +32599,22 @@ function elicitationForm(context) {
32554
32599
  throw new CopilotOperationError("unsupported", "Copilot elicitation requires a supported primitive form; browser URL flows are unavailable.");
32555
32600
  if (schema.required?.some((id) => !Object.hasOwn(schema.properties, id)))
32556
32601
  throw new Error("Copilot form refers to an unknown required field");
32557
- const questions = Object.entries(schema.properties).map(([id, field]) => {
32602
+ const questions = Object.entries(schema.properties).map(([id, field2]) => {
32558
32603
  const allowed = /* @__PURE__ */ new Set([
32559
32604
  "type",
32560
32605
  "title",
32561
32606
  "description",
32562
32607
  "default",
32563
- ...field.type === "string" ? ["enum", "enumNames", "oneOf", "minLength", "maxLength", "format"] : field.type === "array" ? ["items", "minItems", "maxItems"] : field.type === "number" || field.type === "integer" ? ["minimum", "maximum"] : []
32608
+ ...field2.type === "string" ? ["enum", "enumNames", "oneOf", "minLength", "maxLength", "format"] : field2.type === "array" ? ["items", "minItems", "maxItems"] : field2.type === "number" || field2.type === "integer" ? ["minimum", "maximum"] : []
32564
32609
  ]);
32565
- if (Object.keys(field).some((key) => !allowed.has(key)))
32610
+ if (Object.keys(field2).some((key) => !allowed.has(key)))
32566
32611
  throw new CopilotOperationError("unsupported", "Copilot form contains an unsupported constraint.");
32567
- if ("format" in field && field.format && !["email", "uri", "date", "date-time"].includes(field.format))
32612
+ if ("format" in field2 && field2.format && !["email", "uri", "date", "date-time"].includes(field2.format))
32568
32613
  throw new CopilotOperationError("unsupported", "Copilot form contains an unsupported text format.");
32569
- if (!["string", "number", "integer", "boolean", "array"].includes(field.type))
32614
+ if (!["string", "number", "integer", "boolean", "array"].includes(field2.type))
32570
32615
  throw new CopilotOperationError("unsupported", "Copilot form field cannot be represented");
32571
- const prompt = [field.title ?? id, field.description].filter(Boolean).join("\n");
32572
- const choices = options(field);
32616
+ const prompt = [field2.title ?? id, field2.description].filter(Boolean).join("\n");
32617
+ const choices = options(field2);
32573
32618
  const optional2 = !schema.required?.includes(id);
32574
32619
  if (choices)
32575
32620
  return {
@@ -32577,7 +32622,7 @@ function elicitationForm(context) {
32577
32622
  type: "choice",
32578
32623
  prompt,
32579
32624
  options: choices,
32580
- multiple: field.type === "array",
32625
+ multiple: field2.type === "array",
32581
32626
  allowOther: false,
32582
32627
  optional: optional2
32583
32628
  };
@@ -32585,43 +32630,43 @@ function elicitationForm(context) {
32585
32630
  id,
32586
32631
  type: "text",
32587
32632
  prompt,
32588
- multiline: field.type === "string",
32633
+ multiline: field2.type === "string",
32589
32634
  secret: false,
32590
32635
  optional: optional2,
32591
- ...field.default === void 0 ? {} : { prefill: String(field.default) }
32636
+ ...field2.default === void 0 ? {} : { prefill: String(field2.default) }
32592
32637
  };
32593
32638
  });
32594
32639
  const decode3 = (response) => {
32595
32640
  if (response.cancelled)
32596
32641
  return { action: "cancel" };
32597
32642
  const content = /* @__PURE__ */ Object.create(null);
32598
- for (const [id, field] of Object.entries(schema.properties)) {
32643
+ for (const [id, field2] of Object.entries(schema.properties)) {
32599
32644
  const values = Object.hasOwn(response.answers, id) ? response.answers[id] ?? [] : [];
32600
32645
  if (!values.length)
32601
32646
  continue;
32602
32647
  const value = values[0] ?? "";
32603
- if (field.type === "array") {
32604
- if (field.minItems !== void 0 && values.length < field.minItems || field.maxItems !== void 0 && values.length > field.maxItems)
32648
+ if (field2.type === "array") {
32649
+ if (field2.minItems !== void 0 && values.length < field2.minItems || field2.maxItems !== void 0 && values.length > field2.maxItems)
32605
32650
  throw new Error("The number of choices is outside the native form's limits.");
32606
32651
  content[id] = values;
32607
32652
  continue;
32608
32653
  }
32609
- if (field.type === "boolean") {
32654
+ if (field2.type === "boolean") {
32610
32655
  content[id] = value === "true";
32611
32656
  continue;
32612
32657
  }
32613
- if (field.type === "number" || field.type === "integer") {
32658
+ if (field2.type === "number" || field2.type === "integer") {
32614
32659
  const number4 = Number(value);
32615
- if (!value.trim() || !Number.isFinite(number4) || field.type === "integer" && !Number.isSafeInteger(number4) || field.minimum !== void 0 && number4 < field.minimum || field.maximum !== void 0 && number4 > field.maximum)
32660
+ if (!value.trim() || !Number.isFinite(number4) || field2.type === "integer" && !Number.isSafeInteger(number4) || field2.minimum !== void 0 && number4 < field2.minimum || field2.maximum !== void 0 && number4 > field2.maximum)
32616
32661
  throw new Error("The number is outside the native form's limits.");
32617
32662
  content[id] = number4;
32618
32663
  continue;
32619
32664
  }
32620
- if (field.type === "string") {
32621
- if ("minLength" in field && field.minLength !== void 0 && Array.from(value).length < field.minLength || "maxLength" in field && field.maxLength !== void 0 && Array.from(value).length > field.maxLength)
32665
+ if (field2.type === "string") {
32666
+ if ("minLength" in field2 && field2.minLength !== void 0 && Array.from(value).length < field2.minLength || "maxLength" in field2 && field2.maxLength !== void 0 && Array.from(value).length > field2.maxLength)
32622
32667
  throw new Error("The text length is outside the native form's limits.");
32623
- if ("format" in field && field.format) {
32624
- const valid = field.format === "email" ? /^[^\s@]+@[^\s@]+\.[^\s@]+$/u.test(value) : field.format === "uri" ? URL.canParse(value) : field.format === "date" ? calendarDate(value) : calendarDate(value.slice(0, 10)) && /^\d{4}-\d{2}-\d{2}T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/iu.test(value) && !Number.isNaN(Date.parse(value));
32668
+ if ("format" in field2 && field2.format) {
32669
+ const valid = field2.format === "email" ? /^[^\s@]+@[^\s@]+\.[^\s@]+$/u.test(value) : field2.format === "uri" ? URL.canParse(value) : field2.format === "date" ? calendarDate(value) : calendarDate(value.slice(0, 10)) && /^\d{4}-\d{2}-\d{2}T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/iu.test(value) && !Number.isNaN(Date.parse(value));
32625
32670
  if (!valid)
32626
32671
  throw new Error("The text does not match the native form's format.");
32627
32672
  }
@@ -3401,10 +3401,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3401
3401
  const shape = def.shape;
3402
3402
  const propValues = {};
3403
3403
  for (const key in shape) {
3404
- const field = shape[key]._zod;
3405
- if (field.values) {
3404
+ const field2 = shape[key]._zod;
3405
+ if (field2.values) {
3406
3406
  propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
3407
- for (const v of field.values)
3407
+ for (const v of field2.values)
3408
3408
  propValues[key].add(v);
3409
3409
  }
3410
3410
  }
@@ -15151,6 +15151,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
15151
15151
  var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
15152
15152
  var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
15153
15153
 
15154
+ // ../../shared-contracts/dist/thread-questions.js
15155
+ var field = external_exports.discriminatedUnion("type", [
15156
+ external_exports.object({
15157
+ id: external_exports.string().min(1),
15158
+ type: external_exports.literal("choice"),
15159
+ prompt: external_exports.string(),
15160
+ options: external_exports.array(external_exports.object({
15161
+ value: external_exports.string().min(1),
15162
+ label: external_exports.string(),
15163
+ description: external_exports.string().optional()
15164
+ })).min(1),
15165
+ multiple: external_exports.boolean(),
15166
+ allowOther: external_exports.boolean(),
15167
+ optional: external_exports.boolean()
15168
+ }),
15169
+ external_exports.object({
15170
+ id: external_exports.string().min(1),
15171
+ type: external_exports.literal("text"),
15172
+ prompt: external_exports.string(),
15173
+ multiline: external_exports.boolean(),
15174
+ secret: external_exports.literal(false),
15175
+ optional: external_exports.boolean(),
15176
+ placeholder: external_exports.string().optional(),
15177
+ prefill: external_exports.string().optional()
15178
+ })
15179
+ ]);
15180
+ var threadQuestionSchema = external_exports.object({
15181
+ interactionId: external_exports.string().min(1),
15182
+ turnId: external_exports.string().min(1),
15183
+ title: external_exports.string().optional(),
15184
+ questions: external_exports.array(field).min(1)
15185
+ }).refine(({ questions }) => questions.some((q) => q.type === "choice" && q.multiple), {
15186
+ message: "Shared cards require at least one multi-select question"
15187
+ });
15188
+ var threadQuestionsListParamsSchema = external_exports.strictObject({ threadId: external_exports.string().min(1) });
15189
+ var threadQuestionsResultSchema = external_exports.object({ questions: external_exports.array(threadQuestionSchema) });
15190
+ var threadQuestionRespondParamsSchema = external_exports.strictObject({
15191
+ threadId: external_exports.string().min(1),
15192
+ turnId: external_exports.string().min(1),
15193
+ interactionId: external_exports.string().min(1),
15194
+ answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
15195
+ cancelled: external_exports.boolean().default(false)
15196
+ });
15197
+ var threadQuestionRespondResultSchema = external_exports.object({ accepted: external_exports.literal(true) });
15198
+
15154
15199
  // ../../shared-contracts/dist/console.js
15155
15200
  var consoleAnnouncementSchema = external_exports.strictObject({
15156
15201
  title: external_exports.string().trim().min(1).max(200),
@@ -16501,26 +16546,26 @@ function parseHostUsage(value) {
16501
16546
  }
16502
16547
  }
16503
16548
  const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
16504
- for (const field of [
16549
+ for (const field2 of [
16505
16550
  "totalCredits",
16506
16551
  "contextUsagePercent",
16507
16552
  "apiOutputTokensPerSecond"
16508
16553
  ]) {
16509
- const candidate = value[field];
16554
+ const candidate = value[field2];
16510
16555
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
16511
- throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
16556
+ throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
16512
16557
  }
16513
16558
  }
16514
- for (const field of tokenFields) {
16515
- const candidate = value[field];
16559
+ for (const field2 of tokenFields) {
16560
+ const candidate = value[field2];
16516
16561
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
16517
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
16562
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
16518
16563
  }
16519
16564
  }
16520
- for (const field of safeIntegerFields) {
16521
- const candidate = value[field];
16565
+ for (const field2 of safeIntegerFields) {
16566
+ const candidate = value[field2];
16522
16567
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
16523
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
16568
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
16524
16569
  }
16525
16570
  }
16526
16571
  if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
@@ -16529,10 +16574,10 @@ function parseHostUsage(value) {
16529
16574
  if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
16530
16575
  throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
16531
16576
  }
16532
- for (const field of percentFields) {
16533
- const candidate = value[field];
16577
+ for (const field2 of percentFields) {
16578
+ const candidate = value[field2];
16534
16579
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
16535
- throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
16580
+ throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
16536
16581
  }
16537
16582
  }
16538
16583
  if (value.sessionCacheUsage !== void 0) {
@@ -17019,8 +17064,8 @@ function protobufBytes(data) {
17019
17064
  const fields = /* @__PURE__ */ new Map();
17020
17065
  while (offset < data.length) {
17021
17066
  const tag = varint();
17022
- const field = Math.floor(tag / 8), wire = tag % 8;
17023
- if (!Number.isSafeInteger(tag) || field === 0)
17067
+ const field2 = Math.floor(tag / 8), wire = tag % 8;
17068
+ if (!Number.isSafeInteger(tag) || field2 === 0)
17024
17069
  throw new Error("Invalid Cursor native field");
17025
17070
  if (wire === 0) {
17026
17071
  varint();
@@ -17030,16 +17075,16 @@ function protobufBytes(data) {
17030
17075
  if (!Number.isSafeInteger(length) || length < 0 || offset + length > data.length)
17031
17076
  throw new Error("Unsupported Cursor native record");
17032
17077
  if (wire === 2) {
17033
- const values = fields.get(field) ?? [];
17078
+ const values = fields.get(field2) ?? [];
17034
17079
  values.push(Buffer.from(data.subarray(offset, offset + length)));
17035
- fields.set(field, values);
17080
+ fields.set(field2, values);
17036
17081
  }
17037
17082
  offset += length;
17038
17083
  }
17039
17084
  return fields;
17040
17085
  }
17041
- function one(fields, field) {
17042
- const values = fields.get(field);
17086
+ function one(fields, field2) {
17087
+ const values = fields.get(field2);
17043
17088
  if (values?.length !== 1 || !values[0])
17044
17089
  throw new Error("Cursor native history identity is missing or ambiguous");
17045
17090
  return values[0];
@@ -23819,6 +23864,7 @@ var HARNESS_BROKER_PROTOCOL_VERSION = 1;
23819
23864
  var HARNESS_BROKER_MAX_FRAME_BYTES = 8 * 1024 * 1024;
23820
23865
  var HARNESS_BROKER_MAX_PENDING_REQUESTS = 32;
23821
23866
  var HARNESS_BROKER_REQUEST_TIMEOUT_MS = 15e3;
23867
+ var HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE = 100;
23822
23868
  var HARNESS_BROKER_IDLE_TIMEOUT_MS = 60 * 60 * 1e3;
23823
23869
  var HARNESS_BROKER_RETIRING_ERROR_CODE = "brokerRetiring";
23824
23870
  var harnessBrokerMethodSchema = external_exports.enum([
@@ -23826,6 +23872,8 @@ var harnessBrokerMethodSchema = external_exports.enum([
23826
23872
  "adapter.inspectAccount",
23827
23873
  "adapter.credits",
23828
23874
  "adapter.open",
23875
+ "adapter.sessionImport.list",
23876
+ "adapter.sessionImport.resolve",
23829
23877
  "adapter.subagent.readSnapshot",
23830
23878
  "session.readSnapshot",
23831
23879
  "session.readCapabilities",
@@ -23928,30 +23976,6 @@ function consumeBrokerFrames(socket, onFrame, onError) {
23928
23976
  });
23929
23977
  }
23930
23978
 
23931
- // ../../harness-broker/dist/paths.js
23932
- import os4 from "node:os";
23933
- import path10 from "node:path";
23934
- var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
23935
- var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
23936
- function defaultHarnessBrokerDirectory(environment = process.env) {
23937
- const home = environment.HOME || os4.homedir();
23938
- return path10.join(home, ".codexhost", "harness-broker");
23939
- }
23940
- function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
23941
- harnessPluginIdSchema.parse(harnessId);
23942
- if (harnessId !== "claude-code")
23943
- return path10.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
23944
- return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path10.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
23945
- }
23946
- function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
23947
- harnessPluginIdSchema.parse(harnessId);
23948
- return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
23949
- }
23950
- function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
23951
- const home = environment.HOME || os4.homedir();
23952
- return path10.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
23953
- }
23954
-
23955
23979
  // ../../harness-broker/dist/validation.js
23956
23980
  var cwdSchema = external_exports.string().min(1).max(16384);
23957
23981
  var brokerEnvironmentSchema = external_exports.object({
@@ -24002,7 +24026,31 @@ var brokerOpenInputSchema = external_exports.discriminatedUnion("kind", [
24002
24026
  forkSchema,
24003
24027
  rollbackSchema
24004
24028
  ]);
24005
- var brokerInspectInputSchema = external_exports.object({ cwd: cwdSchema.optional(), refresh: external_exports.boolean().optional() }).strict();
24029
+ var brokerInspectInputSchema = external_exports.object({
24030
+ cwd: cwdSchema.optional(),
24031
+ refresh: external_exports.boolean().optional(),
24032
+ purpose: external_exports.literal("availability").optional()
24033
+ }).strict();
24034
+ var brokerSessionImportListParamsSchema = external_exports.object({
24035
+ offset: external_exports.number().int().nonnegative().safe(),
24036
+ limit: external_exports.number().int().min(1).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE)
24037
+ }).strict();
24038
+ var brokerSessionImportResolveParamsSchema = external_exports.object({ nativeSessionId: harnessSessionImportIdSchema }).strict();
24039
+ var brokerSessionImportPageSchema = external_exports.object({
24040
+ candidates: external_exports.array(harnessSessionImportCandidateSchema).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE),
24041
+ total: external_exports.number().int().nonnegative().safe()
24042
+ }).strict();
24043
+ var brokerSessionImportSourceSchema = external_exports.object({
24044
+ candidate: harnessSessionImportCandidateSchema,
24045
+ nativeRef: nativeSessionRefSchema
24046
+ }).strict().superRefine((source, context) => {
24047
+ if (source.nativeRef.nativeSessionId !== source.candidate.nativeSessionId) {
24048
+ context.addIssue({
24049
+ code: "custom",
24050
+ message: "Session import source identity does not match"
24051
+ });
24052
+ }
24053
+ });
24006
24054
  var textInputSchema = external_exports.object({ type: external_exports.literal("text"), text: external_exports.string().max(4e6) }).strict();
24007
24055
  var turnStartSchema = external_exports.object({
24008
24056
  type: external_exports.literal("turn.start"),
@@ -24173,6 +24221,107 @@ var harnessOutputSchema = external_exports.custom((value) => {
24173
24221
  return false;
24174
24222
  });
24175
24223
 
24224
+ // ../../harness-broker/dist/session-import-client.js
24225
+ function createBrokerSessionImportCapability(input) {
24226
+ let listing = null;
24227
+ const closed = () => ({
24228
+ ok: false,
24229
+ error: { code: "invalidState", message: "Harness broker adapter is closed", retryable: false }
24230
+ });
24231
+ const invalid = () => ({
24232
+ ok: false,
24233
+ error: {
24234
+ code: "protocolError",
24235
+ message: "Harness broker returned invalid Session import metadata",
24236
+ retryable: false
24237
+ }
24238
+ });
24239
+ const list = async () => {
24240
+ try {
24241
+ const candidates = [];
24242
+ const identities = /* @__PURE__ */ new Set();
24243
+ let total;
24244
+ for (; ; ) {
24245
+ if (input.isClosed())
24246
+ return closed();
24247
+ const result = await input.request("adapter.sessionImport.list", {
24248
+ offset: candidates.length,
24249
+ limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
24250
+ });
24251
+ if (input.isClosed())
24252
+ return closed();
24253
+ if (!result.ok)
24254
+ return result;
24255
+ const page = brokerSessionImportPageSchema.safeParse(result.value);
24256
+ 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)
24257
+ return invalid();
24258
+ total = page.data.total;
24259
+ for (const candidate of page.data.candidates) {
24260
+ if (identities.has(candidate.nativeSessionId))
24261
+ return invalid();
24262
+ identities.add(candidate.nativeSessionId);
24263
+ candidates.push(candidate);
24264
+ }
24265
+ if (candidates.length === total)
24266
+ return { ok: true, value: candidates };
24267
+ }
24268
+ } catch (error51) {
24269
+ return { ok: false, error: input.error(error51) };
24270
+ }
24271
+ };
24272
+ return {
24273
+ listCandidates() {
24274
+ if (input.isClosed())
24275
+ return Promise.resolve(closed());
24276
+ listing ??= list().finally(() => {
24277
+ listing = null;
24278
+ });
24279
+ return listing;
24280
+ },
24281
+ async resolveCandidate(nativeSessionId) {
24282
+ if (input.isClosed())
24283
+ return closed();
24284
+ try {
24285
+ const result = await input.request("adapter.sessionImport.resolve", { nativeSessionId });
24286
+ if (input.isClosed())
24287
+ return closed();
24288
+ if (!result.ok)
24289
+ return result;
24290
+ const source = brokerSessionImportSourceSchema.safeParse(result.value);
24291
+ if (!source.success || source.data.nativeRef.harnessId !== input.harnessId || source.data.candidate.nativeSessionId !== nativeSessionId)
24292
+ return invalid();
24293
+ return { ok: true, value: source.data };
24294
+ } catch (error51) {
24295
+ return { ok: false, error: input.error(error51) };
24296
+ }
24297
+ }
24298
+ };
24299
+ }
24300
+
24301
+ // ../../harness-broker/dist/paths.js
24302
+ import os4 from "node:os";
24303
+ import path10 from "node:path";
24304
+ var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
24305
+ var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
24306
+ function defaultHarnessBrokerDirectory(environment = process.env) {
24307
+ const home = environment.HOME || os4.homedir();
24308
+ return path10.join(home, ".codexhost", "harness-broker");
24309
+ }
24310
+ function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
24311
+ harnessPluginIdSchema.parse(harnessId);
24312
+ if (harnessId !== "claude-code")
24313
+ return path10.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
24314
+ return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path10.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
24315
+ }
24316
+ function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
24317
+ harnessPluginIdSchema.parse(harnessId);
24318
+ return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
24319
+ }
24320
+ function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
24321
+ const home = environment.HOME || os4.homedir();
24322
+ return path10.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
24323
+ }
24324
+
24176
24325
  // ../../harness-broker/dist/client.js
24177
24326
  function unavailable(message, retryable = true) {
24178
24327
  return { code: "unavailable", message, retryable, stage: "harnessBroker" };
@@ -24709,6 +24858,7 @@ var BrokeredHarnessAdapter = class {
24709
24858
  commandCatalog;
24710
24859
  liveCommandCatalog;
24711
24860
  harnessId;
24861
+ sessionImport;
24712
24862
  credits;
24713
24863
  refreshCredits;
24714
24864
  #descriptorPath;
@@ -24731,6 +24881,14 @@ var BrokeredHarnessAdapter = class {
24731
24881
  };
24732
24882
  constructor(input = {}) {
24733
24883
  this.harnessId = harnessPluginIdSchema.parse(input.harnessId ?? "claude-code");
24884
+ if (input.sessionImport) {
24885
+ this.sessionImport = createBrokerSessionImportCapability({
24886
+ harnessId: this.harnessId,
24887
+ request: async (method, params) => parseHarnessResult(await this.#request(method, params, method === "adapter.sessionImport.resolve")),
24888
+ isClosed: () => this.#closed,
24889
+ error: (error51) => this.#error(error51)
24890
+ });
24891
+ }
24734
24892
  if (input.accountCredits !== false) {
24735
24893
  this.credits = () => this.#credits;
24736
24894
  this.refreshCredits = () => this.#refreshAccountCredits();
@@ -24918,6 +25076,7 @@ function createHarnessAdapter(context) {
24918
25076
  if (context.platform === "darwin" && context.managedRemoteHost) {
24919
25077
  const environment2 = { ...context.environment };
24920
25078
  return new BrokeredHarnessAdapter({
25079
+ sessionImport: true,
24921
25080
  accountCredits: false,
24922
25081
  harnessId: "cursor-cli",
24923
25082
  forwardDelegationEnvironment: true,