Lang — Expression & Language
Purpose
Section titled “Purpose”The language runtime. Governs how your AI expresses itself — vocabulary, safety boundaries, output attribution, prompt integrity. Like the display and typography system of an OS, Lang controls how things appear to users. Every interaction with Baseline Protocol starts here — input is tokenized, parsed into commands and arguments, validated against syntax rules, and dispatched to handlers.
Key interfaces
Section titled “Key interfaces”interface ParsedInput { original: string; tokens: string[]; command: string | null; options: Map<string, unknown>; arguments: string[]; intent: string | null;}
interface IntentResult { type: string; // 'question' | 'action' | 'query' | 'modification' | 'deletion' | 'status' confidence: number; // 0.0 – 1.0 patterns: RegExp[];}
interface ProcessResult { success: boolean; parsed?: ParsedInput; intent?: IntentResult; result?: CommandResult; error?: string; suggestions?: string[];}import { BaselineLangSystem } from '@baselineos/lang';
const lang = new BaselineLangSystem();
const result = lang.processInput('help');// { success: true, parsed: { command: 'help', ... } }
// Register a custom commandlang.registerCommand('deploy', { aliases: ['ship'], description: 'Deploy the current build', usage: 'deploy --env production', examples: ['deploy --env staging'],});LayerSweep checks
Section titled “LayerSweep checks”The layer sweep runs three checks against Lang:
| Check | What it validates |
|---|---|
| Input parsing | Input is parseable — either as a registered command or natural language with detected intent |
| Injection resistance | No prompt-injection patterns (e.g. “ignore previous instructions”) in title or description |
| Output safety | Output does not contain exposed credentials (password=, api_key=, etc.) |
References
Section titled “References”- Specification: 01-lang — formal type definitions and processing pipeline
- Package README —
@baselineos/lang