@blaxel/core 0.2.0-dev1

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 (86) hide show
  1. package/LICENSE +21 -0
  2. package/dist/agents/index.d.ts +15 -0
  3. package/dist/agents/index.js +114 -0
  4. package/dist/authentication/apikey.d.ts +10 -0
  5. package/dist/authentication/apikey.js +24 -0
  6. package/dist/authentication/clientcredentials.d.ts +15 -0
  7. package/dist/authentication/clientcredentials.js +70 -0
  8. package/dist/authentication/credentials.d.ts +6 -0
  9. package/dist/authentication/credentials.js +17 -0
  10. package/dist/authentication/deviceMode.d.ts +15 -0
  11. package/dist/authentication/deviceMode.js +70 -0
  12. package/dist/authentication/index.d.ts +3 -0
  13. package/dist/authentication/index.js +63 -0
  14. package/dist/authentication/types.d.ts +9 -0
  15. package/dist/authentication/types.js +2 -0
  16. package/dist/cache/index.d.ts +1 -0
  17. package/dist/cache/index.js +26 -0
  18. package/dist/client/authentication.d.ts +25 -0
  19. package/dist/client/authentication.js +15 -0
  20. package/dist/client/client.d.ts +2 -0
  21. package/dist/client/client.gen.d.ts +12 -0
  22. package/dist/client/client.gen.js +8 -0
  23. package/dist/client/client.js +17 -0
  24. package/dist/client/index.d.ts +2 -0
  25. package/dist/client/index.js +19 -0
  26. package/dist/client/interceptors.d.ts +3 -0
  27. package/dist/client/interceptors.js +17 -0
  28. package/dist/client/sdk.gen.d.ts +410 -0
  29. package/dist/client/sdk.gen.js +1436 -0
  30. package/dist/client/types.gen.d.ts +3534 -0
  31. package/dist/client/types.gen.js +4 -0
  32. package/dist/common/autoload.d.ts +3 -0
  33. package/dist/common/autoload.js +27 -0
  34. package/dist/common/env.d.ts +5 -0
  35. package/dist/common/env.js +43 -0
  36. package/dist/common/errors.d.ts +1 -0
  37. package/dist/common/errors.js +17 -0
  38. package/dist/common/internal.d.ts +2 -0
  39. package/dist/common/internal.js +19 -0
  40. package/dist/common/logger.d.ts +1 -0
  41. package/dist/common/logger.js +4 -0
  42. package/dist/common/node.d.ts +3 -0
  43. package/dist/common/node.js +14 -0
  44. package/dist/common/settings.d.ts +26 -0
  45. package/dist/common/settings.js +84 -0
  46. package/dist/index.d.ts +14 -0
  47. package/dist/index.js +30 -0
  48. package/dist/mcp/client.d.ts +19 -0
  49. package/dist/mcp/client.js +151 -0
  50. package/dist/mcp/index.d.ts +2 -0
  51. package/dist/mcp/index.js +18 -0
  52. package/dist/mcp/server.d.ts +24 -0
  53. package/dist/mcp/server.js +213 -0
  54. package/dist/models/index.d.ts +8 -0
  55. package/dist/models/index.js +31 -0
  56. package/dist/sandbox/action.d.ts +18 -0
  57. package/dist/sandbox/action.js +74 -0
  58. package/dist/sandbox/client/client.gen.d.ts +12 -0
  59. package/dist/sandbox/client/client.gen.js +6 -0
  60. package/dist/sandbox/client/index.d.ts +2 -0
  61. package/dist/sandbox/client/index.js +19 -0
  62. package/dist/sandbox/client/sdk.gen.d.ts +83 -0
  63. package/dist/sandbox/client/sdk.gen.js +153 -0
  64. package/dist/sandbox/client/types.gen.d.ts +410 -0
  65. package/dist/sandbox/client/types.gen.js +4 -0
  66. package/dist/sandbox/filesystem.d.ts +18 -0
  67. package/dist/sandbox/filesystem.js +121 -0
  68. package/dist/sandbox/index.d.ts +1 -0
  69. package/dist/sandbox/index.js +17 -0
  70. package/dist/sandbox/network.d.ts +5 -0
  71. package/dist/sandbox/network.js +10 -0
  72. package/dist/sandbox/process.d.ts +12 -0
  73. package/dist/sandbox/process.js +61 -0
  74. package/dist/sandbox/sandbox.d.ts +23 -0
  75. package/dist/sandbox/sandbox.js +92 -0
  76. package/dist/telemetry/telemetry.d.ts +58 -0
  77. package/dist/telemetry/telemetry.js +59 -0
  78. package/dist/tools/index.d.ts +10 -0
  79. package/dist/tools/index.js +52 -0
  80. package/dist/tools/mcpTool.d.ts +21 -0
  81. package/dist/tools/mcpTool.js +193 -0
  82. package/dist/tools/types.d.ts +8 -0
  83. package/dist/tools/types.js +2 -0
  84. package/dist/tools/zodSchema.d.ts +9 -0
  85. package/dist/tools/zodSchema.js +46 -0
  86. package/package.json +76 -0
@@ -0,0 +1,213 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.BlaxelMcpServerTransport = void 0;
37
+ const uuid_1 = require("uuid");
38
+ const ws_1 = __importStar(require("ws"));
39
+ const env_js_1 = require("../common/env.js");
40
+ const logger_js_1 = require("../common/logger.js");
41
+ const telemetry_js_1 = require("../telemetry/telemetry.js");
42
+ const spans = new Map();
43
+ class BlaxelMcpServerTransport {
44
+ port;
45
+ wss;
46
+ clients = new Map();
47
+ onclose;
48
+ onerror;
49
+ messageHandler;
50
+ onconnection;
51
+ ondisconnection;
52
+ set onmessage(handler) {
53
+ this.messageHandler = handler
54
+ ? (msg, clientId) => {
55
+ if (!("id" in msg)) {
56
+ return handler(msg);
57
+ }
58
+ return handler({
59
+ ...msg,
60
+ id: clientId + ":" + msg.id,
61
+ });
62
+ }
63
+ : undefined;
64
+ }
65
+ constructor(port) {
66
+ this.port = port ?? parseInt(env_js_1.env.BL_SERVER_PORT ?? "8080", 10);
67
+ this.wss = new ws_1.WebSocketServer({ port: this.port });
68
+ }
69
+ async start() {
70
+ logger_js_1.logger.info("Starting WebSocket Server on port " + this.port);
71
+ this.wss.on("connection", (ws) => {
72
+ const clientId = (0, uuid_1.v4)();
73
+ this.clients.set(clientId, {
74
+ ws,
75
+ });
76
+ this.onconnection?.(clientId);
77
+ ws.on("message", (data) => {
78
+ const span = (0, telemetry_js_1.startSpan)("message", {
79
+ attributes: {
80
+ "mcp.client.id": clientId,
81
+ "span.type": "mcp.message",
82
+ },
83
+ isRoot: false,
84
+ });
85
+ try {
86
+ const msg = JSON.parse(data.toString());
87
+ this.messageHandler?.(msg, clientId);
88
+ if ("method" in msg && "id" in msg && "params" in msg) {
89
+ span.setAttributes({
90
+ "mcp.message.parsed": true,
91
+ "mcp.method": msg.method,
92
+ "mcp.messageId": msg.id,
93
+ "mcp.toolName": msg.params?.name,
94
+ });
95
+ spans.set(clientId + ":" + msg.id, span);
96
+ }
97
+ // Handle msg.id safely
98
+ const msgId = msg.id ? String(msg.id) : "";
99
+ const [cId, parsedMsgId] = msgId.split(":");
100
+ msg.id = parsedMsgId ? parseInt(parsedMsgId) : undefined;
101
+ // Use optional chaining for safe access
102
+ const client = this.clients.get(cId ?? "");
103
+ if (client?.ws?.readyState === ws_1.default.OPEN) {
104
+ const msgSpan = spans.get(cId + ":" + (msg.id ?? ""));
105
+ try {
106
+ client.ws.send(JSON.stringify(msg));
107
+ if (msgSpan) {
108
+ msgSpan.setAttributes({
109
+ "mcp.message.response_sent": true,
110
+ });
111
+ }
112
+ }
113
+ catch (err) {
114
+ if (msgSpan) {
115
+ msgSpan.setStatus("error"); // Error status
116
+ msgSpan.recordException(err);
117
+ }
118
+ throw err;
119
+ }
120
+ finally {
121
+ if (msgSpan) {
122
+ msgSpan.end();
123
+ }
124
+ }
125
+ }
126
+ else {
127
+ this.clients.delete(cId);
128
+ this.ondisconnection?.(cId);
129
+ }
130
+ }
131
+ catch (err) {
132
+ if (err instanceof Error) {
133
+ span.setStatus("error"); // Error status
134
+ span.recordException(err);
135
+ this.onerror?.(err);
136
+ }
137
+ else {
138
+ this.onerror?.(new Error(`Failed to parse message: ${String(err)}`));
139
+ }
140
+ span.end();
141
+ }
142
+ });
143
+ ws.on("close", () => {
144
+ this.clients.delete(clientId);
145
+ this.ondisconnection?.(clientId);
146
+ });
147
+ ws.on("error", (err) => {
148
+ this.onerror?.(err);
149
+ });
150
+ });
151
+ return Promise.resolve();
152
+ }
153
+ async send(msg) {
154
+ const [cId, msgId] = msg.id ? String(msg.id).split(":") : [];
155
+ msg.id = parseInt(msgId);
156
+ const data = JSON.stringify(msg);
157
+ const deadClients = [];
158
+ if (cId) {
159
+ // Send to specific client
160
+ const client = this.clients.get(cId);
161
+ if (client?.ws?.readyState === ws_1.default.OPEN) {
162
+ const msgSpan = spans.get(cId + ":" + msg.id);
163
+ try {
164
+ client.ws.send(data);
165
+ if (msgSpan) {
166
+ msgSpan.setAttributes({
167
+ "mcp.message.response_sent": true,
168
+ });
169
+ }
170
+ }
171
+ catch (err) {
172
+ if (msgSpan) {
173
+ msgSpan.setStatus("error"); // Error status
174
+ msgSpan.recordException(err);
175
+ }
176
+ throw err;
177
+ }
178
+ finally {
179
+ if (msgSpan) {
180
+ msgSpan.end();
181
+ }
182
+ }
183
+ }
184
+ else {
185
+ this.clients.delete(cId);
186
+ this.ondisconnection?.(cId);
187
+ }
188
+ }
189
+ for (const [id, client] of this.clients.entries()) {
190
+ if (client.ws.readyState !== ws_1.default.OPEN) {
191
+ deadClients.push(id);
192
+ }
193
+ }
194
+ // Cleanup dead clients
195
+ deadClients.forEach((id) => {
196
+ this.clients.delete(id);
197
+ this.ondisconnection?.(id);
198
+ });
199
+ return Promise.resolve();
200
+ }
201
+ async broadcast(msg) {
202
+ return this.send(msg);
203
+ }
204
+ async close() {
205
+ return new Promise((resolve) => {
206
+ this.wss.close(() => {
207
+ this.clients.clear();
208
+ resolve();
209
+ });
210
+ });
211
+ }
212
+ }
213
+ exports.BlaxelMcpServerTransport = BlaxelMcpServerTransport;
@@ -0,0 +1,8 @@
1
+ import { Model } from "../client/types.gen.js";
2
+ export declare class BLModel {
3
+ modelName: string;
4
+ options?: Record<string, unknown>;
5
+ constructor(modelName: string, options?: Record<string, unknown>);
6
+ }
7
+ export declare const blModel: (modelName: string, options?: Record<string, unknown>) => BLModel;
8
+ export declare const getModelMetadata: (model: string) => Promise<Model | null>;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getModelMetadata = exports.blModel = exports.BLModel = void 0;
4
+ const index_js_1 = require("../cache/index.js");
5
+ const sdk_gen_js_1 = require("../client/sdk.gen.js");
6
+ class BLModel {
7
+ modelName;
8
+ options;
9
+ constructor(modelName, options) {
10
+ this.modelName = modelName;
11
+ this.options = options || {};
12
+ }
13
+ }
14
+ exports.BLModel = BLModel;
15
+ const blModel = (modelName, options) => {
16
+ return new BLModel(modelName, options);
17
+ };
18
+ exports.blModel = blModel;
19
+ const getModelMetadata = async (model) => {
20
+ const cacheData = await (0, index_js_1.findFromCache)("Model", model);
21
+ if (cacheData) {
22
+ return cacheData;
23
+ }
24
+ const { data } = await (0, sdk_gen_js_1.getModel)({
25
+ path: {
26
+ modelName: model,
27
+ },
28
+ });
29
+ return data || null;
30
+ };
31
+ exports.getModelMetadata = getModelMetadata;
@@ -0,0 +1,18 @@
1
+ import { Sandbox } from "../client/index.js";
2
+ export declare class ResponseError extends Error {
3
+ response: Response;
4
+ data: unknown;
5
+ error: unknown;
6
+ constructor(response: Response, data: unknown, error: unknown);
7
+ }
8
+ export declare class SandboxAction {
9
+ private sandbox;
10
+ constructor(sandbox: Sandbox);
11
+ get name(): string;
12
+ get fallbackUrl(): string | null;
13
+ get externalUrl(): string;
14
+ get internalUrl(): string;
15
+ get forcedUrl(): string | null;
16
+ get url(): string;
17
+ handleResponseError(response: Response, data: unknown, error: unknown): void;
18
+ }
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SandboxAction = exports.ResponseError = void 0;
4
+ const process_1 = require("process");
5
+ const internal_js_1 = require("../common/internal.js");
6
+ const settings_js_1 = require("../common/settings.js");
7
+ class ResponseError extends Error {
8
+ response;
9
+ data;
10
+ error;
11
+ constructor(response, data, error) {
12
+ let dataError = {};
13
+ if (data && typeof data === 'object' && 'error' in data) {
14
+ dataError = data;
15
+ }
16
+ if (error && typeof error === 'object' && 'error' in error) {
17
+ dataError['error'] = error.error;
18
+ }
19
+ if (response.status) {
20
+ dataError['status'] = response.status;
21
+ }
22
+ if (response.statusText) {
23
+ dataError['statusText'] = response.statusText;
24
+ }
25
+ super(JSON.stringify(dataError));
26
+ this.response = response;
27
+ this.data = data;
28
+ this.error = error;
29
+ }
30
+ }
31
+ exports.ResponseError = ResponseError;
32
+ class SandboxAction {
33
+ sandbox;
34
+ constructor(sandbox) {
35
+ this.sandbox = sandbox;
36
+ }
37
+ get name() {
38
+ return this.sandbox.metadata?.name ?? "";
39
+ }
40
+ get fallbackUrl() {
41
+ if (this.externalUrl != this.url) {
42
+ return this.externalUrl;
43
+ }
44
+ return null;
45
+ }
46
+ get externalUrl() {
47
+ return `${settings_js_1.settings.runUrl}/${settings_js_1.settings.workspace}/sandboxes/${this.name}`;
48
+ }
49
+ get internalUrl() {
50
+ const hash = (0, internal_js_1.getGlobalUniqueHash)(settings_js_1.settings.workspace, "sandbox", this.name);
51
+ return `${settings_js_1.settings.runInternalProtocol}://bl-${settings_js_1.settings.env}-${hash}.${settings_js_1.settings.runInternalHostname}`;
52
+ }
53
+ get forcedUrl() {
54
+ const envVar = this.name.replace(/-/g, "_").toUpperCase();
55
+ const envName = `BL_SANDBOX_${envVar}_URL`;
56
+ if (process_1.env[envName]) {
57
+ return process_1.env[envName];
58
+ }
59
+ return null;
60
+ }
61
+ get url() {
62
+ if (this.forcedUrl)
63
+ return this.forcedUrl;
64
+ if (settings_js_1.settings.runInternalHostname)
65
+ return this.internalUrl;
66
+ return this.externalUrl;
67
+ }
68
+ handleResponseError(response, data, error) {
69
+ if (!response.ok || !data) {
70
+ throw new ResponseError(response, data, error);
71
+ }
72
+ }
73
+ }
74
+ exports.SandboxAction = SandboxAction;
@@ -0,0 +1,12 @@
1
+ import { type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch';
2
+ import type { ClientOptions } from './types.gen.js';
3
+ /**
4
+ * The `createClientConfig()` function will be called on client initialization
5
+ * and the returned object will become the client's initial configuration.
6
+ *
7
+ * You may want to initialize your client this way instead of calling
8
+ * `setConfig()`. This is useful for example if you're using Next.js
9
+ * to ensure your client always has the correct values.
10
+ */
11
+ export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>;
12
+ export declare const client: import("@hey-api/client-fetch").Client;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ // This file is auto-generated by @hey-api/openapi-ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.client = void 0;
5
+ const client_fetch_1 = require("@hey-api/client-fetch");
6
+ exports.client = (0, client_fetch_1.createClient)((0, client_fetch_1.createConfig)());
@@ -0,0 +1,2 @@
1
+ export * from './sdk.gen.js';
2
+ export * from './types.gen.js';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // This file is auto-generated by @hey-api/openapi-ts
18
+ __exportStar(require("./sdk.gen.js"), exports);
19
+ __exportStar(require("./types.gen.js"), exports);
@@ -0,0 +1,83 @@
1
+ import type { Client, Options as ClientOptions, TDataShape } from '@hey-api/client-fetch';
2
+ import type { DeleteFilesystemByPathData, DeleteNetworkProcessByPidMonitorData, DeleteProcessByIdentifierData, DeleteProcessByIdentifierKillData, GetFilesystemByPathData, GetNetworkProcessByPidPortsData, GetProcessByIdentifierData, GetProcessByIdentifierLogsData, GetProcessData, PostNetworkProcessByPidMonitorData, PostProcessData, PutFilesystemByPathData } from './types.gen.js';
3
+ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
4
+ /**
5
+ * You can provide a client instance returned by `createClient()` instead of
6
+ * individual options. This might be also useful if you want to implement a
7
+ * custom client.
8
+ */
9
+ client?: Client;
10
+ /**
11
+ * You can pass arbitrary values through the `meta` object. This can be
12
+ * used to access values that aren't defined as part of the SDK function.
13
+ */
14
+ meta?: Record<string, unknown>;
15
+ };
16
+ /**
17
+ * Delete file or directory
18
+ * Delete a file or directory
19
+ */
20
+ export declare const deleteFilesystemByPath: <ThrowOnError extends boolean = false>(options: Options<DeleteFilesystemByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").SuccessResponse, import("./types.gen.js").ErrorResponse, ThrowOnError>;
21
+ /**
22
+ * Get file or directory information
23
+ * Get content of a file or listing of a directory
24
+ */
25
+ export declare const getFilesystemByPath: <ThrowOnError extends boolean = false>(options: Options<GetFilesystemByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").Directory, import("./types.gen.js").ErrorResponse, ThrowOnError>;
26
+ /**
27
+ * Create or update file or directory
28
+ * Create or update a file or directory
29
+ */
30
+ export declare const putFilesystemByPath: <ThrowOnError extends boolean = false>(options: Options<PutFilesystemByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").SuccessResponse, import("./types.gen.js").ErrorResponse, ThrowOnError>;
31
+ /**
32
+ * Stop monitoring ports for a process
33
+ * Stop monitoring for new ports opened by a process
34
+ */
35
+ export declare const deleteNetworkProcessByPidMonitor: <ThrowOnError extends boolean = false>(options: Options<DeleteNetworkProcessByPidMonitorData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<{
36
+ [key: string]: unknown;
37
+ }, import("./types.gen.js").ErrorResponse, ThrowOnError>;
38
+ /**
39
+ * Start monitoring ports for a process
40
+ * Start monitoring for new ports opened by a process
41
+ */
42
+ export declare const postNetworkProcessByPidMonitor: <ThrowOnError extends boolean = false>(options: Options<PostNetworkProcessByPidMonitorData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<{
43
+ [key: string]: unknown;
44
+ }, import("./types.gen.js").ErrorResponse, ThrowOnError>;
45
+ /**
46
+ * Get open ports for a process
47
+ * Get a list of all open ports for a process
48
+ */
49
+ export declare const getNetworkProcessByPidPorts: <ThrowOnError extends boolean = false>(options: Options<GetNetworkProcessByPidPortsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<{
50
+ [key: string]: unknown;
51
+ }, import("./types.gen.js").ErrorResponse, ThrowOnError>;
52
+ /**
53
+ * List all processes
54
+ * Get a list of all running and completed processes
55
+ */
56
+ export declare const getProcess: <ThrowOnError extends boolean = false>(options?: Options<GetProcessData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").ProcessResponse[], unknown, ThrowOnError>;
57
+ /**
58
+ * Execute a command
59
+ * Execute a command and return process information
60
+ */
61
+ export declare const postProcess: <ThrowOnError extends boolean = false>(options: Options<PostProcessData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").ProcessResponse, import("./types.gen.js").ErrorResponse, ThrowOnError>;
62
+ /**
63
+ * Stop a process
64
+ * Gracefully stop a running process
65
+ */
66
+ export declare const deleteProcessByIdentifier: <ThrowOnError extends boolean = false>(options: Options<DeleteProcessByIdentifierData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").SuccessResponse, import("./types.gen.js").ErrorResponse, ThrowOnError>;
67
+ /**
68
+ * Get process by identifier
69
+ * Get information about a process by its PID or name
70
+ */
71
+ export declare const getProcessByIdentifier: <ThrowOnError extends boolean = false>(options: Options<GetProcessByIdentifierData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").ProcessResponse, import("./types.gen.js").ErrorResponse, ThrowOnError>;
72
+ /**
73
+ * Kill a process
74
+ * Forcefully kill a running process
75
+ */
76
+ export declare const deleteProcessByIdentifierKill: <ThrowOnError extends boolean = false>(options: Options<DeleteProcessByIdentifierKillData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").SuccessResponse, import("./types.gen.js").ErrorResponse, ThrowOnError>;
77
+ /**
78
+ * Get process logs
79
+ * Get the stdout and stderr output of a process
80
+ */
81
+ export declare const getProcessByIdentifierLogs: <ThrowOnError extends boolean = false>(options: Options<GetProcessByIdentifierLogsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<{
82
+ [key: string]: string;
83
+ }, import("./types.gen.js").ErrorResponse, ThrowOnError>;
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ // This file is auto-generated by @hey-api/openapi-ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.getProcessByIdentifierLogs = exports.deleteProcessByIdentifierKill = exports.getProcessByIdentifier = exports.deleteProcessByIdentifier = exports.postProcess = exports.getProcess = exports.getNetworkProcessByPidPorts = exports.postNetworkProcessByPidMonitor = exports.deleteNetworkProcessByPidMonitor = exports.putFilesystemByPath = exports.getFilesystemByPath = exports.deleteFilesystemByPath = void 0;
5
+ const client_gen_js_1 = require("../client/client.gen.js");
6
+ /**
7
+ * Delete file or directory
8
+ * Delete a file or directory
9
+ */
10
+ const deleteFilesystemByPath = (options) => {
11
+ return (options.client ?? client_gen_js_1.client).delete({
12
+ url: '/filesystem/{path}',
13
+ ...options
14
+ });
15
+ };
16
+ exports.deleteFilesystemByPath = deleteFilesystemByPath;
17
+ /**
18
+ * Get file or directory information
19
+ * Get content of a file or listing of a directory
20
+ */
21
+ const getFilesystemByPath = (options) => {
22
+ return (options.client ?? client_gen_js_1.client).get({
23
+ url: '/filesystem/{path}',
24
+ ...options
25
+ });
26
+ };
27
+ exports.getFilesystemByPath = getFilesystemByPath;
28
+ /**
29
+ * Create or update file or directory
30
+ * Create or update a file or directory
31
+ */
32
+ const putFilesystemByPath = (options) => {
33
+ return (options.client ?? client_gen_js_1.client).put({
34
+ url: '/filesystem/{path}',
35
+ ...options,
36
+ headers: {
37
+ 'Content-Type': 'application/json',
38
+ ...options?.headers
39
+ }
40
+ });
41
+ };
42
+ exports.putFilesystemByPath = putFilesystemByPath;
43
+ /**
44
+ * Stop monitoring ports for a process
45
+ * Stop monitoring for new ports opened by a process
46
+ */
47
+ const deleteNetworkProcessByPidMonitor = (options) => {
48
+ return (options.client ?? client_gen_js_1.client).delete({
49
+ url: '/network/process/{pid}/monitor',
50
+ ...options
51
+ });
52
+ };
53
+ exports.deleteNetworkProcessByPidMonitor = deleteNetworkProcessByPidMonitor;
54
+ /**
55
+ * Start monitoring ports for a process
56
+ * Start monitoring for new ports opened by a process
57
+ */
58
+ const postNetworkProcessByPidMonitor = (options) => {
59
+ return (options.client ?? client_gen_js_1.client).post({
60
+ url: '/network/process/{pid}/monitor',
61
+ ...options,
62
+ headers: {
63
+ 'Content-Type': 'application/json',
64
+ ...options?.headers
65
+ }
66
+ });
67
+ };
68
+ exports.postNetworkProcessByPidMonitor = postNetworkProcessByPidMonitor;
69
+ /**
70
+ * Get open ports for a process
71
+ * Get a list of all open ports for a process
72
+ */
73
+ const getNetworkProcessByPidPorts = (options) => {
74
+ return (options.client ?? client_gen_js_1.client).get({
75
+ url: '/network/process/{pid}/ports',
76
+ ...options
77
+ });
78
+ };
79
+ exports.getNetworkProcessByPidPorts = getNetworkProcessByPidPorts;
80
+ /**
81
+ * List all processes
82
+ * Get a list of all running and completed processes
83
+ */
84
+ const getProcess = (options) => {
85
+ return (options?.client ?? client_gen_js_1.client).get({
86
+ url: '/process',
87
+ ...options
88
+ });
89
+ };
90
+ exports.getProcess = getProcess;
91
+ /**
92
+ * Execute a command
93
+ * Execute a command and return process information
94
+ */
95
+ const postProcess = (options) => {
96
+ return (options.client ?? client_gen_js_1.client).post({
97
+ url: '/process',
98
+ ...options,
99
+ headers: {
100
+ 'Content-Type': 'application/json',
101
+ ...options?.headers
102
+ }
103
+ });
104
+ };
105
+ exports.postProcess = postProcess;
106
+ /**
107
+ * Stop a process
108
+ * Gracefully stop a running process
109
+ */
110
+ const deleteProcessByIdentifier = (options) => {
111
+ return (options.client ?? client_gen_js_1.client).delete({
112
+ url: '/process/{identifier}',
113
+ ...options
114
+ });
115
+ };
116
+ exports.deleteProcessByIdentifier = deleteProcessByIdentifier;
117
+ /**
118
+ * Get process by identifier
119
+ * Get information about a process by its PID or name
120
+ */
121
+ const getProcessByIdentifier = (options) => {
122
+ return (options.client ?? client_gen_js_1.client).get({
123
+ url: '/process/{identifier}',
124
+ ...options
125
+ });
126
+ };
127
+ exports.getProcessByIdentifier = getProcessByIdentifier;
128
+ /**
129
+ * Kill a process
130
+ * Forcefully kill a running process
131
+ */
132
+ const deleteProcessByIdentifierKill = (options) => {
133
+ return (options.client ?? client_gen_js_1.client).delete({
134
+ url: '/process/{identifier}/kill',
135
+ ...options,
136
+ headers: {
137
+ 'Content-Type': 'application/json',
138
+ ...options?.headers
139
+ }
140
+ });
141
+ };
142
+ exports.deleteProcessByIdentifierKill = deleteProcessByIdentifierKill;
143
+ /**
144
+ * Get process logs
145
+ * Get the stdout and stderr output of a process
146
+ */
147
+ const getProcessByIdentifierLogs = (options) => {
148
+ return (options.client ?? client_gen_js_1.client).get({
149
+ url: '/process/{identifier}/logs',
150
+ ...options
151
+ });
152
+ };
153
+ exports.getProcessByIdentifierLogs = getProcessByIdentifierLogs;