@adhdev/daemon-core 0.9.82-rc.160 → 0.9.82-rc.161

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/cli-adapter-types.d.ts +14 -1
  2. package/dist/commands/mesh-coordinator.d.ts +72 -1
  3. package/dist/config/chat-history.d.ts +2 -0
  4. package/dist/config/mesh-config.d.ts +3 -0
  5. package/dist/index.d.ts +11 -0
  6. package/dist/index.js +4923 -1411
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +4975 -1476
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/mesh/coordinator-prompt.d.ts +30 -0
  11. package/dist/mesh/coordinator-registry.d.ts +35 -1
  12. package/dist/providers/cli-provider-instance.d.ts +1 -1
  13. package/dist/providers/contracts.d.ts +48 -0
  14. package/dist/providers/native-history/antigravity-cli-transcript.d.ts +1 -1
  15. package/dist/providers/native-history/claude-cli-transcript.d.ts +1 -1
  16. package/dist/providers/native-history/codex-cli-transcript.d.ts +1 -1
  17. package/dist/providers/native-history/dispatcher.d.ts +24 -0
  18. package/dist/providers/native-history/hermes-cli-transcript.d.ts +30 -0
  19. package/dist/providers/native-history/index.d.ts +2 -0
  20. package/dist/providers/spec/adapter.d.ts +56 -0
  21. package/dist/providers/spec/cli-adapter.d.ts +76 -0
  22. package/dist/providers/spec/driver.d.ts +148 -0
  23. package/dist/providers/spec/evaluator.d.ts +47 -0
  24. package/dist/providers/spec/loader.d.ts +14 -0
  25. package/dist/providers/spec/native-history-executor.d.ts +39 -0
  26. package/dist/providers/spec/route.d.ts +4 -0
  27. package/dist/providers/spec/schema.gen.d.ts +507 -0
  28. package/dist/providers/spec/types.d.ts +211 -0
  29. package/dist/repo-mesh-types.d.ts +33 -1
  30. package/dist/sessions/registry.d.ts +3 -0
  31. package/package.json +2 -1
  32. package/src/cli-adapter-types.ts +15 -1
  33. package/src/commands/chat-commands.ts +150 -12
  34. package/src/commands/cli-manager.ts +11 -0
  35. package/src/commands/mesh-coordinator.ts +235 -1
  36. package/src/commands/router.ts +238 -50
  37. package/src/config/chat-history.ts +11 -3
  38. package/src/config/mesh-config.ts +16 -1
  39. package/src/index.ts +19 -0
  40. package/src/mesh/coordinator-prompt.ts +164 -8
  41. package/src/mesh/coordinator-registry.ts +50 -4
  42. package/src/providers/cli-provider-instance.ts +8 -3
  43. package/src/providers/contracts.ts +53 -0
  44. package/src/providers/native-history/antigravity-cli-transcript.ts +2 -2
  45. package/src/providers/native-history/claude-cli-transcript.ts +1 -1
  46. package/src/providers/native-history/codex-cli-transcript.ts +1 -1
  47. package/src/providers/native-history/dispatcher.ts +227 -0
  48. package/src/providers/native-history/hermes-cli-transcript.ts +230 -0
  49. package/src/providers/native-history/index.ts +7 -0
  50. package/src/providers/provider-loader.ts +126 -3
  51. package/src/providers/sdk/v1/schemas/cli/provider.schema.json +13 -0
  52. package/src/providers/spec/adapter.ts +153 -0
  53. package/src/providers/spec/cli-adapter.ts +318 -0
  54. package/src/providers/spec/driver.ts +498 -0
  55. package/src/providers/spec/evaluator.ts +268 -0
  56. package/src/providers/spec/loader.ts +130 -0
  57. package/src/providers/spec/native-history-executor.ts +612 -0
  58. package/src/providers/spec/route.ts +51 -0
  59. package/src/providers/spec/schema.gen.ts +507 -0
  60. package/src/providers/spec/schema.json +210 -0
  61. package/src/providers/spec/types.ts +230 -0
  62. package/src/repo-mesh-types.ts +33 -1
  63. package/src/sessions/registry.ts +3 -0
@@ -11,6 +11,9 @@ export interface CliAdapterStatus {
11
11
  message: string;
12
12
  buttons: string[];
13
13
  } | null;
14
+ providerSessionId?: string;
15
+ errorMessage?: string;
16
+ errorReason?: string;
14
17
  }
15
18
  export interface AcpAdapterHandle {
16
19
  onEvent(event: string, data?: unknown): void;
@@ -38,7 +41,9 @@ export interface CliAdapter {
38
41
  force?: boolean;
39
42
  }): Promise<void>;
40
43
  forceSendMessage?(text: string): Promise<void>;
41
- getStatus(): CliAdapterStatus;
44
+ getStatus(options?: {
45
+ allowParse?: boolean;
46
+ }): CliAdapterStatus;
42
47
  getScriptParsedStatus?(): unknown;
43
48
  getDebugSnapshot?(): unknown;
44
49
  invokeScript?(scriptName: string, args?: Record<string, unknown>): Promise<unknown>;
@@ -60,4 +65,12 @@ export interface CliAdapter {
60
65
  setOnPtyData?(callback: (data: string) => void): void;
61
66
  writeRaw?(data: string): void;
62
67
  resize?(cols: number, rows: number): void;
68
+ getRuntimeMetadata?(): unknown;
69
+ updateRuntimeMeta?(meta: Record<string, unknown>): void;
70
+ refreshProviderDefinition?(provider: unknown): void;
71
+ }
72
+ export interface CliAdapterStatusOptional {
73
+ providerSessionId?: string;
74
+ errorMessage?: string;
75
+ errorReason?: string;
63
76
  }
@@ -1,4 +1,4 @@
1
- import type { ProviderModule, MeshCoordinatorMcpConfigFormat } from '../providers/contracts.js';
1
+ import type { MeshCoordinatorMcpConfigFormat, MeshCoordinatorSystemPromptInjection, ProviderModule } from '../providers/contracts.js';
2
2
  export interface MeshCoordinatorMcpServerLaunch {
3
3
  command: string;
4
4
  args: string[];
@@ -42,3 +42,74 @@ export interface ResolveMeshCoordinatorSetupOptions {
42
42
  }
43
43
  export declare function createHermesManualMeshCoordinatorSetup(meshId: string, workspace: string): MeshCoordinatorSetup;
44
44
  export declare function resolveMeshCoordinatorSetup(options: ResolveMeshCoordinatorSetupOptions): MeshCoordinatorSetup;
45
+ /**
46
+ * Apply a provider's declared system-prompt injection rule, mutating `cliArgs`
47
+ * and `launchEnv` in place and writing any required workspace context file.
48
+ *
49
+ * Replaces the previous hard-coded `if (cliType === 'claude-cli') ... else if
50
+ * (cliType === 'hermes-cli') ...` branches in router.ts. Adding a new CLI is
51
+ * now provider.v1.json data, not a router edit.
52
+ *
53
+ * Failures are non-fatal: log and continue with whatever was applied so the
54
+ * coordinator session still launches, just without the prompt for that
55
+ * provider. A missing/unknown rule means "skip injection" — safe by default
56
+ * (the previous fallback unconditionally pushed --append-system-prompt onto
57
+ * every non-Claude CLI, which crashed agy on launch).
58
+ */
59
+ export interface CoordinatorInjectionEffect {
60
+ /** Absolute path the daemon wrote a wrapper-blocked file to. Only set for
61
+ * context_file injection. R48 schedules a strip after launch so workers
62
+ * don't see the wrapper on disk; R47's unregister cleanup uses it as a
63
+ * fallback if the timer never fires (process crash, etc). */
64
+ contextFilePath?: string;
65
+ }
66
+ export declare function applyMeshCoordinatorSystemPromptInjection(systemPrompt: string, injection: MeshCoordinatorSystemPromptInjection | undefined, ctx: {
67
+ cliArgs: string[];
68
+ launchEnv: Record<string, string>;
69
+ workspace: string;
70
+ cliType: string;
71
+ }): CoordinatorInjectionEffect;
72
+ /**
73
+ * Strip the daemon's wrapper block from a context_file we previously wrote.
74
+ *
75
+ * Used in two places:
76
+ * 1. R48 inject-then-remove: ~5s after spawn, after agy/gemini have read
77
+ * the file into their in-memory system-prompt cache. Removing it from
78
+ * disk at that point doesn't affect the running coordinator but keeps
79
+ * worker sessions (or fresh non-coordinator launches) in the same
80
+ * workspace from picking up our wrapper.
81
+ * 2. R47 unregister fallback: if the timer never fires (process crash,
82
+ * kill -9), coordinator-registry.unregisterMeshCoordinator runs the
83
+ * same logic when its entry is dropped.
84
+ *
85
+ * Idempotent: missing file is fine, missing sentinels are fine, returns
86
+ * silently. Leaves user-authored content outside the sentinels intact.
87
+ * Deletes the file outright if our wrapper was the only content.
88
+ */
89
+ export declare function stripCoordinatorWrapperFile(filePath: string): void;
90
+ export interface PtyExecResult {
91
+ exitCode: number | null;
92
+ signal: number | null;
93
+ output: string;
94
+ timedOut: boolean;
95
+ }
96
+ /**
97
+ * Run a one-shot CLI command under a real PTY and collect its output.
98
+ *
99
+ * Some provider mcp-registration commands (`agy mcp add`, future bubbletea
100
+ * TUIs) refuse to run without `/dev/tty`. Daemon-side `execFileSync` runs
101
+ * pipe-only, so those commands fail with errors like
102
+ * `bubbletea: error opening TTY: open /dev/tty: device not configured`
103
+ * and silently skip the registration, leaving the launched session
104
+ * without the adhdev-mesh MCP tools — which is exactly what we saw with
105
+ * agy coordinators.
106
+ *
107
+ * Wrapping the registration through node-pty gives the child a real PTY,
108
+ * so the bubbletea check passes. We close stdin immediately and just
109
+ * collect stdout until the process exits or the timeout fires.
110
+ */
111
+ export declare function execUnderPty(command: string, args: string[], options?: {
112
+ cwd?: string;
113
+ env?: Record<string, string>;
114
+ timeoutMs?: number;
115
+ }): Promise<PtyExecResult>;
@@ -111,6 +111,8 @@ export declare function readProviderChatHistory(agentType: string, options?: {
111
111
  historyBehavior?: ProviderHistoryBehavior;
112
112
  scripts?: ProviderNativeHistoryScripts;
113
113
  excludeInProgressTurn?: boolean;
114
+ sessionStartedAtMs?: number;
115
+ envOverrides?: Record<string, string>;
114
116
  }): {
115
117
  messages: HistoryMessage[];
116
118
  hasMore: boolean;
@@ -115,4 +115,7 @@ export declare function updateNode(meshId: string, nodeId: string, opts: {
115
115
  userOverrides?: Partial<RepoMeshNodeCapabilities>;
116
116
  policy?: RepoMeshNodePolicy;
117
117
  worktreeBootstrap?: LocalMeshNodeEntry['worktreeBootstrap'];
118
+ /** Per-node instruction surfaced in the coordinator prompt. Pass an
119
+ * empty string or undefined to clear it. */
120
+ systemPrompt?: string;
118
121
  }): LocalMeshNodeEntry | undefined;
package/dist/index.d.ts CHANGED
@@ -135,4 +135,15 @@ export type { ExtensionInfo as InstallerExtensionInfo } from './installer.js';
135
135
  export { initDaemonComponents, startDaemonDevSupport, shutdownDaemonComponents } from './boot/daemon-lifecycle.js';
136
136
  export type { DaemonInitConfig, DaemonComponents, DaemonDevSupportOptions } from './boot/daemon-lifecycle.js';
137
137
  export { startLocalIpcServer, buildIpcStatusHttpResponse, type LocalIpcServerOptions, type LocalIpcServerHandle, type IpcCommandContext, type IpcCommandResult, type IpcStatusPayload, } from './ipc/local-ipc-server.js';
138
+ export { evaluate as evaluateSpec, evaluate } from './providers/spec/evaluator.js';
139
+ export { loadSpec, resolveSpecPath } from './providers/spec/loader.js';
140
+ export { createNativeHistoryDispatcher } from './providers/native-history/index.js';
141
+ export type { ReaderId } from './providers/native-history/index.js';
142
+ export { readClaudeCliSession, readCodexCliSession, readAntigravityCliSession, readHermesCliSession, } from './providers/native-history/index.js';
143
+ export type { CliSpec, SpecState, ControlAction, Control, NotificationRule, DelegateTrigger, Section, } from './providers/spec/types.js';
144
+ export type { SpecEvaluation, TraceEntry } from './providers/spec/evaluator.js';
145
+ export { SpecDriver } from './providers/spec/driver.js';
146
+ export type { DashboardEvent, DashboardCommand, SpecDriverOpts } from './providers/spec/driver.js';
147
+ export { TerminalAdapter } from './providers/spec/adapter.js';
148
+ export type { TerminalAdapterOpts, TerminalAdapterHandlers } from './providers/spec/adapter.js';
138
149
  export { validateCliProviderManifest, formatManifestValidationIssues, type ManifestValidationIssue, type ManifestValidationResult, V1_CONTRACT_VERSION, V1_PRIMITIVE_CATALOG, V1_ALL_PRIMITIVES, } from './providers/sdk/v1/index.js';