@retinue/agentkit 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +310 -0
- package/dist/adapters/bullmq/consumer.d.ts +33 -0
- package/dist/adapters/bullmq/consumer.js +41 -0
- package/dist/adapters/bullmq/dispatcher.d.ts +74 -0
- package/dist/adapters/bullmq/dispatcher.js +160 -0
- package/dist/adapters/bullmq/export.d.ts +31 -0
- package/dist/adapters/bullmq/export.js +53 -0
- package/dist/adapters/bullmq/extraction.d.ts +42 -0
- package/dist/adapters/bullmq/extraction.js +63 -0
- package/dist/adapters/bullmq/index.d.ts +13 -0
- package/dist/adapters/bullmq/index.js +13 -0
- package/dist/adapters/bullmq/lock.d.ts +77 -0
- package/dist/adapters/bullmq/lock.js +126 -0
- package/dist/adapters/bullmq/queue.d.ts +50 -0
- package/dist/adapters/bullmq/queue.js +81 -0
- package/dist/adapters/memory/artifact-exports.d.ts +11 -0
- package/dist/adapters/memory/artifact-exports.js +102 -0
- package/dist/adapters/memory/artifacts.d.ts +15 -0
- package/dist/adapters/memory/artifacts.js +134 -0
- package/dist/adapters/memory/blobs.d.ts +7 -0
- package/dist/adapters/memory/blobs.js +27 -0
- package/dist/adapters/memory/evaluation.d.ts +18 -0
- package/dist/adapters/memory/evaluation.js +148 -0
- package/dist/adapters/memory/files.d.ts +27 -0
- package/dist/adapters/memory/files.js +0 -0
- package/dist/adapters/memory/flows.d.ts +16 -0
- package/dist/adapters/memory/flows.js +117 -0
- package/dist/adapters/memory/hitl.d.ts +9 -0
- package/dist/adapters/memory/hitl.js +130 -0
- package/dist/adapters/memory/idempotency.d.ts +13 -0
- package/dist/adapters/memory/idempotency.js +32 -0
- package/dist/adapters/memory/index.d.ts +39 -0
- package/dist/adapters/memory/index.js +107 -0
- package/dist/adapters/memory/knowledge.d.ts +43 -0
- package/dist/adapters/memory/knowledge.js +248 -0
- package/dist/adapters/memory/mcp.d.ts +9 -0
- package/dist/adapters/memory/mcp.js +37 -0
- package/dist/adapters/memory/message-store.d.ts +17 -0
- package/dist/adapters/memory/message-store.js +70 -0
- package/dist/adapters/memory/principal-memory.d.ts +7 -0
- package/dist/adapters/memory/principal-memory.js +83 -0
- package/dist/adapters/memory/runtime.d.ts +29 -0
- package/dist/adapters/memory/runtime.js +0 -0
- package/dist/adapters/memory/sessions.d.ts +29 -0
- package/dist/adapters/memory/sessions.js +0 -0
- package/dist/adapters/memory/skills.d.ts +10 -0
- package/dist/adapters/memory/skills.js +41 -0
- package/dist/adapters/memory/thread-summary.d.ts +7 -0
- package/dist/adapters/memory/thread-summary.js +29 -0
- package/dist/adapters/memory/usage-limits.d.ts +13 -0
- package/dist/adapters/memory/usage-limits.js +72 -0
- package/dist/adapters/memory/usage.d.ts +16 -0
- package/dist/adapters/memory/usage.js +279 -0
- package/dist/adapters/otel/index.d.ts +111 -0
- package/dist/adapters/otel/index.js +133 -0
- package/dist/adapters/postgres/artifact-exports.d.ts +12 -0
- package/dist/adapters/postgres/artifact-exports.js +117 -0
- package/dist/adapters/postgres/artifacts.d.ts +16 -0
- package/dist/adapters/postgres/artifacts.js +172 -0
- package/dist/adapters/postgres/checkpoint-store.d.ts +16 -0
- package/dist/adapters/postgres/checkpoint-store.js +34 -0
- package/dist/adapters/postgres/config.d.ts +15 -0
- package/dist/adapters/postgres/config.js +187 -0
- package/dist/adapters/postgres/conversation-store.d.ts +4 -0
- package/dist/adapters/postgres/conversation-store.js +82 -0
- package/dist/adapters/postgres/evaluation.d.ts +17 -0
- package/dist/adapters/postgres/evaluation.js +193 -0
- package/dist/adapters/postgres/file-content.d.ts +30 -0
- package/dist/adapters/postgres/file-content.js +111 -0
- package/dist/adapters/postgres/files.d.ts +19 -0
- package/dist/adapters/postgres/files.js +209 -0
- package/dist/adapters/postgres/flows.d.ts +20 -0
- package/dist/adapters/postgres/flows.js +206 -0
- package/dist/adapters/postgres/hitl.d.ts +5 -0
- package/dist/adapters/postgres/hitl.js +247 -0
- package/dist/adapters/postgres/index.d.ts +35 -0
- package/dist/adapters/postgres/index.js +35 -0
- package/dist/adapters/postgres/knowledge.d.ts +48 -0
- package/dist/adapters/postgres/knowledge.js +255 -0
- package/dist/adapters/postgres/memory.d.ts +14 -0
- package/dist/adapters/postgres/memory.js +194 -0
- package/dist/adapters/postgres/message-store.d.ts +11 -0
- package/dist/adapters/postgres/message-store.js +145 -0
- package/dist/adapters/postgres/migrations.d.ts +69 -0
- package/dist/adapters/postgres/migrations.js +1594 -0
- package/dist/adapters/postgres/pg-executor.d.ts +19 -0
- package/dist/adapters/postgres/pg-executor.js +32 -0
- package/dist/adapters/postgres/retention.d.ts +26 -0
- package/dist/adapters/postgres/retention.js +59 -0
- package/dist/adapters/postgres/rollups.d.ts +17 -0
- package/dist/adapters/postgres/rollups.js +267 -0
- package/dist/adapters/postgres/run-coordinator.d.ts +5 -0
- package/dist/adapters/postgres/run-coordinator.js +98 -0
- package/dist/adapters/postgres/run-event-log.d.ts +26 -0
- package/dist/adapters/postgres/run-event-log.js +30 -0
- package/dist/adapters/postgres/run-store.d.ts +4 -0
- package/dist/adapters/postgres/run-store.js +199 -0
- package/dist/adapters/postgres/schema.d.ts +39 -0
- package/dist/adapters/postgres/schema.js +70 -0
- package/dist/adapters/postgres/session-state.d.ts +7 -0
- package/dist/adapters/postgres/session-state.js +99 -0
- package/dist/adapters/postgres/sql.d.ts +8 -0
- package/dist/adapters/postgres/sql.js +2 -0
- package/dist/adapters/postgres/transaction.d.ts +37 -0
- package/dist/adapters/postgres/transaction.js +93 -0
- package/dist/adapters/postgres/unit-of-work.d.ts +18 -0
- package/dist/adapters/postgres/unit-of-work.js +8 -0
- package/dist/adapters/postgres/usage-limits.d.ts +15 -0
- package/dist/adapters/postgres/usage-limits.js +136 -0
- package/dist/adapters/postgres/usage.d.ts +15 -0
- package/dist/adapters/postgres/usage.js +226 -0
- package/dist/adapters/redis/index.d.ts +9 -0
- package/dist/adapters/redis/index.js +9 -0
- package/dist/adapters/redis/realtime.d.ts +74 -0
- package/dist/adapters/redis/realtime.js +112 -0
- package/dist/adapters/supabase/index.d.ts +88 -0
- package/dist/adapters/supabase/index.js +84 -0
- package/dist/adapters/supabase/realtime.d.ts +30 -0
- package/dist/adapters/supabase/realtime.js +53 -0
- package/dist/adapters/supabase/rls.d.ts +99 -0
- package/dist/adapters/supabase/rls.js +216 -0
- package/dist/adapters/supabase/storage.d.ts +50 -0
- package/dist/adapters/supabase/storage.js +207 -0
- package/dist/agents/agent.d.ts +66 -0
- package/dist/agents/agent.js +209 -0
- package/dist/agents/define.d.ts +21 -0
- package/dist/agents/define.js +63 -0
- package/dist/agents/engine.d.ts +98 -0
- package/dist/agents/engine.js +462 -0
- package/dist/agents/index.d.ts +50 -0
- package/dist/agents/index.js +17 -0
- package/dist/artifacts/index.d.ts +114 -0
- package/dist/artifacts/index.js +219 -0
- package/dist/authorization/index.d.ts +76 -0
- package/dist/authorization/index.js +76 -0
- package/dist/capabilities/index.d.ts +120 -0
- package/dist/capabilities/index.js +167 -0
- package/dist/capabilities/runtime.d.ts +89 -0
- package/dist/capabilities/runtime.js +84 -0
- package/dist/citations/index.d.ts +161 -0
- package/dist/citations/index.js +182 -0
- package/dist/context/assembler.d.ts +82 -0
- package/dist/context/assembler.js +129 -0
- package/dist/context/compaction.d.ts +45 -0
- package/dist/context/compaction.js +55 -0
- package/dist/context/index.d.ts +75 -0
- package/dist/context/index.js +17 -0
- package/dist/core/content-parts.d.ts +194 -0
- package/dist/core/content-parts.js +23 -0
- package/dist/core/context.d.ts +51 -0
- package/dist/core/context.js +9 -0
- package/dist/core/env.d.ts +25 -0
- package/dist/core/env.js +41 -0
- package/dist/core/errors.d.ts +30 -0
- package/dist/core/errors.js +65 -0
- package/dist/core/events.d.ts +139 -0
- package/dist/core/events.js +99 -0
- package/dist/core/ids.d.ts +52 -0
- package/dist/core/ids.js +13 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.js +9 -0
- package/dist/core/tokens.d.ts +22 -0
- package/dist/core/tokens.js +22 -0
- package/dist/core/validation.d.ts +34 -0
- package/dist/core/validation.js +176 -0
- package/dist/documents/extraction.d.ts +121 -0
- package/dist/documents/extraction.js +293 -0
- package/dist/documents/index.d.ts +199 -0
- package/dist/documents/index.js +65 -0
- package/dist/documents/parsers/pdf.d.ts +47 -0
- package/dist/documents/parsers/pdf.js +508 -0
- package/dist/documents/parsers/text.d.ts +59 -0
- package/dist/documents/parsers/text.js +325 -0
- package/dist/documents/read-tool.d.ts +52 -0
- package/dist/documents/read-tool.js +109 -0
- package/dist/documents/render.d.ts +29 -0
- package/dist/documents/render.js +59 -0
- package/dist/documents/vision.d.ts +159 -0
- package/dist/documents/vision.js +214 -0
- package/dist/entries/adapters-bullmq.d.ts +8 -0
- package/dist/entries/adapters-bullmq.js +8 -0
- package/dist/entries/adapters-otel.d.ts +13 -0
- package/dist/entries/adapters-otel.js +13 -0
- package/dist/entries/adapters-postgres.d.ts +10 -0
- package/dist/entries/adapters-postgres.js +10 -0
- package/dist/entries/adapters-redis.d.ts +3 -0
- package/dist/entries/adapters-redis.js +3 -0
- package/dist/entries/context.d.ts +20 -0
- package/dist/entries/context.js +20 -0
- package/dist/entries/flows.d.ts +15 -0
- package/dist/entries/flows.js +15 -0
- package/dist/entries/hitl.d.ts +10 -0
- package/dist/entries/hitl.js +10 -0
- package/dist/entries/knowledge.d.ts +18 -0
- package/dist/entries/knowledge.js +19 -0
- package/dist/entries/mcp.d.ts +10 -0
- package/dist/entries/mcp.js +10 -0
- package/dist/entries/observability.d.ts +14 -0
- package/dist/entries/observability.js +16 -0
- package/dist/entries/persistence.d.ts +11 -0
- package/dist/entries/persistence.js +11 -0
- package/dist/entries/providers.d.ts +14 -0
- package/dist/entries/providers.js +14 -0
- package/dist/entries/runtime.d.ts +13 -0
- package/dist/entries/runtime.js +13 -0
- package/dist/entries/server.d.ts +24 -0
- package/dist/entries/server.js +24 -0
- package/dist/entries/tools.d.ts +21 -0
- package/dist/entries/tools.js +21 -0
- package/dist/entries/usage.d.ts +10 -0
- package/dist/entries/usage.js +10 -0
- package/dist/evaluation/gate.d.ts +168 -0
- package/dist/evaluation/gate.js +180 -0
- package/dist/evaluation/graders.d.ts +125 -0
- package/dist/evaluation/graders.js +203 -0
- package/dist/evaluation/index.d.ts +120 -0
- package/dist/evaluation/index.js +183 -0
- package/dist/evaluation/judge.d.ts +75 -0
- package/dist/evaluation/judge.js +111 -0
- package/dist/export/index.d.ts +162 -0
- package/dist/export/index.js +363 -0
- package/dist/export/markdown.d.ts +19 -0
- package/dist/export/markdown.js +29 -0
- package/dist/export/pdf.d.ts +73 -0
- package/dist/export/pdf.js +407 -0
- package/dist/files/context.d.ts +97 -0
- package/dist/files/context.js +185 -0
- package/dist/files/index.d.ts +210 -0
- package/dist/files/index.js +338 -0
- package/dist/files/read-tool.d.ts +81 -0
- package/dist/files/read-tool.js +163 -0
- package/dist/files/turn-parts.d.ts +96 -0
- package/dist/files/turn-parts.js +171 -0
- package/dist/flows/index.d.ts +270 -0
- package/dist/flows/index.js +62 -0
- package/dist/flows/interpreter.d.ts +146 -0
- package/dist/flows/interpreter.js +426 -0
- package/dist/flows/runner.d.ts +145 -0
- package/dist/flows/runner.js +270 -0
- package/dist/graphql/index.d.ts +8 -0
- package/dist/graphql/index.js +8 -0
- package/dist/graphql/resolvers.d.ts +237 -0
- package/dist/graphql/resolvers.js +253 -0
- package/dist/graphql/schema.d.ts +11 -0
- package/dist/graphql/schema.js +258 -0
- package/dist/graphql/sse.d.ts +77 -0
- package/dist/graphql/sse.js +100 -0
- package/dist/hitl/approved-execution.d.ts +127 -0
- package/dist/hitl/approved-execution.js +177 -0
- package/dist/hitl/index.d.ts +79 -0
- package/dist/hitl/index.js +12 -0
- package/dist/hitl/service.d.ts +221 -0
- package/dist/hitl/service.js +268 -0
- package/dist/idempotency/index.d.ts +70 -0
- package/dist/idempotency/index.js +59 -0
- package/dist/index.d.ts +103 -0
- package/dist/index.js +60 -0
- package/dist/knowledge/chunking.d.ts +57 -0
- package/dist/knowledge/chunking.js +158 -0
- package/dist/knowledge/index.d.ts +119 -0
- package/dist/knowledge/index.js +166 -0
- package/dist/knowledge/retrieval.d.ts +146 -0
- package/dist/knowledge/retrieval.js +170 -0
- package/dist/loadtest/harness.d.ts +168 -0
- package/dist/loadtest/harness.js +507 -0
- package/dist/loadtest/index.d.ts +13 -0
- package/dist/loadtest/index.js +13 -0
- package/dist/loadtest/injection.d.ts +89 -0
- package/dist/loadtest/injection.js +147 -0
- package/dist/loadtest/metrics.d.ts +197 -0
- package/dist/loadtest/metrics.js +160 -0
- package/dist/loadtest/runbooks.d.ts +28 -0
- package/dist/loadtest/runbooks.js +159 -0
- package/dist/loadtest/scenario.d.ts +104 -0
- package/dist/loadtest/scenario.js +208 -0
- package/dist/mcp/egress.d.ts +53 -0
- package/dist/mcp/egress.js +115 -0
- package/dist/mcp/index.d.ts +93 -0
- package/dist/mcp/index.js +33 -0
- package/dist/mcp/provider.d.ts +62 -0
- package/dist/mcp/provider.js +0 -0
- package/dist/models/index.d.ts +98 -0
- package/dist/models/index.js +74 -0
- package/dist/models/pricing.d.ts +24 -0
- package/dist/models/pricing.js +37 -0
- package/dist/models/provider-factory.d.ts +31 -0
- package/dist/models/provider-factory.js +67 -0
- package/dist/models/streaming.d.ts +145 -0
- package/dist/models/streaming.js +272 -0
- package/dist/models/vision.d.ts +38 -0
- package/dist/models/vision.js +62 -0
- package/dist/persistence/index.d.ts +1654 -0
- package/dist/persistence/index.js +226 -0
- package/dist/principal-memory/index.d.ts +106 -0
- package/dist/principal-memory/index.js +89 -0
- package/dist/retention/index.d.ts +89 -0
- package/dist/retention/index.js +70 -0
- package/dist/runtime/checkpoint.d.ts +37 -0
- package/dist/runtime/checkpoint.js +22 -0
- package/dist/runtime/index.d.ts +118 -0
- package/dist/runtime/index.js +69 -0
- package/dist/runtime/retry.d.ts +95 -0
- package/dist/runtime/retry.js +126 -0
- package/dist/runtime/serialization.d.ts +85 -0
- package/dist/runtime/serialization.js +95 -0
- package/dist/runtime/streaming.d.ts +54 -0
- package/dist/runtime/streaming.js +115 -0
- package/dist/runtime/worker.d.ts +130 -0
- package/dist/runtime/worker.js +405 -0
- package/dist/security/checklist.d.ts +53 -0
- package/dist/security/checklist.js +204 -0
- package/dist/security/findings.d.ts +56 -0
- package/dist/security/findings.js +168 -0
- package/dist/security/index.d.ts +14 -0
- package/dist/security/index.js +14 -0
- package/dist/security/prompt-safety.d.ts +100 -0
- package/dist/security/prompt-safety.js +133 -0
- package/dist/server/boot.d.ts +32 -0
- package/dist/server/boot.js +36 -0
- package/dist/server/cli-worker.d.ts +37 -0
- package/dist/server/cli-worker.js +151 -0
- package/dist/server/cli.d.ts +27 -0
- package/dist/server/cli.js +74 -0
- package/dist/server/config.d.ts +42 -0
- package/dist/server/config.js +127 -0
- package/dist/server/health.d.ts +59 -0
- package/dist/server/health.js +90 -0
- package/dist/server/host.d.ts +39 -0
- package/dist/server/host.js +124 -0
- package/dist/server/index.d.ts +15 -0
- package/dist/server/index.js +15 -0
- package/dist/server/main.d.ts +16 -0
- package/dist/server/main.js +31 -0
- package/dist/server/sse-route.d.ts +21 -0
- package/dist/server/sse-route.js +282 -0
- package/dist/skills/index.d.ts +67 -0
- package/dist/skills/index.js +31 -0
- package/dist/skills/resolver.d.ts +54 -0
- package/dist/skills/resolver.js +121 -0
- package/dist/teams/index.d.ts +93 -0
- package/dist/teams/index.js +207 -0
- package/dist/telemetry/index.d.ts +157 -0
- package/dist/telemetry/index.js +71 -0
- package/dist/telemetry/instrument.d.ts +108 -0
- package/dist/telemetry/instrument.js +232 -0
- package/dist/telemetry/log-events.d.ts +17 -0
- package/dist/telemetry/log-events.js +58 -0
- package/dist/telemetry/metrics.d.ts +123 -0
- package/dist/telemetry/metrics.js +135 -0
- package/dist/telemetry/noop.d.ts +39 -0
- package/dist/telemetry/noop.js +143 -0
- package/dist/telemetry/redaction.d.ts +64 -0
- package/dist/telemetry/redaction.js +153 -0
- package/dist/telemetry/spans.d.ts +56 -0
- package/dist/telemetry/spans.js +78 -0
- package/dist/telemetry/trace-context.d.ts +55 -0
- package/dist/telemetry/trace-context.js +60 -0
- package/dist/toolkit/compute.d.ts +53 -0
- package/dist/toolkit/compute.js +152 -0
- package/dist/toolkit/data.d.ts +98 -0
- package/dist/toolkit/data.js +235 -0
- package/dist/toolkit/http.d.ts +113 -0
- package/dist/toolkit/http.js +205 -0
- package/dist/toolkit/index.d.ts +21 -0
- package/dist/toolkit/index.js +17 -0
- package/dist/toolkit/web.d.ts +107 -0
- package/dist/toolkit/web.js +147 -0
- package/dist/tools/define.d.ts +25 -0
- package/dist/tools/define.js +45 -0
- package/dist/tools/delegating.d.ts +132 -0
- package/dist/tools/delegating.js +211 -0
- package/dist/tools/index.d.ts +129 -0
- package/dist/tools/index.js +33 -0
- package/dist/tools/library/compute.d.ts +11 -0
- package/dist/tools/library/compute.js +46 -0
- package/dist/tools/library/data.d.ts +16 -0
- package/dist/tools/library/data.js +92 -0
- package/dist/tools/library/http.d.ts +28 -0
- package/dist/tools/library/http.js +71 -0
- package/dist/tools/library/index.d.ts +97 -0
- package/dist/tools/library/index.js +134 -0
- package/dist/tools/library/knowledge.d.ts +39 -0
- package/dist/tools/library/knowledge.js +58 -0
- package/dist/tools/library/web.d.ts +19 -0
- package/dist/tools/library/web.js +65 -0
- package/dist/tools/meta-tools.d.ts +19 -0
- package/dist/tools/meta-tools.js +36 -0
- package/dist/tools/registry.d.ts +146 -0
- package/dist/tools/registry.js +291 -0
- package/dist/usage/index.d.ts +105 -0
- package/dist/usage/index.js +20 -0
- package/dist/usage/quota.d.ts +258 -0
- package/dist/usage/quota.js +510 -0
- package/dist/usage/recorder.d.ts +29 -0
- package/dist/usage/recorder.js +96 -0
- package/dist/usage/rollups.d.ts +121 -0
- package/dist/usage/rollups.js +157 -0
- package/dist/worker/export.d.ts +57 -0
- package/dist/worker/export.js +81 -0
- package/dist/worker/extraction.d.ts +57 -0
- package/dist/worker/extraction.js +84 -0
- package/dist/worker/main.d.ts +103 -0
- package/dist/worker/main.js +159 -0
- package/package.json +187 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OCR and vision, feeding the same derived-artifact path (#132).
|
|
3
|
+
*
|
|
4
|
+
* The point of this file is that a screenshot, a scanned PDF and a Markdown file all end up as the same
|
|
5
|
+
* `ExtractedDocument`. Downstream — `read_document`, the context section, the blob — sees one representation
|
|
6
|
+
* regardless of where the text came from, which is what stops "can the model read this?" depending on the
|
|
7
|
+
* format the user happened to attach.
|
|
8
|
+
*
|
|
9
|
+
* Two ports, because the two jobs are genuinely different and conflating them would force one adapter to do
|
|
10
|
+
* both badly:
|
|
11
|
+
*
|
|
12
|
+
* - **`OcrProvider`** transcribes. Given a scan it returns the words that are on the page, with a confidence.
|
|
13
|
+
* It does not interpret.
|
|
14
|
+
* - **`VisionProvider`** describes. Given a screenshot or a chart it says what is shown, which is the only
|
|
15
|
+
* useful answer for an image with no text in it.
|
|
16
|
+
*
|
|
17
|
+
* **There is no built-in OCR adapter, and there cannot honestly be one.** OCR needs a trained engine —
|
|
18
|
+
* Tesseract, or a hosted service. The PDF parser in #131 could be written over the raw syntax with `zlib`
|
|
19
|
+
* because a PDF *contains* its text; a scan does not contain text at all. So `OcrProvider` is a port with a
|
|
20
|
+
* documented contract and no implementation in this package, and a deployment that needs OCR supplies one.
|
|
21
|
+
* The alternative — a stub that returns empty text — would make every scan look like a successful extraction
|
|
22
|
+
* of nothing, which is precisely the failure `no-text-layer` exists to prevent.
|
|
23
|
+
*
|
|
24
|
+
* The vision side *is* implemented, over the model registry, because a vision-capable model is already a
|
|
25
|
+
* dependency this platform has.
|
|
26
|
+
*/
|
|
27
|
+
import type { ExecutionContext } from "../core/context.js";
|
|
28
|
+
import type { RunId } from "../core/ids.js";
|
|
29
|
+
import type { ModelRegistry } from "../models/index.js";
|
|
30
|
+
import type { ProviderFactory } from "../models/provider-factory.js";
|
|
31
|
+
import { DEFAULT_VISION_PROMPT } from "../models/vision.js";
|
|
32
|
+
import type { UsageRecorder } from "../usage/index.js";
|
|
33
|
+
import type { DocumentBlock, DocumentParser, ExtractionFailure, ExtractionLimits } from "./index.js";
|
|
34
|
+
/**
|
|
35
|
+
* Below this, extraction is flagged rather than presented as certain — AC-5.
|
|
36
|
+
*
|
|
37
|
+
* Re-exported from `persistence`, not defined here. Two layers interpret the field and neither may import the
|
|
38
|
+
* other, so the port that declares `confidence` owns the number that gives it meaning.
|
|
39
|
+
*/
|
|
40
|
+
export declare const LOW_CONFIDENCE_WARNING = "The text was recognised with low confidence and may contain errors. Treat figures and names as uncertain.";
|
|
41
|
+
/** The image types this platform will send to a vision model or an OCR engine. */
|
|
42
|
+
export declare const IMAGE_MEDIA_TYPES: readonly ["image/png", "image/jpeg", "image/webp", "image/gif"];
|
|
43
|
+
export type OcrResult = {
|
|
44
|
+
readonly blocks: readonly DocumentBlock[];
|
|
45
|
+
/**
|
|
46
|
+
* 0–1, the engine's own confidence.
|
|
47
|
+
*
|
|
48
|
+
* Required, not optional. An engine that cannot report one should say `0` and let the low-confidence flag
|
|
49
|
+
* fire, because "no confidence reported" and "high confidence" must never be the same value — the default
|
|
50
|
+
* would be the optimistic one and nobody would notice.
|
|
51
|
+
*/
|
|
52
|
+
readonly confidence: number;
|
|
53
|
+
readonly pageCount?: number;
|
|
54
|
+
readonly warnings?: readonly string[];
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Transcribes an image or a scanned document.
|
|
58
|
+
*
|
|
59
|
+
* Takes the **original bytes and media type**, not page images: rasterising a PDF needs a renderer, and every
|
|
60
|
+
* real OCR service (Textract, Document AI, Azure Document Intelligence) accepts a PDF directly and does that
|
|
61
|
+
* itself. Making rasterisation the provider's business is both simpler and what the APIs already assume.
|
|
62
|
+
*/
|
|
63
|
+
export interface OcrProvider {
|
|
64
|
+
readonly id: string;
|
|
65
|
+
readonly mediaTypes: readonly string[];
|
|
66
|
+
recognise(input: {
|
|
67
|
+
readonly bytes: Uint8Array;
|
|
68
|
+
readonly mediaType: string;
|
|
69
|
+
readonly limits: ExtractionLimits;
|
|
70
|
+
}): Promise<OcrResult | ExtractionFailure>;
|
|
71
|
+
}
|
|
72
|
+
export type VisionResult = {
|
|
73
|
+
readonly description: string;
|
|
74
|
+
readonly modelId: string;
|
|
75
|
+
readonly inputTokens: number;
|
|
76
|
+
readonly outputTokens: number;
|
|
77
|
+
readonly cachedInputTokens: number;
|
|
78
|
+
};
|
|
79
|
+
/** Describes an image. Separate from OCR: transcribing and interpreting are different jobs. */
|
|
80
|
+
export interface VisionProvider {
|
|
81
|
+
readonly id: string;
|
|
82
|
+
readonly mediaTypes: readonly string[];
|
|
83
|
+
describe(input: {
|
|
84
|
+
readonly bytes: Uint8Array;
|
|
85
|
+
readonly mediaType: string;
|
|
86
|
+
readonly prompt?: string;
|
|
87
|
+
}): Promise<VisionResult>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* A `VisionProvider` over the model registry.
|
|
91
|
+
*
|
|
92
|
+
* `requiredModalities: ["image"]` is AC-3, and it is enforced by `resolve` throwing rather than by a check
|
|
93
|
+
* here — see `models/vision.ts`. The refusal surfaces as `capability_unavailable`, which the pipeline records
|
|
94
|
+
* as a typed failure, so a deployment with no vision model gets "this platform cannot describe images"
|
|
95
|
+
* instead of a description of an image nobody looked at.
|
|
96
|
+
*/
|
|
97
|
+
export declare const createModelVisionProvider: (deps: {
|
|
98
|
+
readonly registry: ModelRegistry;
|
|
99
|
+
readonly providers: ProviderFactory;
|
|
100
|
+
/** `smart` by default: a description is read by a person and a cheap model's is not worth the tokens. */
|
|
101
|
+
readonly role?: "fast" | "smart";
|
|
102
|
+
readonly maxOutputTokens?: number;
|
|
103
|
+
}) => VisionProvider;
|
|
104
|
+
/**
|
|
105
|
+
* A synthetic run id for a background extraction.
|
|
106
|
+
*
|
|
107
|
+
* `UsageEvent.runId` is required, and an extraction is **not a run** — it has no conversation turn and no
|
|
108
|
+
* agent. Rather than widen the usage ledger with a second identity dimension, the extraction borrows the
|
|
109
|
+
* field with a namespaced value. Two consequences worth knowing:
|
|
110
|
+
*
|
|
111
|
+
* - The ledger stays single, which is what AC-4 asks for: one place to answer "what did this tenant spend".
|
|
112
|
+
* - `usageDedupeKey` is `(runId, stepId)`, so a retried extraction of the same file records **once**. That is
|
|
113
|
+
* not incidental — vision calls are the expensive kind, and a re-enqueued job double-charging a tenant is
|
|
114
|
+
* the failure this shape prevents.
|
|
115
|
+
*
|
|
116
|
+
* The wart is that `runId` no longer always names a run. Flagged rather than hidden; a separate cost dimension
|
|
117
|
+
* would be the cleaner answer if the ledger ever needs to distinguish them.
|
|
118
|
+
*/
|
|
119
|
+
export declare const extractionRunId: (fileId: string) => RunId;
|
|
120
|
+
/**
|
|
121
|
+
* The image parser: OCR when there is text to transcribe, vision to describe, or both.
|
|
122
|
+
*
|
|
123
|
+
* Both is the useful default for a screenshot. A screenshot of a dashboard has text *and* a chart, and either
|
|
124
|
+
* alone loses half of it — the numbers without the layout, or the layout without the numbers.
|
|
125
|
+
*/
|
|
126
|
+
export declare const createImageDocumentParser: (deps: {
|
|
127
|
+
readonly vision?: VisionProvider;
|
|
128
|
+
readonly ocr?: OcrProvider;
|
|
129
|
+
/**
|
|
130
|
+
* Observed for tests and hosts that want the raw result.
|
|
131
|
+
*
|
|
132
|
+
* **Not the billing path.** Billing goes through the returned document's `usage`, because only the pipeline
|
|
133
|
+
* knows which file a parse belonged to — a callback held by the parser is shared across every file it ever
|
|
134
|
+
* parses, so correlating one would mean trusting that parses never interleave.
|
|
135
|
+
*/
|
|
136
|
+
readonly onVisionUsage?: (usage: VisionResult) => void;
|
|
137
|
+
}) => DocumentParser;
|
|
138
|
+
/**
|
|
139
|
+
* OCR for a document the text parser could not read — a scanned PDF.
|
|
140
|
+
*
|
|
141
|
+
* A *fallback* parser rather than a second entry in the dispatch table, because both parsers claim
|
|
142
|
+
* `application/pdf` and the dispatch table holds one per media type. The pipeline tries the text parser
|
|
143
|
+
* first and falls back only on `no-text-layer`, which is the reason #131 made that a distinct reason rather
|
|
144
|
+
* than folding it into `malformed`: the distinction is now load-bearing.
|
|
145
|
+
*/
|
|
146
|
+
export declare const createScannedPdfParser: (deps: {
|
|
147
|
+
readonly ocr: OcrProvider;
|
|
148
|
+
}) => DocumentParser;
|
|
149
|
+
/** Records a vision call against the usage ledger. Separate so the parser stays free of billing. */
|
|
150
|
+
export declare const recordVisionUsage: (recorder: UsageRecorder, context: ExecutionContext, input: {
|
|
151
|
+
readonly fileId: string;
|
|
152
|
+
readonly usage: VisionResult;
|
|
153
|
+
readonly costMinorUnits: number;
|
|
154
|
+
readonly currency: string;
|
|
155
|
+
}) => Promise<void>;
|
|
156
|
+
/** Guard for a media type this platform treats as an image. */
|
|
157
|
+
export declare const isImageMediaType: (mediaType: string) => boolean;
|
|
158
|
+
export { DEFAULT_VISION_PROMPT };
|
|
159
|
+
//# sourceMappingURL=vision.d.ts.map
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OCR and vision, feeding the same derived-artifact path (#132).
|
|
3
|
+
*
|
|
4
|
+
* The point of this file is that a screenshot, a scanned PDF and a Markdown file all end up as the same
|
|
5
|
+
* `ExtractedDocument`. Downstream — `read_document`, the context section, the blob — sees one representation
|
|
6
|
+
* regardless of where the text came from, which is what stops "can the model read this?" depending on the
|
|
7
|
+
* format the user happened to attach.
|
|
8
|
+
*
|
|
9
|
+
* Two ports, because the two jobs are genuinely different and conflating them would force one adapter to do
|
|
10
|
+
* both badly:
|
|
11
|
+
*
|
|
12
|
+
* - **`OcrProvider`** transcribes. Given a scan it returns the words that are on the page, with a confidence.
|
|
13
|
+
* It does not interpret.
|
|
14
|
+
* - **`VisionProvider`** describes. Given a screenshot or a chart it says what is shown, which is the only
|
|
15
|
+
* useful answer for an image with no text in it.
|
|
16
|
+
*
|
|
17
|
+
* **There is no built-in OCR adapter, and there cannot honestly be one.** OCR needs a trained engine —
|
|
18
|
+
* Tesseract, or a hosted service. The PDF parser in #131 could be written over the raw syntax with `zlib`
|
|
19
|
+
* because a PDF *contains* its text; a scan does not contain text at all. So `OcrProvider` is a port with a
|
|
20
|
+
* documented contract and no implementation in this package, and a deployment that needs OCR supplies one.
|
|
21
|
+
* The alternative — a stub that returns empty text — would make every scan look like a successful extraction
|
|
22
|
+
* of nothing, which is precisely the failure `no-text-layer` exists to prevent.
|
|
23
|
+
*
|
|
24
|
+
* The vision side *is* implemented, over the model registry, because a vision-capable model is already a
|
|
25
|
+
* dependency this platform has.
|
|
26
|
+
*/
|
|
27
|
+
import { AgentPlatformError } from "../core/errors.js";
|
|
28
|
+
import { DEFAULT_VISION_PROMPT, describeImage } from "../models/vision.js";
|
|
29
|
+
import { LOW_CONFIDENCE_THRESHOLD as THRESHOLD } from "../persistence/index.js";
|
|
30
|
+
/**
|
|
31
|
+
* Below this, extraction is flagged rather than presented as certain — AC-5.
|
|
32
|
+
*
|
|
33
|
+
* Re-exported from `persistence`, not defined here. Two layers interpret the field and neither may import the
|
|
34
|
+
* other, so the port that declares `confidence` owns the number that gives it meaning.
|
|
35
|
+
*/
|
|
36
|
+
// `LOW_CONFIDENCE_THRESHOLD` is persistence's, and re-exporting it here gave one name two subpaths (#199).
|
|
37
|
+
export const LOW_CONFIDENCE_WARNING = "The text was recognised with low confidence and may contain errors. Treat figures and names as uncertain.";
|
|
38
|
+
/** The image types this platform will send to a vision model or an OCR engine. */
|
|
39
|
+
export const IMAGE_MEDIA_TYPES = ["image/png", "image/jpeg", "image/webp", "image/gif"];
|
|
40
|
+
/**
|
|
41
|
+
* A `VisionProvider` over the model registry.
|
|
42
|
+
*
|
|
43
|
+
* `requiredModalities: ["image"]` is AC-3, and it is enforced by `resolve` throwing rather than by a check
|
|
44
|
+
* here — see `models/vision.ts`. The refusal surfaces as `capability_unavailable`, which the pipeline records
|
|
45
|
+
* as a typed failure, so a deployment with no vision model gets "this platform cannot describe images"
|
|
46
|
+
* instead of a description of an image nobody looked at.
|
|
47
|
+
*/
|
|
48
|
+
export const createModelVisionProvider = (deps) => ({
|
|
49
|
+
id: "model-vision",
|
|
50
|
+
mediaTypes: IMAGE_MEDIA_TYPES,
|
|
51
|
+
async describe({ bytes, mediaType, prompt }) {
|
|
52
|
+
// Throws `capability_unavailable` when nothing satisfies it. Deliberately not caught: a fabricated
|
|
53
|
+
// description is the one outcome worse than no description, and swallowing this is how you get one.
|
|
54
|
+
const definition = deps.registry.resolve({
|
|
55
|
+
role: deps.role ?? "smart",
|
|
56
|
+
requiredModalities: ["image"],
|
|
57
|
+
});
|
|
58
|
+
const model = deps.providers.languageModel(definition);
|
|
59
|
+
const result = await describeImage({
|
|
60
|
+
model,
|
|
61
|
+
bytes,
|
|
62
|
+
mediaType,
|
|
63
|
+
...(prompt === undefined ? {} : { prompt }),
|
|
64
|
+
...(deps.maxOutputTokens === undefined ? {} : { maxOutputTokens: deps.maxOutputTokens }),
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
description: result.text,
|
|
68
|
+
modelId: definition.modelId,
|
|
69
|
+
inputTokens: result.usage.inputTokens,
|
|
70
|
+
outputTokens: result.usage.outputTokens,
|
|
71
|
+
cachedInputTokens: result.usage.cachedInputTokens,
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* A synthetic run id for a background extraction.
|
|
77
|
+
*
|
|
78
|
+
* `UsageEvent.runId` is required, and an extraction is **not a run** — it has no conversation turn and no
|
|
79
|
+
* agent. Rather than widen the usage ledger with a second identity dimension, the extraction borrows the
|
|
80
|
+
* field with a namespaced value. Two consequences worth knowing:
|
|
81
|
+
*
|
|
82
|
+
* - The ledger stays single, which is what AC-4 asks for: one place to answer "what did this tenant spend".
|
|
83
|
+
* - `usageDedupeKey` is `(runId, stepId)`, so a retried extraction of the same file records **once**. That is
|
|
84
|
+
* not incidental — vision calls are the expensive kind, and a re-enqueued job double-charging a tenant is
|
|
85
|
+
* the failure this shape prevents.
|
|
86
|
+
*
|
|
87
|
+
* The wart is that `runId` no longer always names a run. Flagged rather than hidden; a separate cost dimension
|
|
88
|
+
* would be the cleaner answer if the ledger ever needs to distinguish them.
|
|
89
|
+
*/
|
|
90
|
+
export const extractionRunId = (fileId) => `extraction:${fileId}`;
|
|
91
|
+
/**
|
|
92
|
+
* The image parser: OCR when there is text to transcribe, vision to describe, or both.
|
|
93
|
+
*
|
|
94
|
+
* Both is the useful default for a screenshot. A screenshot of a dashboard has text *and* a chart, and either
|
|
95
|
+
* alone loses half of it — the numbers without the layout, or the layout without the numbers.
|
|
96
|
+
*/
|
|
97
|
+
export const createImageDocumentParser = (deps) => ({
|
|
98
|
+
id: "image",
|
|
99
|
+
mediaTypes: IMAGE_MEDIA_TYPES,
|
|
100
|
+
async parse({ bytes, mediaType, limits }) {
|
|
101
|
+
if (bytes.byteLength > limits.maxBytes)
|
|
102
|
+
return {
|
|
103
|
+
reason: "too-large",
|
|
104
|
+
// AC-6, with the limit named rather than implied.
|
|
105
|
+
message: `That image is larger than the ${limits.maxBytes} byte limit.`,
|
|
106
|
+
};
|
|
107
|
+
const blocks = [];
|
|
108
|
+
const warnings = [];
|
|
109
|
+
const usage = [];
|
|
110
|
+
let confidence;
|
|
111
|
+
if (deps.ocr !== undefined && deps.ocr.mediaTypes.includes(mediaType)) {
|
|
112
|
+
const result = await deps.ocr.recognise({ bytes, mediaType, limits });
|
|
113
|
+
if ("reason" in result) {
|
|
114
|
+
// An OCR failure is not fatal when vision can still describe the image: a photograph with no text
|
|
115
|
+
// is exactly that case, and refusing the whole extraction would lose the description too.
|
|
116
|
+
warnings.push(`Text recognition failed: ${result.message}`);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
blocks.push(...result.blocks);
|
|
120
|
+
confidence = result.confidence;
|
|
121
|
+
warnings.push(...(result.warnings ?? []));
|
|
122
|
+
// AC-5. The flag is derived from the number rather than left to a reader to compare, so every
|
|
123
|
+
// consumer treats the same document as uncertain.
|
|
124
|
+
if (result.confidence < THRESHOLD)
|
|
125
|
+
warnings.push(LOW_CONFIDENCE_WARNING);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (deps.vision !== undefined && deps.vision.mediaTypes.includes(mediaType)) {
|
|
129
|
+
const result = await deps.vision.describe({ bytes, mediaType });
|
|
130
|
+
deps.onVisionUsage?.(result);
|
|
131
|
+
// Reported whether or not the description came back usable: the tokens were spent either way, and a
|
|
132
|
+
// call that produced nothing is exactly the one a bill should show.
|
|
133
|
+
usage.push({
|
|
134
|
+
kind: "vision",
|
|
135
|
+
modelId: result.modelId,
|
|
136
|
+
inputTokens: result.inputTokens,
|
|
137
|
+
outputTokens: result.outputTokens,
|
|
138
|
+
cachedInputTokens: result.cachedInputTokens,
|
|
139
|
+
});
|
|
140
|
+
if (result.description.trim() !== "")
|
|
141
|
+
// Labelled, because a description is the model's reading of an image and a transcription is what the
|
|
142
|
+
// image says. Presenting them identically would let a later answer cite an inference as a quote.
|
|
143
|
+
blocks.push({ kind: "heading", level: 2, text: "Image description" });
|
|
144
|
+
blocks.push({ kind: "paragraph", text: result.description.trim() });
|
|
145
|
+
}
|
|
146
|
+
if (blocks.length === 0)
|
|
147
|
+
return {
|
|
148
|
+
reason: "no-text-layer",
|
|
149
|
+
message: deps.ocr === undefined && deps.vision === undefined
|
|
150
|
+
? "This platform is not configured to read images."
|
|
151
|
+
: "Nothing could be read from that image.",
|
|
152
|
+
};
|
|
153
|
+
return {
|
|
154
|
+
blocks,
|
|
155
|
+
truncated: false,
|
|
156
|
+
warnings,
|
|
157
|
+
...(confidence === undefined ? {} : { confidence }),
|
|
158
|
+
...(usage.length === 0 ? {} : { usage }),
|
|
159
|
+
};
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
/**
|
|
163
|
+
* OCR for a document the text parser could not read — a scanned PDF.
|
|
164
|
+
*
|
|
165
|
+
* A *fallback* parser rather than a second entry in the dispatch table, because both parsers claim
|
|
166
|
+
* `application/pdf` and the dispatch table holds one per media type. The pipeline tries the text parser
|
|
167
|
+
* first and falls back only on `no-text-layer`, which is the reason #131 made that a distinct reason rather
|
|
168
|
+
* than folding it into `malformed`: the distinction is now load-bearing.
|
|
169
|
+
*/
|
|
170
|
+
export const createScannedPdfParser = (deps) => ({
|
|
171
|
+
id: "scanned-pdf",
|
|
172
|
+
mediaTypes: ["application/pdf"],
|
|
173
|
+
async parse({ bytes, mediaType, limits }) {
|
|
174
|
+
if (bytes.byteLength > limits.maxBytes)
|
|
175
|
+
return { reason: "too-large", message: `That document is larger than the ${limits.maxBytes} byte limit.` };
|
|
176
|
+
const result = await deps.ocr.recognise({ bytes, mediaType, limits });
|
|
177
|
+
if ("reason" in result)
|
|
178
|
+
return result;
|
|
179
|
+
const warnings = [...(result.warnings ?? [])];
|
|
180
|
+
if (result.confidence < THRESHOLD)
|
|
181
|
+
warnings.push(LOW_CONFIDENCE_WARNING);
|
|
182
|
+
if (result.blocks.length === 0)
|
|
183
|
+
return {
|
|
184
|
+
reason: "no-text-layer",
|
|
185
|
+
message: "Text recognition found no readable text in that document.",
|
|
186
|
+
};
|
|
187
|
+
return {
|
|
188
|
+
blocks: result.blocks,
|
|
189
|
+
...(result.pageCount === undefined ? {} : { pageCount: result.pageCount }),
|
|
190
|
+
truncated: false,
|
|
191
|
+
warnings,
|
|
192
|
+
confidence: result.confidence,
|
|
193
|
+
};
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
/** Records a vision call against the usage ledger. Separate so the parser stays free of billing. */
|
|
197
|
+
export const recordVisionUsage = async (recorder, context, input) => {
|
|
198
|
+
await recorder.record(context, {
|
|
199
|
+
runId: extractionRunId(input.fileId),
|
|
200
|
+
// The step, so `usageDedupeKey` makes a retried extraction record once rather than charging twice for
|
|
201
|
+
// the same image.
|
|
202
|
+
stepId: "vision",
|
|
203
|
+
modelId: input.usage.modelId,
|
|
204
|
+
inputTokens: input.usage.inputTokens,
|
|
205
|
+
outputTokens: input.usage.outputTokens,
|
|
206
|
+
cachedInputTokens: input.usage.cachedInputTokens,
|
|
207
|
+
costMinorUnits: input.costMinorUnits,
|
|
208
|
+
currency: input.currency,
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
/** Guard for a media type this platform treats as an image. */
|
|
212
|
+
export const isImageMediaType = (mediaType) => IMAGE_MEDIA_TYPES.includes(mediaType.split(";")[0]?.trim().toLowerCase() ?? "");
|
|
213
|
+
export { DEFAULT_VISION_PROMPT };
|
|
214
|
+
//# sourceMappingURL=vision.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/adapters/bullmq` — the durable queue and its dispatchers.
|
|
3
|
+
*
|
|
4
|
+
* `bullmq` and `ioredis` are optional peers. Importing this constructs no connection; only
|
|
5
|
+
* `createBullMqRunQueue` does.
|
|
6
|
+
*/
|
|
7
|
+
export * from "../adapters/bullmq/index.js";
|
|
8
|
+
//# sourceMappingURL=adapters-bullmq.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/adapters/bullmq` — the durable queue and its dispatchers.
|
|
3
|
+
*
|
|
4
|
+
* `bullmq` and `ioredis` are optional peers. Importing this constructs no connection; only
|
|
5
|
+
* `createBullMqRunQueue` does.
|
|
6
|
+
*/
|
|
7
|
+
export * from "../adapters/bullmq/index.js";
|
|
8
|
+
//# sourceMappingURL=adapters-bullmq.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/adapters/otel` — the OpenTelemetry exporter for the telemetry port.
|
|
3
|
+
*
|
|
4
|
+
* Its own entry for the reason boundary rule R11 exists: "vendor-neutral instrumentation" is only true if the
|
|
5
|
+
* vendor's SDK is confined to one place.
|
|
6
|
+
*
|
|
7
|
+
* It takes **no peer dependency**, which surprised me while packaging this: the adapter defines the structural
|
|
8
|
+
* types it needs and the caller passes a real provider, so `@opentelemetry/api` appears only in the tests. It
|
|
9
|
+
* was briefly declared as an optional peer here — an install requirement for something never imported — and
|
|
10
|
+
* removed once checked.
|
|
11
|
+
*/
|
|
12
|
+
export * from "../adapters/otel/index.js";
|
|
13
|
+
//# sourceMappingURL=adapters-otel.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/adapters/otel` — the OpenTelemetry exporter for the telemetry port.
|
|
3
|
+
*
|
|
4
|
+
* Its own entry for the reason boundary rule R11 exists: "vendor-neutral instrumentation" is only true if the
|
|
5
|
+
* vendor's SDK is confined to one place.
|
|
6
|
+
*
|
|
7
|
+
* It takes **no peer dependency**, which surprised me while packaging this: the adapter defines the structural
|
|
8
|
+
* types it needs and the caller passes a real provider, so `@opentelemetry/api` appears only in the tests. It
|
|
9
|
+
* was briefly declared as an optional peer here — an install requirement for something never imported — and
|
|
10
|
+
* removed once checked.
|
|
11
|
+
*/
|
|
12
|
+
export * from "../adapters/otel/index.js";
|
|
13
|
+
//# sourceMappingURL=adapters-otel.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/adapters/postgres` — the Postgres and Supabase adapters, and the migrations.
|
|
3
|
+
*
|
|
4
|
+
* Its own entry because `pg` is an optional peer. Supabase ships here rather than separately: it *is* these
|
|
5
|
+
* adapters over a connection with row-level security enabled, so splitting them would suggest a second
|
|
6
|
+
* implementation exists.
|
|
7
|
+
*/
|
|
8
|
+
export * from "../adapters/postgres/index.js";
|
|
9
|
+
export * from "../adapters/supabase/index.js";
|
|
10
|
+
//# sourceMappingURL=adapters-postgres.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/adapters/postgres` — the Postgres and Supabase adapters, and the migrations.
|
|
3
|
+
*
|
|
4
|
+
* Its own entry because `pg` is an optional peer. Supabase ships here rather than separately: it *is* these
|
|
5
|
+
* adapters over a connection with row-level security enabled, so splitting them would suggest a second
|
|
6
|
+
* implementation exists.
|
|
7
|
+
*/
|
|
8
|
+
export * from "../adapters/postgres/index.js";
|
|
9
|
+
export * from "../adapters/supabase/index.js";
|
|
10
|
+
//# sourceMappingURL=adapters-postgres.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/context` — what goes into the prompt, and what comes back out of it.
|
|
3
|
+
*
|
|
4
|
+
* Assembly and budgeting, skills, per-principal memory, and citations. Grouped because they are one decision
|
|
5
|
+
* from the host's side: everything here competes for the same window.
|
|
6
|
+
*/
|
|
7
|
+
export * from "../context/index.js";
|
|
8
|
+
export * from "../skills/index.js";
|
|
9
|
+
export * from "../principal-memory/index.js";
|
|
10
|
+
export * from "../citations/index.js";
|
|
11
|
+
/**
|
|
12
|
+
* Prompt safety is context, not security review.
|
|
13
|
+
*
|
|
14
|
+
* `encloseUntrusted`, `makeNonce` and `renderContextBlock` are how third-party text is rendered *into* a prompt
|
|
15
|
+
* — the same subject as assembly and budgeting, and reached at the same moment. They sit in `src/security/`
|
|
16
|
+
* beside the executable security acceptances, which is a directory grouped by concern rather than by consumer;
|
|
17
|
+
* this is the consumer view, so they are here and the acceptances are at `./observability`.
|
|
18
|
+
*/
|
|
19
|
+
export * from "../security/prompt-safety.js";
|
|
20
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/context` — what goes into the prompt, and what comes back out of it.
|
|
3
|
+
*
|
|
4
|
+
* Assembly and budgeting, skills, per-principal memory, and citations. Grouped because they are one decision
|
|
5
|
+
* from the host's side: everything here competes for the same window.
|
|
6
|
+
*/
|
|
7
|
+
export * from "../context/index.js";
|
|
8
|
+
export * from "../skills/index.js";
|
|
9
|
+
export * from "../principal-memory/index.js";
|
|
10
|
+
export * from "../citations/index.js";
|
|
11
|
+
/**
|
|
12
|
+
* Prompt safety is context, not security review.
|
|
13
|
+
*
|
|
14
|
+
* `encloseUntrusted`, `makeNonce` and `renderContextBlock` are how third-party text is rendered *into* a prompt
|
|
15
|
+
* — the same subject as assembly and budgeting, and reached at the same moment. They sit in `src/security/`
|
|
16
|
+
* beside the executable security acceptances, which is a directory grouped by concern rather than by consumer;
|
|
17
|
+
* this is the consumer view, so they are here and the acceptances are at `./observability`.
|
|
18
|
+
*/
|
|
19
|
+
export * from "../security/prompt-safety.js";
|
|
20
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/flows` — durable workflows, and teams as a kind of step.
|
|
3
|
+
*
|
|
4
|
+
* REQ-038 (#187) and REQ-037 (#186), which are one subpath because they are one mechanism: a team compiles to a
|
|
5
|
+
* flow, so there is one interpreter, one durability story and one budget.
|
|
6
|
+
*
|
|
7
|
+
* No optional peer. The interpreter is a pure function and the runner takes ports, so the only thing a consumer
|
|
8
|
+
* needs beyond the runtime is a store — either the in-memory one at `./persistence` or Postgres at
|
|
9
|
+
* `./adapters/postgres`.
|
|
10
|
+
*/
|
|
11
|
+
export * from "../flows/index.js";
|
|
12
|
+
export * from "../flows/interpreter.js";
|
|
13
|
+
export * from "../flows/runner.js";
|
|
14
|
+
export * from "../teams/index.js";
|
|
15
|
+
//# sourceMappingURL=flows.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/flows` — durable workflows, and teams as a kind of step.
|
|
3
|
+
*
|
|
4
|
+
* REQ-038 (#187) and REQ-037 (#186), which are one subpath because they are one mechanism: a team compiles to a
|
|
5
|
+
* flow, so there is one interpreter, one durability story and one budget.
|
|
6
|
+
*
|
|
7
|
+
* No optional peer. The interpreter is a pure function and the runner takes ports, so the only thing a consumer
|
|
8
|
+
* needs beyond the runtime is a store — either the in-memory one at `./persistence` or Postgres at
|
|
9
|
+
* `./adapters/postgres`.
|
|
10
|
+
*/
|
|
11
|
+
export * from "../flows/index.js";
|
|
12
|
+
export * from "../flows/interpreter.js";
|
|
13
|
+
export * from "../flows/runner.js";
|
|
14
|
+
export * from "../teams/index.js";
|
|
15
|
+
//# sourceMappingURL=flows.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/hitl` — approvals, questions, and who may do what.
|
|
3
|
+
*
|
|
4
|
+
* The approval service and gate, the question service, and the authorization policy. Authorization is here
|
|
5
|
+
* rather than on its own because every consumer of one is a consumer of the other: an approval answers *may this
|
|
6
|
+
* happen*, and authorization answers *may this caller ask*.
|
|
7
|
+
*/
|
|
8
|
+
export * from "../hitl/index.js";
|
|
9
|
+
export * from "../authorization/index.js";
|
|
10
|
+
//# sourceMappingURL=hitl.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/hitl` — approvals, questions, and who may do what.
|
|
3
|
+
*
|
|
4
|
+
* The approval service and gate, the question service, and the authorization policy. Authorization is here
|
|
5
|
+
* rather than on its own because every consumer of one is a consumer of the other: an approval answers *may this
|
|
6
|
+
* happen*, and authorization answers *may this caller ask*.
|
|
7
|
+
*/
|
|
8
|
+
export * from "../hitl/index.js";
|
|
9
|
+
export * from "../authorization/index.js";
|
|
10
|
+
//# sourceMappingURL=hitl.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/knowledge` — indexed material, documents, files and artifacts.
|
|
3
|
+
*
|
|
4
|
+
* Retrieval, chunking and embeddings; the extraction pipeline; attachments and their read tools; artifacts and
|
|
5
|
+
* the export formats. One subpath because a deployment that has any of these has all of them: an attachment
|
|
6
|
+
* becomes a document becomes chunks becomes a retrieval hit.
|
|
7
|
+
*/
|
|
8
|
+
export * from "../knowledge/index.js";
|
|
9
|
+
export * from "../documents/index.js";
|
|
10
|
+
export * from "../files/index.js";
|
|
11
|
+
export * from "../files/context.js";
|
|
12
|
+
export * from "../files/read-tool.js";
|
|
13
|
+
export * from "../files/turn-parts.js";
|
|
14
|
+
export * from "../artifacts/index.js";
|
|
15
|
+
export * from "../export/index.js";
|
|
16
|
+
export * from "../export/pdf.js";
|
|
17
|
+
export * from "../export/markdown.js";
|
|
18
|
+
//# sourceMappingURL=knowledge.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/knowledge` — indexed material, documents, files and artifacts.
|
|
3
|
+
*
|
|
4
|
+
* Retrieval, chunking and embeddings; the extraction pipeline; attachments and their read tools; artifacts and
|
|
5
|
+
* the export formats. One subpath because a deployment that has any of these has all of them: an attachment
|
|
6
|
+
* becomes a document becomes chunks becomes a retrieval hit.
|
|
7
|
+
*/
|
|
8
|
+
export * from "../knowledge/index.js";
|
|
9
|
+
export * from "../documents/index.js";
|
|
10
|
+
export * from "../files/index.js";
|
|
11
|
+
export * from "../files/context.js";
|
|
12
|
+
export * from "../files/read-tool.js";
|
|
13
|
+
// #185: resolving a stored attachment into a turn part, through the mediated read path.
|
|
14
|
+
export * from "../files/turn-parts.js";
|
|
15
|
+
export * from "../artifacts/index.js";
|
|
16
|
+
export * from "../export/index.js";
|
|
17
|
+
export * from "../export/pdf.js";
|
|
18
|
+
export * from "../export/markdown.js";
|
|
19
|
+
//# sourceMappingURL=knowledge.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/mcp` — importing another server's tools.
|
|
3
|
+
*
|
|
4
|
+
* The client, the provider, the effect classifier and the egress policy. Its own subpath rather than part of
|
|
5
|
+
* `./tools` because the trust story is different: a first-party tool is code in your repository, and an imported
|
|
6
|
+
* one is a contract with a process you do not control — which is why an unclassified remote tool becomes
|
|
7
|
+
* `external-write` rather than `read`.
|
|
8
|
+
*/
|
|
9
|
+
export * from "../mcp/index.js";
|
|
10
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/mcp` — importing another server's tools.
|
|
3
|
+
*
|
|
4
|
+
* The client, the provider, the effect classifier and the egress policy. Its own subpath rather than part of
|
|
5
|
+
* `./tools` because the trust story is different: a first-party tool is code in your repository, and an imported
|
|
6
|
+
* one is a contract with a process you do not control — which is why an unclassified remote tool becomes
|
|
7
|
+
* `external-write` rather than `read`.
|
|
8
|
+
*/
|
|
9
|
+
export * from "../mcp/index.js";
|
|
10
|
+
//# sourceMappingURL=mcp.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/observability` — telemetry, retention, the security review and the harnesses.
|
|
3
|
+
*
|
|
4
|
+
* Platform operations rather than application code: spans and metrics, the retention windows and deletion path,
|
|
5
|
+
* the security review as executable acceptances, the load and evaluation harnesses. A consumer building an
|
|
6
|
+
* assistant needs none of it; a team running one needs all of it.
|
|
7
|
+
*/
|
|
8
|
+
export * from "../telemetry/index.js";
|
|
9
|
+
export * from "../retention/index.js";
|
|
10
|
+
export * from "../security/checklist.js";
|
|
11
|
+
export * from "../security/findings.js";
|
|
12
|
+
export * from "../evaluation/index.js";
|
|
13
|
+
export * from "../loadtest/index.js";
|
|
14
|
+
//# sourceMappingURL=observability.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/observability` — telemetry, retention, the security review and the harnesses.
|
|
3
|
+
*
|
|
4
|
+
* Platform operations rather than application code: spans and metrics, the retention windows and deletion path,
|
|
5
|
+
* the security review as executable acceptances, the load and evaluation harnesses. A consumer building an
|
|
6
|
+
* assistant needs none of it; a team running one needs all of it.
|
|
7
|
+
*/
|
|
8
|
+
export * from "../telemetry/index.js";
|
|
9
|
+
export * from "../retention/index.js";
|
|
10
|
+
// The security *review* — the executable acceptances and their revisit dates — but not `prompt-safety.ts`,
|
|
11
|
+
// which is context rendering and lives at `./context`. One name, one subpath (#199).
|
|
12
|
+
export * from "../security/checklist.js";
|
|
13
|
+
export * from "../security/findings.js";
|
|
14
|
+
export * from "../evaluation/index.js";
|
|
15
|
+
export * from "../loadtest/index.js";
|
|
16
|
+
//# sourceMappingURL=observability.js.map
|