@qwen-code/qwen-code 0.18.1-preview.0 → 0.18.1-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +2 -1
  2. package/bundled/qc-helper/docs/features/channels/feishu.md +16 -0
  3. package/bundled/qc-helper/docs/features/mcp.md +1 -1
  4. package/bundled/qc-helper/docs/qwen-serve.md +18 -7
  5. package/bundled/review/SKILL.md +7 -3
  6. package/chunks/{agent-WK5GYOPC.js → agent-ZLVQLNIP.js} +5 -5
  7. package/chunks/{agent-headless-KZJALDQF.js → agent-headless-H4ZT46GX.js} +5 -5
  8. package/chunks/{anthropicContentGenerator-DCI26OQF.js → anthropicContentGenerator-KLBHYGH6.js} +1 -1
  9. package/chunks/{askUserQuestion-NDNFGC35.js → askUserQuestion-QPZXR3UO.js} +1 -1
  10. package/chunks/{chunk-27STU35P.js → chunk-BRU4Z5BG.js} +10 -5
  11. package/chunks/{chunk-JZFEL3RB.js → chunk-C64WAJOC.js} +1 -1
  12. package/chunks/{chunk-DYCU43TE.js → chunk-HISY5FYZ.js} +4 -4
  13. package/chunks/{chunk-E322ZT4P.js → chunk-L6F7VZPZ.js} +6 -6
  14. package/chunks/{chunk-3NRO6NHX.js → chunk-MN5RAXVB.js} +3 -3
  15. package/chunks/{chunk-RLFLJVHU.js → chunk-Q6WOQSR4.js} +2 -2
  16. package/chunks/{chunk-BW7CMDF3.js → chunk-R53CLQY7.js} +1 -1
  17. package/chunks/{chunk-26QELEL2.js → chunk-RTTAC5VW.js} +1 -1
  18. package/chunks/{chunk-Q3NN2XUW.js → chunk-UKLVRIWE.js} +1253 -1007
  19. package/chunks/{chunk-VXHYMZXW.js → chunk-VIEIRAK3.js} +1 -1
  20. package/chunks/{chunk-OT6JA3KQ.js → chunk-YJDVHAGL.js} +1 -1
  21. package/chunks/{chunk-6WPY6ES3.js → chunk-ZNUMXPNK.js} +565 -48
  22. package/chunks/{computer-use-4ELNIZMF.js → computer-use-SWC45S44.js} +5 -5
  23. package/chunks/{contextCommand-E2V26QGD.js → contextCommand-O5DLQUIZ.js} +7 -7
  24. package/chunks/{cron-create-7CXEAJ2K.js → cron-create-DQKRQMCP.js} +1 -1
  25. package/chunks/{cron-delete-2FQYYNQ6.js → cron-delete-DOFPHFTI.js} +1 -1
  26. package/chunks/{cron-list-QCAJ73XE.js → cron-list-RCVOO3CB.js} +1 -1
  27. package/chunks/{dist-PF2IYSMD.js → dist-UH7CYT7F.js} +1 -1
  28. package/chunks/{edit-IC3ECG44.js → edit-J7M33W4D.js} +6 -6
  29. package/chunks/{enter-worktree-ETQWM7BB.js → enter-worktree-RCCPIOG6.js} +5 -5
  30. package/chunks/{enterPlanMode-VL3F45RF.js → enterPlanMode-EC7HWVXV.js} +5 -5
  31. package/chunks/{exit-worktree-F5BJXBFB.js → exit-worktree-V3OVN22U.js} +5 -5
  32. package/chunks/{exitPlanMode-VOC7G5FJ.js → exitPlanMode-P3F5VTWX.js} +7 -6
  33. package/chunks/{geminiContentGenerator-7D2QZ5FE.js → geminiContentGenerator-E2LZQIFZ.js} +1 -1
  34. package/chunks/{glob-XTABUPPR.js → glob-ENPPHN24.js} +5 -5
  35. package/chunks/{grep-MRCXYH2N.js → grep-RXZMZKHV.js} +5 -5
  36. package/chunks/{ls-XVGXRYWD.js → ls-TRD77UTS.js} +1 -1
  37. package/chunks/{lsp-S6SHPULC.js → lsp-2VFWQPZS.js} +1 -1
  38. package/chunks/{monitor-LNRRNJJB.js → monitor-YYWM7RUX.js} +5 -5
  39. package/chunks/{notebook-edit-IS3UYVGM.js → notebook-edit-L6OODJTK.js} +6 -6
  40. package/chunks/{openaiContentGenerator-P772OZ6K.js → openaiContentGenerator-BPRGR5FJ.js} +5 -5
  41. package/chunks/{qwenContentGenerator-Y6YGZRHH.js → qwenContentGenerator-ENMXX47B.js} +7 -7
  42. package/chunks/{read-file-2JIJ646W.js → read-file-3VASWJKO.js} +3 -3
  43. package/chunks/{ripGrep-Z74CN4MW.js → ripGrep-67IQWCR7.js} +5 -5
  44. package/chunks/{scheduler-KFG4TT3A.js → scheduler-TAPJOQHX.js} +5 -5
  45. package/chunks/{send-message-SMNR5DBG.js → send-message-QZOC5GA2.js} +1 -1
  46. package/chunks/{serve-XDZAE3KF.js → serve-CQF2R7SG.js} +709 -26
  47. package/chunks/{shell-BTAJJJHO.js → shell-ZLBFZ75G.js} +5 -5
  48. package/chunks/{skill-LSM726DP.js → skill-BZ2NCCJN.js} +3 -3
  49. package/chunks/{src-JMUZP4A4.js → src-ASRB3EO3.js} +9 -5
  50. package/chunks/{syntheticOutput-KMNF7YG6.js → syntheticOutput-WJSUK4SZ.js} +2 -2
  51. package/chunks/{task-create-LIJHK75G.js → task-create-GGSC27HO.js} +2 -2
  52. package/chunks/{task-list-S4GNSILM.js → task-list-EDHHHSK4.js} +1 -1
  53. package/chunks/{task-stop-3GBRYJHM.js → task-stop-WR5PDVZY.js} +1 -1
  54. package/chunks/{task-update-F3UTVJMS.js → task-update-UR7NUHBV.js} +2 -2
  55. package/chunks/{team-create-S5ZBN464.js → team-create-NXTYUYLE.js} +5 -5
  56. package/chunks/{team-delete-54434EB7.js → team-delete-FC33URJK.js} +1 -1
  57. package/chunks/{todoWrite-4ENGSBUX.js → todoWrite-GO2ME7ZV.js} +1 -1
  58. package/chunks/{tool-search-NUOEJ4LF.js → tool-search-GYO3ZDMH.js} +3 -3
  59. package/chunks/{web-fetch-RHZMF3MP.js → web-fetch-NLLATYIL.js} +2 -2
  60. package/chunks/{workflow-ZI3ZXNU6.js → workflow-KZLZUDHE.js} +249 -24
  61. package/chunks/{write-file-MHQLLZWY.js → write-file-AUXVL5D2.js} +6 -6
  62. package/cli.js +543 -184
  63. package/package.json +2 -2
@@ -3231,7 +3231,7 @@ var require_compile = __commonJS({
3231
3231
  }
3232
3232
  __name(compileSchema, "compileSchema");
3233
3233
  exports.compileSchema = compileSchema;
3234
- function resolveRef(root, baseId, ref) {
3234
+ function resolveRef2(root, baseId, ref) {
3235
3235
  var _a;
3236
3236
  ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
3237
3237
  const schOrFunc = root.refs[ref];
@@ -3248,8 +3248,8 @@ var require_compile = __commonJS({
3248
3248
  return;
3249
3249
  return root.refs[ref] = inlineOrCompile.call(this, _sch);
3250
3250
  }
3251
- __name(resolveRef, "resolveRef");
3252
- exports.resolveRef = resolveRef;
3251
+ __name(resolveRef2, "resolveRef");
3252
+ exports.resolveRef = resolveRef2;
3253
3253
  function inlineOrCompile(sch) {
3254
3254
  if ((0, resolve_1.inlineRef)(sch.schema, this.opts.inlineRefs))
3255
3255
  return sch.schema;
@@ -11098,7 +11098,7 @@ var require_compile2 = __commonJS({
11098
11098
  }
11099
11099
  __name(compileSchema, "compileSchema");
11100
11100
  exports.compileSchema = compileSchema;
11101
- function resolveRef(root, baseId, ref) {
11101
+ function resolveRef2(root, baseId, ref) {
11102
11102
  var _a;
11103
11103
  ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
11104
11104
  const schOrFunc = root.refs[ref];
@@ -11115,8 +11115,8 @@ var require_compile2 = __commonJS({
11115
11115
  return;
11116
11116
  return root.refs[ref] = inlineOrCompile.call(this, _sch);
11117
11117
  }
11118
- __name(resolveRef, "resolveRef");
11119
- exports.resolveRef = resolveRef;
11118
+ __name(resolveRef2, "resolveRef");
11119
+ exports.resolveRef = resolveRef2;
11120
11120
  function inlineOrCompile(sch) {
11121
11121
  if ((0, resolve_1.inlineRef)(sch.schema, this.opts.inlineRefs))
11122
11122
  return sch.schema;
@@ -14284,10 +14284,17 @@ var SchemaValidator = class {
14284
14284
  if (!valid && validate.errors) {
14285
14285
  fixBooleanValues(
14286
14286
  data,
14287
+ anySchema,
14288
+ anySchema
14289
+ );
14290
+ fixStringValues(
14291
+ data,
14292
+ anySchema,
14287
14293
  anySchema
14288
14294
  );
14289
14295
  fixStringifiedJsonValues(
14290
14296
  data,
14297
+ anySchema,
14291
14298
  anySchema
14292
14299
  );
14293
14300
  fixNumericValues(
@@ -14302,49 +14309,371 @@ var SchemaValidator = class {
14302
14309
  return null;
14303
14310
  }
14304
14311
  };
14305
- function getAcceptedTypes(propSchema) {
14306
- const types = /* @__PURE__ */ new Set();
14307
- if (typeof propSchema["type"] === "string") {
14308
- types.add(propSchema["type"]);
14309
- } else if (Array.isArray(propSchema["type"])) {
14310
- for (const t of propSchema["type"]) {
14311
- types.add(t);
14312
+ function resolveRef(ref, rootSchema) {
14313
+ if (!ref.startsWith("#/")) return null;
14314
+ const parts = ref.slice(2).split("/");
14315
+ let current = rootSchema;
14316
+ for (const rawPart of parts) {
14317
+ if (current == null || typeof current !== "object") return null;
14318
+ const part = rawPart.replace(/~1/g, "/").replace(/~0/g, "~");
14319
+ if (!Object.hasOwn(current, part)) return null;
14320
+ current = current[part];
14321
+ }
14322
+ if (current != null && typeof current === "object" && !Array.isArray(current)) {
14323
+ return current;
14324
+ }
14325
+ return null;
14326
+ }
14327
+ __name(resolveRef, "resolveRef");
14328
+ function resolvePropSchema(propSchema, rootSchema) {
14329
+ if (!propSchema) return void 0;
14330
+ let schema = propSchema;
14331
+ let depth = 0;
14332
+ while (typeof schema["$ref"] === "string" && depth < 64) {
14333
+ depth++;
14334
+ const resolved = resolveRef(schema["$ref"], rootSchema);
14335
+ if (!resolved) return propSchema;
14336
+ schema = resolved;
14337
+ }
14338
+ return schema;
14339
+ }
14340
+ __name(resolvePropSchema, "resolvePropSchema");
14341
+ function resolveArrayElementSchema(parentSchema, rootSchema, index) {
14342
+ const prefixItems = parentSchema["prefixItems"];
14343
+ if (prefixItems && index < prefixItems.length) {
14344
+ const entry = prefixItems[index];
14345
+ if (typeof entry === "object" && entry !== null && !Array.isArray(entry)) {
14346
+ return resolvePropSchema(entry, rootSchema);
14347
+ }
14348
+ return void 0;
14349
+ }
14350
+ const itemsSchema = parentSchema["items"];
14351
+ if (itemsSchema) {
14352
+ return resolvePropSchema(itemsSchema, rootSchema);
14353
+ }
14354
+ return void 0;
14355
+ }
14356
+ __name(resolveArrayElementSchema, "resolveArrayElementSchema");
14357
+ function getCompositionVariants(schema, rootSchema) {
14358
+ const variants = [];
14359
+ for (const keyword of ["allOf", "anyOf", "oneOf"]) {
14360
+ const val = schema[keyword];
14361
+ if (Array.isArray(val)) {
14362
+ for (const item of val) {
14363
+ if (typeof item === "object" && item != null && !Array.isArray(item)) {
14364
+ const resolved = rootSchema ? resolvePropSchema(item, rootSchema) : item;
14365
+ if (resolved) variants.push(resolved);
14366
+ }
14367
+ }
14312
14368
  }
14313
14369
  }
14314
- for (const keyword of ["anyOf", "oneOf"]) {
14315
- const variants = propSchema[keyword];
14316
- if (Array.isArray(variants)) {
14317
- for (const variant of variants) {
14318
- if (typeof variant["type"] === "string") {
14319
- types.add(variant["type"]);
14320
- } else if (Array.isArray(variant["type"])) {
14321
- for (const t of variant["type"]) {
14322
- types.add(t);
14370
+ return variants;
14371
+ }
14372
+ __name(getCompositionVariants, "getCompositionVariants");
14373
+ function schemaHasObjectShape(schema, rootSchema) {
14374
+ if (schema["properties"] || schema["additionalProperties"]) return true;
14375
+ for (const variant of getCompositionVariants(schema, rootSchema)) {
14376
+ if (variant["properties"] || variant["additionalProperties"]) return true;
14377
+ }
14378
+ return false;
14379
+ }
14380
+ __name(schemaHasObjectShape, "schemaHasObjectShape");
14381
+ var DANGEROUS_PROP_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
14382
+ function getEffectiveProperties(schema, rootSchema) {
14383
+ const merged = /* @__PURE__ */ Object.create(null);
14384
+ for (const variant of getCompositionVariants(schema, rootSchema)) {
14385
+ const variantProps = variant["properties"];
14386
+ if (variantProps) {
14387
+ for (const [k, v] of Object.entries(variantProps)) {
14388
+ if (DANGEROUS_PROP_KEYS.has(k)) continue;
14389
+ if (!Object.hasOwn(merged, k)) merged[k] = v;
14390
+ }
14391
+ }
14392
+ }
14393
+ const topProps = schema["properties"];
14394
+ if (topProps) {
14395
+ for (const [k, v] of Object.entries(topProps)) {
14396
+ if (DANGEROUS_PROP_KEYS.has(k)) continue;
14397
+ merged[k] = v;
14398
+ }
14399
+ }
14400
+ return Object.keys(merged).length > 0 ? merged : void 0;
14401
+ }
14402
+ __name(getEffectiveProperties, "getEffectiveProperties");
14403
+ function getAcceptedTypes(propSchema, rootSchema, depth = 0, cache = /* @__PURE__ */ new WeakMap()) {
14404
+ if (depth > 64) return null;
14405
+ let schema = propSchema;
14406
+ if (typeof schema["$ref"] === "string" && rootSchema) {
14407
+ const resolved = resolvePropSchema(propSchema, rootSchema);
14408
+ if (!resolved || typeof resolved["$ref"] === "string") {
14409
+ return null;
14410
+ }
14411
+ schema = resolved;
14412
+ }
14413
+ const cacheable = typeof schema === "object" && schema !== null;
14414
+ if (cacheable) {
14415
+ const cached = cache.get(schema);
14416
+ if (cached !== void 0) return cached;
14417
+ }
14418
+ const types = /* @__PURE__ */ new Set();
14419
+ if (typeof schema === "object" && schema !== null) {
14420
+ if (typeof schema["type"] === "string") {
14421
+ types.add(schema["type"]);
14422
+ } else if (Array.isArray(schema["type"])) {
14423
+ for (const t of schema["type"]) {
14424
+ types.add(t);
14425
+ }
14426
+ }
14427
+ for (const keyword of ["anyOf", "oneOf", "allOf"]) {
14428
+ const variants = schema[keyword];
14429
+ if (Array.isArray(variants)) {
14430
+ for (const variant of variants) {
14431
+ const nested = getAcceptedTypes(
14432
+ variant,
14433
+ rootSchema,
14434
+ depth + 1,
14435
+ cache
14436
+ );
14437
+ if (nested) {
14438
+ for (const t of nested) {
14439
+ types.add(t);
14440
+ }
14323
14441
  }
14324
14442
  }
14325
14443
  }
14326
14444
  }
14327
14445
  }
14328
- return types.size > 0 ? types : null;
14446
+ const result = types.size > 0 ? types : null;
14447
+ if (cacheable) cache.set(schema, result);
14448
+ return result;
14329
14449
  }
14330
14450
  __name(getAcceptedTypes, "getAcceptedTypes");
14331
- function fixStringifiedJsonValues(data, schema) {
14332
- const properties = schema["properties"];
14333
- if (!properties) return;
14451
+ function valueToSchemaType(value) {
14452
+ if (value === null) return "null";
14453
+ if (typeof value === "boolean") return "boolean";
14454
+ if (typeof value === "bigint") return "integer";
14455
+ if (typeof value === "number") {
14456
+ if (!Number.isFinite(value)) return null;
14457
+ return Number.isInteger(value) ? "integer" : "number";
14458
+ }
14459
+ if (typeof value === "string") return "string";
14460
+ if (Array.isArray(value)) return "array";
14461
+ if (typeof value === "object") return "object";
14462
+ return null;
14463
+ }
14464
+ __name(valueToSchemaType, "valueToSchemaType");
14465
+ function typeIsAccepted(valueType, accepted) {
14466
+ if (accepted.has(valueType)) return true;
14467
+ if (valueType === "integer" && accepted.has("number")) return true;
14468
+ return false;
14469
+ }
14470
+ __name(typeIsAccepted, "typeIsAccepted");
14471
+ function fixStringifiedJsonValuesInArray(array, itemsSchema, root, key) {
14472
+ if (Array.isArray(itemsSchema["prefixItems"])) {
14473
+ for (let i = 0; i < array.length; i++) {
14474
+ const elSchema = resolveArrayElementSchema(itemsSchema, root, i);
14475
+ if (!elSchema) continue;
14476
+ const item = array[i];
14477
+ if (typeof item !== "string") continue;
14478
+ const trimmed = item.trim();
14479
+ if (trimmed.startsWith("[") && trimmed.endsWith("]") || trimmed.startsWith("{") && trimmed.endsWith("}")) {
14480
+ const elAccepted = getAcceptedTypes(elSchema, root);
14481
+ if (elAccepted && !elAccepted.has("string")) {
14482
+ try {
14483
+ const parsed = JSON.parse(trimmed);
14484
+ const parsedType = Array.isArray(parsed) ? "array" : typeof parsed;
14485
+ if (elAccepted.has(parsedType)) {
14486
+ debugLogger.debug(
14487
+ `coercion: ${key}[${i}] = ${String(item)} \u2192 ${JSON.stringify(parsed)} (accepted: ${[...elAccepted].join("|")})`
14488
+ );
14489
+ array[i] = parsed;
14490
+ }
14491
+ } catch {
14492
+ }
14493
+ }
14494
+ }
14495
+ }
14496
+ return;
14497
+ }
14498
+ const resolvedItems = resolvePropSchema(itemsSchema, root);
14499
+ if (!resolvedItems) return;
14500
+ const innerItems = resolvedItems["items"];
14501
+ const resolvedInner = innerItems ? resolvePropSchema(innerItems, root) : void 0;
14502
+ const itemsAccepted = resolvedInner ? getAcceptedTypes(resolvedInner, root) : null;
14503
+ if (!itemsAccepted || itemsAccepted.has("string")) return;
14504
+ for (let i = 0; i < array.length; i++) {
14505
+ const item = array[i];
14506
+ if (typeof item !== "string") continue;
14507
+ const trimmed = item.trim();
14508
+ if (trimmed.startsWith("[") && trimmed.endsWith("]") || trimmed.startsWith("{") && trimmed.endsWith("}")) {
14509
+ try {
14510
+ const parsed = JSON.parse(trimmed);
14511
+ const parsedType = Array.isArray(parsed) ? "array" : typeof parsed;
14512
+ if (itemsAccepted.has(parsedType)) {
14513
+ debugLogger.debug(
14514
+ `coercion: ${key}[${i}] = ${String(item)} \u2192 ${JSON.stringify(parsed)} (accepted: ${[...itemsAccepted].join("|")})`
14515
+ );
14516
+ array[i] = parsed;
14517
+ }
14518
+ } catch {
14519
+ }
14520
+ }
14521
+ }
14522
+ }
14523
+ __name(fixStringifiedJsonValuesInArray, "fixStringifiedJsonValuesInArray");
14524
+ function fixStringifiedJsonValues(data, schema, rootSchema, depth = 0) {
14525
+ if (depth > 64) return;
14526
+ const root = rootSchema ?? schema;
14527
+ const properties = getEffectiveProperties(schema, root);
14528
+ if (!properties && !schema["additionalProperties"]) return;
14334
14529
  for (const key of Object.keys(data)) {
14335
14530
  const value = data[key];
14336
- const propSchema = properties[key];
14337
- if (!propSchema || typeof value !== "string") continue;
14531
+ const additionalProps = schema["additionalProperties"];
14532
+ const propSchema = properties?.[key] ?? (typeof additionalProps === "object" && additionalProps !== null ? additionalProps : void 0);
14533
+ if (!propSchema) continue;
14534
+ const resolved = resolvePropSchema(
14535
+ propSchema,
14536
+ root
14537
+ );
14538
+ if (!resolved) continue;
14539
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
14540
+ if (schemaHasObjectShape(resolved, root)) {
14541
+ fixStringifiedJsonValues(
14542
+ value,
14543
+ resolved,
14544
+ root,
14545
+ depth + 1
14546
+ );
14547
+ }
14548
+ continue;
14549
+ }
14550
+ if (Array.isArray(value)) {
14551
+ if (Array.isArray(resolved["prefixItems"])) {
14552
+ for (let i = 0; i < value.length; i++) {
14553
+ const elSchema = resolveArrayElementSchema(resolved, root, i);
14554
+ if (!elSchema) continue;
14555
+ const item = value[i];
14556
+ if (typeof item === "object" && item !== null && !Array.isArray(item)) {
14557
+ if (schemaHasObjectShape(elSchema, root)) {
14558
+ fixStringifiedJsonValues(
14559
+ item,
14560
+ elSchema,
14561
+ root,
14562
+ depth + 1
14563
+ );
14564
+ }
14565
+ } else if (Array.isArray(item)) {
14566
+ if (elSchema["type"] === "array" || elSchema["items"] || elSchema["prefixItems"]) {
14567
+ fixStringifiedJsonValuesInArray(item, elSchema, root, key);
14568
+ }
14569
+ } else if (typeof item === "string") {
14570
+ const elAccepted = getAcceptedTypes(elSchema, root);
14571
+ if (elAccepted && !elAccepted.has("string")) {
14572
+ const trimmed2 = item.trim();
14573
+ if (trimmed2.startsWith("[") && trimmed2.endsWith("]") || trimmed2.startsWith("{") && trimmed2.endsWith("}")) {
14574
+ try {
14575
+ const parsed = JSON.parse(trimmed2);
14576
+ const parsedType = Array.isArray(parsed) ? "array" : typeof parsed;
14577
+ if (elAccepted.has(parsedType)) {
14578
+ debugLogger.debug(
14579
+ `coercion: ${key}[${i}] = ${String(item)} \u2192 ${JSON.stringify(parsed)} (accepted: ${[...elAccepted].join("|")})`
14580
+ );
14581
+ value[i] = parsed;
14582
+ }
14583
+ } catch {
14584
+ }
14585
+ }
14586
+ }
14587
+ }
14588
+ }
14589
+ } else {
14590
+ const itemsSchema = resolved["items"];
14591
+ if (itemsSchema) {
14592
+ const resolvedItems = resolvePropSchema(itemsSchema, root);
14593
+ if (!resolvedItems) continue;
14594
+ if (schemaHasObjectShape(resolvedItems, root)) {
14595
+ const itemsAccepted = getAcceptedTypes(resolvedItems, root);
14596
+ for (let i = 0; i < value.length; i++) {
14597
+ const item = value[i];
14598
+ if (typeof item === "object" && item !== null && !Array.isArray(item)) {
14599
+ fixStringifiedJsonValues(
14600
+ item,
14601
+ resolvedItems,
14602
+ root,
14603
+ depth + 1
14604
+ );
14605
+ } else if (typeof item === "string" && itemsAccepted && !itemsAccepted.has("string")) {
14606
+ const trimmed2 = item.trim();
14607
+ if (trimmed2.startsWith("{") && trimmed2.endsWith("}") || trimmed2.startsWith("[") && trimmed2.endsWith("]")) {
14608
+ try {
14609
+ const parsed = JSON.parse(trimmed2);
14610
+ if (itemsAccepted.has(
14611
+ Array.isArray(parsed) ? "array" : typeof parsed
14612
+ )) {
14613
+ debugLogger.debug(
14614
+ `coercion: ${key}[${i}] = ${String(item)} \u2192 ${JSON.stringify(parsed)} (accepted: ${[...itemsAccepted].join("|")})`
14615
+ );
14616
+ value[i] = parsed;
14617
+ }
14618
+ } catch {
14619
+ }
14620
+ }
14621
+ }
14622
+ }
14623
+ } else if (resolvedItems["type"] === "array" || resolvedItems["items"] || resolvedItems["prefixItems"]) {
14624
+ for (const subArray of value) {
14625
+ if (Array.isArray(subArray)) {
14626
+ fixStringifiedJsonValuesInArray(
14627
+ subArray,
14628
+ resolvedItems,
14629
+ root,
14630
+ key
14631
+ );
14632
+ }
14633
+ }
14634
+ } else {
14635
+ const itemsAccepted = getAcceptedTypes(resolvedItems, root);
14636
+ if (itemsAccepted && !itemsAccepted.has("string")) {
14637
+ for (let i = 0; i < value.length; i++) {
14638
+ const item = value[i];
14639
+ if (typeof item !== "string") continue;
14640
+ const trimmed2 = item.trim();
14641
+ if (trimmed2.startsWith("[") && trimmed2.endsWith("]") || trimmed2.startsWith("{") && trimmed2.endsWith("}")) {
14642
+ try {
14643
+ const parsed = JSON.parse(trimmed2);
14644
+ const parsedType = Array.isArray(parsed) ? "array" : typeof parsed;
14645
+ if (itemsAccepted.has(parsedType)) {
14646
+ debugLogger.debug(
14647
+ `coercion: ${key}[${i}] = ${String(item)} \u2192 ${JSON.stringify(parsed)} (accepted: ${[...itemsAccepted].join("|")})`
14648
+ );
14649
+ value[i] = parsed;
14650
+ }
14651
+ } catch {
14652
+ }
14653
+ }
14654
+ }
14655
+ }
14656
+ }
14657
+ }
14658
+ }
14659
+ continue;
14660
+ }
14661
+ if (typeof value !== "string") continue;
14338
14662
  const trimmed = value.trim();
14339
14663
  if (trimmed.startsWith("[") && trimmed.endsWith("]") || trimmed.startsWith("{") && trimmed.endsWith("}")) {
14340
- const accepted = getAcceptedTypes(propSchema);
14664
+ const accepted = getAcceptedTypes(resolved, root);
14341
14665
  if (!accepted) continue;
14342
14666
  if (accepted.has("string")) continue;
14343
- if (!accepted.has("array") && !accepted.has("object")) continue;
14667
+ if (!accepted.has("array") && !accepted.has("object")) {
14668
+ continue;
14669
+ }
14344
14670
  try {
14345
14671
  const parsed = JSON.parse(trimmed);
14346
14672
  const parsedType = Array.isArray(parsed) ? "array" : typeof parsed;
14347
14673
  if (accepted.has(parsedType)) {
14674
+ debugLogger.debug(
14675
+ `coercion: ${key} = ${String(value)} \u2192 ${JSON.stringify(parsed)} (accepted: ${[...accepted].join("|")})`
14676
+ );
14348
14677
  data[key] = parsed;
14349
14678
  }
14350
14679
  } catch {
@@ -14381,31 +14710,219 @@ function fixNumericValues(data, schema) {
14381
14710
  }
14382
14711
  }
14383
14712
  __name(fixNumericValues, "fixNumericValues");
14384
- function fixBooleanValues(data, schema) {
14385
- const properties = schema?.["properties"];
14386
- const items = schema?.["items"];
14713
+ function fixBooleanValues(data, schema, rootSchema, depth = 0) {
14714
+ if (depth > 64) return;
14715
+ const root = rootSchema ?? schema;
14716
+ const properties = getEffectiveProperties(schema, root);
14717
+ if (!properties && !schema["additionalProperties"]) return;
14387
14718
  for (const key of Object.keys(data)) {
14388
- if (!(key in data)) continue;
14389
14719
  const value = data[key];
14390
- const childSchema = Array.isArray(data) ? items : properties?.[key];
14720
+ const additionalProps = schema["additionalProperties"];
14721
+ const propSchema = properties?.[key] ?? (typeof additionalProps === "object" && additionalProps !== null ? additionalProps : void 0);
14722
+ const resolved = propSchema ? resolvePropSchema(propSchema, root) : void 0;
14391
14723
  if (typeof value === "object" && value !== null) {
14392
- fixBooleanValues(value, childSchema);
14724
+ if (Array.isArray(value)) {
14725
+ if (Array.isArray(resolved?.["prefixItems"])) {
14726
+ for (let i = 0; i < value.length; i++) {
14727
+ const elSchema = resolveArrayElementSchema(resolved, root, i);
14728
+ if (!elSchema) continue;
14729
+ const item = value[i];
14730
+ if (typeof item === "object" && item !== null && !Array.isArray(item)) {
14731
+ if (schemaHasObjectShape(elSchema, root)) {
14732
+ fixBooleanValues(
14733
+ item,
14734
+ elSchema,
14735
+ root,
14736
+ depth + 1
14737
+ );
14738
+ }
14739
+ } else if (typeof item === "string") {
14740
+ const elAccepted = getAcceptedTypes(elSchema, root);
14741
+ if (elAccepted?.has("boolean") && !elAccepted.has("string")) {
14742
+ const lower = item.toLowerCase();
14743
+ if (lower === "true" || lower === "false") {
14744
+ debugLogger.debug(
14745
+ `coercion: ${key}[${i}] = ${JSON.stringify(item)} \u2192 ${lower === "true"} (accepted: ${[...elAccepted].join("|")})`
14746
+ );
14747
+ value[i] = lower === "true";
14748
+ }
14749
+ }
14750
+ }
14751
+ }
14752
+ } else {
14753
+ const itemsSchema = resolved?.["items"];
14754
+ if (itemsSchema) {
14755
+ const resolvedItems = resolvePropSchema(itemsSchema, root);
14756
+ if (!resolvedItems) continue;
14757
+ if (schemaHasObjectShape(resolvedItems, root)) {
14758
+ for (const item of value) {
14759
+ if (typeof item === "object" && item !== null && !Array.isArray(item)) {
14760
+ fixBooleanValues(
14761
+ item,
14762
+ resolvedItems,
14763
+ root,
14764
+ depth + 1
14765
+ );
14766
+ }
14767
+ }
14768
+ } else {
14769
+ const itemsAccepted = getAcceptedTypes(resolvedItems, root);
14770
+ if (itemsAccepted?.has("boolean") && !itemsAccepted.has("string")) {
14771
+ for (let i = 0; i < value.length; i++) {
14772
+ const item = value[i];
14773
+ if (typeof item === "string") {
14774
+ const lower = item.toLowerCase();
14775
+ if (lower === "true" || lower === "false") {
14776
+ debugLogger.debug(
14777
+ `coercion: ${key}[${i}] = ${JSON.stringify(item)} \u2192 ${lower === "true"} (accepted: ${[...itemsAccepted].join("|")})`
14778
+ );
14779
+ value[i] = lower === "true";
14780
+ }
14781
+ }
14782
+ }
14783
+ }
14784
+ }
14785
+ }
14786
+ }
14787
+ } else {
14788
+ if (resolved && schemaHasObjectShape(resolved, root)) {
14789
+ fixBooleanValues(
14790
+ value,
14791
+ resolved,
14792
+ root,
14793
+ depth + 1
14794
+ );
14795
+ }
14796
+ }
14393
14797
  continue;
14394
14798
  }
14395
- if (typeof value !== "string") continue;
14396
- const accepted = childSchema ? getAcceptedTypes(childSchema) : null;
14397
- if (!accepted || accepted.has("string") || !accepted.has("boolean")) {
14799
+ if (typeof value === "string") {
14800
+ const lower = value.toLowerCase();
14801
+ if (lower !== "true" && lower !== "false") continue;
14802
+ const accepted = resolved ? getAcceptedTypes(resolved, root) : null;
14803
+ if (accepted?.has("boolean") && !accepted.has("string")) {
14804
+ debugLogger.debug(
14805
+ `coercion: ${key} = ${JSON.stringify(value)} \u2192 ${lower === "true"} (accepted: ${[...accepted].join("|")})`
14806
+ );
14807
+ data[key] = lower === "true";
14808
+ }
14809
+ }
14810
+ }
14811
+ }
14812
+ __name(fixBooleanValues, "fixBooleanValues");
14813
+ function fixStringValues(data, schema, rootSchema, depth = 0) {
14814
+ if (depth > 64) return;
14815
+ const root = rootSchema ?? schema;
14816
+ const properties = getEffectiveProperties(schema, root);
14817
+ if (!properties && !schema["additionalProperties"]) return;
14818
+ for (const key of Object.keys(data)) {
14819
+ const value = data[key];
14820
+ const additionalProps = schema["additionalProperties"];
14821
+ const propSchema = properties?.[key] ?? (typeof additionalProps === "object" && additionalProps !== null ? additionalProps : void 0);
14822
+ if (!propSchema) continue;
14823
+ const resolved = resolvePropSchema(
14824
+ propSchema,
14825
+ root
14826
+ );
14827
+ if (!resolved) continue;
14828
+ if (typeof value === "object" && value !== null) {
14829
+ if (Array.isArray(value)) {
14830
+ if (Array.isArray(resolved["prefixItems"])) {
14831
+ let coerced;
14832
+ for (let i = 0; i < value.length; i++) {
14833
+ const elSchema = resolveArrayElementSchema(resolved, root, i);
14834
+ if (!elSchema) continue;
14835
+ const item = value[i];
14836
+ if (typeof item === "object" && item !== null && !Array.isArray(item)) {
14837
+ if (schemaHasObjectShape(elSchema, root)) {
14838
+ fixStringValues(
14839
+ item,
14840
+ elSchema,
14841
+ root,
14842
+ depth + 1
14843
+ );
14844
+ }
14845
+ } else if (item !== null && item !== void 0 && (typeof item === "number" || typeof item === "boolean" || typeof item === "bigint")) {
14846
+ const elAccepted = getAcceptedTypes(elSchema, root);
14847
+ if (elAccepted?.has("string")) {
14848
+ const currentType = valueToSchemaType(item);
14849
+ if (currentType && !typeIsAccepted(currentType, elAccepted)) {
14850
+ coerced ??= [...value];
14851
+ debugLogger.debug(
14852
+ `coercion: ${key}[${i}] = ${String(item)} \u2192 ${JSON.stringify(String(item))} (accepted: ${[...elAccepted].join("|")})`
14853
+ );
14854
+ coerced[i] = String(item);
14855
+ }
14856
+ }
14857
+ }
14858
+ }
14859
+ if (coerced) data[key] = coerced;
14860
+ } else {
14861
+ const itemsSchema = resolved["items"];
14862
+ if (itemsSchema) {
14863
+ const resolvedItems = resolvePropSchema(itemsSchema, root);
14864
+ if (resolvedItems) {
14865
+ if (schemaHasObjectShape(resolvedItems, root)) {
14866
+ for (const item of value) {
14867
+ if (typeof item === "object" && item !== null && !Array.isArray(item)) {
14868
+ fixStringValues(
14869
+ item,
14870
+ resolvedItems,
14871
+ root,
14872
+ depth + 1
14873
+ );
14874
+ }
14875
+ }
14876
+ } else {
14877
+ const itemsAccepted = getAcceptedTypes(resolvedItems, root);
14878
+ if (itemsAccepted?.has("string")) {
14879
+ let coerced;
14880
+ for (let i = 0; i < value.length; i++) {
14881
+ const item = value[i];
14882
+ if (item !== null && item !== void 0 && (typeof item === "number" || typeof item === "boolean" || typeof item === "bigint")) {
14883
+ const currentType = valueToSchemaType(item);
14884
+ if (currentType && !typeIsAccepted(currentType, itemsAccepted)) {
14885
+ coerced ??= [...value];
14886
+ debugLogger.debug(
14887
+ `coercion: ${key}[${i}] = ${String(item)} \u2192 ${JSON.stringify(String(item))} (accepted: ${[...itemsAccepted].join("|")})`
14888
+ );
14889
+ coerced[i] = String(item);
14890
+ }
14891
+ }
14892
+ }
14893
+ if (coerced) data[key] = coerced;
14894
+ }
14895
+ }
14896
+ }
14897
+ }
14898
+ }
14899
+ } else {
14900
+ if (schemaHasObjectShape(resolved, root)) {
14901
+ fixStringValues(
14902
+ value,
14903
+ resolved,
14904
+ root,
14905
+ depth + 1
14906
+ );
14907
+ }
14908
+ }
14398
14909
  continue;
14399
14910
  }
14400
- const lower = value.toLowerCase();
14401
- if (lower === "true") {
14402
- data[key] = true;
14403
- } else if (lower === "false") {
14404
- data[key] = false;
14911
+ if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
14912
+ const accepted = getAcceptedTypes(resolved, root);
14913
+ if (accepted?.has("string")) {
14914
+ const currentType = valueToSchemaType(value);
14915
+ if (currentType && !typeIsAccepted(currentType, accepted)) {
14916
+ debugLogger.debug(
14917
+ `coercion: ${key} = ${String(value)} \u2192 ${JSON.stringify(String(value))} (accepted: ${[...accepted].join("|")})`
14918
+ );
14919
+ data[key] = String(value);
14920
+ }
14921
+ }
14405
14922
  }
14406
14923
  }
14407
14924
  }
14408
- __name(fixBooleanValues, "fixBooleanValues");
14925
+ __name(fixStringValues, "fixStringValues");
14409
14926
 
14410
14927
  // packages/core/src/agents/runtime/agent-statistics.ts
14411
14928
  init_esbuild_shims();
@@ -14801,7 +15318,7 @@ function isTool(obj) {
14801
15318
  }
14802
15319
  __name(isTool, "isTool");
14803
15320
  function hasCycleInSchema(schema) {
14804
- function resolveRef(ref) {
15321
+ function resolveRef2(ref) {
14805
15322
  if (!ref.startsWith("#/")) {
14806
15323
  return null;
14807
15324
  }
@@ -14815,7 +15332,7 @@ function hasCycleInSchema(schema) {
14815
15332
  }
14816
15333
  return current;
14817
15334
  }
14818
- __name(resolveRef, "resolveRef");
15335
+ __name(resolveRef2, "resolveRef");
14819
15336
  function traverse(node, visitedRefs, pathRefs) {
14820
15337
  if (typeof node !== "object" || node === null) {
14821
15338
  return false;
@@ -14836,7 +15353,7 @@ function hasCycleInSchema(schema) {
14836
15353
  if (visitedRefs.has(ref)) {
14837
15354
  return false;
14838
15355
  }
14839
- const resolvedNode = resolveRef(ref);
15356
+ const resolvedNode = resolveRef2(ref);
14840
15357
  if (resolvedNode) {
14841
15358
  visitedRefs.add(ref);
14842
15359
  pathRefs.add(ref);