@theoremjs/agents 0.0.0-stage → 0.3.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 +21 -0
- package/README.md +1264 -2
- package/esm/_dnt.polyfills.d.ts +66 -0
- package/esm/_dnt.polyfills.js +51 -0
- package/esm/mod.d.ts +65 -0
- package/esm/mod.js +42 -0
- package/esm/package.json +3 -0
- package/esm/src/cli/bin.d.ts +7 -0
- package/esm/src/cli/bin.js +9 -0
- package/esm/src/cli/commands/bench.d.ts +6 -0
- package/esm/src/cli/commands/bench.js +458 -0
- package/esm/src/cli/commands/egress-compile.d.ts +17 -0
- package/esm/src/cli/commands/egress-compile.js +25 -0
- package/esm/src/cli/commands/eval.d.ts +37 -0
- package/esm/src/cli/commands/eval.js +190 -0
- package/esm/src/cli/commands/fuzz-canary.d.ts +15 -0
- package/esm/src/cli/commands/fuzz-canary.js +202 -0
- package/esm/src/cli/commands/fuzz-guardrails.d.ts +2 -0
- package/esm/src/cli/commands/fuzz-guardrails.js +5 -0
- package/esm/src/cli/commands/profile.d.ts +2 -0
- package/esm/src/cli/commands/profile.js +80 -0
- package/esm/src/cli/commands/run.d.ts +13 -0
- package/esm/src/cli/commands/run.js +45 -0
- package/esm/src/cli/commands/test.d.ts +25 -0
- package/esm/src/cli/commands/test.js +143 -0
- package/esm/src/cli/event-log.d.ts +15 -0
- package/esm/src/cli/event-log.js +136 -0
- package/esm/src/cli/index.d.ts +10 -0
- package/esm/src/cli/index.js +267 -0
- package/esm/src/cli/matrix/fixtures.d.ts +10 -0
- package/esm/src/cli/matrix/fixtures.js +72 -0
- package/esm/src/cli/matrix/synthesizer.d.ts +18 -0
- package/esm/src/cli/matrix/synthesizer.js +103 -0
- package/esm/src/evals/attachments.d.ts +4 -0
- package/esm/src/evals/attachments.js +53 -0
- package/esm/src/evals/breakdown.d.ts +28 -0
- package/esm/src/evals/breakdown.js +68 -0
- package/esm/src/evals/graders/answer.d.ts +13 -0
- package/esm/src/evals/graders/answer.js +133 -0
- package/esm/src/evals/graders/code.d.ts +64 -0
- package/esm/src/evals/graders/code.js +205 -0
- package/esm/src/evals/graders/judge.d.ts +20 -0
- package/esm/src/evals/graders/judge.js +365 -0
- package/esm/src/evals/graders/latency.d.ts +5 -0
- package/esm/src/evals/graders/latency.js +81 -0
- package/esm/src/evals/graders/live.d.ts +11 -0
- package/esm/src/evals/graders/live.js +40 -0
- package/esm/src/evals/graders/media.d.ts +18 -0
- package/esm/src/evals/graders/media.js +92 -0
- package/esm/src/evals/graders/shared.d.ts +11 -0
- package/esm/src/evals/graders/shared.js +62 -0
- package/esm/src/evals/graders/transcript.d.ts +17 -0
- package/esm/src/evals/graders/transcript.js +200 -0
- package/esm/src/evals/mod.d.ts +42 -0
- package/esm/src/evals/mod.js +30 -0
- package/esm/src/evals/record.d.ts +35 -0
- package/esm/src/evals/record.js +105 -0
- package/esm/src/evals/rubrics/catalog.d.ts +148 -0
- package/esm/src/evals/rubrics/catalog.js +846 -0
- package/esm/src/evals/rubrics/mod.d.ts +24 -0
- package/esm/src/evals/rubrics/mod.js +55 -0
- package/esm/src/evals/rubrics/mustache.d.ts +23 -0
- package/esm/src/evals/rubrics/mustache.js +154 -0
- package/esm/src/evals/rubrics/types.d.ts +54 -0
- package/esm/src/evals/rubrics/types.js +74 -0
- package/esm/src/evals/run.d.ts +118 -0
- package/esm/src/evals/run.js +452 -0
- package/esm/src/evals/suite.d.ts +19 -0
- package/esm/src/evals/suite.js +92 -0
- package/esm/src/evals/summary.d.ts +32 -0
- package/esm/src/evals/summary.js +30 -0
- package/esm/src/evals/trial.d.ts +27 -0
- package/esm/src/evals/trial.js +158 -0
- package/esm/src/evals/types.d.ts +260 -0
- package/esm/src/evals/types.js +126 -0
- package/esm/src/evals/verdict.d.ts +18 -0
- package/esm/src/evals/verdict.js +45 -0
- package/esm/src/guardrails/canary-gate.d.ts +21 -0
- package/esm/src/guardrails/canary-gate.js +40 -0
- package/esm/src/guardrails/canary.d.ts +112 -0
- package/esm/src/guardrails/canary.js +901 -0
- package/esm/src/guardrails/compile-egress.d.ts +11 -0
- package/esm/src/guardrails/compile-egress.js +11 -0
- package/esm/src/guardrails/corpus/canary-egress-attacks.d.ts +22 -0
- package/esm/src/guardrails/corpus/canary-egress-attacks.js +303 -0
- package/esm/src/guardrails/corpus/fuzz-inbound.d.ts +5 -0
- package/esm/src/guardrails/corpus/fuzz-inbound.js +202 -0
- package/esm/src/guardrails/corpus/inbound-payloads.d.ts +3 -0
- package/esm/src/guardrails/corpus/inbound-payloads.js +118 -0
- package/esm/src/guardrails/corpus/live-attacks.d.ts +13 -0
- package/esm/src/guardrails/corpus/live-attacks.js +224 -0
- package/esm/src/guardrails/corpus/mod.d.ts +7 -0
- package/esm/src/guardrails/corpus/mod.js +4 -0
- package/esm/src/guardrails/corpus/secrets.d.ts +12 -0
- package/esm/src/guardrails/corpus/secrets.js +16 -0
- package/esm/src/guardrails/corpus/strings.d.ts +23 -0
- package/esm/src/guardrails/corpus/strings.js +29 -0
- package/esm/src/guardrails/corpus/types.d.ts +32 -0
- package/esm/src/guardrails/corpus/types.js +1 -0
- package/esm/src/guardrails/egress-automata.d.ts +14 -0
- package/esm/src/guardrails/egress-automata.js +6059 -0
- package/esm/src/guardrails/egress-compiler.d.ts +33 -0
- package/esm/src/guardrails/egress-compiler.js +237 -0
- package/esm/src/guardrails/egress-patterns.d.ts +24 -0
- package/esm/src/guardrails/egress-patterns.js +32 -0
- package/esm/src/guardrails/egress-policy.d.ts +27 -0
- package/esm/src/guardrails/egress-policy.js +76 -0
- package/esm/src/guardrails/egress-rules.d.ts +54 -0
- package/esm/src/guardrails/egress-rules.js +49 -0
- package/esm/src/guardrails/egress-stream.d.ts +105 -0
- package/esm/src/guardrails/egress-stream.js +645 -0
- package/esm/src/guardrails/egress-urls.d.ts +83 -0
- package/esm/src/guardrails/egress-urls.js +917 -0
- package/esm/src/guardrails/egress.d.ts +106 -0
- package/esm/src/guardrails/egress.js +374 -0
- package/esm/src/guardrails/error.d.ts +26 -0
- package/esm/src/guardrails/error.js +91 -0
- package/esm/src/guardrails/event-schemas.d.ts +57 -0
- package/esm/src/guardrails/event-schemas.js +41 -0
- package/esm/src/guardrails/events.d.ts +9 -0
- package/esm/src/guardrails/events.js +42 -0
- package/esm/src/guardrails/hits.d.ts +8 -0
- package/esm/src/guardrails/hits.js +19 -0
- package/esm/src/guardrails/injection-patterns.d.ts +15 -0
- package/esm/src/guardrails/injection-patterns.js +94 -0
- package/esm/src/guardrails/injection.d.ts +14 -0
- package/esm/src/guardrails/injection.js +237 -0
- package/esm/src/guardrails/lexicon.d.ts +30 -0
- package/esm/src/guardrails/lexicon.js +478 -0
- package/esm/src/guardrails/live-outbound-gate.d.ts +54 -0
- package/esm/src/guardrails/live-outbound-gate.js +305 -0
- package/esm/src/guardrails/mod.d.ts +46 -0
- package/esm/src/guardrails/mod.js +29 -0
- package/esm/src/guardrails/network.d.ts +42 -0
- package/esm/src/guardrails/network.js +328 -0
- package/esm/src/guardrails/normalize.d.ts +6 -0
- package/esm/src/guardrails/normalize.js +132 -0
- package/esm/src/guardrails/policy.d.ts +19 -0
- package/esm/src/guardrails/policy.js +50 -0
- package/esm/src/guardrails/progressive-yield.d.ts +69 -0
- package/esm/src/guardrails/progressive-yield.js +237 -0
- package/esm/src/guardrails/prompt-echo.d.ts +38 -0
- package/esm/src/guardrails/prompt-echo.js +225 -0
- package/esm/src/guardrails/quota.d.ts +20 -0
- package/esm/src/guardrails/quota.js +80 -0
- package/esm/src/guardrails/rules.d.ts +56 -0
- package/esm/src/guardrails/rules.js +54 -0
- package/esm/src/guardrails/sanitize.d.ts +23 -0
- package/esm/src/guardrails/sanitize.js +184 -0
- package/esm/src/guardrails/sensitive.d.ts +29 -0
- package/esm/src/guardrails/sensitive.js +113 -0
- package/esm/src/guardrails/serialize.d.ts +14 -0
- package/esm/src/guardrails/serialize.js +37 -0
- package/esm/src/guardrails/testing.d.ts +9 -0
- package/esm/src/guardrails/testing.js +8 -0
- package/esm/src/guardrails/theorem-error.d.ts +18 -0
- package/esm/src/guardrails/theorem-error.js +53 -0
- package/esm/src/guardrails/thought-guard.d.ts +55 -0
- package/esm/src/guardrails/thought-guard.js +464 -0
- package/esm/src/guardrails/tool-directives.d.ts +19 -0
- package/esm/src/guardrails/tool-directives.js +109 -0
- package/esm/src/guardrails/tool-result.d.ts +61 -0
- package/esm/src/guardrails/tool-result.js +248 -0
- package/esm/src/guardrails/types.d.ts +242 -0
- package/esm/src/guardrails/types.js +54 -0
- package/esm/src/host/client-turn.d.ts +9 -0
- package/esm/src/host/client-turn.js +38 -0
- package/esm/src/host/mint-trace.d.ts +28 -0
- package/esm/src/host/mint-trace.js +59 -0
- package/esm/src/host/mod.d.ts +13 -0
- package/esm/src/host/mod.js +11 -0
- package/esm/src/host/readStreamingJsonStringField.d.ts +2 -0
- package/esm/src/host/readStreamingJsonStringField.js +68 -0
- package/esm/src/host/reply.d.ts +7 -0
- package/esm/src/host/reply.js +35 -0
- package/esm/src/interface/blocks.d.ts +8 -0
- package/esm/src/interface/blocks.js +213 -0
- package/esm/src/interface/composer-actions.d.ts +20 -0
- package/esm/src/interface/composer-actions.js +31 -0
- package/esm/src/interface/draft.d.ts +14 -0
- package/esm/src/interface/draft.js +28 -0
- package/esm/src/interface/from-profile.d.ts +12 -0
- package/esm/src/interface/from-profile.js +144 -0
- package/esm/src/interface/history.d.ts +40 -0
- package/esm/src/interface/history.js +269 -0
- package/esm/src/interface/inputs.d.ts +10 -0
- package/esm/src/interface/inputs.js +64 -0
- package/esm/src/interface/mod.d.ts +31 -0
- package/esm/src/interface/mod.js +21 -0
- package/esm/src/interface/models.d.ts +19 -0
- package/esm/src/interface/models.js +45 -0
- package/esm/src/interface/pending.d.ts +48 -0
- package/esm/src/interface/pending.js +146 -0
- package/esm/src/interface/profile-interface.d.ts +4 -0
- package/esm/src/interface/profile-interface.js +223 -0
- package/esm/src/interface/session.d.ts +64 -0
- package/esm/src/interface/session.js +121 -0
- package/esm/src/interface/tool-calls.d.ts +20 -0
- package/esm/src/interface/tool-calls.js +73 -0
- package/esm/src/interface/tool-invoke.d.ts +4 -0
- package/esm/src/interface/tool-invoke.js +20 -0
- package/esm/src/interface/tool-media.d.ts +9 -0
- package/esm/src/interface/tool-media.js +112 -0
- package/esm/src/interface/types.d.ts +213 -0
- package/esm/src/interface/types.js +4 -0
- package/esm/src/kernel/auth/credential-source.d.ts +23 -0
- package/esm/src/kernel/auth/credential-source.js +11 -0
- package/esm/src/kernel/auth/crypto.d.ts +51 -0
- package/esm/src/kernel/auth/crypto.js +161 -0
- package/esm/src/kernel/auth/mod.d.ts +5 -0
- package/esm/src/kernel/auth/mod.js +5 -0
- package/esm/src/kernel/auth/oauth.d.ts +17 -0
- package/esm/src/kernel/auth/oauth.js +438 -0
- package/esm/src/kernel/auth/scope-refusal.d.ts +9 -0
- package/esm/src/kernel/auth/scope-refusal.js +8 -0
- package/esm/src/kernel/auth/typed-secret.d.ts +13 -0
- package/esm/src/kernel/auth/typed-secret.js +23 -0
- package/esm/src/kernel/auth/types.d.ts +139 -0
- package/esm/src/kernel/auth/types.js +1 -0
- package/esm/src/kernel/default-scope.d.ts +34 -0
- package/esm/src/kernel/default-scope.js +72 -0
- package/esm/src/kernel/engine/compaction.d.ts +70 -0
- package/esm/src/kernel/engine/compaction.js +202 -0
- package/esm/src/kernel/engine/decision.d.ts +41 -0
- package/esm/src/kernel/engine/decision.js +412 -0
- package/esm/src/kernel/engine/hash.d.ts +6 -0
- package/esm/src/kernel/engine/hash.js +22 -0
- package/esm/src/kernel/engine/live-inbound.d.ts +9 -0
- package/esm/src/kernel/engine/live-inbound.js +19 -0
- package/esm/src/kernel/engine/live-ingress.d.ts +9 -0
- package/esm/src/kernel/engine/live-ingress.js +37 -0
- package/esm/src/kernel/engine/media-probe/audio.d.ts +7 -0
- package/esm/src/kernel/engine/media-probe/audio.js +342 -0
- package/esm/src/kernel/engine/media-probe/bytes.d.ts +6 -0
- package/esm/src/kernel/engine/media-probe/bytes.js +26 -0
- package/esm/src/kernel/engine/media-probe/image.d.ts +5 -0
- package/esm/src/kernel/engine/media-probe/image.js +171 -0
- package/esm/src/kernel/engine/media-probe/iso-bmff.d.ts +19 -0
- package/esm/src/kernel/engine/media-probe/iso-bmff.js +48 -0
- package/esm/src/kernel/engine/media-probe/matroska.d.ts +35 -0
- package/esm/src/kernel/engine/media-probe/matroska.js +226 -0
- package/esm/src/kernel/engine/media-probe/mp4.d.ts +22 -0
- package/esm/src/kernel/engine/media-probe/mp4.js +279 -0
- package/esm/src/kernel/engine/media-probe/opus.d.ts +4 -0
- package/esm/src/kernel/engine/media-probe/opus.js +23 -0
- package/esm/src/kernel/engine/media-probe/pdf.d.ts +5 -0
- package/esm/src/kernel/engine/media-probe/pdf.js +117 -0
- package/esm/src/kernel/engine/media-probe/video.d.ts +15 -0
- package/esm/src/kernel/engine/media-probe/video.js +49 -0
- package/esm/src/kernel/engine/record.d.ts +3 -0
- package/esm/src/kernel/engine/record.js +11 -0
- package/esm/src/kernel/engine/repair.d.ts +7 -0
- package/esm/src/kernel/engine/repair.js +36 -0
- package/esm/src/kernel/engine/runner/gates.d.ts +5 -0
- package/esm/src/kernel/engine/runner/gates.js +322 -0
- package/esm/src/kernel/engine/runner/mod.d.ts +15 -0
- package/esm/src/kernel/engine/runner/mod.js +574 -0
- package/esm/src/kernel/engine/runner/schema-validation.d.ts +14 -0
- package/esm/src/kernel/engine/runner/schema-validation.js +105 -0
- package/esm/src/kernel/engine/runner/stages.d.ts +28 -0
- package/esm/src/kernel/engine/runner/stages.js +48 -0
- package/esm/src/kernel/engine/runner/state.d.ts +76 -0
- package/esm/src/kernel/engine/runner/state.js +40 -0
- package/esm/src/kernel/engine/runner/steps.d.ts +14 -0
- package/esm/src/kernel/engine/runner/steps.js +360 -0
- package/esm/src/kernel/engine/runner/stream.d.ts +40 -0
- package/esm/src/kernel/engine/runner/stream.js +225 -0
- package/esm/src/kernel/engine/runner/usage.d.ts +45 -0
- package/esm/src/kernel/engine/runner/usage.js +150 -0
- package/esm/src/kernel/engine/session/mod.d.ts +31 -0
- package/esm/src/kernel/engine/session/mod.js +951 -0
- package/esm/src/kernel/engine/session/session-trace.d.ts +115 -0
- package/esm/src/kernel/engine/session/session-trace.js +489 -0
- package/esm/src/kernel/engine/token-estimate.d.ts +77 -0
- package/esm/src/kernel/engine/token-estimate.js +218 -0
- package/esm/src/kernel/engine/tool-trace.d.ts +58 -0
- package/esm/src/kernel/engine/tool-trace.js +131 -0
- package/esm/src/kernel/engine/tree.d.ts +2 -0
- package/esm/src/kernel/engine/tree.js +17 -0
- package/esm/src/kernel/engine/turn-trace.d.ts +118 -0
- package/esm/src/kernel/engine/turn-trace.js +863 -0
- package/esm/src/kernel/engine/usage.d.ts +30 -0
- package/esm/src/kernel/engine/usage.js +134 -0
- package/esm/src/kernel/interaction-parts.d.ts +10 -0
- package/esm/src/kernel/interaction-parts.js +22 -0
- package/esm/src/kernel/mod.d.ts +47 -0
- package/esm/src/kernel/mod.js +30 -0
- package/esm/src/kernel/profile-graph.d.ts +140 -0
- package/esm/src/kernel/profile-graph.js +151 -0
- package/esm/src/kernel/profile-presence.d.ts +9 -0
- package/esm/src/kernel/profile-presence.js +143 -0
- package/esm/src/kernel/profile-scope.d.ts +36 -0
- package/esm/src/kernel/profile-scope.js +262 -0
- package/esm/src/kernel/registry/attachments.d.ts +35 -0
- package/esm/src/kernel/registry/attachments.js +211 -0
- package/esm/src/kernel/registry/catalog.d.ts +19 -0
- package/esm/src/kernel/registry/catalog.js +78 -0
- package/esm/src/kernel/registry/ingress.d.ts +8 -0
- package/esm/src/kernel/registry/ingress.js +134 -0
- package/esm/src/kernel/registry/kernel-registry.d.ts +12 -0
- package/esm/src/kernel/registry/kernel-registry.js +8 -0
- package/esm/src/kernel/registry/profile-outputs.d.ts +3 -0
- package/esm/src/kernel/registry/profile-outputs.js +7 -0
- package/esm/src/kernel/registry/profiles.d.ts +92 -0
- package/esm/src/kernel/registry/profiles.js +698 -0
- package/esm/src/kernel/registry/provider-request.d.ts +6 -0
- package/esm/src/kernel/registry/provider-request.js +42 -0
- package/esm/src/kernel/registry/resolve.d.ts +14 -0
- package/esm/src/kernel/registry/resolve.js +237 -0
- package/esm/src/kernel/registry/schemas.d.ts +9 -0
- package/esm/src/kernel/registry/schemas.js +25 -0
- package/esm/src/kernel/registry/sole-model.d.ts +2 -0
- package/esm/src/kernel/registry/sole-model.js +4 -0
- package/esm/src/kernel/registry/system-prompt.d.ts +8 -0
- package/esm/src/kernel/registry/system-prompt.js +33 -0
- package/esm/src/kernel/registry/system-role.d.ts +3 -0
- package/esm/src/kernel/registry/system-role.js +9 -0
- package/esm/src/kernel/registry/vault.d.ts +13 -0
- package/esm/src/kernel/registry/vault.js +14 -0
- package/esm/src/kernel/schema.d.ts +172 -0
- package/esm/src/kernel/schema.js +653 -0
- package/esm/src/kernel/scope.d.ts +22 -0
- package/esm/src/kernel/scope.js +25 -0
- package/esm/src/kernel/stages.d.ts +141 -0
- package/esm/src/kernel/stages.js +388 -0
- package/esm/src/kernel/stop.d.ts +93 -0
- package/esm/src/kernel/stop.js +125 -0
- package/esm/src/kernel/system-parts.d.ts +26 -0
- package/esm/src/kernel/system-parts.js +98 -0
- package/esm/src/kernel/tools/activity-label.d.ts +16 -0
- package/esm/src/kernel/tools/activity-label.js +209 -0
- package/esm/src/kernel/tools/events.d.ts +51 -0
- package/esm/src/kernel/tools/events.js +149 -0
- package/esm/src/kernel/tools/execute.d.ts +64 -0
- package/esm/src/kernel/tools/execute.js +801 -0
- package/esm/src/kernel/tools/gate-answer.d.ts +50 -0
- package/esm/src/kernel/tools/gate-answer.js +54 -0
- package/esm/src/kernel/tools/harness.d.ts +16 -0
- package/esm/src/kernel/tools/harness.js +42 -0
- package/esm/src/kernel/tools/invoke.d.ts +10 -0
- package/esm/src/kernel/tools/invoke.js +129 -0
- package/esm/src/kernel/tools/mcp-sessions.d.ts +20 -0
- package/esm/src/kernel/tools/mcp-sessions.js +64 -0
- package/esm/src/kernel/tools/mod.d.ts +9 -0
- package/esm/src/kernel/tools/mod.js +6 -0
- package/esm/src/kernel/tools/model-text.d.ts +11 -0
- package/esm/src/kernel/tools/model-text.js +25 -0
- package/esm/src/kernel/tools/permission.d.ts +6 -0
- package/esm/src/kernel/tools/permission.js +38 -0
- package/esm/src/kernel/tools/project.d.ts +8 -0
- package/esm/src/kernel/tools/project.js +25 -0
- package/esm/src/kernel/tools/registry.d.ts +20 -0
- package/esm/src/kernel/tools/registry.js +84 -0
- package/esm/src/kernel/tools/remote.d.ts +110 -0
- package/esm/src/kernel/tools/remote.js +998 -0
- package/esm/src/kernel/tools/resolve.d.ts +28 -0
- package/esm/src/kernel/tools/resolve.js +259 -0
- package/esm/src/kernel/tools/schema.d.ts +10 -0
- package/esm/src/kernel/tools/schema.js +174 -0
- package/esm/src/kernel/tools/signed-in-fetch.d.ts +18 -0
- package/esm/src/kernel/tools/signed-in-fetch.js +45 -0
- package/esm/src/kernel/tools/stage-run.d.ts +93 -0
- package/esm/src/kernel/tools/stage-run.js +140 -0
- package/esm/src/kernel/tools/types.d.ts +287 -0
- package/esm/src/kernel/tools/types.js +1 -0
- package/esm/src/kernel/turn-events.d.ts +599 -0
- package/esm/src/kernel/turn-events.js +425 -0
- package/esm/src/kernel/types.d.ts +884 -0
- package/esm/src/kernel/types.js +1 -0
- package/esm/src/kernel/util/base64.d.ts +2 -0
- package/esm/src/kernel/util/base64.js +13 -0
- package/esm/src/kernel/util/exact-type.d.ts +31 -0
- package/esm/src/kernel/util/exact-type.js +1 -0
- package/esm/src/kernel/util/find-last.d.ts +3 -0
- package/esm/src/kernel/util/find-last.js +9 -0
- package/esm/src/kernel/util/mime.d.ts +2 -0
- package/esm/src/kernel/util/mime.js +4 -0
- package/esm/src/kernel/util/record.d.ts +1 -0
- package/esm/src/kernel/util/record.js +3 -0
- package/esm/src/observability/destinations.d.ts +9 -0
- package/esm/src/observability/destinations.js +38 -0
- package/esm/src/observability/jsonl.d.ts +18 -0
- package/esm/src/observability/jsonl.js +117 -0
- package/esm/src/observability/mod.d.ts +22 -0
- package/esm/src/observability/mod.js +16 -0
- package/esm/src/observability/openinference.d.ts +11 -0
- package/esm/src/observability/openinference.js +205 -0
- package/esm/src/observability/otlp.d.ts +68 -0
- package/esm/src/observability/otlp.js +98 -0
- package/esm/src/observability/phoenix.d.ts +29 -0
- package/esm/src/observability/phoenix.js +71 -0
- package/esm/src/observability/policy.d.ts +14 -0
- package/esm/src/observability/policy.js +69 -0
- package/esm/src/observability/resolve-policy.d.ts +8 -0
- package/esm/src/observability/resolve-policy.js +58 -0
- package/esm/src/observability/spans.d.ts +16 -0
- package/esm/src/observability/spans.js +56 -0
- package/esm/src/observability/trace-catalog.d.ts +111 -0
- package/esm/src/observability/trace-catalog.js +865 -0
- package/esm/src/observability/trace-record.d.ts +23 -0
- package/esm/src/observability/trace-record.js +223 -0
- package/esm/src/observability/trace-schema.d.ts +54 -0
- package/esm/src/observability/trace-schema.js +59 -0
- package/esm/src/observability/trace-sink.d.ts +13 -0
- package/esm/src/observability/trace-sink.js +3 -0
- package/esm/src/observability/trace-span.d.ts +92 -0
- package/esm/src/observability/trace-span.js +199 -0
- package/esm/src/observability/trace.d.ts +11 -0
- package/esm/src/observability/trace.js +35 -0
- package/esm/src/observability/types.d.ts +85 -0
- package/esm/src/observability/types.js +3 -0
- package/esm/src/presets/google/speech-voices.d.ts +8 -0
- package/esm/src/presets/google/speech-voices.js +38 -0
- package/esm/src/presets/google-limits.d.ts +12 -0
- package/esm/src/presets/google-limits.js +18 -0
- package/esm/src/presets/google.d.ts +104 -0
- package/esm/src/presets/google.js +188 -0
- package/esm/src/presets/mod.d.ts +10 -0
- package/esm/src/presets/mod.js +9 -0
- package/esm/src/presets/openrouter.d.ts +13 -0
- package/esm/src/presets/openrouter.js +13 -0
- package/esm/src/presets/typesafe.d.ts +2 -0
- package/esm/src/presets/typesafe.js +2 -0
- package/esm/src/providers/create-provider.d.ts +21 -0
- package/esm/src/providers/create-provider.js +90 -0
- package/esm/src/providers/decision/usage.d.ts +3 -0
- package/esm/src/providers/decision/usage.js +25 -0
- package/esm/src/providers/google/api-error.d.ts +8 -0
- package/esm/src/providers/google/api-error.js +123 -0
- package/esm/src/providers/google/grounding.d.ts +5 -0
- package/esm/src/providers/google/grounding.js +226 -0
- package/esm/src/providers/google/interactions/framing.d.ts +15 -0
- package/esm/src/providers/google/interactions/framing.js +263 -0
- package/esm/src/providers/google/interactions/mod.d.ts +2 -0
- package/esm/src/providers/google/interactions/mod.js +2 -0
- package/esm/src/providers/google/interactions/steps.d.ts +12 -0
- package/esm/src/providers/google/interactions/steps.js +200 -0
- package/esm/src/providers/google/interactions/stream.d.ts +24 -0
- package/esm/src/providers/google/interactions/stream.js +297 -0
- package/esm/src/providers/google/keys.d.ts +20 -0
- package/esm/src/providers/google/keys.js +87 -0
- package/esm/src/providers/google/live/framing.d.ts +51 -0
- package/esm/src/providers/google/live/framing.js +597 -0
- package/esm/src/providers/google/live/mod.d.ts +7 -0
- package/esm/src/providers/google/live/mod.js +7 -0
- package/esm/src/providers/google/live/openapi-schema.d.ts +1 -0
- package/esm/src/providers/google/live/openapi-schema.js +42 -0
- package/esm/src/providers/google/live/session.d.ts +14 -0
- package/esm/src/providers/google/live/session.js +150 -0
- package/esm/src/providers/google/live/stream.d.ts +51 -0
- package/esm/src/providers/google/live/stream.js +263 -0
- package/esm/src/providers/google/thinking.d.ts +3 -0
- package/esm/src/providers/google/thinking.js +8 -0
- package/esm/src/providers/google/urls.d.ts +6 -0
- package/esm/src/providers/google/urls.js +6 -0
- package/esm/src/providers/google/usage.d.ts +7 -0
- package/esm/src/providers/google/usage.js +49 -0
- package/esm/src/providers/local/local.d.ts +12 -0
- package/esm/src/providers/local/local.js +186 -0
- package/esm/src/providers/local/mod.d.ts +8 -0
- package/esm/src/providers/local/mod.js +8 -0
- package/esm/src/providers/mod.d.ts +11 -0
- package/esm/src/providers/mod.js +7 -0
- package/esm/src/providers/openrouter/cache-control.d.ts +5 -0
- package/esm/src/providers/openrouter/cache-control.js +4 -0
- package/esm/src/providers/openrouter/chat.d.ts +64 -0
- package/esm/src/providers/openrouter/chat.js +490 -0
- package/esm/src/providers/openrouter/image.d.ts +24 -0
- package/esm/src/providers/openrouter/image.js +187 -0
- package/esm/src/providers/openrouter/openai/compat.d.ts +19 -0
- package/esm/src/providers/openrouter/openai/compat.js +162 -0
- package/esm/src/providers/openrouter/openai/image-payload.d.ts +9 -0
- package/esm/src/providers/openrouter/openai/image-payload.js +115 -0
- package/esm/src/providers/openrouter/openai/sdk-messages.d.ts +10 -0
- package/esm/src/providers/openrouter/openai/sdk-messages.js +99 -0
- package/esm/src/providers/openrouter/openai/usage.d.ts +8 -0
- package/esm/src/providers/openrouter/openai/usage.js +56 -0
- package/esm/src/providers/openrouter/resolve-api-key.d.ts +3 -0
- package/esm/src/providers/openrouter/resolve-api-key.js +8 -0
- package/esm/src/providers/openrouter/speech.d.ts +18 -0
- package/esm/src/providers/openrouter/speech.js +109 -0
- package/esm/src/providers/probe.d.ts +5 -0
- package/esm/src/providers/probe.js +15 -0
- package/esm/src/providers/shared/builtin-wire.d.ts +4 -0
- package/esm/src/providers/shared/builtin-wire.js +9 -0
- package/esm/src/providers/shared/pcm.d.ts +14 -0
- package/esm/src/providers/shared/pcm.js +78 -0
- package/esm/src/providers/shared/response-identity.d.ts +11 -0
- package/esm/src/providers/shared/response-identity.js +12 -0
- package/esm/src/providers/shared/sse.d.ts +10 -0
- package/esm/src/providers/shared/sse.js +79 -0
- package/esm/src/providers/shared/structured-output.d.ts +4 -0
- package/esm/src/providers/shared/structured-output.js +11 -0
- package/esm/src/providers/shared/tool-args.d.ts +25 -0
- package/esm/src/providers/shared/tool-args.js +84 -0
- package/esm/src/providers/shared/upstream-tap.d.ts +8 -0
- package/esm/src/providers/shared/upstream-tap.js +85 -0
- package/esm/src/providers/shared/upstream-tape.d.ts +6 -0
- package/esm/src/providers/shared/upstream-tape.js +88 -0
- package/esm/src/providers/shared/vault.d.ts +13 -0
- package/esm/src/providers/shared/vault.js +41 -0
- package/esm/src/providers/types.d.ts +19 -0
- package/esm/src/providers/types.js +1 -0
- package/esm/src/surface/formats.d.ts +28 -0
- package/esm/src/surface/formats.js +139 -0
- package/esm/src/surface/mod.d.ts +14 -0
- package/esm/src/surface/mod.js +10 -0
- package/esm/src/surface/runtime.d.ts +40 -0
- package/esm/src/surface/runtime.js +439 -0
- package/esm/src/surface/tools.d.ts +15 -0
- package/esm/src/surface/tools.js +80 -0
- package/esm/src/surface/types.d.ts +104 -0
- package/esm/src/surface/types.js +4 -0
- package/package.json +108 -4
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build-time compiler for egress rules, behind `@theoremjs/agents/guardrails/compile`.
|
|
3
|
+
*
|
|
4
|
+
* The streaming egress hold reads each pattern as an automaton that accepts
|
|
5
|
+
* every match of it and more, so it can hold exactly the text a match could
|
|
6
|
+
* still be under way in. Building those automata takes a regex engine (refa)
|
|
7
|
+
* and time a Worker cold start cannot spare, so it runs here, at build time:
|
|
8
|
+
* `agents egress-compile` writes the table, and `egressPolicy` loads it.
|
|
9
|
+
*
|
|
10
|
+
* An automaton drops its pattern's assertions: a lookbehind, `\b`, `^` and `$`
|
|
11
|
+
* match nothing, and a lookahead may be read or skipped. A bounded repeat over
|
|
12
|
+
* `COUNT_LIMIT` is unbounded. An inline modifier's flags are set on the whole
|
|
13
|
+
* pattern. Each change only widens what it accepts, so the hold can only hold
|
|
14
|
+
* more than it must. A backreference to text that varies has no automaton;
|
|
15
|
+
* compiling it fails.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
import { type CompiledEgressRules, type EgressAutomatonData, type EgressRule } from './egress-rules.js';
|
|
20
|
+
/** The table `egressPolicy` needs to hold exactly for `rules`. */
|
|
21
|
+
declare function compileEgressRules(rules: readonly EgressRule[]): CompiledEgressRules;
|
|
22
|
+
/** `compiled` as a module exporting it as `compiledEgressRules`. */
|
|
23
|
+
declare function compiledEgressModule(compiled: CompiledEgressRules): string;
|
|
24
|
+
/**
|
|
25
|
+
* Everything `egress-automata.ts` holds, from the bundled patterns as they are
|
|
26
|
+
* now: the injection patterns reversed, and the forward and reversed automata.
|
|
27
|
+
*/
|
|
28
|
+
declare function bundledEgressAutomata(): {
|
|
29
|
+
reversedPatterns: RegExp[];
|
|
30
|
+
forward: EgressAutomatonData;
|
|
31
|
+
reversed: EgressAutomatonData;
|
|
32
|
+
};
|
|
33
|
+
export { bundledEgressAutomata, compiledEgressModule, compileEgressRules };
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build-time compiler for egress rules, behind `@theoremjs/agents/guardrails/compile`.
|
|
3
|
+
*
|
|
4
|
+
* The streaming egress hold reads each pattern as an automaton that accepts
|
|
5
|
+
* every match of it and more, so it can hold exactly the text a match could
|
|
6
|
+
* still be under way in. Building those automata takes a regex engine (refa)
|
|
7
|
+
* and time a Worker cold start cannot spare, so it runs here, at build time:
|
|
8
|
+
* `agents egress-compile` writes the table, and `egressPolicy` loads it.
|
|
9
|
+
*
|
|
10
|
+
* An automaton drops its pattern's assertions: a lookbehind, `\b`, `^` and `$`
|
|
11
|
+
* match nothing, and a lookahead may be read or skipped. A bounded repeat over
|
|
12
|
+
* `COUNT_LIMIT` is unbounded. An inline modifier's flags are set on the whole
|
|
13
|
+
* pattern. Each change only widens what it accepts, so the hold can only hold
|
|
14
|
+
* more than it must. A backreference to text that varies has no automaton;
|
|
15
|
+
* compiling it fails.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
import { RegExpParser, visitRegExpAST } from '@eslint-community/regexpp';
|
|
20
|
+
import { JS, NFA } from 'refa';
|
|
21
|
+
import { EGRESS_PATTERNS } from './egress-patterns.js';
|
|
22
|
+
import { assertEgressRules, EGRESS_COMPILER_VERSION, ruleFingerprint, } from './egress-rules.js';
|
|
23
|
+
import { TheoremError } from './error.js';
|
|
24
|
+
const MAX_CHAR = 0xffff;
|
|
25
|
+
/**
|
|
26
|
+
* A bounded repeat longer than this is read as unbounded: the hold cannot
|
|
27
|
+
* tell the bound is reached without counting, and holding on is the safe side.
|
|
28
|
+
*/
|
|
29
|
+
const COUNT_LIMIT = 256;
|
|
30
|
+
/** The pattern read right to left: `P` on reversed text matches where this matches on the text. */
|
|
31
|
+
function reversed(alternatives) {
|
|
32
|
+
return alternatives.map((concat) => ({
|
|
33
|
+
type: 'Concatenation',
|
|
34
|
+
elements: concat.elements.map(reversedElement).reverse(),
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
function reversedElement(element) {
|
|
38
|
+
switch (element.type) {
|
|
39
|
+
case 'Alternation':
|
|
40
|
+
case 'Quantifier':
|
|
41
|
+
return { ...element, alternatives: reversed(element.alternatives) };
|
|
42
|
+
case 'Assertion':
|
|
43
|
+
return {
|
|
44
|
+
...element,
|
|
45
|
+
kind: element.kind === 'ahead' ? 'behind' : 'ahead',
|
|
46
|
+
alternatives: reversed(element.alternatives),
|
|
47
|
+
};
|
|
48
|
+
case 'CharacterClass':
|
|
49
|
+
return element;
|
|
50
|
+
default:
|
|
51
|
+
// lexicon-exempt: developer contract / internal diagnostic — not end-user or model copy (P2)
|
|
52
|
+
throw new Error(`cannot reverse a ${element.type} element`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The pattern with its assertions loosened: a lookbehind (and `\b`, `^`, `$`,
|
|
57
|
+
* which parse to lookarounds) matches the empty string, a lookahead is either
|
|
58
|
+
* skipped or read as part of the match, and a long bounded repeat is unbounded.
|
|
59
|
+
*/
|
|
60
|
+
function loosened(alternatives) {
|
|
61
|
+
return alternatives.map((concat) => ({
|
|
62
|
+
type: 'Concatenation',
|
|
63
|
+
elements: concat.elements.flatMap(loosenedElement),
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
function loosenedElement(element) {
|
|
67
|
+
switch (element.type) {
|
|
68
|
+
case 'Alternation':
|
|
69
|
+
return [{ ...element, alternatives: loosened(element.alternatives) }];
|
|
70
|
+
case 'Quantifier':
|
|
71
|
+
return [
|
|
72
|
+
{
|
|
73
|
+
...element,
|
|
74
|
+
max: element.max > COUNT_LIMIT ? Number.POSITIVE_INFINITY : element.max,
|
|
75
|
+
alternatives: loosened(element.alternatives),
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
case 'Assertion':
|
|
79
|
+
if (element.kind === 'behind')
|
|
80
|
+
return [];
|
|
81
|
+
return [
|
|
82
|
+
{
|
|
83
|
+
type: 'Alternation',
|
|
84
|
+
alternatives: [
|
|
85
|
+
{ type: 'Concatenation', elements: [] },
|
|
86
|
+
...loosened(element.alternatives),
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
case 'CharacterClass':
|
|
91
|
+
return [element];
|
|
92
|
+
default:
|
|
93
|
+
// lexicon-exempt: developer contract / internal diagnostic — not end-user or model copy (P2)
|
|
94
|
+
throw new Error(`cannot loosen a ${element.type} element`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* `literal` as current JavaScript reads it: refa's own parser stops at ES2024,
|
|
99
|
+
* and refa ignores an inline modifier group, so its flags go on the pattern.
|
|
100
|
+
*/
|
|
101
|
+
function literalAst(literal) {
|
|
102
|
+
const ast = new RegExpParser().parseLiteral(literal);
|
|
103
|
+
visitRegExpAST(ast, {
|
|
104
|
+
onModifiersEnter({ add }) {
|
|
105
|
+
ast.flags.ignoreCase ||= add.ignoreCase;
|
|
106
|
+
ast.flags.dotAll ||= add.dotAll;
|
|
107
|
+
ast.flags.multiline ||= add.multiline;
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
return ast;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The pattern over UTF-16 code units. A `u` or `v` pattern reads code points;
|
|
114
|
+
* it is rewritten to the equivalent pattern on the units that spell them.
|
|
115
|
+
*/
|
|
116
|
+
function parsed(pattern) {
|
|
117
|
+
const ast = literalAst(String(pattern));
|
|
118
|
+
const { expression } = JS.Parser.fromAst(ast).parse({ assertions: 'parse' });
|
|
119
|
+
if (!ast.flags.unicode && !ast.flags.unicodeSets) {
|
|
120
|
+
return expression.alternatives;
|
|
121
|
+
}
|
|
122
|
+
const units = JS.toLiteral(expression, { flags: { unicode: false, unicodeSets: false } });
|
|
123
|
+
return JS.Parser.fromLiteral(units).parse({ assertions: 'parse' }).expression.alternatives;
|
|
124
|
+
}
|
|
125
|
+
/** A regex literal for the reversed pattern, with the original's flags. */
|
|
126
|
+
function reversedLiteral(pattern) {
|
|
127
|
+
const literal = JS.toLiteral(reversed(parsed(pattern)), {
|
|
128
|
+
flags: { global: true, unicode: false, sticky: false },
|
|
129
|
+
});
|
|
130
|
+
return new RegExp(literal.source, literal.flags);
|
|
131
|
+
}
|
|
132
|
+
function nfaOf(alternatives) {
|
|
133
|
+
const nfa = NFA.fromRegex(loosened(alternatives), { maxCharacter: MAX_CHAR });
|
|
134
|
+
nfa.removeUnreachable();
|
|
135
|
+
return { initial: nfa.initial, nodes: [...nfa.nodes()], finals: nfa.finals };
|
|
136
|
+
}
|
|
137
|
+
/** The union of the patterns' automata as tables, nodes tagged with their pattern. */
|
|
138
|
+
function automatonData(patterns) {
|
|
139
|
+
const nfas = patterns.map(nfaOf);
|
|
140
|
+
const bounds = new Set([0]);
|
|
141
|
+
for (const nfa of nfas) {
|
|
142
|
+
for (const node of nfa.nodes) {
|
|
143
|
+
for (const set of node.out.values()) {
|
|
144
|
+
for (const range of set.ranges) {
|
|
145
|
+
bounds.add(range.min);
|
|
146
|
+
if (range.max < MAX_CHAR)
|
|
147
|
+
bounds.add(range.max + 1);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const classStarts = [...bounds].sort((a, b) => a - b);
|
|
153
|
+
const classOf = (code) => {
|
|
154
|
+
let lo = 0;
|
|
155
|
+
let hi = classStarts.length - 1;
|
|
156
|
+
while (lo < hi) {
|
|
157
|
+
const mid = (lo + hi + 1) >> 1;
|
|
158
|
+
if (classStarts[mid] <= code)
|
|
159
|
+
lo = mid;
|
|
160
|
+
else
|
|
161
|
+
hi = mid - 1;
|
|
162
|
+
}
|
|
163
|
+
return lo;
|
|
164
|
+
};
|
|
165
|
+
const charsets = [];
|
|
166
|
+
const charsetIds = new Map();
|
|
167
|
+
const charsetId = (ranges) => {
|
|
168
|
+
const classes = [];
|
|
169
|
+
for (const { min, max } of ranges) {
|
|
170
|
+
for (let k = classOf(min); k < classStarts.length && classStarts[k] <= max; k++) {
|
|
171
|
+
classes.push(k);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
const key = classes.join(',');
|
|
175
|
+
let id = charsetIds.get(key);
|
|
176
|
+
if (id === undefined) {
|
|
177
|
+
id = charsets.length;
|
|
178
|
+
charsets.push(classes);
|
|
179
|
+
charsetIds.set(key, id);
|
|
180
|
+
}
|
|
181
|
+
return id;
|
|
182
|
+
};
|
|
183
|
+
const nodes = [];
|
|
184
|
+
const initials = [];
|
|
185
|
+
nfas.forEach((nfa, pattern) => {
|
|
186
|
+
const ids = new Map();
|
|
187
|
+
for (const node of nfa.nodes)
|
|
188
|
+
ids.set(node, nodes.length + ids.size);
|
|
189
|
+
initials.push(ids.get(nfa.initial));
|
|
190
|
+
for (const node of nfa.nodes) {
|
|
191
|
+
const row = [pattern, nfa.finals.has(node) ? 1 : 0];
|
|
192
|
+
for (const [to, set] of node.out)
|
|
193
|
+
row.push(ids.get(to), charsetId(set.ranges));
|
|
194
|
+
nodes.push(row);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
return { classStarts, charsets, initials, nodes };
|
|
198
|
+
}
|
|
199
|
+
/** The table `egressPolicy` needs to hold exactly for `rules`. */
|
|
200
|
+
function compileEgressRules(rules) {
|
|
201
|
+
assertEgressRules(rules);
|
|
202
|
+
const alternatives = rules.map(({ rule, pattern }) => {
|
|
203
|
+
try {
|
|
204
|
+
const units = parsed(pattern);
|
|
205
|
+
nfaOf(units);
|
|
206
|
+
return units;
|
|
207
|
+
}
|
|
208
|
+
catch (err) {
|
|
209
|
+
throw new TheoremError('config', `egress rule ${rule}: ${pattern} has no automaton the stream can hold for (${err instanceof Error ? err.message : String(err)})`);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
return {
|
|
213
|
+
compiler: EGRESS_COMPILER_VERSION,
|
|
214
|
+
rules: ruleFingerprint(rules),
|
|
215
|
+
automaton: automatonData(alternatives),
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
/** `compiled` as a module exporting it as `compiledEgressRules`. */
|
|
219
|
+
function compiledEgressModule(compiled) {
|
|
220
|
+
// lexicon-exempt: developer contract / internal diagnostic — not end-user or model copy (P2)
|
|
221
|
+
return `// Generated by \`agents egress-compile\`. Do not edit: change the rules and compile again.
|
|
222
|
+
export const compiledEgressRules = ${JSON.stringify(compiled)};
|
|
223
|
+
`;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Everything `egress-automata.ts` holds, from the bundled patterns as they are
|
|
227
|
+
* now: the injection patterns reversed, and the forward and reversed automata.
|
|
228
|
+
*/
|
|
229
|
+
function bundledEgressAutomata() {
|
|
230
|
+
const injection = EGRESS_PATTERNS.filter((entry) => entry.kind === 'injection');
|
|
231
|
+
return {
|
|
232
|
+
reversedPatterns: injection.map(({ pattern }) => reversedLiteral(pattern)),
|
|
233
|
+
forward: automatonData(EGRESS_PATTERNS.map(({ pattern }) => parsed(pattern))),
|
|
234
|
+
reversed: automatonData(injection.map(({ pattern }) => reversed(parsed(pattern)))),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
export { bundledEgressAutomata, compiledEgressModule, compileEgressRules };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every pattern the bundled egress policy matches on the reply, in the order
|
|
3
|
+
* the streaming hold's automata number them (`egress-automata.ts`, generated
|
|
4
|
+
* from this list by `scripts/gen-egress-automata.ts`).
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import { type SensitiveGroup } from './sensitive.js';
|
|
9
|
+
declare const SYSTEM_BOUNDARY: RegExp;
|
|
10
|
+
/** What a match of the pattern means: the rule it trips, or the blob its filter decodes. */
|
|
11
|
+
type EgressPatternKind = 'injection' | 'sensitive' | 'card' | 'boundary' | 'base64' | 'hex' | 'spaced' | 'pipe' | 'image' | 'link';
|
|
12
|
+
interface EgressPattern {
|
|
13
|
+
kind: EgressPatternKind;
|
|
14
|
+
pattern: RegExp;
|
|
15
|
+
/** The sensitive-data group a `sensitive` or `card` pattern belongs to. */
|
|
16
|
+
group?: SensitiveGroup;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Patterns matched on the reply as written. The injection patterns come first:
|
|
20
|
+
* the rewritten views (typo, Unicode, rot13, leet, URL) match those alone.
|
|
21
|
+
*/
|
|
22
|
+
declare const EGRESS_PATTERNS: readonly EgressPattern[];
|
|
23
|
+
export type { EgressPattern, EgressPatternKind };
|
|
24
|
+
export { EGRESS_PATTERNS, SYSTEM_BOUNDARY };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every pattern the bundled egress policy matches on the reply, in the order
|
|
3
|
+
* the streaming hold's automata number them (`egress-automata.ts`, generated
|
|
4
|
+
* from this list by `scripts/gen-egress-automata.ts`).
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import { IMAGE_PATTERNS, LINK_PATTERNS } from './egress-urls.js';
|
|
9
|
+
import { BASE64_BLOB, HEX_BLOB, INJECTION_PATTERNS, PIPE_SEPARATED, SPACED_LETTERS, } from './injection-patterns.js';
|
|
10
|
+
import { CARD_CANDIDATE, SENSITIVE_PATTERNS } from './sensitive.js';
|
|
11
|
+
const SYSTEM_BOUNDARY = /This turn\x27s canary is|<\s*(?:\/\s*)?user_data(?:\s*(?:\/\s*)?>)?/i; // lexicon-exempt: developer contract / internal diagnostic — not end-user or model copy (P2)
|
|
12
|
+
/**
|
|
13
|
+
* Patterns matched on the reply as written. The injection patterns come first:
|
|
14
|
+
* the rewritten views (typo, Unicode, rot13, leet, URL) match those alone.
|
|
15
|
+
*/
|
|
16
|
+
const EGRESS_PATTERNS = [
|
|
17
|
+
...INJECTION_PATTERNS.map((pattern) => ({ kind: 'injection', pattern })),
|
|
18
|
+
...SENSITIVE_PATTERNS.map(({ group, pattern }) => ({
|
|
19
|
+
kind: 'sensitive',
|
|
20
|
+
pattern,
|
|
21
|
+
group,
|
|
22
|
+
})),
|
|
23
|
+
{ kind: 'card', pattern: CARD_CANDIDATE, group: 'financial' },
|
|
24
|
+
{ kind: 'boundary', pattern: new RegExp(SYSTEM_BOUNDARY.source, 'gi') },
|
|
25
|
+
{ kind: 'base64', pattern: BASE64_BLOB },
|
|
26
|
+
{ kind: 'hex', pattern: HEX_BLOB },
|
|
27
|
+
{ kind: 'spaced', pattern: SPACED_LETTERS },
|
|
28
|
+
{ kind: 'pipe', pattern: PIPE_SEPARATED },
|
|
29
|
+
...IMAGE_PATTERNS.map((pattern) => ({ kind: 'image', pattern })),
|
|
30
|
+
...LINK_PATTERNS.map((pattern) => ({ kind: 'link', pattern })),
|
|
31
|
+
];
|
|
32
|
+
export { EGRESS_PATTERNS, SYSTEM_BOUNDARY };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `egressPolicy`: the bundled egress checks a host selects, with its own
|
|
3
|
+
* rules added. The rules' automata come from `agents egress-compile`, so the
|
|
4
|
+
* stream holds exactly the text a host match could still be under way in, as
|
|
5
|
+
* it does for the bundled patterns.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import { type EgressChecks } from './egress.js';
|
|
10
|
+
import { type CompiledEgressRules, type EgressRule } from './egress-rules.js';
|
|
11
|
+
import type { EgressEnforcer } from './types.js';
|
|
12
|
+
interface EgressPolicyOptions {
|
|
13
|
+
/** Host rules, blocked on alongside the bundled checks. */
|
|
14
|
+
rules?: readonly EgressRule[];
|
|
15
|
+
/** `compiledEgressRules` from the module `agents egress-compile` wrote for `rules`. */
|
|
16
|
+
compiled?: CompiledEgressRules;
|
|
17
|
+
/**
|
|
18
|
+
* The bundled checks: `true` (the default) runs each at its default, `false`
|
|
19
|
+
* none, and an object switches the ones it names (`EgressChecks`). The
|
|
20
|
+
* system-prompt leak checks run either way.
|
|
21
|
+
*/
|
|
22
|
+
bundled?: boolean | EgressChecks;
|
|
23
|
+
}
|
|
24
|
+
/** An egress enforce that blocks on each host rule and on the bundled checks `bundled` selects. */
|
|
25
|
+
declare function egressPolicy({ rules, compiled, bundled, }?: EgressPolicyOptions): EgressEnforcer;
|
|
26
|
+
export type { EgressPolicyOptions };
|
|
27
|
+
export { egressPolicy };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `egressPolicy`: the bundled egress checks a host selects, with its own
|
|
3
|
+
* rules added. The rules' automata come from `agents egress-compile`, so the
|
|
4
|
+
* stream holds exactly the text a host match could still be under way in, as
|
|
5
|
+
* it does for the bundled patterns.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import { collectEgressHits, egressChecksProblem, egressScope, hitsEnforcer, NO_CHECKS, registerEgressChecks, resolveEgressChecks, } from './egress.js';
|
|
10
|
+
import { assertEgressRules, EGRESS_COMPILER_VERSION, globalPattern, ruleFingerprint, } from './egress-rules.js';
|
|
11
|
+
import { createEgressStream, registerStreamPlan, } from './egress-stream.js';
|
|
12
|
+
import { TheoremError } from './error.js';
|
|
13
|
+
import { hitFromSpan } from './hits.js';
|
|
14
|
+
/** Every host rule's matches in `text`. An empty match is not a hit. */
|
|
15
|
+
function ruleHits(text, rules) {
|
|
16
|
+
const hits = [];
|
|
17
|
+
for (const { rule, severity, pattern } of rules) {
|
|
18
|
+
for (const match of text.matchAll(pattern)) {
|
|
19
|
+
if (!match[0])
|
|
20
|
+
continue;
|
|
21
|
+
hits.push(hitFromSpan(text, { start: match.index, end: match.index + match[0].length }, rule, severity));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return hits;
|
|
25
|
+
}
|
|
26
|
+
/** A compiled table that no longer matches `rules` would hold for the wrong patterns. */
|
|
27
|
+
function assertCompiledFor(rules, compiled) {
|
|
28
|
+
const stale = (why) => configError(`the compiled rules ${why}; run \`agents egress-compile\` again`); // lexicon-exempt: developer contract / internal diagnostic — not end-user or model copy (P2)
|
|
29
|
+
if (compiled?.compiler !== EGRESS_COMPILER_VERSION) {
|
|
30
|
+
// lexicon-exempt: developer contract / internal diagnostic — not end-user or model copy (P2)
|
|
31
|
+
throw stale(`come from compiler ${compiled?.compiler}, this one is ${EGRESS_COMPILER_VERSION}`);
|
|
32
|
+
}
|
|
33
|
+
const want = ruleFingerprint(rules);
|
|
34
|
+
if (JSON.stringify(compiled.rules) !== JSON.stringify(want)) {
|
|
35
|
+
throw stale('were compiled from different rules'); // lexicon-exempt: developer contract / internal diagnostic — not end-user or model copy (P2)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function configError(message) {
|
|
39
|
+
return new TheoremError('config', `egressPolicy: ${message}`);
|
|
40
|
+
}
|
|
41
|
+
function assertEgressChecks(checks) {
|
|
42
|
+
const problem = egressChecksProblem('bundled', checks);
|
|
43
|
+
if (problem !== undefined)
|
|
44
|
+
throw configError(problem);
|
|
45
|
+
}
|
|
46
|
+
/** An egress enforce that blocks on each host rule and on the bundled checks `bundled` selects. */
|
|
47
|
+
function egressPolicy({ rules = [], compiled, bundled = true, } = {}) {
|
|
48
|
+
assertEgressRules(rules);
|
|
49
|
+
if (rules.length > 0) {
|
|
50
|
+
if (compiled === undefined) {
|
|
51
|
+
throw configError('rules need the compiled table `agents egress-compile` writes for them'); // lexicon-exempt: developer contract / internal diagnostic — not end-user or model copy (P2)
|
|
52
|
+
}
|
|
53
|
+
assertCompiledFor(rules, compiled);
|
|
54
|
+
}
|
|
55
|
+
assertEgressChecks(bundled);
|
|
56
|
+
const checks = bundled === false ? NO_CHECKS : resolveEgressChecks(bundled === true ? {} : bundled);
|
|
57
|
+
const host = rules.map(({ rule, pattern, severity }) => ({
|
|
58
|
+
rule,
|
|
59
|
+
severity: severity ?? 'high',
|
|
60
|
+
pattern: globalPattern(pattern),
|
|
61
|
+
}));
|
|
62
|
+
const enforce = hitsEnforcer((text, context) => {
|
|
63
|
+
const hits = collectEgressHits(text, egressScope(context), checks);
|
|
64
|
+
hits.push(...ruleHits(text, host));
|
|
65
|
+
return hits;
|
|
66
|
+
});
|
|
67
|
+
const scan = compiled && host.length > 0 ? { automaton: compiled.automaton, rules: host } : undefined;
|
|
68
|
+
registerStreamPlan(enforce, (context) => createEgressStream({
|
|
69
|
+
checks,
|
|
70
|
+
...(scan ? { host: scan } : {}),
|
|
71
|
+
...(context.givenUrls ? { given: context.givenUrls } : {}),
|
|
72
|
+
}));
|
|
73
|
+
registerEgressChecks(enforce, checks);
|
|
74
|
+
return enforce;
|
|
75
|
+
}
|
|
76
|
+
export { egressPolicy };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host egress rules: the patterns a host adds to (or runs instead of) the
|
|
3
|
+
* bundled egress policy, and the tables `agents egress-compile` writes for
|
|
4
|
+
* them. Shared by the build-time compiler and `egressPolicy`.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import type { Severity } from './types.js';
|
|
9
|
+
/** One host egress rule: a reply matching `pattern` is blocked under `rule`. */
|
|
10
|
+
interface EgressRule {
|
|
11
|
+
/** The rule id hits carry, e.g. `acme.account-number`. `egress.` ids are the bundled policy's. */
|
|
12
|
+
rule: string;
|
|
13
|
+
/** Matched on the reply as written. No sticky (`y`) flag; `g` is implied. */
|
|
14
|
+
pattern: RegExp;
|
|
15
|
+
/** Default `high`. */
|
|
16
|
+
severity?: Severity;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* An automaton over UTF-16 code units, as tables.
|
|
20
|
+
*
|
|
21
|
+
* - `classStarts`: first code unit of each character class; class k covers
|
|
22
|
+
* `[classStarts[k], classStarts[k+1])`.
|
|
23
|
+
* - `charsets`: each charset as the sorted class ids it contains.
|
|
24
|
+
* - `initials`: the initial node of each pattern.
|
|
25
|
+
* - `nodes`: each node as `[pattern, final (0/1), target, charset, target, charset, ...]`.
|
|
26
|
+
*/
|
|
27
|
+
interface EgressAutomatonData {
|
|
28
|
+
classStarts: readonly number[];
|
|
29
|
+
charsets: readonly (readonly number[])[];
|
|
30
|
+
initials: readonly number[];
|
|
31
|
+
nodes: readonly (readonly number[])[];
|
|
32
|
+
}
|
|
33
|
+
/** What `compileEgressRules` writes: the rules it read, and their automaton. */
|
|
34
|
+
interface CompiledEgressRules {
|
|
35
|
+
/** `EGRESS_COMPILER_VERSION` of the compiler that wrote it. */
|
|
36
|
+
compiler: number;
|
|
37
|
+
/** Each rule's id and pattern, in order: `egressPolicy` refuses a table that no longer matches its rules. */
|
|
38
|
+
rules: readonly {
|
|
39
|
+
rule: string;
|
|
40
|
+
source: string;
|
|
41
|
+
flags: string;
|
|
42
|
+
}[];
|
|
43
|
+
automaton: EgressAutomatonData;
|
|
44
|
+
}
|
|
45
|
+
/** Bumped whenever the compiled table's layout or meaning changes. */
|
|
46
|
+
declare const EGRESS_COMPILER_VERSION = 1;
|
|
47
|
+
/** Rule ids are non-empty, unique and not the bundled policy's; patterns are not sticky. */
|
|
48
|
+
declare function assertEgressRules(rules: readonly EgressRule[]): void;
|
|
49
|
+
/** The rules as a compiled table records them. */
|
|
50
|
+
declare function ruleFingerprint(rules: readonly EgressRule[]): CompiledEgressRules['rules'];
|
|
51
|
+
/** The pattern, global, for scanning every match. */
|
|
52
|
+
declare function globalPattern(pattern: RegExp): RegExp;
|
|
53
|
+
export type { CompiledEgressRules, EgressAutomatonData, EgressRule };
|
|
54
|
+
export { assertEgressRules, EGRESS_COMPILER_VERSION, globalPattern, ruleFingerprint };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host egress rules: the patterns a host adds to (or runs instead of) the
|
|
3
|
+
* bundled egress policy, and the tables `agents egress-compile` writes for
|
|
4
|
+
* them. Shared by the build-time compiler and `egressPolicy`.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import { TheoremError } from './error.js';
|
|
9
|
+
/** Bumped whenever the compiled table's layout or meaning changes. */
|
|
10
|
+
const EGRESS_COMPILER_VERSION = 1;
|
|
11
|
+
const RESERVED_PREFIX = 'egress.';
|
|
12
|
+
function configError(message) {
|
|
13
|
+
return new TheoremError('config', message);
|
|
14
|
+
}
|
|
15
|
+
/** Rule ids are non-empty, unique and not the bundled policy's; patterns are not sticky. */
|
|
16
|
+
function assertEgressRules(rules) {
|
|
17
|
+
const seen = new Set();
|
|
18
|
+
for (const { rule, pattern } of rules) {
|
|
19
|
+
if (typeof rule !== 'string' || !rule.trim()) {
|
|
20
|
+
throw configError('egress rule ids must be non-empty strings'); // lexicon-exempt: developer contract / internal diagnostic — not end-user or model copy (P2)
|
|
21
|
+
}
|
|
22
|
+
if (rule.startsWith(RESERVED_PREFIX)) {
|
|
23
|
+
throw configError(
|
|
24
|
+
// lexicon-exempt: developer contract / internal diagnostic — not end-user or model copy (P2)
|
|
25
|
+
`egress rule ${rule}: ids starting "${RESERVED_PREFIX}" are the bundled policy's`);
|
|
26
|
+
}
|
|
27
|
+
if (seen.has(rule)) {
|
|
28
|
+
throw configError(`egress rule ${rule} is listed twice`); // lexicon-exempt: developer contract / internal diagnostic — not end-user or model copy (P2)
|
|
29
|
+
}
|
|
30
|
+
seen.add(rule);
|
|
31
|
+
if (!(pattern instanceof RegExp)) {
|
|
32
|
+
throw configError(`egress rule ${rule}: pattern must be a RegExp`); // lexicon-exempt: developer contract / internal diagnostic — not end-user or model copy (P2)
|
|
33
|
+
}
|
|
34
|
+
if (pattern.sticky) {
|
|
35
|
+
throw configError(
|
|
36
|
+
// lexicon-exempt: developer contract / internal diagnostic — not end-user or model copy (P2)
|
|
37
|
+
`egress rule ${rule}: a sticky (y) pattern only matches where the last one ended`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** The rules as a compiled table records them. */
|
|
42
|
+
function ruleFingerprint(rules) {
|
|
43
|
+
return rules.map(({ rule, pattern }) => ({ rule, source: pattern.source, flags: pattern.flags }));
|
|
44
|
+
}
|
|
45
|
+
/** The pattern, global, for scanning every match. */
|
|
46
|
+
function globalPattern(pattern) {
|
|
47
|
+
return new RegExp(pattern.source, pattern.global ? pattern.flags : `${pattern.flags}g`);
|
|
48
|
+
}
|
|
49
|
+
export { assertEgressRules, EGRESS_COMPILER_VERSION, globalPattern, ruleFingerprint };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bundled egress policy, run on a reply as it streams.
|
|
3
|
+
*
|
|
4
|
+
* The bundled checks match their patterns on the reply as written and, for
|
|
5
|
+
* injection phrasing, on
|
|
6
|
+
* rewrites of it (typo-folded, Unicode-folded, rot13, leet, URL-decoded, read
|
|
7
|
+
* backwards). The stream keeps each rewrite growing with the reply and, for
|
|
8
|
+
* every pattern, an automaton accepting every match of it and more
|
|
9
|
+
* (`egress-automata.ts`). Text is held from the earliest place any match could
|
|
10
|
+
* still be under way in any rewrite, and nowhere else: a match that completes
|
|
11
|
+
* later starts at or after that place, so none of it has been released.
|
|
12
|
+
*
|
|
13
|
+
* A match whose outcome no later text can change is settled; a settled match
|
|
14
|
+
* of the pattern itself (not the automaton) is a hit, and the reply is
|
|
15
|
+
* blocked there. Each character is read a bounded number of times, so a long
|
|
16
|
+
* reply costs time in proportion to its length.
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import { type ResolvedEgressChecks } from './egress.js';
|
|
21
|
+
import { type EgressAutomatonData } from './egress-rules.js';
|
|
22
|
+
import { type GivenUrls } from './egress-urls.js';
|
|
23
|
+
import type { EgressEnforcer, GuardrailContext, Severity } from './types.js';
|
|
24
|
+
/** A settled match the policy blocks on. */
|
|
25
|
+
interface EgressStreamHit {
|
|
26
|
+
rule: string;
|
|
27
|
+
severity: Severity;
|
|
28
|
+
/** Where in the reply the match starts (the start of its rewrite's source). */
|
|
29
|
+
start: number;
|
|
30
|
+
}
|
|
31
|
+
interface EgressStream {
|
|
32
|
+
/** Read the next piece of the reply; a hit when a match has settled. */
|
|
33
|
+
push: (chunk: string) => EgressStreamHit | undefined;
|
|
34
|
+
/** The earliest index of the reply a match could still start at. */
|
|
35
|
+
holdFrom: () => number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Text grown at its end, with what its latest update added. Reading a grown
|
|
39
|
+
* string copies the whole of it, so what reads each new character reads it
|
|
40
|
+
* from `fresh`.
|
|
41
|
+
*/
|
|
42
|
+
interface Grown {
|
|
43
|
+
text: string;
|
|
44
|
+
fresh: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A rewrite of the reply, grown as the reply is: its settled text (no later
|
|
48
|
+
* reply text changes it) and, per settled character, the reply index a match
|
|
49
|
+
* starting there must be held from.
|
|
50
|
+
*/
|
|
51
|
+
interface View extends Grown {
|
|
52
|
+
/** Reply index to hold from for a match starting at view index `j`. */
|
|
53
|
+
rawAt: (j: number) => number;
|
|
54
|
+
/** Take whatever the source has settled since the last call. */
|
|
55
|
+
update: () => void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* `typoNormalize` of the source. It rewrites whole words (`\w` runs) of the
|
|
59
|
+
* same length, so a word settles when a non-word character ends it, or as soon
|
|
60
|
+
* as it can no longer fold to a target (then the rest of it passes as is).
|
|
61
|
+
*/
|
|
62
|
+
declare function typoView(source: View): View;
|
|
63
|
+
/** A rewrite whose characters keep their own reply index. */
|
|
64
|
+
interface MappedView extends View {
|
|
65
|
+
from: number[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* `normalizeForDetection` of the reply, in its three passes: each code point
|
|
69
|
+
* mapped, emoji runs between letters dropped, a backslash before a letter
|
|
70
|
+
* dropped. Unsettled: a high surrogate whose low half may follow (in the reply
|
|
71
|
+
* or in the mapped text), an emoji run after a letter until the character
|
|
72
|
+
* after it, a backslash until the character after it.
|
|
73
|
+
*/
|
|
74
|
+
declare function normalizedView(reply: Grown): MappedView;
|
|
75
|
+
/**
|
|
76
|
+
* `decodeUrlRuns` of the reply: a run of `%XX` escapes is unsettled until the
|
|
77
|
+
* character after it shows the run is over. Its decoded text holds from the
|
|
78
|
+
* run's first `%`.
|
|
79
|
+
*/
|
|
80
|
+
declare function urlView(reply: Grown): MappedView;
|
|
81
|
+
interface EgressStreamOptions {
|
|
82
|
+
/** The bundled checks to run. Default each at its default (`EgressChecks`). */
|
|
83
|
+
checks?: ResolvedEgressChecks;
|
|
84
|
+
/** Host rules, read on the reply as written, with their compiled automaton. */
|
|
85
|
+
host?: {
|
|
86
|
+
automaton: EgressAutomatonData;
|
|
87
|
+
rules: readonly {
|
|
88
|
+
rule: string;
|
|
89
|
+
severity: Severity;
|
|
90
|
+
pattern: RegExp;
|
|
91
|
+
}[];
|
|
92
|
+
};
|
|
93
|
+
/** The URLs the model was given, for the image and link checks. */
|
|
94
|
+
given?: GivenUrls;
|
|
95
|
+
}
|
|
96
|
+
/** Scans the bundled egress policy's patterns, and any host rules, as a reply streams. */
|
|
97
|
+
declare function createEgressStream(options?: EgressStreamOptions): EgressStream;
|
|
98
|
+
/** A stream running a policy's checks, for the turn or session `context` describes. */
|
|
99
|
+
type EgressStreamPlan = (context: GuardrailContext) => EgressStream;
|
|
100
|
+
/** The streaming plan for `enforce`, when the stream knows its checks. */
|
|
101
|
+
declare function streamPlanOf(enforce: EgressEnforcer): EgressStreamPlan | undefined;
|
|
102
|
+
/** Tell the gate `enforce` runs exactly the checks `plan` streams. */
|
|
103
|
+
declare function registerStreamPlan(enforce: EgressEnforcer, plan: EgressStreamPlan): void;
|
|
104
|
+
export type { EgressStream, EgressStreamHit, EgressStreamOptions, EgressStreamPlan, Grown, MappedView, View, };
|
|
105
|
+
export { createEgressStream, normalizedView, registerStreamPlan, streamPlanOf, typoView, urlView };
|