@blaxel/core 0.2.0-dev1 → 0.2.0-dev10
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/authentication/index.js +1 -0
- package/dist/cache/index.js +1 -0
- package/dist/common/env.js +1 -0
- package/dist/common/logger.d.ts +25 -1
- package/dist/common/logger.js +58 -1
- package/dist/common/node.d.ts +2 -2
- package/dist/common/node.js +3 -2
- package/dist/common/settings.d.ts +1 -0
- package/dist/common/settings.js +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/mcp/client.js +1 -1
- package/dist/sandbox/client/types.gen.js +0 -1
- package/dist/telemetry/telemetry.d.ts +7 -7
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.authentication = authentication;
|
|
7
|
+
/* eslint-disable */
|
|
7
8
|
const path_1 = require("path");
|
|
8
9
|
const yaml_1 = __importDefault(require("yaml"));
|
|
9
10
|
const env_js_1 = require("../common/env.js");
|
package/dist/cache/index.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.findFromCache = findFromCache;
|
|
7
|
+
/* eslint-disable */
|
|
7
8
|
const yaml_1 = __importDefault(require("yaml"));
|
|
8
9
|
const node_js_1 = require("../common/node.js");
|
|
9
10
|
const cache = new Map();
|
package/dist/common/env.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.env = void 0;
|
|
7
|
+
/* eslint-disable */
|
|
7
8
|
const toml_1 = __importDefault(require("toml"));
|
|
8
9
|
const node_js_1 = require("./node.js");
|
|
9
10
|
const secretEnv = {};
|
package/dist/common/logger.d.ts
CHANGED
|
@@ -1 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
interface LoggerInterface {
|
|
2
|
+
info: (message: string) => void;
|
|
3
|
+
debug: (message: string) => void;
|
|
4
|
+
warn: (message: string) => void;
|
|
5
|
+
error: (message: string) => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Stringify an object with a limited depth
|
|
9
|
+
* @param obj The object to stringify
|
|
10
|
+
* @param maxDepth Maximum depth (default: 1)
|
|
11
|
+
* @param depth Current depth (internal use)
|
|
12
|
+
*/
|
|
13
|
+
export declare function stringify<T>(obj: T, maxDepth?: number, depth?: number): string;
|
|
14
|
+
declare class Logger {
|
|
15
|
+
private logger;
|
|
16
|
+
constructor();
|
|
17
|
+
setLogger(logger: LoggerInterface): void;
|
|
18
|
+
parseArgs(args: unknown[]): string;
|
|
19
|
+
info(...message: unknown[]): void;
|
|
20
|
+
debug(...message: unknown[]): void;
|
|
21
|
+
warn(...message: unknown[]): void;
|
|
22
|
+
error(...message: unknown[]): void;
|
|
23
|
+
}
|
|
24
|
+
declare const logger: Logger;
|
|
25
|
+
export { logger };
|
package/dist/common/logger.js
CHANGED
|
@@ -1,4 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.logger = void 0;
|
|
4
|
-
exports.
|
|
4
|
+
exports.stringify = stringify;
|
|
5
|
+
/**
|
|
6
|
+
* Stringify an object with a limited depth
|
|
7
|
+
* @param obj The object to stringify
|
|
8
|
+
* @param maxDepth Maximum depth (default: 1)
|
|
9
|
+
* @param depth Current depth (internal use)
|
|
10
|
+
*/
|
|
11
|
+
function stringify(obj, maxDepth = 1, depth = 0) {
|
|
12
|
+
if (obj instanceof Error)
|
|
13
|
+
return obj.stack || obj.message;
|
|
14
|
+
if (obj === null)
|
|
15
|
+
return 'null';
|
|
16
|
+
if (obj === undefined)
|
|
17
|
+
return 'undefined';
|
|
18
|
+
// If we've reached max depth or it's not an object
|
|
19
|
+
if (depth >= maxDepth || typeof obj !== 'object') {
|
|
20
|
+
return typeof obj === 'object' ? `[${Array.isArray(obj) ? 'Array' : 'object'}]` :
|
|
21
|
+
typeof obj === 'string' ? `"${obj}"` : String(obj);
|
|
22
|
+
}
|
|
23
|
+
// Handle arrays
|
|
24
|
+
if (Array.isArray(obj)) {
|
|
25
|
+
return `[${obj.map(item => stringify(item, maxDepth, depth + 1)).join(', ')}]`;
|
|
26
|
+
}
|
|
27
|
+
// Handle objects
|
|
28
|
+
const pairs = Object.entries(obj).map(([key, val]) => `"${key}": ${stringify(val, maxDepth, depth + 1)}`);
|
|
29
|
+
return `{${pairs.join(', ')}}`;
|
|
30
|
+
}
|
|
31
|
+
class Logger {
|
|
32
|
+
logger;
|
|
33
|
+
constructor() {
|
|
34
|
+
this.logger = console;
|
|
35
|
+
}
|
|
36
|
+
setLogger(logger) {
|
|
37
|
+
this.logger = logger;
|
|
38
|
+
}
|
|
39
|
+
parseArgs(args) {
|
|
40
|
+
return args.map((arg) => {
|
|
41
|
+
if (arg instanceof Error) {
|
|
42
|
+
return arg.stack ?? arg.message;
|
|
43
|
+
}
|
|
44
|
+
return arg;
|
|
45
|
+
}).join(" ");
|
|
46
|
+
}
|
|
47
|
+
info(...message) {
|
|
48
|
+
this.logger.info(this.parseArgs(message));
|
|
49
|
+
}
|
|
50
|
+
debug(...message) {
|
|
51
|
+
this.logger.debug(this.parseArgs(message));
|
|
52
|
+
}
|
|
53
|
+
warn(...message) {
|
|
54
|
+
this.logger.warn(this.parseArgs(message));
|
|
55
|
+
}
|
|
56
|
+
error(...message) {
|
|
57
|
+
this.logger.error(this.parseArgs(message));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const logger = new Logger();
|
|
61
|
+
exports.logger = logger;
|
package/dist/common/node.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare let fs:
|
|
2
|
-
declare let os:
|
|
1
|
+
declare let fs: typeof import("fs") | null;
|
|
2
|
+
declare let os: typeof import("os") | null;
|
|
3
3
|
export { fs, os };
|
package/dist/common/node.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.os = exports.fs = void 0;
|
|
4
|
+
/* eslint-disable */
|
|
4
5
|
const isNode = typeof process !== "undefined" &&
|
|
5
6
|
process.versions != null &&
|
|
6
7
|
process.versions.node != null;
|
|
@@ -9,6 +10,6 @@ exports.fs = fs;
|
|
|
9
10
|
let os = null;
|
|
10
11
|
exports.os = os;
|
|
11
12
|
if (isNode) {
|
|
12
|
-
exports.fs = fs = require("fs");
|
|
13
|
-
exports.os = os = require("os");
|
|
13
|
+
exports.fs = fs = eval("require")("fs");
|
|
14
|
+
exports.os = os = eval("require")("os");
|
|
14
15
|
}
|
package/dist/common/settings.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -10,5 +10,6 @@ export * from "./common/settings.js";
|
|
|
10
10
|
export * from "./mcp/index.js";
|
|
11
11
|
export * from "./models/index.js";
|
|
12
12
|
export * from "./sandbox/index.js";
|
|
13
|
+
export * from "./telemetry/telemetry.js";
|
|
13
14
|
export * from "./tools/index.js";
|
|
14
15
|
export * from "./tools/types.js";
|
package/dist/index.js
CHANGED
|
@@ -26,5 +26,6 @@ __exportStar(require("./common/settings.js"), exports);
|
|
|
26
26
|
__exportStar(require("./mcp/index.js"), exports);
|
|
27
27
|
__exportStar(require("./models/index.js"), exports);
|
|
28
28
|
__exportStar(require("./sandbox/index.js"), exports);
|
|
29
|
+
__exportStar(require("./telemetry/telemetry.js"), exports);
|
|
29
30
|
__exportStar(require("./tools/index.js"), exports);
|
|
30
31
|
__exportStar(require("./tools/types.js"), exports);
|
package/dist/mcp/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Options for creating a span
|
|
3
3
|
*/
|
|
4
|
-
export interface
|
|
4
|
+
export interface BlaxelSpanOptions {
|
|
5
5
|
/** Key-value attributes to attach to the span */
|
|
6
6
|
attributes?: Record<string, string | number | boolean>;
|
|
7
7
|
/** Parent span context, if any */
|
|
@@ -12,7 +12,7 @@ export interface SpanOptions {
|
|
|
12
12
|
/**
|
|
13
13
|
* Represents a telemetry span
|
|
14
14
|
*/
|
|
15
|
-
export interface
|
|
15
|
+
export interface BlaxelSpan {
|
|
16
16
|
/** Add an attribute to the span */
|
|
17
17
|
setAttribute(key: string, value: string | number | boolean): void;
|
|
18
18
|
/** Add multiple attributes to the span */
|
|
@@ -29,9 +29,9 @@ export interface Span {
|
|
|
29
29
|
/**
|
|
30
30
|
* Provider interface for telemetry functionality
|
|
31
31
|
*/
|
|
32
|
-
export interface
|
|
32
|
+
export interface BlaxelTelemetryProvider {
|
|
33
33
|
/** Create a new span */
|
|
34
|
-
startSpan(name: string, options?:
|
|
34
|
+
startSpan(name: string, options?: BlaxelSpanOptions): BlaxelSpan;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Registry for managing the global telemetry provider
|
|
@@ -44,15 +44,15 @@ declare class TelemetryRegistry {
|
|
|
44
44
|
/**
|
|
45
45
|
* Register a telemetry provider implementation
|
|
46
46
|
*/
|
|
47
|
-
registerProvider(provider:
|
|
47
|
+
registerProvider(provider: BlaxelTelemetryProvider): void;
|
|
48
48
|
/**
|
|
49
49
|
* Get the current telemetry provider
|
|
50
50
|
*/
|
|
51
|
-
getProvider():
|
|
51
|
+
getProvider(): BlaxelTelemetryProvider;
|
|
52
52
|
}
|
|
53
53
|
export declare const telemetryRegistry: TelemetryRegistry;
|
|
54
54
|
/**
|
|
55
55
|
* Create a span with the registered provider
|
|
56
56
|
*/
|
|
57
|
-
export declare function startSpan(name: string, options?:
|
|
57
|
+
export declare function startSpan(name: string, options?: BlaxelSpanOptions): BlaxelSpan;
|
|
58
58
|
export {};
|