@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,158 @@
|
|
|
1
|
+
import { ALL_PROFILE_TYPES, profileTypesForField } from './profile-scope.js';
|
|
2
|
+
/**
|
|
3
|
+
* Adding a profile section? Add it to PROFILE_FIELDS and a row here, never a FacetKind in the
|
|
4
|
+
* frontend. Each facet's `profileTypes` come from `PROFILE_FIELD_SCOPE` via its `profilePath`.
|
|
5
|
+
*/
|
|
6
|
+
const PROFILE_GRAPH_DEF = [
|
|
7
|
+
{
|
|
8
|
+
id: 'identity',
|
|
9
|
+
profilePath: 'identity',
|
|
10
|
+
role: 'root',
|
|
11
|
+
optional: false,
|
|
12
|
+
editor: 'structural',
|
|
13
|
+
label: 'Identity',
|
|
14
|
+
ownsFields: ['profile.id', 'profile.type'],
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: 'models',
|
|
18
|
+
profilePath: 'models',
|
|
19
|
+
role: 'spine',
|
|
20
|
+
optional: false,
|
|
21
|
+
editor: 'structural',
|
|
22
|
+
label: 'Models',
|
|
23
|
+
ownsFields: [
|
|
24
|
+
'profile.defaultModel',
|
|
25
|
+
'profile.allowModelSelect',
|
|
26
|
+
'profile.maxSteps',
|
|
27
|
+
'providerContinuation',
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 'modelBinding',
|
|
32
|
+
profilePath: 'models.*',
|
|
33
|
+
role: 'branch',
|
|
34
|
+
parent: 'models',
|
|
35
|
+
optional: false,
|
|
36
|
+
editor: 'structural',
|
|
37
|
+
label: 'Model binding',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 'decision',
|
|
41
|
+
profilePath: 'decision',
|
|
42
|
+
role: 'spine',
|
|
43
|
+
optional: false,
|
|
44
|
+
editor: 'structural',
|
|
45
|
+
label: 'Decision',
|
|
46
|
+
ownsFields: ['inputs'],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 'image',
|
|
50
|
+
profilePath: 'image',
|
|
51
|
+
role: 'spine',
|
|
52
|
+
optional: false,
|
|
53
|
+
editor: 'structural',
|
|
54
|
+
label: 'Image',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'speech',
|
|
58
|
+
profilePath: 'speech',
|
|
59
|
+
role: 'spine',
|
|
60
|
+
optional: false,
|
|
61
|
+
editor: 'structural',
|
|
62
|
+
label: 'Speech',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'live',
|
|
66
|
+
profilePath: 'live',
|
|
67
|
+
role: 'spine',
|
|
68
|
+
optional: false,
|
|
69
|
+
editor: 'structural',
|
|
70
|
+
label: 'Live',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: 'tools',
|
|
74
|
+
profilePath: 'tools',
|
|
75
|
+
role: 'spine',
|
|
76
|
+
optional: false,
|
|
77
|
+
editor: 'structural',
|
|
78
|
+
label: 'Tools',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'toolSpec',
|
|
82
|
+
profilePath: 'tools.allow',
|
|
83
|
+
role: 'branch',
|
|
84
|
+
parent: 'tools',
|
|
85
|
+
optional: true,
|
|
86
|
+
editor: 'structural',
|
|
87
|
+
label: 'Tool',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: 'inputs',
|
|
91
|
+
profilePath: 'inputs',
|
|
92
|
+
role: 'spine',
|
|
93
|
+
optional: false,
|
|
94
|
+
editor: 'structural',
|
|
95
|
+
label: 'Inputs',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: 'outputs',
|
|
99
|
+
profilePath: 'outputs',
|
|
100
|
+
role: 'spine',
|
|
101
|
+
optional: true,
|
|
102
|
+
editor: 'structural',
|
|
103
|
+
label: 'Outputs',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: 'turnBehaviour',
|
|
107
|
+
profilePath: 'turnBehaviour',
|
|
108
|
+
role: 'spine',
|
|
109
|
+
optional: true,
|
|
110
|
+
editor: 'structural',
|
|
111
|
+
label: 'Turn behaviour',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: 'guardrails',
|
|
115
|
+
profilePath: 'guardrails',
|
|
116
|
+
role: 'spine',
|
|
117
|
+
optional: true,
|
|
118
|
+
editor: 'structural',
|
|
119
|
+
label: 'Guardrails',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: 'observability',
|
|
123
|
+
profilePath: 'observability',
|
|
124
|
+
role: 'spine',
|
|
125
|
+
optional: true,
|
|
126
|
+
editor: 'structural',
|
|
127
|
+
label: 'Observability',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
id: 'labels',
|
|
131
|
+
profilePath: 'labels',
|
|
132
|
+
role: 'spine',
|
|
133
|
+
optional: true,
|
|
134
|
+
editor: 'structural',
|
|
135
|
+
label: 'Labels',
|
|
136
|
+
},
|
|
137
|
+
];
|
|
138
|
+
/** The facets whose types differ from their `profilePath`'s scope. */
|
|
139
|
+
const FACET_PROFILE_TYPES = {
|
|
140
|
+
// why: The root holds `id` and `type`, which every profile has.
|
|
141
|
+
identity: ALL_PROFILE_TYPES,
|
|
142
|
+
// why: A decision's inputs belong to its Decision facet.
|
|
143
|
+
inputs: profileTypesForField('inputs').filter((type) => type !== 'decision'),
|
|
144
|
+
};
|
|
145
|
+
/** The profile graph: each facet, with the profile types it applies to. */
|
|
146
|
+
export const PROFILE_GRAPH = PROFILE_GRAPH_DEF.map((facet) => ({
|
|
147
|
+
...facet,
|
|
148
|
+
profileTypes: FACET_PROFILE_TYPES[facet.id] ?? profileTypesForField(facet.profilePath),
|
|
149
|
+
}));
|
|
150
|
+
/** Spine (and root) facets visible for a profile type, in catalog order. */
|
|
151
|
+
function spineFacetsForProfileType(type) {
|
|
152
|
+
return PROFILE_GRAPH.filter((facet) => (facet.role === 'root' || facet.role === 'spine') && facet.profileTypes.includes(type));
|
|
153
|
+
}
|
|
154
|
+
/** The facet with this id, or `undefined`. */
|
|
155
|
+
function profileGraphFacet(id) {
|
|
156
|
+
return PROFILE_GRAPH.find((facet) => facet.id === id);
|
|
157
|
+
}
|
|
158
|
+
export { profileGraphFacet, spineFacetsForProfileType };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** labels-exempt-file: authoring field-meta presence notes — not runtime user or model copy (P2) */
|
|
2
|
+
export interface ProfileFieldPresence {
|
|
3
|
+
/** The profile must set the field: always (`true`), or only in the case named. */
|
|
4
|
+
required?: true | string;
|
|
5
|
+
/** What leaving the field out does, as a short phrase a blank control can show. */
|
|
6
|
+
unset?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The value leaving the field out stands for, where one value says it: a profile that writes
|
|
9
|
+
* this value and one that leaves the field out are the same profile.
|
|
10
|
+
*/
|
|
11
|
+
value?: unknown;
|
|
12
|
+
}
|
|
13
|
+
/** The most model calls a turn makes when its profile sets no `maxSteps`. */
|
|
14
|
+
export declare const DEFAULT_MAX_STEPS = 20;
|
|
15
|
+
/** Presence for profile paths, keyed like `PROFILE_FIELDS` (`models.*` matches every binding). */
|
|
16
|
+
export declare const PROFILE_FIELD_PRESENCE: Readonly<Record<string, ProfileFieldPresence>>;
|
|
17
|
+
/** The value leaving the field at `path` out stands for, or nothing when no one value says it. */
|
|
18
|
+
export declare function unsetValue(path: readonly string[]): unknown;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/** The most model calls a turn makes when its profile sets no `maxSteps`. */
|
|
2
|
+
export const DEFAULT_MAX_STEPS = 20;
|
|
3
|
+
/** Presence for profile paths, keyed like `PROFILE_FIELDS` (`models.*` matches every binding). */
|
|
4
|
+
export const PROFILE_FIELD_PRESENCE = {
|
|
5
|
+
'profile.id': { required: true },
|
|
6
|
+
'profile.type': { required: true },
|
|
7
|
+
identity: { required: true },
|
|
8
|
+
'identity.handle': { required: true },
|
|
9
|
+
'identity.system': { unset: "Only the kernel's notes" },
|
|
10
|
+
tools: { required: true },
|
|
11
|
+
'tools.allow': { required: true },
|
|
12
|
+
image: { required: true },
|
|
13
|
+
speech: { required: true },
|
|
14
|
+
live: { required: true },
|
|
15
|
+
decision: { required: true },
|
|
16
|
+
'decision.contract': { required: true },
|
|
17
|
+
models: { required: true },
|
|
18
|
+
'profile.defaultModel': {
|
|
19
|
+
required: 'when more than one model is declared',
|
|
20
|
+
unset: 'The only model',
|
|
21
|
+
},
|
|
22
|
+
'profile.allowModelSelect': { unset: 'Off', value: false },
|
|
23
|
+
'profile.maxSteps': { unset: `${DEFAULT_MAX_STEPS} model calls`, value: DEFAULT_MAX_STEPS },
|
|
24
|
+
'models.*.protocol': { required: true },
|
|
25
|
+
'models.*.provider': { required: true },
|
|
26
|
+
'models.*.options': { unset: "The protocol's defaults" },
|
|
27
|
+
'models.*.keySlot': { unset: 'Provider primary slot' },
|
|
28
|
+
'models.*.fallbackKeySlot': { unset: 'Provider fallback slot, when configured' },
|
|
29
|
+
providerContinuation: { unset: 'The host keeps the history' },
|
|
30
|
+
'providerContinuation.history': { unset: 'host', value: 'host' },
|
|
31
|
+
'models.*.apiId': { required: true },
|
|
32
|
+
'models.*.builtInTools': { unset: 'None', value: [] },
|
|
33
|
+
'models.*.maxOutputTokens': { unset: 'Provider default' },
|
|
34
|
+
'models.*.temperature': { unset: 'Provider default' },
|
|
35
|
+
'models.*.summaries': { unset: 'Provider default' },
|
|
36
|
+
'models.*.efforts': { unset: 'Provider default' },
|
|
37
|
+
'models.*.defaultEffort': {
|
|
38
|
+
required: 'when more than one effort is declared',
|
|
39
|
+
unset: 'The only effort',
|
|
40
|
+
},
|
|
41
|
+
'models.*.allowEffortSelect': { unset: 'Off', value: false },
|
|
42
|
+
'models.*.timeoutMs': { unset: 'No timeout' },
|
|
43
|
+
'models.*.compaction': { unset: 'Off' },
|
|
44
|
+
'models.*.compaction.maxTokens': { required: true },
|
|
45
|
+
'models.*.compaction.compactAt': { required: true },
|
|
46
|
+
'models.*.compaction.previousExchanges': { required: true },
|
|
47
|
+
'models.*.compaction.profile': { unset: 'The agent itself, on a text profile' },
|
|
48
|
+
'models.*.compaction.trigger': { unset: 'compactAt of maxTokens' },
|
|
49
|
+
'models.*.compaction.timing': { required: true },
|
|
50
|
+
'models.*.compaction.meter': { unset: 'history', value: 'history' },
|
|
51
|
+
inputs: { required: 'on every type that takes it but live', unset: 'No slots or context' },
|
|
52
|
+
'inputs.text': { unset: 'Accepted', value: true },
|
|
53
|
+
'inputs.attachments.accept': { unset: 'No attachments' },
|
|
54
|
+
'inputs.voice.accept': { unset: 'No voice' },
|
|
55
|
+
'inputs.maxFiles': { required: 'when attachments or voice is set' },
|
|
56
|
+
'inputs.maxBytes': { required: 'when attachments or voice is set' },
|
|
57
|
+
'inputs.maxTurnBytes': { required: 'when attachments or voice is set' },
|
|
58
|
+
'inputs.state': { required: true },
|
|
59
|
+
'inputs.maxStateBytes': { unset: 'No cap' },
|
|
60
|
+
'inputs.limitsByMime': { unset: 'maxBytes for every type' },
|
|
61
|
+
'inputs.slots': { unset: 'No slots' },
|
|
62
|
+
'inputs.context': { unset: 'No context' },
|
|
63
|
+
'inputs.context.from': { required: true },
|
|
64
|
+
'inputs.context.maxChars': { required: true },
|
|
65
|
+
'outputs.structured': { unset: 'Free text', value: null },
|
|
66
|
+
'outputs.validation.maxRetries': { unset: '0', value: 0 },
|
|
67
|
+
'outputs.streaming.mode': { unset: 'sse', value: 'sse' },
|
|
68
|
+
'outputs.streaming.streamThoughts': { unset: 'On', value: true },
|
|
69
|
+
'turnBehaviour.resumption.allowContinue': {
|
|
70
|
+
unset: 'All three',
|
|
71
|
+
value: ['length', 'stream_incomplete', 'provider_error'],
|
|
72
|
+
},
|
|
73
|
+
'turnBehaviour.resumption.autoContinue': {
|
|
74
|
+
unset: 'length and stream_incomplete',
|
|
75
|
+
value: ['length', 'stream_incomplete'],
|
|
76
|
+
},
|
|
77
|
+
'turnBehaviour.resumption.maxContinues': { unset: 'No cap' },
|
|
78
|
+
'turnBehaviour.allowSteering': { unset: 'On', value: true },
|
|
79
|
+
'turnBehaviour.atStepLimit': { unset: 'stop', value: 'stop' },
|
|
80
|
+
'guardrails.quota': { unset: 'No limit' },
|
|
81
|
+
'guardrails.detect': { unset: 'Redacts what goes to the model' },
|
|
82
|
+
'guardrails.detect.ungiven_images.allow.fromTools': { unset: 'On', value: true },
|
|
83
|
+
'guardrails.detect.ungiven_links.allow.fromTools': { unset: 'On', value: true },
|
|
84
|
+
'guardrails.blockedReply': { unset: 'One rewrite' },
|
|
85
|
+
'guardrails.blockedReply.onBlock': { unset: 'retry', value: 'retry' },
|
|
86
|
+
'guardrails.blockedReply.maxRetries': { unset: '1', value: 1 },
|
|
87
|
+
'guardrails.network.allowPrivateNetworks': { unset: 'Off', value: false },
|
|
88
|
+
'guardrails.network.allowedHosts': { unset: 'None', value: [] },
|
|
89
|
+
'guardrails.network.allowedSchemes': {
|
|
90
|
+
unset: 'https, plus http when allowPrivateNetworks is on',
|
|
91
|
+
},
|
|
92
|
+
'guardrails.taint.afterRemoteRead': { unset: 'off', value: 'off' },
|
|
93
|
+
'guardrails.taint.remoteDestination': { unset: 'off', value: 'off' },
|
|
94
|
+
'guardrails.disclosure': { unset: 'No check' },
|
|
95
|
+
'observability.writeTo': { unset: 'No traces, unless runTurn is given a sink' },
|
|
96
|
+
'observability.sampleRate': { unset: '1', value: 1 },
|
|
97
|
+
'observability.include.upstreamLog': { unset: 'On', value: true },
|
|
98
|
+
'observability.include.outboundWire': {
|
|
99
|
+
unset: 'Off; on when the profile has no observability block',
|
|
100
|
+
},
|
|
101
|
+
'observability.include.evidenceRaw': {
|
|
102
|
+
unset: 'Off; on when the profile has no observability block',
|
|
103
|
+
},
|
|
104
|
+
'observability.include.usage': { unset: 'On', value: true },
|
|
105
|
+
'observability.include.guardrailDecisions': { unset: 'On', value: true },
|
|
106
|
+
'observability.include.guardrailMatchPreview': { unset: 'Off', value: false },
|
|
107
|
+
'observability.resource': { unset: 'None' },
|
|
108
|
+
'observability.scrub.sensitive': { unset: 'On', value: true },
|
|
109
|
+
'observability.scrub.injection': { unset: 'On', value: true },
|
|
110
|
+
'observability.scrub.canary': { unset: 'On', value: true },
|
|
111
|
+
'observability.retainForDays': { unset: '14', value: 14 },
|
|
112
|
+
'observability.rotateAfterMiB': { unset: '32', value: 32 },
|
|
113
|
+
'observability.onWriteError': { unset: 'Errors are dropped' },
|
|
114
|
+
'image.aspectRatio': { unset: 'Provider default' },
|
|
115
|
+
'image.resolution': { unset: 'Provider default' },
|
|
116
|
+
'image.mimeType': { unset: 'Provider default' },
|
|
117
|
+
'image.quality': { unset: 'Provider default' },
|
|
118
|
+
'image.background': { unset: 'Provider default' },
|
|
119
|
+
'image.n': { unset: 'Provider default' },
|
|
120
|
+
'image.seed': { unset: 'Provider default' },
|
|
121
|
+
'image.outputCompression': { unset: 'Provider default' },
|
|
122
|
+
'image.references': { unset: 'None' },
|
|
123
|
+
'image.includeText': { unset: 'Off', value: false },
|
|
124
|
+
'speech.voice': { unset: "The turn's speech.voice; Gemini refuses speech without one" },
|
|
125
|
+
'speech.style': { unset: "The turn's speech.style, else no direction" },
|
|
126
|
+
'speech.speed': { unset: "The turn's speech.speed, else the voice's own pace" },
|
|
127
|
+
'speech.format': { unset: 'Provider default' },
|
|
128
|
+
'live.ingress.audio': { unset: 'On', value: true },
|
|
129
|
+
'live.ingress.video': { unset: 'On', value: true },
|
|
130
|
+
'live.ingress.text': { unset: 'Off', value: false },
|
|
131
|
+
'live.voice': { unset: 'Provider default' },
|
|
132
|
+
'live.vad.activityHandling': { unset: 'Provider default' },
|
|
133
|
+
'live.vad.startSensitivity': { unset: 'Provider default' },
|
|
134
|
+
'live.vad.endSensitivity': { unset: 'Provider default' },
|
|
135
|
+
'live.vad.prefixPaddingMs': { unset: 'Provider default' },
|
|
136
|
+
'live.vad.silenceDurationMs': { unset: 'Provider default' },
|
|
137
|
+
'live.sessionResumption': { unset: 'Off', value: false },
|
|
138
|
+
'live.greeting': { unset: 'The agent waits for the visitor' },
|
|
139
|
+
'live.resumed': { unset: 'A resumed call is silent' },
|
|
140
|
+
'live.resumed.prompt': { required: true },
|
|
141
|
+
'live.resumed.afterMs': { unset: '3000' },
|
|
142
|
+
'live.contextCompression': { unset: 'Off' },
|
|
143
|
+
'live.contextCompression.triggerTokens': { unset: 'Provider default' },
|
|
144
|
+
'live.contextCompression.slidingWindow': { required: true },
|
|
145
|
+
'live.contextCompression.slidingWindow.targetTokens': { unset: 'Provider default' },
|
|
146
|
+
'live.transcription.input': { unset: 'Off' },
|
|
147
|
+
'live.transcription.output': {
|
|
148
|
+
unset: 'Off; on with a detector at live_reply',
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
/** The value leaving the field at `path` out stands for, or nothing when no one value says it. */
|
|
152
|
+
export function unsetValue(path) {
|
|
153
|
+
const held = Object.entries(PROFILE_FIELD_PRESENCE).find(([known]) => {
|
|
154
|
+
const keys = known.replace(/^profile\./, '').split('.');
|
|
155
|
+
return keys.length === path.length && keys.every((key, at) => key === '*' || key === path[at]);
|
|
156
|
+
});
|
|
157
|
+
return held?.[1].value;
|
|
158
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ProfileType } from './schema.js';
|
|
2
|
+
/**
|
|
3
|
+
* Mirrors `PROFILE_TYPES` — a value import would cycle through `schema.ts`.
|
|
4
|
+
* Drift is gated by tests/kernel/profile-scope.test.ts.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ALL_PROFILE_TYPES: readonly ProfileType[];
|
|
7
|
+
export interface ProfileFieldScope {
|
|
8
|
+
profileTypes: readonly ProfileType[];
|
|
9
|
+
/** Why other types can't take it — shown in `defineProfile` errors and authoring UIs. */
|
|
10
|
+
reason: string;
|
|
11
|
+
/**
|
|
12
|
+
* The one value other types may still carry: the field's "off" value
|
|
13
|
+
* (`outputs.structured: null` asks for no schema).
|
|
14
|
+
*/
|
|
15
|
+
offValue?: null;
|
|
16
|
+
}
|
|
17
|
+
/** Whether a top-level profile key is one of the profile's own settings. */
|
|
18
|
+
export declare function isProfileRootField(key: string): boolean;
|
|
19
|
+
/** The keys of the profile object that a catalog path names: `profile.maxSteps` is `maxSteps`. */
|
|
20
|
+
export declare function profileKeysOf(catalogPath: string): string[];
|
|
21
|
+
/** Keyed like `PROFILE_FIELDS`; `models.*` matches every model binding. */
|
|
22
|
+
export declare const PROFILE_FIELD_SCOPE: Readonly<Record<string, ProfileFieldScope>>;
|
|
23
|
+
/**
|
|
24
|
+
* The scope entry that governs `path`: its own, else its nearest ancestor's.
|
|
25
|
+
* `undefined` means every profile type.
|
|
26
|
+
*/
|
|
27
|
+
export declare function profileFieldScope(path: string): ProfileFieldScope | undefined;
|
|
28
|
+
export declare function profileTypesForField(path: string): readonly ProfileType[];
|
|
29
|
+
export interface OutOfScopeField {
|
|
30
|
+
/** e.g. `models.fast.compaction` for the `models.*.compaction` scope. */
|
|
31
|
+
path: string;
|
|
32
|
+
scope: ProfileFieldScope;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Every field `profile` sets that its type may not, ancestors before their
|
|
36
|
+
* children. A scope's off value is not reported.
|
|
37
|
+
*/
|
|
38
|
+
export declare function outOfScopeFields(profile: {
|
|
39
|
+
readonly type: ProfileType;
|
|
40
|
+
}): OutOfScopeField[];
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
// invariant: Leaf module: `schema.ts` and `profile-graph.ts` read it at load time.
|
|
2
|
+
/** labels-exempt-file: authoring field-meta scope reasons — not runtime user or model copy (P2) */
|
|
3
|
+
import { HOST_GUARDRAIL_FIELDS } from '../guardrails/types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Mirrors `PROFILE_TYPES` — a value import would cycle through `schema.ts`.
|
|
6
|
+
* Drift is gated by tests/kernel/profile-scope.test.ts.
|
|
7
|
+
*/
|
|
8
|
+
export const ALL_PROFILE_TYPES = [
|
|
9
|
+
'text',
|
|
10
|
+
'image',
|
|
11
|
+
'speech',
|
|
12
|
+
'live',
|
|
13
|
+
'decision',
|
|
14
|
+
'embedding',
|
|
15
|
+
'host',
|
|
16
|
+
];
|
|
17
|
+
const MODEL_PROFILE_TYPES = [
|
|
18
|
+
'text',
|
|
19
|
+
'image',
|
|
20
|
+
'speech',
|
|
21
|
+
'live',
|
|
22
|
+
'decision',
|
|
23
|
+
'embedding',
|
|
24
|
+
];
|
|
25
|
+
const TURN_TYPES = ['text', 'image', 'speech', 'live'];
|
|
26
|
+
/** Types whose `inputs` are turn inputs (text, files, slots) rather than decision state. */
|
|
27
|
+
const TURN_INPUT_TYPES = ['text', 'image'];
|
|
28
|
+
const TURN_INPUT_REASON = 'a decision takes JSON state, not turn text, files, or slots';
|
|
29
|
+
/** Types that take slots and context: the turn types, and a call. */
|
|
30
|
+
const SLOT_TYPES = ['text', 'image', 'live'];
|
|
31
|
+
const SLOT_REASON = 'a decision takes JSON state, and speech reads its transcript only';
|
|
32
|
+
/** Guardrails a host profile may set keep `host`; the rest guard a model turn. */
|
|
33
|
+
function turnGuardrailTypes(key) {
|
|
34
|
+
return HOST_GUARDRAIL_FIELDS.includes(key)
|
|
35
|
+
? [...TURN_TYPES, 'host']
|
|
36
|
+
: TURN_TYPES;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The profile's own settings, which no section holds. The catalog names each `profile.<key>`, as
|
|
40
|
+
* a section's fields carry their section's name.
|
|
41
|
+
*/
|
|
42
|
+
const PROFILE_ROOT_FIELDS = ['id', 'type', 'defaultModel', 'allowModelSelect', 'maxSteps'];
|
|
43
|
+
/** Whether a top-level profile key is one of the profile's own settings. */
|
|
44
|
+
export function isProfileRootField(key) {
|
|
45
|
+
return PROFILE_ROOT_FIELDS.includes(key);
|
|
46
|
+
}
|
|
47
|
+
/** The keys of the profile object that a catalog path names: `profile.maxSteps` is `maxSteps`. */
|
|
48
|
+
export function profileKeysOf(catalogPath) {
|
|
49
|
+
return catalogPath.replace(/^profile\./, '').split('.');
|
|
50
|
+
}
|
|
51
|
+
/** Keyed like `PROFILE_FIELDS`; `models.*` matches every model binding. */
|
|
52
|
+
export const PROFILE_FIELD_SCOPE = {
|
|
53
|
+
providerContinuation: {
|
|
54
|
+
profileTypes: TURN_TYPES,
|
|
55
|
+
reason: 'only model turns and live sessions use provider continuation',
|
|
56
|
+
},
|
|
57
|
+
...Object.fromEntries([
|
|
58
|
+
'efforts',
|
|
59
|
+
'defaultEffort',
|
|
60
|
+
'allowEffortSelect',
|
|
61
|
+
'summaries',
|
|
62
|
+
'maxOutputTokens',
|
|
63
|
+
'temperature',
|
|
64
|
+
'builtInTools',
|
|
65
|
+
].map((field) => [
|
|
66
|
+
`models.*.${field}`,
|
|
67
|
+
{
|
|
68
|
+
profileTypes: TURN_TYPES,
|
|
69
|
+
reason: 'only model turns use this setting; decisions send state and questions',
|
|
70
|
+
},
|
|
71
|
+
])),
|
|
72
|
+
'models.*.timeoutMs': {
|
|
73
|
+
profileTypes: ['decision'],
|
|
74
|
+
reason: 'only decision bindings configure a request timeout here',
|
|
75
|
+
},
|
|
76
|
+
identity: {
|
|
77
|
+
profileTypes: MODEL_PROFILE_TYPES,
|
|
78
|
+
reason: 'a host profile has no agent identity — it runs no model',
|
|
79
|
+
},
|
|
80
|
+
'identity.system': {
|
|
81
|
+
profileTypes: ['text', 'image', 'live'],
|
|
82
|
+
reason: 'speech has no system channel (the input text is the transcript) and a decision is asked only through its questions',
|
|
83
|
+
},
|
|
84
|
+
'identity.systemByRole': {
|
|
85
|
+
profileTypes: ['text', 'image', 'live'],
|
|
86
|
+
reason: 'speech has no system channel (the input text is the transcript) and a decision is asked only through its questions',
|
|
87
|
+
},
|
|
88
|
+
models: { profileTypes: MODEL_PROFILE_TYPES, reason: 'a host profile runs no model' },
|
|
89
|
+
'models.*.protocol': {
|
|
90
|
+
profileTypes: MODEL_PROFILE_TYPES,
|
|
91
|
+
reason: 'a host profile runs no model',
|
|
92
|
+
},
|
|
93
|
+
'models.*.provider': {
|
|
94
|
+
profileTypes: MODEL_PROFILE_TYPES,
|
|
95
|
+
reason: 'a host profile runs no model',
|
|
96
|
+
},
|
|
97
|
+
'models.*.compaction': {
|
|
98
|
+
profileTypes: ['text', 'image', 'speech'],
|
|
99
|
+
reason: 'live compacts with live.contextCompression',
|
|
100
|
+
},
|
|
101
|
+
'profile.defaultModel': {
|
|
102
|
+
profileTypes: [...TURN_TYPES, 'embedding'],
|
|
103
|
+
reason: 'a host profile runs no model and a decision declares exactly one',
|
|
104
|
+
},
|
|
105
|
+
'profile.allowModelSelect': {
|
|
106
|
+
profileTypes: [...TURN_TYPES, 'embedding'],
|
|
107
|
+
reason: 'a host profile runs no model and a decision declares exactly one',
|
|
108
|
+
},
|
|
109
|
+
'profile.maxSteps': {
|
|
110
|
+
profileTypes: TURN_TYPES,
|
|
111
|
+
reason: 'only model turns take tool-loop steps',
|
|
112
|
+
},
|
|
113
|
+
decision: { profileTypes: ['decision'], reason: 'only decision profiles carry a contract' },
|
|
114
|
+
image: { profileTypes: ['image'], reason: 'only image profiles generate images' },
|
|
115
|
+
speech: { profileTypes: ['speech'], reason: 'only speech profiles synthesize audio' },
|
|
116
|
+
live: { profileTypes: ['live'], reason: 'only live profiles open a realtime session' },
|
|
117
|
+
tools: {
|
|
118
|
+
profileTypes: ['text', 'image', 'live', 'host'],
|
|
119
|
+
reason: 'speech and decision profiles call no tools',
|
|
120
|
+
},
|
|
121
|
+
'tools.t1Policy': {
|
|
122
|
+
profileTypes: ['text', 'image'],
|
|
123
|
+
reason: 'live wires every allowed tool once at session setup, and a host profile can execute every allowed tool',
|
|
124
|
+
},
|
|
125
|
+
'tools.t2Loader': {
|
|
126
|
+
profileTypes: ['text', 'image'],
|
|
127
|
+
reason: 'live function declarations are fixed at session setup, and a host profile can execute every allowed tool',
|
|
128
|
+
},
|
|
129
|
+
inputs: {
|
|
130
|
+
profileTypes: ['text', 'image', 'live', 'decision', 'embedding'],
|
|
131
|
+
reason: 'speech input is the transcript, and a host profile takes no turns',
|
|
132
|
+
},
|
|
133
|
+
'inputs.voice': {
|
|
134
|
+
profileTypes: ['text'],
|
|
135
|
+
reason: 'no image model reads audio, and a decision takes JSON state',
|
|
136
|
+
},
|
|
137
|
+
'inputs.text': {
|
|
138
|
+
profileTypes: [...TURN_INPUT_TYPES, 'embedding'],
|
|
139
|
+
reason: TURN_INPUT_REASON,
|
|
140
|
+
},
|
|
141
|
+
'inputs.attachments': {
|
|
142
|
+
profileTypes: [...TURN_INPUT_TYPES, 'embedding'],
|
|
143
|
+
reason: TURN_INPUT_REASON,
|
|
144
|
+
},
|
|
145
|
+
'inputs.maxFiles': {
|
|
146
|
+
profileTypes: [...TURN_INPUT_TYPES, 'embedding'],
|
|
147
|
+
reason: TURN_INPUT_REASON,
|
|
148
|
+
},
|
|
149
|
+
'inputs.maxBytes': {
|
|
150
|
+
profileTypes: [...TURN_INPUT_TYPES, 'embedding'],
|
|
151
|
+
reason: TURN_INPUT_REASON,
|
|
152
|
+
},
|
|
153
|
+
'inputs.maxTurnBytes': {
|
|
154
|
+
profileTypes: [...TURN_INPUT_TYPES, 'embedding'],
|
|
155
|
+
reason: TURN_INPUT_REASON,
|
|
156
|
+
},
|
|
157
|
+
'inputs.limitsByMime': {
|
|
158
|
+
profileTypes: [...TURN_INPUT_TYPES, 'embedding'],
|
|
159
|
+
reason: TURN_INPUT_REASON,
|
|
160
|
+
},
|
|
161
|
+
'inputs.slots': {
|
|
162
|
+
profileTypes: SLOT_TYPES,
|
|
163
|
+
reason: SLOT_REASON,
|
|
164
|
+
},
|
|
165
|
+
'inputs.context': {
|
|
166
|
+
profileTypes: SLOT_TYPES,
|
|
167
|
+
reason: SLOT_REASON,
|
|
168
|
+
},
|
|
169
|
+
'inputs.state': {
|
|
170
|
+
profileTypes: ['decision'],
|
|
171
|
+
reason: 'only a decision reads JSON state; a turn takes text, files, and slots',
|
|
172
|
+
},
|
|
173
|
+
'inputs.maxStateBytes': {
|
|
174
|
+
profileTypes: ['decision'],
|
|
175
|
+
reason: 'only a decision reads JSON state; a turn takes text, files, and slots',
|
|
176
|
+
},
|
|
177
|
+
outputs: {
|
|
178
|
+
profileTypes: ['text', 'image', 'speech'],
|
|
179
|
+
reason: 'live output is the realtime session, and decision and host profiles produce no turn output',
|
|
180
|
+
},
|
|
181
|
+
'outputs.structured': {
|
|
182
|
+
profileTypes: ['text'],
|
|
183
|
+
reason: 'only a text reply has a JSON shape; image and speech turns return media',
|
|
184
|
+
offValue: null,
|
|
185
|
+
},
|
|
186
|
+
'outputs.validation': {
|
|
187
|
+
profileTypes: ['text'],
|
|
188
|
+
reason: 'validation checks a structured reply, which only text profiles make',
|
|
189
|
+
},
|
|
190
|
+
turnBehaviour: {
|
|
191
|
+
profileTypes: TURN_TYPES,
|
|
192
|
+
reason: 'only model turns can be continued or steered',
|
|
193
|
+
},
|
|
194
|
+
'turnBehaviour.resumption': {
|
|
195
|
+
profileTypes: ['text', 'image', 'speech'],
|
|
196
|
+
reason: 'live resumes through live.sessionResumption',
|
|
197
|
+
},
|
|
198
|
+
'turnBehaviour.allowSteering': {
|
|
199
|
+
profileTypes: ['text', 'live'],
|
|
200
|
+
reason: 'image and speech turns take no mid-turn input',
|
|
201
|
+
},
|
|
202
|
+
'turnBehaviour.atStepLimit': {
|
|
203
|
+
profileTypes: ['text'],
|
|
204
|
+
reason: 'only a text turn writes an answer after its tools',
|
|
205
|
+
},
|
|
206
|
+
'guardrails.quota': {
|
|
207
|
+
profileTypes: turnGuardrailTypes('quota'),
|
|
208
|
+
reason: 'quota counts model turns',
|
|
209
|
+
},
|
|
210
|
+
'guardrails.detect': {
|
|
211
|
+
profileTypes: turnGuardrailTypes('detect'),
|
|
212
|
+
reason: 'the decision path runs none of the turn guardrails',
|
|
213
|
+
},
|
|
214
|
+
'guardrails.blockedReply': {
|
|
215
|
+
profileTypes: ['text', 'image', 'live'],
|
|
216
|
+
reason: 'only a reply can be blocked, and speech, decision, and host profiles write none',
|
|
217
|
+
},
|
|
218
|
+
'guardrails.network': {
|
|
219
|
+
profileTypes: ['text', 'image', 'live', 'host'],
|
|
220
|
+
reason: 'speech and decision profiles call no tools',
|
|
221
|
+
},
|
|
222
|
+
'guardrails.taint': {
|
|
223
|
+
profileTypes: ['text', 'image', 'live'],
|
|
224
|
+
reason: 'speech and decision profiles call no tools, and a host profile runs no turn to taint',
|
|
225
|
+
},
|
|
226
|
+
'guardrails.disclosure': {
|
|
227
|
+
profileTypes: ['decision'],
|
|
228
|
+
reason: 'disclosure gates state leaving a decision profile for its model',
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* The scope entry that governs `path`: its own, else its nearest ancestor's.
|
|
233
|
+
* `undefined` means every profile type.
|
|
234
|
+
*/
|
|
235
|
+
export function profileFieldScope(path) {
|
|
236
|
+
const segments = path.split('.');
|
|
237
|
+
for (let end = segments.length; end > 0; end--) {
|
|
238
|
+
const scope = PROFILE_FIELD_SCOPE[segments.slice(0, end).join('.')];
|
|
239
|
+
if (scope)
|
|
240
|
+
return scope;
|
|
241
|
+
}
|
|
242
|
+
return undefined;
|
|
243
|
+
}
|
|
244
|
+
export function profileTypesForField(path) {
|
|
245
|
+
return profileFieldScope(path)?.profileTypes ?? ALL_PROFILE_TYPES;
|
|
246
|
+
}
|
|
247
|
+
/** Every set value under `segments`, keyed by concrete path; `*` walks each key of a map. */
|
|
248
|
+
function valuesAt(root, segments, at = '') {
|
|
249
|
+
if (!segments.length)
|
|
250
|
+
return root === undefined ? [] : [[at, root]];
|
|
251
|
+
if (root === null || typeof root !== 'object')
|
|
252
|
+
return [];
|
|
253
|
+
const [head, ...rest] = segments;
|
|
254
|
+
const record = root;
|
|
255
|
+
const keys = head === '*' ? Object.keys(record) : [head];
|
|
256
|
+
return keys.flatMap((key) => valuesAt(record[key], rest, at ? `${at}.${key}` : key));
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Every field `profile` sets that its type may not, ancestors before their
|
|
260
|
+
* children. A scope's off value is not reported.
|
|
261
|
+
*/
|
|
262
|
+
export function outOfScopeFields(profile) {
|
|
263
|
+
const out = [];
|
|
264
|
+
for (const [path, scope] of Object.entries(PROFILE_FIELD_SCOPE)) {
|
|
265
|
+
if (scope.profileTypes.includes(profile.type))
|
|
266
|
+
continue;
|
|
267
|
+
for (const [at, value] of valuesAt(profile, profileKeysOf(path))) {
|
|
268
|
+
if (scope.offValue !== undefined && value === scope.offValue)
|
|
269
|
+
continue;
|
|
270
|
+
out.push({ path: at, scope });
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return out;
|
|
274
|
+
}
|