@adhdev/daemon-core 0.8.77 → 0.8.79

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.
@@ -19,6 +19,7 @@ export interface CommandLogEntry {
19
19
  error?: string;
20
20
  durationMs?: number;
21
21
  }
22
+ export declare function shouldLogCommand(cmd: string): boolean;
22
23
  /**
23
24
  * Log a command received from the dashboard/WS/P2P/extension/API.
24
25
  * Call this at the entry point of command handling.
@@ -1,5 +1,14 @@
1
1
  export declare const DEFAULT_SESSION_HOST_APP_NAME = "adhdev";
2
2
  export declare const DEFAULT_STANDALONE_SESSION_HOST_APP_NAME = "adhdev-standalone";
3
+ export interface SessionHostAppNameResolution {
4
+ appName: string;
5
+ warning?: string;
6
+ source: 'default' | 'explicit' | 'reserved-standalone-fallback';
7
+ }
8
+ export declare function resolveSessionHostAppNameResolution(options?: {
9
+ standalone?: boolean;
10
+ env?: NodeJS.ProcessEnv;
11
+ }): SessionHostAppNameResolution;
3
12
  export declare function resolveSessionHostAppName(options?: {
4
13
  standalone?: boolean;
5
14
  env?: NodeJS.ProcessEnv;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/session-host-core",
3
- "version": "0.8.77",
3
+ "version": "0.8.79",
4
4
  "description": "ADHDev local session host core — session registry, protocol, buffers",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-core",
3
- "version": "0.8.77",
3
+ "version": "0.8.79",
4
4
  "description": "ADHDev daemon core — CDP, IDE detection, providers, command execution",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -266,7 +266,9 @@ export {
266
266
  DEFAULT_SESSION_HOST_APP_NAME,
267
267
  DEFAULT_STANDALONE_SESSION_HOST_APP_NAME,
268
268
  resolveSessionHostAppName,
269
+ resolveSessionHostAppNameResolution,
269
270
  } from './session-host/app-name.js';
271
+ export type { SessionHostAppNameResolution } from './session-host/app-name.js';
270
272
  export { ensureSessionHostReady, listHostedCliRuntimes } from './session-host/runtime-support.js';
271
273
  export {
272
274
  getSessionHostRecoveryLabel,
@@ -116,8 +116,14 @@ function checkSize(): void {
116
116
  const SKIP_COMMANDS = new Set([
117
117
  'heartbeat',
118
118
  'status_report',
119
+ 'read_chat',
120
+ 'mark_session_seen',
119
121
  ]);
120
122
 
123
+ export function shouldLogCommand(cmd: string): boolean {
124
+ return !SKIP_COMMANDS.has(cmd);
125
+ }
126
+
121
127
  // ─── Public API ──────────────────────────────
122
128
 
123
129
  /**
@@ -125,7 +131,7 @@ const SKIP_COMMANDS = new Set([
125
131
  * Call this at the entry point of command handling.
126
132
  */
127
133
  export function logCommand(entry: CommandLogEntry): void {
128
- if (SKIP_COMMANDS.has(entry.cmd)) return;
134
+ if (!shouldLogCommand(entry.cmd)) return;
129
135
 
130
136
  try {
131
137
  if (++writeCount % 500 === 0) {
@@ -1,26 +1,48 @@
1
1
  export const DEFAULT_SESSION_HOST_APP_NAME = 'adhdev'
2
2
  export const DEFAULT_STANDALONE_SESSION_HOST_APP_NAME = 'adhdev-standalone'
3
3
 
4
- function validateStandaloneSessionHostAppName(explicit: string): void {
5
- if (explicit !== DEFAULT_SESSION_HOST_APP_NAME) return
6
- throw new Error(
7
- `Standalone session-host namespace '${DEFAULT_SESSION_HOST_APP_NAME}' is reserved for the global daemon. `
8
- + `Use '${DEFAULT_STANDALONE_SESSION_HOST_APP_NAME}' or another non-default namespace.`,
9
- )
4
+ export interface SessionHostAppNameResolution {
5
+ appName: string
6
+ warning?: string
7
+ source: 'default' | 'explicit' | 'reserved-standalone-fallback'
10
8
  }
11
9
 
12
- export function resolveSessionHostAppName(options: {
10
+ function getReservedStandaloneNamespaceWarning(): string {
11
+ return `Standalone session-host namespace '${DEFAULT_SESSION_HOST_APP_NAME}' is reserved for the global daemon. `
12
+ + `Falling back to '${DEFAULT_STANDALONE_SESSION_HOST_APP_NAME}' for this standalone run.`
13
+ }
14
+
15
+ export function resolveSessionHostAppNameResolution(options: {
13
16
  standalone?: boolean
14
17
  env?: NodeJS.ProcessEnv
15
- } = {}): string {
18
+ } = {}): SessionHostAppNameResolution {
16
19
  const env = options.env || process.env
17
20
  const explicit = typeof env.ADHDEV_SESSION_HOST_NAME === 'string'
18
21
  ? env.ADHDEV_SESSION_HOST_NAME.trim()
19
22
  : ''
20
23
 
21
24
  if (explicit) {
22
- if (options.standalone) validateStandaloneSessionHostAppName(explicit)
23
- return explicit
25
+ if (options.standalone && explicit === DEFAULT_SESSION_HOST_APP_NAME) {
26
+ return {
27
+ appName: DEFAULT_STANDALONE_SESSION_HOST_APP_NAME,
28
+ warning: getReservedStandaloneNamespaceWarning(),
29
+ source: 'reserved-standalone-fallback',
30
+ }
31
+ }
32
+ return {
33
+ appName: explicit,
34
+ source: 'explicit',
35
+ }
36
+ }
37
+ return {
38
+ appName: options.standalone ? DEFAULT_STANDALONE_SESSION_HOST_APP_NAME : DEFAULT_SESSION_HOST_APP_NAME,
39
+ source: 'default',
24
40
  }
25
- return options.standalone ? DEFAULT_STANDALONE_SESSION_HOST_APP_NAME : DEFAULT_SESSION_HOST_APP_NAME
41
+ }
42
+
43
+ export function resolveSessionHostAppName(options: {
44
+ standalone?: boolean
45
+ env?: NodeJS.ProcessEnv
46
+ } = {}): string {
47
+ return resolveSessionHostAppNameResolution(options).appName
26
48
  }