@slatesvideo/shared 0.7.14 → 0.7.16

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/dist/auth.d.ts CHANGED
@@ -51,6 +51,7 @@ export interface McpLauncher {
51
51
  env: Record<string, string>;
52
52
  }
53
53
  /** The desktop's bundled server, or null when there is none on this computer (no app, an old app,
54
- * an uninstalled one whose file was left behind, or a file this version cannot read). */
54
+ * an uninstalled one whose file was left behind, a file this version cannot read, or a launch that
55
+ * is not the app's). */
55
56
  export declare function readMcpLauncher(file?: string): McpLauncher | null;
56
57
  //# sourceMappingURL=auth.d.ts.map
package/dist/auth.js CHANGED
@@ -1,7 +1,8 @@
1
+ import { execFileSync } from 'node:child_process';
1
2
  import { createHash } from 'node:crypto';
2
3
  import { homedir } from 'node:os';
3
- import { join } from 'node:path';
4
- import { existsSync, readFileSync, writeFileSync, mkdirSync, } from 'node:fs';
4
+ import { basename, dirname, join, resolve, sep } from 'node:path';
5
+ import { chmodSync, existsSync, readFileSync, writeFileSync, mkdirSync, } from 'node:fs';
5
6
  // Reads/writes ~/.slates/agent-connection.json — the single file the
6
7
  // Slates desktop app produces and the MCP/CLI consume.
7
8
  //
@@ -42,9 +43,41 @@ export function setDefaultProjectId(projectId) {
42
43
  export function readDefaultProjectId() {
43
44
  return readConnection().defaultProjectId ?? null;
44
45
  }
46
+ /**
47
+ * Windows: leave the current user the only entry on `path`. `/reset` first, because `/inheritance:r`
48
+ * keeps a file's own entries, and a file made in a folder that hands nothing down starts with explicit
49
+ * SYSTEM and Administrators ones. The profile folder's ACL is no wall: Codex's sandbox group can read
50
+ * it. Full paths, because Git for Windows puts its own `whoami` first on PATH. A failure warns and
51
+ * carries on, so a locked-down machine can still sign in.
52
+ */
53
+ function restrictToCurrentUser(path) {
54
+ const system32 = join(process.env.SystemRoot ?? 'C:\\Windows', 'System32');
55
+ try {
56
+ const whoami = execFileSync(join(system32, 'whoami.exe'), ['/user', '/fo', 'csv', '/nh'], { encoding: 'utf8', windowsHide: true });
57
+ const sid = /"(S-1-[\d-]+)"/.exec(whoami)?.[1];
58
+ if (!sid)
59
+ throw new Error(`no SID in ${whoami}`);
60
+ execFileSync(join(system32, 'icacls.exe'), [path, '/reset'], { stdio: 'ignore', windowsHide: true });
61
+ execFileSync(join(system32, 'icacls.exe'), [path, '/inheritance:r', '/grant:r', `*${sid}:F`], { stdio: 'ignore', windowsHide: true });
62
+ }
63
+ catch (error) {
64
+ console.error(`[slates] could not limit ${path} to this user: ${error instanceof Error ? error.message : error}`);
65
+ }
66
+ }
45
67
  export function writeConnection(data) {
46
- if (!existsSync(AGENT_DIR))
47
- mkdirSync(AGENT_DIR, { recursive: true });
68
+ mkdirSync(AGENT_DIR, { recursive: true, mode: 0o700 });
69
+ // Owner-only, because this file holds both tokens. `mode` applies only when a file or folder is
70
+ // created, and the desktop may have made them first, so the modes are set before the tokens land.
71
+ if (process.platform === 'win32') {
72
+ if (!existsSync(CONNECTION_FILE))
73
+ writeFileSync(CONNECTION_FILE, '');
74
+ restrictToCurrentUser(CONNECTION_FILE);
75
+ }
76
+ else {
77
+ chmodSync(AGENT_DIR, 0o700);
78
+ if (existsSync(CONNECTION_FILE))
79
+ chmodSync(CONNECTION_FILE, 0o600);
80
+ }
48
81
  writeFileSync(CONNECTION_FILE, JSON.stringify(data, null, 2), { mode: 0o600 });
49
82
  }
50
83
  export function setCloudToken(token) {
@@ -95,8 +128,44 @@ export function requireDesktop() {
95
128
  // the transition tools while his app had them. A server started from this file is the app's own
96
129
  // copy, so it is always the version that matches the app, and updates when the app does.
97
130
  export const MCP_LAUNCHER_FILE = join(AGENT_DIR, 'mcp-server.json');
131
+ /** What `slate/src/main/agent/mcpLauncher.ts` `appMcpLaunch()` writes, and all it writes. */
132
+ const LAUNCHER_ENV = { ELECTRON_RUN_AS_NODE: '1', SLATES_MCP_BUNDLED: '1' };
133
+ /**
134
+ * Where the app installs: `electron-builder.yml`'s one-click per-user NSIS, and a Mac app dragged to
135
+ * either Applications folder. Slates ships no Linux build. An app run from anywhere else, or a
136
+ * lookalike folder, reads as no launcher, and the copy that was started simply runs as itself.
137
+ */
138
+ function appInstallRoots() {
139
+ const home = homedir();
140
+ return [
141
+ join(process.env.LOCALAPPDATA || join(home, 'AppData', 'Local'), 'Programs', 'slates'),
142
+ resolve('/Applications/Slates.app'),
143
+ join(home, 'Applications', 'Slates.app'),
144
+ ];
145
+ }
146
+ function isInstalled(command) {
147
+ const fold = (path) => (process.platform === 'win32' ? resolve(path).toLowerCase() : resolve(path));
148
+ return appInstallRoots().some((root) => fold(command).startsWith(fold(root) + sep));
149
+ }
150
+ /**
151
+ * Whether a launch is the app's own binary starting the server packaged beside it. The file is
152
+ * plain JSON a write tool could reach, and this process would run what it names at every start, so
153
+ * `cmd.exe /c ...`, an env carrying NODE_OPTIONS or a copy planted elsewhere must read as no launcher
154
+ * at all.
155
+ */
156
+ function isAppLaunch(command, args, env) {
157
+ if (!/^slates(\.exe)?$/i.test(basename(command)) || args.length !== 1 || !isInstalled(command))
158
+ return false;
159
+ const appDir = dirname(command);
160
+ const serverPath = join('mcp-server', 'dist', 'server.mjs');
161
+ const packaged = [join(appDir, 'resources', serverPath), join(dirname(appDir), 'Resources', serverPath)];
162
+ const sameEnv = Object.keys(env).length === Object.keys(LAUNCHER_ENV).length &&
163
+ Object.entries(LAUNCHER_ENV).every(([key, value]) => env[key] === value);
164
+ return sameEnv && packaged.includes(resolve(args[0]));
165
+ }
98
166
  /** The desktop's bundled server, or null when there is none on this computer (no app, an old app,
99
- * an uninstalled one whose file was left behind, or a file this version cannot read). */
167
+ * an uninstalled one whose file was left behind, a file this version cannot read, or a launch that
168
+ * is not the app's). */
100
169
  export function readMcpLauncher(file = MCP_LAUNCHER_FILE) {
101
170
  try {
102
171
  const raw = JSON.parse(readFileSync(file, 'utf-8'));
@@ -111,6 +180,8 @@ export function readMcpLauncher(file = MCP_LAUNCHER_FILE) {
111
180
  // The app was moved or uninstalled since it wrote the file: nothing to start.
112
181
  if (!existsSync(raw.command) || (raw.args[0] && !existsSync(raw.args[0])))
113
182
  return null;
183
+ if (!isAppLaunch(raw.command, raw.args, env))
184
+ return null;
114
185
  return { version: raw.version, command: raw.command, args: raw.args, env };
115
186
  }
116
187
  catch {
@@ -16,6 +16,10 @@ export declare const BLENDER_SETUP_HINT: string;
16
16
  export declare class BlenderNotRunningError extends Error {
17
17
  constructor();
18
18
  }
19
+ /** Something answered on the bridge ports, and it is not a Blender this client may drive. */
20
+ export declare class BlenderPeerError extends Error {
21
+ constructor(message: string);
22
+ }
19
23
  /** Raised when Blender executed the code and Python threw. Carries the traceback. */
20
24
  export declare class BlenderExecError extends Error {
21
25
  readonly stdout: string;
@@ -44,7 +48,11 @@ export declare class BlenderBridgeClient {
44
48
  call(body: string, opts?: {
45
49
  timeoutMs?: number;
46
50
  }): Promise<unknown>;
47
- /** True when a Blender with the add-on is reachable. Never throws. */
51
+ /**
52
+ * True when a Blender this client may drive answers, false when nothing listens. Throws
53
+ * when a listener cannot be used: the reason is what the user needs (update the add-on,
54
+ * restart the bridge), and "no Blender found" would send them the wrong way.
55
+ */
48
56
  isReachable(): Promise<boolean>;
49
57
  }
50
58
  //# sourceMappingURL=blender.d.ts.map
@@ -1,16 +1,42 @@
1
+ import { createHmac, randomBytes, timingSafeEqual } from 'node:crypto';
2
+ import { readFileSync } from 'node:fs';
1
3
  import net from 'node:net';
4
+ import { join } from 'node:path';
5
+ import { AGENT_DIR } from '../auth.js';
2
6
  // Thin client for the Slates Blender add-on's localhost execution bridge.
3
7
  //
4
- // Wire protocol (matches the add-on's `bridge/server.py`, which is Blender
5
- // Lab's `blender_mcp` protocol):
8
+ // Wire protocol (matches the add-on's `bridge_auth.py`, in front of `bridge/server.py`,
9
+ // which is Blender Lab's `blender_mcp` protocol). Requests and responses are
10
+ // NUL-delimited JSON over plain TCP, one request per connection:
6
11
  //
7
- // -> {"type":"execute","code":"...","strict_json":false}\0
8
- // <- {"status":"ok","result":{...},"stdout":"...","stderr":"..."}\0
9
- // <- {"status":"error","message":"<traceback>"}\0
12
+ // -> {"type":"hello","nonce":"<client nonce>"}\0
13
+ // <- {"status":"ok","nonce":"<server nonce>","proof":"<mac>"}\0
14
+ // -> {"type":"execute_sealed","nonce":"<server nonce>","payload":"<json>","mac":"<mac>"}\0
15
+ // <- {"status":"ok","result":{"sealed":"<json>","mac":"<mac>"}}\0
10
16
  //
11
- // Requests and responses are NUL-delimited JSON over a plain TCP socket. The
12
- // add-on executes on Blender's main thread via a timer, so a request is
13
- // serviced within a tick rather than immediately — the socket stays open until
17
+ // `payload` is the upstream request `{"type":"execute","code":"...","strict_json":false}`
18
+ // and `sealed` the upstream reply `{"status":"ok","result":{...},"stdout":"...","stderr":"..."}`
19
+ // or `{"status":"error","message":"<traceback>"}`, each as a string so both sides MAC the
20
+ // same bytes. A mac is HMAC-SHA256 of `<label>\0<nonce>\0<body>` under the token the add-on
21
+ // writes to ~/.slates/blender-bridge-<port>.token each time it binds:
22
+ //
23
+ // hello label "hello", the client nonce, body the server nonce
24
+ // request label "request", the server nonce, body the payload
25
+ // reply label "reply", the server nonce, body the sealed string
26
+ //
27
+ // 🚨 THE TOKEN NEVER CROSSES THE SOCKET, AND NO CODE IS SENT BEFORE THE PROOF. Anything
28
+ // local can bind a port in this range, and on Windows it can share a port the add-on holds
29
+ // (`__init__.py` `_port_is_free`). A listener without the token cannot answer the hello, so
30
+ // it is sent no code, and it cannot seal a reply, so a forged `filePath` cannot reach the
31
+ // desktop's upload route. A process sharing the add-on's port is the one exception: the hello
32
+ // can land on the add-on and the signed request on that process, which can then read the
33
+ // code. It still cannot change it, forge it or seal a reply. Each nonce is good for one
34
+ // request, so a captured one replays nothing. A later incompatible change takes a new request
35
+ // type: the older side answers "Unknown request type", which is how an old add-on is told
36
+ // apart here.
37
+ //
38
+ // The add-on executes on Blender's main thread via a timer, so a request is
39
+ // serviced within a tick rather than immediately: the socket stays open until
14
40
  // the reply lands, and long jobs (renders) hold it open for as long as they
15
41
  // take. That is why the timeout here is generous and configurable per call
16
42
  // rather than a single global value.
@@ -24,6 +50,9 @@ const DEFAULT_TIMEOUT_MS = 60_000;
24
50
  // Renders are the one call that legitimately runs for minutes.
25
51
  export const RENDER_TIMEOUT_MS = 15 * 60_000;
26
52
  const CONNECT_TIMEOUT_MS = 1_500;
53
+ // Bounds a listener that accepts and never answers, on each port walked. Blender answers a
54
+ // hello on its next timer tick unless its main thread is busy.
55
+ const HELLO_TIMEOUT_MS = 15_000;
27
56
  /**
28
57
  * Where the add-on comes from, and how to switch it on. ONE string.
29
58
  *
@@ -48,6 +77,26 @@ export class BlenderNotRunningError extends Error {
48
77
  this.name = 'BlenderNotRunningError';
49
78
  }
50
79
  }
80
+ /** Something answered on the bridge ports, and it is not a Blender this client may drive. */
81
+ export class BlenderPeerError extends Error {
82
+ constructor(message) {
83
+ super(message);
84
+ this.name = 'BlenderPeerError';
85
+ }
86
+ }
87
+ const ADDON_OUTDATED_MESSAGE = 'The Slates add-on in this Blender is too old for this version of Slates, which only ' +
88
+ 'drives an add-on that proves itself. Update it: in Blender open Edit > Preferences > ' +
89
+ 'Get Extensions, choose Refresh Remote, then Update on Slates, or reinstall from ' +
90
+ 'https://slates.video/blender. Then restart Blender.';
91
+ const UNVERIFIED_MESSAGE = `Something is listening on ${HOST}:${BASE_PORT}-${BASE_PORT + PORT_FALLBACKS} but could not ` +
92
+ 'prove it is the Slates add-on, so nothing was sent to it. In Blender, stop and start the ' +
93
+ 'bridge from the Slates tab, which writes a new token to ~/.slates. If that does not clear ' +
94
+ 'it, Blender is running as another user or another program holds the port.';
95
+ const UNSIGNED_REPLY_MESSAGE = 'Blender did not return a signed reply, so the result was thrown away. Check the Blender ' +
96
+ 'window and retry. If it repeats, stop and start the bridge from the Slates tab.';
97
+ /** A listener took the connection and said nothing in time. */
98
+ class BlenderSilentError extends Error {
99
+ }
51
100
  /** Raised when Blender executed the code and Python threw. Carries the traceback. */
52
101
  export class BlenderExecError extends Error {
53
102
  stdout;
@@ -59,6 +108,26 @@ export class BlenderExecError extends Error {
59
108
  this.stderr = stderr;
60
109
  }
61
110
  }
111
+ function bridgeMac(token, label, nonce, body) {
112
+ return createHmac('sha256', token).update(`${label}\0${nonce}\0${body}`, 'utf8').digest('hex');
113
+ }
114
+ function macMatches(expected, received) {
115
+ if (typeof received !== 'string')
116
+ return false;
117
+ const a = Buffer.from(expected);
118
+ const b = Buffer.from(received);
119
+ return a.length === b.length && timingSafeEqual(a, b);
120
+ }
121
+ /** The add-on rewrites this file on every bind, so it is read fresh for each handshake. */
122
+ function readBridgeToken(port) {
123
+ try {
124
+ const token = readFileSync(join(AGENT_DIR, `blender-bridge-${port}.token`), 'utf8').trim();
125
+ return /^[0-9a-f]{64}$/.test(token) ? token : null;
126
+ }
127
+ catch {
128
+ return null;
129
+ }
130
+ }
62
131
  /**
63
132
  * Resolve the installed add-on package regardless of what Blender named it.
64
133
  *
@@ -107,17 +176,6 @@ function connect(port) {
107
176
  });
108
177
  });
109
178
  }
110
- async function connectAny() {
111
- for (let port = BASE_PORT; port <= BASE_PORT + PORT_FALLBACKS; port++) {
112
- try {
113
- return await connect(port);
114
- }
115
- catch {
116
- // Try the next port in the range.
117
- }
118
- }
119
- throw new BlenderNotRunningError();
120
- }
121
179
  function request(socket, payload, timeoutMs) {
122
180
  return new Promise((resolve, reject) => {
123
181
  let buffer = '';
@@ -130,7 +188,7 @@ function request(socket, payload, timeoutMs) {
130
188
  socket.destroy();
131
189
  fn();
132
190
  };
133
- const timer = setTimeout(() => finish(() => reject(new Error(`Blender did not respond within ${Math.round(timeoutMs / 1000)}s. ` +
191
+ const timer = setTimeout(() => finish(() => reject(new BlenderSilentError(`Blender did not respond within ${Math.round(timeoutMs / 1000)}s. ` +
134
192
  'It may be busy with a modal operator — check the Blender window.'))), timeoutMs);
135
193
  socket.setEncoding('utf8');
136
194
  socket.on('data', (chunk) => {
@@ -153,6 +211,69 @@ function request(socket, payload, timeoutMs) {
153
211
  socket.write(payload + '\0');
154
212
  });
155
213
  }
214
+ /**
215
+ * The session on `port`, null with no listener there, or why the listener cannot be used. Throws
216
+ * when the listener is silent and this port has a token: that is the add-on with its main thread
217
+ * busy, and walking on would run the work in whichever other .blend is open.
218
+ */
219
+ async function helloOn(port) {
220
+ let socket;
221
+ try {
222
+ socket = await connect(port);
223
+ }
224
+ catch {
225
+ return null;
226
+ }
227
+ const clientNonce = randomBytes(16).toString('hex');
228
+ let reply;
229
+ try {
230
+ reply = await request(socket, JSON.stringify({ type: 'hello', nonce: clientNonce }), HELLO_TIMEOUT_MS);
231
+ }
232
+ catch (err) {
233
+ if (err instanceof BlenderSilentError && readBridgeToken(port))
234
+ throw err;
235
+ return err;
236
+ }
237
+ if (typeof reply !== 'object' || reply === null)
238
+ return new BlenderPeerError(UNVERIFIED_MESSAGE);
239
+ if (reply.status === 'error' && typeof reply.message === 'string' && reply.message.startsWith('Unknown request type')) {
240
+ return new BlenderPeerError(ADDON_OUTDATED_MESSAGE);
241
+ }
242
+ const token = readBridgeToken(port);
243
+ if (!token || typeof reply.nonce !== 'string' || !macMatches(bridgeMac(token, 'hello', clientNonce, reply.nonce), reply.proof)) {
244
+ return new BlenderPeerError(UNVERIFIED_MESSAGE);
245
+ }
246
+ return { port, token, nonce: reply.nonce };
247
+ }
248
+ /**
249
+ * The first port whose listener proves it is the add-on. A listener that cannot does not stop
250
+ * the walk, because the add-on steps past a held port. When none proves itself, the failure
251
+ * that tells the user the most wins: an old add-on, then a silent listener, then a stranger.
252
+ */
253
+ async function authenticate() {
254
+ const failures = [];
255
+ for (let port = BASE_PORT; port <= BASE_PORT + PORT_FALLBACKS; port++) {
256
+ const outcome = await helloOn(port);
257
+ if (outcome === null)
258
+ continue;
259
+ if (!(outcome instanceof Error))
260
+ return outcome;
261
+ failures.push(outcome);
262
+ }
263
+ const outdated = failures.find((f) => f.message === ADDON_OUTDATED_MESSAGE);
264
+ const silent = failures.find((f) => !(f instanceof BlenderPeerError));
265
+ throw outdated ?? silent ?? failures[0] ?? new BlenderNotRunningError();
266
+ }
267
+ /** Open what the add-on sealed. An unsealed reply, error or not, is untrusted text and is dropped. */
268
+ function unseal(res, session) {
269
+ const seal = res?.result;
270
+ if (res?.status !== 'ok' || typeof seal?.sealed !== 'string')
271
+ throw new BlenderPeerError(UNSIGNED_REPLY_MESSAGE);
272
+ if (!macMatches(bridgeMac(session.token, 'reply', session.nonce, seal.sealed), seal.mac)) {
273
+ throw new BlenderPeerError(UNSIGNED_REPLY_MESSAGE);
274
+ }
275
+ return JSON.parse(seal.sealed);
276
+ }
156
277
  export class BlenderBridgeClient {
157
278
  /**
158
279
  * Execute Python in Blender and return whatever the code assigned to
@@ -161,9 +282,16 @@ export class BlenderBridgeClient {
161
282
  * itself, which it cannot do if the error is about serialization.
162
283
  */
163
284
  async execute(code, opts) {
164
- const socket = await connectAny();
285
+ const session = await authenticate();
286
+ const socket = await connect(session.port);
165
287
  const payload = JSON.stringify({ type: 'execute', code, strict_json: false });
166
- const res = await request(socket, payload, opts?.timeoutMs ?? DEFAULT_TIMEOUT_MS);
288
+ const sealed = JSON.stringify({
289
+ type: 'execute_sealed',
290
+ nonce: session.nonce,
291
+ payload,
292
+ mac: bridgeMac(session.token, 'request', session.nonce, payload),
293
+ });
294
+ const res = unseal(await request(socket, sealed, opts?.timeoutMs ?? DEFAULT_TIMEOUT_MS), session);
167
295
  const stdout = res.stdout ?? '';
168
296
  const stderr = res.stderr ?? '';
169
297
  if (res.status !== 'ok') {
@@ -180,15 +308,20 @@ export class BlenderBridgeClient {
180
308
  const { result } = await this.execute(`${PRELUDE}\n${body}`, opts);
181
309
  return result;
182
310
  }
183
- /** True when a Blender with the add-on is reachable. Never throws. */
311
+ /**
312
+ * True when a Blender this client may drive answers, false when nothing listens. Throws
313
+ * when a listener cannot be used: the reason is what the user needs (update the add-on,
314
+ * restart the bridge), and "no Blender found" would send them the wrong way.
315
+ */
184
316
  async isReachable() {
185
317
  try {
186
- const socket = await connectAny();
187
- socket.destroy();
318
+ await authenticate();
188
319
  return true;
189
320
  }
190
- catch {
191
- return false;
321
+ catch (err) {
322
+ if (err instanceof BlenderNotRunningError)
323
+ return false;
324
+ throw err;
192
325
  }
193
326
  }
194
327
  }
@@ -1,3 +1,4 @@
1
+ export declare function resolveCloudBaseUrl(override?: string | undefined): string;
1
2
  export declare const DEFAULT_CLOUD_BASE_URL: string;
2
3
  export declare class SlatesCloudHttpError extends Error {
3
4
  readonly status: number;
@@ -1,22 +1,22 @@
1
1
  import { requireCloudToken, tokenHash } from '../auth.js';
2
2
  import { SLATES_API_URL } from '../api-url.js';
3
3
  const FALLBACK_CLOUD_BASE_URL = SLATES_API_URL;
4
- // The slates_sk_ bearer is attached to every cloud request. SLATES_CLOUD_BASE_URL
5
- // may override the host for dev/staging, but ONLY over https (or http to
6
- // localhost) — otherwise the token could be exfiltrated to an arbitrary host
7
- // or sent in cleartext. An invalid/insecure override is ignored (falls back to
8
- // production) rather than silently leaking the token.
9
- function resolveCloudBaseUrl() {
10
- const override = process.env.SLATES_CLOUD_BASE_URL;
4
+ // The slates_sk_ bearer is attached to every cloud request, and an env block in a
5
+ // plugin or project config can reach this process. So SLATES_CLOUD_BASE_URL may
6
+ // point only at this machine (a local slates-api) or the production host; any
7
+ // other host, https or not, is ignored in favour of production. It is not a way
8
+ // to reach a staging host: add one here by name if one ever exists.
9
+ export function resolveCloudBaseUrl(override = process.env.SLATES_CLOUD_BASE_URL) {
11
10
  if (!override)
12
11
  return FALLBACK_CLOUD_BASE_URL;
13
12
  try {
14
13
  const u = new URL(override);
15
- const isLoopback = u.hostname === 'localhost' || u.hostname === '127.0.0.1';
16
- if (u.protocol === 'https:' || (u.protocol === 'http:' && isLoopback)) {
14
+ const isLoopback = u.hostname === 'localhost' || u.hostname === '127.0.0.1' || u.hostname === '[::1]';
15
+ const isProduction = u.protocol === 'https:' && u.hostname === new URL(FALLBACK_CLOUD_BASE_URL).hostname;
16
+ if (isProduction || (isLoopback && (u.protocol === 'http:' || u.protocol === 'https:'))) {
17
17
  return override.replace(/\/+$/, '');
18
18
  }
19
- console.error(`[slates] Ignoring SLATES_CLOUD_BASE_URL="${override}": must be https:// (or http://localhost). ` +
19
+ console.error(`[slates] Ignoring SLATES_CLOUD_BASE_URL="${override}": it must be this machine or ${FALLBACK_CLOUD_BASE_URL}. ` +
20
20
  `Falling back to ${FALLBACK_CLOUD_BASE_URL} so the auth token is not exposed.`);
21
21
  }
22
22
  catch {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './auth.js';
2
- export { SlatesCloudClient, type SlatesUserInfo, type CreditsBalance, type ModelRegistryResponse } from './clients/cloud.js';
2
+ export { SlatesCloudClient, DEFAULT_CLOUD_BASE_URL, resolveCloudBaseUrl, type SlatesUserInfo, type CreditsBalance, type ModelRegistryResponse } from './clients/cloud.js';
3
3
  export { SlatesDesktopClient, setDesktopClientIdentity, type DesktopHealth } from './clients/desktop.js';
4
4
  export { BRAIN_SHAPE, SKILLS } from './skills/content.js';
5
5
  export { BRAIN_CACHE, brainFiles, clearServedBrain, refreshServedBrain, servedBrain, useBrainSource, type LockedGuide, type ServedBrain } from './skills/served.js';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './auth.js';
2
- export { SlatesCloudClient } from './clients/cloud.js';
2
+ export { SlatesCloudClient, DEFAULT_CLOUD_BASE_URL, resolveCloudBaseUrl } from './clients/cloud.js';
3
3
  export { SlatesDesktopClient, setDesktopClientIdentity } from './clients/desktop.js';
4
4
  export { BRAIN_SHAPE, SKILLS } from './skills/content.js';
5
5
  export { BRAIN_CACHE, brainFiles, clearServedBrain, refreshServedBrain, servedBrain, useBrainSource } from './skills/served.js';