@blaxel/core 0.3.26-preview.310 → 0.3.26-preview.312
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/common/settings.js +2 -2
- package/dist/cjs/sandbox/client/sdk.gen.js +17 -8
- package/dist/cjs/sandbox/filesystem/filesystem.js +1 -1
- package/dist/cjs/sandbox/preview.js +104 -1
- package/dist/cjs/types/sandbox/client/sdk.gen.d.ts +17 -8
- package/dist/cjs/types/sandbox/client/types.gen.d.ts +21 -5
- package/dist/cjs/types/sandbox/preview.d.ts +12 -3
- package/dist/cjs/types/sandbox/types.d.ts +7 -0
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/common/settings.js +2 -2
- package/dist/cjs-browser/sandbox/client/sdk.gen.js +17 -8
- package/dist/cjs-browser/sandbox/filesystem/filesystem.js +1 -1
- package/dist/cjs-browser/sandbox/preview.js +104 -1
- package/dist/cjs-browser/types/sandbox/client/sdk.gen.d.ts +17 -8
- package/dist/cjs-browser/types/sandbox/client/types.gen.d.ts +21 -5
- package/dist/cjs-browser/types/sandbox/preview.d.ts +12 -3
- package/dist/cjs-browser/types/sandbox/types.d.ts +7 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/common/settings.js +2 -2
- package/dist/esm/sandbox/client/sdk.gen.js +17 -8
- package/dist/esm/sandbox/filesystem/filesystem.js +1 -1
- package/dist/esm/sandbox/preview.js +104 -1
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/common/settings.js +2 -2
- package/dist/esm-browser/sandbox/client/sdk.gen.js +17 -8
- package/dist/esm-browser/sandbox/filesystem/filesystem.js +1 -1
- package/dist/esm-browser/sandbox/preview.js +104 -1
- package/package.json +1 -1
|
@@ -30,8 +30,8 @@ function missingCredentialsMessage() {
|
|
|
30
30
|
return "No Blaxel credentials found. Set the BL_API_KEY and BL_WORKSPACE environment variables, or run `bl login`.";
|
|
31
31
|
}
|
|
32
32
|
// Build info - these placeholders are replaced at build time by build:replace-imports
|
|
33
|
-
const BUILD_VERSION = "0.3.26-preview.
|
|
34
|
-
const BUILD_COMMIT = "
|
|
33
|
+
const BUILD_VERSION = "0.3.26-preview.312";
|
|
34
|
+
const BUILD_COMMIT = "45891cd9862d690bb6532b5758e75084083d511f";
|
|
35
35
|
const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
|
|
36
36
|
const BLAXEL_API_VERSION = "2026-09-22";
|
|
37
37
|
// Bun < 1.3.11 never sends connection-level WINDOW_UPDATE: the pooled h2
|
|
@@ -294,7 +294,7 @@ const postFilesystemMultipartByUploadIdComplete = (options) => {
|
|
|
294
294
|
exports.postFilesystemMultipartByUploadIdComplete = postFilesystemMultipartByUploadIdComplete;
|
|
295
295
|
/**
|
|
296
296
|
* Upload part
|
|
297
|
-
* Upload a single part of a multipart upload
|
|
297
|
+
* Upload a single part of a multipart upload. Re-uploading a part number replaces that part. Wait for the previous request for that part to finish before retrying.
|
|
298
298
|
*/
|
|
299
299
|
const putFilesystemMultipartByUploadIdPart = (options) => {
|
|
300
300
|
return (options.client ?? client_gen_1.client).put({
|
|
@@ -354,7 +354,8 @@ const postFilesystemMultipartInitiateByPath = (options) => {
|
|
|
354
354
|
exports.postFilesystemMultipartInitiateByPath = postFilesystemMultipartInitiateByPath;
|
|
355
355
|
/**
|
|
356
356
|
* Fuzzy search for files and directories
|
|
357
|
-
*
|
|
357
|
+
* Ranks the files and directories under a path by how well their relative path fuzzy-matches `query` (fzf algorithm: the query's characters must appear in order, not necessarily next to each other), best match first.
|
|
358
|
+
* Fuzzy search is for "jump to file" lookups from a partial name. The `patterns` parameter is currently ignored by this endpoint; use find for exact glob filtering.
|
|
358
359
|
*/
|
|
359
360
|
const getFilesystemSearchByPath = (options) => {
|
|
360
361
|
return (options.client ?? client_gen_1.client).get({
|
|
@@ -405,7 +406,11 @@ const getFilesystemByPath = (options) => {
|
|
|
405
406
|
exports.getFilesystemByPath = getFilesystemByPath;
|
|
406
407
|
/**
|
|
407
408
|
* Create or update a file or directory
|
|
408
|
-
* Create or update a file or directory
|
|
409
|
+
* Create or update a file or directory.
|
|
410
|
+
*
|
|
411
|
+
* Idempotent: an existing file is overwritten (truncated, not appended to) and an existing directory is kept, so retrying the same request is safe.
|
|
412
|
+
*
|
|
413
|
+
* Send either a JSON body (FileRequest) or `multipart/form-data` for binary files. Multipart fields, in any order: `file` (required, the file content), `permissions` (optional octal mode such as `0755`, applied when the file is created, default `0644`; an existing file keeps its mode), `path` (optional, ignored: the target is always the URL path).
|
|
409
414
|
*/
|
|
410
415
|
const putFilesystemByPath = (options) => {
|
|
411
416
|
return (options.client ?? client_gen_1.client).put({
|
|
@@ -460,7 +465,7 @@ const getFilesystemTreeByPath = (options) => {
|
|
|
460
465
|
exports.getFilesystemTreeByPath = getFilesystemTreeByPath;
|
|
461
466
|
/**
|
|
462
467
|
* Create or update directory tree
|
|
463
|
-
* Create or update multiple files within a directory tree structure
|
|
468
|
+
* Create or update multiple files within a directory tree structure. Idempotent: existing files are overwritten, so retrying the same request is safe.
|
|
464
469
|
*/
|
|
465
470
|
const putFilesystemTreeByPath = (options) => {
|
|
466
471
|
return (options.client ?? client_gen_1.client).put({
|
|
@@ -609,7 +614,10 @@ const getProcess = (options) => {
|
|
|
609
614
|
exports.getProcess = getProcess;
|
|
610
615
|
/**
|
|
611
616
|
* Execute a command
|
|
612
|
-
* Execute a command and return process information.
|
|
617
|
+
* Execute a command and return process information.
|
|
618
|
+
*
|
|
619
|
+
* Streaming: with `Accept: application/x-ndjson` (or `Accept: text/event-stream`, kept for compatibility) the response is NDJSON (`Content-Type: application/x-ndjson`), not SSE: one JSON object per line, `{"type": "...", "data": "..."}`.
|
|
620
|
+
* `type` is `stdout` or `stderr` (`data` is a raw output chunk, sent as soon as the process writes it, newlines included; if the process finished before any chunk was streamed, its output is sent instead as one event per line, without the newline), `keepalive` (every 5 seconds, no data), `error` (`data` is the message, ends the stream) or `result` (last event, `data` is the ProcessResponse as a JSON string).
|
|
613
621
|
*/
|
|
614
622
|
const postProcess = (options) => {
|
|
615
623
|
return (options.client ?? client_gen_1.client).post({
|
|
@@ -630,7 +638,7 @@ const postProcess = (options) => {
|
|
|
630
638
|
exports.postProcess = postProcess;
|
|
631
639
|
/**
|
|
632
640
|
* Stop a process
|
|
633
|
-
*
|
|
641
|
+
* Request graceful termination. Poll GET /process/{identifier} until terminal status confirms the managed process has exited.
|
|
634
642
|
*/
|
|
635
643
|
const deleteProcessByIdentifier = (options) => {
|
|
636
644
|
return (options.client ?? client_gen_1.client).delete({
|
|
@@ -664,7 +672,7 @@ const getProcessByIdentifier = (options) => {
|
|
|
664
672
|
exports.getProcessByIdentifier = getProcessByIdentifier;
|
|
665
673
|
/**
|
|
666
674
|
* Kill a process
|
|
667
|
-
*
|
|
675
|
+
* Request forceful termination. Poll GET /process/{identifier} until terminal status confirms the managed process has exited.
|
|
668
676
|
*/
|
|
669
677
|
const deleteProcessByIdentifierKill = (options) => {
|
|
670
678
|
return (options.client ?? client_gen_1.client).delete({
|
|
@@ -698,7 +706,8 @@ const getProcessByIdentifierLogs = (options) => {
|
|
|
698
706
|
exports.getProcessByIdentifierLogs = getProcessByIdentifierLogs;
|
|
699
707
|
/**
|
|
700
708
|
* Stream process logs in real time
|
|
701
|
-
* Streams the stdout and stderr output of a process in real time
|
|
709
|
+
* Streams the stdout and stderr output of a process in real time: the output so far, then live output as the process writes it. Closes when the process exits or the client disconnects.
|
|
710
|
+
* Each output line starts with `stdout:` or `stderr:` and keeps its trailing newline. A partial line (e.g. a prompt) is sent as soon as it is written; when the process completes it, the rest follows without a new prefix. `[keepalive]` lines are sent every 30 seconds.
|
|
702
711
|
*/
|
|
703
712
|
const getProcessByIdentifierLogsStream = (options) => {
|
|
704
713
|
return (options.client ?? client_gen_1.client).get({
|
|
@@ -266,7 +266,7 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
|
266
266
|
}
|
|
267
267
|
async search(query, path = "/", options) {
|
|
268
268
|
const formattedPath = this.formatPath(path);
|
|
269
|
-
const queryParams = {};
|
|
269
|
+
const queryParams = { query };
|
|
270
270
|
if (options?.maxResults !== undefined) {
|
|
271
271
|
queryParams.maxResults = options.maxResults;
|
|
272
272
|
}
|
|
@@ -2,11 +2,48 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SandboxPreviews = exports.SandboxPreview = exports.SandboxPreviewTokens = exports.SandboxPreviewToken = void 0;
|
|
4
4
|
const index_js_1 = require("../client/index.js");
|
|
5
|
+
function isShorthand(preview) {
|
|
6
|
+
return !("metadata" in preview || "spec" in preview);
|
|
7
|
+
}
|
|
8
|
+
function normalizePreview(preview) {
|
|
9
|
+
if (!isShorthand(preview))
|
|
10
|
+
return preview;
|
|
11
|
+
if (!Number.isInteger(preview.port) || preview.port < 1 || preview.port > 65535) {
|
|
12
|
+
throw new RangeError("Preview port must be an integer between 1 and 65535");
|
|
13
|
+
}
|
|
14
|
+
if (preview.name !== undefined && (typeof preview.name !== "string" || preview.name.length === 0)) {
|
|
15
|
+
throw new RangeError("Preview name must be a nonempty string");
|
|
16
|
+
}
|
|
17
|
+
if (preview.public !== undefined && typeof preview.public !== "boolean") {
|
|
18
|
+
throw new RangeError("Preview public must be a boolean");
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
metadata: { name: preview.name ?? `preview-${preview.port}` },
|
|
22
|
+
spec: { port: preview.port, public: preview.public ?? false },
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
// Explicit HTTP status takes precedence over a legacy numeric service code.
|
|
26
|
+
function httpStatus(error) {
|
|
27
|
+
if (typeof error !== "object" || error === null)
|
|
28
|
+
return undefined;
|
|
29
|
+
const fields = error;
|
|
30
|
+
const response = fields.response;
|
|
31
|
+
const responseStatus = typeof response === "object" && response !== null && "status" in response
|
|
32
|
+
? response.status : undefined;
|
|
33
|
+
for (const status of [fields.status, fields.statusCode, responseStatus, fields.code]) {
|
|
34
|
+
if (typeof status === "number")
|
|
35
|
+
return status;
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
5
39
|
class SandboxPreviewToken {
|
|
6
40
|
previewToken;
|
|
7
41
|
constructor(previewToken) {
|
|
8
42
|
this.previewToken = previewToken;
|
|
9
43
|
}
|
|
44
|
+
get name() {
|
|
45
|
+
return this.previewToken.metadata?.name ?? "";
|
|
46
|
+
}
|
|
10
47
|
get value() {
|
|
11
48
|
return this.previewToken.spec.token ?? "";
|
|
12
49
|
}
|
|
@@ -47,6 +84,49 @@ class SandboxPreviewTokens {
|
|
|
47
84
|
});
|
|
48
85
|
return new SandboxPreviewToken(data);
|
|
49
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Reuse the latest token within the requested expiry ceiling, or mint one.
|
|
89
|
+
* minValidity is in milliseconds. Concurrent callers may create separate tokens.
|
|
90
|
+
*/
|
|
91
|
+
async createIfExpired(expiresAt, minValidity = 3_600_000) {
|
|
92
|
+
const now = Date.now();
|
|
93
|
+
if (!Number.isFinite(minValidity) || minValidity < 0) {
|
|
94
|
+
throw new RangeError("minValidity must be finite and non-negative");
|
|
95
|
+
}
|
|
96
|
+
const requestedExpiry = expiresAt ?? new Date(now + 86_400_000);
|
|
97
|
+
const ceiling = requestedExpiry instanceof Date ? requestedExpiry.getTime() : NaN;
|
|
98
|
+
if (!Number.isFinite(ceiling) || ceiling <= now || ceiling < now + minValidity) {
|
|
99
|
+
throw new RangeError("expiresAt must be a valid future date at least minValidity from now");
|
|
100
|
+
}
|
|
101
|
+
if (this.preview.spec?.public === true) {
|
|
102
|
+
throw new Error("Cannot create or reuse a token for a public preview");
|
|
103
|
+
}
|
|
104
|
+
const { data } = await (0, index_js_1.listSandboxPreviewTokens)({
|
|
105
|
+
path: {
|
|
106
|
+
sandboxName: this.resourceName,
|
|
107
|
+
previewName: this.previewName,
|
|
108
|
+
},
|
|
109
|
+
throwOnError: true,
|
|
110
|
+
});
|
|
111
|
+
if (!Array.isArray(data))
|
|
112
|
+
throw new Error("Failed to list preview tokens");
|
|
113
|
+
let selected;
|
|
114
|
+
let latestExpiry = -Infinity;
|
|
115
|
+
for (const token of data) {
|
|
116
|
+
const spec = token?.spec;
|
|
117
|
+
if (!spec || typeof spec.token !== "string" || spec.token.length === 0 || spec.expired === true ||
|
|
118
|
+
typeof spec.expiresAt !== "string")
|
|
119
|
+
continue;
|
|
120
|
+
const expiry = Date.parse(spec.expiresAt);
|
|
121
|
+
if (!Number.isFinite(expiry) || expiry <= now || expiry < now + minValidity || expiry > ceiling)
|
|
122
|
+
continue;
|
|
123
|
+
if (expiry > latestExpiry) {
|
|
124
|
+
selected = token;
|
|
125
|
+
latestExpiry = expiry;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return selected ? new SandboxPreviewToken(selected) : this.create(requestedExpiry);
|
|
129
|
+
}
|
|
50
130
|
async list() {
|
|
51
131
|
const { data } = await (0, index_js_1.listSandboxPreviewTokens)({
|
|
52
132
|
path: {
|
|
@@ -80,6 +160,9 @@ class SandboxPreview {
|
|
|
80
160
|
get name() {
|
|
81
161
|
return this.preview.metadata.name;
|
|
82
162
|
}
|
|
163
|
+
get url() {
|
|
164
|
+
return this.preview.spec?.url ?? "";
|
|
165
|
+
}
|
|
83
166
|
get metadata() {
|
|
84
167
|
return this.preview.metadata;
|
|
85
168
|
}
|
|
@@ -106,6 +189,7 @@ class SandboxPreviews {
|
|
|
106
189
|
return data.map((preview) => new SandboxPreview(preview));
|
|
107
190
|
}
|
|
108
191
|
async create(preview, force) {
|
|
192
|
+
const normalized = normalizePreview(preview);
|
|
109
193
|
const query = {};
|
|
110
194
|
if (force) {
|
|
111
195
|
query['force'] = 'true';
|
|
@@ -115,12 +199,31 @@ class SandboxPreviews {
|
|
|
115
199
|
sandboxName: this.sandboxName,
|
|
116
200
|
},
|
|
117
201
|
query,
|
|
118
|
-
body:
|
|
202
|
+
body: normalized,
|
|
119
203
|
throwOnError: true,
|
|
120
204
|
});
|
|
121
205
|
return new SandboxPreview(data);
|
|
122
206
|
}
|
|
207
|
+
/** Existing previews are returned as-is; shorthand's private default applies only on creation. */
|
|
123
208
|
async createIfNotExists(preview, force) {
|
|
209
|
+
if (isShorthand(preview)) {
|
|
210
|
+
const normalized = normalizePreview(preview);
|
|
211
|
+
try {
|
|
212
|
+
return await this.get(normalized.metadata.name);
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
if (httpStatus(error) !== 404)
|
|
216
|
+
throw error;
|
|
217
|
+
}
|
|
218
|
+
try {
|
|
219
|
+
return await this.create(normalized, force);
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
if (httpStatus(error) !== 409)
|
|
223
|
+
throw error;
|
|
224
|
+
return this.get(normalized.metadata.name);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
124
227
|
try {
|
|
125
228
|
const previewInstance = await this.get(preview.metadata.name);
|
|
126
229
|
return previewInstance;
|
|
@@ -119,7 +119,7 @@ export declare const deleteFilesystemMultipartByUploadIdAbort: <ThrowOnError ext
|
|
|
119
119
|
export declare const postFilesystemMultipartByUploadIdComplete: <ThrowOnError extends boolean = false>(options: Options<PostFilesystemMultipartByUploadIdCompleteData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").SuccessResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
120
120
|
/**
|
|
121
121
|
* Upload part
|
|
122
|
-
* Upload a single part of a multipart upload
|
|
122
|
+
* Upload a single part of a multipart upload. Re-uploading a part number replaces that part. Wait for the previous request for that part to finish before retrying.
|
|
123
123
|
*/
|
|
124
124
|
export declare const putFilesystemMultipartByUploadIdPart: <ThrowOnError extends boolean = false>(options: Options<PutFilesystemMultipartByUploadIdPartData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").MultipartUploadPartResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
125
125
|
/**
|
|
@@ -134,7 +134,8 @@ export declare const getFilesystemMultipartByUploadIdParts: <ThrowOnError extend
|
|
|
134
134
|
export declare const postFilesystemMultipartInitiateByPath: <ThrowOnError extends boolean = false>(options: Options<PostFilesystemMultipartInitiateByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").MultipartInitiateResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
135
135
|
/**
|
|
136
136
|
* Fuzzy search for files and directories
|
|
137
|
-
*
|
|
137
|
+
* Ranks the files and directories under a path by how well their relative path fuzzy-matches `query` (fzf algorithm: the query's characters must appear in order, not necessarily next to each other), best match first.
|
|
138
|
+
* Fuzzy search is for "jump to file" lookups from a partial name. The `patterns` parameter is currently ignored by this endpoint; use find for exact glob filtering.
|
|
138
139
|
*/
|
|
139
140
|
export declare const getFilesystemSearchByPath: <ThrowOnError extends boolean = false>(options: Options<GetFilesystemSearchByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").FuzzySearchResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
140
141
|
/**
|
|
@@ -149,7 +150,11 @@ export declare const deleteFilesystemByPath: <ThrowOnError extends boolean = fal
|
|
|
149
150
|
export declare const getFilesystemByPath: <ThrowOnError extends boolean = false>(options: Options<GetFilesystemByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").File | import("./types.gen").Directory | import("./types.gen").FileWithContent | Blob, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
150
151
|
/**
|
|
151
152
|
* Create or update a file or directory
|
|
152
|
-
* Create or update a file or directory
|
|
153
|
+
* Create or update a file or directory.
|
|
154
|
+
*
|
|
155
|
+
* Idempotent: an existing file is overwritten (truncated, not appended to) and an existing directory is kept, so retrying the same request is safe.
|
|
156
|
+
*
|
|
157
|
+
* Send either a JSON body (FileRequest) or `multipart/form-data` for binary files. Multipart fields, in any order: `file` (required, the file content), `permissions` (optional octal mode such as `0755`, applied when the file is created, default `0644`; an existing file keeps its mode), `path` (optional, ignored: the target is always the URL path).
|
|
153
158
|
*/
|
|
154
159
|
export declare const putFilesystemByPath: <ThrowOnError extends boolean = false>(options: Options<PutFilesystemByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").SuccessResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
155
160
|
/**
|
|
@@ -164,7 +169,7 @@ export declare const deleteFilesystemTreeByPath: <ThrowOnError extends boolean =
|
|
|
164
169
|
export declare const getFilesystemTreeByPath: <ThrowOnError extends boolean = false>(options: Options<GetFilesystemTreeByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").File | import("./types.gen").Directory | import("./types.gen").FileWithContent | Blob, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
165
170
|
/**
|
|
166
171
|
* Create or update directory tree
|
|
167
|
-
* Create or update multiple files within a directory tree structure
|
|
172
|
+
* Create or update multiple files within a directory tree structure. Idempotent: existing files are overwritten, so retrying the same request is safe.
|
|
168
173
|
*/
|
|
169
174
|
export declare const putFilesystemTreeByPath: <ThrowOnError extends boolean = false>(options: Options<PutFilesystemTreeByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").File | import("./types.gen").Directory | import("./types.gen").FileWithContent | Blob, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
170
175
|
/**
|
|
@@ -211,12 +216,15 @@ export declare const putNetworkTunnelConfig: <ThrowOnError extends boolean = fal
|
|
|
211
216
|
export declare const getProcess: <ThrowOnError extends boolean = false>(options?: Options<GetProcessData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").ProcessResponse[], unknown, ThrowOnError>;
|
|
212
217
|
/**
|
|
213
218
|
* Execute a command
|
|
214
|
-
* Execute a command and return process information.
|
|
219
|
+
* Execute a command and return process information.
|
|
220
|
+
*
|
|
221
|
+
* Streaming: with `Accept: application/x-ndjson` (or `Accept: text/event-stream`, kept for compatibility) the response is NDJSON (`Content-Type: application/x-ndjson`), not SSE: one JSON object per line, `{"type": "...", "data": "..."}`.
|
|
222
|
+
* `type` is `stdout` or `stderr` (`data` is a raw output chunk, sent as soon as the process writes it, newlines included; if the process finished before any chunk was streamed, its output is sent instead as one event per line, without the newline), `keepalive` (every 5 seconds, no data), `error` (`data` is the message, ends the stream) or `result` (last event, `data` is the ProcessResponse as a JSON string).
|
|
215
223
|
*/
|
|
216
224
|
export declare const postProcess: <ThrowOnError extends boolean = false>(options: Options<PostProcessData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").ProcessResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
217
225
|
/**
|
|
218
226
|
* Stop a process
|
|
219
|
-
*
|
|
227
|
+
* Request graceful termination. Poll GET /process/{identifier} until terminal status confirms the managed process has exited.
|
|
220
228
|
*/
|
|
221
229
|
export declare const deleteProcessByIdentifier: <ThrowOnError extends boolean = false>(options: Options<DeleteProcessByIdentifierData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").SuccessResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
222
230
|
/**
|
|
@@ -226,7 +234,7 @@ export declare const deleteProcessByIdentifier: <ThrowOnError extends boolean =
|
|
|
226
234
|
export declare const getProcessByIdentifier: <ThrowOnError extends boolean = false>(options: Options<GetProcessByIdentifierData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").ProcessResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
227
235
|
/**
|
|
228
236
|
* Kill a process
|
|
229
|
-
*
|
|
237
|
+
* Request forceful termination. Poll GET /process/{identifier} until terminal status confirms the managed process has exited.
|
|
230
238
|
*/
|
|
231
239
|
export declare const deleteProcessByIdentifierKill: <ThrowOnError extends boolean = false>(options: Options<DeleteProcessByIdentifierKillData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").SuccessResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
232
240
|
/**
|
|
@@ -236,7 +244,8 @@ export declare const deleteProcessByIdentifierKill: <ThrowOnError extends boolea
|
|
|
236
244
|
export declare const getProcessByIdentifierLogs: <ThrowOnError extends boolean = false>(options: Options<GetProcessByIdentifierLogsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").ProcessLogs, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
237
245
|
/**
|
|
238
246
|
* Stream process logs in real time
|
|
239
|
-
* Streams the stdout and stderr output of a process in real time
|
|
247
|
+
* Streams the stdout and stderr output of a process in real time: the output so far, then live output as the process writes it. Closes when the process exits or the client disconnects.
|
|
248
|
+
* Each output line starts with `stdout:` or `stderr:` and keeps its trailing newline. A partial line (e.g. a prompt) is sent as soon as it is written; when the process completes it, the rest follows without a new prefix. `[keepalive]` lines are sent every 30 seconds.
|
|
240
249
|
*/
|
|
241
250
|
export declare const getProcessByIdentifierLogsStream: <ThrowOnError extends boolean = false>(options: Options<GetProcessByIdentifierLogsStreamData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<string, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
242
251
|
/**
|
|
@@ -278,11 +278,17 @@ export type FuzzySearchResponse = {
|
|
|
278
278
|
};
|
|
279
279
|
export type HealthResponse = {
|
|
280
280
|
arch: string;
|
|
281
|
+
/**
|
|
282
|
+
* Build time in RFC 3339 (UTC), or "unknown" for builds without it
|
|
283
|
+
*/
|
|
281
284
|
buildTime: string;
|
|
282
285
|
gitCommit: string;
|
|
283
286
|
goVersion: string;
|
|
284
287
|
lastUpgrade: UpgradeStatus;
|
|
285
288
|
os: string;
|
|
289
|
+
/**
|
|
290
|
+
* API start time in RFC 3339
|
|
291
|
+
*/
|
|
286
292
|
startedAt: string;
|
|
287
293
|
status: string;
|
|
288
294
|
upgradeCount: number;
|
|
@@ -377,6 +383,9 @@ export type ProcessRequest = {
|
|
|
377
383
|
};
|
|
378
384
|
export type ProcessResponse = {
|
|
379
385
|
command: string;
|
|
386
|
+
/**
|
|
387
|
+
* Completion time, same format as startedAt. Empty string while the process runs
|
|
388
|
+
*/
|
|
380
389
|
completedAt: string;
|
|
381
390
|
exitCode: number;
|
|
382
391
|
/**
|
|
@@ -389,6 +398,9 @@ export type ProcessResponse = {
|
|
|
389
398
|
pid: string;
|
|
390
399
|
restartCount?: number;
|
|
391
400
|
restartOnFailure?: boolean;
|
|
401
|
+
/**
|
|
402
|
+
* Start time as an HTTP date (RFC 1123, e.g. Wed, 01 Jan 2023 12:00:00 GMT)
|
|
403
|
+
*/
|
|
392
404
|
startedAt: string;
|
|
393
405
|
status: 'failed' | 'killed' | 'stopped' | 'running' | 'completed';
|
|
394
406
|
stderr: string;
|
|
@@ -1143,12 +1155,16 @@ export type GetFilesystemSearchByPathData = {
|
|
|
1143
1155
|
path: string;
|
|
1144
1156
|
};
|
|
1145
1157
|
query?: {
|
|
1158
|
+
/**
|
|
1159
|
+
* Fuzzy pattern matched against each relative path (e.g., mngo for src/main.go). When omitted, the search path itself is used as the pattern.
|
|
1160
|
+
*/
|
|
1161
|
+
query?: string;
|
|
1146
1162
|
/**
|
|
1147
1163
|
* Maximum number of results to return (default: 20)
|
|
1148
1164
|
*/
|
|
1149
1165
|
maxResults?: number;
|
|
1150
1166
|
/**
|
|
1151
|
-
*
|
|
1167
|
+
* Accepted for compatibility but currently ignored; use filesystem-find for glob filtering
|
|
1152
1168
|
*/
|
|
1153
1169
|
patterns?: string;
|
|
1154
1170
|
/**
|
|
@@ -1226,7 +1242,7 @@ export type GetFilesystemByPathData = {
|
|
|
1226
1242
|
body?: never;
|
|
1227
1243
|
path: {
|
|
1228
1244
|
/**
|
|
1229
|
-
* File or directory path
|
|
1245
|
+
* File or directory path. Relative paths are resolved against the filesystem working directory. For example, with a working directory of /app, GET /filesystem/workspace resolves to /app/workspace. To access the absolute path /workspace over HTTP, encode its leading slash as %2F: GET /filesystem/%2Fworkspace. The double-slash form GET /filesystem//workspace also addresses /workspace.
|
|
1230
1246
|
*/
|
|
1231
1247
|
path: string;
|
|
1232
1248
|
};
|
|
@@ -1651,7 +1667,7 @@ export type DeleteProcessByIdentifierErrors = {
|
|
|
1651
1667
|
export type DeleteProcessByIdentifierError = DeleteProcessByIdentifierErrors[keyof DeleteProcessByIdentifierErrors];
|
|
1652
1668
|
export type DeleteProcessByIdentifierResponses = {
|
|
1653
1669
|
/**
|
|
1654
|
-
* Process
|
|
1670
|
+
* Process stop requested
|
|
1655
1671
|
*/
|
|
1656
1672
|
200: SuccessResponse;
|
|
1657
1673
|
};
|
|
@@ -1709,7 +1725,7 @@ export type DeleteProcessByIdentifierKillErrors = {
|
|
|
1709
1725
|
export type DeleteProcessByIdentifierKillError = DeleteProcessByIdentifierKillErrors[keyof DeleteProcessByIdentifierKillErrors];
|
|
1710
1726
|
export type DeleteProcessByIdentifierKillResponses = {
|
|
1711
1727
|
/**
|
|
1712
|
-
* Process
|
|
1728
|
+
* Process kill requested
|
|
1713
1729
|
*/
|
|
1714
1730
|
200: SuccessResponse;
|
|
1715
1731
|
};
|
|
@@ -1775,7 +1791,7 @@ export type GetProcessByIdentifierLogsStreamErrors = {
|
|
|
1775
1791
|
export type GetProcessByIdentifierLogsStreamError = GetProcessByIdentifierLogsStreamErrors[keyof GetProcessByIdentifierLogsStreamErrors];
|
|
1776
1792
|
export type GetProcessByIdentifierLogsStreamResponses = {
|
|
1777
1793
|
/**
|
|
1778
|
-
*
|
|
1794
|
+
* Process output, each line prefixed with stdout: or stderr:
|
|
1779
1795
|
*/
|
|
1780
1796
|
200: string;
|
|
1781
1797
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { Preview, PreviewToken, Sandbox } from "../client/index.js";
|
|
1
|
+
import type { Preview, PreviewToken, Sandbox } from "../client/index.js";
|
|
2
|
+
import type { SandboxPreviewCreateConfiguration } from "./types.js";
|
|
2
3
|
export declare class SandboxPreviewToken {
|
|
3
4
|
private previewToken;
|
|
4
5
|
constructor(previewToken: PreviewToken);
|
|
6
|
+
get name(): string;
|
|
5
7
|
get value(): string;
|
|
6
8
|
get expiresAt(): string | Date;
|
|
7
9
|
get expired(): boolean;
|
|
@@ -12,6 +14,11 @@ export declare class SandboxPreviewTokens {
|
|
|
12
14
|
get previewName(): string;
|
|
13
15
|
get resourceName(): string;
|
|
14
16
|
create(expiresAt: Date): Promise<SandboxPreviewToken>;
|
|
17
|
+
/**
|
|
18
|
+
* Reuse the latest token within the requested expiry ceiling, or mint one.
|
|
19
|
+
* minValidity is in milliseconds. Concurrent callers may create separate tokens.
|
|
20
|
+
*/
|
|
21
|
+
createIfExpired(expiresAt?: Date, minValidity?: number): Promise<SandboxPreviewToken>;
|
|
15
22
|
list(): Promise<SandboxPreviewToken[]>;
|
|
16
23
|
delete(tokenName: string): Promise<{
|
|
17
24
|
message?: string;
|
|
@@ -22,6 +29,7 @@ export declare class SandboxPreview {
|
|
|
22
29
|
tokens: SandboxPreviewTokens;
|
|
23
30
|
constructor(preview: Preview);
|
|
24
31
|
get name(): string;
|
|
32
|
+
get url(): string;
|
|
25
33
|
get metadata(): import("../client/types.gen.js").PreviewMetadata;
|
|
26
34
|
get spec(): import("../client/types.gen.js").PreviewSpec;
|
|
27
35
|
}
|
|
@@ -30,8 +38,9 @@ export declare class SandboxPreviews {
|
|
|
30
38
|
constructor(sandbox: Sandbox);
|
|
31
39
|
get sandboxName(): string;
|
|
32
40
|
list(): Promise<SandboxPreview[]>;
|
|
33
|
-
create(preview: Preview, force?: boolean): Promise<SandboxPreview>;
|
|
34
|
-
|
|
41
|
+
create(preview: Preview | SandboxPreviewCreateConfiguration, force?: boolean): Promise<SandboxPreview>;
|
|
42
|
+
/** Existing previews are returned as-is; shorthand's private default applies only on creation. */
|
|
43
|
+
createIfNotExists(preview: Preview | SandboxPreviewCreateConfiguration, force?: boolean): Promise<SandboxPreview>;
|
|
35
44
|
get(previewName: string): Promise<SandboxPreview>;
|
|
36
45
|
delete(previewName: string): Promise<Preview>;
|
|
37
46
|
private waitForDeletion;
|
|
@@ -38,6 +38,13 @@ export type SandboxUpdateMetadata = {
|
|
|
38
38
|
export type SandboxUpdateNetwork = {
|
|
39
39
|
network?: SandboxNetwork;
|
|
40
40
|
};
|
|
41
|
+
export type SandboxPreviewCreateConfiguration = {
|
|
42
|
+
port: number;
|
|
43
|
+
/** Defaults to preview-<port> within this sandbox. */
|
|
44
|
+
name?: string;
|
|
45
|
+
/** Defaults to false on creation; existing previews are not changed. */
|
|
46
|
+
public?: boolean;
|
|
47
|
+
};
|
|
41
48
|
export type SandboxCreateConfiguration = {
|
|
42
49
|
name?: string;
|
|
43
50
|
image?: string;
|