Skip to content
Français

createWorkspace

import { createWorkspace } from "@elie-laloum/outpost/workspaces";

Creates an owned Git, copied-directory, mounted-directory or ephemeral workspace. File modes allocate no Git repository and publish nothing on closure.

Complete example and detailed rules.

  • optionsRequired
    GitWorkspaceOptions
    Select the Git branch or file source, runtime location and ownership policy for the new workspace.
  • options.sourceRequired
    GitWorkspaceSource
    Declared source for an owned resource; mutually exclusive with borrowing an open workspace.
  • options.signalOptional
    AbortSignal | undefined
    Cancels opening: checked before allocation and passed to the storage reservation and workspaceReady commands. An open workspace ignores it.
  • options.hooksOptional
    LifecycleHooks | undefined
    Setup commands: workspaceReady once when the workspace opens, then hostReady and sandboxReady for each sandbox on it unless that sandbox passes its own hooks. Each command stops after 600000 (10 minutes) unless it sets deadlineMs; a nonzero exit fails with code process.
  • options.storageQuotaOptional
    Omit<StorageReservationOptions, "signal"> | undefined
    Storage admission checked before the workspace opens: reserves reserveBytes and fails with code configuration when usage under .outpost plus active reservations would exceed maxBytes. The reservation is released when the workspace closes.
  • options.observationOptional
    ObservationHub | undefined
    Hub that receives this workspace’s Git, copy, hook, integration and cleanup operations. The caller keeps ownership; the workspace never closes it.
  • options.limitsOptional
    StageLimits | undefined
    Deadlines in milliseconds for copying, Git preparation, commit collection and integration. Past a deadline the stage fails with code timeout, or conflict for integration. collectMs also bounds each Git command inspecting a diff guard; incomplete inspection fails with code guard.
  • options.labelOptional
    string | undefined
    Name used in the integrate branch (outpost/<label>-<id>), the worktree directory under .outpost/workspaces and the startup-failure journal; lowercased, other characters replaced by -, cut to 48.
  • optionsRequired
    FileWorkspaceOptions
    Select the Git branch or file source, runtime location and ownership policy for the new workspace.
  • options.hooksOptional
    LifecycleHooks | undefined
    Declared workspaceReady, hostReady and sandboxReady preparation commands.
  • options.storageQuotaOptional
    Omit<StorageReservationOptions, "signal"> | undefined
    Admission reservation through Transport; coordinates cooperating writers without enforcing a physical disk quota.
  • options.recoveryOptional
    FileWorkspaceRecoveryAuthorization | undefined
    Explicit stopped-process recovery authorization; interrupted replay remains a separate workflow decision.
  • options.inputsOptional
    readonly WorkspaceInput[] | undefined
    Explicit file inputs; JSON workflow parameters are never implicitly written to disk.
  • options.sourceRequired
    FileWorkspaceSource
    Declared source for an owned resource; mutually exclusive with borrowing an open workspace.
  • options.runtimeOptional
    WorkspaceRuntimeOptions | undefined
    Control directory and logical namespace, separate from the workspace files.
  • options.pathsOptional
    readonly string[] | undefined
    Explicit relative path selection; copy selection does not implicitly apply .gitignore.
  • options.retentionOptional
    WorkspaceRetention | undefined
    run cleans successful owned work, local retains it, portable additionally requires an explicit Transport and namespace.
  • options.signalOptional
    AbortSignal | undefined
    Cancellation signal propagated to the operation and its process group; reusable sandboxes remain usable.

Promise<GitWorkspace> · Promise<FileWorkspace>

export declare function createWorkspace(
  options: GitWorkspaceOptions,
): Promise<GitWorkspace>;

export declare function createWorkspace(
  options: FileWorkspaceOptions,
): Promise<FileWorkspace>;