sessioncast-cli 1.1.3 → 1.1.4

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.
@@ -66,18 +66,33 @@ class AgentRunner {
66
66
  }
67
67
  }
68
68
  }
69
- if (!finalPath || !fs.existsSync(finalPath)) {
70
- throw new Error(`Config file not found. Tried: ${configPath || envPath || defaultPaths.join(', ')}`);
71
- }
72
- console.log(`Loading config from: ${finalPath}`);
73
- const content = fs.readFileSync(finalPath, 'utf-8');
74
- const ext = path.extname(finalPath).toLowerCase();
75
- if (ext === '.json') {
76
- return JSON.parse(content);
69
+ // If yml file found, load from file
70
+ if (finalPath && fs.existsSync(finalPath)) {
71
+ console.log(`Loading config from: ${finalPath}`);
72
+ const content = fs.readFileSync(finalPath, 'utf-8');
73
+ const ext = path.extname(finalPath).toLowerCase();
74
+ if (ext === '.json') {
75
+ return JSON.parse(content);
76
+ }
77
+ else {
78
+ return yaml.load(content);
79
+ }
77
80
  }
78
- else {
79
- return yaml.load(content);
81
+ // SaaS mode: load from conf store (after sessioncast login)
82
+ const config_1 = require("../config");
83
+ const agentToken = (0, config_1.getAgentToken)();
84
+ const relayUrl = (0, config_1.getRelayUrl)();
85
+ const machineId = (0, config_1.getMachineId)();
86
+ if (agentToken) {
87
+ const os = require("os");
88
+ console.log('Loading config from login credentials (SaaS mode)');
89
+ return {
90
+ machineId: machineId || os.hostname(),
91
+ relay: relayUrl || 'wss://relay.sessioncast.io/ws',
92
+ token: agentToken,
93
+ };
80
94
  }
95
+ throw new Error('No config found. Run "sessioncast login" first, or create ~/.sessioncast.yml');
81
96
  }
82
97
  async start() {
83
98
  if (this.running)
package/dist/api.js CHANGED
@@ -9,11 +9,14 @@ const config_1 = require("./config");
9
9
  class ApiClient {
10
10
  getHeaders() {
11
11
  const apiKey = (0, config_1.getApiKey)();
12
- if (!apiKey) {
12
+ const accessToken = (0, config_1.getAccessToken)();
13
+ const agentToken = (0, config_1.getAgentToken)();
14
+ const token = accessToken || apiKey || agentToken;
15
+ if (!token) {
13
16
  throw new Error('Not logged in. Run: sessioncast login');
14
17
  }
15
18
  return {
16
- 'Authorization': `Bearer ${apiKey}`,
19
+ 'Authorization': `Bearer ${token}`,
17
20
  'Content-Type': 'application/json'
18
21
  };
19
22
  }
@@ -236,7 +236,7 @@ function status() {
236
236
  console.log(chalk_1.default.gray('Run: sessioncast login'));
237
237
  }
238
238
  }
239
- const CURRENT_VERSION = '1.1.3';
239
+ const CURRENT_VERSION = '1.1.4';
240
240
  async function checkForUpdates() {
241
241
  try {
242
242
  const res = await (0, node_fetch_1.default)('https://registry.npmjs.org/sessioncast-cli/latest', { timeout: 3000 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sessioncast-cli",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "SessionCast CLI - Control your agents from anywhere",
5
5
  "main": "dist/index.js",
6
6
  "bin": {