import { SandboxFilesystem } from '@mastra/code-sdk/agents/sandbox-filesystem'; import type { getDynamicWorkspace } from '@mastra/code-sdk/agents/workspace'; import { Workspace } from '@mastra/core/workspace'; import type { SkillSource, SkillSourceEntry, SkillSourceStat, WorkspaceSandbox } from '@mastra/core/workspace'; import type { MastraFactorySandboxConfig } from './factory.js'; import type { GithubIntegration } from './integrations/github/integration.js'; import type { FactoryProjectsStorage } from './storage/domains/projects/base.js'; import type { WorkItemsStorage } from './storage/domains/work-items/base.js'; export declare const BUNDLED_FACTORY_SKILLS_PATH: string; /** * Resolve the consumer repo's local Factory skills root, if any. Checked in * addition to the bundled skills so projects can add (or override) Factory * skills without patching the installed package. Candidates cover the cwd * variants the dev server runs with (`repo root`, `--dir src/mastra` which * runs with cwd `src/mastra/public`). */ export declare function resolveLocalFactorySkillsPath(cwd?: string): string | undefined; export declare const FACTORY_SKILL_NAMES: Set; export declare class FactorySkillSource implements SkillSource { #private; readonly fallback: SkillSource; constructor(fallback: SkillSource, fallbackSkillRoots: string[], localSkillsPath?: string | undefined); exists(skillPath: string): Promise; stat(skillPath: string): Promise; readFile(skillPath: string): Promise; readdir(skillPath: string): Promise; realpath(skillPath: string): Promise; } type DynamicWorkspaceContext = Parameters[0]; /** * When a session's sandbox boots: on the agent's first command (`'lazy'`, the * default) or as soon as the session's workspace is first resolved (`'eager'`). * An eager start is fire-and-forget; if it fails, the lazy path still runs. */ export type FactorySandboxStart = 'lazy' | 'eager'; export interface CreateWorkspaceFactoryOptions { /** Factory sandbox runtime config (session sandbox callback). */ sandbox?: MastraFactorySandboxConfig; /** Defaults to `'lazy'`. */ sandboxStart?: FactorySandboxStart; /** GitHub integration used to resolve Factory sessions and mint repo tokens. */ github?: GithubIntegration; /** Work-items storage used to resolve the session's run-binding role, so * review-board sessions get the reviewer PAT as `GH_TOKEN`. Optional — * without it every session uses the default (worker) PAT. */ workItems?: Pick; /** Projects storage used to authorize workspace-free supervisor sessions. */ projects?: Pick; /** Runtime workspace/token registrations invalidated when a session retires. */ workspaceRegistry?: FactoryWorkspaceRegistry; } type WorkspaceUnregister = () => Promise | void; /** Tracks dynamic Factory workspaces by persisted session id for retirement. */ export declare class FactoryWorkspaceRegistry { #private; generation(sessionId: string): number; register(sessionId: string, workspaceId: string, generation: number, unregister: WorkspaceUnregister): Promise; invalidateSession(sessionId: string): Promise; } export declare function createWorkspaceFactory(options?: CreateWorkspaceFactoryOptions): ({ requestContext, mastra, skillExtension }: DynamicWorkspaceContext) => Promise | Workspace | undefined>; export {}; //# sourceMappingURL=workspace.d.ts.map