OSS-first docs
These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.
Answer a user question using a KB snapshot with strict locale/jurisdiction gating.
Goal
Provide policy-safe answers that cite a KB snapshot or refuse.
Context
Called by UI or workflows; must fail-closed if envelope is invalid or citations are missing.
Source Definition
import { defineCommand } from '@lssm-tech/lib.contracts-spec';
import { defineSchemaModel, ScalarTypeEnum } from '@lssm-tech/lib.schema';
import {
AssistantAnswerIRModel,
LLMCallEnvelopeModel,
} from '../entities/models';
export const AssistantAnswerContract = defineCommand({
meta: {
key: 'assistant.answer',
version: '1.0.0',
stability: 'experimental',
owners: ['@examples'],
tags: ['assistant', 'policy', 'locale', 'jurisdiction', 'knowledge'],
description:
'Answer a user question using a KB snapshot with strict locale/jurisdiction gating.',
goal: 'Provide policy-safe answers that cite a KB snapshot or refuse.',
context:
'Called by UI or workflows; must fail-closed if envelope is invalid or citations are missing.',
},
io: {
input: AssistantQuestionInput,
output: AssistantAnswerIRModel,
errors: {
LOCALE_REQUIRED: {
description: 'Locale is required and must be supported',
http: 400,
gqlCode: 'LOCALE_REQUIRED',
when: 'locale is missing or unsupported',
},
JURISDICTION_REQUIRED: {
description: 'Jurisdiction is required',
http: 400,
gqlCode: 'JURISDICTION_REQUIRED',
when: 'jurisdiction is missing',
},
KB_SNAPSHOT_REQUIRED: {
description: 'KB snapshot id is required',
http: 400,
gqlCode: 'KB_SNAPSHOT_REQUIRED',
when: 'kbSnapshotId is missing',
},
CITATIONS_REQUIRED: {
description: 'Answers must include citations to a KB snapshot',
http: 422,
gqlCode: 'CITATIONS_REQUIRED',
when: 'answer has no citations',
},
SCOPE_VIOLATION: {
description:
'Answer violates allowed scope and must be refused/escalated',
http: 403,
gqlCode: 'SCOPE_VIOLATION',
when: 'output includes forbidden content under the given allowedScope',
},
},
},
policy: { auth: 'user' },
});