@liberseek/boft-cli-win32-arm64 0.8.4 → 0.8.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.
@@ -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
  }
@@ -14677,6 +14677,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
14677
14677
  cachedInputTokens: count,
14678
14678
  cacheWriteInputTokens: count,
14679
14679
  cacheKnownInputTokens: count,
14680
+ cacheHitCachedInputTokens: count,
14681
+ cacheHitInputTokens: count,
14680
14682
  outputTokens: count,
14681
14683
  reasoningOutputTokens: count,
14682
14684
  /** USD at the public price, summed over the priced requests only. */
@@ -14784,6 +14786,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
14784
14786
  var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
14785
14787
  var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
14786
14788
 
14789
+ // ../../shared-contracts/dist/thread-questions.js
14790
+ var field = external_exports.discriminatedUnion("type", [
14791
+ external_exports.object({
14792
+ id: external_exports.string().min(1),
14793
+ type: external_exports.literal("choice"),
14794
+ prompt: external_exports.string(),
14795
+ options: external_exports.array(external_exports.object({
14796
+ value: external_exports.string().min(1),
14797
+ label: external_exports.string(),
14798
+ description: external_exports.string().optional()
14799
+ })).min(1),
14800
+ multiple: external_exports.boolean(),
14801
+ allowOther: external_exports.boolean(),
14802
+ optional: external_exports.boolean()
14803
+ }),
14804
+ external_exports.object({
14805
+ id: external_exports.string().min(1),
14806
+ type: external_exports.literal("text"),
14807
+ prompt: external_exports.string(),
14808
+ multiline: external_exports.boolean(),
14809
+ secret: external_exports.literal(false),
14810
+ optional: external_exports.boolean(),
14811
+ placeholder: external_exports.string().optional(),
14812
+ prefill: external_exports.string().optional()
14813
+ })
14814
+ ]);
14815
+ var threadQuestionSchema = external_exports.object({
14816
+ interactionId: external_exports.string().min(1),
14817
+ turnId: external_exports.string().min(1),
14818
+ title: external_exports.string().optional(),
14819
+ questions: external_exports.array(field).min(1)
14820
+ }).refine(({ questions }) => questions.some((q) => q.type === "choice" && q.multiple), {
14821
+ message: "Shared cards require at least one multi-select question"
14822
+ });
14823
+ var threadQuestionsListParamsSchema = external_exports.strictObject({ threadId: external_exports.string().min(1) });
14824
+ var threadQuestionsResultSchema = external_exports.object({ questions: external_exports.array(threadQuestionSchema) });
14825
+ var threadQuestionRespondParamsSchema = external_exports.strictObject({
14826
+ threadId: external_exports.string().min(1),
14827
+ turnId: external_exports.string().min(1),
14828
+ interactionId: external_exports.string().min(1),
14829
+ answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
14830
+ cancelled: external_exports.boolean().default(false)
14831
+ });
14832
+ var threadQuestionRespondResultSchema = external_exports.object({ accepted: external_exports.literal(true) });
14833
+
14787
14834
  // ../../shared-contracts/dist/harness-plugins.js
14788
14835
  var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
14789
14836
  var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
@@ -15553,7 +15600,10 @@ var harnessPluginRouteSchema = external_exports.object({
15553
15600
  harnessId: harnessPluginIdSchema,
15554
15601
  model: harnessModelRefSchema.optional(),
15555
15602
  thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
15556
- permissionModeId: harnessPermissionModeIdSchema.optional()
15603
+ permissionModeId: harnessPermissionModeIdSchema.optional(),
15604
+ /** A draft prewarm create: stays unsubmitted until the user's first Turn.
15605
+ * Desktop forwards only the Model of a main-process prewarm to thread/start. */
15606
+ prewarm: external_exports.literal(true).optional()
15557
15607
  }).strict();
15558
15608
 
15559
15609
  // ../../shared-contracts/dist/harness-launch-settings.js
@@ -16065,13 +16115,13 @@ function parseHarnessUsageEntry(value) {
16065
16115
  }
16066
16116
  if (!tokenCount(entry.inputTokens) || !tokenCount(entry.outputTokens))
16067
16117
  return null;
16068
- for (const field of [
16118
+ for (const field2 of [
16069
16119
  "cachedInputTokens",
16070
16120
  "cacheWriteInputTokens",
16071
16121
  "cacheWrite1hInputTokens",
16072
16122
  "reasoningOutputTokens"
16073
16123
  ]) {
16074
- if (entry[field] !== void 0 && !tokenCount(entry[field]))
16124
+ if (entry[field2] !== void 0 && !tokenCount(entry[field2]))
16075
16125
  return null;
16076
16126
  }
16077
16127
  const cached2 = entry.cachedInputTokens ?? 0;
@@ -16165,8 +16215,8 @@ function usage(value) {
16165
16215
  if (!row)
16166
16216
  return null;
16167
16217
  const result = { values: [], known: 0 };
16168
- for (const [i, field] of fields.entries()) {
16169
- const n = row[field];
16218
+ for (const [i, field2] of fields.entries()) {
16219
+ const n = row[field2];
16170
16220
  if (n !== void 0 && n !== null) {
16171
16221
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 0)
16172
16222
  return null;
@@ -17051,26 +17101,26 @@ function parseHostUsage(value) {
17051
17101
  }
17052
17102
  }
17053
17103
  const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
17054
- for (const field of [
17104
+ for (const field2 of [
17055
17105
  "totalCredits",
17056
17106
  "contextUsagePercent",
17057
17107
  "apiOutputTokensPerSecond"
17058
17108
  ]) {
17059
- const candidate = value[field];
17109
+ const candidate = value[field2];
17060
17110
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
17061
- throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
17111
+ throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
17062
17112
  }
17063
17113
  }
17064
- for (const field of tokenFields) {
17065
- const candidate = value[field];
17114
+ for (const field2 of tokenFields) {
17115
+ const candidate = value[field2];
17066
17116
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
17067
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
17117
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
17068
17118
  }
17069
17119
  }
17070
- for (const field of safeIntegerFields) {
17071
- const candidate = value[field];
17120
+ for (const field2 of safeIntegerFields) {
17121
+ const candidate = value[field2];
17072
17122
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
17073
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
17123
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
17074
17124
  }
17075
17125
  }
17076
17126
  if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
@@ -17079,16 +17129,16 @@ function parseHostUsage(value) {
17079
17129
  if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
17080
17130
  throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
17081
17131
  }
17082
- for (const field of ["totalCredits", "contextUsagePercent"]) {
17083
- const candidate = value[field];
17132
+ for (const field2 of ["totalCredits", "contextUsagePercent"]) {
17133
+ const candidate = value[field2];
17084
17134
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
17085
- throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
17135
+ throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
17086
17136
  }
17087
17137
  }
17088
- for (const field of percentFields) {
17089
- const candidate = value[field];
17138
+ for (const field2 of percentFields) {
17139
+ const candidate = value[field2];
17090
17140
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
17091
- throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
17141
+ throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
17092
17142
  }
17093
17143
  }
17094
17144
  if (value.sessionCacheUsage !== void 0) {
@@ -17159,19 +17209,19 @@ function parseHostUsageRequest(value) {
17159
17209
  if (typeof value.requestId !== "string" || value.requestId.length === 0) {
17160
17210
  throw new Error("Harness Usage request 'requestId' must be a non-empty string");
17161
17211
  }
17162
- for (const field of ["model", "provider"]) {
17163
- const candidate = value[field];
17212
+ for (const field2 of ["model", "provider"]) {
17213
+ const candidate = value[field2];
17164
17214
  if (candidate !== void 0 && (typeof candidate !== "string" || candidate.length === 0)) {
17165
- throw new Error(`Harness Usage request '${field}' must be a non-empty string`);
17215
+ throw new Error(`Harness Usage request '${field2}' must be a non-empty string`);
17166
17216
  }
17167
17217
  }
17168
17218
  if (value.historical !== void 0 && typeof value.historical !== "boolean") {
17169
17219
  throw new Error("Harness Usage request 'historical' must be a boolean");
17170
17220
  }
17171
- for (const field of requestTokenFields) {
17172
- const candidate = value[field];
17221
+ for (const field2 of requestTokenFields) {
17222
+ const candidate = value[field2];
17173
17223
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
17174
- throw new Error(`Harness Usage request '${field}' must be a non-negative safe integer`);
17224
+ throw new Error(`Harness Usage request '${field2}' must be a non-negative safe integer`);
17175
17225
  }
17176
17226
  }
17177
17227
  if (value.inputTokens === void 0 || value.outputTokens === void 0) {
@@ -17205,7 +17255,7 @@ function tokenSnapshot(value) {
17205
17255
  const total = object2(token.total);
17206
17256
  const last = object2(token.last);
17207
17257
  const result = {};
17208
- for (const field of [
17258
+ for (const field2 of [
17209
17259
  "totalTokens",
17210
17260
  "inputTokens",
17211
17261
  "cachedInputTokens",
@@ -17213,9 +17263,9 @@ function tokenSnapshot(value) {
17213
17263
  "outputTokens",
17214
17264
  "reasoningOutputTokens"
17215
17265
  ]) {
17216
- const n = integer2(total?.[field]);
17266
+ const n = integer2(total?.[field2]);
17217
17267
  if (n !== void 0)
17218
- result[field] = n;
17268
+ result[field2] = n;
17219
17269
  }
17220
17270
  const used = integer2(last?.totalTokens);
17221
17271
  const window = integer2(token.modelContextWindow);
@@ -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
  }
@@ -18734,6 +18734,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
18734
18734
  cachedInputTokens: count,
18735
18735
  cacheWriteInputTokens: count,
18736
18736
  cacheKnownInputTokens: count,
18737
+ cacheHitCachedInputTokens: count,
18738
+ cacheHitInputTokens: count,
18737
18739
  outputTokens: count,
18738
18740
  reasoningOutputTokens: count,
18739
18741
  /** USD at the public price, summed over the priced requests only. */
@@ -18841,6 +18843,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
18841
18843
  var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
18842
18844
  var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
18843
18845
 
18846
+ // ../../shared-contracts/dist/thread-questions.js
18847
+ var field = external_exports.discriminatedUnion("type", [
18848
+ external_exports.object({
18849
+ id: external_exports.string().min(1),
18850
+ type: external_exports.literal("choice"),
18851
+ prompt: external_exports.string(),
18852
+ options: external_exports.array(external_exports.object({
18853
+ value: external_exports.string().min(1),
18854
+ label: external_exports.string(),
18855
+ description: external_exports.string().optional()
18856
+ })).min(1),
18857
+ multiple: external_exports.boolean(),
18858
+ allowOther: external_exports.boolean(),
18859
+ optional: external_exports.boolean()
18860
+ }),
18861
+ external_exports.object({
18862
+ id: external_exports.string().min(1),
18863
+ type: external_exports.literal("text"),
18864
+ prompt: external_exports.string(),
18865
+ multiline: external_exports.boolean(),
18866
+ secret: external_exports.literal(false),
18867
+ optional: external_exports.boolean(),
18868
+ placeholder: external_exports.string().optional(),
18869
+ prefill: external_exports.string().optional()
18870
+ })
18871
+ ]);
18872
+ var threadQuestionSchema = external_exports.object({
18873
+ interactionId: external_exports.string().min(1),
18874
+ turnId: external_exports.string().min(1),
18875
+ title: external_exports.string().optional(),
18876
+ questions: external_exports.array(field).min(1)
18877
+ }).refine(({ questions }) => questions.some((q) => q.type === "choice" && q.multiple), {
18878
+ message: "Shared cards require at least one multi-select question"
18879
+ });
18880
+ var threadQuestionsListParamsSchema = external_exports.strictObject({ threadId: external_exports.string().min(1) });
18881
+ var threadQuestionsResultSchema = external_exports.object({ questions: external_exports.array(threadQuestionSchema) });
18882
+ var threadQuestionRespondParamsSchema = external_exports.strictObject({
18883
+ threadId: external_exports.string().min(1),
18884
+ turnId: external_exports.string().min(1),
18885
+ interactionId: external_exports.string().min(1),
18886
+ answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
18887
+ cancelled: external_exports.boolean().default(false)
18888
+ });
18889
+ var threadQuestionRespondResultSchema = external_exports.object({ accepted: external_exports.literal(true) });
18890
+
18844
18891
  // ../../shared-contracts/dist/harness-plugins.js
18845
18892
  var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
18846
18893
  var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
@@ -19610,7 +19657,10 @@ var harnessPluginRouteSchema = external_exports.object({
19610
19657
  harnessId: harnessPluginIdSchema,
19611
19658
  model: harnessModelRefSchema.optional(),
19612
19659
  thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
19613
- permissionModeId: harnessPermissionModeIdSchema.optional()
19660
+ permissionModeId: harnessPermissionModeIdSchema.optional(),
19661
+ /** A draft prewarm create: stays unsubmitted until the user's first Turn.
19662
+ * Desktop forwards only the Model of a main-process prewarm to thread/start. */
19663
+ prewarm: external_exports.literal(true).optional()
19614
19664
  }).strict();
19615
19665
 
19616
19666
  // ../../shared-contracts/dist/harness-launch-settings.js
@@ -27605,19 +27655,19 @@ var CopilotSession = class {
27605
27655
  }
27606
27656
  async _input(message, options2) {
27607
27657
  this.assertElicitation();
27608
- const field = { type: "string" };
27609
- if (options2?.title) field.title = options2.title;
27610
- if (options2?.description) field.description = options2.description;
27611
- if (options2?.minLength != null) field.minLength = options2.minLength;
27612
- if (options2?.maxLength != null) field.maxLength = options2.maxLength;
27613
- if (options2?.format) field.format = options2.format;
27614
- if (options2?.default != null) field.default = options2.default;
27658
+ const field2 = { type: "string" };
27659
+ if (options2?.title) field2.title = options2.title;
27660
+ if (options2?.description) field2.description = options2.description;
27661
+ if (options2?.minLength != null) field2.minLength = options2.minLength;
27662
+ if (options2?.maxLength != null) field2.maxLength = options2.maxLength;
27663
+ if (options2?.format) field2.format = options2.format;
27664
+ if (options2?.default != null) field2.default = options2.default;
27615
27665
  const result = await this.rpc.ui.elicitation({
27616
27666
  message,
27617
27667
  requestedSchema: {
27618
27668
  type: "object",
27619
27669
  properties: {
27620
- value: field
27670
+ value: field2
27621
27671
  },
27622
27672
  required: ["value"]
27623
27673
  }
@@ -28792,14 +28842,14 @@ function toolFilterListToArray(value) {
28792
28842
  }
28793
28843
  return value instanceof ToolSet ? value.toArray() : value;
28794
28844
  }
28795
- function validateToolFilterList(field, list) {
28845
+ function validateToolFilterList(field2, list) {
28796
28846
  if (!list) {
28797
28847
  return;
28798
28848
  }
28799
28849
  for (const entry of list) {
28800
28850
  if (entry === "*") {
28801
28851
  throw new Error(
28802
- `Invalid ${field} entry '*': there is no bare wildcard. Use one or more of \`new ToolSet().addBuiltIn('*')\`, \`.addMcp('*')\`, or \`.addCustom('*')\` to target a specific source.`
28852
+ `Invalid ${field2} entry '*': there is no bare wildcard. Use one or more of \`new ToolSet().addBuiltIn('*')\`, \`.addMcp('*')\`, or \`.addCustom('*')\` to target a specific source.`
28803
28853
  );
28804
28854
  }
28805
28855
  }
@@ -32210,26 +32260,26 @@ function parseHostUsage(value) {
32210
32260
  }
32211
32261
  }
32212
32262
  const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
32213
- for (const field of [
32263
+ for (const field2 of [
32214
32264
  "totalCredits",
32215
32265
  "contextUsagePercent",
32216
32266
  "apiOutputTokensPerSecond"
32217
32267
  ]) {
32218
- const candidate = value[field];
32268
+ const candidate = value[field2];
32219
32269
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
32220
- throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
32270
+ throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
32221
32271
  }
32222
32272
  }
32223
- for (const field of tokenFields) {
32224
- const candidate = value[field];
32273
+ for (const field2 of tokenFields) {
32274
+ const candidate = value[field2];
32225
32275
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
32226
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
32276
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
32227
32277
  }
32228
32278
  }
32229
- for (const field of safeIntegerFields) {
32230
- const candidate = value[field];
32279
+ for (const field2 of safeIntegerFields) {
32280
+ const candidate = value[field2];
32231
32281
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
32232
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
32282
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
32233
32283
  }
32234
32284
  }
32235
32285
  if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
@@ -32238,16 +32288,16 @@ function parseHostUsage(value) {
32238
32288
  if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
32239
32289
  throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
32240
32290
  }
32241
- for (const field of ["totalCredits", "contextUsagePercent"]) {
32242
- const candidate = value[field];
32291
+ for (const field2 of ["totalCredits", "contextUsagePercent"]) {
32292
+ const candidate = value[field2];
32243
32293
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
32244
- throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
32294
+ throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
32245
32295
  }
32246
32296
  }
32247
- for (const field of percentFields) {
32248
- const candidate = value[field];
32297
+ for (const field2 of percentFields) {
32298
+ const candidate = value[field2];
32249
32299
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
32250
- throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
32300
+ throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
32251
32301
  }
32252
32302
  }
32253
32303
  if (value.sessionCacheUsage !== void 0) {
@@ -32587,18 +32637,18 @@ function calendarDate(value) {
32587
32637
  const timestamp = Date.parse(value);
32588
32638
  return /^\d{4}-\d{2}-\d{2}$/u.test(value) && Number.isFinite(timestamp) && new Date(timestamp).toISOString().slice(0, 10) === value;
32589
32639
  }
32590
- function options(field) {
32591
- if (field.type === "boolean")
32640
+ function options(field2) {
32641
+ if (field2.type === "boolean")
32592
32642
  return [
32593
32643
  { value: "true", label: "Yes" },
32594
32644
  { value: "false", label: "No" }
32595
32645
  ];
32596
- if (field.type === "string" && "enum" in field)
32597
- return field.enum.map((value, index) => ({ value, label: field.enumNames?.[index] ?? value }));
32598
- if (field.type === "string" && "oneOf" in field)
32599
- return field.oneOf.map((option) => ({ value: option.const, label: option.title }));
32600
- if (field.type === "array") {
32601
- return "enum" in field.items ? field.items.enum.map((value) => ({ value, label: value })) : field.items.anyOf.map((option) => ({ value: option.const, label: option.title }));
32646
+ if (field2.type === "string" && "enum" in field2)
32647
+ return field2.enum.map((value, index) => ({ value, label: field2.enumNames?.[index] ?? value }));
32648
+ if (field2.type === "string" && "oneOf" in field2)
32649
+ return field2.oneOf.map((option) => ({ value: option.const, label: option.title }));
32650
+ if (field2.type === "array") {
32651
+ return "enum" in field2.items ? field2.items.enum.map((value) => ({ value, label: value })) : field2.items.anyOf.map((option) => ({ value: option.const, label: option.title }));
32602
32652
  }
32603
32653
  }
32604
32654
  function elicitationForm(context) {
@@ -32607,22 +32657,22 @@ function elicitationForm(context) {
32607
32657
  throw new CopilotOperationError("unsupported", "Copilot elicitation requires a supported primitive form; browser URL flows are unavailable.");
32608
32658
  if (schema.required?.some((id) => !Object.hasOwn(schema.properties, id)))
32609
32659
  throw new Error("Copilot form refers to an unknown required field");
32610
- const questions = Object.entries(schema.properties).map(([id, field]) => {
32660
+ const questions = Object.entries(schema.properties).map(([id, field2]) => {
32611
32661
  const allowed = /* @__PURE__ */ new Set([
32612
32662
  "type",
32613
32663
  "title",
32614
32664
  "description",
32615
32665
  "default",
32616
- ...field.type === "string" ? ["enum", "enumNames", "oneOf", "minLength", "maxLength", "format"] : field.type === "array" ? ["items", "minItems", "maxItems"] : field.type === "number" || field.type === "integer" ? ["minimum", "maximum"] : []
32666
+ ...field2.type === "string" ? ["enum", "enumNames", "oneOf", "minLength", "maxLength", "format"] : field2.type === "array" ? ["items", "minItems", "maxItems"] : field2.type === "number" || field2.type === "integer" ? ["minimum", "maximum"] : []
32617
32667
  ]);
32618
- if (Object.keys(field).some((key) => !allowed.has(key)))
32668
+ if (Object.keys(field2).some((key) => !allowed.has(key)))
32619
32669
  throw new CopilotOperationError("unsupported", "Copilot form contains an unsupported constraint.");
32620
- if ("format" in field && field.format && !["email", "uri", "date", "date-time"].includes(field.format))
32670
+ if ("format" in field2 && field2.format && !["email", "uri", "date", "date-time"].includes(field2.format))
32621
32671
  throw new CopilotOperationError("unsupported", "Copilot form contains an unsupported text format.");
32622
- if (!["string", "number", "integer", "boolean", "array"].includes(field.type))
32672
+ if (!["string", "number", "integer", "boolean", "array"].includes(field2.type))
32623
32673
  throw new CopilotOperationError("unsupported", "Copilot form field cannot be represented");
32624
- const prompt = [field.title ?? id, field.description].filter(Boolean).join("\n");
32625
- const choices = options(field);
32674
+ const prompt = [field2.title ?? id, field2.description].filter(Boolean).join("\n");
32675
+ const choices = options(field2);
32626
32676
  const optional2 = !schema.required?.includes(id);
32627
32677
  if (choices)
32628
32678
  return {
@@ -32630,7 +32680,7 @@ function elicitationForm(context) {
32630
32680
  type: "choice",
32631
32681
  prompt,
32632
32682
  options: choices,
32633
- multiple: field.type === "array",
32683
+ multiple: field2.type === "array",
32634
32684
  allowOther: false,
32635
32685
  optional: optional2
32636
32686
  };
@@ -32638,43 +32688,43 @@ function elicitationForm(context) {
32638
32688
  id,
32639
32689
  type: "text",
32640
32690
  prompt,
32641
- multiline: field.type === "string",
32691
+ multiline: field2.type === "string",
32642
32692
  secret: false,
32643
32693
  optional: optional2,
32644
- ...field.default === void 0 ? {} : { prefill: String(field.default) }
32694
+ ...field2.default === void 0 ? {} : { prefill: String(field2.default) }
32645
32695
  };
32646
32696
  });
32647
32697
  const decode3 = (response) => {
32648
32698
  if (response.cancelled)
32649
32699
  return { action: "cancel" };
32650
32700
  const content = /* @__PURE__ */ Object.create(null);
32651
- for (const [id, field] of Object.entries(schema.properties)) {
32701
+ for (const [id, field2] of Object.entries(schema.properties)) {
32652
32702
  const values = Object.hasOwn(response.answers, id) ? response.answers[id] ?? [] : [];
32653
32703
  if (!values.length)
32654
32704
  continue;
32655
32705
  const value = values[0] ?? "";
32656
- if (field.type === "array") {
32657
- if (field.minItems !== void 0 && values.length < field.minItems || field.maxItems !== void 0 && values.length > field.maxItems)
32706
+ if (field2.type === "array") {
32707
+ if (field2.minItems !== void 0 && values.length < field2.minItems || field2.maxItems !== void 0 && values.length > field2.maxItems)
32658
32708
  throw new Error("The number of choices is outside the native form's limits.");
32659
32709
  content[id] = values;
32660
32710
  continue;
32661
32711
  }
32662
- if (field.type === "boolean") {
32712
+ if (field2.type === "boolean") {
32663
32713
  content[id] = value === "true";
32664
32714
  continue;
32665
32715
  }
32666
- if (field.type === "number" || field.type === "integer") {
32716
+ if (field2.type === "number" || field2.type === "integer") {
32667
32717
  const number4 = Number(value);
32668
- 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)
32718
+ 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)
32669
32719
  throw new Error("The number is outside the native form's limits.");
32670
32720
  content[id] = number4;
32671
32721
  continue;
32672
32722
  }
32673
- if (field.type === "string") {
32674
- 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)
32723
+ if (field2.type === "string") {
32724
+ 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)
32675
32725
  throw new Error("The text length is outside the native form's limits.");
32676
- if ("format" in field && field.format) {
32677
- 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));
32726
+ if ("format" in field2 && field2.format) {
32727
+ 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));
32678
32728
  if (!valid)
32679
32729
  throw new Error("The text does not match the native form's format.");
32680
32730
  }