chore: more validation of plan vs spec

This commit is contained in:
2026-04-02 18:59:18 +02:00
parent aec533b54f
commit 1a24027723
25 changed files with 112 additions and 49 deletions

View File

@@ -1,24 +1,22 @@
-- allium: 1
-- bDS AI Integration
-- Scope: core (one-shot operations), extension Bucket C (chat + streaming)
-- Distilled from: src/main/engine/ChatEngine.ts, ai/providers.ts,
-- ai/chat.ts, ai/tasks.ts, SecureKeyStore.ts
-- Note: Rust rewrite simplifies providers to two configurable
-- OpenAI-compatible endpoints (online + airplane mode),
-- replacing the TypeScript app's 4 named providers.
use "./post.allium" as post
use "./media.allium" as media
value AiProvider {
kind: opencode_zen | mistral | ollama | lm_studio
-- OpenCode Zen: routes claude* to Anthropic Messages API,
-- everything else to OpenAI Chat Completions
-- Mistral: native Mistral API
-- Ollama: localhost:11434, local models
-- LM Studio: localhost:1234, local models
}
value AiModel {
provider: AiProvider
name: String
modalities: Set<String> -- text, vision, etc.
entity AiEndpoint {
kind: online | airplane
url: String
api_key: String? -- encrypted via SecureKeyStore; null for local models
model: String
-- online: cloud provider (OpenAI, Anthropic-via-proxy, etc.)
-- airplane: local model (Ollama, LM Studio, etc.)
}
entity SecureKeyStore {
@@ -30,7 +28,7 @@ entity SecureKeyStore {
entity ChatConversation {
title: String
model: String -- default: claude-sonnet-4-5
model: String
created_at: Timestamp
updated_at: Timestamp
@@ -47,6 +45,9 @@ entity ChatMessage {
}
-- One-shot AI tasks (core scope, no streaming)
-- All use OpenAI Chat Completions wire format.
-- When airplane_mode: use airplane endpoint. When online: use online endpoint.
-- When no endpoint configured for current mode: disable AI, show toast.
rule AnalyzeTaxonomy {
when: AnalyzeTaxonomyRequested(post)
@@ -92,11 +93,11 @@ rule TranslateMedia {
ensures: MediaTranslationResult(title, alt, caption)
}
-- Chat (extension scope, with streaming and tool use)
-- Chat (extension Bucket C scope, with streaming and tool use)
rule StartChat {
when: StartChatRequested(model)
ensures: ChatConversation.created(model: model ?? "claude-sonnet-4-5")
ensures: ChatConversation.created(model: model)
}
rule SendChatMessage {
@@ -112,15 +113,26 @@ rule SendChatMessage {
-- Model catalog
rule RefreshModelCatalog {
when: RefreshModelCatalogRequested(provider)
when: RefreshModelCatalogRequested(endpoint)
-- Queries the endpoint's model list API
-- 5-minute cache TTL
ensures: ModelCatalogUpdated(provider)
ensures: ModelCatalogUpdated(endpoint)
}
invariant AirplaneModeGating {
-- All AI activities must be gated by airplane (offline) mode
-- When offline: either use local model (Ollama/LM Studio) or
-- inform the user via toast notification
-- When airplane_mode = true: only the airplane endpoint is used
-- When airplane_mode = false: the online endpoint is used
-- If the active endpoint is not configured: AI is unavailable,
-- show toast notification to user
}
invariant TwoEndpointModel {
-- Two configurable OpenAI-compatible endpoints:
-- online: for cloud providers (requires API key)
-- airplane: for local models (no API key required)
-- Both use the OpenAI Chat Completions wire format.
-- This replaces the TypeScript app's 4 named provider model.
}
invariant SecureKeyStorage {

View File

@@ -54,6 +54,12 @@ use "./metadata_diff.allium" as metadata_diff -- DB/filesystem diff and rebuil
--
-- 2. Liquid subset: see template.allium for the exact subset.
-- Only 5 tags, 4 standard filters, 2 custom filters, 5 operators.
-- .size is property access on arrays, NOT a pipe filter.
--
-- 3. Macro calling convention: [[macroslug param1=value1 ...]]
-- Double-bracket syntax, not Liquid tags. Identical to current app.
--
-- 4. AI provider model: Rust rewrite uses two configurable OpenAI-compatible
-- endpoints (online + airplane mode) instead of the TypeScript app's
-- 4 named providers (OpenCode Zen, Mistral, Ollama, LM Studio).
-- See ai.allium for details.

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS CLI / App Notification Sync
-- Scope: extension (Bucket G — MCP + Automation)
-- Distilled from: src/main/engine/CliNotifier.ts, NotificationWatcher.ts
entity DbNotification {

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS Semantic Similarity / Embeddings
-- Scope: extension (Bucket D — Embeddings + Duplicate Detection)
-- Distilled from: src/main/engine/EmbeddingEngine.ts
use "./post.allium" as post

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS Static Site Generation
-- Scope: core (Wave 4)
-- Distilled from: src/main/engine/BlogGenerationEngine.ts,
-- PageRenderer.ts, GenerationWorkerPool, RoutePageGenerationService

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS Git Integration
-- Scope: extension (Bucket A — Git + Validation)
-- Distilled from: src/main/engine/GitEngine.ts
use "./post.allium" as post

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS Internationalization
-- Scope: core (Wave 0 onward — split localization is mandatory)
-- Distilled from: src/main/shared/i18n.ts, i18n/locales/*.json
value SupportedLanguage {

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS MCP Server (Model Context Protocol)
-- Scope: extension (Bucket G — MCP + Automation)
-- Distilled from: src/main/engine/MCPServer.ts, ProposalStore, MCPAgentConfigEngine.ts
use "./post.allium" as post

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS Media Lifecycle
-- Scope: core (Wave 1)
-- Distilled from: src/main/engine/MediaEngine.ts, schema.ts
use "./project.allium" as project

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS Navigation Menu
-- Scope: core (read for rendering), extension Bucket F (menu editor UI)
-- Distilled from: src/main/engine/MenuEngine.ts
value MenuItem {

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS Project Metadata, Categories, Publishing Preferences
-- Scope: core (Wave 1)
-- Distilled from: src/main/engine/MetaEngine.ts, schema.ts
use "./project.allium" as project

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS Metadata Diff and Rebuild
-- Scope: core (Wave 1)
-- Distilled from: src/main/engine/MetadataDiffEngine.ts
use "./post.allium" as post

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS Post Lifecycle
-- Scope: core (Wave 1)
-- Distilled from: src/main/engine/PostEngine.ts, postFileUtils.ts, schema.ts
use "./project.allium" as project

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS Local Preview Server
-- Scope: core (Wave 4)
-- Distilled from: src/main/engine/PreviewServer.ts, PageRenderer.ts
use "./template.allium" as template

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS Project Management
-- Scope: core (Wave 1)
-- Distilled from: src/main/engine/ProjectEngine.ts, schema.ts
entity Project {

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS SSH Publishing
-- Scope: core (Wave 5)
-- Distilled from: src/main/engine/PublishEngine.ts
use "./metadata.allium" as meta

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS Scripting System
-- Scope: core (Wave 6 — Lua runtime and scripting docs)
-- Distilled from: src/main/engine/ScriptEngine.ts, schema.ts
-- Note: TypeScript app uses Python/Pyodide. Rust rewrite uses Lua.
-- Behavioural contract is identical; only runtime changes.

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS Full-Text Search
-- Scope: core (Wave 1 — FTS5 in-app search with Snowball stemmers)
-- Distilled from: src/main/engine/PostEngine.ts (FTS methods),
-- MediaEngine.ts (FTS methods), stemmer.ts

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS Tag System
-- Scope: core (Wave 1)
-- Distilled from: src/main/engine/TagEngine.ts, schema.ts
use "./project.allium" as project

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS Background Task Manager
-- Scope: core (Wave 1)
-- Distilled from: src/main/engine/TaskManager.ts
entity Task {

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS Liquid Template System
-- Scope: core (Wave 1 data, Wave 4 rendering)
-- Distilled from: src/main/engine/TemplateEngine.ts, PageRenderer.ts, schema.ts,
-- bundled starter templates in src/main/engine/templates/

View File

@@ -1,5 +1,6 @@
-- allium: 1
-- bDS Translation System
-- Scope: core (Wave 1)
-- Distilled from: src/main/engine/PostEngine.ts (translation methods),
-- postTranslationFileUtils.ts, MediaEngine.ts