@blaxel/core 0.2.16-dev.103 → 0.2.16-dev.105
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/agents/index.js +1 -6
- package/dist/common/internal.d.ts +2 -0
- package/dist/common/internal.js +48 -1
- package/dist/jobs/jobs.js +1 -6
- package/dist/sandbox/action.d.ts +1 -1
- package/dist/sandbox/action.js +2 -8
- package/dist/sandbox/filesystem/filesystem.js +1 -1
- package/dist/tools/index.js +3 -3
- package/dist/tools/mcpTool.js +1 -5
- package/package.json +1 -1
package/dist/agents/index.js
CHANGED
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getAgentMetadata = exports.blAgent = void 0;
|
|
4
4
|
const index_js_1 = require("../cache/index.js");
|
|
5
5
|
const index_js_2 = require("../client/index.js");
|
|
6
|
-
const env_js_1 = require("../common/env.js");
|
|
7
6
|
const internal_js_1 = require("../common/internal.js");
|
|
8
7
|
const logger_js_1 = require("../common/logger.js");
|
|
9
8
|
const settings_js_1 = require("../common/settings.js");
|
|
@@ -27,11 +26,7 @@ class BlAgent {
|
|
|
27
26
|
return new URL(`${settings_js_1.settings.runInternalProtocol}://bl-${settings_js_1.settings.env}-${hash}.${settings_js_1.settings.runInternalHostname}`);
|
|
28
27
|
}
|
|
29
28
|
get forcedUrl() {
|
|
30
|
-
|
|
31
|
-
if (env_js_1.env[`BL_AGENT_${envVar}_URL`]) {
|
|
32
|
-
return new URL(env_js_1.env[`BL_AGENT_${envVar}_URL`]);
|
|
33
|
-
}
|
|
34
|
-
return null;
|
|
29
|
+
return (0, internal_js_1.getForcedUrl)('function', this.agentName);
|
|
35
30
|
}
|
|
36
31
|
get url() {
|
|
37
32
|
if (this.forcedUrl)
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export declare function getAlphanumericLimitedHash(input: string, maxSize?: number): string;
|
|
2
2
|
export declare function getGlobalUniqueHash(workspace: string, type: string, name: string): string;
|
|
3
|
+
export declare function pluralize(type: string): string;
|
|
4
|
+
export declare function getForcedUrl(type: string, name: string): import("url").URL | null;
|
package/dist/common/internal.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.getAlphanumericLimitedHash = getAlphanumericLimitedHash;
|
|
4
5
|
exports.getGlobalUniqueHash = getGlobalUniqueHash;
|
|
5
|
-
|
|
6
|
+
exports.pluralize = pluralize;
|
|
7
|
+
exports.getForcedUrl = getForcedUrl;
|
|
8
|
+
const core_1 = require("@blaxel/core");
|
|
6
9
|
// Pure JS MD5 implementation that matches standard crypto MD5
|
|
7
10
|
function md5(input) {
|
|
8
11
|
function cmn(q, a, b, x, s, t) {
|
|
@@ -139,3 +142,47 @@ function getGlobalUniqueHash(workspace, type, name) {
|
|
|
139
142
|
const globalUniqueName = `${workspace}-${type}-${name}`;
|
|
140
143
|
return getAlphanumericLimitedHash(globalUniqueName, 48);
|
|
141
144
|
}
|
|
145
|
+
function pluralize(type) {
|
|
146
|
+
const word = type.toLowerCase();
|
|
147
|
+
// Words ending in s, ss, sh, ch, x, z - add 'es'
|
|
148
|
+
if (word.endsWith('s') || word.endsWith('ss') || word.endsWith('sh') ||
|
|
149
|
+
word.endsWith('ch') || word.endsWith('x') || word.endsWith('z')) {
|
|
150
|
+
return type + 'es';
|
|
151
|
+
}
|
|
152
|
+
// Words ending in consonant + y - change y to ies
|
|
153
|
+
if (word.endsWith('y') && word.length > 1) {
|
|
154
|
+
const beforeY = word[word.length - 2];
|
|
155
|
+
if (!'aeiou'.includes(beforeY)) {
|
|
156
|
+
return type.slice(0, -1) + 'ies';
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// Words ending in f or fe - change to ves
|
|
160
|
+
if (word.endsWith('f')) {
|
|
161
|
+
return type.slice(0, -1) + 'ves';
|
|
162
|
+
}
|
|
163
|
+
if (word.endsWith('fe')) {
|
|
164
|
+
return type.slice(0, -2) + 'ves';
|
|
165
|
+
}
|
|
166
|
+
// Words ending in consonant + o - add 'es'
|
|
167
|
+
if (word.endsWith('o') && word.length > 1) {
|
|
168
|
+
const beforeO = word[word.length - 2];
|
|
169
|
+
if (!'aeiou'.includes(beforeO)) {
|
|
170
|
+
return type + 'es';
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
// Default case - just add 's'
|
|
174
|
+
return type + 's';
|
|
175
|
+
}
|
|
176
|
+
function getForcedUrl(type, name) {
|
|
177
|
+
const pluralType = pluralize(type);
|
|
178
|
+
const envVar = name.replace(/-/g, "_").toUpperCase();
|
|
179
|
+
// BL_FUNCTIONS_NAME_URL
|
|
180
|
+
if (core_1.env[`BL_${pluralType.toUpperCase()}_${envVar}_URL`]) {
|
|
181
|
+
return new URL(core_1.env[`BL_${pluralType.toUpperCase()}_${envVar}_URL`]);
|
|
182
|
+
}
|
|
183
|
+
// BL_FUNCTION_NAME_URL
|
|
184
|
+
if (core_1.env[`BL_${type.toUpperCase()}_${envVar}_URL`]) {
|
|
185
|
+
return new URL(core_1.env[`BL_${type.toUpperCase()}_${envVar}_URL`]);
|
|
186
|
+
}
|
|
187
|
+
return null;
|
|
188
|
+
}
|
package/dist/jobs/jobs.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.blJob = void 0;
|
|
4
|
-
const env_js_1 = require("../common/env.js");
|
|
5
4
|
const internal_js_1 = require("../common/internal.js");
|
|
6
5
|
const logger_js_1 = require("../common/logger.js");
|
|
7
6
|
const settings_js_1 = require("../common/settings.js");
|
|
@@ -25,11 +24,7 @@ class BlJob {
|
|
|
25
24
|
return new URL(`${settings_js_1.settings.runInternalProtocol}://bl-${settings_js_1.settings.env}-${hash}.${settings_js_1.settings.runInternalHostname}`);
|
|
26
25
|
}
|
|
27
26
|
get forcedUrl() {
|
|
28
|
-
|
|
29
|
-
if (env_js_1.env[`BL_JOB_${envVar}_URL`]) {
|
|
30
|
-
return new URL(env_js_1.env[`BL_JOB_${envVar}_URL`]);
|
|
31
|
-
}
|
|
32
|
-
return null;
|
|
27
|
+
return (0, internal_js_1.getForcedUrl)('job', this.jobName);
|
|
33
28
|
}
|
|
34
29
|
get url() {
|
|
35
30
|
if (this.forcedUrl)
|
package/dist/sandbox/action.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare class SandboxAction {
|
|
|
13
13
|
get externalUrl(): string;
|
|
14
14
|
get internalUrl(): string;
|
|
15
15
|
get client(): import("@hey-api/client-fetch").Client;
|
|
16
|
-
get forcedUrl(): string | null;
|
|
16
|
+
get forcedUrl(): string | import("url").URL | null;
|
|
17
17
|
get url(): string;
|
|
18
18
|
handleResponseError(response: Response, data: unknown, error: unknown): void;
|
|
19
19
|
}
|
package/dist/sandbox/action.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SandboxAction = exports.ResponseError = void 0;
|
|
4
4
|
const client_fetch_1 = require("@hey-api/client-fetch");
|
|
5
|
-
const env_js_1 = require("../common/env.js");
|
|
6
5
|
const internal_js_1 = require("../common/internal.js");
|
|
7
6
|
const settings_js_1 = require("../common/settings.js");
|
|
8
7
|
const client_gen_js_1 = require("./client/client.gen.js");
|
|
@@ -64,16 +63,11 @@ class SandboxAction {
|
|
|
64
63
|
get forcedUrl() {
|
|
65
64
|
if (this.sandbox.forceUrl)
|
|
66
65
|
return this.sandbox.forceUrl;
|
|
67
|
-
|
|
68
|
-
const envName = `BL_SANDBOXES_${envVar}_URL`;
|
|
69
|
-
if (env_js_1.env[envName]) {
|
|
70
|
-
return env_js_1.env[envName];
|
|
71
|
-
}
|
|
72
|
-
return null;
|
|
66
|
+
return (0, internal_js_1.getForcedUrl)('sandbox', this.name);
|
|
73
67
|
}
|
|
74
68
|
get url() {
|
|
75
69
|
if (this.forcedUrl)
|
|
76
|
-
return this.forcedUrl;
|
|
70
|
+
return this.forcedUrl.toString();
|
|
77
71
|
// Uncomment and use this when agent and mcp are available in mk3
|
|
78
72
|
// Update all requests made in this package to use fallbackUrl when internalUrl is not working
|
|
79
73
|
// if (settings.runInternalHostname) return this.internalUrl;
|
|
@@ -56,7 +56,7 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
|
56
56
|
// Build URL
|
|
57
57
|
let url = `${this.url}/filesystem/${path}`;
|
|
58
58
|
if (this.forcedUrl) {
|
|
59
|
-
url = `${this.forcedUrl}/filesystem/${path}`;
|
|
59
|
+
url = `${this.forcedUrl.toString()}/filesystem/${path}`;
|
|
60
60
|
}
|
|
61
61
|
// Make the request using fetch instead of axios for better FormData handling
|
|
62
62
|
const response = await fetch(url, {
|
package/dist/tools/index.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getToolMetadata = exports.blTool = exports.blTools = exports.BLTools = exports.getTool = void 0;
|
|
4
4
|
const index_js_1 = require("../cache/index.js");
|
|
5
5
|
const client_js_1 = require("../client/client.js");
|
|
6
|
-
const
|
|
6
|
+
const internal_js_1 = require("../common/internal.js");
|
|
7
7
|
const mcpTool_js_1 = require("./mcpTool.js");
|
|
8
8
|
const getTool = async (name, ms) => {
|
|
9
9
|
return await (0, mcpTool_js_1.getMcpTool)(name, ms);
|
|
@@ -25,8 +25,8 @@ const blTool = (name) => {
|
|
|
25
25
|
};
|
|
26
26
|
exports.blTool = blTool;
|
|
27
27
|
const getToolMetadata = async (tool) => {
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
28
|
+
const forcedUrl = (0, internal_js_1.getForcedUrl)('function', tool);
|
|
29
|
+
if (forcedUrl) {
|
|
30
30
|
return {
|
|
31
31
|
metadata: {
|
|
32
32
|
name: tool,
|
package/dist/tools/mcpTool.js
CHANGED
|
@@ -58,11 +58,7 @@ class McpTool {
|
|
|
58
58
|
return new URL(`${settings_js_1.settings.runInternalProtocol}://bl-${settings_js_1.settings.env}-${hash}.${settings_js_1.settings.runInternalHostname}`);
|
|
59
59
|
}
|
|
60
60
|
get forcedUrl() {
|
|
61
|
-
|
|
62
|
-
if (env_js_1.env[`BL_${this.pluralType.toUpperCase()}_${envVar}_URL`]) {
|
|
63
|
-
return new URL(env_js_1.env[`BL_${this.pluralType.toUpperCase()}_${envVar}_URL`]);
|
|
64
|
-
}
|
|
65
|
-
return null;
|
|
61
|
+
return (0, internal_js_1.getForcedUrl)(this.type, this.name);
|
|
66
62
|
}
|
|
67
63
|
get url() {
|
|
68
64
|
if (this.forcedUrl)
|