@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
|
@@ -5,14 +5,13 @@ import { historyMessageParts, isMediaRefPart } from '../../../kernel/interaction
|
|
|
5
5
|
import { mediaKindForMime } from '../../../kernel/registry/catalog.js';
|
|
6
6
|
import { toolEvent } from '../../../kernel/tools/events.js';
|
|
7
7
|
import { isRecord } from '../../../kernel/util/record.js';
|
|
8
|
-
import { builtinWire } from '../../shared/builtin-wire.js';
|
|
9
8
|
import { pcmMediaAsWav } from '../../shared/pcm.js';
|
|
10
9
|
import { historyToolArguments, historyToolIdentity, toolCallEvents, } from '../../shared/tool-args.js';
|
|
10
|
+
import { liveBuiltinTool } from '../builtins.js';
|
|
11
11
|
import { groundingFromLiveMetadata } from '../grounding.js';
|
|
12
12
|
import { assertGoogleThinkingLevel } from '../thinking.js';
|
|
13
13
|
import { GEMINI_LIVE_WS_URL } from '../urls.js';
|
|
14
14
|
import { byModality, modalityCounts } from '../usage.js';
|
|
15
|
-
import { toGeminiOpenApiSchema } from './openapi-schema.js';
|
|
16
15
|
export function buildGeminiLiveWebSocketUrl(apiKey) {
|
|
17
16
|
return `${GEMINI_LIVE_WS_URL}?key=${encodeURIComponent(apiKey)}`;
|
|
18
17
|
}
|
|
@@ -21,26 +20,19 @@ export function buildGeminiLiveWebSocketUrl(apiKey) {
|
|
|
21
20
|
* model keeps speaking, and a cancel reaches it as a `tool` event with `phase: 'cancel'`.
|
|
22
21
|
*/
|
|
23
22
|
const LIVE_FUNCTION_BEHAVIOR = 'NON_BLOCKING';
|
|
23
|
+
/** `parametersJsonSchema` takes the JSON Schema as it is; `parameters` takes only Google's OpenAPI subset. */
|
|
24
24
|
export function wireFunctionDeclaration(decl) {
|
|
25
|
-
const parameters = toGeminiOpenApiSchema(decl.parameters);
|
|
26
25
|
return {
|
|
27
26
|
name: decl.name,
|
|
28
27
|
description: decl.description,
|
|
29
28
|
behavior: LIVE_FUNCTION_BEHAVIOR,
|
|
30
|
-
|
|
31
|
-
? parameters
|
|
32
|
-
: { type: 'OBJECT', properties: {} },
|
|
29
|
+
parametersJsonSchema: decl.parameters ?? { type: 'object', properties: {} },
|
|
33
30
|
};
|
|
34
31
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Builtins are their own tool entries (`{ googleSearch: {} }`), functions share
|
|
37
|
-
* one `functionDeclarations` entry. Which builtins a model takes is the API's
|
|
38
|
-
* answer (probe 23/09/2026: a model without one closes the socket with 1007).
|
|
39
|
-
*/
|
|
40
32
|
function wireLiveTools(req) {
|
|
41
33
|
const tools = [];
|
|
42
34
|
for (const builtin of req.builtins) {
|
|
43
|
-
tools.push(
|
|
35
|
+
tools.push(liveBuiltinTool(builtin));
|
|
44
36
|
}
|
|
45
37
|
const functionDeclarations = (req.wireTools ?? []).map(wireFunctionDeclaration);
|
|
46
38
|
if (functionDeclarations.length > 0) {
|
|
@@ -64,14 +56,16 @@ function buildLiveGenerationConfig(req) {
|
|
|
64
56
|
};
|
|
65
57
|
}
|
|
66
58
|
assertGoogleThinkingLevel(req.thinking);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
59
|
+
const thinkingConfig = {
|
|
60
|
+
...(req.thinking ? { thinkingLevel: req.thinking } : {}),
|
|
61
|
+
...(req.summaries ? { includeThoughts: req.summaries === 'auto' } : {}),
|
|
62
|
+
};
|
|
63
|
+
if (Object.keys(thinkingConfig).length > 0) {
|
|
64
|
+
generationConfig.thinkingConfig = thinkingConfig;
|
|
71
65
|
}
|
|
72
66
|
return generationConfig;
|
|
73
67
|
}
|
|
74
|
-
// Unset numbers are left to Gemini's defaults.
|
|
68
|
+
// why: Unset numbers are left to Gemini's defaults.
|
|
75
69
|
function buildContextWindowCompression(compression) {
|
|
76
70
|
const { triggerTokens } = compression;
|
|
77
71
|
const { targetTokens } = compression.slidingWindow;
|
|
@@ -128,7 +122,7 @@ export function buildGeminiLiveSetupMessage(req) {
|
|
|
128
122
|
const realtimeInputConfig = live?.vad ? buildLiveRealtimeInputConfig(live.vad) : undefined;
|
|
129
123
|
const tools = wireLiveTools(req);
|
|
130
124
|
const sessionResumption = buildLiveSessionResumption(req);
|
|
131
|
-
// `initialHistoryInClientContent` makes Gemini wait for clientContent before
|
|
125
|
+
// why: `initialHistoryInClientContent` makes Gemini wait for clientContent before
|
|
132
126
|
// realtime generation, so an empty session (e.g. Th30) would hang forever.
|
|
133
127
|
const seedInitialHistory = Boolean(req.history && req.history.length > 0);
|
|
134
128
|
const setup = {
|
|
@@ -228,27 +222,30 @@ export function buildGeminiLiveRealtimeInput(input) {
|
|
|
228
222
|
};
|
|
229
223
|
}
|
|
230
224
|
const part = inlineMediaPart(input);
|
|
231
|
-
// The part's mime as given: the API reads the rate from it and rejects what it cannot take.
|
|
225
|
+
// why: The part's mime as given: the API reads the rate from it and rejects what it cannot take.
|
|
232
226
|
const media = { mimeType: part.mimeType, data: part.data };
|
|
233
227
|
return { realtimeInput: part.type === 'audio' ? { audio: media } : { video: media } };
|
|
234
228
|
}
|
|
235
|
-
|
|
229
|
+
function liveFunctionResponsePayload(output) {
|
|
236
230
|
const error = asRecord(output)?.error;
|
|
237
231
|
if (typeof error === 'string') {
|
|
238
232
|
return { error };
|
|
239
233
|
}
|
|
240
234
|
return { result: output };
|
|
241
235
|
}
|
|
242
|
-
export function buildGeminiLiveToolResponse(id, name, output) {
|
|
243
|
-
return buildGeminiLiveToolResponses([{ id, name, output }]);
|
|
236
|
+
export function buildGeminiLiveToolResponse(id, name, output, parts) {
|
|
237
|
+
return buildGeminiLiveToolResponses([{ id, name, output, parts }]);
|
|
244
238
|
}
|
|
245
239
|
export function buildGeminiLiveToolResponses(responses) {
|
|
246
240
|
return {
|
|
247
241
|
toolResponse: {
|
|
248
|
-
functionResponses: responses.map(({ id, name, output }) => ({
|
|
242
|
+
functionResponses: responses.map(({ id, name, output, parts }) => ({
|
|
249
243
|
id,
|
|
250
244
|
name,
|
|
251
245
|
response: liveFunctionResponsePayload(output),
|
|
246
|
+
...(parts?.length
|
|
247
|
+
? { parts: parts.filter((part) => part.type !== 'text').map(contentPart) }
|
|
248
|
+
: {}),
|
|
252
249
|
})),
|
|
253
250
|
},
|
|
254
251
|
};
|
|
@@ -393,13 +390,16 @@ function foldToolCalls(message, fold, events) {
|
|
|
393
390
|
const calls = asRecord(message.toolCall)?.functionCalls;
|
|
394
391
|
if (!Array.isArray(calls))
|
|
395
392
|
return;
|
|
393
|
+
// why: The calls of one `toolCall` message are the model's step: chosen together, before any result.
|
|
394
|
+
const stepId = crypto.randomUUID();
|
|
395
|
+
const stepCallCount = calls.length;
|
|
396
396
|
for (const value of calls) {
|
|
397
397
|
const call = asRecord(value) ?? {};
|
|
398
398
|
const id = typeof call.id === 'string' && call.id ? call.id : undefined;
|
|
399
399
|
const name = typeof call.name === 'string' ? call.name : '';
|
|
400
400
|
if (id && name)
|
|
401
401
|
fold.calls.set(id, name);
|
|
402
|
-
events.push(...toolCallEvents({ id, name }, call.args));
|
|
402
|
+
events.push(...toolCallEvents({ id, name, stepId, stepCallCount }, call.args));
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
405
|
/**
|
|
@@ -415,7 +415,7 @@ function foldToolCancellations(message, fold, events) {
|
|
|
415
415
|
for (const id of ids) {
|
|
416
416
|
const name = typeof id === 'string' ? fold.calls.get(id) : undefined;
|
|
417
417
|
if (typeof id !== 'string' || !name) {
|
|
418
|
-
// Every observed cancel names a call this connection issued; anything else is a wire change.
|
|
418
|
+
// why: Every observed cancel names a call this connection issued; anything else is a wire change.
|
|
419
419
|
events.push(toErrorEvent(new TheoremError('bad_response', `Live cancelled a tool call it never issued: ${String(id)}`)));
|
|
420
420
|
continue;
|
|
421
421
|
}
|
|
@@ -1,51 +1,13 @@
|
|
|
1
1
|
import { TheoremError } from '../../../guardrails/error.js';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
5
|
-
|
|
6
|
-
export type SessionQueueItem = {
|
|
7
|
-
type: 'batch';
|
|
8
|
-
events: ProviderEvent[];
|
|
9
|
-
turnPhase: LiveTurnPhase;
|
|
10
|
-
row: Record<string, unknown>;
|
|
11
|
-
} | {
|
|
12
|
-
type: 'row';
|
|
13
|
-
row: Record<string, unknown>;
|
|
14
|
-
} | {
|
|
15
|
-
type: 'error';
|
|
16
|
-
error: Error;
|
|
17
|
-
row?: Record<string, unknown>;
|
|
18
|
-
}
|
|
19
|
-
/** `error` is set when the close was not normal; `goAway` when the provider warned first. */
|
|
20
|
-
| {
|
|
21
|
-
type: 'closed';
|
|
22
|
-
code: number;
|
|
23
|
-
reason: string;
|
|
24
|
-
error?: TheoremError;
|
|
25
|
-
goAway?: GoAwayClose;
|
|
26
|
-
};
|
|
27
|
-
export interface GoAwayClose {
|
|
2
|
+
import type { ModelEvent } from '../../../kernel/types.js';
|
|
3
|
+
import type { LiveTurnPhase } from '../../types.js';
|
|
4
|
+
export declare function closeError(code: number, reason: string, during: 'setup' | 'session'): TheoremError;
|
|
5
|
+
export declare function goAwayIn(events: readonly ModelEvent[]): {
|
|
28
6
|
timeLeftMs?: number;
|
|
29
|
-
|
|
30
|
-
closedAfterMs: number;
|
|
31
|
-
}
|
|
32
|
-
export declare function readMessageData(data: unknown): Promise<string>;
|
|
33
|
-
export declare function performLiveSetup(ws: WebSocket, req: ProviderCompleteRequest): Promise<Record<string, unknown>>;
|
|
34
|
-
export type LiveSocketSender = {
|
|
35
|
-
send(data: string): void;
|
|
36
|
-
};
|
|
37
|
-
export declare function sendInitialPayloads(ws: LiveSocketSender, req: ProviderCompleteRequest): void;
|
|
38
|
-
export interface LiveQueue {
|
|
39
|
-
push: (item: SessionQueueItem) => void;
|
|
40
|
-
next: () => Promise<SessionQueueItem | undefined>;
|
|
41
|
-
close: () => void;
|
|
42
|
-
isClosed: () => boolean;
|
|
43
|
-
}
|
|
44
|
-
export declare function createLiveQueue(): LiveQueue;
|
|
7
|
+
} | undefined;
|
|
45
8
|
/**
|
|
46
9
|
* `interactionStatus`, when sent, is authoritative: `IN_PROGRESS` keeps the cycle
|
|
47
10
|
* open across `turnComplete` (background reasoning or async tools may still
|
|
48
11
|
* produce output). Without it, `turnComplete` is the boundary.
|
|
49
12
|
*/
|
|
50
|
-
export declare function turnPhaseFromMessage(message: Record<string, unknown>, events:
|
|
51
|
-
export declare function attachLiveSessionHandlers(ws: WebSocket, liveQueue: LiveQueue): void;
|
|
13
|
+
export declare function turnPhaseFromMessage(message: Record<string, unknown>, events: ModelEvent[]): LiveTurnPhase;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { TheoremError } from '../../../guardrails/error.js';
|
|
2
2
|
import { asRecord } from '../../../kernel/engine/record.js';
|
|
3
3
|
import { findLast } from '../../../kernel/util/find-last.js';
|
|
4
|
-
import {
|
|
5
|
-
import { buildGeminiLiveClientContent, buildGeminiLiveRealtimeInput, buildGeminiLiveSetupMessage, foldGeminiLiveServerMessage, newLiveFold, parseGeminiLiveMessage, readLiveInteractionStatus, } from './framing.js';
|
|
6
|
-
const SETUP_TIMEOUT_MS = 20_000;
|
|
4
|
+
import { readLiveInteractionStatus } from './framing.js';
|
|
7
5
|
/** RFC 6455 §7.4.1 close codes; any other code is `unavailable`. */
|
|
8
6
|
const CLOSE_KINDS = {
|
|
9
7
|
1006: 'network',
|
|
@@ -12,7 +10,6 @@ const CLOSE_KINDS = {
|
|
|
12
10
|
1011: 'unavailable',
|
|
13
11
|
1013: 'unavailable',
|
|
14
12
|
};
|
|
15
|
-
const NORMAL_CLOSE = 1000;
|
|
16
13
|
/**
|
|
17
14
|
* Google refuses an over-quota Live key with code 1011 (`unavailable`) and a reason
|
|
18
15
|
* ("You exceeded your current quota, …"); the reason is the only quota signal.
|
|
@@ -31,148 +28,15 @@ function closeReasonKind(reason) {
|
|
|
31
28
|
return 'auth';
|
|
32
29
|
return undefined;
|
|
33
30
|
}
|
|
34
|
-
function closeError(code, reason, during) {
|
|
31
|
+
export function closeError(code, reason, during) {
|
|
35
32
|
return new TheoremError(closeReasonKind(reason) ?? CLOSE_KINDS[code] ?? 'unavailable', `Gemini Live WebSocket closed during ${during} (${code}: ${reason})`);
|
|
36
33
|
}
|
|
37
|
-
|
|
38
|
-
const LIVE_SEND_ROW = 'ws_send';
|
|
39
|
-
export function sendLiveFrame(ws, payload, tap) {
|
|
40
|
-
tap?.({ eventType: LIVE_SEND_ROW, body: payload });
|
|
41
|
-
ws.send(JSON.stringify(payload));
|
|
42
|
-
}
|
|
43
|
-
function goAwayIn(events) {
|
|
34
|
+
export function goAwayIn(events) {
|
|
44
35
|
const warning = findLast(events, (ev) => ev.type === 'session' && ev.session.kind === 'closing_soon');
|
|
45
36
|
return warning?.session.kind === 'closing_soon'
|
|
46
37
|
? { timeLeftMs: warning.session.timeLeftMs }
|
|
47
38
|
: undefined;
|
|
48
39
|
}
|
|
49
|
-
export async function readMessageData(data) {
|
|
50
|
-
if (typeof data === 'string')
|
|
51
|
-
return data;
|
|
52
|
-
if (data instanceof ArrayBuffer) {
|
|
53
|
-
return new TextDecoder().decode(data);
|
|
54
|
-
}
|
|
55
|
-
if (typeof Blob !== 'undefined' && data instanceof Blob) {
|
|
56
|
-
return await data.text();
|
|
57
|
-
}
|
|
58
|
-
return String(data);
|
|
59
|
-
}
|
|
60
|
-
export function performLiveSetup(ws, req) {
|
|
61
|
-
return new Promise((resolve, reject) => {
|
|
62
|
-
let setupResolved = false;
|
|
63
|
-
const timeout = setTimeout(() => {
|
|
64
|
-
if (!setupResolved) {
|
|
65
|
-
setupResolved = true;
|
|
66
|
-
reject(new TheoremError('timeout', `Gemini Live setup timed out after ${SETUP_TIMEOUT_MS}ms`));
|
|
67
|
-
}
|
|
68
|
-
}, SETUP_TIMEOUT_MS);
|
|
69
|
-
const sendSetup = () => {
|
|
70
|
-
try {
|
|
71
|
-
sendLiveFrame(ws, buildGeminiLiveSetupMessage(req), req.tapUpstream);
|
|
72
|
-
}
|
|
73
|
-
catch (err) {
|
|
74
|
-
clearTimeout(timeout);
|
|
75
|
-
setupResolved = true;
|
|
76
|
-
reject(err instanceof Error ? err : new Error(String(err)));
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
ws.onerror = () => {
|
|
80
|
-
clearTimeout(timeout);
|
|
81
|
-
if (!setupResolved) {
|
|
82
|
-
setupResolved = true;
|
|
83
|
-
reject(new TheoremError('network', 'Gemini Live WebSocket error during setup'));
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
ws.onclose = (evt) => {
|
|
87
|
-
clearTimeout(timeout);
|
|
88
|
-
if (!setupResolved) {
|
|
89
|
-
setupResolved = true;
|
|
90
|
-
reject(closeError(evt.code, evt.reason, 'setup'));
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
const initialMessageHandler = async (evt) => {
|
|
94
|
-
const rawText = await readMessageData(evt.data);
|
|
95
|
-
const parsed = parseGeminiLiveMessage(rawText);
|
|
96
|
-
if (!parsed.ok) {
|
|
97
|
-
if (parsed.reason === 'empty')
|
|
98
|
-
return;
|
|
99
|
-
clearTimeout(timeout);
|
|
100
|
-
setupResolved = true;
|
|
101
|
-
reject(new TheoremError('bad_response', 'malformed Gemini Live message during setup'));
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
const apiError = readGeminiApiError(parsed.value);
|
|
105
|
-
if (apiError) {
|
|
106
|
-
clearTimeout(timeout);
|
|
107
|
-
setupResolved = true;
|
|
108
|
-
reject(apiError);
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
if (parsed.value.setupComplete) {
|
|
112
|
-
clearTimeout(timeout);
|
|
113
|
-
setupResolved = true;
|
|
114
|
-
ws.removeEventListener('message', initialMessageHandler);
|
|
115
|
-
resolve(parsed.value);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
ws.addEventListener('message', initialMessageHandler);
|
|
119
|
-
// A fetch-upgraded socket (Cloudflare `resp.webSocket.accept()`) is already
|
|
120
|
-
// open and never fires `open`.
|
|
121
|
-
if (ws.readyState === WebSocket.OPEN) {
|
|
122
|
-
sendSetup();
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
ws.onopen = sendSetup;
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
export function sendInitialPayloads(ws, req) {
|
|
130
|
-
if (req.history && req.history.length > 0) {
|
|
131
|
-
const historyMsg = buildGeminiLiveClientContent(req.history);
|
|
132
|
-
if (historyMsg) {
|
|
133
|
-
sendLiveFrame(ws, historyMsg, req.tapUpstream);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
for (const part of req.input ?? []) {
|
|
137
|
-
sendLiveFrame(ws, buildGeminiLiveRealtimeInput(part), req.tapUpstream);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
export function createLiveQueue() {
|
|
141
|
-
const queue = [];
|
|
142
|
-
let notify = null;
|
|
143
|
-
let closed = false;
|
|
144
|
-
return {
|
|
145
|
-
push(item) {
|
|
146
|
-
queue.push(item);
|
|
147
|
-
if (notify) {
|
|
148
|
-
const fn = notify;
|
|
149
|
-
notify = null;
|
|
150
|
-
fn();
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
async next() {
|
|
154
|
-
while (queue.length === 0) {
|
|
155
|
-
if (closed)
|
|
156
|
-
return undefined;
|
|
157
|
-
await new Promise((resolve) => {
|
|
158
|
-
notify = resolve;
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
return queue.shift();
|
|
162
|
-
},
|
|
163
|
-
close() {
|
|
164
|
-
closed = true;
|
|
165
|
-
if (notify) {
|
|
166
|
-
const fn = notify;
|
|
167
|
-
notify = null;
|
|
168
|
-
fn();
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
isClosed() {
|
|
172
|
-
return closed;
|
|
173
|
-
},
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
40
|
/**
|
|
177
41
|
* `interactionStatus`, when sent, is authoritative: `IN_PROGRESS` keeps the cycle
|
|
178
42
|
* open across `turnComplete` (background reasoning or async tools may still
|
|
@@ -191,73 +55,3 @@ export function turnPhaseFromMessage(message, events) {
|
|
|
191
55
|
return 'complete';
|
|
192
56
|
return 'streaming';
|
|
193
57
|
}
|
|
194
|
-
export function attachLiveSessionHandlers(ws, liveQueue) {
|
|
195
|
-
const fold = newLiveFold();
|
|
196
|
-
/** The last `goAway`, and when it arrived (monotonic ms). */
|
|
197
|
-
let goAway;
|
|
198
|
-
ws.onmessage = async (evt) => {
|
|
199
|
-
try {
|
|
200
|
-
const rawText = await readMessageData(evt.data);
|
|
201
|
-
const parsed = parseGeminiLiveMessage(rawText);
|
|
202
|
-
if (!parsed.ok) {
|
|
203
|
-
if (parsed.reason === 'empty')
|
|
204
|
-
return;
|
|
205
|
-
liveQueue.push({
|
|
206
|
-
type: 'error',
|
|
207
|
-
error: new TheoremError('bad_response', 'malformed Gemini Live message'),
|
|
208
|
-
});
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
if (parsed.value.setupComplete)
|
|
212
|
-
return;
|
|
213
|
-
const apiError = readGeminiApiError(parsed.value);
|
|
214
|
-
if (apiError) {
|
|
215
|
-
liveQueue.push({ type: 'error', error: apiError, row: parsed.value });
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
const events = foldGeminiLiveServerMessage(parsed.value, fold);
|
|
219
|
-
const warning = goAwayIn(events);
|
|
220
|
-
if (warning)
|
|
221
|
-
goAway = { ...warning, atMs: performance.now() };
|
|
222
|
-
const turnPhase = turnPhaseFromMessage(parsed.value, events);
|
|
223
|
-
liveQueue.push(events.length > 0 || turnPhase !== 'streaming'
|
|
224
|
-
? { type: 'batch', events, turnPhase, row: parsed.value }
|
|
225
|
-
: { type: 'row', row: parsed.value });
|
|
226
|
-
}
|
|
227
|
-
catch (err) {
|
|
228
|
-
liveQueue.push({
|
|
229
|
-
type: 'error',
|
|
230
|
-
error: err instanceof Error ? err : new Error(String(err)),
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
ws.onerror = () => {
|
|
235
|
-
if (!liveQueue.isClosed()) {
|
|
236
|
-
liveQueue.push({
|
|
237
|
-
type: 'error',
|
|
238
|
-
error: new TheoremError('network', 'Gemini Live WebSocket error'),
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
ws.onclose = (evt) => {
|
|
243
|
-
if (!liveQueue.isClosed()) {
|
|
244
|
-
liveQueue.push({
|
|
245
|
-
type: 'closed',
|
|
246
|
-
code: evt.code,
|
|
247
|
-
reason: evt.reason,
|
|
248
|
-
...(evt.code === NORMAL_CLOSE
|
|
249
|
-
? {}
|
|
250
|
-
: { error: closeError(evt.code, evt.reason, 'session') }),
|
|
251
|
-
...(goAway
|
|
252
|
-
? {
|
|
253
|
-
goAway: {
|
|
254
|
-
...(goAway.timeLeftMs !== undefined ? { timeLeftMs: goAway.timeLeftMs } : {}),
|
|
255
|
-
closedAfterMs: Math.round(performance.now() - goAway.atMs),
|
|
256
|
-
},
|
|
257
|
-
}
|
|
258
|
-
: {}),
|
|
259
|
-
});
|
|
260
|
-
liveQueue.close();
|
|
261
|
-
}
|
|
262
|
-
};
|
|
263
|
-
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
declare const INTERACTIONS_URL = "https://generativelanguage.googleapis.com/v1beta/interactions?alt=sse";
|
|
2
|
-
declare const INTERACTIONS_JSON_URL = "https://generativelanguage.googleapis.com/v1beta/interactions";
|
|
3
1
|
/** The models a key's project can call; paged with `pageToken`. */
|
|
4
2
|
declare const GEMINI_MODELS_URL = "https://generativelanguage.googleapis.com/v1beta/models";
|
|
5
3
|
declare const GEMINI_LIVE_WS_URL = "wss://generativelanguage.googleapis.com/ws/google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent";
|
|
6
|
-
export { GEMINI_LIVE_WS_URL, GEMINI_MODELS_URL
|
|
4
|
+
export { GEMINI_LIVE_WS_URL, GEMINI_MODELS_URL };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
const INTERACTIONS_URL = 'https://generativelanguage.googleapis.com/v1beta/interactions?alt=sse';
|
|
2
|
-
const INTERACTIONS_JSON_URL = 'https://generativelanguage.googleapis.com/v1beta/interactions';
|
|
3
1
|
/** The models a key's project can call; paged with `pageToken`. */
|
|
4
2
|
const GEMINI_MODELS_URL = 'https://generativelanguage.googleapis.com/v1beta/models';
|
|
5
3
|
const GEMINI_LIVE_WS_URL = 'wss://generativelanguage.googleapis.com/ws/google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent';
|
|
6
|
-
export { GEMINI_LIVE_WS_URL, GEMINI_MODELS_URL
|
|
4
|
+
export { GEMINI_LIVE_WS_URL, GEMINI_MODELS_URL };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Google usage lists, in the spellings the wire sends
|
|
1
|
+
/* probed 2026-09-23:
|
|
2
|
+
* Google usage lists, in the spellings the wire sends:
|
|
3
3
|
*
|
|
4
4
|
* - Interactions: `input_tokens_by_modality` / `output_tokens_by_modality`,
|
|
5
5
|
* `[{ modality: 'text', tokens }]`; `grounding_tool_count`,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Provider-neutral live tracing and tool read-back helpers.
|
|
2
|
+
* @module
|
|
3
|
+
*/
|
|
4
|
+
import type { TurnHistoryMessage } from '../kernel/types.js';
|
|
5
|
+
export declare function liveSentInput(row: Record<string, unknown>): TurnHistoryMessage[];
|
|
6
|
+
export declare function liveToolReadBack(output: unknown): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Protocol } from '../../kernel/protocols/mod.js';
|
|
2
|
+
/** What an `ollamaEmbedding` binding sets in `options`. */
|
|
3
|
+
export interface OllamaEmbeddingOptions {
|
|
4
|
+
truncate?: boolean;
|
|
5
|
+
dimensions?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const ollamaEmbedding: Protocol<OllamaEmbeddingOptions>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TheoremError } from '../../guardrails/error.js';
|
|
3
|
+
import { defineProtocol } from '../../kernel/protocols/mod.js';
|
|
4
|
+
const options = z.strictObject({
|
|
5
|
+
truncate: z
|
|
6
|
+
.boolean()
|
|
7
|
+
.optional()
|
|
8
|
+
.describe('What happens to an input longer than the model reads. On, it is cut to fit; off, the call fails. Absent: Ollama cuts it.'),
|
|
9
|
+
dimensions: z
|
|
10
|
+
.number()
|
|
11
|
+
.int()
|
|
12
|
+
.positive()
|
|
13
|
+
.optional()
|
|
14
|
+
.describe('How many numbers each vector holds, for models that can shorten theirs. Absent: the length the model returns.'),
|
|
15
|
+
});
|
|
16
|
+
function strings(input) {
|
|
17
|
+
const values = Array.isArray(input) ? input : [input];
|
|
18
|
+
return values.map((item) => {
|
|
19
|
+
if (typeof item === 'string')
|
|
20
|
+
return item;
|
|
21
|
+
if (item.parts.length !== 1 || item.parts[0]?.type !== 'text')
|
|
22
|
+
throw new TheoremError('unsupported', 'The Ollama embedding protocol accepts text only');
|
|
23
|
+
return item.parts[0].text;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export const ollamaEmbedding = defineProtocol({
|
|
27
|
+
id: 'ollamaEmbedding',
|
|
28
|
+
name: 'Ollama Embeddings',
|
|
29
|
+
description: 'Ollama’s local embedding endpoint.',
|
|
30
|
+
endpoints: { embedding: '/api/embed' },
|
|
31
|
+
options,
|
|
32
|
+
embeddingLimits: () => ({ media: [] }),
|
|
33
|
+
create(context) {
|
|
34
|
+
return {
|
|
35
|
+
async embed(request) {
|
|
36
|
+
const parsed = options.parse(request.options ?? {});
|
|
37
|
+
const rows = context.send({
|
|
38
|
+
model: context.apiId,
|
|
39
|
+
input: strings(request.input),
|
|
40
|
+
...(parsed.truncate === undefined ? {} : { truncate: parsed.truncate }),
|
|
41
|
+
...(parsed.dimensions === undefined ? {} : { dimensions: parsed.dimensions }),
|
|
42
|
+
}, { stream: false });
|
|
43
|
+
let row;
|
|
44
|
+
for await (const current of rows)
|
|
45
|
+
row = current;
|
|
46
|
+
const embeddings = Array.isArray(row?.embeddings) ? row.embeddings : [];
|
|
47
|
+
return {
|
|
48
|
+
model: typeof row?.model === 'string' ? row.model : context.apiId,
|
|
49
|
+
embeddings: embeddings.map((values, index) => ({
|
|
50
|
+
index,
|
|
51
|
+
values: Array.isArray(values)
|
|
52
|
+
? values.filter((value) => typeof value === 'number')
|
|
53
|
+
: [],
|
|
54
|
+
dimensions: Array.isArray(values) ? values.length : 0,
|
|
55
|
+
})),
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Provider } from '../../kernel/protocols/provider.js';
|
|
2
|
+
/** What registering `localProvider` takes as `connection`. */
|
|
3
|
+
export interface LocalConnection {
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
}
|
|
6
|
+
/** A server on your machine or network that speaks OpenAI's chat API: Ollama, llama.cpp, vLLM, LM Studio. */
|
|
7
|
+
export declare const localProvider: Provider<LocalConnection, string>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { bearer, defineProvider, endpointUrlSchema, } from '../../kernel/protocols/provider.js';
|
|
3
|
+
import { openAi } from '../open-ai/protocol.js';
|
|
4
|
+
import { ollamaEmbedding } from './embedding-protocol.js';
|
|
5
|
+
/** A server on your machine or network that speaks OpenAI's chat API: Ollama, llama.cpp, vLLM, LM Studio. */
|
|
6
|
+
export const localProvider = defineProvider({
|
|
7
|
+
id: 'local',
|
|
8
|
+
name: 'Local',
|
|
9
|
+
description: "A server that speaks OpenAI's chat API: Ollama, llama.cpp, vLLM, LM Studio.", // labels-exempt: builder field description, read by the studio and docs
|
|
10
|
+
traceName: 'openai',
|
|
11
|
+
connection: z.strictObject({
|
|
12
|
+
baseUrl: endpointUrlSchema.describe('Where the server listens, up to and including /v1, e.g. http://localhost:11434/v1.'),
|
|
13
|
+
}),
|
|
14
|
+
key: z.string().trim().min(1).optional(),
|
|
15
|
+
authorize: bearer(),
|
|
16
|
+
serves: (at) => [
|
|
17
|
+
{ protocol: openAi, baseUrl: at.baseUrl },
|
|
18
|
+
{
|
|
19
|
+
protocol: ollamaEmbedding,
|
|
20
|
+
baseUrl: at.baseUrl,
|
|
21
|
+
url: ({ path }) => {
|
|
22
|
+
const base = new URL(at.baseUrl);
|
|
23
|
+
base.pathname = base.pathname.replace(/\/v1\/?$/, '') || '/';
|
|
24
|
+
return new URL(path.replace(/^\/+/, ''), base).toString();
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
});
|
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Protocols, providers, and what it takes to define either: a protocol owns the wire, a provider is
|
|
3
|
+
* where a service is and how to sign in to it.
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import "../../_dnt.polyfills.js";
|
|
7
|
-
export type {
|
|
8
|
-
export type {
|
|
9
|
-
export {
|
|
10
|
-
export type {
|
|
11
|
-
export type {
|
|
7
|
+
export type { ProviderCheckpoint, ProviderContinuationPolicy, ProviderWarning, } from '../kernel/checkpoint.js';
|
|
8
|
+
export type { JsonObject, JsonValue } from '../kernel/json.js';
|
|
9
|
+
export { jsonObjectSchema, jsonValueSchema } from '../kernel/json.js';
|
|
10
|
+
export type { DecisionModelBinding, ModelBinding } from '../kernel/protocols/binding.js';
|
|
11
|
+
export type { ProviderLimits } from '../kernel/protocols/limits.js';
|
|
12
|
+
export type { ModelPrice, PriceTable, Rates } from '../kernel/protocols/prices.js';
|
|
13
|
+
export type { Continuation, DecisionCall, EmbeddingCall, EmbeddingMediaKind, EmbeddingModelLimits, ExtensionBodyAt, ExtensionReader, LiveToolResult, ModelProfileType, Protocol, ProtocolContentEvent, ProtocolContext, ProtocolDefinition, ProtocolEvent, ProtocolExtension, ProtocolOperations, ProtocolRequest, ProtocolSession, ProtocolSocket, SendInit, UpstreamFailure, } from '../kernel/protocols/protocol.js';
|
|
14
|
+
export { carriesTo, defineProtocol, extendProtocol, modelOptions, } from '../kernel/protocols/protocol.js';
|
|
15
|
+
export type { Authorize, Outgoing, Provider, ProviderDefinition, ProviderRegistry, RegisteredProvider, Registration, Serve, Signer, } from '../kernel/protocols/provider.js';
|
|
16
|
+
export { bearer, createProviderRegistry, defineProvider, endpointUrlSchema, header, query, } from '../kernel/protocols/provider.js';
|
|
17
|
+
export type { OpenWebSocket, ProviderHostOptions } from '../kernel/protocols/runtime.js';
|
|
18
|
+
export type { CredentialContext, CredentialResolver, KeyCredential, KeyVault, } from '../kernel/registry/vault.js';
|
|
19
|
+
export { embeddingModelLimits } from './embedding-limits.js';
|
|
20
|
+
export { geminiEmbedding } from './gemini/embedding-protocol.js';
|
|
21
|
+
export { geminiInteractions } from './gemini/interactions-protocol.js';
|
|
22
|
+
export { geminiLive } from './gemini/live-protocol.js';
|
|
23
|
+
export { geminiProvider } from './gemini/provider.js';
|
|
24
|
+
export { ollamaEmbedding } from './local/embedding-protocol.js';
|
|
25
|
+
export { localProvider } from './local/provider.js';
|
|
26
|
+
export { openAi } from './open-ai/protocol.js';
|
|
27
|
+
export { openRouterEmbedding } from './openrouter/embedding-protocol.js';
|
|
28
|
+
export { openRouterImages } from './openrouter/images-protocol.js';
|
|
29
|
+
export { openRouter } from './openrouter/protocol.js';
|
|
30
|
+
export { openRouterProvider } from './openrouter/provider.js';
|
|
31
|
+
export { systemOne } from './system-one/protocol.js';
|
|
32
|
+
export { typesafeProvider } from './typesafe/provider.js';
|
package/esm/src/providers/mod.js
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Protocols, providers, and what it takes to define either: a protocol owns the wire, a provider is
|
|
3
|
+
* where a service is and how to sign in to it.
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import "../../_dnt.polyfills.js";
|
|
7
|
-
export {
|
|
7
|
+
export { jsonObjectSchema, jsonValueSchema } from '../kernel/json.js';
|
|
8
|
+
export { carriesTo, defineProtocol, extendProtocol, modelOptions, } from '../kernel/protocols/protocol.js';
|
|
9
|
+
export { bearer, createProviderRegistry, defineProvider, endpointUrlSchema, header, query, } from '../kernel/protocols/provider.js';
|
|
10
|
+
export { embeddingModelLimits } from './embedding-limits.js';
|
|
11
|
+
export { geminiEmbedding } from './gemini/embedding-protocol.js';
|
|
12
|
+
export { geminiInteractions } from './gemini/interactions-protocol.js';
|
|
13
|
+
export { geminiLive } from './gemini/live-protocol.js';
|
|
14
|
+
export { geminiProvider } from './gemini/provider.js';
|
|
15
|
+
export { ollamaEmbedding } from './local/embedding-protocol.js';
|
|
16
|
+
export { localProvider } from './local/provider.js';
|
|
17
|
+
export { openAi } from './open-ai/protocol.js';
|
|
18
|
+
export { openRouterEmbedding } from './openrouter/embedding-protocol.js';
|
|
19
|
+
export { openRouterImages } from './openrouter/images-protocol.js';
|
|
20
|
+
export { openRouter } from './openrouter/protocol.js';
|
|
21
|
+
export { openRouterProvider } from './openrouter/provider.js';
|
|
22
|
+
export { systemOne } from './system-one/protocol.js';
|
|
23
|
+
export { typesafeProvider } from './typesafe/provider.js';
|