@blaxel/core 0.3.18-dev.283 → 0.3.18-preview.284

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.
@@ -24,8 +24,8 @@ function missingCredentialsMessage() {
24
24
  return "No Blaxel credentials found. Set the BL_API_KEY and BL_WORKSPACE environment variables, or run `bl login`.";
25
25
  }
26
26
  // Build info - these placeholders are replaced at build time by build:replace-imports
27
- const BUILD_VERSION = "0.3.18-dev.283";
28
- const BUILD_COMMIT = "fed607fe45d4a15407e77f7c40f31815d763df5a";
27
+ const BUILD_VERSION = "0.3.18-preview.284";
28
+ const BUILD_COMMIT = "57fc469276ceec702626782b675333c68e6bce4d";
29
29
  const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
30
30
  const BLAXEL_API_VERSION = "2026-04-28";
31
31
  // Bun < 1.3.11 never sends connection-level WINDOW_UPDATE: the pooled h2
@@ -94,11 +94,6 @@ function getOsArch() {
94
94
  }
95
95
  return "browser/unknown";
96
96
  }
97
- /**
98
- * An integration built on this SDK identifies itself with one User-Agent
99
- * product token: `<name>/<semver>`, lowercase name.
100
- */
101
- const INTEGRATION_TOKEN_PATTERN = /^[a-z0-9][a-z0-9._-]*\/\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
102
97
  class Settings {
103
98
  _credentials;
104
99
  config;
@@ -195,34 +190,14 @@ class Settings {
195
190
  get apiVersion() {
196
191
  return env.BL_API_VERSION || BLAXEL_API_VERSION;
197
192
  }
198
- /**
199
- * Product token identifying the integration built on this SDK, or `""`.
200
- * Resolved from `config.integration`, then `BL_INTEGRATION`. See `Config.integration`.
201
- */
202
- get integration() {
203
- const value = this.config.integration ?? env.BL_INTEGRATION ?? "";
204
- if (!value) {
205
- return "";
206
- }
207
- if (!INTEGRATION_TOKEN_PATTERN.test(value)) {
208
- logger.warn(`Ignoring invalid Blaxel integration token "${value}": expected <name>/<semver> with a lowercase name`);
209
- return "";
210
- }
211
- return value;
212
- }
213
- set integration(value) {
214
- this.config.integration = value;
215
- }
216
193
  get headers() {
217
194
  this.assertCredentials();
218
195
  const osArch = getOsArch();
219
- const sdkUserAgent = `blaxel/sdk/typescript/${this.version} (${osArch}) blaxel/${this.commit}`;
220
- const integration = this.integration;
221
196
  return {
222
197
  "x-blaxel-authorization": this.authorization,
223
198
  "x-blaxel-workspace": this.workspace || "",
224
199
  "Blaxel-Version": this.apiVersion,
225
- "User-Agent": integration ? `${sdkUserAgent} ${integration}` : sdkUserAgent,
200
+ "User-Agent": `blaxel/sdk/typescript/${this.version} (${osArch}) blaxel/${this.commit}`,
226
201
  };
227
202
  }
228
203
  get name() {
@@ -216,53 +216,3 @@ describe('Settings H2 tuning knobs (config > env > default)', () => {
216
216
  });
217
217
  });
218
218
  });
219
- describe('Settings.integration', () => {
220
- const sdkUserAgent = /^blaxel\/sdk\/typescript\/\S+ \([^)]+\) blaxel\/\S+/;
221
- async function authenticated() {
222
- const { settings } = await import('./settings.js');
223
- settings.credentials = new ApiKey({ apiKey: 'test-key', workspace: 'test-ws' });
224
- delete settings.config.integration;
225
- delete process.env.BL_INTEGRATION;
226
- return settings;
227
- }
228
- afterEach(async () => {
229
- const { settings } = await import('./settings.js');
230
- delete settings.config.integration;
231
- delete process.env.BL_INTEGRATION;
232
- });
233
- it('sends the plain SDK User-Agent by default', async () => {
234
- const settings = await authenticated();
235
- expect(settings.integration).toBe('');
236
- expect(settings.headers['User-Agent']).toMatch(new RegExp(sdkUserAgent.source + '$'));
237
- });
238
- it('appends the token set programmatically, once', async () => {
239
- const settings = await authenticated();
240
- settings.integration = 'deepseek-harness-blaxel-sandbox/0.1.2';
241
- const userAgent = settings.headers['User-Agent'];
242
- expect(userAgent).toMatch(sdkUserAgent);
243
- expect(userAgent.endsWith(' deepseek-harness-blaxel-sandbox/0.1.2')).toBe(true);
244
- expect(userAgent.split('deepseek-harness-blaxel-sandbox').length).toBe(2);
245
- });
246
- it('reads BL_INTEGRATION when nothing is set programmatically, and config wins', async () => {
247
- const settings = await authenticated();
248
- process.env.BL_INTEGRATION = 'herdr/1.4.0-rc.1';
249
- expect(settings.headers['User-Agent'].endsWith(' herdr/1.4.0-rc.1')).toBe(true);
250
- settings.setConfig({ ...settings.config, integration: 'deepseek-harness-blaxel-sandbox/0.1.2' });
251
- expect(settings.headers['User-Agent'].endsWith(' deepseek-harness-blaxel-sandbox/0.1.2')).toBe(true);
252
- });
253
- it.each(['Deepseek/0.1.2', 'deepseek-harness', 'deepseek/0.1', 'a/1.0.0 b/1.0.0', 'deepseek/0.1.2 (extra)', ' x/1.0.0'])('ignores the invalid token %j', async (value) => {
254
- const settings = await authenticated();
255
- settings.integration = value;
256
- expect(settings.integration).toBe('');
257
- expect(settings.headers['User-Agent']).toMatch(new RegExp(sdkUserAgent.source + '$'));
258
- });
259
- it('changes no header other than User-Agent', async () => {
260
- const settings = await authenticated();
261
- const plain = { ...settings.headers };
262
- settings.integration = 'deepseek-harness-blaxel-sandbox/0.1.2';
263
- const tagged = { ...settings.headers };
264
- delete plain['User-Agent'];
265
- delete tagged['User-Agent'];
266
- expect(tagged).toEqual(plain);
267
- });
268
- });
@@ -225,6 +225,7 @@ export class SandboxInstance {
225
225
  ...(options.customDomain !== undefined ? { customDomain: options.customDomain } : {}),
226
226
  ...(options.prefix !== undefined ? { prefix: options.prefix } : {}),
227
227
  ...(options.snapshotId !== undefined ? { snapshotId: options.snapshotId } : {}),
228
+ ...(options.envs !== undefined ? { envs: options.envs } : {}),
228
229
  },
229
230
  throwOnError: true,
230
231
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaxel/core",
3
- "version": "0.3.18-dev.283",
3
+ "version": "0.3.18-preview.284",
4
4
  "description": "Blaxel Core SDK for TypeScript",
5
5
  "license": "MIT",
6
6
  "author": "Blaxel, INC (https://blaxel.ai)",