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.
Create a new draft rule version with source references.
Goal
Propose curated knowledge updates with traceability.
Context
Automation or curators propose draft rule versions.
Source Definition
import { defineCommand, defineQuery } from '@lssm-tech/lib.contracts-spec';
import { defineSchemaModel, ScalarTypeEnum } from '@lssm-tech/lib.schema';
import {
KBSnapshotModel,
RuleVersionModel,
SourceDocumentModel,
SourceRefModel,
} from '../entities/models';
export const KbUpsertRuleVersionContract = defineCommand({
meta: {
key: 'kb.upsertRuleVersion',
title: 'Upsert Rule Version',
version: '1.0.0',
stability: 'experimental',
owners: ['@examples'],
tags: ['knowledge', 'rules', 'versioning'],
description: 'Create a new draft rule version with source references.',
goal: 'Propose curated knowledge updates with traceability.',
context: 'Automation or curators propose draft rule versions.',
},
io: {
input: UpsertRuleVersionInput,
output: RuleVersionModel,
errors: {
SOURCE_REFS_REQUIRED: {
description: 'Rule version must cite at least one sourceRef',
http: 400,
gqlCode: 'SOURCE_REFS_REQUIRED',
when: 'sourceRefs is empty',
},
RULE_NOT_FOUND: {
description: 'Rule does not exist',
http: 404,
gqlCode: 'RULE_NOT_FOUND',
when: 'ruleId is unknown',
},
},
},
policy: { auth: 'user' },
});