@adhdev/daemon-core 0.9.82-rc.261 → 0.9.82-rc.263
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/build-info.d.ts +37 -0
- package/dist/commands/router.d.ts +116 -0
- package/dist/git/git-status.d.ts +7 -0
- package/dist/git/git-types.d.ts +19 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +971 -69
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +967 -69
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-active-work.d.ts +18 -0
- package/dist/mesh/mesh-fast-forward.d.ts +41 -1
- package/dist/mesh/mesh-ledger.d.ts +1 -1
- package/dist/mesh/mesh-runtime-store.d.ts +6 -0
- package/dist/mesh/mesh-work-queue.d.ts +6 -0
- package/package.json +1 -1
- package/src/build-info.ts +73 -0
- package/src/commands/router.ts +805 -9
- package/src/git/git-status.ts +73 -1
- package/src/git/git-types.ts +20 -0
- package/src/index.ts +5 -2
- package/src/mesh/mesh-active-work.ts +31 -0
- package/src/mesh/mesh-fast-forward.ts +418 -17
- package/src/mesh/mesh-ledger.ts +1 -0
- package/src/mesh/mesh-runtime-store.ts +19 -0
- package/src/mesh/mesh-work-queue.ts +13 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Daemon build stamp — single runtime source for "which commit is this running
|
|
3
|
+
* daemon built from?".
|
|
4
|
+
*
|
|
5
|
+
* The values are injected at BUILD time via tsup `define` (esbuild global
|
|
6
|
+
* replacement). Every build config that bundles daemon-core into a shippable
|
|
7
|
+
* daemon (daemon-core's own dist, daemon-standalone, daemon-cloud) replaces
|
|
8
|
+
* these `__DAEMON_BUILD_*` identifiers with the literal git commit/version that
|
|
9
|
+
* was current when the bundle was produced. See:
|
|
10
|
+
* - oss/packages/daemon-core/tsup.config.ts (standalone consumes this dist)
|
|
11
|
+
* - packages/daemon-cloud/tsup.config.ts (re-bundles daemon-core from source)
|
|
12
|
+
*
|
|
13
|
+
* If a bundle is produced WITHOUT the define (e.g. running src directly through
|
|
14
|
+
* tsx in dev, or a build env without git), the identifiers stay undefined and
|
|
15
|
+
* we fall back to `"unknown"` — never a ReferenceError, never a build failure.
|
|
16
|
+
*
|
|
17
|
+
* IMPORTANT (live-reflection caveat): a fresh local `daemon-core dist` rebuild +
|
|
18
|
+
* daemon restart is NOT enough to make a *cloud* daemon report a new commit —
|
|
19
|
+
* daemon-cloud ships its own re-bundle of daemon-core, so the build stamp only
|
|
20
|
+
* advances after the cloud daemon is rebuilt/redeployed and restarted. This is
|
|
21
|
+
* precisely the gap `mesh_status`'s `staleDaemonBuild` warning exists to surface.
|
|
22
|
+
*/
|
|
23
|
+
export interface DaemonBuildInfo {
|
|
24
|
+
/** Full 40-char git commit the daemon bundle was built from, or 'unknown'. */
|
|
25
|
+
commit: string;
|
|
26
|
+
/** Short (7-char) form of the same commit, or 'unknown'. */
|
|
27
|
+
commitShort: string;
|
|
28
|
+
/** package.json version baked in at build time, or 'unknown'. */
|
|
29
|
+
version: string;
|
|
30
|
+
/** ISO build timestamp if the build config injected one. */
|
|
31
|
+
builtAt?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Resolve the build stamp baked into the running daemon bundle. Pure read of
|
|
35
|
+
* build-time constants — no I/O, safe to call from any runtime path. Cached.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getDaemonBuildInfo(): DaemonBuildInfo;
|
|
@@ -15,6 +15,87 @@ import type { ProviderLoader } from '../providers/provider-loader.js';
|
|
|
15
15
|
import type { ProviderInstanceManager } from '../providers/provider-instance-manager.js';
|
|
16
16
|
import { SessionRegistry } from '../sessions/registry.js';
|
|
17
17
|
export declare function readCachedInlineMeshActiveSessionDetails(node: any): Array<Record<string, unknown>>;
|
|
18
|
+
type MeshRefineStageStatus = 'passed' | 'failed' | 'skipped';
|
|
19
|
+
type MeshRefineEffectiveDiffSummary = {
|
|
20
|
+
status: MeshRefineStageStatus;
|
|
21
|
+
/** True when there is at least one root-tree change between base and branch (incl. gitlink bumps). */
|
|
22
|
+
hasEffectiveDiff: boolean;
|
|
23
|
+
baseHead: string;
|
|
24
|
+
branchHead: string;
|
|
25
|
+
/** Root-level paths that differ between base and branch (capped). */
|
|
26
|
+
changedPaths?: string[];
|
|
27
|
+
/** Submodule paths with uncommitted/divergent commits but NO committed gitlink bump in the root tree. */
|
|
28
|
+
submoduleHints?: Array<{
|
|
29
|
+
path: string;
|
|
30
|
+
reason: string;
|
|
31
|
+
}>;
|
|
32
|
+
durationMs: number;
|
|
33
|
+
error?: string;
|
|
34
|
+
stdout?: string;
|
|
35
|
+
stderr?: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* No-op guard: detect a "silent no-op" merge before the Refinery merge runs.
|
|
39
|
+
*
|
|
40
|
+
* A silent no-op occurs when the refine target branch's ROOT tree is byte-identical
|
|
41
|
+
* to the merge base (origin/main). This is the trap where a submodule (e.g. oss) has
|
|
42
|
+
* real commits but the root branch never committed the gitlink (oss-pointer) bump, so
|
|
43
|
+
* the root diff Refinery would merge is empty. Merging that produces a merge commit with
|
|
44
|
+
* no content change — reported as "success" while the actual work never reaches main.
|
|
45
|
+
*
|
|
46
|
+
* A committed gitlink bump (the legitimate oss-pointer bump) DOES show up in the root
|
|
47
|
+
* tree diff (as a 160000-mode entry), so this guard does NOT block legitimate refines —
|
|
48
|
+
* it only fires when the root tree diff vs base is COMPLETELY empty.
|
|
49
|
+
*
|
|
50
|
+
* Runs after the patch-equivalence gate; the "already merged via other path" case
|
|
51
|
+
* (branch has real changes already present in base) is handled upstream and never
|
|
52
|
+
* reaches here, so an empty root diff at this point is genuinely a no-op.
|
|
53
|
+
*/
|
|
54
|
+
export declare function runMeshRefineEffectiveDiffGate(repoRoot: string, baseHead: string, branchHead: string): Promise<MeshRefineEffectiveDiffSummary>;
|
|
55
|
+
/**
|
|
56
|
+
* Result of evaluating whether a `git merge-tree --write-tree` submodule
|
|
57
|
+
* conflict is in fact a trivial gitlink fast-forward that should pass the
|
|
58
|
+
* patch-equivalence gate.
|
|
59
|
+
*
|
|
60
|
+
* `git merge-tree` (and `git merge` with the default recursive strategy)
|
|
61
|
+
* refuses to 3-way merge gitlinks unless the case is "trivial" — and it
|
|
62
|
+
* treats *any* gitlink that differs across merge-base/base/branch as
|
|
63
|
+
* non-trivial, even when the branch-side commit is a strict descendant of the
|
|
64
|
+
* base-side commit (i.e. a real fast-forward). Refinery only ever wants to
|
|
65
|
+
* accept the branch's recorded gitlink, so a fast-forwardable bump is safe to
|
|
66
|
+
* resolve to the branch side without any conflict.
|
|
67
|
+
*/
|
|
68
|
+
type GitlinkTrivialFastForwardEvaluation = {
|
|
69
|
+
/** True only when the merge-tree conflict is *fully* explained by trivial-ff gitlinks. */
|
|
70
|
+
trivial: boolean;
|
|
71
|
+
/** Why the evaluation declined to treat the conflict as trivial (set when trivial=false). */
|
|
72
|
+
reason?: string;
|
|
73
|
+
/** Per-path detail for the changed gitlinks that were inspected. */
|
|
74
|
+
gitlinks: Array<{
|
|
75
|
+
path: string;
|
|
76
|
+
baseCommit?: string;
|
|
77
|
+
branchCommit?: string;
|
|
78
|
+
fastForward: boolean;
|
|
79
|
+
}>;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Decide whether a merge-tree submodule conflict between base and branch is a
|
|
83
|
+
* trivial gitlink fast-forward (and nothing else).
|
|
84
|
+
*
|
|
85
|
+
* The conflict is treated as trivial ONLY when:
|
|
86
|
+
* 1. at least one changed gitlink exists,
|
|
87
|
+
* 2. every changed gitlink fast-forwards (base-commit is an ancestor of the
|
|
88
|
+
* branch-commit inside that submodule's repo), and
|
|
89
|
+
* 3. the *only* paths that changed on both sides of the merge (i.e. the paths
|
|
90
|
+
* that could possibly produce a 3-way conflict — the intersection of
|
|
91
|
+
* mergeBase→base and mergeBase→branch changes) are gitlinks. Any
|
|
92
|
+
* overlapping non-gitlink path means a genuine content conflict could be
|
|
93
|
+
* hiding behind the submodule failure, so we keep the block.
|
|
94
|
+
*
|
|
95
|
+
* If any of these fail, the conflict is left as a genuine block. This never
|
|
96
|
+
* passes a regular-file conflict or a diverged (non-ff) gitlink.
|
|
97
|
+
*/
|
|
98
|
+
export declare function evaluateGitlinkTrivialFastForward(repoRoot: string, baseHead: string, branchHead: string): GitlinkTrivialFastForwardEvaluation;
|
|
18
99
|
export interface SessionHostControlPlane {
|
|
19
100
|
getDiagnostics(payload?: {
|
|
20
101
|
includeSessions?: boolean;
|
|
@@ -96,6 +177,10 @@ export declare class DaemonCommandRouter {
|
|
|
96
177
|
private runningRefineJobs;
|
|
97
178
|
/** Terminal async Refinery jobs preserve a clear answer after the worktree node has been removed. */
|
|
98
179
|
private terminalRefineJobs;
|
|
180
|
+
/** In-memory async batch Refinery jobs keyed by meshId (one batch convergence per mesh at a time). */
|
|
181
|
+
private runningRefineBatchJobs;
|
|
182
|
+
/** Terminal async batch Refinery jobs preserve the last batch outcome for late readers. */
|
|
183
|
+
private terminalRefineBatchJobs;
|
|
99
184
|
constructor(deps: CommandRouterDeps);
|
|
100
185
|
private cloneJsonValue;
|
|
101
186
|
private hydrateCachedAggregateMeshStatusFromInline;
|
|
@@ -154,6 +239,36 @@ export declare class DaemonCommandRouter {
|
|
|
154
239
|
* isolated as blocked_review while the rest of the batch proceeds.
|
|
155
240
|
*/
|
|
156
241
|
private batchRefineMeshNodes;
|
|
242
|
+
/**
|
|
243
|
+
* Convergence core shared by the synchronous batch entry and the async batch job.
|
|
244
|
+
* Refines each node in order: the per-node refine pipeline fetches origin/<base>
|
|
245
|
+
* fresh, so each merged sibling advances the base before the next node's auto-rebase
|
|
246
|
+
* + patch-equivalence re-check. A blocked/failed node is isolated; the batch
|
|
247
|
+
* continues with the remaining nodes. Does NOT touch the per-node merge logic — it
|
|
248
|
+
* only sequences calls to executeMeshRefineNodeSynchronously and aggregates outcomes.
|
|
249
|
+
*/
|
|
250
|
+
private runMeshRefineBatchConvergence;
|
|
251
|
+
private buildRefineBatchJobKey;
|
|
252
|
+
private buildRefineBatchJobHandle;
|
|
253
|
+
/**
|
|
254
|
+
* Emit a batch Refinery terminal/accepted event through the SAME pending-event +
|
|
255
|
+
* forward mechanism single-node refine uses (queueRefineJobEvent), so the
|
|
256
|
+
* coordinator's existing refine:accepted/completed/failed handling and message
|
|
257
|
+
* renderer apply unchanged. The aggregate per-node results ride along in `result`.
|
|
258
|
+
*/
|
|
259
|
+
private queueRefineBatchJobEvent;
|
|
260
|
+
private appendRefineBatchJobLedger;
|
|
261
|
+
private finishMeshRefineBatchJob;
|
|
262
|
+
/**
|
|
263
|
+
* Async entry for the batch Refinery execute path. Mirrors startMeshRefineJob:
|
|
264
|
+
* resolves the plan synchronously (so target/ordering errors and the dry-run shape
|
|
265
|
+
* stay synchronous), then for execute=true registers an in-flight batch job, returns
|
|
266
|
+
* {async:true, status:'accepted', batch:true, ...plan} immediately, and runs the
|
|
267
|
+
* convergence loop in the background — emitting the same terminal refine event.
|
|
268
|
+
* Idempotent: a batch already in flight for this mesh returns the running handle
|
|
269
|
+
* with duplicate:true rather than spawning a second background job.
|
|
270
|
+
*/
|
|
271
|
+
private startMeshRefineBatchJob;
|
|
157
272
|
private finishMeshRefineJob;
|
|
158
273
|
private startMeshRefineJob;
|
|
159
274
|
/**
|
|
@@ -166,3 +281,4 @@ export declare class DaemonCommandRouter {
|
|
|
166
281
|
*/
|
|
167
282
|
private stopIde;
|
|
168
283
|
}
|
|
284
|
+
export {};
|
package/dist/git/git-status.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { GitRepoStatus } from './git-types.js';
|
|
2
|
+
import { type DaemonBuildInfo } from '../build-info.js';
|
|
2
3
|
export interface GitStatusOptions {
|
|
3
4
|
timeoutMs?: number;
|
|
4
5
|
/** When true, include submodule status in the result. Defaults to true. */
|
|
@@ -10,6 +11,12 @@ export interface GitStatusOptions {
|
|
|
10
11
|
* Callers should opt into this only for convergence-critical surfaces.
|
|
11
12
|
*/
|
|
12
13
|
refreshUpstream?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Test/override seam for the daemon build stamp used by the stale-build
|
|
16
|
+
* detector. Production callers omit this so the real baked-in build commit
|
|
17
|
+
* (getDaemonBuildInfo) is used.
|
|
18
|
+
*/
|
|
19
|
+
daemonBuildInfo?: DaemonBuildInfo;
|
|
13
20
|
}
|
|
14
21
|
export declare function getGitRepoStatus(workspace: string, options?: GitStatusOptions): Promise<GitRepoStatus>;
|
|
15
22
|
interface ParsedPorcelainStatus {
|
package/dist/git/git-types.d.ts
CHANGED
|
@@ -54,9 +54,28 @@ export interface GitRepoStatus extends GitRepoIdentity {
|
|
|
54
54
|
lastCheckedAt: number;
|
|
55
55
|
/** Submodule statuses when auto-discover is enabled */
|
|
56
56
|
submodules?: GitSubmoduleStatus[];
|
|
57
|
+
/**
|
|
58
|
+
* Set when the running daemon's build commit is a STRICT ancestor of this
|
|
59
|
+
* repo's HEAD (or a submodule HEAD) — i.e. the live daemon predates committed
|
|
60
|
+
* code in this workspace and is awaiting a deploy/restart to catch up.
|
|
61
|
+
* Omitted entirely when no staleness is provable (unknown build, commit not
|
|
62
|
+
* present in repo, or build commit == HEAD) to avoid over-warning.
|
|
63
|
+
*/
|
|
64
|
+
daemonBuildBehind?: DaemonBuildBehind;
|
|
57
65
|
error?: string;
|
|
58
66
|
reason?: GitFailureReason;
|
|
59
67
|
}
|
|
68
|
+
export interface DaemonBuildBehind {
|
|
69
|
+
/** Full build commit baked into the running daemon. */
|
|
70
|
+
buildCommit: string;
|
|
71
|
+
/** Short build commit. */
|
|
72
|
+
buildCommitShort: string;
|
|
73
|
+
/** HEAD commit the build commit is behind (repo or submodule). */
|
|
74
|
+
head: string;
|
|
75
|
+
/** Where the comparison matched: 'root' or the submodule path. */
|
|
76
|
+
scope: string;
|
|
77
|
+
warning: string;
|
|
78
|
+
}
|
|
60
79
|
export type GitFileChangeStatus = 'added' | 'modified' | 'deleted' | 'renamed' | 'copied' | 'untracked' | 'conflict';
|
|
61
80
|
export interface GitFileChange {
|
|
62
81
|
path: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -49,9 +49,10 @@ export { fastForwardMeshNode } from './mesh/mesh-fast-forward.js';
|
|
|
49
49
|
export type { MeshFastForwardNodeArgs, MeshFastForwardPlannedStep, MeshFastForwardResult } from './mesh/mesh-fast-forward.js';
|
|
50
50
|
export { buildMeshLedgerReconciliationEvidence, buildMeshLedgerReplicaEvidence } from './mesh/mesh-ledger-reconciliation.js';
|
|
51
51
|
export type { AnyLedgerSlice, MeshLedgerReconciliationEvidence, MeshLedgerReplicaEvidence, MeshLedgerReplicaStatus } from './mesh/mesh-ledger-reconciliation.js';
|
|
52
|
-
export { enqueueTask, recordDirectDispatchTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus, cancelTask, requeueTask, getMeshQueueStats, getMeshQueueRevision, normalizeMeshTaskMode, validateMeshTaskModeRequest, buildMeshNodeCapabilityTags, nodeSatisfiesRequiredTags, normalizeMeshCapabilityTags, insertDirectDispatch, getActiveDirectDispatches, updateDirectDispatchStatus, cleanupTerminalDirectDispatches, markStaleDirectDispatches, recordMeshToolCall, assertNoDependencyCycle, hasPendingDependents, describeTaskDependencyState } from './mesh/mesh-work-queue.js';
|
|
52
|
+
export { enqueueTask, recordDirectDispatchTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus, cancelTask, requeueTask, getMeshQueueStats, getMeshQueueRevision, normalizeMeshTaskMode, validateMeshTaskModeRequest, buildMeshNodeCapabilityTags, nodeSatisfiesRequiredTags, normalizeMeshCapabilityTags, insertDirectDispatch, getActiveDirectDispatches, updateDirectDispatchStatus, cleanupTerminalDirectDispatches, markStaleDirectDispatches, deleteDirectDispatchesByTaskId, recordMeshToolCall, assertNoDependencyCycle, hasPendingDependents, describeTaskDependencyState } from './mesh/mesh-work-queue.js';
|
|
53
53
|
export type { MeshWorkQueueEntry, MeshTaskStatus, MeshTaskMode, MeshWorkQueueStats, MeshQueueMutationOptions, MeshTaskModeValidationResult, DirectDispatchRecord, MeshToolCallRateResult } from './mesh/mesh-work-queue.js';
|
|
54
|
-
export { buildCompactStaleDirectWorkSummary, buildMeshActiveWork, buildMeshActiveWorkSummary } from './mesh/mesh-active-work.js';
|
|
54
|
+
export { buildCompactStaleDirectWorkSummary, buildMeshActiveWork, buildMeshActiveWorkSummary, classifyStaleDirectForPrune, PRUNABLE_ORPHAN_STALE_REASONS } from './mesh/mesh-active-work.js';
|
|
55
|
+
export type { StaleDirectPruneClassification } from './mesh/mesh-active-work.js';
|
|
55
56
|
export type { MeshActiveWorkRecord, MeshActiveWorkStatus, MeshActiveWorkSummary, MeshActiveWorkSource, MeshStaleDirectWorkSummary } from './mesh/mesh-active-work.js';
|
|
56
57
|
export { buildMeshAsyncRefineJobs, summarizeMeshAsyncRefineJobs, STALE_TERMINAL_REFINE_WINDOW_MS, RECENT_TERMINAL_REFINE_CAP } from './mesh/mesh-refine-status.js';
|
|
57
58
|
export type { MeshAsyncRefineJobStatus, MeshAsyncRefineJobSummary, MeshAsyncRefineJobsSummary } from './mesh/mesh-refine-status.js';
|
|
@@ -87,6 +88,8 @@ export type { DaemonUpgradeHelperPayload, CurrentGlobalInstallSurface, PinnedGlo
|
|
|
87
88
|
export { DaemonStatusReporter } from './status/reporter.js';
|
|
88
89
|
export { buildSessionEntries, findCdpManager, hasCdpManager, isCdpConnected } from './status/builders.js';
|
|
89
90
|
export { buildStatusSnapshot, buildMachineInfo } from './status/snapshot.js';
|
|
91
|
+
export { getDaemonBuildInfo } from './build-info.js';
|
|
92
|
+
export type { DaemonBuildInfo } from './build-info.js';
|
|
90
93
|
export { normalizeManagedStatus, isManagedStatusWorking, isManagedStatusWaiting, normalizeActiveChatData } from './status/normalize.js';
|
|
91
94
|
export type { ManagedStatus } from './status/normalize.js';
|
|
92
95
|
export type { StatusSnapshotOptions, StatusSnapshot } from './status/snapshot.js';
|