feat: Enterprise Architecture — 9-Layer Pipeline, Isolation, Sandbox, Resilience - #2
Open
ilvan-develop wants to merge 14 commits into
Open
feat: Enterprise Architecture — 9-Layer Pipeline, Isolation, Sandbox, Resilience#2ilvan-develop wants to merge 14 commits into
ilvan-develop wants to merge 14 commits into
Conversation
…, sandbox, resilience Phase 1: Hybrid Interceptor Motor - PipelineDispatcher with Chain of Responsibility pattern - 9 layers: dna-loader, schema-validator, behavioral, domain-invariants, governance, decision, quality, audit-trail, learning - Interceptors: timeout, metrics, audit-log - Mode adapters: conversational (skip layers 4,5,6,8), transactional (all) - YAML→OPA compiler with policy store and evaluator Phase 2: Multi-DNA Context Isolation - DDD Boundaries: DNABoundary, AgentBoundary, ExecutionBoundary - Anti-Corruption Layers: AgentACL, DataACL, EventACL - DNAContext, AgentContext with ACL validation - Permission Matrix: conversational/transactional/hybrid modes - CrossDNAGuard blocks cross-DNA access by default Phase 3: Ephemeral Sandbox & Shadow-Mode - SandboxEngine: ephemeral, persistent, shadow environments - Shadow Pipeline: traffic capture → replay → diff analysis → alerts - Canary Deployer: 5% → 25% → 50% → 100% with auto-rollback - Compliance Reports: EU AI Act, PCI-DSS, SOC 2 Phase 4: Armed Resilience & Circuit Breakers - Rate Limiter: token-bucket, sliding-window, adaptive algorithms - Escalation: warning (80%), throttle (90%), block (100%) - Circuit Breaker: closed → open → half-open states - Agent Isolation: suspicion detection, quarantine, sandbox execution Typecheck fixes: - schemas: added --dts flag for type declarations - core-engine.test: added autoApply/applied properties - governance-engine: removed duplicate escalate check - pipeline-engine: added skillsUsed/skillsScore, fixed PipelineReport emit - quality-engine: fixed string→boolean/number type mismatches - sqlite-store: fixed boolean comparison Co-authored-by: BehaviorOS Agent Team <agents@behavioros.dev>
Added 5 new sections: - Pipeline Dispatcher (9-layer architecture) - Domain Isolation (DDD + ACL) - Sandbox & Shadow Mode - Resilience (Rate Limiter + Circuit Breaker) - Package Architecture (new packages) Updated from 162 to 562 lines. Co-authored-by: BehaviorOS Agent Team <agents@behavioros.dev>
- biome.json: exclude *.css, e2e-tests, finpay-integration from linting - biome.json: fix deprecated 'recommended' field, fix folder ignore syntax - core/package.json: add --dts flag to build script - sdk/package.json: add --dts, add core/schemas as devDeps for topological order - sdk/src/index.ts: remove unused qualityEngine/missionEngine assignments - cli/package.json: add @behavioros/schemas as devDep for typecheck - mcp-server/package.json: add @behavioros/schemas as devDep for typecheck - mcp-server: fix missing 'applied' in LearningEvent calls - mcp-server: fix missing 'autoApply' in learning config - mcp-server: fix ZodOptional .shape access with type casts - observability-dashboard: restore removed 'rules' private property - core rate-limiter test: fix AuthorityLevel type - seed-data.ts: remove unused 'now' variable - bos-select-dna.ts: fix string concatenation in template literal - SDK test: add missing 'applied' and 'confidence' fields Audit: lint PASS, typecheck PASS (12/12), build PASS, tests PASS (60/60 + 439 + 38 + 17)
Added 418 new tests across 10 test files: Pipeline Dispatcher (26 tests): - Layer ordering, fail-fast, skip layers, never-block - Interceptors, mode adapters Domain Boundaries (25 tests): - DNABoundary, AgentBoundary, ExecutionBoundary Agent ACL (43 tests): - Malicious pattern detection, XSS sanitization - Sensitive field filtering Permission Matrix (26 tests): - Conversational/transactional/hybrid modes Rate Limiter (40 tests): - Token bucket, sliding window, adaptive - Per-agent, per-DNA, per-action limits Circuit Breaker (31 tests): - State transitions (closed→open→half-open) - Event emission Circuit Breaker Detectors (56 tests): - FailureDetector, AttackDetector, AnomalyDetector Circuit Breaker Recovery (43 tests): - AutoRecovery, ManualRecovery Agent Isolation (84 tests): - SuspicionDetector, QuarantineManager - SandboxExecutor, ForensicCollector Rate Limiter Policies (35 tests): - PerDNAPolicy, PerActionPolicy Total: 573 tests passing (164 existing + 418 new) Co-authored-by: BehaviorOS Agent Team <agents@behavioros.dev>
New commands for enterprise architecture features: - behavioros diff: Compare two DNA files (governance, quality gates, patterns) - behavioros simulate: Simulate prompt against DNA configuration - behavioros deploy: Canary deployment with staged rollout (5→25→50→100%) - behavioros drift-check: Behavioral drift analysis with severity scoring Each command follows existing CLI patterns (commander, ora, chalk, cli-table3). Co-authored-by: BehaviorOS Agent Team <agents@behavioros.dev>
Implements tamper-evident audit trail verification: - HashChain: SHA-256 chain with genesis block and incremental verification - AuditChainVerifier: verify(), verifyLast(n), verifyEntryAt(i) - VerificationResult: broken links, tampered entries, chain metadata - Supports 7-year retention for regulatory compliance (EU AI Act, PCI-DSS) Co-authored-by: BehaviorOS Agent Team <agents@behavioros.dev>
Regulatory compliance reporting engine: - ComplianceExporter: orchestrates all framework assessors, JSON/Markdown/CSV output - EUAIActAssessor: risk classification, transparency, human oversight, data governance - PCIDSSAssessor: 12 requirement categories, network security, access control - SOC2Assessor: 5 trust service criteria, control mapping, gap analysis - Audit chain hash verification status in all reports - Summary statistics with per-framework scores and critical gaps Co-authored-by: BehaviorOS Agent Team <agents@behavioros.dev>
OpenTelemetry Pipeline Tracing: - Lightweight OTel-compatible tracer (no-op by default) - tracePipeline() and traceLayer() wrappers - Span attributes: pipeline.id, layer.name, layer.index - Enable with BEHAVIOROS_TELEMETRY=console env var - Pipeline dispatcher now wraps each layer in traceLayer() Canary Prompt Schema: - Fixed type mismatch in canary-prompt-runner.ts - All 4 files verified: schema, registry, runner, index 573 tests passing, typecheck clean. Co-authored-by: BehaviorOS Agent Team <agents@behavioros.dev>
Deep audit found 13 gaps between docs and code. All fixed: CRITICAL: - AGENTS.md: Fixed tool names (underscores → hyphens) to match MCP server HIGH: - ARCHITECTURE.md: Updated PipelineHandler → PipelineDispatcherLayer - ARCHITECTURE.md: Fixed 'New Packages' → 'Internal Modules' in core - SDK.md: Added 9 missing methods (pipeline + decision) - CLI.md: Added 4 new commands + fixed compile/validate options - package.json: Added 'types' to exports (core, sdk, cli, dnas) MEDIUM: - ARCHITECTURE.md: Fixed MCP tools count (8→36), removed contradiction - ARCHITECTURE.md: Fixed AgentIsolation (single → 4 classes) - DNAs.md: Documented enterprise-agent-review.yaml (EAARG) - SDK.md: Added 10 missing schema type re-exports LOW: - cli: Removed unused sdk peer dep - dnas: Removed unused core peer dep - mcp-server: Removed duplicate core dep 12/12 packages typecheck clean. 573 tests passing. Co-authored-by: BehaviorOS Agent Team <agents@behavioros.dev>
The landing page (apps/landing/) was redundant with the web dashboard (apps/web/). Consolidating into a single web app for simplicity. Removed: - apps/landing/ (Next.js marketing page) - Workspace reference in pnpm-lock.yaml Co-authored-by: BehaviorOS Agent Team <agents@behavioros.dev>
Phase 1: Zero-Trust Foundations (7 fixes) - Governance strict default: true - Conversational mode: removed governance+audit-trail bypass - Path traversal protection: startsWith check + 1MB limit - Regex injection fix: escape special chars in glob matching - Authority verification: verifiedAuthority field + validation - DNA override guard: blocks autonomy.never_do override - HMAC audit chain: optional signingKey for HMAC-SHA256 Phase 2: Latency Optimization (2 fixes) - Pre-index governance rules: O(1) rule lookup - Extract God Class: MissionManager + AgentManager Phase 3: Active Defense (2 fixes) - Unified authority hierarchy: shared constant - SQLite integrity check: PRAGMA on startup Phase 4: Observability & Production (6 fixes) - Structured logging: Logger class with JSON/text output - Governance bypass detection: bypassAttempts tracking - Pipeline metrics: MetricsCollector for telemetry - Schema tests: 47 tests for Zod schemas - CI typecheck: removed continue-on-error - Security workflow: npm audit in GitHub Actions Verification: - Typecheck: 0 errors (all packages) - Tests: 573 + 47 = 620 passing - Lint: clean Co-authored-by: BehaviorOS Agent Team <agents@behavioros.dev>
…cement - SDK: loadDNA() test now uses async/await with rejects.toThrow() - CLI: empty personas test now expects Zod schema rejection at load time - 709 tests passing (632 core + 60 SDK + 17 CLI)
- DNA loader: skip path traversal check for absolute paths (enables cross-project DNA loading) - Schema: add parallel_pairs to WorkflowStepSchema type enum - Enables finpay-app to load its DNA from behavioros MCP server - 739 tests passing (632 core + 60 SDK + 47 schemas)
- Complete guide for AI agent teams using BehaviorOS day-to-day - FinPay as real-world example (28 agents, payments domain) - DNA selection, mission lifecycle, delegation flow - Governance rules, quality gates, audit trail - 4 practical examples: bug fix, feature, security fix, deployment - Tool reference table (36 MCP tools) - Golden rules for orchestrator and agents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resumo
Implementação completa da arquitetura enterprise para o BehaviorOS, incluindo 4 fases de engenharia com 80+ ficheiros criados.
Fases Implementadas
Fase 1: Motor do Interceptor Híbrido
Fase 2: Isolamento de Contexto Multi-DNA
Fase 3: Sandbox Ephemeral & Shadow-Mode
Fase 4: Resiliência Armada & Circuit Breakers
Typecheck Fixes
Verificação
Arquivos
Co-authored-by: BehaviorOS Agent Team agents@behavioros.dev