@mastra/platform-workspace 0.0.0-client-tool-results-20260912062135

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/LICENSE.md ADDED
@@ -0,0 +1,32 @@
1
+ Portions of this software are licensed as follows:
2
+
3
+ - All content that resides under any directory named `ee/` within this
4
+ repository, including but not limited to:
5
+ - `@mastra/core/auth/ee`
6
+ - `@mastra/core/agent-builder/ee`
7
+ - `@mastra/editor/ee`
8
+
9
+ is licensed under the license defined in [`ee/LICENSE`](https://github.com/mastra-ai/mastra/blob/main/ee/LICENSE).
10
+
11
+ - All third-party components incorporated into the Mastra Software are
12
+ licensed under the original license provided by the owner of the
13
+ applicable component.
14
+
15
+ - Content outside of the above-mentioned directories or restrictions is
16
+ available under the "Apache License 2.0" as defined below.
17
+
18
+ # Apache License 2.0
19
+
20
+ Copyright (c) 2025 Kepler Software, Inc.
21
+
22
+ Licensed under the Apache License, Version 2.0 (the "License");
23
+ you may not use this file except in compliance with the License.
24
+ You may obtain a copy of the License at
25
+
26
+ http://www.apache.org/licenses/LICENSE-2.0
27
+
28
+ Unless required by applicable law or agreed to in writing, software
29
+ distributed under the License is distributed on an "AS IS" BASIS,
30
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31
+ See the License for the specific language governing permissions and
32
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # @mastra/platform-workspace
2
+
3
+ Mastra Platform workspace provider. It gives agents environment-scoped sandbox execution and bucket-backed filesystem access through the Mastra Platform workspace proxy.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @mastra/platform-workspace
9
+ ```
10
+
11
+ ## Configuration
12
+
13
+ All options can be passed to the constructor or read from environment variables:
14
+
15
+ | Option | Env var | Required |
16
+ | ----------------- | -------------------------------------------------------------- | ------------------------------- |
17
+ | `accessToken` | `MASTRA_PLATFORM_ACCESS_TOKEN` or `MASTRA_PLATFORM_SECRET_KEY` | Yes |
18
+ | `projectId` | `MASTRA_PROJECT_ID` | Yes |
19
+ | `environmentId` | `MASTRA_ENVIRONMENT_ID` | Yes (sandbox) |
20
+ | `actingUserId` | — | No (sandbox) |
21
+ | `sandboxProvider` | `SANDBOX_PROVIDER` | No (sandbox, defaults to `e2b`) |
22
+ | `bucketName` | `MASTRA_PLATFORM_BUCKET_NAME` | Yes (filesystem) |
23
+
24
+ The proxy URL defaults to `https://workspaces.mastra.ai`. Set `MASTRA_PLATFORM_REGION` to `us` or `eu` (case-insensitive) to route to the regional replica at `https://workspaces.us.mastra.ai` or `https://workspaces.eu.mastra.ai`. An explicit `MASTRA_WORKSPACE_PROXY_URL` (useful for staging) overrides both.
25
+
26
+ Requests to the proxy are authenticated with `Authorization: Bearer <accessToken>`. For sandbox requests authenticated with a project access token, set `actingUserId` to the stable opaque user subject from your authentication system. It is sent as `x-acting-user-id` for token partitioning and attribution; it is not an authorization claim.
27
+
28
+ ## Usage
29
+
30
+ ```typescript
31
+ import { Agent } from '@mastra/core/agent';
32
+ import { Workspace } from '@mastra/core/workspace';
33
+ import { PlatformFilesystem, PlatformSandbox } from '@mastra/platform-workspace';
34
+
35
+ const workspace = new Workspace({
36
+ filesystem: new PlatformFilesystem({}),
37
+ sandbox: new PlatformSandbox({
38
+ idleTimeoutMinutes: 30,
39
+ networkIsolation: 'ISOLATED',
40
+ }),
41
+ });
42
+
43
+ const agent = new Agent({
44
+ name: 'code-analyzer',
45
+ model: 'anthropic/claude-sonnet-4-5',
46
+ workspace,
47
+ });
48
+ ```
49
+
50
+ ## Documentation
51
+
52
+ Both providers authenticate through the workspace proxy with `MASTRA_PROJECT_ID` and a credential. Set `MASTRA_PLATFORM_SECRET_KEY` to your organization API key for local development. The deployed `MASTRA_PLATFORM_ACCESS_TOKEN` takes precedence when present; an explicit `accessToken` constructor option takes precedence over both. Blank environment credentials are ignored. `PlatformSandbox` also requires `MASTRA_ENVIRONMENT_ID`; `PlatformFilesystem` requires `MASTRA_PLATFORM_BUCKET_NAME`. Constructor values override environment variables, and `MASTRA_WORKSPACE_PROXY_URL` can point requests at a non-production proxy.
53
+
54
+ `PlatformFilesystem` implements the Mastra filesystem interface against a Platform bucket. It supports reading, writing, listing, moving, and deleting files, preserves reserved characters in object names, and can be mounted with `readOnly: true` to reject mutations.
55
+
56
+ `PlatformSandbox` starts or reconnects to an environment-scoped provider sandbox and implements command execution, lifecycle, and networking operations. The provider defaults to E2B and can be changed to Railway through `sandboxProvider` or `SANDBOX_PROVIDER`. Pass an existing `sandboxId` to reattach to a live sandbox, and `actingUserId` to partition and attribute project-token requests to a stable application user.
57
+
58
+ The exported `Template()` builder creates reusable sandbox images from commands, packages, environment values, repository checkouts, CPU, memory, and working-directory settings. Platform derives a content identity from the serialized template so matching definitions can reuse previous builds. Ephemeral environment values are excluded from that identity and are not persisted into the runtime image.
59
+
60
+ Proxy failures throw `PlatformApiError`, which includes the HTTP status, parsed machine-readable error code, proxy message, and raw response body. Use these fields to distinguish missing resources, authentication failures, and provider errors.
61
+
62
+ - [Mastra Platform workspaces](https://mastra.ai/docs/mastra-platform/workspaces)
63
+
64
+ ## Changelog
65
+
66
+ See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/workspaces/platform-workspace/CHANGELOG.md) for version history and release notes.
67
+
68
+ ## Support
69
+
70
+ We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
@@ -0,0 +1,47 @@
1
+ /**
2
+ * In-process `sandboxId → instanceUrl` registry populated by
3
+ * {@link PlatformSandbox.start} from the `instanceUrl` field workspace-proxy
4
+ * includes on create + get responses, and consumed by
5
+ * {@link PlatformSandbox.executeCommand} on the private-network fast path.
6
+ *
7
+ * The registry lives in the same Node process as the `PlatformSandbox`
8
+ * consumer — for shipyard, that is the Mastra runtime deployed from
9
+ * `mastracode/web`. There is no receiver route and no cross-service dance;
10
+ * the address is just a field copied from a response the runtime already
11
+ * receives.
12
+ *
13
+ * State intentionally does not persist:
14
+ *
15
+ * - The IPv6 rotates on every sandbox recreate.
16
+ * - The URL has no meaning after the sandbox is destroyed.
17
+ * - The live sandbox binding, session context, and lease all die with the
18
+ * runtime process; the address dying with them is correct.
19
+ * - The proxy's `environment_sandboxes.instance_url` column is the durable
20
+ * source of truth — a runtime restart re-populates the registry on the
21
+ * next `start()` / reattach from the proxy's response.
22
+ */
23
+ import type { SandboxAddressRegistry } from './sandbox.js';
24
+ /**
25
+ * Concrete in-process {@link SandboxAddressRegistry}. Backed by a `Map`; no
26
+ * eviction policy, no TTL — entries live until an observed transport failure
27
+ * calls `delete`, until the sandbox is explicitly destroyed, or until the
28
+ * process exits.
29
+ */
30
+ export declare class InProcessSandboxAddressRegistry implements SandboxAddressRegistry {
31
+ #private;
32
+ get(sandboxId: string): string | undefined;
33
+ /**
34
+ * Populate or overwrite the address for a sandbox. Called by
35
+ * {@link PlatformSandbox.start} on every fresh provision and every reattach;
36
+ * overwriting is intentional so a re-provision with a fresh IPv6 heals the
37
+ * map without a branch.
38
+ */
39
+ set(sandboxId: string, instanceUrl: string): void;
40
+ delete(sandboxId: string): void;
41
+ /**
42
+ * Test-only introspection. Not part of {@link SandboxAddressRegistry} —
43
+ * production callers must not read the registry as a whole.
44
+ */
45
+ get size(): number;
46
+ }
47
+ //# sourceMappingURL=address-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address-registry.d.ts","sourceRoot":"","sources":["../src/address-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE3D;;;;;GAKG;AACH,qBAAa,+BAAgC,YAAW,sBAAsB;;IAG5E,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEzC;IAED;;;;;OAKG;IACH,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAEhD;IAED,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAE9B;IAED;;;OAGG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
@@ -0,0 +1,72 @@
1
+ export interface PlatformClientOptions {
2
+ accessToken?: string;
3
+ projectId?: string;
4
+ actingUserId?: string;
5
+ sandboxProvider?: SandboxProvider;
6
+ /**
7
+ * Advisory correlation id for the factory session driving this client.
8
+ * Sent as `x-mastra-session-id` on every proxy request so proxy-side logs
9
+ * can be joined back to the calling session without a multi-store hand-join
10
+ * (`threadId → sessionId → sandboxId → providerResourceId`). Never used for
11
+ * authorization — the Bearer token remains the only credential.
12
+ */
13
+ sessionId?: string;
14
+ /**
15
+ * Advisory correlation id for the factory thread, sent as
16
+ * `x-mastra-thread-id` when present. See {@link PlatformClientOptions.sessionId}.
17
+ */
18
+ threadId?: string;
19
+ fetch?: typeof fetch;
20
+ }
21
+ export interface PlatformRequestOptions extends RequestInit {
22
+ query?: Record<string, string | number | boolean | undefined>;
23
+ }
24
+ export type SandboxProvider = 'railway' | 'e2b';
25
+ export declare function requireOption(value: string | undefined, name: string): string;
26
+ export declare function resolvePlatformOptions(options: PlatformClientOptions): {
27
+ accessToken: string;
28
+ projectId: string;
29
+ actingUserId: string | undefined;
30
+ proxyUrl: string;
31
+ sandboxProvider: SandboxProvider;
32
+ sessionId: string | undefined;
33
+ threadId: string | undefined;
34
+ fetch: typeof fetch;
35
+ };
36
+ /**
37
+ * Structured error shape returned by the workspace proxy. All routes emit
38
+ * `{ error: { message, type } }` on failure — see servers/workspace-proxy in
39
+ * the Platform repo. Kept as a wire-level type so callers can switch on
40
+ * `error.code` without re-parsing `error.body`.
41
+ */
42
+ export interface PlatformProxyError {
43
+ message: string;
44
+ /** Machine-readable error kind, e.g. `not_found`, `invalid_request`, `authentication_error`. */
45
+ type: string;
46
+ }
47
+ export declare class PlatformApiError extends Error {
48
+ readonly status: number;
49
+ readonly body: string;
50
+ /** Machine-readable proxy error kind (e.g. `not_found`), when the response body matches `{ error: { message, type } }`. */
51
+ readonly code: string | undefined;
52
+ /** Human-readable proxy error message, when the response body matches `{ error: { message, type } }`. */
53
+ readonly proxyMessage: string | undefined;
54
+ constructor(status: number, body: string);
55
+ }
56
+ export declare class PlatformClient {
57
+ readonly accessToken: string;
58
+ readonly projectId: string;
59
+ readonly actingUserId: string | undefined;
60
+ readonly proxyUrl: string;
61
+ readonly sandboxProvider: SandboxProvider;
62
+ /** Advisory session correlation id — see {@link PlatformClientOptions.sessionId}. */
63
+ readonly sessionId: string | undefined;
64
+ /** Advisory thread correlation id — see {@link PlatformClientOptions.threadId}. */
65
+ readonly threadId: string | undefined;
66
+ readonly fetch: typeof fetch;
67
+ constructor(options: PlatformClientOptions);
68
+ request(path: string, options?: PlatformRequestOptions): Promise<Response>;
69
+ requestProvider(path: string, options?: PlatformRequestOptions): Promise<Response>;
70
+ private requestAtPath;
71
+ }
72
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED,MAAM,WAAW,sBAAuB,SAAQ,WAAW;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;CAC/D;AAED,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,KAAK,CAAC;AA6BhD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM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,CAEnF;IAEK,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,sBAA2B,GAAG,OAAO,CAAC,QAAQ,CAAC,CAE3F;YAEa,aAAa;CA2B5B"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Direct exec client — opens Railway's tcp-proxy exec WebSocket directly using
3
+ * a short-lived JWT minted by the workspace proxy's exec-lease endpoint. This
4
+ * removes the platform data plane from the exec stdout/stderr path entirely
5
+ * (see `docs/factory/direct-sandbox-connection.md` in the Platform repo),
6
+ * cutting payload-scaled Cloud Run egress and RTT for commands like
7
+ * `pnpm install` that stream tens of MB of output.
8
+ *
9
+ * The frame protocol below mirrors `connectExecWs()` in `railway@3.5.5`
10
+ * (`workspaces/railway/node_modules/railway/dist/index.js`). The `railway`
11
+ * SDK's version is pinned on both sides (platform + here); a version bump
12
+ * signals the protocol may have drifted and this module must be revisited.
13
+ */
14
+ /**
15
+ * Minimal WebSocket surface this module depends on. Matches both the browser
16
+ * `WebSocket` global and Node 22+'s built-in `WebSocket`. Extracted so tests
17
+ * can inject a fake without pulling in `ws` or jsdom.
18
+ */
19
+ export interface DirectExecWebSocket {
20
+ binaryType: 'blob' | 'arraybuffer';
21
+ onopen: ((event: unknown) => void) | null;
22
+ onmessage: ((event: {
23
+ data: unknown;
24
+ }) => void) | null;
25
+ onclose: ((event: {
26
+ code: number;
27
+ reason: string;
28
+ }) => void) | null;
29
+ onerror: ((event: unknown) => void) | null;
30
+ send(data: string): void;
31
+ close(code?: number, reason?: string): void;
32
+ }
33
+ /**
34
+ * Factory that opens a WebSocket to `endpoint` with the given subprotocols.
35
+ * Defaults to the global `WebSocket` when omitted, which works on Node 22+
36
+ * (the package's minimum) and in the browser. Tests inject a fake here.
37
+ */
38
+ export type DirectExecWebSocketFactory = (endpoint: string, subprotocols: string[]) => DirectExecWebSocket;
39
+ /** Lease payload returned by `POST /v1/:provider/projects/:projectId/sandbox/:sandboxId/exec-lease`. */
40
+ export interface ExecLease {
41
+ jwt: string;
42
+ wsEndpoint: string;
43
+ subprotocol: string;
44
+ /** ISO-8601 UTC. Null when the provider issues a JWT without an `exp` claim. */
45
+ expiresAt: string | null;
46
+ }
47
+ /** Inputs to a direct exec invocation. Mirrors the shape of the `/exec` route body. */
48
+ export interface DirectExecOptions {
49
+ command: string;
50
+ cwd?: string;
51
+ env?: Record<string, string>;
52
+ /**
53
+ * Wall-clock cap for the exec. When elapsed, we close the socket and
54
+ * return `{timedOut: true, exitCode: 124}` matching the semantics of the
55
+ * proxy's `/exec` route.
56
+ */
57
+ timeoutMs?: number;
58
+ onStdout?: (chunk: string) => void;
59
+ onStderr?: (chunk: string) => void;
60
+ /** Injected for tests. Defaults to `globalThis.WebSocket`. */
61
+ webSocketFactory?: DirectExecWebSocketFactory;
62
+ }
63
+ /**
64
+ * Result of a direct exec. Shape matches the workspace-proxy `/exec` response
65
+ * so the caller (`PlatformSandbox.executeCommand`) can hand it back with no
66
+ * translation.
67
+ *
68
+ * `exitCode` is `null` when the socket closed without an `exit` frame AND the
69
+ * exec did not time out (rare — usually a mid-stream network drop). Callers
70
+ * currently coerce `null` to `1` upstream; kept nullable here to preserve the
71
+ * distinction for future observability.
72
+ */
73
+ export interface DirectExecResult {
74
+ exitCode: number | null;
75
+ stdout: string;
76
+ stderr: string;
77
+ truncated: boolean;
78
+ timedOut: boolean;
79
+ /**
80
+ * WebSocket close metadata. Populated on any close (normal or transport
81
+ * failure). `opened` distinguishes handshake failures (never opened) from
82
+ * mid-stream drops. Callers use this for diagnostic logging; not part of
83
+ * the CommandResult contract.
84
+ */
85
+ closeCode?: number;
86
+ closeReason?: string;
87
+ opened?: boolean;
88
+ }
89
+ /**
90
+ * Open the provider exec WebSocket using `lease`, run `command`, and resolve
91
+ * with the accumulated stdout/stderr + exit code. See the module docstring
92
+ * for the wire protocol reference.
93
+ *
94
+ * The client sends `stdin_close` immediately after `init_exec`, matching the
95
+ * SDK's own one-shot exec behavior — we never stream stdin from the caller.
96
+ */
97
+ export declare function execViaLease(lease: ExecLease, options: DirectExecOptions): Promise<DirectExecResult>;
98
+ //# sourceMappingURL=direct-exec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"direct-exec.d.ts","sourceRoot":"","sources":["../src/direct-exec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAeH;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,GAAG,aAAa,CAAC;IACnC,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IAC1C,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IACvD,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IACpE,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IAC3C,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7C;AAED;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,mBAAmB,CAAC;AAE3G,wGAAwG;AACxG,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,uFAAuF;AACvF,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,8DAA8D;IAC9D,gBAAgB,CAAC,EAAE,0BAA0B,CAAC;CAC/C;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAcD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAyJpG"}
@@ -0,0 +1,7 @@
1
+ import type { DirectExecOptions, DirectExecResult, ExecLease } from './direct-exec.js';
2
+ export interface E2BExecLease extends ExecLease {
3
+ sandboxId: string;
4
+ }
5
+ export type E2BExecRunner = (lease: E2BExecLease, options: DirectExecOptions) => Promise<DirectExecResult>;
6
+ export declare const execViaE2BLease: E2BExecRunner;
7
+ //# sourceMappingURL=e2b-exec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"e2b-exec.d.ts","sourceRoot":"","sources":["../src/e2b-exec.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAIvF,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE3G,eAAO,MAAM,eAAe,EAAE,aAwD7B,CAAC"}
@@ -0,0 +1,62 @@
1
+ import { Buffer } from 'node:buffer';
2
+ import type { RequestContext } from '@mastra/core/request-context';
3
+ import type { CopyOptions, FileContent, FileEntry, FileStat, FilesystemIcon, FilesystemInfo, InstructionsOption, ListOptions, MastraFilesystemOptions, ProviderStatus, ReadOptions, RemoveOptions, WriteOptions } from '@mastra/core/workspace';
4
+ import { MastraFilesystem } from '@mastra/core/workspace';
5
+ import type { PlatformClientOptions } from './client.js';
6
+ export interface PlatformFilesystemOptions extends PlatformClientOptions, MastraFilesystemOptions {
7
+ id?: string;
8
+ bucketName?: string;
9
+ readOnly?: boolean;
10
+ displayName?: string;
11
+ icon?: FilesystemIcon;
12
+ description?: string;
13
+ instructions?: InstructionsOption;
14
+ }
15
+ export declare class PlatformFilesystem extends MastraFilesystem {
16
+ readonly id: string;
17
+ readonly name = "PlatformFilesystem";
18
+ readonly provider = "platform";
19
+ readonly readOnly?: boolean;
20
+ readonly displayName?: string;
21
+ readonly icon: FilesystemIcon;
22
+ readonly description?: string;
23
+ status: ProviderStatus;
24
+ private readonly _client;
25
+ private readonly _bucketName;
26
+ private readonly _instructionsOverride?;
27
+ constructor(options?: PlatformFilesystemOptions);
28
+ private generateId;
29
+ readFile(path: string, options?: ReadOptions): Promise<string | Buffer>;
30
+ writeFile(path: string, content: FileContent, options?: WriteOptions): Promise<void>;
31
+ /**
32
+ * Append bytes to a file.
33
+ *
34
+ * **Not atomic.** Object storage behind the workspace proxy has no native
35
+ * append or compare-and-swap primitive, so this implementation is a
36
+ * read-modify-write: it reads the current contents, concatenates the new
37
+ * bytes, and PUTs the whole object back. Concurrent `appendFile` calls to
38
+ * the same path can overwrite each other's writes ("last write wins").
39
+ * Use `writeFile` with distinct keys for concurrent writers.
40
+ */
41
+ appendFile(path: string, content: FileContent): Promise<void>;
42
+ deleteFile(path: string, options?: RemoveOptions): Promise<void>;
43
+ copyFile(src: string, dest: string, options?: CopyOptions): Promise<void>;
44
+ moveFile(src: string, dest: string, options?: CopyOptions): Promise<void>;
45
+ mkdir(path: string, _options?: {
46
+ recursive?: boolean;
47
+ }): Promise<void>;
48
+ rmdir(path: string, options?: RemoveOptions): Promise<void>;
49
+ readdir(path: string, options?: ListOptions): Promise<FileEntry[]>;
50
+ exists(path: string): Promise<boolean>;
51
+ stat(path: string): Promise<FileStat>;
52
+ realpath(path: string): Promise<string>;
53
+ getInstructions(opts?: {
54
+ requestContext?: RequestContext;
55
+ }): string;
56
+ getInfo(): FilesystemInfo<{
57
+ bucketName: string;
58
+ displayName?: string;
59
+ description?: string;
60
+ }>;
61
+ }
62
+ //# sourceMappingURL=filesystem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../src/filesystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,SAAS,EACT,QAAQ,EACR,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,uBAAuB,EACvB,cAAc,EACd,WAAW,EACX,aAAa,EACb,YAAY,EACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAsC,gBAAgB,EAA0B,MAAM,wBAAwB,CAAC;AACtH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAQzD,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB,EAAE,uBAAuB;IAC/F,EA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