@theoremjs/agents 0.0.0-stage → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +545 -2
- package/esm/_dnt.polyfills.d.ts +66 -0
- package/esm/_dnt.polyfills.js +51 -0
- package/esm/mod.d.ts +79 -0
- package/esm/mod.js +49 -0
- package/esm/package.json +3 -0
- package/esm/src/cli/bin.d.ts +7 -0
- package/esm/src/cli/bin.js +9 -0
- package/esm/src/cli/commands/bench.d.ts +6 -0
- package/esm/src/cli/commands/bench.js +480 -0
- package/esm/src/cli/commands/detect-compile.d.ts +17 -0
- package/esm/src/cli/commands/detect-compile.js +22 -0
- package/esm/src/cli/commands/eval.d.ts +37 -0
- package/esm/src/cli/commands/eval.js +190 -0
- package/esm/src/cli/commands/fuzz-canary.d.ts +15 -0
- package/esm/src/cli/commands/fuzz-canary.js +241 -0
- package/esm/src/cli/commands/fuzz-guardrails.d.ts +2 -0
- package/esm/src/cli/commands/fuzz-guardrails.js +5 -0
- package/esm/src/cli/commands/profile.d.ts +2 -0
- package/esm/src/cli/commands/profile.js +80 -0
- package/esm/src/cli/commands/run.d.ts +13 -0
- package/esm/src/cli/commands/run.js +45 -0
- package/esm/src/cli/commands/test.d.ts +26 -0
- package/esm/src/cli/commands/test.js +143 -0
- package/esm/src/cli/event-log.d.ts +15 -0
- package/esm/src/cli/event-log.js +136 -0
- package/esm/src/cli/index.d.ts +10 -0
- package/esm/src/cli/index.js +267 -0
- package/esm/src/cli/matrix/fixtures.d.ts +10 -0
- package/esm/src/cli/matrix/fixtures.js +67 -0
- package/esm/src/cli/matrix/synthesizer.d.ts +18 -0
- package/esm/src/cli/matrix/synthesizer.js +103 -0
- package/esm/src/evals/attachments.d.ts +5 -0
- package/esm/src/evals/attachments.js +55 -0
- package/esm/src/evals/breakdown.d.ts +30 -0
- package/esm/src/evals/breakdown.js +69 -0
- package/esm/src/evals/graders/answer.d.ts +16 -0
- package/esm/src/evals/graders/answer.js +134 -0
- package/esm/src/evals/graders/code.d.ts +40 -0
- package/esm/src/evals/graders/code.js +184 -0
- package/esm/src/evals/graders/judge.d.ts +24 -0
- package/esm/src/evals/graders/judge.js +367 -0
- package/esm/src/evals/graders/latency.d.ts +6 -0
- package/esm/src/evals/graders/latency.js +82 -0
- package/esm/src/evals/graders/live.d.ts +14 -0
- package/esm/src/evals/graders/live.js +42 -0
- package/esm/src/evals/graders/media.d.ts +18 -0
- package/esm/src/evals/graders/media.js +91 -0
- package/esm/src/evals/graders/shared.d.ts +11 -0
- package/esm/src/evals/graders/shared.js +62 -0
- package/esm/src/evals/graders/transcript.d.ts +19 -0
- package/esm/src/evals/graders/transcript.js +202 -0
- package/esm/src/evals/mod.d.ts +34 -0
- package/esm/src/evals/mod.js +22 -0
- package/esm/src/evals/record.d.ts +41 -0
- package/esm/src/evals/record.js +107 -0
- package/esm/src/evals/rubrics/catalog.d.ts +148 -0
- package/esm/src/evals/rubrics/catalog.js +846 -0
- package/esm/src/evals/rubrics/mod.d.ts +24 -0
- package/esm/src/evals/rubrics/mod.js +55 -0
- package/esm/src/evals/rubrics/mustache.d.ts +23 -0
- package/esm/src/evals/rubrics/mustache.js +154 -0
- package/esm/src/evals/rubrics/types.d.ts +54 -0
- package/esm/src/evals/rubrics/types.js +74 -0
- package/esm/src/evals/run.d.ts +75 -0
- package/esm/src/evals/run.js +418 -0
- package/esm/src/evals/suite.d.ts +28 -0
- package/esm/src/evals/suite.js +97 -0
- package/esm/src/evals/summary.d.ts +35 -0
- package/esm/src/evals/summary.js +31 -0
- package/esm/src/evals/trial.d.ts +14 -0
- package/esm/src/evals/trial.js +135 -0
- package/esm/src/evals/types.d.ts +169 -0
- package/esm/src/evals/types.js +113 -0
- package/esm/src/evals/verdict.d.ts +23 -0
- package/esm/src/evals/verdict.js +48 -0
- package/esm/src/guardrails/boundaries.d.ts +41 -0
- package/esm/src/guardrails/boundaries.js +103 -0
- package/esm/src/guardrails/canary-gate.d.ts +22 -0
- package/esm/src/guardrails/canary-gate.js +40 -0
- package/esm/src/guardrails/canary.d.ts +146 -0
- package/esm/src/guardrails/canary.js +974 -0
- package/esm/src/guardrails/compile-egress.d.ts +12 -0
- package/esm/src/guardrails/compile-egress.js +12 -0
- package/esm/src/guardrails/corpus/canary-egress-attacks.d.ts +24 -0
- package/esm/src/guardrails/corpus/canary-egress-attacks.js +305 -0
- package/esm/src/guardrails/corpus/fuzz-inbound.d.ts +5 -0
- package/esm/src/guardrails/corpus/fuzz-inbound.js +199 -0
- package/esm/src/guardrails/corpus/inbound-payloads.d.ts +5 -0
- package/esm/src/guardrails/corpus/inbound-payloads.js +120 -0
- package/esm/src/guardrails/corpus/live-attacks.d.ts +15 -0
- package/esm/src/guardrails/corpus/live-attacks.js +229 -0
- package/esm/src/guardrails/corpus/mod.d.ts +7 -0
- package/esm/src/guardrails/corpus/mod.js +4 -0
- package/esm/src/guardrails/corpus/secrets.d.ts +12 -0
- package/esm/src/guardrails/corpus/secrets.js +16 -0
- package/esm/src/guardrails/corpus/strings.d.ts +23 -0
- package/esm/src/guardrails/corpus/strings.js +29 -0
- package/esm/src/guardrails/corpus/types.d.ts +36 -0
- package/esm/src/guardrails/corpus/types.js +1 -0
- package/esm/src/guardrails/credential-rules.d.ts +36 -0
- package/esm/src/guardrails/credential-rules.js +3001 -0
- package/esm/src/guardrails/credential-scan.d.ts +45 -0
- package/esm/src/guardrails/credential-scan.js +172 -0
- package/esm/src/guardrails/destinations.d.ts +45 -0
- package/esm/src/guardrails/destinations.js +234 -0
- package/esm/src/guardrails/detect-at.d.ts +107 -0
- package/esm/src/guardrails/detect-at.js +434 -0
- package/esm/src/guardrails/detect-reply.d.ts +61 -0
- package/esm/src/guardrails/detect-reply.js +95 -0
- package/esm/src/guardrails/detect-stream.d.ts +33 -0
- package/esm/src/guardrails/detect-stream.js +77 -0
- package/esm/src/guardrails/detectors.d.ts +216 -0
- package/esm/src/guardrails/detectors.js +503 -0
- package/esm/src/guardrails/egress-automata.d.ts +12 -0
- package/esm/src/guardrails/egress-automata.js +25582 -0
- package/esm/src/guardrails/egress-compiler.d.ts +55 -0
- package/esm/src/guardrails/egress-compiler.js +431 -0
- package/esm/src/guardrails/egress-patterns.d.ts +26 -0
- package/esm/src/guardrails/egress-patterns.js +36 -0
- package/esm/src/guardrails/egress-stream.d.ts +123 -0
- package/esm/src/guardrails/egress-stream.js +774 -0
- package/esm/src/guardrails/egress-urls.d.ts +86 -0
- package/esm/src/guardrails/egress-urls.js +909 -0
- package/esm/src/guardrails/egress.d.ts +46 -0
- package/esm/src/guardrails/egress.js +124 -0
- package/esm/src/guardrails/error.d.ts +31 -0
- package/esm/src/guardrails/error.js +96 -0
- package/esm/src/guardrails/event-schemas.d.ts +100 -0
- package/esm/src/guardrails/event-schemas.js +48 -0
- package/esm/src/guardrails/events.d.ts +13 -0
- package/esm/src/guardrails/events.js +45 -0
- package/esm/src/guardrails/hints.d.ts +14 -0
- package/esm/src/guardrails/hints.js +57 -0
- package/esm/src/guardrails/hits.d.ts +14 -0
- package/esm/src/guardrails/hits.js +30 -0
- package/esm/src/guardrails/host-patterns.d.ts +85 -0
- package/esm/src/guardrails/host-patterns.js +173 -0
- package/esm/src/guardrails/injection-patterns.d.ts +20 -0
- package/esm/src/guardrails/injection-patterns.js +126 -0
- package/esm/src/guardrails/injection-reversed.d.ts +9 -0
- package/esm/src/guardrails/injection-reversed.js +49 -0
- package/esm/src/guardrails/injection.d.ts +30 -0
- package/esm/src/guardrails/injection.js +460 -0
- package/esm/src/guardrails/labels.d.ts +40 -0
- package/esm/src/guardrails/labels.js +874 -0
- package/esm/src/guardrails/live-outbound-gate.d.ts +55 -0
- package/esm/src/guardrails/live-outbound-gate.js +298 -0
- package/esm/src/guardrails/mod.d.ts +54 -0
- package/esm/src/guardrails/mod.js +34 -0
- package/esm/src/guardrails/network.d.ts +46 -0
- package/esm/src/guardrails/network.js +330 -0
- package/esm/src/guardrails/normalize.d.ts +20 -0
- package/esm/src/guardrails/normalize.js +165 -0
- package/esm/src/guardrails/policy.d.ts +4 -0
- package/esm/src/guardrails/policy.js +21 -0
- package/esm/src/guardrails/progressive-yield.d.ts +110 -0
- package/esm/src/guardrails/progressive-yield.js +281 -0
- package/esm/src/guardrails/prompt-echo.d.ts +40 -0
- package/esm/src/guardrails/prompt-echo.js +306 -0
- package/esm/src/guardrails/quota.d.ts +21 -0
- package/esm/src/guardrails/quota.js +80 -0
- package/esm/src/guardrails/rules.d.ts +47 -0
- package/esm/src/guardrails/rules.js +47 -0
- package/esm/src/guardrails/sanitize.d.ts +40 -0
- package/esm/src/guardrails/sanitize.js +160 -0
- package/esm/src/guardrails/sensitive-groups.d.ts +21 -0
- package/esm/src/guardrails/sensitive-groups.js +12 -0
- package/esm/src/guardrails/sensitive.d.ts +22 -0
- package/esm/src/guardrails/sensitive.js +234 -0
- package/esm/src/guardrails/serialize.d.ts +15 -0
- package/esm/src/guardrails/serialize.js +37 -0
- package/esm/src/guardrails/testing.d.ts +11 -0
- package/esm/src/guardrails/testing.js +10 -0
- package/esm/src/guardrails/theorem-error.d.ts +21 -0
- package/esm/src/guardrails/theorem-error.js +54 -0
- package/esm/src/guardrails/thought-guard.d.ts +76 -0
- package/esm/src/guardrails/thought-guard.js +664 -0
- package/esm/src/guardrails/tool-directives.d.ts +38 -0
- package/esm/src/guardrails/tool-directives.js +195 -0
- package/esm/src/guardrails/tool-leak.d.ts +26 -0
- package/esm/src/guardrails/tool-leak.js +45 -0
- package/esm/src/guardrails/tool-result.d.ts +92 -0
- package/esm/src/guardrails/tool-result.js +272 -0
- package/esm/src/guardrails/types.d.ts +250 -0
- package/esm/src/guardrails/types.js +58 -0
- package/esm/src/host/client-turn.d.ts +36 -0
- package/esm/src/host/client-turn.js +80 -0
- package/esm/src/host/mint-trace.d.ts +29 -0
- package/esm/src/host/mint-trace.js +60 -0
- package/esm/src/host/mod.d.ts +13 -0
- package/esm/src/host/mod.js +11 -0
- package/esm/src/host/readStreamingJsonStringField.d.ts +2 -0
- package/esm/src/host/readStreamingJsonStringField.js +27 -0
- package/esm/src/host/reply.d.ts +13 -0
- package/esm/src/host/reply.js +41 -0
- package/esm/src/interface/blocks.d.ts +11 -0
- package/esm/src/interface/blocks.js +283 -0
- package/esm/src/interface/composer-actions.d.ts +24 -0
- package/esm/src/interface/composer-actions.js +33 -0
- package/esm/src/interface/draft.d.ts +20 -0
- package/esm/src/interface/draft.js +39 -0
- package/esm/src/interface/from-profile.d.ts +24 -0
- package/esm/src/interface/from-profile.js +179 -0
- package/esm/src/interface/history.d.ts +46 -0
- package/esm/src/interface/history.js +278 -0
- package/esm/src/interface/inputs.d.ts +11 -0
- package/esm/src/interface/inputs.js +67 -0
- package/esm/src/interface/mod.d.ts +33 -0
- package/esm/src/interface/mod.js +22 -0
- package/esm/src/interface/models.d.ts +26 -0
- package/esm/src/interface/models.js +50 -0
- package/esm/src/interface/pending.d.ts +57 -0
- package/esm/src/interface/pending.js +152 -0
- package/esm/src/interface/profile-interface.d.ts +4 -0
- package/esm/src/interface/profile-interface.js +237 -0
- package/esm/src/interface/session.d.ts +71 -0
- package/esm/src/interface/session.js +128 -0
- package/esm/src/interface/stop.d.ts +13 -0
- package/esm/src/interface/stop.js +28 -0
- package/esm/src/interface/tool-calls.d.ts +32 -0
- package/esm/src/interface/tool-calls.js +127 -0
- package/esm/src/interface/tool-invoke.d.ts +6 -0
- package/esm/src/interface/tool-invoke.js +22 -0
- package/esm/src/interface/tool-media.d.ts +11 -0
- package/esm/src/interface/tool-media.js +113 -0
- package/esm/src/interface/types.d.ts +278 -0
- package/esm/src/interface/types.js +5 -0
- package/esm/src/kernel/api-catalog.d.ts +85 -0
- package/esm/src/kernel/api-catalog.js +229 -0
- package/esm/src/kernel/auth/credential-source.d.ts +23 -0
- package/esm/src/kernel/auth/credential-source.js +11 -0
- package/esm/src/kernel/auth/crypto.d.ts +56 -0
- package/esm/src/kernel/auth/crypto.js +163 -0
- package/esm/src/kernel/auth/mod.d.ts +5 -0
- package/esm/src/kernel/auth/mod.js +5 -0
- package/esm/src/kernel/auth/oauth.d.ts +18 -0
- package/esm/src/kernel/auth/oauth.js +439 -0
- package/esm/src/kernel/auth/scope-refusal.d.ts +9 -0
- package/esm/src/kernel/auth/scope-refusal.js +8 -0
- package/esm/src/kernel/auth/typed-secret.d.ts +13 -0
- package/esm/src/kernel/auth/typed-secret.js +23 -0
- package/esm/src/kernel/auth/types.d.ts +152 -0
- package/esm/src/kernel/auth/types.js +1 -0
- package/esm/src/kernel/checkpoint.d.ts +43 -0
- package/esm/src/kernel/checkpoint.js +58 -0
- package/esm/src/kernel/default-scope.d.ts +72 -0
- package/esm/src/kernel/default-scope.js +121 -0
- package/esm/src/kernel/engine/call-trace.d.ts +19 -0
- package/esm/src/kernel/engine/call-trace.js +29 -0
- package/esm/src/kernel/engine/compaction.d.ts +71 -0
- package/esm/src/kernel/engine/compaction.js +203 -0
- package/esm/src/kernel/engine/decision.d.ts +43 -0
- package/esm/src/kernel/engine/decision.js +439 -0
- package/esm/src/kernel/engine/embedding.d.ts +8 -0
- package/esm/src/kernel/engine/embedding.js +118 -0
- package/esm/src/kernel/engine/hash.d.ts +6 -0
- package/esm/src/kernel/engine/hash.js +22 -0
- package/esm/src/kernel/engine/live-inbound.d.ts +19 -0
- package/esm/src/kernel/engine/live-inbound.js +44 -0
- package/esm/src/kernel/engine/live-ingress.d.ts +15 -0
- package/esm/src/kernel/engine/live-ingress.js +42 -0
- package/esm/src/kernel/engine/record.d.ts +3 -0
- package/esm/src/kernel/engine/record.js +11 -0
- package/esm/src/kernel/engine/repair.d.ts +7 -0
- package/esm/src/kernel/engine/repair.js +36 -0
- package/esm/src/kernel/engine/runner/gates.d.ts +5 -0
- package/esm/src/kernel/engine/runner/gates.js +508 -0
- package/esm/src/kernel/engine/runner/mod.d.ts +29 -0
- package/esm/src/kernel/engine/runner/mod.js +625 -0
- package/esm/src/kernel/engine/runner/nested.d.ts +32 -0
- package/esm/src/kernel/engine/runner/nested.js +134 -0
- package/esm/src/kernel/engine/runner/schema-validation.d.ts +35 -0
- package/esm/src/kernel/engine/runner/schema-validation.js +179 -0
- package/esm/src/kernel/engine/runner/stages.d.ts +28 -0
- package/esm/src/kernel/engine/runner/stages.js +41 -0
- package/esm/src/kernel/engine/runner/state.d.ts +97 -0
- package/esm/src/kernel/engine/runner/state.js +50 -0
- package/esm/src/kernel/engine/runner/step-order.d.ts +27 -0
- package/esm/src/kernel/engine/runner/step-order.js +165 -0
- package/esm/src/kernel/engine/runner/steps.d.ts +14 -0
- package/esm/src/kernel/engine/runner/steps.js +519 -0
- package/esm/src/kernel/engine/runner/stream.d.ts +71 -0
- package/esm/src/kernel/engine/runner/stream.js +376 -0
- package/esm/src/kernel/engine/runner/usage.d.ts +45 -0
- package/esm/src/kernel/engine/runner/usage.js +148 -0
- package/esm/src/kernel/engine/session/mod.d.ts +33 -0
- package/esm/src/kernel/engine/session/mod.js +1182 -0
- package/esm/src/kernel/engine/session/session-trace.d.ts +115 -0
- package/esm/src/kernel/engine/session/session-trace.js +500 -0
- package/esm/src/kernel/engine/token-estimate.d.ts +23 -0
- package/esm/src/kernel/engine/token-estimate.js +38 -0
- package/esm/src/kernel/engine/tool-trace.d.ts +58 -0
- package/esm/src/kernel/engine/tool-trace.js +132 -0
- package/esm/src/kernel/engine/tree.d.ts +2 -0
- package/esm/src/kernel/engine/tree.js +17 -0
- package/esm/src/kernel/engine/turn-trace.d.ts +119 -0
- package/esm/src/kernel/engine/turn-trace.js +855 -0
- package/esm/src/kernel/engine/usage.d.ts +36 -0
- package/esm/src/kernel/engine/usage.js +151 -0
- package/esm/src/kernel/interaction-parts.d.ts +13 -0
- package/esm/src/kernel/interaction-parts.js +40 -0
- package/esm/src/kernel/json.d.ts +10 -0
- package/esm/src/kernel/json.js +3 -0
- package/esm/src/kernel/mod.d.ts +74 -0
- package/esm/src/kernel/mod.js +45 -0
- package/esm/src/kernel/profile-graph.d.ts +145 -0
- package/esm/src/kernel/profile-graph.js +158 -0
- package/esm/src/kernel/profile-presence.d.ts +18 -0
- package/esm/src/kernel/profile-presence.js +158 -0
- package/esm/src/kernel/profile-scope.d.ts +40 -0
- package/esm/src/kernel/profile-scope.js +274 -0
- package/esm/src/kernel/protocols/binding.d.ts +65 -0
- package/esm/src/kernel/protocols/binding.js +125 -0
- package/esm/src/kernel/protocols/limits.d.ts +15 -0
- package/esm/src/kernel/protocols/limits.js +28 -0
- package/esm/src/kernel/protocols/mod.d.ts +5 -0
- package/esm/src/kernel/protocols/mod.js +5 -0
- package/esm/src/kernel/protocols/prices.d.ts +36 -0
- package/esm/src/kernel/protocols/prices.js +37 -0
- package/esm/src/kernel/protocols/protocol.d.ts +253 -0
- package/esm/src/kernel/protocols/protocol.js +253 -0
- package/esm/src/kernel/protocols/provider.d.ts +108 -0
- package/esm/src/kernel/protocols/provider.js +143 -0
- package/esm/src/kernel/protocols/runtime.d.ts +55 -0
- package/esm/src/kernel/protocols/runtime.js +534 -0
- package/esm/src/kernel/provider-budget.d.ts +32 -0
- package/esm/src/kernel/provider-budget.js +262 -0
- package/esm/src/kernel/provider-dispatch.d.ts +13 -0
- package/esm/src/kernel/provider-dispatch.js +36 -0
- package/esm/src/kernel/provider-live.d.ts +7 -0
- package/esm/src/kernel/provider-live.js +189 -0
- package/esm/src/kernel/provider-runtime.d.ts +57 -0
- package/esm/src/kernel/provider-runtime.js +524 -0
- package/esm/src/kernel/registry/attachments.d.ts +46 -0
- package/esm/src/kernel/registry/attachments.js +220 -0
- package/esm/src/kernel/registry/catalog.d.ts +25 -0
- package/esm/src/kernel/registry/catalog.js +85 -0
- package/esm/src/kernel/registry/embedding-rules.d.ts +28 -0
- package/esm/src/kernel/registry/embedding-rules.js +66 -0
- package/esm/src/kernel/registry/ingress.d.ts +12 -0
- package/esm/src/kernel/registry/ingress.js +179 -0
- package/esm/src/kernel/registry/kernel-registry.d.ts +15 -0
- package/esm/src/kernel/registry/kernel-registry.js +15 -0
- package/esm/src/kernel/registry/profile-outputs.d.ts +3 -0
- package/esm/src/kernel/registry/profile-outputs.js +10 -0
- package/esm/src/kernel/registry/profiles.d.ts +116 -0
- package/esm/src/kernel/registry/profiles.js +773 -0
- package/esm/src/kernel/registry/provider-request.d.ts +6 -0
- package/esm/src/kernel/registry/provider-request.js +34 -0
- package/esm/src/kernel/registry/resolve.d.ts +17 -0
- package/esm/src/kernel/registry/resolve.js +238 -0
- package/esm/src/kernel/registry/schemas.d.ts +12 -0
- package/esm/src/kernel/registry/schemas.js +27 -0
- package/esm/src/kernel/registry/slot-fill.d.ts +7 -0
- package/esm/src/kernel/registry/slot-fill.js +22 -0
- package/esm/src/kernel/registry/sole-model.d.ts +2 -0
- package/esm/src/kernel/registry/sole-model.js +4 -0
- package/esm/src/kernel/registry/system-prompt.d.ts +8 -0
- package/esm/src/kernel/registry/system-prompt.js +32 -0
- package/esm/src/kernel/registry/system-role.d.ts +3 -0
- package/esm/src/kernel/registry/system-role.js +9 -0
- package/esm/src/kernel/registry/vault.d.ts +14 -0
- package/esm/src/kernel/registry/vault.js +1 -0
- package/esm/src/kernel/schema.d.ts +226 -0
- package/esm/src/kernel/schema.js +895 -0
- package/esm/src/kernel/scope.d.ts +29 -0
- package/esm/src/kernel/scope.js +45 -0
- package/esm/src/kernel/stages.d.ts +176 -0
- package/esm/src/kernel/stages.js +431 -0
- package/esm/src/kernel/stop.d.ts +116 -0
- package/esm/src/kernel/stop.js +137 -0
- package/esm/src/kernel/system-parts.d.ts +26 -0
- package/esm/src/kernel/system-parts.js +98 -0
- package/esm/src/kernel/tools/activity-label.d.ts +22 -0
- package/esm/src/kernel/tools/activity-label.js +435 -0
- package/esm/src/kernel/tools/agent.d.ts +66 -0
- package/esm/src/kernel/tools/agent.js +212 -0
- package/esm/src/kernel/tools/coordinate.d.ts +4 -0
- package/esm/src/kernel/tools/coordinate.js +165 -0
- package/esm/src/kernel/tools/events.d.ts +66 -0
- package/esm/src/kernel/tools/events.js +184 -0
- package/esm/src/kernel/tools/execute.d.ts +100 -0
- package/esm/src/kernel/tools/execute.js +1173 -0
- package/esm/src/kernel/tools/gate-answer.d.ts +60 -0
- package/esm/src/kernel/tools/gate-answer.js +65 -0
- package/esm/src/kernel/tools/handler-events.d.ts +45 -0
- package/esm/src/kernel/tools/handler-events.js +106 -0
- package/esm/src/kernel/tools/harness.d.ts +17 -0
- package/esm/src/kernel/tools/harness.js +43 -0
- package/esm/src/kernel/tools/http-limit.d.ts +27 -0
- package/esm/src/kernel/tools/http-limit.js +85 -0
- package/esm/src/kernel/tools/invoke.d.ts +32 -0
- package/esm/src/kernel/tools/invoke.js +282 -0
- package/esm/src/kernel/tools/mcp-sessions.d.ts +23 -0
- package/esm/src/kernel/tools/mcp-sessions.js +69 -0
- package/esm/src/kernel/tools/mod.d.ts +10 -0
- package/esm/src/kernel/tools/mod.js +7 -0
- package/esm/src/kernel/tools/model-text.d.ts +16 -0
- package/esm/src/kernel/tools/model-text.js +31 -0
- package/esm/src/kernel/tools/operation.d.ts +76 -0
- package/esm/src/kernel/tools/operation.js +100 -0
- package/esm/src/kernel/tools/page-answer.d.ts +8 -0
- package/esm/src/kernel/tools/page-answer.js +19 -0
- package/esm/src/kernel/tools/permission.d.ts +15 -0
- package/esm/src/kernel/tools/permission.js +38 -0
- package/esm/src/kernel/tools/project.d.ts +11 -0
- package/esm/src/kernel/tools/project.js +55 -0
- package/esm/src/kernel/tools/registry.d.ts +27 -0
- package/esm/src/kernel/tools/registry.js +143 -0
- package/esm/src/kernel/tools/remote.d.ts +144 -0
- package/esm/src/kernel/tools/remote.js +1125 -0
- package/esm/src/kernel/tools/resolve.d.ts +31 -0
- package/esm/src/kernel/tools/resolve.js +267 -0
- package/esm/src/kernel/tools/run.d.ts +28 -0
- package/esm/src/kernel/tools/run.js +86 -0
- package/esm/src/kernel/tools/schema.d.ts +10 -0
- package/esm/src/kernel/tools/schema.js +95 -0
- package/esm/src/kernel/tools/signed-in-fetch.d.ts +19 -0
- package/esm/src/kernel/tools/signed-in-fetch.js +45 -0
- package/esm/src/kernel/tools/stage-run.d.ts +116 -0
- package/esm/src/kernel/tools/stage-run.js +198 -0
- package/esm/src/kernel/tools/types.d.ts +497 -0
- package/esm/src/kernel/tools/types.js +1 -0
- package/esm/src/kernel/tools/unchecked-output.d.ts +14 -0
- package/esm/src/kernel/tools/unchecked-output.js +18 -0
- package/esm/src/kernel/turn-events.d.ts +776 -0
- package/esm/src/kernel/turn-events.js +543 -0
- package/esm/src/kernel/types.d.ts +1025 -0
- package/esm/src/kernel/types.js +1 -0
- package/esm/src/kernel/util/base64.d.ts +4 -0
- package/esm/src/kernel/util/base64.js +15 -0
- package/esm/src/kernel/util/exact-type.d.ts +31 -0
- package/esm/src/kernel/util/exact-type.js +1 -0
- package/esm/src/kernel/util/find-last.d.ts +3 -0
- package/esm/src/kernel/util/find-last.js +9 -0
- package/esm/src/kernel/util/mime.d.ts +2 -0
- package/esm/src/kernel/util/mime.js +4 -0
- package/esm/src/kernel/util/partial-json.d.ts +23 -0
- package/esm/src/kernel/util/partial-json.js +128 -0
- package/esm/src/kernel/util/record.d.ts +2 -0
- package/esm/src/kernel/util/record.js +4 -0
- package/esm/src/observability/destinations.d.ts +14 -0
- package/esm/src/observability/destinations.js +43 -0
- package/esm/src/observability/jsonl.d.ts +18 -0
- package/esm/src/observability/jsonl.js +110 -0
- package/esm/src/observability/mod.d.ts +22 -0
- package/esm/src/observability/mod.js +16 -0
- package/esm/src/observability/openinference.d.ts +11 -0
- package/esm/src/observability/openinference.js +205 -0
- package/esm/src/observability/otlp.d.ts +71 -0
- package/esm/src/observability/otlp.js +98 -0
- package/esm/src/observability/phoenix.d.ts +30 -0
- package/esm/src/observability/phoenix.js +71 -0
- package/esm/src/observability/policy.d.ts +17 -0
- package/esm/src/observability/policy.js +73 -0
- package/esm/src/observability/resolve-policy.d.ts +8 -0
- package/esm/src/observability/resolve-policy.js +64 -0
- package/esm/src/observability/spans.d.ts +22 -0
- package/esm/src/observability/spans.js +72 -0
- package/esm/src/observability/trace-catalog.d.ts +128 -0
- package/esm/src/observability/trace-catalog.js +906 -0
- package/esm/src/observability/trace-record.d.ts +23 -0
- package/esm/src/observability/trace-record.js +228 -0
- package/esm/src/observability/trace-schema.d.ts +57 -0
- package/esm/src/observability/trace-schema.js +59 -0
- package/esm/src/observability/trace-sink.d.ts +14 -0
- package/esm/src/observability/trace-sink.js +3 -0
- package/esm/src/observability/trace-span.d.ts +98 -0
- package/esm/src/observability/trace-span.js +201 -0
- package/esm/src/observability/trace.d.ts +13 -0
- package/esm/src/observability/trace.js +37 -0
- package/esm/src/observability/types.d.ts +109 -0
- package/esm/src/observability/types.js +3 -0
- package/esm/src/presets/google/speech-voices.d.ts +9 -0
- package/esm/src/presets/google/speech-voices.js +38 -0
- package/esm/src/presets/google-limits.d.ts +13 -0
- package/esm/src/presets/google-limits.js +18 -0
- package/esm/src/presets/google.d.ts +119 -0
- package/esm/src/presets/google.js +197 -0
- package/esm/src/presets/local.d.ts +26 -0
- package/esm/src/presets/local.js +30 -0
- package/esm/src/presets/mod.d.ts +11 -0
- package/esm/src/presets/mod.js +9 -0
- package/esm/src/presets/openrouter.d.ts +26 -0
- package/esm/src/presets/openrouter.js +31 -0
- package/esm/src/providers/embedding-limits.d.ts +7 -0
- package/esm/src/providers/embedding-limits.js +12 -0
- package/esm/src/providers/gemini/embedding-protocol.d.ts +8 -0
- package/esm/src/providers/gemini/embedding-protocol.js +125 -0
- package/esm/src/providers/gemini/interactions-protocol.d.ts +8 -0
- package/esm/src/providers/gemini/interactions-protocol.js +105 -0
- package/esm/src/providers/gemini/live-protocol.d.ts +3 -0
- package/esm/src/providers/gemini/live-protocol.js +191 -0
- package/esm/src/providers/gemini/prices.d.ts +3 -0
- package/esm/src/providers/gemini/prices.js +63 -0
- package/esm/src/providers/gemini/provider.d.ts +7 -0
- package/esm/src/providers/gemini/provider.js +39 -0
- package/esm/src/providers/google/api-error.d.ts +8 -0
- package/esm/src/providers/google/api-error.js +123 -0
- package/esm/src/providers/google/builtins.d.ts +14 -0
- package/esm/src/providers/google/builtins.js +57 -0
- package/esm/src/providers/google/grounding.d.ts +5 -0
- package/esm/src/providers/google/grounding.js +226 -0
- package/esm/src/providers/google/interactions/framing.d.ts +27 -0
- package/esm/src/providers/google/interactions/framing.js +304 -0
- package/esm/src/providers/google/interactions/steps.d.ts +12 -0
- package/esm/src/providers/google/interactions/steps.js +200 -0
- package/esm/src/providers/google/interactions/stream.d.ts +23 -0
- package/esm/src/providers/google/interactions/stream.js +230 -0
- package/esm/src/providers/google/live/framing.d.ts +61 -0
- package/esm/src/providers/google/live/framing.js +597 -0
- package/esm/src/providers/google/live/stream.d.ts +13 -0
- package/esm/src/providers/google/live/stream.js +57 -0
- package/esm/src/providers/google/thinking.d.ts +3 -0
- package/esm/src/providers/google/thinking.js +8 -0
- package/esm/src/providers/google/urls.d.ts +4 -0
- package/esm/src/providers/google/urls.js +4 -0
- package/esm/src/providers/google/usage.d.ts +7 -0
- package/esm/src/providers/google/usage.js +49 -0
- package/esm/src/providers/live.d.ts +6 -0
- package/esm/src/providers/live.js +6 -0
- package/esm/src/providers/local/embedding-protocol.d.ts +7 -0
- package/esm/src/providers/local/embedding-protocol.js +60 -0
- package/esm/src/providers/local/provider.d.ts +7 -0
- package/esm/src/providers/local/provider.js +28 -0
- package/esm/src/providers/mod.d.ts +32 -0
- package/esm/src/providers/mod.js +23 -0
- package/esm/src/providers/open-ai/protocol.d.ts +3 -0
- package/esm/src/providers/open-ai/protocol.js +189 -0
- package/esm/src/providers/openrouter/embedding-protocol.d.ts +6 -0
- package/esm/src/providers/openrouter/embedding-protocol.js +86 -0
- package/esm/src/providers/openrouter/image.d.ts +15 -0
- package/esm/src/providers/openrouter/image.js +34 -0
- package/esm/src/providers/openrouter/images-protocol.d.ts +3 -0
- package/esm/src/providers/openrouter/images-protocol.js +82 -0
- package/esm/src/providers/openrouter/openai/compat.d.ts +19 -0
- package/esm/src/providers/openrouter/openai/compat.js +162 -0
- package/esm/src/providers/openrouter/openai/image-payload.d.ts +9 -0
- package/esm/src/providers/openrouter/openai/image-payload.js +115 -0
- package/esm/src/providers/openrouter/openai/reasoning-state.d.ts +2 -0
- package/esm/src/providers/openrouter/openai/reasoning-state.js +31 -0
- package/esm/src/providers/openrouter/openai/usage.d.ts +8 -0
- package/esm/src/providers/openrouter/openai/usage.js +56 -0
- package/esm/src/providers/openrouter/protocol.d.ts +8 -0
- package/esm/src/providers/openrouter/protocol.js +171 -0
- package/esm/src/providers/openrouter/provider.d.ts +10 -0
- package/esm/src/providers/openrouter/provider.js +50 -0
- package/esm/src/providers/shared/carried-tool-files.d.ts +7 -0
- package/esm/src/providers/shared/carried-tool-files.js +43 -0
- package/esm/src/providers/shared/pcm.d.ts +14 -0
- package/esm/src/providers/shared/pcm.js +78 -0
- package/esm/src/providers/shared/protocol-events.d.ts +8 -0
- package/esm/src/providers/shared/protocol-events.js +20 -0
- package/esm/src/providers/shared/response-identity.d.ts +11 -0
- package/esm/src/providers/shared/response-identity.js +12 -0
- package/esm/src/providers/shared/retry.d.ts +17 -0
- package/esm/src/providers/shared/retry.js +90 -0
- package/esm/src/providers/shared/sse.d.ts +6 -0
- package/esm/src/providers/shared/sse.js +93 -0
- package/esm/src/providers/shared/structured-output.d.ts +4 -0
- package/esm/src/providers/shared/structured-output.js +11 -0
- package/esm/src/providers/shared/tool-args.d.ts +24 -0
- package/esm/src/providers/shared/tool-args.js +88 -0
- package/esm/src/providers/shared/tool-draft.d.ts +16 -0
- package/esm/src/providers/shared/tool-draft.js +14 -0
- package/esm/src/providers/shared/upstream-tap.d.ts +8 -0
- package/esm/src/providers/shared/upstream-tap.js +85 -0
- package/esm/src/providers/shared/upstream-tape.d.ts +6 -0
- package/esm/src/providers/shared/upstream-tape.js +88 -0
- package/esm/src/providers/system-one/protocol.d.ts +8 -0
- package/esm/src/providers/system-one/protocol.js +93 -0
- package/esm/src/providers/types.d.ts +51 -0
- package/esm/src/providers/types.js +2 -0
- package/esm/src/providers/typesafe/provider.d.ts +7 -0
- package/esm/src/providers/typesafe/provider.js +24 -0
- package/esm/src/surface/formats.d.ts +46 -0
- package/esm/src/surface/formats.js +178 -0
- package/esm/src/surface/mod.d.ts +16 -0
- package/esm/src/surface/mod.js +12 -0
- package/esm/src/surface/runtime.d.ts +44 -0
- package/esm/src/surface/runtime.js +441 -0
- package/esm/src/surface/tools.d.ts +9 -0
- package/esm/src/surface/tools.js +62 -0
- package/esm/src/surface/types.d.ts +110 -0
- package/esm/src/surface/types.js +4 -0
- package/package.json +100 -4
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { TurnCost, TurnEvent, TurnGroundingCount, TurnTokens } from '../types.js';
|
|
2
|
+
/** Provider usage already mapped to the OpenTelemetry GenAI meanings. */
|
|
3
|
+
export interface ReportedUsage {
|
|
4
|
+
/** Everything the model read. `undefined` = not reported. */
|
|
5
|
+
input?: number;
|
|
6
|
+
/** Everything the model wrote, reasoning included. `undefined` = not reported. */
|
|
7
|
+
output?: number;
|
|
8
|
+
thinking?: number;
|
|
9
|
+
toolUse?: number;
|
|
10
|
+
cached?: number;
|
|
11
|
+
cacheWrite?: number;
|
|
12
|
+
cost?: TurnCost;
|
|
13
|
+
byModality?: TurnTokens['byModality'];
|
|
14
|
+
grounding?: TurnGroundingCount[];
|
|
15
|
+
}
|
|
16
|
+
export declare function usageCount(value: unknown): number | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* `TurnTokens` from reported usage, or `undefined` when the provider reported
|
|
19
|
+
* nothing. A missing side is 0 and listed in `estimated`. Input 0 counts as
|
|
20
|
+
* missing, since every model call reads a prompt; an all-zero row (a
|
|
21
|
+
* placeholder some servers stream) reports nothing.
|
|
22
|
+
*/
|
|
23
|
+
export declare function reportedTokens(usage: ReportedUsage): TurnTokens | undefined;
|
|
24
|
+
/** A turn's usage: the sum of its `tokens` events. `done.tokens` and the turn's span both read it. */
|
|
25
|
+
export declare function sumEventTokens(events: readonly TurnEvent[]): TurnTokens | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* A turn's usage with its agent tool calls': its own `tokens` events plus each
|
|
28
|
+
* call's `tokens` on the tool's `complete` or `error`. `done.tokens` reads it;
|
|
29
|
+
* the turn's span keeps `sumEventTokens`, since each call has its own span.
|
|
30
|
+
*/
|
|
31
|
+
export declare function sumTurnTokens(events: readonly TurnEvent[]): TurnTokens | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* A side is `estimated` when any call estimated it. Cost is `partial` when some call reported none;
|
|
34
|
+
* a missing `upstreamUsd` is not missing data (OpenRouter reports it only for BYOK).
|
|
35
|
+
*/
|
|
36
|
+
export declare function sumTokens(calls: TurnTokens[]): TurnTokens | undefined;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
export function usageCount(value) {
|
|
2
|
+
return typeof value === 'number' && Number.isFinite(value) && value >= 0 ? value : undefined;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* `TurnTokens` from reported usage, or `undefined` when the provider reported
|
|
6
|
+
* nothing. A missing side is 0 and listed in `estimated`. Input 0 counts as
|
|
7
|
+
* missing, since every model call reads a prompt; an all-zero row (a
|
|
8
|
+
* placeholder some servers stream) reports nothing.
|
|
9
|
+
*/
|
|
10
|
+
export function reportedTokens(usage) {
|
|
11
|
+
const reportedInput = usage.input ? usage.input : undefined;
|
|
12
|
+
if (reportedInput === undefined && !usage.output)
|
|
13
|
+
return undefined;
|
|
14
|
+
const estimated = [];
|
|
15
|
+
if (reportedInput === undefined)
|
|
16
|
+
estimated.push('input');
|
|
17
|
+
if (usage.output === undefined)
|
|
18
|
+
estimated.push('output');
|
|
19
|
+
const input = reportedInput ?? 0;
|
|
20
|
+
const output = usage.output ?? 0;
|
|
21
|
+
return {
|
|
22
|
+
input,
|
|
23
|
+
output,
|
|
24
|
+
...(usage.thinking ? { thinking: usage.thinking } : {}),
|
|
25
|
+
...(usage.toolUse ? { toolUse: usage.toolUse } : {}),
|
|
26
|
+
...(usage.cached ? { cached: usage.cached } : {}),
|
|
27
|
+
...(usage.cacheWrite ? { cacheWrite: usage.cacheWrite } : {}),
|
|
28
|
+
total: input + output,
|
|
29
|
+
...(usage.cost ? { cost: usage.cost } : {}),
|
|
30
|
+
...(estimated.length > 0 ? { estimated } : {}),
|
|
31
|
+
...(usage.byModality ? { byModality: usage.byModality } : {}),
|
|
32
|
+
...(usage.grounding ? { grounding: usage.grounding } : {}),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function sumCost(calls) {
|
|
36
|
+
const costs = calls.flatMap((call) => (call.cost ? [call.cost] : []));
|
|
37
|
+
if (costs.length === 0)
|
|
38
|
+
return undefined;
|
|
39
|
+
const upstream = costs.flatMap((cost) => cost.upstreamUsd === undefined ? [] : [cost.upstreamUsd]);
|
|
40
|
+
const partial = costs.length < calls.length || costs.some((cost) => cost.partial);
|
|
41
|
+
return {
|
|
42
|
+
usd: costs.reduce((sum, cost) => sum + cost.usd, 0),
|
|
43
|
+
...(upstream.length > 0 ? { upstreamUsd: upstream.reduce((sum, usd) => sum + usd, 0) } : {}),
|
|
44
|
+
...(partial ? { partial: true } : {}),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A modality's share summed across calls, kept only when every call reported
|
|
49
|
+
* that modality: a partial sum would read as exact and be wrong.
|
|
50
|
+
*/
|
|
51
|
+
function sumByModality(calls) {
|
|
52
|
+
const sides = ['input', 'output'];
|
|
53
|
+
const summed = {};
|
|
54
|
+
for (const side of sides) {
|
|
55
|
+
const [first, ...rest] = calls.map((call) => call.byModality?.[side]);
|
|
56
|
+
const modalities = Object.keys(first ?? {}).filter((modality) => rest.every((counts) => counts?.[modality] !== undefined));
|
|
57
|
+
if (modalities.length === 0)
|
|
58
|
+
continue;
|
|
59
|
+
summed[side] = Object.fromEntries(modalities.map((modality) => [
|
|
60
|
+
modality,
|
|
61
|
+
calls.reduce((sum, call) => sum + (call.byModality?.[side]?.[modality] ?? 0), 0),
|
|
62
|
+
]));
|
|
63
|
+
}
|
|
64
|
+
return Object.keys(summed).length > 0 ? summed : undefined;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Grounding use summed per tool over the calls that reported it; a call that
|
|
68
|
+
* ran no grounding tool reports none. `searchQueryCount` sums only when every
|
|
69
|
+
* report of that tool carried it.
|
|
70
|
+
*/
|
|
71
|
+
function sumGrounding(calls) {
|
|
72
|
+
const byType = new Map();
|
|
73
|
+
for (const entry of calls.flatMap((call) => call.grounding ?? [])) {
|
|
74
|
+
byType.set(entry.type, [...(byType.get(entry.type) ?? []), entry]);
|
|
75
|
+
}
|
|
76
|
+
if (byType.size === 0)
|
|
77
|
+
return undefined;
|
|
78
|
+
return [...byType].map(([type, entries]) => {
|
|
79
|
+
const queries = entries.every((entry) => entry.searchQueryCount !== undefined);
|
|
80
|
+
return {
|
|
81
|
+
type,
|
|
82
|
+
count: entries.reduce((sum, entry) => sum + entry.count, 0),
|
|
83
|
+
...(queries
|
|
84
|
+
? {
|
|
85
|
+
searchQueryCount: entries.reduce((sum, entry) => sum + (entry.searchQueryCount ?? 0), 0),
|
|
86
|
+
}
|
|
87
|
+
: {}),
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/** A turn's usage: the sum of its `tokens` events. `done.tokens` and the turn's span both read it. */
|
|
92
|
+
export function sumEventTokens(events) {
|
|
93
|
+
return sumTokens(events.flatMap((event) => (event.type === 'tokens' ? [event.tokens] : [])));
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* A turn's usage with its agent tool calls': its own `tokens` events plus each
|
|
97
|
+
* call's `tokens` on the tool's `complete` or `error`. `done.tokens` reads it;
|
|
98
|
+
* the turn's span keeps `sumEventTokens`, since each call has its own span.
|
|
99
|
+
*/
|
|
100
|
+
export function sumTurnTokens(events) {
|
|
101
|
+
return sumTokens(events.flatMap((event) => {
|
|
102
|
+
if (event.type === 'tokens')
|
|
103
|
+
return [event.tokens];
|
|
104
|
+
if (event.type !== 'tool')
|
|
105
|
+
return [];
|
|
106
|
+
const { tool } = event;
|
|
107
|
+
return (tool.phase === 'complete' || tool.phase === 'error') && tool.tokens
|
|
108
|
+
? [tool.tokens]
|
|
109
|
+
: [];
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* A side is `estimated` when any call estimated it. Cost is `partial` when some call reported none;
|
|
114
|
+
* a missing `upstreamUsd` is not missing data (OpenRouter reports it only for BYOK).
|
|
115
|
+
*/
|
|
116
|
+
export function sumTokens(calls) {
|
|
117
|
+
if (calls.length === 0)
|
|
118
|
+
return undefined;
|
|
119
|
+
const add = (pick) => calls.reduce((sum, call) => sum + (pick(call) ?? 0), 0);
|
|
120
|
+
const input = add((call) => call.input);
|
|
121
|
+
const output = add((call) => call.output);
|
|
122
|
+
const thinking = add((call) => call.thinking);
|
|
123
|
+
const toolUse = add((call) => call.toolUse);
|
|
124
|
+
const cached = add((call) => call.cached);
|
|
125
|
+
const cacheWrite = add((call) => call.cacheWrite);
|
|
126
|
+
const cost = sumCost(calls);
|
|
127
|
+
const byModality = sumByModality(calls);
|
|
128
|
+
const grounding = sumGrounding(calls);
|
|
129
|
+
const sides = ['input', 'output'];
|
|
130
|
+
const estimated = sides.filter((side) => calls.some((call) => call.estimated?.includes(side)));
|
|
131
|
+
const unknownMedia = {};
|
|
132
|
+
for (const side of sides) {
|
|
133
|
+
const count = add((call) => call.unknownMedia?.[side]);
|
|
134
|
+
if (count > 0)
|
|
135
|
+
unknownMedia[side] = count;
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
input,
|
|
139
|
+
output,
|
|
140
|
+
...(thinking ? { thinking } : {}),
|
|
141
|
+
...(toolUse ? { toolUse } : {}),
|
|
142
|
+
...(cached ? { cached } : {}),
|
|
143
|
+
...(cacheWrite ? { cacheWrite } : {}),
|
|
144
|
+
total: input + output,
|
|
145
|
+
...(cost ? { cost } : {}),
|
|
146
|
+
...(estimated.length > 0 ? { estimated } : {}),
|
|
147
|
+
...(Object.keys(unknownMedia).length > 0 ? { unknownMedia } : {}),
|
|
148
|
+
...(byModality ? { byModality } : {}),
|
|
149
|
+
...(grounding ? { grounding } : {}),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { InteractionMediaRefPart, InteractionPart, TurnHistoryMessage } from './types.js';
|
|
2
|
+
/** `toGoogleValue` snake-cases `mimeType` to the documented Interactions `mime_type`. */
|
|
3
|
+
export declare function wireInteractionPart(part: InteractionPart): Record<string, string>;
|
|
4
|
+
/** True for a part that is media referenced by `uri` rather than carried as data. */
|
|
5
|
+
export declare function isMediaRefPart(part: InteractionPart): part is InteractionMediaRefPart;
|
|
6
|
+
/**
|
|
7
|
+
* Everything a history message says, in the one order every provider adapter
|
|
8
|
+
* sends it: `content` first as a text part (when non-empty), then `parts`.
|
|
9
|
+
* Neither field replaces the other.
|
|
10
|
+
*/
|
|
11
|
+
export declare function historyMessageParts(msg: TurnHistoryMessage): InteractionPart[];
|
|
12
|
+
/** One step's calls as the assistant message that made them, with the reasoning written before them. */
|
|
13
|
+
export declare function historyToolCalls(calls: readonly Pick<import('./turn-events.js').ToolCallRequest, 'callId' | 'name' | 'arguments' | 'reasoning'>[]): TurnHistoryMessage;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** `toGoogleValue` snake-cases `mimeType` to the documented Interactions `mime_type`. */
|
|
2
|
+
export function wireInteractionPart(part) {
|
|
3
|
+
if (part.type === 'text') {
|
|
4
|
+
return { type: 'text', text: part.text };
|
|
5
|
+
}
|
|
6
|
+
if ('uri' in part) {
|
|
7
|
+
return { type: part.type, mimeType: part.mimeType, uri: part.uri };
|
|
8
|
+
}
|
|
9
|
+
return { type: part.type, mimeType: part.mimeType, data: part.data };
|
|
10
|
+
}
|
|
11
|
+
/** True for a part that is media referenced by `uri` rather than carried as data. */
|
|
12
|
+
export function isMediaRefPart(part) {
|
|
13
|
+
return part.type !== 'text' && 'uri' in part;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Everything a history message says, in the one order every provider adapter
|
|
17
|
+
* sends it: `content` first as a text part (when non-empty), then `parts`.
|
|
18
|
+
* Neither field replaces the other.
|
|
19
|
+
*/
|
|
20
|
+
export function historyMessageParts(msg) {
|
|
21
|
+
const parts = msg.parts ?? [];
|
|
22
|
+
return msg.content ? [{ type: 'text', text: msg.content }, ...parts] : [...parts];
|
|
23
|
+
}
|
|
24
|
+
/** One step's calls as the assistant message that made them, with the reasoning written before them. */
|
|
25
|
+
export function historyToolCalls(calls) {
|
|
26
|
+
const reasoning = calls.flatMap((call) => call.reasoning ?? []);
|
|
27
|
+
const tool_calls = [];
|
|
28
|
+
for (const call of calls) {
|
|
29
|
+
tool_calls.push({
|
|
30
|
+
id: call.callId,
|
|
31
|
+
type: 'function',
|
|
32
|
+
function: { name: call.name, arguments: JSON.stringify(call.arguments) },
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
role: 'assistant',
|
|
37
|
+
tool_calls,
|
|
38
|
+
...(reasoning.length ? { reasoning: [...reasoning] } : {}),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Any value JSON can hold. */
|
|
3
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
4
|
+
[key: string]: JsonValue;
|
|
5
|
+
};
|
|
6
|
+
export type JsonObject = {
|
|
7
|
+
[key: string]: JsonValue;
|
|
8
|
+
};
|
|
9
|
+
export declare const jsonValueSchema: z.ZodType<JsonValue>;
|
|
10
|
+
export declare const jsonObjectSchema: z.ZodRecord<z.ZodString, z.ZodType<JsonValue>>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profile, turn, tool, provider, egress, and event contracts for THEOREM.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import "../../_dnt.polyfills.js";
|
|
7
|
+
export * from './auth/mod.js';
|
|
8
|
+
export type { ProviderCheckpoint, ProviderContinuationPolicy, ProviderStateRebuilt, ProviderWarning, } from './checkpoint.js';
|
|
9
|
+
export { historyHash, providerCheckpointSchema, providerContinuationSchema, providerWarningSchema, } from './checkpoint.js';
|
|
10
|
+
export { clearProfiles, compactHistory, getProfile, getProvider, getStructured, getTool, hasProfile, hasTool, invokeTool, invokeToolStep, listProfiles, listProtocols, listProviders, listTools, projectProfile, registerProfile, registerProfiles, registerProvider, registerStructured, registerTool, registerTools, requireTool, resetTools, resolveTurn, runDecision, runEmbedding, runSession, runTurn, } from './default-scope.js';
|
|
11
|
+
export type { CompactionSplit, CompactionTokens } from './engine/compaction.js';
|
|
12
|
+
export { compactionMeter, compactionNeeded, resolveCompactionTokens, resolveHistoryTokens, shouldCompact, splitForCompaction, } from './engine/compaction.js';
|
|
13
|
+
export type { RunDecisionOptions } from './engine/decision.js';
|
|
14
|
+
export { DecisionError, validateDecisionRequest } from './engine/decision.js';
|
|
15
|
+
export type { RunEmbeddingOptions } from './engine/embedding.js';
|
|
16
|
+
export type { LiveIngressChannel } from './engine/live-ingress.js';
|
|
17
|
+
export { assertLiveIngress, assertLiveIngressConfigured, hasAnyLiveIngress, liveIngressChannelDefault, liveIngressEnabled, liveIngressEnabledFromSpec, } from './engine/live-ingress.js';
|
|
18
|
+
export type { RunSessionOptions, SignInGatePolicy } from './engine/session/mod.js';
|
|
19
|
+
export type { TokenCount, TokenEstimator } from './engine/token-estimate.js';
|
|
20
|
+
export { loadTokenEstimator, TOKEN_TEXT_ENCODING, } from './engine/token-estimate.js';
|
|
21
|
+
export { sumTokens } from './engine/usage.js';
|
|
22
|
+
export { isMediaRefPart, wireInteractionPart } from './interaction-parts.js';
|
|
23
|
+
export type { JsonObject, JsonValue } from './json.js';
|
|
24
|
+
export { jsonObjectSchema, jsonValueSchema } from './json.js';
|
|
25
|
+
export type { ProfileGraphEditor, ProfileGraphFacet, ProfileGraphFacetId, ProfileGraphRole, } from './profile-graph.js';
|
|
26
|
+
export { PROFILE_GRAPH, profileGraphFacet, spineFacetsForProfileType, } from './profile-graph.js';
|
|
27
|
+
export { unsetValue } from './profile-presence.js';
|
|
28
|
+
export { outOfScopeFields, profileTypesForField } from './profile-scope.js';
|
|
29
|
+
export type { DecisionModelBinding, ModelBinding, RuntimeAbilities } from './protocols/binding.js';
|
|
30
|
+
export { checkBinding, commonModelSettingsSchema, decisionModelBindingSchema, keySlotSchema, keySlotsOf, modelBindingSchema, } from './protocols/binding.js';
|
|
31
|
+
export type { ProviderLimits } from './protocols/limits.js';
|
|
32
|
+
export { providerLimitsSchema, resolveProviderLimits } from './protocols/limits.js';
|
|
33
|
+
export type { EstimatedCost, ModelPrice, PriceTable, Rates } from './protocols/prices.js';
|
|
34
|
+
export { costFromPrices } from './protocols/prices.js';
|
|
35
|
+
export type { Continuation, DecisionCall, EmbeddingCall, EmbeddingMediaKind, EmbeddingModelLimits, ExtensionBodyAt, ExtensionReader, LiveToolResult, ModelProfileType, Protocol, ProtocolContentEvent, ProtocolContext, ProtocolDefinition, ProtocolEvent, ProtocolExtension, ProtocolOperations, ProtocolRequest, ProtocolSession, ProtocolSocket, SendInit, UpstreamFailure, } from './protocols/protocol.js';
|
|
36
|
+
export { carriesTo, defineProtocol, extendProtocol, modelOptions } from './protocols/protocol.js';
|
|
37
|
+
export type { Authorize, DecisionModelSettings, ModelSettings, Outgoing, Provider, ProviderDefinition, ProviderRegistry, RegisteredProvider, Registration, Serve, Signer, } from './protocols/provider.js';
|
|
38
|
+
export { bearer, createProviderRegistry, defineProvider, endpointUrlSchema, header, query, } from './protocols/provider.js';
|
|
39
|
+
export type { CallSetup, OpenWebSocket, ProtocolCall, ProviderHostOptions, } from './protocols/runtime.js';
|
|
40
|
+
export { callProtocol, plainWebSocket } from './protocols/runtime.js';
|
|
41
|
+
export type { MediaInputChannel } from './registry/catalog.js';
|
|
42
|
+
export { clampThinkingLevel, clampThinkingLevelForApiId, mediaChannelForMime, mediaKindForMime, mimeAllowed, mimeEssence, modelEntryByApiId, requireModelBinding, } from './registry/catalog.js';
|
|
43
|
+
export type { KernelRegistry } from './registry/kernel-registry.js';
|
|
44
|
+
export { createKernelRegistry } from './registry/kernel-registry.js';
|
|
45
|
+
export type { DecisionProfileDefinition, EmbeddingProfileDefinition, HostProfileDefinition, ImageProfileDefinition, LiveProfileDefinition, ProfileDefinition, ProfileDefinitionBase, ProfileRegistry, SpeechProfileDefinition, TextProfileDefinition, } from './registry/profiles.js';
|
|
46
|
+
export { createProfileRegistry, defineProfile } from './registry/profiles.js';
|
|
47
|
+
export { projectProfileObject, requireModelProfile } from './registry/resolve.js';
|
|
48
|
+
export type { SchemaRegistry } from './registry/schemas.js';
|
|
49
|
+
export { createSchemaRegistry } from './registry/schemas.js';
|
|
50
|
+
export type { CredentialContext, CredentialResolver, KeyCredential } from './registry/vault.js';
|
|
51
|
+
export type { AuthUnauthenticatedPolicy, CustomToolType, HttpMethod, StudioAuthType, ToolAccess, ToolAuthType, ToolPermission, ToolType, } from './schema.js';
|
|
52
|
+
export { API_EXPORTS, ATTACHMENT_ACCEPT_MIMES, AUTH_UNAUTHENTICATED_POLICIES, AWAITING_USER_INPUT_KINDS, AWAITING_USER_INPUT_STATUS, CACHE_MODES, CACHE_TTLS, COMPACTION_METERS, COMPACTION_OUTCOMES, COMPACTION_TIMINGS, CONTINUE_STOP_KINDS, catalogPathFor, EXTRA_FIELDS, fieldMeta, HTTP_METHODS, IMAGE_ATTACHMENT_ACCEPT_MIMES, isKeySlotName, isToolGateKind, isTurnInjectStage, isTurnStage, KEY_SLOT_NAME, MEDIA_INPUT_KIND_VALUES, MEDIA_INPUT_KINDS, MEDIA_WILDCARDS, PROFILE_FIELDS, PROFILE_HANDLE_MAX_CHARS, PROFILE_ID_MAX_CHARS, PROFILE_TYPES, REQUEST_FIELDS, SPEECH_AUDIO_FORMATS, STREAM_MODES, STUDIO_AUTH_TYPES, SUMMARY_MODES, THINKING_LEVELS, TOOL_ACCESS, TOOL_AUTH_TYPES, TOOL_GATE_KINDS, TOOL_LOAD_TIERS, TOOL_PERMISSION, TOOL_TYPES, TURN_INJECT_STAGES, TURN_STAGES, TURN_STOP_KINDS, VOICE_ACCEPT_MIMES, } from './schema.js';
|
|
53
|
+
export type { KernelScope } from './scope.js';
|
|
54
|
+
export { createKernelScope, defaultKernelScope } from './scope.js';
|
|
55
|
+
export type { AwaitingUserInput, StageAffordance, StageApplyInput, StageApplyOutput, StageApplyWarning, StageApplyWarningCode, StageContext, StageEventExtra, StageHandler, StageMutate, StageResult, } from './stages.js';
|
|
56
|
+
export { applyStageResult, STAGE_AFFORDANCE_MATRIX, STAGE_AFFORDANCES, stageAllowsAffordance, stageEventFields, } from './stages.js';
|
|
57
|
+
export type { MediaTurnBehaviourSpec, ProfileTurnBehaviourSpec, ProfileTurnResumptionSpec, TurnContinueFrom, TurnStop, } from './stop.js';
|
|
58
|
+
export { AUTO_CONTINUE_DELAY_MS, CONTINUE_INSTRUCTION_TYPES, DEFAULT_ALLOW_CONTINUE, DEFAULT_AUTO_CONTINUE, GenerationStopError, isContinueStopKind, isGenerationStopError, isResumeableStop, isUserCancelledStop, profileAllowsInject, profileAllowsSteering, profileTurnResumption, shouldAutoContinue, turnStopFromClientStreamEnd, turnStopFromInteractionStatus, turnStopFromOpenAiFinishReason, } from './stop.js';
|
|
59
|
+
export { systemPromptProblem } from './system-parts.js';
|
|
60
|
+
export { activityLabelProblem } from './tools/activity-label.js';
|
|
61
|
+
export { agentToolInputFor, agentToolOutput } from './tools/agent.js';
|
|
62
|
+
export { type AnsweredGate, answerGatedCall, GATE_DECISIONS, type GateAnswerRequest, type GateDecision, gateExpired, type HeldGatedCall, resolveGateTtlMs, sessionPermissionsAfterApproval, type ToolGateAuth, } from './tools/gate-answer.js';
|
|
63
|
+
export type { CredentialQuery, McpProtocolVersion, McpRpcResponse, ToolRegistry, } from './tools/mod.js';
|
|
64
|
+
export { askUserTool, authorizeToolReplay, coerceToolResultParts, createToolRegistry, credentialPlacement, executeHttpTool, executeMcpTool, executeRegisteredTool, formatToolResult, isUnsupportedMcpProtocolError, leanToolResultData, MCP_PROTOCOL_VERSIONS, parseMcpRpcResponse, prepareTurnToolSnapshot, projectForModel, registerHarnessTools, resolveToolAuth, withCredentialQuery, } from './tools/mod.js';
|
|
65
|
+
export type { BeginToolOperationResult, PageToolDispatch, PageToolExecution, SavedToolInvocation, TerminalToolEvent, ToolExecutionCoordinator, ToolOperationClaim, ToolOperationIdentity, ToolOperationOutcome, ToolOperationUncertainty, } from './tools/operation.js';
|
|
66
|
+
export { savedToolInvocationSchema, toolInvocationHash, toolOperationOutcomeSchema, } from './tools/operation.js';
|
|
67
|
+
export { jsonSchemaFromZod } from './tools/schema.js';
|
|
68
|
+
export { CredentialRefusedError } from './tools/signed-in-fetch.js';
|
|
69
|
+
export type { ModelToolResult, PageAnswer, ToolAuthConfig, ToolContext, ToolLabels, } from './tools/types.js';
|
|
70
|
+
export { awaitingUserInputSchema, type GateReference, gateReferenceSchema, isAwaitingUserInput, keptReply, reasoningPartSchema, TURN_EVENT_SCHEMAS, toolGateSchema, turnDoneOf, turnEventSchema, turnHistoryMessageSchema, turnToolSnapshotSchema, } from './turn-events.js';
|
|
71
|
+
export type * from './types.js';
|
|
72
|
+
export { base64ToBytes, bytesToBase64 } from './util/base64.js';
|
|
73
|
+
export type { Equals } from './util/exact-type.js';
|
|
74
|
+
export { isRecord } from './util/record.js';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profile, turn, tool, provider, egress, and event contracts for THEOREM.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import "../../_dnt.polyfills.js";
|
|
7
|
+
export * from './auth/mod.js';
|
|
8
|
+
export { historyHash, providerCheckpointSchema, providerContinuationSchema, providerWarningSchema, } from './checkpoint.js';
|
|
9
|
+
export { clearProfiles, compactHistory, getProfile, getProvider, getStructured, getTool, hasProfile, hasTool, invokeTool, invokeToolStep, listProfiles, listProtocols, listProviders, listTools, projectProfile, registerProfile, registerProfiles, registerProvider, registerStructured, registerTool, registerTools, requireTool, resetTools, resolveTurn, runDecision, runEmbedding, runSession, runTurn, } from './default-scope.js';
|
|
10
|
+
export { compactionMeter, compactionNeeded, resolveCompactionTokens, resolveHistoryTokens, shouldCompact, splitForCompaction, } from './engine/compaction.js';
|
|
11
|
+
export { DecisionError, validateDecisionRequest } from './engine/decision.js';
|
|
12
|
+
export { assertLiveIngress, assertLiveIngressConfigured, hasAnyLiveIngress, liveIngressChannelDefault, liveIngressEnabled, liveIngressEnabledFromSpec, } from './engine/live-ingress.js';
|
|
13
|
+
export { loadTokenEstimator, TOKEN_TEXT_ENCODING, } from './engine/token-estimate.js';
|
|
14
|
+
export { sumTokens } from './engine/usage.js';
|
|
15
|
+
export { isMediaRefPart, wireInteractionPart } from './interaction-parts.js';
|
|
16
|
+
export { jsonObjectSchema, jsonValueSchema } from './json.js';
|
|
17
|
+
export { PROFILE_GRAPH, profileGraphFacet, spineFacetsForProfileType, } from './profile-graph.js';
|
|
18
|
+
export { unsetValue } from './profile-presence.js';
|
|
19
|
+
export { outOfScopeFields, profileTypesForField } from './profile-scope.js';
|
|
20
|
+
export { checkBinding, commonModelSettingsSchema, decisionModelBindingSchema, keySlotSchema, keySlotsOf, modelBindingSchema, } from './protocols/binding.js';
|
|
21
|
+
export { providerLimitsSchema, resolveProviderLimits } from './protocols/limits.js';
|
|
22
|
+
export { costFromPrices } from './protocols/prices.js';
|
|
23
|
+
export { carriesTo, defineProtocol, extendProtocol, modelOptions } from './protocols/protocol.js';
|
|
24
|
+
export { bearer, createProviderRegistry, defineProvider, endpointUrlSchema, header, query, } from './protocols/provider.js';
|
|
25
|
+
export { callProtocol, plainWebSocket } from './protocols/runtime.js';
|
|
26
|
+
export { clampThinkingLevel, clampThinkingLevelForApiId, mediaChannelForMime, mediaKindForMime, mimeAllowed, mimeEssence, modelEntryByApiId, requireModelBinding, } from './registry/catalog.js';
|
|
27
|
+
export { createKernelRegistry } from './registry/kernel-registry.js';
|
|
28
|
+
export { createProfileRegistry, defineProfile } from './registry/profiles.js';
|
|
29
|
+
export { projectProfileObject, requireModelProfile } from './registry/resolve.js';
|
|
30
|
+
export { createSchemaRegistry } from './registry/schemas.js';
|
|
31
|
+
export { API_EXPORTS, ATTACHMENT_ACCEPT_MIMES, AUTH_UNAUTHENTICATED_POLICIES, AWAITING_USER_INPUT_KINDS, AWAITING_USER_INPUT_STATUS, CACHE_MODES, CACHE_TTLS, COMPACTION_METERS, COMPACTION_OUTCOMES, COMPACTION_TIMINGS, CONTINUE_STOP_KINDS, catalogPathFor, EXTRA_FIELDS, fieldMeta, HTTP_METHODS, IMAGE_ATTACHMENT_ACCEPT_MIMES, isKeySlotName, isToolGateKind, isTurnInjectStage, isTurnStage, KEY_SLOT_NAME, MEDIA_INPUT_KIND_VALUES, MEDIA_INPUT_KINDS, MEDIA_WILDCARDS, PROFILE_FIELDS, PROFILE_HANDLE_MAX_CHARS, PROFILE_ID_MAX_CHARS, PROFILE_TYPES, REQUEST_FIELDS, SPEECH_AUDIO_FORMATS, STREAM_MODES, STUDIO_AUTH_TYPES, SUMMARY_MODES, THINKING_LEVELS, TOOL_ACCESS, TOOL_AUTH_TYPES, TOOL_GATE_KINDS, TOOL_LOAD_TIERS, TOOL_PERMISSION, TOOL_TYPES, TURN_INJECT_STAGES, TURN_STAGES, TURN_STOP_KINDS, VOICE_ACCEPT_MIMES, } from './schema.js';
|
|
32
|
+
export { createKernelScope, defaultKernelScope } from './scope.js';
|
|
33
|
+
export { applyStageResult, STAGE_AFFORDANCE_MATRIX, STAGE_AFFORDANCES, stageAllowsAffordance, stageEventFields, } from './stages.js';
|
|
34
|
+
export { AUTO_CONTINUE_DELAY_MS, CONTINUE_INSTRUCTION_TYPES, DEFAULT_ALLOW_CONTINUE, DEFAULT_AUTO_CONTINUE, GenerationStopError, isContinueStopKind, isGenerationStopError, isResumeableStop, isUserCancelledStop, profileAllowsInject, profileAllowsSteering, profileTurnResumption, shouldAutoContinue, turnStopFromClientStreamEnd, turnStopFromInteractionStatus, turnStopFromOpenAiFinishReason, } from './stop.js';
|
|
35
|
+
export { systemPromptProblem } from './system-parts.js';
|
|
36
|
+
export { activityLabelProblem } from './tools/activity-label.js';
|
|
37
|
+
export { agentToolInputFor, agentToolOutput } from './tools/agent.js';
|
|
38
|
+
export { answerGatedCall, GATE_DECISIONS, gateExpired, resolveGateTtlMs, sessionPermissionsAfterApproval, } from './tools/gate-answer.js';
|
|
39
|
+
export { askUserTool, authorizeToolReplay, coerceToolResultParts, createToolRegistry, credentialPlacement, executeHttpTool, executeMcpTool, executeRegisteredTool, formatToolResult, isUnsupportedMcpProtocolError, leanToolResultData, MCP_PROTOCOL_VERSIONS, parseMcpRpcResponse, prepareTurnToolSnapshot, projectForModel, registerHarnessTools, resolveToolAuth, withCredentialQuery, } from './tools/mod.js';
|
|
40
|
+
export { savedToolInvocationSchema, toolInvocationHash, toolOperationOutcomeSchema, } from './tools/operation.js';
|
|
41
|
+
export { jsonSchemaFromZod } from './tools/schema.js';
|
|
42
|
+
export { CredentialRefusedError } from './tools/signed-in-fetch.js';
|
|
43
|
+
export { awaitingUserInputSchema, gateReferenceSchema, isAwaitingUserInput, keptReply, reasoningPartSchema, TURN_EVENT_SCHEMAS, toolGateSchema, turnDoneOf, turnEventSchema, turnHistoryMessageSchema, turnToolSnapshotSchema, } from './turn-events.js';
|
|
44
|
+
export { base64ToBytes, bytesToBase64 } from './util/base64.js';
|
|
45
|
+
export { isRecord } from './util/record.js';
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { ProfileType } from './schema.js';
|
|
2
|
+
/** The editor a graph facet is edited with: schema-driven or structural. */
|
|
3
|
+
export type ProfileGraphEditor = 'schema' | 'structural';
|
|
4
|
+
/** Where a facet sits in the graph: root, spine, or branch. */
|
|
5
|
+
export type ProfileGraphRole = 'root' | 'spine' | 'branch';
|
|
6
|
+
/**
|
|
7
|
+
* Adding a profile section? Add it to PROFILE_FIELDS and a row here, never a FacetKind in the
|
|
8
|
+
* frontend. Each facet's `profileTypes` come from `PROFILE_FIELD_SCOPE` via its `profilePath`.
|
|
9
|
+
*/
|
|
10
|
+
declare const PROFILE_GRAPH_DEF: readonly [{
|
|
11
|
+
readonly id: "identity";
|
|
12
|
+
readonly profilePath: "identity";
|
|
13
|
+
readonly role: "root";
|
|
14
|
+
readonly optional: false;
|
|
15
|
+
readonly editor: "structural";
|
|
16
|
+
readonly label: "Identity";
|
|
17
|
+
readonly ownsFields: readonly ["profile.id", "profile.type"];
|
|
18
|
+
}, {
|
|
19
|
+
readonly id: "models";
|
|
20
|
+
readonly profilePath: "models";
|
|
21
|
+
readonly role: "spine";
|
|
22
|
+
readonly optional: false;
|
|
23
|
+
readonly editor: "structural";
|
|
24
|
+
readonly label: "Models";
|
|
25
|
+
readonly ownsFields: readonly ["profile.defaultModel", "profile.allowModelSelect", "profile.maxSteps", "providerContinuation"];
|
|
26
|
+
}, {
|
|
27
|
+
readonly id: "modelBinding";
|
|
28
|
+
readonly profilePath: "models.*";
|
|
29
|
+
readonly role: "branch";
|
|
30
|
+
readonly parent: "models";
|
|
31
|
+
readonly optional: false;
|
|
32
|
+
readonly editor: "structural";
|
|
33
|
+
readonly label: "Model binding";
|
|
34
|
+
}, {
|
|
35
|
+
readonly id: "decision";
|
|
36
|
+
readonly profilePath: "decision";
|
|
37
|
+
readonly role: "spine";
|
|
38
|
+
readonly optional: false;
|
|
39
|
+
readonly editor: "structural";
|
|
40
|
+
readonly label: "Decision";
|
|
41
|
+
readonly ownsFields: readonly ["inputs"];
|
|
42
|
+
}, {
|
|
43
|
+
readonly id: "image";
|
|
44
|
+
readonly profilePath: "image";
|
|
45
|
+
readonly role: "spine";
|
|
46
|
+
readonly optional: false;
|
|
47
|
+
readonly editor: "structural";
|
|
48
|
+
readonly label: "Image";
|
|
49
|
+
}, {
|
|
50
|
+
readonly id: "speech";
|
|
51
|
+
readonly profilePath: "speech";
|
|
52
|
+
readonly role: "spine";
|
|
53
|
+
readonly optional: false;
|
|
54
|
+
readonly editor: "structural";
|
|
55
|
+
readonly label: "Speech";
|
|
56
|
+
}, {
|
|
57
|
+
readonly id: "live";
|
|
58
|
+
readonly profilePath: "live";
|
|
59
|
+
readonly role: "spine";
|
|
60
|
+
readonly optional: false;
|
|
61
|
+
readonly editor: "structural";
|
|
62
|
+
readonly label: "Live";
|
|
63
|
+
}, {
|
|
64
|
+
readonly id: "tools";
|
|
65
|
+
readonly profilePath: "tools";
|
|
66
|
+
readonly role: "spine";
|
|
67
|
+
readonly optional: false;
|
|
68
|
+
readonly editor: "structural";
|
|
69
|
+
readonly label: "Tools";
|
|
70
|
+
}, {
|
|
71
|
+
readonly id: "toolSpec";
|
|
72
|
+
readonly profilePath: "tools.allow";
|
|
73
|
+
readonly role: "branch";
|
|
74
|
+
readonly parent: "tools";
|
|
75
|
+
readonly optional: true;
|
|
76
|
+
readonly editor: "structural";
|
|
77
|
+
readonly label: "Tool";
|
|
78
|
+
}, {
|
|
79
|
+
readonly id: "inputs";
|
|
80
|
+
readonly profilePath: "inputs";
|
|
81
|
+
readonly role: "spine";
|
|
82
|
+
readonly optional: false;
|
|
83
|
+
readonly editor: "structural";
|
|
84
|
+
readonly label: "Inputs";
|
|
85
|
+
}, {
|
|
86
|
+
readonly id: "outputs";
|
|
87
|
+
readonly profilePath: "outputs";
|
|
88
|
+
readonly role: "spine";
|
|
89
|
+
readonly optional: true;
|
|
90
|
+
readonly editor: "structural";
|
|
91
|
+
readonly label: "Outputs";
|
|
92
|
+
}, {
|
|
93
|
+
readonly id: "turnBehaviour";
|
|
94
|
+
readonly profilePath: "turnBehaviour";
|
|
95
|
+
readonly role: "spine";
|
|
96
|
+
readonly optional: true;
|
|
97
|
+
readonly editor: "structural";
|
|
98
|
+
readonly label: "Turn behaviour";
|
|
99
|
+
}, {
|
|
100
|
+
readonly id: "guardrails";
|
|
101
|
+
readonly profilePath: "guardrails";
|
|
102
|
+
readonly role: "spine";
|
|
103
|
+
readonly optional: true;
|
|
104
|
+
readonly editor: "structural";
|
|
105
|
+
readonly label: "Guardrails";
|
|
106
|
+
}, {
|
|
107
|
+
readonly id: "observability";
|
|
108
|
+
readonly profilePath: "observability";
|
|
109
|
+
readonly role: "spine";
|
|
110
|
+
readonly optional: true;
|
|
111
|
+
readonly editor: "structural";
|
|
112
|
+
readonly label: "Observability";
|
|
113
|
+
}, {
|
|
114
|
+
readonly id: "labels";
|
|
115
|
+
readonly profilePath: "labels";
|
|
116
|
+
readonly role: "spine";
|
|
117
|
+
readonly optional: true;
|
|
118
|
+
readonly editor: "structural";
|
|
119
|
+
readonly label: "Labels";
|
|
120
|
+
}];
|
|
121
|
+
/** The id of a profile graph facet. */
|
|
122
|
+
export type ProfileGraphFacetId = (typeof PROFILE_GRAPH_DEF)[number]['id'];
|
|
123
|
+
/** `profilePath` is a PROFILE_FIELDS key (section root) or a dynamic path (`models.*`). */
|
|
124
|
+
export interface ProfileGraphFacet {
|
|
125
|
+
id: ProfileGraphFacetId;
|
|
126
|
+
profilePath: string;
|
|
127
|
+
role: ProfileGraphRole;
|
|
128
|
+
parent?: ProfileGraphFacetId;
|
|
129
|
+
profileTypes: readonly ProfileType[];
|
|
130
|
+
optional: boolean;
|
|
131
|
+
editor: ProfileGraphEditor;
|
|
132
|
+
label: string;
|
|
133
|
+
/**
|
|
134
|
+
* Extra PROFILE_FIELDS top-level keys owned by this facet (not 1:1 with id).
|
|
135
|
+
* Used by the drift gate so `profile.defaultModel` / `profile.id` / `profile.type` are not orphaned.
|
|
136
|
+
*/
|
|
137
|
+
ownsFields?: readonly string[];
|
|
138
|
+
}
|
|
139
|
+
/** The profile graph: each facet, with the profile types it applies to. */
|
|
140
|
+
export declare const PROFILE_GRAPH: readonly ProfileGraphFacet[];
|
|
141
|
+
/** Spine (and root) facets visible for a profile type, in catalog order. */
|
|
142
|
+
declare function spineFacetsForProfileType(type: ProfileType): ProfileGraphFacet[];
|
|
143
|
+
/** The facet with this id, or `undefined`. */
|
|
144
|
+
declare function profileGraphFacet(id: ProfileGraphFacetId): ProfileGraphFacet | undefined;
|
|
145
|
+
export { profileGraphFacet, spineFacetsForProfileType };
|