@adhdev/daemon-core 0.9.82-rc.375 → 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
package/src/commands/router.ts
CHANGED
|
@@ -89,6 +89,7 @@ import * as fs from 'fs';
|
|
|
89
89
|
import { execFileSync } from 'node:child_process';
|
|
90
90
|
import { workingDirBasename } from '../providers/working-dir.js';
|
|
91
91
|
import { resolveWin32Executable } from '../cli-adapters/resolve-executable.js';
|
|
92
|
+
import { readMeshTimeoutEnvMs, MESH_CONNECT_TIMEOUT_MS } from '../runtime-defaults.js';
|
|
92
93
|
|
|
93
94
|
export function readProviderPriorityFromPolicy(policy: unknown): string[] {
|
|
94
95
|
const record = policy && typeof policy === 'object' && !Array.isArray(policy)
|
|
@@ -1315,17 +1316,6 @@ export function finalizeMeshNodeStatus(args: {
|
|
|
1315
1316
|
);
|
|
1316
1317
|
}
|
|
1317
1318
|
|
|
1318
|
-
// Reads a positive integer timeout (ms) from an env var, clamped to [1s, 120s];
|
|
1319
|
-
// falls back to the default when unset or out of range. Lets slow cross-machine
|
|
1320
|
-
// peers (e.g. a TURN-relayed Windows daemon whose git_status RTT is 10-18s) be
|
|
1321
|
-
// tuned without a rebuild.
|
|
1322
|
-
function readMeshTimeoutEnvMs(name: string, defaultMs: number): number {
|
|
1323
|
-
const raw = process.env[name]?.trim();
|
|
1324
|
-
if (!raw) return defaultMs;
|
|
1325
|
-
const parsed = Number.parseInt(raw, 10);
|
|
1326
|
-
if (Number.isFinite(parsed) && parsed >= 1_000 && parsed <= 120_000) return parsed;
|
|
1327
|
-
return defaultMs;
|
|
1328
|
-
}
|
|
1329
1319
|
|
|
1330
1320
|
// Direct-peer git_status probe timeout for the dashboard's requireDirectPeerTruth
|
|
1331
1321
|
// bootstrap. The previous hard-coded 8s/12s were shorter than the real P2P
|
|
@@ -1348,7 +1338,10 @@ export const MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS = readMeshTimeoutEnvMs('MESH_DIR
|
|
|
1348
1338
|
// so this never masks a real failure for the whole window; it only grants a
|
|
1349
1339
|
// still-handshaking peer the time it legitimately needs. Matches the daemon-cloud
|
|
1350
1340
|
// DaemonMeshManager CONNECT_TIMEOUT_MS (45s). Env-overridable for very slow links.
|
|
1351
|
-
|
|
1341
|
+
// Re-exported from the unified MESH_CONNECT_TIMEOUT_MS (runtime-defaults) so this
|
|
1342
|
+
// probe path and the coordinator's remote task-dispatch path share ONE
|
|
1343
|
+
// env-overridable connect budget instead of silently diverging when the env is set.
|
|
1344
|
+
export const MESH_DIRECT_PROBE_CONNECT_TIMEOUT_MS = MESH_CONNECT_TIMEOUT_MS;
|
|
1352
1345
|
// How long a successful per-peer git_status probe stays fresh enough to be
|
|
1353
1346
|
// reused instead of issuing another blocking `refreshUpstream:true` fan-out.
|
|
1354
1347
|
// A slow (TURN-relayed) peer's probe can take 9-23s, and the dashboard's
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { MeshLedgerKind } from './mesh-ledger.js';
|
|
2
|
+
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Core event injection
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
const MESH_COORDINATOR_EVENTS = new Set([
|
|
8
|
+
'agent:generating_started',
|
|
9
|
+
'agent:generating_completed',
|
|
10
|
+
'agent:waiting_approval',
|
|
11
|
+
'agent:stopped',
|
|
12
|
+
'agent:ready',
|
|
13
|
+
'monitor:no_progress',
|
|
14
|
+
'refine:accepted',
|
|
15
|
+
'refine:completed',
|
|
16
|
+
'refine:failed',
|
|
17
|
+
'worktree_bootstrap_complete',
|
|
18
|
+
'worktree_bootstrap_failed',
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
export const EVENT_TO_LEDGER_KIND: Record<string, MeshLedgerKind> = {
|
|
22
|
+
'agent:generating_completed': 'task_completed',
|
|
23
|
+
'agent:waiting_approval': 'task_approval_needed',
|
|
24
|
+
'agent:stopped': 'task_failed',
|
|
25
|
+
'monitor:no_progress': 'task_stalled',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export function isMeshCoordinatorEvent(eventName: unknown): eventName is string {
|
|
29
|
+
return typeof eventName === 'string' && MESH_COORDINATOR_EVENTS.has(eventName);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Terminal events that the coordinator is actively blocked waiting on. When the
|
|
33
|
+
// coordinator CLI session dispatches a task (e.g. mesh_send_task) it stays in
|
|
34
|
+
// `generating` until the result arrives — but a generating coordinator queues
|
|
35
|
+
// incoming send_message calls into its adapter's pendingOutboundQueue, which is
|
|
36
|
+
// only flushed on the coordinator's OWN idle transition. That transition can't
|
|
37
|
+
// happen until it receives this very event → deadlock. We force-inject these so
|
|
38
|
+
// they bypass the busy send-guard and land in the PTY while generating.
|
|
39
|
+
export const MESH_FORCE_INJECT_EVENTS: ReadonlySet<string> = new Set([
|
|
40
|
+
'agent:generating_completed',
|
|
41
|
+
'agent:stopped',
|
|
42
|
+
'agent:waiting_approval',
|
|
43
|
+
'refine:completed',
|
|
44
|
+
'refine:failed',
|
|
45
|
+
'worktree_bootstrap_complete',
|
|
46
|
+
'worktree_bootstrap_failed',
|
|
47
|
+
]);
|
|
48
|
+
|
|
49
|
+
export function shouldForceInjectMeshEvent(eventName: unknown): boolean {
|
|
50
|
+
return typeof eventName === 'string' && MESH_FORCE_INJECT_EVENTS.has(eventName);
|
|
51
|
+
}
|