@adhdev/daemon-core 0.8.78 → 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.
@@ -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.78",
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.78",
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,
@@ -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
  }