@sema-agent/core
Version:
Stateless, task-oriented AI agent core
164 lines (163 loc) • 8.53 kB
JavaScript
export const ROUTE_ADJUDICATION_CONFORMANCE_CORPUS = [
{
name: "per-model-on-root",
intent: "a per-model credential not bound yet is servable, on the deployment root",
model: { id: "m-main", baseUrl: "https://gw.example.com" },
credential: { source: "per-model", apiKey: "k-main" },
config: { baseUrl: "https://gw.example.com" },
expect: { ok: true, posture: "per-model" },
},
{
name: "per-model-off-root",
intent: "a per-model credential not bound yet is servable off the deployment root too (the resolver was asked about THIS entry)",
model: { id: "m-third", baseUrl: "https://third-party.example.net/v1" },
credential: { source: "per-model", apiKey: "k-third" },
config: { baseUrl: "https://gw.example.com" },
expect: { ok: true, posture: "per-model" },
},
{
name: "per-model-headers-borne",
intent: "an entry-declared auth header is a per-model credential (headers-borne)",
model: { id: "m-hdr", baseUrl: "https://third-party.example.net" },
credential: { source: "per-model", headersBorne: true, carrierBag: "model" },
config: { baseUrl: "https://gw.example.com" },
expect: { ok: true, posture: "per-model" },
},
{
name: "per-model-empty-string-key",
intent: "an empty-string per-model key is a PRESENT credential (fails closed at emit, never falls to the deployment key)",
model: { id: "m-degraded", baseUrl: "https://third-party.example.net" },
credential: { source: "per-model", apiKey: "" },
config: { baseUrl: "https://gw.example.com" },
expect: { ok: true, posture: "per-model" },
},
{
name: "deployment-paired",
intent: "the main-gateway pass: entry URL === declared config root, deployment credential allowed",
model: { id: "m-main", baseUrl: "https://gw.example.com" },
credential: { source: "deployment-config", apiKey: "k-gw" },
config: { baseUrl: "https://gw.example.com" },
expect: { ok: true, posture: "paired" },
},
{
name: "deployment-paired-empty-entry",
intent: "an entry with an empty baseUrl targets the config root — deployment credential paired",
model: { id: "m-implicit", baseUrl: "" },
credential: { source: "deployment-config", apiKey: "k-gw" },
config: { baseUrl: "https://gw.example.com" },
expect: { ok: true, posture: "paired" },
},
{
name: "deployment-paired-slash-normalized",
intent: "trailing slashes do not break the pairing (both halves normalize before compare)",
model: { id: "m-main", baseUrl: "https://gw.example.com/" },
credential: { source: "deployment-config", apiKey: "k-gw" },
config: { baseUrl: "https://gw.example.com" },
expect: { ok: true, posture: "paired" },
},
{
name: "deployment-mismatch",
intent: "THE torn pair: deployment credential + entry URL off the declared root = refusal, not a silently-followed key",
model: { id: "m-third", baseUrl: "https://third-party.example.net/v1" },
credential: { source: "deployment-config", apiKey: "k-gw" },
config: { baseUrl: "https://gw.example.com" },
expect: { ok: false, code: "route.credential_mismatch" },
leg: "named",
},
{
name: "deployment-mismatch-path-differs",
intent: "a differing path is a differing root (no prefix leniency — the credential goes to the exact declared root only)",
model: { id: "m-path", baseUrl: "https://gw.example.com/other" },
credential: { source: "deployment-config", apiKey: "k-gw" },
config: { baseUrl: "https://gw.example.com/v1" },
expect: { ok: false, code: "route.credential_mismatch" },
leg: "named",
},
{
name: "deployment-mismatch-query-differs",
intent: "two roots differing only in a QUERY parameter are two routes — the deployment credential is not paired with the second",
model: { id: "m-tenant", baseUrl: "https://gw.example.com/v1?tenant=b-corp" },
credential: { source: "deployment-config", apiKey: "k-boot" },
config: { baseUrl: "https://gw.example.com/v1?tenant=a-corp" },
expect: { ok: false, code: "route.credential_mismatch" },
leg: "named",
},
{
name: "deployment-mismatch-derived-leg",
intent: "the same torn pair on a DERIVED model: same verdict; the engine disposes of it as fallback-to-primary + notice",
model: { id: "m-summarize", baseUrl: "https://third-party.example.net" },
credential: { source: "deployment-config", apiKey: "k-gw" },
config: { baseUrl: "https://gw.example.com" },
expect: { ok: false, code: "route.credential_mismatch" },
leg: "derived",
},
{
name: "deployment-headers-borne-mismatch",
intent: "a deployment auth HEADER is the same fallback arm: off the declared root it is refused, not sent",
model: { id: "m-third", baseUrl: "https://third-party.example.net" },
credential: { source: "deployment-config", headersBorne: true, carrierBag: "config" },
config: { baseUrl: "https://gw.example.com" },
expect: { ok: false, code: "route.credential_mismatch" },
leg: "named",
},
{
name: "deployment-undeclared-entry-root",
intent: "a config key with NO declared root and an entry carrying its own root: nothing says the key belongs there — refused, never sent (declare config.baseUrl, or give the entry its own credential)",
model: { id: "m-catalogue", baseUrl: "https://api.example.com/v1" },
credential: { source: "deployment-config", apiKey: "k-deployment" },
config: {},
expect: { ok: false, code: "route.credential_mismatch" },
leg: "named",
},
{
name: "deployment-lane-default",
intent: "a config key with no declared root is paired with the lane's own default endpoint — a request there is paired",
model: { id: "m-vendor", baseUrl: "https://api.vendor.example" },
credential: { source: "deployment-config", apiKey: "k-vendor" },
config: { laneDefault: "https://api.vendor.example" },
expect: { ok: true, posture: "paired" },
},
{
name: "deployment-lane-default-entry-elsewhere",
intent: "the same key with an entry rooted away from the lane default is refused, exactly like a declared root",
model: { id: "m-catalogue", baseUrl: "https://third-party.example.net/v1" },
credential: { source: "deployment-config", apiKey: "k-vendor" },
config: { laneDefault: "https://api.vendor.example" },
expect: { ok: false, code: "route.credential_mismatch" },
leg: "named",
},
{
name: "absent-keyless-on-root",
intent: "a keyless deployment on its own root has nothing to protect — allowed",
model: { id: "m-local", baseUrl: "http://127.0.0.1:8000/v1" },
credential: { source: "absent" },
config: { baseUrl: "http://127.0.0.1:8000/v1" },
expect: { ok: true, posture: "keyless" },
},
{
name: "absent-keyless-undeclared",
intent: "keyless with no declared config root (URL only on the model) — allowed",
model: { id: "m-local", baseUrl: "http://127.0.0.1:8000/v1" },
credential: { source: "absent" },
config: {},
expect: { ok: true, posture: "keyless" },
},
{
name: "absent-missing-off-root",
intent: "an entry declaring its OWN URL away from a DECLARED deployment root with no credential anywhere is a configuration hole — loud refusal beats an unauthenticated request to a third-party host",
model: { id: "m-third", baseUrl: "https://third-party.example.net" },
credential: { source: "absent" },
config: { baseUrl: "https://gw.example.com" },
expect: { ok: false, code: "route.credential_missing" },
leg: "named",
},
{
name: "absent-missing-derived-leg",
intent: "the same hole on a DERIVED model: same verdict; engine disposition is fallback-to-primary + notice",
model: { id: "m-summarize", baseUrl: "https://third-party.example.net" },
credential: { source: "absent" },
config: { baseUrl: "https://gw.example.com" },
expect: { ok: false, code: "route.credential_missing" },
leg: "derived",
},
];