@blaxel/core 0.2.44 → 0.2.45-dev.202
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/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/agents/index.js +2 -2
- package/dist/cjs/client/sdk.gen.js +19 -2
- package/dist/cjs/common/internal.js +40 -0
- package/dist/cjs/common/settings.js +5 -2
- package/dist/cjs/jobs/jobs.js +2 -2
- package/dist/cjs/sandbox/action.js +1 -2
- package/dist/cjs/sandbox/sandbox.js +12 -2
- package/dist/cjs/tools/mcpTool.js +2 -2
- package/dist/cjs/types/client/sdk.gen.d.ts +9 -1
- package/dist/cjs/types/client/types.gen.d.ts +39 -0
- package/dist/cjs/types/common/internal.d.ts +2 -0
- package/dist/cjs/types/common/settings.d.ts +1 -0
- package/dist/cjs/types/sandbox/types.d.ts +1 -0
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/agents/index.js +2 -2
- package/dist/cjs-browser/client/sdk.gen.js +19 -2
- package/dist/cjs-browser/common/internal.js +40 -0
- package/dist/cjs-browser/common/settings.js +5 -2
- package/dist/cjs-browser/jobs/jobs.js +2 -2
- package/dist/cjs-browser/sandbox/action.js +1 -2
- package/dist/cjs-browser/sandbox/sandbox.js +12 -2
- package/dist/cjs-browser/tools/mcpTool.js +2 -2
- package/dist/cjs-browser/types/client/sdk.gen.d.ts +9 -1
- package/dist/cjs-browser/types/client/types.gen.d.ts +39 -0
- package/dist/cjs-browser/types/common/internal.d.ts +2 -0
- package/dist/cjs-browser/types/common/settings.d.ts +1 -0
- package/dist/cjs-browser/types/sandbox/types.d.ts +1 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/agents/index.js +3 -3
- package/dist/esm/client/sdk.gen.js +16 -0
- package/dist/esm/common/internal.js +38 -0
- package/dist/esm/common/settings.js +5 -2
- package/dist/esm/jobs/jobs.js +3 -3
- package/dist/esm/sandbox/action.js +2 -3
- package/dist/esm/sandbox/sandbox.js +12 -2
- package/dist/esm/tools/mcpTool.js +3 -3
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/agents/index.js +3 -3
- package/dist/esm-browser/client/sdk.gen.js +16 -0
- package/dist/esm-browser/common/internal.js +38 -0
- package/dist/esm-browser/common/settings.js +5 -2
- package/dist/esm-browser/jobs/jobs.js +3 -3
- package/dist/esm-browser/sandbox/action.js +2 -3
- package/dist/esm-browser/sandbox/sandbox.js +12 -2
- package/dist/esm-browser/tools/mcpTool.js +3 -3
- package/package.json +2 -2
|
@@ -5,6 +5,8 @@ exports.getAlphanumericLimitedHash = getAlphanumericLimitedHash;
|
|
|
5
5
|
exports.getGlobalUniqueHash = getGlobalUniqueHash;
|
|
6
6
|
exports.pluralize = pluralize;
|
|
7
7
|
exports.getForcedUrl = getForcedUrl;
|
|
8
|
+
exports.getWorkloadTypeShort = getWorkloadTypeShort;
|
|
9
|
+
exports.generateInternalUrl = generateInternalUrl;
|
|
8
10
|
const env_js_1 = require("./env.js");
|
|
9
11
|
// Pure JS MD5 implementation that matches standard crypto MD5
|
|
10
12
|
function md5(input) {
|
|
@@ -186,3 +188,41 @@ function getForcedUrl(type, name) {
|
|
|
186
188
|
}
|
|
187
189
|
return null;
|
|
188
190
|
}
|
|
191
|
+
function getWorkloadTypeShort(type) {
|
|
192
|
+
const lowerType = type.toLowerCase();
|
|
193
|
+
switch (lowerType) {
|
|
194
|
+
case 'agent':
|
|
195
|
+
case 'agents':
|
|
196
|
+
return 'agt';
|
|
197
|
+
case 'mcp':
|
|
198
|
+
case 'mcps':
|
|
199
|
+
case 'function':
|
|
200
|
+
case 'functions':
|
|
201
|
+
return 'mcp';
|
|
202
|
+
case 'sandbox':
|
|
203
|
+
case 'sandboxes':
|
|
204
|
+
return 'sbx';
|
|
205
|
+
case 'job':
|
|
206
|
+
case 'jobs':
|
|
207
|
+
return 'job';
|
|
208
|
+
case 'model':
|
|
209
|
+
case 'models':
|
|
210
|
+
return 'mdl';
|
|
211
|
+
default:
|
|
212
|
+
// fallback to first 3 letters of type
|
|
213
|
+
return lowerType.substring(0, 3);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
function generateInternalUrl(workspace, type, name, env, protocol, hostname, blCloud, workspaceId) {
|
|
217
|
+
if (blCloud && workspaceId) {
|
|
218
|
+
// New cloud format: bl-ENV-WORKLOAD_CALLED_NAME-WORKLOAD_TYPE_SHORT-WORKSPACE_ID
|
|
219
|
+
const workloadTypeShort = getWorkloadTypeShort(type);
|
|
220
|
+
const subdomain = `bl-${env}-${name}-${workloadTypeShort}-${workspaceId}`;
|
|
221
|
+
return `${protocol}://${subdomain}.${hostname}`;
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
// Legacy format: bl-ENV-HASH.internalhostname
|
|
225
|
+
const hash = getGlobalUniqueHash(workspace, type, name);
|
|
226
|
+
return `${protocol}://bl-${env}-${hash}.${hostname}`;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
@@ -10,7 +10,7 @@ function getPackageVersion() {
|
|
|
10
10
|
if (typeof require !== "undefined") {
|
|
11
11
|
// Try to require package.json (Node.js only, gracefully fails in browser)
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
13
|
-
const packageJson = {"version":"0.2.
|
|
13
|
+
const packageJson = {"version":"0.2.45-dev.202","commit":"f1d418f3edb7d63c93a13cf3b1d434c0ee483bb4"};
|
|
14
14
|
return packageJson.version || "unknown";
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
@@ -62,7 +62,7 @@ function getCommitHash() {
|
|
|
62
62
|
if (typeof require !== "undefined") {
|
|
63
63
|
// Try to require package.json and look for commit field (set during build)
|
|
64
64
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
65
|
-
const packageJson = {"version":"0.2.
|
|
65
|
+
const packageJson = {"version":"0.2.45-dev.202","commit":"f1d418f3edb7d63c93a13cf3b1d434c0ee483bb4"};
|
|
66
66
|
// Check for commit in various possible locations
|
|
67
67
|
const commit = packageJson.commit || packageJson.buildInfo?.commit;
|
|
68
68
|
if (commit) {
|
|
@@ -165,6 +165,9 @@ class Settings {
|
|
|
165
165
|
get blCloud() {
|
|
166
166
|
return env_js_1.env.BL_CLOUD === "true";
|
|
167
167
|
}
|
|
168
|
+
get workspaceId() {
|
|
169
|
+
return env_js_1.env.BL_WORKSPACE_ID || "";
|
|
170
|
+
}
|
|
168
171
|
get generation() {
|
|
169
172
|
return env_js_1.env.BL_GENERATION || "";
|
|
170
173
|
}
|
package/dist/cjs/jobs/jobs.js
CHANGED
|
@@ -20,8 +20,8 @@ class BlJob {
|
|
|
20
20
|
return new URL(`${settings_js_1.settings.runUrl}/${settings_js_1.settings.workspace}/jobs/${this.jobName}`);
|
|
21
21
|
}
|
|
22
22
|
get internalUrl() {
|
|
23
|
-
const
|
|
24
|
-
return new URL(
|
|
23
|
+
const url = (0, internal_js_1.generateInternalUrl)(settings_js_1.settings.workspace, "job", this.jobName, settings_js_1.settings.env, settings_js_1.settings.runInternalProtocol, settings_js_1.settings.runInternalHostname, settings_js_1.settings.blCloud, settings_js_1.settings.workspaceId);
|
|
24
|
+
return new URL(url);
|
|
25
25
|
}
|
|
26
26
|
get forcedUrl() {
|
|
27
27
|
return (0, internal_js_1.getForcedUrl)('job', this.jobName);
|
|
@@ -48,8 +48,7 @@ class SandboxAction {
|
|
|
48
48
|
return this.sandbox.metadata?.url ?? `${settings_js_1.settings.runUrl}/${settings_js_1.settings.workspace}/sandboxes/${this.name}`;
|
|
49
49
|
}
|
|
50
50
|
get internalUrl() {
|
|
51
|
-
|
|
52
|
-
return `${settings_js_1.settings.runInternalProtocol}://bl-${settings_js_1.settings.env}-${hash}.${settings_js_1.settings.runInternalHostname}`;
|
|
51
|
+
return (0, internal_js_1.generateInternalUrl)(settings_js_1.settings.workspace, "sandbox", this.name, settings_js_1.settings.env, settings_js_1.settings.runInternalProtocol, settings_js_1.settings.runInternalHostname, settings_js_1.settings.blCloud, settings_js_1.settings.workspaceId);
|
|
53
52
|
}
|
|
54
53
|
get client() {
|
|
55
54
|
if (this.sandbox.forceUrl) {
|
|
@@ -49,7 +49,15 @@ class SandboxInstance {
|
|
|
49
49
|
const defaultImage = `blaxel/${env}-base:latest`;
|
|
50
50
|
const defaultMemory = 4096;
|
|
51
51
|
// Handle SandboxCreateConfiguration or simple dict with name/image/memory/ports/envs/volumes keys
|
|
52
|
-
if (!sandbox ||
|
|
52
|
+
if (!sandbox ||
|
|
53
|
+
'name' in sandbox ||
|
|
54
|
+
'image' in sandbox ||
|
|
55
|
+
'memory' in sandbox ||
|
|
56
|
+
'ports' in sandbox ||
|
|
57
|
+
'envs' in sandbox ||
|
|
58
|
+
'volumes' in sandbox ||
|
|
59
|
+
'lifecycle' in sandbox ||
|
|
60
|
+
'snapshotEnabled' in sandbox) {
|
|
53
61
|
if (!sandbox)
|
|
54
62
|
sandbox = {};
|
|
55
63
|
if (!sandbox.name)
|
|
@@ -65,6 +73,7 @@ class SandboxInstance {
|
|
|
65
73
|
const expires = sandbox.expires;
|
|
66
74
|
const region = sandbox.region;
|
|
67
75
|
const lifecycle = sandbox.lifecycle;
|
|
76
|
+
const snapshotEnabled = sandbox.snapshotEnabled;
|
|
68
77
|
sandbox = {
|
|
69
78
|
metadata: { name: sandbox.name },
|
|
70
79
|
spec: {
|
|
@@ -75,9 +84,10 @@ class SandboxInstance {
|
|
|
75
84
|
ports: ports,
|
|
76
85
|
envs: envs,
|
|
77
86
|
generation: "mk3",
|
|
87
|
+
snapshotEnabled,
|
|
78
88
|
},
|
|
79
89
|
volumes: volumes,
|
|
80
|
-
lifecycle: lifecycle
|
|
90
|
+
lifecycle: lifecycle,
|
|
81
91
|
}
|
|
82
92
|
};
|
|
83
93
|
if (ttl) {
|
|
@@ -58,8 +58,8 @@ class McpTool {
|
|
|
58
58
|
return new URL(`${settings_js_1.settings.runUrl}/${settings_js_1.settings.workspace}/${this.pluralType}/${this.name}`);
|
|
59
59
|
}
|
|
60
60
|
get internalUrl() {
|
|
61
|
-
const
|
|
62
|
-
return new URL(
|
|
61
|
+
const url = (0, internal_js_1.generateInternalUrl)(settings_js_1.settings.workspace, this.type, this.name, settings_js_1.settings.env, settings_js_1.settings.runInternalProtocol, settings_js_1.settings.runInternalHostname, settings_js_1.settings.blCloud, settings_js_1.settings.workspaceId);
|
|
62
|
+
return new URL(url);
|
|
63
63
|
}
|
|
64
64
|
get forcedUrl() {
|
|
65
65
|
return (0, internal_js_1.getForcedUrl)(this.type, this.name);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
|
|
2
|
-
import type { ListAgentsData, CreateAgentData, DeleteAgentData, GetAgentData, UpdateAgentData, ListAgentRevisionsData, GetConfigurationData, ListCustomDomainsData, CreateCustomDomainData, DeleteCustomDomainData, GetCustomDomainData, UpdateCustomDomainData, VerifyCustomDomainData, ListFunctionsData, CreateFunctionData, DeleteFunctionData, GetFunctionData, UpdateFunctionData, ListFunctionRevisionsData, GetIntegrationData, ListIntegrationConnectionsData, CreateIntegrationConnectionData, DeleteIntegrationConnectionData, GetIntegrationConnectionData, UpdateIntegrationConnectionData, GetIntegrationConnectionModelEndpointConfigurationsData, ListIntegrationConnectionModelsData, GetIntegrationConnectionModelData, ListJobsData, CreateJobData, DeleteJobData, GetJobData, UpdateJobData, ListJobRevisionsData, ListLocationsData, ListMcpHubDefinitionsData, ListModelsData, CreateModelData, DeleteModelData, GetModelData, UpdateModelData, ListModelRevisionsData, ListPoliciesData, CreatePolicyData, DeletePolicyData, GetPolicyData, UpdatePolicyData, ListPrivateClustersData, CreatePrivateClusterData, DeletePrivateClusterData, GetPrivateClusterData, UpdatePrivateClusterData, GetPrivateClusterHealthData, UpdatePrivateClusterHealthData, ListAllPendingInvitationsData, ListPublicIpsData, ListSandboxHubDefinitionsData, ListSandboxesData, CreateSandboxData, DeleteSandboxData, GetSandboxData, UpdateSandboxData, ListSandboxPreviewsData, CreateSandboxPreviewData, DeleteSandboxPreviewData, GetSandboxPreviewData, UpdateSandboxPreviewData, ListSandboxPreviewTokensData, CreateSandboxPreviewTokenData, DeleteSandboxPreviewTokenData, StartSandboxData, StopSandboxData, GetWorkspaceServiceAccountsData, CreateWorkspaceServiceAccountData, DeleteWorkspaceServiceAccountData, UpdateWorkspaceServiceAccountData, ListApiKeysForServiceAccountData, CreateApiKeyForServiceAccountData, DeleteApiKeyForServiceAccountData, ListTemplatesData, GetTemplateData, ListWorkspaceUsersData, InviteWorkspaceUserData, RemoveWorkspaceUserData, UpdateWorkspaceUserRoleData, ListVolumeTemplatesData, CreateVolumeTemplateData, DeleteVolumeTemplateData, GetVolumeTemplateData, UpdateVolumeTemplateData, ListVolumesData, CreateVolumeData, DeleteVolumeData, GetVolumeData, ListWorkspacesData, CreateWorkspaceData, DeleteWorkspaceData, GetWorkspaceData, UpdateWorkspaceData, DeclineWorkspaceInvitationData, AcceptWorkspaceInvitationData, LeaveWorkspaceData, CheckWorkspaceAvailabilityData } from './types.gen.js';
|
|
2
|
+
import type { ListAgentsData, CreateAgentData, DeleteAgentData, GetAgentData, UpdateAgentData, ListAgentRevisionsData, GetConfigurationData, ListCustomDomainsData, CreateCustomDomainData, DeleteCustomDomainData, GetCustomDomainData, UpdateCustomDomainData, VerifyCustomDomainData, ListFunctionsData, CreateFunctionData, DeleteFunctionData, GetFunctionData, UpdateFunctionData, ListFunctionRevisionsData, GetIntegrationData, ListIntegrationConnectionsData, CreateIntegrationConnectionData, DeleteIntegrationConnectionData, GetIntegrationConnectionData, UpdateIntegrationConnectionData, GetIntegrationConnectionModelEndpointConfigurationsData, ListIntegrationConnectionModelsData, GetIntegrationConnectionModelData, ListJobsData, CreateJobData, DeleteJobData, GetJobData, UpdateJobData, ListJobRevisionsData, ListLocationsData, ListMcpHubDefinitionsData, ListModelsData, CreateModelData, DeleteModelData, GetModelData, UpdateModelData, ListModelRevisionsData, ListPoliciesData, CreatePolicyData, DeletePolicyData, GetPolicyData, UpdatePolicyData, ListPrivateClustersData, CreatePrivateClusterData, DeletePrivateClusterData, GetPrivateClusterData, UpdatePrivateClusterData, GetPrivateClusterHealthData, UpdatePrivateClusterHealthData, ListAllPendingInvitationsData, ListPublicIpsData, ListSandboxHubDefinitionsData, ListSandboxesData, CreateSandboxData, DeleteSandboxData, GetSandboxData, UpdateSandboxData, ListSandboxPreviewsData, CreateSandboxPreviewData, DeleteSandboxPreviewData, GetSandboxPreviewData, UpdateSandboxPreviewData, ListSandboxPreviewTokensData, CreateSandboxPreviewTokenData, DeleteSandboxPreviewTokenData, StartSandboxData, StopSandboxData, GetWorkspaceServiceAccountsData, CreateWorkspaceServiceAccountData, DeleteWorkspaceServiceAccountData, UpdateWorkspaceServiceAccountData, ListApiKeysForServiceAccountData, CreateApiKeyForServiceAccountData, DeleteApiKeyForServiceAccountData, ListTemplatesData, GetTemplateData, ListWorkspaceUsersData, InviteWorkspaceUserData, RemoveWorkspaceUserData, UpdateWorkspaceUserRoleData, ListVolumeTemplatesData, CreateVolumeTemplateData, DeleteVolumeTemplateData, GetVolumeTemplateData, UpdateVolumeTemplateData, DeleteVolumeTemplateVersionData, ListVolumesData, CreateVolumeData, DeleteVolumeData, GetVolumeData, ListWorkspacesData, CreateWorkspaceData, DeleteWorkspaceData, GetWorkspaceData, UpdateWorkspaceData, DeclineWorkspaceInvitationData, AcceptWorkspaceInvitationData, LeaveWorkspaceData, CheckWorkspaceAvailabilityData } from './types.gen.js';
|
|
3
3
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
|
|
4
4
|
/**
|
|
5
5
|
* You can provide a client instance returned by `createClient()` instead of
|
|
@@ -457,6 +457,14 @@ export declare const getVolumeTemplate: <ThrowOnError extends boolean = false>(o
|
|
|
457
457
|
* Creates or updates a volume template.
|
|
458
458
|
*/
|
|
459
459
|
export declare const updateVolumeTemplate: <ThrowOnError extends boolean = false>(options: Options<UpdateVolumeTemplateData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").VolumeTemplate, unknown, ThrowOnError>;
|
|
460
|
+
/**
|
|
461
|
+
* Delete volume template version
|
|
462
|
+
* Deletes a specific version of a volume template.
|
|
463
|
+
*/
|
|
464
|
+
export declare const deleteVolumeTemplateVersion: <ThrowOnError extends boolean = false>(options: Options<DeleteVolumeTemplateVersionData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<{
|
|
465
|
+
message?: string;
|
|
466
|
+
template?: import("./types.gen.js").VolumeTemplate;
|
|
467
|
+
}, unknown, ThrowOnError>;
|
|
460
468
|
/**
|
|
461
469
|
* List volumes
|
|
462
470
|
* Returns a list of all volumes in the workspace.
|
|
@@ -2007,6 +2007,10 @@ export type Runtime = {
|
|
|
2007
2007
|
*/
|
|
2008
2008
|
organization?: string;
|
|
2009
2009
|
ports?: Ports;
|
|
2010
|
+
/**
|
|
2011
|
+
* Enable snapshot feature on your deployment, default to true
|
|
2012
|
+
*/
|
|
2013
|
+
snapshotEnabled?: boolean;
|
|
2010
2014
|
/**
|
|
2011
2015
|
* The readiness probe. Should be a Kubernetes Probe type
|
|
2012
2016
|
*/
|
|
@@ -4553,6 +4557,41 @@ export type UpdateVolumeTemplateResponses = {
|
|
|
4553
4557
|
200: VolumeTemplate;
|
|
4554
4558
|
};
|
|
4555
4559
|
export type UpdateVolumeTemplateResponse = UpdateVolumeTemplateResponses[keyof UpdateVolumeTemplateResponses];
|
|
4560
|
+
export type DeleteVolumeTemplateVersionData = {
|
|
4561
|
+
body?: never;
|
|
4562
|
+
path: {
|
|
4563
|
+
/**
|
|
4564
|
+
* Name of the volume template
|
|
4565
|
+
*/
|
|
4566
|
+
volumeTemplateName: string;
|
|
4567
|
+
/**
|
|
4568
|
+
* Name of the version to delete
|
|
4569
|
+
*/
|
|
4570
|
+
versionName: string;
|
|
4571
|
+
};
|
|
4572
|
+
query?: never;
|
|
4573
|
+
url: '/volume_templates/{volumeTemplateName}/versions/{versionName}';
|
|
4574
|
+
};
|
|
4575
|
+
export type DeleteVolumeTemplateVersionErrors = {
|
|
4576
|
+
/**
|
|
4577
|
+
* Cannot delete the only version
|
|
4578
|
+
*/
|
|
4579
|
+
400: unknown;
|
|
4580
|
+
/**
|
|
4581
|
+
* Version not found
|
|
4582
|
+
*/
|
|
4583
|
+
404: unknown;
|
|
4584
|
+
};
|
|
4585
|
+
export type DeleteVolumeTemplateVersionResponses = {
|
|
4586
|
+
/**
|
|
4587
|
+
* Version deleted successfully
|
|
4588
|
+
*/
|
|
4589
|
+
200: {
|
|
4590
|
+
message?: string;
|
|
4591
|
+
template?: VolumeTemplate;
|
|
4592
|
+
};
|
|
4593
|
+
};
|
|
4594
|
+
export type DeleteVolumeTemplateVersionResponse = DeleteVolumeTemplateVersionResponses[keyof DeleteVolumeTemplateVersionResponses];
|
|
4556
4595
|
export type ListVolumesData = {
|
|
4557
4596
|
body?: never;
|
|
4558
4597
|
path?: never;
|
|
@@ -2,3 +2,5 @@ export declare function getAlphanumericLimitedHash(input: string, maxSize?: numb
|
|
|
2
2
|
export declare function getGlobalUniqueHash(workspace: string, type: string, name: string): string;
|
|
3
3
|
export declare function pluralize(type: string): string;
|
|
4
4
|
export declare function getForcedUrl(type: string, name: string): import("url").URL | null;
|
|
5
|
+
export declare function getWorkloadTypeShort(type: string): string;
|
|
6
|
+
export declare function generateInternalUrl(workspace: string, type: string, name: string, env: string, protocol: string, hostname: string, blCloud: boolean, workspaceId: string): string;
|
|
@@ -40,6 +40,7 @@ export type SandboxCreateConfiguration = {
|
|
|
40
40
|
expires?: Date;
|
|
41
41
|
region?: string;
|
|
42
42
|
lifecycle?: SandboxLifecycle;
|
|
43
|
+
snapshotEnabled?: boolean;
|
|
43
44
|
};
|
|
44
45
|
export declare function normalizePorts(ports?: (Port | Record<string, any>)[]): Port[] | undefined;
|
|
45
46
|
export declare function normalizeEnvs(envs?: EnvVar[]): EnvVar[] | undefined;
|