@theoremjs/agents 0.0.0-stage → 0.3.1
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 +545 -2
- package/esm/_dnt.polyfills.d.ts +66 -0
- package/esm/_dnt.polyfills.js +51 -0
- package/esm/mod.d.ts +79 -0
- package/esm/mod.js +49 -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 +480 -0
- package/esm/src/cli/commands/detect-compile.d.ts +17 -0
- package/esm/src/cli/commands/detect-compile.js +22 -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 +241 -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 +26 -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 +67 -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 +5 -0
- package/esm/src/evals/attachments.js +55 -0
- package/esm/src/evals/breakdown.d.ts +30 -0
- package/esm/src/evals/breakdown.js +69 -0
- package/esm/src/evals/graders/answer.d.ts +16 -0
- package/esm/src/evals/graders/answer.js +134 -0
- package/esm/src/evals/graders/code.d.ts +40 -0
- package/esm/src/evals/graders/code.js +184 -0
- package/esm/src/evals/graders/judge.d.ts +24 -0
- package/esm/src/evals/graders/judge.js +367 -0
- package/esm/src/evals/graders/latency.d.ts +6 -0
- package/esm/src/evals/graders/latency.js +82 -0
- package/esm/src/evals/graders/live.d.ts +14 -0
- package/esm/src/evals/graders/live.js +42 -0
- package/esm/src/evals/graders/media.d.ts +18 -0
- package/esm/src/evals/graders/media.js +91 -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 +19 -0
- package/esm/src/evals/graders/transcript.js +202 -0
- package/esm/src/evals/mod.d.ts +34 -0
- package/esm/src/evals/mod.js +22 -0
- package/esm/src/evals/record.d.ts +41 -0
- package/esm/src/evals/record.js +107 -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 +75 -0
- package/esm/src/evals/run.js +418 -0
- package/esm/src/evals/suite.d.ts +28 -0
- package/esm/src/evals/suite.js +97 -0
- package/esm/src/evals/summary.d.ts +35 -0
- package/esm/src/evals/summary.js +31 -0
- package/esm/src/evals/trial.d.ts +14 -0
- package/esm/src/evals/trial.js +135 -0
- package/esm/src/evals/types.d.ts +169 -0
- package/esm/src/evals/types.js +113 -0
- package/esm/src/evals/verdict.d.ts +23 -0
- package/esm/src/evals/verdict.js +48 -0
- package/esm/src/guardrails/boundaries.d.ts +41 -0
- package/esm/src/guardrails/boundaries.js +103 -0
- package/esm/src/guardrails/canary-gate.d.ts +22 -0
- package/esm/src/guardrails/canary-gate.js +40 -0
- package/esm/src/guardrails/canary.d.ts +146 -0
- package/esm/src/guardrails/canary.js +974 -0
- package/esm/src/guardrails/compile-egress.d.ts +12 -0
- package/esm/src/guardrails/compile-egress.js +12 -0
- package/esm/src/guardrails/corpus/canary-egress-attacks.d.ts +24 -0
- package/esm/src/guardrails/corpus/canary-egress-attacks.js +305 -0
- package/esm/src/guardrails/corpus/fuzz-inbound.d.ts +5 -0
- package/esm/src/guardrails/corpus/fuzz-inbound.js +199 -0
- package/esm/src/guardrails/corpus/inbound-payloads.d.ts +5 -0
- package/esm/src/guardrails/corpus/inbound-payloads.js +120 -0
- package/esm/src/guardrails/corpus/live-attacks.d.ts +15 -0
- package/esm/src/guardrails/corpus/live-attacks.js +229 -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 +36 -0
- package/esm/src/guardrails/corpus/types.js +1 -0
- package/esm/src/guardrails/credential-rules.d.ts +36 -0
- package/esm/src/guardrails/credential-rules.js +3001 -0
- package/esm/src/guardrails/credential-scan.d.ts +45 -0
- package/esm/src/guardrails/credential-scan.js +172 -0
- package/esm/src/guardrails/destinations.d.ts +45 -0
- package/esm/src/guardrails/destinations.js +234 -0
- package/esm/src/guardrails/detect-at.d.ts +107 -0
- package/esm/src/guardrails/detect-at.js +434 -0
- package/esm/src/guardrails/detect-reply.d.ts +61 -0
- package/esm/src/guardrails/detect-reply.js +95 -0
- package/esm/src/guardrails/detect-stream.d.ts +33 -0
- package/esm/src/guardrails/detect-stream.js +77 -0
- package/esm/src/guardrails/detectors.d.ts +216 -0
- package/esm/src/guardrails/detectors.js +503 -0
- package/esm/src/guardrails/egress-automata.d.ts +12 -0
- package/esm/src/guardrails/egress-automata.js +25582 -0
- package/esm/src/guardrails/egress-compiler.d.ts +55 -0
- package/esm/src/guardrails/egress-compiler.js +431 -0
- package/esm/src/guardrails/egress-patterns.d.ts +26 -0
- package/esm/src/guardrails/egress-patterns.js +36 -0
- package/esm/src/guardrails/egress-stream.d.ts +123 -0
- package/esm/src/guardrails/egress-stream.js +774 -0
- package/esm/src/guardrails/egress-urls.d.ts +86 -0
- package/esm/src/guardrails/egress-urls.js +909 -0
- package/esm/src/guardrails/egress.d.ts +46 -0
- package/esm/src/guardrails/egress.js +124 -0
- package/esm/src/guardrails/error.d.ts +31 -0
- package/esm/src/guardrails/error.js +96 -0
- package/esm/src/guardrails/event-schemas.d.ts +100 -0
- package/esm/src/guardrails/event-schemas.js +48 -0
- package/esm/src/guardrails/events.d.ts +13 -0
- package/esm/src/guardrails/events.js +45 -0
- package/esm/src/guardrails/hints.d.ts +14 -0
- package/esm/src/guardrails/hints.js +57 -0
- package/esm/src/guardrails/hits.d.ts +14 -0
- package/esm/src/guardrails/hits.js +30 -0
- package/esm/src/guardrails/host-patterns.d.ts +85 -0
- package/esm/src/guardrails/host-patterns.js +173 -0
- package/esm/src/guardrails/injection-patterns.d.ts +20 -0
- package/esm/src/guardrails/injection-patterns.js +126 -0
- package/esm/src/guardrails/injection-reversed.d.ts +9 -0
- package/esm/src/guardrails/injection-reversed.js +49 -0
- package/esm/src/guardrails/injection.d.ts +30 -0
- package/esm/src/guardrails/injection.js +460 -0
- package/esm/src/guardrails/labels.d.ts +40 -0
- package/esm/src/guardrails/labels.js +874 -0
- package/esm/src/guardrails/live-outbound-gate.d.ts +55 -0
- package/esm/src/guardrails/live-outbound-gate.js +298 -0
- package/esm/src/guardrails/mod.d.ts +54 -0
- package/esm/src/guardrails/mod.js +34 -0
- package/esm/src/guardrails/network.d.ts +46 -0
- package/esm/src/guardrails/network.js +330 -0
- package/esm/src/guardrails/normalize.d.ts +20 -0
- package/esm/src/guardrails/normalize.js +165 -0
- package/esm/src/guardrails/policy.d.ts +4 -0
- package/esm/src/guardrails/policy.js +21 -0
- package/esm/src/guardrails/progressive-yield.d.ts +110 -0
- package/esm/src/guardrails/progressive-yield.js +281 -0
- package/esm/src/guardrails/prompt-echo.d.ts +40 -0
- package/esm/src/guardrails/prompt-echo.js +306 -0
- package/esm/src/guardrails/quota.d.ts +21 -0
- package/esm/src/guardrails/quota.js +80 -0
- package/esm/src/guardrails/rules.d.ts +47 -0
- package/esm/src/guardrails/rules.js +47 -0
- package/esm/src/guardrails/sanitize.d.ts +40 -0
- package/esm/src/guardrails/sanitize.js +160 -0
- package/esm/src/guardrails/sensitive-groups.d.ts +21 -0
- package/esm/src/guardrails/sensitive-groups.js +12 -0
- package/esm/src/guardrails/sensitive.d.ts +22 -0
- package/esm/src/guardrails/sensitive.js +234 -0
- package/esm/src/guardrails/serialize.d.ts +15 -0
- package/esm/src/guardrails/serialize.js +37 -0
- package/esm/src/guardrails/testing.d.ts +11 -0
- package/esm/src/guardrails/testing.js +10 -0
- package/esm/src/guardrails/theorem-error.d.ts +21 -0
- package/esm/src/guardrails/theorem-error.js +54 -0
- package/esm/src/guardrails/thought-guard.d.ts +76 -0
- package/esm/src/guardrails/thought-guard.js +664 -0
- package/esm/src/guardrails/tool-directives.d.ts +38 -0
- package/esm/src/guardrails/tool-directives.js +195 -0
- package/esm/src/guardrails/tool-leak.d.ts +26 -0
- package/esm/src/guardrails/tool-leak.js +45 -0
- package/esm/src/guardrails/tool-result.d.ts +92 -0
- package/esm/src/guardrails/tool-result.js +272 -0
- package/esm/src/guardrails/types.d.ts +250 -0
- package/esm/src/guardrails/types.js +58 -0
- package/esm/src/host/client-turn.d.ts +36 -0
- package/esm/src/host/client-turn.js +80 -0
- package/esm/src/host/mint-trace.d.ts +29 -0
- package/esm/src/host/mint-trace.js +60 -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 +27 -0
- package/esm/src/host/reply.d.ts +13 -0
- package/esm/src/host/reply.js +41 -0
- package/esm/src/interface/blocks.d.ts +11 -0
- package/esm/src/interface/blocks.js +283 -0
- package/esm/src/interface/composer-actions.d.ts +24 -0
- package/esm/src/interface/composer-actions.js +33 -0
- package/esm/src/interface/draft.d.ts +20 -0
- package/esm/src/interface/draft.js +39 -0
- package/esm/src/interface/from-profile.d.ts +24 -0
- package/esm/src/interface/from-profile.js +179 -0
- package/esm/src/interface/history.d.ts +46 -0
- package/esm/src/interface/history.js +278 -0
- package/esm/src/interface/inputs.d.ts +11 -0
- package/esm/src/interface/inputs.js +67 -0
- package/esm/src/interface/mod.d.ts +33 -0
- package/esm/src/interface/mod.js +22 -0
- package/esm/src/interface/models.d.ts +26 -0
- package/esm/src/interface/models.js +50 -0
- package/esm/src/interface/pending.d.ts +57 -0
- package/esm/src/interface/pending.js +152 -0
- package/esm/src/interface/profile-interface.d.ts +4 -0
- package/esm/src/interface/profile-interface.js +237 -0
- package/esm/src/interface/session.d.ts +71 -0
- package/esm/src/interface/session.js +128 -0
- package/esm/src/interface/stop.d.ts +13 -0
- package/esm/src/interface/stop.js +28 -0
- package/esm/src/interface/tool-calls.d.ts +32 -0
- package/esm/src/interface/tool-calls.js +127 -0
- package/esm/src/interface/tool-invoke.d.ts +6 -0
- package/esm/src/interface/tool-invoke.js +22 -0
- package/esm/src/interface/tool-media.d.ts +11 -0
- package/esm/src/interface/tool-media.js +113 -0
- package/esm/src/interface/types.d.ts +278 -0
- package/esm/src/interface/types.js +5 -0
- package/esm/src/kernel/api-catalog.d.ts +85 -0
- package/esm/src/kernel/api-catalog.js +229 -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 +56 -0
- package/esm/src/kernel/auth/crypto.js +163 -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 +18 -0
- package/esm/src/kernel/auth/oauth.js +439 -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 +152 -0
- package/esm/src/kernel/auth/types.js +1 -0
- package/esm/src/kernel/checkpoint.d.ts +43 -0
- package/esm/src/kernel/checkpoint.js +58 -0
- package/esm/src/kernel/default-scope.d.ts +72 -0
- package/esm/src/kernel/default-scope.js +121 -0
- package/esm/src/kernel/engine/call-trace.d.ts +19 -0
- package/esm/src/kernel/engine/call-trace.js +29 -0
- package/esm/src/kernel/engine/compaction.d.ts +71 -0
- package/esm/src/kernel/engine/compaction.js +203 -0
- package/esm/src/kernel/engine/decision.d.ts +43 -0
- package/esm/src/kernel/engine/decision.js +439 -0
- package/esm/src/kernel/engine/embedding.d.ts +8 -0
- package/esm/src/kernel/engine/embedding.js +118 -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 +19 -0
- package/esm/src/kernel/engine/live-inbound.js +44 -0
- package/esm/src/kernel/engine/live-ingress.d.ts +15 -0
- package/esm/src/kernel/engine/live-ingress.js +42 -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 +508 -0
- package/esm/src/kernel/engine/runner/mod.d.ts +29 -0
- package/esm/src/kernel/engine/runner/mod.js +625 -0
- package/esm/src/kernel/engine/runner/nested.d.ts +32 -0
- package/esm/src/kernel/engine/runner/nested.js +134 -0
- package/esm/src/kernel/engine/runner/schema-validation.d.ts +35 -0
- package/esm/src/kernel/engine/runner/schema-validation.js +179 -0
- package/esm/src/kernel/engine/runner/stages.d.ts +28 -0
- package/esm/src/kernel/engine/runner/stages.js +41 -0
- package/esm/src/kernel/engine/runner/state.d.ts +97 -0
- package/esm/src/kernel/engine/runner/state.js +50 -0
- package/esm/src/kernel/engine/runner/step-order.d.ts +27 -0
- package/esm/src/kernel/engine/runner/step-order.js +165 -0
- package/esm/src/kernel/engine/runner/steps.d.ts +14 -0
- package/esm/src/kernel/engine/runner/steps.js +519 -0
- package/esm/src/kernel/engine/runner/stream.d.ts +71 -0
- package/esm/src/kernel/engine/runner/stream.js +376 -0
- package/esm/src/kernel/engine/runner/usage.d.ts +45 -0
- package/esm/src/kernel/engine/runner/usage.js +148 -0
- package/esm/src/kernel/engine/session/mod.d.ts +33 -0
- package/esm/src/kernel/engine/session/mod.js +1182 -0
- package/esm/src/kernel/engine/session/session-trace.d.ts +115 -0
- package/esm/src/kernel/engine/session/session-trace.js +500 -0
- package/esm/src/kernel/engine/token-estimate.d.ts +23 -0
- package/esm/src/kernel/engine/token-estimate.js +38 -0
- package/esm/src/kernel/engine/tool-trace.d.ts +58 -0
- package/esm/src/kernel/engine/tool-trace.js +132 -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 +119 -0
- package/esm/src/kernel/engine/turn-trace.js +855 -0
- package/esm/src/kernel/engine/usage.d.ts +36 -0
- package/esm/src/kernel/engine/usage.js +151 -0
- package/esm/src/kernel/interaction-parts.d.ts +13 -0
- package/esm/src/kernel/interaction-parts.js +40 -0
- package/esm/src/kernel/json.d.ts +10 -0
- package/esm/src/kernel/json.js +3 -0
- package/esm/src/kernel/mod.d.ts +74 -0
- package/esm/src/kernel/mod.js +45 -0
- package/esm/src/kernel/profile-graph.d.ts +145 -0
- package/esm/src/kernel/profile-graph.js +158 -0
- package/esm/src/kernel/profile-presence.d.ts +18 -0
- package/esm/src/kernel/profile-presence.js +158 -0
- package/esm/src/kernel/profile-scope.d.ts +40 -0
- package/esm/src/kernel/profile-scope.js +274 -0
- package/esm/src/kernel/protocols/binding.d.ts +65 -0
- package/esm/src/kernel/protocols/binding.js +125 -0
- package/esm/src/kernel/protocols/limits.d.ts +15 -0
- package/esm/src/kernel/protocols/limits.js +28 -0
- package/esm/src/kernel/protocols/mod.d.ts +5 -0
- package/esm/src/kernel/protocols/mod.js +5 -0
- package/esm/src/kernel/protocols/prices.d.ts +36 -0
- package/esm/src/kernel/protocols/prices.js +37 -0
- package/esm/src/kernel/protocols/protocol.d.ts +253 -0
- package/esm/src/kernel/protocols/protocol.js +253 -0
- package/esm/src/kernel/protocols/provider.d.ts +108 -0
- package/esm/src/kernel/protocols/provider.js +143 -0
- package/esm/src/kernel/protocols/runtime.d.ts +55 -0
- package/esm/src/kernel/protocols/runtime.js +534 -0
- package/esm/src/kernel/provider-budget.d.ts +32 -0
- package/esm/src/kernel/provider-budget.js +262 -0
- package/esm/src/kernel/provider-dispatch.d.ts +13 -0
- package/esm/src/kernel/provider-dispatch.js +36 -0
- package/esm/src/kernel/provider-live.d.ts +7 -0
- package/esm/src/kernel/provider-live.js +189 -0
- package/esm/src/kernel/provider-runtime.d.ts +57 -0
- package/esm/src/kernel/provider-runtime.js +524 -0
- package/esm/src/kernel/registry/attachments.d.ts +46 -0
- package/esm/src/kernel/registry/attachments.js +220 -0
- package/esm/src/kernel/registry/catalog.d.ts +25 -0
- package/esm/src/kernel/registry/catalog.js +85 -0
- package/esm/src/kernel/registry/embedding-rules.d.ts +28 -0
- package/esm/src/kernel/registry/embedding-rules.js +66 -0
- package/esm/src/kernel/registry/ingress.d.ts +12 -0
- package/esm/src/kernel/registry/ingress.js +179 -0
- package/esm/src/kernel/registry/kernel-registry.d.ts +15 -0
- package/esm/src/kernel/registry/kernel-registry.js +15 -0
- package/esm/src/kernel/registry/profile-outputs.d.ts +3 -0
- package/esm/src/kernel/registry/profile-outputs.js +10 -0
- package/esm/src/kernel/registry/profiles.d.ts +116 -0
- package/esm/src/kernel/registry/profiles.js +773 -0
- package/esm/src/kernel/registry/provider-request.d.ts +6 -0
- package/esm/src/kernel/registry/provider-request.js +34 -0
- package/esm/src/kernel/registry/resolve.d.ts +17 -0
- package/esm/src/kernel/registry/resolve.js +238 -0
- package/esm/src/kernel/registry/schemas.d.ts +12 -0
- package/esm/src/kernel/registry/schemas.js +27 -0
- package/esm/src/kernel/registry/slot-fill.d.ts +7 -0
- package/esm/src/kernel/registry/slot-fill.js +22 -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 +32 -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 +14 -0
- package/esm/src/kernel/registry/vault.js +1 -0
- package/esm/src/kernel/schema.d.ts +226 -0
- package/esm/src/kernel/schema.js +895 -0
- package/esm/src/kernel/scope.d.ts +29 -0
- package/esm/src/kernel/scope.js +45 -0
- package/esm/src/kernel/stages.d.ts +176 -0
- package/esm/src/kernel/stages.js +431 -0
- package/esm/src/kernel/stop.d.ts +116 -0
- package/esm/src/kernel/stop.js +137 -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 +22 -0
- package/esm/src/kernel/tools/activity-label.js +435 -0
- package/esm/src/kernel/tools/agent.d.ts +66 -0
- package/esm/src/kernel/tools/agent.js +212 -0
- package/esm/src/kernel/tools/coordinate.d.ts +4 -0
- package/esm/src/kernel/tools/coordinate.js +165 -0
- package/esm/src/kernel/tools/events.d.ts +66 -0
- package/esm/src/kernel/tools/events.js +184 -0
- package/esm/src/kernel/tools/execute.d.ts +100 -0
- package/esm/src/kernel/tools/execute.js +1173 -0
- package/esm/src/kernel/tools/gate-answer.d.ts +60 -0
- package/esm/src/kernel/tools/gate-answer.js +65 -0
- package/esm/src/kernel/tools/handler-events.d.ts +45 -0
- package/esm/src/kernel/tools/handler-events.js +106 -0
- package/esm/src/kernel/tools/harness.d.ts +17 -0
- package/esm/src/kernel/tools/harness.js +43 -0
- package/esm/src/kernel/tools/http-limit.d.ts +27 -0
- package/esm/src/kernel/tools/http-limit.js +85 -0
- package/esm/src/kernel/tools/invoke.d.ts +32 -0
- package/esm/src/kernel/tools/invoke.js +282 -0
- package/esm/src/kernel/tools/mcp-sessions.d.ts +23 -0
- package/esm/src/kernel/tools/mcp-sessions.js +69 -0
- package/esm/src/kernel/tools/mod.d.ts +10 -0
- package/esm/src/kernel/tools/mod.js +7 -0
- package/esm/src/kernel/tools/model-text.d.ts +16 -0
- package/esm/src/kernel/tools/model-text.js +31 -0
- package/esm/src/kernel/tools/operation.d.ts +76 -0
- package/esm/src/kernel/tools/operation.js +100 -0
- package/esm/src/kernel/tools/page-answer.d.ts +8 -0
- package/esm/src/kernel/tools/page-answer.js +19 -0
- package/esm/src/kernel/tools/permission.d.ts +15 -0
- package/esm/src/kernel/tools/permission.js +38 -0
- package/esm/src/kernel/tools/project.d.ts +11 -0
- package/esm/src/kernel/tools/project.js +55 -0
- package/esm/src/kernel/tools/registry.d.ts +27 -0
- package/esm/src/kernel/tools/registry.js +143 -0
- package/esm/src/kernel/tools/remote.d.ts +144 -0
- package/esm/src/kernel/tools/remote.js +1125 -0
- package/esm/src/kernel/tools/resolve.d.ts +31 -0
- package/esm/src/kernel/tools/resolve.js +267 -0
- package/esm/src/kernel/tools/run.d.ts +28 -0
- package/esm/src/kernel/tools/run.js +86 -0
- package/esm/src/kernel/tools/schema.d.ts +10 -0
- package/esm/src/kernel/tools/schema.js +95 -0
- package/esm/src/kernel/tools/signed-in-fetch.d.ts +19 -0
- package/esm/src/kernel/tools/signed-in-fetch.js +45 -0
- package/esm/src/kernel/tools/stage-run.d.ts +116 -0
- package/esm/src/kernel/tools/stage-run.js +198 -0
- package/esm/src/kernel/tools/types.d.ts +497 -0
- package/esm/src/kernel/tools/types.js +1 -0
- package/esm/src/kernel/tools/unchecked-output.d.ts +14 -0
- package/esm/src/kernel/tools/unchecked-output.js +18 -0
- package/esm/src/kernel/turn-events.d.ts +776 -0
- package/esm/src/kernel/turn-events.js +543 -0
- package/esm/src/kernel/types.d.ts +1025 -0
- package/esm/src/kernel/types.js +1 -0
- package/esm/src/kernel/util/base64.d.ts +4 -0
- package/esm/src/kernel/util/base64.js +15 -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/partial-json.d.ts +23 -0
- package/esm/src/kernel/util/partial-json.js +128 -0
- package/esm/src/kernel/util/record.d.ts +2 -0
- package/esm/src/kernel/util/record.js +4 -0
- package/esm/src/observability/destinations.d.ts +14 -0
- package/esm/src/observability/destinations.js +43 -0
- package/esm/src/observability/jsonl.d.ts +18 -0
- package/esm/src/observability/jsonl.js +110 -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 +71 -0
- package/esm/src/observability/otlp.js +98 -0
- package/esm/src/observability/phoenix.d.ts +30 -0
- package/esm/src/observability/phoenix.js +71 -0
- package/esm/src/observability/policy.d.ts +17 -0
- package/esm/src/observability/policy.js +73 -0
- package/esm/src/observability/resolve-policy.d.ts +8 -0
- package/esm/src/observability/resolve-policy.js +64 -0
- package/esm/src/observability/spans.d.ts +22 -0
- package/esm/src/observability/spans.js +72 -0
- package/esm/src/observability/trace-catalog.d.ts +128 -0
- package/esm/src/observability/trace-catalog.js +906 -0
- package/esm/src/observability/trace-record.d.ts +23 -0
- package/esm/src/observability/trace-record.js +228 -0
- package/esm/src/observability/trace-schema.d.ts +57 -0
- package/esm/src/observability/trace-schema.js +59 -0
- package/esm/src/observability/trace-sink.d.ts +14 -0
- package/esm/src/observability/trace-sink.js +3 -0
- package/esm/src/observability/trace-span.d.ts +98 -0
- package/esm/src/observability/trace-span.js +201 -0
- package/esm/src/observability/trace.d.ts +13 -0
- package/esm/src/observability/trace.js +37 -0
- package/esm/src/observability/types.d.ts +109 -0
- package/esm/src/observability/types.js +3 -0
- package/esm/src/presets/google/speech-voices.d.ts +9 -0
- package/esm/src/presets/google/speech-voices.js +38 -0
- package/esm/src/presets/google-limits.d.ts +13 -0
- package/esm/src/presets/google-limits.js +18 -0
- package/esm/src/presets/google.d.ts +119 -0
- package/esm/src/presets/google.js +197 -0
- package/esm/src/presets/local.d.ts +26 -0
- package/esm/src/presets/local.js +30 -0
- package/esm/src/presets/mod.d.ts +11 -0
- package/esm/src/presets/mod.js +9 -0
- package/esm/src/presets/openrouter.d.ts +26 -0
- package/esm/src/presets/openrouter.js +31 -0
- package/esm/src/providers/embedding-limits.d.ts +7 -0
- package/esm/src/providers/embedding-limits.js +12 -0
- package/esm/src/providers/gemini/embedding-protocol.d.ts +8 -0
- package/esm/src/providers/gemini/embedding-protocol.js +125 -0
- package/esm/src/providers/gemini/interactions-protocol.d.ts +8 -0
- package/esm/src/providers/gemini/interactions-protocol.js +105 -0
- package/esm/src/providers/gemini/live-protocol.d.ts +3 -0
- package/esm/src/providers/gemini/live-protocol.js +191 -0
- package/esm/src/providers/gemini/prices.d.ts +3 -0
- package/esm/src/providers/gemini/prices.js +63 -0
- package/esm/src/providers/gemini/provider.d.ts +7 -0
- package/esm/src/providers/gemini/provider.js +39 -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/builtins.d.ts +14 -0
- package/esm/src/providers/google/builtins.js +57 -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 +27 -0
- package/esm/src/providers/google/interactions/framing.js +304 -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 +23 -0
- package/esm/src/providers/google/interactions/stream.js +230 -0
- package/esm/src/providers/google/live/framing.d.ts +61 -0
- package/esm/src/providers/google/live/framing.js +597 -0
- package/esm/src/providers/google/live/stream.d.ts +13 -0
- package/esm/src/providers/google/live/stream.js +57 -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 +4 -0
- package/esm/src/providers/google/urls.js +4 -0
- package/esm/src/providers/google/usage.d.ts +7 -0
- package/esm/src/providers/google/usage.js +49 -0
- package/esm/src/providers/live.d.ts +6 -0
- package/esm/src/providers/live.js +6 -0
- package/esm/src/providers/local/embedding-protocol.d.ts +7 -0
- package/esm/src/providers/local/embedding-protocol.js +60 -0
- package/esm/src/providers/local/provider.d.ts +7 -0
- package/esm/src/providers/local/provider.js +28 -0
- package/esm/src/providers/mod.d.ts +32 -0
- package/esm/src/providers/mod.js +23 -0
- package/esm/src/providers/open-ai/protocol.d.ts +3 -0
- package/esm/src/providers/open-ai/protocol.js +189 -0
- package/esm/src/providers/openrouter/embedding-protocol.d.ts +6 -0
- package/esm/src/providers/openrouter/embedding-protocol.js +86 -0
- package/esm/src/providers/openrouter/image.d.ts +15 -0
- package/esm/src/providers/openrouter/image.js +34 -0
- package/esm/src/providers/openrouter/images-protocol.d.ts +3 -0
- package/esm/src/providers/openrouter/images-protocol.js +82 -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/reasoning-state.d.ts +2 -0
- package/esm/src/providers/openrouter/openai/reasoning-state.js +31 -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/protocol.d.ts +8 -0
- package/esm/src/providers/openrouter/protocol.js +171 -0
- package/esm/src/providers/openrouter/provider.d.ts +10 -0
- package/esm/src/providers/openrouter/provider.js +50 -0
- package/esm/src/providers/shared/carried-tool-files.d.ts +7 -0
- package/esm/src/providers/shared/carried-tool-files.js +43 -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/protocol-events.d.ts +8 -0
- package/esm/src/providers/shared/protocol-events.js +20 -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/retry.d.ts +17 -0
- package/esm/src/providers/shared/retry.js +90 -0
- package/esm/src/providers/shared/sse.d.ts +6 -0
- package/esm/src/providers/shared/sse.js +93 -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 +24 -0
- package/esm/src/providers/shared/tool-args.js +88 -0
- package/esm/src/providers/shared/tool-draft.d.ts +16 -0
- package/esm/src/providers/shared/tool-draft.js +14 -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/system-one/protocol.d.ts +8 -0
- package/esm/src/providers/system-one/protocol.js +93 -0
- package/esm/src/providers/types.d.ts +51 -0
- package/esm/src/providers/types.js +2 -0
- package/esm/src/providers/typesafe/provider.d.ts +7 -0
- package/esm/src/providers/typesafe/provider.js +24 -0
- package/esm/src/surface/formats.d.ts +46 -0
- package/esm/src/surface/formats.js +178 -0
- package/esm/src/surface/mod.d.ts +16 -0
- package/esm/src/surface/mod.js +12 -0
- package/esm/src/surface/runtime.d.ts +44 -0
- package/esm/src/surface/runtime.js +441 -0
- package/esm/src/surface/tools.d.ts +9 -0
- package/esm/src/surface/tools.js +62 -0
- package/esm/src/surface/types.d.ts +110 -0
- package/esm/src/surface/types.js +4 -0
- package/package.json +100 -4
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
// invariant: Content is held in memory as markers the record builder resolves: `$content` is scrubbed, hashed
|
|
2
|
+
// and moved into `TraceRecord.content`; `$bytes` is hashed and never stored; `$json` has media
|
|
3
|
+
// hashed and strings equal to recorded content replaced by their hash.
|
|
4
|
+
import { TheoremError } from '../guardrails/error.js';
|
|
5
|
+
import { isRecord } from '../kernel/util/record.js';
|
|
6
|
+
const TRACE_ID_BYTES = 16;
|
|
7
|
+
const SPAN_ID_BYTES = 8;
|
|
8
|
+
const NANOS_PER_MS = 1_000_000;
|
|
9
|
+
const HEX_PAD = 2;
|
|
10
|
+
const HEX_RADIX = 16;
|
|
11
|
+
const TRACEPARENT = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
12
|
+
const ALL_ZERO = /^0+$/;
|
|
13
|
+
const SAMPLED_FLAGS = '01';
|
|
14
|
+
const UNCLOSED = 'unclosed';
|
|
15
|
+
function randomHex(bytes) {
|
|
16
|
+
for (;;) {
|
|
17
|
+
const buf = crypto.getRandomValues(new Uint8Array(bytes));
|
|
18
|
+
const hex = [...buf].map((b) => b.toString(HEX_RADIX).padStart(HEX_PAD, '0')).join('');
|
|
19
|
+
if (!ALL_ZERO.test(hex)) {
|
|
20
|
+
return hex;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** On Cloudflare Workers both clocks advance only at I/O; the root carries `theorem.clock=io`. */
|
|
25
|
+
function systemClock() {
|
|
26
|
+
const epochMs = Date.now();
|
|
27
|
+
const perfStart = performance.now();
|
|
28
|
+
return {
|
|
29
|
+
nowUnixNano: () => BigInt(epochMs) * BigInt(NANOS_PER_MS) +
|
|
30
|
+
BigInt(Math.round((performance.now() - perfStart) * NANOS_PER_MS)),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function clockAdvancesOnlyAtIo() {
|
|
34
|
+
return globalThis.navigator?.userAgent === 'Cloudflare-Workers';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The trace and span ids of a W3C `traceparent` THEOREM accepts (version 00,
|
|
38
|
+
* lowercase hex, non-zero ids), or `undefined`. For a host checking a value from
|
|
39
|
+
* a request before handing it to a turn, which throws on anything else.
|
|
40
|
+
*/
|
|
41
|
+
function readTraceparent(value) {
|
|
42
|
+
const match = TRACEPARENT.exec(value.trim());
|
|
43
|
+
const traceId = match?.[1];
|
|
44
|
+
const spanId = match?.[2];
|
|
45
|
+
if (!traceId || !spanId || ALL_ZERO.test(traceId) || ALL_ZERO.test(spanId))
|
|
46
|
+
return undefined;
|
|
47
|
+
return { traceId, spanId };
|
|
48
|
+
}
|
|
49
|
+
/** Throws on a malformed value: a host bug, not a runtime state. */
|
|
50
|
+
function parseTraceparent(value) {
|
|
51
|
+
const parsed = readTraceparent(value);
|
|
52
|
+
if (!parsed) {
|
|
53
|
+
throw new TheoremError('request', `traceparent is not a valid W3C trace context: '${value}'`);
|
|
54
|
+
}
|
|
55
|
+
return parsed;
|
|
56
|
+
}
|
|
57
|
+
function formatTraceparent(traceId, spanId) {
|
|
58
|
+
return `00-${traceId}-${spanId}-${SAMPLED_FLAGS}`;
|
|
59
|
+
}
|
|
60
|
+
/** Marks text as message content, which the trace stores by hash. */
|
|
61
|
+
function traceContent(text) {
|
|
62
|
+
return { $content: text };
|
|
63
|
+
}
|
|
64
|
+
/** Marks base64 data as bytes, which the trace stores by hash. */
|
|
65
|
+
function traceBytes(base64) {
|
|
66
|
+
return { $bytes: base64 };
|
|
67
|
+
}
|
|
68
|
+
/** `undefined` members and non-JSON values are dropped the way `JSON.stringify` drops them. */
|
|
69
|
+
function traceJson(value) {
|
|
70
|
+
return { $json: toAttributeValue(value) ?? null };
|
|
71
|
+
}
|
|
72
|
+
function toAttributeValue(value) {
|
|
73
|
+
if (typeof value === 'string' || typeof value === 'boolean') {
|
|
74
|
+
return value;
|
|
75
|
+
}
|
|
76
|
+
if (typeof value === 'number') {
|
|
77
|
+
return Number.isFinite(value) ? value : null;
|
|
78
|
+
}
|
|
79
|
+
if (value === null) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
if (Array.isArray(value)) {
|
|
83
|
+
return value.map((item) => toAttributeValue(item) ?? null);
|
|
84
|
+
}
|
|
85
|
+
if (typeof value === 'object') {
|
|
86
|
+
const out = {};
|
|
87
|
+
for (const [key, nested] of Object.entries(value)) {
|
|
88
|
+
const mapped = toAttributeValue(nested);
|
|
89
|
+
if (mapped !== undefined) {
|
|
90
|
+
out[key] = mapped;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return out;
|
|
94
|
+
}
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
function isMarker(value, key) {
|
|
98
|
+
return isRecord(value) && key in value;
|
|
99
|
+
}
|
|
100
|
+
function isTraceContent(value) {
|
|
101
|
+
return isMarker(value, '$content') && typeof value.$content === 'string';
|
|
102
|
+
}
|
|
103
|
+
function isTraceBytes(value) {
|
|
104
|
+
return isMarker(value, '$bytes') && typeof value.$bytes === 'string';
|
|
105
|
+
}
|
|
106
|
+
function isTraceJson(value) {
|
|
107
|
+
return isMarker(value, '$json');
|
|
108
|
+
}
|
|
109
|
+
function linkFrom(input) {
|
|
110
|
+
const { traceId, spanId } = parseTraceparent(input.traceparent);
|
|
111
|
+
return { traceId, spanId, attributes: { ...(input.attributes ?? {}) } };
|
|
112
|
+
}
|
|
113
|
+
function msBetween(fromUnixNano, clock) {
|
|
114
|
+
return Number(clock.nowUnixNano() - BigInt(fromUnixNano)) / NANOS_PER_MS;
|
|
115
|
+
}
|
|
116
|
+
function openHandle(state, traceId, parentSpanId, name, options) {
|
|
117
|
+
const entry = {
|
|
118
|
+
span: {
|
|
119
|
+
traceId,
|
|
120
|
+
spanId: randomHex(SPAN_ID_BYTES),
|
|
121
|
+
...(parentSpanId ? { parentSpanId } : {}),
|
|
122
|
+
name,
|
|
123
|
+
kind: options?.kind ?? 'INTERNAL',
|
|
124
|
+
startTimeUnixNano: options?.startTimeUnixNano ?? String(state.clock.nowUnixNano()),
|
|
125
|
+
endTimeUnixNano: '',
|
|
126
|
+
attributes: { ...(options?.attributes ?? {}) },
|
|
127
|
+
events: [],
|
|
128
|
+
links: (options?.links ?? []).map(linkFrom),
|
|
129
|
+
status: { code: 'UNSET' },
|
|
130
|
+
},
|
|
131
|
+
ended: false,
|
|
132
|
+
order: state.open.length,
|
|
133
|
+
};
|
|
134
|
+
state.open.push(entry);
|
|
135
|
+
const { span } = entry;
|
|
136
|
+
return {
|
|
137
|
+
traceId,
|
|
138
|
+
spanId: span.spanId,
|
|
139
|
+
get ended() {
|
|
140
|
+
return entry.ended;
|
|
141
|
+
},
|
|
142
|
+
traceparent: () => formatTraceparent(traceId, span.spanId),
|
|
143
|
+
child: (childName, childOptions) => openHandle(state, traceId, span.spanId, childName, childOptions),
|
|
144
|
+
set: (attributes) => {
|
|
145
|
+
if (!entry.ended) {
|
|
146
|
+
Object.assign(span.attributes, attributes);
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
event: (eventName, attributes, timeUnixNano) => {
|
|
150
|
+
if (!entry.ended) {
|
|
151
|
+
span.events.push({
|
|
152
|
+
name: eventName,
|
|
153
|
+
timeUnixNano: timeUnixNano ?? String(state.clock.nowUnixNano()),
|
|
154
|
+
attributes: { ...(attributes ?? {}) },
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
end: (status) => {
|
|
159
|
+
if (entry.ended) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
entry.ended = true;
|
|
163
|
+
span.endTimeUnixNano = String(state.clock.nowUnixNano());
|
|
164
|
+
span.status = status ?? { code: 'OK' };
|
|
165
|
+
},
|
|
166
|
+
msSinceStart: () => msBetween(span.startTimeUnixNano, state.clock),
|
|
167
|
+
msSinceEnd: () => (entry.ended ? msBetween(span.endTimeUnixNano, state.clock) : undefined),
|
|
168
|
+
nowUnixNano: () => String(state.clock.nowUnixNano()),
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Open a root span. With `traceparent`, the root joins that trace as a child of
|
|
173
|
+
* the named span; without it, the root starts a new trace.
|
|
174
|
+
*/
|
|
175
|
+
function startTrace(name, options = {}) {
|
|
176
|
+
const parent = options.traceparent ? parseTraceparent(options.traceparent) : undefined;
|
|
177
|
+
const state = { clock: options.clock ?? systemClock(), open: [] };
|
|
178
|
+
const root = openHandle(state, parent?.traceId ?? randomHex(TRACE_ID_BYTES), parent?.spanId, name, {
|
|
179
|
+
...options,
|
|
180
|
+
attributes: {
|
|
181
|
+
...(clockAdvancesOnlyAtIo() ? { 'theorem.clock': 'io' } : {}),
|
|
182
|
+
...(options.attributes ?? {}),
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
return {
|
|
186
|
+
root,
|
|
187
|
+
clock: state.clock,
|
|
188
|
+
collect: () => {
|
|
189
|
+
const now = String(state.clock.nowUnixNano());
|
|
190
|
+
for (const entry of state.open) {
|
|
191
|
+
if (!entry.ended) {
|
|
192
|
+
entry.ended = true;
|
|
193
|
+
entry.span.endTimeUnixNano = now;
|
|
194
|
+
entry.span.status = { code: 'ERROR', message: UNCLOSED };
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return [...state.open].sort((a, b) => a.order - b.order).map((entry) => entry.span);
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
export { formatTraceparent, isTraceBytes, isTraceContent, isTraceJson, parseTraceparent, readTraceparent, startTrace, traceBytes, traceContent, traceJson, };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type TraceRecord } from './trace-record.js';
|
|
2
|
+
import type { TraceSink } from './trace-sink.js';
|
|
3
|
+
import type { TraceSpan } from './trace-span.js';
|
|
4
|
+
import type { ResolvedObservabilityPolicy } from './types.js';
|
|
5
|
+
/** Trace failures never fail the turn: build and write errors go to `sink.onError`, if set. */
|
|
6
|
+
declare function writeTrace(sink: TraceSink, record: Promise<TraceRecord>, policy: ResolvedObservabilityPolicy): Promise<void>;
|
|
7
|
+
/** Like `writeTrace`, it never fails the caller. */
|
|
8
|
+
declare function writeSpans(sink: TraceSink, spans: TraceSpan[], policy: ResolvedObservabilityPolicy, metadata?: Record<string, unknown>): Promise<void>;
|
|
9
|
+
/** A sink that discards every record. */
|
|
10
|
+
declare function noopSink(): TraceSink;
|
|
11
|
+
/** A sink that appends each trace record to the given array. */
|
|
12
|
+
declare function memorySink(into: TraceRecord[]): TraceSink;
|
|
13
|
+
export { memorySink, noopSink, writeSpans, writeTrace };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// invariant: 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
|
+
// why: 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
|
+
/** A sink that discards every record. */
|
|
25
|
+
function noopSink() {
|
|
26
|
+
return { write: () => Promise.resolve() };
|
|
27
|
+
}
|
|
28
|
+
/** A sink that appends each trace record to the given array. */
|
|
29
|
+
function memorySink(into) {
|
|
30
|
+
return {
|
|
31
|
+
write: (record) => {
|
|
32
|
+
into.push(record);
|
|
33
|
+
return Promise.resolve();
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export { memorySink, noopSink, writeSpans, writeTrace };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { ResolvedDetect } from '../guardrails/detectors.js';
|
|
2
|
+
import type { TraceSink } from './trace-sink.js';
|
|
3
|
+
import type { TraceAttributes } from './trace-span.js';
|
|
4
|
+
/** Which payloads land in each TraceRecord. Omitted keys use resolved defaults. */
|
|
5
|
+
export interface TraceIncludeSpec {
|
|
6
|
+
/** Scrubbed provider rows and frames (`theorem.upstream.row` events). Default: true. */
|
|
7
|
+
upstreamLog?: boolean;
|
|
8
|
+
/** Scrubbed outbound request bodies (`theorem.wire.request` events). Default: false. */
|
|
9
|
+
outboundWire?: boolean;
|
|
10
|
+
/** The provider's raw grounding payload (`raw` on `theorem.grounding` events). Default: false. */
|
|
11
|
+
evidenceRaw?: boolean;
|
|
12
|
+
/** Usage attributes (`gen_ai.usage.*`, `theorem.usage.*`). Default: true. */
|
|
13
|
+
usage?: boolean;
|
|
14
|
+
/** Guardrail decisions (`theorem.guardrail` events). Default: true. */
|
|
15
|
+
guardrailDecisions?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Keep `GuardrailHit.match` (the exact matched text) on guardrail events. Default: false;
|
|
18
|
+
* debugging only, so treat the store like server logs when enabled.
|
|
19
|
+
*/
|
|
20
|
+
guardrailMatchPreview?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Whether a stored trace is cleaned, and whose patterns clean it. `true` cleans with what each
|
|
24
|
+
* detector reads the turn with; `false` with nothing. The object names the sides, whatever the
|
|
25
|
+
* turn reads with: Theorem's patterns, the host's (`guardrails.detect` patterns and detectors),
|
|
26
|
+
* each on when left out.
|
|
27
|
+
*/
|
|
28
|
+
export type ScrubSwitch = boolean | {
|
|
29
|
+
theorem?: boolean;
|
|
30
|
+
host?: boolean;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Scrubbing of stored records. It reads the detectors `guardrails.detect` declares and ignores
|
|
34
|
+
* their actions: a detector set to `ignore` in the turn still cleans the trace. Defaults are on.
|
|
35
|
+
*/
|
|
36
|
+
export interface TraceScrubSpec {
|
|
37
|
+
/** The data detectors (`ids`, `financial`, `network`, `credentials`) and the host's own. Default: true. */
|
|
38
|
+
sensitive?: ScrubSwitch;
|
|
39
|
+
/** `injection` and `tool_instructions`. Default: true. */
|
|
40
|
+
injection?: ScrubSwitch;
|
|
41
|
+
/** Never persist the canary token. It is Theorem's alone, so the host side adds nothing. Default: true. */
|
|
42
|
+
canary?: ScrubSwitch;
|
|
43
|
+
}
|
|
44
|
+
/** Omit the whole block for no tracing. */
|
|
45
|
+
export interface ProfileObservabilitySpec {
|
|
46
|
+
/**
|
|
47
|
+
* `false` is off, a string is a `registerTraceDestination` id, a TraceSink is an inline writer.
|
|
48
|
+
* `runTurn(..., sink)` still overrides this for one call.
|
|
49
|
+
*/
|
|
50
|
+
writeTo?: false | string | TraceSink;
|
|
51
|
+
/**
|
|
52
|
+
* Fraction of traces to record, 0–1 inclusive. Default: 1. Decided by trace id, so every
|
|
53
|
+
* record of one trace is kept or dropped together.
|
|
54
|
+
*/
|
|
55
|
+
sampleRate?: number;
|
|
56
|
+
include?: TraceIncludeSpec;
|
|
57
|
+
/** Stamped on every record as `TraceRecord.resource`, e.g. `{ 'service.name': 'harbor' }`. */
|
|
58
|
+
resource?: TraceAttributes;
|
|
59
|
+
/** Defaults stay on even when `guardrails.detect` is `ignore`. */
|
|
60
|
+
scrub?: TraceScrubSpec;
|
|
61
|
+
/**
|
|
62
|
+
* Days to keep each record, handed to every destination with the record
|
|
63
|
+
* (`TraceWriteContext`): the JSONL writer prunes by it, a host store computes
|
|
64
|
+
* its own expiry from it. `<= 0` keeps records forever. Default: 14.
|
|
65
|
+
*/
|
|
66
|
+
retainForDays?: number;
|
|
67
|
+
/**
|
|
68
|
+
* File size in MiB at which a file-based destination starts a new file, handed to every
|
|
69
|
+
* destination with the record (`TraceWriteContext`). Default: 32.
|
|
70
|
+
*/
|
|
71
|
+
rotateAfterMiB?: number;
|
|
72
|
+
/** Called when record build or destination write fails. Must not throw. */
|
|
73
|
+
onWriteError?: (err: unknown) => void;
|
|
74
|
+
}
|
|
75
|
+
/** Which optional content a trace record includes, each on or off. */
|
|
76
|
+
export interface ResolvedTraceInclude {
|
|
77
|
+
upstreamLog: boolean;
|
|
78
|
+
outboundWire: boolean;
|
|
79
|
+
evidenceRaw: boolean;
|
|
80
|
+
usage: boolean;
|
|
81
|
+
guardrailDecisions: boolean;
|
|
82
|
+
guardrailMatchPreview: boolean;
|
|
83
|
+
}
|
|
84
|
+
/** A `ScrubSwitch` with its sides filled in; one with both sides off is `false`. */
|
|
85
|
+
export type ResolvedScrubSwitch = boolean | {
|
|
86
|
+
theorem: boolean;
|
|
87
|
+
host: boolean;
|
|
88
|
+
};
|
|
89
|
+
/** What is scrubbed from the text a trace stores: sensitive values, injection, and the canary. */
|
|
90
|
+
export interface ResolvedTraceScrub {
|
|
91
|
+
sensitive: ResolvedScrubSwitch;
|
|
92
|
+
injection: ResolvedScrubSwitch;
|
|
93
|
+
canary: ResolvedScrubSwitch;
|
|
94
|
+
}
|
|
95
|
+
/** A profile's observability settings after defaults: whether and where to record, the sample rate, what to include and scrub, and retention and rotation. */
|
|
96
|
+
export interface ResolvedObservabilityPolicy {
|
|
97
|
+
/** False when the block is omitted or `writeTo` is `false`/absent. Sampling applies at write. */
|
|
98
|
+
record: boolean;
|
|
99
|
+
writeTo: false | string | TraceSink | undefined;
|
|
100
|
+
sampleRate: number;
|
|
101
|
+
include: ResolvedTraceInclude;
|
|
102
|
+
scrub: ResolvedTraceScrub;
|
|
103
|
+
/** The profile's detectors, whose patterns clean the record. Absent, Theorem's patterns alone. */
|
|
104
|
+
detect?: ResolvedDetect;
|
|
105
|
+
resource: TraceAttributes;
|
|
106
|
+
retainForDays: number;
|
|
107
|
+
rotateAfterMiB: number;
|
|
108
|
+
onWriteError?: (err: unknown) => void;
|
|
109
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
/** The name of a Gemini speech voice. */
|
|
9
|
+
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,13 @@
|
|
|
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
|
+
/** A thinking level Gemini takes: minimal, low, medium, or high. */
|
|
6
|
+
type GoogleThinkingLevel = (typeof GOOGLE_THINKING_LEVELS)[number];
|
|
7
|
+
/**
|
|
8
|
+
* A `geminiInteractions` or `geminiLive` binding's `efforts`, typed to the levels Gemini takes.
|
|
9
|
+
* The runtime check refuses an untyped host's level when the binding is built, not when a turn runs.
|
|
10
|
+
*/
|
|
11
|
+
declare function googleEfforts<Efforts extends Record<string, GoogleThinkingLevel>>(efforts: Efforts): Efforts;
|
|
12
|
+
export type { GoogleThinkingLevel };
|
|
13
|
+
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,119 @@
|
|
|
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
|
+
/** The image MIME types a Gemini profile can take as input. */
|
|
11
|
+
declare const GOOGLE_IMAGE_INPUT_MIMES: readonly ["image/png", "image/jpeg", "image/webp", "image/heic", "image/heif"];
|
|
12
|
+
/** The audio MIME types a Gemini profile can take as voice input. */
|
|
13
|
+
declare const GOOGLE_VOICE_INPUT_MIMES: readonly ["audio/webm", "audio/wav", "audio/mpeg", "audio/mp4"];
|
|
14
|
+
/**
|
|
15
|
+
* TTS models that reject any history with a model turn, so compaction's summary fails them
|
|
16
|
+
* (live, 29/09/2026).
|
|
17
|
+
*/
|
|
18
|
+
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"];
|
|
19
|
+
/**
|
|
20
|
+
* Models that reject any thinking setting, `summaries: false` included: leave
|
|
21
|
+
* `efforts` and `summaries` unset (live, 30/09/2026).
|
|
22
|
+
*/
|
|
23
|
+
declare const GOOGLE_NO_THINKING_API_IDS: readonly ["gemini-2.5-flash-image", "antigravity-preview-05-2026", "antigravity-preview-09-2026", "antigravity-preview-latest"];
|
|
24
|
+
/**
|
|
25
|
+
* Models that refuse a thinking level and take `summaries`: leave `efforts` unset
|
|
26
|
+
* (live, 01/10/2026: Live closes 1007 "Thinking level is not supported for this model";
|
|
27
|
+
* 04/10/2026: setup takes `includeThoughts` either way).
|
|
28
|
+
*/
|
|
29
|
+
declare const GOOGLE_NO_EFFORT_API_IDS: readonly ["gemini-3.8-live"];
|
|
30
|
+
/**
|
|
31
|
+
* Models that refuse a session without a thinking level: pin `efforts`
|
|
32
|
+
* (live, 01/10/2026: Live closes 1007 "Thinking level must be specified for this model").
|
|
33
|
+
*/
|
|
34
|
+
declare const GOOGLE_THINKING_REQUIRED_API_IDS: readonly ["gemini-3.8-live-extended-thinking"];
|
|
35
|
+
/** Which grounding builtins a model's free-tier quota allows. */
|
|
36
|
+
interface GoogleFreeTierGrounding {
|
|
37
|
+
googleSearch: boolean;
|
|
38
|
+
googleMaps: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Models with a non-zero free-tier quota, and the grounding each allows (AI Studio, Sep 2026).
|
|
42
|
+
* No model keeps free Maps quota: 3.5 Flash-Lite turns with Maps are refused as over quota
|
|
43
|
+
* (live, 13/10/2026).
|
|
44
|
+
* A builtin with no quota is refused as if over quota: on Live, a close 1011 "You exceeded your
|
|
45
|
+
* current quota" at setup, whatever the key's usage (live, 01/10/2026).
|
|
46
|
+
*/
|
|
47
|
+
declare const GOOGLE_FREE_TIER_GROUNDING: Readonly<Record<string, GoogleFreeTierGrounding>>;
|
|
48
|
+
/** Grounding builtins the free tier allows on `apiId`; none for a model with no free quota. */
|
|
49
|
+
declare function googleFreeTierBuiltins(apiId: string): Array<'googleSearch' | 'googleMaps'>;
|
|
50
|
+
/** A Gemini binding field that breaks a Gemini rule, and what is wrong with it. */
|
|
51
|
+
interface GoogleBindingViolation {
|
|
52
|
+
field: 'apiId' | 'efforts' | 'summaries' | 'builtInTools';
|
|
53
|
+
message: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The first setting Google would refuse on this binding, or `undefined`. With `freeTier`, it
|
|
57
|
+
* also holds the binding to the free-tier table: a listed model, and only the grounding its
|
|
58
|
+
* quota allows.
|
|
59
|
+
*/
|
|
60
|
+
declare function googleBindingViolation(binding: Pick<ModelBinding, 'apiId' | 'efforts' | 'summaries' | 'builtInTools'>, options?: {
|
|
61
|
+
freeTier?: boolean;
|
|
62
|
+
}): GoogleBindingViolation | undefined;
|
|
63
|
+
/** The speech settings a Gemini profile may pin, with the voice narrowed to Gemini's. */
|
|
64
|
+
type GoogleSpeechPins = Omit<ProfileSpeechSpec, 'voice'> & {
|
|
65
|
+
voice?: GoogleSpeechVoice;
|
|
66
|
+
};
|
|
67
|
+
/** The live settings a Gemini profile may pin, with the voice narrowed to Gemini's. */
|
|
68
|
+
type GoogleLivePins = Omit<ProfileLiveSpec, 'voice'> & {
|
|
69
|
+
voice?: GoogleSpeechVoice;
|
|
70
|
+
};
|
|
71
|
+
/** The aspect ratios a Gemini image model can return. */
|
|
72
|
+
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"];
|
|
73
|
+
/** The resolutions a Gemini image model can return. */
|
|
74
|
+
declare const GOOGLE_IMAGE_RESOLUTIONS: readonly ["1K", "2K", "4K"];
|
|
75
|
+
/** What a Gemini image model can be asked to return. */
|
|
76
|
+
declare const GOOGLE_IMAGE_OUTPUT_MIMES: readonly ["image/png", "image/jpeg"];
|
|
77
|
+
/** One of {@linkcode GOOGLE_IMAGE_INPUT_MIMES}. */
|
|
78
|
+
type GoogleImageInputMime = (typeof GOOGLE_IMAGE_INPUT_MIMES)[number];
|
|
79
|
+
/** One of {@linkcode GOOGLE_VOICE_INPUT_MIMES}. */
|
|
80
|
+
type GoogleVoiceInputMime = (typeof GOOGLE_VOICE_INPUT_MIMES)[number];
|
|
81
|
+
/** One of {@linkcode GOOGLE_IMAGE_ASPECT_RATIOS}. */
|
|
82
|
+
type GoogleImageAspectRatio = (typeof GOOGLE_IMAGE_ASPECT_RATIOS)[number];
|
|
83
|
+
/** One of {@linkcode GOOGLE_IMAGE_RESOLUTIONS}. */
|
|
84
|
+
type GoogleImageResolution = (typeof GOOGLE_IMAGE_RESOLUTIONS)[number];
|
|
85
|
+
/** One of {@linkcode GOOGLE_IMAGE_OUTPUT_MIMES}. */
|
|
86
|
+
type GoogleImageOutputMime = (typeof GOOGLE_IMAGE_OUTPUT_MIMES)[number];
|
|
87
|
+
/** The image settings a Gemini profile may pin, narrowed to what Gemini accepts. */
|
|
88
|
+
type GoogleImagePins = Omit<ProfileImageSpec, 'aspectRatio' | 'resolution' | 'mimeType'> & {
|
|
89
|
+
aspectRatio?: GoogleImageAspectRatio;
|
|
90
|
+
resolution?: GoogleImageResolution;
|
|
91
|
+
mimeType?: GoogleImageOutputMime;
|
|
92
|
+
};
|
|
93
|
+
/** The tools Gemini runs itself, as `builtin` tool definitions. */
|
|
94
|
+
declare const GOOGLE_BUILTIN_TOOLS: ({
|
|
95
|
+
type: "builtin";
|
|
96
|
+
name: string;
|
|
97
|
+
description: string;
|
|
98
|
+
category: string;
|
|
99
|
+
access: "read-only";
|
|
100
|
+
paths: string[];
|
|
101
|
+
loadTier: "T0";
|
|
102
|
+
permission: "auto";
|
|
103
|
+
conflictsWith?: undefined;
|
|
104
|
+
} | {
|
|
105
|
+
type: "builtin";
|
|
106
|
+
name: string;
|
|
107
|
+
description: string;
|
|
108
|
+
category: string;
|
|
109
|
+
access: "read-only";
|
|
110
|
+
paths: string[];
|
|
111
|
+
loadTier: "T0";
|
|
112
|
+
permission: "auto";
|
|
113
|
+
conflictsWith: string[];
|
|
114
|
+
})[];
|
|
115
|
+
/** Registers into the default scope; a scope of its own takes `GOOGLE_BUILTIN_TOOLS`. */
|
|
116
|
+
declare function registerGooglePreset(): void;
|
|
117
|
+
export { GEMINI_MODELS_URL } from '../providers/google/urls.js';
|
|
118
|
+
export type { GoogleBindingViolation, GoogleFreeTierGrounding, GoogleImageAspectRatio, GoogleImageInputMime, GoogleImageOutputMime, GoogleImagePins, GoogleImageResolution, GoogleLivePins, GoogleSpeechPins, GoogleSpeechVoice, GoogleThinkingLevel, GoogleVoiceInputMime, };
|
|
119
|
+
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_EFFORT_API_IDS, 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, };
|