@theoremjs/agents 0.3.0 → 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/README.md +276 -995
- package/esm/mod.d.ts +33 -19
- package/esm/mod.js +18 -11
- package/esm/src/cli/commands/bench.js +36 -14
- 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 +3 -3
- package/esm/src/cli/commands/fuzz-canary.js +55 -16
- package/esm/src/cli/commands/profile.js +4 -4
- package/esm/src/cli/commands/run.d.ts +2 -2
- package/esm/src/cli/commands/run.js +1 -1
- package/esm/src/cli/commands/test.d.ts +4 -3
- package/esm/src/cli/commands/test.js +2 -2
- package/esm/src/cli/index.js +9 -9
- package/esm/src/cli/matrix/fixtures.js +25 -30
- package/esm/src/evals/attachments.d.ts +1 -0
- package/esm/src/evals/attachments.js +4 -2
- package/esm/src/evals/breakdown.d.ts +2 -0
- package/esm/src/evals/breakdown.js +1 -0
- package/esm/src/evals/graders/answer.d.ts +3 -0
- package/esm/src/evals/graders/answer.js +1 -0
- package/esm/src/evals/graders/code.d.ts +7 -31
- package/esm/src/evals/graders/code.js +4 -25
- package/esm/src/evals/graders/judge.d.ts +4 -0
- package/esm/src/evals/graders/judge.js +7 -5
- package/esm/src/evals/graders/latency.d.ts +1 -0
- package/esm/src/evals/graders/latency.js +3 -2
- package/esm/src/evals/graders/live.d.ts +3 -0
- package/esm/src/evals/graders/live.js +2 -0
- package/esm/src/evals/graders/media.js +1 -2
- package/esm/src/evals/graders/shared.js +1 -1
- package/esm/src/evals/graders/transcript.d.ts +2 -0
- package/esm/src/evals/graders/transcript.js +5 -3
- package/esm/src/evals/mod.d.ts +1 -9
- package/esm/src/evals/mod.js +1 -9
- package/esm/src/evals/record.d.ts +6 -0
- package/esm/src/evals/record.js +4 -2
- package/esm/src/evals/rubrics/mod.d.ts +1 -1
- package/esm/src/evals/rubrics/mod.js +1 -1
- package/esm/src/evals/rubrics/mustache.js +1 -1
- package/esm/src/evals/rubrics/types.js +1 -1
- package/esm/src/evals/run.d.ts +9 -52
- package/esm/src/evals/run.js +12 -46
- package/esm/src/evals/suite.d.ts +12 -3
- package/esm/src/evals/suite.js +9 -4
- package/esm/src/evals/summary.d.ts +3 -0
- package/esm/src/evals/summary.js +1 -0
- package/esm/src/evals/trial.d.ts +3 -16
- package/esm/src/evals/trial.js +7 -30
- package/esm/src/evals/types.d.ts +30 -121
- package/esm/src/evals/types.js +3 -16
- package/esm/src/evals/verdict.d.ts +5 -0
- package/esm/src/evals/verdict.js +4 -1
- 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 +1 -0
- package/esm/src/guardrails/canary.d.ts +49 -15
- package/esm/src/guardrails/canary.js +103 -30
- package/esm/src/guardrails/compile-egress.d.ts +6 -5
- package/esm/src/guardrails/compile-egress.js +6 -5
- package/esm/src/guardrails/corpus/canary-egress-attacks.d.ts +3 -1
- package/esm/src/guardrails/corpus/canary-egress-attacks.js +4 -2
- package/esm/src/guardrails/corpus/fuzz-inbound.js +14 -17
- package/esm/src/guardrails/corpus/inbound-payloads.d.ts +2 -0
- package/esm/src/guardrails/corpus/inbound-payloads.js +4 -2
- package/esm/src/guardrails/corpus/live-attacks.d.ts +2 -0
- package/esm/src/guardrails/corpus/live-attacks.js +6 -1
- package/esm/src/guardrails/corpus/mod.d.ts +1 -1
- package/esm/src/guardrails/corpus/secrets.d.ts +3 -3
- package/esm/src/guardrails/corpus/secrets.js +2 -2
- package/esm/src/guardrails/corpus/strings.d.ts +1 -1
- package/esm/src/guardrails/corpus/strings.js +1 -1
- package/esm/src/guardrails/corpus/types.d.ts +5 -1
- 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 +4 -6
- package/esm/src/guardrails/egress-automata.js +24095 -4572
- package/esm/src/guardrails/egress-compiler.d.ts +38 -16
- package/esm/src/guardrails/egress-compiler.js +254 -60
- package/esm/src/guardrails/egress-patterns.d.ts +4 -2
- package/esm/src/guardrails/egress-patterns.js +6 -2
- package/esm/src/guardrails/egress-stream.d.ts +54 -36
- package/esm/src/guardrails/egress-stream.js +253 -124
- package/esm/src/guardrails/egress-urls.d.ts +6 -3
- package/esm/src/guardrails/egress-urls.js +14 -22
- package/esm/src/guardrails/egress.d.ts +26 -86
- package/esm/src/guardrails/egress.js +59 -309
- package/esm/src/guardrails/error.d.ts +13 -8
- package/esm/src/guardrails/error.js +23 -18
- package/esm/src/guardrails/event-schemas.d.ts +46 -3
- package/esm/src/guardrails/event-schemas.js +12 -5
- package/esm/src/guardrails/events.d.ts +5 -1
- package/esm/src/guardrails/events.js +4 -1
- package/esm/src/guardrails/hints.d.ts +14 -0
- package/esm/src/guardrails/hints.js +57 -0
- package/esm/src/guardrails/hits.d.ts +7 -1
- package/esm/src/guardrails/hits.js +12 -1
- 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 +6 -1
- package/esm/src/guardrails/injection-patterns.js +33 -1
- 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 +17 -1
- package/esm/src/guardrails/injection.js +259 -36
- 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 +9 -8
- package/esm/src/guardrails/live-outbound-gate.js +100 -107
- package/esm/src/guardrails/mod.d.ts +29 -21
- package/esm/src/guardrails/mod.js +18 -13
- package/esm/src/guardrails/network.d.ts +4 -0
- package/esm/src/guardrails/network.js +21 -19
- package/esm/src/guardrails/normalize.d.ts +15 -1
- package/esm/src/guardrails/normalize.js +34 -1
- package/esm/src/guardrails/policy.d.ts +2 -17
- package/esm/src/guardrails/policy.js +12 -41
- package/esm/src/guardrails/progressive-yield.d.ts +65 -24
- package/esm/src/guardrails/progressive-yield.js +191 -147
- package/esm/src/guardrails/prompt-echo.d.ts +4 -2
- package/esm/src/guardrails/prompt-echo.js +87 -6
- package/esm/src/guardrails/quota.d.ts +1 -0
- package/esm/src/guardrails/quota.js +1 -1
- package/esm/src/guardrails/rules.d.ts +20 -29
- package/esm/src/guardrails/rules.js +23 -30
- package/esm/src/guardrails/sanitize.d.ts +32 -15
- package/esm/src/guardrails/sanitize.js +100 -124
- 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 +16 -23
- package/esm/src/guardrails/sensitive.js +168 -47
- package/esm/src/guardrails/serialize.d.ts +1 -0
- package/esm/src/guardrails/testing.d.ts +4 -2
- package/esm/src/guardrails/testing.js +4 -2
- package/esm/src/guardrails/theorem-error.d.ts +4 -1
- package/esm/src/guardrails/theorem-error.js +3 -2
- package/esm/src/guardrails/thought-guard.d.ts +34 -13
- package/esm/src/guardrails/thought-guard.js +264 -64
- package/esm/src/guardrails/tool-directives.d.ts +29 -10
- package/esm/src/guardrails/tool-directives.js +133 -47
- 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 +45 -14
- package/esm/src/guardrails/tool-result.js +94 -70
- package/esm/src/guardrails/types.d.ts +79 -71
- package/esm/src/guardrails/types.js +11 -7
- package/esm/src/host/client-turn.d.ts +29 -2
- package/esm/src/host/client-turn.js +46 -4
- package/esm/src/host/mint-trace.d.ts +1 -0
- package/esm/src/host/mint-trace.js +3 -2
- package/esm/src/host/mod.d.ts +2 -2
- package/esm/src/host/mod.js +1 -1
- package/esm/src/host/readStreamingJsonStringField.js +2 -43
- package/esm/src/host/reply.d.ts +6 -0
- package/esm/src/host/reply.js +7 -1
- package/esm/src/interface/blocks.d.ts +3 -0
- package/esm/src/interface/blocks.js +84 -14
- package/esm/src/interface/composer-actions.d.ts +4 -0
- package/esm/src/interface/composer-actions.js +5 -3
- package/esm/src/interface/draft.d.ts +6 -0
- package/esm/src/interface/draft.js +22 -11
- package/esm/src/interface/from-profile.d.ts +13 -1
- package/esm/src/interface/from-profile.js +66 -31
- package/esm/src/interface/history.d.ts +9 -3
- package/esm/src/interface/history.js +33 -24
- package/esm/src/interface/inputs.d.ts +1 -0
- package/esm/src/interface/inputs.js +3 -0
- package/esm/src/interface/mod.d.ts +4 -2
- package/esm/src/interface/mod.js +3 -2
- package/esm/src/interface/models.d.ts +7 -0
- package/esm/src/interface/models.js +5 -0
- package/esm/src/interface/pending.d.ts +9 -0
- package/esm/src/interface/pending.js +9 -3
- package/esm/src/interface/profile-interface.js +54 -40
- package/esm/src/interface/session.d.ts +12 -5
- package/esm/src/interface/session.js +17 -10
- 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 +14 -2
- package/esm/src/interface/tool-calls.js +64 -10
- package/esm/src/interface/tool-invoke.d.ts +2 -0
- package/esm/src/interface/tool-invoke.js +3 -1
- package/esm/src/interface/tool-media.d.ts +2 -0
- package/esm/src/interface/tool-media.js +2 -1
- package/esm/src/interface/types.d.ts +105 -40
- package/esm/src/interface/types.js +1 -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/crypto.d.ts +7 -2
- package/esm/src/kernel/auth/crypto.js +12 -10
- package/esm/src/kernel/auth/oauth.d.ts +2 -1
- package/esm/src/kernel/auth/oauth.js +23 -22
- package/esm/src/kernel/auth/typed-secret.js +2 -2
- package/esm/src/kernel/auth/types.d.ts +13 -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 +43 -5
- package/esm/src/kernel/default-scope.js +54 -5
- 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 +6 -5
- package/esm/src/kernel/engine/compaction.js +12 -11
- package/esm/src/kernel/engine/decision.d.ts +10 -8
- package/esm/src/kernel/engine/decision.js +173 -146
- package/esm/src/kernel/engine/embedding.d.ts +8 -0
- package/esm/src/kernel/engine/embedding.js +118 -0
- package/esm/src/kernel/engine/live-inbound.d.ts +14 -4
- package/esm/src/kernel/engine/live-inbound.js +36 -11
- package/esm/src/kernel/engine/live-ingress.d.ts +6 -0
- package/esm/src/kernel/engine/live-ingress.js +6 -1
- package/esm/src/kernel/engine/repair.js +12 -12
- package/esm/src/kernel/engine/runner/gates.d.ts +2 -2
- package/esm/src/kernel/engine/runner/gates.js +287 -101
- package/esm/src/kernel/engine/runner/mod.d.ts +19 -5
- package/esm/src/kernel/engine/runner/mod.js +107 -56
- 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 +24 -3
- package/esm/src/kernel/engine/runner/schema-validation.js +78 -4
- package/esm/src/kernel/engine/runner/stages.d.ts +1 -1
- package/esm/src/kernel/engine/runner/stages.js +1 -8
- package/esm/src/kernel/engine/runner/state.d.ts +33 -12
- package/esm/src/kernel/engine/runner/state.js +11 -1
- 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 +2 -2
- package/esm/src/kernel/engine/runner/steps.js +328 -169
- package/esm/src/kernel/engine/runner/stream.d.ts +42 -11
- package/esm/src/kernel/engine/runner/stream.js +197 -46
- package/esm/src/kernel/engine/runner/usage.d.ts +5 -5
- package/esm/src/kernel/engine/runner/usage.js +12 -14
- package/esm/src/kernel/engine/session/mod.d.ts +8 -6
- package/esm/src/kernel/engine/session/mod.js +360 -129
- package/esm/src/kernel/engine/session/session-trace.d.ts +10 -10
- package/esm/src/kernel/engine/session/session-trace.js +41 -30
- package/esm/src/kernel/engine/token-estimate.d.ts +10 -64
- package/esm/src/kernel/engine/token-estimate.js +14 -194
- package/esm/src/kernel/engine/tool-trace.d.ts +3 -3
- package/esm/src/kernel/engine/tool-trace.js +2 -1
- package/esm/src/kernel/engine/turn-trace.d.ts +8 -7
- package/esm/src/kernel/engine/turn-trace.js +28 -36
- package/esm/src/kernel/engine/usage.d.ts +6 -0
- package/esm/src/kernel/engine/usage.js +17 -0
- package/esm/src/kernel/interaction-parts.d.ts +3 -0
- package/esm/src/kernel/interaction-parts.js +18 -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 +38 -11
- package/esm/src/kernel/mod.js +22 -7
- package/esm/src/kernel/profile-graph.d.ts +11 -6
- package/esm/src/kernel/profile-graph.js +14 -7
- package/esm/src/kernel/profile-presence.d.ts +10 -1
- package/esm/src/kernel/profile-presence.js +90 -75
- package/esm/src/kernel/profile-scope.d.ts +7 -3
- package/esm/src/kernel/profile-scope.js +67 -55
- 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 +15 -4
- package/esm/src/kernel/registry/attachments.js +31 -22
- package/esm/src/kernel/registry/catalog.d.ts +6 -0
- package/esm/src/kernel/registry/catalog.js +9 -2
- 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 +6 -2
- package/esm/src/kernel/registry/ingress.js +55 -10
- package/esm/src/kernel/registry/kernel-registry.d.ts +3 -0
- package/esm/src/kernel/registry/kernel-registry.js +9 -2
- package/esm/src/kernel/registry/profile-outputs.js +4 -1
- package/esm/src/kernel/registry/profiles.d.ts +38 -14
- package/esm/src/kernel/registry/profiles.js +280 -205
- package/esm/src/kernel/registry/provider-request.d.ts +3 -3
- package/esm/src/kernel/registry/provider-request.js +5 -13
- package/esm/src/kernel/registry/resolve.d.ts +4 -1
- package/esm/src/kernel/registry/resolve.js +59 -58
- package/esm/src/kernel/registry/schemas.d.ts +3 -0
- package/esm/src/kernel/registry/schemas.js +3 -1
- 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/system-prompt.js +7 -8
- package/esm/src/kernel/registry/vault.d.ts +14 -13
- package/esm/src/kernel/registry/vault.js +1 -14
- package/esm/src/kernel/schema.d.ts +100 -46
- package/esm/src/kernel/schema.js +499 -257
- package/esm/src/kernel/scope.d.ts +12 -5
- package/esm/src/kernel/scope.js +23 -3
- package/esm/src/kernel/stages.d.ts +38 -3
- package/esm/src/kernel/stages.js +82 -39
- package/esm/src/kernel/stop.d.ts +29 -6
- package/esm/src/kernel/stop.js +16 -4
- package/esm/src/kernel/system-parts.js +6 -6
- package/esm/src/kernel/tools/activity-label.d.ts +12 -6
- package/esm/src/kernel/tools/activity-label.js +258 -32
- 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 +21 -6
- package/esm/src/kernel/tools/events.js +53 -18
- package/esm/src/kernel/tools/execute.d.ts +47 -11
- package/esm/src/kernel/tools/execute.js +508 -136
- package/esm/src/kernel/tools/gate-answer.d.ts +12 -2
- package/esm/src/kernel/tools/gate-answer.js +17 -6
- 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 +1 -0
- package/esm/src/kernel/tools/harness.js +2 -1
- 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 +27 -5
- package/esm/src/kernel/tools/invoke.js +223 -70
- package/esm/src/kernel/tools/mcp-sessions.d.ts +4 -1
- package/esm/src/kernel/tools/mcp-sessions.js +13 -8
- package/esm/src/kernel/tools/mod.d.ts +4 -3
- package/esm/src/kernel/tools/mod.js +3 -2
- package/esm/src/kernel/tools/model-text.d.ts +10 -5
- package/esm/src/kernel/tools/model-text.js +18 -12
- 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 +11 -2
- package/esm/src/kernel/tools/permission.js +12 -12
- package/esm/src/kernel/tools/project.d.ts +4 -1
- package/esm/src/kernel/tools/project.js +32 -2
- package/esm/src/kernel/tools/registry.d.ts +9 -2
- package/esm/src/kernel/tools/registry.js +69 -10
- package/esm/src/kernel/tools/remote.d.ts +40 -6
- package/esm/src/kernel/tools/remote.js +219 -92
- package/esm/src/kernel/tools/resolve.d.ts +3 -0
- package/esm/src/kernel/tools/resolve.js +12 -4
- 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 +3 -3
- package/esm/src/kernel/tools/schema.js +21 -100
- package/esm/src/kernel/tools/signed-in-fetch.d.ts +2 -1
- package/esm/src/kernel/tools/signed-in-fetch.js +3 -3
- package/esm/src/kernel/tools/stage-run.d.ts +27 -4
- package/esm/src/kernel/tools/stage-run.js +75 -17
- package/esm/src/kernel/tools/types.d.ts +235 -25
- 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 +208 -31
- package/esm/src/kernel/turn-events.js +127 -9
- package/esm/src/kernel/types.d.ts +302 -161
- package/esm/src/kernel/util/base64.d.ts +2 -0
- package/esm/src/kernel/util/base64.js +2 -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 +1 -0
- package/esm/src/kernel/util/record.js +1 -0
- package/esm/src/observability/destinations.d.ts +5 -0
- package/esm/src/observability/destinations.js +7 -2
- package/esm/src/observability/jsonl.d.ts +2 -2
- package/esm/src/observability/jsonl.js +15 -22
- package/esm/src/observability/mod.d.ts +3 -3
- package/esm/src/observability/mod.js +2 -2
- package/esm/src/observability/openinference.d.ts +1 -1
- package/esm/src/observability/openinference.js +3 -3
- package/esm/src/observability/otlp.d.ts +3 -0
- package/esm/src/observability/otlp.js +3 -3
- package/esm/src/observability/phoenix.d.ts +1 -0
- package/esm/src/observability/policy.d.ts +3 -0
- package/esm/src/observability/policy.js +5 -1
- package/esm/src/observability/resolve-policy.js +11 -5
- package/esm/src/observability/spans.d.ts +8 -2
- package/esm/src/observability/spans.js +21 -5
- package/esm/src/observability/trace-catalog.d.ts +19 -2
- package/esm/src/observability/trace-catalog.js +128 -87
- package/esm/src/observability/trace-record.js +22 -17
- package/esm/src/observability/trace-schema.d.ts +3 -0
- package/esm/src/observability/trace-schema.js +1 -1
- package/esm/src/observability/trace-sink.d.ts +1 -0
- package/esm/src/observability/trace-sink.js +1 -1
- package/esm/src/observability/trace-span.d.ts +7 -1
- package/esm/src/observability/trace-span.js +3 -1
- package/esm/src/observability/trace.d.ts +2 -0
- package/esm/src/observability/trace.js +4 -2
- package/esm/src/observability/types.d.ts +35 -11
- package/esm/src/observability/types.js +1 -1
- package/esm/src/presets/google/speech-voices.d.ts +1 -0
- package/esm/src/presets/google-limits.d.ts +1 -0
- package/esm/src/presets/google.d.ts +27 -12
- package/esm/src/presets/google.js +34 -25
- package/esm/src/presets/local.d.ts +26 -0
- package/esm/src/presets/local.js +30 -0
- package/esm/src/presets/mod.d.ts +5 -4
- package/esm/src/presets/mod.js +4 -4
- package/esm/src/presets/openrouter.d.ts +14 -1
- package/esm/src/presets/openrouter.js +19 -1
- 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/builtins.d.ts +14 -0
- package/esm/src/providers/google/builtins.js +57 -0
- package/esm/src/providers/google/grounding.d.ts +4 -4
- package/esm/src/providers/google/interactions/framing.d.ts +20 -8
- package/esm/src/providers/google/interactions/framing.js +85 -44
- package/esm/src/providers/google/interactions/steps.d.ts +5 -5
- package/esm/src/providers/google/interactions/steps.js +4 -4
- package/esm/src/providers/google/interactions/stream.d.ts +10 -11
- package/esm/src/providers/google/interactions/stream.js +33 -100
- package/esm/src/providers/google/live/framing.d.ts +15 -5
- package/esm/src/providers/google/live/framing.js +25 -25
- package/esm/src/providers/google/live/stream.d.ts +6 -44
- package/esm/src/providers/google/live/stream.js +3 -209
- package/esm/src/providers/google/urls.d.ts +1 -3
- package/esm/src/providers/google/urls.js +1 -3
- package/esm/src/providers/google/usage.js +2 -2
- 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 +28 -7
- package/esm/src/providers/mod.js +19 -3
- 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 +0 -9
- package/esm/src/providers/openrouter/image.js +0 -153
- 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 +2 -2
- package/esm/src/providers/openrouter/openai/compat.js +6 -6
- package/esm/src/providers/openrouter/openai/image-payload.d.ts +2 -2
- 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/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.js +2 -2
- 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 +2 -2
- 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 +0 -4
- package/esm/src/providers/shared/sse.js +50 -36
- package/esm/src/providers/shared/tool-args.d.ts +6 -7
- package/esm/src/providers/shared/tool-args.js +10 -6
- 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 +2 -2
- package/esm/src/providers/shared/upstream-tape.js +1 -1
- 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 +48 -16
- package/esm/src/providers/types.js +2 -1
- 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 +19 -1
- package/esm/src/surface/formats.js +68 -29
- package/esm/src/surface/mod.d.ts +4 -2
- package/esm/src/surface/mod.js +4 -2
- package/esm/src/surface/runtime.d.ts +4 -0
- package/esm/src/surface/runtime.js +2 -0
- package/esm/src/surface/tools.d.ts +2 -8
- package/esm/src/surface/tools.js +4 -22
- package/esm/src/surface/types.d.ts +6 -0
- package/package.json +5 -13
- package/esm/src/cli/commands/egress-compile.d.ts +0 -17
- package/esm/src/cli/commands/egress-compile.js +0 -25
- package/esm/src/guardrails/egress-policy.d.ts +0 -27
- package/esm/src/guardrails/egress-policy.js +0 -76
- package/esm/src/guardrails/egress-rules.d.ts +0 -54
- package/esm/src/guardrails/egress-rules.js +0 -49
- package/esm/src/guardrails/lexicon.d.ts +0 -30
- package/esm/src/guardrails/lexicon.js +0 -478
- package/esm/src/kernel/engine/media-probe/audio.d.ts +0 -7
- package/esm/src/kernel/engine/media-probe/audio.js +0 -342
- package/esm/src/kernel/engine/media-probe/bytes.d.ts +0 -6
- package/esm/src/kernel/engine/media-probe/bytes.js +0 -26
- package/esm/src/kernel/engine/media-probe/image.d.ts +0 -5
- package/esm/src/kernel/engine/media-probe/image.js +0 -171
- package/esm/src/kernel/engine/media-probe/iso-bmff.d.ts +0 -19
- package/esm/src/kernel/engine/media-probe/iso-bmff.js +0 -48
- package/esm/src/kernel/engine/media-probe/matroska.d.ts +0 -35
- package/esm/src/kernel/engine/media-probe/matroska.js +0 -226
- package/esm/src/kernel/engine/media-probe/mp4.d.ts +0 -22
- package/esm/src/kernel/engine/media-probe/mp4.js +0 -279
- package/esm/src/kernel/engine/media-probe/opus.d.ts +0 -4
- package/esm/src/kernel/engine/media-probe/opus.js +0 -23
- package/esm/src/kernel/engine/media-probe/pdf.d.ts +0 -5
- package/esm/src/kernel/engine/media-probe/pdf.js +0 -117
- package/esm/src/kernel/engine/media-probe/video.d.ts +0 -15
- package/esm/src/kernel/engine/media-probe/video.js +0 -49
- package/esm/src/presets/typesafe.d.ts +0 -2
- package/esm/src/presets/typesafe.js +0 -2
- package/esm/src/providers/create-provider.d.ts +0 -21
- package/esm/src/providers/create-provider.js +0 -90
- package/esm/src/providers/decision/usage.d.ts +0 -3
- package/esm/src/providers/decision/usage.js +0 -25
- package/esm/src/providers/google/interactions/mod.d.ts +0 -2
- package/esm/src/providers/google/interactions/mod.js +0 -2
- package/esm/src/providers/google/keys.d.ts +0 -20
- package/esm/src/providers/google/keys.js +0 -87
- package/esm/src/providers/google/live/mod.d.ts +0 -7
- package/esm/src/providers/google/live/mod.js +0 -7
- package/esm/src/providers/google/live/openapi-schema.d.ts +0 -1
- package/esm/src/providers/google/live/openapi-schema.js +0 -42
- package/esm/src/providers/google/live/session.d.ts +0 -14
- package/esm/src/providers/google/live/session.js +0 -150
- package/esm/src/providers/local/local.d.ts +0 -12
- package/esm/src/providers/local/local.js +0 -186
- package/esm/src/providers/local/mod.d.ts +0 -8
- package/esm/src/providers/local/mod.js +0 -8
- package/esm/src/providers/openrouter/cache-control.d.ts +0 -5
- package/esm/src/providers/openrouter/cache-control.js +0 -4
- package/esm/src/providers/openrouter/chat.d.ts +0 -64
- package/esm/src/providers/openrouter/chat.js +0 -490
- package/esm/src/providers/openrouter/openai/sdk-messages.d.ts +0 -10
- package/esm/src/providers/openrouter/openai/sdk-messages.js +0 -99
- package/esm/src/providers/openrouter/resolve-api-key.d.ts +0 -3
- package/esm/src/providers/openrouter/resolve-api-key.js +0 -8
- package/esm/src/providers/openrouter/speech.d.ts +0 -18
- package/esm/src/providers/openrouter/speech.js +0 -109
- package/esm/src/providers/probe.d.ts +0 -5
- package/esm/src/providers/probe.js +0 -15
- package/esm/src/providers/shared/builtin-wire.d.ts +0 -4
- package/esm/src/providers/shared/builtin-wire.js +0 -9
- package/esm/src/providers/shared/vault.d.ts +0 -13
- package/esm/src/providers/shared/vault.js +0 -41
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Content is held in memory as markers the record builder resolves: `$content` is scrubbed, hashed
|
|
1
|
+
// invariant: Content is held in memory as markers the record builder resolves: `$content` is scrubbed, hashed
|
|
2
2
|
// and moved into `TraceRecord.content`; `$bytes` is hashed and never stored; `$json` has media
|
|
3
3
|
// hashed and strings equal to recorded content replaced by their hash.
|
|
4
4
|
import { TheoremError } from '../guardrails/error.js';
|
|
@@ -57,9 +57,11 @@ function parseTraceparent(value) {
|
|
|
57
57
|
function formatTraceparent(traceId, spanId) {
|
|
58
58
|
return `00-${traceId}-${spanId}-${SAMPLED_FLAGS}`;
|
|
59
59
|
}
|
|
60
|
+
/** Marks text as message content, which the trace stores by hash. */
|
|
60
61
|
function traceContent(text) {
|
|
61
62
|
return { $content: text };
|
|
62
63
|
}
|
|
64
|
+
/** Marks base64 data as bytes, which the trace stores by hash. */
|
|
63
65
|
function traceBytes(base64) {
|
|
64
66
|
return { $bytes: base64 };
|
|
65
67
|
}
|
|
@@ -6,6 +6,8 @@ import type { ResolvedObservabilityPolicy } from './types.js';
|
|
|
6
6
|
declare function writeTrace(sink: TraceSink, record: Promise<TraceRecord>, policy: ResolvedObservabilityPolicy): Promise<void>;
|
|
7
7
|
/** Like `writeTrace`, it never fails the caller. */
|
|
8
8
|
declare function writeSpans(sink: TraceSink, spans: TraceSpan[], policy: ResolvedObservabilityPolicy, metadata?: Record<string, unknown>): Promise<void>;
|
|
9
|
+
/** A sink that discards every record. */
|
|
9
10
|
declare function noopSink(): TraceSink;
|
|
11
|
+
/** A sink that appends each trace record to the given array. */
|
|
10
12
|
declare function memorySink(into: TraceRecord[]): TraceSink;
|
|
11
13
|
export { memorySink, noopSink, writeSpans, writeTrace };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Tracing is host-injected: THEOREM reads no environment variables and owns no database sink.
|
|
1
|
+
// invariant: Tracing is host-injected: THEOREM reads no environment variables and owns no database sink.
|
|
2
2
|
import { buildRecord } from './trace-record.js';
|
|
3
3
|
/** Trace failures never fail the turn: build and write errors go to `sink.onError`, if set. */
|
|
4
4
|
async function writeTrace(sink, record, policy) {
|
|
@@ -13,7 +13,7 @@ async function writeTrace(sink, record, policy) {
|
|
|
13
13
|
sink.onError?.(err);
|
|
14
14
|
}
|
|
15
15
|
catch {
|
|
16
|
-
// Host onError must not fail the turn.
|
|
16
|
+
// why: Host onError must not fail the turn.
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -21,9 +21,11 @@ async function writeTrace(sink, record, policy) {
|
|
|
21
21
|
function writeSpans(sink, spans, policy, metadata) {
|
|
22
22
|
return writeTrace(sink, buildRecord({ spans, policy, ...(metadata ? { metadata } : {}) }), policy);
|
|
23
23
|
}
|
|
24
|
+
/** A sink that discards every record. */
|
|
24
25
|
function noopSink() {
|
|
25
26
|
return { write: () => Promise.resolve() };
|
|
26
27
|
}
|
|
28
|
+
/** A sink that appends each trace record to the given array. */
|
|
27
29
|
function memorySink(into) {
|
|
28
30
|
return {
|
|
29
31
|
write: (record) => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ResolvedDetect } from '../guardrails/detectors.js';
|
|
1
2
|
import type { TraceSink } from './trace-sink.js';
|
|
2
3
|
import type { TraceAttributes } from './trace-span.js';
|
|
3
4
|
/** Which payloads land in each TraceRecord. Omitted keys use resolved defaults. */
|
|
@@ -18,14 +19,27 @@ export interface TraceIncludeSpec {
|
|
|
18
19
|
*/
|
|
19
20
|
guardrailMatchPreview?: boolean;
|
|
20
21
|
}
|
|
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
|
+
*/
|
|
22
36
|
export interface TraceScrubSpec {
|
|
23
|
-
/**
|
|
24
|
-
sensitive?:
|
|
25
|
-
/**
|
|
26
|
-
injection?:
|
|
27
|
-
/** Never persist the canary token. Default: true. */
|
|
28
|
-
canary?:
|
|
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;
|
|
29
43
|
}
|
|
30
44
|
/** Omit the whole block for no tracing. */
|
|
31
45
|
export interface ProfileObservabilitySpec {
|
|
@@ -42,7 +56,7 @@ export interface ProfileObservabilitySpec {
|
|
|
42
56
|
include?: TraceIncludeSpec;
|
|
43
57
|
/** Stamped on every record as `TraceRecord.resource`, e.g. `{ 'service.name': 'harbor' }`. */
|
|
44
58
|
resource?: TraceAttributes;
|
|
45
|
-
/** Defaults stay on even when `guardrails.
|
|
59
|
+
/** Defaults stay on even when `guardrails.detect` is `ignore`. */
|
|
46
60
|
scrub?: TraceScrubSpec;
|
|
47
61
|
/**
|
|
48
62
|
* Days to keep each record, handed to every destination with the record
|
|
@@ -58,6 +72,7 @@ export interface ProfileObservabilitySpec {
|
|
|
58
72
|
/** Called when record build or destination write fails. Must not throw. */
|
|
59
73
|
onWriteError?: (err: unknown) => void;
|
|
60
74
|
}
|
|
75
|
+
/** Which optional content a trace record includes, each on or off. */
|
|
61
76
|
export interface ResolvedTraceInclude {
|
|
62
77
|
upstreamLog: boolean;
|
|
63
78
|
outboundWire: boolean;
|
|
@@ -66,11 +81,18 @@ export interface ResolvedTraceInclude {
|
|
|
66
81
|
guardrailDecisions: boolean;
|
|
67
82
|
guardrailMatchPreview: boolean;
|
|
68
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. */
|
|
69
90
|
export interface ResolvedTraceScrub {
|
|
70
|
-
sensitive:
|
|
71
|
-
injection:
|
|
72
|
-
canary:
|
|
91
|
+
sensitive: ResolvedScrubSwitch;
|
|
92
|
+
injection: ResolvedScrubSwitch;
|
|
93
|
+
canary: ResolvedScrubSwitch;
|
|
73
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. */
|
|
74
96
|
export interface ResolvedObservabilityPolicy {
|
|
75
97
|
/** False when the block is omitted or `writeTo` is `false`/absent. Sampling applies at write. */
|
|
76
98
|
record: boolean;
|
|
@@ -78,6 +100,8 @@ export interface ResolvedObservabilityPolicy {
|
|
|
78
100
|
sampleRate: number;
|
|
79
101
|
include: ResolvedTraceInclude;
|
|
80
102
|
scrub: ResolvedTraceScrub;
|
|
103
|
+
/** The profile's detectors, whose patterns clean the record. Absent, Theorem's patterns alone. */
|
|
104
|
+
detect?: ResolvedDetect;
|
|
81
105
|
resource: TraceAttributes;
|
|
82
106
|
retainForDays: number;
|
|
83
107
|
rotateAfterMiB: number;
|
|
@@ -5,4 +5,5 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import "../../../_dnt.polyfills.js";
|
|
7
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. */
|
|
8
9
|
export type GoogleSpeechVoice = (typeof GOOGLE_SPEECH_VOICES)[number];
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
declare const GOOGLE_THINKING_LEVELS: readonly ["minimal", "low", "medium", "high"];
|
|
3
3
|
/** The audio format Gemini speech returns (PCM, wrapped as WAV); OpenRouter speech also takes `mp3`. */
|
|
4
4
|
declare const GOOGLE_SPEECH_FORMATS: readonly ["pcm"];
|
|
5
|
+
/** A thinking level Gemini takes: minimal, low, medium, or high. */
|
|
5
6
|
type GoogleThinkingLevel = (typeof GOOGLE_THINKING_LEVELS)[number];
|
|
6
7
|
/**
|
|
7
8
|
* A `geminiInteractions` or `geminiLive` binding's `efforts`, typed to the levels Gemini takes.
|
|
@@ -7,7 +7,9 @@ import "../../_dnt.polyfills.js";
|
|
|
7
7
|
import type { ModelBinding, ProfileImageSpec, ProfileLiveSpec, ProfileSpeechSpec } from '../kernel/types.js';
|
|
8
8
|
import { GOOGLE_SPEECH_VOICES, type GoogleSpeechVoice } from './google/speech-voices.js';
|
|
9
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. */
|
|
10
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. */
|
|
11
13
|
declare const GOOGLE_VOICE_INPUT_MIMES: readonly ["audio/webm", "audio/wav", "audio/mpeg", "audio/mp4"];
|
|
12
14
|
/**
|
|
13
15
|
* TTS models that reject any history with a model turn, so compaction's summary fails them
|
|
@@ -18,7 +20,13 @@ declare const GOOGLE_SINGLE_TURN_API_IDS: readonly ["gemini-2.5-flash-preview-tt
|
|
|
18
20
|
* Models that reject any thinking setting, `summaries: false` included: leave
|
|
19
21
|
* `efforts` and `summaries` unset (live, 30/09/2026).
|
|
20
22
|
*/
|
|
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"
|
|
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"];
|
|
22
30
|
/**
|
|
23
31
|
* Models that refuse a session without a thinking level: pin `efforts`
|
|
24
32
|
* (live, 01/10/2026: Live closes 1007 "Thinking level must be specified for this model").
|
|
@@ -31,12 +39,15 @@ interface GoogleFreeTierGrounding {
|
|
|
31
39
|
}
|
|
32
40
|
/**
|
|
33
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).
|
|
34
44
|
* A builtin with no quota is refused as if over quota: on Live, a close 1011 "You exceeded your
|
|
35
45
|
* current quota" at setup, whatever the key's usage (live, 01/10/2026).
|
|
36
46
|
*/
|
|
37
47
|
declare const GOOGLE_FREE_TIER_GROUNDING: Readonly<Record<string, GoogleFreeTierGrounding>>;
|
|
38
48
|
/** Grounding builtins the free tier allows on `apiId`; none for a model with no free quota. */
|
|
39
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. */
|
|
40
51
|
interface GoogleBindingViolation {
|
|
41
52
|
field: 'apiId' | 'efforts' | 'summaries' | 'builtInTools';
|
|
42
53
|
message: string;
|
|
@@ -49,26 +60,37 @@ interface GoogleBindingViolation {
|
|
|
49
60
|
declare function googleBindingViolation(binding: Pick<ModelBinding, 'apiId' | 'efforts' | 'summaries' | 'builtInTools'>, options?: {
|
|
50
61
|
freeTier?: boolean;
|
|
51
62
|
}): GoogleBindingViolation | undefined;
|
|
63
|
+
/** The speech settings a Gemini profile may pin, with the voice narrowed to Gemini's. */
|
|
52
64
|
type GoogleSpeechPins = Omit<ProfileSpeechSpec, 'voice'> & {
|
|
53
65
|
voice?: GoogleSpeechVoice;
|
|
54
66
|
};
|
|
67
|
+
/** The live settings a Gemini profile may pin, with the voice narrowed to Gemini's. */
|
|
55
68
|
type GoogleLivePins = Omit<ProfileLiveSpec, 'voice'> & {
|
|
56
69
|
voice?: GoogleSpeechVoice;
|
|
57
70
|
};
|
|
71
|
+
/** The aspect ratios a Gemini image model can return. */
|
|
58
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. */
|
|
59
74
|
declare const GOOGLE_IMAGE_RESOLUTIONS: readonly ["1K", "2K", "4K"];
|
|
60
75
|
/** What a Gemini image model can be asked to return. */
|
|
61
76
|
declare const GOOGLE_IMAGE_OUTPUT_MIMES: readonly ["image/png", "image/jpeg"];
|
|
77
|
+
/** One of {@linkcode GOOGLE_IMAGE_INPUT_MIMES}. */
|
|
62
78
|
type GoogleImageInputMime = (typeof GOOGLE_IMAGE_INPUT_MIMES)[number];
|
|
79
|
+
/** One of {@linkcode GOOGLE_VOICE_INPUT_MIMES}. */
|
|
63
80
|
type GoogleVoiceInputMime = (typeof GOOGLE_VOICE_INPUT_MIMES)[number];
|
|
81
|
+
/** One of {@linkcode GOOGLE_IMAGE_ASPECT_RATIOS}. */
|
|
64
82
|
type GoogleImageAspectRatio = (typeof GOOGLE_IMAGE_ASPECT_RATIOS)[number];
|
|
83
|
+
/** One of {@linkcode GOOGLE_IMAGE_RESOLUTIONS}. */
|
|
65
84
|
type GoogleImageResolution = (typeof GOOGLE_IMAGE_RESOLUTIONS)[number];
|
|
85
|
+
/** One of {@linkcode GOOGLE_IMAGE_OUTPUT_MIMES}. */
|
|
66
86
|
type GoogleImageOutputMime = (typeof GOOGLE_IMAGE_OUTPUT_MIMES)[number];
|
|
87
|
+
/** The image settings a Gemini profile may pin, narrowed to what Gemini accepts. */
|
|
67
88
|
type GoogleImagePins = Omit<ProfileImageSpec, 'aspectRatio' | 'resolution' | 'mimeType'> & {
|
|
68
89
|
aspectRatio?: GoogleImageAspectRatio;
|
|
69
90
|
resolution?: GoogleImageResolution;
|
|
70
91
|
mimeType?: GoogleImageOutputMime;
|
|
71
92
|
};
|
|
93
|
+
/** The tools Gemini runs itself, as `builtin` tool definitions. */
|
|
72
94
|
declare const GOOGLE_BUILTIN_TOOLS: ({
|
|
73
95
|
type: "builtin";
|
|
74
96
|
name: string;
|
|
@@ -78,11 +100,7 @@ declare const GOOGLE_BUILTIN_TOOLS: ({
|
|
|
78
100
|
paths: string[];
|
|
79
101
|
loadTier: "T0";
|
|
80
102
|
permission: "auto";
|
|
81
|
-
|
|
82
|
-
interactions: string;
|
|
83
|
-
openRouter: string;
|
|
84
|
-
live: string;
|
|
85
|
-
};
|
|
103
|
+
conflictsWith?: undefined;
|
|
86
104
|
} | {
|
|
87
105
|
type: "builtin";
|
|
88
106
|
name: string;
|
|
@@ -92,13 +110,10 @@ declare const GOOGLE_BUILTIN_TOOLS: ({
|
|
|
92
110
|
paths: string[];
|
|
93
111
|
loadTier: "T0";
|
|
94
112
|
permission: "auto";
|
|
95
|
-
|
|
96
|
-
interactions: string;
|
|
97
|
-
live: string;
|
|
98
|
-
openRouter?: undefined;
|
|
99
|
-
};
|
|
113
|
+
conflictsWith: string[];
|
|
100
114
|
})[];
|
|
101
115
|
/** Registers into the default scope; a scope of its own takes `GOOGLE_BUILTIN_TOOLS`. */
|
|
102
116
|
declare function registerGooglePreset(): void;
|
|
117
|
+
export { GEMINI_MODELS_URL } from '../providers/google/urls.js';
|
|
103
118
|
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, };
|
|
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, };
|
|
@@ -7,6 +7,7 @@ import "../../_dnt.polyfills.js";
|
|
|
7
7
|
import { registerTools } from '../kernel/default-scope.js';
|
|
8
8
|
import { GOOGLE_SPEECH_VOICES } from './google/speech-voices.js';
|
|
9
9
|
import { GOOGLE_SPEECH_FORMATS, GOOGLE_THINKING_LEVELS, googleEfforts, } from './google-limits.js';
|
|
10
|
+
/** The image MIME types a Gemini profile can take as input. */
|
|
10
11
|
const GOOGLE_IMAGE_INPUT_MIMES = [
|
|
11
12
|
'image/png',
|
|
12
13
|
'image/jpeg',
|
|
@@ -14,6 +15,7 @@ const GOOGLE_IMAGE_INPUT_MIMES = [
|
|
|
14
15
|
'image/heic',
|
|
15
16
|
'image/heif',
|
|
16
17
|
];
|
|
18
|
+
/** The audio MIME types a Gemini profile can take as voice input. */
|
|
17
19
|
const GOOGLE_VOICE_INPUT_MIMES = ['audio/webm', 'audio/wav', 'audio/mpeg', 'audio/mp4'];
|
|
18
20
|
/**
|
|
19
21
|
* TTS models that reject any history with a model turn, so compaction's summary fails them
|
|
@@ -34,9 +36,13 @@ const GOOGLE_NO_THINKING_API_IDS = [
|
|
|
34
36
|
'antigravity-preview-05-2026',
|
|
35
37
|
'antigravity-preview-09-2026',
|
|
36
38
|
'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
39
|
];
|
|
40
|
+
/**
|
|
41
|
+
* Models that refuse a thinking level and take `summaries`: leave `efforts` unset
|
|
42
|
+
* (live, 01/10/2026: Live closes 1007 "Thinking level is not supported for this model";
|
|
43
|
+
* 04/10/2026: setup takes `includeThoughts` either way).
|
|
44
|
+
*/
|
|
45
|
+
const GOOGLE_NO_EFFORT_API_IDS = ['gemini-3.8-live'];
|
|
40
46
|
/**
|
|
41
47
|
* Models that refuse a session without a thinking level: pin `efforts`
|
|
42
48
|
* (live, 01/10/2026: Live closes 1007 "Thinking level must be specified for this model").
|
|
@@ -48,18 +54,20 @@ const grounding = (googleSearch, googleMaps) => ({
|
|
|
48
54
|
});
|
|
49
55
|
/**
|
|
50
56
|
* Models with a non-zero free-tier quota, and the grounding each allows (AI Studio, Sep 2026).
|
|
57
|
+
* No model keeps free Maps quota: 3.5 Flash-Lite turns with Maps are refused as over quota
|
|
58
|
+
* (live, 13/10/2026).
|
|
51
59
|
* A builtin with no quota is refused as if over quota: on Live, a close 1011 "You exceeded your
|
|
52
60
|
* current quota" at setup, whatever the key's usage (live, 01/10/2026).
|
|
53
61
|
*/
|
|
54
62
|
const GOOGLE_FREE_TIER_GROUNDING = {
|
|
55
|
-
'gemini-2.5-flash-lite': grounding(true,
|
|
56
|
-
'gemini-2.5-flash': grounding(true,
|
|
63
|
+
'gemini-2.5-flash-lite': grounding(true, false),
|
|
64
|
+
'gemini-2.5-flash': grounding(true, false),
|
|
57
65
|
'gemini-2.5-flash-preview-tts': grounding(true, false),
|
|
58
66
|
'gemini-3-flash-preview': grounding(false, false),
|
|
59
|
-
'gemini-3.1-flash-lite': grounding(false,
|
|
67
|
+
'gemini-3.1-flash-lite': grounding(false, false),
|
|
60
68
|
'gemini-3.1-flash-lite-image': grounding(false, false),
|
|
61
|
-
'gemini-3.1-flash-tts-preview': grounding(false,
|
|
62
|
-
'gemini-3.5-flash-lite': grounding(false,
|
|
69
|
+
'gemini-3.1-flash-tts-preview': grounding(false, false),
|
|
70
|
+
'gemini-3.5-flash-lite': grounding(false, false),
|
|
63
71
|
'gemini-3.5-flash': grounding(false, false),
|
|
64
72
|
'gemini-3.6-flash': grounding(false, false),
|
|
65
73
|
'gemini-3.7-flash': grounding(false, false),
|
|
@@ -89,20 +97,19 @@ function pinsEffort(binding) {
|
|
|
89
97
|
function googleBindingViolation(binding, options = {}) {
|
|
90
98
|
const apiId = binding.apiId.trim();
|
|
91
99
|
const noThinking = GOOGLE_NO_THINKING_API_IDS;
|
|
100
|
+
const noEffort = GOOGLE_NO_EFFORT_API_IDS;
|
|
92
101
|
const thinkingRequired = GOOGLE_THINKING_REQUIRED_API_IDS;
|
|
93
|
-
if (noThinking.includes(apiId)) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
};
|
|
105
|
-
}
|
|
102
|
+
if ((noThinking.includes(apiId) || noEffort.includes(apiId)) && pinsEffort(binding)) {
|
|
103
|
+
return {
|
|
104
|
+
field: 'efforts',
|
|
105
|
+
message: `${apiId} takes no thinking level; leave efforts unset.`,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
if (noThinking.includes(apiId) && binding.summaries !== undefined) {
|
|
109
|
+
return {
|
|
110
|
+
field: 'summaries',
|
|
111
|
+
message: `${apiId} takes no thinking setting; leave summaries unset.`,
|
|
112
|
+
};
|
|
106
113
|
}
|
|
107
114
|
if (thinkingRequired.includes(apiId) && !pinsEffort(binding)) {
|
|
108
115
|
return { field: 'efforts', message: `${apiId} needs a thinking level; pin efforts.` };
|
|
@@ -120,6 +127,7 @@ function googleBindingViolation(binding, options = {}) {
|
|
|
120
127
|
}
|
|
121
128
|
return undefined;
|
|
122
129
|
}
|
|
130
|
+
/** The aspect ratios a Gemini image model can return. */
|
|
123
131
|
const GOOGLE_IMAGE_ASPECT_RATIOS = [
|
|
124
132
|
'1:1',
|
|
125
133
|
'3:2',
|
|
@@ -132,9 +140,11 @@ const GOOGLE_IMAGE_ASPECT_RATIOS = [
|
|
|
132
140
|
'16:9',
|
|
133
141
|
'21:9',
|
|
134
142
|
];
|
|
143
|
+
/** The resolutions a Gemini image model can return. */
|
|
135
144
|
const GOOGLE_IMAGE_RESOLUTIONS = ['1K', '2K', '4K'];
|
|
136
145
|
/** What a Gemini image model can be asked to return. */
|
|
137
146
|
const GOOGLE_IMAGE_OUTPUT_MIMES = ['image/png', 'image/jpeg'];
|
|
147
|
+
/** The tools Gemini runs itself, as `builtin` tool definitions. */
|
|
138
148
|
const GOOGLE_BUILTIN_TOOLS = [
|
|
139
149
|
{
|
|
140
150
|
type: 'builtin',
|
|
@@ -145,7 +155,6 @@ const GOOGLE_BUILTIN_TOOLS = [
|
|
|
145
155
|
paths: ['*'],
|
|
146
156
|
loadTier: 'T0',
|
|
147
157
|
permission: 'auto',
|
|
148
|
-
wire: { interactions: 'google_search', openRouter: 'web', live: 'googleSearch' },
|
|
149
158
|
},
|
|
150
159
|
{
|
|
151
160
|
type: 'builtin',
|
|
@@ -156,7 +165,8 @@ const GOOGLE_BUILTIN_TOOLS = [
|
|
|
156
165
|
paths: ['*'],
|
|
157
166
|
loadTier: 'T0',
|
|
158
167
|
permission: 'auto',
|
|
159
|
-
|
|
168
|
+
// why: Google refuses a request that carries Maps with Search or URL context.
|
|
169
|
+
conflictsWith: ['googleSearch', 'urlContext'],
|
|
160
170
|
},
|
|
161
171
|
{
|
|
162
172
|
type: 'builtin',
|
|
@@ -167,7 +177,6 @@ const GOOGLE_BUILTIN_TOOLS = [
|
|
|
167
177
|
paths: ['*'],
|
|
168
178
|
loadTier: 'T0',
|
|
169
179
|
permission: 'auto',
|
|
170
|
-
wire: { interactions: 'url_context', live: 'urlContext' },
|
|
171
180
|
},
|
|
172
181
|
{
|
|
173
182
|
type: 'builtin',
|
|
@@ -178,11 +187,11 @@ const GOOGLE_BUILTIN_TOOLS = [
|
|
|
178
187
|
paths: ['*'],
|
|
179
188
|
loadTier: 'T0',
|
|
180
189
|
permission: 'auto',
|
|
181
|
-
wire: { interactions: 'code_execution', live: 'codeExecution' },
|
|
182
190
|
},
|
|
183
191
|
];
|
|
184
192
|
/** Registers into the default scope; a scope of its own takes `GOOGLE_BUILTIN_TOOLS`. */
|
|
185
193
|
function registerGooglePreset() {
|
|
186
194
|
registerTools(GOOGLE_BUILTIN_TOOLS);
|
|
187
195
|
}
|
|
188
|
-
export {
|
|
196
|
+
export { GEMINI_MODELS_URL } from '../providers/google/urls.js';
|
|
197
|
+
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, };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local model convenience preset.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import type { ModelBinding } from '../kernel/types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Whether an Ollama model thinks, read from the server's `POST /api/show` reply for it:
|
|
9
|
+
* `capabilities` lists `thinking` (Ollama 0.34.0, 04/10/2026). The host fetches the reply.
|
|
10
|
+
*/
|
|
11
|
+
declare function ollamaModelThinks(show: unknown): boolean;
|
|
12
|
+
/** A local binding field its model would refuse, and what is wrong with it. */
|
|
13
|
+
interface LocalBindingViolation {
|
|
14
|
+
field: 'efforts';
|
|
15
|
+
message: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The first setting a local server would refuse on this binding, or `undefined`. A thinking
|
|
19
|
+
* level goes to the server as `reasoning_effort`; Ollama answers HTTP 400 "does not support
|
|
20
|
+
* thinking" for a model that does not think (04/10/2026).
|
|
21
|
+
*/
|
|
22
|
+
declare function localBindingViolation(binding: Pick<ModelBinding, 'apiId' | 'efforts'>, model: {
|
|
23
|
+
thinks: boolean;
|
|
24
|
+
}): LocalBindingViolation | undefined;
|
|
25
|
+
export type { LocalBindingViolation };
|
|
26
|
+
export { localBindingViolation, ollamaModelThinks };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local model convenience preset.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Whether an Ollama model thinks, read from the server's `POST /api/show` reply for it:
|
|
8
|
+
* `capabilities` lists `thinking` (Ollama 0.34.0, 04/10/2026). The host fetches the reply.
|
|
9
|
+
*/
|
|
10
|
+
function ollamaModelThinks(show) {
|
|
11
|
+
if (!show || typeof show !== 'object')
|
|
12
|
+
return false;
|
|
13
|
+
const { capabilities } = show;
|
|
14
|
+
return Array.isArray(capabilities) && capabilities.includes('thinking');
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The first setting a local server would refuse on this binding, or `undefined`. A thinking
|
|
18
|
+
* level goes to the server as `reasoning_effort`; Ollama answers HTTP 400 "does not support
|
|
19
|
+
* thinking" for a model that does not think (04/10/2026).
|
|
20
|
+
*/
|
|
21
|
+
function localBindingViolation(binding, model) {
|
|
22
|
+
if (!model.thinks && Object.keys(binding.efforts ?? {}).length > 0) {
|
|
23
|
+
return {
|
|
24
|
+
field: 'efforts',
|
|
25
|
+
message: `${binding.apiId.trim()} does not think; leave efforts unset.`,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
export { localBindingViolation, ollamaModelThinks };
|
package/esm/src/presets/mod.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Host-convenience catalogs for first-party providers: provider builtins and media vocabularies.
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import "../../_dnt.polyfills.js";
|
|
7
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 {
|
|
10
|
-
export {
|
|
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_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, } from './google.js';
|
|
9
|
+
export type { LocalBindingViolation } from './local.js';
|
|
10
|
+
export { localBindingViolation, ollamaModelThinks } from './local.js';
|
|
11
|
+
export { OPENROUTER_BUILTIN_TOOLS, OPENROUTER_IMAGES_IGNORED_INPUTS, OPENROUTER_IMAGES_INPUT_MIMES, registerOpenRouterPreset, } from './openrouter.js';
|
package/esm/src/presets/mod.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Host-convenience catalogs for first-party providers: provider builtins and media vocabularies.
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
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 {
|
|
9
|
-
export {
|
|
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_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, } from './google.js';
|
|
8
|
+
export { localBindingViolation, ollamaModelThinks } from './local.js';
|
|
9
|
+
export { OPENROUTER_BUILTIN_TOOLS, OPENROUTER_IMAGES_IGNORED_INPUTS, OPENROUTER_IMAGES_INPUT_MIMES, registerOpenRouterPreset, } from './openrouter.js';
|
|
@@ -10,4 +10,17 @@ declare const OPENROUTER_IMAGES_INPUT_MIMES: readonly ["image/*"];
|
|
|
10
10
|
* only. The chat path (`image.includeText`) sends the system prompt and history.
|
|
11
11
|
*/
|
|
12
12
|
declare const OPENROUTER_IMAGES_IGNORED_INPUTS: readonly ["system", "history"];
|
|
13
|
-
|
|
13
|
+
/** The tools OpenRouter runs itself, as `builtin` tool definitions. */
|
|
14
|
+
declare const OPENROUTER_BUILTIN_TOOLS: {
|
|
15
|
+
type: "builtin";
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
category: string;
|
|
19
|
+
access: "read-only";
|
|
20
|
+
paths: string[];
|
|
21
|
+
loadTier: "T0";
|
|
22
|
+
permission: "auto";
|
|
23
|
+
}[];
|
|
24
|
+
/** Registers into the default scope; a scope of its own takes `OPENROUTER_BUILTIN_TOOLS`. */
|
|
25
|
+
declare function registerOpenRouterPreset(): void;
|
|
26
|
+
export { OPENROUTER_BUILTIN_TOOLS, OPENROUTER_IMAGES_IGNORED_INPUTS, OPENROUTER_IMAGES_INPUT_MIMES, registerOpenRouterPreset, };
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
+
import { registerTools } from '../kernel/default-scope.js';
|
|
6
7
|
/** `/images` takes image references only; a profile on it lists nothing wider in `inputs.attachments.accept`. */
|
|
7
8
|
const OPENROUTER_IMAGES_INPUT_MIMES = ['image/*'];
|
|
8
9
|
/**
|
|
@@ -10,4 +11,21 @@ const OPENROUTER_IMAGES_INPUT_MIMES = ['image/*'];
|
|
|
10
11
|
* only. The chat path (`image.includeText`) sends the system prompt and history.
|
|
11
12
|
*/
|
|
12
13
|
const OPENROUTER_IMAGES_IGNORED_INPUTS = ['system', 'history'];
|
|
13
|
-
|
|
14
|
+
/** The tools OpenRouter runs itself, as `builtin` tool definitions. */
|
|
15
|
+
const OPENROUTER_BUILTIN_TOOLS = [
|
|
16
|
+
{
|
|
17
|
+
type: 'builtin',
|
|
18
|
+
name: 'webSearch',
|
|
19
|
+
description: 'OpenRouter web search',
|
|
20
|
+
category: 'grounding',
|
|
21
|
+
access: 'read-only',
|
|
22
|
+
paths: ['*'],
|
|
23
|
+
loadTier: 'T0',
|
|
24
|
+
permission: 'auto',
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
/** Registers into the default scope; a scope of its own takes `OPENROUTER_BUILTIN_TOOLS`. */
|
|
28
|
+
function registerOpenRouterPreset() {
|
|
29
|
+
registerTools(OPENROUTER_BUILTIN_TOOLS);
|
|
30
|
+
}
|
|
31
|
+
export { OPENROUTER_BUILTIN_TOOLS, OPENROUTER_IMAGES_IGNORED_INPUTS, OPENROUTER_IMAGES_INPUT_MIMES, registerOpenRouterPreset, };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ModelBinding } from '../kernel/protocols/binding.js';
|
|
2
|
+
import type { EmbeddingModelLimits, Protocol } from '../kernel/protocols/protocol.js';
|
|
3
|
+
/**
|
|
4
|
+
* What a binding's embedding model takes, read from its protocol: one Theorem ships, or one of
|
|
5
|
+
* `protocols`. Undefined when neither has it, and the kernel then holds requests to the profile alone.
|
|
6
|
+
*/
|
|
7
|
+
export declare function embeddingModelLimits(binding: Pick<ModelBinding, 'protocol' | 'apiId'>, protocols?: readonly Protocol[]): EmbeddingModelLimits | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { geminiEmbedding } from './gemini/embedding-protocol.js';
|
|
2
|
+
import { ollamaEmbedding } from './local/embedding-protocol.js';
|
|
3
|
+
import { openRouterEmbedding } from './openrouter/embedding-protocol.js';
|
|
4
|
+
const SHIPPED = [geminiEmbedding, openRouterEmbedding, ollamaEmbedding];
|
|
5
|
+
/**
|
|
6
|
+
* What a binding's embedding model takes, read from its protocol: one Theorem ships, or one of
|
|
7
|
+
* `protocols`. Undefined when neither has it, and the kernel then holds requests to the profile alone.
|
|
8
|
+
*/
|
|
9
|
+
export function embeddingModelLimits(binding, protocols = []) {
|
|
10
|
+
const protocol = [...protocols, ...SHIPPED].find((entry) => entry.id === binding.protocol);
|
|
11
|
+
return protocol?.embeddingLimits?.(binding.apiId);
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Protocol } from '../../kernel/protocols/protocol.js';
|
|
2
|
+
/** What a `geminiEmbedding` binding sets in `options`. */
|
|
3
|
+
export interface GeminiEmbeddingOptions {
|
|
4
|
+
/** For `gemini-embedding-001`; Gemini Embedding 2 refuses it and reads the request's `task` from the text. */
|
|
5
|
+
taskType?: 'RETRIEVAL_QUERY' | 'RETRIEVAL_DOCUMENT' | 'SEMANTIC_SIMILARITY' | 'CLASSIFICATION' | 'CLUSTERING' | 'QUESTION_ANSWERING' | 'FACT_VERIFICATION' | 'CODE_RETRIEVAL_QUERY';
|
|
6
|
+
outputDimensionality?: 768 | 1536 | 3072;
|
|
7
|
+
}
|
|
8
|
+
export declare const geminiEmbedding: Protocol<GeminiEmbeddingOptions>;
|