@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,143 @@
|
|
|
1
|
+
// Leaf module: `schema.ts` reads it at load time. `defineProfile` enforces the requirements;
|
|
2
|
+
// this records them for display.
|
|
3
|
+
/** Presence for profile paths, keyed like `PROFILE_FIELDS` (`models.*` matches every binding). */
|
|
4
|
+
export const PROFILE_FIELD_PRESENCE = {
|
|
5
|
+
id: { required: true },
|
|
6
|
+
type: { required: true },
|
|
7
|
+
identity: { required: true },
|
|
8
|
+
'identity.handle': { required: true },
|
|
9
|
+
'identity.system': { unset: 'No system instruction' },
|
|
10
|
+
tools: { required: true },
|
|
11
|
+
'tools.allow': { required: true },
|
|
12
|
+
image: { required: true },
|
|
13
|
+
speech: { required: true },
|
|
14
|
+
live: { required: true },
|
|
15
|
+
decision: { required: true },
|
|
16
|
+
'decision.contract': { required: true },
|
|
17
|
+
models: { required: true },
|
|
18
|
+
defaultModel: { required: 'when more than one model is declared', unset: 'The only model' },
|
|
19
|
+
allowModelSelect: { unset: 'Off' },
|
|
20
|
+
maxSteps: { unset: 'Unbounded' },
|
|
21
|
+
key: { required: 'when a Google model has no key of its own', unset: 'No key slot' },
|
|
22
|
+
fallbackKey: { unset: 'No fallback' },
|
|
23
|
+
'models.*.protocol': { required: true },
|
|
24
|
+
'models.*.provider': { required: true },
|
|
25
|
+
'models.*.apiId': { required: true },
|
|
26
|
+
'models.*.builtInTools': { unset: 'None' },
|
|
27
|
+
'models.*.maxOutputTokens': { unset: 'Provider default' },
|
|
28
|
+
'models.*.temperature': { unset: 'Provider default' },
|
|
29
|
+
'models.*.summaries': { unset: 'Provider default' },
|
|
30
|
+
'models.*.efforts': { unset: 'Provider default' },
|
|
31
|
+
'models.*.defaultEffort': {
|
|
32
|
+
required: 'when more than one effort is declared',
|
|
33
|
+
unset: 'The only effort',
|
|
34
|
+
},
|
|
35
|
+
'models.*.allowEffortSelect': { unset: 'Off' },
|
|
36
|
+
'models.*.key': { unset: "The profile's key" },
|
|
37
|
+
'models.*.fallbackKey': { unset: "The profile's fallback key" },
|
|
38
|
+
'models.*.timeoutMs': { unset: 'No timeout' },
|
|
39
|
+
'models.*.compaction': { unset: 'Off' },
|
|
40
|
+
'models.*.compaction.maxTokens': { required: true },
|
|
41
|
+
'models.*.compaction.compactAt': { required: true },
|
|
42
|
+
'models.*.compaction.previousExchanges': { required: true },
|
|
43
|
+
'models.*.compaction.profile': { unset: 'The agent itself' },
|
|
44
|
+
'models.*.compaction.timing': { required: true },
|
|
45
|
+
'models.*.compaction.meter': { unset: 'history' },
|
|
46
|
+
'models.*.cache': { unset: 'Off' },
|
|
47
|
+
'models.*.cache.mode': { required: true },
|
|
48
|
+
'models.*.cache.ttl': { unset: 'Provider default' },
|
|
49
|
+
'models.*.store': { unset: 'Provider default' },
|
|
50
|
+
'models.*.persistViaInteractionId': { required: 'when the protocol is geminiInteractions' },
|
|
51
|
+
inputs: { required: true },
|
|
52
|
+
'inputs.text': { unset: 'Accepted' },
|
|
53
|
+
'inputs.attachments.accept': { unset: 'No attachments' },
|
|
54
|
+
'inputs.voice.accept': { unset: 'No voice' },
|
|
55
|
+
'inputs.maxFiles': { required: 'when attachments or voice is set' },
|
|
56
|
+
'inputs.maxBytes': { required: 'when attachments or voice is set' },
|
|
57
|
+
'inputs.maxTurnBytes': { required: 'when attachments or voice is set' },
|
|
58
|
+
'inputs.state': { required: true },
|
|
59
|
+
'inputs.maxStateBytes': { unset: 'No cap' },
|
|
60
|
+
'inputs.limitsByMime': { unset: 'maxBytes for every type' },
|
|
61
|
+
'inputs.slots': { unset: 'No slots' },
|
|
62
|
+
'outputs.structured': { unset: 'Free text' },
|
|
63
|
+
'outputs.validation.maxRetries': { unset: '0' },
|
|
64
|
+
'outputs.streaming.mode': { unset: 'sse' },
|
|
65
|
+
'outputs.streaming.streamThoughts': { unset: 'On' },
|
|
66
|
+
'turnBehaviour.resumption.allowContinue': { unset: 'All three' },
|
|
67
|
+
'turnBehaviour.resumption.autoContinue': { unset: 'length and stream_incomplete' },
|
|
68
|
+
'turnBehaviour.resumption.maxContinues': { unset: 'No cap' },
|
|
69
|
+
'turnBehaviour.allowSteering': { unset: 'On' },
|
|
70
|
+
'guardrails.quota': { unset: 'No limit' },
|
|
71
|
+
'guardrails.canary': { unset: 'On' },
|
|
72
|
+
'guardrails.sanitizeInput': { unset: 'On' },
|
|
73
|
+
'guardrails.redactSensitive': { unset: 'On' },
|
|
74
|
+
'guardrails.egress': { unset: 'No check' },
|
|
75
|
+
'guardrails.egress.enforce': { required: 'when checks is not set' },
|
|
76
|
+
'guardrails.egress.checks': { required: 'when enforce is not set' },
|
|
77
|
+
'guardrails.egress.checks.sensitive': { unset: 'Every group but network' },
|
|
78
|
+
'guardrails.egress.checks.sensitive.ids': { unset: 'On' },
|
|
79
|
+
'guardrails.egress.checks.sensitive.financial': { unset: 'On' },
|
|
80
|
+
'guardrails.egress.checks.sensitive.network': { unset: 'Off' },
|
|
81
|
+
'guardrails.egress.checks.sensitive.credentials': { unset: 'On' },
|
|
82
|
+
'guardrails.egress.checks.boundary': { unset: 'On' },
|
|
83
|
+
'guardrails.egress.checks.injection': { unset: 'On' },
|
|
84
|
+
'guardrails.egress.checks.images': { unset: 'On' },
|
|
85
|
+
'guardrails.egress.checks.images.hosts': { unset: 'None' },
|
|
86
|
+
'guardrails.egress.checks.images.fromTools': { unset: 'On' },
|
|
87
|
+
'guardrails.egress.checks.links': { unset: 'Off' },
|
|
88
|
+
'guardrails.egress.checks.links.hosts': { unset: 'The images hosts' },
|
|
89
|
+
'guardrails.egress.checks.links.fromTools': { unset: 'On' },
|
|
90
|
+
'guardrails.egress.onBlock': { unset: 'reject_to_agent' },
|
|
91
|
+
'guardrails.egress.maxRetries': { unset: '0' },
|
|
92
|
+
'guardrails.egress.holdback': { unset: '256' },
|
|
93
|
+
'guardrails.network.allowPrivateNetworks': { unset: 'Off' },
|
|
94
|
+
'guardrails.network.allowedHosts': { unset: 'None' },
|
|
95
|
+
'guardrails.network.allowedSchemes': {
|
|
96
|
+
unset: 'https, plus http when allowPrivateNetworks is on',
|
|
97
|
+
},
|
|
98
|
+
'guardrails.taint.afterRemoteRead': { unset: 'off' },
|
|
99
|
+
'guardrails.disclosure': { unset: 'No check' },
|
|
100
|
+
'observability.writeTo': { unset: 'No traces' },
|
|
101
|
+
'observability.sampleRate': { unset: '1' },
|
|
102
|
+
'observability.include.upstreamLog': { unset: 'On' },
|
|
103
|
+
'observability.include.outboundWire': { unset: 'Off' },
|
|
104
|
+
'observability.include.evidenceRaw': { unset: 'Off' },
|
|
105
|
+
'observability.include.usage': { unset: 'On' },
|
|
106
|
+
'observability.include.guardrailDecisions': { unset: 'On' },
|
|
107
|
+
'observability.include.guardrailMatchPreview': { unset: 'Off' },
|
|
108
|
+
'observability.resource': { unset: 'None' },
|
|
109
|
+
'observability.scrub.sensitive': { unset: 'On' },
|
|
110
|
+
'observability.scrub.injection': { unset: 'On' },
|
|
111
|
+
'observability.scrub.canary': { unset: 'On' },
|
|
112
|
+
'observability.retainForDays': { unset: '14' },
|
|
113
|
+
'observability.rotateAfterMiB': { unset: '32' },
|
|
114
|
+
'observability.onWriteError': { unset: 'Errors are dropped' },
|
|
115
|
+
'image.aspectRatio': { unset: 'Provider default' },
|
|
116
|
+
'image.resolution': { unset: 'Provider default' },
|
|
117
|
+
'image.mimeType': { unset: 'Provider default' },
|
|
118
|
+
'image.quality': { unset: 'Provider default' },
|
|
119
|
+
'image.background': { unset: 'Provider default' },
|
|
120
|
+
'image.n': { unset: 'Provider default' },
|
|
121
|
+
'image.seed': { unset: 'Provider default' },
|
|
122
|
+
'image.outputCompression': { unset: 'Provider default' },
|
|
123
|
+
'image.references': { unset: 'None' },
|
|
124
|
+
'image.includeText': { unset: 'Off' },
|
|
125
|
+
'speech.voice': { unset: 'Provider default' },
|
|
126
|
+
'speech.format': { unset: 'Provider default' },
|
|
127
|
+
'live.ingress.audio': { unset: 'On' },
|
|
128
|
+
'live.ingress.video': { unset: 'On' },
|
|
129
|
+
'live.ingress.text': { unset: 'Off' },
|
|
130
|
+
'live.voice': { unset: 'Provider default' },
|
|
131
|
+
'live.vad.activityHandling': { unset: 'Provider default' },
|
|
132
|
+
'live.vad.startSensitivity': { unset: 'Provider default' },
|
|
133
|
+
'live.vad.endSensitivity': { unset: 'Provider default' },
|
|
134
|
+
'live.vad.prefixPaddingMs': { unset: 'Provider default' },
|
|
135
|
+
'live.vad.silenceDurationMs': { unset: 'Provider default' },
|
|
136
|
+
'live.sessionResumption': { unset: 'Off' },
|
|
137
|
+
'live.contextCompression': { unset: 'Off' },
|
|
138
|
+
'live.contextCompression.triggerTokens': { unset: 'Provider default' },
|
|
139
|
+
'live.contextCompression.slidingWindow': { required: true },
|
|
140
|
+
'live.contextCompression.slidingWindow.targetTokens': { unset: 'Provider default' },
|
|
141
|
+
'live.transcription.input': { unset: 'Off' },
|
|
142
|
+
'live.transcription.output': { unset: 'Off' },
|
|
143
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ProfileType } from './schema.js';
|
|
2
|
+
/**
|
|
3
|
+
* Mirrors `PROFILE_TYPES` — a value import would cycle through `schema.ts`.
|
|
4
|
+
* Drift is gated by tests/kernel/profile-scope.test.ts.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ALL_PROFILE_TYPES: readonly ProfileType[];
|
|
7
|
+
export interface ProfileFieldScope {
|
|
8
|
+
profileTypes: readonly ProfileType[];
|
|
9
|
+
/** Why other types can't take it — shown in `defineProfile` errors and authoring UIs. */
|
|
10
|
+
reason: string;
|
|
11
|
+
/**
|
|
12
|
+
* The one value other types may still carry: the field's "off" value (speech stores
|
|
13
|
+
* `guardrails.canary: false`; `outputs.structured: null` asks for no schema).
|
|
14
|
+
*/
|
|
15
|
+
offValue?: false | null;
|
|
16
|
+
}
|
|
17
|
+
/** Keyed like `PROFILE_FIELDS`; `models.*` matches every model binding. */
|
|
18
|
+
export declare const PROFILE_FIELD_SCOPE: Readonly<Record<string, ProfileFieldScope>>;
|
|
19
|
+
/**
|
|
20
|
+
* The scope entry that governs `path`: its own, else its nearest ancestor's.
|
|
21
|
+
* `undefined` means every profile type.
|
|
22
|
+
*/
|
|
23
|
+
export declare function profileFieldScope(path: string): ProfileFieldScope | undefined;
|
|
24
|
+
export declare function profileTypesForField(path: string): readonly ProfileType[];
|
|
25
|
+
export interface OutOfScopeField {
|
|
26
|
+
/** e.g. `models.fast.compaction` for the `models.*.compaction` scope. */
|
|
27
|
+
path: string;
|
|
28
|
+
scope: ProfileFieldScope;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Every field `profile` sets that its type may not, ancestors before their
|
|
32
|
+
* children. A scope's off value is not reported.
|
|
33
|
+
*/
|
|
34
|
+
export declare function outOfScopeFields(profile: {
|
|
35
|
+
readonly type: ProfileType;
|
|
36
|
+
}): OutOfScopeField[];
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
// Leaf module: `schema.ts` and `profile-graph.ts` read it at load time.
|
|
2
|
+
/** lexicon-exempt-file: authoring field-meta scope reasons — not runtime user or model copy (P2) */
|
|
3
|
+
import { HOST_GUARDRAIL_FIELDS } from '../guardrails/types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Mirrors `PROFILE_TYPES` — a value import would cycle through `schema.ts`.
|
|
6
|
+
* Drift is gated by tests/kernel/profile-scope.test.ts.
|
|
7
|
+
*/
|
|
8
|
+
export const ALL_PROFILE_TYPES = [
|
|
9
|
+
'text',
|
|
10
|
+
'image',
|
|
11
|
+
'speech',
|
|
12
|
+
'live',
|
|
13
|
+
'decision',
|
|
14
|
+
'host',
|
|
15
|
+
];
|
|
16
|
+
const MODEL_PROFILE_TYPES = ['text', 'image', 'speech', 'live', 'decision'];
|
|
17
|
+
const TURN_TYPES = ['text', 'image', 'speech', 'live'];
|
|
18
|
+
/** Types whose `inputs` are turn inputs (text, files, slots) rather than decision state. */
|
|
19
|
+
const TURN_INPUT_TYPES = ['text', 'image'];
|
|
20
|
+
const TURN_INPUT_REASON = 'a decision takes JSON state, not turn text, files or slots';
|
|
21
|
+
/** Guardrails a host profile may set keep `host`; the rest guard a model turn. */
|
|
22
|
+
function turnGuardrailTypes(key) {
|
|
23
|
+
return HOST_GUARDRAIL_FIELDS.includes(key)
|
|
24
|
+
? [...TURN_TYPES, 'host']
|
|
25
|
+
: TURN_TYPES;
|
|
26
|
+
}
|
|
27
|
+
/** Keyed like `PROFILE_FIELDS`; `models.*` matches every model binding. */
|
|
28
|
+
export const PROFILE_FIELD_SCOPE = {
|
|
29
|
+
...Object.fromEntries([
|
|
30
|
+
'efforts',
|
|
31
|
+
'defaultEffort',
|
|
32
|
+
'allowEffortSelect',
|
|
33
|
+
'summaries',
|
|
34
|
+
'maxOutputTokens',
|
|
35
|
+
'temperature',
|
|
36
|
+
'builtInTools',
|
|
37
|
+
'cache',
|
|
38
|
+
'store',
|
|
39
|
+
'persistViaInteractionId',
|
|
40
|
+
'server',
|
|
41
|
+
'fallbackKey',
|
|
42
|
+
].map((field) => [
|
|
43
|
+
`models.*.${field}`,
|
|
44
|
+
{
|
|
45
|
+
profileTypes: TURN_TYPES,
|
|
46
|
+
reason: 'only model turns use this setting; decisions send state and questions',
|
|
47
|
+
},
|
|
48
|
+
])),
|
|
49
|
+
'models.*.timeoutMs': {
|
|
50
|
+
profileTypes: ['decision'],
|
|
51
|
+
reason: 'only decision bindings configure a request timeout here',
|
|
52
|
+
},
|
|
53
|
+
identity: {
|
|
54
|
+
profileTypes: MODEL_PROFILE_TYPES,
|
|
55
|
+
reason: 'a host profile has no agent identity — it runs no model',
|
|
56
|
+
},
|
|
57
|
+
'identity.system': {
|
|
58
|
+
profileTypes: ['text', 'image', 'live'],
|
|
59
|
+
reason: 'speech has no system channel (the input text is the transcript) and a decision is asked only through its questions',
|
|
60
|
+
},
|
|
61
|
+
'identity.systemByRole': {
|
|
62
|
+
profileTypes: ['text', 'image', 'live'],
|
|
63
|
+
reason: 'speech has no system channel (the input text is the transcript) and a decision is asked only through its questions',
|
|
64
|
+
},
|
|
65
|
+
models: { profileTypes: MODEL_PROFILE_TYPES, reason: 'a host profile runs no model' },
|
|
66
|
+
'models.*.protocol': {
|
|
67
|
+
profileTypes: MODEL_PROFILE_TYPES,
|
|
68
|
+
reason: 'a host profile runs no model',
|
|
69
|
+
},
|
|
70
|
+
'models.*.provider': {
|
|
71
|
+
profileTypes: MODEL_PROFILE_TYPES,
|
|
72
|
+
reason: 'a host profile runs no model',
|
|
73
|
+
},
|
|
74
|
+
'models.*.compaction': {
|
|
75
|
+
profileTypes: ['text', 'image', 'speech'],
|
|
76
|
+
reason: 'live compacts with live.contextCompression',
|
|
77
|
+
},
|
|
78
|
+
key: { profileTypes: MODEL_PROFILE_TYPES, reason: 'a host profile runs no model' },
|
|
79
|
+
fallbackKey: {
|
|
80
|
+
profileTypes: TURN_TYPES,
|
|
81
|
+
reason: 'a host profile runs no model and a decision makes one call on its key',
|
|
82
|
+
},
|
|
83
|
+
defaultModel: {
|
|
84
|
+
profileTypes: TURN_TYPES,
|
|
85
|
+
reason: 'a host profile runs no model and a decision declares exactly one',
|
|
86
|
+
},
|
|
87
|
+
allowModelSelect: {
|
|
88
|
+
profileTypes: TURN_TYPES,
|
|
89
|
+
reason: 'a host profile runs no model and a decision declares exactly one',
|
|
90
|
+
},
|
|
91
|
+
maxSteps: {
|
|
92
|
+
profileTypes: TURN_TYPES,
|
|
93
|
+
reason: 'only model turns take tool-loop steps',
|
|
94
|
+
},
|
|
95
|
+
decision: { profileTypes: ['decision'], reason: 'only decision profiles carry a contract' },
|
|
96
|
+
image: { profileTypes: ['image'], reason: 'only image profiles generate images' },
|
|
97
|
+
speech: { profileTypes: ['speech'], reason: 'only speech profiles synthesize audio' },
|
|
98
|
+
live: { profileTypes: ['live'], reason: 'only live profiles open a realtime session' },
|
|
99
|
+
tools: {
|
|
100
|
+
profileTypes: ['text', 'image', 'live', 'host'],
|
|
101
|
+
reason: 'speech and decision profiles call no tools',
|
|
102
|
+
},
|
|
103
|
+
'tools.t1Policy': {
|
|
104
|
+
profileTypes: ['text', 'image'],
|
|
105
|
+
reason: 'live wires every allowed tool once at session setup, and a host profile can execute every allowed tool',
|
|
106
|
+
},
|
|
107
|
+
'tools.t2Loader': {
|
|
108
|
+
profileTypes: ['text', 'image'],
|
|
109
|
+
reason: 'live function declarations are fixed at session setup, and a host profile can execute every allowed tool',
|
|
110
|
+
},
|
|
111
|
+
inputs: {
|
|
112
|
+
profileTypes: ['text', 'image', 'decision'],
|
|
113
|
+
reason: 'speech input is the transcript, live ingress is live.ingress, and a host profile takes no turns',
|
|
114
|
+
},
|
|
115
|
+
'inputs.voice': {
|
|
116
|
+
profileTypes: ['text'],
|
|
117
|
+
reason: 'no image model reads audio, and a decision takes JSON state',
|
|
118
|
+
},
|
|
119
|
+
'inputs.text': {
|
|
120
|
+
profileTypes: TURN_INPUT_TYPES,
|
|
121
|
+
reason: TURN_INPUT_REASON,
|
|
122
|
+
},
|
|
123
|
+
'inputs.attachments': {
|
|
124
|
+
profileTypes: TURN_INPUT_TYPES,
|
|
125
|
+
reason: TURN_INPUT_REASON,
|
|
126
|
+
},
|
|
127
|
+
'inputs.maxFiles': {
|
|
128
|
+
profileTypes: TURN_INPUT_TYPES,
|
|
129
|
+
reason: TURN_INPUT_REASON,
|
|
130
|
+
},
|
|
131
|
+
'inputs.maxBytes': {
|
|
132
|
+
profileTypes: TURN_INPUT_TYPES,
|
|
133
|
+
reason: TURN_INPUT_REASON,
|
|
134
|
+
},
|
|
135
|
+
'inputs.maxTurnBytes': {
|
|
136
|
+
profileTypes: TURN_INPUT_TYPES,
|
|
137
|
+
reason: TURN_INPUT_REASON,
|
|
138
|
+
},
|
|
139
|
+
'inputs.limitsByMime': {
|
|
140
|
+
profileTypes: TURN_INPUT_TYPES,
|
|
141
|
+
reason: TURN_INPUT_REASON,
|
|
142
|
+
},
|
|
143
|
+
'inputs.slots': {
|
|
144
|
+
profileTypes: TURN_INPUT_TYPES,
|
|
145
|
+
reason: TURN_INPUT_REASON,
|
|
146
|
+
},
|
|
147
|
+
'inputs.state': {
|
|
148
|
+
profileTypes: ['decision'],
|
|
149
|
+
reason: 'only a decision reads JSON state; a turn takes text, files and slots',
|
|
150
|
+
},
|
|
151
|
+
'inputs.maxStateBytes': {
|
|
152
|
+
profileTypes: ['decision'],
|
|
153
|
+
reason: 'only a decision reads JSON state; a turn takes text, files and slots',
|
|
154
|
+
},
|
|
155
|
+
outputs: {
|
|
156
|
+
profileTypes: ['text', 'image', 'speech'],
|
|
157
|
+
reason: 'live output is the realtime session, and decision and host profiles produce no turn output',
|
|
158
|
+
},
|
|
159
|
+
'outputs.structured': {
|
|
160
|
+
profileTypes: ['text'],
|
|
161
|
+
reason: 'only a text reply has a JSON shape; image and speech turns return media',
|
|
162
|
+
offValue: null,
|
|
163
|
+
},
|
|
164
|
+
'outputs.validation': {
|
|
165
|
+
profileTypes: ['text'],
|
|
166
|
+
reason: 'validation checks a structured reply, which only text profiles make',
|
|
167
|
+
},
|
|
168
|
+
turnBehaviour: {
|
|
169
|
+
profileTypes: TURN_TYPES,
|
|
170
|
+
reason: 'only model turns can be continued or steered',
|
|
171
|
+
},
|
|
172
|
+
'turnBehaviour.resumption': {
|
|
173
|
+
profileTypes: ['text', 'image', 'speech'],
|
|
174
|
+
reason: 'live resumes through live.sessionResumption',
|
|
175
|
+
},
|
|
176
|
+
'turnBehaviour.allowSteering': {
|
|
177
|
+
profileTypes: ['text', 'live'],
|
|
178
|
+
reason: 'image and speech turns take no mid-turn input',
|
|
179
|
+
},
|
|
180
|
+
'guardrails.quota': {
|
|
181
|
+
profileTypes: turnGuardrailTypes('quota'),
|
|
182
|
+
reason: 'quota counts model turns',
|
|
183
|
+
},
|
|
184
|
+
'guardrails.canary': {
|
|
185
|
+
profileTypes: ['text', 'image', 'live'],
|
|
186
|
+
reason: 'the canary is minted into a system prompt, which speech, decision and host profiles lack',
|
|
187
|
+
offValue: false,
|
|
188
|
+
},
|
|
189
|
+
'guardrails.promptEcho': {
|
|
190
|
+
profileTypes: ['text', 'image', 'live'],
|
|
191
|
+
reason: 'the echo is of a system prompt, which speech, decision and host profiles lack',
|
|
192
|
+
offValue: false,
|
|
193
|
+
},
|
|
194
|
+
'guardrails.sanitizeInput': {
|
|
195
|
+
profileTypes: turnGuardrailTypes('sanitizeInput'),
|
|
196
|
+
reason: 'the decision path runs none of the turn guardrails',
|
|
197
|
+
},
|
|
198
|
+
'guardrails.redactSensitive': {
|
|
199
|
+
profileTypes: turnGuardrailTypes('redactSensitive'),
|
|
200
|
+
reason: 'the decision path runs none of the turn guardrails',
|
|
201
|
+
},
|
|
202
|
+
'guardrails.egress': {
|
|
203
|
+
profileTypes: turnGuardrailTypes('egress'),
|
|
204
|
+
reason: 'egress gates user-visible model text in the turn runner',
|
|
205
|
+
},
|
|
206
|
+
'guardrails.network': {
|
|
207
|
+
profileTypes: turnGuardrailTypes('network'),
|
|
208
|
+
reason: 'the decision path calls no tools',
|
|
209
|
+
},
|
|
210
|
+
'guardrails.taint': {
|
|
211
|
+
profileTypes: turnGuardrailTypes('taint'),
|
|
212
|
+
reason: 'the decision path calls no tools',
|
|
213
|
+
},
|
|
214
|
+
'guardrails.disclosure': {
|
|
215
|
+
profileTypes: ['decision'],
|
|
216
|
+
reason: 'disclosure gates state leaving a decision profile for its model',
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* The scope entry that governs `path`: its own, else its nearest ancestor's.
|
|
221
|
+
* `undefined` means every profile type.
|
|
222
|
+
*/
|
|
223
|
+
export function profileFieldScope(path) {
|
|
224
|
+
const segments = path.split('.');
|
|
225
|
+
for (let end = segments.length; end > 0; end--) {
|
|
226
|
+
const scope = PROFILE_FIELD_SCOPE[segments.slice(0, end).join('.')];
|
|
227
|
+
if (scope)
|
|
228
|
+
return scope;
|
|
229
|
+
}
|
|
230
|
+
return undefined;
|
|
231
|
+
}
|
|
232
|
+
export function profileTypesForField(path) {
|
|
233
|
+
return profileFieldScope(path)?.profileTypes ?? ALL_PROFILE_TYPES;
|
|
234
|
+
}
|
|
235
|
+
/** Every set value under `segments`, keyed by concrete path; `*` walks each key of a map. */
|
|
236
|
+
function valuesAt(root, segments, at = '') {
|
|
237
|
+
if (!segments.length)
|
|
238
|
+
return root === undefined ? [] : [[at, root]];
|
|
239
|
+
if (root === null || typeof root !== 'object')
|
|
240
|
+
return [];
|
|
241
|
+
const [head, ...rest] = segments;
|
|
242
|
+
const record = root;
|
|
243
|
+
const keys = head === '*' ? Object.keys(record) : [head];
|
|
244
|
+
return keys.flatMap((key) => valuesAt(record[key], rest, at ? `${at}.${key}` : key));
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Every field `profile` sets that its type may not, ancestors before their
|
|
248
|
+
* children. A scope's off value is not reported.
|
|
249
|
+
*/
|
|
250
|
+
export function outOfScopeFields(profile) {
|
|
251
|
+
const out = [];
|
|
252
|
+
for (const [path, scope] of Object.entries(PROFILE_FIELD_SCOPE)) {
|
|
253
|
+
if (scope.profileTypes.includes(profile.type))
|
|
254
|
+
continue;
|
|
255
|
+
for (const [at, value] of valuesAt(profile, path.split('.'))) {
|
|
256
|
+
if (scope.offValue !== undefined && value === scope.offValue)
|
|
257
|
+
continue;
|
|
258
|
+
out.push({ path: at, scope });
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return out;
|
|
262
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ErrorCopy, TheoremError } from '../../guardrails/error.js';
|
|
2
|
+
import { type LexiconOverrides } from '../../guardrails/lexicon.js';
|
|
3
|
+
import type { AttachmentValidationIssue, MediaLimits, MimeInputs, Profile, TurnBlob, TurnMediaRef } from '../types.js';
|
|
4
|
+
declare function resolveMediaLimits(inputs: MimeInputs): MediaLimits | undefined;
|
|
5
|
+
/** A MIME-specific cap, then its category wildcard, then the global cap. */
|
|
6
|
+
declare function maxBytesForMime(mimeType: string, limits: MediaLimits): number;
|
|
7
|
+
declare function isTurnMediaRef(item: TurnBlob | TurnMediaRef): item is TurnMediaRef;
|
|
8
|
+
declare function requireMediaLimits(profile: Profile): MediaLimits;
|
|
9
|
+
/** CSV formula injection: formula-like cells get an apostrophe before they reach a model. */
|
|
10
|
+
declare function sanitizeCsvText(text: string): string;
|
|
11
|
+
/** `sizeBytes` is absent for provider references, which carry no bytes. */
|
|
12
|
+
export interface AttachmentFacts {
|
|
13
|
+
name?: string;
|
|
14
|
+
mimeType: string;
|
|
15
|
+
sizeBytes?: number;
|
|
16
|
+
}
|
|
17
|
+
/** An absent `accept` list means the channel takes nothing. */
|
|
18
|
+
export interface AttachmentRules {
|
|
19
|
+
attachments?: string[];
|
|
20
|
+
voice?: string[];
|
|
21
|
+
limits?: MediaLimits;
|
|
22
|
+
}
|
|
23
|
+
/** The one attachment check: the kernel throws on it at ingress and the headless interface runs it before a send. */
|
|
24
|
+
declare function attachmentIssues(rules: AttachmentRules, files: AttachmentFacts[], clips: AttachmentFacts[]): AttachmentValidationIssue[];
|
|
25
|
+
declare function attachmentIssueCopy(issue: AttachmentValidationIssue): ErrorCopy;
|
|
26
|
+
declare function attachmentIssueText(issue: AttachmentValidationIssue, lexicon?: LexiconOverrides): string;
|
|
27
|
+
declare function attachmentsRefused(issues: readonly AttachmentValidationIssue[]): TheoremError;
|
|
28
|
+
/** Provider references are checked for MIME and count; byte limits apply to inline blobs only. */
|
|
29
|
+
declare function assertTurnAttachments(profile: Profile, attachments: Array<TurnBlob | TurnMediaRef> | undefined, voice: TurnBlob[] | undefined): void;
|
|
30
|
+
/** Provider file references pass through unsanitized: the kernel has no bytes to scan. */
|
|
31
|
+
declare function sanitizeTurnBlobs(profile: Profile, attachments: Array<TurnBlob | TurnMediaRef> | undefined, voice: TurnBlob[] | undefined): {
|
|
32
|
+
attachments?: Array<TurnBlob | TurnMediaRef>;
|
|
33
|
+
voice?: TurnBlob[];
|
|
34
|
+
};
|
|
35
|
+
export { assertTurnAttachments, attachmentIssueCopy, attachmentIssues, attachmentIssueText, attachmentsRefused, isTurnMediaRef, maxBytesForMime, requireMediaLimits, resolveMediaLimits, sanitizeCsvText, sanitizeTurnBlobs, };
|