@mastra/docker 0.12.1 → 0.13.0-alpha.0

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.
@@ -11,7 +11,13 @@ export interface DockerFactorySandboxSettings extends Record<string, unknown> {
11
11
  /** `user[:group]` or `uid[:gid]` that owns the checkout. Part of the template identity. */
12
12
  owner?: string;
13
13
  }
14
- export interface DockerFactorySandboxOptions extends Omit<DockerSandboxOptions, 'id' | 'template'> {
14
+ export interface DockerFactorySandboxOptions extends Omit<DockerSandboxOptions, 'id' | 'template' | 'env'> {
15
+ /**
16
+ * Environment variables of every session sandbox. A function receives each
17
+ * session's context, so a credential can go to one factory's sessions only:
18
+ * `ctx => (ctx.factoryId === id ? { TOKEN } : {})`.
19
+ */
20
+ env?: Record<string, string> | ((ctx: FactorySandboxContext) => Record<string, string>);
15
21
  /** Options for the environment's repo template. */
16
22
  template?: Pick<DockerRepoTemplateOptions, 'buildEnv' | 'dockerOptions'>;
17
23
  /** Provider-side defaults used when a setting is unset. Never stored by factory. */
@@ -1 +1 @@
1
- {"version":3,"file":"factory-sandbox.d.ts","sourceRoot":"","sources":["../src/factory-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAGV,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEtD,OAAO,KAAK,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAStG,qHAAqH;AACrH,MAAM,WAAW,4BAA6B,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC3E,6EAA6E;IAC7E,SAAS,CAAC,E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937
2937
  create(ctx, settings) {
2938
- const { defaults: _defaults, template: _template, image, ...options } = this.#options;
2938
+ const { defaults: _defaults, template: _template, image, env, ...options } = this.#options;
2939
2939
  const template = this.template(ctx, settings);
2940
2940
  return new DockerSandbox({
2941
2941
  ...options,
2942
+ ...env ? { env: typeof env === "function" ? env(ctx) : env } : {},
2942
2943
  ...template === void 0 && image !== void 0 ? { image } : {},
2943
2944
  id: ctx.sessionId,
2944
2945
  template,