@nhtio/adk 1.20260607.2 → 1.20260609.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.
- package/CHANGELOG.md +185 -0
- package/batteries/embeddings/openai/adapter.cjs +1 -1
- package/batteries/embeddings/openai/adapter.mjs +1 -1
- package/batteries/embeddings/openai/exceptions.cjs +1 -1
- package/batteries/embeddings/openai/exceptions.mjs +1 -1
- package/batteries/embeddings/openai/types.d.ts +7 -0
- package/batteries/embeddings/webllm/adapter.cjs +1 -1
- package/batteries/embeddings/webllm/adapter.mjs +1 -1
- package/batteries/embeddings/webllm/exceptions.cjs +1 -1
- package/batteries/embeddings/webllm/exceptions.mjs +1 -1
- package/batteries/llm/chat_common/helpers.d.ts +165 -0
- package/batteries/llm/chat_common/types.d.ts +309 -0
- package/batteries/llm/index.d.ts +5 -0
- package/batteries/llm/ollama/adapter.cjs +736 -0
- package/batteries/llm/ollama/adapter.cjs.map +1 -0
- package/batteries/llm/ollama/adapter.d.ts +64 -0
- package/batteries/llm/ollama/adapter.mjs +734 -0
- package/batteries/llm/ollama/adapter.mjs.map +1 -0
- package/batteries/llm/ollama/exceptions.cjs +105 -0
- package/batteries/llm/ollama/exceptions.cjs.map +1 -0
- package/batteries/llm/ollama/exceptions.d.ts +112 -0
- package/batteries/llm/ollama/exceptions.mjs +96 -0
- package/batteries/llm/ollama/exceptions.mjs.map +1 -0
- package/batteries/llm/ollama/helpers.cjs +487 -0
- package/batteries/llm/ollama/helpers.cjs.map +1 -0
- package/batteries/llm/ollama/helpers.d.ts +158 -0
- package/batteries/llm/ollama/helpers.mjs +450 -0
- package/batteries/llm/ollama/helpers.mjs.map +1 -0
- package/batteries/llm/ollama/index.d.ts +29 -0
- package/batteries/llm/ollama/types.cjs +2 -0
- package/batteries/llm/ollama/types.d.ts +334 -0
- package/batteries/llm/ollama/types.mjs +0 -0
- package/batteries/llm/ollama/validation.cjs +130 -0
- package/batteries/llm/ollama/validation.cjs.map +1 -0
- package/batteries/llm/ollama/validation.d.ts +31 -0
- package/batteries/llm/ollama/validation.mjs +127 -0
- package/batteries/llm/ollama/validation.mjs.map +1 -0
- package/batteries/llm/ollama.cjs +54 -0
- package/batteries/llm/ollama.mjs +6 -0
- package/batteries/llm/openai_chat_completions/adapter.cjs +36 -19
- package/batteries/llm/openai_chat_completions/adapter.cjs.map +1 -1
- package/batteries/llm/openai_chat_completions/adapter.mjs +23 -6
- package/batteries/llm/openai_chat_completions/adapter.mjs.map +1 -1
- package/batteries/llm/openai_chat_completions/exceptions.cjs +1 -1
- package/batteries/llm/openai_chat_completions/exceptions.mjs +1 -1
- package/batteries/llm/openai_chat_completions/helpers.cjs +80 -320
- package/batteries/llm/openai_chat_completions/helpers.cjs.map +1 -1
- package/batteries/llm/openai_chat_completions/helpers.d.ts +68 -144
- package/batteries/llm/openai_chat_completions/helpers.mjs +40 -280
- package/batteries/llm/openai_chat_completions/helpers.mjs.map +1 -1
- package/batteries/llm/openai_chat_completions/types.d.ts +273 -181
- package/batteries/llm/openai_chat_completions/validation.cjs +2 -2
- package/batteries/llm/openai_chat_completions/validation.cjs.map +1 -1
- package/batteries/llm/openai_chat_completions/validation.mjs +2 -2
- package/batteries/llm/openai_chat_completions/validation.mjs.map +1 -1
- package/batteries/llm/openai_chat_completions.cjs +29 -28
- package/batteries/llm/openai_chat_completions.mjs +2 -1
- package/batteries/llm/webllm_chat_completions/adapter.cjs +38 -19
- package/batteries/llm/webllm_chat_completions/adapter.cjs.map +1 -1
- package/batteries/llm/webllm_chat_completions/adapter.d.ts +18 -0
- package/batteries/llm/webllm_chat_completions/adapter.mjs +25 -6
- package/batteries/llm/webllm_chat_completions/adapter.mjs.map +1 -1
- package/batteries/llm/webllm_chat_completions/exceptions.cjs +1 -1
- package/batteries/llm/webllm_chat_completions/exceptions.mjs +1 -1
- package/batteries/llm/webllm_chat_completions/helpers.cjs +29 -28
- package/batteries/llm/webllm_chat_completions/helpers.mjs +2 -1
- package/batteries/llm/webllm_chat_completions/types.d.ts +21 -0
- package/batteries/llm/webllm_chat_completions/validation.cjs +13 -1
- package/batteries/llm/webllm_chat_completions/validation.cjs.map +1 -1
- package/batteries/llm/webllm_chat_completions/validation.d.ts +12 -0
- package/batteries/llm/webllm_chat_completions/validation.mjs +13 -1
- package/batteries/llm/webllm_chat_completions/validation.mjs.map +1 -1
- package/batteries/llm/webllm_chat_completions.cjs +29 -28
- package/batteries/llm/webllm_chat_completions.mjs +2 -1
- package/batteries/llm.cjs +44 -28
- package/batteries/llm.mjs +9 -4
- package/batteries/storage/flydrive.cjs +1 -1
- package/batteries/storage/flydrive.mjs +1 -1
- package/batteries/storage/in_memory/index.d.ts +1 -1
- package/batteries/storage/in_memory.cjs +2 -2
- package/batteries/storage/in_memory.cjs.map +1 -1
- package/batteries/storage/in_memory.mjs +2 -2
- package/batteries/storage/in_memory.mjs.map +1 -1
- package/batteries/storage/opfs/index.d.ts +19 -0
- package/batteries/storage/opfs.cjs +1 -1
- package/batteries/storage/opfs.cjs.map +1 -1
- package/batteries/storage/opfs.mjs +1 -1
- package/batteries/storage/opfs.mjs.map +1 -1
- package/batteries/tools/color.cjs +3 -2
- package/batteries/tools/color.cjs.map +1 -1
- package/batteries/tools/color.mjs +3 -2
- package/batteries/tools/color.mjs.map +1 -1
- package/batteries/tools/comparison.cjs +4 -3
- package/batteries/tools/comparison.cjs.map +1 -1
- package/batteries/tools/comparison.mjs +4 -3
- package/batteries/tools/comparison.mjs.map +1 -1
- package/batteries/tools/data_structure.cjs +30 -10
- package/batteries/tools/data_structure.cjs.map +1 -1
- package/batteries/tools/data_structure.mjs +30 -10
- package/batteries/tools/data_structure.mjs.map +1 -1
- package/batteries/tools/datetime_extended.cjs +5 -10
- package/batteries/tools/datetime_extended.cjs.map +1 -1
- package/batteries/tools/datetime_extended.mjs +5 -10
- package/batteries/tools/datetime_extended.mjs.map +1 -1
- package/batteries/tools/datetime_math.cjs +2 -2
- package/batteries/tools/datetime_math.mjs +2 -2
- package/batteries/tools/encoding.cjs +13 -4
- package/batteries/tools/encoding.cjs.map +1 -1
- package/batteries/tools/encoding.mjs +13 -4
- package/batteries/tools/encoding.mjs.map +1 -1
- package/batteries/tools/formatting.cjs +4 -4
- package/batteries/tools/formatting.cjs.map +1 -1
- package/batteries/tools/formatting.mjs +4 -4
- package/batteries/tools/formatting.mjs.map +1 -1
- package/batteries/tools/geo_basics.cjs +2 -2
- package/batteries/tools/geo_basics.mjs +2 -2
- package/batteries/tools/index.d.ts +1 -0
- package/batteries/tools/math.cjs +10 -8
- package/batteries/tools/math.cjs.map +1 -1
- package/batteries/tools/math.mjs +10 -8
- package/batteries/tools/math.mjs.map +1 -1
- package/batteries/tools/memory.cjs +5 -5
- package/batteries/tools/memory.mjs +5 -5
- package/batteries/tools/parsing.cjs +9 -5
- package/batteries/tools/parsing.cjs.map +1 -1
- package/batteries/tools/parsing.mjs +9 -5
- package/batteries/tools/parsing.mjs.map +1 -1
- package/batteries/tools/retrievables.cjs +4 -4
- package/batteries/tools/retrievables.mjs +4 -4
- package/batteries/tools/searxng/exceptions.d.ts +21 -0
- package/batteries/tools/searxng/index.d.ts +150 -0
- package/batteries/tools/searxng.cjs +5 -0
- package/batteries/tools/searxng.mjs +2 -0
- package/batteries/tools/standing_instructions.cjs +4 -4
- package/batteries/tools/standing_instructions.mjs +4 -4
- package/batteries/tools/statistics.cjs +54 -43
- package/batteries/tools/statistics.cjs.map +1 -1
- package/batteries/tools/statistics.mjs +54 -43
- package/batteries/tools/statistics.mjs.map +1 -1
- package/batteries/tools/string_processing.cjs +5 -5
- package/batteries/tools/string_processing.cjs.map +1 -1
- package/batteries/tools/string_processing.mjs +5 -5
- package/batteries/tools/string_processing.mjs.map +1 -1
- package/batteries/tools/structured_data.cjs +8 -13
- package/batteries/tools/structured_data.cjs.map +1 -1
- package/batteries/tools/structured_data.mjs +8 -13
- package/batteries/tools/structured_data.mjs.map +1 -1
- package/batteries/tools/text_analysis.cjs +3 -3
- package/batteries/tools/text_analysis.mjs +3 -3
- package/batteries/tools/text_comparison.cjs +2 -2
- package/batteries/tools/text_comparison.mjs +2 -2
- package/batteries/tools/time.cjs +2 -2
- package/batteries/tools/time.mjs +2 -2
- package/batteries/tools/unit_conversion.cjs +10 -8
- package/batteries/tools/unit_conversion.cjs.map +1 -1
- package/batteries/tools/unit_conversion.mjs +10 -8
- package/batteries/tools/unit_conversion.mjs.map +1 -1
- package/batteries/tools.cjs +3 -0
- package/batteries/tools.mjs +2 -1
- package/batteries/vector/arangodb/index.d.ts +2 -0
- package/batteries/vector/arangodb.cjs +2 -1
- package/batteries/vector/arangodb.cjs.map +1 -1
- package/batteries/vector/arangodb.mjs +2 -1
- package/batteries/vector/arangodb.mjs.map +1 -1
- package/batteries/vector/builder.cjs +31 -0
- package/batteries/vector/builder.cjs.map +1 -1
- package/batteries/vector/builder.d.ts +58 -0
- package/batteries/vector/builder.mjs +31 -0
- package/batteries/vector/builder.mjs.map +1 -1
- package/batteries/vector/chroma/index.d.ts +4 -0
- package/batteries/vector/chroma.cjs +3 -0
- package/batteries/vector/chroma.cjs.map +1 -1
- package/batteries/vector/chroma.mjs +3 -0
- package/batteries/vector/chroma.mjs.map +1 -1
- package/batteries/vector/clickhouse/index.d.ts +2 -0
- package/batteries/vector/clickhouse.cjs +2 -1
- package/batteries/vector/clickhouse.cjs.map +1 -1
- package/batteries/vector/clickhouse.mjs +2 -1
- package/batteries/vector/clickhouse.mjs.map +1 -1
- package/batteries/vector/cloudflare/index.d.ts +2 -0
- package/batteries/vector/cloudflare.cjs +2 -1
- package/batteries/vector/cloudflare.cjs.map +1 -1
- package/batteries/vector/cloudflare.mjs +2 -1
- package/batteries/vector/cloudflare.mjs.map +1 -1
- package/batteries/vector/conformance/index.d.ts +22 -0
- package/batteries/vector/conformance.cjs +22 -0
- package/batteries/vector/conformance.cjs.map +1 -1
- package/batteries/vector/conformance.mjs +22 -0
- package/batteries/vector/conformance.mjs.map +1 -1
- package/batteries/vector/contract.cjs +22 -0
- package/batteries/vector/contract.cjs.map +1 -1
- package/batteries/vector/contract.d.ts +51 -0
- package/batteries/vector/contract.mjs +22 -0
- package/batteries/vector/contract.mjs.map +1 -1
- package/batteries/vector/couchbase/index.d.ts +2 -0
- package/batteries/vector/couchbase.cjs +2 -1
- package/batteries/vector/couchbase.cjs.map +1 -1
- package/batteries/vector/couchbase.mjs +2 -1
- package/batteries/vector/couchbase.mjs.map +1 -1
- package/batteries/vector/duckdb/index.d.ts +2 -0
- package/batteries/vector/duckdb.cjs +2 -1
- package/batteries/vector/duckdb.cjs.map +1 -1
- package/batteries/vector/duckdb.mjs +2 -1
- package/batteries/vector/duckdb.mjs.map +1 -1
- package/batteries/vector/elasticsearch/index.d.ts +2 -0
- package/batteries/vector/elasticsearch.cjs +2 -1
- package/batteries/vector/elasticsearch.cjs.map +1 -1
- package/batteries/vector/elasticsearch.mjs +2 -1
- package/batteries/vector/elasticsearch.mjs.map +1 -1
- package/batteries/vector/exceptions.cjs +1 -1
- package/batteries/vector/exceptions.mjs +1 -1
- package/batteries/vector/factory.cjs +6 -0
- package/batteries/vector/factory.cjs.map +1 -1
- package/batteries/vector/factory.d.ts +14 -0
- package/batteries/vector/factory.mjs +6 -0
- package/batteries/vector/factory.mjs.map +1 -1
- package/batteries/vector/filters.cjs +22 -1
- package/batteries/vector/filters.cjs.map +1 -1
- package/batteries/vector/filters.d.ts +38 -0
- package/batteries/vector/filters.mjs +22 -1
- package/batteries/vector/filters.mjs.map +1 -1
- package/batteries/vector/helpers.cjs +13 -0
- package/batteries/vector/helpers.cjs.map +1 -1
- package/batteries/vector/helpers.d.ts +14 -0
- package/batteries/vector/helpers.mjs +13 -0
- package/batteries/vector/helpers.mjs.map +1 -1
- package/batteries/vector/hnswlib/index.d.ts +2 -0
- package/batteries/vector/hnswlib.cjs +2 -1
- package/batteries/vector/hnswlib.cjs.map +1 -1
- package/batteries/vector/hnswlib.mjs +2 -1
- package/batteries/vector/hnswlib.mjs.map +1 -1
- package/batteries/vector/in_memory/index.d.ts +1 -0
- package/batteries/vector/in_memory.cjs +1 -0
- package/batteries/vector/in_memory.cjs.map +1 -1
- package/batteries/vector/in_memory.mjs +1 -0
- package/batteries/vector/in_memory.mjs.map +1 -1
- package/batteries/vector/lancedb/index.d.ts +2 -0
- package/batteries/vector/lancedb.cjs +2 -1
- package/batteries/vector/lancedb.cjs.map +1 -1
- package/batteries/vector/lancedb.mjs +2 -1
- package/batteries/vector/lancedb.mjs.map +1 -1
- package/batteries/vector/mariadb/index.d.ts +2 -0
- package/batteries/vector/mariadb.cjs +2 -1
- package/batteries/vector/mariadb.cjs.map +1 -1
- package/batteries/vector/mariadb.mjs +2 -1
- package/batteries/vector/mariadb.mjs.map +1 -1
- package/batteries/vector/meilisearch/index.d.ts +2 -0
- package/batteries/vector/meilisearch.cjs +2 -1
- package/batteries/vector/meilisearch.cjs.map +1 -1
- package/batteries/vector/meilisearch.mjs +2 -1
- package/batteries/vector/meilisearch.mjs.map +1 -1
- package/batteries/vector/migrate.cjs +18 -1
- package/batteries/vector/migrate.cjs.map +1 -1
- package/batteries/vector/migrate.d.ts +31 -0
- package/batteries/vector/migrate.mjs +18 -1
- package/batteries/vector/migrate.mjs.map +1 -1
- package/batteries/vector/milvus/index.d.ts +5 -0
- package/batteries/vector/milvus.cjs +4 -0
- package/batteries/vector/milvus.cjs.map +1 -1
- package/batteries/vector/milvus.mjs +4 -0
- package/batteries/vector/milvus.mjs.map +1 -1
- package/batteries/vector/mongodb/index.d.ts +2 -0
- package/batteries/vector/mongodb.cjs +2 -1
- package/batteries/vector/mongodb.cjs.map +1 -1
- package/batteries/vector/mongodb.mjs +2 -1
- package/batteries/vector/mongodb.mjs.map +1 -1
- package/batteries/vector/neo4j/index.d.ts +2 -0
- package/batteries/vector/neo4j.cjs +2 -1
- package/batteries/vector/neo4j.cjs.map +1 -1
- package/batteries/vector/neo4j.mjs +2 -1
- package/batteries/vector/neo4j.mjs.map +1 -1
- package/batteries/vector/opensearch/index.d.ts +2 -0
- package/batteries/vector/opensearch.cjs +2 -1
- package/batteries/vector/opensearch.cjs.map +1 -1
- package/batteries/vector/opensearch.mjs +2 -1
- package/batteries/vector/opensearch.mjs.map +1 -1
- package/batteries/vector/oracle23ai/index.d.ts +2 -0
- package/batteries/vector/oracle23ai.cjs +2 -1
- package/batteries/vector/oracle23ai.cjs.map +1 -1
- package/batteries/vector/oracle23ai.mjs +2 -1
- package/batteries/vector/oracle23ai.mjs.map +1 -1
- package/batteries/vector/orama/index.d.ts +1 -0
- package/batteries/vector/orama.cjs +1 -0
- package/batteries/vector/orama.cjs.map +1 -1
- package/batteries/vector/orama.mjs +1 -0
- package/batteries/vector/orama.mjs.map +1 -1
- package/batteries/vector/pgvector/index.d.ts +9 -2
- package/batteries/vector/pgvector.cjs +4 -0
- package/batteries/vector/pgvector.cjs.map +1 -1
- package/batteries/vector/pgvector.mjs +4 -0
- package/batteries/vector/pgvector.mjs.map +1 -1
- package/batteries/vector/pinecone/index.d.ts +5 -0
- package/batteries/vector/pinecone.cjs +3 -1
- package/batteries/vector/pinecone.cjs.map +1 -1
- package/batteries/vector/pinecone.mjs +3 -1
- package/batteries/vector/pinecone.mjs.map +1 -1
- package/batteries/vector/plan.d.ts +27 -0
- package/batteries/vector/qdrant/index.d.ts +5 -0
- package/batteries/vector/qdrant.cjs +4 -0
- package/batteries/vector/qdrant.cjs.map +1 -1
- package/batteries/vector/qdrant.mjs +4 -0
- package/batteries/vector/qdrant.mjs.map +1 -1
- package/batteries/vector/redis/index.d.ts +2 -0
- package/batteries/vector/redis.cjs +2 -1
- package/batteries/vector/redis.cjs.map +1 -1
- package/batteries/vector/redis.mjs +2 -1
- package/batteries/vector/redis.mjs.map +1 -1
- package/batteries/vector/retrievable.cjs +9 -1
- package/batteries/vector/retrievable.cjs.map +1 -1
- package/batteries/vector/retrievable.mjs +9 -1
- package/batteries/vector/retrievable.mjs.map +1 -1
- package/batteries/vector/retrievable_glue.d.ts +21 -0
- package/batteries/vector/s3vectors/index.d.ts +2 -0
- package/batteries/vector/s3vectors.cjs +2 -1
- package/batteries/vector/s3vectors.cjs.map +1 -1
- package/batteries/vector/s3vectors.mjs +2 -1
- package/batteries/vector/s3vectors.mjs.map +1 -1
- package/batteries/vector/schema.cjs +28 -0
- package/batteries/vector/schema.cjs.map +1 -1
- package/batteries/vector/schema.d.ts +39 -0
- package/batteries/vector/schema.mjs +28 -0
- package/batteries/vector/schema.mjs.map +1 -1
- package/batteries/vector/solr/index.d.ts +2 -0
- package/batteries/vector/solr.cjs +2 -1
- package/batteries/vector/solr.cjs.map +1 -1
- package/batteries/vector/solr.mjs +2 -1
- package/batteries/vector/solr.mjs.map +1 -1
- package/batteries/vector/sqlite_vec/index.d.ts +6 -3
- package/batteries/vector/sqlite_vec.cjs +2 -0
- package/batteries/vector/sqlite_vec.cjs.map +1 -1
- package/batteries/vector/sqlite_vec.mjs +2 -0
- package/batteries/vector/sqlite_vec.mjs.map +1 -1
- package/batteries/vector/surrealdb/index.d.ts +2 -0
- package/batteries/vector/surrealdb.cjs +2 -1
- package/batteries/vector/surrealdb.cjs.map +1 -1
- package/batteries/vector/surrealdb.mjs +2 -1
- package/batteries/vector/surrealdb.mjs.map +1 -1
- package/batteries/vector/types.d.ts +27 -0
- package/batteries/vector/typesense/index.d.ts +2 -0
- package/batteries/vector/typesense.cjs +2 -1
- package/batteries/vector/typesense.cjs.map +1 -1
- package/batteries/vector/typesense.mjs +2 -1
- package/batteries/vector/typesense.mjs.map +1 -1
- package/batteries/vector/validation.cjs +14 -0
- package/batteries/vector/validation.cjs.map +1 -1
- package/batteries/vector/validation.d.ts +14 -0
- package/batteries/vector/validation.mjs +14 -0
- package/batteries/vector/validation.mjs.map +1 -1
- package/batteries/vector/vector_store_constructor.cjs +1 -1
- package/batteries/vector/vector_store_constructor.cjs.map +1 -1
- package/batteries/vector/vector_store_constructor.d.ts +1 -1
- package/batteries/vector/vector_store_constructor.mjs +1 -1
- package/batteries/vector/vector_store_constructor.mjs.map +1 -1
- package/batteries/vector/vespa/index.d.ts +2 -0
- package/batteries/vector/vespa.cjs +2 -1
- package/batteries/vector/vespa.cjs.map +1 -1
- package/batteries/vector/vespa.mjs +2 -1
- package/batteries/vector/vespa.mjs.map +1 -1
- package/batteries/vector/weaviate/index.d.ts +2 -0
- package/batteries/vector/weaviate.cjs +2 -1
- package/batteries/vector/weaviate.cjs.map +1 -1
- package/batteries/vector/weaviate.mjs +2 -1
- package/batteries/vector/weaviate.mjs.map +1 -1
- package/batteries.cjs +46 -28
- package/batteries.mjs +10 -5
- package/{common-BT0nfCi9.mjs → common-DYDUi99O.mjs} +9 -9
- package/common-DYDUi99O.mjs.map +1 -0
- package/{common-Cj8TaQ9U.js → common-DZl3ADJs.js} +9 -9
- package/common-DZl3ADJs.js.map +1 -0
- package/common.cjs +7 -7
- package/common.d.ts +1 -1
- package/common.mjs +7 -7
- package/{dispatch_runner-DPcS7Y_M.mjs → dispatch_runner--ZhdDWRZ.mjs} +27 -5
- package/{dispatch_runner-DPcS7Y_M.mjs.map → dispatch_runner--ZhdDWRZ.mjs.map} +1 -1
- package/{dispatch_runner-BHBNupqp.js → dispatch_runner-nHDKkxye.js} +27 -5
- package/{dispatch_runner-BHBNupqp.js.map → dispatch_runner-nHDKkxye.js.map} +1 -1
- package/dispatch_runner.cjs +1 -1
- package/dispatch_runner.d.ts +1 -1
- package/dispatch_runner.mjs +1 -1
- package/eslint/rules/artifact_tool_forbids_artifact_constructor.cjs +1 -0
- package/eslint/rules/artifact_tool_forbids_artifact_constructor.cjs.map +1 -1
- package/eslint/rules/artifact_tool_forbids_artifact_constructor.d.ts +1 -0
- package/eslint/rules/artifact_tool_forbids_artifact_constructor.mjs +1 -0
- package/eslint/rules/artifact_tool_forbids_artifact_constructor.mjs.map +1 -1
- package/eslint/rules/no_model_in_tool_handler.cjs +1 -0
- package/eslint/rules/no_model_in_tool_handler.cjs.map +1 -1
- package/eslint/rules/no_model_in_tool_handler.d.ts +1 -0
- package/eslint/rules/no_model_in_tool_handler.mjs +1 -0
- package/eslint/rules/no_model_in_tool_handler.mjs.map +1 -1
- package/eslint/rules/require_validator_any_required.cjs +1 -0
- package/eslint/rules/require_validator_any_required.cjs.map +1 -1
- package/eslint/rules/require_validator_any_required.d.ts +1 -0
- package/eslint/rules/require_validator_any_required.mjs +1 -0
- package/eslint/rules/require_validator_any_required.mjs.map +1 -1
- package/eslint/rules/thought_payload_requires_replay_tag.cjs +1 -0
- package/eslint/rules/thought_payload_requires_replay_tag.cjs.map +1 -1
- package/eslint/rules/thought_payload_requires_replay_tag.d.ts +1 -0
- package/eslint/rules/thought_payload_requires_replay_tag.mjs +1 -0
- package/eslint/rules/thought_payload_requires_replay_tag.mjs.map +1 -1
- package/eslint/rules/token_encoding_requires_context_window.cjs +1 -0
- package/eslint/rules/token_encoding_requires_context_window.cjs.map +1 -1
- package/eslint/rules/token_encoding_requires_context_window.d.ts +1 -0
- package/eslint/rules/token_encoding_requires_context_window.mjs +1 -0
- package/eslint/rules/token_encoding_requires_context_window.mjs.map +1 -1
- package/eslint.cjs +1 -1
- package/eslint.mjs +1 -1
- package/{exceptions-BeWH2FwP.mjs → exceptions-BDhN0Xzr.mjs} +3 -2
- package/exceptions-BDhN0Xzr.mjs.map +1 -0
- package/{exceptions-CitH5wZI.js → exceptions-BRXrUKiW.js} +3 -2
- package/exceptions-BRXrUKiW.js.map +1 -0
- package/exceptions.cjs +2 -2
- package/exceptions.mjs +2 -2
- package/factories.cjs +1 -1
- package/factories.mjs +1 -1
- package/forge.cjs +4 -4
- package/forge.d.ts +1 -1
- package/forge.mjs +4 -4
- package/guards.cjs +9 -9
- package/guards.mjs +9 -9
- package/helpers-DSTFxTiC.js +497 -0
- package/helpers-DSTFxTiC.js.map +1 -0
- package/helpers-xhrQbMAG.mjs +306 -0
- package/helpers-xhrQbMAG.mjs.map +1 -0
- package/index.cjs +13 -13
- package/index.mjs +13 -13
- package/lib/classes/base_exception.d.ts +1 -0
- package/lib/classes/media.d.ts +10 -0
- package/lib/classes/retrievable.d.ts +1 -1
- package/lib/classes/spooled_json_artifact.d.ts +1 -1
- package/lib/classes/spooled_markdown_artifact.d.ts +1 -0
- package/lib/classes/tokenizable.d.ts +3 -0
- package/lib/classes/tool.d.ts +8 -0
- package/lib/classes/turn_gate.d.ts +6 -0
- package/lib/dispatch_runner.d.ts +4 -32
- package/lib/helpers/bignum.cjs +82 -0
- package/lib/helpers/bignum.cjs.map +1 -0
- package/lib/helpers/bignum.d.ts +52 -0
- package/lib/helpers/bignum.mjs +74 -0
- package/lib/helpers/bignum.mjs.map +1 -0
- package/lib/turn_runner.d.ts +1 -1
- package/lib/types/dispatch_runner.d.ts +83 -0
- package/lib/utils/exceptions.d.ts +1 -1
- package/lib/utils/retry.cjs.map +1 -1
- package/lib/utils/retry.d.ts +2 -0
- package/lib/utils/retry.mjs.map +1 -1
- package/mcp/adk-docs-corpus.json +1 -1
- package/package.json +264 -224
- package/{runtime-j92CNi5z.mjs → runtime-Bz5zA8wc.mjs} +2 -2
- package/{runtime-j92CNi5z.mjs.map → runtime-Bz5zA8wc.mjs.map} +1 -1
- package/{runtime-MFFcJrRv.js → runtime-DslE1aBw.js} +2 -2
- package/{runtime-MFFcJrRv.js.map → runtime-DslE1aBw.js.map} +1 -1
- package/searxng-Bkrwhwhw.js +269 -0
- package/searxng-Bkrwhwhw.js.map +1 -0
- package/searxng-CyA-nEu5.mjs +257 -0
- package/searxng-CyA-nEu5.mjs.map +1 -0
- package/skills/adk-assembly/SKILL.md +2 -2
- package/{spooled_artifact-CHoZgWwI.mjs → spooled_artifact-7eePq7JA.mjs} +5 -5
- package/{spooled_artifact-CHoZgWwI.mjs.map → spooled_artifact-7eePq7JA.mjs.map} +1 -1
- package/{spooled_artifact-BTq6Nzfy.js → spooled_artifact-DX8LLyUX.js} +5 -5
- package/{spooled_artifact-BTq6Nzfy.js.map → spooled_artifact-DX8LLyUX.js.map} +1 -1
- package/spooled_artifact.cjs +2 -2
- package/spooled_artifact.mjs +2 -2
- package/{spooled_markdown_artifact-CALSDxIx.js → spooled_markdown_artifact-ClX72lek.js} +4 -4
- package/spooled_markdown_artifact-ClX72lek.js.map +1 -0
- package/{spooled_markdown_artifact-Ci5UL7l4.mjs → spooled_markdown_artifact-wkrBF3oX.mjs} +4 -4
- package/spooled_markdown_artifact-wkrBF3oX.mjs.map +1 -0
- package/{thought-D34QQZZ9.mjs → thought-B_vxAiKU.mjs} +5 -5
- package/{thought-D34QQZZ9.mjs.map → thought-B_vxAiKU.mjs.map} +1 -1
- package/{thought-BbwhJ1wb.js → thought-DLwpF7MI.js} +5 -5
- package/{thought-BbwhJ1wb.js.map → thought-DLwpF7MI.js.map} +1 -1
- package/{tool-CVyZkFC7.js → tool-D5WGVIcI.js} +4 -4
- package/{tool-CVyZkFC7.js.map → tool-D5WGVIcI.js.map} +1 -1
- package/{tool-CMhaDRNd.mjs → tool-wMYMVl60.mjs} +4 -4
- package/{tool-CMhaDRNd.mjs.map → tool-wMYMVl60.mjs.map} +1 -1
- package/{tool_call-CV5qVNlb.mjs → tool_call-B4-_-vjG.mjs} +5 -5
- package/tool_call-B4-_-vjG.mjs.map +1 -0
- package/{tool_call-Db68hB7y.js → tool_call-DixVlW40.js} +5 -5
- package/tool_call-DixVlW40.js.map +1 -0
- package/{tool_registry-D1pSSlsd.mjs → tool_registry-791Vrjtf.mjs} +4 -3
- package/tool_registry-791Vrjtf.mjs.map +1 -0
- package/{tool_registry-DYUYqXvo.js → tool_registry-CKJPze3j.js} +4 -3
- package/tool_registry-CKJPze3j.js.map +1 -0
- package/{turn_runner-DqWHNP80.js → turn_runner-HXImLGIn.js} +7 -7
- package/turn_runner-HXImLGIn.js.map +1 -0
- package/{turn_runner-fg1Wc3dK.mjs → turn_runner-ZyYO-Kti.mjs} +7 -7
- package/turn_runner-ZyYO-Kti.mjs.map +1 -0
- package/turn_runner.cjs +1 -1
- package/turn_runner.mjs +1 -1
- package/types.d.ts +1 -1
- package/common-BT0nfCi9.mjs.map +0 -1
- package/common-Cj8TaQ9U.js.map +0 -1
- package/exceptions-BeWH2FwP.mjs.map +0 -1
- package/exceptions-CitH5wZI.js.map +0 -1
- package/spooled_markdown_artifact-CALSDxIx.js.map +0 -1
- package/spooled_markdown_artifact-Ci5UL7l4.mjs.map +0 -1
- package/tool_call-CV5qVNlb.mjs.map +0 -1
- package/tool_call-Db68hB7y.js.map +0 -1
- package/tool_registry-D1pSSlsd.mjs.map +0 -1
- package/tool_registry-DYUYqXvo.js.map +0 -1
- package/turn_runner-DqWHNP80.js.map +0 -1
- package/turn_runner-fg1Wc3dK.mjs.map +0 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime validation schema and wrapper for native Ollama adapter options.
|
|
3
|
+
*
|
|
4
|
+
* @module @nhtio/adk/batteries/llm/ollama/validation
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Schema and call-site wrapper for validating `OllamaAdapterOptions`. Used at construction time
|
|
8
|
+
* and at the start of every iteration against the merged options shape (stash > executor >
|
|
9
|
+
* constructor). Throws `E_INVALID_OLLAMA_OPTIONS` on failure — same hard-fail policy as every other
|
|
10
|
+
* ADK contract.
|
|
11
|
+
*
|
|
12
|
+
* Note the deliberate `.unknown(...)` asymmetry: the TOP level is `.unknown(false)` so option typos
|
|
13
|
+
* fail loud, but the nested `options` (runtime/sampling) block is `.unknown(true)` so new llama.cpp
|
|
14
|
+
* parameters pass through without a library bump.
|
|
15
|
+
*/
|
|
16
|
+
import type { OllamaAdapterOptions } from "./types";
|
|
17
|
+
/**
|
|
18
|
+
* Validator schema for `OllamaAdapterOptions`. Used by `validateOptions` at construction time and
|
|
19
|
+
* again at the start of every iteration after options have been merged (stash > executor >
|
|
20
|
+
* constructor). Rejects unknown top-level keys so typos fail loud.
|
|
21
|
+
*/
|
|
22
|
+
export declare const ollamaOptionsSchema: import("@nhtio/validation").ObjectSchema<OllamaAdapterOptions>;
|
|
23
|
+
/**
|
|
24
|
+
* Validates an arbitrary input against `ollamaOptionsSchema` and returns the resolved options
|
|
25
|
+
* shape. Throws `E_INVALID_OLLAMA_OPTIONS` (carrying the validator's error report on `cause`) on
|
|
26
|
+
* failure.
|
|
27
|
+
*
|
|
28
|
+
* @param input - The raw options object to validate.
|
|
29
|
+
* @returns The resolved options object with defaults filled in.
|
|
30
|
+
*/
|
|
31
|
+
export declare const validateOptions: (input: unknown) => OllamaAdapterOptions;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { i as byteStoreSchema } from "../../../common-DYDUi99O.mjs";
|
|
2
|
+
import "../../../guards.mjs";
|
|
3
|
+
import { E_INVALID_OLLAMA_OPTIONS } from "./exceptions.mjs";
|
|
4
|
+
import { validator } from "@nhtio/validation";
|
|
5
|
+
//#region src/batteries/llm/ollama/validation.ts
|
|
6
|
+
var jsonSchemaSchema = validator.object().unknown(true);
|
|
7
|
+
var bucketLabelSchema = validator.string().valid("standingInstructions", "memories", "retrievables", "timeline");
|
|
8
|
+
var bucketOrderSchema = validator.array().items(bucketLabelSchema).unique().default([
|
|
9
|
+
"standingInstructions",
|
|
10
|
+
"memories",
|
|
11
|
+
"retrievables",
|
|
12
|
+
"timeline"
|
|
13
|
+
]);
|
|
14
|
+
var tokenEncodingSchema = validator.alternatives(validator.string().valid("gpt2", "r50k_base", "p50k_base", "p50k_edit", "cl100k_base", "o200k_base", "gemini", "llama2", "claude"), validator.any().valid(null).optional()).default(null);
|
|
15
|
+
var retrySchema = validator.object({
|
|
16
|
+
maxAttempts: validator.number().integer().min(1).default(1),
|
|
17
|
+
baseDelayMs: validator.number().integer().min(0).default(500),
|
|
18
|
+
maxDelayMs: validator.number().integer().min(1).default(3e4),
|
|
19
|
+
retriableStatuses: validator.array().items(validator.number().integer().min(100).max(599)).default([
|
|
20
|
+
429,
|
|
21
|
+
502,
|
|
22
|
+
503,
|
|
23
|
+
504
|
|
24
|
+
]),
|
|
25
|
+
honorRetryAfter: validator.boolean().default(true)
|
|
26
|
+
}).unknown(false);
|
|
27
|
+
var helperSchema = validator.function();
|
|
28
|
+
var helpersSchema = validator.object({
|
|
29
|
+
descriptionToChatCompletionsJsonSchema: helperSchema.optional(),
|
|
30
|
+
renderUntrustedContent: helperSchema.optional(),
|
|
31
|
+
renderTrustedContent: helperSchema.optional(),
|
|
32
|
+
renderStandingInstructions: helperSchema.optional(),
|
|
33
|
+
renderMemories: helperSchema.optional(),
|
|
34
|
+
renderRetrievables: helperSchema.optional(),
|
|
35
|
+
renderRetrievableSafetyDirective: helperSchema.optional(),
|
|
36
|
+
renderFirstPartyRetrievables: helperSchema.optional(),
|
|
37
|
+
renderThirdPartyPublicRetrievables: helperSchema.optional(),
|
|
38
|
+
renderThirdPartyPrivateRetrievables: helperSchema.optional(),
|
|
39
|
+
renderThought: helperSchema.optional(),
|
|
40
|
+
filterThoughts: helperSchema.optional(),
|
|
41
|
+
toolsToChatCompletionsTools: helperSchema.optional(),
|
|
42
|
+
renderChatCompletionsSystemPrompt: helperSchema.optional(),
|
|
43
|
+
renderOllamaTimelineMessage: helperSchema.optional(),
|
|
44
|
+
renderOllamaToolCallResult: helperSchema.optional(),
|
|
45
|
+
buildOllamaHistory: helperSchema.optional()
|
|
46
|
+
}).unknown(false);
|
|
47
|
+
var thinkSchema = validator.alternatives(validator.boolean(), validator.string().valid("low", "medium", "high"));
|
|
48
|
+
var formatSchema = validator.alternatives(validator.string().valid("json"), jsonSchemaSchema);
|
|
49
|
+
var keepAliveSchema = validator.alternatives(validator.string(), validator.number());
|
|
50
|
+
var stopSchema = validator.alternatives(validator.string(), validator.array().items(validator.string()));
|
|
51
|
+
var runtimeOptionsSchema = validator.object({
|
|
52
|
+
num_ctx: validator.number().integer().min(1).optional(),
|
|
53
|
+
temperature: validator.number().min(0).optional(),
|
|
54
|
+
top_p: validator.number().min(0).max(1).optional(),
|
|
55
|
+
top_k: validator.number().integer().min(0).optional(),
|
|
56
|
+
min_p: validator.number().min(0).max(1).optional(),
|
|
57
|
+
typical_p: validator.number().min(0).max(1).optional(),
|
|
58
|
+
seed: validator.number().integer().optional(),
|
|
59
|
+
stop: stopSchema.optional(),
|
|
60
|
+
num_predict: validator.number().integer().optional(),
|
|
61
|
+
num_keep: validator.number().integer().min(0).optional(),
|
|
62
|
+
repeat_penalty: validator.number().optional(),
|
|
63
|
+
repeat_last_n: validator.number().integer().optional(),
|
|
64
|
+
presence_penalty: validator.number().optional(),
|
|
65
|
+
frequency_penalty: validator.number().optional(),
|
|
66
|
+
penalize_newline: validator.boolean().optional(),
|
|
67
|
+
num_batch: validator.number().integer().min(1).optional(),
|
|
68
|
+
num_gpu: validator.number().integer().min(0).optional(),
|
|
69
|
+
main_gpu: validator.number().integer().min(0).optional(),
|
|
70
|
+
num_thread: validator.number().integer().min(1).optional(),
|
|
71
|
+
numa: validator.boolean().optional(),
|
|
72
|
+
use_mmap: validator.boolean().optional()
|
|
73
|
+
}).unknown(true);
|
|
74
|
+
/**
|
|
75
|
+
* Validator schema for `OllamaAdapterOptions`. Used by `validateOptions` at construction time and
|
|
76
|
+
* again at the start of every iteration after options have been merged (stash > executor >
|
|
77
|
+
* constructor). Rejects unknown top-level keys so typos fail loud.
|
|
78
|
+
*/
|
|
79
|
+
var ollamaOptionsSchema = validator.object({
|
|
80
|
+
apiKey: validator.string().optional(),
|
|
81
|
+
baseURL: validator.string().optional(),
|
|
82
|
+
headers: validator.object().pattern(validator.string(), validator.string()).optional(),
|
|
83
|
+
fetch: validator.function().optional(),
|
|
84
|
+
stream: validator.boolean().default(true),
|
|
85
|
+
streamIdleTimeoutMs: validator.number().integer().min(0).default(0),
|
|
86
|
+
requestTimeoutMs: validator.number().integer().min(0).default(0),
|
|
87
|
+
retry: retrySchema.optional(),
|
|
88
|
+
bucketOrder: bucketOrderSchema,
|
|
89
|
+
contextWindow: validator.number().integer().min(1).optional(),
|
|
90
|
+
selfIdentity: validator.string().min(1).default("assistant"),
|
|
91
|
+
thoughtSurfacing: validator.string().valid("all-self", "latest-self", "all").default("all-self"),
|
|
92
|
+
tokenEncoding: tokenEncodingSchema,
|
|
93
|
+
replayCompatibility: validator.array().items(validator.string().min(1)).default([]),
|
|
94
|
+
helpers: helpersSchema.optional(),
|
|
95
|
+
spoolStore: byteStoreSchema.optional(),
|
|
96
|
+
autoAck: validator.boolean().default(false),
|
|
97
|
+
unsupportedMediaPolicy: validator.alternatives(validator.string().valid("throw", "fallback-stash", "synthetic-description"), validator.object({
|
|
98
|
+
mode: validator.string().valid("fallback-stash").required(),
|
|
99
|
+
stashKeys: validator.array().items(validator.string().min(1)).required()
|
|
100
|
+
}).unknown(false)).default("throw"),
|
|
101
|
+
model: validator.string().required(),
|
|
102
|
+
think: thinkSchema.optional(),
|
|
103
|
+
format: formatSchema.optional(),
|
|
104
|
+
options: runtimeOptionsSchema.optional(),
|
|
105
|
+
keep_alive: keepAliveSchema.optional()
|
|
106
|
+
}).unknown(false);
|
|
107
|
+
var formatValidationDetails = (err) => err.details.map((d) => d.message).join(" and ");
|
|
108
|
+
/**
|
|
109
|
+
* Validates an arbitrary input against `ollamaOptionsSchema` and returns the resolved options
|
|
110
|
+
* shape. Throws `E_INVALID_OLLAMA_OPTIONS` (carrying the validator's error report on `cause`) on
|
|
111
|
+
* failure.
|
|
112
|
+
*
|
|
113
|
+
* @param input - The raw options object to validate.
|
|
114
|
+
* @returns The resolved options object with defaults filled in.
|
|
115
|
+
*/
|
|
116
|
+
var validateOptions = (input) => {
|
|
117
|
+
const { value, error } = ollamaOptionsSchema.validate(input, {
|
|
118
|
+
abortEarly: false,
|
|
119
|
+
convert: false
|
|
120
|
+
});
|
|
121
|
+
if (error) throw new E_INVALID_OLLAMA_OPTIONS([formatValidationDetails(error)], { cause: error });
|
|
122
|
+
return value;
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
export { ollamaOptionsSchema, validateOptions };
|
|
126
|
+
|
|
127
|
+
//# sourceMappingURL=validation.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.mjs","names":[],"sources":["../../../../src/batteries/llm/ollama/validation.ts"],"sourcesContent":["/**\n * Runtime validation schema and wrapper for native Ollama adapter options.\n *\n * @module @nhtio/adk/batteries/llm/ollama/validation\n *\n * @remarks\n * Schema and call-site wrapper for validating `OllamaAdapterOptions`. Used at construction time\n * and at the start of every iteration against the merged options shape (stash > executor >\n * constructor). Throws `E_INVALID_OLLAMA_OPTIONS` on failure — same hard-fail policy as every other\n * ADK contract.\n *\n * Note the deliberate `.unknown(...)` asymmetry: the TOP level is `.unknown(false)` so option typos\n * fail loud, but the nested `options` (runtime/sampling) block is `.unknown(true)` so new llama.cpp\n * parameters pass through without a library bump.\n */\n\nimport { isError } from '@nhtio/adk/guards'\nimport { byteStoreSchema } from '@nhtio/adk/common'\nimport { E_INVALID_OLLAMA_OPTIONS } from './exceptions'\nimport { validator, ValidationError } from '@nhtio/validation'\nimport type { OllamaAdapterOptions } from './types'\n\n// ─── Sub-schemas ──────────────────────────────────────────────────────────────\n\nconst jsonSchemaSchema = validator.object().unknown(true)\n\nconst bucketLabelSchema = validator\n .string()\n .valid('standingInstructions', 'memories', 'retrievables', 'timeline')\n\nconst bucketOrderSchema = validator\n .array()\n .items(bucketLabelSchema)\n .unique()\n .default(['standingInstructions', 'memories', 'retrievables', 'timeline'])\n\nconst tokenEncodingSchema = validator\n .alternatives(\n validator\n .string()\n .valid(\n 'gpt2',\n 'r50k_base',\n 'p50k_base',\n 'p50k_edit',\n 'cl100k_base',\n 'o200k_base',\n 'gemini',\n 'llama2',\n 'claude'\n ),\n // `tokenEncoding?: TokenEncoding | null` — OPTIONAL: a valid encoding string, explicit null, or\n // absent (undefined = \"no token counting\"). `.optional()` makes the null/undefined disposition\n // explicit per adk/require-validator-any-required, without rejecting the legitimate \"omitted\"\n // case.\n validator.any().valid(null).optional()\n )\n .default(null)\n\nconst retrySchema = validator\n .object({\n maxAttempts: validator.number().integer().min(1).default(1),\n baseDelayMs: validator.number().integer().min(0).default(500),\n maxDelayMs: validator.number().integer().min(1).default(30_000),\n retriableStatuses: validator\n .array()\n .items(validator.number().integer().min(100).max(599))\n .default([429, 502, 503, 504]),\n honorRetryAfter: validator.boolean().default(true),\n })\n .unknown(false)\n\nconst helperSchema = validator.function()\n\nconst helpersSchema = validator\n .object({\n descriptionToChatCompletionsJsonSchema: helperSchema.optional(),\n renderUntrustedContent: helperSchema.optional(),\n renderTrustedContent: helperSchema.optional(),\n renderStandingInstructions: helperSchema.optional(),\n renderMemories: helperSchema.optional(),\n renderRetrievables: helperSchema.optional(),\n renderRetrievableSafetyDirective: helperSchema.optional(),\n renderFirstPartyRetrievables: helperSchema.optional(),\n renderThirdPartyPublicRetrievables: helperSchema.optional(),\n renderThirdPartyPrivateRetrievables: helperSchema.optional(),\n renderThought: helperSchema.optional(),\n filterThoughts: helperSchema.optional(),\n toolsToChatCompletionsTools: helperSchema.optional(),\n renderChatCompletionsSystemPrompt: helperSchema.optional(),\n renderOllamaTimelineMessage: helperSchema.optional(),\n renderOllamaToolCallResult: helperSchema.optional(),\n buildOllamaHistory: helperSchema.optional(),\n })\n .unknown(false)\n\n// ─── Native request-body sub-schemas ──────────────────────────────────────────\n\nconst thinkSchema = validator.alternatives(\n validator.boolean(),\n validator.string().valid('low', 'medium', 'high')\n)\n\nconst formatSchema = validator.alternatives(validator.string().valid('json'), jsonSchemaSchema)\n\nconst keepAliveSchema = validator.alternatives(validator.string(), validator.number())\n\nconst stopSchema = validator.alternatives(\n validator.string(),\n validator.array().items(validator.string())\n)\n\n// Nested runtime/sampling options block. `.unknown(true)` — the ONLY place unknown keys are\n// allowed — so new llama.cpp parameters pass through without a library bump.\nconst runtimeOptionsSchema = validator\n .object({\n num_ctx: validator.number().integer().min(1).optional(),\n temperature: validator.number().min(0).optional(),\n top_p: validator.number().min(0).max(1).optional(),\n top_k: validator.number().integer().min(0).optional(),\n min_p: validator.number().min(0).max(1).optional(),\n typical_p: validator.number().min(0).max(1).optional(),\n seed: validator.number().integer().optional(),\n stop: stopSchema.optional(),\n num_predict: validator.number().integer().optional(),\n num_keep: validator.number().integer().min(0).optional(),\n repeat_penalty: validator.number().optional(),\n repeat_last_n: validator.number().integer().optional(),\n presence_penalty: validator.number().optional(),\n frequency_penalty: validator.number().optional(),\n penalize_newline: validator.boolean().optional(),\n num_batch: validator.number().integer().min(1).optional(),\n num_gpu: validator.number().integer().min(0).optional(),\n main_gpu: validator.number().integer().min(0).optional(),\n num_thread: validator.number().integer().min(1).optional(),\n numa: validator.boolean().optional(),\n use_mmap: validator.boolean().optional(),\n })\n .unknown(true)\n\n// ─── Top-level schema ─────────────────────────────────────────────────────────\n\n/**\n * Validator schema for `OllamaAdapterOptions`. Used by `validateOptions` at construction time and\n * again at the start of every iteration after options have been merged (stash > executor >\n * constructor). Rejects unknown top-level keys so typos fail loud.\n */\nexport const ollamaOptionsSchema = validator\n .object<OllamaAdapterOptions>({\n // ADK control\n apiKey: validator.string().optional(),\n baseURL: validator.string().optional(),\n headers: validator.object().pattern(validator.string(), validator.string()).optional(),\n fetch: validator.function().optional(),\n stream: validator.boolean().default(true),\n streamIdleTimeoutMs: validator.number().integer().min(0).default(0),\n requestTimeoutMs: validator.number().integer().min(0).default(0),\n retry: retrySchema.optional(),\n bucketOrder: bucketOrderSchema,\n contextWindow: validator.number().integer().min(1).optional(),\n selfIdentity: validator.string().min(1).default('assistant'),\n thoughtSurfacing: validator\n .string()\n .valid('all-self', 'latest-self', 'all')\n .default('all-self'),\n tokenEncoding: tokenEncodingSchema,\n replayCompatibility: validator.array().items(validator.string().min(1)).default([]),\n helpers: helpersSchema.optional(),\n spoolStore: byteStoreSchema.optional(),\n // Opt-in: the executor only self-acks tool-call-free responses when true. Default false hands\n // turn-completion control to the implementor's output pipeline.\n autoAck: validator.boolean().default(false),\n unsupportedMediaPolicy: validator\n .alternatives(\n validator.string().valid('throw', 'fallback-stash', 'synthetic-description'),\n validator\n .object({\n mode: validator.string().valid('fallback-stash').required(),\n stashKeys: validator.array().items(validator.string().min(1)).required(),\n })\n .unknown(false)\n )\n .default('throw'),\n\n // Native /api/chat request body\n model: validator.string().required(),\n think: thinkSchema.optional(),\n format: formatSchema.optional(),\n options: runtimeOptionsSchema.optional(),\n keep_alive: keepAliveSchema.optional(),\n })\n .unknown(false)\n\nconst isValidationError = (value: unknown): value is ValidationError =>\n isError(value) && Array.isArray((value as ValidationError).details)\n\nconst formatValidationDetails = (err: ValidationError): string =>\n err.details.map((d) => d.message).join(' and ')\n\n/**\n * Validates an arbitrary input against `ollamaOptionsSchema` and returns the resolved options\n * shape. Throws `E_INVALID_OLLAMA_OPTIONS` (carrying the validator's error report on `cause`) on\n * failure.\n *\n * @param input - The raw options object to validate.\n * @returns The resolved options object with defaults filled in.\n */\nexport const validateOptions = (input: unknown): OllamaAdapterOptions => {\n const { value, error } = ollamaOptionsSchema.validate(input, {\n abortEarly: false,\n convert: false,\n })\n if (error) {\n throw new E_INVALID_OLLAMA_OPTIONS([formatValidationDetails(error)], { cause: error })\n }\n return value as OllamaAdapterOptions\n}\n\n// suppress unused import warning when the alias isn't referenced\nvoid isValidationError\n"],"mappings":"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"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../../chunk-Ble4zEEl.js");
|
|
3
|
+
const require_helpers = require("../../helpers-DSTFxTiC.js");
|
|
4
|
+
const require_batteries_llm_ollama_exceptions = require("./ollama/exceptions.cjs");
|
|
5
|
+
const require_batteries_llm_ollama_validation = require("./ollama/validation.cjs");
|
|
6
|
+
const require_batteries_llm_ollama_helpers = require("./ollama/helpers.cjs");
|
|
7
|
+
const require_batteries_llm_ollama_adapter = require("./ollama/adapter.cjs");
|
|
8
|
+
exports.E_INVALID_OLLAMA_OPTIONS = require_batteries_llm_ollama_exceptions.E_INVALID_OLLAMA_OPTIONS;
|
|
9
|
+
exports.E_OLLAMA_CONTEXT_OVERFLOW = require_batteries_llm_ollama_exceptions.E_OLLAMA_CONTEXT_OVERFLOW;
|
|
10
|
+
exports.E_OLLAMA_HTTP_ERROR = require_batteries_llm_ollama_exceptions.E_OLLAMA_HTTP_ERROR;
|
|
11
|
+
exports.E_OLLAMA_INVALID_TOOL_CALL_ARGS = require_batteries_llm_ollama_exceptions.E_OLLAMA_INVALID_TOOL_CALL_ARGS;
|
|
12
|
+
exports.E_OLLAMA_REQUEST_TIMEOUT = require_batteries_llm_ollama_exceptions.E_OLLAMA_REQUEST_TIMEOUT;
|
|
13
|
+
exports.E_OLLAMA_STREAM_ERROR = require_batteries_llm_ollama_exceptions.E_OLLAMA_STREAM_ERROR;
|
|
14
|
+
exports.E_OLLAMA_STREAM_STALLED = require_batteries_llm_ollama_exceptions.E_OLLAMA_STREAM_STALLED;
|
|
15
|
+
exports.E_OLLAMA_UNSUPPORTED_MEDIA_MODALITY = require_batteries_llm_ollama_exceptions.E_OLLAMA_UNSUPPORTED_MEDIA_MODALITY;
|
|
16
|
+
exports.OllamaAdapter = require_batteries_llm_ollama_adapter.OllamaAdapter;
|
|
17
|
+
exports.buildOllamaHistory = require_batteries_llm_ollama_helpers.buildOllamaHistory;
|
|
18
|
+
exports.defaultBuildOllamaHistory = require_batteries_llm_ollama_helpers.defaultBuildOllamaHistory;
|
|
19
|
+
exports.defaultDescriptionToChatCompletionsJsonSchema = require_helpers.defaultDescriptionToChatCompletionsJsonSchema;
|
|
20
|
+
exports.defaultFilterThoughts = require_helpers.defaultFilterThoughts;
|
|
21
|
+
exports.defaultOllamaToolsFromTools = require_batteries_llm_ollama_helpers.defaultOllamaToolsFromTools;
|
|
22
|
+
exports.defaultRenderChatCompletionsSystemPrompt = require_helpers.defaultRenderChatCompletionsSystemPrompt;
|
|
23
|
+
exports.defaultRenderFirstPartyRetrievables = require_helpers.defaultRenderFirstPartyRetrievables;
|
|
24
|
+
exports.defaultRenderMemories = require_helpers.defaultRenderMemories;
|
|
25
|
+
exports.defaultRenderOllamaTimelineMessage = require_batteries_llm_ollama_helpers.defaultRenderOllamaTimelineMessage;
|
|
26
|
+
exports.defaultRenderOllamaToolCallResult = require_batteries_llm_ollama_helpers.defaultRenderOllamaToolCallResult;
|
|
27
|
+
exports.defaultRenderRetrievableSafetyDirective = require_helpers.defaultRenderRetrievableSafetyDirective;
|
|
28
|
+
exports.defaultRenderRetrievables = require_helpers.defaultRenderRetrievables;
|
|
29
|
+
exports.defaultRenderStandingInstructions = require_helpers.defaultRenderStandingInstructions;
|
|
30
|
+
exports.defaultRenderThirdPartyPrivateRetrievables = require_helpers.defaultRenderThirdPartyPrivateRetrievables;
|
|
31
|
+
exports.defaultRenderThirdPartyPublicRetrievables = require_helpers.defaultRenderThirdPartyPublicRetrievables;
|
|
32
|
+
exports.defaultRenderThought = require_helpers.defaultRenderThought;
|
|
33
|
+
exports.defaultRenderTrustedContent = require_helpers.defaultRenderTrustedContent;
|
|
34
|
+
exports.defaultRenderUntrustedContent = require_helpers.defaultRenderUntrustedContent;
|
|
35
|
+
exports.defaultToolsToChatCompletionsTools = require_helpers.defaultToolsToChatCompletionsTools;
|
|
36
|
+
exports.descriptionToChatCompletionsJsonSchema = require_helpers.descriptionToChatCompletionsJsonSchema;
|
|
37
|
+
exports.filterThoughts = require_helpers.filterThoughts;
|
|
38
|
+
exports.ollamaOptionsSchema = require_batteries_llm_ollama_validation.ollamaOptionsSchema;
|
|
39
|
+
exports.ollamaToolsFromTools = require_batteries_llm_ollama_helpers.ollamaToolsFromTools;
|
|
40
|
+
exports.renderChatCompletionsSystemPrompt = require_helpers.renderChatCompletionsSystemPrompt;
|
|
41
|
+
exports.renderFirstPartyRetrievables = require_helpers.renderFirstPartyRetrievables;
|
|
42
|
+
exports.renderMemories = require_helpers.renderMemories;
|
|
43
|
+
exports.renderOllamaTimelineMessage = require_batteries_llm_ollama_helpers.renderOllamaTimelineMessage;
|
|
44
|
+
exports.renderOllamaToolCallResult = require_batteries_llm_ollama_helpers.renderOllamaToolCallResult;
|
|
45
|
+
exports.renderRetrievableSafetyDirective = require_helpers.renderRetrievableSafetyDirective;
|
|
46
|
+
exports.renderRetrievables = require_helpers.renderRetrievables;
|
|
47
|
+
exports.renderStandingInstructions = require_helpers.renderStandingInstructions;
|
|
48
|
+
exports.renderThirdPartyPrivateRetrievables = require_helpers.renderThirdPartyPrivateRetrievables;
|
|
49
|
+
exports.renderThirdPartyPublicRetrievables = require_helpers.renderThirdPartyPublicRetrievables;
|
|
50
|
+
exports.renderThought = require_helpers.renderThought;
|
|
51
|
+
exports.renderTrustedContent = require_helpers.renderTrustedContent;
|
|
52
|
+
exports.renderUntrustedContent = require_helpers.renderUntrustedContent;
|
|
53
|
+
exports.toolsToChatCompletionsTools = require_helpers.toolsToChatCompletionsTools;
|
|
54
|
+
exports.validateOptions = require_batteries_llm_ollama_validation.validateOptions;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { C as renderRetrievables, D as renderThought, E as renderThirdPartyPublicRetrievables, M as toolsToChatCompletionsTools, O as renderTrustedContent, S as renderRetrievableSafetyDirective, T as renderThirdPartyPrivateRetrievables, _ as filterThoughts, a as defaultRenderMemories, b as renderFirstPartyRetrievables, c as defaultRenderStandingInstructions, d as defaultRenderThought, f as defaultRenderTrustedContent, h as descriptionToChatCompletionsJsonSchema, i as defaultRenderFirstPartyRetrievables, k as renderUntrustedContent, l as defaultRenderThirdPartyPrivateRetrievables, m as defaultToolsToChatCompletionsTools, n as defaultFilterThoughts, o as defaultRenderRetrievableSafetyDirective, p as defaultRenderUntrustedContent, r as defaultRenderChatCompletionsSystemPrompt, s as defaultRenderRetrievables, t as defaultDescriptionToChatCompletionsJsonSchema, u as defaultRenderThirdPartyPublicRetrievables, w as renderStandingInstructions, x as renderMemories, y as renderChatCompletionsSystemPrompt } from "../../helpers-xhrQbMAG.mjs";
|
|
2
|
+
import { E_INVALID_OLLAMA_OPTIONS, E_OLLAMA_CONTEXT_OVERFLOW, E_OLLAMA_HTTP_ERROR, E_OLLAMA_INVALID_TOOL_CALL_ARGS, E_OLLAMA_REQUEST_TIMEOUT, E_OLLAMA_STREAM_ERROR, E_OLLAMA_STREAM_STALLED, E_OLLAMA_UNSUPPORTED_MEDIA_MODALITY } from "./ollama/exceptions.mjs";
|
|
3
|
+
import { ollamaOptionsSchema, validateOptions } from "./ollama/validation.mjs";
|
|
4
|
+
import { buildOllamaHistory, defaultBuildOllamaHistory, defaultOllamaToolsFromTools, defaultRenderOllamaTimelineMessage, defaultRenderOllamaToolCallResult, ollamaToolsFromTools, renderOllamaTimelineMessage, renderOllamaToolCallResult } from "./ollama/helpers.mjs";
|
|
5
|
+
import { OllamaAdapter } from "./ollama/adapter.mjs";
|
|
6
|
+
export { E_INVALID_OLLAMA_OPTIONS, E_OLLAMA_CONTEXT_OVERFLOW, E_OLLAMA_HTTP_ERROR, E_OLLAMA_INVALID_TOOL_CALL_ARGS, E_OLLAMA_REQUEST_TIMEOUT, E_OLLAMA_STREAM_ERROR, E_OLLAMA_STREAM_STALLED, E_OLLAMA_UNSUPPORTED_MEDIA_MODALITY, OllamaAdapter, buildOllamaHistory, defaultBuildOllamaHistory, defaultDescriptionToChatCompletionsJsonSchema, defaultFilterThoughts, defaultOllamaToolsFromTools, defaultRenderChatCompletionsSystemPrompt, defaultRenderFirstPartyRetrievables, defaultRenderMemories, defaultRenderOllamaTimelineMessage, defaultRenderOllamaToolCallResult, defaultRenderRetrievableSafetyDirective, defaultRenderRetrievables, defaultRenderStandingInstructions, defaultRenderThirdPartyPrivateRetrievables, defaultRenderThirdPartyPublicRetrievables, defaultRenderThought, defaultRenderTrustedContent, defaultRenderUntrustedContent, defaultToolsToChatCompletionsTools, descriptionToChatCompletionsJsonSchema, filterThoughts, ollamaOptionsSchema, ollamaToolsFromTools, renderChatCompletionsSystemPrompt, renderFirstPartyRetrievables, renderMemories, renderOllamaTimelineMessage, renderOllamaToolCallResult, renderRetrievableSafetyDirective, renderRetrievables, renderStandingInstructions, renderThirdPartyPrivateRetrievables, renderThirdPartyPublicRetrievables, renderThought, renderTrustedContent, renderUntrustedContent, toolsToChatCompletionsTools, validateOptions };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../../../chunk-Ble4zEEl.js");
|
|
3
|
-
const require_tool_registry = require("../../../tool_registry-
|
|
4
|
-
const require_thought = require("../../../thought-
|
|
5
|
-
const require_spooled_artifact = require("../../../spooled_artifact-
|
|
6
|
-
require("../../../common-
|
|
7
|
-
const require_tool_call = require("../../../tool_call-
|
|
3
|
+
const require_tool_registry = require("../../../tool_registry-CKJPze3j.js");
|
|
4
|
+
const require_thought = require("../../../thought-DLwpF7MI.js");
|
|
5
|
+
const require_spooled_artifact = require("../../../spooled_artifact-DX8LLyUX.js");
|
|
6
|
+
require("../../../common-DZl3ADJs.js");
|
|
7
|
+
const require_tool_call = require("../../../tool_call-DixVlW40.js");
|
|
8
8
|
require("../../../guards.cjs");
|
|
9
9
|
const require_lib_utils_retry = require("../../../lib/utils/retry.cjs");
|
|
10
10
|
const require_batteries_llm_openai_chat_completions_exceptions = require("./exceptions.cjs");
|
|
11
11
|
const require_batteries_llm_openai_chat_completions_validation = require("./validation.cjs");
|
|
12
12
|
const require_batteries_storage_in_memory = require("../../storage/in_memory.cjs");
|
|
13
|
+
const require_helpers = require("../../../helpers-DSTFxTiC.js");
|
|
13
14
|
const require_batteries_llm_openai_chat_completions_helpers = require("./helpers.cjs");
|
|
14
15
|
let luxon = require("luxon");
|
|
15
16
|
let js_sha256 = require("js-sha256");
|
|
@@ -142,21 +143,21 @@ var mergeOptions = (baseline, exec, stash) => {
|
|
|
142
143
|
var resolveHelpers = (overrides) => {
|
|
143
144
|
const src = overrides ?? {};
|
|
144
145
|
return {
|
|
145
|
-
descriptionToChatCompletionsJsonSchema: src.descriptionToChatCompletionsJsonSchema ??
|
|
146
|
-
renderUntrustedContent: src.renderUntrustedContent ??
|
|
147
|
-
renderTrustedContent: src.renderTrustedContent ??
|
|
148
|
-
renderStandingInstructions: src.renderStandingInstructions ??
|
|
149
|
-
renderMemories: src.renderMemories ??
|
|
150
|
-
renderRetrievables: src.renderRetrievables ??
|
|
151
|
-
renderRetrievableSafetyDirective: src.renderRetrievableSafetyDirective ??
|
|
152
|
-
renderFirstPartyRetrievables: src.renderFirstPartyRetrievables ??
|
|
153
|
-
renderThirdPartyPublicRetrievables: src.renderThirdPartyPublicRetrievables ??
|
|
154
|
-
renderThirdPartyPrivateRetrievables: src.renderThirdPartyPrivateRetrievables ??
|
|
146
|
+
descriptionToChatCompletionsJsonSchema: src.descriptionToChatCompletionsJsonSchema ?? require_helpers.defaultDescriptionToChatCompletionsJsonSchema,
|
|
147
|
+
renderUntrustedContent: src.renderUntrustedContent ?? require_helpers.defaultRenderUntrustedContent,
|
|
148
|
+
renderTrustedContent: src.renderTrustedContent ?? require_helpers.defaultRenderTrustedContent,
|
|
149
|
+
renderStandingInstructions: src.renderStandingInstructions ?? require_helpers.defaultRenderStandingInstructions,
|
|
150
|
+
renderMemories: src.renderMemories ?? require_helpers.defaultRenderMemories,
|
|
151
|
+
renderRetrievables: src.renderRetrievables ?? require_helpers.defaultRenderRetrievables,
|
|
152
|
+
renderRetrievableSafetyDirective: src.renderRetrievableSafetyDirective ?? require_helpers.defaultRenderRetrievableSafetyDirective,
|
|
153
|
+
renderFirstPartyRetrievables: src.renderFirstPartyRetrievables ?? require_helpers.defaultRenderFirstPartyRetrievables,
|
|
154
|
+
renderThirdPartyPublicRetrievables: src.renderThirdPartyPublicRetrievables ?? require_helpers.defaultRenderThirdPartyPublicRetrievables,
|
|
155
|
+
renderThirdPartyPrivateRetrievables: src.renderThirdPartyPrivateRetrievables ?? require_helpers.defaultRenderThirdPartyPrivateRetrievables,
|
|
155
156
|
renderTimelineMessage: src.renderTimelineMessage ?? require_batteries_llm_openai_chat_completions_helpers.defaultRenderTimelineMessage,
|
|
156
|
-
renderThought: src.renderThought ??
|
|
157
|
-
filterThoughts: src.filterThoughts ??
|
|
158
|
-
toolsToChatCompletionsTools: src.toolsToChatCompletionsTools ??
|
|
159
|
-
renderChatCompletionsSystemPrompt: src.renderChatCompletionsSystemPrompt ??
|
|
157
|
+
renderThought: src.renderThought ?? require_helpers.defaultRenderThought,
|
|
158
|
+
filterThoughts: src.filterThoughts ?? require_helpers.defaultFilterThoughts,
|
|
159
|
+
toolsToChatCompletionsTools: src.toolsToChatCompletionsTools ?? require_helpers.defaultToolsToChatCompletionsTools,
|
|
160
|
+
renderChatCompletionsSystemPrompt: src.renderChatCompletionsSystemPrompt ?? require_helpers.defaultRenderChatCompletionsSystemPrompt,
|
|
160
161
|
renderChatCompletionsToolCallResult: src.renderChatCompletionsToolCallResult ?? require_batteries_llm_openai_chat_completions_helpers.defaultRenderChatCompletionsToolCallResult,
|
|
161
162
|
buildChatCompletionsHistory: src.buildChatCompletionsHistory ?? require_batteries_llm_openai_chat_completions_helpers.defaultBuildChatCompletionsHistory,
|
|
162
163
|
createChatCompletionsToolCallDeltaAccumulator: src.createChatCompletionsToolCallDeltaAccumulator ?? require_batteries_llm_openai_chat_completions_helpers.defaultCreateChatCompletionsToolCallDeltaAccumulator
|
|
@@ -451,6 +452,22 @@ var OpenAIChatCompletionsAdapter = class OpenAIChatCompletionsAdapter {
|
|
|
451
452
|
detail: require_tool_registry.isError(err) ? err.message : String(err)
|
|
452
453
|
}
|
|
453
454
|
});
|
|
455
|
+
if (attempt < maxAttempts) {
|
|
456
|
+
const delay = require_lib_utils_retry.computeBackoff(attempt, retryCfg);
|
|
457
|
+
helpers.log.debug({
|
|
458
|
+
kind: "retry-attempt",
|
|
459
|
+
message: `Retrying after transport failure in ~${delay}ms (attempt ${attempt + 1}/${maxAttempts})`,
|
|
460
|
+
payload: {
|
|
461
|
+
reason: "transport-error",
|
|
462
|
+
delayMs: delay,
|
|
463
|
+
attempt: attempt + 1,
|
|
464
|
+
maxAttempts
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
await require_lib_utils_retry.sleepWithJitter(delay, ctx.abortSignal);
|
|
468
|
+
attempt += 1;
|
|
469
|
+
continue;
|
|
470
|
+
}
|
|
454
471
|
ctx.nack(new require_batteries_llm_openai_chat_completions_exceptions.E_OPENAI_CHAT_COMPLETIONS_HTTP_ERROR([0, require_tool_registry.isError(err) ? err.message : String(err)]));
|
|
455
472
|
return;
|
|
456
473
|
}
|