@workglow/util 0.2.20 → 0.2.21

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 (58) hide show
  1. package/dist/browser.js +5 -2
  2. package/dist/browser.js.map +3 -3
  3. package/dist/bun.js +5 -2
  4. package/dist/bun.js.map +3 -3
  5. package/dist/json-schema/SchemaUtils.d.ts.map +1 -1
  6. package/dist/json-schema/SchemaValidation.d.ts +6 -0
  7. package/dist/json-schema/SchemaValidation.d.ts.map +1 -1
  8. package/dist/media/cpuImage.d.ts +15 -16
  9. package/dist/media/cpuImage.d.ts.map +1 -1
  10. package/dist/media/encode.d.ts +3 -5
  11. package/dist/media/encode.d.ts.map +1 -1
  12. package/dist/media/gpuImage.d.ts +21 -30
  13. package/dist/media/gpuImage.d.ts.map +1 -1
  14. package/dist/media/imageCacheCodec.d.ts +19 -7
  15. package/dist/media/imageCacheCodec.d.ts.map +1 -1
  16. package/dist/media/imageRasterCodecRegistry.d.ts +3 -3
  17. package/dist/media/imageRasterCodecRegistry.d.ts.map +1 -1
  18. package/dist/media/imageTypes.d.ts +0 -16
  19. package/dist/media/imageTypes.d.ts.map +1 -1
  20. package/dist/media/imageValue.d.ts +44 -0
  21. package/dist/media/imageValue.d.ts.map +1 -0
  22. package/dist/media/imageValue.test.d.ts +7 -0
  23. package/dist/media/imageValue.test.d.ts.map +1 -0
  24. package/dist/media/imageValueSchema.d.ts +15 -0
  25. package/dist/media/imageValueSchema.d.ts.map +1 -0
  26. package/dist/media/previewBudget.d.ts +10 -13
  27. package/dist/media/previewBudget.d.ts.map +1 -1
  28. package/dist/media/rawPixelBuffer.d.ts +20 -0
  29. package/dist/media/rawPixelBuffer.d.ts.map +1 -0
  30. package/dist/media/{sharpImage.node.d.ts → sharpImage.server.d.ts} +42 -14
  31. package/dist/media/sharpImage.server.d.ts.map +1 -0
  32. package/dist/media/webGpuImage.browser.d.ts +11 -14
  33. package/dist/media/webGpuImage.browser.d.ts.map +1 -1
  34. package/dist/media-browser.d.ts +9 -3
  35. package/dist/media-browser.d.ts.map +1 -1
  36. package/dist/media-browser.js +429 -342
  37. package/dist/media-browser.js.map +14 -14
  38. package/dist/media-node.d.ts +8 -6
  39. package/dist/media-node.d.ts.map +1 -1
  40. package/dist/media-node.js +479 -254
  41. package/dist/media-node.js.map +14 -14
  42. package/dist/node.js +5 -2
  43. package/dist/node.js.map +3 -3
  44. package/dist/schema-entry.js +166 -165
  45. package/dist/schema-entry.js.map +5 -5
  46. package/dist/worker/WorkerManager.d.ts.map +1 -1
  47. package/dist/worker-browser.js +5 -2
  48. package/dist/worker-browser.js.map +3 -3
  49. package/dist/worker-bun.js +5 -2
  50. package/dist/worker-bun.js.map +3 -3
  51. package/dist/worker-node.js +5 -2
  52. package/dist/worker-node.js.map +3 -3
  53. package/package.json +1 -1
  54. package/dist/media/gpuImageSchema.d.ts +0 -8
  55. package/dist/media/gpuImageSchema.d.ts.map +0 -1
  56. package/dist/media/sharpImage.bun.d.ts +0 -7
  57. package/dist/media/sharpImage.bun.d.ts.map +0 -1
  58. package/dist/media/sharpImage.node.d.ts.map +0 -1
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/json-schema/FromSchema.ts", "../src/json-schema/SchemaUtils.ts", "../src/json-schema/SchemaValidation.ts", "../src/json-schema/parsePartialJson.ts", "../src/vector/TypedArray.ts", "../src/vector/Tensor.ts", "../src/vector/TypedArrayUtils.ts", "../src/vector/VectorSimilarityUtils.ts", "../src/vector/VectorUtils.ts"],
3
+ "sources": ["../src/json-schema/FromSchema.ts", "../src/json-schema/SchemaValidation.ts", "../src/json-schema/SchemaUtils.ts", "../src/json-schema/parsePartialJson.ts", "../src/vector/TypedArray.ts", "../src/vector/Tensor.ts", "../src/vector/TypedArrayUtils.ts", "../src/vector/VectorSimilarityUtils.ts", "../src/vector/VectorUtils.ts"],
4
4
  "sourcesContent": [
5
5
  "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {\n FromExtendedSchema,\n FromExtendedSchemaOptions,\n FromSchemaOptions,\n} from \"@sroussey/json-schema-to-ts\";\nimport type { JsonSchema, JsonSchemaCustomProps } from \"./JsonSchema\";\n\nexport { FromSchemaOptions };\n\n/**\n * Removes the [$JSONSchema] symbol property from a type\n * This is needed because json-schema-to-ts adds this property which cannot be serialized\n */\nexport type StripJSONSchema<T> = T extends object\n ? {\n [K in keyof T as K extends symbol ? never : K]: T[K];\n }\n : T;\n\nexport const FromSchemaDefaultOptions = {\n parseNotKeyword: true,\n parseIfThenElseKeywords: true,\n keepDefaultedPropertiesOptional: true,\n references: false,\n deserialize: false,\n} as const satisfies FromSchemaOptions;\n\nexport type FromSchema<\n SCHEMA extends JsonSchema<EXTENSION>,\n OPTIONS extends FromExtendedSchemaOptions<EXTENSION> = typeof FromSchemaDefaultOptions,\n EXTENSION extends JsonSchemaCustomProps = JsonSchemaCustomProps,\n> = StripJSONSchema<FromExtendedSchema<EXTENSION, SCHEMA, OPTIONS>>;\n\n/**\n * IncludeProps - Returns a new schema with only the specified properties\n *\n * This is a schema transformer that returns a new schema object.\n * Use with FromSchema like: FromSchema<IncludeProps<typeof schema, typeof [\"prop1\", \"prop2\"]>>\n *\n * @template Schema - The JSON schema object (with 'as const')\n * @template Keys - Readonly array type of property keys to include (use typeof [\"key1\", \"key2\"] as const)\n *\n * @example\n * const schema = {\n * type: \"object\",\n * properties: {\n * name: { type: \"string\" },\n * age: { type: \"number\" },\n * email: { type: \"string\" }\n * },\n * required: [\"name\"],\n * additionalProperties: false\n * } as const;\n *\n * type Filtered = FromSchema<IncludeProps<typeof schema, typeof [\"name\", \"age\"]>>;\n * // => { name: string, age?: number }\n */\nexport type IncludeProps<\n Schema extends { readonly type: \"object\"; readonly properties: Record<string, unknown> },\n Keys extends readonly (keyof Schema[\"properties\"])[],\n> = Omit<Schema, \"properties\" | \"required\"> & {\n readonly properties: {\n readonly [K in Extract<keyof Schema[\"properties\"], Keys[number]>]: Schema[\"properties\"][K];\n };\n} & (Schema extends { readonly required: readonly (infer R extends string)[] }\n ? { readonly required: readonly Extract<R, Keys[number]>[] }\n : {});\n\n/**\n * ExcludeProps - Returns a new schema without the specified properties\n *\n * This is a schema transformer that returns a new schema object.\n * Use with FromSchema like: FromSchema<ExcludeProps<typeof schema, typeof [\"prop1\", \"prop2\"]>>\n *\n * @template Schema - The JSON schema object (with 'as const')\n * @template Keys - Readonly array type of property keys to exclude (use typeof [\"key1\", \"key2\"] as const)\n *\n * @example\n * const schema = {\n * type: \"object\",\n * properties: {\n * name: { type: \"string\" },\n * age: { type: \"number\" },\n * email: { type: \"string\" }\n * },\n * required: [\"name\"],\n * additionalProperties: false\n * } as const;\n *\n * type Filtered = FromSchema<ExcludeProps<typeof schema, typeof [\"email\"]>>;\n * // => { name: string, age?: number }\n */\nexport type ExcludeProps<\n Schema extends { readonly type: \"object\"; readonly properties: Record<string, unknown> },\n Keys extends readonly (keyof Schema[\"properties\"])[],\n> = Omit<Schema, \"properties\" | \"required\"> & {\n readonly properties: {\n readonly [K in Exclude<keyof Schema[\"properties\"], Keys[number]>]: Schema[\"properties\"][K];\n };\n} & (Schema extends { readonly required: readonly (infer R extends string)[] }\n ? { readonly required: readonly Exclude<R, Keys[number]>[] }\n : {});\n",
6
- "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Semantic Compatibility Utilities for Task Graph Dataflows\n *\n * In this project, task graphs have connections between tasks called dataflows.\n * These dataflows have different kinds of compatibility checks:\n *\n * **Static Compatibility:**\n * Static rules help decide if an edge should be connected at all. A connection\n * is statically compatible if:\n * - The source and target are the same exact type\n * - The source connects to the equivalent of \"any\" (target accepts anything)\n * - The source type is acceptable to the target (e.g., a string to something\n * that accepts oneOf[string[], string])\n *\n * **Runtime Compatibility:**\n * Assuming the connection is allowed at design time (passes static check),\n * runtime rules determine if they are compatible during execution.\n *\n * Currently, there is one runtime compatibility check:\n * - If both input and output schemas have 'format' annotations attached,\n * the format annotation has the format /\\w+(:\\w+)?/ where the first part\n * is the \"name\" and if alone matches any other with the same \"name\".\n * If there is a second part, then that narrows the type.\n * - Format checks apply to all types (strings, arrays, etc.), not just strings\n * - A schema with format can connect to a schema with no format (source has format, target doesn't)\n * - A schema with no format cannot connect to a schema with format (source doesn't have format, target does)\n *\n * Example: In the AI package, 'format':'model' and 'format': 'model:EmbeddingTask'\n * are used on string types. An input with property `model` and 'format':'model'\n * connects to a target with property `model` and 'format':'model:EmbeddingTask' --\n * this compatibility is called \"runtime\". It first passes the static check as\n * compatible and then notices a difference in format runtime.\n *\n * Format is also used on array types, e.g., 'format':'Float64Array' on arrays\n * containing Float64 numbers.\n *\n * Only connections that pass the runtime check will pass data at runtime.\n */\n\nimport type { JsonSchema } from \"./JsonSchema\";\n\n/**\n * Checks if two format strings are compatible.\n * Format: /\\w+(:\\w+)?/ where first part is the \"name\" and optional second part narrows the type.\n * - Same name without narrowing: static compatible\n * - Source name matches target narrowed name: runtime compatible\n * - Different names or incompatible narrowing: incompatible\n */\nfunction areFormatStringsCompatible(\n sourceFormat: string,\n targetFormat: string\n): \"static\" | \"runtime\" | \"incompatible\" {\n // Allow letters (must start), numbers, underscore, and dash; e.g., my-type:another_type\n const formatPattern = /^[a-zA-Z][a-zA-Z0-9_-]*(?::[a-zA-Z][a-zA-Z0-9_-]*)?$/;\n if (!formatPattern.test(sourceFormat) || !formatPattern.test(targetFormat)) {\n return \"incompatible\";\n }\n\n const [sourceName, sourceNarrow] = sourceFormat.split(\":\");\n const [targetName, targetNarrow] = targetFormat.split(\":\");\n\n // Different base names are incompatible\n if (sourceName !== targetName) {\n return \"incompatible\";\n }\n\n // Same name, no narrowing on either: static compatible\n if (!sourceNarrow && !targetNarrow) {\n return \"static\";\n }\n\n // Source has narrowing, target doesn't: static compatible (source is more specific)\n if (sourceNarrow && !targetNarrow) {\n return \"static\";\n }\n\n // Target has narrowing, source doesn't: runtime compatible (target is more specific)\n if (!sourceNarrow && targetNarrow) {\n return \"runtime\";\n }\n\n // Both have narrowing: must match exactly for static, otherwise incompatible\n if (sourceNarrow === targetNarrow) {\n return \"static\";\n }\n\n return \"incompatible\";\n}\n\n/**\n * Checks if a source type is statically compatible with a target type.\n * Handles cases like string to oneOf[string[], string] or string to any.\n */\nfunction isTypeStaticallyCompatible(sourceType: unknown, targetType: unknown): boolean {\n // Target accepts any type (no type constraint)\n if (!targetType) {\n return true;\n }\n\n // Source has no type constraint\n if (!sourceType) {\n return false;\n }\n\n // Convert to arrays for comparison\n const sourceTypes = Array.isArray(sourceType) ? sourceType : [sourceType];\n const targetTypes = Array.isArray(targetType) ? targetType : [targetType];\n\n // Check if any source type matches any target type\n return sourceTypes.some((st) => targetTypes.includes(st as any));\n}\n\n/**\n * Merges allOf schemas into a single schema representing their intersection.\n * For example: allOf: [{ type: \"string\", format: \"model\" }, { type: \"string\" }]\n * becomes: { type: \"string\", format: \"model\" }\n */\nfunction mergeAllOfSchemas(schemas: JsonSchema[]): JsonSchema | null {\n if (schemas.length === 0) return null;\n if (schemas.length === 1) return schemas[0] as JsonSchema;\n\n let merged: Record<string, unknown> = {};\n\n for (const schema of schemas) {\n if (typeof schema === \"boolean\") {\n if (schema === false) return false; // false in allOf makes the whole thing false\n // true in allOf doesn't add constraints, so we can skip it\n continue;\n }\n\n // At this point, schema is an object\n const schemaObj = schema as Record<string, unknown>;\n\n // Merge type\n if (schemaObj.type !== undefined) {\n if (merged.type === undefined) {\n merged.type = schemaObj.type;\n } else if (merged.type !== schemaObj.type) {\n // Types must be compatible - if they're different primitives, it's incompatible\n const mergedTypes = Array.isArray(merged.type) ? merged.type : [merged.type];\n const schemaTypes = Array.isArray(schemaObj.type) ? schemaObj.type : [schemaObj.type];\n const commonTypes = mergedTypes.filter((t: unknown) => schemaTypes.includes(t));\n if (commonTypes.length === 0) {\n return false; // Incompatible types\n }\n merged.type = commonTypes.length === 1 ? commonTypes[0] : commonTypes;\n }\n }\n\n // Merge format - use the most specific one (the one with narrowing if any)\n const schemaFormat = schemaObj.format as string | undefined;\n const mergedFormat = merged.format as string | undefined;\n if (schemaFormat) {\n if (!mergedFormat) {\n merged.format = schemaFormat;\n } else {\n // Both have formats - check if they're compatible\n const formatCompat = areFormatStringsCompatible(mergedFormat, schemaFormat);\n if (formatCompat === \"incompatible\") {\n return false; // Incompatible formats\n }\n // Use the more specific format (the one with narrowing, or either if both same)\n const mergedHasNarrow = mergedFormat.includes(\":\");\n const schemaHasNarrow = schemaFormat.includes(\":\");\n if (schemaHasNarrow && !mergedHasNarrow) {\n merged.format = schemaFormat;\n } else if (!schemaHasNarrow && mergedHasNarrow) {\n // Keep merged format (it's more specific)\n } else if (mergedFormat !== schemaFormat) {\n // Both have narrowing and they're different - should be caught by areFormatStringsCompatible\n return false;\n }\n }\n }\n\n // Merge properties for objects\n if (schemaObj.properties && typeof schemaObj.properties === \"object\") {\n if (!merged.properties) {\n merged.properties = {};\n }\n const mergedProps = merged.properties as Record<string, JsonSchema>;\n const schemaProps = schemaObj.properties as Record<string, JsonSchema>;\n for (const [key, value] of Object.entries(schemaProps)) {\n if (mergedProps[key]) {\n // Recursively merge nested schemas\n const nestedMerged = mergeAllOfSchemas([mergedProps[key], value]);\n if (nestedMerged === null || nestedMerged === false) {\n return false;\n }\n mergedProps[key] = nestedMerged as JsonSchema;\n } else {\n mergedProps[key] = value;\n }\n }\n }\n\n // Merge required arrays\n if (schemaObj.required && Array.isArray(schemaObj.required)) {\n if (!merged.required) {\n merged.required = [];\n }\n const mergedRequired = merged.required as string[];\n const schemaRequired = schemaObj.required as string[];\n // Intersection of required arrays\n merged.required = mergedRequired.filter((r) => schemaRequired.includes(r));\n }\n\n // Merge additionalProperties - most restrictive wins\n if (schemaObj.additionalProperties !== undefined) {\n if (merged.additionalProperties === undefined) {\n merged.additionalProperties = schemaObj.additionalProperties;\n } else if (merged.additionalProperties === true && schemaObj.additionalProperties === false) {\n merged.additionalProperties = false; // false is more restrictive\n }\n }\n\n // Merge items for arrays\n if (schemaObj.items !== undefined) {\n if (merged.items === undefined) {\n merged.items = schemaObj.items;\n } else {\n // Recursively merge item schemas\n const mergedItems = mergeAllOfSchemas([\n merged.items as JsonSchema,\n schemaObj.items as JsonSchema,\n ]);\n if (mergedItems === null || mergedItems === false) {\n return false;\n }\n merged.items = mergedItems;\n }\n }\n }\n\n return merged as JsonSchema;\n}\n\n/**\n * Checks if a source schema is compatible with a target schema in a oneOf/anyOf union.\n */\nfunction isCompatibleWithUnion(\n sourceSchema: JsonSchema,\n unionSchemas: JsonSchema[]\n): \"static\" | \"runtime\" | \"incompatible\" {\n let hasStatic = false;\n let hasRuntime = false;\n\n for (const unionSchema of unionSchemas) {\n const compatibility = areSemanticallyCompatible(sourceSchema, unionSchema);\n if (compatibility === \"static\") {\n hasStatic = true;\n } else if (compatibility === \"runtime\") {\n hasRuntime = true;\n }\n }\n\n if (hasStatic) return \"static\";\n if (hasRuntime) return \"runtime\";\n return \"incompatible\";\n}\n\n/**\n * Checks if two JSON schemas are semantically compatible.\n * Returns:\n * - \"static\": Compatible at design time, no runtime check needed\n * - \"runtime\": Compatible at design time, but needs runtime semantic check\n * - \"incompatible\": Not compatible\n */\nexport function areSemanticallyCompatible(\n sourceSchema: JsonSchema,\n targetSchema: JsonSchema\n): \"static\" | \"runtime\" | \"incompatible\" {\n // Handle undefined schemas (non-existent ports)\n if (sourceSchema === undefined || targetSchema === undefined) {\n return \"incompatible\";\n }\n\n // Handle boolean schemas\n if (typeof targetSchema === \"boolean\") {\n if (targetSchema === false) return \"incompatible\";\n if (targetSchema === true) return \"static\"; // target accepts anything\n return \"incompatible\";\n }\n\n if (typeof sourceSchema === \"boolean\") {\n if (sourceSchema === false) return \"incompatible\";\n // sourceSchema === true means source can be anything, which is compatible with any target, but may not be at runtime\n if (sourceSchema === true) return \"runtime\";\n }\n\n // Handle allOf in source (intersection types - merge all schemas first)\n if (sourceSchema.allOf && Array.isArray(sourceSchema.allOf)) {\n const mergedSchema = mergeAllOfSchemas(sourceSchema.allOf);\n if (mergedSchema === null || mergedSchema === false) {\n return \"incompatible\";\n }\n // Check compatibility of the merged schema against the target\n return areSemanticallyCompatible(mergedSchema, targetSchema);\n }\n\n // Check type compatibility first\n const sourceType = sourceSchema.type;\n const targetType = targetSchema.type;\n\n // Handle oneOf/anyOf in source first\n if (sourceSchema.oneOf && Array.isArray(sourceSchema.oneOf)) {\n let hasStatic = false;\n let hasRuntime = false;\n\n for (const sourceOption of sourceSchema.oneOf) {\n const compatibility = areSemanticallyCompatible(sourceOption as JsonSchema, targetSchema);\n if (compatibility === \"static\") {\n hasStatic = true;\n } else if (compatibility === \"runtime\") {\n hasRuntime = true;\n }\n }\n\n // If any option requires runtime check, the whole thing requires runtime check\n if (hasRuntime) return \"runtime\";\n if (hasStatic) return \"static\";\n return \"incompatible\";\n }\n\n if (sourceSchema.anyOf && Array.isArray(sourceSchema.anyOf)) {\n let hasStatic = false;\n let hasRuntime = false;\n\n for (const sourceOption of sourceSchema.anyOf) {\n const compatibility = areSemanticallyCompatible(sourceOption as JsonSchema, targetSchema);\n if (compatibility === \"static\") {\n hasStatic = true;\n } else if (compatibility === \"runtime\") {\n hasRuntime = true;\n }\n }\n\n // If any option requires runtime check, the whole thing requires runtime check\n if (hasRuntime) return \"runtime\";\n if (hasStatic) return \"static\";\n return \"incompatible\";\n }\n\n // Handle oneOf/anyOf in target (e.g., oneOf[string[], string])\n if (targetSchema.oneOf && Array.isArray(targetSchema.oneOf)) {\n return isCompatibleWithUnion(sourceSchema, targetSchema.oneOf);\n }\n\n if (targetSchema.anyOf && Array.isArray(targetSchema.anyOf)) {\n return isCompatibleWithUnion(sourceSchema, targetSchema.anyOf);\n }\n\n // Handle allOf in target (intersection types - source must be compatible with all)\n if (targetSchema.allOf && Array.isArray(targetSchema.allOf)) {\n let hasStatic = false;\n let hasRuntime = false;\n\n for (const allOfSchema of targetSchema.allOf) {\n const compatibility = areSemanticallyCompatible(sourceSchema, allOfSchema as JsonSchema);\n if (compatibility === \"incompatible\") {\n return \"incompatible\";\n } else if (compatibility === \"static\") {\n hasStatic = true;\n } else if (compatibility === \"runtime\") {\n hasRuntime = true;\n }\n }\n\n if (hasRuntime) return \"runtime\";\n if (hasStatic) return \"static\";\n return \"incompatible\";\n }\n\n // Handle object types - check if properties are compatible\n if (sourceType === \"object\" && targetType === \"object\") {\n const sourceProperties = sourceSchema.properties;\n const targetProperties = targetSchema.properties;\n\n // If target has no properties constraint, it accepts any object\n if (!targetProperties) {\n return \"static\";\n }\n\n // If source has no properties but target does, check if target allows additional properties\n if (!sourceProperties) {\n // If target doesn't allow additional properties, incompatible\n if (targetSchema.additionalProperties === false) {\n return \"incompatible\";\n }\n // Otherwise, source (any object) is compatible with target that allows additional properties\n return \"static\";\n }\n\n // Check if all required target properties are present and compatible in source\n const targetRequired = targetSchema.required || [];\n let hasRuntime = false;\n\n for (const propName of targetRequired) {\n const targetProp = (targetProperties as Record<string, JsonSchema>)?.[propName];\n const sourceProp = (sourceProperties as Record<string, JsonSchema>)?.[propName];\n\n // If target requires a property that source doesn't have, incompatible\n if (!sourceProp) {\n return \"incompatible\";\n }\n\n // Check compatibility of the property\n if (targetProp) {\n const propCompatibility = areSemanticallyCompatible(sourceProp, targetProp);\n if (propCompatibility === \"incompatible\") {\n return \"incompatible\";\n } else if (propCompatibility === \"runtime\") {\n hasRuntime = true;\n }\n }\n }\n\n // Check if target allows additional properties\n if (targetSchema.additionalProperties === false) {\n // Target doesn't allow additional properties, so source can't have extra properties\n const sourcePropNames = Object.keys(sourceProperties as Record<string, JsonSchema>);\n const targetPropNames = Object.keys(targetProperties as Record<string, JsonSchema>);\n const extraProps = sourcePropNames.filter((name) => !targetPropNames.includes(name));\n if (extraProps.length > 0) {\n return \"incompatible\";\n }\n }\n\n if (hasRuntime) return \"runtime\";\n return \"static\";\n }\n\n // Handle array types - check compatibility of array items and array format\n if (sourceType === \"array\" && targetType === \"array\") {\n // First check format on the array schema itself (e.g., format: \"Float64Array\")\n const sourceFormat = (sourceSchema as any)?.format;\n const targetFormat = (targetSchema as any)?.format;\n\n let formatCompatibility: \"static\" | \"runtime\" | \"incompatible\" | null = null;\n\n // Both have format: check compatibility using prefix matching\n if (sourceFormat && targetFormat) {\n formatCompatibility = areFormatStringsCompatible(sourceFormat, targetFormat);\n // If formats are incompatible, the arrays are incompatible\n if (formatCompatibility === \"incompatible\") {\n return \"incompatible\";\n }\n }\n\n // Source has format, target doesn't: static compatible (source is more specific)\n if (sourceFormat && !targetFormat) {\n return \"static\";\n }\n\n // Source doesn't have format, target does: incompatible (target requires format)\n if (!sourceFormat && targetFormat) {\n return \"incompatible\";\n }\n\n const sourceItems = sourceSchema.items;\n const targetItems = targetSchema.items;\n\n // If both have items schemas, recursively check compatibility\n if (\n sourceItems &&\n typeof sourceItems === \"object\" &&\n !Array.isArray(sourceItems) &&\n targetItems &&\n typeof targetItems === \"object\" &&\n !Array.isArray(targetItems)\n ) {\n const itemsCompatibility = areSemanticallyCompatible(\n sourceItems as JsonSchema,\n targetItems as JsonSchema\n );\n // If format requires runtime check, return runtime (more restrictive)\n if (formatCompatibility === \"runtime\") {\n return \"runtime\";\n }\n return itemsCompatibility;\n }\n\n // If target accepts any array items, it's statically compatible\n if (!targetItems) {\n return \"static\";\n }\n\n // If source has no items but target does, incompatible\n if (!sourceItems) {\n return \"incompatible\";\n }\n\n // If target items is an array (tuple), check if source is compatible with any item\n if (Array.isArray(targetItems)) {\n return isCompatibleWithUnion(sourceItems as JsonSchema, targetItems as JsonSchema[]);\n }\n\n // Fallback to static if we can't determine\n return \"static\";\n }\n\n // If source has no type constraint, it can be anything (compatible with any target)\n // But we need to check if target has constraints that might require runtime checks\n if (!sourceType) {\n // Source accepts any type, but target might have format requiring runtime check\n const targetFormat = (targetSchema as any)?.format;\n if (targetFormat) {\n return \"runtime\";\n }\n return \"static\";\n }\n\n // Check if types are statically compatible\n if (!targetType) {\n // Target has no type constraint, it accepts anything\n // But we still need to check format - if target requires format, source must have it\n const targetFormat = (targetSchema as any)?.format;\n if (targetFormat) {\n // Target requires format, check if source has it\n const sourceFormat = (sourceSchema as any)?.format;\n if (!sourceFormat) {\n return \"incompatible\";\n }\n // Both have format, check compatibility\n return areFormatStringsCompatible(sourceFormat, targetFormat);\n }\n return \"static\";\n }\n\n if (!isTypeStaticallyCompatible(sourceType, targetType)) {\n return \"incompatible\";\n }\n\n // If types are compatible, check format compatibility\n // Format checks apply to all types, not just strings\n // Access format field directly (it's a standard JSON Schema field)\n const sourceFormat = (sourceSchema as any)?.format;\n const targetFormat = (targetSchema as any)?.format;\n\n // Both have format: check compatibility using prefix matching\n if (sourceFormat && targetFormat) {\n return areFormatStringsCompatible(sourceFormat, targetFormat);\n }\n\n // Source has format, target doesn't: static compatible (source is more specific)\n if (sourceFormat && !targetFormat) {\n return \"static\";\n }\n\n // Source doesn't have format, target does: incompatible (target requires format)\n if (!sourceFormat && targetFormat) {\n return \"incompatible\";\n }\n\n // Neither has format: static compatible\n return \"static\";\n}\n\n/**\n * Checks if two object schemas are semantically compatible.\n * This is a helper function for checking object-level schema compatibility.\n */\nexport function areObjectSchemasSemanticallyCompatible(\n sourceSchema: JsonSchema,\n targetSchema: JsonSchema\n): \"static\" | \"runtime\" | \"incompatible\" {\n return areSemanticallyCompatible(sourceSchema, targetSchema);\n}\n",
7
- "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { compileSchema } from \"@sroussey/json-schema-library\";\nexport type { SchemaNode } from \"@sroussey/json-schema-library\";\n\nimport type { DataPortSchema } from \"./DataPortSchema\";\nimport type { JsonSchema } from \"./JsonSchema\";\n\n// ========================================================================\n// Schema Validation Types\n// ========================================================================\n\nexport interface SchemaValidationError {\n readonly path: string;\n readonly message: string;\n}\n\nexport interface SchemaValidationResult {\n readonly valid: boolean;\n readonly errors: readonly SchemaValidationError[];\n}\n\nconst VALID_RESULT: SchemaValidationResult = Object.freeze({\n valid: true,\n errors: Object.freeze([] as SchemaValidationError[]),\n});\n\n/**\n * Pattern for format annotations used in dataflow compatibility checking.\n * Format: /\\w+(:\\w+)?/ where first part is the \"name\" and optional second part narrows the type.\n * Reused from SchemaUtils.ts areFormatStringsCompatible().\n */\nconst FORMAT_PATTERN = /^[a-zA-Z][a-zA-Z0-9_-]*(?::[a-zA-Z][a-zA-Z0-9_-]*)?$/;\n\nconst VALID_JSON_SCHEMA_TYPES = new Set([\n \"string\",\n \"number\",\n \"integer\",\n \"boolean\",\n \"object\",\n \"array\",\n \"null\",\n]);\n\n// ========================================================================\n// Schema Structure Validation\n// ========================================================================\n\n/**\n * Validates that a schema is a well-formed DataPortSchema.\n *\n * A DataPortSchema must be either a boolean or an object with `type: \"object\"`\n * and a `properties` record where no property value is a boolean.\n */\nexport function validateDataPortSchema(schema: DataPortSchema): SchemaValidationResult {\n if (typeof schema === \"boolean\") {\n return VALID_RESULT;\n }\n\n const errors: SchemaValidationError[] = [];\n\n if (typeof schema !== \"object\" || schema === null) {\n return { valid: false, errors: [{ path: \"\", message: \"Schema must be a boolean or object\" }] };\n }\n\n if (schema.type !== \"object\") {\n errors.push({\n path: \"/type\",\n message: `DataPortSchema must have type \"object\", got \"${String(schema.type)}\"`,\n });\n }\n\n if (\n !schema.properties ||\n typeof schema.properties !== \"object\" ||\n Array.isArray(schema.properties)\n ) {\n errors.push({\n path: \"/properties\",\n message: \"DataPortSchema must have a properties object\",\n });\n } else {\n for (const [key, value] of Object.entries(schema.properties)) {\n if (typeof value === \"boolean\") {\n errors.push({\n path: `/properties/${key}`,\n message: `Property \"${key}\" must not be a boolean schema`,\n });\n continue;\n }\n collectJsonSchemaErrors(value as JsonSchema, `/properties/${key}`, errors);\n }\n }\n\n return errors.length === 0 ? VALID_RESULT : { valid: false, errors };\n}\n\n/**\n * Validates structural correctness of a JsonSchema value (property, items, etc.).\n * Checks that `type` (if present) is a known JSON Schema type.\n */\nfunction collectJsonSchemaErrors(\n schema: JsonSchema,\n path: string,\n errors: SchemaValidationError[]\n): void {\n if (typeof schema === \"boolean\") {\n return;\n }\n\n if (schema === null || schema === undefined) {\n errors.push({ path, message: `Expected schema object, got ${typeof schema}` });\n return;\n }\n\n if (typeof schema !== \"object\") {\n errors.push({ path, message: `Expected schema object, got ${typeof schema}` });\n return;\n }\n\n // Validate type field\n if (schema.type !== undefined) {\n if (typeof schema.type === \"string\") {\n if (!VALID_JSON_SCHEMA_TYPES.has(schema.type)) {\n errors.push({\n path: `${path}/type`,\n message: `Unknown JSON Schema type \"${schema.type}\"`,\n });\n }\n } else if (Array.isArray(schema.type)) {\n for (const t of schema.type) {\n if (!VALID_JSON_SCHEMA_TYPES.has(t as string)) {\n errors.push({\n path: `${path}/type`,\n message: `Unknown JSON Schema type \"${String(t)}\" in type array`,\n });\n }\n }\n }\n }\n\n // Recurse into nested schemas\n if (schema.properties && typeof schema.properties === \"object\") {\n for (const [key, value] of Object.entries(schema.properties)) {\n if (typeof value === \"boolean\") {\n continue; // boolean schemas are valid in nested JSON Schema\n }\n collectJsonSchemaErrors(value as JsonSchema, `${path}/properties/${key}`, errors);\n }\n }\n\n if (schema.items && typeof schema.items === \"object\" && !Array.isArray(schema.items)) {\n collectJsonSchemaErrors(schema.items as JsonSchema, `${path}/items`, errors);\n }\n\n if (Array.isArray(schema.items)) {\n for (let i = 0; i < schema.items.length; i++) {\n collectJsonSchemaErrors(schema.items[i] as JsonSchema, `${path}/items/${i}`, errors);\n }\n }\n\n for (const keyword of [\"oneOf\", \"anyOf\", \"allOf\"] as const) {\n const arr = (schema as Record<string, unknown>)[keyword];\n if (Array.isArray(arr)) {\n for (let i = 0; i < arr.length; i++) {\n collectJsonSchemaErrors(arr[i] as JsonSchema, `${path}/${keyword}/${i}`, errors);\n }\n }\n }\n}\n\n// ========================================================================\n// Format Annotation Validation\n// ========================================================================\n\n/**\n * Validates that all `format` annotations in a schema match the expected pattern.\n *\n * Format annotations use the pattern `/^[a-zA-Z][a-zA-Z0-9_-]*(:[a-zA-Z][a-zA-Z0-9_-]*)?$/`\n * (e.g., `\"model\"`, `\"model:EmbeddingTask\"`, `\"storage:tabular\"`).\n *\n * Standard JSON Schema formats (e.g., `\"date-time\"`, `\"uri\"`, `\"email\"`) also pass\n * since they match the pattern.\n */\nexport function validateFormatAnnotations(schema: DataPortSchema): SchemaValidationResult {\n if (typeof schema === \"boolean\") {\n return VALID_RESULT;\n }\n\n if (typeof schema !== \"object\" || schema === null || Array.isArray(schema)) {\n return {\n valid: false,\n errors: [{ path: \"\", message: \"Schema must be a JSON Schema object or boolean\" }],\n };\n }\n\n const errors: SchemaValidationError[] = [];\n collectFormatErrors(schema as JsonSchema, \"\", errors);\n return errors.length === 0 ? VALID_RESULT : { valid: false, errors };\n}\n\nfunction collectFormatErrors(\n schema: JsonSchema,\n path: string,\n errors: SchemaValidationError[]\n): void {\n if (typeof schema !== \"object\" || schema === null) {\n return;\n }\n\n // Check format on this schema node\n const format = (schema as Record<string, unknown>).format;\n if (typeof format === \"string\" && !FORMAT_PATTERN.test(format)) {\n errors.push({\n path: `${path}/format`,\n message: `Invalid format annotation \"${format}\" — must match pattern ${FORMAT_PATTERN.source}`,\n });\n }\n\n // Recurse into properties\n if (schema.properties && typeof schema.properties === \"object\") {\n for (const [key, value] of Object.entries(schema.properties)) {\n collectFormatErrors(value as JsonSchema, `${path}/properties/${key}`, errors);\n }\n }\n\n // Recurse into items\n if (schema.items && typeof schema.items === \"object\" && !Array.isArray(schema.items)) {\n collectFormatErrors(schema.items as JsonSchema, `${path}/items`, errors);\n }\n\n if (Array.isArray(schema.items)) {\n for (let i = 0; i < schema.items.length; i++) {\n collectFormatErrors(schema.items[i] as JsonSchema, `${path}/items/${i}`, errors);\n }\n }\n\n // Recurse into oneOf/anyOf/allOf\n for (const keyword of [\"oneOf\", \"anyOf\", \"allOf\"] as const) {\n const arr = (schema as Record<string, unknown>)[keyword];\n if (Array.isArray(arr)) {\n for (let i = 0; i < arr.length; i++) {\n collectFormatErrors(arr[i] as JsonSchema, `${path}/${keyword}/${i}`, errors);\n }\n }\n }\n}\n\n// ========================================================================\n// Combined Validation\n// ========================================================================\n\n/**\n * Validates a DataPortSchema for both structural correctness and valid format annotations.\n * Convenience function combining {@link validateDataPortSchema} and {@link validateFormatAnnotations}.\n */\nexport function validateSchema(schema: DataPortSchema): SchemaValidationResult {\n if (typeof schema === \"boolean\") {\n return VALID_RESULT;\n }\n\n const structureResult = validateDataPortSchema(schema);\n const formatResult = validateFormatAnnotations(schema);\n\n const allErrors = [...structureResult.errors, ...formatResult.errors];\n return allErrors.length === 0 ? VALID_RESULT : { valid: false, errors: allErrors };\n}\n",
6
+ "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { compileSchema } from \"@sroussey/json-schema-library\";\nexport type { SchemaNode } from \"@sroussey/json-schema-library\";\n\nimport type { DataPortSchema } from \"./DataPortSchema\";\nimport type { JsonSchema } from \"./JsonSchema\";\n\n// ========================================================================\n// Schema Validation Types\n// ========================================================================\n\nexport interface SchemaValidationError {\n readonly path: string;\n readonly message: string;\n}\n\nexport interface SchemaValidationResult {\n readonly valid: boolean;\n readonly errors: readonly SchemaValidationError[];\n}\n\nconst VALID_RESULT: SchemaValidationResult = Object.freeze({\n valid: true,\n errors: Object.freeze([] as SchemaValidationError[]),\n});\n\n/**\n * Pattern for format annotations used in dataflow compatibility checking.\n * Format: /\\w+(:\\w+)?/ where first part is the \"name\" and optional second part narrows the type.\n * Reused from SchemaUtils.ts areFormatStringsCompatible().\n */\nexport const FORMAT_PATTERN = /^[a-zA-Z][a-zA-Z0-9_-]*(?::[a-zA-Z0-9][a-zA-Z0-9_-]*)*$/;\n\nconst VALID_JSON_SCHEMA_TYPES = new Set([\n \"string\",\n \"number\",\n \"integer\",\n \"boolean\",\n \"object\",\n \"array\",\n \"null\",\n]);\n\n// ========================================================================\n// Schema Structure Validation\n// ========================================================================\n\n/**\n * Validates that a schema is a well-formed DataPortSchema.\n *\n * A DataPortSchema must be either a boolean or an object with `type: \"object\"`\n * and a `properties` record where no property value is a boolean.\n */\nexport function validateDataPortSchema(schema: DataPortSchema): SchemaValidationResult {\n if (typeof schema === \"boolean\") {\n return VALID_RESULT;\n }\n\n const errors: SchemaValidationError[] = [];\n\n if (typeof schema !== \"object\" || schema === null) {\n return { valid: false, errors: [{ path: \"\", message: \"Schema must be a boolean or object\" }] };\n }\n\n if (schema.type !== \"object\") {\n errors.push({\n path: \"/type\",\n message: `DataPortSchema must have type \"object\", got \"${String(schema.type)}\"`,\n });\n }\n\n if (\n !schema.properties ||\n typeof schema.properties !== \"object\" ||\n Array.isArray(schema.properties)\n ) {\n errors.push({\n path: \"/properties\",\n message: \"DataPortSchema must have a properties object\",\n });\n } else {\n for (const [key, value] of Object.entries(schema.properties)) {\n if (typeof value === \"boolean\") {\n errors.push({\n path: `/properties/${key}`,\n message: `Property \"${key}\" must not be a boolean schema`,\n });\n continue;\n }\n collectJsonSchemaErrors(value as JsonSchema, `/properties/${key}`, errors);\n }\n }\n\n return errors.length === 0 ? VALID_RESULT : { valid: false, errors };\n}\n\n/**\n * Validates structural correctness of a JsonSchema value (property, items, etc.).\n * Checks that `type` (if present) is a known JSON Schema type.\n */\nfunction collectJsonSchemaErrors(\n schema: JsonSchema,\n path: string,\n errors: SchemaValidationError[]\n): void {\n if (typeof schema === \"boolean\") {\n return;\n }\n\n if (schema === null || schema === undefined) {\n errors.push({ path, message: `Expected schema object, got ${typeof schema}` });\n return;\n }\n\n if (typeof schema !== \"object\") {\n errors.push({ path, message: `Expected schema object, got ${typeof schema}` });\n return;\n }\n\n // Validate type field\n if (schema.type !== undefined) {\n if (typeof schema.type === \"string\") {\n if (!VALID_JSON_SCHEMA_TYPES.has(schema.type)) {\n errors.push({\n path: `${path}/type`,\n message: `Unknown JSON Schema type \"${schema.type}\"`,\n });\n }\n } else if (Array.isArray(schema.type)) {\n for (const t of schema.type) {\n if (!VALID_JSON_SCHEMA_TYPES.has(t as string)) {\n errors.push({\n path: `${path}/type`,\n message: `Unknown JSON Schema type \"${String(t)}\" in type array`,\n });\n }\n }\n }\n }\n\n // Recurse into nested schemas\n if (schema.properties && typeof schema.properties === \"object\") {\n for (const [key, value] of Object.entries(schema.properties)) {\n if (typeof value === \"boolean\") {\n continue; // boolean schemas are valid in nested JSON Schema\n }\n collectJsonSchemaErrors(value as JsonSchema, `${path}/properties/${key}`, errors);\n }\n }\n\n if (schema.items && typeof schema.items === \"object\" && !Array.isArray(schema.items)) {\n collectJsonSchemaErrors(schema.items as JsonSchema, `${path}/items`, errors);\n }\n\n if (Array.isArray(schema.items)) {\n for (let i = 0; i < schema.items.length; i++) {\n collectJsonSchemaErrors(schema.items[i] as JsonSchema, `${path}/items/${i}`, errors);\n }\n }\n\n for (const keyword of [\"oneOf\", \"anyOf\", \"allOf\"] as const) {\n const arr = (schema as Record<string, unknown>)[keyword];\n if (Array.isArray(arr)) {\n for (let i = 0; i < arr.length; i++) {\n collectJsonSchemaErrors(arr[i] as JsonSchema, `${path}/${keyword}/${i}`, errors);\n }\n }\n }\n}\n\n// ========================================================================\n// Format Annotation Validation\n// ========================================================================\n\n/**\n * Validates that all `format` annotations in a schema match the expected pattern.\n *\n * Format annotations use the pattern `/^[a-zA-Z][a-zA-Z0-9_-]*(:[a-zA-Z][a-zA-Z0-9_-]*)?$/`\n * (e.g., `\"model\"`, `\"model:EmbeddingTask\"`, `\"storage:tabular\"`).\n *\n * Standard JSON Schema formats (e.g., `\"date-time\"`, `\"uri\"`, `\"email\"`) also pass\n * since they match the pattern.\n */\nexport function validateFormatAnnotations(schema: DataPortSchema): SchemaValidationResult {\n if (typeof schema === \"boolean\") {\n return VALID_RESULT;\n }\n\n if (typeof schema !== \"object\" || schema === null || Array.isArray(schema)) {\n return {\n valid: false,\n errors: [{ path: \"\", message: \"Schema must be a JSON Schema object or boolean\" }],\n };\n }\n\n const errors: SchemaValidationError[] = [];\n collectFormatErrors(schema as JsonSchema, \"\", errors);\n return errors.length === 0 ? VALID_RESULT : { valid: false, errors };\n}\n\nfunction collectFormatErrors(\n schema: JsonSchema,\n path: string,\n errors: SchemaValidationError[]\n): void {\n if (typeof schema !== \"object\" || schema === null) {\n return;\n }\n\n // Check format on this schema node\n const format = (schema as Record<string, unknown>).format;\n if (typeof format === \"string\" && !FORMAT_PATTERN.test(format)) {\n errors.push({\n path: `${path}/format`,\n message: `Invalid format annotation \"${format}\" — must match pattern ${FORMAT_PATTERN.source}`,\n });\n }\n\n // Recurse into properties\n if (schema.properties && typeof schema.properties === \"object\") {\n for (const [key, value] of Object.entries(schema.properties)) {\n collectFormatErrors(value as JsonSchema, `${path}/properties/${key}`, errors);\n }\n }\n\n // Recurse into items\n if (schema.items && typeof schema.items === \"object\" && !Array.isArray(schema.items)) {\n collectFormatErrors(schema.items as JsonSchema, `${path}/items`, errors);\n }\n\n if (Array.isArray(schema.items)) {\n for (let i = 0; i < schema.items.length; i++) {\n collectFormatErrors(schema.items[i] as JsonSchema, `${path}/items/${i}`, errors);\n }\n }\n\n // Recurse into oneOf/anyOf/allOf\n for (const keyword of [\"oneOf\", \"anyOf\", \"allOf\"] as const) {\n const arr = (schema as Record<string, unknown>)[keyword];\n if (Array.isArray(arr)) {\n for (let i = 0; i < arr.length; i++) {\n collectFormatErrors(arr[i] as JsonSchema, `${path}/${keyword}/${i}`, errors);\n }\n }\n }\n}\n\n// ========================================================================\n// Combined Validation\n// ========================================================================\n\n/**\n * Validates a DataPortSchema for both structural correctness and valid format annotations.\n * Convenience function combining {@link validateDataPortSchema} and {@link validateFormatAnnotations}.\n */\nexport function validateSchema(schema: DataPortSchema): SchemaValidationResult {\n if (typeof schema === \"boolean\") {\n return VALID_RESULT;\n }\n\n const structureResult = validateDataPortSchema(schema);\n const formatResult = validateFormatAnnotations(schema);\n\n const allErrors = [...structureResult.errors, ...formatResult.errors];\n return allErrors.length === 0 ? VALID_RESULT : { valid: false, errors: allErrors };\n}\n",
7
+ "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Semantic Compatibility Utilities for Task Graph Dataflows\n *\n * In this project, task graphs have connections between tasks called dataflows.\n * These dataflows have different kinds of compatibility checks:\n *\n * **Static Compatibility:**\n * Static rules help decide if an edge should be connected at all. A connection\n * is statically compatible if:\n * - The source and target are the same exact type\n * - The source connects to the equivalent of \"any\" (target accepts anything)\n * - The source type is acceptable to the target (e.g., a string to something\n * that accepts oneOf[string[], string])\n *\n * **Runtime Compatibility:**\n * Assuming the connection is allowed at design time (passes static check),\n * runtime rules determine if they are compatible during execution.\n *\n * Currently, there is one runtime compatibility check:\n * - If both input and output schemas have 'format' annotations attached,\n * the format annotation has the format /\\w+(:\\w+)?/ where the first part\n * is the \"name\" and if alone matches any other with the same \"name\".\n * If there is a second part, then that narrows the type.\n * - Format checks apply to all types (strings, arrays, etc.), not just strings\n * - A schema with format can connect to a schema with no format (source has format, target doesn't)\n * - A schema with no format cannot connect to a schema with format (source doesn't have format, target does)\n *\n * Example: In the AI package, 'format':'model' and 'format': 'model:EmbeddingTask'\n * are used on string types. An input with property `model` and 'format':'model'\n * connects to a target with property `model` and 'format':'model:EmbeddingTask' --\n * this compatibility is called \"runtime\". It first passes the static check as\n * compatible and then notices a difference in format runtime.\n *\n * Format is also used on array types, e.g., 'format':'Float64Array' on arrays\n * containing Float64 numbers.\n *\n * Only connections that pass the runtime check will pass data at runtime.\n */\n\nimport type { JsonSchema } from \"./JsonSchema\";\nimport { FORMAT_PATTERN } from \"./SchemaValidation\";\n\n/**\n * Checks if two format strings are compatible.\n * Format: /\\w+(:\\w+)?/ where first part is the \"name\" and optional second part narrows the type.\n * - Same name without narrowing: static compatible\n * - Source name matches target narrowed name: runtime compatible\n * - Different names or incompatible narrowing: incompatible\n */\nfunction areFormatStringsCompatible(\n sourceFormat: string,\n targetFormat: string\n): \"static\" | \"runtime\" | \"incompatible\" {\n if (!FORMAT_PATTERN.test(sourceFormat) || !FORMAT_PATTERN.test(targetFormat)) {\n return \"incompatible\";\n }\n\n const [sourceName, sourceNarrow] = sourceFormat.split(\":\");\n const [targetName, targetNarrow] = targetFormat.split(\":\");\n\n // Different base names are incompatible\n if (sourceName !== targetName) {\n return \"incompatible\";\n }\n\n // Same name, no narrowing on either: static compatible\n if (!sourceNarrow && !targetNarrow) {\n return \"static\";\n }\n\n // Source has narrowing, target doesn't: static compatible (source is more specific)\n if (sourceNarrow && !targetNarrow) {\n return \"static\";\n }\n\n // Target has narrowing, source doesn't: runtime compatible (target is more specific)\n if (!sourceNarrow && targetNarrow) {\n return \"runtime\";\n }\n\n // Both have narrowing: must match exactly for static, otherwise incompatible\n if (sourceNarrow === targetNarrow) {\n return \"static\";\n }\n\n return \"incompatible\";\n}\n\n/**\n * Checks if a source type is statically compatible with a target type.\n * Handles cases like string to oneOf[string[], string] or string to any.\n */\nfunction isTypeStaticallyCompatible(sourceType: unknown, targetType: unknown): boolean {\n // Target accepts any type (no type constraint)\n if (!targetType) {\n return true;\n }\n\n // Source has no type constraint\n if (!sourceType) {\n return false;\n }\n\n // Convert to arrays for comparison\n const sourceTypes = Array.isArray(sourceType) ? sourceType : [sourceType];\n const targetTypes = Array.isArray(targetType) ? targetType : [targetType];\n\n // Check if any source type matches any target type\n return sourceTypes.some((st) => targetTypes.includes(st as any));\n}\n\n/**\n * Merges allOf schemas into a single schema representing their intersection.\n * For example: allOf: [{ type: \"string\", format: \"model\" }, { type: \"string\" }]\n * becomes: { type: \"string\", format: \"model\" }\n */\nfunction mergeAllOfSchemas(schemas: JsonSchema[]): JsonSchema | null {\n if (schemas.length === 0) return null;\n if (schemas.length === 1) return schemas[0] as JsonSchema;\n\n let merged: Record<string, unknown> = {};\n\n for (const schema of schemas) {\n if (typeof schema === \"boolean\") {\n if (schema === false) return false; // false in allOf makes the whole thing false\n // true in allOf doesn't add constraints, so we can skip it\n continue;\n }\n\n // At this point, schema is an object\n const schemaObj = schema as Record<string, unknown>;\n\n // Merge type\n if (schemaObj.type !== undefined) {\n if (merged.type === undefined) {\n merged.type = schemaObj.type;\n } else if (merged.type !== schemaObj.type) {\n // Types must be compatible - if they're different primitives, it's incompatible\n const mergedTypes = Array.isArray(merged.type) ? merged.type : [merged.type];\n const schemaTypes = Array.isArray(schemaObj.type) ? schemaObj.type : [schemaObj.type];\n const commonTypes = mergedTypes.filter((t: unknown) => schemaTypes.includes(t));\n if (commonTypes.length === 0) {\n return false; // Incompatible types\n }\n merged.type = commonTypes.length === 1 ? commonTypes[0] : commonTypes;\n }\n }\n\n // Merge format - use the most specific one (the one with narrowing if any)\n const schemaFormat = schemaObj.format as string | undefined;\n const mergedFormat = merged.format as string | undefined;\n if (schemaFormat) {\n if (!mergedFormat) {\n merged.format = schemaFormat;\n } else {\n // Both have formats - check if they're compatible\n const formatCompat = areFormatStringsCompatible(mergedFormat, schemaFormat);\n if (formatCompat === \"incompatible\") {\n return false; // Incompatible formats\n }\n // Use the more specific format (the one with narrowing, or either if both same)\n const mergedHasNarrow = mergedFormat.includes(\":\");\n const schemaHasNarrow = schemaFormat.includes(\":\");\n if (schemaHasNarrow && !mergedHasNarrow) {\n merged.format = schemaFormat;\n } else if (!schemaHasNarrow && mergedHasNarrow) {\n // Keep merged format (it's more specific)\n } else if (mergedFormat !== schemaFormat) {\n // Both have narrowing and they're different - should be caught by areFormatStringsCompatible\n return false;\n }\n }\n }\n\n // Merge properties for objects\n if (schemaObj.properties && typeof schemaObj.properties === \"object\") {\n if (!merged.properties) {\n merged.properties = {};\n }\n const mergedProps = merged.properties as Record<string, JsonSchema>;\n const schemaProps = schemaObj.properties as Record<string, JsonSchema>;\n for (const [key, value] of Object.entries(schemaProps)) {\n if (mergedProps[key]) {\n // Recursively merge nested schemas\n const nestedMerged = mergeAllOfSchemas([mergedProps[key], value]);\n if (nestedMerged === null || nestedMerged === false) {\n return false;\n }\n mergedProps[key] = nestedMerged as JsonSchema;\n } else {\n mergedProps[key] = value;\n }\n }\n }\n\n // Merge required arrays\n if (schemaObj.required && Array.isArray(schemaObj.required)) {\n if (!merged.required) {\n merged.required = [];\n }\n const mergedRequired = merged.required as string[];\n const schemaRequired = schemaObj.required as string[];\n // Intersection of required arrays\n merged.required = mergedRequired.filter((r) => schemaRequired.includes(r));\n }\n\n // Merge additionalProperties - most restrictive wins\n if (schemaObj.additionalProperties !== undefined) {\n if (merged.additionalProperties === undefined) {\n merged.additionalProperties = schemaObj.additionalProperties;\n } else if (merged.additionalProperties === true && schemaObj.additionalProperties === false) {\n merged.additionalProperties = false; // false is more restrictive\n }\n }\n\n // Merge items for arrays\n if (schemaObj.items !== undefined) {\n if (merged.items === undefined) {\n merged.items = schemaObj.items;\n } else {\n // Recursively merge item schemas\n const mergedItems = mergeAllOfSchemas([\n merged.items as JsonSchema,\n schemaObj.items as JsonSchema,\n ]);\n if (mergedItems === null || mergedItems === false) {\n return false;\n }\n merged.items = mergedItems;\n }\n }\n }\n\n return merged as JsonSchema;\n}\n\n/**\n * Checks if a source schema is compatible with a target schema in a oneOf/anyOf union.\n */\nfunction isCompatibleWithUnion(\n sourceSchema: JsonSchema,\n unionSchemas: JsonSchema[]\n): \"static\" | \"runtime\" | \"incompatible\" {\n let hasStatic = false;\n let hasRuntime = false;\n\n for (const unionSchema of unionSchemas) {\n const compatibility = areSemanticallyCompatible(sourceSchema, unionSchema);\n if (compatibility === \"static\") {\n hasStatic = true;\n } else if (compatibility === \"runtime\") {\n hasRuntime = true;\n }\n }\n\n if (hasStatic) return \"static\";\n if (hasRuntime) return \"runtime\";\n return \"incompatible\";\n}\n\n/**\n * Checks if two JSON schemas are semantically compatible.\n * Returns:\n * - \"static\": Compatible at design time, no runtime check needed\n * - \"runtime\": Compatible at design time, but needs runtime semantic check\n * - \"incompatible\": Not compatible\n */\nexport function areSemanticallyCompatible(\n sourceSchema: JsonSchema,\n targetSchema: JsonSchema\n): \"static\" | \"runtime\" | \"incompatible\" {\n // Handle undefined schemas (non-existent ports)\n if (sourceSchema === undefined || targetSchema === undefined) {\n return \"incompatible\";\n }\n\n // Handle boolean schemas\n if (typeof targetSchema === \"boolean\") {\n if (targetSchema === false) return \"incompatible\";\n if (targetSchema === true) return \"static\"; // target accepts anything\n return \"incompatible\";\n }\n\n if (typeof sourceSchema === \"boolean\") {\n if (sourceSchema === false) return \"incompatible\";\n // sourceSchema === true means source can be anything, which is compatible with any target, but may not be at runtime\n if (sourceSchema === true) return \"runtime\";\n }\n\n // Handle allOf in source (intersection types - merge all schemas first)\n if (sourceSchema.allOf && Array.isArray(sourceSchema.allOf)) {\n const mergedSchema = mergeAllOfSchemas(sourceSchema.allOf);\n if (mergedSchema === null || mergedSchema === false) {\n return \"incompatible\";\n }\n // Check compatibility of the merged schema against the target\n return areSemanticallyCompatible(mergedSchema, targetSchema);\n }\n\n // Check type compatibility first\n const sourceType = sourceSchema.type;\n const targetType = targetSchema.type;\n\n // Handle oneOf/anyOf in source first\n if (sourceSchema.oneOf && Array.isArray(sourceSchema.oneOf)) {\n let hasStatic = false;\n let hasRuntime = false;\n\n for (const sourceOption of sourceSchema.oneOf) {\n const compatibility = areSemanticallyCompatible(sourceOption as JsonSchema, targetSchema);\n if (compatibility === \"static\") {\n hasStatic = true;\n } else if (compatibility === \"runtime\") {\n hasRuntime = true;\n }\n }\n\n // If any option requires runtime check, the whole thing requires runtime check\n if (hasRuntime) return \"runtime\";\n if (hasStatic) return \"static\";\n return \"incompatible\";\n }\n\n if (sourceSchema.anyOf && Array.isArray(sourceSchema.anyOf)) {\n let hasStatic = false;\n let hasRuntime = false;\n\n for (const sourceOption of sourceSchema.anyOf) {\n const compatibility = areSemanticallyCompatible(sourceOption as JsonSchema, targetSchema);\n if (compatibility === \"static\") {\n hasStatic = true;\n } else if (compatibility === \"runtime\") {\n hasRuntime = true;\n }\n }\n\n // If any option requires runtime check, the whole thing requires runtime check\n if (hasRuntime) return \"runtime\";\n if (hasStatic) return \"static\";\n return \"incompatible\";\n }\n\n // Handle oneOf/anyOf in target (e.g., oneOf[string[], string])\n if (targetSchema.oneOf && Array.isArray(targetSchema.oneOf)) {\n return isCompatibleWithUnion(sourceSchema, targetSchema.oneOf);\n }\n\n if (targetSchema.anyOf && Array.isArray(targetSchema.anyOf)) {\n return isCompatibleWithUnion(sourceSchema, targetSchema.anyOf);\n }\n\n // Handle allOf in target (intersection types - source must be compatible with all)\n if (targetSchema.allOf && Array.isArray(targetSchema.allOf)) {\n let hasStatic = false;\n let hasRuntime = false;\n\n for (const allOfSchema of targetSchema.allOf) {\n const compatibility = areSemanticallyCompatible(sourceSchema, allOfSchema as JsonSchema);\n if (compatibility === \"incompatible\") {\n return \"incompatible\";\n } else if (compatibility === \"static\") {\n hasStatic = true;\n } else if (compatibility === \"runtime\") {\n hasRuntime = true;\n }\n }\n\n if (hasRuntime) return \"runtime\";\n if (hasStatic) return \"static\";\n return \"incompatible\";\n }\n\n // Handle object types - check if properties are compatible\n if (sourceType === \"object\" && targetType === \"object\") {\n const sourceProperties = sourceSchema.properties;\n const targetProperties = targetSchema.properties;\n\n // If target has no properties constraint, it accepts any object\n if (!targetProperties) {\n return \"static\";\n }\n\n // If source has no properties but target does, check if target allows additional properties\n if (!sourceProperties) {\n // If target doesn't allow additional properties, incompatible\n if (targetSchema.additionalProperties === false) {\n return \"incompatible\";\n }\n // Otherwise, source (any object) is compatible with target that allows additional properties\n return \"static\";\n }\n\n // Check if all required target properties are present and compatible in source\n const targetRequired = targetSchema.required || [];\n let hasRuntime = false;\n\n for (const propName of targetRequired) {\n const targetProp = (targetProperties as Record<string, JsonSchema>)?.[propName];\n const sourceProp = (sourceProperties as Record<string, JsonSchema>)?.[propName];\n\n // If target requires a property that source doesn't have, incompatible\n if (!sourceProp) {\n return \"incompatible\";\n }\n\n // Check compatibility of the property\n if (targetProp) {\n const propCompatibility = areSemanticallyCompatible(sourceProp, targetProp);\n if (propCompatibility === \"incompatible\") {\n return \"incompatible\";\n } else if (propCompatibility === \"runtime\") {\n hasRuntime = true;\n }\n }\n }\n\n // Check if target allows additional properties\n if (targetSchema.additionalProperties === false) {\n // Target doesn't allow additional properties, so source can't have extra properties\n const sourcePropNames = Object.keys(sourceProperties as Record<string, JsonSchema>);\n const targetPropNames = Object.keys(targetProperties as Record<string, JsonSchema>);\n const extraProps = sourcePropNames.filter((name) => !targetPropNames.includes(name));\n if (extraProps.length > 0) {\n return \"incompatible\";\n }\n }\n\n if (hasRuntime) return \"runtime\";\n return \"static\";\n }\n\n // Handle array types - check compatibility of array items and array format\n if (sourceType === \"array\" && targetType === \"array\") {\n // First check format on the array schema itself (e.g., format: \"Float64Array\")\n const sourceFormat = (sourceSchema as any)?.format;\n const targetFormat = (targetSchema as any)?.format;\n\n let formatCompatibility: \"static\" | \"runtime\" | \"incompatible\" | null = null;\n\n // Both have format: check compatibility using prefix matching\n if (sourceFormat && targetFormat) {\n formatCompatibility = areFormatStringsCompatible(sourceFormat, targetFormat);\n // If formats are incompatible, the arrays are incompatible\n if (formatCompatibility === \"incompatible\") {\n return \"incompatible\";\n }\n }\n\n // Source has format, target doesn't: static compatible (source is more specific)\n if (sourceFormat && !targetFormat) {\n return \"static\";\n }\n\n // Source doesn't have format, target does: incompatible (target requires format)\n if (!sourceFormat && targetFormat) {\n return \"incompatible\";\n }\n\n const sourceItems = sourceSchema.items;\n const targetItems = targetSchema.items;\n\n // If both have items schemas, recursively check compatibility\n if (\n sourceItems &&\n typeof sourceItems === \"object\" &&\n !Array.isArray(sourceItems) &&\n targetItems &&\n typeof targetItems === \"object\" &&\n !Array.isArray(targetItems)\n ) {\n const itemsCompatibility = areSemanticallyCompatible(\n sourceItems as JsonSchema,\n targetItems as JsonSchema\n );\n // If format requires runtime check, return runtime (more restrictive)\n if (formatCompatibility === \"runtime\") {\n return \"runtime\";\n }\n return itemsCompatibility;\n }\n\n // If target accepts any array items, it's statically compatible\n if (!targetItems) {\n return \"static\";\n }\n\n // If source has no items but target does, incompatible\n if (!sourceItems) {\n return \"incompatible\";\n }\n\n // If target items is an array (tuple), check if source is compatible with any item\n if (Array.isArray(targetItems)) {\n return isCompatibleWithUnion(sourceItems as JsonSchema, targetItems as JsonSchema[]);\n }\n\n // Fallback to static if we can't determine\n return \"static\";\n }\n\n // If source has no type constraint, it can be anything (compatible with any target)\n // But we need to check if target has constraints that might require runtime checks\n if (!sourceType) {\n // Source accepts any type, but target might have format requiring runtime check\n const targetFormat = (targetSchema as any)?.format;\n if (targetFormat) {\n return \"runtime\";\n }\n return \"static\";\n }\n\n // Check if types are statically compatible\n if (!targetType) {\n // Target has no type constraint, it accepts anything\n // But we still need to check format - if target requires format, source must have it\n const targetFormat = (targetSchema as any)?.format;\n if (targetFormat) {\n // Target requires format, check if source has it\n const sourceFormat = (sourceSchema as any)?.format;\n if (!sourceFormat) {\n return \"incompatible\";\n }\n // Both have format, check compatibility\n return areFormatStringsCompatible(sourceFormat, targetFormat);\n }\n return \"static\";\n }\n\n if (!isTypeStaticallyCompatible(sourceType, targetType)) {\n return \"incompatible\";\n }\n\n // If types are compatible, check format compatibility\n // Format checks apply to all types, not just strings\n // Access format field directly (it's a standard JSON Schema field)\n const sourceFormat = (sourceSchema as any)?.format;\n const targetFormat = (targetSchema as any)?.format;\n\n // Both have format: check compatibility using prefix matching\n if (sourceFormat && targetFormat) {\n return areFormatStringsCompatible(sourceFormat, targetFormat);\n }\n\n // Source has format, target doesn't: static compatible (source is more specific)\n if (sourceFormat && !targetFormat) {\n return \"static\";\n }\n\n // Source doesn't have format, target does: incompatible (target requires format)\n if (!sourceFormat && targetFormat) {\n return \"incompatible\";\n }\n\n // Neither has format: static compatible\n return \"static\";\n}\n\n/**\n * Checks if two object schemas are semantically compatible.\n * This is a helper function for checking object-level schema compatibility.\n */\nexport function areObjectSchemasSemanticallyCompatible(\n sourceSchema: JsonSchema,\n targetSchema: JsonSchema\n): \"static\" | \"runtime\" | \"incompatible\" {\n return areSemanticallyCompatible(sourceSchema, targetSchema);\n}\n",
8
8
  "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Attempts to parse a potentially incomplete JSON string into a partial object.\n *\n * Useful for progressive rendering of streamed JSON output from AI providers.\n * Each call returns the most complete object that can be parsed from the\n * accumulated text so far.\n *\n * Strategy:\n * 1. Try JSON.parse directly (handles complete JSON)\n * 2. If that fails, scan the object while tracking brackets/strings, then\n * strip trailing incomplete tokens and close any still-open delimiters\n *\n * @param text - The (possibly incomplete) JSON string\n * @returns The parsed partial object, or undefined if text is too incomplete\n */\nexport function parsePartialJson(text: string): Record<string, unknown> | undefined {\n const trimmed = text.trim();\n if (!trimmed) return undefined;\n\n // Fast path: try parsing as-is\n try {\n const result = JSON.parse(trimmed);\n if (typeof result === \"object\" && result !== null && !Array.isArray(result)) {\n return result as Record<string, unknown>;\n }\n return undefined;\n } catch {\n // Fall through to repair logic\n }\n\n // Must start with '{' for an object\n if (trimmed[0] !== \"{\") return undefined;\n\n const repaired = repairJson(trimmed);\n if (repaired === undefined) return undefined;\n\n try {\n const result = JSON.parse(repaired);\n if (typeof result === \"object\" && result !== null && !Array.isArray(result)) {\n return result as Record<string, unknown>;\n }\n return undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Attempts to repair incomplete JSON by closing open structures.\n * Returns the repaired string, or undefined if the text is too malformed.\n */\nfunction repairJson(text: string): string | undefined {\n let result = \"\";\n let i = 0;\n const len = text.length;\n\n // Track open delimiters for closing\n const stack: string[] = [];\n let inString = false;\n let escaped = false;\n\n while (i < len) {\n const ch = text[i];\n\n if (escaped) {\n escaped = false;\n result += ch;\n i++;\n continue;\n }\n\n if (ch === \"\\\\\") {\n escaped = true;\n result += ch;\n i++;\n continue;\n }\n\n if (inString) {\n if (ch === '\"') {\n inString = false;\n result += ch;\n i++;\n continue;\n }\n result += ch;\n i++;\n continue;\n }\n\n // Not in a string\n switch (ch) {\n case '\"':\n inString = true;\n result += ch;\n i++;\n break;\n case \"{\":\n stack.push(\"}\");\n result += ch;\n i++;\n break;\n case \"[\":\n stack.push(\"]\");\n result += ch;\n i++;\n break;\n case \"}\":\n if (stack.length > 0 && stack[stack.length - 1] === \"}\") {\n stack.pop();\n result += ch;\n i++;\n } else {\n // Mismatched brace, truncate here\n return closeStack(result, stack);\n }\n break;\n case \"]\":\n if (stack.length > 0 && stack[stack.length - 1] === \"]\") {\n stack.pop();\n result += ch;\n i++;\n } else {\n return closeStack(result, stack);\n }\n break;\n default:\n result += ch;\n i++;\n break;\n }\n }\n\n // Reached the end with unclosed structures\n if (inString) {\n // Close the unclosed string, then close the stack\n result += '\"';\n }\n\n if (stack.length === 0) {\n // Already valid\n return result;\n }\n\n return closeStack(cleanTrailing(result), stack);\n}\n\n/**\n * Removes trailing incomplete tokens that would prevent JSON parsing.\n * Strips trailing commas, colons, and incomplete key/value fragments.\n */\nfunction cleanTrailing(text: string): string {\n // Remove trailing whitespace\n let s = text.trimEnd();\n\n // Repeatedly strip trailing problematic characters\n let changed = true;\n while (changed) {\n changed = false;\n const trimmed = s.trimEnd();\n\n // Trailing comma\n if (trimmed.endsWith(\",\")) {\n s = trimmed.slice(0, -1);\n changed = true;\n continue;\n }\n\n // Trailing colon (incomplete key-value pair)\n if (trimmed.endsWith(\":\")) {\n // Remove the colon and the preceding key\n const withoutColon = trimmed.slice(0, -1).trimEnd();\n // Remove the key (should be a string ending with \")\n if (withoutColon.endsWith('\"')) {\n const keyStart = withoutColon.lastIndexOf('\"', withoutColon.length - 2);\n if (keyStart >= 0) {\n // Also remove any preceding comma\n let before = withoutColon.slice(0, keyStart).trimEnd();\n if (before.endsWith(\",\")) {\n before = before.slice(0, -1);\n }\n s = before;\n changed = true;\n continue;\n }\n }\n // Can't find the key, just remove the colon\n s = withoutColon;\n changed = true;\n continue;\n }\n\n // Trailing incomplete value after a colon (e.g., `\"key\": tru` or `\"key\": 12`)\n // Check if there's an incomplete bare token at the end\n const bareTokenMatch = trimmed.match(\n /,\\s*\"[^\"]*\"\\s*:\\s*(?:tru|fal|nul|true|false|null|[\\d.eE+-]+)$/\n );\n if (bareTokenMatch) {\n // Check if the bare value is complete\n const valueStr = trimmed.slice(trimmed.lastIndexOf(\":\") + 1).trim();\n try {\n JSON.parse(valueStr);\n // Value is complete, keep it\n } catch {\n // Value is incomplete, remove the whole key-value pair\n s = trimmed.slice(0, bareTokenMatch.index!).trimEnd();\n if (s.endsWith(\",\")) s = s.slice(0, -1);\n changed = true;\n continue;\n }\n }\n }\n\n return s;\n}\n\n/**\n * Closes all open delimiters in the stack.\n */\nfunction closeStack(text: string, stack: string[]): string {\n return text + [...stack].reverse().join(\"\");\n}\n",
9
9
  "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { FromSchema, FromSchemaDefaultOptions, FromSchemaOptions } from \"../json-schema/FromSchema\";\nimport { JsonSchema } from \"../json-schema/JsonSchema\";\n\n/**\n * Polyfill Float16Array for runtimes that don't support it yet (Node < 24).\n * Float16Array is referenced at module-load time in the schema options below,\n * so the polyfill must run before any usage.\n */\nif (typeof globalThis.Float16Array === \"undefined\") {\n // @ts-expect-error — intentional minimal shim\n globalThis.Float16Array = class Float16Array extends Uint16Array {\n static override readonly BYTES_PER_ELEMENT = 2;\n };\n}\n\n/**\n * Supported typed array types\n * - Float16Array: 16-bit floating point (medium precision)\n * - Float32Array: Standard 32-bit floating point (most common)\n * - Float64Array: 64-bit floating point (high precision)\n * - Int8Array: 8-bit signed integer (binary quantization)\n * - Uint8Array: 8-bit unsigned integer (quantization)\n * - Int16Array: 16-bit signed integer (quantization)\n * - Uint16Array: 16-bit unsigned integer (quantization)\n */\nexport type TypedArray =\n | Float32Array\n | Float16Array\n | Float64Array\n | Int8Array\n | Uint8Array\n | Int16Array\n | Uint16Array;\n\nexport type TypedArrayConstructor =\n | typeof Float16Array\n | typeof Float32Array\n | typeof Float64Array\n | typeof Int8Array\n | typeof Uint8Array\n | typeof Int16Array\n | typeof Uint16Array;\n\nexport type TypedArrayString =\n | \"TypedArray\"\n | \"TypedArray:Float16Array\"\n | \"TypedArray:Float32Array\"\n | \"TypedArray:Float64Array\"\n | \"TypedArray:Int8Array\"\n | \"TypedArray:Uint8Array\"\n | \"TypedArray:Int16Array\"\n | \"TypedArray:Uint16Array\";\n\nexport function isTypedArray(value: unknown): value is TypedArray {\n return ArrayBuffer.isView(value) && !(value instanceof DataView);\n}\n\n// Type-only value for use in deserialize patterns\nconst TypedArrayType = null as any as TypedArray;\n\nconst TypedArraySchemaOptions = {\n ...FromSchemaDefaultOptions,\n deserialize: [\n {\n pattern: { type: \"array\", format: \"TypedArray:Float64Array\" },\n output: Float64Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray:Float32Array\" },\n output: Float32Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray:Float16Array\" },\n output: Float16Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray:Int16Array\" },\n output: Int16Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray:Int8Array\" },\n output: Int8Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray:Uint8Array\" },\n output: Uint8Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray:Uint16Array\" },\n output: Uint16Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray\" },\n output: TypedArrayType,\n },\n ],\n} as const satisfies FromSchemaOptions;\n\nexport type TypedArraySchemaOptions = typeof TypedArraySchemaOptions;\n\nexport type VectorFromSchema<SCHEMA extends JsonSchema> = FromSchema<\n SCHEMA,\n TypedArraySchemaOptions\n>;\n\nexport const TypedArraySchema = (annotations: Record<string, unknown> = {}) => {\n return {\n type: \"array\",\n format: \"TypedArray\",\n title: \"Typed Array\",\n description: \"A typed array (Float32Array, Int8Array, etc.)\",\n ...annotations,\n } as const satisfies JsonSchema;\n};\n",
10
10
  "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { FromSchema } from \"../json-schema/FromSchema\";\nimport { JsonSchema } from \"../json-schema/JsonSchema\";\nimport { TypedArraySchema, TypedArraySchemaOptions } from \"./TypedArray\";\n\nexport const TensorType = {\n FLOAT16: \"float16\",\n FLOAT32: \"float32\",\n FLOAT64: \"float64\",\n INT8: \"int8\",\n UINT8: \"uint8\",\n INT16: \"int16\",\n UINT16: \"uint16\",\n} as const;\n\nexport type TensorType = (typeof TensorType)[keyof typeof TensorType];\n\n/**\n * Tensor schema for representing tensors as arrays of numbers\n * @param annotations - Additional annotations for the schema\n * @returns The tensor schema\n */\nexport const TensorSchema = (annotations: Record<string, unknown> = {}) =>\n ({\n type: \"object\",\n properties: {\n type: {\n type: \"string\",\n enum: Object.values(TensorType),\n title: \"Type\",\n description: \"The type of the tensor\",\n },\n data: TypedArraySchema({\n title: \"Data\",\n description: \"The data of the tensor\",\n }),\n shape: {\n type: \"array\",\n items: { type: \"number\" },\n title: \"Shape\",\n description: \"The shape of the tensor (dimensions)\",\n minItems: 1,\n default: [1],\n },\n normalized: {\n type: \"boolean\",\n title: \"Normalized\",\n description: \"Whether the tensor data is normalized\",\n default: false,\n },\n },\n required: [\"data\"],\n additionalProperties: false,\n ...annotations,\n }) as const satisfies JsonSchema;\n\nexport type Tensor = FromSchema<ReturnType<typeof TensorSchema>, TypedArraySchemaOptions>;\n",
@@ -12,7 +12,7 @@
12
12
  "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { TypedArray } from \"./TypedArray\";\n\n/**\n * Calculates cosine similarity between two vectors\n * Returns a value between -1 and 1, where 1 means identical direction\n */\nexport function cosineSimilarity(a: TypedArray, b: TypedArray): number {\n if (a.length !== b.length) {\n throw new Error(\"Vectors must have the same length\");\n }\n let dotProduct = 0;\n let normA = 0;\n let normB = 0;\n for (let i = 0; i < a.length; i++) {\n dotProduct += a[i] * b[i];\n normA += a[i] * a[i];\n normB += b[i] * b[i];\n }\n const denominator = Math.sqrt(normA) * Math.sqrt(normB);\n if (denominator === 0) {\n return 0;\n }\n return dotProduct / denominator;\n}\n\n/**\n * Calculates Jaccard similarity between two vectors\n * Uses the formula: sum(min(a[i], b[i])) / sum(max(a[i], b[i]))\n * Returns a value between 0 and 1\n * For negative values, normalizes by finding the global min and shifting to non-negative range\n */\nexport function jaccardSimilarity(a: TypedArray, b: TypedArray): number {\n if (a.length !== b.length) {\n throw new Error(\"Vectors must have the same length\");\n }\n\n // Find global min across both vectors to handle negative values\n let globalMin = a[0];\n for (let i = 0; i < a.length; i++) {\n globalMin = Math.min(globalMin, a[i], b[i]);\n }\n\n // Shift values to non-negative range if needed\n const shift = globalMin < 0 ? -globalMin : 0;\n\n let minSum = 0;\n let maxSum = 0;\n\n for (let i = 0; i < a.length; i++) {\n const shiftedA = a[i] + shift;\n const shiftedB = b[i] + shift;\n minSum += Math.min(shiftedA, shiftedB);\n maxSum += Math.max(shiftedA, shiftedB);\n }\n\n return maxSum === 0 ? 0 : minSum / maxSum;\n}\n\n/**\n * Calculates Hamming distance between two vectors (normalized)\n * Counts the number of positions where vectors differ\n * Returns a value between 0 and 1 (0 = identical, 1 = completely different)\n */\nexport function hammingDistance(a: TypedArray, b: TypedArray): number {\n if (a.length !== b.length) {\n throw new Error(\"Vectors must have the same length\");\n }\n\n let differences = 0;\n\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n differences++;\n }\n }\n\n return differences / a.length;\n}\n\n/**\n * Calculates Hamming similarity (inverse of distance)\n * Returns a value between 0 and 1 (1 = identical, 0 = completely different)\n */\nexport function hammingSimilarity(a: TypedArray, b: TypedArray): number {\n return 1 - hammingDistance(a, b);\n}\n",
13
13
  "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { TypedArray } from \"./TypedArray\";\n\n/**\n * Calculates the magnitude (L2 norm) of a vector\n */\nexport function magnitude(arr: TypedArray | number[]): number {\n // @ts-ignore - Vector reduce works but TS doesn't recognize it\n return Math.sqrt(arr.reduce((acc, val) => acc + val * val, 0));\n}\n\n/**\n * Calculates the inner (dot) product of two vectors\n */\nexport function inner(arr1: TypedArray, arr2: TypedArray): number {\n if (arr1.length !== arr2.length) {\n throw new Error(\"Vectors must have the same length to compute inner product.\");\n }\n // @ts-ignore - Vector reduce works but TS doesn't recognize it\n return arr1.reduce((acc, val, i) => acc + val * arr2[i], 0);\n}\n\n/**\n * Normalizes a vector to unit length (L2 normalization)\n *\n * @param vector - The vector to normalize\n * @param throwOnZero - If true, throws an error for zero vectors. If false, returns the original vector.\n * @param float32 - If true, always returns a Float32Array regardless of input type. When false (default),\n * the return type matches the input type. Note: for integer typed arrays (Int8Array, Uint8Array,\n * Int16Array, Uint16Array), normalized float values are truncated to integers when stored back in\n * the original type — use `float32=true` to preserve precision for integer inputs.\n * @returns Normalized vector. Float arrays preserve their type. Integer arrays preserve their type\n * (with truncation). Pass `float32=true` to always get a Float32Array.\n */\nexport function normalize(vector: TypedArray, throwOnZero = true, float32 = false): TypedArray {\n const mag = magnitude(vector);\n\n if (mag === 0) {\n if (throwOnZero) {\n throw new Error(\"Cannot normalize a zero vector.\");\n }\n return vector;\n }\n\n const normalized = Array.from(vector).map((val) => Number(val) / mag);\n\n if (float32) {\n return new Float32Array(normalized);\n }\n\n if (vector instanceof Float64Array) {\n return new Float64Array(normalized);\n }\n if (vector instanceof Float16Array) {\n return new Float16Array(normalized);\n }\n if (vector instanceof Float32Array) {\n return new Float32Array(normalized);\n }\n if (vector instanceof Int8Array) {\n return new Int8Array(normalized);\n }\n if (vector instanceof Uint8Array) {\n return new Uint8Array(normalized);\n }\n if (vector instanceof Int16Array) {\n return new Int16Array(normalized);\n }\n if (vector instanceof Uint16Array) {\n return new Uint16Array(normalized);\n }\n return new Float32Array(normalized);\n}\n\n/**\n * Normalizes an array of numbers to unit length (L2 normalization)\n *\n * @param values - The array of numbers to normalize\n * @param throwOnZero - If true, throws an error for zero vectors. If false, returns the original array.\n * @returns Normalized array of numbers\n */\nexport function normalizeNumberArray(values: number[], throwOnZero = false): number[] {\n const norm = magnitude(values);\n\n if (norm === 0) {\n if (throwOnZero) {\n throw new Error(\"Cannot normalize a zero vector.\");\n }\n return values;\n }\n\n return values.map((v) => v / norm);\n}\n"
14
14
  ],
15
- "mappings": ";AAyBO,IAAM,2BAA2B;AAAA,EACtC,iBAAiB;AAAA,EACjB,yBAAyB;AAAA,EACzB,iCAAiC;AAAA,EACjC,YAAY;AAAA,EACZ,aAAa;AACf;;ACuBA,SAAS,0BAA0B,CACjC,cACA,cACuC;AAAA,EAEvC,MAAM,gBAAgB;AAAA,EACtB,IAAI,CAAC,cAAc,KAAK,YAAY,KAAK,CAAC,cAAc,KAAK,YAAY,GAAG;AAAA,IAC1E,OAAO;AAAA,EACT;AAAA,EAEA,OAAO,YAAY,gBAAgB,aAAa,MAAM,GAAG;AAAA,EACzD,OAAO,YAAY,gBAAgB,aAAa,MAAM,GAAG;AAAA,EAGzD,IAAI,eAAe,YAAY;AAAA,IAC7B,OAAO;AAAA,EACT;AAAA,EAGA,IAAI,CAAC,gBAAgB,CAAC,cAAc;AAAA,IAClC,OAAO;AAAA,EACT;AAAA,EAGA,IAAI,gBAAgB,CAAC,cAAc;AAAA,IACjC,OAAO;AAAA,EACT;AAAA,EAGA,IAAI,CAAC,gBAAgB,cAAc;AAAA,IACjC,OAAO;AAAA,EACT;AAAA,EAGA,IAAI,iBAAiB,cAAc;AAAA,IACjC,OAAO;AAAA,EACT;AAAA,EAEA,OAAO;AAAA;AAOT,SAAS,0BAA0B,CAAC,YAAqB,YAA8B;AAAA,EAErF,IAAI,CAAC,YAAY;AAAA,IACf,OAAO;AAAA,EACT;AAAA,EAGA,IAAI,CAAC,YAAY;AAAA,IACf,OAAO;AAAA,EACT;AAAA,EAGA,MAAM,cAAc,MAAM,QAAQ,UAAU,IAAI,aAAa,CAAC,UAAU;AAAA,EACxE,MAAM,cAAc,MAAM,QAAQ,UAAU,IAA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A,IACd,IAAI,aAAa;AAAA,MACf,MAAM,IAAI,MAAM,iCAAiC;AAAA,IACnD;AAAA,IACA,OAAO;AAAA,EACT;AAAA,EAEA,OAAO,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI;AAAA;",
16
+ "debugId": "A6ECA6928852238264756E2164756E21",
17
17
  "names": []
18
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"WorkerManager.d.ts","sourceRoot":"","sources":["../../src/worker/WorkerManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAkC;IACjD,OAAO,CAAC,YAAY,CAAyC;IAC7D,kFAAkF;IAClF,OAAO,CAAC,eAAe,CAAuC;IAC9D,OAAO,CAAC,qBAAqB,CAAuC;IACpE,OAAO,CAAC,sBAAsB,CAAuC;IACrE,gFAAgF;IAChF,OAAO,CAAC,eAAe,CAAwC;IAC/D,wDAAwD;IACxD,OAAO,CAAC,YAAY,CAAkC;IACtD,uDAAuD;IACvD,OAAO,CAAC,gBAAgB,CAAyC;IACjE,4CAA4C;IAC5C,OAAO,CAAC,gBAAgB,CAAkC;IAC1D,wDAAwD;IACxD,OAAO,CAAC,UAAU,CAAyD;IAC3E,qDAAqD;IACrD,OAAO,CAAC,mBAAmB,CAAyC;IAEpE,cAAc,CACZ,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,EACxC,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,GACnC,IAAI,CAaN;IAED,OAAO,CAAC,oBAAoB;YAiDd,iBAAiB;IAgC/B,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI9B;IAED,OAAO,CAAC,mBAAmB;IAK3B,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,uBAAuB;YAqBjB,2BAA2B;YAsB3B,uBAAuB;IAiC/B,k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C,CAAC,GAAG,SAAS,CAAC,CA2CxB;IAED;;OAEG;IACG,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKjD;IAED;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAK7B;IAEK,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3C;IAED;;;;;;;;;;;OAWG;IACI,wBAAwB,CAAC,CAAC,EAC/B,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,GAAG,EAAE,EACX,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GACjC,cAAc,CAAC,CAAC,CAAC,CAuHnB;CACF;AAED,eAAO,MAAM,cAAc,6CAAsD,CAAC"}
@@ -892,7 +892,10 @@ class WorkerManager {
892
892
  queue.push({ kind: "done" });
893
893
  notify();
894
894
  } else if (type === "error") {
895
- queue.push({ kind: "error", error: new Error(data) });
895
+ const err = typeof data === "object" && data !== null ? Object.assign(new Error(data.message ?? String(data)), {
896
+ name: data.name ?? "Error"
897
+ }) : new Error(String(data));
898
+ queue.push({ kind: "error", error: err });
896
899
  notify();
897
900
  }
898
901
  };
@@ -1149,4 +1152,4 @@ export {
1149
1152
  ConsoleLogger
1150
1153
  };
1151
1154
 
1152
- //# debugId=351DE461359AE77964756E2164756E21
1155
+ //# debugId=C3A2A88900E8EA7664756E2164756E21