@pixerate/editor 0.22.0 → 0.24.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.
Files changed (188) hide show
  1. package/README.md +175 -2
  2. package/THIRD_PARTY_NOTICES.md +139 -0
  3. package/dist/agent/index.cjs +87 -111
  4. package/dist/agent/index.cjs.map +1 -1
  5. package/dist/agent/index.d.cts +70 -211
  6. package/dist/agent/index.d.ts +70 -211
  7. package/dist/agent/index.js +78 -102
  8. package/dist/agent/index.js.map +1 -1
  9. package/dist/arrangeShortcuts-B8O3f8-P.d.cts +184 -0
  10. package/dist/arrangeShortcuts-sLlD2rSX.d.ts +184 -0
  11. package/dist/canvas/index.cjs +2075 -86
  12. package/dist/canvas/index.cjs.map +1 -1
  13. package/dist/canvas/index.d.cts +608 -186
  14. package/dist/canvas/index.d.ts +608 -186
  15. package/dist/canvas/index.js +2060 -71
  16. package/dist/canvas/index.js.map +1 -1
  17. package/dist/chunk-26BVFKHU.cjs +453 -0
  18. package/dist/chunk-26BVFKHU.cjs.map +1 -0
  19. package/dist/chunk-2H7ZHPEJ.js +762 -0
  20. package/dist/chunk-2H7ZHPEJ.js.map +1 -0
  21. package/dist/{chunk-DENSCKFC.js → chunk-3CN2WD3X.js} +1730 -189
  22. package/dist/chunk-3CN2WD3X.js.map +1 -0
  23. package/dist/{chunk-JJDLPEWL.js → chunk-3LV6RRPH.js} +2 -2
  24. package/dist/{chunk-MJZBNWG7.js → chunk-5S3Z4PPF.js} +78 -557
  25. package/dist/chunk-5S3Z4PPF.js.map +1 -0
  26. package/dist/chunk-664LQYFJ.js +115 -0
  27. package/dist/chunk-664LQYFJ.js.map +1 -0
  28. package/dist/chunk-7DWMJCAT.js +453 -0
  29. package/dist/chunk-7DWMJCAT.js.map +1 -0
  30. package/dist/chunk-ARRTP33I.js +101 -0
  31. package/dist/chunk-ARRTP33I.js.map +1 -0
  32. package/dist/chunk-CPOKFNBG.cjs +101 -0
  33. package/dist/chunk-CPOKFNBG.cjs.map +1 -0
  34. package/dist/{chunk-AA4ZEVCC.cjs → chunk-D27YFC46.cjs} +101 -580
  35. package/dist/chunk-D27YFC46.cjs.map +1 -0
  36. package/dist/chunk-D6FH2YAX.cjs +131 -0
  37. package/dist/chunk-D6FH2YAX.cjs.map +1 -0
  38. package/dist/{chunk-4SUNJZWB.cjs → chunk-FD4LPFAE.cjs} +48 -200
  39. package/dist/chunk-FD4LPFAE.cjs.map +1 -0
  40. package/dist/chunk-FODNLX5N.js +749 -0
  41. package/dist/chunk-FODNLX5N.js.map +1 -0
  42. package/dist/{chunk-OYXSKQFR.js → chunk-FPENXAEJ.js} +35 -187
  43. package/dist/chunk-FPENXAEJ.js.map +1 -0
  44. package/dist/chunk-G2I4QJOT.cjs +762 -0
  45. package/dist/chunk-G2I4QJOT.cjs.map +1 -0
  46. package/dist/chunk-HLIMTC6N.js +1 -0
  47. package/dist/chunk-HLIMTC6N.js.map +1 -0
  48. package/dist/{chunk-QGHGJ56O.js → chunk-ITBSKI26.js} +1483 -19
  49. package/dist/chunk-ITBSKI26.js.map +1 -0
  50. package/dist/{chunk-6M3BCTBD.cjs → chunk-MA2F5KHF.cjs} +470 -242
  51. package/dist/chunk-MA2F5KHF.cjs.map +1 -0
  52. package/dist/{chunk-SAZRENEZ.cjs → chunk-MCSJFWAO.cjs} +1733 -192
  53. package/dist/chunk-MCSJFWAO.cjs.map +1 -0
  54. package/dist/chunk-MKA3AHLV.cjs +256 -0
  55. package/dist/chunk-MKA3AHLV.cjs.map +1 -0
  56. package/dist/chunk-OLZJXL4R.cjs +749 -0
  57. package/dist/chunk-OLZJXL4R.cjs.map +1 -0
  58. package/dist/chunk-OXSV64JX.js +689 -0
  59. package/dist/chunk-OXSV64JX.js.map +1 -0
  60. package/dist/chunk-P3RQ5UJE.cjs +689 -0
  61. package/dist/chunk-P3RQ5UJE.cjs.map +1 -0
  62. package/dist/chunk-P6ODPZ4W.js +256 -0
  63. package/dist/chunk-P6ODPZ4W.js.map +1 -0
  64. package/dist/chunk-PGNZKFQS.js +685 -0
  65. package/dist/chunk-PGNZKFQS.js.map +1 -0
  66. package/dist/chunk-PL4JB3BF.cjs +1 -0
  67. package/dist/chunk-PL4JB3BF.cjs.map +1 -0
  68. package/dist/{chunk-GVSMRPHB.cjs → chunk-SBCZ6RN5.cjs} +1568 -104
  69. package/dist/chunk-SBCZ6RN5.cjs.map +1 -0
  70. package/dist/{chunk-CL37JGFW.cjs → chunk-SML64VJG.cjs} +4 -4
  71. package/dist/{chunk-CL37JGFW.cjs.map → chunk-SML64VJG.cjs.map} +1 -1
  72. package/dist/chunk-TNNJXF46.cjs +115 -0
  73. package/dist/chunk-TNNJXF46.cjs.map +1 -0
  74. package/dist/chunk-U5HZSFCS.js +131 -0
  75. package/dist/chunk-U5HZSFCS.js.map +1 -0
  76. package/dist/{chunk-RU52I7QO.js → chunk-U5KWZU4X.js} +388 -160
  77. package/dist/chunk-U5KWZU4X.js.map +1 -0
  78. package/dist/chunk-XNORY7M6.cjs +685 -0
  79. package/dist/chunk-XNORY7M6.cjs.map +1 -0
  80. package/dist/commands/index.cjs +860 -0
  81. package/dist/commands/index.cjs.map +1 -0
  82. package/dist/commands/index.d.cts +244 -0
  83. package/dist/commands/index.d.ts +244 -0
  84. package/dist/commands/index.js +860 -0
  85. package/dist/commands/index.js.map +1 -0
  86. package/dist/comment-store-BEMgVlAA.d.cts +135 -0
  87. package/dist/comment-store-BEMgVlAA.d.ts +135 -0
  88. package/dist/compare/index.cjs +15 -0
  89. package/dist/compare/index.cjs.map +1 -0
  90. package/dist/compare/index.d.cts +58 -0
  91. package/dist/compare/index.d.ts +58 -0
  92. package/dist/compare/index.js +15 -0
  93. package/dist/compare/index.js.map +1 -0
  94. package/dist/{controller-B7GIybc4.d.cts → controller-BhLLAoi8.d.cts} +119 -5
  95. package/dist/{controller-B7GIybc4.d.ts → controller-BhLLAoi8.d.ts} +119 -5
  96. package/dist/documents-BQjzJNe2.d.ts +76 -0
  97. package/dist/documents-KRTPhvst.d.cts +76 -0
  98. package/dist/extensions/index.cjs +53 -5
  99. package/dist/extensions/index.cjs.map +1 -1
  100. package/dist/extensions/index.d.cts +7 -3
  101. package/dist/extensions/index.d.ts +7 -3
  102. package/dist/extensions/index.js +52 -4
  103. package/dist/generation/index.cjs +1373 -0
  104. package/dist/generation/index.cjs.map +1 -0
  105. package/dist/generation/index.d.cts +554 -0
  106. package/dist/generation/index.d.ts +554 -0
  107. package/dist/generation/index.js +1373 -0
  108. package/dist/generation/index.js.map +1 -0
  109. package/dist/grammar/index.cjs +48 -3
  110. package/dist/grammar/index.cjs.map +1 -1
  111. package/dist/grammar/index.d.cts +322 -100
  112. package/dist/grammar/index.d.ts +322 -100
  113. package/dist/grammar/index.js +54 -9
  114. package/dist/history/index.cjs +12 -2
  115. package/dist/history/index.cjs.map +1 -1
  116. package/dist/history/index.d.cts +211 -7
  117. package/dist/history/index.d.ts +211 -7
  118. package/dist/history/index.js +13 -3
  119. package/dist/image-editor/index.cjs +2244 -38
  120. package/dist/image-editor/index.cjs.map +1 -1
  121. package/dist/image-editor/index.d.cts +742 -4
  122. package/dist/image-editor/index.d.ts +742 -4
  123. package/dist/image-editor/index.js +2222 -16
  124. package/dist/image-editor/index.js.map +1 -1
  125. package/dist/{index-CCr_z9kF.d.cts → index-BhJBSm2d.d.cts} +370 -4
  126. package/dist/{index-Ck6ajwXh.d.ts → index-fJrlkJCd.d.ts} +370 -4
  127. package/dist/index.cjs +193 -98
  128. package/dist/index.cjs.map +1 -1
  129. package/dist/index.d.cts +17 -48
  130. package/dist/index.d.ts +17 -48
  131. package/dist/index.js +198 -103
  132. package/dist/index.js.map +1 -1
  133. package/dist/migrate-iTlm3a8h.d.cts +112 -0
  134. package/dist/migrate-iTlm3a8h.d.ts +112 -0
  135. package/dist/persistence/index.cjs +676 -0
  136. package/dist/persistence/index.cjs.map +1 -0
  137. package/dist/persistence/index.d.cts +347 -0
  138. package/dist/persistence/index.d.ts +347 -0
  139. package/dist/persistence/index.js +676 -0
  140. package/dist/persistence/index.js.map +1 -0
  141. package/dist/registry-BDe-vlv3.d.ts +171 -0
  142. package/dist/registry-D32LpIc4.d.cts +354 -0
  143. package/dist/registry-DnzpgY27.d.cts +171 -0
  144. package/dist/registry-evKTP4ls.d.ts +354 -0
  145. package/dist/schema-DYDGdYL9.d.cts +41 -0
  146. package/dist/schema-DYDGdYL9.d.ts +41 -0
  147. package/dist/serializers/index.cjs +4 -3
  148. package/dist/serializers/index.cjs.map +1 -1
  149. package/dist/serializers/index.d.cts +2 -1
  150. package/dist/serializers/index.d.ts +2 -1
  151. package/dist/serializers/index.js +3 -2
  152. package/dist/sourcemap-C8AH3MBQ.d.cts +91 -0
  153. package/dist/sourcemap-DA1Evhrv.d.ts +91 -0
  154. package/dist/spreadsheet/index.cjs +53 -3
  155. package/dist/spreadsheet/index.cjs.map +1 -1
  156. package/dist/spreadsheet/index.d.cts +247 -18
  157. package/dist/spreadsheet/index.d.ts +247 -18
  158. package/dist/spreadsheet/index.js +58 -8
  159. package/dist/{tokens-CyLZmIei.d.cts → tokens-D7yXvUU6.d.cts} +15 -2
  160. package/dist/{tokens-CyLZmIei.d.ts → tokens-D7yXvUU6.d.ts} +15 -2
  161. package/dist/{track-changes-BSF58RK0.d.cts → track-changes-BK5sVf4_.d.cts} +18 -136
  162. package/dist/{track-changes-BSF58RK0.d.ts → track-changes-CDjCrwKe.d.ts} +18 -136
  163. package/dist/{types-CJ4U-HHI.d.ts → types-DX4Mh4SL.d.cts} +1 -1
  164. package/dist/{types-CJ4U-HHI.d.cts → types-DX4Mh4SL.d.ts} +1 -1
  165. package/dist/types-GT5a5YAX.d.cts +86 -0
  166. package/dist/types-GT5a5YAX.d.ts +86 -0
  167. package/package.json +23 -2
  168. package/dist/chunk-2TWGLC5K.cjs +0 -262
  169. package/dist/chunk-2TWGLC5K.cjs.map +0 -1
  170. package/dist/chunk-4SUNJZWB.cjs.map +0 -1
  171. package/dist/chunk-6M3BCTBD.cjs.map +0 -1
  172. package/dist/chunk-AA4ZEVCC.cjs.map +0 -1
  173. package/dist/chunk-AXV2ZW34.cjs +0 -118
  174. package/dist/chunk-AXV2ZW34.cjs.map +0 -1
  175. package/dist/chunk-B2ZRLN4S.js +0 -118
  176. package/dist/chunk-B2ZRLN4S.js.map +0 -1
  177. package/dist/chunk-DENSCKFC.js.map +0 -1
  178. package/dist/chunk-GVSMRPHB.cjs.map +0 -1
  179. package/dist/chunk-KAADNAPF.js +0 -262
  180. package/dist/chunk-KAADNAPF.js.map +0 -1
  181. package/dist/chunk-MJZBNWG7.js.map +0 -1
  182. package/dist/chunk-OYXSKQFR.js.map +0 -1
  183. package/dist/chunk-QGHGJ56O.js.map +0 -1
  184. package/dist/chunk-RU52I7QO.js.map +0 -1
  185. package/dist/chunk-SAZRENEZ.cjs.map +0 -1
  186. package/dist/types-BZgcDsC5.d.cts +0 -42
  187. package/dist/types-BZgcDsC5.d.ts +0 -42
  188. /package/dist/{chunk-JJDLPEWL.js.map → chunk-3LV6RRPH.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/agent/schema.ts"],"sourcesContent":["/**\n * JSON-Schema-lite: the subset of JSON Schema used by MCP tool `inputSchema`s,\n * plus a small validator for tool-call arguments. Unknown keywords are ignored.\n */\nexport type JsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';\n\nexport interface JsonSchema {\n\ttype?: JsonSchemaType | readonly JsonSchemaType[];\n\tdescription?: string;\n\ttitle?: string;\n\tenum?: readonly unknown[];\n\tconst?: unknown;\n\tdefault?: unknown;\n\tproperties?: { readonly [key: string]: JsonSchema };\n\trequired?: readonly string[];\n\tadditionalProperties?: boolean | JsonSchema;\n\titems?: JsonSchema;\n\tminItems?: number;\n\tmaxItems?: number;\n\tminimum?: number;\n\tmaximum?: number;\n\tminLength?: number;\n\tmaxLength?: number;\n\tpattern?: string;\n\t[keyword: string]: unknown;\n}\n\nexport interface SchemaValidationError {\n\t/** JSON-pointer-like path to the offending value, e.g. `/node/id` (`\"\"` is the root). */\n\tpath: string;\n\tmessage: string;\n}\n\nfunction typeOf(value: unknown): JsonSchemaType | 'undefined' {\n\tif (value === null) return 'null';\n\tif (Array.isArray(value)) return 'array';\n\tif (typeof value === 'number') return Number.isInteger(value) ? 'integer' : 'number';\n\tif (typeof value === 'string' || typeof value === 'boolean' || typeof value === 'object') {\n\t\treturn typeof value as JsonSchemaType;\n\t}\n\treturn 'undefined';\n}\n\nfunction matchesType(value: unknown, type: JsonSchemaType): boolean {\n\tconst actual = typeOf(value);\n\tif (type === 'number') return actual === 'number' || actual === 'integer';\n\treturn actual === type;\n}\n\nconst isEqual = (a: unknown, b: unknown) => a === b || JSON.stringify(a) === JSON.stringify(b);\n\n/**\n * Validates `value` against `schema` and returns every error found (an empty\n * array means valid). Supports `type` (incl. arrays of types), `enum`, `const`,\n * `properties`, `required`, `additionalProperties`, `items`, `minItems`,\n * `maxItems`, `minimum`, `maximum`, `minLength`, `maxLength` and `pattern`.\n */\nexport function validateJsonSchema(value: unknown, schema: JsonSchema | undefined, path = ''): SchemaValidationError[] {\n\tif (!schema || typeof schema !== 'object') return [];\n\tconst errors: SchemaValidationError[] = [];\n\tconst at = path || '/';\n\n\tif (schema.type !== undefined) {\n\t\tconst types = (Array.isArray(schema.type) ? schema.type : [schema.type]) as JsonSchemaType[];\n\t\tif (!types.some((t) => matchesType(value, t))) {\n\t\t\terrors.push({ path: at, message: `Expected ${types.join(' | ')}, got ${typeOf(value)}.` });\n\t\t\treturn errors;\n\t\t}\n\t}\n\tif (schema.const !== undefined && !isEqual(value, schema.const)) {\n\t\terrors.push({ path: at, message: `Expected ${JSON.stringify(schema.const)}.` });\n\t}\n\tif (schema.enum && !schema.enum.some((option) => isEqual(value, option))) {\n\t\terrors.push({\n\t\t\tpath: at,\n\t\t\tmessage: `Expected one of ${schema.enum.map((o) => JSON.stringify(o)).join(', ')}, got ${JSON.stringify(value)}.`\n\t\t});\n\t}\n\n\tif (typeof value === 'string') {\n\t\tif (schema.minLength !== undefined && value.length < schema.minLength) {\n\t\t\terrors.push({ path: at, message: `Must be at least ${schema.minLength} characters.` });\n\t\t}\n\t\tif (schema.maxLength !== undefined && value.length > schema.maxLength) {\n\t\t\terrors.push({ path: at, message: `Must be at most ${schema.maxLength} characters.` });\n\t\t}\n\t\tif (schema.pattern !== undefined) {\n\t\t\tlet regex: RegExp | null = null;\n\t\t\ttry {\n\t\t\t\tregex = new RegExp(schema.pattern, 'u');\n\t\t\t} catch {\n\t\t\t\t// An invalid pattern in the schema is not the caller's fault.\n\t\t\t}\n\t\t\tif (regex && !regex.test(value)) {\n\t\t\t\terrors.push({ path: at, message: `Must match pattern ${schema.pattern}.` });\n\t\t\t}\n\t\t}\n\t}\n\n\tif (typeof value === 'number') {\n\t\tif (schema.minimum !== undefined && value < schema.minimum) {\n\t\t\terrors.push({ path: at, message: `Must be >= ${schema.minimum}.` });\n\t\t}\n\t\tif (schema.maximum !== undefined && value > schema.maximum) {\n\t\t\terrors.push({ path: at, message: `Must be <= ${schema.maximum}.` });\n\t\t}\n\t}\n\n\tif (Array.isArray(value)) {\n\t\tif (schema.minItems !== undefined && value.length < schema.minItems) {\n\t\t\terrors.push({ path: at, message: `Must have at least ${schema.minItems} items.` });\n\t\t}\n\t\tif (schema.maxItems !== undefined && value.length > schema.maxItems) {\n\t\t\terrors.push({ path: at, message: `Must have at most ${schema.maxItems} items.` });\n\t\t}\n\t\tif (schema.items) {\n\t\t\tvalue.forEach((item, index) => {\n\t\t\t\terrors.push(...validateJsonSchema(item, schema.items, `${path}/${index}`));\n\t\t\t});\n\t\t}\n\t}\n\n\tif (typeOf(value) === 'object') {\n\t\tconst obj = value as Record<string, unknown>;\n\t\tfor (const key of schema.required ?? []) {\n\t\t\tif (obj[key] === undefined) {\n\t\t\t\terrors.push({ path: `${path}/${key}`, message: `Missing required property \"${key}\".` });\n\t\t\t}\n\t\t}\n\t\tconst properties = schema.properties ?? {};\n\t\tfor (const [key, child] of Object.entries(obj)) {\n\t\t\tif (child === undefined) continue;\n\t\t\tif (key in properties) {\n\t\t\t\terrors.push(...validateJsonSchema(child, properties[key], `${path}/${key}`));\n\t\t\t} else if (schema.additionalProperties === false) {\n\t\t\t\terrors.push({ path: `${path}/${key}`, message: `Unknown property \"${key}\".` });\n\t\t\t} else if (typeof schema.additionalProperties === 'object') {\n\t\t\t\terrors.push(...validateJsonSchema(child, schema.additionalProperties, `${path}/${key}`));\n\t\t\t}\n\t\t}\n\t}\n\n\treturn errors;\n}\n"],"mappings":";AAiCA,SAAS,OAAO,OAA8C;AAC7D,MAAI,UAAU,KAAM,QAAO;AAC3B,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO;AACjC,MAAI,OAAO,UAAU,SAAU,QAAO,OAAO,UAAU,KAAK,IAAI,YAAY;AAC5E,MAAI,OAAO,UAAU,YAAY,OAAO,UAAU,aAAa,OAAO,UAAU,UAAU;AACzF,WAAO,OAAO;AAAA,EACf;AACA,SAAO;AACR;AAEA,SAAS,YAAY,OAAgB,MAA+B;AACnE,QAAM,SAAS,OAAO,KAAK;AAC3B,MAAI,SAAS,SAAU,QAAO,WAAW,YAAY,WAAW;AAChE,SAAO,WAAW;AACnB;AAEA,IAAM,UAAU,CAAC,GAAY,MAAe,MAAM,KAAK,KAAK,UAAU,CAAC,MAAM,KAAK,UAAU,CAAC;AAQtF,SAAS,mBAAmB,OAAgB,QAAgC,OAAO,IAA6B;AACtH,MAAI,CAAC,UAAU,OAAO,WAAW,SAAU,QAAO,CAAC;AACnD,QAAM,SAAkC,CAAC;AACzC,QAAM,KAAK,QAAQ;AAEnB,MAAI,OAAO,SAAS,QAAW;AAC9B,UAAM,QAAS,MAAM,QAAQ,OAAO,IAAI,IAAI,OAAO,OAAO,CAAC,OAAO,IAAI;AACtE,QAAI,CAAC,MAAM,KAAK,CAAC,MAAM,YAAY,OAAO,CAAC,CAAC,GAAG;AAC9C,aAAO,KAAK,EAAE,MAAM,IAAI,SA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AE,CAAC;AAAA,MAC5E,WAAW,OAAO,yBAAyB,OAAO;AACjD,eAAO,KAAK,EAAE,MAAM,GAAG,IAAI,IAAI,GAAG,IAAI,SAAS,qBAAqB,GAAG,KAAK,CAAC;AAAA,MAC9E,WAAW,OAAO,OAAO,yBAAyB,UAAU;AAC3D,eAAO,KAAK,GAAG,mBAAmB,OAAO,OAAO,sBAAsB,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC;AAAA,MACxF;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;","names":[]}
@@ -0,0 +1,101 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/agent/schema.ts
2
+ function typeOf(value) {
3
+ if (value === null) return "null";
4
+ if (Array.isArray(value)) return "array";
5
+ if (typeof value === "number") return Number.isInteger(value) ? "integer" : "number";
6
+ if (typeof value === "string" || typeof value === "boolean" || typeof value === "object") {
7
+ return typeof value;
8
+ }
9
+ return "undefined";
10
+ }
11
+ function matchesType(value, type) {
12
+ const actual = typeOf(value);
13
+ if (type === "number") return actual === "number" || actual === "integer";
14
+ return actual === type;
15
+ }
16
+ var isEqual = (a, b) => a === b || JSON.stringify(a) === JSON.stringify(b);
17
+ function validateJsonSchema(value, schema, path = "") {
18
+ if (!schema || typeof schema !== "object") return [];
19
+ const errors = [];
20
+ const at = path || "/";
21
+ if (schema.type !== void 0) {
22
+ const types = Array.isArray(schema.type) ? schema.type : [schema.type];
23
+ if (!types.some((t) => matchesType(value, t))) {
24
+ errors.push({ path: at, message: `Expected ${types.join(" | ")}, got ${typeOf(value)}.` });
25
+ return errors;
26
+ }
27
+ }
28
+ if (schema.const !== void 0 && !isEqual(value, schema.const)) {
29
+ errors.push({ path: at, message: `Expected ${JSON.stringify(schema.const)}.` });
30
+ }
31
+ if (schema.enum && !schema.enum.some((option) => isEqual(value, option))) {
32
+ errors.push({
33
+ path: at,
34
+ message: `Expected one of ${schema.enum.map((o) => JSON.stringify(o)).join(", ")}, got ${JSON.stringify(value)}.`
35
+ });
36
+ }
37
+ if (typeof value === "string") {
38
+ if (schema.minLength !== void 0 && value.length < schema.minLength) {
39
+ errors.push({ path: at, message: `Must be at least ${schema.minLength} characters.` });
40
+ }
41
+ if (schema.maxLength !== void 0 && value.length > schema.maxLength) {
42
+ errors.push({ path: at, message: `Must be at most ${schema.maxLength} characters.` });
43
+ }
44
+ if (schema.pattern !== void 0) {
45
+ let regex = null;
46
+ try {
47
+ regex = new RegExp(schema.pattern, "u");
48
+ } catch (e) {
49
+ }
50
+ if (regex && !regex.test(value)) {
51
+ errors.push({ path: at, message: `Must match pattern ${schema.pattern}.` });
52
+ }
53
+ }
54
+ }
55
+ if (typeof value === "number") {
56
+ if (schema.minimum !== void 0 && value < schema.minimum) {
57
+ errors.push({ path: at, message: `Must be >= ${schema.minimum}.` });
58
+ }
59
+ if (schema.maximum !== void 0 && value > schema.maximum) {
60
+ errors.push({ path: at, message: `Must be <= ${schema.maximum}.` });
61
+ }
62
+ }
63
+ if (Array.isArray(value)) {
64
+ if (schema.minItems !== void 0 && value.length < schema.minItems) {
65
+ errors.push({ path: at, message: `Must have at least ${schema.minItems} items.` });
66
+ }
67
+ if (schema.maxItems !== void 0 && value.length > schema.maxItems) {
68
+ errors.push({ path: at, message: `Must have at most ${schema.maxItems} items.` });
69
+ }
70
+ if (schema.items) {
71
+ value.forEach((item, index) => {
72
+ errors.push(...validateJsonSchema(item, schema.items, `${path}/${index}`));
73
+ });
74
+ }
75
+ }
76
+ if (typeOf(value) === "object") {
77
+ const obj = value;
78
+ for (const key of _nullishCoalesce(schema.required, () => ( []))) {
79
+ if (obj[key] === void 0) {
80
+ errors.push({ path: `${path}/${key}`, message: `Missing required property "${key}".` });
81
+ }
82
+ }
83
+ const properties = _nullishCoalesce(schema.properties, () => ( {}));
84
+ for (const [key, child] of Object.entries(obj)) {
85
+ if (child === void 0) continue;
86
+ if (key in properties) {
87
+ errors.push(...validateJsonSchema(child, properties[key], `${path}/${key}`));
88
+ } else if (schema.additionalProperties === false) {
89
+ errors.push({ path: `${path}/${key}`, message: `Unknown property "${key}".` });
90
+ } else if (typeof schema.additionalProperties === "object") {
91
+ errors.push(...validateJsonSchema(child, schema.additionalProperties, `${path}/${key}`));
92
+ }
93
+ }
94
+ }
95
+ return errors;
96
+ }
97
+
98
+
99
+
100
+ exports.validateJsonSchema = validateJsonSchema;
101
+ //# sourceMappingURL=chunk-CPOKFNBG.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/chunk-CPOKFNBG.cjs","../src/agent/schema.ts"],"names":[],"mappings":"AAAA;ACiCA,SAAS,MAAA,CAAO,KAAA,EAA8C;AAC7D,EAAA,GAAA,CAAI,MAAA,IAAU,IAAA,EAAM,OAAO,MAAA;AAC3B,EAAA,GAAA,CAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG,OAAO,OAAA;AACjC,EAAA,GAAA,CAAI,OAAO,MAAA,IAAU,QAAA,EAAU,OAAO,MAAA,CAAO,SAAA,CAAU,KAAK,EAAA,EAAI,UAAA,EAAY,QAAA;AAC5E,EAAA,GAAA,CAAI,OAAO,MAAA,IAAU,SAAA,GAAY,OAAO,MAAA,IAAU,UAAA,GAAa,OAAO,MAAA,IAAU,QAAA,EAAU;AACzF,IAAA,OAAO,OAAO,KAAA;AAAA,EACf;AACA,EAAA,OAAO,WAAA;AACR;AAEA,SAAS,WAAA,CAAY,KAAA,EAAgB,IAAA,EAA+B;AACnE,EAAA,MAAM,OAAA,EAAS,MAAA,CAAO,KAAK,CAAA;AAC3B,EAAA,GAAA,CAAI,KAAA,IAAS,QAAA,EAAU,OAAO,OAAA,IAAW,SAAA,GAAY,OAAA,IAAW,SAAA;AAChE,EAAA,OAAO,OAAA,IAAW,IAAA;AACnB;AAEA,IAAM,QAAA,EAAU,CAAC,CAAA,EAAY,CAAA,EAAA,GAAe,EAA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,EAAI,OAAA,EAAS,CAAA,mBAAA,EAAsB,MAAA,CAAO,QAAQ,CAAA,OAAA,EAAU,CAAC,CAAA;AAAA,IAClF;AACA,IAAA,GAAA,CAAI,MAAA,CAAO,SAAA,IAAa,KAAA,EAAA,GAAa,KAAA,CAAM,OAAA,EAAS,MAAA,CAAO,QAAA,EAAU;AACpE,MAAA,MAAA,CAAO,IAAA,CAAK,EAAE,IAAA,EAAM,EAAA,EAAI,OAAA,EAAS,CAAA,kBAAA,EAAqB,MAAA,CAAO,QAAQ,CAAA,OAAA,EAAU,CAAC,CAAA;AAAA,IACjF;AACA,IAAA,GAAA,CAAI,MAAA,CAAO,KAAA,EAAO;AACjB,MAAA,KAAA,CAAM,OAAA,CAAQ,CAAC,IAAA,EAAM,KAAA,EAAA,GAAU;AAC9B,QAAA,MAAA,CAAO,IAAA,CAAK,GAAG,kBAAA,CAAmB,IAAA,EAAM,MAAA,CAAO,KAAA,EAAO,CAAA,EAAA;AACtD,MAAA;AACF,IAAA;AACD,EAAA;AAEgC,EAAA;AACnB,IAAA;AAC6B,IAAA;AACZ,MAAA;AACoB,QAAA;AAChD,MAAA;AACD,IAAA;AACyC,IAAA;AACO,IAAA;AACtB,MAAA;AACF,MAAA;AACiC,QAAA;AACN,MAAA;AACF,QAAA;AACE,MAAA;AACD,QAAA;AACjD,MAAA;AACD,IAAA;AACD,EAAA;AAEO,EAAA;AACR;AD/C+D;AACA;AACA;AACA","file":"/home/runner/work/editor/editor/packages/core/dist/chunk-CPOKFNBG.cjs","sourcesContent":[null,"/**\n * JSON-Schema-lite: the subset of JSON Schema used by MCP tool `inputSchema`s,\n * plus a small validator for tool-call arguments. Unknown keywords are ignored.\n */\nexport type JsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';\n\nexport interface JsonSchema {\n\ttype?: JsonSchemaType | readonly JsonSchemaType[];\n\tdescription?: string;\n\ttitle?: string;\n\tenum?: readonly unknown[];\n\tconst?: unknown;\n\tdefault?: unknown;\n\tproperties?: { readonly [key: string]: JsonSchema };\n\trequired?: readonly string[];\n\tadditionalProperties?: boolean | JsonSchema;\n\titems?: JsonSchema;\n\tminItems?: number;\n\tmaxItems?: number;\n\tminimum?: number;\n\tmaximum?: number;\n\tminLength?: number;\n\tmaxLength?: number;\n\tpattern?: string;\n\t[keyword: string]: unknown;\n}\n\nexport interface SchemaValidationError {\n\t/** JSON-pointer-like path to the offending value, e.g. `/node/id` (`\"\"` is the root). */\n\tpath: string;\n\tmessage: string;\n}\n\nfunction typeOf(value: unknown): JsonSchemaType | 'undefined' {\n\tif (value === null) return 'null';\n\tif (Array.isArray(value)) return 'array';\n\tif (typeof value === 'number') return Number.isInteger(value) ? 'integer' : 'number';\n\tif (typeof value === 'string' || typeof value === 'boolean' || typeof value === 'object') {\n\t\treturn typeof value as JsonSchemaType;\n\t}\n\treturn 'undefined';\n}\n\nfunction matchesType(value: unknown, type: JsonSchemaType): boolean {\n\tconst actual = typeOf(value);\n\tif (type === 'number') return actual === 'number' || actual === 'integer';\n\treturn actual === type;\n}\n\nconst isEqual = (a: unknown, b: unknown) => a === b || JSON.stringify(a) === JSON.stringify(b);\n\n/**\n * Validates `value` against `schema` and returns every error found (an empty\n * array means valid). Supports `type` (incl. arrays of types), `enum`, `const`,\n * `properties`, `required`, `additionalProperties`, `items`, `minItems`,\n * `maxItems`, `minimum`, `maximum`, `minLength`, `maxLength` and `pattern`.\n */\nexport function validateJsonSchema(value: unknown, schema: JsonSchema | undefined, path = ''): SchemaValidationError[] {\n\tif (!schema || typeof schema !== 'object') return [];\n\tconst errors: SchemaValidationError[] = [];\n\tconst at = path || '/';\n\n\tif (schema.type !== undefined) {\n\t\tconst types = (Array.isArray(schema.type) ? schema.type : [schema.type]) as JsonSchemaType[];\n\t\tif (!types.some((t) => matchesType(value, t))) {\n\t\t\terrors.push({ path: at, message: `Expected ${types.join(' | ')}, got ${typeOf(value)}.` });\n\t\t\treturn errors;\n\t\t}\n\t}\n\tif (schema.const !== undefined && !isEqual(value, schema.const)) {\n\t\terrors.push({ path: at, message: `Expected ${JSON.stringify(schema.const)}.` });\n\t}\n\tif (schema.enum && !schema.enum.some((option) => isEqual(value, option))) {\n\t\terrors.push({\n\t\t\tpath: at,\n\t\t\tmessage: `Expected one of ${schema.enum.map((o) => JSON.stringify(o)).join(', ')}, got ${JSON.stringify(value)}.`\n\t\t});\n\t}\n\n\tif (typeof value === 'string') {\n\t\tif (schema.minLength !== undefined && value.length < schema.minLength) {\n\t\t\terrors.push({ path: at, message: `Must be at least ${schema.minLength} characters.` });\n\t\t}\n\t\tif (schema.maxLength !== undefined && value.length > schema.maxLength) {\n\t\t\terrors.push({ path: at, message: `Must be at most ${schema.maxLength} characters.` });\n\t\t}\n\t\tif (schema.pattern !== undefined) {\n\t\t\tlet regex: RegExp | null = null;\n\t\t\ttry {\n\t\t\t\tregex = new RegExp(schema.pattern, 'u');\n\t\t\t} catch {\n\t\t\t\t// An invalid pattern in the schema is not the caller's fault.\n\t\t\t}\n\t\t\tif (regex && !regex.test(value)) {\n\t\t\t\terrors.push({ path: at, message: `Must match pattern ${schema.pattern}.` });\n\t\t\t}\n\t\t}\n\t}\n\n\tif (typeof value === 'number') {\n\t\tif (schema.minimum !== undefined && value < schema.minimum) {\n\t\t\terrors.push({ path: at, message: `Must be >= ${schema.minimum}.` });\n\t\t}\n\t\tif (schema.maximum !== undefined && value > schema.maximum) {\n\t\t\terrors.push({ path: at, message: `Must be <= ${schema.maximum}.` });\n\t\t}\n\t}\n\n\tif (Array.isArray(value)) {\n\t\tif (schema.minItems !== undefined && value.length < schema.minItems) {\n\t\t\terrors.push({ path: at, message: `Must have at least ${schema.minItems} items.` });\n\t\t}\n\t\tif (schema.maxItems !== undefined && value.length > schema.maxItems) {\n\t\t\terrors.push({ path: at, message: `Must have at most ${schema.maxItems} items.` });\n\t\t}\n\t\tif (schema.items) {\n\t\t\tvalue.forEach((item, index) => {\n\t\t\t\terrors.push(...validateJsonSchema(item, schema.items, `${path}/${index}`));\n\t\t\t});\n\t\t}\n\t}\n\n\tif (typeOf(value) === 'object') {\n\t\tconst obj = value as Record<string, unknown>;\n\t\tfor (const key of schema.required ?? []) {\n\t\t\tif (obj[key] === undefined) {\n\t\t\t\terrors.push({ path: `${path}/${key}`, message: `Missing required property \"${key}\".` });\n\t\t\t}\n\t\t}\n\t\tconst properties = schema.properties ?? {};\n\t\tfor (const [key, child] of Object.entries(obj)) {\n\t\t\tif (child === undefined) continue;\n\t\t\tif (key in properties) {\n\t\t\t\terrors.push(...validateJsonSchema(child, properties[key], `${path}/${key}`));\n\t\t\t} else if (schema.additionalProperties === false) {\n\t\t\t\terrors.push({ path: `${path}/${key}`, message: `Unknown property \"${key}\".` });\n\t\t\t} else if (typeof schema.additionalProperties === 'object') {\n\t\t\t\terrors.push(...validateJsonSchema(child, schema.additionalProperties, `${path}/${key}`));\n\t\t\t}\n\t\t}\n\t}\n\n\treturn errors;\n}\n"]}