@adhdev/daemon-core 0.9.77-rc.6 → 0.9.77-rc.60
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/daemon-lifecycle.d.ts +3 -0
- package/dist/cli-adapters/provider-cli-adapter.d.ts +4 -0
- package/dist/cli-adapters/provider-cli-shared.d.ts +14 -4
- package/dist/commands/mesh-coordinator.d.ts +10 -0
- package/dist/commands/router.d.ts +4 -1
- package/dist/config/mesh-config.d.ts +1 -0
- package/dist/git/git-worktree.d.ts +15 -2
- package/dist/index.d.ts +10 -6
- package/dist/index.js +2076 -299
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2061 -299
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-events.d.ts +14 -7
- package/dist/mesh/mesh-ledger-reconciliation.d.ts +55 -0
- package/dist/mesh/mesh-ledger.d.ts +84 -4
- package/dist/mesh/mesh-sync.d.ts +4 -12
- package/dist/mesh/mesh-visualization.d.ts +70 -0
- package/dist/mesh/mesh-work-queue.d.ts +58 -1
- package/dist/mesh/p2p-relay-failure.d.ts +35 -0
- package/dist/providers/chat-message-normalization.d.ts +1 -0
- package/dist/providers/cli-provider-instance.d.ts +6 -0
- package/dist/repo-mesh-types.d.ts +2 -0
- package/dist/shared-types.d.ts +38 -0
- package/package.json +1 -1
- package/src/boot/daemon-lifecycle.ts +5 -0
- package/src/cli-adapters/provider-cli-adapter.ts +35 -4
- package/src/cli-adapters/provider-cli-shared.ts +14 -4
- package/src/commands/cli-manager.ts +0 -4
- package/src/commands/mesh-coordinator.ts +55 -7
- package/src/commands/router.ts +915 -26
- package/src/commands/stream-commands.ts +8 -1
- package/src/config/config.ts +2 -1
- package/src/config/mesh-config.ts +2 -0
- package/src/config/workspaces.ts +1 -1
- package/src/git/git-worktree.ts +56 -4
- package/src/index.d.ts +3 -0
- package/src/index.ts +29 -6
- package/src/mesh/coordinator-prompt.ts +21 -10
- package/src/mesh/mesh-events.ts +532 -22
- package/src/mesh/mesh-ledger-reconciliation.ts +115 -0
- package/src/mesh/mesh-ledger.ts +209 -8
- package/src/mesh/mesh-sync.ts +4 -34
- package/src/mesh/mesh-visualization.ts +341 -0
- package/src/mesh/mesh-work-queue.ts +183 -17
- package/src/mesh/p2p-relay-failure.ts +152 -0
- package/src/providers/acp-provider-instance.ts +2 -1
- package/src/providers/chat-message-normalization.ts +32 -0
- package/src/providers/cli-provider-instance.ts +155 -31
- package/src/providers/extension-provider-instance.ts +2 -1
- package/src/providers/ide-provider-instance.ts +2 -2
- package/src/repo-mesh-types.ts +2 -0
- package/src/shared-types.ts +38 -0
|
@@ -57,6 +57,8 @@ export interface DaemonInitConfig {
|
|
|
57
57
|
workspace: string;
|
|
58
58
|
sessionId: string;
|
|
59
59
|
}) => void;
|
|
60
|
+
/** Relays a command to a remote mesh node daemon */
|
|
61
|
+
dispatchMeshCommand?: (daemonId: string, command: string, args: Record<string, unknown>) => Promise<any>;
|
|
60
62
|
}
|
|
61
63
|
export interface DaemonComponents {
|
|
62
64
|
providerLoader: ProviderLoader;
|
|
@@ -73,6 +75,7 @@ export interface DaemonComponents {
|
|
|
73
75
|
value: IDEInfo[];
|
|
74
76
|
};
|
|
75
77
|
refreshProviderAvailability: (providerType?: string) => Promise<void>;
|
|
78
|
+
dispatchMeshCommand?: (daemonId: string, command: string, args: Record<string, unknown>) => Promise<any>;
|
|
76
79
|
}
|
|
77
80
|
export interface DaemonDevSupportOptions {
|
|
78
81
|
components: DaemonComponents;
|
|
@@ -77,6 +77,8 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
77
77
|
private resizeSuppressUntil;
|
|
78
78
|
private statusHistory;
|
|
79
79
|
private cliScripts;
|
|
80
|
+
/** Per-session opaque state object created by cliScripts.createState(), reset on stop. */
|
|
81
|
+
private scriptState;
|
|
80
82
|
private runtimeSettings;
|
|
81
83
|
/** Full accumulated rendered PTY transcript for parser/readback use */
|
|
82
84
|
private accumulatedBuffer;
|
|
@@ -112,6 +114,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
112
114
|
private getParseScreenText;
|
|
113
115
|
private shouldReadTerminalScreenSnapshot;
|
|
114
116
|
private resetTerminalScreen;
|
|
117
|
+
private getAccumulatedRawBufferCacheKey;
|
|
115
118
|
private getFreshParsedStatusCache;
|
|
116
119
|
private providerOwnsTranscript;
|
|
117
120
|
private shouldUseFullProviderTranscriptContext;
|
|
@@ -161,6 +164,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
161
164
|
private finishResponse;
|
|
162
165
|
private maybeCommitVisibleIdleTranscript;
|
|
163
166
|
private commitCurrentTranscript;
|
|
167
|
+
private invokeCliScript;
|
|
164
168
|
private runParseSession;
|
|
165
169
|
private runDetectStatus;
|
|
166
170
|
private runParseApproval;
|
|
@@ -63,17 +63,27 @@ export interface ParsedSession {
|
|
|
63
63
|
coverage?: 'full' | 'tail' | 'current-turn';
|
|
64
64
|
}
|
|
65
65
|
export interface CliScripts {
|
|
66
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Optional state factory. Called once per CLI session start (or script reload).
|
|
68
|
+
* The returned object is passed as the first argument to detectStatus, parseApproval,
|
|
69
|
+
* and parseSession on every invocation, allowing scripts to maintain per-session state
|
|
70
|
+
* (e.g. last-seen status, approval fingerprints, stability counters).
|
|
71
|
+
*
|
|
72
|
+
* Scripts that don't define createState() receive null as the state argument,
|
|
73
|
+
* making this change fully backward compatible.
|
|
74
|
+
*/
|
|
75
|
+
createState?: () => unknown;
|
|
76
|
+
parseSession?: (state: unknown, input: CliScriptInput & {
|
|
67
77
|
tail?: string;
|
|
68
78
|
tailScreen?: CliScreenSnapshot;
|
|
69
79
|
}) => ParsedSession | null;
|
|
70
|
-
detectStatus?: (input: CliStatusInput) => string | null;
|
|
71
|
-
parseApproval?: (input: CliApprovalInput) => {
|
|
80
|
+
detectStatus?: (state: unknown, input: CliStatusInput) => string | null;
|
|
81
|
+
parseApproval?: (state: unknown, input: CliApprovalInput) => {
|
|
72
82
|
message: string;
|
|
73
83
|
buttons: string[];
|
|
74
84
|
} | null;
|
|
75
85
|
resolveAction?: (data: any) => string;
|
|
76
|
-
[name: string]: ((input: any) => any) | undefined;
|
|
86
|
+
[name: string]: ((state: unknown, input: any) => any) | ((data: any) => any) | (() => unknown) | undefined;
|
|
77
87
|
}
|
|
78
88
|
export interface CliScreenLine {
|
|
79
89
|
index: number;
|
|
@@ -17,6 +17,14 @@ export type MeshCoordinatorSetup = {
|
|
|
17
17
|
requiresRestart: boolean;
|
|
18
18
|
instructions: string;
|
|
19
19
|
template: string;
|
|
20
|
+
} | {
|
|
21
|
+
/** Provider registers MCP via its own CLI command (e.g. `codex mcp add` / `gemini mcp add`). */
|
|
22
|
+
kind: 'cli_command';
|
|
23
|
+
serverName: string;
|
|
24
|
+
/** The rendered shell command to execute before launching the coordinator session. */
|
|
25
|
+
command: string;
|
|
26
|
+
requiresRestart: boolean;
|
|
27
|
+
instructions: string;
|
|
20
28
|
} | {
|
|
21
29
|
kind: 'unsupported';
|
|
22
30
|
reason: string;
|
|
@@ -29,6 +37,8 @@ export interface ResolveMeshCoordinatorSetupOptions {
|
|
|
29
37
|
adhdevMcpCommand?: string;
|
|
30
38
|
adhdevMcpEntryPath?: string;
|
|
31
39
|
nodeExecutable?: string;
|
|
40
|
+
adhdevMcpTransport?: 'local' | 'ipc';
|
|
41
|
+
adhdevMcpPort?: number;
|
|
32
42
|
}
|
|
33
43
|
export declare function createHermesManualMeshCoordinatorSetup(meshId: string, workspace: string): MeshCoordinatorSetup;
|
|
34
44
|
export declare function resolveMeshCoordinatorSetup(options: ResolveMeshCoordinatorSetupOptions): MeshCoordinatorSetup;
|
|
@@ -84,13 +84,16 @@ export declare class DaemonCommandRouter {
|
|
|
84
84
|
* the mesh doesn't exist in the local meshes.json file. */
|
|
85
85
|
private inlineMeshCache;
|
|
86
86
|
constructor(deps: CommandRouterDeps);
|
|
87
|
-
|
|
87
|
+
getCachedInlineMesh(meshId: string, inlineMesh?: unknown): any | undefined;
|
|
88
88
|
private getMeshForCommand;
|
|
89
89
|
private updateInlineMeshNode;
|
|
90
90
|
private removeInlineMeshNode;
|
|
91
91
|
private normalizeMeshSessionCleanupMode;
|
|
92
92
|
private sessionMatchesMeshNode;
|
|
93
|
+
private cleanupLocalWorktreeNode;
|
|
94
|
+
private getWorktreeForceCleanupConvergence;
|
|
93
95
|
private isCompletedHostedSession;
|
|
96
|
+
private recordIntentionalMeshSessionStop;
|
|
94
97
|
private cleanupMeshSessions;
|
|
95
98
|
private traceSessionHostAction;
|
|
96
99
|
/**
|
|
@@ -31,9 +31,22 @@ export interface WorktreeEntry {
|
|
|
31
31
|
branch: string | null;
|
|
32
32
|
bare: boolean;
|
|
33
33
|
}
|
|
34
|
+
export interface WorktreeRemoveOptions {
|
|
35
|
+
/** Refuse to remove a worktree with uncommitted or untracked changes. */
|
|
36
|
+
requireClean?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* If normal removal fails with Git's submodule-worktree guard, retry with
|
|
39
|
+
* `git worktree remove --force`. Callers must perform their own
|
|
40
|
+
* higher-level managed-path/convergence checks before enabling this.
|
|
41
|
+
*/
|
|
42
|
+
allowSubmoduleForceFallback?: boolean;
|
|
43
|
+
}
|
|
34
44
|
export interface WorktreeRemoveResult {
|
|
35
45
|
success: true;
|
|
36
46
|
removedPath: string;
|
|
47
|
+
fallback?: 'git_worktree_remove_force_submodule';
|
|
48
|
+
forced?: boolean;
|
|
49
|
+
reason?: 'working_trees_containing_submodules';
|
|
37
50
|
}
|
|
38
51
|
/**
|
|
39
52
|
* Resolve the target directory for a new worktree.
|
|
@@ -49,9 +62,9 @@ export declare function createWorktree(opts: WorktreeCreateOptions): Promise<Wor
|
|
|
49
62
|
/**
|
|
50
63
|
* Remove a git worktree and clean up the directory.
|
|
51
64
|
*
|
|
52
|
-
* Runs: git worktree remove <worktreePath>
|
|
65
|
+
* Runs: git worktree remove <worktreePath>
|
|
53
66
|
*/
|
|
54
|
-
export declare function removeWorktree(repoRoot: string, worktreePath: string): Promise<WorktreeRemoveResult>;
|
|
67
|
+
export declare function removeWorktree(repoRoot: string, worktreePath: string, opts?: WorktreeRemoveOptions): Promise<WorktreeRemoveResult>;
|
|
55
68
|
/**
|
|
56
69
|
* List all worktrees for a repository.
|
|
57
70
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -31,11 +31,16 @@ export { buildCoordinatorSystemPrompt } from './mesh/coordinator-prompt.js';
|
|
|
31
31
|
export type { CoordinatorPromptContext } from './mesh/coordinator-prompt.js';
|
|
32
32
|
export { syncMeshes } from './mesh/mesh-sync.js';
|
|
33
33
|
export type { MeshSyncTransport, MeshSyncResult, RemoteMeshRecord } from './mesh/mesh-sync.js';
|
|
34
|
-
export { appendLedgerEntry, readLedgerEntries, getLedgerSummary, getLedgerDir, getSessionRecoveryContext } from './mesh/mesh-ledger.js';
|
|
35
|
-
export type { MeshLedgerEntry, MeshLedgerKind, MeshLedgerSummary, ReadLedgerOptions, SessionRecoveryContext } from './mesh/mesh-ledger.js';
|
|
36
|
-
export {
|
|
37
|
-
export type {
|
|
38
|
-
export {
|
|
34
|
+
export { appendLedgerEntry, appendRemoteLedgerEntries, readLedgerEntries, readLedgerSlice, getLedgerSummary, getLedgerDir, getSessionRecoveryContext, MAX_LEDGER_SLICE_LIMIT } from './mesh/mesh-ledger.js';
|
|
35
|
+
export type { AppendRemoteLedgerResult, MeshLedgerEntry, MeshLedgerKind, MeshLedgerSlice, MeshLedgerSummary, ReadLedgerOptions, ReadLedgerSliceOptions, SessionRecoveryContext } from './mesh/mesh-ledger.js';
|
|
36
|
+
export { buildMeshLedgerReconciliationEvidence, buildMeshLedgerReplicaEvidence } from './mesh/mesh-ledger-reconciliation.js';
|
|
37
|
+
export type { MeshLedgerReconciliationEvidence, MeshLedgerReplicaEvidence, MeshLedgerReplicaStatus } from './mesh/mesh-ledger-reconciliation.js';
|
|
38
|
+
export { enqueueTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus, cancelTask, requeueTask, getMeshQueueStats } from './mesh/mesh-work-queue.js';
|
|
39
|
+
export type { MeshWorkQueueEntry, MeshTaskStatus, MeshWorkQueueStats } from './mesh/mesh-work-queue.js';
|
|
40
|
+
export { triggerMeshQueue, drainPendingMeshCoordinatorEvents, getPendingMeshCoordinatorEvents, clearPendingMeshCoordinatorEvents } from './mesh/mesh-events.js';
|
|
41
|
+
export type { PendingMeshCoordinatorEvent } from './mesh/mesh-events.js';
|
|
42
|
+
export { P2pRelayFailureError, buildP2pRelayFailurePayload, classifyP2pRelayFailure, isP2pRelayTransportFailure, } from './mesh/p2p-relay-failure.js';
|
|
43
|
+
export type { P2pRelayFailureClassification, P2pRelayFailureCode, P2pRelayFailureContext, P2pRelayFailurePayload, } from './mesh/p2p-relay-failure.js';
|
|
39
44
|
export { loadState, saveState, resetState } from './config/state-store.js';
|
|
40
45
|
export type { DaemonState } from './config/state-store.js';
|
|
41
46
|
export { detectIDEs } from './detection/ide-detector.js';
|
|
@@ -112,7 +117,6 @@ export { ensureSessionHostReady, listHostedCliRuntimes } from './session-host/ru
|
|
|
112
117
|
export { getSessionHostRecoveryLabel, getSessionHostSurfaceKind, isSessionHostLiveRuntime, isSessionHostRecoverySnapshot, partitionSessionHostDiagnosticsSessions, partitionSessionHostRecords, } from './session-host/runtime-surface.js';
|
|
113
118
|
export type { SessionHostSurfaceKind, SessionHostSurfaceRecordLike } from './session-host/runtime-surface.js';
|
|
114
119
|
export { shouldAutoRestoreHostedSessionsOnStartup } from './session-host/startup-restore-policy.js';
|
|
115
|
-
export type { SessionHostEndpoint } from '@adhdev/session-host-core';
|
|
116
120
|
export { getAIExtensions, installExtensions, launchIDE, isExtensionInstalled } from './installer.js';
|
|
117
121
|
export type { ExtensionInfo as InstallerExtensionInfo } from './installer.js';
|
|
118
122
|
export { initDaemonComponents, startDaemonDevSupport, shutdownDaemonComponents } from './boot/daemon-lifecycle.js';
|