@adhdev/daemon-core 0.8.87 → 0.8.89
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 +2 -1
- package/dist/index.js +107 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +95 -28
- package/dist/index.mjs.map +1 -1
- package/dist/runtime-defaults.d.ts +11 -0
- package/node_modules/@adhdev/session-host-core/package.json +1 -1
- package/package.json +1 -1
- package/src/boot/daemon-lifecycle.ts +7 -3
- package/src/cdp/initializer.ts +3 -2
- package/src/cdp/scanner.ts +3 -2
- package/src/cli-adapters/provider-cli-adapter.ts +78 -18
- package/src/index.ts +14 -1
- package/src/runtime-defaults.ts +16 -0
- package/src/session-host/runtime-support.ts +2 -1
- package/src/status/reporter.ts +10 -5
package/dist/index.d.ts
CHANGED
|
@@ -60,6 +60,7 @@ export { logCommand, getRecentCommands } from './logging/command-log.js';
|
|
|
60
60
|
export { DaemonCliManager } from './commands/cli-manager.js';
|
|
61
61
|
export { launchWithCdp, getAvailableIdeIds, killIdeProcess, isIdeRunning } from './launch.js';
|
|
62
62
|
export { DEFAULT_DAEMON_PORT, DAEMON_WS_PATH } from './ipc-protocol.js';
|
|
63
|
+
export { DEFAULT_CDP_SCAN_INTERVAL_MS, DEFAULT_CDP_DISCOVERY_INTERVAL_MS, DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS, DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS, DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS, MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS, DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS, MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS, DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS, DEFAULT_SESSION_HOST_READY_TIMEOUT_MS, STANDALONE_CDP_SCAN_INTERVAL_MS, } from './runtime-defaults.js';
|
|
63
64
|
export { readChatHistory } from './config/chat-history.js';
|
|
64
65
|
export { hashSignatureParts, buildChatMessageSignature, buildChatTailDeliverySignature, buildSessionModalDeliverySignature, } from './chat/chat-signatures.js';
|
|
65
66
|
export type { ChatMessageSignatureInput, ChatTailDeliverySignatureInput, SessionModalDeliverySignatureInput, } from './chat/chat-signatures.js';
|
|
@@ -84,7 +85,7 @@ export { BUILTIN_CHAT_MESSAGE_KINDS, isBuiltinChatMessageKind, normalizeChatMess
|
|
|
84
85
|
export type { BuiltinChatMessageKind, ChatMessageKind } from './providers/chat-message-normalization.js';
|
|
85
86
|
export { VersionArchive, detectAllVersions } from './providers/version-archive.js';
|
|
86
87
|
export type { ProviderVersionInfo, VersionHistory } from './providers/version-archive.js';
|
|
87
|
-
export { DevServer } from './daemon/dev-server.js';
|
|
88
|
+
export { DevServer, DEV_SERVER_PORT } from './daemon/dev-server.js';
|
|
88
89
|
export { ProviderCliAdapter } from './cli-adapters/provider-cli-adapter.js';
|
|
89
90
|
export type { CliAdapter } from './cli-adapter-types.js';
|
|
90
91
|
export { NodePtyTransportFactory } from './cli-adapters/pty-transport.js';
|
package/dist/index.js
CHANGED
|
@@ -2462,8 +2462,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
2462
2462
|
const buttons = Array.isArray(modal.buttons) ? modal.buttons : [];
|
|
2463
2463
|
if (buttons.length !== 1) return false;
|
|
2464
2464
|
const buttonLabel = String(buttons[0] || "").trim();
|
|
2465
|
-
|
|
2466
|
-
return looksLikeConfirmOnlyLabel(buttonLabel) || /Quick safety check|project trust|trust (?:this project|the contents of this directory|the files in this folder)|Enter to confirm/i.test(modalText);
|
|
2465
|
+
return looksLikeConfirmOnlyLabel(buttonLabel);
|
|
2467
2466
|
}
|
|
2468
2467
|
async waitForInteractivePrompt(maxWaitMs = 5e3) {
|
|
2469
2468
|
const startedAt = Date.now();
|
|
@@ -3079,11 +3078,14 @@ var init_provider_cli_adapter = __esm({
|
|
|
3079
3078
|
}
|
|
3080
3079
|
// ─── Public API (CliAdapter) ───────────────────
|
|
3081
3080
|
getStatus() {
|
|
3081
|
+
const screenText = this.terminalScreen.getText() || "";
|
|
3082
|
+
const startupModal = this.startupParseGate ? this.getStartupConfirmationModal(screenText) : null;
|
|
3083
|
+
const effectiveStatus = this.parseErrorMessage ? "error" : startupModal ? "waiting_approval" : this.currentStatus;
|
|
3082
3084
|
return {
|
|
3083
|
-
status:
|
|
3085
|
+
status: effectiveStatus,
|
|
3084
3086
|
messages: [...this.committedMessages],
|
|
3085
3087
|
workingDir: this.workingDir,
|
|
3086
|
-
activeModal: this.activeModal,
|
|
3088
|
+
activeModal: startupModal || this.activeModal,
|
|
3087
3089
|
errorMessage: this.parseErrorMessage || void 0,
|
|
3088
3090
|
errorReason: this.parseErrorMessage ? "parse_error" : void 0
|
|
3089
3091
|
};
|
|
@@ -3136,8 +3138,38 @@ var init_provider_cli_adapter = __esm({
|
|
|
3136
3138
|
index: typeof message.index === "number" ? message.index : index,
|
|
3137
3139
|
receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
|
|
3138
3140
|
}));
|
|
3139
|
-
const
|
|
3140
|
-
const
|
|
3141
|
+
const parsedLastAssistant = [...parsedHydratedMessages].reverse().find((message) => message.role === "assistant" && typeof message.content === "string" && message.content.trim());
|
|
3142
|
+
const visibleIdlePrompt = this.looksLikeVisibleIdlePrompt(screenText);
|
|
3143
|
+
const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedHydratedMessages.length > committedHydratedMessages.length && (this.currentStatus === "idle" || this.currentStatus === "generating" && this.isWaitingForResponse && parsed.status === "idle" && visibleIdlePrompt);
|
|
3144
|
+
if (shouldAdoptParsedIdleReplay) {
|
|
3145
|
+
this.committedMessages = normalizeCliParsedMessages(parsed.messages, {
|
|
3146
|
+
committedMessages: this.committedMessages,
|
|
3147
|
+
scope: this.currentTurnScope,
|
|
3148
|
+
lastOutputAt: this.lastOutputAt
|
|
3149
|
+
});
|
|
3150
|
+
this.syncMessageViews();
|
|
3151
|
+
if (this.currentStatus !== "idle" || this.isWaitingForResponse) {
|
|
3152
|
+
this.responseBuffer = "";
|
|
3153
|
+
this.isWaitingForResponse = false;
|
|
3154
|
+
this.responseSettleIgnoreUntil = 0;
|
|
3155
|
+
this.submitRetryUsed = false;
|
|
3156
|
+
this.submitRetryPromptSnippet = "";
|
|
3157
|
+
this.finishRetryCount = 0;
|
|
3158
|
+
this.currentTurnScope = null;
|
|
3159
|
+
this.activeModal = null;
|
|
3160
|
+
this.setStatus("idle", "parsed_idle_replay_commit");
|
|
3161
|
+
this.onStatusChange?.();
|
|
3162
|
+
}
|
|
3163
|
+
}
|
|
3164
|
+
const effectiveCommittedHydratedMessages = shouldAdoptParsedIdleReplay ? this.committedMessages.map((message, index) => buildChatMessage({
|
|
3165
|
+
...message,
|
|
3166
|
+
id: message.id || `msg_${index}`,
|
|
3167
|
+
index: typeof message.index === "number" ? message.index : index,
|
|
3168
|
+
receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
|
|
3169
|
+
})) : committedHydratedMessages;
|
|
3170
|
+
const shouldPreferCommittedHistoryReplay = !this.currentTurnScope && !this.activeModal && effectiveCommittedHydratedMessages.length > parsedHydratedMessages.length;
|
|
3171
|
+
const shouldPreferCommittedIdleReplay = shouldPreferCommittedMessages && !shouldAdoptParsedIdleReplay;
|
|
3172
|
+
const hydratedMessages = shouldPreferCommittedIdleReplay || shouldPreferCommittedHistoryReplay ? effectiveCommittedHydratedMessages : parsedHydratedMessages;
|
|
3141
3173
|
result = {
|
|
3142
3174
|
id: parsed.id || "cli_session",
|
|
3143
3175
|
status: parsed.status || this.currentStatus,
|
|
@@ -3738,8 +3770,9 @@ ${data.message || ""}`.trim();
|
|
|
3738
3770
|
this.ptyProcess?.write(data);
|
|
3739
3771
|
}
|
|
3740
3772
|
resolveModal(buttonIndex) {
|
|
3741
|
-
|
|
3742
|
-
const modal = this.activeModal;
|
|
3773
|
+
const screenText = this.terminalScreen.getText() || "";
|
|
3774
|
+
const modal = this.activeModal || this.getStartupConfirmationModal(screenText);
|
|
3775
|
+
if (!this.ptyProcess || this.currentStatus !== "waiting_approval" && !modal) return;
|
|
3743
3776
|
this.clearIdleFinishCandidate("resolve_modal");
|
|
3744
3777
|
this.recordTrace("resolve_modal", {
|
|
3745
3778
|
buttonIndex,
|
|
@@ -3754,7 +3787,10 @@ ${data.message || ""}`.trim();
|
|
|
3754
3787
|
}
|
|
3755
3788
|
this.setStatus("generating", "approval_resolved");
|
|
3756
3789
|
this.onStatusChange?.();
|
|
3757
|
-
|
|
3790
|
+
const startupTrustModal = /Quick safety check|project trust|trust (?:this project|the contents of this directory|the files in this folder)/i.test(String(modal?.message || ""));
|
|
3791
|
+
if (startupTrustModal && buttonIndex in this.approvalKeys) {
|
|
3792
|
+
this.ptyProcess.write(`${this.approvalKeys[buttonIndex]}\r`);
|
|
3793
|
+
} else if (this.shouldResolveModalWithEnter(modal, buttonIndex)) {
|
|
3758
3794
|
this.ptyProcess.write("\r");
|
|
3759
3795
|
} else if (buttonIndex in this.approvalKeys) {
|
|
3760
3796
|
this.ptyProcess.write(this.approvalKeys[buttonIndex]);
|
|
@@ -3775,20 +3811,24 @@ ${data.message || ""}`.trim();
|
|
|
3775
3811
|
}
|
|
3776
3812
|
}
|
|
3777
3813
|
getDebugState() {
|
|
3814
|
+
const screenText = sanitizeTerminalText(this.terminalScreen.getText());
|
|
3815
|
+
const startupModal = this.startupParseGate ? this.getStartupConfirmationModal(screenText) : null;
|
|
3816
|
+
const effectiveStatus = startupModal ? "waiting_approval" : this.currentStatus;
|
|
3817
|
+
const effectiveReady = this.ready || !!startupModal;
|
|
3778
3818
|
return {
|
|
3779
3819
|
type: this.cliType,
|
|
3780
3820
|
name: this.cliName,
|
|
3781
3821
|
providerResolution: this.providerResolutionMeta,
|
|
3782
|
-
status:
|
|
3783
|
-
ready:
|
|
3822
|
+
status: effectiveStatus,
|
|
3823
|
+
ready: effectiveReady,
|
|
3784
3824
|
startupParseGate: this.startupParseGate,
|
|
3785
3825
|
spawnAt: this.spawnAt,
|
|
3786
3826
|
workingDir: this.workingDir,
|
|
3787
|
-
messages: this.messages
|
|
3788
|
-
committedMessages: this.committedMessages
|
|
3789
|
-
structuredMessages: this.structuredMessages
|
|
3827
|
+
messages: this.messages,
|
|
3828
|
+
committedMessages: this.committedMessages,
|
|
3829
|
+
structuredMessages: this.structuredMessages,
|
|
3790
3830
|
messageCount: this.committedMessages.length,
|
|
3791
|
-
screenText:
|
|
3831
|
+
screenText: screenText.slice(-4e3),
|
|
3792
3832
|
currentTurnScope: this.currentTurnScope,
|
|
3793
3833
|
startupBuffer: this.startupBuffer.slice(-4e3),
|
|
3794
3834
|
recentOutputBuffer: this.recentOutputBuffer.slice(-500),
|
|
@@ -3803,7 +3843,7 @@ ${data.message || ""}`.trim();
|
|
|
3803
3843
|
lastScreenChangeAt: this.lastScreenChangeAt,
|
|
3804
3844
|
lastScreenSnapshot: this.lastScreenSnapshot.slice(-500),
|
|
3805
3845
|
isWaitingForResponse: this.isWaitingForResponse,
|
|
3806
|
-
activeModal: this.activeModal,
|
|
3846
|
+
activeModal: startupModal || this.activeModal,
|
|
3807
3847
|
lastApprovalResolvedAt: this.lastApprovalResolvedAt,
|
|
3808
3848
|
sendDelayMs: this.sendDelayMs,
|
|
3809
3849
|
sendKey: this.sendKey,
|
|
@@ -3855,10 +3895,19 @@ __export(index_exports, {
|
|
|
3855
3895
|
CliProviderInstance: () => CliProviderInstance,
|
|
3856
3896
|
DAEMON_WS_PATH: () => DAEMON_WS_PATH,
|
|
3857
3897
|
DEFAULT_ACTIVE_CHAT_POLL_STATUSES: () => DEFAULT_ACTIVE_CHAT_POLL_STATUSES,
|
|
3898
|
+
DEFAULT_CDP_DISCOVERY_INTERVAL_MS: () => DEFAULT_CDP_DISCOVERY_INTERVAL_MS,
|
|
3899
|
+
DEFAULT_CDP_SCAN_INTERVAL_MS: () => DEFAULT_CDP_SCAN_INTERVAL_MS,
|
|
3858
3900
|
DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS: () => DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS,
|
|
3859
3901
|
DEFAULT_DAEMON_PORT: () => DEFAULT_DAEMON_PORT,
|
|
3902
|
+
DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS: () => DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS,
|
|
3860
3903
|
DEFAULT_SESSION_HOST_APP_NAME: () => DEFAULT_SESSION_HOST_APP_NAME,
|
|
3904
|
+
DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS: () => DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS,
|
|
3905
|
+
DEFAULT_SESSION_HOST_READY_TIMEOUT_MS: () => DEFAULT_SESSION_HOST_READY_TIMEOUT_MS,
|
|
3861
3906
|
DEFAULT_STANDALONE_SESSION_HOST_APP_NAME: () => DEFAULT_STANDALONE_SESSION_HOST_APP_NAME,
|
|
3907
|
+
DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS: () => DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS,
|
|
3908
|
+
DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS: () => DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS,
|
|
3909
|
+
DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS: () => DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS,
|
|
3910
|
+
DEV_SERVER_PORT: () => DEV_SERVER_PORT,
|
|
3862
3911
|
DaemonAgentStreamManager: () => DaemonAgentStreamManager,
|
|
3863
3912
|
DaemonCdpInitializer: () => DaemonCdpInitializer,
|
|
3864
3913
|
DaemonCdpManager: () => DaemonCdpManager,
|
|
@@ -3870,10 +3919,13 @@ __export(index_exports, {
|
|
|
3870
3919
|
DevServer: () => DevServer,
|
|
3871
3920
|
IdeProviderInstance: () => IdeProviderInstance,
|
|
3872
3921
|
LOG: () => LOG,
|
|
3922
|
+
MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS: () => MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS,
|
|
3923
|
+
MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS: () => MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS,
|
|
3873
3924
|
NodePtyTransportFactory: () => NodePtyTransportFactory,
|
|
3874
3925
|
ProviderCliAdapter: () => ProviderCliAdapter,
|
|
3875
3926
|
ProviderInstanceManager: () => ProviderInstanceManager,
|
|
3876
3927
|
ProviderLoader: () => ProviderLoader,
|
|
3928
|
+
STANDALONE_CDP_SCAN_INTERVAL_MS: () => STANDALONE_CDP_SCAN_INTERVAL_MS,
|
|
3877
3929
|
SessionHostPtyTransportFactory: () => SessionHostPtyTransportFactory,
|
|
3878
3930
|
VersionArchive: () => VersionArchive,
|
|
3879
3931
|
appendRecentActivity: () => appendRecentActivity,
|
|
@@ -8734,6 +8786,21 @@ async function probeCdpPort(port, timeoutMs = 1e3) {
|
|
|
8734
8786
|
|
|
8735
8787
|
// src/cdp/scanner.ts
|
|
8736
8788
|
init_logger();
|
|
8789
|
+
|
|
8790
|
+
// src/runtime-defaults.ts
|
|
8791
|
+
var DEFAULT_CDP_SCAN_INTERVAL_MS = 3e4;
|
|
8792
|
+
var DEFAULT_CDP_DISCOVERY_INTERVAL_MS = 3e4;
|
|
8793
|
+
var DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS = 2e3;
|
|
8794
|
+
var DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS = 3e4;
|
|
8795
|
+
var DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS = 5e3;
|
|
8796
|
+
var MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS = 5e3;
|
|
8797
|
+
var DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS = 15e3;
|
|
8798
|
+
var MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS = 5e3;
|
|
8799
|
+
var DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS = 1e4;
|
|
8800
|
+
var DEFAULT_SESSION_HOST_READY_TIMEOUT_MS = 15e3;
|
|
8801
|
+
var STANDALONE_CDP_SCAN_INTERVAL_MS = 15e3;
|
|
8802
|
+
|
|
8803
|
+
// src/cdp/scanner.ts
|
|
8737
8804
|
var DaemonCdpScanner = class {
|
|
8738
8805
|
ctx;
|
|
8739
8806
|
opts;
|
|
@@ -8767,7 +8834,7 @@ var DaemonCdpScanner = class {
|
|
|
8767
8834
|
*/
|
|
8768
8835
|
startPeriodicScan() {
|
|
8769
8836
|
if (this.scanTimer) return;
|
|
8770
|
-
const interval = this.opts.scanIntervalMs ||
|
|
8837
|
+
const interval = this.opts.scanIntervalMs || DEFAULT_CDP_SCAN_INTERVAL_MS;
|
|
8771
8838
|
this.scanTimer = setInterval(async () => {
|
|
8772
8839
|
const portMap = this.ctx.providerLoader.getCdpPortMap();
|
|
8773
8840
|
for (const [ide, ports] of Object.entries(portMap)) {
|
|
@@ -8787,7 +8854,7 @@ var DaemonCdpScanner = class {
|
|
|
8787
8854
|
/**
|
|
8788
8855
|
* Start periodic agent webview discovery on all connected CDPs.
|
|
8789
8856
|
*/
|
|
8790
|
-
startWebviewDiscovery(intervalMs =
|
|
8857
|
+
startWebviewDiscovery(intervalMs = DEFAULT_CDP_DISCOVERY_INTERVAL_MS) {
|
|
8791
8858
|
if (this.discoveryTimer) return;
|
|
8792
8859
|
this.discoveryTimer = setInterval(async () => {
|
|
8793
8860
|
for (const m of this.ctx.cdpManagers.values()) {
|
|
@@ -9009,7 +9076,7 @@ var DaemonCdpInitializer = class {
|
|
|
9009
9076
|
* Start periodic scanning for newly opened IDEs.
|
|
9010
9077
|
* Idempotent — ignored if already started.
|
|
9011
9078
|
*/
|
|
9012
|
-
startPeriodicScan(intervalMs =
|
|
9079
|
+
startPeriodicScan(intervalMs = DEFAULT_CDP_SCAN_INTERVAL_MS) {
|
|
9013
9080
|
if (this.scanTimer) return;
|
|
9014
9081
|
this.scanTimer = setInterval(async () => {
|
|
9015
9082
|
const { providerLoader, cdpManagers } = this.config;
|
|
@@ -9023,7 +9090,7 @@ var DaemonCdpInitializer = class {
|
|
|
9023
9090
|
/**
|
|
9024
9091
|
* Start periodic agent webview discovery.
|
|
9025
9092
|
*/
|
|
9026
|
-
startDiscovery(intervalMs =
|
|
9093
|
+
startDiscovery(intervalMs = DEFAULT_CDP_DISCOVERY_INTERVAL_MS) {
|
|
9027
9094
|
if (this.discoveryTimer) return;
|
|
9028
9095
|
this.discoveryTimer = setInterval(async () => {
|
|
9029
9096
|
for (const m of this.config.cdpManagers.values()) {
|
|
@@ -18223,19 +18290,19 @@ var DaemonStatusReporter = class {
|
|
|
18223
18290
|
startReporting() {
|
|
18224
18291
|
setTimeout(() => {
|
|
18225
18292
|
this.sendUnifiedStatusReport({ forceServer: true, reason: "initial" }).catch((e) => LOG.warn("Status", `Initial report failed: ${e?.message}`));
|
|
18226
|
-
},
|
|
18293
|
+
}, DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS);
|
|
18227
18294
|
const scheduleServerReport = () => {
|
|
18228
18295
|
this.statusTimer = setTimeout(() => {
|
|
18229
18296
|
this.sendUnifiedStatusReport({ forceServer: true, reason: "periodic" }).catch((e) => LOG.warn("Status", `Periodic report failed: ${e?.message}`));
|
|
18230
18297
|
scheduleServerReport();
|
|
18231
|
-
},
|
|
18298
|
+
}, DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS);
|
|
18232
18299
|
};
|
|
18233
18300
|
scheduleServerReport();
|
|
18234
18301
|
this.p2pTimer = setInterval(() => {
|
|
18235
18302
|
if (this.deps.p2p?.isConnected) {
|
|
18236
18303
|
this.sendUnifiedStatusReport({ p2pOnly: true }).catch((e) => LOG.warn("Status", `P2P status send failed: ${e?.message}`));
|
|
18237
18304
|
}
|
|
18238
|
-
},
|
|
18305
|
+
}, DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS);
|
|
18239
18306
|
}
|
|
18240
18307
|
stopReporting() {
|
|
18241
18308
|
if (this.statusTimer) {
|
|
@@ -18253,14 +18320,14 @@ var DaemonStatusReporter = class {
|
|
|
18253
18320
|
throttledReport() {
|
|
18254
18321
|
const now = Date.now();
|
|
18255
18322
|
const elapsed = now - this.lastStatusSentAt;
|
|
18256
|
-
if (elapsed >=
|
|
18323
|
+
if (elapsed >= DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS) {
|
|
18257
18324
|
this.sendUnifiedStatusReport().catch((e) => LOG.warn("Status", `Throttled report failed: ${e?.message}`));
|
|
18258
18325
|
} else if (!this.statusPendingThrottle) {
|
|
18259
18326
|
this.statusPendingThrottle = true;
|
|
18260
18327
|
setTimeout(() => {
|
|
18261
18328
|
this.statusPendingThrottle = false;
|
|
18262
18329
|
this.sendUnifiedStatusReport().catch((e) => LOG.warn("Status", `Deferred report failed: ${e?.message}`));
|
|
18263
|
-
},
|
|
18330
|
+
}, DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS - elapsed);
|
|
18264
18331
|
}
|
|
18265
18332
|
}
|
|
18266
18333
|
toDaemonStatusEventName(value) {
|
|
@@ -25515,7 +25582,7 @@ function resolveSessionHostAppName(options = {}) {
|
|
|
25515
25582
|
|
|
25516
25583
|
// src/session-host/runtime-support.ts
|
|
25517
25584
|
var import_session_host_core3 = require("@adhdev/session-host-core");
|
|
25518
|
-
var STARTUP_TIMEOUT_MS =
|
|
25585
|
+
var STARTUP_TIMEOUT_MS = DEFAULT_SESSION_HOST_READY_TIMEOUT_MS;
|
|
25519
25586
|
var STARTUP_POLL_MS = 200;
|
|
25520
25587
|
async function canConnect(endpoint) {
|
|
25521
25588
|
const client = new import_session_host_core3.SessionHostClient({ endpoint });
|
|
@@ -25931,8 +25998,8 @@ async function initDaemonComponents(config) {
|
|
|
25931
25998
|
}
|
|
25932
25999
|
});
|
|
25933
26000
|
await cdpInitializer.connectAll(detectedIdesRef.value);
|
|
25934
|
-
cdpInitializer.startPeriodicScan(config.cdpScanIntervalMs ??
|
|
25935
|
-
cdpInitializer.startDiscovery(
|
|
26001
|
+
cdpInitializer.startPeriodicScan(config.cdpScanIntervalMs ?? DEFAULT_CDP_SCAN_INTERVAL_MS);
|
|
26002
|
+
cdpInitializer.startDiscovery(DEFAULT_CDP_DISCOVERY_INTERVAL_MS);
|
|
25936
26003
|
const commandHandler = new DaemonCommandHandler({
|
|
25937
26004
|
cdpManagers,
|
|
25938
26005
|
ideType: "unknown",
|
|
@@ -26062,10 +26129,19 @@ async function shutdownDaemonComponents(components) {
|
|
|
26062
26129
|
CliProviderInstance,
|
|
26063
26130
|
DAEMON_WS_PATH,
|
|
26064
26131
|
DEFAULT_ACTIVE_CHAT_POLL_STATUSES,
|
|
26132
|
+
DEFAULT_CDP_DISCOVERY_INTERVAL_MS,
|
|
26133
|
+
DEFAULT_CDP_SCAN_INTERVAL_MS,
|
|
26065
26134
|
DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS,
|
|
26066
26135
|
DEFAULT_DAEMON_PORT,
|
|
26136
|
+
DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS,
|
|
26067
26137
|
DEFAULT_SESSION_HOST_APP_NAME,
|
|
26138
|
+
DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS,
|
|
26139
|
+
DEFAULT_SESSION_HOST_READY_TIMEOUT_MS,
|
|
26068
26140
|
DEFAULT_STANDALONE_SESSION_HOST_APP_NAME,
|
|
26141
|
+
DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS,
|
|
26142
|
+
DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS,
|
|
26143
|
+
DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS,
|
|
26144
|
+
DEV_SERVER_PORT,
|
|
26069
26145
|
DaemonAgentStreamManager,
|
|
26070
26146
|
DaemonCdpInitializer,
|
|
26071
26147
|
DaemonCdpManager,
|
|
@@ -26077,10 +26153,13 @@ async function shutdownDaemonComponents(components) {
|
|
|
26077
26153
|
DevServer,
|
|
26078
26154
|
IdeProviderInstance,
|
|
26079
26155
|
LOG,
|
|
26156
|
+
MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS,
|
|
26157
|
+
MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS,
|
|
26080
26158
|
NodePtyTransportFactory,
|
|
26081
26159
|
ProviderCliAdapter,
|
|
26082
26160
|
ProviderInstanceManager,
|
|
26083
26161
|
ProviderLoader,
|
|
26162
|
+
STANDALONE_CDP_SCAN_INTERVAL_MS,
|
|
26084
26163
|
SessionHostPtyTransportFactory,
|
|
26085
26164
|
VersionArchive,
|
|
26086
26165
|
appendRecentActivity,
|