mock-mcp 0.5.0 → 0.5.1

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.
@@ -1,5 +1,6 @@
1
- import { N as GetStatusResult, O as ListRunsResult, I as ClaimNextBatchResult, K as ProvideBatchResult, S as GetBatchResult } from '../protocol-xZu-wb0n.cjs';
2
- import { a as MockResponseDescriptor } from '../types-BKREdsyr.cjs';
1
+ import { GetStatusResult, ListRunsResult, ClaimNextBatchResult, ProvideBatchResult, GetBatchResult, RunInfo } from '../shared/index.cjs';
2
+ import { M as MockResponseDescriptor, D as DaemonRegistry } from '../types-bEGXLBF0.cjs';
3
+ import 'node:fs';
3
4
 
4
5
  /**
5
6
  * MCP Adapter - The MCP stdio server that bridges AI clients to the Daemon.
@@ -7,14 +8,15 @@ import { a as MockResponseDescriptor } from '../types-BKREdsyr.cjs';
7
8
  * Each MCP client (Cursor, Claude Desktop, etc.) spawns one Adapter process.
8
9
  * The Adapter:
9
10
  * - Exposes MCP tools (claim_next_batch, provide_batch_mock_data, get_status)
10
- * - Connects to the Daemon via IPC
11
+ * - Discovers and connects to ALL active Daemons via IPC
11
12
  * - Does NOT bind any ports (avoids conflicts)
13
+ * - Works across projects without requiring --project-root
12
14
  */
13
- type Logger = Pick<Console, "log" | "warn" | "error"> & {
15
+ type Logger$1 = Pick<Console, "log" | "warn" | "error"> & {
14
16
  debug?: (...args: unknown[]) => void;
15
17
  };
16
18
  interface AdapterOptions {
17
- logger?: Logger;
19
+ logger?: Logger$1;
18
20
  version?: string;
19
21
  }
20
22
  declare function runAdapter(opts?: AdapterOptions): Promise<void>;
@@ -52,4 +54,89 @@ declare class DaemonClient {
52
54
  private rpc;
53
55
  }
54
56
 
55
- export { type AdapterOptions, DaemonClient, runAdapter };
57
+ /**
58
+ * MultiDaemonClient - Aggregates multiple daemon connections for cross-project operation.
59
+ *
60
+ * This client discovers all active daemons and can perform operations across them.
61
+ * It's designed for MCP adapters that need to work without knowing the specific project root.
62
+ */
63
+
64
+ type Logger = Pick<Console, "log" | "warn" | "error"> & {
65
+ debug?: (...args: unknown[]) => void;
66
+ };
67
+ interface MultiDaemonClientOptions {
68
+ logger?: Logger;
69
+ cacheDir?: string;
70
+ }
71
+ interface DaemonConnection {
72
+ registry: DaemonRegistry;
73
+ healthy: boolean;
74
+ }
75
+ interface ExtendedRunInfo extends RunInfo {
76
+ projectId: string;
77
+ projectRoot: string;
78
+ }
79
+ interface AggregatedStatusResult {
80
+ daemons: (GetStatusResult & {
81
+ healthy: boolean;
82
+ })[];
83
+ totalRuns: number;
84
+ totalPending: number;
85
+ totalClaimed: number;
86
+ }
87
+ declare class MultiDaemonClient {
88
+ private readonly logger;
89
+ private readonly cacheDir?;
90
+ private readonly adapterId;
91
+ constructor(opts?: MultiDaemonClientOptions);
92
+ /**
93
+ * Discover all active and healthy daemons.
94
+ */
95
+ discoverDaemons(): Promise<DaemonConnection[]>;
96
+ /**
97
+ * Get aggregated status from all daemons.
98
+ */
99
+ getAggregatedStatus(): Promise<AggregatedStatusResult>;
100
+ /**
101
+ * List all runs across all daemons.
102
+ */
103
+ listAllRuns(): Promise<ExtendedRunInfo[]>;
104
+ /**
105
+ * Claim the next available batch from any daemon.
106
+ * Searches through all daemons in order until finding one with a pending batch.
107
+ */
108
+ claimNextBatch(args: {
109
+ runId?: string;
110
+ leaseMs?: number;
111
+ }): Promise<(ClaimNextBatchResult & {
112
+ projectId: string;
113
+ projectRoot: string;
114
+ }) | null>;
115
+ /**
116
+ * Provide mock data for a batch.
117
+ * Automatically routes to the correct daemon based on batchId.
118
+ */
119
+ provideBatch(args: {
120
+ batchId: string;
121
+ claimToken: string;
122
+ mocks: MockResponseDescriptor[];
123
+ }): Promise<ProvideBatchResult>;
124
+ /**
125
+ * Release a batch.
126
+ */
127
+ releaseBatch(args: {
128
+ batchId: string;
129
+ claimToken: string;
130
+ reason?: string;
131
+ }): Promise<{
132
+ ok: boolean;
133
+ message?: string;
134
+ }>;
135
+ /**
136
+ * Get a specific batch by ID.
137
+ */
138
+ getBatch(batchId: string): Promise<GetBatchResult | null>;
139
+ private rpc;
140
+ }
141
+
142
+ export { type AdapterOptions, type AggregatedStatusResult, DaemonClient, type ExtendedRunInfo, MultiDaemonClient, type MultiDaemonClientOptions, runAdapter };
@@ -1,5 +1,6 @@
1
- import { N as GetStatusResult, O as ListRunsResult, I as ClaimNextBatchResult, K as ProvideBatchResult, S as GetBatchResult } from '../protocol-CiwaQFOt.js';
2
- import { a as MockResponseDescriptor } from '../types-BKREdsyr.js';
1
+ import { GetStatusResult, ListRunsResult, ClaimNextBatchResult, ProvideBatchResult, GetBatchResult, RunInfo } from '../shared/index.js';
2
+ import { M as MockResponseDescriptor, D as DaemonRegistry } from '../types-bEGXLBF0.js';
3
+ import 'node:fs';
3
4
 
4
5
  /**
5
6
  * MCP Adapter - The MCP stdio server that bridges AI clients to the Daemon.
@@ -7,14 +8,15 @@ import { a as MockResponseDescriptor } from '../types-BKREdsyr.js';
7
8
  * Each MCP client (Cursor, Claude Desktop, etc.) spawns one Adapter process.
8
9
  * The Adapter:
9
10
  * - Exposes MCP tools (claim_next_batch, provide_batch_mock_data, get_status)
10
- * - Connects to the Daemon via IPC
11
+ * - Discovers and connects to ALL active Daemons via IPC
11
12
  * - Does NOT bind any ports (avoids conflicts)
13
+ * - Works across projects without requiring --project-root
12
14
  */
13
- type Logger = Pick<Console, "log" | "warn" | "error"> & {
15
+ type Logger$1 = Pick<Console, "log" | "warn" | "error"> & {
14
16
  debug?: (...args: unknown[]) => void;
15
17
  };
16
18
  interface AdapterOptions {
17
- logger?: Logger;
19
+ logger?: Logger$1;
18
20
  version?: string;
19
21
  }
20
22
  declare function runAdapter(opts?: AdapterOptions): Promise<void>;
@@ -52,4 +54,89 @@ declare class DaemonClient {
52
54
  private rpc;
53
55
  }
54
56
 
55
- export { type AdapterOptions, DaemonClient, runAdapter };
57
+ /**
58
+ * MultiDaemonClient - Aggregates multiple daemon connections for cross-project operation.
59
+ *
60
+ * This client discovers all active daemons and can perform operations across them.
61
+ * It's designed for MCP adapters that need to work without knowing the specific project root.
62
+ */
63
+
64
+ type Logger = Pick<Console, "log" | "warn" | "error"> & {
65
+ debug?: (...args: unknown[]) => void;
66
+ };
67
+ interface MultiDaemonClientOptions {
68
+ logger?: Logger;
69
+ cacheDir?: string;
70
+ }
71
+ interface DaemonConnection {
72
+ registry: DaemonRegistry;
73
+ healthy: boolean;
74
+ }
75
+ interface ExtendedRunInfo extends RunInfo {
76
+ projectId: string;
77
+ projectRoot: string;
78
+ }
79
+ interface AggregatedStatusResult {
80
+ daemons: (GetStatusResult & {
81
+ healthy: boolean;
82
+ })[];
83
+ totalRuns: number;
84
+ totalPending: number;
85
+ totalClaimed: number;
86
+ }
87
+ declare class MultiDaemonClient {
88
+ private readonly logger;
89
+ private readonly cacheDir?;
90
+ private readonly adapterId;
91
+ constructor(opts?: MultiDaemonClientOptions);
92
+ /**
93
+ * Discover all active and healthy daemons.
94
+ */
95
+ discoverDaemons(): Promise<DaemonConnection[]>;
96
+ /**
97
+ * Get aggregated status from all daemons.
98
+ */
99
+ getAggregatedStatus(): Promise<AggregatedStatusResult>;
100
+ /**
101
+ * List all runs across all daemons.
102
+ */
103
+ listAllRuns(): Promise<ExtendedRunInfo[]>;
104
+ /**
105
+ * Claim the next available batch from any daemon.
106
+ * Searches through all daemons in order until finding one with a pending batch.
107
+ */
108
+ claimNextBatch(args: {
109
+ runId?: string;
110
+ leaseMs?: number;
111
+ }): Promise<(ClaimNextBatchResult & {
112
+ projectId: string;
113
+ projectRoot: string;
114
+ }) | null>;
115
+ /**
116
+ * Provide mock data for a batch.
117
+ * Automatically routes to the correct daemon based on batchId.
118
+ */
119
+ provideBatch(args: {
120
+ batchId: string;
121
+ claimToken: string;
122
+ mocks: MockResponseDescriptor[];
123
+ }): Promise<ProvideBatchResult>;
124
+ /**
125
+ * Release a batch.
126
+ */
127
+ releaseBatch(args: {
128
+ batchId: string;
129
+ claimToken: string;
130
+ reason?: string;
131
+ }): Promise<{
132
+ ok: boolean;
133
+ message?: string;
134
+ }>;
135
+ /**
136
+ * Get a specific batch by ID.
137
+ */
138
+ getBatch(batchId: string): Promise<GetBatchResult | null>;
139
+ private rpc;
140
+ }
141
+
142
+ export { type AdapterOptions, type AggregatedStatusResult, DaemonClient, type ExtendedRunInfo, MultiDaemonClient, type MultiDaemonClientOptions, runAdapter };