@langchain/core 1.1.3 → 1.1.5-dev-1765431816670
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 +8 -0
- package/README.md +1 -1
- package/dist/agents.d.cts.map +1 -0
- package/dist/agents.d.ts.map +1 -0
- package/dist/caches/index.d.cts.map +1 -0
- package/dist/caches/index.d.ts.map +1 -0
- package/dist/callbacks/base.cjs +1 -1
- package/dist/callbacks/base.cjs.map +1 -1
- package/dist/callbacks/base.d.cts.map +1 -0
- package/dist/callbacks/base.d.ts.map +1 -0
- package/dist/callbacks/base.js +1 -1
- package/dist/callbacks/base.js.map +1 -1
- package/dist/callbacks/dispatch/index.d.cts.map +1 -0
- package/dist/callbacks/dispatch/index.d.ts.map +1 -0
- package/dist/callbacks/dispatch/web.d.cts.map +1 -0
- package/dist/callbacks/dispatch/web.d.ts.map +1 -0
- package/dist/callbacks/manager.cjs +6 -6
- package/dist/callbacks/manager.cjs.map +1 -1
- package/dist/callbacks/manager.d.cts.map +1 -0
- package/dist/callbacks/manager.d.ts.map +1 -0
- package/dist/callbacks/manager.js +7 -7
- package/dist/callbacks/manager.js.map +1 -1
- package/dist/chat_history.d.cts.map +1 -0
- package/dist/chat_history.d.ts.map +1 -0
- package/dist/context.d.cts.map +1 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/document_loaders/base.d.cts.map +1 -0
- package/dist/document_loaders/base.d.ts.map +1 -0
- package/dist/document_loaders/langsmith.d.cts.map +1 -0
- package/dist/document_loaders/langsmith.d.ts.map +1 -0
- package/dist/documents/document.d.cts.map +1 -0
- package/dist/documents/document.d.ts.map +1 -0
- package/dist/documents/transformers.d.cts.map +1 -0
- package/dist/documents/transformers.d.ts.map +1 -0
- package/dist/embeddings.d.cts.map +1 -0
- package/dist/embeddings.d.ts.map +1 -0
- package/dist/example_selectors/base.d.cts.map +1 -0
- package/dist/example_selectors/base.d.ts.map +1 -0
- package/dist/example_selectors/conditional.d.cts.map +1 -0
- package/dist/example_selectors/conditional.d.ts.map +1 -0
- package/dist/example_selectors/length_based.d.cts.map +1 -0
- package/dist/example_selectors/length_based.d.ts.map +1 -0
- package/dist/example_selectors/semantic_similarity.d.cts.map +1 -0
- package/dist/example_selectors/semantic_similarity.d.ts.map +1 -0
- package/dist/indexing/base.d.cts.map +1 -0
- package/dist/indexing/base.d.ts.map +1 -0
- package/dist/indexing/record_manager.d.cts.map +1 -0
- package/dist/indexing/record_manager.d.ts.map +1 -0
- package/dist/language_models/base.d.cts.map +1 -0
- package/dist/language_models/base.d.ts.map +1 -0
- package/dist/language_models/chat_models.d.cts.map +1 -0
- package/dist/language_models/chat_models.d.ts.map +1 -0
- package/dist/language_models/llms.d.cts.map +1 -0
- package/dist/language_models/llms.d.ts.map +1 -0
- package/dist/language_models/profile.d.cts.map +1 -0
- package/dist/language_models/profile.d.ts.map +1 -0
- package/dist/load/import_type.d.cts.map +1 -0
- package/dist/load/import_type.d.ts.map +1 -0
- package/dist/load/index.d.cts.map +1 -0
- package/dist/load/index.d.ts.map +1 -0
- package/dist/load/map_keys.cjs +5 -4
- package/dist/load/map_keys.cjs.map +1 -1
- package/dist/load/map_keys.d.cts.map +1 -0
- package/dist/load/map_keys.d.ts.map +1 -0
- package/dist/load/map_keys.js +3 -3
- package/dist/load/map_keys.js.map +1 -1
- package/dist/load/serializable.d.cts.map +1 -0
- package/dist/load/serializable.d.ts.map +1 -0
- package/dist/memory.d.cts.map +1 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/messages/ai.d.cts.map +1 -0
- package/dist/messages/ai.d.ts.map +1 -0
- package/dist/messages/base.d.cts.map +1 -0
- package/dist/messages/base.d.ts.map +1 -0
- package/dist/messages/chat.d.cts.map +1 -0
- package/dist/messages/chat.d.ts.map +1 -0
- package/dist/messages/content/base.d.cts.map +1 -0
- package/dist/messages/content/base.d.ts.map +1 -0
- package/dist/messages/content/data.d.cts.map +1 -0
- package/dist/messages/content/data.d.ts.map +1 -0
- package/dist/messages/content/index.d.cts.map +1 -0
- package/dist/messages/content/index.d.ts.map +1 -0
- package/dist/messages/content/multimodal.d.cts.map +1 -0
- package/dist/messages/content/multimodal.d.ts.map +1 -0
- package/dist/messages/content/tools.d.cts.map +1 -0
- package/dist/messages/content/tools.d.ts.map +1 -0
- package/dist/messages/format.d.cts.map +1 -0
- package/dist/messages/format.d.ts.map +1 -0
- package/dist/messages/function.d.cts.map +1 -0
- package/dist/messages/function.d.ts.map +1 -0
- package/dist/messages/human.d.cts.map +1 -0
- package/dist/messages/human.d.ts.map +1 -0
- package/dist/messages/message.d.cts.map +1 -0
- package/dist/messages/message.d.ts.map +1 -0
- package/dist/messages/metadata.d.cts.map +1 -0
- package/dist/messages/metadata.d.ts.map +1 -0
- package/dist/messages/modifier.d.cts.map +1 -0
- package/dist/messages/modifier.d.ts.map +1 -0
- package/dist/messages/system.d.cts.map +1 -0
- package/dist/messages/system.d.ts.map +1 -0
- package/dist/messages/tool.d.cts.map +1 -0
- package/dist/messages/tool.d.ts.map +1 -0
- package/dist/messages/transformers.d.cts.map +1 -0
- package/dist/messages/transformers.d.ts.map +1 -0
- package/dist/messages/utils.d.cts.map +1 -0
- package/dist/messages/utils.d.ts.map +1 -0
- package/dist/output_parsers/base.d.cts.map +1 -0
- package/dist/output_parsers/base.d.ts.map +1 -0
- package/dist/output_parsers/bytes.d.cts.map +1 -0
- package/dist/output_parsers/bytes.d.ts.map +1 -0
- package/dist/output_parsers/json.d.cts.map +1 -0
- package/dist/output_parsers/json.d.ts.map +1 -0
- package/dist/output_parsers/list.d.cts.map +1 -0
- package/dist/output_parsers/list.d.ts.map +1 -0
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.cts.map +1 -0
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.ts.map +1 -0
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.cts.map +1 -0
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.ts.map +1 -0
- package/dist/output_parsers/string.d.cts.map +1 -0
- package/dist/output_parsers/string.d.ts.map +1 -0
- package/dist/output_parsers/structured.d.cts.map +1 -0
- package/dist/output_parsers/structured.d.ts.map +1 -0
- package/dist/output_parsers/transform.d.cts.map +1 -0
- package/dist/output_parsers/transform.d.ts.map +1 -0
- package/dist/output_parsers/xml.d.cts.map +1 -0
- package/dist/output_parsers/xml.d.ts.map +1 -0
- package/dist/outputs.d.cts.map +1 -0
- package/dist/outputs.d.ts.map +1 -0
- package/dist/prompt_values.d.cts.map +1 -0
- package/dist/prompt_values.d.ts.map +1 -0
- package/dist/prompts/base.d.cts.map +1 -0
- package/dist/prompts/base.d.ts.map +1 -0
- package/dist/prompts/chat.d.cts.map +1 -0
- package/dist/prompts/chat.d.ts.map +1 -0
- package/dist/prompts/dict.d.cts.map +1 -0
- package/dist/prompts/dict.d.ts.map +1 -0
- package/dist/prompts/few_shot.d.cts.map +1 -0
- package/dist/prompts/few_shot.d.ts.map +1 -0
- package/dist/prompts/image.d.cts.map +1 -0
- package/dist/prompts/image.d.ts.map +1 -0
- package/dist/prompts/pipeline.d.cts.map +1 -0
- package/dist/prompts/pipeline.d.ts.map +1 -0
- package/dist/prompts/prompt.d.cts.map +1 -0
- package/dist/prompts/prompt.d.ts.map +1 -0
- package/dist/prompts/serde.d.cts.map +1 -0
- package/dist/prompts/serde.d.ts.map +1 -0
- package/dist/prompts/string.d.cts.map +1 -0
- package/dist/prompts/string.d.ts.map +1 -0
- package/dist/prompts/structured.d.cts.map +1 -0
- package/dist/prompts/structured.d.ts.map +1 -0
- package/dist/prompts/template.d.cts.map +1 -0
- package/dist/prompts/template.d.ts.map +1 -0
- package/dist/retrievers/document_compressors/index.d.cts.map +1 -0
- package/dist/retrievers/document_compressors/index.d.ts.map +1 -0
- package/dist/retrievers/index.d.cts.map +1 -0
- package/dist/retrievers/index.d.ts.map +1 -0
- package/dist/runnables/base.cjs +7 -7
- package/dist/runnables/base.cjs.map +1 -1
- package/dist/runnables/base.d.cts.map +1 -0
- package/dist/runnables/base.d.ts.map +1 -0
- package/dist/runnables/base.js +1 -1
- package/dist/runnables/base.js.map +1 -1
- package/dist/runnables/branch.d.cts.map +1 -0
- package/dist/runnables/branch.d.ts.map +1 -0
- package/dist/runnables/config.cjs +15 -1
- package/dist/runnables/config.cjs.map +1 -1
- package/dist/runnables/config.d.cts.map +1 -0
- package/dist/runnables/config.d.ts.map +1 -0
- package/dist/runnables/config.js +15 -1
- package/dist/runnables/config.js.map +1 -1
- package/dist/runnables/graph.d.cts.map +1 -0
- package/dist/runnables/graph.d.ts.map +1 -0
- package/dist/runnables/history.d.cts.map +1 -0
- package/dist/runnables/history.d.ts.map +1 -0
- package/dist/runnables/passthrough.d.cts.map +1 -0
- package/dist/runnables/passthrough.d.ts.map +1 -0
- package/dist/runnables/router.d.cts.map +1 -0
- package/dist/runnables/router.d.ts.map +1 -0
- package/dist/runnables/types.d.cts.map +1 -0
- package/dist/runnables/types.d.ts.map +1 -0
- package/dist/singletons/async_local_storage/context.d.cts.map +1 -0
- package/dist/singletons/async_local_storage/context.d.ts.map +1 -0
- package/dist/singletons/async_local_storage/globals.d.cts.map +1 -0
- package/dist/singletons/async_local_storage/globals.d.ts.map +1 -0
- package/dist/singletons/async_local_storage/index.d.cts.map +1 -0
- package/dist/singletons/async_local_storage/index.d.ts.map +1 -0
- package/dist/singletons/callbacks.cjs.map +1 -1
- package/dist/singletons/callbacks.d.cts.map +1 -0
- package/dist/singletons/callbacks.d.ts.map +1 -0
- package/dist/singletons/callbacks.js.map +1 -1
- package/dist/stores.d.cts.map +1 -0
- package/dist/stores.d.ts.map +1 -0
- package/dist/structured_query/base.d.cts.map +1 -0
- package/dist/structured_query/base.d.ts.map +1 -0
- package/dist/structured_query/functional.d.cts.map +1 -0
- package/dist/structured_query/functional.d.ts.map +1 -0
- package/dist/structured_query/ir.d.cts.map +1 -0
- package/dist/structured_query/ir.d.ts.map +1 -0
- package/dist/structured_query/utils.d.cts.map +1 -0
- package/dist/structured_query/utils.d.ts.map +1 -0
- package/dist/tools/index.d.cts.map +1 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/types.d.cts.map +1 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/utils.d.cts.map +1 -0
- package/dist/tools/utils.d.ts.map +1 -0
- package/dist/tracers/base.d.cts.map +1 -0
- package/dist/tracers/base.d.ts.map +1 -0
- package/dist/tracers/console.cjs +3 -3
- package/dist/tracers/console.cjs.map +1 -1
- package/dist/tracers/console.d.cts.map +1 -0
- package/dist/tracers/console.d.ts.map +1 -0
- package/dist/tracers/console.js +3 -3
- package/dist/tracers/console.js.map +1 -1
- package/dist/tracers/event_stream.d.cts.map +1 -0
- package/dist/tracers/event_stream.d.ts.map +1 -0
- package/dist/tracers/log_stream.d.cts.map +1 -0
- package/dist/tracers/log_stream.d.ts.map +1 -0
- package/dist/tracers/run_collector.d.cts.map +1 -0
- package/dist/tracers/run_collector.d.ts.map +1 -0
- package/dist/tracers/tracer_langchain.d.cts.map +1 -0
- package/dist/tracers/tracer_langchain.d.ts.map +1 -0
- package/dist/types/_internal.d.cts.map +1 -0
- package/dist/types/_internal.d.ts.map +1 -0
- package/dist/types/type-utils.d.cts.map +1 -0
- package/dist/types/type-utils.d.ts.map +1 -0
- package/dist/utils/async_caller.cjs +1 -1
- package/dist/utils/async_caller.cjs.map +1 -1
- package/dist/utils/async_caller.d.cts.map +1 -0
- package/dist/utils/async_caller.d.ts.map +1 -0
- package/dist/utils/async_caller.js +1 -1
- package/dist/utils/async_caller.js.map +1 -1
- package/dist/utils/chunk_array.d.cts.map +1 -0
- package/dist/utils/chunk_array.d.ts.map +1 -0
- package/dist/utils/env.d.cts.map +1 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/event_source_parse.d.cts.map +1 -0
- package/dist/utils/event_source_parse.d.ts.map +1 -0
- package/dist/utils/fast-json-patch/src/core.d.cts.map +1 -0
- package/dist/utils/fast-json-patch/src/core.d.ts.map +1 -0
- package/dist/utils/fast-json-patch/src/duplex.d.cts.map +1 -0
- package/dist/utils/fast-json-patch/src/duplex.d.ts.map +1 -0
- package/dist/utils/format.d.cts.map +1 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/function_calling.d.cts.map +1 -0
- package/dist/utils/function_calling.d.ts.map +1 -0
- package/dist/utils/hash.d.cts.map +1 -0
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/{node_modules/.pnpm/is-network-error@1.3.0/node_modules → utils}/is-network-error/index.cjs +1 -1
- package/dist/utils/is-network-error/index.cjs.map +1 -0
- package/dist/{node_modules/.pnpm/is-network-error@1.3.0/node_modules → utils}/is-network-error/index.js +1 -1
- package/dist/utils/is-network-error/index.js.map +1 -0
- package/dist/utils/js-sha256/hash.d.cts.map +1 -0
- package/dist/utils/js-sha256/hash.d.ts.map +1 -0
- package/dist/utils/json.d.cts.map +1 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json_schema.d.cts.map +1 -0
- package/dist/utils/json_schema.d.ts.map +1 -0
- package/dist/utils/math.d.cts.map +1 -0
- package/dist/utils/math.d.ts.map +1 -0
- package/dist/utils/ml-distance/similarities.d.cts.map +1 -0
- package/dist/utils/ml-distance/similarities.d.ts.map +1 -0
- package/dist/{node_modules/.pnpm/p-retry@7.1.0/node_modules → utils}/p-retry/index.cjs +2 -2
- package/dist/utils/p-retry/index.cjs.map +1 -0
- package/dist/{node_modules/.pnpm/p-retry@7.1.0/node_modules → utils}/p-retry/index.js +2 -2
- package/dist/utils/p-retry/index.js.map +1 -0
- package/dist/utils/signal.d.cts.map +1 -0
- package/dist/utils/signal.d.ts.map +1 -0
- package/dist/utils/stream.d.cts.map +1 -0
- package/dist/utils/stream.d.ts.map +1 -0
- package/dist/utils/testing/chat_models.cjs +11 -5
- package/dist/utils/testing/chat_models.cjs.map +1 -1
- package/dist/utils/testing/chat_models.d.cts +8 -1
- package/dist/utils/testing/chat_models.d.cts.map +1 -0
- package/dist/utils/testing/chat_models.d.ts +8 -1
- package/dist/utils/testing/chat_models.d.ts.map +1 -0
- package/dist/utils/testing/chat_models.js +11 -5
- package/dist/utils/testing/chat_models.js.map +1 -1
- package/dist/utils/testing/embeddings.d.cts.map +1 -0
- package/dist/utils/testing/embeddings.d.ts.map +1 -0
- package/dist/utils/testing/llms.d.cts.map +1 -0
- package/dist/utils/testing/llms.d.ts.map +1 -0
- package/dist/utils/testing/message_history.d.cts.map +1 -0
- package/dist/utils/testing/message_history.d.ts.map +1 -0
- package/dist/utils/testing/output_parsers.d.cts.map +1 -0
- package/dist/utils/testing/output_parsers.d.ts.map +1 -0
- package/dist/utils/testing/retrievers.d.cts.map +1 -0
- package/dist/utils/testing/retrievers.d.ts.map +1 -0
- package/dist/utils/testing/runnables.d.cts.map +1 -0
- package/dist/utils/testing/runnables.d.ts.map +1 -0
- package/dist/utils/testing/tools.d.cts.map +1 -0
- package/dist/utils/testing/tools.d.ts.map +1 -0
- package/dist/utils/testing/tracers.d.cts.map +1 -0
- package/dist/utils/testing/tracers.d.ts.map +1 -0
- package/dist/utils/testing/vectorstores.d.cts.map +1 -0
- package/dist/utils/testing/vectorstores.d.ts.map +1 -0
- package/dist/utils/tiktoken.d.cts.map +1 -0
- package/dist/utils/tiktoken.d.ts.map +1 -0
- package/dist/utils/types/index.d.cts.map +1 -0
- package/dist/utils/types/index.d.ts.map +1 -0
- package/dist/utils/types/zod.d.cts.map +1 -0
- package/dist/utils/types/zod.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/errorMessages.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/errorMessages.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parseTypes.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parseTypes.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/any.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/any.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/array.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/array.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/bigint.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/bigint.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/boolean.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/boolean.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/date.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/date.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/enum.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/enum.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/intersection.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/intersection.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/literal.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/literal.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/map.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/map.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/never.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/never.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/null.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/null.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/nullable.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/nullable.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/number.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/number.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/object.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/object.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/record.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/record.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/set.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/set.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/string.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/string.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/tuple.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/tuple.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/undefined.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/undefined.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/union.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/union.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/unknown.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/unknown.d.ts.map +1 -0
- package/dist/vectorstores.d.cts.map +1 -0
- package/dist/vectorstores.d.ts.map +1 -0
- package/package.json +10 -10
- package/agents.cjs +0 -1
- package/agents.d.cts +0 -1
- package/agents.d.ts +0 -1
- package/agents.js +0 -1
- package/caches.cjs +0 -1
- package/caches.d.cts +0 -1
- package/caches.d.ts +0 -1
- package/caches.js +0 -1
- package/callbacks/base.cjs +0 -1
- package/callbacks/base.d.cts +0 -1
- package/callbacks/base.d.ts +0 -1
- package/callbacks/base.js +0 -1
- package/callbacks/dispatch/web.cjs +0 -1
- package/callbacks/dispatch/web.d.cts +0 -1
- package/callbacks/dispatch/web.d.ts +0 -1
- package/callbacks/dispatch/web.js +0 -1
- package/callbacks/dispatch.cjs +0 -1
- package/callbacks/dispatch.d.cts +0 -1
- package/callbacks/dispatch.d.ts +0 -1
- package/callbacks/dispatch.js +0 -1
- package/callbacks/manager.cjs +0 -1
- package/callbacks/manager.d.cts +0 -1
- package/callbacks/manager.d.ts +0 -1
- package/callbacks/manager.js +0 -1
- package/callbacks/promises.cjs +0 -1
- package/callbacks/promises.d.cts +0 -1
- package/callbacks/promises.d.ts +0 -1
- package/callbacks/promises.js +0 -1
- package/chat_history.cjs +0 -1
- package/chat_history.d.cts +0 -1
- package/chat_history.d.ts +0 -1
- package/chat_history.js +0 -1
- package/context.cjs +0 -1
- package/context.d.cts +0 -1
- package/context.d.ts +0 -1
- package/context.js +0 -1
- package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.cjs +0 -169
- package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.cjs.map +0 -1
- package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.js +0 -168
- package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.js.map +0 -1
- package/dist/node_modules/.pnpm/camelcase@9.0.0/node_modules/camelcase/index.cjs +0 -122
- package/dist/node_modules/.pnpm/camelcase@9.0.0/node_modules/camelcase/index.cjs.map +0 -1
- package/dist/node_modules/.pnpm/camelcase@9.0.0/node_modules/camelcase/index.js +0 -121
- package/dist/node_modules/.pnpm/camelcase@9.0.0/node_modules/camelcase/index.js.map +0 -1
- package/dist/node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.cjs +0 -18
- package/dist/node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.cjs.map +0 -1
- package/dist/node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.js +0 -17
- package/dist/node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.js.map +0 -1
- package/dist/node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.cjs.map +0 -1
- package/dist/node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.js.map +0 -1
- package/dist/node_modules/.pnpm/p-retry@7.1.0/node_modules/p-retry/index.cjs.map +0 -1
- package/dist/node_modules/.pnpm/p-retry@7.1.0/node_modules/p-retry/index.js.map +0 -1
- package/document_loaders/base.cjs +0 -1
- package/document_loaders/base.d.cts +0 -1
- package/document_loaders/base.d.ts +0 -1
- package/document_loaders/base.js +0 -1
- package/document_loaders/langsmith.cjs +0 -1
- package/document_loaders/langsmith.d.cts +0 -1
- package/document_loaders/langsmith.d.ts +0 -1
- package/document_loaders/langsmith.js +0 -1
- package/documents.cjs +0 -1
- package/documents.d.cts +0 -1
- package/documents.d.ts +0 -1
- package/documents.js +0 -1
- package/embeddings.cjs +0 -1
- package/embeddings.d.cts +0 -1
- package/embeddings.d.ts +0 -1
- package/embeddings.js +0 -1
- package/example_selectors.cjs +0 -1
- package/example_selectors.d.cts +0 -1
- package/example_selectors.d.ts +0 -1
- package/example_selectors.js +0 -1
- package/indexing.cjs +0 -1
- package/indexing.d.cts +0 -1
- package/indexing.d.ts +0 -1
- package/indexing.js +0 -1
- package/language_models/base.cjs +0 -1
- package/language_models/base.d.cts +0 -1
- package/language_models/base.d.ts +0 -1
- package/language_models/base.js +0 -1
- package/language_models/chat_models.cjs +0 -1
- package/language_models/chat_models.d.cts +0 -1
- package/language_models/chat_models.d.ts +0 -1
- package/language_models/chat_models.js +0 -1
- package/language_models/llms.cjs +0 -1
- package/language_models/llms.d.cts +0 -1
- package/language_models/llms.d.ts +0 -1
- package/language_models/llms.js +0 -1
- package/language_models/profile.cjs +0 -1
- package/language_models/profile.d.cts +0 -1
- package/language_models/profile.d.ts +0 -1
- package/language_models/profile.js +0 -1
- package/load/serializable.cjs +0 -1
- package/load/serializable.d.cts +0 -1
- package/load/serializable.d.ts +0 -1
- package/load/serializable.js +0 -1
- package/load.cjs +0 -1
- package/load.d.cts +0 -1
- package/load.d.ts +0 -1
- package/load.js +0 -1
- package/memory.cjs +0 -1
- package/memory.d.cts +0 -1
- package/memory.d.ts +0 -1
- package/memory.js +0 -1
- package/messages/tool.cjs +0 -1
- package/messages/tool.d.cts +0 -1
- package/messages/tool.d.ts +0 -1
- package/messages/tool.js +0 -1
- package/messages.cjs +0 -1
- package/messages.d.cts +0 -1
- package/messages.d.ts +0 -1
- package/messages.js +0 -1
- package/output_parsers/openai_functions.cjs +0 -1
- package/output_parsers/openai_functions.d.cts +0 -1
- package/output_parsers/openai_functions.d.ts +0 -1
- package/output_parsers/openai_functions.js +0 -1
- package/output_parsers/openai_tools.cjs +0 -1
- package/output_parsers/openai_tools.d.cts +0 -1
- package/output_parsers/openai_tools.d.ts +0 -1
- package/output_parsers/openai_tools.js +0 -1
- package/output_parsers.cjs +0 -1
- package/output_parsers.d.cts +0 -1
- package/output_parsers.d.ts +0 -1
- package/output_parsers.js +0 -1
- package/outputs.cjs +0 -1
- package/outputs.d.cts +0 -1
- package/outputs.d.ts +0 -1
- package/outputs.js +0 -1
- package/prompt_values.cjs +0 -1
- package/prompt_values.d.cts +0 -1
- package/prompt_values.d.ts +0 -1
- package/prompt_values.js +0 -1
- package/prompts.cjs +0 -1
- package/prompts.d.cts +0 -1
- package/prompts.d.ts +0 -1
- package/prompts.js +0 -1
- package/retrievers/document_compressors.cjs +0 -1
- package/retrievers/document_compressors.d.cts +0 -1
- package/retrievers/document_compressors.d.ts +0 -1
- package/retrievers/document_compressors.js +0 -1
- package/retrievers.cjs +0 -1
- package/retrievers.d.cts +0 -1
- package/retrievers.d.ts +0 -1
- package/retrievers.js +0 -1
- package/runnables/graph.cjs +0 -1
- package/runnables/graph.d.cts +0 -1
- package/runnables/graph.d.ts +0 -1
- package/runnables/graph.js +0 -1
- package/runnables.cjs +0 -1
- package/runnables.d.cts +0 -1
- package/runnables.d.ts +0 -1
- package/runnables.js +0 -1
- package/singletons.cjs +0 -1
- package/singletons.d.cts +0 -1
- package/singletons.d.ts +0 -1
- package/singletons.js +0 -1
- package/stores.cjs +0 -1
- package/stores.d.cts +0 -1
- package/stores.d.ts +0 -1
- package/stores.js +0 -1
- package/structured_query.cjs +0 -1
- package/structured_query.d.cts +0 -1
- package/structured_query.d.ts +0 -1
- package/structured_query.js +0 -1
- package/tools.cjs +0 -1
- package/tools.d.cts +0 -1
- package/tools.d.ts +0 -1
- package/tools.js +0 -1
- package/tracers/base.cjs +0 -1
- package/tracers/base.d.cts +0 -1
- package/tracers/base.d.ts +0 -1
- package/tracers/base.js +0 -1
- package/tracers/console.cjs +0 -1
- package/tracers/console.d.cts +0 -1
- package/tracers/console.d.ts +0 -1
- package/tracers/console.js +0 -1
- package/tracers/log_stream.cjs +0 -1
- package/tracers/log_stream.d.cts +0 -1
- package/tracers/log_stream.d.ts +0 -1
- package/tracers/log_stream.js +0 -1
- package/tracers/run_collector.cjs +0 -1
- package/tracers/run_collector.d.cts +0 -1
- package/tracers/run_collector.d.ts +0 -1
- package/tracers/run_collector.js +0 -1
- package/tracers/tracer_langchain.cjs +0 -1
- package/tracers/tracer_langchain.d.cts +0 -1
- package/tracers/tracer_langchain.d.ts +0 -1
- package/tracers/tracer_langchain.js +0 -1
- package/types/stream.cjs +0 -1
- package/types/stream.d.cts +0 -1
- package/types/stream.d.ts +0 -1
- package/types/stream.js +0 -1
- package/utils/async_caller.cjs +0 -1
- package/utils/async_caller.d.cts +0 -1
- package/utils/async_caller.d.ts +0 -1
- package/utils/async_caller.js +0 -1
- package/utils/chunk_array.cjs +0 -1
- package/utils/chunk_array.d.cts +0 -1
- package/utils/chunk_array.d.ts +0 -1
- package/utils/chunk_array.js +0 -1
- package/utils/env.cjs +0 -1
- package/utils/env.d.cts +0 -1
- package/utils/env.d.ts +0 -1
- package/utils/env.js +0 -1
- package/utils/event_source_parse.cjs +0 -1
- package/utils/event_source_parse.d.cts +0 -1
- package/utils/event_source_parse.d.ts +0 -1
- package/utils/event_source_parse.js +0 -1
- package/utils/format.cjs +0 -1
- package/utils/format.d.cts +0 -1
- package/utils/format.d.ts +0 -1
- package/utils/format.js +0 -1
- package/utils/function_calling.cjs +0 -1
- package/utils/function_calling.d.cts +0 -1
- package/utils/function_calling.d.ts +0 -1
- package/utils/function_calling.js +0 -1
- package/utils/hash.cjs +0 -1
- package/utils/hash.d.cts +0 -1
- package/utils/hash.d.ts +0 -1
- package/utils/hash.js +0 -1
- package/utils/json_patch.cjs +0 -1
- package/utils/json_patch.d.cts +0 -1
- package/utils/json_patch.d.ts +0 -1
- package/utils/json_patch.js +0 -1
- package/utils/json_schema.cjs +0 -1
- package/utils/json_schema.d.cts +0 -1
- package/utils/json_schema.d.ts +0 -1
- package/utils/json_schema.js +0 -1
- package/utils/math.cjs +0 -1
- package/utils/math.d.cts +0 -1
- package/utils/math.d.ts +0 -1
- package/utils/math.js +0 -1
- package/utils/stream.cjs +0 -1
- package/utils/stream.d.cts +0 -1
- package/utils/stream.d.ts +0 -1
- package/utils/stream.js +0 -1
- package/utils/testing.cjs +0 -1
- package/utils/testing.d.cts +0 -1
- package/utils/testing.d.ts +0 -1
- package/utils/testing.js +0 -1
- package/utils/tiktoken.cjs +0 -1
- package/utils/tiktoken.d.cts +0 -1
- package/utils/tiktoken.d.ts +0 -1
- package/utils/tiktoken.js +0 -1
- package/utils/types.cjs +0 -1
- package/utils/types.d.cts +0 -1
- package/utils/types.d.ts +0 -1
- package/utils/types.js +0 -1
- package/vectorstores.cjs +0 -1
- package/vectorstores.d.cts +0 -1
- package/vectorstores.d.ts +0 -1
- package/vectorstores.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console.js","names":["style: CSPair","text: string","obj: unknown","fallback: string","value: unknown","run: Run","elapsed","styles","_run: Run","parents: Run[]"],"sources":["../../src/tracers/console.ts"],"sourcesContent":["import type { CSPair } from \"ansi-styles\";\nimport styles from \"ansi-styles\";\nimport { BaseTracer, type AgentRun, type Run } from \"./base.js\";\n\nfunction wrap(style: CSPair, text: string) {\n return `${style.open}${text}${style.close}`;\n}\n\nfunction tryJsonStringify(obj: unknown, fallback: string) {\n try {\n return JSON.stringify(obj, null, 2);\n } catch {\n return fallback;\n }\n}\n\nfunction formatKVMapItem(value: unknown) {\n if (typeof value === \"string\") {\n return value.trim();\n }\n\n if (value === null || value === undefined) {\n return value;\n }\n\n return tryJsonStringify(value, value.toString());\n}\n\nfunction elapsed(run: Run): string {\n if (!run.end_time) return \"\";\n const elapsed = run.end_time - run.start_time;\n if (elapsed < 1000) {\n return `${elapsed}ms`;\n }\n return `${(elapsed / 1000).toFixed(2)}s`;\n}\n\nconst { color } = styles;\n\n/**\n * A tracer that logs all events to the console. It extends from the\n * `BaseTracer` class and overrides its methods to provide custom logging\n * functionality.\n * @example\n * ```typescript\n *\n * const llm = new ChatAnthropic({\n * temperature: 0,\n * tags: [\"example\", \"callbacks\", \"constructor\"],\n * callbacks: [new ConsoleCallbackHandler()],\n * });\n *\n * ```\n */\nexport class ConsoleCallbackHandler extends BaseTracer {\n name = \"console_callback_handler\" as const;\n\n /**\n * Method used to persist the run. In this case, it simply returns a\n * resolved promise as there's no persistence logic.\n * @param _run The run to persist.\n * @returns A resolved promise.\n */\n protected persistRun(_run: Run) {\n return Promise.resolve();\n }\n\n // utility methods\n\n /**\n * Method used to get all the parent runs of a given run.\n * @param run The run whose parents are to be retrieved.\n * @returns An array of parent runs.\n */\n getParents(run: Run) {\n const parents: Run[] = [];\n let currentRun = run;\n while (currentRun.parent_run_id) {\n const parent = this.runMap.get(currentRun.parent_run_id);\n if (parent) {\n parents.push(parent);\n currentRun = parent;\n } else {\n break;\n }\n }\n return parents;\n }\n\n /**\n * Method used to get a string representation of the run's lineage, which\n * is used in logging.\n * @param run The run whose lineage is to be retrieved.\n * @returns A string representation of the run's lineage.\n */\n getBreadcrumbs(run: Run) {\n const parents = this.getParents(run).reverse();\n const string = [...parents, run]\n .map((parent, i, arr) => {\n const name = `${parent.execution_order}:${parent.run_type}:${parent.name}`;\n return i === arr.length - 1 ? wrap(styles.bold, name) : name;\n })\n .join(\" > \");\n return wrap(color.grey, string);\n }\n\n // logging methods\n\n /**\n * Method used to log the start of a chain run.\n * @param run The chain run that has started.\n * @returns void\n */\n onChainStart(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(\n color.green,\n \"[chain/start]\"\n )} [${crumbs}] Entering Chain run with input: ${tryJsonStringify(\n run.inputs,\n \"[inputs]\"\n )}`\n );\n }\n\n /**\n * Method used to log the end of a chain run.\n * @param run The chain run that has ended.\n * @returns void\n */\n onChainEnd(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(color.cyan, \"[chain/end]\")} [${crumbs}] [${elapsed(\n run\n )}] Exiting Chain run with output: ${tryJsonStringify(\n run.outputs,\n \"[outputs]\"\n )}`\n );\n }\n\n /**\n * Method used to log any errors of a chain run.\n * @param run The chain run that has errored.\n * @returns void\n */\n onChainError(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(color.red, \"[chain/error]\")} [${crumbs}] [${elapsed(\n run\n )}] Chain run errored with error: ${tryJsonStringify(\n run.error,\n \"[error]\"\n )}`\n );\n }\n\n /**\n * Method used to log the start of an LLM run.\n * @param run The LLM run that has started.\n * @returns void\n */\n onLLMStart(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n const inputs =\n \"prompts\" in run.inputs\n ? { prompts: (run.inputs.prompts as string[]).map((p) => p.trim()) }\n : run.inputs;\n console.log(\n `${wrap(\n color.green,\n \"[llm/start]\"\n )} [${crumbs}] Entering LLM run with input: ${tryJsonStringify(\n inputs,\n \"[inputs]\"\n )}`\n );\n }\n\n /**\n * Method used to log the end of an LLM run.\n * @param run The LLM run that has ended.\n * @returns void\n */\n onLLMEnd(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(color.cyan, \"[llm/end]\")} [${crumbs}] [${elapsed(\n run\n )}] Exiting LLM run with output: ${tryJsonStringify(\n run.outputs,\n \"[response]\"\n )}`\n );\n }\n\n /**\n * Method used to log any errors of an LLM run.\n * @param run The LLM run that has errored.\n * @returns void\n */\n onLLMError(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(color.red, \"[llm/error]\")} [${crumbs}] [${elapsed(\n run\n )}] LLM run errored with error: ${tryJsonStringify(run.error, \"[error]\")}`\n );\n }\n\n /**\n * Method used to log the start of a tool run.\n * @param run The tool run that has started.\n * @returns void\n */\n onToolStart(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(\n color.green,\n \"[tool/start]\"\n )} [${crumbs}] Entering Tool run with input: \"${formatKVMapItem(\n run.inputs.input\n )}\"`\n );\n }\n\n /**\n * Method used to log the end of a tool run.\n * @param run The tool run that has ended.\n * @returns void\n */\n onToolEnd(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n\n console.log(\n `${wrap(color.cyan, \"[tool/end]\")} [${crumbs}] [${elapsed(\n run\n )}] Exiting Tool run with output: \"${formatKVMapItem(\n run.outputs?.output\n )}\"`\n );\n }\n\n /**\n * Method used to log any errors of a tool run.\n * @param run The tool run that has errored.\n * @returns void\n */\n onToolError(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(color.red, \"[tool/error]\")} [${crumbs}] [${elapsed(\n run\n )}] Tool run errored with error: ${tryJsonStringify(\n run.error,\n \"[error]\"\n )}`\n );\n }\n\n /**\n * Method used to log the start of a retriever run.\n * @param run The retriever run that has started.\n * @returns void\n */\n onRetrieverStart(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(\n color.green,\n \"[retriever/start]\"\n )} [${crumbs}] Entering Retriever run with input: ${tryJsonStringify(\n run.inputs,\n \"[inputs]\"\n )}`\n );\n }\n\n /**\n * Method used to log the end of a retriever run.\n * @param run The retriever run that has ended.\n * @returns void\n */\n onRetrieverEnd(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(color.cyan, \"[retriever/end]\")} [${crumbs}] [${elapsed(\n run\n )}] Exiting Retriever run with output: ${tryJsonStringify(\n run.outputs,\n \"[outputs]\"\n )}`\n );\n }\n\n /**\n * Method used to log any errors of a retriever run.\n * @param run The retriever run that has errored.\n * @returns void\n */\n onRetrieverError(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(color.red, \"[retriever/error]\")} [${crumbs}] [${elapsed(\n run\n )}] Retriever run errored with error: ${tryJsonStringify(\n run.error,\n \"[error]\"\n )}`\n );\n }\n\n /**\n * Method used to log the action selected by the agent.\n * @param run The run in which the agent action occurred.\n * @returns void\n */\n onAgentAction(run: Run) {\n const agentRun = run as AgentRun;\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(\n color.blue,\n \"[agent/action]\"\n )} [${crumbs}] Agent selected action: ${tryJsonStringify(\n agentRun.actions[agentRun.actions.length - 1],\n \"[action]\"\n )}`\n );\n }\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"console.js","names":["style: CSPair","text: string","obj: unknown","fallback: string","value: unknown","run: Run","elapsed","_run: Run","parents: Run[]"],"sources":["../../src/tracers/console.ts"],"sourcesContent":["import type { CSPair } from \"ansi-styles\";\nimport styles from \"ansi-styles\";\nimport { BaseTracer, type AgentRun, type Run } from \"./base.js\";\n\nfunction wrap(style: CSPair, text: string) {\n return `${style.open}${text}${style.close}`;\n}\n\nfunction tryJsonStringify(obj: unknown, fallback: string) {\n try {\n return JSON.stringify(obj, null, 2);\n } catch {\n return fallback;\n }\n}\n\nfunction formatKVMapItem(value: unknown) {\n if (typeof value === \"string\") {\n return value.trim();\n }\n\n if (value === null || value === undefined) {\n return value;\n }\n\n return tryJsonStringify(value, value.toString());\n}\n\nfunction elapsed(run: Run): string {\n if (!run.end_time) return \"\";\n const elapsed = run.end_time - run.start_time;\n if (elapsed < 1000) {\n return `${elapsed}ms`;\n }\n return `${(elapsed / 1000).toFixed(2)}s`;\n}\n\nconst { color } = styles;\n\n/**\n * A tracer that logs all events to the console. It extends from the\n * `BaseTracer` class and overrides its methods to provide custom logging\n * functionality.\n * @example\n * ```typescript\n *\n * const llm = new ChatAnthropic({\n * temperature: 0,\n * tags: [\"example\", \"callbacks\", \"constructor\"],\n * callbacks: [new ConsoleCallbackHandler()],\n * });\n *\n * ```\n */\nexport class ConsoleCallbackHandler extends BaseTracer {\n name = \"console_callback_handler\" as const;\n\n /**\n * Method used to persist the run. In this case, it simply returns a\n * resolved promise as there's no persistence logic.\n * @param _run The run to persist.\n * @returns A resolved promise.\n */\n protected persistRun(_run: Run) {\n return Promise.resolve();\n }\n\n // utility methods\n\n /**\n * Method used to get all the parent runs of a given run.\n * @param run The run whose parents are to be retrieved.\n * @returns An array of parent runs.\n */\n getParents(run: Run) {\n const parents: Run[] = [];\n let currentRun = run;\n while (currentRun.parent_run_id) {\n const parent = this.runMap.get(currentRun.parent_run_id);\n if (parent) {\n parents.push(parent);\n currentRun = parent;\n } else {\n break;\n }\n }\n return parents;\n }\n\n /**\n * Method used to get a string representation of the run's lineage, which\n * is used in logging.\n * @param run The run whose lineage is to be retrieved.\n * @returns A string representation of the run's lineage.\n */\n getBreadcrumbs(run: Run) {\n const parents = this.getParents(run).reverse();\n const string = [...parents, run]\n .map((parent, i, arr) => {\n const name = `${parent.execution_order}:${parent.run_type}:${parent.name}`;\n return i === arr.length - 1 ? wrap(styles.bold, name) : name;\n })\n .join(\" > \");\n return wrap(color.grey, string);\n }\n\n // logging methods\n\n /**\n * Method used to log the start of a chain run.\n * @param run The chain run that has started.\n * @returns void\n */\n onChainStart(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(\n color.green,\n \"[chain/start]\"\n )} [${crumbs}] Entering Chain run with input: ${tryJsonStringify(\n run.inputs,\n \"[inputs]\"\n )}`\n );\n }\n\n /**\n * Method used to log the end of a chain run.\n * @param run The chain run that has ended.\n * @returns void\n */\n onChainEnd(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(color.cyan, \"[chain/end]\")} [${crumbs}] [${elapsed(\n run\n )}] Exiting Chain run with output: ${tryJsonStringify(\n run.outputs,\n \"[outputs]\"\n )}`\n );\n }\n\n /**\n * Method used to log any errors of a chain run.\n * @param run The chain run that has errored.\n * @returns void\n */\n onChainError(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(color.red, \"[chain/error]\")} [${crumbs}] [${elapsed(\n run\n )}] Chain run errored with error: ${tryJsonStringify(\n run.error,\n \"[error]\"\n )}`\n );\n }\n\n /**\n * Method used to log the start of an LLM run.\n * @param run The LLM run that has started.\n * @returns void\n */\n onLLMStart(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n const inputs =\n \"prompts\" in run.inputs\n ? { prompts: (run.inputs.prompts as string[]).map((p) => p.trim()) }\n : run.inputs;\n console.log(\n `${wrap(\n color.green,\n \"[llm/start]\"\n )} [${crumbs}] Entering LLM run with input: ${tryJsonStringify(\n inputs,\n \"[inputs]\"\n )}`\n );\n }\n\n /**\n * Method used to log the end of an LLM run.\n * @param run The LLM run that has ended.\n * @returns void\n */\n onLLMEnd(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(color.cyan, \"[llm/end]\")} [${crumbs}] [${elapsed(\n run\n )}] Exiting LLM run with output: ${tryJsonStringify(\n run.outputs,\n \"[response]\"\n )}`\n );\n }\n\n /**\n * Method used to log any errors of an LLM run.\n * @param run The LLM run that has errored.\n * @returns void\n */\n onLLMError(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(color.red, \"[llm/error]\")} [${crumbs}] [${elapsed(\n run\n )}] LLM run errored with error: ${tryJsonStringify(run.error, \"[error]\")}`\n );\n }\n\n /**\n * Method used to log the start of a tool run.\n * @param run The tool run that has started.\n * @returns void\n */\n onToolStart(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(\n color.green,\n \"[tool/start]\"\n )} [${crumbs}] Entering Tool run with input: \"${formatKVMapItem(\n run.inputs.input\n )}\"`\n );\n }\n\n /**\n * Method used to log the end of a tool run.\n * @param run The tool run that has ended.\n * @returns void\n */\n onToolEnd(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n\n console.log(\n `${wrap(color.cyan, \"[tool/end]\")} [${crumbs}] [${elapsed(\n run\n )}] Exiting Tool run with output: \"${formatKVMapItem(\n run.outputs?.output\n )}\"`\n );\n }\n\n /**\n * Method used to log any errors of a tool run.\n * @param run The tool run that has errored.\n * @returns void\n */\n onToolError(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(color.red, \"[tool/error]\")} [${crumbs}] [${elapsed(\n run\n )}] Tool run errored with error: ${tryJsonStringify(\n run.error,\n \"[error]\"\n )}`\n );\n }\n\n /**\n * Method used to log the start of a retriever run.\n * @param run The retriever run that has started.\n * @returns void\n */\n onRetrieverStart(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(\n color.green,\n \"[retriever/start]\"\n )} [${crumbs}] Entering Retriever run with input: ${tryJsonStringify(\n run.inputs,\n \"[inputs]\"\n )}`\n );\n }\n\n /**\n * Method used to log the end of a retriever run.\n * @param run The retriever run that has ended.\n * @returns void\n */\n onRetrieverEnd(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(color.cyan, \"[retriever/end]\")} [${crumbs}] [${elapsed(\n run\n )}] Exiting Retriever run with output: ${tryJsonStringify(\n run.outputs,\n \"[outputs]\"\n )}`\n );\n }\n\n /**\n * Method used to log any errors of a retriever run.\n * @param run The retriever run that has errored.\n * @returns void\n */\n onRetrieverError(run: Run) {\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(color.red, \"[retriever/error]\")} [${crumbs}] [${elapsed(\n run\n )}] Retriever run errored with error: ${tryJsonStringify(\n run.error,\n \"[error]\"\n )}`\n );\n }\n\n /**\n * Method used to log the action selected by the agent.\n * @param run The run in which the agent action occurred.\n * @returns void\n */\n onAgentAction(run: Run) {\n const agentRun = run as AgentRun;\n const crumbs = this.getBreadcrumbs(run);\n console.log(\n `${wrap(\n color.blue,\n \"[agent/action]\"\n )} [${crumbs}] Agent selected action: ${tryJsonStringify(\n agentRun.actions[agentRun.actions.length - 1],\n \"[action]\"\n )}`\n );\n }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event_stream.d.cts","names":["BaseTracer","Run","BaseCallbackHandler","BaseCallbackHandlerInput","CallbackHandlerPrefersStreaming","IterableReadableStream","StreamEventData","StreamEvent","Record","RunInfo","EventStreamCallbackHandlerInput","isStreamEventsHandler","EventStreamCallbackHandler","T","TransformStream","WritableStreamDefaultWriter","Symbol","asyncIterator","Promise","AsyncGenerator"],"sources":["../../src/tracers/event_stream.d.ts"],"sourcesContent":["import { BaseTracer, type Run } from \"./base.js\";\nimport { BaseCallbackHandler, BaseCallbackHandlerInput, CallbackHandlerPrefersStreaming } from \"../callbacks/base.js\";\nimport { IterableReadableStream } from \"../utils/stream.js\";\n/**\n * Data associated with a StreamEvent.\n */\nexport type StreamEventData = {\n /**\n * The input passed to the runnable that generated the event.\n * Inputs will sometimes be available at the *START* of the runnable, and\n * sometimes at the *END* of the runnable.\n * If a runnable is able to stream its inputs, then its input by definition\n * won't be known until the *END* of the runnable when it has finished streaming\n * its inputs.\n */\n input?: any;\n /**\n * The output of the runnable that generated the event.\n * Outputs will only be available at the *END* of the runnable.\n * For most runnables, this field can be inferred from the `chunk` field,\n * though there might be some exceptions for special cased runnables (e.g., like\n * chat models), which may return more information.\n */\n output?: any;\n /**\n * A streaming chunk from the output that generated the event.\n * chunks support addition in general, and adding them up should result\n * in the output of the runnable that generated the event.\n */\n chunk?: any;\n};\n/**\n * A streaming event.\n *\n * Schema of a streaming event which is produced from the streamEvents method.\n */\nexport type StreamEvent = {\n /**\n * Event names are of the format: on_[runnable_type]_(start|stream|end).\n *\n * Runnable types are one of:\n * - llm - used by non chat models\n * - chat_model - used by chat models\n * - prompt -- e.g., ChatPromptTemplate\n * - tool -- LangChain tools\n * - chain - most Runnables are of this type\n *\n * Further, the events are categorized as one of:\n * - start - when the runnable starts\n * - stream - when the runnable is streaming\n * - end - when the runnable ends\n *\n * start, stream and end are associated with slightly different `data` payload.\n *\n * Please see the documentation for `EventData` for more details.\n */\n event: string;\n /** The name of the runnable that generated the event. */\n name: string;\n /**\n * An randomly generated ID to keep track of the execution of the given runnable.\n *\n * Each child runnable that gets invoked as part of the execution of a parent runnable\n * is assigned its own unique ID.\n */\n run_id: string;\n /**\n * Tags associated with the runnable that generated this event.\n * Tags are always inherited from parent runnables.\n */\n tags?: string[];\n /** Metadata associated with the runnable that generated this event. */\n metadata: Record<string, any>;\n /**\n * Event data.\n *\n * The contents of the event data depend on the event type.\n */\n data: StreamEventData;\n};\ntype RunInfo = {\n name: string;\n tags: string[];\n metadata: Record<string, any>;\n runType: string;\n inputs?: Record<string, any>;\n};\nexport interface EventStreamCallbackHandlerInput extends BaseCallbackHandlerInput {\n autoClose?: boolean;\n includeNames?: string[];\n includeTypes?: string[];\n includeTags?: string[];\n excludeNames?: string[];\n excludeTypes?: string[];\n excludeTags?: string[];\n}\nexport declare const isStreamEventsHandler: (handler: BaseCallbackHandler) => handler is EventStreamCallbackHandler;\n/**\n * Class that extends the `BaseTracer` class from the\n * `langchain.callbacks.tracers.base` module. It represents a callback\n * handler that logs the execution of runs and emits `RunLog` instances to a\n * `RunLogStream`.\n */\nexport declare class EventStreamCallbackHandler extends BaseTracer implements CallbackHandlerPrefersStreaming {\n protected autoClose: boolean;\n protected includeNames?: string[];\n protected includeTypes?: string[];\n protected includeTags?: string[];\n protected excludeNames?: string[];\n protected excludeTypes?: string[];\n protected excludeTags?: string[];\n private runInfoMap;\n private tappedPromises;\n protected transformStream: TransformStream;\n writer: WritableStreamDefaultWriter;\n receiveStream: IterableReadableStream<StreamEvent>;\n name: string;\n lc_prefer_streaming: boolean;\n constructor(fields?: EventStreamCallbackHandlerInput);\n [Symbol.asyncIterator](): IterableReadableStream<StreamEvent>;\n protected persistRun(_run: Run): Promise<void>;\n _includeRun(run: RunInfo): boolean;\n tapOutputIterable<T>(runId: string, outputStream: AsyncGenerator<T>): AsyncGenerator<T>;\n send(payload: StreamEvent, run: RunInfo): Promise<void>;\n sendEndEvent(payload: StreamEvent, run: RunInfo): Promise<void>;\n onLLMStart(run: Run): Promise<void>;\n onLLMNewToken(run: Run, token: string, kwargs?: {\n chunk: any;\n }): Promise<void>;\n onLLMEnd(run: Run): Promise<void>;\n onChainStart(run: Run): Promise<void>;\n onChainEnd(run: Run): Promise<void>;\n onToolStart(run: Run): Promise<void>;\n onToolEnd(run: Run): Promise<void>;\n onRetrieverStart(run: Run): Promise<void>;\n onRetrieverEnd(run: Run): Promise<void>;\n handleCustomEvent(eventName: string, data: any, runId: string): Promise<void>;\n finish(): Promise<void>;\n}\nexport {};\n//# sourceMappingURL=event_stream.d.ts.map"],"mappings":";;;;AAMA;AA8BA;AAmDA;KAjFYM,eAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BAC,WAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAoCEC;;;;;;QAMJF;;UASOI,+BAAAA,SAAwCP"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event_stream.d.ts","names":["BaseTracer","Run","BaseCallbackHandler","BaseCallbackHandlerInput","CallbackHandlerPrefersStreaming","IterableReadableStream","StreamEventData","StreamEvent","Record","RunInfo","EventStreamCallbackHandlerInput","isStreamEventsHandler","EventStreamCallbackHandler","T","TransformStream","WritableStreamDefaultWriter","Symbol","asyncIterator","Promise","AsyncGenerator"],"sources":["../../src/tracers/event_stream.d.ts"],"sourcesContent":["import { BaseTracer, type Run } from \"./base.js\";\nimport { BaseCallbackHandler, BaseCallbackHandlerInput, CallbackHandlerPrefersStreaming } from \"../callbacks/base.js\";\nimport { IterableReadableStream } from \"../utils/stream.js\";\n/**\n * Data associated with a StreamEvent.\n */\nexport type StreamEventData = {\n /**\n * The input passed to the runnable that generated the event.\n * Inputs will sometimes be available at the *START* of the runnable, and\n * sometimes at the *END* of the runnable.\n * If a runnable is able to stream its inputs, then its input by definition\n * won't be known until the *END* of the runnable when it has finished streaming\n * its inputs.\n */\n input?: any;\n /**\n * The output of the runnable that generated the event.\n * Outputs will only be available at the *END* of the runnable.\n * For most runnables, this field can be inferred from the `chunk` field,\n * though there might be some exceptions for special cased runnables (e.g., like\n * chat models), which may return more information.\n */\n output?: any;\n /**\n * A streaming chunk from the output that generated the event.\n * chunks support addition in general, and adding them up should result\n * in the output of the runnable that generated the event.\n */\n chunk?: any;\n};\n/**\n * A streaming event.\n *\n * Schema of a streaming event which is produced from the streamEvents method.\n */\nexport type StreamEvent = {\n /**\n * Event names are of the format: on_[runnable_type]_(start|stream|end).\n *\n * Runnable types are one of:\n * - llm - used by non chat models\n * - chat_model - used by chat models\n * - prompt -- e.g., ChatPromptTemplate\n * - tool -- LangChain tools\n * - chain - most Runnables are of this type\n *\n * Further, the events are categorized as one of:\n * - start - when the runnable starts\n * - stream - when the runnable is streaming\n * - end - when the runnable ends\n *\n * start, stream and end are associated with slightly different `data` payload.\n *\n * Please see the documentation for `EventData` for more details.\n */\n event: string;\n /** The name of the runnable that generated the event. */\n name: string;\n /**\n * An randomly generated ID to keep track of the execution of the given runnable.\n *\n * Each child runnable that gets invoked as part of the execution of a parent runnable\n * is assigned its own unique ID.\n */\n run_id: string;\n /**\n * Tags associated with the runnable that generated this event.\n * Tags are always inherited from parent runnables.\n */\n tags?: string[];\n /** Metadata associated with the runnable that generated this event. */\n metadata: Record<string, any>;\n /**\n * Event data.\n *\n * The contents of the event data depend on the event type.\n */\n data: StreamEventData;\n};\ntype RunInfo = {\n name: string;\n tags: string[];\n metadata: Record<string, any>;\n runType: string;\n inputs?: Record<string, any>;\n};\nexport interface EventStreamCallbackHandlerInput extends BaseCallbackHandlerInput {\n autoClose?: boolean;\n includeNames?: string[];\n includeTypes?: string[];\n includeTags?: string[];\n excludeNames?: string[];\n excludeTypes?: string[];\n excludeTags?: string[];\n}\nexport declare const isStreamEventsHandler: (handler: BaseCallbackHandler) => handler is EventStreamCallbackHandler;\n/**\n * Class that extends the `BaseTracer` class from the\n * `langchain.callbacks.tracers.base` module. It represents a callback\n * handler that logs the execution of runs and emits `RunLog` instances to a\n * `RunLogStream`.\n */\nexport declare class EventStreamCallbackHandler extends BaseTracer implements CallbackHandlerPrefersStreaming {\n protected autoClose: boolean;\n protected includeNames?: string[];\n protected includeTypes?: string[];\n protected includeTags?: string[];\n protected excludeNames?: string[];\n protected excludeTypes?: string[];\n protected excludeTags?: string[];\n private runInfoMap;\n private tappedPromises;\n protected transformStream: TransformStream;\n writer: WritableStreamDefaultWriter;\n receiveStream: IterableReadableStream<StreamEvent>;\n name: string;\n lc_prefer_streaming: boolean;\n constructor(fields?: EventStreamCallbackHandlerInput);\n [Symbol.asyncIterator](): IterableReadableStream<StreamEvent>;\n protected persistRun(_run: Run): Promise<void>;\n _includeRun(run: RunInfo): boolean;\n tapOutputIterable<T>(runId: string, outputStream: AsyncGenerator<T>): AsyncGenerator<T>;\n send(payload: StreamEvent, run: RunInfo): Promise<void>;\n sendEndEvent(payload: StreamEvent, run: RunInfo): Promise<void>;\n onLLMStart(run: Run): Promise<void>;\n onLLMNewToken(run: Run, token: string, kwargs?: {\n chunk: any;\n }): Promise<void>;\n onLLMEnd(run: Run): Promise<void>;\n onChainStart(run: Run): Promise<void>;\n onChainEnd(run: Run): Promise<void>;\n onToolStart(run: Run): Promise<void>;\n onToolEnd(run: Run): Promise<void>;\n onRetrieverStart(run: Run): Promise<void>;\n onRetrieverEnd(run: Run): Promise<void>;\n handleCustomEvent(eventName: string, data: any, runId: string): Promise<void>;\n finish(): Promise<void>;\n}\nexport {};\n//# sourceMappingURL=event_stream.d.ts.map"],"mappings":";;;;;;AAMA;AA8BA;AAmDiBU,KAjFLJ,eAAAA,GAiFKI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAnDLH,WAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAoCEC;;;;;;QAMJF;;UASOI,+BAAAA,SAAwCP"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log_stream.d.cts","names":["Operation","JSONPatchOperation","BaseTracer","Run","BaseCallbackHandler","BaseCallbackHandlerInput","CallbackHandlerPrefersStreaming","HandleLLMNewTokenCallbackFields","IterableReadableStream","StreamEvent","StreamEventData","LogEntry","Record","RunState","RunLogPatch","RunLog","SchemaFormat","LogStreamCallbackHandlerInput","isLogStreamHandler","LogStreamCallbackHandler","T","TransformStream","WritableStreamDefaultWriter","Symbol","asyncIterator","Promise","AsyncGenerator"],"sources":["../../src/tracers/log_stream.d.ts"],"sourcesContent":["import { type Operation as JSONPatchOperation } from \"../utils/fast-json-patch/index.js\";\nimport { BaseTracer, type Run } from \"./base.js\";\nimport { BaseCallbackHandler, BaseCallbackHandlerInput, CallbackHandlerPrefersStreaming, HandleLLMNewTokenCallbackFields } from \"../callbacks/base.js\";\nimport { IterableReadableStream } from \"../utils/stream.js\";\nimport type { StreamEvent, StreamEventData } from \"./event_stream.js\";\nexport type { StreamEvent, StreamEventData };\n/**\n * Interface that represents the structure of a log entry in the\n * `LogStreamCallbackHandler`.\n */\nexport type LogEntry = {\n /** ID of the sub-run. */\n id: string;\n /** Name of the object being run. */\n name: string;\n /** Type of the object being run, eg. prompt, chain, llm, etc. */\n type: string;\n /** List of tags for the run. */\n tags: string[];\n /** Key-value pairs of metadata for the run. */\n metadata: Record<string, any>;\n /** ISO-8601 timestamp of when the run started. */\n start_time: string;\n /** List of general output chunks streamed by this run. */\n streamed_output: any[];\n /** List of LLM tokens streamed by this run, if applicable. */\n streamed_output_str: string[];\n /** Inputs to this run. Not available currently via streamLog. */\n inputs?: any;\n /** Final output of this run. Only available after the run has finished successfully. */\n final_output?: any;\n /** ISO-8601 timestamp of when the run ended. Only available after the run has finished. */\n end_time?: string;\n};\nexport type RunState = {\n /** ID of the sub-run. */\n id: string;\n /** List of output chunks streamed by Runnable.stream() */\n streamed_output: any[];\n /** Final output of the run, usually the result of aggregating streamed_output. Only available after the run has finished successfully. */\n final_output?: any;\n /**\n * List of sub-runs contained in this run, if any, in the order they were started.\n * If filters were supplied, this list will contain only the runs that matched the filters.\n */\n logs: Record<string, LogEntry>;\n /** Name of the object being run. */\n name: string;\n /** Type of the object being run, eg. prompt, chain, llm, etc. */\n type: string;\n};\n/**\n * List of jsonpatch JSONPatchOperations, which describe how to create the run state\n * from an empty dict. This is the minimal representation of the log, designed to\n * be serialized as JSON and sent over the wire to reconstruct the log on the other\n * side. Reconstruction of the state can be done with any jsonpatch-compliant library,\n * see https://jsonpatch.com for more information.\n */\nexport declare class RunLogPatch {\n ops: JSONPatchOperation[];\n constructor(fields: {\n ops?: JSONPatchOperation[];\n });\n concat(other: RunLogPatch): RunLog;\n}\nexport declare class RunLog extends RunLogPatch {\n state: RunState;\n constructor(fields: {\n ops?: JSONPatchOperation[];\n state: RunState;\n });\n concat(other: RunLogPatch): RunLog;\n static fromRunLogPatch(patch: RunLogPatch): RunLog;\n}\nexport type SchemaFormat = \"original\" | \"streaming_events\";\nexport interface LogStreamCallbackHandlerInput extends BaseCallbackHandlerInput {\n autoClose?: boolean;\n includeNames?: string[];\n includeTypes?: string[];\n includeTags?: string[];\n excludeNames?: string[];\n excludeTypes?: string[];\n excludeTags?: string[];\n _schemaFormat?: SchemaFormat;\n}\nexport declare const isLogStreamHandler: (handler: BaseCallbackHandler) => handler is LogStreamCallbackHandler;\n/**\n * Class that extends the `BaseTracer` class from the\n * `langchain.callbacks.tracers.base` module. It represents a callback\n * handler that logs the execution of runs and emits `RunLog` instances to a\n * `RunLogStream`.\n */\nexport declare class LogStreamCallbackHandler extends BaseTracer implements CallbackHandlerPrefersStreaming {\n protected autoClose: boolean;\n protected includeNames?: string[];\n protected includeTypes?: string[];\n protected includeTags?: string[];\n protected excludeNames?: string[];\n protected excludeTypes?: string[];\n protected excludeTags?: string[];\n protected _schemaFormat: SchemaFormat;\n protected rootId?: string;\n private keyMapByRunId;\n private counterMapByRunName;\n protected transformStream: TransformStream;\n writer: WritableStreamDefaultWriter;\n receiveStream: IterableReadableStream<RunLogPatch>;\n name: string;\n lc_prefer_streaming: boolean;\n constructor(fields?: LogStreamCallbackHandlerInput);\n [Symbol.asyncIterator](): IterableReadableStream<RunLogPatch>;\n protected persistRun(_run: Run): Promise<void>;\n _includeRun(run: Run): boolean;\n tapOutputIterable<T>(runId: string, output: AsyncGenerator<T>): AsyncGenerator<T>;\n onRunCreate(run: Run): Promise<void>;\n onRunUpdate(run: Run): Promise<void>;\n onLLMNewToken(run: Run, token: string, kwargs?: HandleLLMNewTokenCallbackFields): Promise<void>;\n}\n//# sourceMappingURL=log_stream.d.ts.map"],"mappings":";;;;;;;;;AAUA;AAwBA;AAwBA;AACSC,KAjDGU,QAAAA,GAiDHV;EAEKA;EAEIa,EAAAA,EAAAA,MAAAA;EAAcC;EAAM,IAAA,EAAA,MAAA;EAEjBA;EACVF,IAAAA,EAAAA,MAAAA;EAEGZ;EACCY,IAAAA,EAAAA,MAAAA,EAAAA;EAEGC;EAAcC,QAAAA,EAnDlBH,MAmDkBG,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA;EACED;EAAcC,UAAAA,EAAAA,MAAAA;EAPZD;EAAW,eAAA,EAAA,GAAA,EAAA;EASnCE;EACKC,mBAAAA,EAAAA,MAAAA,EAAAA;EAUIC;EAOAC,MAAAA,CAAAA,EAAAA,GAAAA;EAQQH;EAIEK,YAAAA,CAAAA,EAAAA,GAAAA;EACnBC;EAC8BR,QAAAA,CAAAA,EAAAA,MAAAA;CAAvBN;AAGMS,KA3EbJ,QAAAA,GA2EaI;EAC4BH;EAAvBN,EAAAA,EAAAA,MAAAA;EAAzBe;EAC0BpB,eAAAA,EAAAA,GAAAA,EAAAA;EAAMsB;EAChBtB,YAAAA,CAAAA,EAAAA,GAAAA;EAC0CiB;;;;EAC1CjB,IAAAA,EArEXS,MAqEWT,CAAAA,MAAAA,EArEIQ,QAqEJR,CAAAA;EAAMsB;EACNtB,IAAAA,EAAAA,MAAAA;EAAMsB;EACJtB,IAAAA,EAAAA,MAAAA;CAA6BI;;;;AAxBuD;;;;cAlCtFO,WAAAA;OACZb;;UAEKA;;gBAEIa,cAAcC;;cAEXA,MAAAA,SAAeD,WAAAA;SACzBD;;UAEGZ;WACCY;;gBAEGC,cAAcC;gCACED,cAAcC;;KAEpCC,YAAAA;UACKC,6BAAAA,SAAsCZ;;;;;;;;kBAQnCW;;cAECE,8BAA8Bd,mCAAmCe;;;;;;;cAOjEA,wBAAAA,SAAiCjB,UAAAA,YAAsBI;;;;;;;;2BAQ/CU;;;;6BAIEK;UACnBC;iBACOd,uBAAuBM;;;uBAGjBG;GACpBM,MAAAA,CAAOC,aAAAA,KAAkBhB,uBAAuBM;6BACtBX,MAAMsB;mBAChBtB;8CAC2BuB,eAAeN,KAAKM,eAAeN;mBAC9DjB,MAAMsB;mBACNtB,MAAMsB;qBACJtB,6BAA6BI,kCAAkCkB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log_stream.d.ts","names":["Operation","JSONPatchOperation","BaseTracer","Run","BaseCallbackHandler","BaseCallbackHandlerInput","CallbackHandlerPrefersStreaming","HandleLLMNewTokenCallbackFields","IterableReadableStream","StreamEvent","StreamEventData","LogEntry","Record","RunState","RunLogPatch","RunLog","SchemaFormat","LogStreamCallbackHandlerInput","isLogStreamHandler","LogStreamCallbackHandler","T","TransformStream","WritableStreamDefaultWriter","Symbol","asyncIterator","Promise","AsyncGenerator"],"sources":["../../src/tracers/log_stream.d.ts"],"sourcesContent":["import { type Operation as JSONPatchOperation } from \"../utils/fast-json-patch/index.js\";\nimport { BaseTracer, type Run } from \"./base.js\";\nimport { BaseCallbackHandler, BaseCallbackHandlerInput, CallbackHandlerPrefersStreaming, HandleLLMNewTokenCallbackFields } from \"../callbacks/base.js\";\nimport { IterableReadableStream } from \"../utils/stream.js\";\nimport type { StreamEvent, StreamEventData } from \"./event_stream.js\";\nexport type { StreamEvent, StreamEventData };\n/**\n * Interface that represents the structure of a log entry in the\n * `LogStreamCallbackHandler`.\n */\nexport type LogEntry = {\n /** ID of the sub-run. */\n id: string;\n /** Name of the object being run. */\n name: string;\n /** Type of the object being run, eg. prompt, chain, llm, etc. */\n type: string;\n /** List of tags for the run. */\n tags: string[];\n /** Key-value pairs of metadata for the run. */\n metadata: Record<string, any>;\n /** ISO-8601 timestamp of when the run started. */\n start_time: string;\n /** List of general output chunks streamed by this run. */\n streamed_output: any[];\n /** List of LLM tokens streamed by this run, if applicable. */\n streamed_output_str: string[];\n /** Inputs to this run. Not available currently via streamLog. */\n inputs?: any;\n /** Final output of this run. Only available after the run has finished successfully. */\n final_output?: any;\n /** ISO-8601 timestamp of when the run ended. Only available after the run has finished. */\n end_time?: string;\n};\nexport type RunState = {\n /** ID of the sub-run. */\n id: string;\n /** List of output chunks streamed by Runnable.stream() */\n streamed_output: any[];\n /** Final output of the run, usually the result of aggregating streamed_output. Only available after the run has finished successfully. */\n final_output?: any;\n /**\n * List of sub-runs contained in this run, if any, in the order they were started.\n * If filters were supplied, this list will contain only the runs that matched the filters.\n */\n logs: Record<string, LogEntry>;\n /** Name of the object being run. */\n name: string;\n /** Type of the object being run, eg. prompt, chain, llm, etc. */\n type: string;\n};\n/**\n * List of jsonpatch JSONPatchOperations, which describe how to create the run state\n * from an empty dict. This is the minimal representation of the log, designed to\n * be serialized as JSON and sent over the wire to reconstruct the log on the other\n * side. Reconstruction of the state can be done with any jsonpatch-compliant library,\n * see https://jsonpatch.com for more information.\n */\nexport declare class RunLogPatch {\n ops: JSONPatchOperation[];\n constructor(fields: {\n ops?: JSONPatchOperation[];\n });\n concat(other: RunLogPatch): RunLog;\n}\nexport declare class RunLog extends RunLogPatch {\n state: RunState;\n constructor(fields: {\n ops?: JSONPatchOperation[];\n state: RunState;\n });\n concat(other: RunLogPatch): RunLog;\n static fromRunLogPatch(patch: RunLogPatch): RunLog;\n}\nexport type SchemaFormat = \"original\" | \"streaming_events\";\nexport interface LogStreamCallbackHandlerInput extends BaseCallbackHandlerInput {\n autoClose?: boolean;\n includeNames?: string[];\n includeTypes?: string[];\n includeTags?: string[];\n excludeNames?: string[];\n excludeTypes?: string[];\n excludeTags?: string[];\n _schemaFormat?: SchemaFormat;\n}\nexport declare const isLogStreamHandler: (handler: BaseCallbackHandler) => handler is LogStreamCallbackHandler;\n/**\n * Class that extends the `BaseTracer` class from the\n * `langchain.callbacks.tracers.base` module. It represents a callback\n * handler that logs the execution of runs and emits `RunLog` instances to a\n * `RunLogStream`.\n */\nexport declare class LogStreamCallbackHandler extends BaseTracer implements CallbackHandlerPrefersStreaming {\n protected autoClose: boolean;\n protected includeNames?: string[];\n protected includeTypes?: string[];\n protected includeTags?: string[];\n protected excludeNames?: string[];\n protected excludeTypes?: string[];\n protected excludeTags?: string[];\n protected _schemaFormat: SchemaFormat;\n protected rootId?: string;\n private keyMapByRunId;\n private counterMapByRunName;\n protected transformStream: TransformStream;\n writer: WritableStreamDefaultWriter;\n receiveStream: IterableReadableStream<RunLogPatch>;\n name: string;\n lc_prefer_streaming: boolean;\n constructor(fields?: LogStreamCallbackHandlerInput);\n [Symbol.asyncIterator](): IterableReadableStream<RunLogPatch>;\n protected persistRun(_run: Run): Promise<void>;\n _includeRun(run: Run): boolean;\n tapOutputIterable<T>(runId: string, output: AsyncGenerator<T>): AsyncGenerator<T>;\n onRunCreate(run: Run): Promise<void>;\n onRunUpdate(run: Run): Promise<void>;\n onLLMNewToken(run: Run, token: string, kwargs?: HandleLLMNewTokenCallbackFields): Promise<void>;\n}\n//# sourceMappingURL=log_stream.d.ts.map"],"mappings":";;;;;;;;;AAUA;AAwBA;AAwBA;AACSC,KAjDGU,QAAAA,GAiDHV;EAEKA;EAEIa,EAAAA,EAAAA,MAAAA;EAAcC;EAAM,IAAA,EAAA,MAAA;EAEjBA;EACVF,IAAAA,EAAAA,MAAAA;EAEGZ;EACCY,IAAAA,EAAAA,MAAAA,EAAAA;EAEGC;EAAcC,QAAAA,EAnDlBH,MAmDkBG,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA;EACED;EAAcC,UAAAA,EAAAA,MAAAA;EAPZD;EAAW,eAAA,EAAA,GAAA,EAAA;EASnCE;EACKC,mBAAAA,EAAAA,MAAAA,EAAAA;EAUIC;EAOAC,MAAAA,CAAAA,EAAAA,GAAAA;EAQQH;EAIEK,YAAAA,CAAAA,EAAAA,GAAAA;EACnBC;EAC8BR,QAAAA,CAAAA,EAAAA,MAAAA;CAAvBN;AAGMS,KA3EbJ,QAAAA,GA2EaI;EAC4BH;EAAvBN,EAAAA,EAAAA,MAAAA;EAAzBe;EAC0BpB,eAAAA,EAAAA,GAAAA,EAAAA;EAAMsB;EAChBtB,YAAAA,CAAAA,EAAAA,GAAAA;EAC0CiB;;;;EAC1CjB,IAAAA,EArEXS,MAqEWT,CAAAA,MAAAA,EArEIQ,QAqEJR,CAAAA;EAAMsB;EACNtB,IAAAA,EAAAA,MAAAA;EAAMsB;EACJtB,IAAAA,EAAAA,MAAAA;CAA6BI;;;;AAxBuD;;;;cAlCtFO,WAAAA;OACZb;;UAEKA;;gBAEIa,cAAcC;;cAEXA,MAAAA,SAAeD,WAAAA;SACzBD;;UAEGZ;WACCY;;gBAEGC,cAAcC;gCACED,cAAcC;;KAEpCC,YAAAA;UACKC,6BAAAA,SAAsCZ;;;;;;;;kBAQnCW;;cAECE,8BAA8Bd,mCAAmCe;;;;;;;cAOjEA,wBAAAA,SAAiCjB,UAAAA,YAAsBI;;;;;;;;2BAQ/CU;;;;6BAIEK;UACnBC;iBACOd,uBAAuBM;;;uBAGjBG;GACpBM,MAAAA,CAAOC,aAAAA,KAAkBhB,uBAAuBM;6BACtBX,MAAMsB;mBAChBtB;8CAC2BuB,eAAeN,KAAKM,eAAeN;mBAC9DjB,MAAMsB;mBACNtB,MAAMsB;qBACJtB,6BAA6BI,kCAAkCkB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run_collector.d.cts","names":["BaseRun","Run","BaseTracer","RunCollectorCallbackHandler","exampleId","Promise"],"sources":["../../src/tracers/run_collector.d.ts"],"sourcesContent":["import { BaseRun, Run } from \"langsmith/schemas\";\nimport { BaseTracer } from \"./base.js\";\n/**\n * A callback handler that collects traced runs and makes it easy to fetch the traced run object from calls through any langchain object.\n * For instance, it makes it easy to fetch the run ID and then do things with that, such as log feedback.\n */\nexport declare class RunCollectorCallbackHandler extends BaseTracer {\n /** The name of the callback handler. */\n name: string;\n /** The ID of the example. */\n exampleId?: string;\n /** An array of traced runs. */\n tracedRuns: Run[];\n /**\n * Creates a new instance of the RunCollectorCallbackHandler class.\n * @param exampleId The ID of the example.\n */\n constructor({ exampleId }?: {\n exampleId?: string;\n });\n /**\n * Persists the given run object.\n * @param run The run object to persist.\n */\n protected persistRun(run: BaseRun): Promise<void>;\n}\n//# sourceMappingURL=run_collector.d.ts.map"],"mappings":";;;;;;;AAMA;;AAWkBI,cAXGD,2BAAAA,SAAoCD,UAAAA,CAWvCE;EAOYJ;EAAUK,IAAAA,EAAAA,MAAAA;EAlBiBH;EAAU,SAAA,CAAA,EAAA,MAAA;;cAMnDD;;;;;;;;;;;;;;4BAYcD,UAAUK"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run_collector.d.ts","names":["BaseRun","Run","BaseTracer","RunCollectorCallbackHandler","exampleId","Promise"],"sources":["../../src/tracers/run_collector.d.ts"],"sourcesContent":["import { BaseRun, Run } from \"langsmith/schemas\";\nimport { BaseTracer } from \"./base.js\";\n/**\n * A callback handler that collects traced runs and makes it easy to fetch the traced run object from calls through any langchain object.\n * For instance, it makes it easy to fetch the run ID and then do things with that, such as log feedback.\n */\nexport declare class RunCollectorCallbackHandler extends BaseTracer {\n /** The name of the callback handler. */\n name: string;\n /** The ID of the example. */\n exampleId?: string;\n /** An array of traced runs. */\n tracedRuns: Run[];\n /**\n * Creates a new instance of the RunCollectorCallbackHandler class.\n * @param exampleId The ID of the example.\n */\n constructor({ exampleId }?: {\n exampleId?: string;\n });\n /**\n * Persists the given run object.\n * @param run The run object to persist.\n */\n protected persistRun(run: BaseRun): Promise<void>;\n}\n//# sourceMappingURL=run_collector.d.ts.map"],"mappings":";;;;;;;AAMA;;AAWkBI,cAXGD,2BAAAA,SAAoCD,UAAAA,CAWvCE;EAOYJ;EAAUK,IAAAA,EAAAA,MAAAA;EAlBiBH;EAAU,SAAA,CAAA,EAAA,MAAA;;cAMnDD;;;;;;;;;;;;;;4BAYcD,UAAUK"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracer_langchain.d.cts","names":["LangSmithTracingClientInterface","RunTree","RunTreeConfig","BaseRun","RunCreate","RunUpdate","BaseRunUpdate","KVMap","BaseTracer","BaseCallbackHandlerInput","Run","RunCreate2","LangChainTracerFields","LangChainTracer","Promise"],"sources":["../../src/tracers/tracer_langchain.d.ts"],"sourcesContent":["import { type LangSmithTracingClientInterface } from \"langsmith\";\nimport { RunTree, type RunTreeConfig } from \"langsmith/run_trees\";\nimport { BaseRun, RunCreate, RunUpdate as BaseRunUpdate, KVMap } from \"langsmith/schemas\";\nimport { BaseTracer } from \"./base.js\";\nimport { BaseCallbackHandlerInput } from \"../callbacks/base.js\";\nexport interface Run extends BaseRun {\n id: string;\n child_runs: this[];\n child_execution_order: number;\n dotted_order?: string;\n trace_id?: string;\n}\nexport interface RunCreate2 extends RunCreate {\n trace_id?: string;\n dotted_order?: string;\n}\nexport interface RunUpdate extends BaseRunUpdate {\n events: BaseRun[\"events\"];\n inputs: KVMap;\n trace_id?: string;\n dotted_order?: string;\n}\nexport interface LangChainTracerFields extends BaseCallbackHandlerInput {\n exampleId?: string;\n projectName?: string;\n client?: LangSmithTracingClientInterface;\n replicas?: RunTreeConfig[\"replicas\"];\n}\nexport declare class LangChainTracer extends BaseTracer implements LangChainTracerFields {\n name: string;\n projectName?: string;\n exampleId?: string;\n client: LangSmithTracingClientInterface;\n replicas?: RunTreeConfig[\"replicas\"];\n usesRunTreeMap: boolean;\n constructor(fields?: LangChainTracerFields);\n protected persistRun(_run: Run): Promise<void>;\n onRunCreate(run: Run): Promise<void>;\n onRunUpdate(run: Run): Promise<void>;\n getRun(id: string): Run | undefined;\n updateFromRunTree(runTree: RunTree): void;\n getRunTreeWithTracingConfig(id: string): RunTree | undefined;\n static getTraceableRunTree(): RunTree | undefined;\n}\n//# sourceMappingURL=tracer_langchain.d.ts.map"],"mappings":";;;;;;;UAKiBU,GAAAA,SAAYP;;EAAZO,UAAG,EAAA,IAAA,EAASP;EAOZQ,qBAAU,EAAA,MAASP;EAInBC,YAAS,CAAA,EAAA,MAAA;EACdF,QAAAA,CAAAA,EAAAA,MAAAA;;AADuBG,UAJlBK,UAAAA,SAAmBP,SAIDE,CAAAA;EAAa,QAAA,CAAA,EAAA,MAAA;EAM/BM,YAAAA,CAAAA,EAAAA,MAAAA;;AAIFV,UAVEG,SAAAA,SAAkBC,WAUpBJ,CAAAA;EAJgCO,MAAAA,EALnCN,OAKmCM,CAAAA,QAAAA,CAAAA;EAAwB,MAAA,EAJ3DF,KAI2D;EAMlDM,QAAAA,CAAAA,EAAAA,MAAAA;EAITb,YAAAA,CAAAA,EAAAA,MAAAA;;AAGaY,UAbRA,qBAAAA,SAA8BH,wBAatBG,CAAAA;EACMF,SAAAA,CAAAA,EAAAA,MAAAA;EAAMI,WAAAA,CAAAA,EAAAA,MAAAA;EAChBJ,MAAAA,CAAAA,EAZRV,+BAYQU;EAAMI,QAAAA,CAAAA,EAXZZ,aAWYY,CAAAA,UAAAA,CAAAA;;AACAA,cAVND,eAAAA,SAAwBL,UAAAA,YAAsBI,qBAUxCE,CAAAA;EACHJ,IAAAA,EAAAA,MAAAA;EACOT,WAAAA,CAAAA,EAAAA,MAAAA;EACcA,SAAAA,CAAAA,EAAAA,MAAAA;EACXA,MAAAA,EAVtBD,+BAUsBC;EAdWO,QAAAA,CAAAA,EAK9BN,aAL8BM,CAAAA,UAAAA,CAAAA;EAAsBI,cAAAA,EAAAA,OAAAA;EAAqB,WAAA,CAAA,MAAA,CAAA,EAO/DA,qBAP+D;6BAQzDF,MAAMI;mBAChBJ,MAAMI;mBACNJ,MAAMI;sBACHJ;6BACOT;2CACcA;gCACXA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracer_langchain.d.ts","names":["LangSmithTracingClientInterface","RunTree","RunTreeConfig","BaseRun","RunCreate","RunUpdate","BaseRunUpdate","KVMap","BaseTracer","BaseCallbackHandlerInput","Run","RunCreate2","LangChainTracerFields","LangChainTracer","Promise"],"sources":["../../src/tracers/tracer_langchain.d.ts"],"sourcesContent":["import { type LangSmithTracingClientInterface } from \"langsmith\";\nimport { RunTree, type RunTreeConfig } from \"langsmith/run_trees\";\nimport { BaseRun, RunCreate, RunUpdate as BaseRunUpdate, KVMap } from \"langsmith/schemas\";\nimport { BaseTracer } from \"./base.js\";\nimport { BaseCallbackHandlerInput } from \"../callbacks/base.js\";\nexport interface Run extends BaseRun {\n id: string;\n child_runs: this[];\n child_execution_order: number;\n dotted_order?: string;\n trace_id?: string;\n}\nexport interface RunCreate2 extends RunCreate {\n trace_id?: string;\n dotted_order?: string;\n}\nexport interface RunUpdate extends BaseRunUpdate {\n events: BaseRun[\"events\"];\n inputs: KVMap;\n trace_id?: string;\n dotted_order?: string;\n}\nexport interface LangChainTracerFields extends BaseCallbackHandlerInput {\n exampleId?: string;\n projectName?: string;\n client?: LangSmithTracingClientInterface;\n replicas?: RunTreeConfig[\"replicas\"];\n}\nexport declare class LangChainTracer extends BaseTracer implements LangChainTracerFields {\n name: string;\n projectName?: string;\n exampleId?: string;\n client: LangSmithTracingClientInterface;\n replicas?: RunTreeConfig[\"replicas\"];\n usesRunTreeMap: boolean;\n constructor(fields?: LangChainTracerFields);\n protected persistRun(_run: Run): Promise<void>;\n onRunCreate(run: Run): Promise<void>;\n onRunUpdate(run: Run): Promise<void>;\n getRun(id: string): Run | undefined;\n updateFromRunTree(runTree: RunTree): void;\n getRunTreeWithTracingConfig(id: string): RunTree | undefined;\n static getTraceableRunTree(): RunTree | undefined;\n}\n//# sourceMappingURL=tracer_langchain.d.ts.map"],"mappings":";;;;;;;UAKiBU,GAAAA,SAAYP;;EAAZO,UAAG,EAAA,IAAA,EAAA;EAOHC,qBAAU,EAAA,MAASP;EAInBC,YAAS,CAAA,EAAA,MAAA;EACdF,QAAAA,CAAAA,EAAAA,MAAAA;;AADuBG,UAJlBK,UAAAA,SAAmBP,SAIDE,CAAAA;EAAa,QAAA,CAAA,EAAA,MAAA;EAM/BM,YAAAA,CAAAA,EAAAA,MAAAA;;AAIFV,UAVEG,SAAAA,SAAkBC,WAUpBJ,CAAAA;EAJgCO,MAAAA,EALnCN,OAKmCM,CAAAA,QAAAA,CAAAA;EAAwB,MAAA,EAJ3DF,KAI2D;EAMlDM,QAAAA,CAAAA,EAAAA,MAAAA;EAITb,YAAAA,CAAAA,EAAAA,MAAAA;;AAGaY,UAbRA,qBAAAA,SAA8BH,wBAatBG,CAAAA;EACMF,SAAAA,CAAAA,EAAAA,MAAAA;EAAMI,WAAAA,CAAAA,EAAAA,MAAAA;EAChBJ,MAAAA,CAAAA,EAZRV,+BAYQU;EAAMI,QAAAA,CAAAA,EAXZZ,aAWYY,CAAAA,UAAAA,CAAAA;;AACAA,cAVND,eAAAA,SAAwBL,UAAAA,YAAsBI,qBAUxCE,CAAAA;EACHJ,IAAAA,EAAAA,MAAAA;EACOT,WAAAA,CAAAA,EAAAA,MAAAA;EACcA,SAAAA,CAAAA,EAAAA,MAAAA;EACXA,MAAAA,EAVtBD,+BAUsBC;EAdWO,QAAAA,CAAAA,EAK9BN,aAL8BM,CAAAA,UAAAA,CAAAA;EAAsBI,cAAAA,EAAAA,OAAAA;EAAqB,WAAA,CAAA,MAAA,CAAA,EAO/DA,qBAP+D;6BAQzDF,MAAMI;mBAChBJ,MAAMI;mBACNJ,MAAMI;sBACHJ;6BACOT;2CACcA;gCACXA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_internal.d.cts","names":["IterableReadableStreamInterface","T","ReadableStream","AsyncIterable"],"sources":["../../src/types/_internal.d.ts"],"sourcesContent":["export type IterableReadableStreamInterface<T> = ReadableStream<T> & AsyncIterable<T>;\n//# sourceMappingURL=_internal.d.ts.map"],"mappings":";KAAYA,qCAAqCE,eAAeD,KAAKE,cAAcF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_internal.d.ts","names":["IterableReadableStreamInterface","T","ReadableStream","AsyncIterable"],"sources":["../../src/types/_internal.d.ts"],"sourcesContent":["export type IterableReadableStreamInterface<T> = ReadableStream<T> & AsyncIterable<T>;\n//# sourceMappingURL=_internal.d.ts.map"],"mappings":";KAAYA,qCAAqCE,eAAeD,KAAKE,cAAcF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-utils.d.cts","names":["Optional","T","K","Omit","Pick","Partial"],"sources":["../../src/types/type-utils.d.ts"],"sourcesContent":["export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n//# sourceMappingURL=type-utils.d.ts.map"],"mappings":";KAAYA,4BAA4BC,KAAKE,KAAKF,GAAGC,KAAKG,QAAQD,KAAKH,GAAGC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-utils.d.ts","names":["Optional","T","K","Omit","Pick","Partial"],"sources":["../../src/types/type-utils.d.ts"],"sourcesContent":["export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n//# sourceMappingURL=type-utils.d.ts.map"],"mappings":";KAAYA,4BAA4BC,KAAKE,KAAKF,GAAGC,KAAKG,QAAQD,KAAKH,GAAGC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_index = require('../node_modules/.pnpm/p-retry@7.1.0/node_modules/p-retry/index.cjs');
|
|
3
2
|
const require_signal = require('./signal.cjs');
|
|
3
|
+
const require_index = require('./p-retry/index.cjs');
|
|
4
4
|
const p_queue = require_rolldown_runtime.__toESM(require("p-queue"));
|
|
5
5
|
|
|
6
6
|
//#region src/utils/async_caller.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async_caller.cjs","names":["error: any","params: AsyncCallerParams","PQueueMod","callable: T","pRetry","options: AsyncCallerCallOptions","listener: (() => void) | undefined","getAbortSignalError"],"sources":["../../src/utils/async_caller.ts"],"sourcesContent":["import PQueueMod from \"p-queue\";\nimport
|
|
1
|
+
{"version":3,"file":"async_caller.cjs","names":["error: any","params: AsyncCallerParams","PQueueMod","callable: T","pRetry","options: AsyncCallerCallOptions","listener: (() => void) | undefined","getAbortSignalError"],"sources":["../../src/utils/async_caller.ts"],"sourcesContent":["import PQueueMod from \"p-queue\";\n\nimport { getAbortSignalError } from \"./signal.js\";\nimport pRetry from \"./p-retry/index.js\";\n\nconst STATUS_NO_RETRY = [\n 400, // Bad Request\n 401, // Unauthorized\n 402, // Payment Required\n 403, // Forbidden\n 404, // Not Found\n 405, // Method Not Allowed\n 406, // Not Acceptable\n 407, // Proxy Authentication Required\n 409, // Conflict\n];\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst defaultFailedAttemptHandler = (error: any) => {\n if (\n error.message.startsWith(\"Cancel\") ||\n error.message.startsWith(\"AbortError\") ||\n error.name === \"AbortError\"\n ) {\n throw error;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((error as any)?.code === \"ECONNABORTED\") {\n throw error;\n }\n const status =\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (error as any)?.response?.status ?? (error as any)?.status;\n if (status && STATUS_NO_RETRY.includes(+status)) {\n throw error;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((error as any)?.error?.code === \"insufficient_quota\") {\n const err = new Error(error?.message);\n err.name = \"InsufficientQuotaError\";\n throw err;\n }\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type FailedAttemptHandler = (error: any) => any;\n\nexport interface AsyncCallerParams {\n /**\n * The maximum number of concurrent calls that can be made.\n * Defaults to `Infinity`, which means no limit.\n */\n maxConcurrency?: number;\n /**\n * The maximum number of retries that can be made for a single call,\n * with an exponential backoff between each attempt. Defaults to 6.\n */\n maxRetries?: number;\n /**\n * Custom handler to handle failed attempts. Takes the originally thrown\n * error object as input, and should itself throw an error if the input\n * error is not retryable.\n */\n onFailedAttempt?: FailedAttemptHandler;\n}\n\nexport interface AsyncCallerCallOptions {\n signal?: AbortSignal;\n}\n\n/**\n * A class that can be used to make async calls with concurrency and retry logic.\n *\n * This is useful for making calls to any kind of \"expensive\" external resource,\n * be it because it's rate-limited, subject to network issues, etc.\n *\n * Concurrent calls are limited by the `maxConcurrency` parameter, which defaults\n * to `Infinity`. This means that by default, all calls will be made in parallel.\n *\n * Retries are limited by the `maxRetries` parameter, which defaults to 6. This\n * means that by default, each call will be retried up to 6 times, with an\n * exponential backoff between each attempt.\n */\nexport class AsyncCaller {\n protected maxConcurrency: AsyncCallerParams[\"maxConcurrency\"];\n\n protected maxRetries: AsyncCallerParams[\"maxRetries\"];\n\n protected onFailedAttempt: AsyncCallerParams[\"onFailedAttempt\"];\n\n private queue: typeof import(\"p-queue\")[\"default\"][\"prototype\"];\n\n constructor(params: AsyncCallerParams) {\n this.maxConcurrency = params.maxConcurrency ?? Infinity;\n this.maxRetries = params.maxRetries ?? 6;\n this.onFailedAttempt =\n params.onFailedAttempt ?? defaultFailedAttemptHandler;\n\n const PQueue = (\n \"default\" in PQueueMod ? PQueueMod.default : PQueueMod\n ) as typeof PQueueMod;\n this.queue = new PQueue({ concurrency: this.maxConcurrency });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async call<A extends any[], T extends (...args: A) => Promise<any>>(\n callable: T,\n ...args: Parameters<T>\n ): Promise<Awaited<ReturnType<T>>> {\n return this.queue.add(\n () =>\n pRetry(\n () =>\n callable(...args).catch((error) => {\n // eslint-disable-next-line no-instanceof/no-instanceof\n if (error instanceof Error) {\n throw error;\n } else {\n throw new Error(error);\n }\n }),\n {\n onFailedAttempt: ({ error }) => this.onFailedAttempt?.(error),\n retries: this.maxRetries,\n randomize: true,\n // If needed we can change some of the defaults here,\n // but they're quite sensible.\n }\n ),\n { throwOnTimeout: true }\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n callWithOptions<A extends any[], T extends (...args: A) => Promise<any>>(\n options: AsyncCallerCallOptions,\n callable: T,\n ...args: Parameters<T>\n ): Promise<Awaited<ReturnType<T>>> {\n // Note this doesn't cancel the underlying request,\n // when available prefer to use the signal option of the underlying call\n if (options.signal) {\n let listener: (() => void) | undefined;\n return Promise.race([\n this.call<A, T>(callable, ...args),\n new Promise<never>((_, reject) => {\n listener = () => {\n reject(getAbortSignalError(options.signal));\n };\n options.signal?.addEventListener(\"abort\", listener);\n }),\n ]).finally(() => {\n if (options.signal && listener) {\n options.signal.removeEventListener(\"abort\", listener);\n }\n });\n }\n return this.call<A, T>(callable, ...args);\n }\n\n fetch(...args: Parameters<typeof fetch>): ReturnType<typeof fetch> {\n return this.call(() =>\n fetch(...args).then((res) => (res.ok ? res : Promise.reject(res)))\n );\n }\n}\n"],"mappings":";;;;;;;;AAKA,MAAM,kBAAkB;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;AAGD,MAAM,8BAA8B,CAACA,UAAe;AAClD,KACE,MAAM,QAAQ,WAAW,SAAS,IAClC,MAAM,QAAQ,WAAW,aAAa,IACtC,MAAM,SAAS,aAEf,OAAM;AAGR,KAAK,OAAe,SAAS,eAC3B,OAAM;CAER,MAAM,SAEH,OAAe,UAAU,UAAW,OAAe;AACtD,KAAI,UAAU,gBAAgB,SAAS,CAAC,OAAO,CAC7C,OAAM;AAGR,KAAK,OAAe,OAAO,SAAS,sBAAsB;EACxD,MAAM,MAAM,IAAI,MAAM,OAAO;EAC7B,IAAI,OAAO;AACX,QAAM;CACP;AACF;;;;;;;;;;;;;;AAyCD,IAAa,cAAb,MAAyB;CACvB,AAAU;CAEV,AAAU;CAEV,AAAU;CAEV,AAAQ;CAER,YAAYC,QAA2B;EACrC,KAAK,iBAAiB,OAAO,kBAAkB;EAC/C,KAAK,aAAa,OAAO,cAAc;EACvC,KAAK,kBACH,OAAO,mBAAmB;EAE5B,MAAM,SACJ,aAAaC,kBAAYA,gBAAU,UAAUA;EAE/C,KAAK,QAAQ,IAAI,OAAO,EAAE,aAAa,KAAK,eAAgB;CAC7D;CAGD,MAAM,KACJC,UACA,GAAG,MAC8B;AACjC,SAAO,KAAK,MAAM,IAChB,MACEC,qBACE,MACE,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU;AAEjC,OAAI,iBAAiB,MACnB,OAAM;OAEN,OAAM,IAAI,MAAM;EAEnB,EAAC,EACJ;GACE,iBAAiB,CAAC,EAAE,OAAO,KAAK,KAAK,kBAAkB,MAAM;GAC7D,SAAS,KAAK;GACd,WAAW;EAGZ,EACF,EACH,EAAE,gBAAgB,KAAM,EACzB;CACF;CAGD,gBACEC,SACAF,UACA,GAAG,MAC8B;AAGjC,MAAI,QAAQ,QAAQ;GAClB,IAAIG;AACJ,UAAO,QAAQ,KAAK,CAClB,KAAK,KAAW,UAAU,GAAG,KAAK,EAClC,IAAI,QAAe,CAAC,GAAG,WAAW;IAChC,WAAW,MAAM;KACf,OAAOC,mCAAoB,QAAQ,OAAO,CAAC;IAC5C;IACD,QAAQ,QAAQ,iBAAiB,SAAS,SAAS;GACpD,EACF,EAAC,CAAC,QAAQ,MAAM;AACf,QAAI,QAAQ,UAAU,UACpB,QAAQ,OAAO,oBAAoB,SAAS,SAAS;GAExD,EAAC;EACH;AACD,SAAO,KAAK,KAAW,UAAU,GAAG,KAAK;CAC1C;CAED,MAAM,GAAG,MAA0D;AACjE,SAAO,KAAK,KAAK,MACf,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,QAAS,IAAI,KAAK,MAAM,QAAQ,OAAO,IAAI,CAAE,CACnE;CACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async_caller.d.cts","names":["FailedAttemptHandler","AsyncCallerParams","AsyncCallerCallOptions","AbortSignal","AsyncCaller","A","T","Promise","Parameters","ReturnType","Awaited","fetch"],"sources":["../../src/utils/async_caller.d.ts"],"sourcesContent":["export type FailedAttemptHandler = (error: any) => any;\nexport interface AsyncCallerParams {\n /**\n * The maximum number of concurrent calls that can be made.\n * Defaults to `Infinity`, which means no limit.\n */\n maxConcurrency?: number;\n /**\n * The maximum number of retries that can be made for a single call,\n * with an exponential backoff between each attempt. Defaults to 6.\n */\n maxRetries?: number;\n /**\n * Custom handler to handle failed attempts. Takes the originally thrown\n * error object as input, and should itself throw an error if the input\n * error is not retryable.\n */\n onFailedAttempt?: FailedAttemptHandler;\n}\nexport interface AsyncCallerCallOptions {\n signal?: AbortSignal;\n}\n/**\n * A class that can be used to make async calls with concurrency and retry logic.\n *\n * This is useful for making calls to any kind of \"expensive\" external resource,\n * be it because it's rate-limited, subject to network issues, etc.\n *\n * Concurrent calls are limited by the `maxConcurrency` parameter, which defaults\n * to `Infinity`. This means that by default, all calls will be made in parallel.\n *\n * Retries are limited by the `maxRetries` parameter, which defaults to 6. This\n * means that by default, each call will be retried up to 6 times, with an\n * exponential backoff between each attempt.\n */\nexport declare class AsyncCaller {\n protected maxConcurrency: AsyncCallerParams[\"maxConcurrency\"];\n protected maxRetries: AsyncCallerParams[\"maxRetries\"];\n protected onFailedAttempt: AsyncCallerParams[\"onFailedAttempt\"];\n private queue;\n constructor(params: AsyncCallerParams);\n call<A extends any[], T extends (...args: A) => Promise<any>>(callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;\n callWithOptions<A extends any[], T extends (...args: A) => Promise<any>>(options: AsyncCallerCallOptions, callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;\n fetch(...args: Parameters<typeof fetch>): ReturnType<typeof fetch>;\n}\n//# sourceMappingURL=async_caller.d.ts.map"],"mappings":";KAAYA,oBAAAA;AAAAA,UACKC,iBAAAA,CADe;EACfA;AAkBjB;AAgBA;;EAE0BA,cAAAA,CAAAA,EAAAA,MAAAA;EACKA;;;;EAG6CK,UAAAA,CAAAA,EAAAA,MAAAA;EAAuBA;;;;;EAAKC,eAAAA,CAAAA,EAxBlFP,oBAwBkFO;;AACzCA,UAvB9CL,sBAAAA,CAuB8CK;EAAuBL,MAAAA,CAAAA,EAtBzEC,WAsByED;;;;;;;;;;;;AAC9B;;;cARnCE,WAAAA;4BACSH;wBACJA;6BACKA;;sBAEPA;4CACsBI,MAAME,wBAAwBD,YAAYE,WAAWF,KAAKC,QAAQG,QAAQD,WAAWH;uDAC1ED,MAAME,uBAAuBL,kCAAkCI,YAAYE,WAAWF,KAAKC,QAAQG,QAAQD,WAAWH;iBAC5JE,kBAAkBG,SAASF,kBAAkBE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async_caller.d.ts","names":["FailedAttemptHandler","AsyncCallerParams","AsyncCallerCallOptions","AbortSignal","AsyncCaller","A","T","Promise","Parameters","ReturnType","Awaited","fetch"],"sources":["../../src/utils/async_caller.d.ts"],"sourcesContent":["export type FailedAttemptHandler = (error: any) => any;\nexport interface AsyncCallerParams {\n /**\n * The maximum number of concurrent calls that can be made.\n * Defaults to `Infinity`, which means no limit.\n */\n maxConcurrency?: number;\n /**\n * The maximum number of retries that can be made for a single call,\n * with an exponential backoff between each attempt. Defaults to 6.\n */\n maxRetries?: number;\n /**\n * Custom handler to handle failed attempts. Takes the originally thrown\n * error object as input, and should itself throw an error if the input\n * error is not retryable.\n */\n onFailedAttempt?: FailedAttemptHandler;\n}\nexport interface AsyncCallerCallOptions {\n signal?: AbortSignal;\n}\n/**\n * A class that can be used to make async calls with concurrency and retry logic.\n *\n * This is useful for making calls to any kind of \"expensive\" external resource,\n * be it because it's rate-limited, subject to network issues, etc.\n *\n * Concurrent calls are limited by the `maxConcurrency` parameter, which defaults\n * to `Infinity`. This means that by default, all calls will be made in parallel.\n *\n * Retries are limited by the `maxRetries` parameter, which defaults to 6. This\n * means that by default, each call will be retried up to 6 times, with an\n * exponential backoff between each attempt.\n */\nexport declare class AsyncCaller {\n protected maxConcurrency: AsyncCallerParams[\"maxConcurrency\"];\n protected maxRetries: AsyncCallerParams[\"maxRetries\"];\n protected onFailedAttempt: AsyncCallerParams[\"onFailedAttempt\"];\n private queue;\n constructor(params: AsyncCallerParams);\n call<A extends any[], T extends (...args: A) => Promise<any>>(callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;\n callWithOptions<A extends any[], T extends (...args: A) => Promise<any>>(options: AsyncCallerCallOptions, callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;\n fetch(...args: Parameters<typeof fetch>): ReturnType<typeof fetch>;\n}\n//# sourceMappingURL=async_caller.d.ts.map"],"mappings":";KAAYA,oBAAAA;AAAAA,UACKC,iBAAAA,CADe;EACfA;AAkBjB;AAgBA;;EAE0BA,cAAAA,CAAAA,EAAAA,MAAAA;EACKA;;;;EAG6CK,UAAAA,CAAAA,EAAAA,MAAAA;EAAuBA;;;;;EAAKC,eAAAA,CAAAA,EAxBlFP,oBAwBkFO;;AACzCA,UAvB9CL,sBAAAA,CAuB8CK;EAAuBL,MAAAA,CAAAA,EAtBzEC,WAsByED;;;;;;;;;;;;AAC9B;;;cARnCE,WAAAA;4BACSH;wBACJA;6BACKA;;sBAEPA;4CACsBI,MAAME,wBAAwBD,YAAYE,WAAWF,KAAKC,QAAQG,QAAQD,WAAWH;uDAC1ED,MAAME,uBAAuBL,kCAAkCI,YAAYE,WAAWF,KAAKC,QAAQG,QAAQD,WAAWH;iBAC5JE,kBAAkBG,SAASF,kBAAkBE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __export } from "../_virtual/rolldown_runtime.js";
|
|
2
|
-
import { pRetry } from "../node_modules/.pnpm/p-retry@7.1.0/node_modules/p-retry/index.js";
|
|
3
2
|
import { getAbortSignalError } from "./signal.js";
|
|
3
|
+
import { pRetry } from "./p-retry/index.js";
|
|
4
4
|
import PQueueMod from "p-queue";
|
|
5
5
|
|
|
6
6
|
//#region src/utils/async_caller.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async_caller.js","names":["error: any","params: AsyncCallerParams","callable: T","options: AsyncCallerCallOptions","listener: (() => void) | undefined"],"sources":["../../src/utils/async_caller.ts"],"sourcesContent":["import PQueueMod from \"p-queue\";\nimport
|
|
1
|
+
{"version":3,"file":"async_caller.js","names":["error: any","params: AsyncCallerParams","callable: T","options: AsyncCallerCallOptions","listener: (() => void) | undefined"],"sources":["../../src/utils/async_caller.ts"],"sourcesContent":["import PQueueMod from \"p-queue\";\n\nimport { getAbortSignalError } from \"./signal.js\";\nimport pRetry from \"./p-retry/index.js\";\n\nconst STATUS_NO_RETRY = [\n 400, // Bad Request\n 401, // Unauthorized\n 402, // Payment Required\n 403, // Forbidden\n 404, // Not Found\n 405, // Method Not Allowed\n 406, // Not Acceptable\n 407, // Proxy Authentication Required\n 409, // Conflict\n];\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst defaultFailedAttemptHandler = (error: any) => {\n if (\n error.message.startsWith(\"Cancel\") ||\n error.message.startsWith(\"AbortError\") ||\n error.name === \"AbortError\"\n ) {\n throw error;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((error as any)?.code === \"ECONNABORTED\") {\n throw error;\n }\n const status =\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (error as any)?.response?.status ?? (error as any)?.status;\n if (status && STATUS_NO_RETRY.includes(+status)) {\n throw error;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((error as any)?.error?.code === \"insufficient_quota\") {\n const err = new Error(error?.message);\n err.name = \"InsufficientQuotaError\";\n throw err;\n }\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type FailedAttemptHandler = (error: any) => any;\n\nexport interface AsyncCallerParams {\n /**\n * The maximum number of concurrent calls that can be made.\n * Defaults to `Infinity`, which means no limit.\n */\n maxConcurrency?: number;\n /**\n * The maximum number of retries that can be made for a single call,\n * with an exponential backoff between each attempt. Defaults to 6.\n */\n maxRetries?: number;\n /**\n * Custom handler to handle failed attempts. Takes the originally thrown\n * error object as input, and should itself throw an error if the input\n * error is not retryable.\n */\n onFailedAttempt?: FailedAttemptHandler;\n}\n\nexport interface AsyncCallerCallOptions {\n signal?: AbortSignal;\n}\n\n/**\n * A class that can be used to make async calls with concurrency and retry logic.\n *\n * This is useful for making calls to any kind of \"expensive\" external resource,\n * be it because it's rate-limited, subject to network issues, etc.\n *\n * Concurrent calls are limited by the `maxConcurrency` parameter, which defaults\n * to `Infinity`. This means that by default, all calls will be made in parallel.\n *\n * Retries are limited by the `maxRetries` parameter, which defaults to 6. This\n * means that by default, each call will be retried up to 6 times, with an\n * exponential backoff between each attempt.\n */\nexport class AsyncCaller {\n protected maxConcurrency: AsyncCallerParams[\"maxConcurrency\"];\n\n protected maxRetries: AsyncCallerParams[\"maxRetries\"];\n\n protected onFailedAttempt: AsyncCallerParams[\"onFailedAttempt\"];\n\n private queue: typeof import(\"p-queue\")[\"default\"][\"prototype\"];\n\n constructor(params: AsyncCallerParams) {\n this.maxConcurrency = params.maxConcurrency ?? Infinity;\n this.maxRetries = params.maxRetries ?? 6;\n this.onFailedAttempt =\n params.onFailedAttempt ?? defaultFailedAttemptHandler;\n\n const PQueue = (\n \"default\" in PQueueMod ? PQueueMod.default : PQueueMod\n ) as typeof PQueueMod;\n this.queue = new PQueue({ concurrency: this.maxConcurrency });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async call<A extends any[], T extends (...args: A) => Promise<any>>(\n callable: T,\n ...args: Parameters<T>\n ): Promise<Awaited<ReturnType<T>>> {\n return this.queue.add(\n () =>\n pRetry(\n () =>\n callable(...args).catch((error) => {\n // eslint-disable-next-line no-instanceof/no-instanceof\n if (error instanceof Error) {\n throw error;\n } else {\n throw new Error(error);\n }\n }),\n {\n onFailedAttempt: ({ error }) => this.onFailedAttempt?.(error),\n retries: this.maxRetries,\n randomize: true,\n // If needed we can change some of the defaults here,\n // but they're quite sensible.\n }\n ),\n { throwOnTimeout: true }\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n callWithOptions<A extends any[], T extends (...args: A) => Promise<any>>(\n options: AsyncCallerCallOptions,\n callable: T,\n ...args: Parameters<T>\n ): Promise<Awaited<ReturnType<T>>> {\n // Note this doesn't cancel the underlying request,\n // when available prefer to use the signal option of the underlying call\n if (options.signal) {\n let listener: (() => void) | undefined;\n return Promise.race([\n this.call<A, T>(callable, ...args),\n new Promise<never>((_, reject) => {\n listener = () => {\n reject(getAbortSignalError(options.signal));\n };\n options.signal?.addEventListener(\"abort\", listener);\n }),\n ]).finally(() => {\n if (options.signal && listener) {\n options.signal.removeEventListener(\"abort\", listener);\n }\n });\n }\n return this.call<A, T>(callable, ...args);\n }\n\n fetch(...args: Parameters<typeof fetch>): ReturnType<typeof fetch> {\n return this.call(() =>\n fetch(...args).then((res) => (res.ok ? res : Promise.reject(res)))\n );\n }\n}\n"],"mappings":";;;;;;;;AAKA,MAAM,kBAAkB;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;AAGD,MAAM,8BAA8B,CAACA,UAAe;AAClD,KACE,MAAM,QAAQ,WAAW,SAAS,IAClC,MAAM,QAAQ,WAAW,aAAa,IACtC,MAAM,SAAS,aAEf,OAAM;AAGR,KAAK,OAAe,SAAS,eAC3B,OAAM;CAER,MAAM,SAEH,OAAe,UAAU,UAAW,OAAe;AACtD,KAAI,UAAU,gBAAgB,SAAS,CAAC,OAAO,CAC7C,OAAM;AAGR,KAAK,OAAe,OAAO,SAAS,sBAAsB;EACxD,MAAM,MAAM,IAAI,MAAM,OAAO;EAC7B,IAAI,OAAO;AACX,QAAM;CACP;AACF;;;;;;;;;;;;;;AAyCD,IAAa,cAAb,MAAyB;CACvB,AAAU;CAEV,AAAU;CAEV,AAAU;CAEV,AAAQ;CAER,YAAYC,QAA2B;EACrC,KAAK,iBAAiB,OAAO,kBAAkB;EAC/C,KAAK,aAAa,OAAO,cAAc;EACvC,KAAK,kBACH,OAAO,mBAAmB;EAE5B,MAAM,SACJ,aAAa,YAAY,UAAU,UAAU;EAE/C,KAAK,QAAQ,IAAI,OAAO,EAAE,aAAa,KAAK,eAAgB;CAC7D;CAGD,MAAM,KACJC,UACA,GAAG,MAC8B;AACjC,SAAO,KAAK,MAAM,IAChB,MACE,OACE,MACE,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU;AAEjC,OAAI,iBAAiB,MACnB,OAAM;OAEN,OAAM,IAAI,MAAM;EAEnB,EAAC,EACJ;GACE,iBAAiB,CAAC,EAAE,OAAO,KAAK,KAAK,kBAAkB,MAAM;GAC7D,SAAS,KAAK;GACd,WAAW;EAGZ,EACF,EACH,EAAE,gBAAgB,KAAM,EACzB;CACF;CAGD,gBACEC,SACAD,UACA,GAAG,MAC8B;AAGjC,MAAI,QAAQ,QAAQ;GAClB,IAAIE;AACJ,UAAO,QAAQ,KAAK,CAClB,KAAK,KAAW,UAAU,GAAG,KAAK,EAClC,IAAI,QAAe,CAAC,GAAG,WAAW;IAChC,WAAW,MAAM;KACf,OAAO,oBAAoB,QAAQ,OAAO,CAAC;IAC5C;IACD,QAAQ,QAAQ,iBAAiB,SAAS,SAAS;GACpD,EACF,EAAC,CAAC,QAAQ,MAAM;AACf,QAAI,QAAQ,UAAU,UACpB,QAAQ,OAAO,oBAAoB,SAAS,SAAS;GAExD,EAAC;EACH;AACD,SAAO,KAAK,KAAW,UAAU,GAAG,KAAK;CAC1C;CAED,MAAM,GAAG,MAA0D;AACjE,SAAO,KAAK,KAAK,MACf,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,QAAS,IAAI,KAAK,MAAM,QAAQ,OAAO,IAAI,CAAE,CACnE;CACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_array.d.cts","names":["chunkArray","T"],"sources":["../../src/utils/chunk_array.d.ts"],"sourcesContent":["export declare const chunkArray: <T>(arr: T[], chunkSize: number) => T[][];\n//# sourceMappingURL=chunk_array.d.ts.map"],"mappings":";cAAqBA,qBAAqBC,2BAA2BA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_array.d.ts","names":["chunkArray","T"],"sources":["../../src/utils/chunk_array.d.ts"],"sourcesContent":["export declare const chunkArray: <T>(arr: T[], chunkSize: number) => T[][];\n//# sourceMappingURL=chunk_array.d.ts.map"],"mappings":";cAAqBA,qBAAqBC,2BAA2BA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.cts","names":["isBrowser","isWebWorker","isJsDom","isDeno","isNode","getEnv","RuntimeEnvironment","getRuntimeEnvironment","getEnvironmentVariable"],"sources":["../../src/utils/env.d.ts"],"sourcesContent":["declare global {\n const Deno: {\n version: {\n deno: string;\n };\n env: {\n get: (name: string) => string | undefined;\n };\n } | undefined;\n}\nexport declare const isBrowser: () => boolean;\nexport declare const isWebWorker: () => boolean;\nexport declare const isJsDom: () => boolean;\nexport declare const isDeno: () => boolean;\nexport declare const isNode: () => boolean;\nexport declare const getEnv: () => string;\nexport type RuntimeEnvironment = {\n library: string;\n libraryVersion?: string;\n runtime: string;\n runtimeVersion?: string;\n};\nexport declare function getRuntimeEnvironment(): RuntimeEnvironment;\nexport declare function getEnvironmentVariable(name: string): string | undefined;\n//# sourceMappingURL=env.d.ts.map"],"mappings":";;;;;;;MAUqBA,GAAAA,EAAwB,CAAA,IAAA,EAAA,MAAA,EAAA,GAAA,MAAA,GAAA,SAAA;IACxBC,CAAAA;EACAC,CAAAA,GAAAA,SAAsB;AAC3C;AACqBE,cAJAJ,SAIqB,EAAA,GAAA,GAAA,OAAA;AACrBK,cAJAJ,WAIoB,EAAA,GAAA,GAAA,OAAA;AAC7BK,cAJSJ,OAIS,EAAA,GAAA,GAAA,OAAA;AAMNK,cATHJ,MASGI,EAAqB,GAAA,GAAA,OAAID;AACzBE,cATHJ,MASGI,EAAsB,GAAA,GAAA,OAAA;cARzBH;KACTC,kBAAAA;;;;;;iBAMYC,qBAAAA,CAAAA,GAAyBD;iBACzBE,sBAAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","names":["isBrowser","isWebWorker","isJsDom","isDeno","isNode","getEnv","RuntimeEnvironment","getRuntimeEnvironment","getEnvironmentVariable"],"sources":["../../src/utils/env.d.ts"],"sourcesContent":["declare global {\n const Deno: {\n version: {\n deno: string;\n };\n env: {\n get: (name: string) => string | undefined;\n };\n } | undefined;\n}\nexport declare const isBrowser: () => boolean;\nexport declare const isWebWorker: () => boolean;\nexport declare const isJsDom: () => boolean;\nexport declare const isDeno: () => boolean;\nexport declare const isNode: () => boolean;\nexport declare const getEnv: () => string;\nexport type RuntimeEnvironment = {\n library: string;\n libraryVersion?: string;\n runtime: string;\n runtimeVersion?: string;\n};\nexport declare function getRuntimeEnvironment(): RuntimeEnvironment;\nexport declare function getEnvironmentVariable(name: string): string | undefined;\n//# sourceMappingURL=env.d.ts.map"],"mappings":";;;;;;;MAUqBA,GAAAA,EAAwB,CAAA,IAAA,EAAA,MAAA,EAAA,GAAA,MAAA,GAAA,SAAA;IACxBC,CAAAA;EACAC,CAAAA,GAAAA,SAAsB;AAC3C;AACqBE,cAJAJ,SAIqB,EAAA,GAAA,GAAA,OAAA;AACrBK,cAJAJ,WAIoB,EAAA,GAAA,GAAA,OAAA;AAC7BK,cAJSJ,OAIS,EAAA,GAAA,GAAA,OAAA;AAMNK,cATHJ,MASGI,EAAqB,GAAA,GAAA,OAAID;AACzBE,cATHJ,MASGI,EAAsB,GAAA,GAAA,OAAA;cARzBH;KACTC,kBAAAA;;;;;;iBAMYC,qBAAAA,CAAAA,GAAyBD;iBACzBE,sBAAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event_source_parse.d.cts","names":["IterableReadableStream","EventStreamContentType","EventSourceMessage","getBytes","Uint8Array","ReadableStream","AsyncIterable","Promise","getLines","ArrayBufferLike","getMessages","convertEventStreamToIterableReadableDataStream"],"sources":["../../src/utils/event_source_parse.d.ts"],"sourcesContent":["import { IterableReadableStream } from \"./stream.js\";\nexport declare const EventStreamContentType = \"text/event-stream\";\n/**\n * Represents a message sent in an event stream\n * https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format\n */\nexport interface EventSourceMessage {\n /** The event ID to set the EventSource object's last event ID value. */\n id: string;\n /** A string identifying the type of event described. */\n event: string;\n /** The event data */\n data: string;\n /** The reconnection interval (in milliseconds) to wait before retrying the connection */\n retry?: number;\n}\n/**\n * Converts a ReadableStream into a callback pattern.\n * @param stream The input ReadableStream.\n * @param onChunk A function that will be called on each new byte chunk in the stream.\n * @returns {Promise<void>} A promise that will be resolved when the stream closes.\n */\nexport declare function getBytes(stream: ReadableStream<Uint8Array> | AsyncIterable<any>, onChunk: (arr: Uint8Array, flush?: boolean) => void): Promise<void>;\n/**\n * Parses arbitary byte chunks into EventSource line buffers.\n * Each line should be of the format \"field: value\" and ends with \\r, \\n, or \\r\\n.\n * @param onLine A function that will be called on each new EventSource line.\n * @returns A function that should be called for each incoming byte chunk.\n */\nexport declare function getLines(onLine: (line: Uint8Array, fieldLength: number, flush?: boolean) => void): (arr: Uint8Array<ArrayBufferLike>, flush?: boolean | undefined) => void;\n/**\n * Parses line buffers into EventSourceMessages.\n * @param onId A function that will be called on each `id` field.\n * @param onRetry A function that will be called on each `retry` field.\n * @param onMessage A function that will be called on each message.\n * @returns A function that should be called for each incoming line buffer.\n */\nexport declare function getMessages(onMessage?: (msg: EventSourceMessage) => void, onId?: (id: string) => void, onRetry?: (retry: number) => void): (line: Uint8Array<ArrayBufferLike>, fieldLength: number, flush?: boolean | undefined) => void;\nexport declare function convertEventStreamToIterableReadableDataStream(stream: ReadableStream, onMetadataEvent?: (e: unknown) => unknown): IterableReadableStream<any>;\n//# sourceMappingURL=event_source_parse.d.ts.map"],"mappings":";;;cACqBC,sBAAAA;;AAArB;AAKA;AAgBA;AAAwDG,UAhBvCF,kBAAAA,CAgBuCE;EAAfC;EAA6BC,EAAAA,EAAAA,MAAAA;EAAmCF;EAAuCG,KAAAA,EAAAA,MAAAA;EAAO;EAO/HC,IAAAA,EAAAA,MAAQ;EAAgBJ;EAA6EK,KAAAA,CAAAA,EAAAA,MAAAA;;AAAD;AAQ5H;;;;AAAqK;AAC7IE,iBAhBAR,QAAAA,CAgBAQ,MAAAA,EAhBiBN,cAgB6B,CAhBdD,UAgBuBC,CAAAA,GAhBTC,aAgBqEN,CAAAA,GAAAA,CAAAA,EAAAA,OAAAA,EAAAA,CAAAA,GAAAA,EAhBlCI,UAgBwD,EAAA,KAAA,CAAA,EAAA,OAAA,EAAA,GAAA,IAAA,CAAA,EAhBjBG,OAgBiB,CAAA,IAAA,CAAA;;;;;;;iBATzIC,QAAAA,gBAAwBJ,kEAAkEA,WAAWK;;;;;;;;iBAQrGC,WAAAA,mBAA8BR,qGAAqGE,WAAWK;iBAC9IE,8CAAAA,SAAuDN,4DAA4DL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event_source_parse.d.ts","names":["IterableReadableStream","EventStreamContentType","EventSourceMessage","getBytes","Uint8Array","ReadableStream","AsyncIterable","Promise","getLines","ArrayBufferLike","getMessages","convertEventStreamToIterableReadableDataStream"],"sources":["../../src/utils/event_source_parse.d.ts"],"sourcesContent":["import { IterableReadableStream } from \"./stream.js\";\nexport declare const EventStreamContentType = \"text/event-stream\";\n/**\n * Represents a message sent in an event stream\n * https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format\n */\nexport interface EventSourceMessage {\n /** The event ID to set the EventSource object's last event ID value. */\n id: string;\n /** A string identifying the type of event described. */\n event: string;\n /** The event data */\n data: string;\n /** The reconnection interval (in milliseconds) to wait before retrying the connection */\n retry?: number;\n}\n/**\n * Converts a ReadableStream into a callback pattern.\n * @param stream The input ReadableStream.\n * @param onChunk A function that will be called on each new byte chunk in the stream.\n * @returns {Promise<void>} A promise that will be resolved when the stream closes.\n */\nexport declare function getBytes(stream: ReadableStream<Uint8Array> | AsyncIterable<any>, onChunk: (arr: Uint8Array, flush?: boolean) => void): Promise<void>;\n/**\n * Parses arbitary byte chunks into EventSource line buffers.\n * Each line should be of the format \"field: value\" and ends with \\r, \\n, or \\r\\n.\n * @param onLine A function that will be called on each new EventSource line.\n * @returns A function that should be called for each incoming byte chunk.\n */\nexport declare function getLines(onLine: (line: Uint8Array, fieldLength: number, flush?: boolean) => void): (arr: Uint8Array<ArrayBufferLike>, flush?: boolean | undefined) => void;\n/**\n * Parses line buffers into EventSourceMessages.\n * @param onId A function that will be called on each `id` field.\n * @param onRetry A function that will be called on each `retry` field.\n * @param onMessage A function that will be called on each message.\n * @returns A function that should be called for each incoming line buffer.\n */\nexport declare function getMessages(onMessage?: (msg: EventSourceMessage) => void, onId?: (id: string) => void, onRetry?: (retry: number) => void): (line: Uint8Array<ArrayBufferLike>, fieldLength: number, flush?: boolean | undefined) => void;\nexport declare function convertEventStreamToIterableReadableDataStream(stream: ReadableStream, onMetadataEvent?: (e: unknown) => unknown): IterableReadableStream<any>;\n//# sourceMappingURL=event_source_parse.d.ts.map"],"mappings":";;;cACqBC,sBAAAA;;AAArB;AAKA;AAgBA;AAAwDG,UAhBvCF,kBAAAA,CAgBuCE;EAAfC;EAA6BC,EAAAA,EAAAA,MAAAA;EAAmCF;EAAuCG,KAAAA,EAAAA,MAAAA;EAAO;EAO/HC,IAAAA,EAAAA,MAAQ;EAAgBJ;EAA6EK,KAAAA,CAAAA,EAAAA,MAAAA;;AAAD;AAQ5H;;;;AAAqK;AAC7IE,iBAhBAR,QAAAA,CAgBAQ,MAAAA,EAhBiBN,cAgB6B,CAhBdD,UAgBuBC,CAAAA,GAhBTC,aAgBqEN,CAAAA,GAAAA,CAAAA,EAAAA,OAAAA,EAAAA,CAAAA,GAAAA,EAhBlCI,UAgBwD,EAAA,KAAA,CAAA,EAAA,OAAA,EAAA,GAAA,IAAA,CAAA,EAhBjBG,OAgBiB,CAAA,IAAA,CAAA;;;;;;;iBATzIC,QAAAA,gBAAwBJ,kEAAkEA,WAAWK;;;;;;;;iBAQrGC,WAAAA,mBAA8BR,qGAAqGE,WAAWK;iBAC9IE,8CAAAA,SAAuDN,4DAA4DL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.cts","names":["PatchError","_deepClone","JsonPatchError","deepClone","Operation","AddOperation","RemoveOperation","ReplaceOperation","MoveOperation","CopyOperation","TestOperation","GetOperation","Validator","T","OperationResult","BaseOperation","PatchResult","Array","getValueByPointer","applyOperation","applyPatch","ReadonlyArray","applyReducer","validator","validate","_areEquals"],"sources":["../../../../src/utils/fast-json-patch/src/core.d.ts"],"sourcesContent":["import { PatchError, _deepClone } from \"./helpers.js\";\nexport declare const JsonPatchError: typeof PatchError;\nexport declare const deepClone: typeof _deepClone;\nexport type Operation = AddOperation<any> | RemoveOperation | ReplaceOperation<any> | MoveOperation | CopyOperation | TestOperation<any> | GetOperation<any>;\nexport interface Validator<T> {\n (operation: Operation, index: number, document: T, existingPathFragment: string): void;\n}\nexport interface OperationResult<T> {\n removed?: any;\n test?: boolean;\n newDocument: T;\n}\nexport interface BaseOperation {\n path: string;\n}\nexport interface AddOperation<T> extends BaseOperation {\n op: \"add\";\n value: T;\n}\nexport interface RemoveOperation extends BaseOperation {\n op: \"remove\";\n}\nexport interface ReplaceOperation<T> extends BaseOperation {\n op: \"replace\";\n value: T;\n}\nexport interface MoveOperation extends BaseOperation {\n op: \"move\";\n from: string;\n}\nexport interface CopyOperation extends BaseOperation {\n op: \"copy\";\n from: string;\n}\nexport interface TestOperation<T> extends BaseOperation {\n op: \"test\";\n value: T;\n}\nexport interface GetOperation<T> extends BaseOperation {\n op: \"_get\";\n value: T;\n}\nexport interface PatchResult<T> extends Array<OperationResult<T>> {\n newDocument: T;\n}\n/**\n * Retrieves a value from a JSON document by a JSON pointer.\n * Returns the value.\n *\n * @param document The document to get the value from\n * @param pointer an escaped JSON pointer\n * @return The retrieved value\n */\nexport declare function getValueByPointer(document: any, pointer: string): any;\n/**\n * Apply a single JSON Patch Operation on a JSON document.\n * Returns the {newDocument, result} of the operation.\n * It modifies the `document` and `operation` objects - it gets the values by reference.\n * If you would like to avoid touching your values, clone them:\n * `jsonpatch.applyOperation(document, jsonpatch._deepClone(operation))`.\n *\n * @param document The document to patch\n * @param operation The operation to apply\n * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.\n * @param mutateDocument Whether to mutate the original document or clone it before applying\n * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.\n * @return `{newDocument, result}` after the operation\n */\nexport declare function applyOperation<T>(document: T, operation: Operation, validateOperation?: boolean | Validator<T>, mutateDocument?: boolean, banPrototypeModifications?: boolean, index?: number): OperationResult<T>;\n/**\n * Apply a full JSON Patch array on a JSON document.\n * Returns the {newDocument, result} of the patch.\n * It modifies the `document` object and `patch` - it gets the values by reference.\n * If you would like to avoid touching your values, clone them:\n * `jsonpatch.applyPatch(document, jsonpatch._deepClone(patch))`.\n *\n * @param document The document to patch\n * @param patch The patch to apply\n * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.\n * @param mutateDocument Whether to mutate the original document or clone it before applying\n * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.\n * @return An array of `{newDocument, result}` after the patch\n */\nexport declare function applyPatch<T>(document: T, patch: ReadonlyArray<Operation>, validateOperation?: boolean | Validator<T>, mutateDocument?: boolean, banPrototypeModifications?: boolean): PatchResult<T>;\n/**\n * Apply a single JSON Patch Operation on a JSON document.\n * Returns the updated document.\n * Suitable as a reducer.\n *\n * @param document The document to patch\n * @param operation The operation to apply\n * @return The updated document\n */\nexport declare function applyReducer<T>(document: T, operation: Operation, index: number): T;\n/**\n * Validates a single operation. Called from `jsonpatch.validate`. Throws `JsonPatchError` in case of an error.\n * @param {object} operation - operation object (patch)\n * @param {number} index - index of operation in the sequence\n * @param {object} [document] - object where the operation is supposed to be applied\n * @param {string} [existingPathFragment] - comes along with `document`\n */\nexport declare function validator(operation: Operation, index: number, document?: any, existingPathFragment?: string): void;\n/**\n * Validates a sequence of operations. If `document` parameter is provided, the sequence is additionally validated against the object document.\n * If error is encountered, returns a JsonPatchError object\n * @param sequence\n * @param document\n * @returns {JsonPatchError|undefined}\n */\nexport declare function validate<T>(sequence: ReadonlyArray<Operation>, document?: T, externalValidator?: Validator<T>): PatchError;\nexport declare function _areEquals(a: any, b: any): boolean;\n//# sourceMappingURL=core.d.ts.map"],"mappings":";;AAG4CM,KAAhCF,SAAAA,GAAYC,YAAoBC,CAAAA,GAAAA,CAAAA,GAAAA,eAAAA,GAAkBC,gBAAlBD,CAAAA,GAAAA,CAAAA,GAA0CE,aAA1CF,GAA0DG,aAA1DH,GAA0EI,aAA1EJ,CAAAA,GAAAA,CAAAA,GAA+FK,YAA/FL,CAAAA,GAAAA,CAAAA;AAAkBC,UAC7CK,SAD6CL,CAAAA,CAAAA,CAAAA,CAAAA;EAAwBC,CAAAA,SAAAA,EAEtEJ,SAFsEI,EAAAA,KAAAA,EAAAA,MAAAA,EAAAA,QAAAA,EAElCK,CAFkCL,EAAAA,oBAAAA,EAAAA,MAAAA,CAAAA,EAAAA,IAAAA;;AAAgCE,UAIrGI,eAJqGJ,CAAAA,CAAAA,CAAAA,CAAAA;EAAqBC,OAAAA,CAAAA,EAAAA,GAAAA;EAAY,IAAA,CAAA,EAAA,OAAA;EACtIC,WAAAA,EAMAC,CANS;AAG1B;AAKiBE,UAAAA,aAAAA,CAAa;EAGbV,IAAAA,EAAAA,MAAAA;AAIjB;AAGiBE,UAPAF,YAOgBQ,CAAAA,CAAAA,CAAAA,SAPQE,aAOiB,CAAA;EAIzCP,EAAAA,EAAAA,KAAAA;EAIAC,KAAAA,EAbNI,CAaMJ;AAIjB;AAIiBE,UAnBAL,eAAAA,SAAwBS,aAmBa,CAAA;EAIrCC,EAAAA,EAAAA,QAAAA;;AAA6BF,UApB7BP,gBAoB6BO,CAAAA,CAAAA,CAAAA,SApBDC,aAoBCD,CAAAA;EAC7BD,EAAAA,EAAAA,SAAAA;EADuBI,KAAAA,EAlB7BJ,CAkB6BI;AAAK;AAyCrBG,UAzDPZ,aAAAA,SAAsBO,aAyDL,CAAA;EAAcF,EAAAA,EAAAA,MAAAA;EAAwBT,IAAAA,EAAAA,MAAAA;;AAAoDS,UArD3GJ,aAAAA,SAAsBM,aAqDqFF,CAAAA;EAAVD,EAAAA,EAAAA,MAAAA;EAA0FC,IAAAA,EAAAA,MAAAA;;AAAD,UAjD1LH,aAiD0L,CAAA,CAAA,CAAA,SAjDjKK,aAiDiK,CAAA;;SA/ChMF;;UAEMF,wBAAwBI;;SAE9BF;;UAEMG,uBAAuBC,MAAMH,gBAAgBD;eAC7CA;;;;;;;;;;;;;;;;iBAwCOO,wBAAwBP,UAAUQ,cAAcjB,0CAA0CQ,UAAUC,oEAAoEG,YAAYH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","names":["PatchError","_deepClone","JsonPatchError","deepClone","Operation","AddOperation","RemoveOperation","ReplaceOperation","MoveOperation","CopyOperation","TestOperation","GetOperation","Validator","T","OperationResult","BaseOperation","PatchResult","Array","getValueByPointer","applyOperation","applyPatch","ReadonlyArray","applyReducer","validator","validate","_areEquals"],"sources":["../../../../src/utils/fast-json-patch/src/core.d.ts"],"sourcesContent":["import { PatchError, _deepClone } from \"./helpers.js\";\nexport declare const JsonPatchError: typeof PatchError;\nexport declare const deepClone: typeof _deepClone;\nexport type Operation = AddOperation<any> | RemoveOperation | ReplaceOperation<any> | MoveOperation | CopyOperation | TestOperation<any> | GetOperation<any>;\nexport interface Validator<T> {\n (operation: Operation, index: number, document: T, existingPathFragment: string): void;\n}\nexport interface OperationResult<T> {\n removed?: any;\n test?: boolean;\n newDocument: T;\n}\nexport interface BaseOperation {\n path: string;\n}\nexport interface AddOperation<T> extends BaseOperation {\n op: \"add\";\n value: T;\n}\nexport interface RemoveOperation extends BaseOperation {\n op: \"remove\";\n}\nexport interface ReplaceOperation<T> extends BaseOperation {\n op: \"replace\";\n value: T;\n}\nexport interface MoveOperation extends BaseOperation {\n op: \"move\";\n from: string;\n}\nexport interface CopyOperation extends BaseOperation {\n op: \"copy\";\n from: string;\n}\nexport interface TestOperation<T> extends BaseOperation {\n op: \"test\";\n value: T;\n}\nexport interface GetOperation<T> extends BaseOperation {\n op: \"_get\";\n value: T;\n}\nexport interface PatchResult<T> extends Array<OperationResult<T>> {\n newDocument: T;\n}\n/**\n * Retrieves a value from a JSON document by a JSON pointer.\n * Returns the value.\n *\n * @param document The document to get the value from\n * @param pointer an escaped JSON pointer\n * @return The retrieved value\n */\nexport declare function getValueByPointer(document: any, pointer: string): any;\n/**\n * Apply a single JSON Patch Operation on a JSON document.\n * Returns the {newDocument, result} of the operation.\n * It modifies the `document` and `operation` objects - it gets the values by reference.\n * If you would like to avoid touching your values, clone them:\n * `jsonpatch.applyOperation(document, jsonpatch._deepClone(operation))`.\n *\n * @param document The document to patch\n * @param operation The operation to apply\n * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.\n * @param mutateDocument Whether to mutate the original document or clone it before applying\n * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.\n * @return `{newDocument, result}` after the operation\n */\nexport declare function applyOperation<T>(document: T, operation: Operation, validateOperation?: boolean | Validator<T>, mutateDocument?: boolean, banPrototypeModifications?: boolean, index?: number): OperationResult<T>;\n/**\n * Apply a full JSON Patch array on a JSON document.\n * Returns the {newDocument, result} of the patch.\n * It modifies the `document` object and `patch` - it gets the values by reference.\n * If you would like to avoid touching your values, clone them:\n * `jsonpatch.applyPatch(document, jsonpatch._deepClone(patch))`.\n *\n * @param document The document to patch\n * @param patch The patch to apply\n * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.\n * @param mutateDocument Whether to mutate the original document or clone it before applying\n * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.\n * @return An array of `{newDocument, result}` after the patch\n */\nexport declare function applyPatch<T>(document: T, patch: ReadonlyArray<Operation>, validateOperation?: boolean | Validator<T>, mutateDocument?: boolean, banPrototypeModifications?: boolean): PatchResult<T>;\n/**\n * Apply a single JSON Patch Operation on a JSON document.\n * Returns the updated document.\n * Suitable as a reducer.\n *\n * @param document The document to patch\n * @param operation The operation to apply\n * @return The updated document\n */\nexport declare function applyReducer<T>(document: T, operation: Operation, index: number): T;\n/**\n * Validates a single operation. Called from `jsonpatch.validate`. Throws `JsonPatchError` in case of an error.\n * @param {object} operation - operation object (patch)\n * @param {number} index - index of operation in the sequence\n * @param {object} [document] - object where the operation is supposed to be applied\n * @param {string} [existingPathFragment] - comes along with `document`\n */\nexport declare function validator(operation: Operation, index: number, document?: any, existingPathFragment?: string): void;\n/**\n * Validates a sequence of operations. If `document` parameter is provided, the sequence is additionally validated against the object document.\n * If error is encountered, returns a JsonPatchError object\n * @param sequence\n * @param document\n * @returns {JsonPatchError|undefined}\n */\nexport declare function validate<T>(sequence: ReadonlyArray<Operation>, document?: T, externalValidator?: Validator<T>): PatchError;\nexport declare function _areEquals(a: any, b: any): boolean;\n//# sourceMappingURL=core.d.ts.map"],"mappings":";;AAG4CM,KAAhCF,SAAAA,GAAYC,YAAoBC,CAAAA,GAAAA,CAAAA,GAAAA,eAAAA,GAAkBC,gBAAlBD,CAAAA,GAAAA,CAAAA,GAA0CE,aAA1CF,GAA0DG,aAA1DH,GAA0EI,aAA1EJ,CAAAA,GAAAA,CAAAA,GAA+FK,YAA/FL,CAAAA,GAAAA,CAAAA;AAAkBC,UAC7CK,SAD6CL,CAAAA,CAAAA,CAAAA,CAAAA;EAAwBC,CAAAA,SAAAA,EAEtEJ,SAFsEI,EAAAA,KAAAA,EAAAA,MAAAA,EAAAA,QAAAA,EAElCK,CAFkCL,EAAAA,oBAAAA,EAAAA,MAAAA,CAAAA,EAAAA,IAAAA;;AAAgCE,UAIrGI,eAJqGJ,CAAAA,CAAAA,CAAAA,CAAAA;EAAqBC,OAAAA,CAAAA,EAAAA,GAAAA;EAAY,IAAA,CAAA,EAAA,OAAA;EACtIC,WAAAA,EAMAC,CANS;AAG1B;AAKiBE,UAAAA,aAAAA,CAAa;EAGbV,IAAAA,EAAAA,MAAAA;AAIjB;AAGiBE,UAPAF,YAOgBQ,CAAAA,CAAAA,CAAAA,SAPQE,aAOiB,CAAA;EAIzCP,EAAAA,EAAAA,KAAAA;EAIAC,KAAAA,EAbNI,CAaMJ;AAIjB;AAIiBE,UAnBAL,eAAAA,SAAwBS,aAmBa,CAAA;EAIrCC,EAAAA,EAAAA,QAAAA;;AAA6BF,UApB7BP,gBAoB6BO,CAAAA,CAAAA,CAAAA,SApBDC,aAoBCD,CAAAA;EAC7BD,EAAAA,EAAAA,SAAAA;EADuBI,KAAAA,EAlB7BJ,CAkB6BI;AAAK;AAyCrBG,UAzDPZ,aAAAA,SAAsBO,aAyDL,CAAA;EAAcF,EAAAA,EAAAA,MAAAA;EAAwBT,IAAAA,EAAAA,MAAAA;;AAAoDS,UArD3GJ,aAAAA,SAAsBM,aAqDqFF,CAAAA;EAAVD,EAAAA,EAAAA,MAAAA;EAA0FC,IAAAA,EAAAA,MAAAA;;AAAD,UAjD1LH,aAiD0L,CAAA,CAAA,CAAA,SAjDjKK,aAiDiK,CAAA;;SA/ChMF;;UAEMF,wBAAwBI;;SAE9BF;;UAEMG,uBAAuBC,MAAMH,gBAAgBD;eAC7CA;;;;;;;;;;;;;;;;iBAwCOO,wBAAwBP,UAAUQ,cAAcjB,0CAA0CQ,UAAUC,oEAAoEG,YAAYH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duplex.d.cts","names":["Operation","Observer","T","unobserve","observe","Object","Array","generate","compare"],"sources":["../../../../src/utils/fast-json-patch/src/duplex.d.ts"],"sourcesContent":["import { Operation } from \"./core.js\";\nexport interface Observer<T> {\n object: T;\n patches: Operation[];\n unobserve: () => void;\n callback: (patches: Operation[]) => void;\n}\n/**\n * Detach an observer from an object\n */\nexport declare function unobserve<T>(root: T, observer: Observer<T>): void;\n/**\n * Observes changes made to an object, which can then be retrieved using generate\n */\nexport declare function observe<T>(obj: Object | Array<T>, callback?: (patches: Operation[]) => void): Observer<T>;\n/**\n * Generate an array of patches from an observer\n */\nexport declare function generate<T>(observer: Observer<Object>, invertible?: boolean): Operation[];\n/**\n * Create an array of patches from the differences in two objects\n */\nexport declare function compare(tree1: Object | Array<any>, tree2: Object | Array<any>, invertible?: boolean): Operation[];\n//# sourceMappingURL=duplex.d.ts.map"],"mappings":";;;;;;;iBAsBwBQ,OAAAA,QAAeH,SAASC,mBAAmBD,SAASC,mCAAmCN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duplex.d.ts","names":["Operation","Observer","T","unobserve","observe","Object","Array","generate","compare"],"sources":["../../../../src/utils/fast-json-patch/src/duplex.d.ts"],"sourcesContent":["import { Operation } from \"./core.js\";\nexport interface Observer<T> {\n object: T;\n patches: Operation[];\n unobserve: () => void;\n callback: (patches: Operation[]) => void;\n}\n/**\n * Detach an observer from an object\n */\nexport declare function unobserve<T>(root: T, observer: Observer<T>): void;\n/**\n * Observes changes made to an object, which can then be retrieved using generate\n */\nexport declare function observe<T>(obj: Object | Array<T>, callback?: (patches: Operation[]) => void): Observer<T>;\n/**\n * Generate an array of patches from an observer\n */\nexport declare function generate<T>(observer: Observer<Object>, invertible?: boolean): Operation[];\n/**\n * Create an array of patches from the differences in two objects\n */\nexport declare function compare(tree1: Object | Array<any>, tree2: Object | Array<any>, invertible?: boolean): Operation[];\n//# sourceMappingURL=duplex.d.ts.map"],"mappings":";;;;;;;iBAsBwBQ,OAAAA,QAAeH,SAASC,mBAAmBD,SAASC,mCAAmCN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.cts","names":["Converter","T","U","ConverterPair"],"sources":["../../src/utils/format.d.ts"],"sourcesContent":["/**\n * A function that converts data from one format to another.\n *\n * This is commonly used for transforming message content blocks between different\n * provider-specific formats and standardized internal representations.\n *\n * @template T - The input type to convert from\n * @template U - The output type to convert to\n *\n * @param input - The data to convert\n * @returns The converted data in the target format\n *\n * @example\n * ```typescript\n * // Convert from OpenAI format to standard format\n * const converter: Converter<OpenAIBlock, ContentBlock.Standard> = (block) => {\n * return { type: \"text\", text: block.text };\n * };\n * ```\n */\nexport type Converter<T, U> = (input: T) => U;\n/**\n * A pair of bidirectional conversion functions for transforming data between two formats.\n *\n * This type is used throughout the message system to enable conversion between\n * provider-specific message formats (like OpenAI, Anthropic, Google, etc.) and\n * standardized internal content block representations. The `encode` function\n * typically converts from a standard format to a provider-specific format, while\n * `decode` converts from a provider-specific format back to the standard format.\n *\n * @template T - The first format (typically the standard/internal format)\n * @template U - The second format (typically the provider-specific format)\n *\n * @property encode - Converts from format T to format U\n * @property decode - Converts from format U back to format T\n *\n * @example\n * ```typescript\n * // Converter pair for OpenAI message blocks\n * const openAIConverter: ConverterPair<ContentBlock.Standard, OpenAIBlock> = {\n * encode: (standard) => ({ text: standard.text }),\n * decode: (openai) => ({ type: \"text\", text: openai.text })\n * };\n *\n * // Usage\n * const standardBlock = { type: \"text\", text: \"Hello\" };\n * const openaiBlock = openAIConverter.encode(standardBlock);\n * const backToStandard = openAIConverter.decode(openaiBlock);\n * ```\n */\nexport type ConverterPair<T, U> = {\n encode: Converter<T, U>;\n decode: Converter<U, T>;\n};\n//# sourceMappingURL=format.d.ts.map"],"mappings":";;AAoBA;AA8BA;;;;;;;AAEqB;;;;;;;;;;;KAhCTA,0BAA0BC,MAAMC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BhCC;UACAH,UAAUC,GAAGC;UACbF,UAAUE,GAAGD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","names":["Converter","T","U","ConverterPair"],"sources":["../../src/utils/format.d.ts"],"sourcesContent":["/**\n * A function that converts data from one format to another.\n *\n * This is commonly used for transforming message content blocks between different\n * provider-specific formats and standardized internal representations.\n *\n * @template T - The input type to convert from\n * @template U - The output type to convert to\n *\n * @param input - The data to convert\n * @returns The converted data in the target format\n *\n * @example\n * ```typescript\n * // Convert from OpenAI format to standard format\n * const converter: Converter<OpenAIBlock, ContentBlock.Standard> = (block) => {\n * return { type: \"text\", text: block.text };\n * };\n * ```\n */\nexport type Converter<T, U> = (input: T) => U;\n/**\n * A pair of bidirectional conversion functions for transforming data between two formats.\n *\n * This type is used throughout the message system to enable conversion between\n * provider-specific message formats (like OpenAI, Anthropic, Google, etc.) and\n * standardized internal content block representations. The `encode` function\n * typically converts from a standard format to a provider-specific format, while\n * `decode` converts from a provider-specific format back to the standard format.\n *\n * @template T - The first format (typically the standard/internal format)\n * @template U - The second format (typically the provider-specific format)\n *\n * @property encode - Converts from format T to format U\n * @property decode - Converts from format U back to format T\n *\n * @example\n * ```typescript\n * // Converter pair for OpenAI message blocks\n * const openAIConverter: ConverterPair<ContentBlock.Standard, OpenAIBlock> = {\n * encode: (standard) => ({ text: standard.text }),\n * decode: (openai) => ({ type: \"text\", text: openai.text })\n * };\n *\n * // Usage\n * const standardBlock = { type: \"text\", text: \"Hello\" };\n * const openaiBlock = openAIConverter.encode(standardBlock);\n * const backToStandard = openAIConverter.decode(openaiBlock);\n * ```\n */\nexport type ConverterPair<T, U> = {\n encode: Converter<T, U>;\n decode: Converter<U, T>;\n};\n//# sourceMappingURL=format.d.ts.map"],"mappings":";;AAoBA;AA8BA;;;;;;;AAEqB;;;;;;;;;;;KAhCTA,0BAA0BC,MAAMC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BhCC;UACAH,UAAUC,GAAGC;UACbF,UAAUE,GAAGD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function_calling.d.cts","names":["StructuredToolInterface","StructuredToolParams","FunctionDefinition","ToolDefinition","RunnableToolLike","isStructuredTool","isStructuredToolParams","isRunnableToolLike","isLangChainTool","convertToOpenAIFunction","convertToOpenAITool","Record"],"sources":["../../src/utils/function_calling.d.ts"],"sourcesContent":["import { StructuredToolInterface, StructuredToolParams } from \"../tools/types.js\";\nimport { FunctionDefinition, ToolDefinition } from \"../language_models/base.js\";\nimport { RunnableToolLike } from \"../runnables/base.js\";\nexport { isStructuredTool, isStructuredToolParams, isRunnableToolLike, isLangChainTool, } from \"../tools/types.js\";\n/**\n * Formats a `StructuredTool` or `RunnableToolLike` instance into a format\n * that is compatible with OpenAI function calling. If `StructuredTool` or\n * `RunnableToolLike` has a zod schema, the output will be converted into a\n * JSON schema, which is then used as the parameters for the OpenAI tool.\n *\n * @param {StructuredToolInterface | RunnableToolLike} tool The tool to convert to an OpenAI function.\n * @returns {FunctionDefinition} The inputted tool in OpenAI function format.\n */\nexport declare function convertToOpenAIFunction(tool: StructuredToolInterface | RunnableToolLike | StructuredToolParams, fields?: {\n /**\n * If `true`, model output is guaranteed to exactly match the JSON Schema\n * provided in the function definition.\n */\n strict?: boolean;\n} | number): FunctionDefinition;\n/**\n * Formats a `StructuredTool` or `RunnableToolLike` instance into a\n * format that is compatible with OpenAI tool calling. If `StructuredTool` or\n * `RunnableToolLike` has a zod schema, the output will be converted into a\n * JSON schema, which is then used as the parameters for the OpenAI tool.\n *\n * @param {StructuredToolInterface | Record<string, any> | RunnableToolLike} tool The tool to convert to an OpenAI tool.\n * @returns {ToolDefinition} The inputted tool in OpenAI tool format.\n */\nexport declare function convertToOpenAITool(tool: StructuredToolInterface | Record<string, any> | RunnableToolLike, fields?: {\n /**\n * If `true`, model output is guaranteed to exactly match the JSON Schema\n * provided in the function definition.\n */\n strict?: boolean;\n} | number): ToolDefinition;\n//# sourceMappingURL=function_calling.d.ts.map"],"mappings":";;;;;;;AAaA;;;;;AAM+B;AAU/B;;AAA4EW,iBAhBpDF,uBAAAA,CAgBoDE,IAAAA,EAhBtBX,uBAgBsBW,GAhBIP,gBAgBJO,GAhBuBV,oBAgBvBU,EAAAA,OAAAA,EAAAA;EAAsBP;;AAMvE;;;aAhBdF;;;;;;;;;;iBAUWQ,mBAAAA,OAA0BV,0BAA0BW,sBAAsBP;;;;;;aAMrFD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function_calling.d.ts","names":["StructuredToolInterface","StructuredToolParams","FunctionDefinition","ToolDefinition","RunnableToolLike","isStructuredTool","isStructuredToolParams","isRunnableToolLike","isLangChainTool","convertToOpenAIFunction","convertToOpenAITool","Record"],"sources":["../../src/utils/function_calling.d.ts"],"sourcesContent":["import { StructuredToolInterface, StructuredToolParams } from \"../tools/types.js\";\nimport { FunctionDefinition, ToolDefinition } from \"../language_models/base.js\";\nimport { RunnableToolLike } from \"../runnables/base.js\";\nexport { isStructuredTool, isStructuredToolParams, isRunnableToolLike, isLangChainTool, } from \"../tools/types.js\";\n/**\n * Formats a `StructuredTool` or `RunnableToolLike` instance into a format\n * that is compatible with OpenAI function calling. If `StructuredTool` or\n * `RunnableToolLike` has a zod schema, the output will be converted into a\n * JSON schema, which is then used as the parameters for the OpenAI tool.\n *\n * @param {StructuredToolInterface | RunnableToolLike} tool The tool to convert to an OpenAI function.\n * @returns {FunctionDefinition} The inputted tool in OpenAI function format.\n */\nexport declare function convertToOpenAIFunction(tool: StructuredToolInterface | RunnableToolLike | StructuredToolParams, fields?: {\n /**\n * If `true`, model output is guaranteed to exactly match the JSON Schema\n * provided in the function definition.\n */\n strict?: boolean;\n} | number): FunctionDefinition;\n/**\n * Formats a `StructuredTool` or `RunnableToolLike` instance into a\n * format that is compatible with OpenAI tool calling. If `StructuredTool` or\n * `RunnableToolLike` has a zod schema, the output will be converted into a\n * JSON schema, which is then used as the parameters for the OpenAI tool.\n *\n * @param {StructuredToolInterface | Record<string, any> | RunnableToolLike} tool The tool to convert to an OpenAI tool.\n * @returns {ToolDefinition} The inputted tool in OpenAI tool format.\n */\nexport declare function convertToOpenAITool(tool: StructuredToolInterface | Record<string, any> | RunnableToolLike, fields?: {\n /**\n * If `true`, model output is guaranteed to exactly match the JSON Schema\n * provided in the function definition.\n */\n strict?: boolean;\n} | number): ToolDefinition;\n//# sourceMappingURL=function_calling.d.ts.map"],"mappings":";;;;;;;AAaA;;;;;AAM+B;AAU/B;;AAA4EW,iBAhBpDF,uBAAAA,CAgBoDE,IAAAA,EAhBtBX,uBAgBsBW,GAhBIP,gBAgBJO,GAhBuBV,oBAgBvBU,EAAAA,OAAAA,EAAAA;EAAsBP;;AAMvE;;;aAhBdF;;;;;;;;;;iBAUWQ,mBAAAA,OAA0BV,0BAA0BW,sBAAsBP;;;;;;aAMrFD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.d.cts","names":["sha256","HashKeyEncoder"],"sources":["../../src/utils/hash.d.ts"],"sourcesContent":["export { sha256 } from \"./js-sha256/hash.js\";\n/**\n * A function type for encoding hash keys.\n * Accepts any number of string arguments (such as prompt and LLM key)\n * and returns a single string to be used as the hash key.\n */\nexport type HashKeyEncoder = (...strings: string[]) => string;\n//# sourceMappingURL=hash.d.ts.map"],"mappings":";;;;;;AAMA;;;KAAYC,cAAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.d.ts","names":["sha256","HashKeyEncoder"],"sources":["../../src/utils/hash.d.ts"],"sourcesContent":["export { sha256 } from \"./js-sha256/hash.js\";\n/**\n * A function type for encoding hash keys.\n * Accepts any number of string arguments (such as prompt and LLM key)\n * and returns a single string to be used as the hash key.\n */\nexport type HashKeyEncoder = (...strings: string[]) => string;\n//# sourceMappingURL=hash.d.ts.map"],"mappings":";;;;;;AAMA;;;KAAYC,cAAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
//#region
|
|
2
|
+
//#region src/utils/is-network-error/index.js
|
|
3
3
|
const objectToString = Object.prototype.toString;
|
|
4
4
|
const isError = (value) => objectToString.call(value) === "[object Error]";
|
|
5
5
|
const errorMessages = new Set([
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../src/utils/is-network-error/index.js"],"sourcesContent":["/* eslint-disable */\nconst objectToString = Object.prototype.toString;\n\nconst isError = (value) => objectToString.call(value) === \"[object Error]\";\n\nconst errorMessages = new Set([\n \"network error\", // Chrome\n \"Failed to fetch\", // Chrome\n \"NetworkError when attempting to fetch resource.\", // Firefox\n \"The Internet connection appears to be offline.\", // Safari 16\n \"Network request failed\", // `cross-fetch`\n \"fetch failed\", // Undici (Node.js)\n \"terminated\", // Undici (Node.js)\n \" A network error occurred.\", // Bun (WebKit)\n \"Network connection lost\", // Cloudflare Workers (fetch)\n]);\n\nexport default function isNetworkError(error) {\n const isValid =\n error &&\n isError(error) &&\n error.name === \"TypeError\" &&\n typeof error.message === \"string\";\n\n if (!isValid) {\n return false;\n }\n\n const { message, stack } = error;\n\n // Safari 17+ has generic message but no stack for network errors\n if (message === \"Load failed\") {\n return (\n stack === undefined ||\n // Sentry adds its own stack trace to the fetch error, so also check for that\n \"__sentry_captured__\" in error\n );\n }\n\n // Deno network errors start with specific text\n if (message.startsWith(\"error sending request for url\")) {\n return true;\n }\n\n // Standard network error messages\n return errorMessages.has(message);\n}\n"],"mappings":";;AACA,MAAM,iBAAiB,OAAO,UAAU;AAExC,MAAM,UAAU,CAAC,UAAU,eAAe,KAAK,MAAM,KAAK;AAE1D,MAAM,gBAAgB,IAAI,IAAI;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;AAED,SAAwB,eAAe,OAAO;CAC5C,MAAM,UACJ,SACA,QAAQ,MAAM,IACd,MAAM,SAAS,eACf,OAAO,MAAM,YAAY;AAE3B,KAAI,CAAC,QACH,QAAO;CAGT,MAAM,EAAE,SAAS,OAAO,GAAG;AAG3B,KAAI,YAAY,cACd,QACE,UAAU,UAEV,yBAAyB;AAK7B,KAAI,QAAQ,WAAW,gCAAgC,CACrD,QAAO;AAIT,QAAO,cAAc,IAAI,QAAQ;AAClC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region src/utils/is-network-error/index.js
|
|
2
2
|
const objectToString = Object.prototype.toString;
|
|
3
3
|
const isError = (value) => objectToString.call(value) === "[object Error]";
|
|
4
4
|
const errorMessages = new Set([
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/utils/is-network-error/index.js"],"sourcesContent":["/* eslint-disable */\nconst objectToString = Object.prototype.toString;\n\nconst isError = (value) => objectToString.call(value) === \"[object Error]\";\n\nconst errorMessages = new Set([\n \"network error\", // Chrome\n \"Failed to fetch\", // Chrome\n \"NetworkError when attempting to fetch resource.\", // Firefox\n \"The Internet connection appears to be offline.\", // Safari 16\n \"Network request failed\", // `cross-fetch`\n \"fetch failed\", // Undici (Node.js)\n \"terminated\", // Undici (Node.js)\n \" A network error occurred.\", // Bun (WebKit)\n \"Network connection lost\", // Cloudflare Workers (fetch)\n]);\n\nexport default function isNetworkError(error) {\n const isValid =\n error &&\n isError(error) &&\n error.name === \"TypeError\" &&\n typeof error.message === \"string\";\n\n if (!isValid) {\n return false;\n }\n\n const { message, stack } = error;\n\n // Safari 17+ has generic message but no stack for network errors\n if (message === \"Load failed\") {\n return (\n stack === undefined ||\n // Sentry adds its own stack trace to the fetch error, so also check for that\n \"__sentry_captured__\" in error\n );\n }\n\n // Deno network errors start with specific text\n if (message.startsWith(\"error sending request for url\")) {\n return true;\n }\n\n // Standard network error messages\n return errorMessages.has(message);\n}\n"],"mappings":";AACA,MAAM,iBAAiB,OAAO,UAAU;AAExC,MAAM,UAAU,CAAC,UAAU,eAAe,KAAK,MAAM,KAAK;AAE1D,MAAM,gBAAgB,IAAI,IAAI;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;AAED,SAAwB,eAAe,OAAO;CAC5C,MAAM,UACJ,SACA,QAAQ,MAAM,IACd,MAAM,SAAS,eACf,OAAO,MAAM,YAAY;AAE3B,KAAI,CAAC,QACH,QAAO;CAGT,MAAM,EAAE,SAAS,OAAO,GAAG;AAG3B,KAAI,YAAY,cACd,QACE,UAAU,UAEV,yBAAyB;AAK7B,KAAI,QAAQ,WAAW,gCAAgC,CACrD,QAAO;AAIT,QAAO,cAAc,IAAI,QAAQ;AAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.d.cts","names":["sha256"],"sources":["../../../src/utils/js-sha256/hash.d.ts"],"sourcesContent":["export declare const sha256: (...strings: string[]) => any;\n//# sourceMappingURL=hash.d.ts.map"],"mappings":";cAAqBA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.d.ts","names":["sha256"],"sources":["../../../src/utils/js-sha256/hash.d.ts"],"sourcesContent":["export declare const sha256: (...strings: string[]) => any;\n//# sourceMappingURL=hash.d.ts.map"],"mappings":";cAAqBA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.cts","names":["parseJsonMarkdown","parsePartialJson","strictParsePartialJson"],"sources":["../../src/utils/json.d.ts"],"sourcesContent":["export declare function parseJsonMarkdown(s: string, parser?: typeof parsePartialJson): any;\n/**\n * Recursive descent partial JSON parser.\n * @param s - The string to parse.\n * @returns The parsed value.\n * @throws Error if the input is a malformed JSON string.\n */\nexport declare function strictParsePartialJson(s: string): unknown;\nexport declare function parsePartialJson(s: string): any | null;\n//# sourceMappingURL=json.d.ts.map"],"mappings":";iBAAwBA,iBAAAA,4BAA6CC;iBAQ7CA,gBAAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","names":["parseJsonMarkdown","parsePartialJson","strictParsePartialJson"],"sources":["../../src/utils/json.d.ts"],"sourcesContent":["export declare function parseJsonMarkdown(s: string, parser?: typeof parsePartialJson): any;\n/**\n * Recursive descent partial JSON parser.\n * @param s - The string to parse.\n * @returns The parsed value.\n * @throws Error if the input is a malformed JSON string.\n */\nexport declare function strictParsePartialJson(s: string): unknown;\nexport declare function parsePartialJson(s: string): any | null;\n//# sourceMappingURL=json.d.ts.map"],"mappings":";iBAAwBA,iBAAAA,4BAA6CC;iBAQ7CA,gBAAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json_schema.d.cts","names":["InteropZodType","JsonSchema7Type","JSONSchema","deepCompareStrict","Validator","toJsonSchema","validatesOnlyStrings","JsonSchema7ArrayType","JsonSchema7ObjectType","JsonSchema7StringType","JsonSchema7NumberType","JsonSchema7NullableType"],"sources":["../../src/utils/json_schema.d.ts"],"sourcesContent":["import { InteropZodType } from \"./types/zod.js\";\nimport { type JsonSchema7Type as JSONSchema } from \"./zod-to-json-schema/index.js\";\nexport { deepCompareStrict, Validator } from \"@cfworker/json-schema\";\n/**\n * Converts a Zod schema or JSON schema to a JSON schema.\n * @param schema - The schema to convert.\n * @returns The converted schema.\n */\nexport declare function toJsonSchema(schema: InteropZodType | JSONSchema): JSONSchema;\n/**\n * Validates if a JSON schema validates only strings. May return false negatives in some edge cases\n * (like recursive or unresolvable refs).\n *\n * @param schema - The schema to validate.\n * @returns `true` if the schema validates only strings, `false` otherwise.\n */\nexport declare function validatesOnlyStrings(schema: unknown): boolean;\nexport { type JsonSchema7Type, type JsonSchema7Type as JSONSchema, type JsonSchema7ArrayType, type JsonSchema7ObjectType, type JsonSchema7StringType, type JsonSchema7NumberType, type JsonSchema7NullableType, } from \"./zod-to-json-schema/index.js\";\n//# sourceMappingURL=json_schema.d.ts.map"],"mappings":";;;;;;;;;;;;;;;iBAQwBK,YAAAA,SAAqBL,iBAAiBE,kBAAaA;;AAA3E;;;;AAAqF;AAQrF;iBAAwBI,oBAAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json_schema.d.ts","names":["InteropZodType","JsonSchema7Type","JSONSchema","deepCompareStrict","Validator","toJsonSchema","validatesOnlyStrings","JsonSchema7ArrayType","JsonSchema7ObjectType","JsonSchema7StringType","JsonSchema7NumberType","JsonSchema7NullableType"],"sources":["../../src/utils/json_schema.d.ts"],"sourcesContent":["import { InteropZodType } from \"./types/zod.js\";\nimport { type JsonSchema7Type as JSONSchema } from \"./zod-to-json-schema/index.js\";\nexport { deepCompareStrict, Validator } from \"@cfworker/json-schema\";\n/**\n * Converts a Zod schema or JSON schema to a JSON schema.\n * @param schema - The schema to convert.\n * @returns The converted schema.\n */\nexport declare function toJsonSchema(schema: InteropZodType | JSONSchema): JSONSchema;\n/**\n * Validates if a JSON schema validates only strings. May return false negatives in some edge cases\n * (like recursive or unresolvable refs).\n *\n * @param schema - The schema to validate.\n * @returns `true` if the schema validates only strings, `false` otherwise.\n */\nexport declare function validatesOnlyStrings(schema: unknown): boolean;\nexport { type JsonSchema7Type, type JsonSchema7Type as JSONSchema, type JsonSchema7ArrayType, type JsonSchema7ObjectType, type JsonSchema7StringType, type JsonSchema7NumberType, type JsonSchema7NullableType, } from \"./zod-to-json-schema/index.js\";\n//# sourceMappingURL=json_schema.d.ts.map"],"mappings":";;;;;;;;;;;;;;;;iBAQwBK,YAAAA,SAAqBL,iBAAiBE,kBAAaA;;;AAA3E;;;;AAAqF;AAQ7DI,iBAAAA,oBAAAA,CAAoB,MAAA,EAAA,OAAA,CAAA,EAAA,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.d.cts","names":["VectorFunction","matrixFunc","normalize","cosineSimilarity","innerProduct","euclideanDistance","maximalMarginalRelevance"],"sources":["../../src/utils/math.d.ts"],"sourcesContent":["type VectorFunction = (xVector: number[], yVector: number[]) => number;\n/**\n * Apply a row-wise function between two matrices with the same number of columns.\n *\n * @param {number[][]} X - The first matrix.\n * @param {number[][]} Y - The second matrix.\n * @param {VectorFunction} func - The function to apply.\n *\n * @throws {Error} If the number of columns in X and Y are not the same.\n *\n * @returns {number[][] | [[]]} A matrix where each row represents the result of applying the function between the corresponding rows of X and Y.\n */\nexport declare function matrixFunc(X: number[][], Y: number[][], func: VectorFunction): number[][];\nexport declare function normalize(M: number[][], similarity?: boolean): number[][];\n/**\n * This function calculates the row-wise cosine similarity between two matrices with the same number of columns.\n *\n * @param {number[][]} X - The first matrix.\n * @param {number[][]} Y - The second matrix.\n *\n * @throws {Error} If the number of columns in X and Y are not the same.\n *\n * @returns {number[][] | [[]]} A matrix where each row represents the cosine similarity values between the corresponding rows of X and Y.\n */\nexport declare function cosineSimilarity(X: number[][], Y: number[][]): number[][];\nexport declare function innerProduct(X: number[][], Y: number[][]): number[][];\nexport declare function euclideanDistance(X: number[][], Y: number[][]): number[][];\n/**\n * This function implements the Maximal Marginal Relevance algorithm\n * to select a set of embeddings that maximizes the diversity and relevance to a query embedding.\n *\n * @param {number[]|number[][]} queryEmbedding - The query embedding.\n * @param {number[][]} embeddingList - The list of embeddings to select from.\n * @param {number} [lambda=0.5] - The trade-off parameter between relevance and diversity.\n * @param {number} [k=4] - The maximum number of embeddings to select.\n *\n * @returns {number[]} The indexes of the selected embeddings in the embeddingList.\n */\nexport declare function maximalMarginalRelevance(queryEmbedding: number[] | number[][], embeddingList: number[][], lambda?: number, k?: number): number[];\nexport {};\n//# sourceMappingURL=math.d.ts.map"],"mappings":";KAAKA,cAAAA;;AAYL;AACA;AAWA;AACA;AACA;AAYA;;;;;iBA1BwBC,UAAAA,qCAA+CD;iBAC/CE,SAAAA;;;;;;;;;;;iBAWAC,gBAAAA;iBACAC,YAAAA;iBACAC,iBAAAA;;;;;;;;;;;;iBAYAC,wBAAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.d.ts","names":["VectorFunction","matrixFunc","normalize","cosineSimilarity","innerProduct","euclideanDistance","maximalMarginalRelevance"],"sources":["../../src/utils/math.d.ts"],"sourcesContent":["type VectorFunction = (xVector: number[], yVector: number[]) => number;\n/**\n * Apply a row-wise function between two matrices with the same number of columns.\n *\n * @param {number[][]} X - The first matrix.\n * @param {number[][]} Y - The second matrix.\n * @param {VectorFunction} func - The function to apply.\n *\n * @throws {Error} If the number of columns in X and Y are not the same.\n *\n * @returns {number[][] | [[]]} A matrix where each row represents the result of applying the function between the corresponding rows of X and Y.\n */\nexport declare function matrixFunc(X: number[][], Y: number[][], func: VectorFunction): number[][];\nexport declare function normalize(M: number[][], similarity?: boolean): number[][];\n/**\n * This function calculates the row-wise cosine similarity between two matrices with the same number of columns.\n *\n * @param {number[][]} X - The first matrix.\n * @param {number[][]} Y - The second matrix.\n *\n * @throws {Error} If the number of columns in X and Y are not the same.\n *\n * @returns {number[][] | [[]]} A matrix where each row represents the cosine similarity values between the corresponding rows of X and Y.\n */\nexport declare function cosineSimilarity(X: number[][], Y: number[][]): number[][];\nexport declare function innerProduct(X: number[][], Y: number[][]): number[][];\nexport declare function euclideanDistance(X: number[][], Y: number[][]): number[][];\n/**\n * This function implements the Maximal Marginal Relevance algorithm\n * to select a set of embeddings that maximizes the diversity and relevance to a query embedding.\n *\n * @param {number[]|number[][]} queryEmbedding - The query embedding.\n * @param {number[][]} embeddingList - The list of embeddings to select from.\n * @param {number} [lambda=0.5] - The trade-off parameter between relevance and diversity.\n * @param {number} [k=4] - The maximum number of embeddings to select.\n *\n * @returns {number[]} The indexes of the selected embeddings in the embeddingList.\n */\nexport declare function maximalMarginalRelevance(queryEmbedding: number[] | number[][], embeddingList: number[][], lambda?: number, k?: number): number[];\nexport {};\n//# sourceMappingURL=math.d.ts.map"],"mappings":";KAAKA,cAAAA;;AAYL;AACA;AAWA;AACA;AACA;AAYA;;;;;iBA1BwBC,UAAAA,qCAA+CD;iBAC/CE,SAAAA;;;;;;;;;;;iBAWAC,gBAAAA;iBACAC,YAAAA;iBACAC,iBAAAA;;;;;;;;;;;;iBAYAC,wBAAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"similarities.d.cts","names":["cosine"],"sources":["../../../src/utils/ml-distance/similarities.d.ts"],"sourcesContent":["/**\n * Returns the average of cosine distances between vectors a and b\n * @param a - first vector\n * @param b - second vector\n *\n */\nexport declare function cosine(a: number[], b: number[]): number;\n//# sourceMappingURL=similarities.d.ts.map"],"mappings":";;AAMA;;;;;iBAAwBA,MAAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"similarities.d.ts","names":["cosine"],"sources":["../../../src/utils/ml-distance/similarities.d.ts"],"sourcesContent":["/**\n * Returns the average of cosine distances between vectors a and b\n * @param a - first vector\n * @param b - second vector\n *\n */\nexport declare function cosine(a: number[], b: number[]): number;\n//# sourceMappingURL=similarities.d.ts.map"],"mappings":";;AAMA;;;;;iBAAwBA,MAAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_index = require('
|
|
1
|
+
const require_index = require('../is-network-error/index.cjs');
|
|
2
2
|
|
|
3
|
-
//#region
|
|
3
|
+
//#region src/utils/p-retry/index.js
|
|
4
4
|
function validateRetries(retries) {
|
|
5
5
|
if (typeof retries === "number") {
|
|
6
6
|
if (retries < 0) throw new TypeError("Expected `retries` to be a non-negative number.");
|