@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,35 @@
|
|
|
1
|
+
// Tracing is host-injected: THEOREM reads no environment variables and owns no database sink.
|
|
2
|
+
import { buildRecord } from './trace-record.js';
|
|
3
|
+
/** Trace failures never fail the turn: build and write errors go to `sink.onError`, if set. */
|
|
4
|
+
async function writeTrace(sink, record, policy) {
|
|
5
|
+
try {
|
|
6
|
+
await sink.write(await record, {
|
|
7
|
+
retainForDays: policy.retainForDays,
|
|
8
|
+
rotateAfterMiB: policy.rotateAfterMiB,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
catch (err) {
|
|
12
|
+
try {
|
|
13
|
+
sink.onError?.(err);
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
// Host onError must not fail the turn.
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/** Like `writeTrace`, it never fails the caller. */
|
|
21
|
+
function writeSpans(sink, spans, policy, metadata) {
|
|
22
|
+
return writeTrace(sink, buildRecord({ spans, policy, ...(metadata ? { metadata } : {}) }), policy);
|
|
23
|
+
}
|
|
24
|
+
function noopSink() {
|
|
25
|
+
return { write: () => Promise.resolve() };
|
|
26
|
+
}
|
|
27
|
+
function memorySink(into) {
|
|
28
|
+
return {
|
|
29
|
+
write: (record) => {
|
|
30
|
+
into.push(record);
|
|
31
|
+
return Promise.resolve();
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export { memorySink, noopSink, writeSpans, writeTrace };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { TraceSink } from './trace-sink.js';
|
|
2
|
+
import type { TraceAttributes } from './trace-span.js';
|
|
3
|
+
/** Which payloads land in each TraceRecord. Omitted keys use resolved defaults. */
|
|
4
|
+
export interface TraceIncludeSpec {
|
|
5
|
+
/** Scrubbed provider rows and frames (`theorem.upstream.row` events). Default: true. */
|
|
6
|
+
upstreamLog?: boolean;
|
|
7
|
+
/** Scrubbed outbound request bodies (`theorem.wire.request` events). Default: false. */
|
|
8
|
+
outboundWire?: boolean;
|
|
9
|
+
/** The provider's raw grounding payload (`raw` on `theorem.grounding` events). Default: false. */
|
|
10
|
+
evidenceRaw?: boolean;
|
|
11
|
+
/** Usage attributes (`gen_ai.usage.*`, `theorem.usage.*`). Default: true. */
|
|
12
|
+
usage?: boolean;
|
|
13
|
+
/** Guardrail decisions (`theorem.guardrail` events). Default: true. */
|
|
14
|
+
guardrailDecisions?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Keep `GuardrailHit.match` (the exact matched text) on guardrail events. Default: false;
|
|
17
|
+
* debugging only, so treat the store like server logs when enabled.
|
|
18
|
+
*/
|
|
19
|
+
guardrailMatchPreview?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Scrubbing of stored records, independent of turn-path `profile.guardrails`. Defaults are on. */
|
|
22
|
+
export interface TraceScrubSpec {
|
|
23
|
+
/** Strip credentials / PII spans in stored text. Default: true. */
|
|
24
|
+
sensitive?: boolean;
|
|
25
|
+
/** Strip injection spans in the stored request copy. Default: true. */
|
|
26
|
+
injection?: boolean;
|
|
27
|
+
/** Never persist the canary token. Default: true. */
|
|
28
|
+
canary?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** Omit the whole block for no tracing. */
|
|
31
|
+
export interface ProfileObservabilitySpec {
|
|
32
|
+
/**
|
|
33
|
+
* `false` is off, a string is a `registerTraceDestination` id, a TraceSink is an inline writer.
|
|
34
|
+
* `runTurn(..., sink)` still overrides this for one call.
|
|
35
|
+
*/
|
|
36
|
+
writeTo?: false | string | TraceSink;
|
|
37
|
+
/**
|
|
38
|
+
* Fraction of traces to record, 0–1 inclusive. Default: 1. Decided by trace id, so every
|
|
39
|
+
* record of one trace is kept or dropped together.
|
|
40
|
+
*/
|
|
41
|
+
sampleRate?: number;
|
|
42
|
+
include?: TraceIncludeSpec;
|
|
43
|
+
/** Stamped on every record as `TraceRecord.resource`, e.g. `{ 'service.name': 'harbor' }`. */
|
|
44
|
+
resource?: TraceAttributes;
|
|
45
|
+
/** Defaults stay on even when `guardrails.redactSensitive` is false. */
|
|
46
|
+
scrub?: TraceScrubSpec;
|
|
47
|
+
/**
|
|
48
|
+
* Days to keep each record, handed to every destination with the record
|
|
49
|
+
* (`TraceWriteContext`): the JSONL writer prunes by it, a host store computes
|
|
50
|
+
* its own expiry from it. `<= 0` keeps records forever. Default: 14.
|
|
51
|
+
*/
|
|
52
|
+
retainForDays?: number;
|
|
53
|
+
/**
|
|
54
|
+
* File size in MiB at which a file-based destination starts a new file, handed to every
|
|
55
|
+
* destination with the record (`TraceWriteContext`). Default: 32.
|
|
56
|
+
*/
|
|
57
|
+
rotateAfterMiB?: number;
|
|
58
|
+
/** Called when record build or destination write fails. Must not throw. */
|
|
59
|
+
onWriteError?: (err: unknown) => void;
|
|
60
|
+
}
|
|
61
|
+
export interface ResolvedTraceInclude {
|
|
62
|
+
upstreamLog: boolean;
|
|
63
|
+
outboundWire: boolean;
|
|
64
|
+
evidenceRaw: boolean;
|
|
65
|
+
usage: boolean;
|
|
66
|
+
guardrailDecisions: boolean;
|
|
67
|
+
guardrailMatchPreview: boolean;
|
|
68
|
+
}
|
|
69
|
+
export interface ResolvedTraceScrub {
|
|
70
|
+
sensitive: boolean;
|
|
71
|
+
injection: boolean;
|
|
72
|
+
canary: boolean;
|
|
73
|
+
}
|
|
74
|
+
export interface ResolvedObservabilityPolicy {
|
|
75
|
+
/** False when the block is omitted or `writeTo` is `false`/absent. Sampling applies at write. */
|
|
76
|
+
record: boolean;
|
|
77
|
+
writeTo: false | string | TraceSink | undefined;
|
|
78
|
+
sampleRate: number;
|
|
79
|
+
include: ResolvedTraceInclude;
|
|
80
|
+
scrub: ResolvedTraceScrub;
|
|
81
|
+
resource: TraceAttributes;
|
|
82
|
+
retainForDays: number;
|
|
83
|
+
rotateAfterMiB: number;
|
|
84
|
+
onWriteError?: (err: unknown) => void;
|
|
85
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gemini TTS voice names for `speech.voice`. No imports, so docs UIs can load it alone.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import "../../../_dnt.polyfills.js";
|
|
7
|
+
export declare const GOOGLE_SPEECH_VOICES: readonly ["Zephyr", "Puck", "Charon", "Kore", "Fenrir", "Leda", "Orus", "Aoede", "Callirrhoe", "Autonoe", "Enceladus", "Iapetus", "Umbriel", "Algieba", "Despina", "Erinome", "Algenib", "Rasalgethi", "Laomedeia", "Achernar", "Alnilam", "Schedar", "Gacrux", "Pulcherrima", "Achird", "Zubenelgenubi", "Vindemiatrix", "Sadachbia", "Sadaltager", "Sulafat"];
|
|
8
|
+
export type GoogleSpeechVoice = (typeof GOOGLE_SPEECH_VOICES)[number];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gemini TTS voice names for `speech.voice`. No imports, so docs UIs can load it alone.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import "../../../_dnt.polyfills.js";
|
|
7
|
+
export const GOOGLE_SPEECH_VOICES = [
|
|
8
|
+
'Zephyr',
|
|
9
|
+
'Puck',
|
|
10
|
+
'Charon',
|
|
11
|
+
'Kore',
|
|
12
|
+
'Fenrir',
|
|
13
|
+
'Leda',
|
|
14
|
+
'Orus',
|
|
15
|
+
'Aoede',
|
|
16
|
+
'Callirrhoe',
|
|
17
|
+
'Autonoe',
|
|
18
|
+
'Enceladus',
|
|
19
|
+
'Iapetus',
|
|
20
|
+
'Umbriel',
|
|
21
|
+
'Algieba',
|
|
22
|
+
'Despina',
|
|
23
|
+
'Erinome',
|
|
24
|
+
'Algenib',
|
|
25
|
+
'Rasalgethi',
|
|
26
|
+
'Laomedeia',
|
|
27
|
+
'Achernar',
|
|
28
|
+
'Alnilam',
|
|
29
|
+
'Schedar',
|
|
30
|
+
'Gacrux',
|
|
31
|
+
'Pulcherrima',
|
|
32
|
+
'Achird',
|
|
33
|
+
'Zubenelgenubi',
|
|
34
|
+
'Vindemiatrix',
|
|
35
|
+
'Sadachbia',
|
|
36
|
+
'Sadaltager',
|
|
37
|
+
'Sulafat',
|
|
38
|
+
];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** The thinking levels Gemini's `thinkingLevel` takes; OpenRouter models take them all. */
|
|
2
|
+
declare const GOOGLE_THINKING_LEVELS: readonly ["minimal", "low", "medium", "high"];
|
|
3
|
+
/** The audio format Gemini speech returns (PCM, wrapped as WAV); OpenRouter speech also takes `mp3`. */
|
|
4
|
+
declare const GOOGLE_SPEECH_FORMATS: readonly ["pcm"];
|
|
5
|
+
type GoogleThinkingLevel = (typeof GOOGLE_THINKING_LEVELS)[number];
|
|
6
|
+
/**
|
|
7
|
+
* A `geminiInteractions` or `geminiLive` binding's `efforts`, typed to the levels Gemini takes.
|
|
8
|
+
* The runtime check refuses an untyped host's level when the binding is built, not when a turn runs.
|
|
9
|
+
*/
|
|
10
|
+
declare function googleEfforts<Efforts extends Record<string, GoogleThinkingLevel>>(efforts: Efforts): Efforts;
|
|
11
|
+
export type { GoogleThinkingLevel };
|
|
12
|
+
export { GOOGLE_SPEECH_FORMATS, GOOGLE_THINKING_LEVELS, googleEfforts };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TheoremError } from '../guardrails/theorem-error.js';
|
|
2
|
+
/** The thinking levels Gemini's `thinkingLevel` takes; OpenRouter models take them all. */
|
|
3
|
+
const GOOGLE_THINKING_LEVELS = ['minimal', 'low', 'medium', 'high'];
|
|
4
|
+
/** The audio format Gemini speech returns (PCM, wrapped as WAV); OpenRouter speech also takes `mp3`. */
|
|
5
|
+
const GOOGLE_SPEECH_FORMATS = ['pcm'];
|
|
6
|
+
/**
|
|
7
|
+
* A `geminiInteractions` or `geminiLive` binding's `efforts`, typed to the levels Gemini takes.
|
|
8
|
+
* The runtime check refuses an untyped host's level when the binding is built, not when a turn runs.
|
|
9
|
+
*/
|
|
10
|
+
function googleEfforts(efforts) {
|
|
11
|
+
for (const [alias, level] of Object.entries(efforts)) {
|
|
12
|
+
if (!GOOGLE_THINKING_LEVELS.includes(level)) {
|
|
13
|
+
throw new TheoremError('config', `Effort '${alias}': Gemini does not take '${level}' (${GOOGLE_THINKING_LEVELS.join(', ')})`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return efforts;
|
|
17
|
+
}
|
|
18
|
+
export { GOOGLE_SPEECH_FORMATS, GOOGLE_THINKING_LEVELS, googleEfforts };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google / Gemini convenience preset.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import "../../_dnt.polyfills.js";
|
|
7
|
+
import type { ModelBinding, ProfileImageSpec, ProfileLiveSpec, ProfileSpeechSpec } from '../kernel/types.js';
|
|
8
|
+
import { GOOGLE_SPEECH_VOICES, type GoogleSpeechVoice } from './google/speech-voices.js';
|
|
9
|
+
import { GOOGLE_SPEECH_FORMATS, GOOGLE_THINKING_LEVELS, type GoogleThinkingLevel, googleEfforts } from './google-limits.js';
|
|
10
|
+
declare const GOOGLE_IMAGE_INPUT_MIMES: readonly ["image/png", "image/jpeg", "image/webp", "image/heic", "image/heif"];
|
|
11
|
+
declare const GOOGLE_VOICE_INPUT_MIMES: readonly ["audio/webm", "audio/wav", "audio/mpeg", "audio/mp4"];
|
|
12
|
+
/**
|
|
13
|
+
* TTS models that reject any history with a model turn, so compaction's summary fails them
|
|
14
|
+
* (live, 29/09/2026).
|
|
15
|
+
*/
|
|
16
|
+
declare const GOOGLE_SINGLE_TURN_API_IDS: readonly ["gemini-2.5-flash-preview-tts", "gemini-3.1-flash-tts-preview", "gemini-3.8-flash-tts", "gemini-3.8-flash-lite-tts"];
|
|
17
|
+
/**
|
|
18
|
+
* Models that reject any thinking setting, `summaries: false` included: leave
|
|
19
|
+
* `efforts` and `summaries` unset (live, 30/09/2026).
|
|
20
|
+
*/
|
|
21
|
+
declare const GOOGLE_NO_THINKING_API_IDS: readonly ["gemini-2.5-flash-image", "antigravity-preview-05-2026", "antigravity-preview-09-2026", "antigravity-preview-latest", "gemini-3.8-live"];
|
|
22
|
+
/**
|
|
23
|
+
* Models that refuse a session without a thinking level: pin `efforts`
|
|
24
|
+
* (live, 01/10/2026: Live closes 1007 "Thinking level must be specified for this model").
|
|
25
|
+
*/
|
|
26
|
+
declare const GOOGLE_THINKING_REQUIRED_API_IDS: readonly ["gemini-3.8-live-extended-thinking"];
|
|
27
|
+
/** Which grounding builtins a model's free-tier quota allows. */
|
|
28
|
+
interface GoogleFreeTierGrounding {
|
|
29
|
+
googleSearch: boolean;
|
|
30
|
+
googleMaps: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Models with a non-zero free-tier quota, and the grounding each allows (AI Studio, Sep 2026).
|
|
34
|
+
* A builtin with no quota is refused as if over quota: on Live, a close 1011 "You exceeded your
|
|
35
|
+
* current quota" at setup, whatever the key's usage (live, 01/10/2026).
|
|
36
|
+
*/
|
|
37
|
+
declare const GOOGLE_FREE_TIER_GROUNDING: Readonly<Record<string, GoogleFreeTierGrounding>>;
|
|
38
|
+
/** Grounding builtins the free tier allows on `apiId`; none for a model with no free quota. */
|
|
39
|
+
declare function googleFreeTierBuiltins(apiId: string): Array<'googleSearch' | 'googleMaps'>;
|
|
40
|
+
interface GoogleBindingViolation {
|
|
41
|
+
field: 'apiId' | 'efforts' | 'summaries' | 'builtInTools';
|
|
42
|
+
message: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The first setting Google would refuse on this binding, or `undefined`. With `freeTier`, it
|
|
46
|
+
* also holds the binding to the free-tier table: a listed model, and only the grounding its
|
|
47
|
+
* quota allows.
|
|
48
|
+
*/
|
|
49
|
+
declare function googleBindingViolation(binding: Pick<ModelBinding, 'apiId' | 'efforts' | 'summaries' | 'builtInTools'>, options?: {
|
|
50
|
+
freeTier?: boolean;
|
|
51
|
+
}): GoogleBindingViolation | undefined;
|
|
52
|
+
type GoogleSpeechPins = Omit<ProfileSpeechSpec, 'voice'> & {
|
|
53
|
+
voice?: GoogleSpeechVoice;
|
|
54
|
+
};
|
|
55
|
+
type GoogleLivePins = Omit<ProfileLiveSpec, 'voice'> & {
|
|
56
|
+
voice?: GoogleSpeechVoice;
|
|
57
|
+
};
|
|
58
|
+
declare const GOOGLE_IMAGE_ASPECT_RATIOS: readonly ["1:1", "3:2", "2:3", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9"];
|
|
59
|
+
declare const GOOGLE_IMAGE_RESOLUTIONS: readonly ["1K", "2K", "4K"];
|
|
60
|
+
/** What a Gemini image model can be asked to return. */
|
|
61
|
+
declare const GOOGLE_IMAGE_OUTPUT_MIMES: readonly ["image/png", "image/jpeg"];
|
|
62
|
+
type GoogleImageInputMime = (typeof GOOGLE_IMAGE_INPUT_MIMES)[number];
|
|
63
|
+
type GoogleVoiceInputMime = (typeof GOOGLE_VOICE_INPUT_MIMES)[number];
|
|
64
|
+
type GoogleImageAspectRatio = (typeof GOOGLE_IMAGE_ASPECT_RATIOS)[number];
|
|
65
|
+
type GoogleImageResolution = (typeof GOOGLE_IMAGE_RESOLUTIONS)[number];
|
|
66
|
+
type GoogleImageOutputMime = (typeof GOOGLE_IMAGE_OUTPUT_MIMES)[number];
|
|
67
|
+
type GoogleImagePins = Omit<ProfileImageSpec, 'aspectRatio' | 'resolution' | 'mimeType'> & {
|
|
68
|
+
aspectRatio?: GoogleImageAspectRatio;
|
|
69
|
+
resolution?: GoogleImageResolution;
|
|
70
|
+
mimeType?: GoogleImageOutputMime;
|
|
71
|
+
};
|
|
72
|
+
declare const GOOGLE_BUILTIN_TOOLS: ({
|
|
73
|
+
type: "builtin";
|
|
74
|
+
name: string;
|
|
75
|
+
description: string;
|
|
76
|
+
category: string;
|
|
77
|
+
access: "read-only";
|
|
78
|
+
paths: string[];
|
|
79
|
+
loadTier: "T0";
|
|
80
|
+
permission: "auto";
|
|
81
|
+
wire: {
|
|
82
|
+
interactions: string;
|
|
83
|
+
openRouter: string;
|
|
84
|
+
live: string;
|
|
85
|
+
};
|
|
86
|
+
} | {
|
|
87
|
+
type: "builtin";
|
|
88
|
+
name: string;
|
|
89
|
+
description: string;
|
|
90
|
+
category: string;
|
|
91
|
+
access: "read-only";
|
|
92
|
+
paths: string[];
|
|
93
|
+
loadTier: "T0";
|
|
94
|
+
permission: "auto";
|
|
95
|
+
wire: {
|
|
96
|
+
interactions: string;
|
|
97
|
+
live: string;
|
|
98
|
+
openRouter?: undefined;
|
|
99
|
+
};
|
|
100
|
+
})[];
|
|
101
|
+
/** Registers into the default scope; a scope of its own takes `GOOGLE_BUILTIN_TOOLS`. */
|
|
102
|
+
declare function registerGooglePreset(): void;
|
|
103
|
+
export type { GoogleBindingViolation, GoogleFreeTierGrounding, GoogleImageAspectRatio, GoogleImageInputMime, GoogleImageOutputMime, GoogleImagePins, GoogleImageResolution, GoogleLivePins, GoogleSpeechPins, GoogleSpeechVoice, GoogleThinkingLevel, GoogleVoiceInputMime, };
|
|
104
|
+
export { GOOGLE_BUILTIN_TOOLS, GOOGLE_FREE_TIER_GROUNDING, GOOGLE_IMAGE_ASPECT_RATIOS, GOOGLE_IMAGE_INPUT_MIMES, GOOGLE_IMAGE_OUTPUT_MIMES, GOOGLE_IMAGE_RESOLUTIONS, GOOGLE_NO_THINKING_API_IDS, GOOGLE_SINGLE_TURN_API_IDS, GOOGLE_SPEECH_FORMATS, GOOGLE_SPEECH_VOICES, GOOGLE_THINKING_LEVELS, GOOGLE_THINKING_REQUIRED_API_IDS, GOOGLE_VOICE_INPUT_MIMES, googleBindingViolation, googleEfforts, googleFreeTierBuiltins, registerGooglePreset, };
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google / Gemini convenience preset.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import "../../_dnt.polyfills.js";
|
|
7
|
+
import { registerTools } from '../kernel/default-scope.js';
|
|
8
|
+
import { GOOGLE_SPEECH_VOICES } from './google/speech-voices.js';
|
|
9
|
+
import { GOOGLE_SPEECH_FORMATS, GOOGLE_THINKING_LEVELS, googleEfforts, } from './google-limits.js';
|
|
10
|
+
const GOOGLE_IMAGE_INPUT_MIMES = [
|
|
11
|
+
'image/png',
|
|
12
|
+
'image/jpeg',
|
|
13
|
+
'image/webp',
|
|
14
|
+
'image/heic',
|
|
15
|
+
'image/heif',
|
|
16
|
+
];
|
|
17
|
+
const GOOGLE_VOICE_INPUT_MIMES = ['audio/webm', 'audio/wav', 'audio/mpeg', 'audio/mp4'];
|
|
18
|
+
/**
|
|
19
|
+
* TTS models that reject any history with a model turn, so compaction's summary fails them
|
|
20
|
+
* (live, 29/09/2026).
|
|
21
|
+
*/
|
|
22
|
+
const GOOGLE_SINGLE_TURN_API_IDS = [
|
|
23
|
+
'gemini-2.5-flash-preview-tts',
|
|
24
|
+
'gemini-3.1-flash-tts-preview',
|
|
25
|
+
'gemini-3.8-flash-tts',
|
|
26
|
+
'gemini-3.8-flash-lite-tts',
|
|
27
|
+
];
|
|
28
|
+
/**
|
|
29
|
+
* Models that reject any thinking setting, `summaries: false` included: leave
|
|
30
|
+
* `efforts` and `summaries` unset (live, 30/09/2026).
|
|
31
|
+
*/
|
|
32
|
+
const GOOGLE_NO_THINKING_API_IDS = [
|
|
33
|
+
'gemini-2.5-flash-image',
|
|
34
|
+
'antigravity-preview-05-2026',
|
|
35
|
+
'antigravity-preview-09-2026',
|
|
36
|
+
'antigravity-preview-latest',
|
|
37
|
+
// Live closes 1007 "Thinking level is not supported for this model" (live, 01/10/2026).
|
|
38
|
+
'gemini-3.8-live',
|
|
39
|
+
];
|
|
40
|
+
/**
|
|
41
|
+
* Models that refuse a session without a thinking level: pin `efforts`
|
|
42
|
+
* (live, 01/10/2026: Live closes 1007 "Thinking level must be specified for this model").
|
|
43
|
+
*/
|
|
44
|
+
const GOOGLE_THINKING_REQUIRED_API_IDS = ['gemini-3.8-live-extended-thinking'];
|
|
45
|
+
const grounding = (googleSearch, googleMaps) => ({
|
|
46
|
+
googleSearch,
|
|
47
|
+
googleMaps,
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Models with a non-zero free-tier quota, and the grounding each allows (AI Studio, Sep 2026).
|
|
51
|
+
* A builtin with no quota is refused as if over quota: on Live, a close 1011 "You exceeded your
|
|
52
|
+
* current quota" at setup, whatever the key's usage (live, 01/10/2026).
|
|
53
|
+
*/
|
|
54
|
+
const GOOGLE_FREE_TIER_GROUNDING = {
|
|
55
|
+
'gemini-2.5-flash-lite': grounding(true, true),
|
|
56
|
+
'gemini-2.5-flash': grounding(true, true),
|
|
57
|
+
'gemini-2.5-flash-preview-tts': grounding(true, false),
|
|
58
|
+
'gemini-3-flash-preview': grounding(false, false),
|
|
59
|
+
'gemini-3.1-flash-lite': grounding(false, true),
|
|
60
|
+
'gemini-3.1-flash-lite-image': grounding(false, false),
|
|
61
|
+
'gemini-3.1-flash-tts-preview': grounding(false, true),
|
|
62
|
+
'gemini-3.5-flash-lite': grounding(false, true),
|
|
63
|
+
'gemini-3.5-flash': grounding(false, false),
|
|
64
|
+
'gemini-3.6-flash': grounding(false, false),
|
|
65
|
+
'gemini-3.7-flash': grounding(false, false),
|
|
66
|
+
'gemini-3.8-flash-tts': grounding(false, false),
|
|
67
|
+
'gemini-3.8-flash-lite-tts': grounding(false, false),
|
|
68
|
+
'gemma-4-26b-a4b-it': grounding(false, false),
|
|
69
|
+
'gemma-4-31b-it': grounding(false, false),
|
|
70
|
+
'gemini-3.1-flash-live-preview': grounding(false, false),
|
|
71
|
+
'gemini-3.8-live': grounding(false, false),
|
|
72
|
+
'gemini-3.8-live-extended-thinking': grounding(false, false),
|
|
73
|
+
};
|
|
74
|
+
/** Grounding builtins the free tier allows on `apiId`; none for a model with no free quota. */
|
|
75
|
+
function googleFreeTierBuiltins(apiId) {
|
|
76
|
+
const allowed = GOOGLE_FREE_TIER_GROUNDING[apiId.trim()];
|
|
77
|
+
if (!allowed)
|
|
78
|
+
return [];
|
|
79
|
+
return ['googleSearch', 'googleMaps'].filter((id) => allowed[id]);
|
|
80
|
+
}
|
|
81
|
+
function pinsEffort(binding) {
|
|
82
|
+
return Object.keys(binding.efforts ?? {}).length > 0;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The first setting Google would refuse on this binding, or `undefined`. With `freeTier`, it
|
|
86
|
+
* also holds the binding to the free-tier table: a listed model, and only the grounding its
|
|
87
|
+
* quota allows.
|
|
88
|
+
*/
|
|
89
|
+
function googleBindingViolation(binding, options = {}) {
|
|
90
|
+
const apiId = binding.apiId.trim();
|
|
91
|
+
const noThinking = GOOGLE_NO_THINKING_API_IDS;
|
|
92
|
+
const thinkingRequired = GOOGLE_THINKING_REQUIRED_API_IDS;
|
|
93
|
+
if (noThinking.includes(apiId)) {
|
|
94
|
+
if (pinsEffort(binding)) {
|
|
95
|
+
return {
|
|
96
|
+
field: 'efforts',
|
|
97
|
+
message: `${apiId} takes no thinking level; leave efforts unset.`,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
if (binding.summaries !== undefined) {
|
|
101
|
+
return {
|
|
102
|
+
field: 'summaries',
|
|
103
|
+
message: `${apiId} takes no thinking setting; leave summaries unset.`,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (thinkingRequired.includes(apiId) && !pinsEffort(binding)) {
|
|
108
|
+
return { field: 'efforts', message: `${apiId} needs a thinking level; pin efforts.` };
|
|
109
|
+
}
|
|
110
|
+
if (!options.freeTier)
|
|
111
|
+
return undefined;
|
|
112
|
+
if (!GOOGLE_FREE_TIER_GROUNDING[apiId]) {
|
|
113
|
+
return { field: 'apiId', message: `${apiId} has no free-tier quota.` };
|
|
114
|
+
}
|
|
115
|
+
const allowed = googleFreeTierBuiltins(apiId);
|
|
116
|
+
for (const builtin of binding.builtInTools ?? []) {
|
|
117
|
+
if ((builtin === 'googleSearch' || builtin === 'googleMaps') && !allowed.includes(builtin)) {
|
|
118
|
+
return { field: 'builtInTools', message: `${apiId} has no free-tier quota for ${builtin}.` };
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
const GOOGLE_IMAGE_ASPECT_RATIOS = [
|
|
124
|
+
'1:1',
|
|
125
|
+
'3:2',
|
|
126
|
+
'2:3',
|
|
127
|
+
'3:4',
|
|
128
|
+
'4:3',
|
|
129
|
+
'4:5',
|
|
130
|
+
'5:4',
|
|
131
|
+
'9:16',
|
|
132
|
+
'16:9',
|
|
133
|
+
'21:9',
|
|
134
|
+
];
|
|
135
|
+
const GOOGLE_IMAGE_RESOLUTIONS = ['1K', '2K', '4K'];
|
|
136
|
+
/** What a Gemini image model can be asked to return. */
|
|
137
|
+
const GOOGLE_IMAGE_OUTPUT_MIMES = ['image/png', 'image/jpeg'];
|
|
138
|
+
const GOOGLE_BUILTIN_TOOLS = [
|
|
139
|
+
{
|
|
140
|
+
type: 'builtin',
|
|
141
|
+
name: 'googleSearch',
|
|
142
|
+
description: 'Google Search grounding',
|
|
143
|
+
category: 'grounding',
|
|
144
|
+
access: 'read-only',
|
|
145
|
+
paths: ['*'],
|
|
146
|
+
loadTier: 'T0',
|
|
147
|
+
permission: 'auto',
|
|
148
|
+
wire: { interactions: 'google_search', openRouter: 'web', live: 'googleSearch' },
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
type: 'builtin',
|
|
152
|
+
name: 'googleMaps',
|
|
153
|
+
description: 'Google Maps grounding',
|
|
154
|
+
category: 'grounding',
|
|
155
|
+
access: 'read-only',
|
|
156
|
+
paths: ['*'],
|
|
157
|
+
loadTier: 'T0',
|
|
158
|
+
permission: 'auto',
|
|
159
|
+
wire: { interactions: 'google_maps', live: 'googleMaps' },
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
type: 'builtin',
|
|
163
|
+
name: 'urlContext',
|
|
164
|
+
description: 'Fetch URL context',
|
|
165
|
+
category: 'grounding',
|
|
166
|
+
access: 'read-only',
|
|
167
|
+
paths: ['*'],
|
|
168
|
+
loadTier: 'T0',
|
|
169
|
+
permission: 'auto',
|
|
170
|
+
wire: { interactions: 'url_context', live: 'urlContext' },
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
type: 'builtin',
|
|
174
|
+
name: 'codeExecution',
|
|
175
|
+
description: 'Google code execution',
|
|
176
|
+
category: 'grounding',
|
|
177
|
+
access: 'read-only',
|
|
178
|
+
paths: ['*'],
|
|
179
|
+
loadTier: 'T0',
|
|
180
|
+
permission: 'auto',
|
|
181
|
+
wire: { interactions: 'code_execution', live: 'codeExecution' },
|
|
182
|
+
},
|
|
183
|
+
];
|
|
184
|
+
/** Registers into the default scope; a scope of its own takes `GOOGLE_BUILTIN_TOOLS`. */
|
|
185
|
+
function registerGooglePreset() {
|
|
186
|
+
registerTools(GOOGLE_BUILTIN_TOOLS);
|
|
187
|
+
}
|
|
188
|
+
export { GOOGLE_BUILTIN_TOOLS, GOOGLE_FREE_TIER_GROUNDING, GOOGLE_IMAGE_ASPECT_RATIOS, GOOGLE_IMAGE_INPUT_MIMES, GOOGLE_IMAGE_OUTPUT_MIMES, GOOGLE_IMAGE_RESOLUTIONS, GOOGLE_NO_THINKING_API_IDS, GOOGLE_SINGLE_TURN_API_IDS, GOOGLE_SPEECH_FORMATS, GOOGLE_SPEECH_VOICES, GOOGLE_THINKING_LEVELS, GOOGLE_THINKING_REQUIRED_API_IDS, GOOGLE_VOICE_INPUT_MIMES, googleBindingViolation, googleEfforts, googleFreeTierBuiltins, registerGooglePreset, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional host-convenience catalogs (provider builtins, media vocabularies) kept out of the kernel.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import "../../_dnt.polyfills.js";
|
|
7
|
+
export type { GoogleBindingViolation, GoogleFreeTierGrounding, GoogleImageAspectRatio, GoogleImageInputMime, GoogleImageOutputMime, GoogleImagePins, GoogleImageResolution, GoogleSpeechVoice, GoogleThinkingLevel, GoogleVoiceInputMime, } from './google.js';
|
|
8
|
+
export { GOOGLE_BUILTIN_TOOLS, GOOGLE_FREE_TIER_GROUNDING, GOOGLE_IMAGE_ASPECT_RATIOS, GOOGLE_IMAGE_INPUT_MIMES, GOOGLE_IMAGE_OUTPUT_MIMES, GOOGLE_IMAGE_RESOLUTIONS, GOOGLE_NO_THINKING_API_IDS, GOOGLE_SINGLE_TURN_API_IDS, GOOGLE_SPEECH_FORMATS, GOOGLE_SPEECH_VOICES, GOOGLE_THINKING_LEVELS, GOOGLE_THINKING_REQUIRED_API_IDS, GOOGLE_VOICE_INPUT_MIMES, googleBindingViolation, googleEfforts, googleFreeTierBuiltins, registerGooglePreset, } from './google.js';
|
|
9
|
+
export { OPENROUTER_IMAGES_IGNORED_INPUTS, OPENROUTER_IMAGES_INPUT_MIMES } from './openrouter.js';
|
|
10
|
+
export { JEV_USD_PER_MILLION_INPUT_TOKENS } from './typesafe.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional host-convenience catalogs (provider builtins, media vocabularies) kept out of the kernel.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import "../../_dnt.polyfills.js";
|
|
7
|
+
export { GOOGLE_BUILTIN_TOOLS, GOOGLE_FREE_TIER_GROUNDING, GOOGLE_IMAGE_ASPECT_RATIOS, GOOGLE_IMAGE_INPUT_MIMES, GOOGLE_IMAGE_OUTPUT_MIMES, GOOGLE_IMAGE_RESOLUTIONS, GOOGLE_NO_THINKING_API_IDS, GOOGLE_SINGLE_TURN_API_IDS, GOOGLE_SPEECH_FORMATS, GOOGLE_SPEECH_VOICES, GOOGLE_THINKING_LEVELS, GOOGLE_THINKING_REQUIRED_API_IDS, GOOGLE_VOICE_INPUT_MIMES, googleBindingViolation, googleEfforts, googleFreeTierBuiltins, registerGooglePreset, } from './google.js';
|
|
8
|
+
export { OPENROUTER_IMAGES_IGNORED_INPUTS, OPENROUTER_IMAGES_INPUT_MIMES } from './openrouter.js';
|
|
9
|
+
export { JEV_USD_PER_MILLION_INPUT_TOKENS } from './typesafe.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenRouter convenience preset.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/** `/images` takes image references only; a profile on it lists nothing wider in `inputs.attachments.accept`. */
|
|
7
|
+
declare const OPENROUTER_IMAGES_INPUT_MIMES: readonly ["image/*"];
|
|
8
|
+
/**
|
|
9
|
+
* What `/images` never sends the model: it reads the prompt text and the reference images
|
|
10
|
+
* only. The chat path (`image.includeText`) sends the system prompt and history.
|
|
11
|
+
*/
|
|
12
|
+
declare const OPENROUTER_IMAGES_IGNORED_INPUTS: readonly ["system", "history"];
|
|
13
|
+
export { OPENROUTER_IMAGES_IGNORED_INPUTS, OPENROUTER_IMAGES_INPUT_MIMES };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenRouter convenience preset.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/** `/images` takes image references only; a profile on it lists nothing wider in `inputs.attachments.accept`. */
|
|
7
|
+
const OPENROUTER_IMAGES_INPUT_MIMES = ['image/*'];
|
|
8
|
+
/**
|
|
9
|
+
* What `/images` never sends the model: it reads the prompt text and the reference images
|
|
10
|
+
* only. The chat path (`image.includeText`) sends the system prompt and history.
|
|
11
|
+
*/
|
|
12
|
+
const OPENROUTER_IMAGES_IGNORED_INPUTS = ['system', 'history'];
|
|
13
|
+
export { OPENROUTER_IMAGES_IGNORED_INPUTS, OPENROUTER_IMAGES_INPUT_MIMES };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { KeyVault, ModelId, ModelProvider, Profile } from '../kernel/types.js';
|
|
2
|
+
import type { GeminiOptions } from './google/keys.js';
|
|
3
|
+
import type { LocalProviderConfig, OpenAiGatewayConfig } from './types.js';
|
|
4
|
+
export interface CreateProviderOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The host's keys by slot, for every provider. A model's calls use the slot its profile names
|
|
7
|
+
* (`key`, `fallbackKey`); a slot holds whatever secret the host put there.
|
|
8
|
+
*/
|
|
9
|
+
vault?: KeyVault;
|
|
10
|
+
gemini?: GeminiOptions;
|
|
11
|
+
/** `voice` is the fallback when a speech profile omits `speech.voice`. */
|
|
12
|
+
openAiGateway?: OpenAiGatewayConfig & {
|
|
13
|
+
voice?: string;
|
|
14
|
+
};
|
|
15
|
+
/** Required for `local` profiles. */
|
|
16
|
+
local?: LocalProviderConfig;
|
|
17
|
+
}
|
|
18
|
+
export declare function isSpeechRole(profile: Profile): boolean;
|
|
19
|
+
export declare function isImageRole(profile: Profile): boolean;
|
|
20
|
+
/** Live profiles use `runSession`. `modelId` picks the binding; default `defaultModel`. */
|
|
21
|
+
export declare function createProvider(profile: Profile, options?: CreateProviderOptions, modelId?: ModelId): ModelProvider;
|