feat(round2+round3): 完整实现 A/B/C/D 主线 + round3-F/H 修复
Round2 主线:
- A: 事件落库地基 (RuntimeApp EventStore 单例 + 14 repo wiring)
- B: 执行体对齐 (read-before-edit, verification-before-completion)
- C: 界面对齐 (@opentui/solid, 删除 runtime 依赖)
- D: 经验闭环 (ExperienceMiner, DebuggerRole, CompactorRole)
Round2 补充修复:
- fail-on-missing 反作弊门禁
- projection-store-apply.test.ts 补写
- 3个空壳测试转行为 (evidence-store, recovery-impl, knowledge-store)
- ask 项目根支持 AIRCODING_PROJECT_ROOT
- Worker 事件契约修复 (task.attempt.started → checkpoint)
Round3-F: cpp 工具切换
- 删除 BuiltInToolRegistrar cpp.* 闭包
- 接入 toolchain-cpp 真实 CppToolRegistrar
- canonical envelope {status/output/metadata}
- ExecutorRole system prompt 对齐新工具名
Round3-H: Doctor 5 类报告
- toolchain (cmake/ninja/cppcheck/clangd/g++)
- display (X11/Wayland + ImageMagick)
- network (internet connectivity)
- provider (api_key/base_url/model/connectivity)
Secret 脱敏:
- 状态交接.md: sk- → \${OPENAI_API_KEY}
- .gitignore: 添加 .air/ .claude/
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,53 +1,28 @@
|
||||
/**
|
||||
* ProjectionClient - Local TUI-side projection consumer
|
||||
* TUI copies minimal projection types from contracts to avoid INV-4 violation
|
||||
* (TUI must only depend on contracts; dd §13.2 / c4/code-view §2 rule 3).
|
||||
*
|
||||
* The runtime package provides the authoritative ProjectionClient in
|
||||
* `runtime/projection/ProjectionClient.ts`. TUI defines its own local copy
|
||||
* with the same surface so that subscriptions work in-process.
|
||||
* ProjectionClient - Local TUI-side projection consumer.
|
||||
* TUI keeps a contracts-only copy of the ProjectionClient surface so it never imports runtime.
|
||||
*
|
||||
* @module packages/tui/src/ProjectionClient
|
||||
*/
|
||||
|
||||
import type { SessionID, ProjectID, TaskID, AgentID, ISOTimeString } from '@aircoding/contracts'
|
||||
import type { ProjectionSubscriber, SessionProjection } from './types.js'
|
||||
|
||||
export interface SessionProjection {
|
||||
session_id: SessionID
|
||||
project_id: ProjectID
|
||||
status: string
|
||||
title?: string
|
||||
tasks: TaskProjection[]
|
||||
agents: AgentProjection[]
|
||||
}
|
||||
|
||||
export interface TaskProjection {
|
||||
id: TaskID
|
||||
type: string
|
||||
status: string
|
||||
title: string
|
||||
retry_count: number
|
||||
attempts: number
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export interface AgentProjection {
|
||||
id: AgentID
|
||||
type: string
|
||||
status: string
|
||||
task_id?: TaskID
|
||||
last_heartbeat?: string
|
||||
}
|
||||
|
||||
export type ProjectionSubscriber = (projection: SessionProjection) => void
|
||||
export type {
|
||||
SessionProjection,
|
||||
TaskProjection,
|
||||
AgentProjection,
|
||||
ToolRunProjection,
|
||||
CommandRunProjection,
|
||||
ArtifactProjection,
|
||||
PermissionPromptProjection,
|
||||
BlockerProjection,
|
||||
ProjectionSubscriber,
|
||||
} from './types.js'
|
||||
|
||||
export class ProjectionClient {
|
||||
private snapshot: SessionProjection | null = null
|
||||
private subscribers: Set<ProjectionSubscriber> = new Set()
|
||||
|
||||
/**
|
||||
* Receive and cache a projection snapshot.
|
||||
*/
|
||||
receive_snapshot(projection: SessionProjection): void {
|
||||
this.snapshot = projection
|
||||
for (const sub of this.subscribers) {
|
||||
@@ -55,17 +30,11 @@ export class ProjectionClient {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribe to projection updates.
|
||||
*/
|
||||
subscribe(subscriber: ProjectionSubscriber): () => void {
|
||||
this.subscribers.add(subscriber)
|
||||
return () => this.subscribers.delete(subscriber)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current snapshot.
|
||||
*/
|
||||
get_snapshot(): SessionProjection | null {
|
||||
return this.snapshot
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user