@mastra/docker 0.9.4-alpha.0 → 0.10.0-alpha.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.
- package/dist/index.cjs +171 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +171 -34
- package/dist/index.js.map +1 -1
- package/dist/template/index.d.ts +1 -1
- package/dist/template/index.d.ts.map +1 -1
- package/dist/template/repo-template.d.ts +78 -4
- package/dist/template/repo-template.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/template/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { DockerTemplate, type DockerTemplateOptions, type DockerTemplateBuildOptions, type DockerTemplateBuildResult, type DockerTemplateSecrets, } from './template.js';
|
|
2
|
-
export { createDockerRepoTemplate, type DockerRepoTemplateOptions, type DockerRepoTemplateResolveOptions, type DockerRepoTemplateResolver, type RepositoryAccess, } from './repo-template.js';
|
|
2
|
+
export { createDockerRepoTemplate, type DockerRepoTemplateOptions, type DockerRepoTemplateRepository, type DockerRepoTemplateResolveOptions, type DockerRepoTemplateResolver, type RepositoryAccess, } from './repo-template.js';
|
|
3
3
|
export { type AptInstallOptions, type DockerTemplateDefinition, type DockerTemplateOperation, type NpmInstallOptions, type PipInstallOptions, type RunWithSecretsOptions, secretNames, synthesizeDockerfile, templateIdentity, templateImageTag, TEMPLATE_IMAGE_REPO, } from './dockerfile.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/template/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,GAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,wBAAwB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,gCAAgC,EACrC,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/template/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,GAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,wBAAwB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,gCAAgC,EACrC,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,cAAc,CAAC"}
|
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
* the template identity. A moved branch therefore yields a fresh image on the
|
|
11
11
|
* next new sandbox, and an unmoved one reuses the cached image. When the head
|
|
12
12
|
* cannot be resolved the resolver rejects: an unpinned clone cached under a
|
|
13
|
-
* stable tag would otherwise serve stale repository state forever.
|
|
13
|
+
* stable tag would otherwise serve stale repository state forever. This holds
|
|
14
|
+
* for every entry of the `repos` form too, where the platform and E2B
|
|
15
|
+
* templates clone such a repository unpinned instead: those use a shallow
|
|
16
|
+
* clone whose tip the session fetches past, while this template clones full
|
|
17
|
+
* history and pins by `checkout`, so there is no cheap unpinned mode here.
|
|
14
18
|
*
|
|
15
19
|
* The clone runs in a throwaway build stage; the credential is passed by value
|
|
16
20
|
* to that stage only and never enters the template identity or the image.
|
|
@@ -41,6 +45,15 @@ export interface RepositoryAccess {
|
|
|
41
45
|
token: string;
|
|
42
46
|
};
|
|
43
47
|
}
|
|
48
|
+
/** One repository of a multi-repository template. */
|
|
49
|
+
export interface DockerRepoTemplateRepository {
|
|
50
|
+
/** Resolves this repository's clone URL and credential, as {@link DockerRepoTemplateOptions.getRepositoryAccess} does for one. */
|
|
51
|
+
getRepositoryAccess: (options?: DockerRepoTemplateResolveOptions) => Promise<RepositoryAccess | undefined>;
|
|
52
|
+
/** Branch, tag, or commit to prepare for this repository; see {@link DockerRepoTemplateOptions.ref}. */
|
|
53
|
+
ref?: string;
|
|
54
|
+
/** Setup command(s) run inside this repository's checkout. */
|
|
55
|
+
setupCommand?: string | string[];
|
|
56
|
+
}
|
|
44
57
|
export interface DockerRepoTemplateOptions {
|
|
45
58
|
/**
|
|
46
59
|
* Resolves the clone URL and, for private repositories, a short-lived
|
|
@@ -51,10 +64,11 @@ export interface DockerRepoTemplateOptions {
|
|
|
51
64
|
*
|
|
52
65
|
* Pass `undefined` for the function itself to mean "no repository":
|
|
53
66
|
* {@link createDockerRepoTemplate} then returns undefined so
|
|
54
|
-
* `template: createDockerRepoTemplate(ctx)` needs no conditional
|
|
55
|
-
* function resolves to `undefined` at start time,
|
|
67
|
+
* `template: createDockerRepoTemplate(ctx)` needs no conditional (unless
|
|
68
|
+
* `repos` is set). If the function resolves to `undefined` at start time,
|
|
69
|
+
* the resolver rejects.
|
|
56
70
|
*/
|
|
57
|
-
getRepositoryAccess
|
|
71
|
+
getRepositoryAccess?: ((options?: DockerRepoTemplateResolveOptions) => Promise<RepositoryAccess | undefined>) | undefined;
|
|
58
72
|
/**
|
|
59
73
|
* Branch, tag, or commit to prepare. The current head of a branch/tag is
|
|
60
74
|
* resolved at each template resolution and pinned into the identity.
|
|
@@ -63,6 +77,40 @@ export interface DockerRepoTemplateOptions {
|
|
|
63
77
|
ref?: string;
|
|
64
78
|
/** Setup command(s) run inside the checkout as separate cached build steps. */
|
|
65
79
|
setupCommand?: string | string[];
|
|
80
|
+
/**
|
|
81
|
+
* Several repositories in one image, each with its own access resolver,
|
|
82
|
+
* `ref` and setup command, cloned to `<workingDirectory>/<repo>` in this
|
|
83
|
+
* order; the working directory itself becomes the build and runtime cwd.
|
|
84
|
+
* Public repositories (no `authorization`) are built before private ones in
|
|
85
|
+
* caller order within each group. Each repository writes
|
|
86
|
+
* `.mastra-sandbox/repos/<repo>` (`setupMarkerContent` of its commands)
|
|
87
|
+
* once every step for it ran.
|
|
88
|
+
*
|
|
89
|
+
* Each credential is passed to that repository's clone and pin steps only,
|
|
90
|
+
* as the secret `GH_TOKEN_<n>` (`n` = position in this list); setup
|
|
91
|
+
* commands never see it.
|
|
92
|
+
*
|
|
93
|
+
* Mutually exclusive with `getRepositoryAccess`. Any entry whose access or
|
|
94
|
+
* head cannot be resolved rejects the whole resolution, as the single form
|
|
95
|
+
* does. Two entries that would clone into the same directory reject the
|
|
96
|
+
* same way. An empty array behaves like no repository.
|
|
97
|
+
*/
|
|
98
|
+
repos?: DockerRepoTemplateRepository[];
|
|
99
|
+
/**
|
|
100
|
+
* `repos` only. Command(s) run at the working directory after every
|
|
101
|
+
* repository is set up (install a shared toolchain, link packages). A
|
|
102
|
+
* failure fails the build. `.mastra-sandbox/workspace-setup` records the
|
|
103
|
+
* digest of the commands that ran, even when there were none.
|
|
104
|
+
*/
|
|
105
|
+
workspaceSetupCommand?: string | string[];
|
|
106
|
+
/**
|
|
107
|
+
* `repos` only. When true a failing per-repository setup command records
|
|
108
|
+
* that repository's directory name in `.mastra-sandbox/setup-failed` (one
|
|
109
|
+
* line per repository) and the build continues; clone, pin, workspace and
|
|
110
|
+
* marker steps still fail the build. Default false: any failure fails the
|
|
111
|
+
* build.
|
|
112
|
+
*/
|
|
113
|
+
continueOnSetupFailure?: boolean;
|
|
66
114
|
/**
|
|
67
115
|
* Extra environment for every build step, including `setupCommand`. Baked
|
|
68
116
|
* into the image via `ENV` and hashed into the identity (keys and values),
|
|
@@ -73,6 +121,7 @@ export interface DockerRepoTemplateOptions {
|
|
|
73
121
|
/**
|
|
74
122
|
* Absolute parent for the checkout; the repo lands at
|
|
75
123
|
* `<workingDirectory>/<repo>`, which becomes the build and runtime cwd.
|
|
124
|
+
* With `repos` the working directory itself is the cwd.
|
|
76
125
|
* @default '/workspace'
|
|
77
126
|
*/
|
|
78
127
|
workingDirectory?: string;
|
|
@@ -98,6 +147,14 @@ export interface DockerRepoTemplateResolveOptions {
|
|
|
98
147
|
/** A resolver producing a fresh, head-pinned template on each call. */
|
|
99
148
|
export type DockerRepoTemplateResolver = (options?: DockerRepoTemplateResolveOptions) => Promise<DockerTemplate>;
|
|
100
149
|
export declare function createDockerRepoTemplate(options: DockerRepoTemplateOptions): DockerRepoTemplateResolver | undefined;
|
|
150
|
+
/** One repository with its access and head resolved. */
|
|
151
|
+
interface ResolvedRepository {
|
|
152
|
+
cloneUrl: string;
|
|
153
|
+
sha: string;
|
|
154
|
+
token?: string;
|
|
155
|
+
tokenEnv?: string;
|
|
156
|
+
setupCommand?: string | string[];
|
|
157
|
+
}
|
|
101
158
|
interface RepoTemplateInputs {
|
|
102
159
|
cloneUrl: string;
|
|
103
160
|
sha: string;
|
|
@@ -115,6 +172,23 @@ interface RepoTemplateInputs {
|
|
|
115
172
|
* @internal
|
|
116
173
|
*/
|
|
117
174
|
export declare function buildRepoTemplate(inputs: RepoTemplateInputs): DockerTemplate;
|
|
175
|
+
interface MultiRepoTemplateInputs {
|
|
176
|
+
repos: ResolvedRepository[];
|
|
177
|
+
workspaceSetupCommand?: string | string[];
|
|
178
|
+
continueOnSetupFailure: boolean;
|
|
179
|
+
buildEnv?: Record<string, string>;
|
|
180
|
+
workingDirectory: string;
|
|
181
|
+
baseImage?: string;
|
|
182
|
+
owner?: string;
|
|
183
|
+
dockerOptions?: DockerOptions;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* List-form assembly: the working directory is the cwd, every repository is
|
|
187
|
+
* laid out under it (public first) around its own pin, then the workspace
|
|
188
|
+
* steps and marker. Exported for tests.
|
|
189
|
+
* @internal
|
|
190
|
+
*/
|
|
191
|
+
export declare function buildMultiRepoTemplate(inputs: MultiRepoTemplateInputs): DockerTemplate;
|
|
118
192
|
/**
|
|
119
193
|
* Resolve `ref` (or the default branch) to a commit sha with `git ls-remote`
|
|
120
194
|
* on the host, without cloning. A full sha is returned as is. Any failure
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo-template.d.ts","sourceRoot":"","sources":["../../src/template/repo-template.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"repo-template.d.ts","sourceRoot":"","sources":["../../src/template/repo-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAYH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAiB5C;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC;IACjB,oGAAoG;IACpG,aAAa,CAAC,EAAE;QAAE,MAAM,EAAE,QAAQ,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACrD;AAED,qDAAqD;AACrD,MAAM,WAAW,4BAA4B;IAC3C,kIAAkI;IAClI,mBAAmB,EAAE,CAAC,OAAO,CAAC,EAAE,gCAAgC,KAAK,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC;IAC3G,wGAAwG;IACxG,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACl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,MAAM,GAAG,SAAS,EACzB,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA+B7B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/docker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0-alpha.1",
|
|
4
4
|
"description": "Docker container sandbox provider for Mastra workspaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"tsdown": "0.22.9",
|
|
35
35
|
"typescript": "^7.0.2",
|
|
36
36
|
"vitest": "4.1.11",
|
|
37
|
+
"@internal/lint": "0.0.141",
|
|
37
38
|
"@internal/types-builder": "0.0.116",
|
|
38
|
-
"@mastra/core": "1.76.0-alpha.1",
|
|
39
39
|
"@internal/workspace-test-utils": "0.0.85",
|
|
40
|
-
"@
|
|
40
|
+
"@mastra/core": "1.76.0-alpha.3",
|
|
41
41
|
"@internal/workspace": "0.0.13"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|