@adhdev/daemon-core 0.9.82-rc.376 → 0.9.82-rc.377
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/chat-commands-debug-bundle.d.ts +14 -0
- package/dist/commands/chat-commands-read.d.ts +7 -0
- package/dist/commands/chat-commands-scope.d.ts +39 -0
- package/dist/commands/chat-commands-shared.d.ts +33 -0
- package/dist/commands/chat-commands-write.d.ts +14 -0
- package/dist/commands/chat-commands.d.ts +9 -49
- package/dist/index.js +2976 -2943
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2971 -2938
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-event-classify.d.ts +5 -0
- package/dist/mesh/mesh-event-forwarding.d.ts +18 -0
- package/dist/mesh/mesh-events-coordinator.d.ts +4 -92
- package/dist/mesh/mesh-events-utils.d.ts +3 -0
- package/dist/mesh/mesh-ledger-reconciliation.d.ts +0 -1
- package/dist/mesh/mesh-queue-assignment.d.ts +86 -0
- package/dist/mesh/mesh-runtime-store.d.ts +0 -3
- package/dist/providers/native-history/constants.d.ts +12 -0
- package/dist/runtime-defaults.d.ts +2 -0
- package/package.json +2 -2
- package/src/commands/chat-commands-debug-bundle.ts +398 -0
- package/src/commands/chat-commands-read.ts +2327 -0
- package/src/commands/chat-commands-scope.ts +54 -0
- package/src/commands/chat-commands-shared.ts +114 -0
- package/src/commands/chat-commands-write.ts +880 -0
- package/src/commands/chat-commands.ts +20 -3697
- package/src/commands/router.ts +5 -12
- package/src/mesh/mesh-event-classify.ts +51 -0
- package/src/mesh/mesh-event-forwarding.ts +1502 -0
- package/src/mesh/mesh-events-coordinator.ts +30 -2993
- package/src/mesh/mesh-events-pending.ts +1 -10
- package/src/mesh/mesh-events-stale.ts +3 -14
- package/src/mesh/mesh-events-utils.ts +52 -14
- package/src/mesh/mesh-ledger-reconciliation.ts +0 -2
- package/src/mesh/mesh-queue-assignment.ts +1457 -0
- package/src/mesh/mesh-runtime-store.ts +0 -37
- package/src/providers/cli-provider-instance.ts +40 -1
- package/src/providers/native-history/constants.ts +19 -0
- package/src/providers/native-history/dispatcher.ts +2 -3
- package/src/providers/spec/native-history-executor.ts +1 -9
- package/src/runtime-defaults.ts +39 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { MeshLedgerKind } from './mesh-ledger.js';
|
|
2
|
+
export declare const EVENT_TO_LEDGER_KIND: Record<string, MeshLedgerKind>;
|
|
3
|
+
export declare function isMeshCoordinatorEvent(eventName: unknown): eventName is string;
|
|
4
|
+
export declare const MESH_FORCE_INJECT_EVENTS: ReadonlySet<string>;
|
|
5
|
+
export declare function shouldForceInjectMeshEvent(eventName: unknown): boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DaemonComponents } from '../boot/daemon-lifecycle.js';
|
|
2
|
+
export declare function resolveForwardEventMeshId(components: DaemonComponents, payload: Record<string, unknown>): string;
|
|
3
|
+
export declare function __resetMeshWorkspaceCacheForTests(): void;
|
|
4
|
+
export declare function buildRelayMetadataEvent(payload: Record<string, unknown>): Record<string, unknown>;
|
|
5
|
+
export declare function handleMeshForwardEvent(components: DaemonComponents, payload: Record<string, unknown>): {
|
|
6
|
+
[extra: string]: unknown;
|
|
7
|
+
success: true;
|
|
8
|
+
forwarded: 0;
|
|
9
|
+
suppressed: true;
|
|
10
|
+
} | {
|
|
11
|
+
success: boolean;
|
|
12
|
+
forwarded: number;
|
|
13
|
+
error?: undefined;
|
|
14
|
+
} | {
|
|
15
|
+
success: boolean;
|
|
16
|
+
error: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function setupMeshEventForwarding(components: DaemonComponents): void;
|
|
@@ -1,92 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export declare function __resetMeshWorkspaceCacheForTests(): void;
|
|
6
|
-
export declare function tryAssignQueueTask(components: DaemonComponents, meshId: string, nodeId: string, sessionId: string, providerType: string): boolean;
|
|
7
|
-
/** Active assignments that hold the one-active-per-node / global-parallel invariant
|
|
8
|
-
* (everything except read-only diagnoses, which run unbounded by the write cap). */
|
|
9
|
-
export declare function activeWriteAssignedCount(meshId: string): number;
|
|
10
|
-
/** Active read-only (live_debug_readonly) assignments, for the read-only safety cap. */
|
|
11
|
-
export declare function activeReadonlyAssignedCount(meshId: string): number;
|
|
12
|
-
/**
|
|
13
|
-
* Order eligible nodes for assignment per the mesh scheduling pipeline:
|
|
14
|
-
* PRIORITY (schedulingPriority desc) → TIE-BREAK (strategy).
|
|
15
|
-
*
|
|
16
|
-
* The caller has already applied the TAG hard-filter and is responsible for the
|
|
17
|
-
* MAX-ALLOC capacity gate (the per-node launch/claim checks). This function only
|
|
18
|
-
* decides the *preference order* among nodes that are otherwise eligible.
|
|
19
|
-
*
|
|
20
|
-
* - 'first_eligible' (default): returns the input order verbatim and does NOT touch
|
|
21
|
-
* the round-robin cursor — byte-for-byte the pre-feature behavior.
|
|
22
|
-
* - 'priority_only': schedulingPriority desc, then input order (load ignored).
|
|
23
|
-
* - 'least_loaded': schedulingPriority desc, then active load asc, then input order.
|
|
24
|
-
* - 'round_robin': same as least_loaded, but among nodes tied at (priority, load)
|
|
25
|
-
* the input order is rotated by a per-mesh cursor that advances once per pass.
|
|
26
|
-
*
|
|
27
|
-
* `nodes` carries the original config/array index so the tie-break can fall back to
|
|
28
|
-
* deterministic input order. `bumpCursor` advances the round-robin cursor exactly
|
|
29
|
-
* once per scheduling pass (only consulted for 'round_robin').
|
|
30
|
-
*/
|
|
31
|
-
interface RankableNode {
|
|
32
|
-
nodeId: string;
|
|
33
|
-
node: any;
|
|
34
|
-
index: number;
|
|
35
|
-
}
|
|
36
|
-
/** Test-only: the pure node-ordering stage (PRIORITY → TIE-BREAK). Exposed so the
|
|
37
|
-
* scheduling pipeline can be unit-tested without standing up live CLI sessions. */
|
|
38
|
-
export declare function __orderEligibleNodesForTests(meshId: string, strategy: RepoMeshSchedulingStrategy, nodes: RankableNode[], opts?: {
|
|
39
|
-
bumpCursor?: boolean;
|
|
40
|
-
}): RankableNode[];
|
|
41
|
-
export interface MeshQueueTriggerResult {
|
|
42
|
-
success: true;
|
|
43
|
-
meshId: string;
|
|
44
|
-
pendingBefore: number;
|
|
45
|
-
assignedBefore: number;
|
|
46
|
-
pendingAfter: number;
|
|
47
|
-
assignedAfter: number;
|
|
48
|
-
claimed: boolean;
|
|
49
|
-
newlyAssignedTasks: Array<{
|
|
50
|
-
id: string;
|
|
51
|
-
nodeId?: string;
|
|
52
|
-
sessionId?: string;
|
|
53
|
-
}>;
|
|
54
|
-
localIdleSessionsChecked: number;
|
|
55
|
-
remoteIdleSessionsChecked: number;
|
|
56
|
-
skippedSessions: Array<{
|
|
57
|
-
nodeId?: string;
|
|
58
|
-
sessionId?: string;
|
|
59
|
-
reason: string;
|
|
60
|
-
status?: string;
|
|
61
|
-
}>;
|
|
62
|
-
autoLaunchStarted: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* True when a worker session is already on its way to claim a still-pending task —
|
|
65
|
-
* either launched this tick (autoLaunchStarted) or launched on a prior tick and still
|
|
66
|
-
* booting/awaiting-claim. Callers MUST treat this as "wait, do not launch another
|
|
67
|
-
* session": a second launch double-edits the worktree. Mutually informative with
|
|
68
|
-
* `noIdleMeshSessionAvailable`, which is suppressed whenever this is true.
|
|
69
|
-
*/
|
|
70
|
-
autoLaunchPending?: boolean;
|
|
71
|
-
noIdleMeshSessionAvailable?: boolean;
|
|
72
|
-
}
|
|
73
|
-
export declare function triggerMeshQueue(components: DaemonComponents, meshId: string): Promise<MeshQueueTriggerResult>;
|
|
74
|
-
export declare function isMeshCoordinatorEvent(eventName: unknown): eventName is string;
|
|
75
|
-
export declare const MESH_FORCE_INJECT_EVENTS: ReadonlySet<string>;
|
|
76
|
-
export declare function shouldForceInjectMeshEvent(eventName: unknown): boolean;
|
|
77
|
-
export declare function buildRelayMetadataEvent(payload: Record<string, unknown>): Record<string, unknown>;
|
|
78
|
-
export declare function handleMeshForwardEvent(components: DaemonComponents, payload: Record<string, unknown>): {
|
|
79
|
-
[extra: string]: unknown;
|
|
80
|
-
success: true;
|
|
81
|
-
forwarded: 0;
|
|
82
|
-
suppressed: true;
|
|
83
|
-
} | {
|
|
84
|
-
success: boolean;
|
|
85
|
-
forwarded: number;
|
|
86
|
-
error?: undefined;
|
|
87
|
-
} | {
|
|
88
|
-
success: boolean;
|
|
89
|
-
error: string;
|
|
90
|
-
};
|
|
91
|
-
export declare function setupMeshEventForwarding(components: DaemonComponents): void;
|
|
92
|
-
export {};
|
|
1
|
+
export { isMeshCoordinatorEvent, MESH_FORCE_INJECT_EVENTS, shouldForceInjectMeshEvent, } from './mesh-event-classify.js';
|
|
2
|
+
export { __orderEligibleNodesForTests, __resetIdleAutoFastForwardForTests, activeReadonlyAssignedCount, activeWriteAssignedCount, triggerMeshQueue, tryAssignQueueTask, } from './mesh-queue-assignment.js';
|
|
3
|
+
export type { MeshQueueTriggerResult } from './mesh-queue-assignment.js';
|
|
4
|
+
export { __resetMeshWorkspaceCacheForTests, buildRelayMetadataEvent, handleMeshForwardEvent, resolveForwardEventMeshId, setupMeshEventForwarding, } from './mesh-event-forwarding.js';
|
|
@@ -52,6 +52,9 @@ export declare function resolveMeshSurfacedSessionPreview(metadataEvent: Record<
|
|
|
52
52
|
role: 'assistant';
|
|
53
53
|
receivedAt: number;
|
|
54
54
|
} | undefined;
|
|
55
|
+
export declare function isMissingFinalAssistantDiagnostic(record: Record<string, unknown> | undefined): boolean;
|
|
56
|
+
export declare function isFalseIdleCompletion(record: Record<string, unknown>): boolean;
|
|
57
|
+
export declare function isWeakCompletionEvidence(record: Record<string, unknown> | undefined): boolean;
|
|
55
58
|
export declare function isWeakCompletionMetadata(metadataEvent: Record<string, unknown>): boolean;
|
|
56
59
|
export declare function buildMeshSystemMessage(args: {
|
|
57
60
|
event: string;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { DaemonComponents } from '../boot/daemon-lifecycle.js';
|
|
2
|
+
import type { RepoMeshSchedulingStrategy } from '../repo-mesh-types.js';
|
|
3
|
+
export declare function __resetIdleAutoFastForwardForTests(): void;
|
|
4
|
+
export declare function getMeshWithCache(components: DaemonComponents, meshId: string): any | undefined;
|
|
5
|
+
export declare function tryAssignQueueTask(components: DaemonComponents, meshId: string, nodeId: string, sessionId: string, providerType: string): boolean;
|
|
6
|
+
/** Active assignments that hold the one-active-per-node / global-parallel invariant
|
|
7
|
+
* (everything except read-only diagnoses, which run unbounded by the write cap). */
|
|
8
|
+
export declare function activeWriteAssignedCount(meshId: string): number;
|
|
9
|
+
/** Active read-only (live_debug_readonly) assignments, for the read-only safety cap. */
|
|
10
|
+
export declare function activeReadonlyAssignedCount(meshId: string): number;
|
|
11
|
+
/**
|
|
12
|
+
* Order eligible nodes for assignment per the mesh scheduling pipeline:
|
|
13
|
+
* PRIORITY (schedulingPriority desc) → TIE-BREAK (strategy).
|
|
14
|
+
*
|
|
15
|
+
* The caller has already applied the TAG hard-filter and is responsible for the
|
|
16
|
+
* MAX-ALLOC capacity gate (the per-node launch/claim checks). This function only
|
|
17
|
+
* decides the *preference order* among nodes that are otherwise eligible.
|
|
18
|
+
*
|
|
19
|
+
* - 'first_eligible' (default): returns the input order verbatim and does NOT touch
|
|
20
|
+
* the round-robin cursor — byte-for-byte the pre-feature behavior.
|
|
21
|
+
* - 'priority_only': schedulingPriority desc, then input order (load ignored).
|
|
22
|
+
* - 'least_loaded': schedulingPriority desc, then active load asc, then input order.
|
|
23
|
+
* - 'round_robin': same as least_loaded, but among nodes tied at (priority, load)
|
|
24
|
+
* the input order is rotated by a per-mesh cursor that advances once per pass.
|
|
25
|
+
*
|
|
26
|
+
* `nodes` carries the original config/array index so the tie-break can fall back to
|
|
27
|
+
* deterministic input order. `bumpCursor` advances the round-robin cursor exactly
|
|
28
|
+
* once per scheduling pass (only consulted for 'round_robin').
|
|
29
|
+
*/
|
|
30
|
+
interface RankableNode {
|
|
31
|
+
nodeId: string;
|
|
32
|
+
node: any;
|
|
33
|
+
index: number;
|
|
34
|
+
}
|
|
35
|
+
/** Test-only: the pure node-ordering stage (PRIORITY → TIE-BREAK). Exposed so the
|
|
36
|
+
* scheduling pipeline can be unit-tested without standing up live CLI sessions. */
|
|
37
|
+
export declare function __orderEligibleNodesForTests(meshId: string, strategy: RepoMeshSchedulingStrategy, nodes: RankableNode[], opts?: {
|
|
38
|
+
bumpCursor?: boolean;
|
|
39
|
+
}): RankableNode[];
|
|
40
|
+
export declare function sessionHasActiveAssignment(meshId: string, sessionId: string): boolean;
|
|
41
|
+
export interface MeshQueueTriggerResult {
|
|
42
|
+
success: true;
|
|
43
|
+
meshId: string;
|
|
44
|
+
pendingBefore: number;
|
|
45
|
+
assignedBefore: number;
|
|
46
|
+
pendingAfter: number;
|
|
47
|
+
assignedAfter: number;
|
|
48
|
+
claimed: boolean;
|
|
49
|
+
newlyAssignedTasks: Array<{
|
|
50
|
+
id: string;
|
|
51
|
+
nodeId?: string;
|
|
52
|
+
sessionId?: string;
|
|
53
|
+
}>;
|
|
54
|
+
localIdleSessionsChecked: number;
|
|
55
|
+
remoteIdleSessionsChecked: number;
|
|
56
|
+
skippedSessions: Array<{
|
|
57
|
+
nodeId?: string;
|
|
58
|
+
sessionId?: string;
|
|
59
|
+
reason: string;
|
|
60
|
+
status?: string;
|
|
61
|
+
}>;
|
|
62
|
+
autoLaunchStarted: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* True when a worker session is already on its way to claim a still-pending task —
|
|
65
|
+
* either launched this tick (autoLaunchStarted) or launched on a prior tick and still
|
|
66
|
+
* booting/awaiting-claim. Callers MUST treat this as "wait, do not launch another
|
|
67
|
+
* session": a second launch double-edits the worktree. Mutually informative with
|
|
68
|
+
* `noIdleMeshSessionAvailable`, which is suppressed whenever this is true.
|
|
69
|
+
*/
|
|
70
|
+
autoLaunchPending?: boolean;
|
|
71
|
+
noIdleMeshSessionAvailable?: boolean;
|
|
72
|
+
}
|
|
73
|
+
export declare function triggerMeshQueue(components: DaemonComponents, meshId: string): Promise<MeshQueueTriggerResult>;
|
|
74
|
+
export declare function maybeAutoFastForwardIdleNode(components: DaemonComponents, args: {
|
|
75
|
+
meshId: string;
|
|
76
|
+
nodeId: string;
|
|
77
|
+
sessionId?: string;
|
|
78
|
+
providerType?: string;
|
|
79
|
+
}): Promise<void>;
|
|
80
|
+
export declare function runIdleMaintenanceThenAssignQueue(components: DaemonComponents, args: {
|
|
81
|
+
meshId: string;
|
|
82
|
+
nodeId: string;
|
|
83
|
+
sessionId: string;
|
|
84
|
+
providerType: string;
|
|
85
|
+
}): void;
|
|
86
|
+
export {};
|
|
@@ -19,9 +19,6 @@ export declare class MeshRuntimeStore {
|
|
|
19
19
|
hasCompletionFingerprint(fingerprint: string): boolean;
|
|
20
20
|
recordCompletionFingerprint(fingerprint: string, ttlMs: number): void;
|
|
21
21
|
sweepExpiredFingerprints(): void;
|
|
22
|
-
recordDirectDelivered(coordinatorDaemonId: string, fingerprint: string, ttlMs: number): void;
|
|
23
|
-
wasDirectDelivered(coordinatorDaemonId: string, fingerprint: string): boolean;
|
|
24
|
-
sweepExpiredDirectDelivered(): void;
|
|
25
22
|
private maybeCheckpointWal;
|
|
26
23
|
private ensureLegacyQueueMigrated;
|
|
27
24
|
getQueueEntries(meshId: string, statuses?: MeshTaskStatus[]): MeshWorkQueueEntry[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spawn-bind grace window: an on-disk rollout whose session_meta.timestamp
|
|
3
|
+
* lands within ±SPAWN_BIND_GRACE_MS of the daemon's spawnedAtMs is treated
|
|
4
|
+
* as belonging to that daemon session. 10s is long enough to absorb codex
|
|
5
|
+
* binary startup latency on cold caches and short enough that two
|
|
6
|
+
* back-to-back launches don't both fall inside the same window.
|
|
7
|
+
*
|
|
8
|
+
* Shared by the declarative executor (providers/spec/native-history-executor.ts)
|
|
9
|
+
* and the codex runtime disambiguator (providers/native-history/dispatcher.ts) —
|
|
10
|
+
* both apply the identical ±10s session-binding window.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SPAWN_BIND_GRACE_MS = 10000;
|
|
@@ -9,3 +9,5 @@ export declare const MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS = 500
|
|
|
9
9
|
export declare const DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS = 10000;
|
|
10
10
|
export declare const DEFAULT_SESSION_HOST_READY_TIMEOUT_MS = 15000;
|
|
11
11
|
export declare const STANDALONE_CDP_SCAN_INTERVAL_MS = 15000;
|
|
12
|
+
export declare function readMeshTimeoutEnvMs(names: string | string[], defaultMs: number): number;
|
|
13
|
+
export declare const MESH_CONNECT_TIMEOUT_MS: number;
|
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.377",
|
|
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,7 +46,7 @@
|
|
|
46
46
|
"author": "vilmire",
|
|
47
47
|
"license": "AGPL-3.0-or-later",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@adhdev/mesh-shared": "0.9.82-rc.
|
|
49
|
+
"@adhdev/mesh-shared": "0.9.82-rc.377",
|
|
50
50
|
"@adhdev/session-host-core": "*",
|
|
51
51
|
"@agentclientprotocol/sdk": "^0.16.1",
|
|
52
52
|
"ajv": "^8.20.0",
|