@adhdev/daemon-core 0.9.82-rc.454 → 0.9.82-rc.455
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/commands/router-refine.d.ts +137 -0
- package/dist/commands/router-worktree-cleanup.d.ts +133 -0
- package/dist/commands/router.d.ts +103 -151
- package/dist/index.js +2962 -2877
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2962 -2877
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-event-classify.d.ts +2 -0
- package/dist/mesh/worktree-bootstrap-config.d.ts +20 -0
- package/package.json +3 -3
- package/src/commands/med-family/cli-agent.ts +26 -23
- package/src/commands/router-refine.ts +1698 -0
- package/src/commands/router-worktree-cleanup.ts +870 -0
- package/src/commands/router.ts +59 -2452
- package/src/mesh/mesh-active-work.ts +11 -2
- package/src/mesh/mesh-event-classify.ts +22 -0
- package/src/mesh/mesh-event-forwarding.ts +36 -0
- package/src/mesh/mesh-queue-assignment.ts +38 -11
- package/src/mesh/mesh-reconcile-loop.ts +174 -4
- package/src/mesh/mesh-runtime-store.ts +27 -13
- package/src/mesh/worktree-bootstrap-config.ts +19 -0
|
@@ -3,3 +3,5 @@ export declare const EVENT_TO_LEDGER_KIND: Record<string, MeshLedgerKind>;
|
|
|
3
3
|
export declare function isMeshCoordinatorEvent(eventName: unknown): eventName is string;
|
|
4
4
|
export declare const MESH_FORCE_INJECT_EVENTS: ReadonlySet<string>;
|
|
5
5
|
export declare function shouldForceInjectMeshEvent(eventName: unknown): boolean;
|
|
6
|
+
export declare const MESH_APPROVAL_EVENTS: ReadonlySet<string>;
|
|
7
|
+
export declare function isMeshApprovalEvent(eventName: unknown): boolean;
|
|
@@ -38,6 +38,26 @@ export declare function isWorktreeBootstrapStaleRunning(node: {
|
|
|
38
38
|
};
|
|
39
39
|
workspace?: string;
|
|
40
40
|
} | undefined, nowMs?: number): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* COMPLETION-PROPAGATION F7 (C2): the single shared consume-ready / bootstrap-pending defer
|
|
43
|
+
* predicate. A task must NOT be injected into a worktree node whose bootstrap is still 'running'
|
|
44
|
+
* — the provider is not yet ready to consume input, so the inject lands in the input buffer and
|
|
45
|
+
* is silently swallowed (empty session). Both the remote dispatch guard (the router agent_command
|
|
46
|
+
* handler) and the local queue-claim gate (tryAssignQueueTask) route through THIS predicate so
|
|
47
|
+
* they agree on exactly when to defer. Returns true = defer. The stale-'running' backstop
|
|
48
|
+
* (isWorktreeBootstrapStaleRunning) is honored here too: a 'running' state far older than any real
|
|
49
|
+
* bootstrap whose worktree is git-clean is treated as silently complete (do NOT defer), so a node
|
|
50
|
+
* whose terminal stamp never reached this daemon is not stranded forever.
|
|
51
|
+
*/
|
|
52
|
+
export declare function shouldDeferDispatchForBootstrap(node: {
|
|
53
|
+
worktreeBootstrap?: {
|
|
54
|
+
status?: string;
|
|
55
|
+
startedAt?: string;
|
|
56
|
+
updatedAt?: string;
|
|
57
|
+
completedAt?: string;
|
|
58
|
+
};
|
|
59
|
+
workspace?: string;
|
|
60
|
+
} | undefined, nowMs?: number): boolean;
|
|
41
61
|
export interface WorktreeBootstrapConfigLoadResult {
|
|
42
62
|
config?: RepoMeshWorktreeBootstrapConfig;
|
|
43
63
|
source: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adhdev/daemon-core",
|
|
3
|
-
"version": "0.9.82-rc.
|
|
3
|
+
"version": "0.9.82-rc.455",
|
|
4
4
|
"description": "ADHDev daemon core — CDP, IDE detection, providers, command execution",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"author": "vilmire",
|
|
47
47
|
"license": "AGPL-3.0-or-later",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@adhdev/mesh-shared": "0.9.82-rc.
|
|
50
|
-
"@adhdev/session-host-core": "0.9.82-rc.
|
|
49
|
+
"@adhdev/mesh-shared": "0.9.82-rc.455",
|
|
50
|
+
"@adhdev/session-host-core": "0.9.82-rc.455",
|
|
51
51
|
"@agentclientprotocol/sdk": "^0.16.1",
|
|
52
52
|
"ajv": "^8.20.0",
|
|
53
53
|
"ajv-formats": "^3.0.1",
|
|
@@ -114,32 +114,35 @@ export const cliAgentHandlers: Record<string, MedFamilyHandler> = {
|
|
|
114
114
|
if (isSendChat && dispatchNodeId && dispatchMeshId) {
|
|
115
115
|
try {
|
|
116
116
|
const { getMesh } = await import('../../config/mesh-config.js');
|
|
117
|
-
|
|
117
|
+
// COMPLETION-PROPAGATION F6 (C1 SSOT): read the router's synchronous inline mesh
|
|
118
|
+
// cache FIRST, falling back to getMesh only when the inline view has nothing. The
|
|
119
|
+
// inline cache is the authoritative bootstrap-status source — markWorktreeBootstrapTerminalState
|
|
120
|
+
// stamps 'complete'/'failed' into it SYNCHRONOUSLY, then persists to local config
|
|
121
|
+
// (what getMesh reads) via a DETACHED async import chain that lags. Reading getMesh
|
|
122
|
+
// first therefore observed a stale 'running' and deferred a dispatch whose worktree
|
|
123
|
+
// was already bootstrapped — the stale-'running' defer this eliminates. Inline-first
|
|
124
|
+
// makes the freshest single source of truth win for both the running and terminal states.
|
|
125
|
+
const meshObj = ctx.getCachedInlineMesh(dispatchMeshId) ?? getMesh(dispatchMeshId);
|
|
118
126
|
const nodeObj = Array.isArray(meshObj?.nodes)
|
|
119
127
|
? meshObj.nodes.find((n: any) => meshNodeIdMatches(n, dispatchNodeId))
|
|
120
128
|
: undefined;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
...(readStringValue(meshCtx?.taskId) ? { taskId: readStringValue(meshCtx?.taskId) } : {}),
|
|
139
|
-
error: `Node '${dispatchNodeId}' worktree bootstrap is still running; a task injected now would land in the session input buffer before the provider is ready to consume it and be silently lost. Dispatch deferred.`,
|
|
140
|
-
nextAction: 'Wait for the worktree_bootstrap_complete event (or poll mesh_status until the node session is ready), then re-send the task with mesh_send_task. Alternatively use mesh_enqueue_task so the queue auto-assigns it once a ready session is available.',
|
|
141
|
-
};
|
|
142
|
-
}
|
|
129
|
+
// COMPLETION-PROPAGATION F7 (C2): the single shared consume-ready/bootstrap-pending
|
|
130
|
+
// defer predicate (honors the stale-'running' git-clean backstop internally), reused
|
|
131
|
+
// by the local queue-claim gate too so remote and local dispatch agree on when to defer.
|
|
132
|
+
const { shouldDeferDispatchForBootstrap } = await import('../../mesh/worktree-bootstrap-config.js');
|
|
133
|
+
if (shouldDeferDispatchForBootstrap(nodeObj as any)) {
|
|
134
|
+
return {
|
|
135
|
+
success: false,
|
|
136
|
+
recoverable: true,
|
|
137
|
+
dispatched: false,
|
|
138
|
+
code: 'mesh_node_bootstrap_pending',
|
|
139
|
+
reason: 'bootstrap_still_running',
|
|
140
|
+
nodeId: dispatchNodeId,
|
|
141
|
+
meshId: dispatchMeshId,
|
|
142
|
+
...(readStringValue(meshCtx?.taskId) ? { taskId: readStringValue(meshCtx?.taskId) } : {}),
|
|
143
|
+
error: `Node '${dispatchNodeId}' worktree bootstrap is still running; a task injected now would land in the session input buffer before the provider is ready to consume it and be silently lost. Dispatch deferred.`,
|
|
144
|
+
nextAction: 'Wait for the worktree_bootstrap_complete event (or poll mesh_status until the node session is ready), then re-send the task with mesh_send_task. Alternatively use mesh_enqueue_task so the queue auto-assigns it once a ready session is available.',
|
|
145
|
+
};
|
|
143
146
|
}
|
|
144
147
|
} catch { /* best-effort — if the bootstrap probe fails, fall through and dispatch */ }
|
|
145
148
|
}
|