@agentsky/sky 2.10.0 → 2.11.0

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.
@@ -0,0 +1,9 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ export {
8
+ __export
9
+ };
@@ -0,0 +1,54 @@
1
+ // src/config.ts
2
+ import { mkdirSync, readFileSync, writeFileSync } from "fs";
3
+ import { homedir } from "os";
4
+ import { dirname, join } from "path";
5
+ var DEFAULT_API_BASE = "https://api.agentsky.dev/v1";
6
+ var DEFAULT_CONSOLE_BASE = "https://platform.agentsky.dev";
7
+ function configPath() {
8
+ return join(process.env.SKY_CONFIG_DIR ?? join(homedir(), ".config", "sky"), "config.json");
9
+ }
10
+ function loadConfig() {
11
+ try {
12
+ return JSON.parse(readFileSync(configPath(), "utf8"));
13
+ } catch {
14
+ return {};
15
+ }
16
+ }
17
+ function saveConfig(config) {
18
+ const path = configPath();
19
+ mkdirSync(dirname(path), { recursive: true });
20
+ writeFileSync(path, `${JSON.stringify(config, null, 2)}
21
+ `, { mode: 384 });
22
+ }
23
+ function apiBase() {
24
+ return (process.env.SKY_API_URL ?? loadConfig().apiBase ?? DEFAULT_API_BASE).replace(/\/$/, "");
25
+ }
26
+ function consoleBase() {
27
+ const configured = process.env.SKY_CONSOLE_URL ?? loadConfig().consoleBase;
28
+ if (configured) return configured.replace(/\/$/, "");
29
+ const api = apiBase();
30
+ if (api === DEFAULT_API_BASE) return DEFAULT_CONSOLE_BASE;
31
+ return api.replace(/\/(?:api\/)?v1$/, "") || api;
32
+ }
33
+ function apiToken() {
34
+ return process.env.SKY_API_TOKEN ?? loadConfig().token;
35
+ }
36
+ function currentUniverse() {
37
+ return process.env.SKY_WORKSPACE ?? process.env.SKY_UNIVERSE ?? loadConfig().currentUniverse;
38
+ }
39
+
40
+ // src/version.ts
41
+ var CLI_VERSION = "2.11.0";
42
+ var USER_AGENT = `sky-cli/${CLI_VERSION} (${process.platform}; node/${process.versions.node})`;
43
+
44
+ export {
45
+ configPath,
46
+ loadConfig,
47
+ saveConfig,
48
+ apiBase,
49
+ consoleBase,
50
+ apiToken,
51
+ currentUniverse,
52
+ CLI_VERSION,
53
+ USER_AGENT
54
+ };