@adhdev/daemon-core 0.9.75 → 0.9.76-rc.10

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.
@@ -144,6 +144,7 @@ export interface LocalMeshNodeEntry {
144
144
  id: string;
145
145
  workspace: string;
146
146
  repoRoot?: string;
147
+ daemonId?: string;
147
148
  userOverrides: Partial<RepoMeshNodeCapabilities>;
148
149
  policy: RepoMeshNodePolicy;
149
150
  /** For single-machine mesh: same daemon, different worktree */
@@ -328,6 +328,15 @@ export interface CompactSessionEntry {
328
328
  settings?: Record<string, any>;
329
329
  }
330
330
  export type VersionUpdateReason = 'force_update_below' | 'major_minor_mismatch' | 'patch_mismatch' | 'daemon_ahead';
331
+ export type ReleaseChannel = 'stable' | 'preview';
332
+ export type NpmUpdateTag = 'latest' | 'next';
333
+ export interface VersionUpdatePolicy {
334
+ channel: ReleaseChannel;
335
+ npmTag: NpmUpdateTag;
336
+ targetVersion: string;
337
+ minVersion?: string;
338
+ updateCommand: string;
339
+ }
331
340
  /** Available provider information */
332
341
  export interface AvailableProviderInfo {
333
342
  type: string;
@@ -469,6 +478,10 @@ export interface CompactDaemonEntry {
469
478
  versionMismatch?: boolean;
470
479
  versionUpdateRequired?: boolean;
471
480
  versionUpdateReason?: VersionUpdateReason;
481
+ releaseChannel?: ReleaseChannel;
482
+ updateChannel?: ReleaseChannel;
483
+ updatePolicy?: VersionUpdatePolicy;
484
+ updateCommand?: string;
472
485
  terminalBackend?: TerminalBackendStatus;
473
486
  detectedIdes?: DetectedIdeInfo[];
474
487
  availableProviders?: AvailableProviderInfo[];
@@ -490,10 +503,14 @@ export interface CloudDaemonSummaryEntry {
490
503
  versionMismatch?: boolean;
491
504
  versionUpdateRequired?: boolean;
492
505
  versionUpdateReason?: VersionUpdateReason;
506
+ releaseChannel?: ReleaseChannel;
507
+ updateChannel?: ReleaseChannel;
508
+ updatePolicy?: VersionUpdatePolicy;
509
+ updateCommand?: string;
493
510
  terminalBackend?: TerminalBackendStatus;
494
511
  }
495
512
  /** Minimal daemon bootstrap payload used by dashboard WS to initiate P2P. */
496
- export interface DashboardBootstrapDaemonEntry {
513
+ export interface DashboardBootstrapDaemonEntry extends Partial<CloudDaemonSummaryEntry> {
497
514
  id: string;
498
515
  p2p?: StatusReportPayload['p2p'];
499
516
  timestamp?: number;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-core",
3
- "version": "0.9.75",
4
- "description": "ADHDev daemon core \u2014 CDP, IDE detection, providers, command execution",
3
+ "version": "0.9.76-rc.10",
4
+ "description": "ADHDev daemon core CDP, IDE detection, providers, command execution",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -266,10 +266,17 @@ export class ProviderCliAdapter implements CliAdapter {
266
266
  const currentSnapshot = normalizeScreenSnapshot(screenText);
267
267
  const lastSnapshot = this.lastScreenSnapshot;
268
268
  if (!lastSnapshot || lastSnapshot === currentSnapshot) return screenText;
269
+ const activeScreenPattern = /\besc to (?:interrupt|stop)\b|Enter to interrupt, Ctrl\+C to cancel|Enter to confirm\s*[·•-]\s*Esc to cancel|\b(?:MCP servers?|tool calls?)\b[^\n\r]{0,160}\brequire approval\b/i;
270
+ const staleSnapshotLooksActive = activeScreenPattern.test(lastSnapshot);
271
+ const currentScreenLooksIdle = /(?:^|\n|\r)\s*[❯›>]\s*(?:Try\s+["“][^\n\r"”]+["”])?\s*(?:\n|\r|$)/.test(screenText)
272
+ && !activeScreenPattern.test(screenText);
273
+ if (staleSnapshotLooksActive && currentScreenLooksIdle) return screenText;
274
+ if (currentSnapshot.length >= lastSnapshot.length) return screenText;
269
275
  // Terminal screen reads can miss a just-rendered completed Hermes box while
270
276
  // the normalized snapshot captured during output still has it. Feed both
271
277
  // views to provider parsers so flattened snapshot-only final bubbles do
272
- // not disappear from read_chat/chat_tail.
278
+ // not disappear from read_chat/chat_tail, but only when the older snapshot
279
+ // carries extra content instead of stale status chrome.
273
280
  return `${screenText}\n${lastSnapshot}`;
274
281
  }
275
282
 
@@ -127,7 +127,7 @@ function resolveAdhdevMcpServerLaunch(options: {
127
127
  if (!entryPath) return null
128
128
  return {
129
129
  command: options.nodeExecutable?.trim() || process.execPath,
130
- args: [entryPath, '--repo-mesh', options.meshId],
130
+ args: [entryPath, '--mode', 'ipc', '--repo-mesh', options.meshId],
131
131
  }
132
132
  }
133
133
 
@@ -41,6 +41,10 @@ import { execNpmCommandSync, resolveCurrentGlobalInstallSurface, spawnDetachedDa
41
41
 
42
42
  type ReleaseChannel = 'stable' | 'preview';
43
43
  const CHANNEL_NPM_TAG: Record<ReleaseChannel, 'latest' | 'next'> = { stable: 'latest', preview: 'next' };
44
+ const CHANNEL_SERVER_URL: Record<ReleaseChannel, string> = {
45
+ stable: 'https://api.adhf.dev',
46
+ preview: 'https://api-preview.adhf.dev',
47
+ };
44
48
 
45
49
  function normalizeReleaseChannel(value: unknown): ReleaseChannel | null {
46
50
  if (typeof value !== 'string') return null;
@@ -892,6 +896,7 @@ export class DaemonCommandRouter {
892
896
  // Check channel-pinned dist-tag and resolve it to a concrete install version.
893
897
  const latest = String(execNpmCommandSync(['view', `${pkgName}@${npmTag}`, 'version'], { encoding: 'utf-8', timeout: 10000 }, npmSurface)).trim();
894
898
  LOG.info('Upgrade', `Latest ${pkgName}@${npmTag}: v${latest}`);
899
+ updateConfig({ updateChannel: channel, serverUrl: CHANNEL_SERVER_URL[channel] } as any);
895
900
  let currentInstalled: string | null = null;
896
901
  try {
897
902
  const currentJson = String(execNpmCommandSync(['ls', '-g', pkgName, '--depth=0', '--json'], {
@@ -1131,6 +1136,7 @@ export class DaemonCommandRouter {
1131
1136
  if (args?.inlineMesh) {
1132
1137
  mcpServerEntry.env = {
1133
1138
  ADHDEV_INLINE_MESH: JSON.stringify(mesh),
1139
+ ADHDEV_MCP_TRANSPORT: 'ipc',
1134
1140
  };
1135
1141
  }
1136
1142
  const mcpConfig = {
@@ -92,7 +92,7 @@ function buildNodeConfigSection(mesh: LocalMeshEntry): string {
92
92
  for (const n of mesh.nodes) {
93
93
  const labels: string[] = [];
94
94
  if (n.isLocalWorktree) labels.push('worktree');
95
- if (n.policy.readOnly) labels.push('read-only');
95
+ if (n.policy?.readOnly) labels.push('read-only');
96
96
  const suffix = labels.length ? ` [${labels.join(', ')}]` : '';
97
97
  lines.push(`- **${n.workspace}** (${n.id})${suffix}`);
98
98
  }
@@ -139,7 +139,7 @@ const WORKFLOW_SECTION = `## Orchestration Workflow
139
139
  3. **Delegate** — For each task:
140
140
  a. Pick the best node (consider: health, dirty state, current workload).
141
141
  b. If no session exists, call \`mesh_launch_session\` to start one.
142
- c. Call \`mesh_send_task\` with a clear, self-contained natural-language instruction.
142
+ c. Call \`mesh_send_task\` with a **complete, self-contained** instruction that includes all context the agent needs (file paths, line numbers, what to change, why). Do not send partial instructions expecting future follow-up.
143
143
  4. **Monitor** — Periodically call \`mesh_read_chat\` to check progress. Handle approvals via \`mesh_approve\`.
144
144
  5. **Verify** — When a task reports completion, call \`mesh_git_status\` to verify changes were made.
145
145
  6. **Checkpoint** — Call \`mesh_checkpoint\` to save the work.
@@ -147,10 +147,12 @@ const WORKFLOW_SECTION = `## Orchestration Workflow
147
147
 
148
148
  const RULES_SECTION = `## Rules
149
149
 
150
- - **Be conversational.** Delegate work the way a tech lead would clear, specific instructions in natural language.
151
- - **Don't inspect code.** Trust the agent's output. Verify via git diff/status, not by reading source files.
150
+ - **Minimize coordinator context.** The coordinator's job is routing, not implementing. Do not read source files, run commands, or analyze code directly — delegate all of that to node agents. Your context should stay lean.
151
+ - **Delegate analysis too.** If you need to understand a bug or explore the codebase, send that investigation as a task to a node. Do not do it yourself.
152
+ - **Front-load the task message.** When calling \`mesh_send_task\`, include everything the agent needs: what files to touch, what the problem is, what the fix should look like. The agent won't ask follow-up questions.
153
+ - **Don't inspect code.** Trust the agent's output. Verify via \`mesh_git_status\`, not by reading source files.
152
154
  - **Don't over-parallelize.** Start with 1-2 concurrent tasks. Scale up if they succeed.
153
155
  - **Handle failures gracefully.** If a task fails, read the chat to understand why, then retry or reassign.
154
- - **Keep the user informed.** Report progress after each delegation round.
156
+ - **Keep the user informed.** Report progress after each delegation round — one or two sentences, not a narration.
155
157
  - **Respect node capabilities.** Don't send build tasks to read-only nodes. Don't push from nodes that aren't allowed to.
156
158
  - **Never fabricate tool results.** Always call the actual tool; never pretend you did.`;
@@ -184,6 +184,7 @@ export interface LocalMeshNodeEntry {
184
184
  id: string;
185
185
  workspace: string;
186
186
  repoRoot?: string;
187
+ daemonId?: string;
187
188
  userOverrides: Partial<RepoMeshNodeCapabilities>;
188
189
  policy: RepoMeshNodePolicy;
189
190
  /** For single-machine mesh: same daemon, different worktree */
@@ -432,6 +432,17 @@ export type VersionUpdateReason =
432
432
  | 'patch_mismatch'
433
433
  | 'daemon_ahead';
434
434
 
435
+ export type ReleaseChannel = 'stable' | 'preview';
436
+ export type NpmUpdateTag = 'latest' | 'next';
437
+
438
+ export interface VersionUpdatePolicy {
439
+ channel: ReleaseChannel;
440
+ npmTag: NpmUpdateTag;
441
+ targetVersion: string;
442
+ minVersion?: string;
443
+ updateCommand: string;
444
+ }
445
+
435
446
  /** Available provider information */
436
447
  export interface AvailableProviderInfo {
437
448
  type: string;
@@ -577,6 +588,10 @@ export interface CompactDaemonEntry {
577
588
  versionMismatch?: boolean;
578
589
  versionUpdateRequired?: boolean;
579
590
  versionUpdateReason?: VersionUpdateReason;
591
+ releaseChannel?: ReleaseChannel;
592
+ updateChannel?: ReleaseChannel;
593
+ updatePolicy?: VersionUpdatePolicy;
594
+ updateCommand?: string;
580
595
  terminalBackend?: TerminalBackendStatus;
581
596
  detectedIdes?: DetectedIdeInfo[];
582
597
  availableProviders?: AvailableProviderInfo[];
@@ -599,11 +614,15 @@ export interface CloudDaemonSummaryEntry {
599
614
  versionMismatch?: boolean;
600
615
  versionUpdateRequired?: boolean;
601
616
  versionUpdateReason?: VersionUpdateReason;
617
+ releaseChannel?: ReleaseChannel;
618
+ updateChannel?: ReleaseChannel;
619
+ updatePolicy?: VersionUpdatePolicy;
620
+ updateCommand?: string;
602
621
  terminalBackend?: TerminalBackendStatus;
603
622
  }
604
623
 
605
624
  /** Minimal daemon bootstrap payload used by dashboard WS to initiate P2P. */
606
- export interface DashboardBootstrapDaemonEntry {
625
+ export interface DashboardBootstrapDaemonEntry extends Partial<CloudDaemonSummaryEntry> {
607
626
  id: string;
608
627
  p2p?: StatusReportPayload['p2p'];
609
628
  timestamp?: number;
@@ -43,6 +43,19 @@ function getActiveChatOptions(profile: SessionEntryProfile): NormalizeActiveChat
43
43
  return LIVE_STATUS_ACTIVE_CHAT_OPTIONS;
44
44
  }
45
45
 
46
+ function resolveSessionStatus(
47
+ activeChat: { status?: string | null; activeModal?: { buttons?: unknown[] | null } | null } | null | undefined,
48
+ providerStatus?: string | null,
49
+ ) {
50
+ const chatStatus = normalizeManagedStatus(activeChat?.status, { activeModal: activeChat?.activeModal || null });
51
+ const topLevelStatus = normalizeManagedStatus(providerStatus, { activeModal: activeChat?.activeModal || null });
52
+
53
+ if (chatStatus === 'waiting_approval' || topLevelStatus === 'waiting_approval') return 'waiting_approval';
54
+ if (chatStatus === 'generating' || topLevelStatus === 'generating') return 'generating';
55
+ if (topLevelStatus !== 'idle') return topLevelStatus;
56
+ return chatStatus;
57
+ }
58
+
46
59
  function shouldIncludeSessionControls(profile: SessionEntryProfile): boolean {
47
60
  return profile !== 'live';
48
61
  }
@@ -170,9 +183,7 @@ function buildIdeWorkspaceSession(
170
183
  providerName: state.name,
171
184
  kind: 'workspace',
172
185
  transport: 'cdp-page',
173
- status: normalizeManagedStatus(activeChat?.status || state.status, {
174
- activeModal: activeChat?.activeModal || null,
175
- }),
186
+ status: resolveSessionStatus(activeChat, state.status),
176
187
  title,
177
188
  workspace,
178
189
  ...(git && { git }),
@@ -212,9 +223,7 @@ function buildExtensionAgentSession(
212
223
  providerSessionId: ext.providerSessionId,
213
224
  kind: 'agent',
214
225
  transport: 'cdp-webview',
215
- status: normalizeManagedStatus(activeChat?.status || ext.status, {
216
- activeModal: activeChat?.activeModal || null,
217
- }),
226
+ status: resolveSessionStatus(activeChat, ext.status),
218
227
  title: activeChat?.title || ext.name,
219
228
  workspace,
220
229
  ...(git && { git }),
@@ -277,9 +286,7 @@ function buildCliSession(state: CliProviderState, options: SessionEntryBuildOpti
277
286
  providerSessionId: state.providerSessionId,
278
287
  kind: 'agent',
279
288
  transport: 'pty',
280
- status: normalizeManagedStatus(activeChat?.status || state.status, {
281
- activeModal: activeChat?.activeModal || null,
282
- }),
289
+ status: resolveSessionStatus(activeChat, state.status),
283
290
  title: activeChat?.title || state.name,
284
291
  workspace,
285
292
  ...(git && { git }),
@@ -328,9 +335,7 @@ function buildAcpSession(state: AcpProviderState, options: SessionEntryBuildOpti
328
335
  providerName: state.name,
329
336
  kind: 'agent',
330
337
  transport: 'acp',
331
- status: normalizeManagedStatus(activeChat?.status || state.status, {
332
- activeModal: activeChat?.activeModal || null,
333
- }),
338
+ status: resolveSessionStatus(activeChat, state.status),
334
339
  title: activeChat?.title || state.name,
335
340
  workspace,
336
341
  ...(git && { git }),
@@ -1,6 +0,0 @@
1
- declare const DEFAULT_SESSION_HOST_COLS = 80;
2
- declare const DEFAULT_SESSION_HOST_ROWS = 32;
3
- declare function resolveSessionHostCols(value: number | undefined): number;
4
- declare function resolveSessionHostRows(value: number | undefined): number;
5
-
6
- export { DEFAULT_SESSION_HOST_COLS, DEFAULT_SESSION_HOST_ROWS, resolveSessionHostCols, resolveSessionHostRows };
@@ -1,6 +0,0 @@
1
- declare const DEFAULT_SESSION_HOST_COLS = 80;
2
- declare const DEFAULT_SESSION_HOST_ROWS = 32;
3
- declare function resolveSessionHostCols(value: number | undefined): number;
4
- declare function resolveSessionHostRows(value: number | undefined): number;
5
-
6
- export { DEFAULT_SESSION_HOST_COLS, DEFAULT_SESSION_HOST_ROWS, resolveSessionHostCols, resolveSessionHostRows };
@@ -1,49 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/defaults.ts
21
- var defaults_exports = {};
22
- __export(defaults_exports, {
23
- DEFAULT_SESSION_HOST_COLS: () => DEFAULT_SESSION_HOST_COLS,
24
- DEFAULT_SESSION_HOST_ROWS: () => DEFAULT_SESSION_HOST_ROWS,
25
- resolveSessionHostCols: () => resolveSessionHostCols,
26
- resolveSessionHostRows: () => resolveSessionHostRows
27
- });
28
- module.exports = __toCommonJS(defaults_exports);
29
- var DEFAULT_SESSION_HOST_COLS = 80;
30
- var DEFAULT_SESSION_HOST_ROWS = 32;
31
- function normalizeSessionHostDimension(value, fallback) {
32
- if (typeof value !== "number" || !Number.isFinite(value)) return fallback;
33
- const rounded = Math.floor(value);
34
- return rounded > 0 ? rounded : fallback;
35
- }
36
- function resolveSessionHostCols(value) {
37
- return normalizeSessionHostDimension(value, DEFAULT_SESSION_HOST_COLS);
38
- }
39
- function resolveSessionHostRows(value) {
40
- return normalizeSessionHostDimension(value, DEFAULT_SESSION_HOST_ROWS);
41
- }
42
- // Annotate the CommonJS export names for ESM import in node:
43
- 0 && (module.exports = {
44
- DEFAULT_SESSION_HOST_COLS,
45
- DEFAULT_SESSION_HOST_ROWS,
46
- resolveSessionHostCols,
47
- resolveSessionHostRows
48
- });
49
- //# sourceMappingURL=defaults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/defaults.ts"],"sourcesContent":["export const DEFAULT_SESSION_HOST_COLS = 80;\nexport const DEFAULT_SESSION_HOST_ROWS = 32;\n\nfunction normalizeSessionHostDimension(value: number | undefined, fallback: number): number {\n if (typeof value !== 'number' || !Number.isFinite(value)) return fallback;\n const rounded = Math.floor(value);\n return rounded > 0 ? rounded : fallback;\n}\n\nexport function resolveSessionHostCols(value: number | undefined): number {\n return normalizeSessionHostDimension(value, DEFAULT_SESSION_HOST_COLS);\n}\n\nexport function resolveSessionHostRows(value: number | undefined): number {\n return normalizeSessionHostDimension(value, DEFAULT_SESSION_HOST_ROWS);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,4BAA4B;AAClC,IAAM,4BAA4B;AAEzC,SAAS,8BAA8B,OAA2B,UAA0B;AAC1F,MAAI,OAAO,UAAU,YAAY,CAAC,OAAO,SAAS,KAAK,EAAG,QAAO;AACjE,QAAM,UAAU,KAAK,MAAM,KAAK;AAChC,SAAO,UAAU,IAAI,UAAU;AACjC;AAEO,SAAS,uBAAuB,OAAmC;AACxE,SAAO,8BAA8B,OAAO,yBAAyB;AACvE;AAEO,SAAS,uBAAuB,OAAmC;AACxE,SAAO,8BAA8B,OAAO,yBAAyB;AACvE;","names":[]}
@@ -1,21 +0,0 @@
1
- // src/defaults.ts
2
- var DEFAULT_SESSION_HOST_COLS = 80;
3
- var DEFAULT_SESSION_HOST_ROWS = 32;
4
- function normalizeSessionHostDimension(value, fallback) {
5
- if (typeof value !== "number" || !Number.isFinite(value)) return fallback;
6
- const rounded = Math.floor(value);
7
- return rounded > 0 ? rounded : fallback;
8
- }
9
- function resolveSessionHostCols(value) {
10
- return normalizeSessionHostDimension(value, DEFAULT_SESSION_HOST_COLS);
11
- }
12
- function resolveSessionHostRows(value) {
13
- return normalizeSessionHostDimension(value, DEFAULT_SESSION_HOST_ROWS);
14
- }
15
- export {
16
- DEFAULT_SESSION_HOST_COLS,
17
- DEFAULT_SESSION_HOST_ROWS,
18
- resolveSessionHostCols,
19
- resolveSessionHostRows
20
- };
21
- //# sourceMappingURL=defaults.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/defaults.ts"],"sourcesContent":["export const DEFAULT_SESSION_HOST_COLS = 80;\nexport const DEFAULT_SESSION_HOST_ROWS = 32;\n\nfunction normalizeSessionHostDimension(value: number | undefined, fallback: number): number {\n if (typeof value !== 'number' || !Number.isFinite(value)) return fallback;\n const rounded = Math.floor(value);\n return rounded > 0 ? rounded : fallback;\n}\n\nexport function resolveSessionHostCols(value: number | undefined): number {\n return normalizeSessionHostDimension(value, DEFAULT_SESSION_HOST_COLS);\n}\n\nexport function resolveSessionHostRows(value: number | undefined): number {\n return normalizeSessionHostDimension(value, DEFAULT_SESSION_HOST_ROWS);\n}\n"],"mappings":";AAAO,IAAM,4BAA4B;AAClC,IAAM,4BAA4B;AAEzC,SAAS,8BAA8B,OAA2B,UAA0B;AAC1F,MAAI,OAAO,UAAU,YAAY,CAAC,OAAO,SAAS,KAAK,EAAG,QAAO;AACjE,QAAM,UAAU,KAAK,MAAM,KAAK;AAChC,SAAO,UAAU,IAAI,UAAU;AACjC;AAEO,SAAS,uBAAuB,OAAmC;AACxE,SAAO,8BAA8B,OAAO,yBAAyB;AACvE;AAEO,SAAS,uBAAuB,OAAmC;AACxE,SAAO,8BAA8B,OAAO,yBAAyB;AACvE;","names":[]}