@love-moon/conductor-sdk 0.7.4 → 0.7.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @love-moon/conductor-sdk
2
2
 
3
+ ## 0.7.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 7bbb412: Add `CONDUCTOR_HOME` support for relocating user-level configuration, logs,
8
+ Fire locks, sessions, update metadata, and AI manager caches while leaving
9
+ project-scoped `.conductor` directories and Fire task markers in place.
10
+
11
+ Migrate device authorization to `conductor.conductor-ai.top` while preserving
12
+ compatibility with the legacy official endpoint and self-hosted backends.
13
+
14
+ ## 0.7.5
15
+
3
16
  ## 0.7.4
4
17
 
5
18
  ## 0.7.3
package/dist/client.js CHANGED
@@ -54,7 +54,7 @@ export class ConductorClient {
54
54
  const projectPath = options.projectPath ?? process.cwd();
55
55
  const backendApi = options.backendApi ?? new BackendApiClient(config);
56
56
  const sessions = options.sessionManager ?? new SessionManager();
57
- const sessionStore = options.sessionStore ?? SessionDiskStore.forBackendUrl(config.backendUrl);
57
+ const sessionStore = options.sessionStore ?? SessionDiskStore.forBackendUrl(config.backendUrl, env);
58
58
  const messageRouter = options.messageRouter ?? new MessageRouter(sessions);
59
59
  const agentHost = resolveAgentHost(env, options.agentHost);
60
60
  const deliveryScopeId = normalizeDeliveryScopeId(options.deliveryScopeId ?? `agent:${agentHost}`);
@@ -1,13 +1,11 @@
1
1
  import fs from 'node:fs';
2
- import os from 'node:os';
3
- import path from 'node:path';
4
2
  import yaml from 'yaml';
3
+ import { resolveConductorConfigPath } from '../paths.js';
5
4
  export const CONFIG_ENV_VAR = 'CONDUCTOR_CONFIG';
6
5
  export const AGENT_TOKEN_ENV_VAR = 'CONDUCTOR_AGENT_TOKEN';
7
6
  export const BACKEND_URL_ENV_VAR = 'CONDUCTOR_BACKEND_URL';
8
7
  export const WS_URL_ENV_VAR = 'CONDUCTOR_WS_URL';
9
8
  export const LOG_LEVEL_ENV_VAR = 'CONDUCTOR_LOG_LEVEL';
10
- const DEFAULT_CONFIG_PATH = path.join(os.homedir(), '.conductor', 'config.yaml');
11
9
  const ALLOWED_LOG_LEVELS = new Set(['debug', 'info', 'warning', 'error', 'critical']);
12
10
  export class ConfigError extends Error {
13
11
  }
@@ -97,21 +95,12 @@ export function loadConfig(targetPath, options = {}) {
97
95
  });
98
96
  }
99
97
  function resolveConfigPath(explicitPath, env) {
100
- const candidate = explicitPath ||
101
- env[CONFIG_ENV_VAR] ||
102
- DEFAULT_CONFIG_PATH;
103
- const normalized = normalizePath(candidate);
98
+ const normalized = resolveConductorConfigPath(explicitPath, env);
104
99
  if (!fs.existsSync(normalized)) {
105
100
  throw new ConfigFileNotFound(normalized);
106
101
  }
107
102
  return normalized;
108
103
  }
109
- function normalizePath(value) {
110
- const expanded = value.startsWith('~')
111
- ? path.join(os.homedir(), value.slice(1))
112
- : value;
113
- return path.resolve(expanded);
114
- }
115
104
  function readYaml(filePath) {
116
105
  const content = fs.readFileSync(filePath, 'utf-8');
117
106
  let parsed;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './paths.js';
1
2
  export * from './config/index.js';
2
3
  export * from './backend/index.js';
3
4
  export * from './ws/index.js';
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './paths.js';
1
2
  export * from './config/index.js';
2
3
  export * from './backend/index.js';
3
4
  export * from './ws/index.js';
@@ -0,0 +1,7 @@
1
+ export declare const CONDUCTOR_HOME_ENV_VAR = "CONDUCTOR_HOME";
2
+ export declare const CONDUCTOR_CONFIG_ENV_VAR = "CONDUCTOR_CONFIG";
3
+ export type ConductorPathEnv = Record<string, string | undefined>;
4
+ export declare function resolveUserHome(env?: ConductorPathEnv, fallbackHome?: string): string;
5
+ export declare function resolveHomeRelativePath(value: string, env?: ConductorPathEnv, fallbackHome?: string): string;
6
+ export declare function resolveConductorHome(env?: ConductorPathEnv): string;
7
+ export declare function resolveConductorConfigPath(explicitPath?: string, env?: ConductorPathEnv): string;
package/dist/paths.js ADDED
@@ -0,0 +1,39 @@
1
+ import os from 'node:os';
2
+ import path from 'node:path';
3
+ export const CONDUCTOR_HOME_ENV_VAR = 'CONDUCTOR_HOME';
4
+ export const CONDUCTOR_CONFIG_ENV_VAR = 'CONDUCTOR_CONFIG';
5
+ function normalizeOptionalString(value) {
6
+ return typeof value === 'string' && value.trim() ? value.trim() : '';
7
+ }
8
+ export function resolveUserHome(env = process.env, fallbackHome = os.homedir()) {
9
+ return normalizeOptionalString(env.HOME)
10
+ || normalizeOptionalString(env.USERPROFILE)
11
+ || normalizeOptionalString(fallbackHome)
12
+ || '/tmp';
13
+ }
14
+ export function resolveHomeRelativePath(value, env = process.env, fallbackHome = os.homedir()) {
15
+ const normalized = normalizeOptionalString(value);
16
+ const userHome = resolveUserHome(env, fallbackHome);
17
+ if (normalized === '~') {
18
+ return path.resolve(userHome);
19
+ }
20
+ if (normalized.startsWith('~/') || normalized.startsWith('~\\')) {
21
+ return path.resolve(userHome, normalized.slice(2));
22
+ }
23
+ return path.resolve(normalized);
24
+ }
25
+ export function resolveConductorHome(env = process.env) {
26
+ const configuredHome = normalizeOptionalString(env[CONDUCTOR_HOME_ENV_VAR]);
27
+ if (configuredHome) {
28
+ return resolveHomeRelativePath(configuredHome, env);
29
+ }
30
+ return path.join(path.resolve(resolveUserHome(env)), '.conductor');
31
+ }
32
+ export function resolveConductorConfigPath(explicitPath, env = process.env) {
33
+ const configuredPath = normalizeOptionalString(explicitPath)
34
+ || normalizeOptionalString(env[CONDUCTOR_CONFIG_ENV_VAR]);
35
+ if (configuredPath) {
36
+ return resolveHomeRelativePath(configuredPath, env);
37
+ }
38
+ return path.join(resolveConductorHome(env), 'config.yaml');
39
+ }
@@ -1,3 +1,4 @@
1
+ import { type ConductorPathEnv } from '../paths.js';
1
2
  export declare const DEFAULT_SESSION_DIR: string;
2
3
  export declare const DEFAULT_SESSION_PATH: string;
3
4
  export declare const DEFAULT_SESSION_ENV = "CODEX_SESSION_ID";
@@ -29,9 +30,10 @@ export declare class SessionDiskStore {
29
30
  constructor(filePath?: string);
30
31
  /**
31
32
  * Create a SessionDiskStore for a specific backend URL.
32
- * Sessions are stored in ~/.conductor/sessions/<host>.yaml
33
+ * Sessions are stored in $CONDUCTOR_HOME/sessions/<host>.yaml.
34
+ * When CONDUCTOR_HOME is unset, it defaults to ~/.conductor.
33
35
  */
34
- static forBackendUrl(backendUrl: string): SessionDiskStore;
36
+ static forBackendUrl(backendUrl: string, env?: ConductorPathEnv): SessionDiskStore;
35
37
  load(): SessionRecord[];
36
38
  private loadUnlocked;
37
39
  save(records: SessionRecord[]): void;
@@ -2,8 +2,9 @@ import fs from 'node:fs';
2
2
  import os from 'node:os';
3
3
  import path from 'node:path';
4
4
  import yaml from 'yaml';
5
- export const DEFAULT_SESSION_DIR = path.join(os.homedir(), '.conductor', 'sessions');
6
- export const DEFAULT_SESSION_PATH = path.join(os.homedir(), '.conductor', 'session.yaml');
5
+ import { resolveConductorHome } from '../paths.js';
6
+ export const DEFAULT_SESSION_DIR = path.join(resolveConductorHome(), 'sessions');
7
+ export const DEFAULT_SESSION_PATH = path.join(resolveConductorHome(), 'session.yaml');
7
8
  export const DEFAULT_SESSION_ENV = 'CODEX_SESSION_ID';
8
9
  export const DEFAULT_SESSION_FALLBACK_ENV = 'SESSION_ID';
9
10
  const SESSION_LOCK_TIMEOUT_MS = 10_000;
@@ -81,17 +82,18 @@ export class SessionRecord {
81
82
  export class SessionDiskStore {
82
83
  filePath;
83
84
  lockPath;
84
- constructor(filePath = DEFAULT_SESSION_PATH) {
85
+ constructor(filePath = path.join(resolveConductorHome(), 'session.yaml')) {
85
86
  this.filePath = path.resolve(filePath);
86
87
  this.lockPath = `${this.filePath}.lock`;
87
88
  }
88
89
  /**
89
90
  * Create a SessionDiskStore for a specific backend URL.
90
- * Sessions are stored in ~/.conductor/sessions/<host>.yaml
91
+ * Sessions are stored in $CONDUCTOR_HOME/sessions/<host>.yaml.
92
+ * When CONDUCTOR_HOME is unset, it defaults to ~/.conductor.
91
93
  */
92
- static forBackendUrl(backendUrl) {
94
+ static forBackendUrl(backendUrl, env = process.env) {
93
95
  const host = extractHostKey(backendUrl);
94
- const filePath = path.join(DEFAULT_SESSION_DIR, `${host}.yaml`);
96
+ const filePath = path.join(resolveConductorHome(env), 'sessions', `${host}.yaml`);
95
97
  return new SessionDiskStore(filePath);
96
98
  }
97
99
  load() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@love-moon/conductor-sdk",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lovemoon-ai/conductor.git"
@@ -33,5 +33,5 @@
33
33
  "typescript": "^5.6.3",
34
34
  "vitest": "^2.1.4"
35
35
  },
36
- "gitCommitId": "b9a27b4"
36
+ "gitCommitId": "c939df2"
37
37
  }