AirCoding
bac285d412
fix: 主线 A 事件落库地基 + 主线 B1/B2 执行原语
...
主线 A(事件驱动落库):
- 统一 EventStore 模块单例:RuntimeApp 不再 new EventStore,改用 eventStore
并 setRepositories(14 个 domain repo),消除事件流向空 DB 的割裂
- Scheduler.create_tasks 改为 async,真正发出 task.created 事件
- run.ts dispatchTask 加 await
- 主线 A 独立复审发现并修复关键假绿:四个 repo(Task/Agent/ToolRun/
TaskAttempt)的 *Update 类型 Omit<'status'> 且 update() 主动丢弃 status,
导致 EventStore.project() 的状态写入全部静默失效,DB 行内容 tasks.status
永远冻结在 pending,UI 显示的 completed 来自内存 graph。已修,DB 现
真实反映 task.status=completed
- 补 agent.started/agent.completed/agent.failed 事件发出(之前 agents 表
恒空),修复后 agents 表有正确行+status
主线 B1(结构化工具调用块类型,N1):
- 新增 content-block.ts 定义 Anthropic canonical content blocks
(TextBlock/ThinkingBlock/ToolUseBlock/ToolResultBlock/CanonicalMessage)
- provider.ts ProviderCompletionInput 去掉 unknown 逃生舱:
messages: CanonicalMessage[], tools?: ToolDefinitionBlock[],
tool_choice?: ToolChoice, system?: string | TextBlock[]
主线 B2(read-before-edit 代码层强制,FR-009):
- fs/index.ts 新增 readFileState 机制(移植 claude-code FileEditTool),
fs.edit 执行前检查:未读先改报 "File has not been read yet",外部修改
报 "File has been unexpectedly modified"
- 修复 fs.edit 参数名不匹配:兼容 old_str/new_str (ExecutorRole) 和
find/replace (UI) 两种命名
- fs_edit 唯一性检查(非 global 模式下 old_str 出现多次报错)
真实验收:
- TSC=0
- air run 后 DB:events=5(原 3,+agent.started/completed),
tasks.status=completed(原 frozen pending),agents 1 行 status=completed
- read-before-edit 行为测试:未读先改 status=error,读后再改 status=ok
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-06-08 12:10:07 +08:00
AirCoding
ddefcbb2b1
fix: integrate audit findings round 1 - tools, worker, scheduler, main agent
...
- Unify ToolResultEnvelope (output vs content) for built-in tools
- Fix shell.run AsyncGenerator consumption in ToolRegistry.call/streaming
- Scheduler: consume WorkerResult.status instead of marking all running tasks completed
- WorkerProcess/WorkerManager: surface exit events and generate failed/cancelled result
- MainAgent: integrate ContextAssembler, Chinese destructive regex, ArchitectureDesigner impact gate
- run.ts: pendingConfirmation flow, dispatch extracted, .air files filtered from /results
- CapabilityRegistry wired into RuntimeApp and ServiceRegistry; DoctorService uses it
- release.ts: findRepoRoot/findBun, run air e2e + depcruise + runtime regression
- New gates: release-critical-gates, CLI run command regression
- 14/14 e2e gates pass; 3/3 release dry-run pass
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-06-05 18:39:10 +08:00
AirCoding
56a1dd0a7b
feat: wire full execution chain — MainAgent→Scheduler→Worker→LLM
...
Architecture-compliant interactive run command:
- air run: interactive readline loop, user types tasks
- MainAgent classifies (regex + 中文 support)
- Scheduler creates tasks + runs state machine
- DISPATCHING spawns worker processes via WorkerManager
- Workers receive task_spec via agent.start IPC
- MONITORING detects worker completion → marks tasks done
- /help /status /tools /tasks slash commands
- Auto-init project if needed
No UML changes — all classes unchanged:
- TaskNode: added optional fields (type, title, description)
- RuntimeApp: added session_id/project_id getters
- WorkerConfig: added task_type/task_spec
- Scheduler state machine: status transitions + completion detection
Chain: stdin → MainAgent → Scheduler → WorkerManager.spawn()
→ worker main.ts → ExecutorRole → call_llm() IPC → ProviderManager
→ tools via ToolRegistry → result → ProjectionStore → TUI
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-06-05 14:16:18 +08:00
AirCoding
bc58bd6840
fix(run): push initial projection so TUI shows active session
...
air run now pushes an initial SessionProjection snapshot
to the ProjectionClient before starting the TUI, so the
TUI shows the active session instead of "No session".
Also keep the process alive with an indefinite promise
instead of exiting immediately after TUI start.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-06-05 13:50:34 +08:00
AirCoding
7d3b2b4a4c
fix(regression): repair 5 regressions from second round, close B10/B12/B15/B16
...
Round 2 regression fixes:
- B10 (INV-2 outbox, CRITICAL): wiring.ts — switch durable events
from eventBus.publish (live-only) to eventIngestor.ingest (persistent)
for debug.record.created and memory.promoted. Add required RuntimeEvent
fields (id, source, route).
- B12 (Scheduler events, CRITICAL): Scheduler.ts — replace all 4
eventBus.publish calls with eventIngestor.ingest + registered event
types (task.started/task.failed/agent.lost/agent.cancelled).
Remove unregistered task.status.changed references.
- B15 (duplicate ProjectionClient): remove orphan tui/src/ProjectionClient.ts
(zero references, superseded by runtime/src/projection/ProjectionClient.ts
re-exported via @aircoding/runtime barrel).
- RuntimeApp: wire Scheduler→WorkerManager in constructor; document
start() bootstrap→recover→hydrate→ready sequence (DD §22.2).
- createRuntime: read project_id from .air/shared/project.json
(DD §6.1 stable UUID), fallback to Date.now() only if not initialized.
- B16 (api_key strict): ProviderManager.get_or_create_adapter now calls
ModelConfigLoader.validate() before passing raw api_key to adapter.
Also fix from R1 regression:
- ArchitectureDesigner: replace broken additive-heuristic risk scoring
(single runtime file→replan, large refactor→confirmation only) with
change-scope classification (contracts→confirmation, breaking→escalate,
large→replan, safe→silent_continue). Remove dead evaluate_risk().
- MainAgent test: update confirmation test from old state name
AWAITING_CONFIRMATION to canonical CONFIRMING (B13 state machine fix).
Test: 148/148 pass (regression + e2e + llm + toolchain-cpp).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-03 17:19:36 +08:00
AirCoding
a773bac28c
P0-P8: Full V1.0.0 Alpha implementation + audit reports
...
Implements 123 tasks across 9 phases (T-001..T-809) totaling 146 source files.
Monorepo (P0):
- 7-package Bun + Turborepo + TypeScript monorepo
- dependency-cruiser enforcing 7 forbidden edges + 5 deep-import rules
Contracts (P0):
- 16 type files (ids/error/event/runtime/ipc/task/worker-result/tool/artifact/evidence/project/provider/permission/ui/capability/platform)
Storage & Events (P1):
- DatabaseManager + MigrationRunner (19 tables, 22 indexes, 5 schema_meta seeds)
- 16 repositories (Repository<T,I,U> pattern, INV-1 status columns via EventStore.project only)
- EventSchemaRegistry (54 durable + 7 ephemeral), EventStore, EventBus, EventIngestor
- Project/Session/Artifact/Evidence stores + 8-step Recovery
Tools & Permission (P2):
- PathClassifier (8 categories), CommandRiskAnalyzer (10 categories), SecretRedactor
- PermissionEngine 6-layer evaluation (capability→profile→task_scope→risk→credential→user_prompt)
- ToolRegistry with 20+ tools across fs/shell/git/project/artifact/context/permission/doctor
- CapabilityManifestValidator + CapabilityRegistry
LLM & Context (P3):
- ModelConfigLoader, CapabilityMatrix, AnthropicCanonicalConverter
- AnthropicAdapter + OpenAICompatibleAdapter
- ProviderManager facade
- PromptLayerLoader (L0/L1/L3/L5), CompactionPolicy, ContextAssembler
Worker IPC & Scheduler (P4):
- WorkerProtocol (NDJSON), WorkerProcess (exit codes 0-5), WorkerManager (spawn/handshake)
- WorkerRuntime (INV-3: IPC only, no direct fs/shell/SQLite)
- 5 worker roles (Executor/Reviewer/Debugger/Compactor/ExperienceMiner)
- TaskGraph, WavePlanner, RetryPlanner, AgentMonitor, WorkspaceManager
- Scheduler (state machine), 8-step Recovery
C++ Toolchain (P5):
- DiagnosticParser, CppProjectDetector, CMakeConfigurator, CppBuilder
- CppTestRunner, CppcheckRunner, ClangdClient
- CppToolRegistrar + capability manifest
Projection & TUI (P6):
- ProjectionStore (hydrate/apply/snapshot/subscribe)
- TuiApp + 8 components (Session/Task/Agent/Tool/Diff/Evidence/Permission/Blocker/Hud)
- ProjectionClient in-process ref
Agents & Knowledge (P7):
- MainAgent, ArchitectureDesigner
- DebugKnowledgeStore + LearnedMemoryStore (single-writer, outbox model)
- Role integration wiring
CLI & Doctor & Release (P8):
- Logger + DeveloperLogEncryptor (AES-256-GCM)
- DoctorService (self_bootstrap first)
- RuntimeApp + ServiceRegistry
- 11 CLI commands: run/init/doctor/provider/resume/compact/history/session/restore/e2e/release
- CliEntrypoint + air<TODO>
Audit (in AirPlan/docs/):
- Deepseek开发阶段审计.md (97 findings)
- Opus开发阶段审计.md (140+ findings, 18 P0 blockers)
- MiniMaxM3开发阶段审计.md (18 P0 blockers, focuses on executability)
- AirPlan/TODO.md (technical debt + 42 TODOs by phase)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-02 19:19:55 +08:00