@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,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/persistence` — the storage ports, and the in-memory adapters.
|
|
3
|
+
*
|
|
4
|
+
* The in-memory adapters live here rather than behind a driver subpath because they have no dependency of their
|
|
5
|
+
* own: they are what makes the package usable the moment it is installed, for a test, a prototype or a first
|
|
6
|
+
* look. Every other adapter carries a driver and has its own subpath.
|
|
7
|
+
*/
|
|
8
|
+
export * from "../persistence/index.js";
|
|
9
|
+
export * from "../adapters/memory/index.js";
|
|
10
|
+
export * from "../idempotency/index.js";
|
|
11
|
+
//# sourceMappingURL=persistence.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/persistence` — the storage ports, and the in-memory adapters.
|
|
3
|
+
*
|
|
4
|
+
* The in-memory adapters live here rather than behind a driver subpath because they have no dependency of their
|
|
5
|
+
* own: they are what makes the package usable the moment it is installed, for a test, a prototype or a first
|
|
6
|
+
* look. Every other adapter carries a driver and has its own subpath.
|
|
7
|
+
*/
|
|
8
|
+
export * from "../persistence/index.js";
|
|
9
|
+
export * from "../adapters/memory/index.js";
|
|
10
|
+
export * from "../idempotency/index.js";
|
|
11
|
+
//# sourceMappingURL=persistence.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/providers` — the model-provider factory, and the embedded facade that uses it.
|
|
3
|
+
*
|
|
4
|
+
* Its own entry because it statically imports six `@ai-sdk/*` packages, and those are **optional peers**: a
|
|
5
|
+
* consumer who uses OpenAI should not have to install Anthropic, Azure, Google and Mistral to import the
|
|
6
|
+
* runtime. Reaching them from the package root would have made that impossible.
|
|
7
|
+
*
|
|
8
|
+
* `createAgent` lives here rather than in the root for the same reason. It is the quickstart — "give me an API
|
|
9
|
+
* key and go" — and that convenience is exactly what needs a provider SDK. Someone composing the runtime
|
|
10
|
+
* themselves never calls it and never installs one.
|
|
11
|
+
*/
|
|
12
|
+
export * from "../models/provider-factory.js";
|
|
13
|
+
export * from "../agents/agent.js";
|
|
14
|
+
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/providers` — the model-provider factory, and the embedded facade that uses it.
|
|
3
|
+
*
|
|
4
|
+
* Its own entry because it statically imports six `@ai-sdk/*` packages, and those are **optional peers**: a
|
|
5
|
+
* consumer who uses OpenAI should not have to install Anthropic, Azure, Google and Mistral to import the
|
|
6
|
+
* runtime. Reaching them from the package root would have made that impossible.
|
|
7
|
+
*
|
|
8
|
+
* `createAgent` lives here rather than in the root for the same reason. It is the quickstart — "give me an API
|
|
9
|
+
* key and go" — and that convenience is exactly what needs a provider SDK. Someone composing the runtime
|
|
10
|
+
* themselves never calls it and never installs one.
|
|
11
|
+
*/
|
|
12
|
+
export * from "../models/provider-factory.js";
|
|
13
|
+
export * from "../agents/agent.js";
|
|
14
|
+
//# sourceMappingURL=providers.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/runtime` — the engine, agents, models and the run loop.
|
|
3
|
+
*
|
|
4
|
+
* What a host reaches for once it has decided to compose something itself rather than take `createRuntime`'s
|
|
5
|
+
* defaults: the default engine, the model catalogue, the retry policy, the run reducer.
|
|
6
|
+
*/
|
|
7
|
+
export * from "../runtime/index.js";
|
|
8
|
+
export * from "../agents/index.js";
|
|
9
|
+
export * from "../models/index.js";
|
|
10
|
+
export * from "../capabilities/index.js";
|
|
11
|
+
export * from "../capabilities/runtime.js";
|
|
12
|
+
export * from "../core/index.js";
|
|
13
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/runtime` — the engine, agents, models and the run loop.
|
|
3
|
+
*
|
|
4
|
+
* What a host reaches for once it has decided to compose something itself rather than take `createRuntime`'s
|
|
5
|
+
* defaults: the default engine, the model catalogue, the retry policy, the run reducer.
|
|
6
|
+
*/
|
|
7
|
+
export * from "../runtime/index.js";
|
|
8
|
+
export * from "../agents/index.js";
|
|
9
|
+
export * from "../models/index.js";
|
|
10
|
+
export * from "../capabilities/index.js";
|
|
11
|
+
export * from "../capabilities/runtime.js";
|
|
12
|
+
export * from "../core/index.js";
|
|
13
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/server` — the reference GraphQL host, and the runnable API and worker commands.
|
|
3
|
+
*
|
|
4
|
+
* A subpath in the same package rather than a package of its own (#196). The runtime still takes **no** HTTP or
|
|
5
|
+
* GraphQL dependency: `graphql`, `graphql-yoga` and `@whatwg-node/server` are optional peers, so a consumer who
|
|
6
|
+
* embeds the runtime in their own server never installs them.
|
|
7
|
+
*
|
|
8
|
+
* What keeps this from quietly merging the two halves is that the boundary is enforced by **path**, not by
|
|
9
|
+
* package. `check-boundaries.mjs` reads directories, and rule R12 refuses any import from the runtime into
|
|
10
|
+
* `src/server/` — so the dependency runs one way, as it did when they were separate packages.
|
|
11
|
+
*
|
|
12
|
+
* The cost, stated because it is real: a server-only fix now bumps the runtime's version, and every consumer
|
|
13
|
+
* sees a release that does not affect them. The changelog has to say which subpath changed.
|
|
14
|
+
*/
|
|
15
|
+
export * from "../server/index.js";
|
|
16
|
+
/**
|
|
17
|
+
* The schema and the resolvers, not only the host that serves them.
|
|
18
|
+
*
|
|
19
|
+
* A consumer building their own host — a Nest service, say (#201) — needs `typeDefs` and `createResolvers` and
|
|
20
|
+
* none of `runApiHost`. Putting them here rather than at the root keeps the root at five values, and putting
|
|
21
|
+
* them anywhere else would mean two imports to serve one API.
|
|
22
|
+
*/
|
|
23
|
+
export * from "../graphql/index.js";
|
|
24
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/server` — the reference GraphQL host, and the runnable API and worker commands.
|
|
3
|
+
*
|
|
4
|
+
* A subpath in the same package rather than a package of its own (#196). The runtime still takes **no** HTTP or
|
|
5
|
+
* GraphQL dependency: `graphql`, `graphql-yoga` and `@whatwg-node/server` are optional peers, so a consumer who
|
|
6
|
+
* embeds the runtime in their own server never installs them.
|
|
7
|
+
*
|
|
8
|
+
* What keeps this from quietly merging the two halves is that the boundary is enforced by **path**, not by
|
|
9
|
+
* package. `check-boundaries.mjs` reads directories, and rule R12 refuses any import from the runtime into
|
|
10
|
+
* `src/server/` — so the dependency runs one way, as it did when they were separate packages.
|
|
11
|
+
*
|
|
12
|
+
* The cost, stated because it is real: a server-only fix now bumps the runtime's version, and every consumer
|
|
13
|
+
* sees a release that does not affect them. The changelog has to say which subpath changed.
|
|
14
|
+
*/
|
|
15
|
+
export * from "../server/index.js";
|
|
16
|
+
/**
|
|
17
|
+
* The schema and the resolvers, not only the host that serves them.
|
|
18
|
+
*
|
|
19
|
+
* A consumer building their own host — a Nest service, say (#201) — needs `typeDefs` and `createResolvers` and
|
|
20
|
+
* none of `runApiHost`. Putting them here rather than at the root keeps the root at five values, and putting
|
|
21
|
+
* them anywhere else would mean two imports to serve one API.
|
|
22
|
+
*/
|
|
23
|
+
export * from "../graphql/index.js";
|
|
24
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/tools` — everything about tools.
|
|
3
|
+
*
|
|
4
|
+
* Three things that used to be in three places:
|
|
5
|
+
*
|
|
6
|
+
* - **Authoring** — `defineTool` and `defineDelegatingTool`, the envelopes that add authorisation, the approval
|
|
7
|
+
* gate and the idempotency key around a deterministic function.
|
|
8
|
+
* - **Dispatch** — the registry, the catalogue, the meta-tools.
|
|
9
|
+
* - **The library** (#188) — fifteen first-party tools, and the `toolkit/` functions they delegate to.
|
|
10
|
+
*
|
|
11
|
+
* One subpath because they are one subject, and because the alternative — authoring at the root, dispatch behind
|
|
12
|
+
* a subpath — would mean a tool author importing from two places to write one tool. The root keeps `defineAgent`
|
|
13
|
+
* and not `defineTool` for the same reason it keeps `createRuntime`: an agent is the thing you declare, and a
|
|
14
|
+
* tool is a component of one.
|
|
15
|
+
*
|
|
16
|
+
* No optional peer: the tools reach the network through the global `fetch` and the platform's own egress policy.
|
|
17
|
+
*/
|
|
18
|
+
export * from "../tools/index.js";
|
|
19
|
+
export * from "../tools/library/index.js";
|
|
20
|
+
export * from "../toolkit/index.js";
|
|
21
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/tools` — everything about tools.
|
|
3
|
+
*
|
|
4
|
+
* Three things that used to be in three places:
|
|
5
|
+
*
|
|
6
|
+
* - **Authoring** — `defineTool` and `defineDelegatingTool`, the envelopes that add authorisation, the approval
|
|
7
|
+
* gate and the idempotency key around a deterministic function.
|
|
8
|
+
* - **Dispatch** — the registry, the catalogue, the meta-tools.
|
|
9
|
+
* - **The library** (#188) — fifteen first-party tools, and the `toolkit/` functions they delegate to.
|
|
10
|
+
*
|
|
11
|
+
* One subpath because they are one subject, and because the alternative — authoring at the root, dispatch behind
|
|
12
|
+
* a subpath — would mean a tool author importing from two places to write one tool. The root keeps `defineAgent`
|
|
13
|
+
* and not `defineTool` for the same reason it keeps `createRuntime`: an agent is the thing you declare, and a
|
|
14
|
+
* tool is a component of one.
|
|
15
|
+
*
|
|
16
|
+
* No optional peer: the tools reach the network through the global `fetch` and the platform's own egress policy.
|
|
17
|
+
*/
|
|
18
|
+
export * from "../tools/index.js";
|
|
19
|
+
export * from "../tools/library/index.js";
|
|
20
|
+
export * from "../toolkit/index.js";
|
|
21
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/usage` — spend, quotas and rollups.
|
|
3
|
+
*
|
|
4
|
+
* The ledger, the quota guard, the limit resolvers and the rollup job. Separate from everything else because a
|
|
5
|
+
* deployment can run without any of it — with the direction of the default being *unbounded*, since a
|
|
6
|
+
* misconfigured quota that blocks everything is an outage and one that blocks nothing is a bill the rollups make
|
|
7
|
+
* visible.
|
|
8
|
+
*/
|
|
9
|
+
export * from "../usage/index.js";
|
|
10
|
+
//# sourceMappingURL=usage.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/usage` — spend, quotas and rollups.
|
|
3
|
+
*
|
|
4
|
+
* The ledger, the quota guard, the limit resolvers and the rollup job. Separate from everything else because a
|
|
5
|
+
* deployment can run without any of it — with the direction of the default being *unbounded*, since a
|
|
6
|
+
* misconfigured quota that blocks everything is an outage and one that blocks nothing is a bill the rollups make
|
|
7
|
+
* visible.
|
|
8
|
+
*/
|
|
9
|
+
export * from "../usage/index.js";
|
|
10
|
+
//# sourceMappingURL=usage.js.map
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The release gate — REQ-032 (#142).
|
|
3
|
+
*
|
|
4
|
+
* Scoring without a gate is a dashboard nobody reads. This is the part that stops a regression shipping, and it
|
|
5
|
+
* is deliberately a **pure function**: given a run, a baseline and a threshold set, it returns a decision. No
|
|
6
|
+
* clock, no store, no process exit — so the decision is testable, and the CI wrapper around it is thin enough
|
|
7
|
+
* to be obviously correct.
|
|
8
|
+
*
|
|
9
|
+
* Four decisions.
|
|
10
|
+
*
|
|
11
|
+
* **It fails on named cases as well as on aggregates.** A dimension can sit above its threshold while a
|
|
12
|
+
* specific case that used to pass now fails, and an aggregate gate would ship that. Both are checked, and both
|
|
13
|
+
* are *reported by name* — a gate that says "quality dropped" gives a reviewer nothing to act on.
|
|
14
|
+
*
|
|
15
|
+
* **A threshold lives in version control and the gate never adjusts it.** Nothing here writes a threshold, so
|
|
16
|
+
* the only way to lower one is a reviewed change to a committed file. That is the mechanism: a gate that could
|
|
17
|
+
* relax its own limits is not a gate.
|
|
18
|
+
*
|
|
19
|
+
* **An override is recorded or it does not exist.** `override` requires an actor *and* a reason, and the
|
|
20
|
+
* decision carries both into the trend record. An unrecordable override is how gates quietly die — one person
|
|
21
|
+
* ships past it, nobody sees, and the next person learns it is optional.
|
|
22
|
+
*
|
|
23
|
+
* **A missing baseline is reported, and whether it is fatal is the caller's to say.** Two situations look
|
|
24
|
+
* identical from in here and are not: the first release of a dataset genuinely has nothing to compare against,
|
|
25
|
+
* while a later release with no baseline has *lost* its comparison. Treating both as fatal means the gate can
|
|
26
|
+
* never be adopted; treating both as fine means the regression check disappears the day someone regenerates the
|
|
27
|
+
* trend and nobody notices. So `requireBaseline` is an input, set by whoever knows which case this is — the CLI
|
|
28
|
+
* knows, because it can see whether the trend has entries.
|
|
29
|
+
*/
|
|
30
|
+
import type { EvalCaseResult, EvalRun } from "../persistence/index.js";
|
|
31
|
+
import { type CaseComparison, type ReleaseComparison } from "./index.js";
|
|
32
|
+
/**
|
|
33
|
+
* The committed thresholds.
|
|
34
|
+
*
|
|
35
|
+
* Per dimension, because dimensions fail differently: an authorization regression is a security problem and a
|
|
36
|
+
* task-completion regression is a quality one, and one number across both would be set by whichever mattered
|
|
37
|
+
* less.
|
|
38
|
+
*/
|
|
39
|
+
export type GateThresholds = {
|
|
40
|
+
/** Minimum mean score per dimension. A dimension absent from the map is ungated, which is reported. */
|
|
41
|
+
readonly dimensions: Readonly<Record<string, number>>;
|
|
42
|
+
/** Minimum overall mean, as a backstop against many small dimension slips that each stay above their line. */
|
|
43
|
+
readonly overallMeanScore?: number;
|
|
44
|
+
/**
|
|
45
|
+
* How many named case regressions are tolerated.
|
|
46
|
+
*
|
|
47
|
+
* Zero by default. A non-zero budget exists because a large dataset has genuinely flaky cases, and a gate that
|
|
48
|
+
* fails on one is a gate people learn to re-run until it passes — which is worse than a stated tolerance.
|
|
49
|
+
*/
|
|
50
|
+
readonly maxRegressedCases?: number;
|
|
51
|
+
};
|
|
52
|
+
export declare const GATE_FAILURE_KINDS: readonly ["dimension-below-threshold", "overall-below-threshold", "cases-regressed", "missing-baseline", "ungated-dimension"];
|
|
53
|
+
export type GateFailureKind = (typeof GATE_FAILURE_KINDS)[number];
|
|
54
|
+
export type GateFailure = {
|
|
55
|
+
readonly kind: GateFailureKind;
|
|
56
|
+
/** The dimension, when the failure is about one. */
|
|
57
|
+
readonly dimension?: string;
|
|
58
|
+
/** What was measured and what was required, so a reviewer needs no second lookup. */
|
|
59
|
+
readonly actual?: number;
|
|
60
|
+
readonly required?: number;
|
|
61
|
+
/** The specific cases, when the failure is about cases. Named, never counted. */
|
|
62
|
+
readonly cases?: readonly CaseComparison[];
|
|
63
|
+
readonly message: string;
|
|
64
|
+
};
|
|
65
|
+
export type GateOverride = {
|
|
66
|
+
/** Who. A gate overridden by "CI" is a gate nobody is accountable for. */
|
|
67
|
+
readonly actor: string;
|
|
68
|
+
/** Why. Free text, and required — an override with no reason is indistinguishable from a bug. */
|
|
69
|
+
readonly reason: string;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* The decision.
|
|
73
|
+
*
|
|
74
|
+
* A union, so "failed" has no `passed` shape to hide in. An overridden failure is its own arm rather than a
|
|
75
|
+
* pass with a flag: a reader counting passes must not count it, and a flag on a pass is a flag that gets
|
|
76
|
+
* dropped.
|
|
77
|
+
*/
|
|
78
|
+
export type GateDecision = {
|
|
79
|
+
readonly outcome: "pass";
|
|
80
|
+
readonly comparison: ReleaseComparison | null;
|
|
81
|
+
readonly warnings: readonly string[];
|
|
82
|
+
} | {
|
|
83
|
+
readonly outcome: "fail";
|
|
84
|
+
readonly failures: readonly GateFailure[];
|
|
85
|
+
readonly comparison: ReleaseComparison | null;
|
|
86
|
+
readonly warnings: readonly string[];
|
|
87
|
+
} | {
|
|
88
|
+
readonly outcome: "overridden";
|
|
89
|
+
readonly failures: readonly GateFailure[];
|
|
90
|
+
readonly override: GateOverride;
|
|
91
|
+
readonly comparison: ReleaseComparison | null;
|
|
92
|
+
readonly warnings: readonly string[];
|
|
93
|
+
};
|
|
94
|
+
export type GateInput = {
|
|
95
|
+
readonly candidate: {
|
|
96
|
+
readonly run: EvalRun;
|
|
97
|
+
readonly results: readonly EvalCaseResult[];
|
|
98
|
+
};
|
|
99
|
+
/** The previous release. `null` for the first run of a dataset, which is reported rather than assumed fine. */
|
|
100
|
+
readonly baseline: {
|
|
101
|
+
readonly run: EvalRun;
|
|
102
|
+
readonly results: readonly EvalCaseResult[];
|
|
103
|
+
} | null;
|
|
104
|
+
/**
|
|
105
|
+
* Whether an absent baseline fails the gate.
|
|
106
|
+
*
|
|
107
|
+
* True for every release after the first. False only when there has genuinely never been one — and false is
|
|
108
|
+
* not the default, because a defaulted-permissive flag is one that stays permissive in every deployment that
|
|
109
|
+
* did not think about it.
|
|
110
|
+
*/
|
|
111
|
+
readonly requireBaseline: boolean;
|
|
112
|
+
readonly thresholds: GateThresholds;
|
|
113
|
+
readonly override?: GateOverride;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Evaluate the gate.
|
|
117
|
+
*
|
|
118
|
+
* Every failure is collected before returning, rather than short-circuiting on the first. A gate that reported
|
|
119
|
+
* one problem per run makes a reviewer fix, re-run, and fix again — and each re-run costs what the gate costs.
|
|
120
|
+
*/
|
|
121
|
+
export declare const evaluateGate: (input: GateInput) => GateDecision;
|
|
122
|
+
/**
|
|
123
|
+
* A record for the trend file.
|
|
124
|
+
*
|
|
125
|
+
* Deliberately flat and small: it is committed, so it is read in a diff. A record carrying the whole run would
|
|
126
|
+
* make every release a thousand-line diff and the trend unreadable, which is the same as not having one.
|
|
127
|
+
*/
|
|
128
|
+
export type TrendEntry = {
|
|
129
|
+
readonly release: string;
|
|
130
|
+
readonly at: string;
|
|
131
|
+
readonly outcome: GateDecision["outcome"];
|
|
132
|
+
readonly meanScore: number;
|
|
133
|
+
readonly total: number;
|
|
134
|
+
readonly passed: number;
|
|
135
|
+
readonly byDimension: readonly {
|
|
136
|
+
readonly dimension: string;
|
|
137
|
+
readonly meanScore: number;
|
|
138
|
+
}[];
|
|
139
|
+
readonly regressedCaseIds: readonly string[];
|
|
140
|
+
readonly improvedCaseIds: readonly string[];
|
|
141
|
+
readonly costMinorUnits: number;
|
|
142
|
+
readonly graderVersions: Readonly<Record<string, string>>;
|
|
143
|
+
/** Present only when overridden, and carrying both fields — that is the whole point of recording it. */
|
|
144
|
+
readonly override?: GateOverride;
|
|
145
|
+
/** The thresholds this release was judged against, so a later threshold change is visible against results. */
|
|
146
|
+
readonly thresholds: GateThresholds;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Build the trend entry for a decision.
|
|
150
|
+
*
|
|
151
|
+
* The thresholds are copied in, which is what makes AC-2 and AC-3 meet: lowering a threshold shows up in the
|
|
152
|
+
* *next* entry next to the results it was applied to, so a reviewer reading history sees the limit and the
|
|
153
|
+
* number that prompted moving it side by side.
|
|
154
|
+
*/
|
|
155
|
+
export declare const trendEntryFor: (input: {
|
|
156
|
+
readonly decision: GateDecision;
|
|
157
|
+
readonly run: EvalRun;
|
|
158
|
+
readonly thresholds: GateThresholds;
|
|
159
|
+
readonly at: string;
|
|
160
|
+
}) => TrendEntry;
|
|
161
|
+
/**
|
|
162
|
+
* The gate's report, as a CI log reads it.
|
|
163
|
+
*
|
|
164
|
+
* Plain text rather than JSON, because the first thing a person does with a failing gate is read the log. The
|
|
165
|
+
* artifact carries the structured version.
|
|
166
|
+
*/
|
|
167
|
+
export declare const formatGateReport: (decision: GateDecision, run: EvalRun) => string;
|
|
168
|
+
//# sourceMappingURL=gate.d.ts.map
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The release gate — REQ-032 (#142).
|
|
3
|
+
*
|
|
4
|
+
* Scoring without a gate is a dashboard nobody reads. This is the part that stops a regression shipping, and it
|
|
5
|
+
* is deliberately a **pure function**: given a run, a baseline and a threshold set, it returns a decision. No
|
|
6
|
+
* clock, no store, no process exit — so the decision is testable, and the CI wrapper around it is thin enough
|
|
7
|
+
* to be obviously correct.
|
|
8
|
+
*
|
|
9
|
+
* Four decisions.
|
|
10
|
+
*
|
|
11
|
+
* **It fails on named cases as well as on aggregates.** A dimension can sit above its threshold while a
|
|
12
|
+
* specific case that used to pass now fails, and an aggregate gate would ship that. Both are checked, and both
|
|
13
|
+
* are *reported by name* — a gate that says "quality dropped" gives a reviewer nothing to act on.
|
|
14
|
+
*
|
|
15
|
+
* **A threshold lives in version control and the gate never adjusts it.** Nothing here writes a threshold, so
|
|
16
|
+
* the only way to lower one is a reviewed change to a committed file. That is the mechanism: a gate that could
|
|
17
|
+
* relax its own limits is not a gate.
|
|
18
|
+
*
|
|
19
|
+
* **An override is recorded or it does not exist.** `override` requires an actor *and* a reason, and the
|
|
20
|
+
* decision carries both into the trend record. An unrecordable override is how gates quietly die — one person
|
|
21
|
+
* ships past it, nobody sees, and the next person learns it is optional.
|
|
22
|
+
*
|
|
23
|
+
* **A missing baseline is reported, and whether it is fatal is the caller's to say.** Two situations look
|
|
24
|
+
* identical from in here and are not: the first release of a dataset genuinely has nothing to compare against,
|
|
25
|
+
* while a later release with no baseline has *lost* its comparison. Treating both as fatal means the gate can
|
|
26
|
+
* never be adopted; treating both as fine means the regression check disappears the day someone regenerates the
|
|
27
|
+
* trend and nobody notices. So `requireBaseline` is an input, set by whoever knows which case this is — the CLI
|
|
28
|
+
* knows, because it can see whether the trend has entries.
|
|
29
|
+
*/
|
|
30
|
+
import { compareRuns } from "./index.js";
|
|
31
|
+
import {} from "./index.js";
|
|
32
|
+
export const GATE_FAILURE_KINDS = [
|
|
33
|
+
"dimension-below-threshold",
|
|
34
|
+
"overall-below-threshold",
|
|
35
|
+
"cases-regressed",
|
|
36
|
+
"missing-baseline",
|
|
37
|
+
"ungated-dimension",
|
|
38
|
+
];
|
|
39
|
+
/**
|
|
40
|
+
* Evaluate the gate.
|
|
41
|
+
*
|
|
42
|
+
* Every failure is collected before returning, rather than short-circuiting on the first. A gate that reported
|
|
43
|
+
* one problem per run makes a reviewer fix, re-run, and fix again — and each re-run costs what the gate costs.
|
|
44
|
+
*/
|
|
45
|
+
export const evaluateGate = (input) => {
|
|
46
|
+
const failures = [];
|
|
47
|
+
const warnings = [];
|
|
48
|
+
const { candidate, baseline, thresholds } = input;
|
|
49
|
+
for (const summary of candidate.run.byDimension) {
|
|
50
|
+
const required = thresholds.dimensions[summary.dimension];
|
|
51
|
+
if (required === undefined) {
|
|
52
|
+
// Not a failure by default — a new dimension appearing before its threshold is agreed should not block a
|
|
53
|
+
// release — but loud, because an ungated dimension is a dimension nobody is measuring.
|
|
54
|
+
warnings.push(`dimension "${summary.dimension}" has no threshold; add one to the committed thresholds file`);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (summary.meanScore < required) {
|
|
58
|
+
failures.push({
|
|
59
|
+
kind: "dimension-below-threshold",
|
|
60
|
+
dimension: summary.dimension,
|
|
61
|
+
actual: summary.meanScore,
|
|
62
|
+
required,
|
|
63
|
+
message: `${summary.dimension} scored ${summary.meanScore.toFixed(3)}, below its threshold of ${required}`,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// A threshold for a dimension the run did not produce. Reported, because it means either the dataset lost a
|
|
68
|
+
// dimension or the run did not score it — and both are the gate measuring less than it claims to.
|
|
69
|
+
for (const dimension of Object.keys(thresholds.dimensions)) {
|
|
70
|
+
if (!candidate.run.byDimension.some((d) => d.dimension === dimension))
|
|
71
|
+
warnings.push(`threshold set for "${dimension}" but the run scored no cases in it`);
|
|
72
|
+
}
|
|
73
|
+
if (thresholds.overallMeanScore !== undefined && candidate.run.meanScore < thresholds.overallMeanScore) {
|
|
74
|
+
failures.push({
|
|
75
|
+
kind: "overall-below-threshold",
|
|
76
|
+
actual: candidate.run.meanScore,
|
|
77
|
+
required: thresholds.overallMeanScore,
|
|
78
|
+
message: `overall mean ${candidate.run.meanScore.toFixed(3)} is below the threshold of ${thresholds.overallMeanScore}`,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
const comparison = baseline === null ? null : compareRuns({ baseline, candidate });
|
|
82
|
+
if (baseline === null) {
|
|
83
|
+
const message = "no baseline run to compare against, so no regression check ran; thresholds were still applied";
|
|
84
|
+
// Fatal when a baseline was expected — a release whose comparison has gone missing is ungated on
|
|
85
|
+
// regressions, and that must stop the build rather than print a line nobody reads. Loud but survivable when
|
|
86
|
+
// there has never been one, so the gate can be adopted on its first run.
|
|
87
|
+
if (input.requireBaseline)
|
|
88
|
+
failures.push({ kind: "missing-baseline", message });
|
|
89
|
+
else
|
|
90
|
+
warnings.push(message);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
const budget = thresholds.maxRegressedCases ?? 0;
|
|
94
|
+
if (comparison !== null && comparison.regressed.length > budget) {
|
|
95
|
+
failures.push({
|
|
96
|
+
kind: "cases-regressed",
|
|
97
|
+
cases: comparison.regressed,
|
|
98
|
+
actual: comparison.regressed.length,
|
|
99
|
+
required: budget,
|
|
100
|
+
// The case ids in the message, so a CI log line is actionable without opening an artifact.
|
|
101
|
+
message: `${comparison.regressed.length} case(s) regressed (budget ${budget}): ${comparison.regressed
|
|
102
|
+
.map((c) => `${c.caseId} (${c.dimension}, ${c.before} → ${c.after})`)
|
|
103
|
+
.join("; ")}`,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (comparison?.graderVersionsDiffer === true)
|
|
107
|
+
// A warning, not a failure: sometimes a grader change is the point of the release. But never silent —
|
|
108
|
+
// a delta across two instruments cannot be attributed to the platform.
|
|
109
|
+
warnings.push("grader versions differ between the baseline and the candidate; the score delta cannot be attributed to the platform alone");
|
|
110
|
+
}
|
|
111
|
+
if (failures.length === 0)
|
|
112
|
+
return { outcome: "pass", comparison, warnings };
|
|
113
|
+
if (input.override !== undefined) {
|
|
114
|
+
// The override applies to *whatever failed*, and the failures travel with it. An override that discarded
|
|
115
|
+
// them would leave a trend record saying "overridden" with no way to learn what for.
|
|
116
|
+
return { outcome: "overridden", failures, override: input.override, comparison, warnings };
|
|
117
|
+
}
|
|
118
|
+
return { outcome: "fail", failures, comparison, warnings };
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Build the trend entry for a decision.
|
|
122
|
+
*
|
|
123
|
+
* The thresholds are copied in, which is what makes AC-2 and AC-3 meet: lowering a threshold shows up in the
|
|
124
|
+
* *next* entry next to the results it was applied to, so a reviewer reading history sees the limit and the
|
|
125
|
+
* number that prompted moving it side by side.
|
|
126
|
+
*/
|
|
127
|
+
export const trendEntryFor = (input) => ({
|
|
128
|
+
release: input.run.release,
|
|
129
|
+
at: input.at,
|
|
130
|
+
outcome: input.decision.outcome,
|
|
131
|
+
meanScore: input.run.meanScore,
|
|
132
|
+
total: input.run.total,
|
|
133
|
+
passed: input.run.passed,
|
|
134
|
+
byDimension: input.run.byDimension.map((d) => ({ dimension: d.dimension, meanScore: d.meanScore })),
|
|
135
|
+
regressedCaseIds: input.decision.comparison?.regressed.map((c) => c.caseId) ?? [],
|
|
136
|
+
improvedCaseIds: input.decision.comparison?.improved.map((c) => c.caseId) ?? [],
|
|
137
|
+
costMinorUnits: input.run.costMinorUnits,
|
|
138
|
+
graderVersions: input.run.graderVersions,
|
|
139
|
+
...(input.decision.outcome === "overridden" ? { override: input.decision.override } : {}),
|
|
140
|
+
thresholds: input.thresholds,
|
|
141
|
+
});
|
|
142
|
+
/**
|
|
143
|
+
* The gate's report, as a CI log reads it.
|
|
144
|
+
*
|
|
145
|
+
* Plain text rather than JSON, because the first thing a person does with a failing gate is read the log. The
|
|
146
|
+
* artifact carries the structured version.
|
|
147
|
+
*/
|
|
148
|
+
export const formatGateReport = (decision, run) => {
|
|
149
|
+
const lines = [
|
|
150
|
+
`release gate: ${decision.outcome.toUpperCase()}`,
|
|
151
|
+
`release ${run.release} — ${run.passed}/${run.total} passed, mean ${run.meanScore.toFixed(3)}, cost ${run.costMinorUnits} minor units`,
|
|
152
|
+
];
|
|
153
|
+
for (const d of run.byDimension)
|
|
154
|
+
lines.push(` ${d.dimension}: ${d.meanScore.toFixed(3)} (${d.passed}/${d.total})`);
|
|
155
|
+
if (decision.outcome !== "pass") {
|
|
156
|
+
lines.push("", "failures:");
|
|
157
|
+
for (const failure of decision.failures)
|
|
158
|
+
lines.push(` ✗ ${failure.message}`);
|
|
159
|
+
}
|
|
160
|
+
if (decision.outcome === "overridden")
|
|
161
|
+
lines.push("", `OVERRIDDEN by ${decision.override.actor}: ${decision.override.reason}`);
|
|
162
|
+
const comparison = decision.comparison;
|
|
163
|
+
if (comparison !== null) {
|
|
164
|
+
lines.push("", `versus ${comparison.baseline}: mean ${comparison.meanScoreDelta >= 0 ? "+" : ""}${comparison.meanScoreDelta.toFixed(3)}`);
|
|
165
|
+
// Regressed first: it is what a reviewer is looking for, and a report that led with improvements would bury
|
|
166
|
+
// it.
|
|
167
|
+
for (const c of comparison.regressed)
|
|
168
|
+
lines.push(` ↓ ${c.caseId} (${c.dimension}) ${c.before} → ${c.after} ${c.reason}`);
|
|
169
|
+
for (const c of comparison.improved)
|
|
170
|
+
lines.push(` ↑ ${c.caseId} (${c.dimension}) ${c.before} → ${c.after}`);
|
|
171
|
+
for (const c of comparison.added)
|
|
172
|
+
lines.push(` + ${c.caseId} (${c.dimension}) new`);
|
|
173
|
+
for (const c of comparison.removed)
|
|
174
|
+
lines.push(` - ${c.caseId} (${c.dimension}) removed`);
|
|
175
|
+
}
|
|
176
|
+
for (const warning of decision.warnings)
|
|
177
|
+
lines.push(` ! ${warning}`);
|
|
178
|
+
return lines.join("\n");
|
|
179
|
+
};
|
|
180
|
+
//# sourceMappingURL=gate.js.map
|