@adhdev/daemon-core 0.9.82-rc.16 → 0.9.82-rc.160
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/boot/process-hardening.d.ts +50 -0
- package/dist/chat/source-machine.d.ts +166 -0
- package/dist/chat/source-resolver.d.ts +104 -0
- package/dist/chat/subscription-updates.d.ts +1 -0
- package/dist/cli-adapter-types.d.ts +5 -1
- package/dist/cli-adapters/cli-script-runner.d.ts +117 -0
- package/dist/cli-adapters/cli-state-engine.d.ts +178 -0
- package/dist/cli-adapters/provider-cli-adapter.d.ts +104 -63
- package/dist/cli-adapters/provider-cli-parse.d.ts +4 -0
- package/dist/cli-adapters/provider-cli-shared.d.ts +27 -0
- package/dist/commands/handler.d.ts +66 -0
- package/dist/commands/router.d.ts +22 -0
- package/dist/config/chat-history.d.ts +5 -0
- package/dist/config/config.d.ts +5 -0
- package/dist/config/mesh-config.d.ts +68 -1
- package/dist/git/git-commands.d.ts +5 -1
- package/dist/index.d.ts +20 -6
- package/dist/index.js +13154 -3031
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13100 -3023
- package/dist/index.mjs.map +1 -1
- package/dist/installer.d.ts +1 -4
- package/dist/ipc/local-ipc-server.d.ts +91 -0
- package/dist/launch.d.ts +1 -1
- package/dist/logging/async-batch-writer.d.ts +10 -0
- package/dist/mesh/beads-db.d.ts +72 -0
- package/dist/mesh/contracts.d.ts +164 -0
- package/dist/mesh/coordinator-registry.d.ts +25 -0
- package/dist/mesh/mesh-active-work.d.ts +90 -0
- package/dist/mesh/mesh-events.d.ts +77 -5
- package/dist/mesh/mesh-fast-forward.d.ts +39 -0
- package/dist/mesh/mesh-host-ownership.d.ts +9 -0
- package/dist/mesh/mesh-ledger.d.ts +58 -1
- package/dist/mesh/mesh-refine-status.d.ts +26 -0
- package/dist/mesh/mesh-work-queue.d.ts +44 -5
- package/dist/mesh/preview-freshness.d.ts +18 -0
- package/dist/mesh/refine-config.d.ts +193 -0
- package/dist/mesh/worktree-bootstrap-config.d.ts +113 -0
- package/dist/providers/approval-utils.d.ts +9 -0
- package/dist/providers/cli-provider-instance.d.ts +6 -1
- package/dist/providers/contracts.d.ts +50 -5
- package/dist/providers/native-history/antigravity-cli-transcript.d.ts +100 -0
- package/dist/providers/native-history/claude-cli-transcript.d.ts +70 -0
- package/dist/providers/native-history/codex-cli-transcript.d.ts +73 -0
- package/dist/providers/native-history/index.d.ts +11 -0
- package/dist/providers/provider-loader.d.ts +19 -1
- package/dist/providers/read-chat-contract.d.ts +29 -0
- package/dist/providers/sdk/v1/builders/acp/detect-status.d.ts +68 -0
- package/dist/providers/sdk/v1/builders/cli/detect-status.d.ts +85 -0
- package/dist/providers/sdk/v1/builders/cli/parse-approval-squash.d.ts +59 -0
- package/dist/providers/sdk/v1/builders/cli/parse-approval.d.ts +64 -0
- package/dist/providers/sdk/v1/builders/cli/parse-session.d.ts +91 -0
- package/dist/providers/sdk/v1/builders/cli/visible-region.d.ts +42 -0
- package/dist/providers/sdk/v1/fixture-tooling/format.d.ts +126 -0
- package/dist/providers/sdk/v1/fixture-tooling/index.d.ts +8 -0
- package/dist/providers/sdk/v1/fixture-tooling/replay.d.ts +38 -0
- package/dist/providers/sdk/v1/index.d.ts +30 -0
- package/dist/providers/sdk/v1/sandbox/README-design.d.ts +193 -0
- package/dist/providers/sdk/v1/sandbox/require-whitelist.d.ts +74 -0
- package/dist/providers/sdk/v1/sandbox/script-runner.d.ts +98 -0
- package/dist/providers/sdk/v1/types/cli/index.d.ts +277 -0
- package/dist/providers/sdk/v1/types/common/index.d.ts +169 -0
- package/dist/providers/sdk/v1/validators/index.d.ts +5 -0
- package/dist/providers/sdk/v1/validators/manifest.d.ts +40 -0
- package/dist/providers/sdk/v1/validators/taint.d.ts +52 -0
- package/dist/providers/transcript-v2.d.ts +176 -0
- package/dist/repo-mesh-types.d.ts +67 -0
- package/dist/shared-types.d.ts +12 -0
- package/dist/status/reporter.d.ts +2 -0
- package/dist/status/snapshot.d.ts +1 -0
- package/dist/types.d.ts +5 -0
- package/package.json +6 -2
- package/src/boot/daemon-lifecycle.ts +17 -10
- package/src/boot/process-hardening.ts +89 -0
- package/src/chat/source-machine.ts +534 -0
- package/src/chat/source-resolver.ts +0 -0
- package/src/chat/subscription-updates.ts +14 -1
- package/src/cli-adapter-types.d.ts +1 -0
- package/src/cli-adapter-types.ts +3 -1
- package/src/cli-adapters/cli-script-runner.ts +421 -0
- package/src/cli-adapters/cli-state-engine.ts +1086 -0
- package/src/cli-adapters/provider-cli-adapter.d.ts +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +664 -1137
- package/src/cli-adapters/provider-cli-parse.d.ts +1 -0
- package/src/cli-adapters/provider-cli-parse.ts +13 -0
- package/src/cli-adapters/provider-cli-runtime.ts +3 -1
- package/src/cli-adapters/provider-cli-shared.d.ts +2 -0
- package/src/cli-adapters/provider-cli-shared.ts +57 -11
- package/src/cli-adapters/terminal-backends/ghostty-vt-backend.ts +17 -1
- package/src/cli-adapters/terminal-backends/xterm-backend.ts +8 -1
- package/src/commands/chat-commands.ts +1451 -52
- package/src/commands/cli-manager.ts +184 -3
- package/src/commands/handler.ts +547 -2
- package/src/commands/mesh-coordinator.ts +13 -143
- package/src/commands/router.ts +3285 -428
- package/src/config/chat-history.ts +79 -24
- package/src/config/config.ts +12 -0
- package/src/config/mesh-config.ts +249 -2
- package/src/config/recent-activity.ts +8 -2
- package/src/daemon/dev-cli-debug.ts +10 -1
- package/src/detection/ide-detector.ts +26 -16
- package/src/git/git-commands.ts +17 -5
- package/src/git/git-worktree.ts +8 -1
- package/src/index.ts +72 -5
- package/src/installer.d.ts +1 -1
- package/src/installer.ts +8 -6
- package/src/ipc/local-ipc-server.ts +278 -0
- package/src/launch.d.ts +1 -1
- package/src/launch.ts +37 -28
- package/src/logging/async-batch-writer.ts +55 -0
- package/src/logging/logger.ts +2 -1
- package/src/mesh/beads-db.ts +479 -0
- package/src/mesh/contracts.ts +329 -0
- package/src/mesh/coordinator-prompt.ts +40 -22
- package/src/mesh/coordinator-registry.ts +75 -0
- package/src/mesh/mesh-active-work.ts +437 -0
- package/src/mesh/mesh-events.ts +820 -61
- package/src/mesh/mesh-fast-forward.ts +430 -0
- package/src/mesh/mesh-host-ownership.ts +73 -0
- package/src/mesh/mesh-ledger.ts +457 -104
- package/src/mesh/mesh-refine-status.ts +144 -0
- package/src/mesh/mesh-work-queue.ts +216 -158
- package/src/mesh/preview-freshness.ts +118 -0
- package/src/mesh/refine-config.ts +366 -0
- package/src/mesh/worktree-bootstrap-config.ts +247 -0
- package/src/providers/approval-utils.ts +39 -5
- package/src/providers/chat-message-normalization.ts +4 -11
- package/src/providers/cli-provider-instance.ts +380 -44
- package/src/providers/contracts.ts +52 -5
- package/src/providers/ide-provider-instance.ts +17 -3
- package/src/providers/native-history/antigravity-cli-transcript.ts +643 -0
- package/src/providers/native-history/claude-cli-transcript.ts +396 -0
- package/src/providers/native-history/codex-cli-transcript.ts +419 -0
- package/src/providers/native-history/index.ts +23 -0
- package/src/providers/provider-loader.ts +294 -28
- package/src/providers/provider-schema.ts +31 -13
- package/src/providers/read-chat-contract.ts +76 -16
- package/src/providers/sdk/README.md +49 -0
- package/src/providers/sdk/v1/builders/acp/detect-status.ts +144 -0
- package/src/providers/sdk/v1/builders/cli/detect-status.ts +262 -0
- package/src/providers/sdk/v1/builders/cli/parse-approval-squash.ts +158 -0
- package/src/providers/sdk/v1/builders/cli/parse-approval.ts +245 -0
- package/src/providers/sdk/v1/builders/cli/parse-session.ts +276 -0
- package/src/providers/sdk/v1/builders/cli/visible-region.ts +143 -0
- package/src/providers/sdk/v1/fixture-tooling/format.ts +130 -0
- package/src/providers/sdk/v1/fixture-tooling/index.ts +22 -0
- package/src/providers/sdk/v1/fixture-tooling/replay.ts +352 -0
- package/src/providers/sdk/v1/index.ts +152 -0
- package/src/providers/sdk/v1/sandbox/README-design.ts +195 -0
- package/src/providers/sdk/v1/sandbox/require-whitelist.ts +472 -0
- package/src/providers/sdk/v1/sandbox/script-runner.ts +150 -0
- package/src/providers/sdk/v1/schemas/cli/provider.schema.json +444 -0
- package/src/providers/sdk/v1/schemas/primitives/acp-session-protocol-v1.json +131 -0
- package/src/providers/sdk/v1/schemas/primitives/native-history-codex-rollout-v1.json +66 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-approval-squash-v1.json +91 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-assistant-block-v1.json +91 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-cue-ordering-v1.json +47 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-dispatch-order-v1.json +32 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-footer-chrome-v1.json +42 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-index-finder-v1.json +27 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-modal-v1.json +119 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-prompt-marker-v1.json +45 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-session-id-extraction-v1.json +46 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-settled-prompt-v1.json +71 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-spinner-v1.json +83 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-transcript-pty-v1.json +83 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-visible-region-v1.json +57 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-welcome-screen-v1.json +35 -0
- package/src/providers/sdk/v1/types/cli/index.ts +365 -0
- package/src/providers/sdk/v1/types/common/index.ts +210 -0
- package/src/providers/sdk/v1/validators/index.ts +19 -0
- package/src/providers/sdk/v1/validators/manifest.ts +110 -0
- package/src/providers/sdk/v1/validators/taint.ts +309 -0
- package/src/providers/transcript-v2.ts +567 -0
- package/src/providers/version-archive.ts +38 -20
- package/src/repo-mesh-types.ts +77 -0
- package/src/shared-types.ts +9 -0
- package/src/status/builders.ts +23 -6
- package/src/status/reporter.ts +15 -0
- package/src/status/snapshot.ts +35 -11
- package/src/system/host-memory.ts +29 -12
- package/src/types.ts +5 -0
package/dist/installer.d.ts
CHANGED
|
@@ -28,10 +28,7 @@ export interface InstallResult {
|
|
|
28
28
|
alreadyInstalled: boolean;
|
|
29
29
|
error?: string;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
* Check if an extension is already installed
|
|
33
|
-
*/
|
|
34
|
-
export declare function isExtensionInstalled(ide: IDEInfo, marketplaceId: string): boolean;
|
|
31
|
+
export declare function isExtensionInstalled(ide: IDEInfo, marketplaceId: string): Promise<boolean>;
|
|
35
32
|
/**
|
|
36
33
|
* Install a single extension
|
|
37
34
|
*/
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LocalIpcServer — generic HTTP + WebSocket IPC endpoint for daemon processes.
|
|
3
|
+
*
|
|
4
|
+
* Both daemon-cloud and daemon-standalone need a local IPC surface so
|
|
5
|
+
* external tools — the `adhdev mcp --mode ipc` MCP server and anything
|
|
6
|
+
* else that wants to issue commands without going through the cloud
|
|
7
|
+
* Worker — can connect over `ws://127.0.0.1:<port>/ipc`.
|
|
8
|
+
*
|
|
9
|
+
* Until now the implementation lived only in daemon-cloud. Standalone
|
|
10
|
+
* sessions therefore couldn't host MCP mesh tools — codex/claude config
|
|
11
|
+
* pointing at `--mode ipc` got `Cannot reach ipc daemon`. This module
|
|
12
|
+
* moves the transport into daemon-core so both daemons can mount it.
|
|
13
|
+
*
|
|
14
|
+
* The transport itself is daemon-agnostic. Cloud-specific behaviors
|
|
15
|
+
* (mesh relay, mandatory update gates) are injected via the caller's
|
|
16
|
+
* `handleCommand` hook; the IPC layer just frames/unframes JSON and
|
|
17
|
+
* routes messages.
|
|
18
|
+
*/
|
|
19
|
+
import { WebSocket } from 'ws';
|
|
20
|
+
/** Parameters passed to `handleCommand` for each incoming ext:command frame. */
|
|
21
|
+
export interface IpcCommandContext {
|
|
22
|
+
/** The raw `command` field from the message — caller decides routing. */
|
|
23
|
+
command: string;
|
|
24
|
+
/** Args provided by the client; may have been normalized by the caller. */
|
|
25
|
+
args: Record<string, unknown>;
|
|
26
|
+
/** Stable id correlating the request and the eventual ext:command_result. */
|
|
27
|
+
requestId: string;
|
|
28
|
+
/** The connected WebSocket — only needed if the caller wants to send extra events. */
|
|
29
|
+
ws: WebSocket;
|
|
30
|
+
}
|
|
31
|
+
/** Result reported back to the client. `result` is optional context for success. */
|
|
32
|
+
export interface IpcCommandResult {
|
|
33
|
+
success: boolean;
|
|
34
|
+
result?: unknown;
|
|
35
|
+
error?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Additional fields the caller wants merged into the response payload
|
|
38
|
+
* (e.g. the cloud daemon's mandatory-update-block fields). Reserved.
|
|
39
|
+
*/
|
|
40
|
+
extra?: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
/** Status payload returned from GET / on the IPC HTTP port. */
|
|
43
|
+
export interface IpcStatusPayload {
|
|
44
|
+
ok: true;
|
|
45
|
+
pid: number;
|
|
46
|
+
wsPath: string;
|
|
47
|
+
port: number;
|
|
48
|
+
/** Arbitrary daemon-specific summary. Cloud daemon includes mesh state, etc. */
|
|
49
|
+
status: Record<string, unknown> | null;
|
|
50
|
+
}
|
|
51
|
+
export interface LocalIpcServerOptions {
|
|
52
|
+
/** TCP port to listen on. 19222 is the conventional default. */
|
|
53
|
+
port: number;
|
|
54
|
+
/** Build the GET / status payload. Called on every health probe. */
|
|
55
|
+
buildStatusPayload: () => Record<string, unknown> | null;
|
|
56
|
+
/** Build the welcome message sent to a freshly-connected client. */
|
|
57
|
+
buildWelcomePayload: () => Record<string, unknown>;
|
|
58
|
+
/** Handle a single ext:command frame. Caller decides routing and returns the result. */
|
|
59
|
+
handleCommand: (ctx: IpcCommandContext) => Promise<IpcCommandResult>;
|
|
60
|
+
/** Optional notification when a new client connects (lets daemon track them for broadcasts). */
|
|
61
|
+
onClientConnected?: (ws: WebSocket) => void;
|
|
62
|
+
/** Optional notification when a client disconnects. */
|
|
63
|
+
onClientDisconnected?: (ws: WebSocket) => void;
|
|
64
|
+
/** Optional logger label (defaults to "IPC"). */
|
|
65
|
+
logCategory?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Returned controller for stopping the server and broadcasting to clients.
|
|
69
|
+
* Stored by the daemon and torn down at shutdown.
|
|
70
|
+
*/
|
|
71
|
+
export interface LocalIpcServerHandle {
|
|
72
|
+
/** True once `listen()` succeeded. */
|
|
73
|
+
isListening(): boolean;
|
|
74
|
+
/** Push a message to every connected client. */
|
|
75
|
+
broadcast(type: string, payload: unknown): void;
|
|
76
|
+
/** Close all client sockets + the HTTP server. */
|
|
77
|
+
close(): Promise<void>;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Build a JSON HTTP response describing the IPC endpoint. Exposed so caller
|
|
81
|
+
* code (and tests) can build the same shape without spinning a real server.
|
|
82
|
+
*/
|
|
83
|
+
export declare function buildIpcStatusHttpResponse(method: string | undefined, url: string | undefined, payload: IpcStatusPayload): {
|
|
84
|
+
statusCode: number;
|
|
85
|
+
body: Record<string, unknown>;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Start the local IPC server. Returns a handle the caller can use to broadcast
|
|
89
|
+
* events and tear down at shutdown.
|
|
90
|
+
*/
|
|
91
|
+
export declare function startLocalIpcServer(opts: LocalIpcServerOptions): Promise<LocalIpcServerHandle>;
|
package/dist/launch.d.ts
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
/** Kill IDE process (graceful → force) */
|
|
19
19
|
export declare function killIdeProcess(ideId: string): Promise<boolean>;
|
|
20
20
|
/** Check if IDE process is running */
|
|
21
|
-
export declare function isIdeRunning(ideId: string): boolean
|
|
21
|
+
export declare function isIdeRunning(ideId: string): Promise<boolean>;
|
|
22
22
|
export interface LaunchOptions {
|
|
23
23
|
ideId?: string;
|
|
24
24
|
workspace?: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class AsyncBatchWriter {
|
|
2
|
+
private static buffers;
|
|
3
|
+
private static writePromises;
|
|
4
|
+
private static flushTimer;
|
|
5
|
+
/**
|
|
6
|
+
* Queues data to be written to a file asynchronously in a batch.
|
|
7
|
+
*/
|
|
8
|
+
static write(filePath: string, data: string): void;
|
|
9
|
+
private static flushAll;
|
|
10
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { MeshTaskStatus, MeshWorkQueueEntry } from './mesh-work-queue.js';
|
|
2
|
+
export declare class BeadsDB {
|
|
3
|
+
private static instance;
|
|
4
|
+
private readonly db;
|
|
5
|
+
private readonly dbPath;
|
|
6
|
+
private readonly migratedMeshIds;
|
|
7
|
+
private fingerprintSweepCounter;
|
|
8
|
+
private walWriteCounter;
|
|
9
|
+
private static readonly WAL_CHECK_INTERVAL;
|
|
10
|
+
private static readonly WAL_MAX_BYTES;
|
|
11
|
+
private constructor();
|
|
12
|
+
static getInstance(): BeadsDB;
|
|
13
|
+
static resetForTests(): void;
|
|
14
|
+
close(): void;
|
|
15
|
+
transaction<T>(fn: () => T): T;
|
|
16
|
+
private migrate;
|
|
17
|
+
hasCompletionFingerprint(fingerprint: string): boolean;
|
|
18
|
+
recordCompletionFingerprint(fingerprint: string, ttlMs: number): void;
|
|
19
|
+
sweepExpiredFingerprints(): void;
|
|
20
|
+
private maybeCheckpointWal;
|
|
21
|
+
private ensureLegacyQueueMigrated;
|
|
22
|
+
getQueueEntries(meshId: string, statuses?: MeshTaskStatus[]): MeshWorkQueueEntry[];
|
|
23
|
+
getQueueRevision(meshId: string): string;
|
|
24
|
+
replaceQueue(meshId: string, queue: MeshWorkQueueEntry[]): void;
|
|
25
|
+
deleteQueue(meshId: string): void;
|
|
26
|
+
insertQueueEntry(entry: MeshWorkQueueEntry): void;
|
|
27
|
+
updateQueueEntry(entry: MeshWorkQueueEntry): void;
|
|
28
|
+
findQueueEntryById(meshId: string, id: string): MeshWorkQueueEntry | null;
|
|
29
|
+
hasActiveAssignment(meshId: string, sessionId: string, nodeId: string): boolean;
|
|
30
|
+
claimNextQueueTask(meshId: string, nodeId: string, sessionId: string): MeshWorkQueueEntry | null;
|
|
31
|
+
getQueueStatsByStatus(meshId: string): {
|
|
32
|
+
status: string;
|
|
33
|
+
count: number;
|
|
34
|
+
}[];
|
|
35
|
+
getActiveAssignmentDetails(meshId: string): Array<{
|
|
36
|
+
id: string;
|
|
37
|
+
nodeId?: string;
|
|
38
|
+
sessionId?: string;
|
|
39
|
+
message: string;
|
|
40
|
+
}>;
|
|
41
|
+
findAssignedBySession(meshId: string, sessionId: string, occurredAtIso?: string): MeshWorkQueueEntry | null;
|
|
42
|
+
private toRow;
|
|
43
|
+
insertDirectDispatch(entry: {
|
|
44
|
+
taskId: string;
|
|
45
|
+
meshId: string;
|
|
46
|
+
nodeId?: string;
|
|
47
|
+
sessionId?: string;
|
|
48
|
+
providerType?: string;
|
|
49
|
+
message: string;
|
|
50
|
+
taskMode?: string;
|
|
51
|
+
via: string;
|
|
52
|
+
dispatchedToIdleSession?: boolean;
|
|
53
|
+
dispatchedAt: string;
|
|
54
|
+
}): void;
|
|
55
|
+
getActiveDirectDispatches(meshId: string): Array<{
|
|
56
|
+
taskId: string;
|
|
57
|
+
meshId: string;
|
|
58
|
+
nodeId: string | null;
|
|
59
|
+
sessionId: string | null;
|
|
60
|
+
providerType: string | null;
|
|
61
|
+
message: string;
|
|
62
|
+
taskMode: string | null;
|
|
63
|
+
via: string;
|
|
64
|
+
status: string;
|
|
65
|
+
dispatchedToIdleSession: boolean;
|
|
66
|
+
dispatchedAt: string;
|
|
67
|
+
updatedAt: string;
|
|
68
|
+
}>;
|
|
69
|
+
updateDirectDispatchStatus(meshId: string, sessionId: string, status: 'acked' | 'completed' | 'failed' | 'stale'): void;
|
|
70
|
+
cleanupTerminalDirectDispatches(olderThanMs: number): void;
|
|
71
|
+
markStaleDirectDispatches(meshId: string, olderThanMs: number): void;
|
|
72
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mesh contract v2 — first-class identity, scopes, and protocol version.
|
|
3
|
+
*
|
|
4
|
+
* Replaces the implicit conventions that grew across mesh-events.ts,
|
|
5
|
+
* mesh-work-queue.ts, mesh-ledger.ts, and mesh-tools.ts where the same
|
|
6
|
+
* concept (a coordinator, a session, a task status) appeared in different
|
|
7
|
+
* shapes per file. The audit found:
|
|
8
|
+
*
|
|
9
|
+
* - PendingMeshCoordinatorEvent had no targetCoordinatorDaemonId. All
|
|
10
|
+
* events were broadcast to every coordinator that drained them. Two
|
|
11
|
+
* coordinators sharing a mesh would each receive every event,
|
|
12
|
+
* leading to duplicate completion handling and missed targeting.
|
|
13
|
+
* - drainPendingMeshCoordinatorEvents accepted only meshId. The caller's
|
|
14
|
+
* coordinator identity was never available, so per-coordinator
|
|
15
|
+
* routing was impossible by construction.
|
|
16
|
+
* - Session identifier keys diverged across stores: targetSessionId /
|
|
17
|
+
* assignedSessionId / instanceId / runtimeSessionId / providerSessionId.
|
|
18
|
+
* resolveEventSessionId() tried four fallbacks per call.
|
|
19
|
+
* - No protocol version on the JSONL ledger or BeadsDB. Schema
|
|
20
|
+
* evolutions had no guard rail.
|
|
21
|
+
* - mesh_reconcile_ledger existed as a routine recovery tool, not as
|
|
22
|
+
* an incident-response escape hatch. That itself signals the routing
|
|
23
|
+
* layer cannot be trusted.
|
|
24
|
+
*
|
|
25
|
+
* This module introduces the types; the actual wiring lands in B2 (data
|
|
26
|
+
* model + 3-way transactional store), B3 (MCP layer enforcement), and B4
|
|
27
|
+
* (frontend consumption). B1 is intentionally non-breaking — it adds the
|
|
28
|
+
* types and leaves runtime behaviour unchanged.
|
|
29
|
+
*/
|
|
30
|
+
/** Provider type identifier (e.g. 'claude-cli', 'codex-cli', 'roo-code').
|
|
31
|
+
* Free-form string; no shared enum exists in daemon-core yet. */
|
|
32
|
+
type ProviderType = string;
|
|
33
|
+
export declare const MESH_PROTOCOL_VERSION_V1: "1.0";
|
|
34
|
+
export declare const MESH_PROTOCOL_VERSION_V2: "2.0";
|
|
35
|
+
export type MeshProtocolVersion = typeof MESH_PROTOCOL_VERSION_V1 | typeof MESH_PROTOCOL_VERSION_V2;
|
|
36
|
+
export declare const SUPPORTED_MESH_PROTOCOL_VERSIONS: readonly MeshProtocolVersion[];
|
|
37
|
+
export declare function isSupportedMeshProtocolVersion(value: unknown): value is MeshProtocolVersion;
|
|
38
|
+
/**
|
|
39
|
+
* Identity of a mesh coordinator. Required (non-optional) on every dispatch
|
|
40
|
+
* and drain operation in v2 — opaque/missing identity is the audit's
|
|
41
|
+
* smoking gun for routing failures and is structurally banned by the v2
|
|
42
|
+
* types.
|
|
43
|
+
*
|
|
44
|
+
* - daemonId: the machineId of the daemon hosting the coordinator. Stable
|
|
45
|
+
* across coordinator restarts on the same machine.
|
|
46
|
+
* - coordinatorRunId: a UUID generated when the coordinator process starts.
|
|
47
|
+
* Stable for the coordinator's lifetime, fresh on restart. Required so
|
|
48
|
+
* two coordinators on the same daemon (one CLI, one MCP) can be told
|
|
49
|
+
* apart without conflating their drains.
|
|
50
|
+
* - sessionId: optional CLI coordinator session identifier (instanceId).
|
|
51
|
+
* Present when the coordinator is itself a CLI session, absent for
|
|
52
|
+
* pure MCP coordinators.
|
|
53
|
+
*/
|
|
54
|
+
export interface CoordinatorIdentity {
|
|
55
|
+
readonly daemonId: string;
|
|
56
|
+
readonly coordinatorRunId: string;
|
|
57
|
+
readonly sessionId?: string;
|
|
58
|
+
}
|
|
59
|
+
export declare function coordinatorIdentityEquals(a: CoordinatorIdentity, b: CoordinatorIdentity): boolean;
|
|
60
|
+
export declare function coordinatorIdentityKey(identity: CoordinatorIdentity): string;
|
|
61
|
+
/**
|
|
62
|
+
* Unified mesh session identifier. v1 referred to "the session" with five
|
|
63
|
+
* different field names depending on which store you were reading; v2
|
|
64
|
+
* collapses them into one explicit handle that carries every disambiguator
|
|
65
|
+
* a consumer might need.
|
|
66
|
+
*
|
|
67
|
+
* - nodeId: the mesh node this session belongs to (FK into mesh node table).
|
|
68
|
+
* - sessionId: provider-instance identifier (the runtime session id).
|
|
69
|
+
* - providerType: which provider category/type the session runs (e.g.
|
|
70
|
+
* 'claude-cli', 'codex-cli', 'roo-code').
|
|
71
|
+
* - coordinatorDaemonId: which coordinator dispatched the work that
|
|
72
|
+
* spawned this session. Used for completion event routing.
|
|
73
|
+
* - assignedAt: ms epoch when the session was bound to its current task.
|
|
74
|
+
*/
|
|
75
|
+
export interface MeshSessionHandle {
|
|
76
|
+
readonly nodeId: string;
|
|
77
|
+
readonly sessionId: string;
|
|
78
|
+
readonly providerType: ProviderType;
|
|
79
|
+
readonly coordinatorDaemonId: string;
|
|
80
|
+
readonly assignedAt: number;
|
|
81
|
+
}
|
|
82
|
+
export declare function meshSessionHandleKey(handle: MeshSessionHandle): string;
|
|
83
|
+
/**
|
|
84
|
+
* Single canonical task status enum. v1 had at least three overlapping
|
|
85
|
+
* sets (queue / ledger / direct-dispatch). v2 consumers import from here.
|
|
86
|
+
*/
|
|
87
|
+
export declare const MESH_TASK_STATUSES: readonly ["pending", "assigned", "in_progress", "completed", "failed", "cancelled"];
|
|
88
|
+
export type MeshTaskStatus = typeof MESH_TASK_STATUSES[number];
|
|
89
|
+
export declare function isMeshTaskStatus(value: unknown): value is MeshTaskStatus;
|
|
90
|
+
/**
|
|
91
|
+
* Explicit scope for pending coordinator events. v1 had no scope: every
|
|
92
|
+
* event was broadcast to every drainer. v2 forces producers to declare
|
|
93
|
+
* intent.
|
|
94
|
+
*
|
|
95
|
+
* - 'unicast': delivered to exactly one coordinator (intendedFor). Other
|
|
96
|
+
* coordinators' drains skip it.
|
|
97
|
+
* - 'broadcast': delivered to every coordinator on the mesh. Used for
|
|
98
|
+
* system-wide signals (e.g. mesh-wide policy changes). The v1 default
|
|
99
|
+
* becomes explicit here so audit tools can flag unintended broadcasts.
|
|
100
|
+
* - 'system': delivered to the daemon-level handler, not coordinators.
|
|
101
|
+
* Reserved for infrastructure events that no coordinator should see
|
|
102
|
+
* (e.g. ledger reconciliation outcomes).
|
|
103
|
+
*/
|
|
104
|
+
export declare const MESH_EVENT_SCOPES: readonly ["unicast", "broadcast", "system"];
|
|
105
|
+
export type MeshEventScope = typeof MESH_EVENT_SCOPES[number];
|
|
106
|
+
export declare function isMeshEventScope(value: unknown): value is MeshEventScope;
|
|
107
|
+
/**
|
|
108
|
+
* v2 shape of a pending coordinator event. Strict supersets of the v1
|
|
109
|
+
* shape — every v1 field is preserved so existing readers do not break;
|
|
110
|
+
* v2 fields (scope, dispatchedBy, intendedFor, protocolVersion) are
|
|
111
|
+
* additive and consulted by v2-aware drainers only.
|
|
112
|
+
*
|
|
113
|
+
* Mixed v1/v2 events coexist during the rollout window. B2 fully cuts
|
|
114
|
+
* over once every coordinator drain is v2-aware.
|
|
115
|
+
*/
|
|
116
|
+
export interface PendingMeshCoordinatorEventV2 {
|
|
117
|
+
readonly event: string;
|
|
118
|
+
readonly meshId: string;
|
|
119
|
+
readonly nodeLabel: string;
|
|
120
|
+
readonly nodeId?: string;
|
|
121
|
+
readonly workspace?: string;
|
|
122
|
+
readonly metadataEvent: Record<string, unknown>;
|
|
123
|
+
readonly coordinatorMessage?: string;
|
|
124
|
+
readonly queuedAt: number;
|
|
125
|
+
readonly protocolVersion: MeshProtocolVersion;
|
|
126
|
+
readonly scope: MeshEventScope;
|
|
127
|
+
readonly dispatchedBy: CoordinatorIdentity;
|
|
128
|
+
/**
|
|
129
|
+
* Required when scope === 'unicast', forbidden otherwise. Drainers MUST
|
|
130
|
+
* skip unicast events whose intendedFor does not equal their own identity.
|
|
131
|
+
*/
|
|
132
|
+
readonly intendedFor?: CoordinatorIdentity;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* v2 ledger entry additions. The originatingCoordinator field is the
|
|
136
|
+
* source of truth that lets completion events route back to the
|
|
137
|
+
* coordinator that dispatched the task. v1's "worker settings carried it
|
|
138
|
+
* if it happened to be set" approach is replaced.
|
|
139
|
+
*/
|
|
140
|
+
export interface MeshLedgerOriginatingCoordinatorV2 {
|
|
141
|
+
readonly originatingCoordinator: CoordinatorIdentity;
|
|
142
|
+
readonly protocolVersion: MeshProtocolVersion;
|
|
143
|
+
}
|
|
144
|
+
export declare class MeshContractViolationError extends Error {
|
|
145
|
+
readonly violationPath: string;
|
|
146
|
+
readonly protocolVersion: MeshProtocolVersion;
|
|
147
|
+
constructor(protocolVersion: MeshProtocolVersion, violationPath: string, detail: string);
|
|
148
|
+
}
|
|
149
|
+
export declare function assertCoordinatorIdentity(raw: unknown, path: string): CoordinatorIdentity;
|
|
150
|
+
export declare function assertPendingMeshCoordinatorEventV2(raw: unknown, path?: string): PendingMeshCoordinatorEventV2;
|
|
151
|
+
/**
|
|
152
|
+
* Decide whether a v2 pending event should be delivered to the given drainer.
|
|
153
|
+
* Centralised so every drain implementation uses the same rule.
|
|
154
|
+
*
|
|
155
|
+
* - 'broadcast': always delivered.
|
|
156
|
+
* - 'system': never delivered to coordinators (system handler only).
|
|
157
|
+
* - 'unicast': delivered iff intendedFor matches drainer identity.
|
|
158
|
+
*
|
|
159
|
+
* v1 events (no scope / no protocolVersion) are treated as broadcast for
|
|
160
|
+
* backward compatibility during rollout; B3 tightens this so v1 events
|
|
161
|
+
* are quarantined to a dedicated drain endpoint instead.
|
|
162
|
+
*/
|
|
163
|
+
export declare function shouldDeliverPendingEventToCoordinator(event: PendingMeshCoordinatorEventV2, drainer: CoordinatorIdentity): boolean;
|
|
164
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MeshCoordinatorRegistry — Persisted record of active mesh coordinator sessions.
|
|
3
|
+
*
|
|
4
|
+
* Survives daemon restarts: when a CLI coordinator session is re-attached after
|
|
5
|
+
* a daemon restart the in-memory `settings.meshCoordinatorFor` on the provider
|
|
6
|
+
* instance is gone, so the registry file fills the gap.
|
|
7
|
+
*
|
|
8
|
+
* Keyed by sessionId (the CLI instance key / runtimeKey).
|
|
9
|
+
*/
|
|
10
|
+
export interface CoordinatorRegistryEntry {
|
|
11
|
+
meshId: string;
|
|
12
|
+
sessionId: string;
|
|
13
|
+
workspace?: string;
|
|
14
|
+
startedAt: number;
|
|
15
|
+
}
|
|
16
|
+
/** Load persisted coordinator registry from disk into in-memory map. Called once on daemon boot. */
|
|
17
|
+
export declare function loadMeshCoordinatorRegistry(): void;
|
|
18
|
+
/** Register a coordinator session. Persists to disk immediately. */
|
|
19
|
+
export declare function registerMeshCoordinator(entry: CoordinatorRegistryEntry): void;
|
|
20
|
+
/** Remove a coordinator session by sessionId. Persists to disk. */
|
|
21
|
+
export declare function unregisterMeshCoordinator(sessionId: string): void;
|
|
22
|
+
/** Look up a coordinator entry by session ID. Returns undefined if not registered. */
|
|
23
|
+
export declare function getCoordinatorForSession(sessionId: string): CoordinatorRegistryEntry | undefined;
|
|
24
|
+
/** List all coordinator entries for a given workspace path. */
|
|
25
|
+
export declare function listCoordinatorsForWorkspace(workspace: string): CoordinatorRegistryEntry[];
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { MeshLedgerEntry } from './mesh-ledger.js';
|
|
2
|
+
import type { MeshWorkQueueEntry, DirectDispatchRecord } from './mesh-work-queue.js';
|
|
3
|
+
export type MeshActiveWorkSource = 'queue' | 'direct';
|
|
4
|
+
export type MeshActiveWorkStatus = 'pending' | 'assigned' | 'generating' | 'idle' | 'failed' | 'awaiting_approval';
|
|
5
|
+
export interface MeshActiveWorkRecord {
|
|
6
|
+
taskId: string;
|
|
7
|
+
source: MeshActiveWorkSource;
|
|
8
|
+
status: MeshActiveWorkStatus;
|
|
9
|
+
nodeId?: string;
|
|
10
|
+
sessionId?: string;
|
|
11
|
+
providerType?: string;
|
|
12
|
+
taskTitle: string;
|
|
13
|
+
taskSummary: string;
|
|
14
|
+
message?: string;
|
|
15
|
+
taskMode?: string;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
dispatchedAt?: string;
|
|
19
|
+
elapsedMs: number;
|
|
20
|
+
terminal?: boolean;
|
|
21
|
+
terminalKind?: string;
|
|
22
|
+
terminalAt?: string;
|
|
23
|
+
staleReason?: string;
|
|
24
|
+
/**
|
|
25
|
+
* When true, the session targeted by this direct dispatch still exists in the live mesh
|
|
26
|
+
* but did not transition to generating — the dispatch was not acknowledged by the provider.
|
|
27
|
+
* Distinct from historical/orphaned stale entries where the node/session is gone.
|
|
28
|
+
*/
|
|
29
|
+
staleDispatchUnacknowledged?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface MeshActiveWorkSummary {
|
|
32
|
+
totalActiveCount: number;
|
|
33
|
+
queueActiveCount: number;
|
|
34
|
+
directActiveCount: number;
|
|
35
|
+
awaitingApprovalCount: number;
|
|
36
|
+
generatingCount: number;
|
|
37
|
+
failedCount: number;
|
|
38
|
+
idleCount: number;
|
|
39
|
+
sourceCounts: Record<MeshActiveWorkSource, number>;
|
|
40
|
+
statusCounts: Record<MeshActiveWorkStatus, number>;
|
|
41
|
+
staleDirectCount: number;
|
|
42
|
+
/**
|
|
43
|
+
* Count of stale direct entries where the target session still exists in the live mesh
|
|
44
|
+
* but never transitioned to generating — these are fresh dispatch failures, not historical orphans.
|
|
45
|
+
* Requires immediate recovery: launch a fresh session and retry the task.
|
|
46
|
+
*/
|
|
47
|
+
staleDirectUnacknowledgedCount?: number;
|
|
48
|
+
/**
|
|
49
|
+
* When staleDirectCount > 0, this note clarifies what kind of stale records exist.
|
|
50
|
+
* Fresh unacknowledged dispatches carry an actionable recovery note; orphaned historical
|
|
51
|
+
* entries carry the "historical evidence only" note. Both may coexist.
|
|
52
|
+
*/
|
|
53
|
+
staleDirectNote?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface MeshStaleDirectWorkSummary {
|
|
56
|
+
count: number;
|
|
57
|
+
sampleLimit: number;
|
|
58
|
+
sample: Array<Pick<MeshActiveWorkRecord, 'taskId' | 'status' | 'nodeId' | 'sessionId' | 'taskTitle' | 'createdAt' | 'staleReason'>>;
|
|
59
|
+
reasonCounts: Record<string, number>;
|
|
60
|
+
detailHint: string;
|
|
61
|
+
note?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface BuildMeshActiveWorkOptions {
|
|
64
|
+
meshId: string;
|
|
65
|
+
queue?: MeshWorkQueueEntry[];
|
|
66
|
+
ledgerEntries?: MeshLedgerEntry[];
|
|
67
|
+
/**
|
|
68
|
+
* Active direct dispatches from BeadsDB. When provided, these are used instead of
|
|
69
|
+
* scanning ledger entries for direct dispatches — eliminates the O(n_ledger) scan.
|
|
70
|
+
* Falls back to ledger scanning when not provided.
|
|
71
|
+
*/
|
|
72
|
+
directDispatches?: DirectDispatchRecord[];
|
|
73
|
+
nodes?: any[];
|
|
74
|
+
now?: number;
|
|
75
|
+
/** Include terminal direct rows (idle/failed) for handoff/recent-work surfaces. Defaults false. */
|
|
76
|
+
includeTerminalDirect?: boolean;
|
|
77
|
+
}
|
|
78
|
+
export declare function buildMeshActiveWorkSummary(activeWork: MeshActiveWorkRecord[]): MeshActiveWorkSummary;
|
|
79
|
+
export declare function buildMeshActiveWork(opts: BuildMeshActiveWorkOptions): {
|
|
80
|
+
activeWork: MeshActiveWorkRecord[];
|
|
81
|
+
staleDirectWork: MeshActiveWorkRecord[];
|
|
82
|
+
staleDirectWorkNote?: string;
|
|
83
|
+
terminalDirectWork: MeshActiveWorkRecord[];
|
|
84
|
+
summary: MeshActiveWorkSummary;
|
|
85
|
+
};
|
|
86
|
+
export declare function buildCompactStaleDirectWorkSummary(staleDirectWork: MeshActiveWorkRecord[], opts?: {
|
|
87
|
+
sampleLimit?: number;
|
|
88
|
+
detailHint?: string;
|
|
89
|
+
note?: string;
|
|
90
|
+
}): MeshStaleDirectWorkSummary;
|
|
@@ -6,15 +6,22 @@ export interface PendingMeshCoordinatorEvent {
|
|
|
6
6
|
nodeId?: string;
|
|
7
7
|
workspace?: string;
|
|
8
8
|
metadataEvent: Record<string, unknown>;
|
|
9
|
+
coordinatorMessage?: string;
|
|
9
10
|
queuedAt: number;
|
|
11
|
+
/**
|
|
12
|
+
* When set, this event is intended for a specific coordinator daemon.
|
|
13
|
+
* Coordinators on other daemons should ignore it during drain.
|
|
14
|
+
* Absent on legacy events — treated as broadcast to any coordinator.
|
|
15
|
+
*/
|
|
16
|
+
targetCoordinatorDaemonId?: string;
|
|
10
17
|
}
|
|
11
18
|
export declare function queuePendingMeshCoordinatorEvent(event: PendingMeshCoordinatorEvent): boolean;
|
|
12
|
-
/** Drain and return all pending coordinator events,
|
|
13
|
-
export declare function drainPendingMeshCoordinatorEvents(): PendingMeshCoordinatorEvent[];
|
|
19
|
+
/** Drain and return all pending coordinator events for meshId, removing them from disk. */
|
|
20
|
+
export declare function drainPendingMeshCoordinatorEvents(meshId?: string, coordinatorDaemonId?: string): PendingMeshCoordinatorEvent[];
|
|
14
21
|
/** Peek at pending coordinator events without draining (non-destructive). */
|
|
15
|
-
export declare function getPendingMeshCoordinatorEvents(): readonly PendingMeshCoordinatorEvent[];
|
|
16
|
-
/** Explicitly clear all pending coordinator events. */
|
|
17
|
-
export declare function clearPendingMeshCoordinatorEvents(): void;
|
|
22
|
+
export declare function getPendingMeshCoordinatorEvents(meshId?: string, coordinatorDaemonId?: string): readonly PendingMeshCoordinatorEvent[];
|
|
23
|
+
/** Explicitly clear all pending coordinator events for a mesh (and coordinator if scoped). */
|
|
24
|
+
export declare function clearPendingMeshCoordinatorEvents(meshId?: string, coordinatorDaemonId?: string): void;
|
|
18
25
|
export declare function tryAssignQueueTask(components: DaemonComponents, meshId: string, nodeId: string, sessionId: string, providerType: string): boolean;
|
|
19
26
|
/**
|
|
20
27
|
* Triggers a queue check for all nodes in the mesh.
|
|
@@ -26,12 +33,77 @@ export declare function handleMeshForwardEvent(components: DaemonComponents, pay
|
|
|
26
33
|
forwarded: number;
|
|
27
34
|
suppressed: boolean;
|
|
28
35
|
intentionalCleanupStop: boolean;
|
|
36
|
+
terminalLedgerEvidence?: undefined;
|
|
37
|
+
terminalLedgerKind?: undefined;
|
|
38
|
+
duplicateRefineTerminalEvent?: undefined;
|
|
39
|
+
duplicateCompletion?: undefined;
|
|
29
40
|
error?: undefined;
|
|
41
|
+
bufferedForGeneratingCoordinator?: undefined;
|
|
30
42
|
} | {
|
|
31
43
|
success: boolean;
|
|
32
44
|
forwarded: number;
|
|
45
|
+
suppressed: boolean;
|
|
46
|
+
terminalLedgerEvidence: boolean;
|
|
47
|
+
terminalLedgerKind: unknown;
|
|
48
|
+
intentionalCleanupStop?: undefined;
|
|
49
|
+
duplicateRefineTerminalEvent?: undefined;
|
|
50
|
+
duplicateCompletion?: undefined;
|
|
51
|
+
error?: undefined;
|
|
52
|
+
bufferedForGeneratingCoordinator?: undefined;
|
|
53
|
+
} | {
|
|
54
|
+
success: boolean;
|
|
55
|
+
forwarded: number;
|
|
56
|
+
suppressed: boolean;
|
|
57
|
+
duplicateRefineTerminalEvent: boolean;
|
|
58
|
+
intentionalCleanupStop?: undefined;
|
|
59
|
+
terminalLedgerEvidence?: undefined;
|
|
60
|
+
terminalLedgerKind?: undefined;
|
|
61
|
+
duplicateCompletion?: undefined;
|
|
62
|
+
error?: undefined;
|
|
63
|
+
bufferedForGeneratingCoordinator?: undefined;
|
|
64
|
+
} | {
|
|
65
|
+
success: boolean;
|
|
66
|
+
forwarded: number;
|
|
67
|
+
suppressed: boolean;
|
|
68
|
+
duplicateCompletion: boolean;
|
|
69
|
+
terminalLedgerEvidence: boolean;
|
|
70
|
+
intentionalCleanupStop?: undefined;
|
|
71
|
+
terminalLedgerKind?: undefined;
|
|
72
|
+
duplicateRefineTerminalEvent?: undefined;
|
|
73
|
+
error?: undefined;
|
|
74
|
+
bufferedForGeneratingCoordinator?: undefined;
|
|
75
|
+
} | {
|
|
76
|
+
success: boolean;
|
|
77
|
+
forwarded: number;
|
|
78
|
+
suppressed: boolean;
|
|
79
|
+
duplicateCompletion: boolean;
|
|
80
|
+
intentionalCleanupStop?: undefined;
|
|
81
|
+
terminalLedgerEvidence?: undefined;
|
|
82
|
+
terminalLedgerKind?: undefined;
|
|
83
|
+
duplicateRefineTerminalEvent?: undefined;
|
|
84
|
+
error?: undefined;
|
|
85
|
+
bufferedForGeneratingCoordinator?: undefined;
|
|
86
|
+
} | {
|
|
87
|
+
success: boolean;
|
|
88
|
+
forwarded: number;
|
|
89
|
+
suppressed?: undefined;
|
|
90
|
+
intentionalCleanupStop?: undefined;
|
|
91
|
+
terminalLedgerEvidence?: undefined;
|
|
92
|
+
terminalLedgerKind?: undefined;
|
|
93
|
+
duplicateRefineTerminalEvent?: undefined;
|
|
94
|
+
duplicateCompletion?: undefined;
|
|
95
|
+
error?: undefined;
|
|
96
|
+
bufferedForGeneratingCoordinator?: undefined;
|
|
97
|
+
} | {
|
|
98
|
+
success: boolean;
|
|
99
|
+
forwarded: number;
|
|
100
|
+
bufferedForGeneratingCoordinator: boolean;
|
|
33
101
|
suppressed?: undefined;
|
|
34
102
|
intentionalCleanupStop?: undefined;
|
|
103
|
+
terminalLedgerEvidence?: undefined;
|
|
104
|
+
terminalLedgerKind?: undefined;
|
|
105
|
+
duplicateRefineTerminalEvent?: undefined;
|
|
106
|
+
duplicateCompletion?: undefined;
|
|
35
107
|
error?: undefined;
|
|
36
108
|
} | {
|
|
37
109
|
success: boolean;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { GitRepoStatus } from '../git/git-types.js';
|
|
2
|
+
export interface MeshFastForwardNodeArgs {
|
|
3
|
+
nodeId?: string;
|
|
4
|
+
meshId?: string;
|
|
5
|
+
workspace: string;
|
|
6
|
+
branch?: string;
|
|
7
|
+
execute?: boolean;
|
|
8
|
+
dryRun?: boolean;
|
|
9
|
+
updateSubmodules?: boolean;
|
|
10
|
+
submoduleIgnorePaths?: string[];
|
|
11
|
+
timeoutMs?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface MeshFastForwardPlannedStep {
|
|
14
|
+
operation: 'refresh_upstream' | 'verify_clean_worktree' | 'verify_fast_forward' | 'merge_ff_only' | 'submodule_update' | 'verify_post_status';
|
|
15
|
+
description: string;
|
|
16
|
+
safe: true;
|
|
17
|
+
willMutateWorktree: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface MeshFastForwardResult {
|
|
20
|
+
success: boolean;
|
|
21
|
+
code: string;
|
|
22
|
+
nodeId?: string;
|
|
23
|
+
meshId?: string;
|
|
24
|
+
workspace: string;
|
|
25
|
+
allowed: boolean;
|
|
26
|
+
dryRun: boolean;
|
|
27
|
+
willRun: boolean;
|
|
28
|
+
executed: boolean;
|
|
29
|
+
updateSubmodules: boolean;
|
|
30
|
+
blockingReasons: string[];
|
|
31
|
+
plannedSteps: MeshFastForwardPlannedStep[];
|
|
32
|
+
current?: GitRepoStatus;
|
|
33
|
+
preStatus?: GitRepoStatus;
|
|
34
|
+
postStatus?: GitRepoStatus;
|
|
35
|
+
finalBranchConvergenceState?: Record<string, unknown>;
|
|
36
|
+
operationError?: string;
|
|
37
|
+
ledgerError?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare function fastForwardMeshNode(args: MeshFastForwardNodeArgs): Promise<MeshFastForwardResult>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RepoMeshDaemonRole, RepoMeshHostMetadata, RepoMeshHostStatus } from '../repo-mesh-types.js';
|
|
2
|
+
export declare function normalizeMeshDaemonRole(value: unknown): RepoMeshDaemonRole | undefined;
|
|
3
|
+
export declare function resolveMeshHostStatus(mesh: unknown): RepoMeshHostStatus;
|
|
4
|
+
export declare function isMeshHostOwner(mesh: unknown): boolean;
|
|
5
|
+
export declare function buildMeshHostRequiredFailure(mesh: unknown, operation: string): Record<string, unknown>;
|
|
6
|
+
export declare function requireMeshHostQueueOwner(opts?: {
|
|
7
|
+
ownerRole?: RepoMeshDaemonRole;
|
|
8
|
+
}): void;
|
|
9
|
+
export declare function createDefaultMeshHostMetadata(): RepoMeshHostMetadata;
|