@blaxel/core 0.2.43 → 0.2.44-dev.201

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.
Files changed (51) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/agents/index.js +2 -2
  3. package/dist/cjs/client/sdk.gen.js +98 -77
  4. package/dist/cjs/client/types.gen.js +0 -1
  5. package/dist/cjs/common/internal.js +40 -0
  6. package/dist/cjs/common/settings.js +5 -2
  7. package/dist/cjs/jobs/jobs.js +2 -2
  8. package/dist/cjs/sandbox/action.js +1 -2
  9. package/dist/cjs/tools/mcpTool.js +2 -2
  10. package/dist/cjs/types/client/sdk.gen.d.ts +27 -22
  11. package/dist/cjs/types/client/types.gen.d.ts +250 -419
  12. package/dist/cjs/types/common/internal.d.ts +2 -0
  13. package/dist/cjs/types/common/settings.d.ts +1 -0
  14. package/dist/cjs/types/volume/index.d.ts +1 -0
  15. package/dist/cjs/volume/index.js +2 -1
  16. package/dist/cjs-browser/.tsbuildinfo +1 -1
  17. package/dist/cjs-browser/agents/index.js +2 -2
  18. package/dist/cjs-browser/client/sdk.gen.js +98 -77
  19. package/dist/cjs-browser/client/types.gen.js +0 -1
  20. package/dist/cjs-browser/common/internal.js +40 -0
  21. package/dist/cjs-browser/common/settings.js +5 -2
  22. package/dist/cjs-browser/jobs/jobs.js +2 -2
  23. package/dist/cjs-browser/sandbox/action.js +1 -2
  24. package/dist/cjs-browser/tools/mcpTool.js +2 -2
  25. package/dist/cjs-browser/types/client/sdk.gen.d.ts +27 -22
  26. package/dist/cjs-browser/types/client/types.gen.d.ts +250 -419
  27. package/dist/cjs-browser/types/common/internal.d.ts +2 -0
  28. package/dist/cjs-browser/types/common/settings.d.ts +1 -0
  29. package/dist/cjs-browser/types/volume/index.d.ts +1 -0
  30. package/dist/cjs-browser/volume/index.js +2 -1
  31. package/dist/esm/.tsbuildinfo +1 -1
  32. package/dist/esm/agents/index.js +3 -3
  33. package/dist/esm/client/sdk.gen.js +89 -69
  34. package/dist/esm/client/types.gen.js +0 -1
  35. package/dist/esm/common/internal.js +38 -0
  36. package/dist/esm/common/settings.js +5 -2
  37. package/dist/esm/jobs/jobs.js +3 -3
  38. package/dist/esm/sandbox/action.js +2 -3
  39. package/dist/esm/tools/mcpTool.js +3 -3
  40. package/dist/esm/volume/index.js +2 -1
  41. package/dist/esm-browser/.tsbuildinfo +1 -1
  42. package/dist/esm-browser/agents/index.js +3 -3
  43. package/dist/esm-browser/client/sdk.gen.js +89 -69
  44. package/dist/esm-browser/client/types.gen.js +0 -1
  45. package/dist/esm-browser/common/internal.js +38 -0
  46. package/dist/esm-browser/common/settings.js +5 -2
  47. package/dist/esm-browser/jobs/jobs.js +3 -3
  48. package/dist/esm-browser/sandbox/action.js +2 -3
  49. package/dist/esm-browser/tools/mcpTool.js +3 -3
  50. package/dist/esm-browser/volume/index.js +2 -1
  51. package/package.json +2 -2
@@ -550,74 +550,6 @@ export const updateJob = (options) => {
550
550
  }
551
551
  });
552
552
  };
553
- /**
554
- * List job executions
555
- * Returns a list of all executions for a job by name.
556
- */
557
- export const listJobExecutions = (options) => {
558
- return (options.client ?? _heyApiClient).get({
559
- security: [
560
- {
561
- scheme: 'bearer',
562
- type: 'http'
563
- }
564
- ],
565
- url: '/jobs/{jobId}/executions',
566
- ...options
567
- });
568
- };
569
- /**
570
- * Create job execution
571
- * Creates a new execution for a job by name.
572
- */
573
- export const createJobExecution = (options) => {
574
- return (options.client ?? _heyApiClient).post({
575
- security: [
576
- {
577
- scheme: 'bearer',
578
- type: 'http'
579
- }
580
- ],
581
- url: '/jobs/{jobId}/executions',
582
- ...options,
583
- headers: {
584
- 'Content-Type': 'application/json',
585
- ...options?.headers
586
- }
587
- });
588
- };
589
- /**
590
- * Delete job execution
591
- * Stop an execution for a job by name.
592
- */
593
- export const deleteJobExecution = (options) => {
594
- return (options.client ?? _heyApiClient).delete({
595
- security: [
596
- {
597
- scheme: 'bearer',
598
- type: 'http'
599
- }
600
- ],
601
- url: '/jobs/{jobId}/executions/{executionId}',
602
- ...options
603
- });
604
- };
605
- /**
606
- * Get job execution
607
- * Returns an execution for a job by name.
608
- */
609
- export const getJobExecution = (options) => {
610
- return (options.client ?? _heyApiClient).get({
611
- security: [
612
- {
613
- scheme: 'bearer',
614
- type: 'http'
615
- }
616
- ],
617
- url: '/jobs/{jobId}/executions/{executionId}',
618
- ...options
619
- });
620
- };
621
553
  /**
622
554
  * List job revisions
623
555
  * Returns revisions for a job by name.
@@ -1491,6 +1423,94 @@ export const updateWorkspaceUserRole = (options) => {
1491
1423
  }
1492
1424
  });
1493
1425
  };
1426
+ /**
1427
+ * List volume templates
1428
+ * Returns a list of all volume templates.
1429
+ */
1430
+ export const listVolumeTemplates = (options) => {
1431
+ return (options?.client ?? _heyApiClient).get({
1432
+ security: [
1433
+ {
1434
+ scheme: 'bearer',
1435
+ type: 'http'
1436
+ }
1437
+ ],
1438
+ url: '/volume_templates',
1439
+ ...options
1440
+ });
1441
+ };
1442
+ /**
1443
+ * Create volume template
1444
+ * Creates a volume template.
1445
+ */
1446
+ export const createVolumeTemplate = (options) => {
1447
+ return (options.client ?? _heyApiClient).post({
1448
+ security: [
1449
+ {
1450
+ scheme: 'bearer',
1451
+ type: 'http'
1452
+ }
1453
+ ],
1454
+ url: '/volume_templates',
1455
+ ...options,
1456
+ headers: {
1457
+ 'Content-Type': 'application/json',
1458
+ ...options?.headers
1459
+ }
1460
+ });
1461
+ };
1462
+ /**
1463
+ * Delete volume template
1464
+ * Deletes a volume template by name.
1465
+ */
1466
+ export const deleteVolumeTemplate = (options) => {
1467
+ return (options.client ?? _heyApiClient).delete({
1468
+ security: [
1469
+ {
1470
+ scheme: 'bearer',
1471
+ type: 'http'
1472
+ }
1473
+ ],
1474
+ url: '/volume_templates/{volumeTemplateName}',
1475
+ ...options
1476
+ });
1477
+ };
1478
+ /**
1479
+ * Get volume template
1480
+ * Returns a volume template by name.
1481
+ */
1482
+ export const getVolumeTemplate = (options) => {
1483
+ return (options.client ?? _heyApiClient).get({
1484
+ security: [
1485
+ {
1486
+ scheme: 'bearer',
1487
+ type: 'http'
1488
+ }
1489
+ ],
1490
+ url: '/volume_templates/{volumeTemplateName}',
1491
+ ...options
1492
+ });
1493
+ };
1494
+ /**
1495
+ * Create or update volume template
1496
+ * Creates or updates a volume template.
1497
+ */
1498
+ export const updateVolumeTemplate = (options) => {
1499
+ return (options.client ?? _heyApiClient).put({
1500
+ security: [
1501
+ {
1502
+ scheme: 'bearer',
1503
+ type: 'http'
1504
+ }
1505
+ ],
1506
+ url: '/volume_templates/{volumeTemplateName}',
1507
+ ...options,
1508
+ headers: {
1509
+ 'Content-Type': 'application/json',
1510
+ ...options?.headers
1511
+ }
1512
+ });
1513
+ };
1494
1514
  /**
1495
1515
  * List volumes
1496
1516
  * Returns a list of all volumes in the workspace.
@@ -1579,7 +1599,7 @@ export const listWorkspaces = (options) => {
1579
1599
  * Create worspace
1580
1600
  * Creates a workspace.
1581
1601
  */
1582
- export const createWorspace = (options) => {
1602
+ export const createWorkspace = (options) => {
1583
1603
  return (options.client ?? _heyApiClient).post({
1584
1604
  security: [
1585
1605
  {
@@ -1,3 +1,2 @@
1
- /* eslint-disable */
2
1
  // This file is auto-generated by @hey-api/openapi-ts
3
2
  export {};
@@ -180,3 +180,41 @@ export function getForcedUrl(type, name) {
180
180
  }
181
181
  return null;
182
182
  }
183
+ export function getWorkloadTypeShort(type) {
184
+ const lowerType = type.toLowerCase();
185
+ switch (lowerType) {
186
+ case 'agent':
187
+ case 'agents':
188
+ return 'agt';
189
+ case 'mcp':
190
+ case 'mcps':
191
+ case 'function':
192
+ case 'functions':
193
+ return 'mcp';
194
+ case 'sandbox':
195
+ case 'sandboxes':
196
+ return 'sbx';
197
+ case 'job':
198
+ case 'jobs':
199
+ return 'job';
200
+ case 'model':
201
+ case 'models':
202
+ return 'mdl';
203
+ default:
204
+ // fallback to first 3 letters of type
205
+ return lowerType.substring(0, 3);
206
+ }
207
+ }
208
+ export function generateInternalUrl(workspace, type, name, env, protocol, hostname, blCloud, workspaceId) {
209
+ if (blCloud && workspaceId) {
210
+ // New cloud format: bl-ENV-WORKLOAD_CALLED_NAME-WORKLOAD_TYPE_SHORT-WORKSPACE_ID
211
+ const workloadTypeShort = getWorkloadTypeShort(type);
212
+ const subdomain = `bl-${env}-${name}-${workloadTypeShort}-${workspaceId}`;
213
+ return `${protocol}://${subdomain}.${hostname}`;
214
+ }
215
+ else {
216
+ // Legacy format: bl-ENV-HASH.internalhostname
217
+ const hash = getGlobalUniqueHash(workspace, type, name);
218
+ return `${protocol}://bl-${env}-${hash}.${hostname}`;
219
+ }
220
+ }
@@ -7,7 +7,7 @@ function getPackageVersion() {
7
7
  if (typeof require !== "undefined") {
8
8
  // Try to require package.json (Node.js only, gracefully fails in browser)
9
9
  // eslint-disable-next-line @typescript-eslint/no-require-imports
10
- const packageJson = {"version":"0.2.43","commit":"cd1ac6fc23a55e6c222dd82b803154ac95c06f05"};
10
+ const packageJson = {"version":"0.2.44-dev.201","commit":"8cadbd600220b27b8d686451bcf85b5c89079f23"};
11
11
  return packageJson.version || "unknown";
12
12
  }
13
13
  else {
@@ -59,7 +59,7 @@ function getCommitHash() {
59
59
  if (typeof require !== "undefined") {
60
60
  // Try to require package.json and look for commit field (set during build)
61
61
  // eslint-disable-next-line @typescript-eslint/no-require-imports
62
- const packageJson = {"version":"0.2.43","commit":"cd1ac6fc23a55e6c222dd82b803154ac95c06f05"};
62
+ const packageJson = {"version":"0.2.44-dev.201","commit":"8cadbd600220b27b8d686451bcf85b5c89079f23"};
63
63
  // Check for commit in various possible locations
64
64
  const commit = packageJson.commit || packageJson.buildInfo?.commit;
65
65
  if (commit) {
@@ -162,6 +162,9 @@ class Settings {
162
162
  get blCloud() {
163
163
  return env.BL_CLOUD === "true";
164
164
  }
165
+ get workspaceId() {
166
+ return env.BL_WORKSPACE_ID || "";
167
+ }
165
168
  get generation() {
166
169
  return env.BL_GENERATION || "";
167
170
  }
@@ -1,4 +1,4 @@
1
- import { getForcedUrl, getGlobalUniqueHash } from "../common/internal.js";
1
+ import { generateInternalUrl, getForcedUrl } from "../common/internal.js";
2
2
  import { logger } from "../common/logger.js";
3
3
  import { settings } from "../common/settings.js";
4
4
  import { startSpan } from '../telemetry/telemetry.js';
@@ -17,8 +17,8 @@ class BlJob {
17
17
  return new URL(`${settings.runUrl}/${settings.workspace}/jobs/${this.jobName}`);
18
18
  }
19
19
  get internalUrl() {
20
- const hash = getGlobalUniqueHash(settings.workspace, "job", this.jobName);
21
- return new URL(`${settings.runInternalProtocol}://bl-${settings.env}-${hash}.${settings.runInternalHostname}`);
20
+ const url = generateInternalUrl(settings.workspace, "job", this.jobName, settings.env, settings.runInternalProtocol, settings.runInternalHostname, settings.blCloud, settings.workspaceId);
21
+ return new URL(url);
22
22
  }
23
23
  get forcedUrl() {
24
24
  return getForcedUrl('job', this.jobName);
@@ -1,5 +1,5 @@
1
1
  import { createClient } from "@hey-api/client-fetch";
2
- import { getForcedUrl, getGlobalUniqueHash } from "../common/internal.js";
2
+ import { generateInternalUrl, getForcedUrl } from "../common/internal.js";
3
3
  import { settings } from "../common/settings.js";
4
4
  import { client as defaultClient } from "./client/client.gen.js";
5
5
  export class ResponseError extends Error {
@@ -44,8 +44,7 @@ export class SandboxAction {
44
44
  return this.sandbox.metadata?.url ?? `${settings.runUrl}/${settings.workspace}/sandboxes/${this.name}`;
45
45
  }
46
46
  get internalUrl() {
47
- const hash = getGlobalUniqueHash(settings.workspace, "sandbox", this.name);
48
- return `${settings.runInternalProtocol}://bl-${settings.env}-${hash}.${settings.runInternalHostname}`;
47
+ return generateInternalUrl(settings.workspace, "sandbox", this.name, settings.env, settings.runInternalProtocol, settings.runInternalHostname, settings.blCloud, settings.workspaceId);
49
48
  }
50
49
  get client() {
51
50
  if (this.sandbox.forceUrl) {
@@ -1,6 +1,6 @@
1
1
  import { Client as ModelContextProtocolClient } from "@modelcontextprotocol/sdk/client/index.js";
2
2
  import { env } from "../common/env.js";
3
- import { getForcedUrl, getGlobalUniqueHash } from "../common/internal.js";
3
+ import { generateInternalUrl, getForcedUrl } from "../common/internal.js";
4
4
  import { logger } from "../common/logger.js";
5
5
  import { settings } from "../common/settings.js";
6
6
  import { authenticate } from "../index.js";
@@ -55,8 +55,8 @@ export class McpTool {
55
55
  return new URL(`${settings.runUrl}/${settings.workspace}/${this.pluralType}/${this.name}`);
56
56
  }
57
57
  get internalUrl() {
58
- const hash = getGlobalUniqueHash(settings.workspace, this.type, this.name);
59
- return new URL(`${settings.runInternalProtocol}://bl-${settings.env}-${hash}.${settings.runInternalHostname}`);
58
+ const url = generateInternalUrl(settings.workspace, this.type, this.name, settings.env, settings.runInternalProtocol, settings.runInternalHostname, settings.blCloud, settings.workspaceId);
59
+ return new URL(url);
60
60
  }
61
61
  get forcedUrl() {
62
62
  return getForcedUrl(this.type, this.name);
@@ -45,7 +45,8 @@ export class VolumeInstance {
45
45
  },
46
46
  spec: {
47
47
  size: volumeConfig.size || defaultSize,
48
- region: volumeConfig.region
48
+ region: volumeConfig.region,
49
+ template: volumeConfig.template
49
50
  }
50
51
  };
51
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaxel/core",
3
- "version": "0.2.43",
3
+ "version": "0.2.44-dev.201",
4
4
  "description": "Blaxel Core SDK for TypeScript",
5
5
  "license": "MIT",
6
6
  "author": "Blaxel, INC (https://blaxel.ai)",
@@ -74,7 +74,7 @@
74
74
  "vite": "^5.2.0",
75
75
  "vitest": "^1.5.0"
76
76
  },
77
- "commit": "cd1ac6fc23a55e6c222dd82b803154ac95c06f05",
77
+ "commit": "8cadbd600220b27b8d686451bcf85b5c89079f23",
78
78
  "scripts": {
79
79
  "lint": "eslint src/",
80
80
  "dev": "tsc --watch",