@revealui/harnesses 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,64 +1,12 @@
1
- import { HarnessAdapter, HarnessCapabilities, HarnessInfo, HarnessCommand, HarnessCommandResult, HarnessEvent, ConfigDiffEntry, ConfigSyncDirection, ConfigSyncResult, HealthCheckResult, HarnessProcessInfo } from './types/index.js';
1
+ import { ConfigDiffEntry, ConfigSyncDirection, ConfigSyncResult, HarnessAdapter, HealthCheckResult, HarnessProcessInfo, HarnessEvent } from './types/index.js';
2
+ export { HarnessCapabilities, HarnessCommand, HarnessCommandResult, HarnessInfo } from './types/index.js';
2
3
  export { Agent, Command, ContentGenerator, ContentSummary, DiffEntry, GeneratedFile, Manifest, PreambleTier, ResolverContext, Rule, Skill, ValidationResult, buildManifest, diffContent, generateContent, listContent, validateManifest } from './content/index.js';
3
- import { DaemonStore } from './storage/index.js';
4
- export { AgentMessage, AgentSession, AgentTask, DaemonEvent, DaemonStoreConfig, FileReservation, SCHEMA_SQL } from './storage/index.js';
4
+ import { D as DaemonStore, M as MergeRequest } from './index-w5ashbfb.js';
5
+ export { A as AgentMessage, a as AgentSession, b as AgentTask, c as DaemonEvent, d as DaemonStoreConfig, F as FileReservation, S as SCHEMA_SQL } from './index-w5ashbfb.js';
6
+ import { z } from 'zod';
5
7
  import { EventEmitter } from 'node:events';
6
- import { WorkboardManager } from './workboard/index.js';
7
- export { ConflictResult, SessionType, WorkboardEntry, WorkboardSession, WorkboardState, acquireLock, atomicWriteSync, deriveSessionId, detectSessionType, lockPathFor, releaseLock, withLock, withLockAsync } from './workboard/index.js';
8
- import 'zod';
9
-
10
- /**
11
- * Adapter for Anthropic Claude Code (CLI: `claude`).
12
- *
13
- * Claude Code communicates via its CLI. Config lives at
14
- * ~/.claude/settings.json and project-level .claude/settings.json.
15
- * MCP integration is handled separately by @revealui/mcp.
16
- *
17
- * Workboard read/write requires REVEALUI_WORKBOARD_PATH to be set to the
18
- * absolute path of the workboard.md file.
19
- */
20
- declare class ClaudeCodeAdapter implements HarnessAdapter {
21
- readonly id = "claude-code";
22
- readonly name = "Claude Code";
23
- private readonly eventHandlers;
24
- private readonly workboardPath;
25
- constructor(workboardPath?: string);
26
- getCapabilities(): HarnessCapabilities;
27
- getInfo(): Promise<HarnessInfo>;
28
- isAvailable(): Promise<boolean>;
29
- notifyRegistered(): void;
30
- notifyUnregistering(): void;
31
- execute(command: HarnessCommand): Promise<HarnessCommandResult>;
32
- private executeInner;
33
- onEvent(handler: (event: HarnessEvent) => void): () => void;
34
- dispose(): Promise<void>;
35
- private emit;
36
- }
37
-
38
- /**
39
- * Adapter for Cursor IDE.
40
- *
41
- * Cursor is a VS Code fork with built-in AI capabilities.
42
- * This adapter detects Cursor via `cursor --version` and provides
43
- * workboard read/write when REVEALUI_WORKBOARD_PATH is set.
44
- */
45
- declare class CursorAdapter implements HarnessAdapter {
46
- readonly id = "cursor";
47
- readonly name = "Cursor";
48
- private readonly eventHandlers;
49
- private readonly workboardPath;
50
- constructor(workboardPath?: string);
51
- getCapabilities(): HarnessCapabilities;
52
- getInfo(): Promise<HarnessInfo>;
53
- isAvailable(): Promise<boolean>;
54
- notifyRegistered(): void;
55
- notifyUnregistering(): void;
56
- execute(command: HarnessCommand): Promise<HarnessCommandResult>;
57
- private executeInner;
58
- onEvent(handler: (event: HarnessEvent) => void): () => void;
59
- dispose(): Promise<void>;
60
- private emit;
61
- }
8
+ import { WorkboardManager, WorkboardState } from './workboard/index.js';
9
+ export { ConflictResult, SessionType, acquireLock, atomicWriteSync, deriveSessionId, detectSessionType, lockPathFor, releaseLock, withLock, withLockAsync } from './workboard/index.js';
62
10
 
63
11
  /**
64
12
  * Syncs harness config between local filesystem and root backup.
@@ -110,6 +58,260 @@ declare class HarnessRegistry {
110
58
  disposeAll(): Promise<void>;
111
59
  }
112
60
 
61
+ /**
62
+ * CIFeedback - Layer 4 of the Autonomous Agent Architecture.
63
+ *
64
+ * Receives CI results (posted by GitHub Actions via the daemon's HTTP gateway),
65
+ * and routes them back to agents:
66
+ * - Green: mark merge request as merged, complete the linked task
67
+ * - Red: parse the failure category, create a fix task, assign back
68
+ * to the originating agent (up to MAX_RETRIES), then escalate
69
+ *
70
+ * The CI workflow posts to `POST /rpc` with method `ci.report`.
71
+ */
72
+
73
+ interface CIReportParams {
74
+ /** PR number the CI ran on. */
75
+ prNumber?: number;
76
+ /** Branch name the CI ran on (fallback lookup if prNumber missing). */
77
+ branch?: string;
78
+ /** Whether CI passed. */
79
+ success: boolean;
80
+ /** Raw CI output (truncated to 10KB by the caller). */
81
+ output?: string;
82
+ /** GitHub Actions run URL for reference. */
83
+ runUrl?: string;
84
+ /** Which CI job failed (e.g., 'quality', 'typecheck', 'test-unit', 'build'). */
85
+ failedJob?: string;
86
+ }
87
+ interface CIFeedbackResult {
88
+ action: 'merged' | 'fix_task_created' | 'escalated' | 'no_merge_request' | 'error';
89
+ mergeRequestId?: string;
90
+ taskId?: string;
91
+ retryCount?: number;
92
+ error?: string;
93
+ }
94
+ declare class CIFeedback {
95
+ private readonly store;
96
+ constructor(store: DaemonStore);
97
+ /**
98
+ * Handle a CI report. Called when GitHub Actions posts results
99
+ * to the daemon HTTP gateway.
100
+ */
101
+ report(params: CIReportParams): Promise<CIFeedbackResult>;
102
+ private handleSuccess;
103
+ private handleFailure;
104
+ /** Escalate to human after max retries. */
105
+ private escalate;
106
+ /** Find the merge request associated with this CI run. */
107
+ private findMergeRequest;
108
+ /** Categorize the CI failure from the job name or output. */
109
+ private categorizeFailure;
110
+ /** Build a descriptive fix task for the agent. */
111
+ private buildFixTaskDescription;
112
+ }
113
+
114
+ /**
115
+ * MergePipeline - Layer 3 of the Autonomous Agent Architecture.
116
+ *
117
+ * Watches task completions, diffs agent worktree branches, attempts
118
+ * fast-forward merges into a staging branch, and creates PRs to `test`.
119
+ *
120
+ * Conflict detection notifies conflicting agents via the messaging system.
121
+ * Merges are ordered by the workspace dependency graph (topological sort).
122
+ */
123
+
124
+ interface MergePipelineConfig {
125
+ /** Absolute path to the repo root. */
126
+ repoRoot: string;
127
+ /** Default base branch for PRs (default: 'test'). */
128
+ baseBranch?: string;
129
+ /** GitHub remote name (default: 'origin'). */
130
+ remote?: string;
131
+ }
132
+ interface MergeResult {
133
+ mergeRequestId: string;
134
+ status: MergeRequest['status'];
135
+ prUrl?: string;
136
+ prNumber?: number;
137
+ error?: string;
138
+ conflictingFiles?: string[];
139
+ }
140
+ declare class MergePipeline {
141
+ private readonly store;
142
+ private readonly repoRoot;
143
+ private readonly baseBranch;
144
+ private readonly remote;
145
+ constructor(store: DaemonStore, config: MergePipelineConfig);
146
+ /**
147
+ * Request a merge for an agent's branch into the base branch.
148
+ * Creates a merge_request record and attempts the merge.
149
+ */
150
+ requestMerge(params: {
151
+ agentId: string;
152
+ sourceBranch: string;
153
+ taskId?: string;
154
+ baseBranch?: string;
155
+ }): Promise<MergeResult>;
156
+ /**
157
+ * Process a pending merge request: fetch, check for conflicts,
158
+ * fast-forward merge, and create a PR.
159
+ */
160
+ processMerge(mergeId: string): Promise<MergeResult>;
161
+ /** Get the current status of a merge request. */
162
+ getStatus(mergeId: string): Promise<MergeResult>;
163
+ /** Retry a failed or conflicted merge request. */
164
+ resolve(mergeId: string): Promise<MergeResult>;
165
+ /** List all active (non-terminal) merge requests. */
166
+ listActive(): Promise<MergeRequest[]>;
167
+ /**
168
+ * Get the workspace dependency order for merge sequencing.
169
+ * Packages that are dependencies of others should merge first.
170
+ */
171
+ getDependencyOrder(): Promise<string[]>;
172
+ /** Run a git command in the repo root. */
173
+ private git;
174
+ /**
175
+ * Check whether source branch merges cleanly into base branch.
176
+ * Uses `git merge-tree` (available in Git 2.38+) for a tree-only check
177
+ * that doesn't touch the working directory.
178
+ */
179
+ private checkConflicts;
180
+ /** Notify conflicting agents via the messaging system. */
181
+ private handleConflict;
182
+ /** Create a GitHub PR using the `gh` CLI. */
183
+ private createPR;
184
+ }
185
+
186
+ /**
187
+ * VAUGHN Capability Model (Section 4 of VAUGHN.md)
188
+ *
189
+ * Defines the full superset of capabilities an adapter can declare.
190
+ * Adapters degrade gracefully when a tool lacks a feature.
191
+ */
192
+ /** Available sandbox isolation modes. */
193
+ type SandboxMode = 'read-only' | 'workspace-write' | 'full-access';
194
+ /** Hook granularity levels. */
195
+ type HookGranularity = 'none' | 'bash-only' | 'all-tools';
196
+ /** Memory backend types. */
197
+ type MemoryBackend = 'none' | 'sqlite' | 'crdt' | 'file';
198
+ /**
199
+ * Full capability declaration for a VAUGHN adapter.
200
+ * Each adapter declares this statically at registration time.
201
+ */
202
+ interface VaughnCapabilities {
203
+ /** Dispatch operations: can the adapter programmatically invoke these? */
204
+ dispatch: {
205
+ /** Adapter can send a prompt and get code back */
206
+ generateCode: boolean;
207
+ /** Adapter can request code analysis */
208
+ analyzeCode: boolean;
209
+ /** Adapter can send a diff to apply */
210
+ applyEdit: boolean;
211
+ /** Adapter can invoke shell commands */
212
+ executeCommand: boolean;
213
+ };
214
+ /** Coordination capabilities */
215
+ readWorkboard: boolean;
216
+ writeWorkboard: boolean;
217
+ claimTasks: boolean;
218
+ reportConflicts: boolean;
219
+ /** Lifecycle capabilities */
220
+ headless: boolean;
221
+ resumable: boolean;
222
+ forkable: boolean;
223
+ backgroundable: boolean;
224
+ /** Safety: hook system */
225
+ hooks: {
226
+ supported: boolean;
227
+ granularity: HookGranularity;
228
+ canBlock: boolean;
229
+ };
230
+ /** Safety: OS-level sandboxing */
231
+ sandbox: {
232
+ supported: boolean;
233
+ modes: SandboxMode[];
234
+ writablePaths?: string[];
235
+ };
236
+ supportsWorktrees: boolean;
237
+ /** Context capabilities */
238
+ supportsSkills: boolean;
239
+ supportsMcp: boolean;
240
+ memory: {
241
+ supported: boolean;
242
+ backend: MemoryBackend;
243
+ };
244
+ maxContextTokens: number;
245
+ /** Which lifecycle events the tool emits natively */
246
+ lifecycleEvents: string[];
247
+ }
248
+ /** Creates a default capabilities object with all features disabled. */
249
+ declare function createDefaultCapabilities(): VaughnCapabilities;
250
+ /**
251
+ * Known capability profiles for supported tools (Section 4.2).
252
+ * These are reference profiles; actual adapters may override.
253
+ */
254
+ declare const TOOL_PROFILES: Record<string, VaughnCapabilities>;
255
+
256
+ /**
257
+ * VAUGHN Lifecycle Events (Section 5 of VAUGHN.md)
258
+ *
259
+ * Defines the 10 canonical lifecycle events, the event envelope,
260
+ * Zod schemas for runtime validation, and a factory function.
261
+ */
262
+
263
+ /** Protocol version. */
264
+ declare const VAUGHN_VERSION: "0.1.0";
265
+ /** The 10 canonical VAUGHN lifecycle events. */
266
+ type VaughnEvent = 'session.start' | 'session.stop' | 'session.crash' | 'prompt.submit' | 'tool.before' | 'tool.after' | 'tool.blocked' | 'task.claimed' | 'task.completed' | 'agent.heartbeat';
267
+ /** All valid event names as a readonly array. */
268
+ declare const VAUGHN_EVENTS: readonly VaughnEvent[];
269
+ /** Standard envelope wrapping every VAUGHN event (Section 5.4). */
270
+ interface VaughnEventEnvelope {
271
+ version: typeof VAUGHN_VERSION;
272
+ event: VaughnEvent;
273
+ timestamp: string;
274
+ agentId: string;
275
+ toolName: string;
276
+ sessionId: string;
277
+ payload: Record<string, unknown>;
278
+ }
279
+ /** Zod schema for runtime validation of event envelopes. */
280
+ declare const vaughnEventSchema: z.ZodEnum<{
281
+ "session.start": "session.start";
282
+ "session.stop": "session.stop";
283
+ "prompt.submit": "prompt.submit";
284
+ "tool.before": "tool.before";
285
+ "tool.after": "tool.after";
286
+ "tool.blocked": "tool.blocked";
287
+ "session.crash": "session.crash";
288
+ "task.claimed": "task.claimed";
289
+ "task.completed": "task.completed";
290
+ "agent.heartbeat": "agent.heartbeat";
291
+ }>;
292
+ declare const vaughnEventEnvelopeSchema: z.ZodObject<{
293
+ version: z.ZodLiteral<"0.1.0">;
294
+ event: z.ZodEnum<{
295
+ "session.start": "session.start";
296
+ "session.stop": "session.stop";
297
+ "prompt.submit": "prompt.submit";
298
+ "tool.before": "tool.before";
299
+ "tool.after": "tool.after";
300
+ "tool.blocked": "tool.blocked";
301
+ "session.crash": "session.crash";
302
+ "task.claimed": "task.claimed";
303
+ "task.completed": "task.completed";
304
+ "agent.heartbeat": "agent.heartbeat";
305
+ }>;
306
+ timestamp: z.ZodString;
307
+ agentId: z.ZodString;
308
+ toolName: z.ZodString;
309
+ sessionId: z.ZodString;
310
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
311
+ }, z.core.$strip>;
312
+ /** Creates a VaughnEventEnvelope with the current timestamp. */
313
+ declare function createEventEnvelope(event: VaughnEvent, agentId: string, toolName: string, sessionId: string, payload?: Record<string, unknown>): VaughnEventEnvelope;
314
+
113
315
  interface OllamaStatus {
114
316
  installed: boolean;
115
317
  running: boolean;
@@ -124,10 +326,6 @@ interface ModelPullResult {
124
326
  success: boolean;
125
327
  message: string;
126
328
  }
127
- interface BitNetStatus {
128
- installed: boolean;
129
- modelPath: string | null;
130
- }
131
329
  interface SnapStatus {
132
330
  installed: boolean;
133
331
  running: boolean;
@@ -141,7 +339,7 @@ interface SnapModel {
141
339
  installed: boolean;
142
340
  }
143
341
  /**
144
- * Manages local inference engines (Ollama, Snaps, BitNet) on the daemon host.
342
+ * Manages local inference engines (Ollama, Snaps) on the daemon host.
145
343
  * Each method mirrors the equivalent Tauri command from `inference.rs`.
146
344
  */
147
345
  declare class InferenceService {
@@ -151,14 +349,13 @@ declare class InferenceService {
151
349
  ollamaDelete(modelName: string): Promise<void>;
152
350
  ollamaStart(): Promise<void>;
153
351
  ollamaStop(): Promise<void>;
154
- bitnetStatus(): Promise<BitNetStatus>;
155
352
  snapList(): Promise<SnapModel[]>;
156
353
  snapStatus(snapName: string): Promise<SnapStatus>;
157
354
  snapInstall(snapName: string): Promise<ModelPullResult>;
158
355
  snapRemove(snapName: string): Promise<void>;
159
356
  }
160
357
 
161
- type AgentBackend = 'Snap' | 'BitNet' | 'Ollama';
358
+ type AgentBackend = 'Snap' | 'Ollama';
162
359
  interface AgentSessionInfo {
163
360
  id: string;
164
361
  name: string;
@@ -244,17 +441,27 @@ interface JsonRpcResponse {
244
441
  * agent.stop → { ok: true }
245
442
  * agent.list → AgentSessionInfo[]
246
443
  * agent.remove → { ok: true }
444
+ * agent.input → { ok: true }
445
+ * agent.resize → { ok: true }
247
446
  * inference.ollama.status → OllamaStatus
248
447
  * inference.ollama.models → OllamaModel[]
249
448
  * inference.ollama.pull → ModelPullResult
250
449
  * inference.ollama.delete → { ok: true }
251
450
  * inference.ollama.start → { ok: true }
252
451
  * inference.ollama.stop → { ok: true }
253
- * inference.bitnet.status → BitNetStatus
254
452
  * inference.snap.list → SnapModel[]
255
453
  * inference.snap.status → SnapStatus
256
454
  * inference.snap.install → ModelPullResult
257
455
  * inference.snap.remove → { ok: true }
456
+ * merge.request → MergeResult
457
+ * merge.status → MergeResult
458
+ * merge.resolve → MergeResult
459
+ * merge.list → MergeRequest[]
460
+ * ci.report → CIFeedbackResult
461
+ * vaughn.capabilities → VaughnAdapterCapability[]
462
+ * vaughn.dispatch → { adapterId: string | null }
463
+ * vaughn.events → VaughnEventEnvelope[]
464
+ * vaughn.config.sync → { files: Record<string, string> }
258
465
  */
259
466
  declare class RpcServer {
260
467
  private readonly registry;
@@ -264,6 +471,11 @@ declare class RpcServer {
264
471
  private healthCheckFn;
265
472
  private spawner;
266
473
  private inference;
474
+ private mergePipeline;
475
+ private ciFeedback;
476
+ private vaughnDispatchFn;
477
+ private readonly vaughnEventQueue;
478
+ private static readonly MAX_VAUGHN_EVENTS;
267
479
  constructor(registry: HarnessRegistry, socketPath: string, store?: DaemonStore | undefined);
268
480
  private handleLine;
269
481
  private dispatch;
@@ -284,6 +496,14 @@ declare class RpcServer {
284
496
  setSpawner(spawner: SpawnerService): void;
285
497
  /** Attach the inference service (called by coordinator after construction). */
286
498
  setInference(inference: InferenceService): void;
499
+ /** Attach the merge pipeline (called by coordinator after construction). */
500
+ setMergePipeline(pipeline: MergePipeline): void;
501
+ /** Attach the CI feedback handler (called by coordinator after construction). */
502
+ setCIFeedback(feedback: CIFeedback): void;
503
+ /** Attach the VAUGHN dispatch function (called by coordinator after construction). */
504
+ setVaughnDispatch(fn: (requirements: Partial<VaughnCapabilities>, description: string) => string | null): void;
505
+ /** Push a VAUGHN event into the recent event queue (capped at 100). */
506
+ pushVaughnEvent(event: VaughnEventEnvelope): void;
287
507
  /** Get the spawner service (used by HTTP gateway for SSE). */
288
508
  getSpawner(): SpawnerService | null;
289
509
  start(): Promise<void>;
@@ -294,12 +514,12 @@ declare class RpcServer {
294
514
  * HTTP gateway that exposes the harness daemon over TCP.
295
515
  *
296
516
  * Routes:
297
- * POST /rpcJSON-RPC 2.0 proxy (same protocol as Unix socket)
298
- * GET /api/pairReturns pairing status (requires valid token or no token set)
299
- * POST /api/pairSubmit pairing code to get a session token
300
- * GET /api/stream/:idSSE stream of agent output (real-time)
301
- * GET /Serves Studio static frontend (index.html)
302
- * GET /assets/*Serves static assets
517
+ * POST /rpc - JSON-RPC 2.0 proxy (same protocol as Unix socket)
518
+ * GET /api/pair - Returns pairing status (requires valid token or no token set)
519
+ * POST /api/pair - Submit pairing code to get a session token
520
+ * GET /api/stream/:id - SSE stream of agent output (real-time)
521
+ * GET / - Serves Studio static frontend (index.html)
522
+ * GET /assets/* - Serves static assets
303
523
  *
304
524
  * Auth:
305
525
  * All /rpc and /api/* requests (except POST /api/pair) require:
@@ -311,7 +531,7 @@ interface HttpGatewayConfig {
311
531
  port: number;
312
532
  /** Bind address (default: '0.0.0.0' for Tailscale access) */
313
533
  host: string;
314
- /** Path to Studio static build directory (optionaldisables static serving if absent) */
534
+ /** Path to Studio static build directory (optional - disables static serving if absent) */
315
535
  staticDir?: string;
316
536
  /** Reference to the Unix-socket RPC server for dispatching */
317
537
  rpcDispatch: RpcServer;
@@ -337,15 +557,15 @@ declare class HttpGateway {
337
557
  private handleRequest;
338
558
  /** Verify the Authorization: Bearer <token> header */
339
559
  private checkAuth;
340
- /** POST /api/pairsubmit pairing code, receive session token */
560
+ /** POST /api/pair - submit pairing code, receive session token */
341
561
  private handlePair;
342
- /** GET /api/paircheck pairing status */
562
+ /** GET /api/pair - check pairing status */
343
563
  private handlePairStatus;
344
- /** GET /api/statusdaemon status summary */
564
+ /** GET /api/status - daemon status summary */
345
565
  private handleStatus;
346
- /** POST /rpcproxy JSON-RPC to the daemon's dispatch */
566
+ /** POST /rpc - proxy JSON-RPC to the daemon's dispatch */
347
567
  private handleRpc;
348
- /** GET /api/stream[/:sessionId]SSE for agent output and exit events */
568
+ /** GET /api/stream[/:sessionId] - SSE for agent output and exit events */
349
569
  private handleStream;
350
570
  /** Serve static files from the Studio build directory */
351
571
  private handleStatic;
@@ -366,7 +586,7 @@ interface CoordinatorOptions {
366
586
  httpStaticDir?: string;
367
587
  }
368
588
  /**
369
- * HarnessCoordinatorsingle entry point for harness-to-harness coordination.
589
+ * HarnessCoordinator - single entry point for harness-to-harness coordination.
370
590
  *
371
591
  * On start:
372
592
  * 1. Auto-detects installed AI harnesses and registers them
@@ -381,11 +601,14 @@ interface CoordinatorOptions {
381
601
  declare class HarnessCoordinator {
382
602
  private readonly options;
383
603
  private readonly registry;
604
+ private readonly vaughnCapabilities;
384
605
  private rpcServer;
385
606
  private httpGateway;
386
607
  private store;
387
608
  private spawner;
388
609
  private inference;
610
+ private mergePipeline;
611
+ private ciFeedback;
389
612
  private sessionId;
390
613
  private readonly workboard;
391
614
  constructor(options: CoordinatorOptions);
@@ -399,6 +622,17 @@ declare class HarnessCoordinator {
399
622
  getStore(): DaemonStore | null;
400
623
  /** Register a custom adapter (must be called before start()). */
401
624
  registerAdapter(adapter: HarnessAdapter): void;
625
+ /** Register explicit VAUGHN capabilities for an adapter. */
626
+ registerVaughnCapabilities(adapterId: string, capabilities: VaughnCapabilities): void;
627
+ /**
628
+ * Dispatch a task to the best-matching adapter based on VAUGHN capability requirements.
629
+ *
630
+ * Returns the selected adapter ID, or null if no adapter matches.
631
+ * Prefers adapters with hooks.canBlock for safety-critical dispatch.
632
+ */
633
+ dispatchTask(requirements: Partial<VaughnCapabilities>, _description: string): string | null;
634
+ /** Check whether capabilities satisfy requirements. */
635
+ private matchesRequirements;
402
636
  /** The HTTP gateway (available after start() if httpPort was set). */
403
637
  getHttpGateway(): HttpGateway | null;
404
638
  /** Run a health check across all registered harnesses and the workboard. */
@@ -407,7 +641,6 @@ declare class HarnessCoordinator {
407
641
 
408
642
  /**
409
643
  * Detects available AI harnesses and registers them in the registry.
410
- * Mirrors autoDetectEditors from packages/editors.
411
644
  *
412
645
  * Creates an adapter for each known harness, checks isAvailable(),
413
646
  * and registers those that respond. Unavailable adapters are disposed.
@@ -427,11 +660,232 @@ declare function findAllHarnessProcesses(): Promise<HarnessProcessInfo[]>;
427
660
  declare function findClaudeCodeSockets(): Promise<string[]>;
428
661
 
429
662
  /**
430
- * @revealui/harnesses AI Harness Integration System (Server-side)
663
+ * VAUGHN Adapter Interface (Section 7 of VAUGHN.md)
664
+ *
665
+ * The adapter is the boundary between a tool's native interface and the
666
+ * VAUGHN protocol. This extends the existing HarnessAdapter with full
667
+ * VAUGHN capabilities.
668
+ */
669
+
670
+ /** MCP server configuration entry. */
671
+ interface McpServerConfig {
672
+ name: string;
673
+ command: string;
674
+ args?: string[];
675
+ env?: Record<string, string>;
676
+ }
677
+ /** Canonical configuration schema (Section 6.1). */
678
+ interface VaughnConfig {
679
+ identity: {
680
+ name: string;
681
+ email: string;
682
+ role?: string;
683
+ };
684
+ permissions: {
685
+ autoApprove: string[];
686
+ deny: string[];
687
+ sandboxMode?: 'read-only' | 'workspace-write' | 'full-access';
688
+ };
689
+ environment: {
690
+ variables: Record<string, string>;
691
+ mcpServers: McpServerConfig[];
692
+ };
693
+ rules: VaughnRule[];
694
+ skills: VaughnSkill[];
695
+ commands: VaughnCommand[];
696
+ }
697
+ /** Tool-agnostic rule definition (Section 6.3). */
698
+ interface VaughnRule {
699
+ id: string;
700
+ description: string;
701
+ content: string;
702
+ appliesTo: string[];
703
+ variables: Record<string, string>;
704
+ }
705
+ /** Tool-agnostic skill definition. */
706
+ interface VaughnSkill {
707
+ id: string;
708
+ name: string;
709
+ description: string;
710
+ instructions: string;
711
+ }
712
+ /** Tool-agnostic command definition. */
713
+ interface VaughnCommand {
714
+ id: string;
715
+ name: string;
716
+ description: string;
717
+ steps: string[];
718
+ }
719
+ /** Result of config generation: a map of file paths to contents. */
720
+ interface GeneratedFiles {
721
+ files: Map<string, string>;
722
+ }
723
+ /** Result of executing a VAUGHN command. */
724
+ interface VaughnCommandResult {
725
+ success: boolean;
726
+ message?: string;
727
+ data?: unknown;
728
+ }
729
+ /** VAUGHN error codes (Section 11.1). */
730
+ type VaughnErrorCode = 'ADAPTER_UNAVAILABLE' | 'CAPABILITY_MISSING' | 'TASK_ALREADY_CLAIMED' | 'TASK_NOT_FOUND' | 'CONFLICT_DETECTED' | 'HOOK_BLOCKED' | 'SANDBOX_DENIED' | 'SESSION_EXPIRED' | 'CONFIG_INVALID' | 'TOOL_RESERVED' | 'WORKBOARD_LOCKED' | 'IDENTITY_CONFLICT';
731
+ /** Structured error envelope (Section 11.2). */
732
+ interface VaughnError {
733
+ code: VaughnErrorCode;
734
+ message: string;
735
+ agentId?: string;
736
+ details?: Record<string, unknown>;
737
+ }
738
+ /** Summary information about a registered adapter. */
739
+ interface VaughnAdapterInfo {
740
+ id: string;
741
+ available: boolean;
742
+ version: string | null;
743
+ capabilities: VaughnCapabilities;
744
+ }
745
+ /**
746
+ * Contract for a VAUGHN adapter.
747
+ *
748
+ * This is the full VAUGHN interface. Existing HarnessAdapters can be
749
+ * wrapped to implement this interface incrementally.
750
+ */
751
+ interface VaughnAdapter {
752
+ /** Unique stable identifier, e.g. 'claude-code', 'codex', 'revealui-agent' */
753
+ readonly id: string;
754
+ /** Full capability declaration */
755
+ readonly capabilities: VaughnCapabilities;
756
+ /** Initialize the adapter (connect to tool, set up event listeners) */
757
+ initialize(): Promise<void>;
758
+ /** Release all resources held by this adapter */
759
+ dispose(): Promise<void>;
760
+ /** True if the tool is installed and accessible */
761
+ isAvailable(): Promise<boolean>;
762
+ /** Tool version string, or null if unavailable */
763
+ getVersion(): Promise<string | null>;
764
+ /** Subscribe to VAUGHN-normalized events (adapter -> coordinator) */
765
+ onEvent(handler: (event: VaughnEventEnvelope) => void): void;
766
+ /** Execute a typed command against this tool (coordinator -> adapter) */
767
+ execute?(command: VaughnCommand): Promise<VaughnCommandResult>;
768
+ /** Generate tool-native config files from canonical VAUGHN config */
769
+ generateConfig(config: VaughnConfig): Promise<GeneratedFiles>;
770
+ /** Read tool-native config and parse into canonical form (optional) */
771
+ readConfig?(): Promise<Partial<VaughnConfig>>;
772
+ /** Read workboard state through the tool's native interface (if capable) */
773
+ readWorkboard?(): Promise<WorkboardState>;
774
+ /** Write workboard state through the tool's native interface (if capable) */
775
+ writeWorkboard?(state: WorkboardState): Promise<void>;
776
+ }
777
+
778
+ /**
779
+ * VAUGHN Config Normalization (Section 6 of VAUGHN.md)
780
+ *
781
+ * Bidirectional: VaughnConfig <-> Claude Code settings.json
782
+ * Write-only: VaughnConfig -> .cursorrules markdown
783
+ * Write-only: VaughnConfig -> AGENTS.md markdown
784
+ */
785
+
786
+ /** Result of config generation: map of relative file paths to contents. */
787
+ interface ConfigGenerationResult {
788
+ files: Map<string, string>;
789
+ }
790
+ /** Subset of Claude Code settings.json we read/write. */
791
+ interface ClaudeCodeSettings {
792
+ permissions?: {
793
+ allow?: string[];
794
+ deny?: string[];
795
+ };
796
+ env?: Record<string, string>;
797
+ mcpServers?: Record<string, {
798
+ command: string;
799
+ args?: string[];
800
+ env?: Record<string, string>;
801
+ }>;
802
+ }
803
+ /** Convert a VaughnConfig to Claude Code settings.json format. */
804
+ declare function vaughnConfigToClaudeSettings(config: VaughnConfig): ClaudeCodeSettings;
805
+ /** Parse Claude Code settings.json into a partial VaughnConfig. */
806
+ declare function claudeSettingsToVaughnConfig(settings: ClaudeCodeSettings): Partial<VaughnConfig>;
807
+ /** Generate .cursorrules markdown from VaughnConfig. */
808
+ declare function vaughnConfigToCursorrules(config: VaughnConfig): string;
809
+ /** Generate AGENTS.md markdown from VaughnConfig. */
810
+ declare function vaughnConfigToAgentsMd(config: VaughnConfig): string;
811
+ /**
812
+ * Generate all config files from a VaughnConfig.
813
+ * Returns a map of relative file paths to contents.
814
+ */
815
+ declare function generateAllConfigs(config: VaughnConfig): ConfigGenerationResult;
816
+
817
+ /**
818
+ * VAUGHN Degradation Model (Section 5.3 of VAUGHN.md)
819
+ *
820
+ * When a tool does not emit a native event for a VAUGHN event,
821
+ * the adapter applies one of three strategies.
822
+ */
823
+
824
+ /**
825
+ * Degradation strategy applied when a tool lacks native support for an event.
826
+ *
827
+ * - polyfill: Adapter synthesizes the event from other signals (same semantics, higher latency)
828
+ * - degrade: Partial functionality, weaker guarantee, explicitly documented
829
+ * - absent: No meaningful approximation; capability is reported as missing
830
+ */
831
+ type DegradationStrategy = 'polyfill' | 'degrade' | 'absent';
832
+ /**
833
+ * Returns the degradation strategy for a given tool and event.
834
+ *
835
+ * - Returns `undefined` if the tool natively supports the event (no degradation).
836
+ * - Returns the strategy if the tool lacks native support.
837
+ * - Returns `'absent'` for unknown tools (conservative default).
838
+ */
839
+ declare function getDegradationStrategy(toolName: string, event: VaughnEvent): DegradationStrategy | undefined;
840
+
841
+ /**
842
+ * VAUGHN Event Normalization Layer
843
+ *
844
+ * Translates HarnessEvent -> VaughnEventEnvelope, applying
845
+ * degradation strategies for events the tool cannot emit natively.
846
+ */
847
+
848
+ /** Result of normalizing a HarnessEvent. */
849
+ interface NormalizedEvent {
850
+ envelope: VaughnEventEnvelope;
851
+ /** Undefined when the tool natively supports the event. */
852
+ degradation: DegradationStrategy | undefined;
853
+ }
854
+ /**
855
+ * Translates tool-native HarnessEvents into VAUGHN canonical event envelopes.
856
+ *
857
+ * Each instance is bound to a specific tool/agent/session identity.
858
+ * Call `normalize()` with each HarnessEvent to get a VaughnEventEnvelope.
859
+ */
860
+ declare class VaughnEventNormalizer {
861
+ private readonly toolName;
862
+ private readonly agentId;
863
+ private readonly sessionId;
864
+ constructor(toolName: string, agentId: string, sessionId: string);
865
+ /**
866
+ * Map a HarnessEvent type to its canonical VAUGHN event.
867
+ * Returns null if the event has no VAUGHN mapping.
868
+ */
869
+ private mapEventType;
870
+ /** Extract event-specific payload fields. */
871
+ private extractPayload;
872
+ /**
873
+ * Normalize a HarnessEvent into a VaughnEventEnvelope.
874
+ *
875
+ * Returns null if:
876
+ * - The event has no VAUGHN mapping
877
+ * - The degradation strategy for this tool/event is 'absent'
878
+ */
879
+ normalize(event: HarnessEvent): NormalizedEvent | null;
880
+ /** Convenience: normalize and return just the envelope (or null). */
881
+ normalizeToEnvelope(event: HarnessEvent): VaughnEventEnvelope | null;
882
+ }
883
+
884
+ /**
885
+ * @revealui/harnesses - AI Harness Integration System (Server-side)
431
886
  *
432
887
  * Adapters, registry, workboard coordination, and JSON-RPC server for
433
- * integrating AI coding tools (Claude Code, Cursor) into the
434
- * RevealUI development workflow.
888
+ * integrating native AI agents into the RevealUI development workflow.
435
889
  *
436
890
  * Pro tier feature: gated behind isFeatureEnabled("ai").
437
891
  *
@@ -440,4 +894,4 @@ declare function findClaudeCodeSockets(): Promise<string[]>;
440
894
  /** Check whether the harnesses feature is licensed for this installation. */
441
895
  declare function checkHarnessesLicense(): Promise<boolean>;
442
896
 
443
- export { ClaudeCodeAdapter, ConfigDiffEntry, ConfigSyncDirection, ConfigSyncResult, type CoordinatorOptions, CursorAdapter, DaemonStore, HarnessAdapter, HarnessCapabilities, HarnessCommand, HarnessCommandResult, HarnessCoordinator, HarnessEvent, HarnessInfo, HarnessProcessInfo, HarnessRegistry, HealthCheckResult, RpcServer, WorkboardManager, autoDetectHarnesses, checkHarnessesLicense, diffAllConfigs, diffConfig, findAllHarnessProcesses, findClaudeCodeSockets, findHarnessProcesses, findProcesses, getConfigurableHarnesses, getLocalConfigPath, getRootConfigPath, syncAllConfigs, syncConfig, validateConfigJson };
897
+ export { type ClaudeCodeSettings, ConfigDiffEntry, type ConfigGenerationResult, ConfigSyncDirection, ConfigSyncResult, type CoordinatorOptions, DaemonStore, type DegradationStrategy, type GeneratedFiles, HarnessAdapter, HarnessCoordinator, HarnessEvent, HarnessProcessInfo, HarnessRegistry, HealthCheckResult, type HookGranularity, type McpServerConfig, type MemoryBackend, type NormalizedEvent, RpcServer, type SandboxMode, TOOL_PROFILES, VAUGHN_EVENTS, VAUGHN_VERSION, type VaughnAdapter, type VaughnAdapterInfo, type VaughnCapabilities, type VaughnCommand, type VaughnCommandResult, type VaughnConfig, type VaughnError, type VaughnErrorCode, type VaughnEvent, type VaughnEventEnvelope, VaughnEventNormalizer, type VaughnRule, type VaughnSkill, WorkboardManager, WorkboardState, autoDetectHarnesses, checkHarnessesLicense, claudeSettingsToVaughnConfig, createDefaultCapabilities, createEventEnvelope, diffAllConfigs, diffConfig, findAllHarnessProcesses, findClaudeCodeSockets, findHarnessProcesses, findProcesses, generateAllConfigs, getConfigurableHarnesses, getDegradationStrategy, getLocalConfigPath, getRootConfigPath, syncAllConfigs, syncConfig, validateConfigJson, vaughnConfigToAgentsMd, vaughnConfigToClaudeSettings, vaughnConfigToCursorrules, vaughnEventEnvelopeSchema, vaughnEventSchema };