@adhdev/daemon-standalone 0.8.86 → 0.8.88
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.js +74 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/{index-C01OH_JA.js → index-i2SMIomG.js} +23 -23
- package/public/index.html +1 -1
package/dist/index.js
CHANGED
|
@@ -30982,8 +30982,25 @@ var require_dist2 = __commonJS({
|
|
|
30982
30982
|
index: typeof message.index === "number" ? message.index : index,
|
|
30983
30983
|
receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
|
|
30984
30984
|
}));
|
|
30985
|
-
const
|
|
30986
|
-
const
|
|
30985
|
+
const parsedLastAssistant = [...parsedHydratedMessages].reverse().find((message) => message.role === "assistant" && typeof message.content === "string" && message.content.trim());
|
|
30986
|
+
const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && this.currentStatus === "idle" && parsedHydratedMessages.length > committedHydratedMessages.length && !!parsedLastAssistant;
|
|
30987
|
+
if (shouldAdoptParsedIdleReplay) {
|
|
30988
|
+
this.committedMessages = normalizeCliParsedMessages(parsed.messages, {
|
|
30989
|
+
committedMessages: this.committedMessages,
|
|
30990
|
+
scope: this.currentTurnScope,
|
|
30991
|
+
lastOutputAt: this.lastOutputAt
|
|
30992
|
+
});
|
|
30993
|
+
this.syncMessageViews();
|
|
30994
|
+
}
|
|
30995
|
+
const effectiveCommittedHydratedMessages = shouldAdoptParsedIdleReplay ? this.committedMessages.map((message, index) => buildChatMessage({
|
|
30996
|
+
...message,
|
|
30997
|
+
id: message.id || `msg_${index}`,
|
|
30998
|
+
index: typeof message.index === "number" ? message.index : index,
|
|
30999
|
+
receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
|
|
31000
|
+
})) : committedHydratedMessages;
|
|
31001
|
+
const shouldPreferCommittedHistoryReplay = !this.currentTurnScope && !this.activeModal && effectiveCommittedHydratedMessages.length > parsedHydratedMessages.length;
|
|
31002
|
+
const shouldPreferCommittedIdleReplay = shouldPreferCommittedMessages && !shouldAdoptParsedIdleReplay;
|
|
31003
|
+
const hydratedMessages = shouldPreferCommittedIdleReplay || shouldPreferCommittedHistoryReplay ? effectiveCommittedHydratedMessages : parsedHydratedMessages;
|
|
30987
31004
|
result = {
|
|
30988
31005
|
id: parsed.id || "cli_session",
|
|
30989
31006
|
status: parsed.status || this.currentStatus,
|
|
@@ -31699,10 +31716,19 @@ ${data.message || ""}`.trim();
|
|
|
31699
31716
|
CliProviderInstance: () => CliProviderInstance,
|
|
31700
31717
|
DAEMON_WS_PATH: () => DAEMON_WS_PATH,
|
|
31701
31718
|
DEFAULT_ACTIVE_CHAT_POLL_STATUSES: () => DEFAULT_ACTIVE_CHAT_POLL_STATUSES,
|
|
31719
|
+
DEFAULT_CDP_DISCOVERY_INTERVAL_MS: () => DEFAULT_CDP_DISCOVERY_INTERVAL_MS,
|
|
31720
|
+
DEFAULT_CDP_SCAN_INTERVAL_MS: () => DEFAULT_CDP_SCAN_INTERVAL_MS,
|
|
31702
31721
|
DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS: () => DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS,
|
|
31703
31722
|
DEFAULT_DAEMON_PORT: () => DEFAULT_DAEMON_PORT,
|
|
31723
|
+
DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS: () => DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS2,
|
|
31704
31724
|
DEFAULT_SESSION_HOST_APP_NAME: () => DEFAULT_SESSION_HOST_APP_NAME,
|
|
31725
|
+
DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS: () => DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS2,
|
|
31726
|
+
DEFAULT_SESSION_HOST_READY_TIMEOUT_MS: () => DEFAULT_SESSION_HOST_READY_TIMEOUT_MS2,
|
|
31705
31727
|
DEFAULT_STANDALONE_SESSION_HOST_APP_NAME: () => DEFAULT_STANDALONE_SESSION_HOST_APP_NAME,
|
|
31728
|
+
DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS: () => DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS,
|
|
31729
|
+
DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS: () => DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS,
|
|
31730
|
+
DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS: () => DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS,
|
|
31731
|
+
DEV_SERVER_PORT: () => DEV_SERVER_PORT,
|
|
31706
31732
|
DaemonAgentStreamManager: () => DaemonAgentStreamManager,
|
|
31707
31733
|
DaemonCdpInitializer: () => DaemonCdpInitializer,
|
|
31708
31734
|
DaemonCdpManager: () => DaemonCdpManager,
|
|
@@ -31714,10 +31740,13 @@ ${data.message || ""}`.trim();
|
|
|
31714
31740
|
DevServer: () => DevServer,
|
|
31715
31741
|
IdeProviderInstance: () => IdeProviderInstance,
|
|
31716
31742
|
LOG: () => LOG2,
|
|
31743
|
+
MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS: () => MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS2,
|
|
31744
|
+
MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS: () => MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS2,
|
|
31717
31745
|
NodePtyTransportFactory: () => NodePtyTransportFactory,
|
|
31718
31746
|
ProviderCliAdapter: () => ProviderCliAdapter,
|
|
31719
31747
|
ProviderInstanceManager: () => ProviderInstanceManager,
|
|
31720
31748
|
ProviderLoader: () => ProviderLoader,
|
|
31749
|
+
STANDALONE_CDP_SCAN_INTERVAL_MS: () => STANDALONE_CDP_SCAN_INTERVAL_MS2,
|
|
31721
31750
|
SessionHostPtyTransportFactory: () => SessionHostPtyTransportFactory2,
|
|
31722
31751
|
VersionArchive: () => VersionArchive,
|
|
31723
31752
|
appendRecentActivity: () => appendRecentActivity,
|
|
@@ -36520,6 +36549,17 @@ ${effect.notification.body || ""}`.trim();
|
|
|
36520
36549
|
}
|
|
36521
36550
|
}
|
|
36522
36551
|
init_logger();
|
|
36552
|
+
var DEFAULT_CDP_SCAN_INTERVAL_MS = 3e4;
|
|
36553
|
+
var DEFAULT_CDP_DISCOVERY_INTERVAL_MS = 3e4;
|
|
36554
|
+
var DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS = 2e3;
|
|
36555
|
+
var DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS = 3e4;
|
|
36556
|
+
var DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS = 5e3;
|
|
36557
|
+
var MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS2 = 5e3;
|
|
36558
|
+
var DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS2 = 15e3;
|
|
36559
|
+
var MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS2 = 5e3;
|
|
36560
|
+
var DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS2 = 1e4;
|
|
36561
|
+
var DEFAULT_SESSION_HOST_READY_TIMEOUT_MS2 = 15e3;
|
|
36562
|
+
var STANDALONE_CDP_SCAN_INTERVAL_MS2 = 15e3;
|
|
36523
36563
|
var DaemonCdpScanner = class {
|
|
36524
36564
|
ctx;
|
|
36525
36565
|
opts;
|
|
@@ -36553,7 +36593,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
36553
36593
|
*/
|
|
36554
36594
|
startPeriodicScan() {
|
|
36555
36595
|
if (this.scanTimer) return;
|
|
36556
|
-
const interval = this.opts.scanIntervalMs ||
|
|
36596
|
+
const interval = this.opts.scanIntervalMs || DEFAULT_CDP_SCAN_INTERVAL_MS;
|
|
36557
36597
|
this.scanTimer = setInterval(async () => {
|
|
36558
36598
|
const portMap = this.ctx.providerLoader.getCdpPortMap();
|
|
36559
36599
|
for (const [ide, ports] of Object.entries(portMap)) {
|
|
@@ -36573,7 +36613,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
36573
36613
|
/**
|
|
36574
36614
|
* Start periodic agent webview discovery on all connected CDPs.
|
|
36575
36615
|
*/
|
|
36576
|
-
startWebviewDiscovery(intervalMs =
|
|
36616
|
+
startWebviewDiscovery(intervalMs = DEFAULT_CDP_DISCOVERY_INTERVAL_MS) {
|
|
36577
36617
|
if (this.discoveryTimer) return;
|
|
36578
36618
|
this.discoveryTimer = setInterval(async () => {
|
|
36579
36619
|
for (const m of this.ctx.cdpManagers.values()) {
|
|
@@ -36793,7 +36833,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
36793
36833
|
* Start periodic scanning for newly opened IDEs.
|
|
36794
36834
|
* Idempotent — ignored if already started.
|
|
36795
36835
|
*/
|
|
36796
|
-
startPeriodicScan(intervalMs =
|
|
36836
|
+
startPeriodicScan(intervalMs = DEFAULT_CDP_SCAN_INTERVAL_MS) {
|
|
36797
36837
|
if (this.scanTimer) return;
|
|
36798
36838
|
this.scanTimer = setInterval(async () => {
|
|
36799
36839
|
const { providerLoader, cdpManagers } = this.config;
|
|
@@ -36807,7 +36847,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
36807
36847
|
/**
|
|
36808
36848
|
* Start periodic agent webview discovery.
|
|
36809
36849
|
*/
|
|
36810
|
-
startDiscovery(intervalMs =
|
|
36850
|
+
startDiscovery(intervalMs = DEFAULT_CDP_DISCOVERY_INTERVAL_MS) {
|
|
36811
36851
|
if (this.discoveryTimer) return;
|
|
36812
36852
|
this.discoveryTimer = setInterval(async () => {
|
|
36813
36853
|
for (const m of this.config.cdpManagers.values()) {
|
|
@@ -45935,19 +45975,19 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
45935
45975
|
startReporting() {
|
|
45936
45976
|
setTimeout(() => {
|
|
45937
45977
|
this.sendUnifiedStatusReport({ forceServer: true, reason: "initial" }).catch((e) => LOG2.warn("Status", `Initial report failed: ${e?.message}`));
|
|
45938
|
-
},
|
|
45978
|
+
}, DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS);
|
|
45939
45979
|
const scheduleServerReport = () => {
|
|
45940
45980
|
this.statusTimer = setTimeout(() => {
|
|
45941
45981
|
this.sendUnifiedStatusReport({ forceServer: true, reason: "periodic" }).catch((e) => LOG2.warn("Status", `Periodic report failed: ${e?.message}`));
|
|
45942
45982
|
scheduleServerReport();
|
|
45943
|
-
},
|
|
45983
|
+
}, DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS);
|
|
45944
45984
|
};
|
|
45945
45985
|
scheduleServerReport();
|
|
45946
45986
|
this.p2pTimer = setInterval(() => {
|
|
45947
45987
|
if (this.deps.p2p?.isConnected) {
|
|
45948
45988
|
this.sendUnifiedStatusReport({ p2pOnly: true }).catch((e) => LOG2.warn("Status", `P2P status send failed: ${e?.message}`));
|
|
45949
45989
|
}
|
|
45950
|
-
},
|
|
45990
|
+
}, DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS);
|
|
45951
45991
|
}
|
|
45952
45992
|
stopReporting() {
|
|
45953
45993
|
if (this.statusTimer) {
|
|
@@ -45965,14 +46005,14 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
45965
46005
|
throttledReport() {
|
|
45966
46006
|
const now = Date.now();
|
|
45967
46007
|
const elapsed = now - this.lastStatusSentAt;
|
|
45968
|
-
if (elapsed >=
|
|
46008
|
+
if (elapsed >= DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS) {
|
|
45969
46009
|
this.sendUnifiedStatusReport().catch((e) => LOG2.warn("Status", `Throttled report failed: ${e?.message}`));
|
|
45970
46010
|
} else if (!this.statusPendingThrottle) {
|
|
45971
46011
|
this.statusPendingThrottle = true;
|
|
45972
46012
|
setTimeout(() => {
|
|
45973
46013
|
this.statusPendingThrottle = false;
|
|
45974
46014
|
this.sendUnifiedStatusReport().catch((e) => LOG2.warn("Status", `Deferred report failed: ${e?.message}`));
|
|
45975
|
-
},
|
|
46015
|
+
}, DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS - elapsed);
|
|
45976
46016
|
}
|
|
45977
46017
|
}
|
|
45978
46018
|
toDaemonStatusEventName(value) {
|
|
@@ -53183,7 +53223,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
53183
53223
|
return resolveSessionHostAppNameResolution2(options).appName;
|
|
53184
53224
|
}
|
|
53185
53225
|
var import_session_host_core32 = require_dist();
|
|
53186
|
-
var STARTUP_TIMEOUT_MS =
|
|
53226
|
+
var STARTUP_TIMEOUT_MS = DEFAULT_SESSION_HOST_READY_TIMEOUT_MS2;
|
|
53187
53227
|
var STARTUP_POLL_MS = 200;
|
|
53188
53228
|
async function canConnect(endpoint) {
|
|
53189
53229
|
const client = new import_session_host_core32.SessionHostClient({ endpoint });
|
|
@@ -53591,8 +53631,8 @@ data: ${JSON.stringify(msg.data)}
|
|
|
53591
53631
|
}
|
|
53592
53632
|
});
|
|
53593
53633
|
await cdpInitializer.connectAll(detectedIdesRef.value);
|
|
53594
|
-
cdpInitializer.startPeriodicScan(config2.cdpScanIntervalMs ??
|
|
53595
|
-
cdpInitializer.startDiscovery(
|
|
53634
|
+
cdpInitializer.startPeriodicScan(config2.cdpScanIntervalMs ?? DEFAULT_CDP_SCAN_INTERVAL_MS);
|
|
53635
|
+
cdpInitializer.startDiscovery(DEFAULT_CDP_DISCOVERY_INTERVAL_MS);
|
|
53596
53636
|
const commandHandler = new DaemonCommandHandler({
|
|
53597
53637
|
cdpManagers,
|
|
53598
53638
|
ideType: "unknown",
|
|
@@ -53806,9 +53846,19 @@ var fs3 = __toESM(require("fs"));
|
|
|
53806
53846
|
var os2 = __toESM(require("os"));
|
|
53807
53847
|
var path2 = __toESM(require("path"));
|
|
53808
53848
|
var import_daemon_core = __toESM(require_dist2());
|
|
53849
|
+
|
|
53850
|
+
// ../daemon-core/src/runtime-defaults.ts
|
|
53851
|
+
var MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS = 5e3;
|
|
53852
|
+
var DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS = 15e3;
|
|
53853
|
+
var MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS = 5e3;
|
|
53854
|
+
var DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS = 1e4;
|
|
53855
|
+
var DEFAULT_SESSION_HOST_READY_TIMEOUT_MS = 15e3;
|
|
53856
|
+
var STANDALONE_CDP_SCAN_INTERVAL_MS = 15e3;
|
|
53857
|
+
|
|
53858
|
+
// src/session-host.ts
|
|
53809
53859
|
var SESSION_HOST_APP_NAME_RESOLUTION = (0, import_daemon_core.resolveSessionHostAppNameResolution)({ standalone: true });
|
|
53810
53860
|
var SESSION_HOST_APP_NAME = SESSION_HOST_APP_NAME_RESOLUTION.appName;
|
|
53811
|
-
var SESSION_HOST_START_TIMEOUT_MS =
|
|
53861
|
+
var SESSION_HOST_START_TIMEOUT_MS = DEFAULT_SESSION_HOST_READY_TIMEOUT_MS;
|
|
53812
53862
|
function getStandaloneSessionHostAppName() {
|
|
53813
53863
|
return SESSION_HOST_APP_NAME;
|
|
53814
53864
|
}
|
|
@@ -54703,7 +54753,7 @@ var StandaloneServer = class {
|
|
|
54703
54753
|
this.scheduleBroadcastStatus();
|
|
54704
54754
|
},
|
|
54705
54755
|
tickIntervalMs: 3e3,
|
|
54706
|
-
cdpScanIntervalMs:
|
|
54756
|
+
cdpScanIntervalMs: STANDALONE_CDP_SCAN_INTERVAL_MS
|
|
54707
54757
|
});
|
|
54708
54758
|
if (shouldAutoRestoreHostedSessionsOnStartup(process.env)) {
|
|
54709
54759
|
await this.components.cliManager.restoreHostedSessions();
|
|
@@ -55467,7 +55517,10 @@ var StandaloneServer = class {
|
|
|
55467
55517
|
}
|
|
55468
55518
|
}
|
|
55469
55519
|
buildMachineRuntimeUpdate(state, key) {
|
|
55470
|
-
const intervalMs = Math.max(
|
|
55520
|
+
const intervalMs = Math.max(
|
|
55521
|
+
MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS,
|
|
55522
|
+
Number(state.request.params.intervalMs || DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS)
|
|
55523
|
+
);
|
|
55471
55524
|
const now = Date.now();
|
|
55472
55525
|
if (state.lastSentAt > 0 && now - state.lastSentAt < intervalMs) {
|
|
55473
55526
|
return null;
|
|
@@ -55497,7 +55550,10 @@ var StandaloneServer = class {
|
|
|
55497
55550
|
}
|
|
55498
55551
|
async buildSessionHostDiagnosticsUpdate(state, key) {
|
|
55499
55552
|
if (!this.sessionHostControl) return null;
|
|
55500
|
-
const intervalMs = Math.max(
|
|
55553
|
+
const intervalMs = Math.max(
|
|
55554
|
+
MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS,
|
|
55555
|
+
Number(state.request.params.intervalMs || DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS)
|
|
55556
|
+
);
|
|
55501
55557
|
const now = Date.now();
|
|
55502
55558
|
if (state.lastSentAt > 0 && now - state.lastSentAt < intervalMs) {
|
|
55503
55559
|
return null;
|