@adhdev/daemon-core 0.8.33 → 0.8.35
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/index.d.ts +1 -1
- package/dist/index.js +127 -102
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +127 -102
- package/dist/index.mjs.map +1 -1
- package/dist/shared-types.d.ts +38 -0
- package/dist/status/reporter.d.ts +3 -0
- package/node_modules/@adhdev/session-host-core/package.json +1 -1
- package/package.json +1 -1
- package/src/agent-stream/forward.d.ts +8 -0
- package/src/agent-stream/index.d.ts +6 -0
- package/src/agent-stream/manager.d.ts +60 -0
- package/src/agent-stream/poller.d.ts +41 -0
- package/src/agent-stream/provider-adapter.d.ts +36 -0
- package/src/agent-stream/types.d.ts +68 -0
- package/src/boot/daemon-lifecycle.d.ts +100 -0
- package/src/cdp/devtools.d.ts +51 -0
- package/src/cdp/initializer.d.ts +50 -0
- package/src/cdp/manager.d.ts +147 -0
- package/src/cdp/scanner.d.ts +58 -0
- package/src/cdp/setup.d.ts +58 -0
- package/src/cli-adapter-types.d.ts +57 -0
- package/src/cli-adapters/provider-cli-adapter.d.ts +177 -0
- package/src/cli-adapters/provider-cli-adapter.ts +115 -91
- package/src/cli-adapters/provider-cli-config.d.ts +30 -0
- package/src/cli-adapters/provider-cli-parse.d.ts +42 -0
- package/src/cli-adapters/provider-cli-runtime.d.ts +29 -0
- package/src/cli-adapters/provider-cli-shared.d.ts +158 -0
- package/src/cli-adapters/pty-transport.d.ts +48 -0
- package/src/cli-adapters/session-host-transport.d.ts +20 -0
- package/src/cli-adapters/spawn-env.d.ts +8 -0
- package/src/cli-adapters/terminal-backends/ghostty-vt-backend.d.ts +16 -0
- package/src/cli-adapters/terminal-backends/types.d.ts +18 -0
- package/src/cli-adapters/terminal-backends/xterm-backend.d.ts +17 -0
- package/src/cli-adapters/terminal-screen.d.ts +33 -0
- package/src/commands/cdp-commands.d.ts +15 -0
- package/src/commands/chat-commands.d.ts +15 -0
- package/src/commands/cli-manager.d.ts +94 -0
- package/src/commands/handler.d.ts +103 -0
- package/src/commands/router.d.ts +98 -0
- package/src/commands/stream-commands.d.ts +14 -0
- package/src/commands/upgrade-helper.d.ts +10 -0
- package/src/commands/workspace-commands.d.ts +11 -0
- package/src/config/chat-history.d.ts +99 -0
- package/src/config/config.d.ts +14 -0
- package/src/config/recent-activity.d.ts +29 -0
- package/src/config/saved-sessions.d.ts +22 -0
- package/src/config/state-store.d.ts +32 -0
- package/src/config/workspaces.d.ts +0 -1
- package/src/daemon/dev-auto-implement.d.ts +43 -0
- package/src/daemon/dev-cdp-handlers.d.ts +22 -0
- package/src/daemon/dev-cli-debug.d.ts +106 -0
- package/src/daemon/dev-server-types.d.ts +43 -0
- package/src/daemon/dev-server.d.ts +140 -0
- package/src/daemon/scaffold-template.d.ts +32 -0
- package/src/daemon-core.d.ts +36 -0
- package/src/detection/cli-detector.d.ts +31 -0
- package/src/detection/ide-detector.d.ts +35 -0
- package/src/index.d.ts +83 -0
- package/src/index.ts +2 -0
- package/src/installer.d.ts +50 -0
- package/src/ipc-protocol.d.ts +111 -0
- package/src/launch.d.ts +46 -0
- package/src/logging/command-log.d.ts +31 -0
- package/src/logging/logger.d.ts +89 -0
- package/src/providers/acp-provider-instance.d.ts +102 -0
- package/src/providers/approval-utils.d.ts +7 -0
- package/src/providers/cli-provider-instance.d.ts +86 -0
- package/src/providers/contracts.d.ts +193 -1
- package/src/providers/control-effects.d.ts +4 -0
- package/src/providers/extension-provider-instance.d.ts +61 -0
- package/src/providers/ide-provider-instance.d.ts +70 -0
- package/src/providers/provider-instance-manager.d.ts +84 -0
- package/src/providers/provider-instance.d.ts +7 -1
- package/src/providers/provider-loader.d.ts +299 -0
- package/src/providers/status-monitor.d.ts +48 -0
- package/src/providers/version-archive.d.ts +52 -0
- package/src/session-host/runtime-support.d.ts +8 -0
- package/src/sessions/reconcile.d.ts +22 -0
- package/src/sessions/registry.d.ts +24 -0
- package/src/shared-types-extra.d.ts +29 -0
- package/src/shared-types.d.ts +79 -22
- package/src/shared-types.ts +40 -0
- package/src/status/builders.d.ts +33 -0
- package/src/status/reporter.d.ts +69 -0
- package/src/status/reporter.ts +16 -13
- package/src/status/snapshot.d.ts +58 -0
- package/src/system/host-memory.d.ts +19 -0
- package/src/types.d.ts +3 -7
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IdeProviderInstance — Runtime instance for IDE Provider
|
|
3
|
+
*
|
|
4
|
+
* Within a single IDE:
|
|
5
|
+
* 1. Native chat (readChat via CDP)
|
|
6
|
+
* 2. Extension agents (Cline, Roo Code etc)
|
|
7
|
+
*
|
|
8
|
+
* IDE Instance manages child Extension Instances.
|
|
9
|
+
* Daemon collects all via a single IDE Instance.getState() call.
|
|
10
|
+
*/
|
|
11
|
+
import type { ProviderModule } from './contracts.js';
|
|
12
|
+
import type { ProviderInstance, ProviderState, InstanceContext } from './provider-instance.js';
|
|
13
|
+
import { ExtensionProviderInstance } from './extension-provider-instance.js';
|
|
14
|
+
export declare class IdeProviderInstance implements ProviderInstance {
|
|
15
|
+
readonly type: string;
|
|
16
|
+
readonly category: "ide";
|
|
17
|
+
private provider;
|
|
18
|
+
private context;
|
|
19
|
+
private settings;
|
|
20
|
+
private events;
|
|
21
|
+
private tickErrorCount;
|
|
22
|
+
private cachedChat;
|
|
23
|
+
private currentStatus;
|
|
24
|
+
private lastAgentStatuses;
|
|
25
|
+
private generatingStartedAt;
|
|
26
|
+
private tickBusy;
|
|
27
|
+
private monitor;
|
|
28
|
+
private historyWriter;
|
|
29
|
+
private autoApproveBusy;
|
|
30
|
+
private appliedEffectKeys;
|
|
31
|
+
private runtimeMessages;
|
|
32
|
+
private ideVersion;
|
|
33
|
+
private instanceId;
|
|
34
|
+
private workspace;
|
|
35
|
+
private extensions;
|
|
36
|
+
constructor(provider: ProviderModule, instanceKey?: string);
|
|
37
|
+
init(context: InstanceContext): Promise<void>;
|
|
38
|
+
onTick(): Promise<void>;
|
|
39
|
+
getState(): ProviderState;
|
|
40
|
+
onEvent(event: string, data?: any): void;
|
|
41
|
+
dispose(): void;
|
|
42
|
+
updateSettings(newSettings: Record<string, any>): void;
|
|
43
|
+
/** Extension Instance add */
|
|
44
|
+
addExtension(provider: ProviderModule, settings?: Record<string, any>): Promise<void>;
|
|
45
|
+
/** Extension Instance remove */
|
|
46
|
+
removeExtension(type: string): void;
|
|
47
|
+
/** Extension Instance Import */
|
|
48
|
+
getExtension(type: string): ExtensionProviderInstance | undefined;
|
|
49
|
+
/** Child Extension list */
|
|
50
|
+
getExtensionTypes(): string[];
|
|
51
|
+
/** Query UUID instanceId */
|
|
52
|
+
getInstanceId(): string;
|
|
53
|
+
/** all Extension Instance list */
|
|
54
|
+
getExtensionInstances(): ExtensionProviderInstance[];
|
|
55
|
+
/** Set workspace from daemon launch context */
|
|
56
|
+
setWorkspace(workspace: string): void;
|
|
57
|
+
private readChat;
|
|
58
|
+
private getReadChatScript;
|
|
59
|
+
private detectAgentTransitions;
|
|
60
|
+
private pushEvent;
|
|
61
|
+
private applyProviderResponse;
|
|
62
|
+
private appendRuntimeSystemMessage;
|
|
63
|
+
private mergeConversationMessages;
|
|
64
|
+
private getPersistedEffectContent;
|
|
65
|
+
private getEffectDedupKey;
|
|
66
|
+
private flushEvents;
|
|
67
|
+
updateCdp(cdp: InstanceContext['cdp']): void;
|
|
68
|
+
private canAutoApprove;
|
|
69
|
+
private autoApproveViaScript;
|
|
70
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProviderInstanceManager — lifecycle management for all ProviderInstances
|
|
3
|
+
*
|
|
4
|
+
* Role:
|
|
5
|
+
* 1. Instance create/delete
|
|
6
|
+
* 2. Tick engine (periodic onTick calls)
|
|
7
|
+
* 3. Collect overall state
|
|
8
|
+
* 4. Event collection and propagation
|
|
9
|
+
*/
|
|
10
|
+
import type { ProviderInstance, ProviderState, ProviderEvent, InstanceContext } from './provider-instance.js';
|
|
11
|
+
export declare class ProviderInstanceManager {
|
|
12
|
+
private instances;
|
|
13
|
+
private tickTimer;
|
|
14
|
+
private tickInterval;
|
|
15
|
+
private eventListeners;
|
|
16
|
+
/**
|
|
17
|
+
* Instance add and initialize
|
|
18
|
+
*/
|
|
19
|
+
addInstance(id: string, instance: ProviderInstance, context: InstanceContext): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Instance remove
|
|
22
|
+
*/
|
|
23
|
+
removeInstance(id: string): void;
|
|
24
|
+
removeByCategory(category: 'cli' | 'ide' | 'extension' | 'acp', options?: {
|
|
25
|
+
dispose?: boolean;
|
|
26
|
+
}): number;
|
|
27
|
+
/**
|
|
28
|
+
* Import by Instance ID
|
|
29
|
+
*/
|
|
30
|
+
getInstance(id: string): ProviderInstance | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Per-category Instance list
|
|
33
|
+
*/
|
|
34
|
+
getByCategory(category: 'cli' | 'ide' | 'extension' | 'acp'): ProviderInstance[];
|
|
35
|
+
/**
|
|
36
|
+
* All Instance count
|
|
37
|
+
*/
|
|
38
|
+
get size(): number;
|
|
39
|
+
/**
|
|
40
|
+
* All Instance IDs (for iteration without exposing the private Map)
|
|
41
|
+
*/
|
|
42
|
+
listInstanceIds(): string[];
|
|
43
|
+
/**
|
|
44
|
+
* all Instance's current status collect
|
|
45
|
+
* + Propagate pending events to event listeners
|
|
46
|
+
*/
|
|
47
|
+
collectAllStates(): ProviderState[];
|
|
48
|
+
/**
|
|
49
|
+
* Per-category status collect
|
|
50
|
+
*/
|
|
51
|
+
collectStatesByCategory(category: 'cli' | 'ide' | 'extension' | 'acp'): ProviderState[];
|
|
52
|
+
/**
|
|
53
|
+
* Start tick — periodically call all Instance.onTick() call
|
|
54
|
+
*/
|
|
55
|
+
startTicking(intervalMs?: number): void;
|
|
56
|
+
/**
|
|
57
|
+
* Stop tick
|
|
58
|
+
*/
|
|
59
|
+
stopTicking(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Register event listener (used for daemon status_event transmission)
|
|
62
|
+
*/
|
|
63
|
+
onEvent(listener: (event: ProviderEvent & {
|
|
64
|
+
providerType: string;
|
|
65
|
+
}) => void): void;
|
|
66
|
+
private emitPendingEvents;
|
|
67
|
+
/**
|
|
68
|
+
* Forward event to specific Instance
|
|
69
|
+
*/
|
|
70
|
+
sendEvent(id: string, event: string, data?: any): void;
|
|
71
|
+
/**
|
|
72
|
+
* Broadcast event to all Instances
|
|
73
|
+
*/
|
|
74
|
+
broadcast(event: string, data?: any): void;
|
|
75
|
+
/**
|
|
76
|
+
* Update settings for all instances of a given provider type.
|
|
77
|
+
* Called when user changes settings from dashboard.
|
|
78
|
+
*/
|
|
79
|
+
updateInstanceSettings(providerType: string, settings: Record<string, any>): number;
|
|
80
|
+
/**
|
|
81
|
+
* All terminate
|
|
82
|
+
*/
|
|
83
|
+
disposeAll(): void;
|
|
84
|
+
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Each Instance manages its own status.
|
|
9
9
|
*/
|
|
10
10
|
import type { ProviderResumeCapability } from './contracts.js';
|
|
11
|
-
import type { AcpConfigOption, AcpMode } from '../shared-types.js';
|
|
11
|
+
import type { AcpConfigOption, AcpMode, ProviderControlSchema } from '../shared-types.js';
|
|
12
12
|
import type { ChatMessage } from '../types.js';
|
|
13
13
|
export type ProviderStatus = 'idle' | 'generating' | 'waiting_approval' | 'error' | 'stopped' | 'starting';
|
|
14
14
|
export interface ProviderRuntimeWriteOwner {
|
|
@@ -68,6 +68,10 @@ interface ProviderStateBase {
|
|
|
68
68
|
pendingEvents: ProviderEvent[];
|
|
69
69
|
runtime?: ProviderRuntimeInfo;
|
|
70
70
|
resume?: ProviderResumeCapability;
|
|
71
|
+
/** Dynamic control current values */
|
|
72
|
+
controlValues?: Record<string, string | number | boolean>;
|
|
73
|
+
/** Provider-declared controls schema (from provider.controls) */
|
|
74
|
+
providerControls?: ProviderControlSchema[];
|
|
71
75
|
}
|
|
72
76
|
/** IDE provider state */
|
|
73
77
|
export interface IdeProviderState extends ProviderStateBase {
|
|
@@ -111,6 +115,8 @@ export interface InstanceContext {
|
|
|
111
115
|
evaluate(script: string, timeout?: number): Promise<unknown>;
|
|
112
116
|
evaluateInWebviewFrame?(expression: string, matchFn?: (bodyPreview: string) => boolean): Promise<string | null>;
|
|
113
117
|
discoverAgentWebviews?(): Promise<any[]>;
|
|
118
|
+
/** Low-level CDP protocol method (e.g. Input.dispatchMouseEvent) */
|
|
119
|
+
send?(method: string, params?: Record<string, unknown>): Promise<unknown>;
|
|
114
120
|
};
|
|
115
121
|
/** Server log transmit */
|
|
116
122
|
serverConn?: {
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProviderLoader — Provider discovery + OS/version override resolution
|
|
3
|
+
*
|
|
4
|
+
* Role:
|
|
5
|
+
* 1. Load providers from upstream auto-download (~/.adhdev/providers/.upstream/)
|
|
6
|
+
* 2. Load user custom from ~/.adhdev/providers/ (overrides)
|
|
7
|
+
* 3. Apply OS/version overrides (process.platform + detected IDE version)
|
|
8
|
+
* 4. Hot-reload support (fs.watch)
|
|
9
|
+
*
|
|
10
|
+
* Design principles:
|
|
11
|
+
* - Load JS files via require() (CJS compatible)
|
|
12
|
+
* - User custom can override builtin
|
|
13
|
+
* - provider.js files are independent, so load order doesn't matter
|
|
14
|
+
*/
|
|
15
|
+
import { VersionArchive } from './version-archive.js';
|
|
16
|
+
import type { ProviderModule, ProviderCategory, ProviderSettingSchema, ResolvedProvider } from './contracts.js';
|
|
17
|
+
export declare class ProviderLoader {
|
|
18
|
+
private providers;
|
|
19
|
+
private providerAvailability;
|
|
20
|
+
private userDir;
|
|
21
|
+
private upstreamDir;
|
|
22
|
+
private disableUpstream;
|
|
23
|
+
private watchers;
|
|
24
|
+
private logFn;
|
|
25
|
+
private versionArchive;
|
|
26
|
+
private scriptsCache;
|
|
27
|
+
/** Inject VersionArchive so resolve() can auto-detect installed versions */
|
|
28
|
+
setVersionArchive(archive: VersionArchive): void;
|
|
29
|
+
private static readonly GITHUB_TARBALL_URL;
|
|
30
|
+
private static readonly META_FILE;
|
|
31
|
+
constructor(options?: {
|
|
32
|
+
userDir?: string;
|
|
33
|
+
logFn?: (msg: string) => void;
|
|
34
|
+
/** Disable upstream auto-download (for dev/testing/OSS) */
|
|
35
|
+
disableUpstream?: boolean;
|
|
36
|
+
});
|
|
37
|
+
private log;
|
|
38
|
+
/**
|
|
39
|
+
* User override root (~/.adhdev/providers by default).
|
|
40
|
+
*/
|
|
41
|
+
getUserDir(): string;
|
|
42
|
+
/**
|
|
43
|
+
* Auto-updated upstream root (~/.adhdev/providers/.upstream by default).
|
|
44
|
+
*/
|
|
45
|
+
getUpstreamDir(): string;
|
|
46
|
+
/**
|
|
47
|
+
* Provider search order for on-disk lookups.
|
|
48
|
+
* Highest-priority editable overrides come first.
|
|
49
|
+
*/
|
|
50
|
+
getProviderRoots(): string[];
|
|
51
|
+
/**
|
|
52
|
+
* Canonical provider directory shape for a given root.
|
|
53
|
+
*/
|
|
54
|
+
getProviderDir(root: string, category: ProviderCategory, type: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* Canonical user override directory for a provider.
|
|
57
|
+
*/
|
|
58
|
+
getUserProviderDir(category: ProviderCategory, type: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* Canonical upstream directory for a provider.
|
|
61
|
+
*/
|
|
62
|
+
getUpstreamProviderDir(category: ProviderCategory, type: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* Find the on-disk directory for a provider by type.
|
|
65
|
+
* Search order: user override → upstream.
|
|
66
|
+
*/
|
|
67
|
+
findProviderDir(type: string): string | null;
|
|
68
|
+
/**
|
|
69
|
+
* Resolve a file within a provider directory.
|
|
70
|
+
*/
|
|
71
|
+
resolveProviderFile(type: string, ...segments: string[]): string | null;
|
|
72
|
+
/**
|
|
73
|
+
* Load all providers (3-tier priority)
|
|
74
|
+
* 1. .upstream/ (GitHub auto-download — primary source)
|
|
75
|
+
* 2. User custom (~/.adhdev/providers/ excluding .upstream)
|
|
76
|
+
* User custom always wins (highest priority).
|
|
77
|
+
* If .upstream/ is empty, call fetchLatest() before loadAll().
|
|
78
|
+
*/
|
|
79
|
+
loadAll(): void;
|
|
80
|
+
/**
|
|
81
|
+
* Check if upstream directory exists and has providers.
|
|
82
|
+
*/
|
|
83
|
+
hasUpstream(): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Get raw provider metadata by type (NO scripts loaded).
|
|
86
|
+
* Safe for: category checks, icon, displayName, targetFilter, cdpPorts.
|
|
87
|
+
* NOT safe for: script execution (readChat, listModels, sendMessage).
|
|
88
|
+
* Use resolve() when scripts are needed.
|
|
89
|
+
*/
|
|
90
|
+
getMeta(type: string): ProviderModule | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Resolve provider type by alias
|
|
93
|
+
* 'claude' → 'claude-cli', 'codex' → 'codex-cli' etc
|
|
94
|
+
* Returns input as-is if no match found.
|
|
95
|
+
*/
|
|
96
|
+
resolveAlias(input: string): string;
|
|
97
|
+
/**
|
|
98
|
+
* Get provider with alias resolution (get + alias fallback)
|
|
99
|
+
*/
|
|
100
|
+
getByAlias(input: string): ProviderModule | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Build CLI/ACP detection list (replaces cli-detector)
|
|
103
|
+
* Dynamically generated from provider.js spawn.command.
|
|
104
|
+
*/
|
|
105
|
+
getCliDetectionList(): {
|
|
106
|
+
id: string;
|
|
107
|
+
displayName: string;
|
|
108
|
+
icon: string;
|
|
109
|
+
command: string;
|
|
110
|
+
category: string;
|
|
111
|
+
versionCommand?: string;
|
|
112
|
+
}[];
|
|
113
|
+
/**
|
|
114
|
+
* List providers by category
|
|
115
|
+
*/
|
|
116
|
+
getByCategory(cat: ProviderCategory): ProviderModule[];
|
|
117
|
+
/**
|
|
118
|
+
* Extension Extension providers with extensionIdPattern only
|
|
119
|
+
* (used by discoverAgentWebviews in daemon-cdp.ts)
|
|
120
|
+
*/
|
|
121
|
+
getExtensionProviders(): ProviderModule[];
|
|
122
|
+
/**
|
|
123
|
+
* All loaded providers
|
|
124
|
+
*/
|
|
125
|
+
getAll(): ProviderModule[];
|
|
126
|
+
/**
|
|
127
|
+
* Check if a provider is enabled (per-IDE)
|
|
128
|
+
* Checks ideSettings[ideType].extensions[type].enabled.
|
|
129
|
+
* Default false (disabled) — user must explicitly enable.
|
|
130
|
+
* Always returns true when called without ideType.
|
|
131
|
+
*/
|
|
132
|
+
isEnabled(type: string, ideType?: string): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Resolve per-IDE extension enabled state using the same normalization
|
|
135
|
+
* that runtime attach/remove uses.
|
|
136
|
+
*/
|
|
137
|
+
getIdeExtensionEnabledState(ideType: string, extensionType: string): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Save IDE extension enabled setting
|
|
140
|
+
*/
|
|
141
|
+
setIdeExtensionEnabled(ideType: string, extensionType: string, enabled: boolean): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Return only enabled providers by category (per-IDE)
|
|
144
|
+
*/
|
|
145
|
+
getEnabledByCategory(cat: ProviderCategory, ideType?: string): ProviderModule[];
|
|
146
|
+
/**
|
|
147
|
+
* Extension Enabled extension providers with extensionIdPattern only (per-IDE)
|
|
148
|
+
*/
|
|
149
|
+
getEnabledExtensionProviders(ideType?: string): ProviderModule[];
|
|
150
|
+
/**
|
|
151
|
+
* Return CDP port map for IDE providers
|
|
152
|
+
* Used by launch.ts, adhdev-daemon.ts
|
|
153
|
+
*/
|
|
154
|
+
getCdpPortMap(): Record<string, [number, number]>;
|
|
155
|
+
/**
|
|
156
|
+
* Return IDE process name map (macOS)
|
|
157
|
+
*/
|
|
158
|
+
getMacAppIdentifiers(): Record<string, string>;
|
|
159
|
+
/**
|
|
160
|
+
* Return IDE process name map (Windows)
|
|
161
|
+
*/
|
|
162
|
+
getWinProcessNames(): Record<string, string[]>;
|
|
163
|
+
/**
|
|
164
|
+
* Available IDE types (only those with cdpPorts)
|
|
165
|
+
*/
|
|
166
|
+
getAvailableIdeTypes(): string[];
|
|
167
|
+
getSpawnCommand(type: string, fallback?: string): string;
|
|
168
|
+
getIdeCliCommand(type: string, fallback?: string | null): string | null;
|
|
169
|
+
getIdePathCandidates(type: string, fallback?: string[]): string[];
|
|
170
|
+
setProviderAvailability(type: string, state: {
|
|
171
|
+
installed: boolean;
|
|
172
|
+
detectedPath?: string | null;
|
|
173
|
+
}): void;
|
|
174
|
+
setCliDetectionResults(results: Array<{
|
|
175
|
+
id: string;
|
|
176
|
+
installed: boolean;
|
|
177
|
+
path?: string;
|
|
178
|
+
}>, replace?: boolean): void;
|
|
179
|
+
setIdeDetectionResults(results: Array<{
|
|
180
|
+
id: string;
|
|
181
|
+
installed: boolean;
|
|
182
|
+
path?: string | null;
|
|
183
|
+
cliCommand?: string | null;
|
|
184
|
+
}>, replace?: boolean): void;
|
|
185
|
+
getAvailableProviderInfos(): Array<ProviderModule & {
|
|
186
|
+
installed?: boolean;
|
|
187
|
+
detectedPath?: string | null;
|
|
188
|
+
}>;
|
|
189
|
+
/**
|
|
190
|
+
* Register IDE providers to core/detector registry
|
|
191
|
+
* → Enables detectIDEs() to detect provider.js-based IDEs
|
|
192
|
+
*/
|
|
193
|
+
registerToDetector(): number;
|
|
194
|
+
/**
|
|
195
|
+
* Return final provider with OS/version overrides applied.
|
|
196
|
+
*
|
|
197
|
+
* Script resolution order:
|
|
198
|
+
* 1. compatibility array (new format — preferred)
|
|
199
|
+
* Provider.json defines: "compatibility": [{ "ideVersion": ">=1.107.0", "scriptDir": "scripts/1.107" }]
|
|
200
|
+
* First matching range wins. Fallback: defaultScriptDir.
|
|
201
|
+
* 2. versions field (legacy format — backward compat)
|
|
202
|
+
* "versions": { "< 1.107.0": { "__dir": "scripts/legacy" } }
|
|
203
|
+
* 3. Root scripts.js (original format — no versioning)
|
|
204
|
+
*
|
|
205
|
+
* Version source: context.version → VersionArchive → undefined
|
|
206
|
+
*/
|
|
207
|
+
resolve(type: string, context?: {
|
|
208
|
+
os?: string;
|
|
209
|
+
version?: string;
|
|
210
|
+
}): ResolvedProvider | undefined;
|
|
211
|
+
/**
|
|
212
|
+
* Load scripts from a scriptDir within a provider directory.
|
|
213
|
+
* Tries scripts.js first, then individual .js files.
|
|
214
|
+
*/
|
|
215
|
+
private loadScriptsFromDir;
|
|
216
|
+
/**
|
|
217
|
+
* Hot-reload: start watching for file changes
|
|
218
|
+
*/
|
|
219
|
+
watch(): void;
|
|
220
|
+
/**
|
|
221
|
+
* Stop hot-reload
|
|
222
|
+
*/
|
|
223
|
+
stopWatch(): void;
|
|
224
|
+
/**
|
|
225
|
+
* Full reload
|
|
226
|
+
*/
|
|
227
|
+
reload(): void;
|
|
228
|
+
/**
|
|
229
|
+
* Download latest providers tarball from GitHub → extract to .upstream/
|
|
230
|
+
* - ETag-based change detection (skip if unchanged)
|
|
231
|
+
* - Never touches user custom files in ~/.adhdev/providers/
|
|
232
|
+
* - Runs in background; existing providers are kept on failure
|
|
233
|
+
*
|
|
234
|
+
* @returns Whether an update occurred
|
|
235
|
+
*/
|
|
236
|
+
fetchLatest(): Promise<{
|
|
237
|
+
updated: boolean;
|
|
238
|
+
error?: string;
|
|
239
|
+
}>;
|
|
240
|
+
/** HTTP(S) file download (follows redirects) */
|
|
241
|
+
private downloadFile;
|
|
242
|
+
/** Recursive directory copy */
|
|
243
|
+
private copyDirRecursive;
|
|
244
|
+
/** .meta.json save */
|
|
245
|
+
private writeMeta;
|
|
246
|
+
/** Count provider files (provider.js or provider.json) */
|
|
247
|
+
private countProviders;
|
|
248
|
+
/**
|
|
249
|
+
* Get public settings schema for a provider (for dashboard UI rendering)
|
|
250
|
+
*/
|
|
251
|
+
getPublicSettings(type: string): ProviderSettingSchema[];
|
|
252
|
+
/**
|
|
253
|
+
* Get public settings schema for all providers
|
|
254
|
+
*/
|
|
255
|
+
getAllPublicSettings(): Record<string, ProviderSettingSchema[]>;
|
|
256
|
+
/**
|
|
257
|
+
* Resolved setting value for a provider (default + user override)
|
|
258
|
+
*/
|
|
259
|
+
getSettingValue(type: string, key: string): any;
|
|
260
|
+
/**
|
|
261
|
+
* All resolved settings for a provider (default + user override)
|
|
262
|
+
*/
|
|
263
|
+
getSettings(type: string): Record<string, any>;
|
|
264
|
+
/**
|
|
265
|
+
* Save provider setting value (writes to config.json)
|
|
266
|
+
*/
|
|
267
|
+
setSetting(type: string, key: string, value: any): boolean;
|
|
268
|
+
private getOptionalStringSetting;
|
|
269
|
+
protected readConfig(): any | null;
|
|
270
|
+
protected writeConfig(config: any): void;
|
|
271
|
+
private getPlatformVersionCommand;
|
|
272
|
+
private getSettingsSchema;
|
|
273
|
+
private getSyntheticSettings;
|
|
274
|
+
/**
|
|
275
|
+
* Find the on-disk directory for a provider by type.
|
|
276
|
+
* Canonical shape: root/category/type.
|
|
277
|
+
*/
|
|
278
|
+
private findProviderDirInternal;
|
|
279
|
+
/**
|
|
280
|
+
* Build a scripts function map from individual .js files in a directory.
|
|
281
|
+
* Each file is wrapped as: (params?) => fs.readFileSync(filePath, 'utf-8')
|
|
282
|
+
* (template substitution is NOT applied here — scripts.js handles that)
|
|
283
|
+
*/
|
|
284
|
+
private buildScriptWrappersFromDir;
|
|
285
|
+
/**
|
|
286
|
+
* Recursively scan directory to load provider files
|
|
287
|
+
* Supports two formats:
|
|
288
|
+
* 1. provider.json (metadata) + scripts.js (optional CDP scripts)
|
|
289
|
+
* 2. provider.js (legacy — everything in one file)
|
|
290
|
+
* Structure: dir/category/agent-name/provider.{json,js}
|
|
291
|
+
*/
|
|
292
|
+
private loadDir;
|
|
293
|
+
/**
|
|
294
|
+
* Simple semver range matching
|
|
295
|
+
* Supported formats: '>=4.0.0', '<3.0.0', '>=2.1.0'
|
|
296
|
+
*/
|
|
297
|
+
private matchesVersion;
|
|
298
|
+
private compareVersions;
|
|
299
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StatusMonitor — Status monitoring notification system
|
|
3
|
+
*
|
|
4
|
+
* Common across all Provider categories (IDE/Extension/CLI/ACP).
|
|
5
|
+
* - Approval waiting (waiting_approval) notification
|
|
6
|
+
* - Notification when generating persists for extended duration
|
|
7
|
+
* - All config toggleable via Provider Settings
|
|
8
|
+
*/
|
|
9
|
+
export interface MonitorConfig {
|
|
10
|
+
/** Enable awaiting-approval notification */
|
|
11
|
+
approvalAlert: boolean;
|
|
12
|
+
/** Prolonged generating notification enabled */
|
|
13
|
+
longGeneratingAlert: boolean;
|
|
14
|
+
/** Prolonged threshold (seconds) */
|
|
15
|
+
longGeneratingThresholdSec: number;
|
|
16
|
+
/** Repeat notification cooldown (seconds) */
|
|
17
|
+
alertCooldownSec: number;
|
|
18
|
+
}
|
|
19
|
+
export declare const DEFAULT_MONITOR_CONFIG: MonitorConfig;
|
|
20
|
+
export interface MonitorEvent {
|
|
21
|
+
type: string;
|
|
22
|
+
agentKey: string;
|
|
23
|
+
timestamp: number;
|
|
24
|
+
elapsedSec?: number;
|
|
25
|
+
message?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare class StatusMonitor {
|
|
28
|
+
private config;
|
|
29
|
+
private lastAlertTime;
|
|
30
|
+
private generatingStartTimes;
|
|
31
|
+
private longGeneratingAlerted;
|
|
32
|
+
private lastProgressFingerprint;
|
|
33
|
+
private lastProgressChangeAt;
|
|
34
|
+
constructor(config?: Partial<MonitorConfig>);
|
|
35
|
+
/** Update config (called from Provider Settings) */
|
|
36
|
+
updateConfig(partial: Partial<MonitorConfig>): void;
|
|
37
|
+
/** Return current config */
|
|
38
|
+
getConfig(): MonitorConfig;
|
|
39
|
+
/**
|
|
40
|
+
* Check status transition → return notification event array.
|
|
41
|
+
* Called from each onTick() or detectStatusTransition().
|
|
42
|
+
*/
|
|
43
|
+
check(agentKey: string, status: string, now: number, progressFingerprint?: string): MonitorEvent[];
|
|
44
|
+
/** Cooldown check — prevent sending the same notification too frequently */
|
|
45
|
+
private shouldAlert;
|
|
46
|
+
/** Reset (on agent terminate/restart) */
|
|
47
|
+
reset(agentKey?: string): void;
|
|
48
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Version Detection & Archiving
|
|
3
|
+
*
|
|
4
|
+
* Detects installed versions for all provider categories (IDE, CLI, ACP, Extension).
|
|
5
|
+
* Archives version history to ~/.adhdev/version-history.json for compatibility tracking.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* const archive = new VersionArchive();
|
|
9
|
+
* const results = await detectAllVersions(providerLoader, archive);
|
|
10
|
+
*/
|
|
11
|
+
import type { ProviderLoader } from './provider-loader.js';
|
|
12
|
+
export interface ProviderVersionInfo {
|
|
13
|
+
type: string;
|
|
14
|
+
name: string;
|
|
15
|
+
category: string;
|
|
16
|
+
installed: boolean;
|
|
17
|
+
version: string | null;
|
|
18
|
+
path: string | null;
|
|
19
|
+
binary: string | null;
|
|
20
|
+
detectedAt: string;
|
|
21
|
+
/**
|
|
22
|
+
* Set when the detected version is NOT listed in provider.json testedVersions.
|
|
23
|
+
* Means scripts may not work correctly with this version.
|
|
24
|
+
*/
|
|
25
|
+
warning?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface VersionHistoryEntry {
|
|
28
|
+
version: string;
|
|
29
|
+
detectedAt: string;
|
|
30
|
+
os: string;
|
|
31
|
+
}
|
|
32
|
+
export interface VersionHistory {
|
|
33
|
+
[providerType: string]: VersionHistoryEntry[];
|
|
34
|
+
}
|
|
35
|
+
export declare class VersionArchive {
|
|
36
|
+
private history;
|
|
37
|
+
constructor();
|
|
38
|
+
private load;
|
|
39
|
+
/** Record a detected version (deduplicates same version) */
|
|
40
|
+
record(type: string, version: string): void;
|
|
41
|
+
/** Get version history for a provider */
|
|
42
|
+
getHistory(type: string): VersionHistoryEntry[];
|
|
43
|
+
/** Get latest known version for a provider */
|
|
44
|
+
getLatest(type: string): string | null;
|
|
45
|
+
/** Get full archive */
|
|
46
|
+
getAll(): VersionHistory;
|
|
47
|
+
private save;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Detect versions for all loaded providers
|
|
51
|
+
*/
|
|
52
|
+
export declare function detectAllVersions(loader: ProviderLoader, archive?: VersionArchive): Promise<ProviderVersionInfo[]>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type SessionHostEndpoint } from '@adhdev/session-host-core';
|
|
2
|
+
import type { HostedCliRuntimeDescriptor } from '../commands/cli-manager.js';
|
|
3
|
+
export declare function ensureSessionHostReady(options: {
|
|
4
|
+
appName?: string;
|
|
5
|
+
spawnHost: () => void;
|
|
6
|
+
timeoutMs?: number;
|
|
7
|
+
}): Promise<SessionHostEndpoint>;
|
|
8
|
+
export declare function listHostedCliRuntimes(endpoint: SessionHostEndpoint): Promise<HostedCliRuntimeDescriptor[]>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { SessionRegistry } from './registry.js';
|
|
2
|
+
interface IdeLikeInstance {
|
|
3
|
+
category?: string;
|
|
4
|
+
type?: string;
|
|
5
|
+
getInstanceId?: () => string;
|
|
6
|
+
getExtensionInstances?: () => Array<{
|
|
7
|
+
type?: string;
|
|
8
|
+
getInstanceId?: () => string;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
interface InstanceManagerLike {
|
|
12
|
+
listInstanceIds(): string[];
|
|
13
|
+
getInstance(id: string): IdeLikeInstance | undefined;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Rebuild missing IDE/runtime session registry entries from live ProviderInstance objects.
|
|
17
|
+
*
|
|
18
|
+
* This is a defensive repair path for cases where an IDE extension instance still exists
|
|
19
|
+
* in InstanceManager/status, but its runtime session entry has been dropped from SessionRegistry.
|
|
20
|
+
*/
|
|
21
|
+
export declare function reconcileIdeRuntimeSessions(instanceManager: InstanceManagerLike | undefined, sessionRegistry: SessionRegistry | undefined): void;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SessionTransport } from '../shared-types.js';
|
|
2
|
+
export interface SessionRuntimeTarget {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
parentSessionId: string | null;
|
|
5
|
+
providerType: string;
|
|
6
|
+
transport: SessionTransport;
|
|
7
|
+
cdpManagerKey?: string;
|
|
8
|
+
adapterKey?: string;
|
|
9
|
+
instanceKey?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class SessionRegistry {
|
|
12
|
+
private readonly bySessionId;
|
|
13
|
+
private readonly byManagerKey;
|
|
14
|
+
private readonly byInstanceKey;
|
|
15
|
+
private readonly byParentSessionId;
|
|
16
|
+
register(target: SessionRuntimeTarget): void;
|
|
17
|
+
get(sessionId: string | undefined | null): SessionRuntimeTarget | undefined;
|
|
18
|
+
unregister(sessionId: string | undefined | null): void;
|
|
19
|
+
unregisterByManagerKey(managerKey: string): void;
|
|
20
|
+
unregisterByInstanceKey(instanceKey: string): void;
|
|
21
|
+
listChildren(parentSessionId: string): SessionRuntimeTarget[];
|
|
22
|
+
private addIndex;
|
|
23
|
+
private removeIndex;
|
|
24
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADHDev Shared Types — Additional cross-package type definitions
|
|
3
|
+
*
|
|
4
|
+
* Extracted common sub-types previously inlined across multiple packages.
|
|
5
|
+
* Separated from shared-types.ts due to rollup-dts bundling constraints.
|
|
6
|
+
*
|
|
7
|
+
* IMPORTANT: This file must remain runtime-free (types only).
|
|
8
|
+
*/
|
|
9
|
+
/** Runtime terminal write-owner descriptor */
|
|
10
|
+
export interface RuntimeWriteOwner {
|
|
11
|
+
clientId: string;
|
|
12
|
+
ownerType: 'agent' | 'user';
|
|
13
|
+
}
|
|
14
|
+
/** Runtime attached client descriptor */
|
|
15
|
+
export interface RuntimeAttachedClient {
|
|
16
|
+
clientId: string;
|
|
17
|
+
type: 'daemon' | 'web' | 'local-terminal';
|
|
18
|
+
readOnly: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Session status union (used by SessionEntry.status, legacy recent-launch metadata, etc.) */
|
|
21
|
+
export type SessionStatus = 'idle' | 'generating' | 'waiting_approval' | 'error' | 'stopped' | 'starting' | 'panel_hidden' | 'not_monitored' | 'disconnected';
|
|
22
|
+
/** Inbox bucket categories for recent sessions */
|
|
23
|
+
export type RecentSessionBucket = 'needs_attention' | 'working' | 'task_complete' | 'idle';
|
|
24
|
+
/** Terminal backend status */
|
|
25
|
+
export interface TerminalBackendStatus {
|
|
26
|
+
backend: 'xterm' | 'ghostty-vt';
|
|
27
|
+
preference: 'auto' | 'xterm' | 'ghostty-vt';
|
|
28
|
+
ghosttyAvailable: boolean;
|
|
29
|
+
}
|