Integrate canonical architecture: two-process backend + LiveKit agent
Promote all 12 staged canonical files from docs/generated/files/ to their
live paths, creating the full PodMan architecture:
Backend:
- server.ts: HTTP service (token mint, sync-PR, outcome recording, /health, WS relay)
- agent.ts: worker joining LiveKit room, grabbing screenshare frames at ~1fps
- agent/podman.ts: orchestrator loop (vision -> collision detection -> intervention)
- env.ts: flat env var accessors replacing nested stub
- vision/gemini.ts: JPEG -> Gemini vision -> EngineerContext (real implementation)
- collision/detector.ts: fused vision+GitHub collision detection (the moat)
- github/client.ts: Octokit wrapper with caching + sync PR creation
- memory/store.ts: extended with recordObservation/recordCollision/recordIntervention/recordOutcome helpers
- memory/vectors.ts: stub for Voyage+Atlas vector recall (Loop A)
- memory/policy.ts: stub for intervention policy gate (Loop B)
- voice/live.ts: stub for Gemini Live TTS voice output
Shared:
- messages.ts: LiveKit data-channel wire protocol (DataMessage, InterventionOutcome, TeamModel, LocalGitReport)
- index.ts: re-exports messages module
Frontend:
- livekit/useScreenPublish.ts: hook for joining pod and publishing screenshare
- livekit/useInterventions.ts: hook for receiving collision cards and responding
- lib/api.ts: fetchToken + postOutcome HTTP helpers
Database:
- database/init.ts: MongoDB Atlas collections + indexes + vector search index
Infra:
- infra/.do/app.yaml: DO App Platform spec (static_site + service + worker)
Retire stubs superseded by canonical decomposition:
- backend/src/index.ts (replaced by server.ts)
- backend/src/intervention/engine.ts (logic now in agent/podman.ts)
- backend/src/livekit/token.ts (token minting now in server.ts)
Install missing dependencies: @livekit/rtc-node, sharp, mongodb, ws, @types/ws
Type error fixes:
- vision/gemini.ts: use MediaResolution.MEDIA_RESOLUTION_LOW enum value (not string literal)
- agent/podman.ts: wrap SuggestedActionKind into { kind: action } SuggestedAction object
All packages pass pnpm -r typecheck and pnpm -r build.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -8,3 +8,4 @@ export type {
|
||||
SuggestedAction,
|
||||
SuggestedActionKind,
|
||||
} from './intervention.js';
|
||||
export * from './messages.js';
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import type { Collision } from './collision.js';
|
||||
import type { Intervention, InterventionStatus } from './intervention.js';
|
||||
|
||||
/** Topics multiplexed over the LiveKit data channel. */
|
||||
export const DATA_TOPIC = 'podman.intervention' as const;
|
||||
|
||||
/** Wire messages exchanged between the PodMan agent and engineer PWAs. */
|
||||
export type DataMessage =
|
||||
| { type: 'COLLISION'; collision: Collision; intervention: Intervention }
|
||||
| { type: 'VOICE_CUE'; text: string }
|
||||
| { type: 'ACK'; interventionId: string; status: InterventionStatus; note?: string }
|
||||
| { type: 'GIT_REPORT'; report: LocalGitReport };
|
||||
|
||||
/** Outcome of an intervention — the supervision signal for policy learning. */
|
||||
export interface InterventionOutcome {
|
||||
interventionId: string;
|
||||
collisionId: string;
|
||||
podId: string;
|
||||
/** Did the predicted collision turn out real? (engineer-confirmed or inferred). */
|
||||
wasRealCollision: boolean;
|
||||
/** Did the engineer accept the offered action (e.g. sync PR)? */
|
||||
accepted: boolean;
|
||||
recordedAt: string;
|
||||
}
|
||||
|
||||
/** The continually-refined per-pod world model (Loop A). */
|
||||
export interface TeamModel {
|
||||
podId: string;
|
||||
/** filePath/dir -> engineerId most associated with it (de-facto owner). */
|
||||
ownership: Record<string, string>;
|
||||
/** Pairs of files that historically collide, with a co-occurrence weight. */
|
||||
hotspots: Array<{ files: [string, string]; weight: number }>;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
/** OPTIONAL Tier-2 ground-truth from a per-laptop git sidecar. */
|
||||
export interface LocalGitReport {
|
||||
engineerId: string;
|
||||
branch: string;
|
||||
/** Commits ahead of upstream (invisible to the GitHub API). */
|
||||
unpushedCount: number;
|
||||
/** Working-tree files with uncommitted edits. */
|
||||
dirtyFiles: string[];
|
||||
reportedAt: string;
|
||||
}
|
||||
Reference in New Issue
Block a user