/**
 * V2 Shared Workspace Type Definitions
 *
 * A Workspace is a structured, versioned JSON document that agents can
 * read and write. Optimistic locking (CAS — Compare-And-Swap) ensures
 * consistency: writes must include the expectedVersion, and fail with
 * a conflict if another writer has updated the document since the read.
 *
 * Usage discipline (CEO requirement):
 * - Each workspace has an owner (agent/team/system)
 * - Schema defines allowed structure
 * - Access mode controls append vs overwrite
 * - Ownership prevents unauthorized writes
 *
 * @module types/v2/workspace.types
 */
/**
 * Access mode for workspace writes.
 * - overwrite: Replace entire data on write
 * - append: Merge/append new data to existing
 * - structured: Write to specific paths within the document
 */
export type WorkspaceAccessMode = 'overwrite' | 'append' | 'structured';
/** All valid access modes. */
export declare const WORKSPACE_ACCESS_MODES: readonly WorkspaceAccessMode[];
/**
 * Who owns the workspace.
 */
export type WorkspaceOwnerType = 'agent' | 'team' | 'mission' | 'system';
/** All valid owner types. */
export declare const WORKSPACE_OWNER_TYPES: readonly WorkspaceOwnerType[];
/**
 * A versioned, structured JSON workspace.
 *
 * Each write increments the version counter. Reads return the current
 * version, which must be passed back on writes for CAS validation.
 */
export interface Workspace {
    /** UUID v4 */
    id: string;
    /** Human-readable name */
    name: string;
    /** Optional description */
    description?: string;
    /** Who owns this workspace */
    ownerType: WorkspaceOwnerType;
    /** Owner identifier (agent session, team ID, mission ID, or 'system') */
    ownerId: string;
    /** Access mode — how data can be modified */
    accessMode: WorkspaceAccessMode;
    /** The actual workspace data (arbitrary JSON-serializable object) */
    data: Record<string, unknown>;
    /** Monotonically increasing version number (starts at 1) */
    version: number;
    /** Which sessions are allowed to write (empty = owner only) */
    allowedWriters: string[];
    /** ISO8601 timestamps */
    createdAt: string;
    updatedAt: string;
    /** Who last wrote to this workspace */
    lastWrittenBy?: string;
}
/**
 * Input for creating a new Workspace.
 */
export interface CreateWorkspaceInput {
    name: string;
    description?: string;
    ownerType: WorkspaceOwnerType;
    ownerId: string;
    accessMode?: WorkspaceAccessMode;
    data?: Record<string, unknown>;
    allowedWriters?: string[];
}
/**
 * Input for writing to a workspace.
 * Requires expectedVersion for CAS validation.
 */
export interface WriteWorkspaceInput {
    /** The version the client believes is current — CAS check */
    expectedVersion: number;
    /** New data to write (interpretation depends on accessMode) */
    data: Record<string, unknown>;
    /** Who is performing the write */
    writerId: string;
}
/**
 * Input for a structured write to a specific path.
 */
export interface StructuredWriteInput {
    /** The version the client believes is current */
    expectedVersion: number;
    /** Dot-notation path to write to (e.g., "results.phase1") */
    path: string;
    /** Value to set at the path */
    value: unknown;
    /** Who is performing the write */
    writerId: string;
}
/**
 * Error thrown when a CAS conflict occurs.
 * The client's expectedVersion doesn't match the current version.
 */
export declare class WorkspaceConflictError extends Error {
    readonly workspaceId: string;
    readonly expectedVersion: number;
    readonly actualVersion: number;
    constructor(workspaceId: string, expectedVersion: number, actualVersion: number);
}
/**
 * Error thrown when a writer is not authorized.
 */
export declare class WorkspaceAccessError extends Error {
    readonly workspaceId: string;
    readonly writerId: string;
    constructor(workspaceId: string, writerId: string);
}
/**
 * Checks whether a string is a valid WorkspaceAccessMode.
 */
export declare function isValidWorkspaceAccessMode(value: string): value is WorkspaceAccessMode;
/**
 * Checks whether a string is a valid WorkspaceOwnerType.
 */
export declare function isValidWorkspaceOwnerType(value: string): value is WorkspaceOwnerType;
/**
 * Validates that an unknown value is structurally a valid Workspace.
 */
export declare function isWorkspace(value: unknown): value is Workspace;
/**
 * Validates CreateWorkspaceInput.
 *
 * @param input - The creation input to validate
 * @returns Array of validation error strings (empty = valid)
 */
export declare function validateCreateWorkspaceInput(input: CreateWorkspaceInput): string[];
/**
 * Validates WriteWorkspaceInput.
 */
export declare function validateWriteWorkspaceInput(input: WriteWorkspaceInput): string[];
/**
 * Creates a new Workspace with sensible defaults.
 *
 * @param input - Required and optional creation fields
 * @returns A fully populated Workspace at version 1
 *
 * @example
 * ```typescript
 * const ws = createWorkspace({
 *   name: 'Sprint 1 Results',
 *   ownerType: 'team',
 *   ownerId: 'team-product',
 * });
 * ```
 */
export declare function createWorkspace(input: CreateWorkspaceInput): Workspace;
//# sourceMappingURL=workspace.types.d.ts.map