@mastra/mesa 0.3.0 → 0.3.1

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.
@@ -0,0 +1,101 @@
1
+ import type { CopyOptions, FileContent, FileEntry, FilesystemInfo, FileStat, ListOptions, MastraFilesystemOptions, ProviderStatus, ReadOptions, RemoveOptions, WriteOptions } from '@mastra/core/workspace';
2
+ import { MastraFilesystem } from '@mastra/core/workspace';
3
+ import { Mesa } from '@mesadev/sdk';
4
+ import type { Author, Bash, FsMountRuntimeOptions, Layout, MesaBashOptions, MesaFileSystem, MesaOptions, TelemetryConfig } from '@mesadev/sdk';
5
+ export interface MesaFilesystemOptions extends MastraFilesystemOptions {
6
+ /** Mesa private key. Falls back to MESA_PRIVATE_KEY when omitted. */
7
+ privateKey?: string;
8
+ /** Commit authors attributed to writes made through this filesystem. */
9
+ authors: readonly [Author, ...Author[]];
10
+ /** Mesa mount layout mapping absolute paths to repos, built with `repo()`. */
11
+ layout: Layout;
12
+ /** Mount every layout repo read-only and block writes through the Mastra filesystem interface. */
13
+ readOnly?: boolean;
14
+ /** Mesa filesystem cache configuration. */
15
+ cache?: FsMountRuntimeOptions['cache'];
16
+ /** Mesa mount token lifetime in seconds. */
17
+ ttl?: number;
18
+ /** Mesa filesystem telemetry configuration. */
19
+ telemetry?: TelemetryConfig;
20
+ /** Custom fetch implementation for Mesa API calls. */
21
+ fetch?: MesaOptions['fetch'];
22
+ /** User agent for Mesa API calls. */
23
+ userAgent?: string;
24
+ }
25
+ /**
26
+ * Workspace filesystem adapter backed by Mesa.
27
+ *
28
+ * This provider runs in the Mastra process and implements the workspace file
29
+ * API against Mesa repos. It does not mount Mesa into a sandbox.
30
+ */
31
+ export declare class MesaFilesystem extends MastraFilesystem {
32
+ readonly id: string;
33
+ readonly name = "MesaFilesystem";
34
+ readonly provider = "mesa";
35
+ readonly readOnly?: boolean;
36
+ readonly icon = "mesa";
37
+ readonly displayName = "Mesa";
38
+ readonly description = "Versioned Mesa filesystem for workspace files";
39
+ status: ProviderStatus;
40
+ private readonly _privateKey?;
41
+ private readonly _authors;
42
+ private readonly _layout;
43
+ private readonly _cache?;
44
+ private readonly _ttl?;
45
+ private readonly _telemetry?;
46
+ private readonly _fetch?;
47
+ private readonly _userAgent?;
48
+ private _mesa?;
49
+ private _filesystem?;
50
+ constructor(options: MesaFilesystemOptions);
51
+ /**
52
+ * The active Mesa client, available after initialization when this instance
53
+ * created the client itself.
54
+ */
55
+ get client(): Mesa | undefined;
56
+ /**
57
+ * The active Mesa filesystem. Accessing this before initialization throws.
58
+ */
59
+ get filesystem(): MesaFileSystem;
60
+ init(): Promise<void>;
61
+ getInfo(): FilesystemInfo<{
62
+ paths: string[];
63
+ mode: 'mounted' | 'client';
64
+ }>;
65
+ getInstructions(): string;
66
+ readFile(inputPath: string, options?: ReadOptions): Promise<string | Buffer>;
67
+ writeFile(inputPath: string, content: FileContent, options?: WriteOptions): Promise<void>;
68
+ appendFile(inputPath: string, content: FileContent): Promise<void>;
69
+ deleteFile(inputPath: string, options?: RemoveOptions): Promise<void>;
70
+ copyFile(src: string, dest: string, options?: CopyOptions): Promise<void>;
71
+ moveFile(src: string, dest: string, options?: CopyOptions): Promise<void>;
72
+ mkdir(inputPath: string, options?: {
73
+ recursive?: boolean;
74
+ }): Promise<void>;
75
+ rmdir(inputPath: string, options?: RemoveOptions): Promise<void>;
76
+ readdir(inputPath: string, options?: ListOptions): Promise<FileEntry[]>;
77
+ exists(inputPath: string): Promise<boolean>;
78
+ stat(inputPath: string): Promise<FileStat>;
79
+ realpath(inputPath: string): Promise<string>;
80
+ /**
81
+ * Create a Mesa-backed Bash runtime for this filesystem.
82
+ */
83
+ bash(options?: MesaBashOptions): Promise<Bash>;
84
+ /**
85
+ * Mesa change management operations for the mounted filesystem.
86
+ */
87
+ get change(): MesaFileSystem['change'];
88
+ /**
89
+ * Mesa bookmark management operations for the mounted filesystem.
90
+ */
91
+ get bookmark(): MesaFileSystem['bookmark'];
92
+ private assertWritable;
93
+ private assertExpectedMtime;
94
+ private ensureParentDirectory;
95
+ private assertParentDirectoryExists;
96
+ private readDirectory;
97
+ private safeStat;
98
+ private toFileEntry;
99
+ private toFileStat;
100
+ }
101
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/filesystem/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,SAAS,EACT,cAAc,EACd,QAAQ,EACR,WAAW,EACX,uBAAuB,EACvB,cAAc,EACd,WAAW,EACX,aAAa,EACb,YAAY,EACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAML,gBAAgB,EAIjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,EACV,MAAM,EACN,IAAI,EACJ,qBAAqB,EACrB,MAAM,EACN,eAAe,EACf,cAAc,EACd,WAAW,EAEX,eAAe,EAChB,MAAM,cAAc,CAAC;AAKtB,MAAM,WAAW,qBAAsB,SAAQ,uBAAuB;IACpE,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,OAAO,EAAE,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IACxC,8EAA8E;IAC9E,MAAM,EAAE,MAAM,CAAC;IACf,kGAAkG;IAClG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,qBAAqB,CAAC,OAAO,CAAC,CAAC;IACvC,4CAA4C;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,sDAAsD;IACtD,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC7B,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,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;OAEG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAGnD;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,cAAc,CAAC,QAAQ,CAAC,CAErC;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,cAAc,CAAC,UAAU,CAAC,CAEzC;IAED,OAAO,CAAC,cAAc;YAMR,mBAAmB;YAanB,qBAAqB;YAqBrB,2BAA2B;YAe3B,aAAa;YAmCb,QAAQ;IAQtB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,UAAU;CAYnB"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @mastra/mesa - Mesa Filesystem Provider
3
+ *
4
+ * A filesystem implementation backed by Mesa repos.
5
+ */
6
+ export { MesaFilesystem, type MesaFilesystemOptions } from './filesystem/index.js';
7
+ export { mesaFilesystemProvider } from './provider.js';
8
+ export { repo, type Author, type Layout } from '@mesadev/sdk';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Mesa filesystem provider descriptor for MastraEditor.
3
+ */
4
+ import type { FilesystemProvider } from '@mastra/core/editor';
5
+ import type { MesaFilesystemOptions } from './filesystem/index.js';
6
+ export declare const mesaFilesystemProvider: FilesystemProvider<MesaFilesystemOptions>;
7
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,eAAO,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,qBAAqB,CA+C5E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mesa",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Mesa filesystem provider for Mastra workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -28,10 +28,10 @@
28
28
  "tsdown": "0.22.9",
29
29
  "typescript": "^7.0.2",
30
30
  "vitest": "4.1.11",
31
- "@internal/lint": "0.0.141",
32
- "@internal/workspace-test-utils": "0.0.85",
33
- "@internal/types-builder": "0.0.116",
34
- "@mastra/core": "1.75.0"
31
+ "@internal/lint": "0.0.142",
32
+ "@internal/workspace-test-utils": "0.0.86",
33
+ "@internal/types-builder": "0.0.117",
34
+ "@mastra/core": "1.76.0"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@mastra/core": ">=1.4.0-0 <2.0.0-0"