@anvia/core 1.5.0 → 1.6.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 (148) hide show
  1. package/README.md +112 -1
  2. package/dist/agent/agent-tool.js +7 -7
  3. package/dist/agent/agent.js +25 -25
  4. package/dist/agent/index.js +29 -29
  5. package/dist/agent/resolve-options.js +10 -10
  6. package/dist/agent/resolved-agent.js +26 -26
  7. package/dist/agent/team/agent-team.js +29 -29
  8. package/dist/agent/team/index.js +29 -29
  9. package/dist/agent/tool-catalog.js +9 -9
  10. package/dist/{chunk-QHGYCYV6.js → chunk-3FIX7GLM.js} +2 -2
  11. package/dist/{chunk-SIXS4CCU.js → chunk-4IOC4SP6.js} +4 -4
  12. package/dist/chunk-4IOC4SP6.js.map +1 -0
  13. package/dist/{chunk-JMMZICU7.js → chunk-4OSA3MMA.js} +39 -5
  14. package/dist/chunk-4OSA3MMA.js.map +1 -0
  15. package/dist/{chunk-Y365ABZY.js → chunk-4WSICA6D.js} +2 -2
  16. package/dist/{chunk-YOLOFTAY.js → chunk-57AUTEQ6.js} +57 -5
  17. package/dist/chunk-57AUTEQ6.js.map +1 -0
  18. package/dist/{chunk-647TQE3E.js → chunk-5BO4OTTK.js} +5 -5
  19. package/dist/{chunk-ZQC6M22O.js → chunk-7LBUXGJI.js} +2 -2
  20. package/dist/{chunk-FGOVEUVK.js → chunk-7OHHMYRO.js} +2 -2
  21. package/dist/{chunk-DXW37JLZ.js → chunk-AMPQJMDG.js} +5 -5
  22. package/dist/{chunk-HAAGSIZH.js → chunk-CB2L2NIQ.js} +2 -2
  23. package/dist/{chunk-I7YCEQXT.js → chunk-D6FK5ZQR.js} +5 -5
  24. package/dist/{chunk-B57NNDEF.js → chunk-FTK6YRLN.js} +5 -5
  25. package/dist/{chunk-T3ZOZEAB.js → chunk-GB4SRUT7.js} +2 -2
  26. package/dist/{chunk-KX2TRKO2.js → chunk-GNBPXJC6.js} +2 -2
  27. package/dist/{chunk-AYN34XVW.js → chunk-GRI4EFNG.js} +15 -15
  28. package/dist/chunk-GRI4EFNG.js.map +1 -0
  29. package/dist/{chunk-CJKGTEN4.js → chunk-HDL5TXF7.js} +2 -2
  30. package/dist/{chunk-YMTBHHLQ.js → chunk-HG6ASDNI.js} +3 -3
  31. package/dist/{chunk-XAVSWLX5.js → chunk-IMSM4HHI.js} +3 -3
  32. package/dist/{chunk-35GMQS3R.js → chunk-KGVDUYZV.js} +3 -3
  33. package/dist/{chunk-E44DRLUL.js → chunk-LW6F3IGP.js} +10 -6
  34. package/dist/chunk-LW6F3IGP.js.map +1 -0
  35. package/dist/{chunk-UEUSJ3UQ.js → chunk-MJAM7HZB.js} +8 -8
  36. package/dist/{chunk-2JZV4LUS.js → chunk-MKY7KTZY.js} +3 -13
  37. package/dist/chunk-MKY7KTZY.js.map +1 -0
  38. package/dist/{chunk-RFFOL6ON.js → chunk-MWG2PMTE.js} +18 -5
  39. package/dist/chunk-MWG2PMTE.js.map +1 -0
  40. package/dist/{chunk-JMNIWUFV.js → chunk-NKSXYOUM.js} +3 -3
  41. package/dist/{chunk-4VDDYI6P.js → chunk-OBTD3GPY.js} +2 -2
  42. package/dist/{chunk-GDY2Z2SZ.js → chunk-PFJN5OIQ.js} +2 -2
  43. package/dist/chunk-PZC5UHIN.js +190 -0
  44. package/dist/chunk-PZC5UHIN.js.map +1 -0
  45. package/dist/{chunk-UYODZ7OE.js → chunk-STEAW4JD.js} +2 -2
  46. package/dist/{chunk-LJGQ6VQB.js → chunk-TD2VYYUT.js} +90 -31
  47. package/dist/chunk-TD2VYYUT.js.map +1 -0
  48. package/dist/{chunk-MTJDYC6T.js → chunk-TOJSC4GI.js} +3 -3
  49. package/dist/{chunk-V5DWNXVH.js → chunk-W2XPREWL.js} +135 -26
  50. package/dist/chunk-W2XPREWL.js.map +1 -0
  51. package/dist/chunk-W6V63YPY.js +96 -0
  52. package/dist/chunk-W6V63YPY.js.map +1 -0
  53. package/dist/{chunk-F4BOW76L.js → chunk-XQTTPQWA.js} +4 -4
  54. package/dist/{chunk-HHMLE3TZ.js → chunk-YCTXTOOQ.js} +7 -16
  55. package/dist/chunk-YCTXTOOQ.js.map +1 -0
  56. package/dist/{chunk-7TUAAGVR.js → chunk-YKWUFYXT.js} +2 -2
  57. package/dist/{chunk-5SJBSCG2.js → chunk-YSR6KLCS.js} +8 -2
  58. package/dist/chunk-YSR6KLCS.js.map +1 -0
  59. package/dist/{chunk-6E6ABRJ6.js → chunk-ZJ4T7CEX.js} +2 -2
  60. package/dist/completion/generate-completion.js +3 -3
  61. package/dist/completion/index.js +3 -3
  62. package/dist/completion/stream-accumulator.js +1 -1
  63. package/dist/embeddings/embed.js +1 -1
  64. package/dist/embeddings/index.js +1 -1
  65. package/dist/evals/advanced-metrics.js +6 -6
  66. package/dist/evals/agent-target.js +2 -1
  67. package/dist/evals/cli.js +6 -6
  68. package/dist/evals/execution.js +3 -1
  69. package/dist/evals/index.js +12 -12
  70. package/dist/evals/judge.js +5 -5
  71. package/dist/evals/metrics.js +6 -6
  72. package/dist/evals/runner.js +5 -5
  73. package/dist/extractor/extractor.js +4 -4
  74. package/dist/extractor/index.js +4 -4
  75. package/dist/guardrails/index.js +4 -4
  76. package/dist/index.js +35 -35
  77. package/dist/internal/agent-runtime/agent-run.js +21 -21
  78. package/dist/internal/agent-runtime/continuation-state.js +3 -3
  79. package/dist/internal/agent-runtime/interaction-suspension.js +3 -3
  80. package/dist/internal/agent-runtime/memory.js +5 -5
  81. package/dist/internal/agent-runtime/prepared-tool-call.js +2 -2
  82. package/dist/internal/agent-runtime/retrieval.js +8 -8
  83. package/dist/internal/agent-runtime/tool-execution.js +15 -15
  84. package/dist/internal/agent.js +26 -26
  85. package/dist/internal/team-runtime/member.js +3 -3
  86. package/dist/internal/team-runtime/run.js +28 -28
  87. package/dist/internal/team-runtime/tools.js +4 -4
  88. package/dist/memory/compaction.js +4 -4
  89. package/dist/memory/index.js +4 -4
  90. package/dist/observability/group.js +3 -3
  91. package/dist/observability/index.js +3 -3
  92. package/dist/pipeline/index.js +6 -6
  93. package/dist/pipeline/pipeline.js +6 -6
  94. package/dist/schema/standard-json-schema.js +1 -1
  95. package/dist/skills/index.js +13 -13
  96. package/dist/skills/load.js +13 -13
  97. package/dist/skills/tools.js +12 -12
  98. package/dist/streaming/index.d.ts +2 -1
  99. package/dist/streaming/index.js +2 -1
  100. package/dist/streaming/readable-stream.js +2 -1
  101. package/dist/tool/create-tool.js +3 -3
  102. package/dist/tool/dynamic-tools.js +8 -8
  103. package/dist/tool/index.js +14 -14
  104. package/dist/tool/question-tool.js +4 -4
  105. package/dist/tool/think-tool.js +4 -4
  106. package/dist/vector-store/index.js +7 -7
  107. package/dist/vector-store/ingest.js +2 -2
  108. package/dist/vector-store/retrieve.js +2 -2
  109. package/package.json +2 -2
  110. package/dist/chunk-2JZV4LUS.js.map +0 -1
  111. package/dist/chunk-54ZZJRP2.js +0 -57
  112. package/dist/chunk-54ZZJRP2.js.map +0 -1
  113. package/dist/chunk-5SJBSCG2.js.map +0 -1
  114. package/dist/chunk-AYN34XVW.js.map +0 -1
  115. package/dist/chunk-E44DRLUL.js.map +0 -1
  116. package/dist/chunk-HHMLE3TZ.js.map +0 -1
  117. package/dist/chunk-JMMZICU7.js.map +0 -1
  118. package/dist/chunk-LJGQ6VQB.js.map +0 -1
  119. package/dist/chunk-NNEKBZSM.js +0 -66
  120. package/dist/chunk-NNEKBZSM.js.map +0 -1
  121. package/dist/chunk-RFFOL6ON.js.map +0 -1
  122. package/dist/chunk-SIXS4CCU.js.map +0 -1
  123. package/dist/chunk-V5DWNXVH.js.map +0 -1
  124. package/dist/chunk-YOLOFTAY.js.map +0 -1
  125. /package/dist/{chunk-QHGYCYV6.js.map → chunk-3FIX7GLM.js.map} +0 -0
  126. /package/dist/{chunk-Y365ABZY.js.map → chunk-4WSICA6D.js.map} +0 -0
  127. /package/dist/{chunk-647TQE3E.js.map → chunk-5BO4OTTK.js.map} +0 -0
  128. /package/dist/{chunk-ZQC6M22O.js.map → chunk-7LBUXGJI.js.map} +0 -0
  129. /package/dist/{chunk-FGOVEUVK.js.map → chunk-7OHHMYRO.js.map} +0 -0
  130. /package/dist/{chunk-DXW37JLZ.js.map → chunk-AMPQJMDG.js.map} +0 -0
  131. /package/dist/{chunk-HAAGSIZH.js.map → chunk-CB2L2NIQ.js.map} +0 -0
  132. /package/dist/{chunk-I7YCEQXT.js.map → chunk-D6FK5ZQR.js.map} +0 -0
  133. /package/dist/{chunk-B57NNDEF.js.map → chunk-FTK6YRLN.js.map} +0 -0
  134. /package/dist/{chunk-T3ZOZEAB.js.map → chunk-GB4SRUT7.js.map} +0 -0
  135. /package/dist/{chunk-KX2TRKO2.js.map → chunk-GNBPXJC6.js.map} +0 -0
  136. /package/dist/{chunk-CJKGTEN4.js.map → chunk-HDL5TXF7.js.map} +0 -0
  137. /package/dist/{chunk-YMTBHHLQ.js.map → chunk-HG6ASDNI.js.map} +0 -0
  138. /package/dist/{chunk-XAVSWLX5.js.map → chunk-IMSM4HHI.js.map} +0 -0
  139. /package/dist/{chunk-35GMQS3R.js.map → chunk-KGVDUYZV.js.map} +0 -0
  140. /package/dist/{chunk-UEUSJ3UQ.js.map → chunk-MJAM7HZB.js.map} +0 -0
  141. /package/dist/{chunk-JMNIWUFV.js.map → chunk-NKSXYOUM.js.map} +0 -0
  142. /package/dist/{chunk-4VDDYI6P.js.map → chunk-OBTD3GPY.js.map} +0 -0
  143. /package/dist/{chunk-GDY2Z2SZ.js.map → chunk-PFJN5OIQ.js.map} +0 -0
  144. /package/dist/{chunk-UYODZ7OE.js.map → chunk-STEAW4JD.js.map} +0 -0
  145. /package/dist/{chunk-MTJDYC6T.js.map → chunk-TOJSC4GI.js.map} +0 -0
  146. /package/dist/{chunk-F4BOW76L.js.map → chunk-XQTTPQWA.js.map} +0 -0
  147. /package/dist/{chunk-7TUAAGVR.js.map → chunk-YKWUFYXT.js.map} +0 -0
  148. /package/dist/{chunk-6E6ABRJ6.js.map → chunk-ZJ4T7CEX.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schema/standard-json-schema.ts"],"sourcesContent":["import type { z } from \"zod\";\nimport type { JsonObject, JsonValue } from \"../completion/index\";\nimport type { StandardJSONSchemaV1, StandardSchemaV1 } from \"./standard-schema\";\nimport { toProviderJsonSchema } from \"./zod-schema\";\n\nconst JSON_SCHEMA_TARGET = \"draft-2020-12\";\n\n/** The outcome of converting a Standard Schema to a provider JSON Schema. */\nexport type StandardSchemaJsonSchemaConversion =\n | { readonly jsonSchema: JsonObject; readonly pendingSchema?: undefined }\n | { readonly jsonSchema?: undefined; readonly pendingSchema: StandardSchemaV1 };\n\n/**\n * Converts a Standard Schema to the JSON Schema sent to providers when the\n * conversion can happen synchronously; otherwise returns the schema as pending\n * so callers can resolve it asynchronously with\n * {@link toProviderJsonSchemaFromStandardSchema}.\n *\n * Providers receive the schema's input representation: the raw provider\n * response is what `~standard.validate` receives as its validation input,\n * while the validated (possibly transformed) value becomes the completion\n * output. Object nodes are completed with `additionalProperties: false` so\n * payloads remain eligible for provider strict modes such as OpenAI\n * structured outputs.\n */\nexport function tryToProviderJsonSchemaFromStandardSchema(\n schema: StandardSchemaV1,\n): StandardSchemaJsonSchemaConversion {\n const props = schema[\"~standard\"];\n // Zod keeps its native converter. Prefer the output representation: it\n // validates identically for schemas without input/output differences and\n // carries zod's strict-object refinements (additionalProperties: false)\n // that provider strict modes such as OpenAI structured outputs require.\n if (props.vendor === \"zod\") {\n return {\n jsonSchema: toProviderJsonSchemaShape(toProviderZodJsonSchema(schema as z.ZodType)),\n };\n }\n // Generic support for any library implementing the Standard JSON Schema spec.\n const jsonSchema = (\n props as {\n jsonSchema?: StandardJSONSchemaV1[\"~standard\"][\"jsonSchema\"] | undefined;\n }\n ).jsonSchema;\n if (typeof jsonSchema === \"object\" && jsonSchema !== null) {\n return {\n jsonSchema: toProviderJsonSchemaShape(jsonSchema.input({ target: JSON_SCHEMA_TARGET })),\n };\n }\n // Vendor-specific converters may need to be loaded asynchronously.\n return { pendingSchema: schema };\n}\n\nfunction toProviderZodJsonSchema(schema: z.ZodType): JsonObject {\n let outputJsonSchema: JsonObject;\n try {\n outputJsonSchema = toProviderJsonSchema(schema, { io: \"output\" });\n } catch {\n // Transformed schemas are unrepresentable on the output side. Describe the\n // validation input instead so the provider emits values the schema\n // accepts, and the transformed output becomes the completion result.\n return toProviderJsonSchema(schema, { io: \"input\" });\n }\n let inputJsonSchema: JsonObject;\n try {\n inputJsonSchema = toProviderJsonSchema(schema, { io: \"input\" });\n } catch {\n // The input side is not representable while the output side is; the\n // output side remains the best available description.\n return outputJsonSchema;\n }\n // The provider response is fed to `~standard.validate` as its input, so the\n // output representation may only be used when it describes the same accepted\n // values as the input side. Ignoring additionalProperties keeps zod's\n // strict-object refinements (which provider strict modes such as OpenAI\n // structured outputs require) while still detecting schemas whose input and\n // output values genuinely differ, like `z.string().pipe(z.coerce.number())`.\n return jsonSchemaMatchesInputShape(inputJsonSchema, outputJsonSchema)\n ? outputJsonSchema\n : inputJsonSchema;\n}\n\n/** Checks whether the output-side schema shape equals the input-side shape, ignoring strictness. */\nfunction jsonSchemaMatchesInputShape(input: JsonValue, output: JsonValue): boolean {\n if (Array.isArray(input) || Array.isArray(output)) {\n return (\n Array.isArray(input) &&\n Array.isArray(output) &&\n input.length === output.length &&\n input.every((item, index) => jsonSchemaMatchesInputShape(item, output[index]))\n );\n }\n if (\n typeof input === \"object\" &&\n input !== null &&\n typeof output === \"object\" &&\n output !== null\n ) {\n const inputKeys = Object.keys(input).sort();\n const outputKeys = Object.keys(output)\n .filter((key) => key !== \"additionalProperties\")\n .sort();\n return (\n inputKeys.length === outputKeys.length &&\n inputKeys.every((key, index) => {\n const outputKey = outputKeys[index];\n if (outputKey === undefined || key !== outputKey) return false;\n // Keys come from Object.keys, so the indexed values exist by construction.\n const inputValue = (input as Record<string, JsonValue>)[key] as JsonValue;\n const outputValue = (output as Record<string, JsonValue>)[outputKey] as JsonValue;\n return jsonSchemaMatchesInputShape(inputValue, outputValue);\n })\n );\n }\n return input === output;\n}\n\n/**\n * Converts any supported Standard Schema to the JSON Schema sent to providers.\n * Synchronously convertible schemas resolve immediately; Valibot schemas load\n * the optional `@valibot/to-json-schema` converter on first use.\n */\nexport async function toProviderJsonSchemaFromStandardSchema(\n schema: StandardSchemaV1,\n): Promise<JsonObject> {\n const converted = tryToProviderJsonSchemaFromStandardSchema(schema);\n if (converted.jsonSchema !== undefined) return converted.jsonSchema;\n const pending = converted.pendingSchema;\n const vendor = pending[\"~standard\"].vendor;\n if (vendor === \"valibot\") {\n return valibotToProviderJsonSchema(pending);\n }\n throw new Error(\n `Structured output schemas from vendor \"${vendor}\" cannot be converted to a provider JSON schema. ` +\n `Use a Zod or Valibot schema, or make the schema implement the Standard JSON Schema interface (\"~standard.jsonSchema\").`,\n );\n}\n\ntype ValibotToJsonSchemaModule = {\n toJsonSchema: (\n schema: StandardSchemaV1,\n config?: {\n readonly target?: \"draft-07\" | \"draft-2020-12\" | \"openapi-3.0\" | undefined;\n readonly typeMode?: \"ignore\" | \"input\" | \"output\" | undefined;\n },\n ) => Record<string, unknown>;\n};\n\nlet valibotToJsonSchemaModule: Promise<ValibotToJsonSchemaModule> | undefined;\n\nasync function loadValibotToJsonSchema(): Promise<ValibotToJsonSchemaModule> {\n valibotToJsonSchemaModule ??=\n import(\"@valibot/to-json-schema\") as unknown as Promise<ValibotToJsonSchemaModule>;\n try {\n return await valibotToJsonSchemaModule;\n } catch (error) {\n valibotToJsonSchemaModule = undefined;\n throw new Error(\n 'The structured output schema is a Valibot schema, but \"@valibot/to-json-schema\" is not installed. ' +\n \"Install it to use Valibot schemas for structured output.\",\n { cause: error },\n );\n }\n}\n\nasync function valibotToProviderJsonSchema(schema: StandardSchemaV1): Promise<JsonObject> {\n const { toJsonSchema } = await loadValibotToJsonSchema();\n const jsonSchema = toJsonSchema(schema, {\n target: JSON_SCHEMA_TARGET,\n typeMode: \"input\",\n });\n return toProviderJsonSchemaShape(jsonSchema);\n}\n\nfunction toProviderJsonSchemaShape(jsonSchema: Record<string, unknown>): JsonObject {\n const providerSchema = copyProviderSchema(jsonSchema);\n completeStrictObjectRefinements(providerSchema);\n return providerSchema;\n}\n\nfunction copyProviderSchema(source: unknown): JsonObject {\n if (typeof source !== \"object\" || source === null || Array.isArray(source)) {\n throw new TypeError(\"Provider JSON schema must be a plain or null-prototype record.\");\n }\n return copyJsonData(source, new WeakSet(), true) as JsonObject;\n}\n\nfunction copyJsonData(\n value: unknown,\n ancestors: WeakSet<object>,\n omitRootSchema = false,\n): JsonValue {\n if (\n value === null ||\n typeof value === \"string\" ||\n typeof value === \"boolean\" ||\n (typeof value === \"number\" && Number.isFinite(value))\n ) {\n return value;\n }\n if (typeof value !== \"object\") {\n throw new TypeError(\"Provider JSON schema must contain only finite JSON data.\");\n }\n if (ancestors.has(value)) {\n throw new TypeError(\"Provider JSON schema must not contain cycles.\");\n }\n ancestors.add(value);\n if (Array.isArray(value)) {\n const copy: JsonValue[] = [];\n for (let index = 0; index < value.length; index++) {\n const descriptor = Object.getOwnPropertyDescriptor(value, String(index));\n if (descriptor === undefined || !(\"value\" in descriptor)) {\n throw new TypeError(\n \"Provider JSON schema arrays must be dense data arrays without accessors.\",\n );\n }\n copy.push(copyJsonData(descriptor.value, ancestors));\n }\n ancestors.delete(value);\n return copy;\n }\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) {\n throw new TypeError(\"Provider JSON schema must contain only plain or null-prototype records.\");\n }\n const copy: JsonObject = {};\n for (const key of Object.keys(value)) {\n if (omitRootSchema && key === \"$schema\") continue;\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor === undefined || !(\"value\" in descriptor)) {\n throw new TypeError(\"Provider JSON schema records must not contain enumerable accessors.\");\n }\n // Define own data properties so __proto__ cannot change the copy's prototype.\n Object.defineProperty(copy, key, {\n value: copyJsonData(descriptor.value, ancestors),\n enumerable: true,\n configurable: true,\n writable: true,\n });\n }\n ancestors.delete(value);\n return copy;\n}\n\n/**\n * Adds `additionalProperties: false` to object schema nodes that do not declare\n * it. Restricting the provider to declared properties is validation-safe\n * because schema libraries strip or accept unknown input keys, and provider\n * strict modes such as OpenAI structured outputs require the refinement.\n * Explicit values (for example permissive objects) are left untouched.\n *\n * Recursion follows schema-bearing keywords only, so literal values under\n * `const`, `enum`, `default`, `examples`, or extension keywords — which may\n * legitimately be objects with a `type` field — are never rewritten.\n */\nfunction completeStrictObjectRefinements(jsonSchema: unknown): void {\n completeSchemaNode(jsonSchema);\n}\n\n// Schema-bearing keywords of the drafts the converters are requested to\n// produce (draft-07, draft-2020-12), so literal values under const, enum,\n// annotations, and extension keywords are never rewritten.\nconst SCHEMA_POSITIONS: ReadonlySet<string> = new Set([\n \"additionalItems\",\n \"additionalProperties\",\n \"allOf\",\n \"anyOf\",\n \"contains\",\n \"contentSchema\",\n \"else\",\n \"if\",\n \"items\",\n \"not\",\n \"oneOf\",\n \"prefixItems\",\n \"propertyNames\",\n \"then\",\n \"unevaluatedItems\",\n \"unevaluatedProperties\",\n]);\n\nconst SCHEMA_MAP_POSITIONS: ReadonlySet<string> = new Set([\n \"$defs\",\n \"definitions\",\n \"dependencies\",\n \"dependentSchemas\",\n \"patternProperties\",\n \"properties\",\n]);\n\nfunction completeSchemaNode(node: unknown): void {\n if (Array.isArray(node)) {\n // Lists of schemas, like prefixItems and draft-07 items.\n for (const item of node) completeSchemaNode(item);\n return;\n }\n if (typeof node !== \"object\" || node === null) return;\n const schema = node as Record<string, unknown>;\n if (schema.type === \"object\" && schema.additionalProperties === undefined) {\n schema.additionalProperties = false;\n }\n for (const [key, value] of Object.entries(schema)) {\n if (SCHEMA_POSITIONS.has(key)) {\n completeSchemaNode(value);\n } else if (\n SCHEMA_MAP_POSITIONS.has(key) &&\n typeof value === \"object\" &&\n value !== null &&\n !Array.isArray(value)\n ) {\n for (const child of Object.values(value)) completeSchemaNode(child);\n }\n }\n}\n"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AA,MACZ,cAAc;AAAA,MACd,UAAU;AAAA,IACZ,CAAC;AAAA,EACH;AACA,YAAU,OAAO,KAAK;AACtB,SAAO;AACT;AAaA,SAAS,gCAAgC,YAA2B;AAClE,qBAAmB,UAAU;AAC/B;AAKA,IAAM,mBAAwC,oBAAI,IAAI;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,uBAA4C,oBAAI,IAAI;AAAA,EACxD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,SAAS,mBAAmB,MAAqB;AAC/C,MAAI,MAAM,QAAQ,IAAI,GAAG;AAEvB,eAAW,QAAQ,KAAM,oBAAmB,IAAI;AAChD;AAAA,EACF;AACA,MAAI,OAAO,SAAS,YAAY,SAAS,KAAM;AAC/C,QAAM,SAAS;AACf,MAAI,OAAO,SAAS,YAAY,OAAO,yBAAyB,QAAW;AACzE,WAAO,uBAAuB;AAAA,EAChC;AACA,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACjD,QAAI,iBAAiB,IAAI,GAAG,GAAG;AAC7B,yBAAmB,KAAK;AAAA,IAC1B,WACE,qBAAqB,IAAI,GAAG,KAC5B,OAAO,UAAU,YACjB,UAAU,QACV,CAAC,MAAM,QAAQ,KAAK,GACpB;AACA,iBAAW,SAAS,OAAO,OAAO,KAAK,EAAG,oBAAmB,KAAK;AAAA,IACpE;AAAA,EACF;AACF;","names":["copy"]}
@@ -1,11 +1,11 @@
1
- import {
2
- normalizeToolResultOutput,
3
- parseToolArgs
4
- } from "./chunk-SCFWN3T2.js";
5
1
  import {
6
2
  ToolCallError,
7
3
  ToolJsonError
8
4
  } from "./chunk-J6S6MT7O.js";
5
+ import {
6
+ normalizeToolResultOutput,
7
+ parseToolArgs
8
+ } from "./chunk-SCFWN3T2.js";
9
9
 
10
10
  // src/internal/agent-runtime/prepared-tool-call.ts
11
11
  var preparedToolInputSymbol = /* @__PURE__ */ Symbol("preparedToolInput");
@@ -90,4 +90,4 @@ export {
90
90
  prepareToolCall,
91
91
  prepareToolCallFromInput
92
92
  };
93
- //# sourceMappingURL=chunk-647TQE3E.js.map
93
+ //# sourceMappingURL=chunk-5BO4OTTK.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isToolIndex
3
- } from "./chunk-F4BOW76L.js";
3
+ } from "./chunk-XQTTPQWA.js";
4
4
  import {
5
5
  isMcpTool
6
6
  } from "./chunk-PLDJCCVL.js";
@@ -165,4 +165,4 @@ function snapshotToolIndex(index) {
165
165
  export {
166
166
  prepareAgentTools
167
167
  };
168
- //# sourceMappingURL=chunk-ZQC6M22O.js.map
168
+ //# sourceMappingURL=chunk-7LBUXGJI.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createMemoryCompactionSummary,
3
3
  cumulativeCompactedMessageCount
4
- } from "./chunk-E44DRLUL.js";
4
+ } from "./chunk-LW6F3IGP.js";
5
5
  import {
6
6
  MemoryCompactionConflictError,
7
7
  MemoryCompactionError
@@ -349,4 +349,4 @@ function isEmptyUsage(usage) {
349
349
  export {
350
350
  AgentRunMemory
351
351
  };
352
- //# sourceMappingURL=chunk-FGOVEUVK.js.map
352
+ //# sourceMappingURL=chunk-7OHHMYRO.js.map
@@ -2,9 +2,6 @@ import {
2
2
  snapshotPipelineObservability,
3
3
  startPipelineRunObservers
4
4
  } from "./chunk-ETYB5JO6.js";
5
- import {
6
- PipelineAgentSuspensionError
7
- } from "./chunk-R6722CIU.js";
8
5
  import {
9
6
  childContext,
10
7
  combineAbortSignals,
@@ -12,6 +9,9 @@ import {
12
9
  runNode,
13
10
  stageContext
14
11
  } from "./chunk-EKZRAWBP.js";
12
+ import {
13
+ PipelineAgentSuspensionError
14
+ } from "./chunk-R6722CIU.js";
15
15
  import {
16
16
  appendComposedGraph,
17
17
  appendParallelBranch,
@@ -23,7 +23,7 @@ import {
23
23
  } from "./chunk-V3FFZWF3.js";
24
24
  import {
25
25
  extract
26
- } from "./chunk-7TUAAGVR.js";
26
+ } from "./chunk-YKWUFYXT.js";
27
27
  import {
28
28
  mapWithConcurrency
29
29
  } from "./chunk-4FIVU53H.js";
@@ -372,4 +372,4 @@ function normalizeParallelBranches(branches) {
372
372
  export {
373
373
  Pipeline
374
374
  };
375
- //# sourceMappingURL=chunk-DXW37JLZ.js.map
375
+ //# sourceMappingURL=chunk-AMPQJMDG.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  embedSparseQuery,
3
3
  embedText
4
- } from "./chunk-HHMLE3TZ.js";
4
+ } from "./chunk-YCTXTOOQ.js";
5
5
  import {
6
6
  assertFiniteMinScore,
7
7
  assertPositiveSearchLimit
@@ -86,4 +86,4 @@ function resolveRetries(setting) {
86
86
  export {
87
87
  retrieveDocuments
88
88
  };
89
- //# sourceMappingURL=chunk-HAAGSIZH.js.map
89
+ //# sourceMappingURL=chunk-CB2L2NIQ.js.map
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  TEAM_INSTRUCTIONS,
13
13
  teamTools
14
- } from "./chunk-CJKGTEN4.js";
14
+ } from "./chunk-HDL5TXF7.js";
15
15
  import {
16
16
  AgentTeamInteractionError,
17
17
  AgentTeamLimitError
@@ -19,10 +19,10 @@ import {
19
19
  import {
20
20
  createResolvedAgent,
21
21
  getResolvedAgentOptions
22
- } from "./chunk-MTJDYC6T.js";
22
+ } from "./chunk-TOJSC4GI.js";
23
23
  import {
24
24
  AgentRun
25
- } from "./chunk-AYN34XVW.js";
25
+ } from "./chunk-GRI4EFNG.js";
26
26
  import {
27
27
  withInternalAgentRunOptions
28
28
  } from "./chunk-KITX3HDN.js";
@@ -36,7 +36,7 @@ import {
36
36
  } from "./chunk-KFAVEL5F.js";
37
37
  import {
38
38
  isStreamingCompletionModel
39
- } from "./chunk-YMTBHHLQ.js";
39
+ } from "./chunk-HG6ASDNI.js";
40
40
  import {
41
41
  Usage
42
42
  } from "./chunk-HJ6KTQTZ.js";
@@ -619,4 +619,4 @@ var TeamRun = class {
619
619
  export {
620
620
  TeamRun
621
621
  };
622
- //# sourceMappingURL=chunk-I7YCEQXT.js.map
622
+ //# sourceMappingURL=chunk-D6FK5ZQR.js.map
@@ -2,12 +2,12 @@ import {
2
2
  AgentInteractionSignal,
3
3
  ToolExecutionSuspension
4
4
  } from "./chunk-5IURMWFN.js";
5
+ import {
6
+ isQuestionTool
7
+ } from "./chunk-GB4SRUT7.js";
5
8
  import {
6
9
  isSkillTool
7
10
  } from "./chunk-2NLINXRF.js";
8
- import {
9
- isQuestionTool
10
- } from "./chunk-T3ZOZEAB.js";
11
11
  import {
12
12
  runControl,
13
13
  toolCallControl
@@ -30,7 +30,7 @@ import {
30
30
  import {
31
31
  prepareToolCall,
32
32
  prepareToolCallFromInput
33
- } from "./chunk-647TQE3E.js";
33
+ } from "./chunk-5BO4OTTK.js";
34
34
  import {
35
35
  assertToolApprovalRequirement,
36
36
  toolMayRequireApproval
@@ -948,4 +948,4 @@ function agentToolEventPayload(toolCall, internalCallId, event) {
948
948
  export {
949
949
  ToolCallExecutor
950
950
  };
951
- //# sourceMappingURL=chunk-B57NNDEF.js.map
951
+ //# sourceMappingURL=chunk-FTK6YRLN.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createTool
3
- } from "./chunk-Y365ABZY.js";
3
+ } from "./chunk-4WSICA6D.js";
4
4
 
5
5
  // src/tool/question-tool.ts
6
6
  import { z } from "zod";
@@ -44,4 +44,4 @@ export {
44
44
  createQuestionTool,
45
45
  isQuestionTool
46
46
  };
47
- //# sourceMappingURL=chunk-T3ZOZEAB.js.map
47
+ //# sourceMappingURL=chunk-GB4SRUT7.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runEvalSuite
3
- } from "./chunk-SIXS4CCU.js";
3
+ } from "./chunk-4IOC4SP6.js";
4
4
 
5
5
  // src/evals/cli.ts
6
6
  var EvalAssertionError = class extends Error {
@@ -352,4 +352,4 @@ export {
352
352
  assertEvalOutcomes,
353
353
  runEvalCli
354
354
  };
355
- //# sourceMappingURL=chunk-KX2TRKO2.js.map
355
+ //# sourceMappingURL=chunk-GNBPXJC6.js.map
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  ToolCallExecutor
3
- } from "./chunk-B57NNDEF.js";
3
+ } from "./chunk-FTK6YRLN.js";
4
4
  import {
5
5
  normalizeMemoryScope
6
6
  } from "./chunk-LAIATEUB.js";
7
7
  import {
8
8
  AgentRunMemory
9
- } from "./chunk-FGOVEUVK.js";
9
+ } from "./chunk-7OHHMYRO.js";
10
10
  import {
11
11
  fetchContextDocuments,
12
12
  fetchToolDefinitions
13
- } from "./chunk-GDY2Z2SZ.js";
13
+ } from "./chunk-PFJN5OIQ.js";
14
14
  import {
15
15
  getInternalAgentRunOptions
16
16
  } from "./chunk-KITX3HDN.js";
@@ -41,19 +41,19 @@ import {
41
41
  } from "./chunk-5IURMWFN.js";
42
42
  import {
43
43
  isQuestionTool
44
- } from "./chunk-T3ZOZEAB.js";
44
+ } from "./chunk-GB4SRUT7.js";
45
45
  import {
46
46
  startAgentRunObservers
47
47
  } from "./chunk-YNA3UR42.js";
48
+ import {
49
+ MemoryCompactionError
50
+ } from "./chunk-LQJ4KHMY.js";
48
51
  import {
49
52
  extractRagText
50
53
  } from "./chunk-MJCMKZFP.js";
51
54
  import {
52
55
  createAsyncQueue
53
56
  } from "./chunk-EZR5AV3J.js";
54
- import {
55
- MemoryCompactionError
56
- } from "./chunk-LQJ4KHMY.js";
57
57
  import {
58
58
  runControl
59
59
  } from "./chunk-FAPIZJS2.js";
@@ -75,17 +75,17 @@ import {
75
75
  import {
76
76
  getAgentProviderOutputSchema
77
77
  } from "./chunk-GLMYZ6OA.js";
78
- import {
79
- runInputGuardrails,
80
- runOutputGuardrails
81
- } from "./chunk-VZ5ZZBNX.js";
82
78
  import {
83
79
  appendGuardrailPolicies,
84
80
  hasEnforcedOutputGuardrails
85
81
  } from "./chunk-6BTJC3ES.js";
82
+ import {
83
+ runInputGuardrails,
84
+ runOutputGuardrails
85
+ } from "./chunk-VZ5ZZBNX.js";
86
86
  import {
87
87
  isStreamingCompletionModel
88
- } from "./chunk-YMTBHHLQ.js";
88
+ } from "./chunk-HG6ASDNI.js";
89
89
  import {
90
90
  createCompletionRequest
91
91
  } from "./chunk-GSVOMQEE.js";
@@ -94,7 +94,7 @@ import {
94
94
  } from "./chunk-4ONUNWGC.js";
95
95
  import {
96
96
  CompletionStreamAccumulator
97
- } from "./chunk-2JZV4LUS.js";
97
+ } from "./chunk-MKY7KTZY.js";
98
98
  import {
99
99
  assertCompletionResponseIntegrity
100
100
  } from "./chunk-XQV3XNVT.js";
@@ -933,7 +933,7 @@ var AgentRun = class _AgentRun {
933
933
  } finally {
934
934
  if (this.runState === "running" || this.runState === "closing") {
935
935
  const cancellation = this.cancellationError ?? new AgentRunCancelledError([...this.chatHistory, ...newMessages], "Agent stream closed.");
936
- this.cancellationError = cancellation;
936
+ this.setCancellationError(cancellation);
937
937
  await settleFailureCleanup([() => this.closeActiveGeneration(cancellation)]);
938
938
  await this.reportRunFailure(cancellation, runId, usage, newMessages, runObservers);
939
939
  this.runState = "cancelled";
@@ -2336,4 +2336,4 @@ function observerRunEnd(outcome) {
2336
2336
  export {
2337
2337
  AgentRun
2338
2338
  };
2339
- //# sourceMappingURL=chunk-AYN34XVW.js.map
2339
+ //# sourceMappingURL=chunk-GRI4EFNG.js.map