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>
This commit is contained in:
AirCoding
2026-06-03 17:19:36 +08:00
parent 20bad8ca29
commit 7d3b2b4a4c
18 changed files with 276 additions and 78 deletions

View File

@@ -1,38 +0,0 @@
/**
* ProjectionClient - In-process projection consumer
* DD §13.2. Direct ref (not IPC). TUI imports ONLY contracts + this client.
*
* @module packages/tui/src/ProjectionClient
*/
import type { SessionProjection, 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) {
sub(projection)
}
}
/**
* 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
}
}

View File

@@ -5,12 +5,12 @@
* @module packages/tui/src/TuiApp
*/
import { ProjectionClient } from './ProjectionClient.js'
import { ProjectionClient } from '@aircoding/runtime'
import { SessionView } from './components/SessionView.js'
import { TaskListView } from './components/TaskListView.js'
import { AgentStatusView } from './components/AgentStatusView.js'
import { HudView } from './components/HudView.js'
import type { SessionProjection } from './types.js'
import type { SessionProjection } from '@aircoding/runtime'
export interface TuiAppProps {
client: ProjectionClient

View File

@@ -1,13 +1,13 @@
/**
* TUI package — Terminal UI components
*
* INV-4: TUI imports ONLY contracts + ProjectionClient.
* INV-4: TUI imports ONLY contracts + ProjectionClient from runtime.
* Uses OpenTUI @opentui/* as renderer (npm-dep, do NOT reimplement).
*
* @module packages/tui
*/
export { ProjectionClient } from './ProjectionClient.js'
export { ProjectionClient } from '@aircoding/runtime'
export { TuiApp } from './TuiApp.js'
export type { TuiAppProps, TuiAppState } from './TuiApp.js'
@@ -35,4 +35,4 @@ export type { BlockerReportProps } from './components/BlockerReport.js'
export { HudView } from './components/HudView.js'
export type { HudViewProps, HudPreset } from './components/HudView.js'
export type { SessionProjection, TaskProjection, AgentProjection, ProjectionSubscriber } from './types.js'
export type { SessionProjection, TaskProjection, AgentProjection, ProjectionSubscriber } from '@aircoding/runtime'