@nhtio/adk 0.1.0-master-e068b986 → 0.1.0-master-0c6d984f
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 +54 -9
- package/batteries/embeddings/openai/adapter.cjs +1 -1
- package/batteries/embeddings/openai/adapter.mjs +1 -1
- package/batteries/embeddings/webllm/adapter.cjs +1 -1
- package/batteries/embeddings/webllm/adapter.mjs +1 -1
- package/batteries/llm/ollama/adapter.cjs +5 -5
- package/batteries/llm/ollama/adapter.mjs +5 -5
- package/batteries/llm/ollama/helpers.cjs +2 -2
- package/batteries/llm/ollama/helpers.mjs +2 -2
- package/batteries/llm/ollama/validation.cjs +1 -1
- package/batteries/llm/ollama/validation.mjs +1 -1
- package/batteries/llm/openai_chat_completions/adapter.cjs +5 -5
- package/batteries/llm/openai_chat_completions/adapter.mjs +5 -5
- package/batteries/llm/openai_chat_completions/helpers.cjs +2 -2
- package/batteries/llm/openai_chat_completions/helpers.mjs +2 -2
- package/batteries/llm/openai_chat_completions/validation.cjs +1 -1
- package/batteries/llm/openai_chat_completions/validation.mjs +1 -1
- package/batteries/llm/webllm_chat_completions/adapter.cjs +5 -5
- package/batteries/llm/webllm_chat_completions/adapter.mjs +5 -5
- package/batteries/llm/webllm_chat_completions/validation.cjs +1 -1
- package/batteries/llm/webllm_chat_completions/validation.mjs +1 -1
- package/batteries/storage/flydrive.cjs +1 -1
- package/batteries/storage/flydrive.mjs +1 -1
- package/batteries/storage/in_memory.cjs +1 -1
- package/batteries/storage/in_memory.mjs +1 -1
- package/batteries/storage/opfs.cjs +1 -1
- package/batteries/storage/opfs.mjs +1 -1
- package/batteries/tools/_shared/index.d.ts +121 -0
- package/batteries/tools/_shared.cjs +157 -0
- package/batteries/tools/_shared.cjs.map +1 -0
- package/batteries/tools/_shared.mjs +149 -0
- package/batteries/tools/_shared.mjs.map +1 -0
- package/batteries/tools/color.cjs +2 -2
- package/batteries/tools/color.mjs +2 -2
- package/batteries/tools/comparison.cjs +3 -3
- package/batteries/tools/comparison.mjs +3 -3
- package/batteries/tools/data_structure.cjs +3 -3
- package/batteries/tools/data_structure.mjs +3 -3
- package/batteries/tools/datetime_extended.cjs +3 -3
- package/batteries/tools/datetime_extended.mjs +3 -3
- package/batteries/tools/datetime_math.cjs +3 -3
- package/batteries/tools/datetime_math.mjs +3 -3
- package/batteries/tools/encoding.cjs +3 -3
- package/batteries/tools/encoding.mjs +3 -3
- package/batteries/tools/formatting.cjs +3 -3
- package/batteries/tools/formatting.mjs +3 -3
- package/batteries/tools/geo_basics.cjs +2 -2
- package/batteries/tools/geo_basics.mjs +2 -2
- package/batteries/tools/index.d.ts +2 -0
- package/batteries/tools/math.cjs +3 -3
- package/batteries/tools/math.mjs +3 -3
- package/batteries/tools/memory.cjs +6 -6
- package/batteries/tools/memory.mjs +6 -6
- package/batteries/tools/parsing.cjs +4 -4
- package/batteries/tools/parsing.mjs +4 -4
- package/batteries/tools/retrievables.cjs +5 -5
- package/batteries/tools/retrievables.mjs +5 -5
- package/batteries/tools/scrapper/exceptions.d.ts +21 -0
- package/batteries/tools/scrapper/index.d.ts +172 -0
- package/batteries/tools/scrapper/shared.d.ts +139 -0
- package/batteries/tools/scrapper.cjs +8 -0
- package/batteries/tools/scrapper.mjs +2 -0
- package/batteries/tools/searxng/index.d.ts +47 -20
- package/batteries/tools/searxng.cjs +2 -1
- package/batteries/tools/searxng.mjs +2 -2
- package/batteries/tools/standing_instructions.cjs +4 -4
- package/batteries/tools/standing_instructions.mjs +4 -4
- package/batteries/tools/statistics.cjs +4 -4
- package/batteries/tools/statistics.mjs +4 -4
- package/batteries/tools/string_processing.cjs +3 -3
- package/batteries/tools/string_processing.mjs +3 -3
- package/batteries/tools/structured_data.cjs +3 -3
- package/batteries/tools/structured_data.mjs +3 -3
- package/batteries/tools/text_analysis.cjs +3 -3
- package/batteries/tools/text_analysis.mjs +3 -3
- package/batteries/tools/text_comparison.cjs +2 -2
- package/batteries/tools/text_comparison.mjs +2 -2
- package/batteries/tools/time.cjs +3 -3
- package/batteries/tools/time.mjs +3 -3
- package/batteries/tools/unit_conversion.cjs +2 -2
- package/batteries/tools/unit_conversion.mjs +2 -2
- package/batteries/tools/web_retrieval/index.d.ts +186 -0
- package/batteries/tools/web_retrieval.cjs +206 -0
- package/batteries/tools/web_retrieval.cjs.map +1 -0
- package/batteries/tools/web_retrieval.mjs +201 -0
- package/batteries/tools/web_retrieval.mjs.map +1 -0
- package/batteries/tools.cjs +13 -1
- package/batteries/tools.mjs +4 -2
- package/batteries/vector/arangodb.cjs +1 -1
- package/batteries/vector/arangodb.mjs +1 -1
- package/batteries/vector/clickhouse.cjs +1 -1
- package/batteries/vector/clickhouse.mjs +1 -1
- package/batteries/vector/cloudflare.cjs +1 -1
- package/batteries/vector/cloudflare.mjs +1 -1
- package/batteries/vector/couchbase.cjs +1 -1
- package/batteries/vector/couchbase.mjs +1 -1
- package/batteries/vector/duckdb.cjs +1 -1
- package/batteries/vector/duckdb.mjs +1 -1
- package/batteries/vector/elasticsearch.cjs +1 -1
- package/batteries/vector/elasticsearch.mjs +1 -1
- package/batteries/vector/filters.cjs +1 -1
- package/batteries/vector/filters.mjs +1 -1
- package/batteries/vector/hnswlib.cjs +1 -1
- package/batteries/vector/hnswlib.mjs +1 -1
- package/batteries/vector/lancedb.cjs +1 -1
- package/batteries/vector/lancedb.mjs +1 -1
- package/batteries/vector/mariadb.cjs +1 -1
- package/batteries/vector/mariadb.mjs +1 -1
- package/batteries/vector/meilisearch.cjs +1 -1
- package/batteries/vector/meilisearch.mjs +1 -1
- package/batteries/vector/migrate.cjs +1 -1
- package/batteries/vector/migrate.mjs +1 -1
- package/batteries/vector/mongodb.cjs +1 -1
- package/batteries/vector/mongodb.mjs +1 -1
- package/batteries/vector/neo4j.cjs +1 -1
- package/batteries/vector/neo4j.mjs +1 -1
- package/batteries/vector/opensearch.cjs +1 -1
- package/batteries/vector/opensearch.mjs +1 -1
- package/batteries/vector/oracle23ai.cjs +1 -1
- package/batteries/vector/oracle23ai.mjs +1 -1
- package/batteries/vector/pinecone.cjs +1 -1
- package/batteries/vector/pinecone.mjs +1 -1
- package/batteries/vector/redis.cjs +1 -1
- package/batteries/vector/redis.mjs +1 -1
- package/batteries/vector/retrievable.cjs +1 -1
- package/batteries/vector/retrievable.mjs +1 -1
- package/batteries/vector/s3vectors.cjs +1 -1
- package/batteries/vector/s3vectors.mjs +1 -1
- package/batteries/vector/solr.cjs +1 -1
- package/batteries/vector/solr.mjs +1 -1
- package/batteries/vector/surrealdb.cjs +1 -1
- package/batteries/vector/surrealdb.mjs +1 -1
- package/batteries/vector/typesense.cjs +1 -1
- package/batteries/vector/typesense.mjs +1 -1
- package/batteries/vector/vespa.cjs +1 -1
- package/batteries/vector/vespa.mjs +1 -1
- package/batteries/vector/weaviate.cjs +1 -1
- package/batteries/vector/weaviate.mjs +1 -1
- package/batteries.cjs +13 -1
- package/batteries.mjs +4 -2
- package/{common-DwyIhf5B.mjs → common-DYDUi99O.mjs} +7 -7
- package/{common-DwyIhf5B.mjs.map → common-DYDUi99O.mjs.map} +1 -1
- package/{common-Do0PmqEC.js → common-DZl3ADJs.js} +7 -7
- package/{common-Do0PmqEC.js.map → common-DZl3ADJs.js.map} +1 -1
- package/common.cjs +7 -7
- package/common.d.ts +1 -1
- package/common.mjs +7 -7
- package/{dispatch_runner-Bh12zRee.mjs → dispatch_runner--ZhdDWRZ.mjs} +3 -3
- package/{dispatch_runner-Bh12zRee.mjs.map → dispatch_runner--ZhdDWRZ.mjs.map} +1 -1
- package/{dispatch_runner-BCfDikZn.js → dispatch_runner-nHDKkxye.js} +3 -3
- package/{dispatch_runner-BCfDikZn.js.map → dispatch_runner-nHDKkxye.js.map} +1 -1
- package/dispatch_runner.cjs +1 -1
- package/dispatch_runner.mjs +1 -1
- package/eslint/rules.cjs +2 -2
- package/eslint/rules.mjs +2 -2
- package/eslint.cjs +3 -3
- package/eslint.mjs +3 -3
- package/forge.cjs +4 -4
- package/forge.mjs +4 -4
- package/guards.cjs +8 -8
- package/guards.mjs +8 -8
- package/index.cjs +10 -10
- package/index.mjs +10 -10
- package/mcp/adk-docs-corpus.json +1 -1
- package/package.json +202 -187
- package/scrapper-CR-MFDCm.js +462 -0
- package/scrapper-CR-MFDCm.js.map +1 -0
- package/scrapper-Djl6ga2K.mjs +432 -0
- package/scrapper-Djl6ga2K.mjs.map +1 -0
- package/{searxng-COD67eJC.js → searxng-CMhRD5xo.js} +84 -88
- package/searxng-CMhRD5xo.js.map +1 -0
- package/{searxng-oL3Z5Qo2.mjs → searxng-yWwuON_Y.mjs} +77 -87
- package/searxng-yWwuON_Y.mjs.map +1 -0
- package/skills/adk-assembly/SKILL.md +2 -2
- package/{spooled_artifact-BsM1EfRB.mjs → spooled_artifact-7eePq7JA.mjs} +3 -3
- package/{spooled_artifact-BsM1EfRB.mjs.map → spooled_artifact-7eePq7JA.mjs.map} +1 -1
- package/{spooled_artifact-B6XRZYFt.js → spooled_artifact-DX8LLyUX.js} +3 -3
- package/{spooled_artifact-B6XRZYFt.js.map → spooled_artifact-DX8LLyUX.js.map} +1 -1
- package/spooled_artifact.cjs +2 -2
- package/spooled_artifact.mjs +2 -2
- package/{spooled_markdown_artifact-DyevhaL6.js → spooled_markdown_artifact-ClX72lek.js} +3 -3
- package/{spooled_markdown_artifact-DyevhaL6.js.map → spooled_markdown_artifact-ClX72lek.js.map} +1 -1
- package/{spooled_markdown_artifact-DJnjD3Ti.mjs → spooled_markdown_artifact-wkrBF3oX.mjs} +3 -3
- package/{spooled_markdown_artifact-DJnjD3Ti.mjs.map → spooled_markdown_artifact-wkrBF3oX.mjs.map} +1 -1
- package/{thought-DzcSu2Y6.mjs → thought-B_vxAiKU.mjs} +3 -3
- package/{thought-DzcSu2Y6.mjs.map → thought-B_vxAiKU.mjs.map} +1 -1
- package/{thought-DhElxSkZ.js → thought-DLwpF7MI.js} +3 -3
- package/{thought-DhElxSkZ.js.map → thought-DLwpF7MI.js.map} +1 -1
- package/{tool-DjUJeSzk.js → tool-D5WGVIcI.js} +3 -3
- package/{tool-DjUJeSzk.js.map → tool-D5WGVIcI.js.map} +1 -1
- package/{tool-DMvZFz9h.mjs → tool-wMYMVl60.mjs} +3 -3
- package/{tool-DMvZFz9h.mjs.map → tool-wMYMVl60.mjs.map} +1 -1
- package/{tool_call-DhAW70EY.mjs → tool_call-B4-_-vjG.mjs} +4 -4
- package/{tool_call-DhAW70EY.mjs.map → tool_call-B4-_-vjG.mjs.map} +1 -1
- package/{tool_call-CGec5078.js → tool_call-DixVlW40.js} +4 -4
- package/{tool_call-CGec5078.js.map → tool_call-DixVlW40.js.map} +1 -1
- package/{tool_registry-BuMKln6b.mjs → tool_registry-791Vrjtf.mjs} +142 -142
- package/tool_registry-791Vrjtf.mjs.map +1 -0
- package/{tool_registry-C5wfDxaq.js → tool_registry-CKJPze3j.js} +141 -141
- package/tool_registry-CKJPze3j.js.map +1 -0
- package/{turn_runner-CfrZZ-ZJ.js → turn_runner-HXImLGIn.js} +5 -5
- package/{turn_runner-CfrZZ-ZJ.js.map → turn_runner-HXImLGIn.js.map} +1 -1
- package/{turn_runner-BQCupiHC.mjs → turn_runner-ZyYO-Kti.mjs} +5 -5
- package/{turn_runner-BQCupiHC.mjs.map → turn_runner-ZyYO-Kti.mjs.map} +1 -1
- package/turn_runner.cjs +1 -1
- package/turn_runner.mjs +1 -1
- package/searxng-COD67eJC.js.map +0 -1
- package/searxng-oL3Z5Qo2.mjs.map +0 -1
- package/tool_registry-BuMKln6b.mjs.map +0 -1
- package/tool_registry-C5wfDxaq.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -71,13 +71,55 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
71
71
|
|
|
72
72
|
### Added
|
|
73
73
|
|
|
74
|
+
- **Scrapper web-extraction tool battery (`@nhtio/adk/batteries/tools/scrapper`).** Tools for any
|
|
75
|
+
[Scrapper](https://github.com/amerkurev/scrapper) instance — a headless-browser service that gives
|
|
76
|
+
an agent browser-grade page reading (JS-rendered pages a plain fetch can't see) as a **stateless**
|
|
77
|
+
HTTP call: fresh incognito context per request, no stored session/cookies/credentials. Two verbs,
|
|
78
|
+
each with an async factory (accepts a dynamic-import `artifact` resolver) and a sync variant:
|
|
79
|
+
`createScrapperArticleTool`/`…Sync` (`/api/article`) and `createScrapperLinksTool`/`…Sync`
|
|
80
|
+
(`/api/links`). Like the SearXNG battery these are factories (not constants) and must not be
|
|
81
|
+
bulk-registered via `Object.values(batteries)`.
|
|
82
|
+
- **Per-parameter disposition** — for every modeled knob the factory chooses: `fixed` (pinned;
|
|
83
|
+
sent always, removed from the model schema), `defaults` (model-overridable), or open
|
|
84
|
+
(model-settable). `url` is always required; `fixedQuery` is a raw kebab passthrough for
|
|
85
|
+
un-modeled params, keeping the battery generic across instances/versions.
|
|
86
|
+
- **Two distinct header channels** — `config.headers` (static or sync/async resolver) authenticates
|
|
87
|
+
to the Scrapper *instance*; the `extra_http_headers` *param* (`'K:v;K2:v2'`) is what the scraper's
|
|
88
|
+
browser sends to the *target site*.
|
|
89
|
+
- Same SearXNG-style two-level output (`resultFormat` normalized/raw/either), `artifact` resolver,
|
|
90
|
+
and input/output middleware pipelines (`shortCircuit`, fresh runner per call). Errors degrade to
|
|
91
|
+
`Error:` strings (parses Scrapper's `{detail:[{msg}]}`; missing `url` → HTTP 422); bad config →
|
|
92
|
+
`E_INVALID_SCRAPPER_CONFIG`. Documented as a featured-battery page with TSDoc `@warning`s for the
|
|
93
|
+
`scroll_down`-needs-`sleep` and instance-relative-URI gotchas. Cross-env unit spec (stubbed
|
|
94
|
+
`fetch`, disposition, resolver, all-three-artifact round-trips) + env-gated live integration spec
|
|
95
|
+
(`TEST_SCRAPPER_URL` / `TEST_SCRAPPER_HEADERS`).
|
|
96
|
+
|
|
97
|
+
- **Web-retrieval RAG glue (`@nhtio/adk/batteries/tools/web_retrieval`).** The shared seam from
|
|
98
|
+
search/scrape results to turn `Retrievable`s, used by both the Scrapper and SearXNG batteries.
|
|
99
|
+
Pure converters — `searxngResultsToRetrievables`, `scrapperArticleToRetrievable`,
|
|
100
|
+
`scrapperLinksToRetrievables` — return plain `RawRetrievable[]` (zero core-class instantiation;
|
|
101
|
+
core referenced as `import type` only). `storeRetrievables(ctx, raws, { retrievable })` constructs
|
|
102
|
+
and stores records via a **resolver-injected** `Retrievable` constructor (ctor / sync / async /
|
|
103
|
+
dynamic-import), so the module never value-imports core. Long page text becomes a reader-backed
|
|
104
|
+
`SpooledArtifact` via a caller `spool` hook (the converter recommends an open
|
|
105
|
+
`ArtifactConstructorResolver` for the content — markdown/json/text — so a consumer's own subclass
|
|
106
|
+
works unchanged; no chunker). Web content defaults to `trustTier: 'third-party-public'` (a
|
|
107
|
+
constant, not URL inference — CONTRIBUTING DD#12).
|
|
108
|
+
|
|
109
|
+
- **Shared tool-battery helpers (`@nhtio/adk/batteries/tools/_shared`).** Internal building blocks
|
|
110
|
+
for the configured-HTTP tool batteries: `resolveArtifact`/`resolveArtifactSync` (resolver → sync
|
|
111
|
+
`() => Ctor`), the onion middleware-pipeline runners (fresh runner per call, short-circuit +
|
|
112
|
+
non-terminal detection), header resolution, and the `ArtifactResolver`/`SyncArtifactResolver`
|
|
113
|
+
types. SearXNG and Scrapper both build on it instead of carrying copies.
|
|
114
|
+
|
|
74
115
|
- **SearXNG search tool battery (`@nhtio/adk/batteries/tools/searxng`).** A web-search tool for any
|
|
75
|
-
[SearXNG](https://docs.searxng.org/dev/search_api.html) instance, exposed via
|
|
76
|
-
`createSearxngSearchTool(config)`
|
|
77
|
-
factory-style tool battery: a search tool has to know
|
|
78
|
-
behind custom authentication, so it needs per-deployment
|
|
79
|
-
load. Because it exports
|
|
80
|
-
`Object.values(batteries)` — call
|
|
116
|
+
[SearXNG](https://docs.searxng.org/dev/search_api.html) instance, exposed via **factories** —
|
|
117
|
+
async `createSearxngSearchTool(config)` and sync `createSearxngSearchToolSync(config)` — rather
|
|
118
|
+
than a ready-made constant. It is the first factory-style tool battery: a search tool has to know
|
|
119
|
+
*which* instance to query and is usually behind custom authentication, so it needs per-deployment
|
|
120
|
+
config that cannot be baked in at module load. Because it exports factories (not a `Tool`), they
|
|
121
|
+
must not be bulk-registered via `Object.values(batteries)` — call a factory first, then register
|
|
122
|
+
the returned tool.
|
|
81
123
|
- **Custom-header auth** — `config.headers` accepts a static `Record<string,string>` or a
|
|
82
124
|
sync/async resolver (`() => headers | Promise<headers>`); the resolver runs on every search, so
|
|
83
125
|
refreshable bearer tokens work. Caller headers override the default `Accept`/`User-Agent`.
|
|
@@ -92,9 +134,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
92
134
|
hit); output stages filter/re-rank `ctx.results`, mutate `ctx.raw`, or set `ctx.output` verbatim
|
|
93
135
|
(e.g. rendered markdown). A `ctx.stash` Map carries across both; a fresh runner is minted per
|
|
94
136
|
invocation (middleware runners are single-use).
|
|
95
|
-
- **Configurable spool artifact** — `config.
|
|
96
|
-
is
|
|
97
|
-
`() =>
|
|
137
|
+
- **Configurable spool artifact (resolver)** — `config.artifact` (default `() => SpooledJsonArtifact`)
|
|
138
|
+
is an open `ArtifactConstructorResolver`: a ctor, a sync resolver, or — via the async factory —
|
|
139
|
+
an async/dynamic-import resolver (`() => import('@nhtio/adk/spooled_artifact').then(m => m.SpooledMarkdownArtifact)`),
|
|
140
|
+
so a consumer's own `SpooledArtifact` subclass works with no battery change. The async factory
|
|
141
|
+
resolves it before building the `Tool` (whose `artifactConstructor` must be sync); the sync
|
|
142
|
+
factory accepts only the sync subset.
|
|
98
143
|
- **Graceful failures** — a disabled-JSON instance (SearXNG disables JSON by default → HTTP 403),
|
|
99
144
|
network errors, timeouts, and thrown pipeline stages all return `Error:` strings the model can
|
|
100
145
|
react to; only malformed args throw (`E_INVALID_TOOL_ARGS`). Invalid config throws the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../../../chunk-Ble4zEEl.js");
|
|
3
|
-
const require_tool_registry = require("../../../tool_registry-
|
|
3
|
+
const require_tool_registry = require("../../../tool_registry-CKJPze3j.js");
|
|
4
4
|
require("../../../guards.cjs");
|
|
5
5
|
const require_lib_utils_retry = require("../../../lib/utils/retry.cjs");
|
|
6
6
|
const require_batteries_embeddings_openai_exceptions = require("./exceptions.cjs");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as isError } from "../../../tool_registry-
|
|
1
|
+
import { o as isError } from "../../../tool_registry-791Vrjtf.mjs";
|
|
2
2
|
import "../../../guards.mjs";
|
|
3
3
|
import { computeBackoff, parseRetryAfter, sleepWithJitter } from "../../../lib/utils/retry.mjs";
|
|
4
4
|
import { E_OPENAI_EMBEDDINGS_HTTP_ERROR, E_OPENAI_EMBEDDINGS_MALFORMED_RESPONSE, E_OPENAI_EMBEDDINGS_REQUEST_TIMEOUT } from "./exceptions.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../../../chunk-Ble4zEEl.js");
|
|
3
|
-
const require_tool_registry = require("../../../tool_registry-
|
|
3
|
+
const require_tool_registry = require("../../../tool_registry-CKJPze3j.js");
|
|
4
4
|
require("../../../guards.cjs");
|
|
5
5
|
const require_batteries_embeddings_openai_helpers = require("../openai/helpers.cjs");
|
|
6
6
|
const require_batteries_embeddings_webllm_exceptions = require("./exceptions.cjs");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as isError } from "../../../tool_registry-
|
|
1
|
+
import { o as isError } from "../../../tool_registry-791Vrjtf.mjs";
|
|
2
2
|
import "../../../guards.mjs";
|
|
3
3
|
import { applyEmbeddingPrefix } from "../openai/helpers.mjs";
|
|
4
4
|
import { E_INVALID_WEBLLM_EMBEDDINGS_OPTIONS, E_WEBLLM_EMBEDDINGS_ENGINE_ERROR } from "./exceptions.mjs";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../../../chunk-Ble4zEEl.js");
|
|
3
|
-
const require_tool_registry = require("../../../tool_registry-
|
|
4
|
-
const require_thought = require("../../../thought-
|
|
5
|
-
const require_spooled_artifact = require("../../../spooled_artifact-
|
|
6
|
-
require("../../../common-
|
|
7
|
-
const require_tool_call = require("../../../tool_call-
|
|
3
|
+
const require_tool_registry = require("../../../tool_registry-CKJPze3j.js");
|
|
4
|
+
const require_thought = require("../../../thought-DLwpF7MI.js");
|
|
5
|
+
const require_spooled_artifact = require("../../../spooled_artifact-DX8LLyUX.js");
|
|
6
|
+
require("../../../common-DZl3ADJs.js");
|
|
7
|
+
const require_tool_call = require("../../../tool_call-DixVlW40.js");
|
|
8
8
|
require("../../../guards.cjs");
|
|
9
9
|
const require_lib_utils_retry = require("../../../lib/utils/retry.cjs");
|
|
10
10
|
const require_batteries_storage_in_memory = require("../../storage/in_memory.cjs");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { n as Message, t as Thought } from "../../../thought-
|
|
3
|
-
import { i as ArtifactTool, t as SpooledArtifact } from "../../../spooled_artifact-
|
|
4
|
-
import "../../../common-
|
|
5
|
-
import { n as Media, t as ToolCall } from "../../../tool_call-
|
|
1
|
+
import { a as Tokenizable, c as isObject, n as canonicalStringify, o as isError, s as isInstanceOf, t as ToolRegistry } from "../../../tool_registry-791Vrjtf.mjs";
|
|
2
|
+
import { n as Message, t as Thought } from "../../../thought-B_vxAiKU.mjs";
|
|
3
|
+
import { i as ArtifactTool, t as SpooledArtifact } from "../../../spooled_artifact-7eePq7JA.mjs";
|
|
4
|
+
import "../../../common-DYDUi99O.mjs";
|
|
5
|
+
import { n as Media, t as ToolCall } from "../../../tool_call-B4-_-vjG.mjs";
|
|
6
6
|
import "../../../guards.mjs";
|
|
7
7
|
import { computeBackoff, linkAbortSignals, parseRetryAfter, sleepWithJitter } from "../../../lib/utils/retry.mjs";
|
|
8
8
|
import { InMemorySpoolStore } from "../../storage/in_memory.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../../../chunk-Ble4zEEl.js");
|
|
3
|
-
require("../../../common-
|
|
4
|
-
const require_tool_call = require("../../../tool_call-
|
|
3
|
+
require("../../../common-DZl3ADJs.js");
|
|
4
|
+
const require_tool_call = require("../../../tool_call-DixVlW40.js");
|
|
5
5
|
require("../../../guards.cjs");
|
|
6
6
|
const require_helpers = require("../../../helpers-DSTFxTiC.js");
|
|
7
7
|
const require_batteries_llm_ollama_exceptions = require("./exceptions.cjs");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../../common-
|
|
2
|
-
import { n as Media } from "../../../tool_call-
|
|
1
|
+
import "../../../common-DYDUi99O.mjs";
|
|
2
|
+
import { n as Media } from "../../../tool_call-B4-_-vjG.mjs";
|
|
3
3
|
import "../../../guards.mjs";
|
|
4
4
|
import { A as retrievableToAttrs, C as renderRetrievables, D as renderThought, E as renderThirdPartyPublicRetrievables, M as toolsToChatCompletionsTools, O as renderTrustedContent, S as renderRetrievableSafetyDirective, T as renderThirdPartyPrivateRetrievables, _ as filterThoughts, a as defaultRenderMemories, b as renderFirstPartyRetrievables, c as defaultRenderStandingInstructions, d as defaultRenderThought, f as defaultRenderTrustedContent, g as escapeXmlAttribute, h as descriptionToChatCompletionsJsonSchema, i as defaultRenderFirstPartyRetrievables, k as renderUntrustedContent, l as defaultRenderThirdPartyPrivateRetrievables, m as defaultToolsToChatCompletionsTools, n as defaultFilterThoughts, o as defaultRenderRetrievableSafetyDirective, p as defaultRenderUntrustedContent, r as defaultRenderChatCompletionsSystemPrompt, s as defaultRenderRetrievables, t as defaultDescriptionToChatCompletionsJsonSchema, u as defaultRenderThirdPartyPublicRetrievables, v as memoryToAttrs, w as renderStandingInstructions, x as renderMemories, y as renderChatCompletionsSystemPrompt } from "../../../helpers-xhrQbMAG.mjs";
|
|
5
5
|
import { E_OLLAMA_UNSUPPORTED_MEDIA_MODALITY } from "./exceptions.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../../../chunk-Ble4zEEl.js");
|
|
3
|
-
const require_common = require("../../../common-
|
|
3
|
+
const require_common = require("../../../common-DZl3ADJs.js");
|
|
4
4
|
require("../../../guards.cjs");
|
|
5
5
|
const require_batteries_llm_ollama_exceptions = require("./exceptions.cjs");
|
|
6
6
|
let _nhtio_validation = require("@nhtio/validation");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as byteStoreSchema } from "../../../common-
|
|
1
|
+
import { i as byteStoreSchema } from "../../../common-DYDUi99O.mjs";
|
|
2
2
|
import "../../../guards.mjs";
|
|
3
3
|
import { E_INVALID_OLLAMA_OPTIONS } from "./exceptions.mjs";
|
|
4
4
|
import { validator } from "@nhtio/validation";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../../../chunk-Ble4zEEl.js");
|
|
3
|
-
const require_tool_registry = require("../../../tool_registry-
|
|
4
|
-
const require_thought = require("../../../thought-
|
|
5
|
-
const require_spooled_artifact = require("../../../spooled_artifact-
|
|
6
|
-
require("../../../common-
|
|
7
|
-
const require_tool_call = require("../../../tool_call-
|
|
3
|
+
const require_tool_registry = require("../../../tool_registry-CKJPze3j.js");
|
|
4
|
+
const require_thought = require("../../../thought-DLwpF7MI.js");
|
|
5
|
+
const require_spooled_artifact = require("../../../spooled_artifact-DX8LLyUX.js");
|
|
6
|
+
require("../../../common-DZl3ADJs.js");
|
|
7
|
+
const require_tool_call = require("../../../tool_call-DixVlW40.js");
|
|
8
8
|
require("../../../guards.cjs");
|
|
9
9
|
const require_lib_utils_retry = require("../../../lib/utils/retry.cjs");
|
|
10
10
|
const require_batteries_llm_openai_chat_completions_exceptions = require("./exceptions.cjs");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { n as Message, t as Thought } from "../../../thought-
|
|
3
|
-
import { i as ArtifactTool, t as SpooledArtifact } from "../../../spooled_artifact-
|
|
4
|
-
import "../../../common-
|
|
5
|
-
import { n as Media, t as ToolCall } from "../../../tool_call-
|
|
1
|
+
import { a as Tokenizable, c as isObject, n as canonicalStringify, o as isError, s as isInstanceOf, t as ToolRegistry } from "../../../tool_registry-791Vrjtf.mjs";
|
|
2
|
+
import { n as Message, t as Thought } from "../../../thought-B_vxAiKU.mjs";
|
|
3
|
+
import { i as ArtifactTool, t as SpooledArtifact } from "../../../spooled_artifact-7eePq7JA.mjs";
|
|
4
|
+
import "../../../common-DYDUi99O.mjs";
|
|
5
|
+
import { n as Media, t as ToolCall } from "../../../tool_call-B4-_-vjG.mjs";
|
|
6
6
|
import "../../../guards.mjs";
|
|
7
7
|
import { computeBackoff, linkAbortSignals, parseRetryAfter, sleepWithJitter } from "../../../lib/utils/retry.mjs";
|
|
8
8
|
import { E_INVALID_OPENAI_CHAT_COMPLETIONS_OPTIONS, E_OPENAI_CHAT_COMPLETIONS_CONTEXT_OVERFLOW, E_OPENAI_CHAT_COMPLETIONS_HTTP_ERROR, E_OPENAI_CHAT_COMPLETIONS_INVALID_TOOL_CALL_ARGS, E_OPENAI_CHAT_COMPLETIONS_REQUEST_TIMEOUT, E_OPENAI_CHAT_COMPLETIONS_STREAM_ERROR, E_OPENAI_CHAT_COMPLETIONS_STREAM_STALLED } from "./exceptions.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../../../chunk-Ble4zEEl.js");
|
|
3
|
-
require("../../../common-
|
|
4
|
-
const require_tool_call = require("../../../tool_call-
|
|
3
|
+
require("../../../common-DZl3ADJs.js");
|
|
4
|
+
const require_tool_call = require("../../../tool_call-DixVlW40.js");
|
|
5
5
|
require("../../../guards.cjs");
|
|
6
6
|
const require_batteries_llm_openai_chat_completions_exceptions = require("./exceptions.cjs");
|
|
7
7
|
const require_helpers = require("../../../helpers-DSTFxTiC.js");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../../common-
|
|
2
|
-
import { n as Media } from "../../../tool_call-
|
|
1
|
+
import "../../../common-DYDUi99O.mjs";
|
|
2
|
+
import { n as Media } from "../../../tool_call-B4-_-vjG.mjs";
|
|
3
3
|
import "../../../guards.mjs";
|
|
4
4
|
import { E_UNSUPPORTED_MEDIA_MODALITY } from "./exceptions.mjs";
|
|
5
5
|
import { A as retrievableToAttrs, C as renderRetrievables, D as renderThought, E as renderThirdPartyPublicRetrievables, M as toolsToChatCompletionsTools, O as renderTrustedContent, S as renderRetrievableSafetyDirective, T as renderThirdPartyPrivateRetrievables, _ as filterThoughts, a as defaultRenderMemories, b as renderFirstPartyRetrievables, c as defaultRenderStandingInstructions, d as defaultRenderThought, f as defaultRenderTrustedContent, g as escapeXmlAttribute, h as descriptionToChatCompletionsJsonSchema, i as defaultRenderFirstPartyRetrievables, j as sanitiseNameField, k as renderUntrustedContent, l as defaultRenderThirdPartyPrivateRetrievables, m as defaultToolsToChatCompletionsTools, n as defaultFilterThoughts, o as defaultRenderRetrievableSafetyDirective, p as defaultRenderUntrustedContent, r as defaultRenderChatCompletionsSystemPrompt, s as defaultRenderRetrievables, t as defaultDescriptionToChatCompletionsJsonSchema, u as defaultRenderThirdPartyPublicRetrievables, v as memoryToAttrs, w as renderStandingInstructions, x as renderMemories, y as renderChatCompletionsSystemPrompt } from "../../../helpers-xhrQbMAG.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../../../chunk-Ble4zEEl.js");
|
|
3
|
-
const require_common = require("../../../common-
|
|
3
|
+
const require_common = require("../../../common-DZl3ADJs.js");
|
|
4
4
|
require("../../../guards.cjs");
|
|
5
5
|
const require_batteries_llm_openai_chat_completions_exceptions = require("./exceptions.cjs");
|
|
6
6
|
let _nhtio_validation = require("@nhtio/validation");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as byteStoreSchema } from "../../../common-
|
|
1
|
+
import { i as byteStoreSchema } from "../../../common-DYDUi99O.mjs";
|
|
2
2
|
import "../../../guards.mjs";
|
|
3
3
|
import { E_INVALID_OPENAI_CHAT_COMPLETIONS_OPTIONS } from "./exceptions.mjs";
|
|
4
4
|
import { validator } from "@nhtio/validation";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../../../chunk-Ble4zEEl.js");
|
|
3
|
-
const require_tool_registry = require("../../../tool_registry-
|
|
4
|
-
const require_thought = require("../../../thought-
|
|
5
|
-
const require_spooled_artifact = require("../../../spooled_artifact-
|
|
6
|
-
require("../../../common-
|
|
7
|
-
const require_tool_call = require("../../../tool_call-
|
|
3
|
+
const require_tool_registry = require("../../../tool_registry-CKJPze3j.js");
|
|
4
|
+
const require_thought = require("../../../thought-DLwpF7MI.js");
|
|
5
|
+
const require_spooled_artifact = require("../../../spooled_artifact-DX8LLyUX.js");
|
|
6
|
+
require("../../../common-DZl3ADJs.js");
|
|
7
|
+
const require_tool_call = require("../../../tool_call-DixVlW40.js");
|
|
8
8
|
require("../../../guards.cjs");
|
|
9
9
|
const require_batteries_storage_in_memory = require("../../storage/in_memory.cjs");
|
|
10
10
|
const require_helpers = require("../../../helpers-DSTFxTiC.js");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { n as Message, t as Thought } from "../../../thought-
|
|
3
|
-
import { i as ArtifactTool, t as SpooledArtifact } from "../../../spooled_artifact-
|
|
4
|
-
import "../../../common-
|
|
5
|
-
import { n as Media, t as ToolCall } from "../../../tool_call-
|
|
1
|
+
import { a as Tokenizable, c as isObject, n as canonicalStringify, o as isError, s as isInstanceOf, t as ToolRegistry } from "../../../tool_registry-791Vrjtf.mjs";
|
|
2
|
+
import { n as Message, t as Thought } from "../../../thought-B_vxAiKU.mjs";
|
|
3
|
+
import { i as ArtifactTool, t as SpooledArtifact } from "../../../spooled_artifact-7eePq7JA.mjs";
|
|
4
|
+
import "../../../common-DYDUi99O.mjs";
|
|
5
|
+
import { n as Media, t as ToolCall } from "../../../tool_call-B4-_-vjG.mjs";
|
|
6
6
|
import "../../../guards.mjs";
|
|
7
7
|
import { InMemorySpoolStore } from "../../storage/in_memory.mjs";
|
|
8
8
|
import { a as defaultRenderMemories, c as defaultRenderStandingInstructions, d as defaultRenderThought, f as defaultRenderTrustedContent, i as defaultRenderFirstPartyRetrievables, l as defaultRenderThirdPartyPrivateRetrievables, m as defaultToolsToChatCompletionsTools, n as defaultFilterThoughts, o as defaultRenderRetrievableSafetyDirective, p as defaultRenderUntrustedContent, r as defaultRenderChatCompletionsSystemPrompt, s as defaultRenderRetrievables, t as defaultDescriptionToChatCompletionsJsonSchema, u as defaultRenderThirdPartyPublicRetrievables } from "../../../helpers-xhrQbMAG.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../../../chunk-Ble4zEEl.js");
|
|
3
|
-
const require_common = require("../../../common-
|
|
3
|
+
const require_common = require("../../../common-DZl3ADJs.js");
|
|
4
4
|
require("../../../guards.cjs");
|
|
5
5
|
const require_batteries_llm_webllm_chat_completions_exceptions = require("./exceptions.cjs");
|
|
6
6
|
let _nhtio_validation = require("@nhtio/validation");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as byteStoreSchema } from "../../../common-
|
|
1
|
+
import { i as byteStoreSchema } from "../../../common-DYDUi99O.mjs";
|
|
2
2
|
import "../../../guards.mjs";
|
|
3
3
|
import { E_INVALID_WEBLLM_CHAT_COMPLETIONS_OPTIONS } from "./exceptions.mjs";
|
|
4
4
|
import { validator } from "@nhtio/validation";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("../../chunk-Ble4zEEl.js");
|
|
3
|
-
const require_tool_registry = require("../../tool_registry-
|
|
3
|
+
const require_tool_registry = require("../../tool_registry-CKJPze3j.js");
|
|
4
4
|
require("../../guards.cjs");
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region src/batteries/storage/flydrive/index.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __commonJSMin } from "../../chunk-Bpcn9VDT.mjs";
|
|
2
|
-
import { s as isInstanceOf } from "../../tool_registry-
|
|
2
|
+
import { s as isInstanceOf } from "../../tool_registry-791Vrjtf.mjs";
|
|
3
3
|
import "../../guards.mjs";
|
|
4
4
|
//#endregion
|
|
5
5
|
//#region src/batteries/storage/flydrive/index.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../../chunk-Ble4zEEl.js");
|
|
3
|
-
const require_tool_registry = require("../../tool_registry-
|
|
3
|
+
const require_tool_registry = require("../../tool_registry-CKJPze3j.js");
|
|
4
4
|
require("../../guards.cjs");
|
|
5
5
|
//#region src/batteries/storage/in_memory/index.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../../chunk-Ble4zEEl.js");
|
|
3
|
-
const require_tool_registry = require("../../tool_registry-
|
|
3
|
+
const require_tool_registry = require("../../tool_registry-CKJPze3j.js");
|
|
4
4
|
require("../../guards.cjs");
|
|
5
5
|
//#region src/batteries/storage/opfs/index.ts
|
|
6
6
|
/**
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-battery helpers shared by the configured HTTP tool batteries (SearXNG, Scrapper, …).
|
|
3
|
+
*
|
|
4
|
+
* @module @nhtio/adk/batteries/tools/_shared
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* These are internal building blocks for the *factory-style* tool batteries — the ones that talk
|
|
8
|
+
* to a configured HTTP instance behind custom auth and expose input/output middleware pipelines.
|
|
9
|
+
* Rather than each battery carry its own copy, the common machinery lives here:
|
|
10
|
+
*
|
|
11
|
+
* - {@link resolveArtifact} / {@link resolveArtifactSync} — turn an {@link ArtifactResolver}
|
|
12
|
+
* (a constructor, a sync resolver, or an async / dynamic-import resolver) into the **sync**
|
|
13
|
+
* `() => SpooledArtifactConstructor` that `Tool.artifactConstructor` requires. Mirrors the vector
|
|
14
|
+
* battery's `resolveClientCtor`.
|
|
15
|
+
* - {@link resolveHeaders} — collapse a static header object or a (sync/async) resolver into a
|
|
16
|
+
* plain header record for one request (refreshable-auth friendly).
|
|
17
|
+
* - {@link runInputPipeline} / {@link runOutputPipeline} — the onion middleware runners (fresh
|
|
18
|
+
* runner per call, short-circuit + non-terminal detection), generic over the context type.
|
|
19
|
+
*
|
|
20
|
+
* This module imports harness primitives only through their specific subpath barrels
|
|
21
|
+
* (`@nhtio/adk/spooled_artifact`, `@nhtio/adk/forge`, `@nhtio/adk/guards`) per the batteries
|
|
22
|
+
* barrel-only rule.
|
|
23
|
+
*/
|
|
24
|
+
import { Middleware } from '@nhtio/middleware';
|
|
25
|
+
import type { NextFn } from '@nhtio/middleware';
|
|
26
|
+
import type { SpooledArtifactConstructor } from "../../../forge";
|
|
27
|
+
/** A static set of request headers (used for custom instance authentication). */
|
|
28
|
+
export type ToolHeaders = Record<string, string>;
|
|
29
|
+
/**
|
|
30
|
+
* A resolver returning request headers, sync or async. Use this form when the auth token is
|
|
31
|
+
* refreshable — the resolver runs on every request, so a fresh token can be minted per call.
|
|
32
|
+
*/
|
|
33
|
+
export type ToolHeadersResolver = () => ToolHeaders | Promise<ToolHeaders>;
|
|
34
|
+
/**
|
|
35
|
+
* Resolve the configured headers (a static object or a sync/async resolver) for a single request.
|
|
36
|
+
*
|
|
37
|
+
* @param headers - The static header record, the resolver, or `undefined`.
|
|
38
|
+
* @returns A fresh, owned copy of the resolved headers (`{}` when none supplied).
|
|
39
|
+
*/
|
|
40
|
+
export declare const resolveHeaders: (headers: ToolHeaders | ToolHeadersResolver | undefined) => Promise<ToolHeaders>;
|
|
41
|
+
/** Convenience alias for the spooled-artifact constructor a tool wraps its output in. */
|
|
42
|
+
export type SpooledArtifactCtor = SpooledArtifactConstructor;
|
|
43
|
+
/**
|
|
44
|
+
* The artifact configuration accepted by a factory: a constructor, a sync resolver, or an async /
|
|
45
|
+
* dynamic-import resolver (which may yield a module namespace whose `default` is the constructor).
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* Mirrors the vector battery's `client` resolver and `Tool.artifactConstructor`'s indirection. The
|
|
49
|
+
* async form lets a consumer `() => import('@nhtio/adk/spooled_artifact').then(m => m.SpooledMarkdownArtifact)`
|
|
50
|
+
* so the artifact class never enters their static module graph.
|
|
51
|
+
*/
|
|
52
|
+
export type ArtifactResolver = SpooledArtifactCtor | (() => SpooledArtifactCtor | {
|
|
53
|
+
default: SpooledArtifactCtor;
|
|
54
|
+
}) | (() => Promise<SpooledArtifactCtor | {
|
|
55
|
+
default: SpooledArtifactCtor;
|
|
56
|
+
}>);
|
|
57
|
+
/** The sync subset of {@link ArtifactResolver} — a constructor or a sync resolver (no Promise). */
|
|
58
|
+
export type SyncArtifactResolver = SpooledArtifactCtor | (() => SpooledArtifactCtor | {
|
|
59
|
+
default: SpooledArtifactCtor;
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* Resolve an {@link ArtifactResolver} to the **sync** `() => SpooledArtifactCtor` that
|
|
63
|
+
* `Tool.artifactConstructor` requires (the wrap-site and the construction-time validator both
|
|
64
|
+
* invoke it synchronously, so an async resolver cannot be passed straight through).
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* A bare constructor is itself a function, so it is distinguished from a resolver via
|
|
68
|
+
* `SpooledArtifact.isSpooledArtifactConstructor` (the same duck-typed guard the core validator
|
|
69
|
+
* uses) rather than by arity. Async because a dynamic-import resolver must be awaited here.
|
|
70
|
+
*
|
|
71
|
+
* @param resolver - The artifact configuration. When `undefined`, callers should fall back to
|
|
72
|
+
* their own default (this function rejects `undefined` so the default lives with the caller).
|
|
73
|
+
* @param onInvalid - Throws a battery-scoped error; receives a human-readable reason.
|
|
74
|
+
* @returns A sync `() => SpooledArtifactCtor` suitable for `Tool.artifactConstructor`.
|
|
75
|
+
*/
|
|
76
|
+
export declare const resolveArtifact: (resolver: ArtifactResolver, onInvalid: (reason: string) => never) => Promise<() => SpooledArtifactCtor>;
|
|
77
|
+
/**
|
|
78
|
+
* Synchronous {@link resolveArtifact}: accepts only the {@link SyncArtifactResolver} subset and
|
|
79
|
+
* throws (via `onInvalid`) on an async resolver — a runtime guard for JS callers who bypass the
|
|
80
|
+
* compile-time narrowing.
|
|
81
|
+
*
|
|
82
|
+
* @param resolver - A constructor or a sync resolver.
|
|
83
|
+
* @param onInvalid - Throws a battery-scoped error; receives a human-readable reason.
|
|
84
|
+
* @returns A sync `() => SpooledArtifactCtor` suitable for `Tool.artifactConstructor`.
|
|
85
|
+
*/
|
|
86
|
+
export declare const resolveArtifactSync: (resolver: SyncArtifactResolver, onInvalid: (reason: string) => never) => (() => SpooledArtifactCtor);
|
|
87
|
+
/** `true` when `value` is the short-circuit sentinel produced by {@link makeShortCircuit}. */
|
|
88
|
+
export declare const isShortCircuit: (value: unknown) => value is {
|
|
89
|
+
result: string;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Build a `shortCircuit(result)` function for an input-pipeline context. Calling it throws the
|
|
93
|
+
* internal sentinel, which {@link runInputPipeline} catches and converts into the verbatim result
|
|
94
|
+
* (skipping the HTTP request entirely — e.g. a cache hit).
|
|
95
|
+
*
|
|
96
|
+
* @returns A function that, when called with a result string, throws the short-circuit sentinel.
|
|
97
|
+
*/
|
|
98
|
+
export declare const makeShortCircuit: () => ((result: string) => never);
|
|
99
|
+
/** A generic onion middleware stage over a mutable context `C`. */
|
|
100
|
+
export type MiddlewareFn<C> = (ctx: C, next: NextFn) => void | Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Run an input pipeline over `ctx`. Returns the short-circuit string when a stage short-circuited,
|
|
103
|
+
* or `undefined` when the pipeline reached its terminal handler. A non-terminal pipeline (a stage
|
|
104
|
+
* that neither called `next()` nor short-circuited) throws — the caller converts it to an
|
|
105
|
+
* `Error:` string.
|
|
106
|
+
*
|
|
107
|
+
* @param mw - The `Middleware` instance holding the stages (a fresh `.runner()` is minted here).
|
|
108
|
+
* @param ctx - The mutable input context handed to each stage.
|
|
109
|
+
* @param label - Battery name, used in the non-terminal error message.
|
|
110
|
+
* @returns The short-circuit result string, or `undefined` if the pipeline ran to completion.
|
|
111
|
+
*/
|
|
112
|
+
export declare const runInputPipeline: <C>(mw: Middleware<MiddlewareFn<C>>, ctx: C, label: string) => Promise<string | undefined>;
|
|
113
|
+
/**
|
|
114
|
+
* Run an output pipeline over `ctx`; rethrow any stage error to the caller's try/catch. A
|
|
115
|
+
* non-terminal pipeline (no `next()`) throws.
|
|
116
|
+
*
|
|
117
|
+
* @param mw - The `Middleware` instance holding the stages (a fresh `.runner()` is minted here).
|
|
118
|
+
* @param ctx - The mutable output context handed to each stage.
|
|
119
|
+
* @param label - Battery name, used in the non-terminal error message.
|
|
120
|
+
*/
|
|
121
|
+
export declare const runOutputPipeline: <C>(mw: Middleware<MiddlewareFn<C>>, ctx: C, label: string) => Promise<void>;
|