@adhdev/daemon-core 0.9.82-rc.5 → 0.9.82-rc.50
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 +2 -0
- package/dist/commands/router.d.ts +13 -0
- package/dist/config/mesh-config.d.ts +66 -1
- package/dist/git/git-commands.d.ts +1 -0
- package/dist/git/git-status.d.ts +5 -0
- package/dist/git/git-types.d.ts +10 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +2483 -434
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2463 -427
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-events.d.ts +17 -5
- package/dist/mesh/mesh-host-ownership.d.ts +9 -0
- package/dist/mesh/mesh-ledger.d.ts +1 -1
- package/dist/mesh/mesh-work-queue.d.ts +11 -5
- package/dist/mesh/refine-config.d.ts +119 -0
- package/dist/providers/chat-message-normalization.d.ts +1 -0
- package/dist/repo-mesh-types.d.ts +160 -0
- package/package.json +1 -1
- package/src/boot/daemon-lifecycle.ts +4 -0
- package/src/commands/router.ts +1831 -296
- package/src/config/mesh-config.ts +244 -1
- package/src/git/git-commands.ts +3 -3
- package/src/git/git-status.ts +97 -6
- package/src/git/git-summary.ts +3 -0
- package/src/git/git-types.ts +11 -0
- package/src/index.ts +32 -2
- package/src/mesh/mesh-events.ts +168 -30
- package/src/mesh/mesh-host-ownership.ts +73 -0
- package/src/mesh/mesh-ledger.ts +1 -0
- package/src/mesh/mesh-work-queue.ts +149 -122
- package/src/mesh/refine-config.ts +306 -0
- package/src/providers/chat-message-normalization.ts +3 -1
- package/src/repo-mesh-types.ts +174 -0
|
@@ -59,6 +59,8 @@ export interface DaemonInitConfig {
|
|
|
59
59
|
}) => void;
|
|
60
60
|
/** Relays a command to a remote mesh node daemon */
|
|
61
61
|
dispatchMeshCommand?: (daemonId: string, command: string, args: Record<string, unknown>) => Promise<any>;
|
|
62
|
+
/** Returns selected-coordinator mesh peer telemetry for a target daemon when available. */
|
|
63
|
+
getMeshPeerConnectionStatus?: (daemonId: string) => Record<string, unknown> | null;
|
|
62
64
|
}
|
|
63
65
|
export interface DaemonComponents {
|
|
64
66
|
providerLoader: ProviderLoader;
|
|
@@ -72,6 +72,10 @@ export interface CommandRouterDeps {
|
|
|
72
72
|
statusVersion?: string;
|
|
73
73
|
/** Session host control plane */
|
|
74
74
|
sessionHostControl?: SessionHostControlPlane | null;
|
|
75
|
+
/** Selected-coordinator mesh peer telemetry surface for target daemons, when supported by the runtime. */
|
|
76
|
+
getMeshPeerConnectionStatus?: (daemonId: string) => Record<string, unknown> | null;
|
|
77
|
+
/** Dispatch a command to a remote mesh node via P2P/relay. Injected by cloud runtime; absent in standalone. */
|
|
78
|
+
dispatchMeshCommand?: (daemonId: string, cmd: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
75
79
|
}
|
|
76
80
|
export interface CommandRouterResult {
|
|
77
81
|
success: boolean;
|
|
@@ -83,9 +87,18 @@ export declare class DaemonCommandRouter {
|
|
|
83
87
|
* Allows the MCP server to query mesh data via get_mesh even when
|
|
84
88
|
* the mesh doesn't exist in the local meshes.json file. */
|
|
85
89
|
private inlineMeshCache;
|
|
90
|
+
/** Coordinator-owned whole-mesh aggregate status snapshots. Browser callers read this by default. */
|
|
91
|
+
private aggregateMeshStatusCache;
|
|
86
92
|
constructor(deps: CommandRouterDeps);
|
|
93
|
+
private cloneJsonValue;
|
|
94
|
+
private hydrateCachedAggregateMeshStatusFromInline;
|
|
95
|
+
private getCachedAggregateMeshStatus;
|
|
96
|
+
private rememberAggregateMeshStatus;
|
|
87
97
|
getCachedInlineMesh(meshId: string, inlineMesh?: unknown): any | undefined;
|
|
98
|
+
private warmInlineMeshCache;
|
|
88
99
|
private getMeshForCommand;
|
|
100
|
+
private invalidateAggregateMeshStatus;
|
|
101
|
+
private requireMeshHostMutationOwner;
|
|
89
102
|
private updateInlineMeshNode;
|
|
90
103
|
private removeInlineMeshNode;
|
|
91
104
|
private normalizeMeshSessionCleanupMode;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Cloud mode syncs these to D1 via server routes; standalone mode
|
|
6
6
|
* uses this file as the single source of truth.
|
|
7
7
|
*/
|
|
8
|
-
import type { LocalMeshEntry, LocalMeshNodeEntry, RepoMeshPolicy, RepoMeshNodePolicy, RepoMeshNodeCapabilities, RepoMeshCoordinatorConfig } from '../repo-mesh-types.js';
|
|
8
|
+
import type { LocalMeshEntry, LocalMeshNodeEntry, RepoMeshPolicy, RepoMeshNodePolicy, RepoMeshNodeCapabilities, RepoMeshCoordinatorConfig, RepoMeshHostMetadata, RepoMeshDaemonRole } from '../repo-mesh-types.js';
|
|
9
9
|
/**
|
|
10
10
|
* Normalize a Git remote URL into a stable identity string.
|
|
11
11
|
* e.g. "git@github.com:user/repo.git" → "github.com/user/repo"
|
|
@@ -22,6 +22,7 @@ export interface CreateMeshOptions {
|
|
|
22
22
|
defaultBranch?: string;
|
|
23
23
|
policy?: Partial<RepoMeshPolicy>;
|
|
24
24
|
coordinator?: RepoMeshCoordinatorConfig;
|
|
25
|
+
meshHost?: RepoMeshHostMetadata;
|
|
25
26
|
}
|
|
26
27
|
export declare function createMesh(opts: CreateMeshOptions): LocalMeshEntry;
|
|
27
28
|
export interface UpdateMeshOptions {
|
|
@@ -29,9 +30,72 @@ export interface UpdateMeshOptions {
|
|
|
29
30
|
defaultBranch?: string;
|
|
30
31
|
policy?: Partial<RepoMeshPolicy>;
|
|
31
32
|
coordinator?: RepoMeshCoordinatorConfig;
|
|
33
|
+
meshHost?: RepoMeshHostMetadata;
|
|
32
34
|
}
|
|
33
35
|
export declare function updateMesh(meshId: string, opts: UpdateMeshOptions): LocalMeshEntry | undefined;
|
|
34
36
|
export declare function deleteMesh(meshId: string): boolean;
|
|
37
|
+
export declare function tokenIdForManualPairing(token: string): string;
|
|
38
|
+
export interface ConfigureMeshHostPairingOptions {
|
|
39
|
+
hostAddress: string;
|
|
40
|
+
token: string;
|
|
41
|
+
now?: string;
|
|
42
|
+
}
|
|
43
|
+
export declare function configureMeshHostPairing(meshId: string, opts: ConfigureMeshHostPairingOptions): {
|
|
44
|
+
mesh: LocalMeshEntry;
|
|
45
|
+
meshHost: RepoMeshHostMetadata;
|
|
46
|
+
hostAddress: string;
|
|
47
|
+
} | undefined;
|
|
48
|
+
export interface CreateMeshHostPairingTokenOptions {
|
|
49
|
+
token?: string;
|
|
50
|
+
expiresAt?: string;
|
|
51
|
+
now?: string;
|
|
52
|
+
}
|
|
53
|
+
export declare function createMeshHostPairingToken(meshId: string, opts?: CreateMeshHostPairingTokenOptions): {
|
|
54
|
+
mesh: LocalMeshEntry;
|
|
55
|
+
meshHost: RepoMeshHostMetadata;
|
|
56
|
+
token: string;
|
|
57
|
+
tokenId: string;
|
|
58
|
+
expiresAt?: string;
|
|
59
|
+
} | undefined;
|
|
60
|
+
export interface MeshHostJoinMemberNodeInput {
|
|
61
|
+
id?: string;
|
|
62
|
+
workspace: string;
|
|
63
|
+
repoRoot?: string;
|
|
64
|
+
daemonId?: string;
|
|
65
|
+
machineId?: string;
|
|
66
|
+
userOverrides?: Partial<RepoMeshNodeCapabilities>;
|
|
67
|
+
policy?: RepoMeshNodePolicy;
|
|
68
|
+
role?: RepoMeshDaemonRole;
|
|
69
|
+
}
|
|
70
|
+
export interface ApplyMeshHostJoinOptions {
|
|
71
|
+
token: string;
|
|
72
|
+
memberNode: MeshHostJoinMemberNodeInput;
|
|
73
|
+
memberMeshId?: string;
|
|
74
|
+
now?: string;
|
|
75
|
+
}
|
|
76
|
+
export declare function applyMeshHostJoinRequest(meshId: string, opts: ApplyMeshHostJoinOptions): {
|
|
77
|
+
accepted: true;
|
|
78
|
+
mesh: LocalMeshEntry;
|
|
79
|
+
meshHost: RepoMeshHostMetadata;
|
|
80
|
+
node: LocalMeshNodeEntry;
|
|
81
|
+
tokenId: string;
|
|
82
|
+
} | {
|
|
83
|
+
accepted: false;
|
|
84
|
+
mesh?: LocalMeshEntry;
|
|
85
|
+
meshHost?: RepoMeshHostMetadata;
|
|
86
|
+
tokenId?: string;
|
|
87
|
+
reason: string;
|
|
88
|
+
} | undefined;
|
|
89
|
+
export declare function markMeshHostPairingJoined(meshId: string, opts: {
|
|
90
|
+
hostDaemonId?: string;
|
|
91
|
+
hostNodeId?: string;
|
|
92
|
+
joinedAt?: string;
|
|
93
|
+
token?: string;
|
|
94
|
+
tokenId?: string;
|
|
95
|
+
}): {
|
|
96
|
+
mesh: LocalMeshEntry;
|
|
97
|
+
meshHost: RepoMeshHostMetadata;
|
|
98
|
+
} | undefined;
|
|
35
99
|
export interface AddNodeOptions {
|
|
36
100
|
workspace: string;
|
|
37
101
|
repoRoot?: string;
|
|
@@ -42,6 +106,7 @@ export interface AddNodeOptions {
|
|
|
42
106
|
isLocalWorktree?: boolean;
|
|
43
107
|
worktreeBranch?: string;
|
|
44
108
|
clonedFromNodeId?: string;
|
|
109
|
+
role?: RepoMeshDaemonRole;
|
|
45
110
|
}
|
|
46
111
|
export declare function addNode(meshId: string, opts: AddNodeOptions): LocalMeshNodeEntry | undefined;
|
|
47
112
|
export declare function removeNode(meshId: string, nodeId: string): boolean;
|
|
@@ -42,6 +42,7 @@ export interface GitPushResult extends GitRepoIdentity {
|
|
|
42
42
|
export interface GitCommandServices {
|
|
43
43
|
getStatus?: (params: {
|
|
44
44
|
workspace: string;
|
|
45
|
+
refreshUpstream?: boolean;
|
|
45
46
|
}) => Promise<GitRepoStatus> | GitRepoStatus;
|
|
46
47
|
getDiffSummary?: (params: {
|
|
47
48
|
workspace: string;
|
package/dist/git/git-status.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ export interface GitStatusOptions {
|
|
|
5
5
|
includeSubmodules?: boolean;
|
|
6
6
|
/** Optional filter to exclude specific submodule paths from status */
|
|
7
7
|
submoduleIgnorePaths?: string[];
|
|
8
|
+
/**
|
|
9
|
+
* When true, refresh the tracked remote before trusting ahead/behind.
|
|
10
|
+
* Callers should opt into this only for convergence-critical surfaces.
|
|
11
|
+
*/
|
|
12
|
+
refreshUpstream?: boolean;
|
|
8
13
|
}
|
|
9
14
|
export declare function getGitRepoStatus(workspace: string, options?: GitStatusOptions): Promise<GitRepoStatus>;
|
|
10
15
|
interface ParsedPorcelainStatus {
|
package/dist/git/git-types.d.ts
CHANGED
|
@@ -27,11 +27,18 @@ export interface GitSubmoduleStatus {
|
|
|
27
27
|
/** Error message if submodule status could not be read */
|
|
28
28
|
error?: string;
|
|
29
29
|
}
|
|
30
|
+
export type GitUpstreamFreshness = 'fresh' | 'unchecked' | 'stale' | 'no_upstream' | 'unavailable';
|
|
30
31
|
export interface GitRepoStatus extends GitRepoIdentity {
|
|
31
32
|
branch: string | null;
|
|
32
33
|
headCommit: string | null;
|
|
33
34
|
headMessage: string | null;
|
|
34
35
|
upstream: string | null;
|
|
36
|
+
/** Whether ahead/behind was verified against a freshly fetched upstream ref. */
|
|
37
|
+
upstreamStatus: GitUpstreamFreshness;
|
|
38
|
+
/** Timestamp for the fetch that refreshed upstream refs when upstreamStatus === 'fresh'. */
|
|
39
|
+
upstreamFetchedAt?: number;
|
|
40
|
+
/** Error from the last refresh attempt when upstreamStatus === 'stale'. */
|
|
41
|
+
upstreamFetchError?: string;
|
|
35
42
|
ahead: number;
|
|
36
43
|
behind: number;
|
|
37
44
|
staged: number;
|
|
@@ -105,6 +112,9 @@ export interface GitCompactSummary {
|
|
|
105
112
|
isGitRepo: boolean;
|
|
106
113
|
repoRoot: string | null;
|
|
107
114
|
branch: string | null;
|
|
115
|
+
upstreamStatus: GitUpstreamFreshness;
|
|
116
|
+
upstreamFetchedAt?: number;
|
|
117
|
+
upstreamFetchError?: string;
|
|
108
118
|
dirty: boolean;
|
|
109
119
|
changedFiles: number;
|
|
110
120
|
ahead: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export type { ChatBubbleState, ChatMessage, ExtensionInfo, CommandResult as CoreCommandResult, ProviderConfig, DaemonEvent, StatusResponse, SystemInfo, DetectedIde, ProviderInfo, AgentEntry, } from './types.js';
|
|
7
7
|
export type { SessionEntry, CompactSessionEntry, CompactDaemonEntry, CloudDaemonSummaryEntry, DashboardBootstrapDaemonEntry, VersionUpdateReason, CloudStatusReportPayload, DaemonStatusEventPayload, DashboardStatusEventPayload, SessionTransport, SessionKind, SessionCapability, AgentSessionStream, ReadChatCursor, ReadChatSyncResult, TransportTopic, SessionChatTailSubscriptionParams, SessionRuntimeOutputSubscriptionParams, MachineRuntimeSubscriptionParams, SessionHostDiagnosticsSubscriptionParams, SessionModalSubscriptionParams, DaemonMetadataSubscriptionParams, WorkspaceGitSubscriptionParams, SessionChatTailUpdate, MachineRuntimeUpdate, SessionHostDiagnosticsUpdate, SessionModalUpdate, DaemonMetadataUpdate, TopicUpdateEnvelope, SubscribeRequest, UnsubscribeRequest, StandaloneWsStatusPayload, AvailableProviderInfo, AcpConfigOption, AcpMode, ProviderControlSchema, StatusReportPayload, MachineInfo, SessionHostDiagnosticsSnapshot, SessionHostRecord, SessionHostWriteOwner, SessionHostAttachedClient, SessionHostLogEntry, SessionHostRequestTrace, SessionHostRuntimeTransition, DetectedIdeInfo, WorkspaceEntry, ProviderSummaryItem, ProviderSummaryMetadata, ProviderState, ProviderStatus, ProviderErrorReason, SessionActiveChatData, ActiveChatData, IdeProviderState, CliProviderState, AcpProviderState, ExtensionProviderState, MessageInputSupport, InputMediaStrategyDescriptor, InputAttachmentStrategy, InputMediaType, } from './shared-types.js';
|
|
8
|
-
export type { RepoMesh, RepoMeshNode, RepoMeshNodeHealth, RepoMeshPolicy, RepoMeshNodePolicy, RepoMeshRelatedRepo, RepoMeshNodeCapabilities, DetectedCommand, ProjectContextSnapshot, ProjectContextSource, RepoMeshCoordinatorConfig, LocalMeshConfig, LocalMeshEntry, LocalMeshNodeEntry, RepoMeshStatus, RepoMeshNodeStatus, } from './repo-mesh-types.js';
|
|
8
|
+
export type { RepoMesh, RepoMeshDaemonRole, RepoMeshHostMetadata, RepoMeshHostPairingMetadata, RepoMeshHostStatus, RepoMeshNode, RepoMeshNodeHealth, RepoMeshPolicy, RepoMeshNodePolicy, RepoMeshRelatedRepo, RepoMeshNodeCapabilities, DetectedCommand, ProjectContextSnapshot, ProjectContextSource, RepoMeshCoordinatorConfig, LocalMeshConfig, LocalMeshEntry, LocalMeshNodeEntry, RepoMeshStatus, RepoMeshNodeStatus, RepoMeshSessionStatus, RepoMeshQueueTask, RepoMeshQueueTaskStatus, RepoMeshQueueSummary, RepoMeshQueueStatus, RepoMeshLedgerEntryStatus, RepoMeshLedgerSummaryStatus, RepoMeshLedgerStatus, } from './repo-mesh-types.js';
|
|
9
9
|
export { DEFAULT_MESH_POLICY } from './repo-mesh-types.js';
|
|
10
10
|
export * from './git/index.js';
|
|
11
11
|
import type { RuntimeWriteOwner as _RuntimeWriteOwner } from './shared-types-extra.js';
|
|
@@ -30,6 +30,8 @@ export { listMeshes, getMesh, getMeshByRepo, createMesh, updateMesh, deleteMesh,
|
|
|
30
30
|
export type { CreateMeshOptions, UpdateMeshOptions, AddNodeOptions } from './config/mesh-config.js';
|
|
31
31
|
export { buildCoordinatorSystemPrompt } from './mesh/coordinator-prompt.js';
|
|
32
32
|
export type { CoordinatorPromptContext } from './mesh/coordinator-prompt.js';
|
|
33
|
+
export { MESH_REFINE_CONFIG_LOCATIONS, MESH_REFINE_CONFIG_SCHEMA, loadMeshRefineConfig, resolveMeshRefineValidationPlan, suggestMeshRefineConfig, validateMeshRefineConfig, } from './mesh/refine-config.js';
|
|
34
|
+
export type { MeshRefineValidationCategory, MeshRefineValidationCommandPlan, MeshRefineValidationPlan, RepoMeshRefineConfig, RepoMeshRefineValidationCommandConfig, } from './mesh/refine-config.js';
|
|
33
35
|
export { syncMeshes } from './mesh/mesh-sync.js';
|
|
34
36
|
export type { MeshSyncTransport, MeshSyncResult, RemoteMeshRecord } from './mesh/mesh-sync.js';
|
|
35
37
|
export { appendLedgerEntry, appendRemoteLedgerEntries, readLedgerEntries, readLedgerSlice, getLedgerSummary, getLedgerDir, getSessionRecoveryContext, MAX_LEDGER_SLICE_LIMIT } from './mesh/mesh-ledger.js';
|
|
@@ -37,8 +39,9 @@ export type { AppendRemoteLedgerResult, MeshLedgerEntry, MeshLedgerKind, MeshLed
|
|
|
37
39
|
export { buildMeshLedgerReconciliationEvidence, buildMeshLedgerReplicaEvidence } from './mesh/mesh-ledger-reconciliation.js';
|
|
38
40
|
export type { MeshLedgerReconciliationEvidence, MeshLedgerReplicaEvidence, MeshLedgerReplicaStatus } from './mesh/mesh-ledger-reconciliation.js';
|
|
39
41
|
export { enqueueTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus, cancelTask, requeueTask, getMeshQueueStats } from './mesh/mesh-work-queue.js';
|
|
40
|
-
export type { MeshWorkQueueEntry, MeshTaskStatus, MeshWorkQueueStats } from './mesh/mesh-work-queue.js';
|
|
41
|
-
export {
|
|
42
|
+
export type { MeshWorkQueueEntry, MeshTaskStatus, MeshWorkQueueStats, MeshQueueMutationOptions } from './mesh/mesh-work-queue.js';
|
|
43
|
+
export { buildMeshHostRequiredFailure, createDefaultMeshHostMetadata, isMeshHostOwner, normalizeMeshDaemonRole, requireMeshHostQueueOwner, resolveMeshHostStatus } from './mesh/mesh-host-ownership.js';
|
|
44
|
+
export { triggerMeshQueue, drainPendingMeshCoordinatorEvents, getPendingMeshCoordinatorEvents, clearPendingMeshCoordinatorEvents, queuePendingMeshCoordinatorEvent } from './mesh/mesh-events.js';
|
|
42
45
|
export type { PendingMeshCoordinatorEvent } from './mesh/mesh-events.js';
|
|
43
46
|
export { P2pRelayFailureError, buildP2pRelayFailurePayload, classifyP2pRelayFailure, isP2pRelayTransportFailure, } from './mesh/p2p-relay-failure.js';
|
|
44
47
|
export type { P2pRelayFailureClassification, P2pRelayFailureCode, P2pRelayFailureContext, P2pRelayFailurePayload, } from './mesh/p2p-relay-failure.js';
|