@adhdev/daemon-core 0.9.82-rc.136 → 0.9.82-rc.138

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.
Files changed (63) hide show
  1. package/dist/chat/source-machine.d.ts +166 -0
  2. package/dist/chat/source-resolver.d.ts +104 -0
  3. package/dist/cli-adapters/cli-script-runner.d.ts +45 -0
  4. package/dist/cli-adapters/cli-state-engine.d.ts +169 -0
  5. package/dist/cli-adapters/provider-cli-adapter.d.ts +72 -74
  6. package/dist/cli-adapters/provider-cli-parse.d.ts +1 -0
  7. package/dist/cli-adapters/provider-cli-shared.d.ts +5 -0
  8. package/dist/config/chat-history.d.ts +1 -0
  9. package/dist/index.d.ts +3 -3
  10. package/dist/index.js +3507 -2288
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.mjs +3515 -2301
  13. package/dist/index.mjs.map +1 -1
  14. package/dist/mesh/beads-db.d.ts +54 -0
  15. package/dist/mesh/contracts.d.ts +164 -0
  16. package/dist/mesh/mesh-active-work.d.ts +7 -1
  17. package/dist/mesh/mesh-events.d.ts +10 -4
  18. package/dist/mesh/mesh-ledger.d.ts +21 -1
  19. package/dist/mesh/mesh-refine-status.d.ts +2 -3
  20. package/dist/mesh/mesh-work-queue.d.ts +17 -0
  21. package/dist/mesh/worktree-bootstrap-config.d.ts +2 -4
  22. package/dist/providers/contracts.d.ts +19 -0
  23. package/dist/providers/read-chat-contract.d.ts +29 -0
  24. package/dist/providers/transcript-v2.d.ts +176 -0
  25. package/dist/repo-mesh-types.d.ts +5 -0
  26. package/dist/shared-types.d.ts +7 -0
  27. package/dist/status/snapshot.d.ts +1 -0
  28. package/dist/types.d.ts +5 -0
  29. package/package.json +1 -1
  30. package/src/chat/source-machine.ts +534 -0
  31. package/src/chat/source-resolver.ts +0 -0
  32. package/src/chat/subscription-updates.ts +9 -0
  33. package/src/cli-adapters/cli-script-runner.ts +145 -0
  34. package/src/cli-adapters/cli-state-engine.ts +1054 -0
  35. package/src/cli-adapters/provider-cli-adapter.d.ts +0 -1
  36. package/src/cli-adapters/provider-cli-adapter.ts +413 -1399
  37. package/src/cli-adapters/provider-cli-parse.ts +3 -0
  38. package/src/cli-adapters/provider-cli-shared.ts +17 -1
  39. package/src/cli-adapters/terminal-backends/ghostty-vt-backend.ts +17 -1
  40. package/src/cli-adapters/terminal-backends/xterm-backend.ts +8 -1
  41. package/src/commands/chat-commands.ts +715 -368
  42. package/src/commands/router.ts +22 -2
  43. package/src/config/chat-history.ts +43 -16
  44. package/src/git/git-worktree.ts +8 -1
  45. package/src/index.ts +3 -2
  46. package/src/mesh/beads-db.ts +305 -2
  47. package/src/mesh/contracts.ts +329 -0
  48. package/src/mesh/coordinator-prompt.ts +12 -17
  49. package/src/mesh/mesh-active-work.ts +162 -59
  50. package/src/mesh/mesh-events.ts +198 -53
  51. package/src/mesh/mesh-ledger.ts +321 -105
  52. package/src/mesh/mesh-refine-status.ts +2 -3
  53. package/src/mesh/mesh-work-queue.ts +116 -120
  54. package/src/mesh/worktree-bootstrap-config.ts +17 -4
  55. package/src/providers/contracts.ts +19 -0
  56. package/src/providers/provider-loader.ts +21 -7
  57. package/src/providers/provider-schema.ts +12 -0
  58. package/src/providers/read-chat-contract.ts +74 -14
  59. package/src/providers/transcript-v2.ts +567 -0
  60. package/src/repo-mesh-types.ts +10 -0
  61. package/src/shared-types.ts +7 -0
  62. package/src/status/snapshot.ts +35 -11
  63. package/src/types.ts +5 -0
@@ -43,6 +43,7 @@ export function buildCliParseInput(options: {
43
43
  isWaitingForResponse?: boolean;
44
44
  scope?: TurnParseScope | null;
45
45
  runtimeSettings: Record<string, any>;
46
+ spawnAt?: number;
46
47
  }): CliScriptInput {
47
48
  const {
48
49
  accumulatedBuffer,
@@ -57,6 +58,7 @@ export function buildCliParseInput(options: {
57
58
  isWaitingForResponse,
58
59
  scope,
59
60
  runtimeSettings,
61
+ spawnAt,
60
62
  } = options;
61
63
  const buffer = scope
62
64
  ? sliceFromOffset(accumulatedBuffer, scope.bufferStart)
@@ -84,6 +86,7 @@ export function buildCliParseInput(options: {
84
86
  isWaitingForResponse,
85
87
  promptText: scope?.prompt || '',
86
88
  settings: { ...runtimeSettings },
89
+ ...(typeof spawnAt === 'number' && spawnAt > 0 ? { spawnAt } : {}),
87
90
  };
88
91
  }
89
92
 
@@ -119,6 +119,7 @@ export interface CliScriptInput {
119
119
  promptText?: string;
120
120
  settings?: Record<string, any>;
121
121
  args?: Record<string, any>;
122
+ spawnAt?: number;
122
123
  }
123
124
 
124
125
  export interface CliStatusInput {
@@ -163,6 +164,10 @@ export interface CliProviderModule {
163
164
  requirePromptEchoBeforeSubmit?: boolean;
164
165
  /** Allow sending another prompt while the CLI is still generating so users can intervene mid-turn. */
165
166
  allowInputDuringGeneration?: boolean;
167
+ /** When true, only transition to idle after the parsed transcript includes a final standard assistant message. */
168
+ requiresFinalAssistantBeforeIdle?: boolean;
169
+ /** When true, allow providers to augment stale snapshot data before parse. Reserved for future use. */
170
+ augmentStaleSnapshot?: boolean;
166
171
  /** When provider-owned, daemon treats provider parser output as canonical transcript authority. */
167
172
  transcriptAuthority?: 'provider' | 'daemon';
168
173
  /** Full context lets provider-owned parsers canonicalize retained history instead of daemon prefix stitching. */
@@ -358,7 +363,18 @@ export class TerminalTranscriptAccumulator {
358
363
  this.ensureRow();
359
364
  if (final === 'A') this.row = Math.max(0, this.row - count);
360
365
  else if (final === 'B') this.row += count;
361
- else if (final === 'C') this.col += count;
366
+ else if (final === 'C') {
367
+ // (fix) Cursor-forward must materialize spaces in the cells it
368
+ // skips, otherwise rendered transcripts collapse "Do you" written
369
+ // as "Do\x1b[1Cyou" into "Doyou". That mis-rendering broke
370
+ // Claude Code's approval-prompt and prompt-line detection
371
+ // (parseApproval saw "Doyouwanttoproceed?" and returned null).
372
+ const line = this.lines[this.row];
373
+ for (let c = this.col; c < this.col + count; c += 1) {
374
+ if (line[c] === undefined) line[c] = ' ';
375
+ }
376
+ this.col += count;
377
+ }
362
378
  else if (final === 'D') this.col = Math.max(0, this.col - count);
363
379
  else if (final === 'G') this.col = Math.max(0, count - 1);
364
380
  else if (final === 'H' || final === 'f') {
@@ -121,7 +121,23 @@ export class GhosttyVtTerminalBackend implements TerminalViewportBackend {
121
121
  }
122
122
 
123
123
  getText(): string {
124
- return this.terminal.formatPlainText({ trim: true }) || '';
124
+ // (fix) ghostty's `trim:true` mode strips trailing whitespace per row
125
+ // AND collapses cells that were touched only by cursor-forward (ESC[<n>C)
126
+ // without a printable glyph. Many TUIs (Claude Code most prominently)
127
+ // render inter-word spaces via CUF rather than literal spaces, so
128
+ // trim:true would smash "Do you want to proceed?" into
129
+ // "Doyouwanttoproceed?" and break every downstream regex
130
+ // (approval detection, prompt-line discovery, etc.). Keep the per-row
131
+ // padding, then trim each row's trailing whitespace ourselves so the
132
+ // serialized text matches what the user sees in the terminal.
133
+ const raw = this.terminal.formatPlainText({ trim: false }) || '';
134
+ if (!raw) return '';
135
+ const lines = raw.split('\n').map((row) => row.replace(/\s+$/, ''));
136
+ let first = 0;
137
+ let last = lines.length;
138
+ while (first < last && !lines[first]) first += 1;
139
+ while (last > first && !lines[last - 1]) last -= 1;
140
+ return lines.slice(first, last).join('\n');
125
141
  }
126
142
 
127
143
  getCursorPosition(): { col: number; row: number } {
@@ -64,7 +64,14 @@ export class XtermTerminalBackend implements TerminalViewportBackend {
64
64
 
65
65
  for (let i = start; i < end; i++) {
66
66
  const line = buffer.getLine(i);
67
- lines.push(line ? line.translateToString(true) : '');
67
+ // (fix) translateToString(true) strips trailing whitespace per row
68
+ // AND collapses cells touched only by cursor-forward (ESC[<n>C),
69
+ // so Claude Code's "Do you want to proceed?" arrives as
70
+ // "Doyouwanttoproceed?" — every downstream approval/prompt regex
71
+ // misses. Use false to preserve inter-word padding; we trim each
72
+ // row's trailing whitespace ourselves below.
73
+ const raw = line ? line.translateToString(false) : '';
74
+ lines.push(raw.replace(/\s+$/, ''));
68
75
  }
69
76
 
70
77
  let first = 0;