Skip to content

@codesoul-co/hypha-tools / workspace

Using this module

Use the Workspace module for declaring and enforcing workspace scope boundaries. It exports 3 interfaces, 1 type.

Import from the package entrypoint

ts
import type {
  WorkspaceRuntimeConfig,
  WorkspaceRuntimePort,
  WorkspaceRuntimeRequest,
  WorkspaceFileOperation,
} from '@codesoul-co/hypha-tools';

Usage patterns

  • Use the 4 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.

Public exports

SymbolKindSignatureDescription
WorkspaceRuntimeConfiginterfaceinterface WorkspaceRuntimeConfigWorkspace Runtime Config interface with 5 public fields or methods.
WorkspaceRuntimePortinterfaceinterface WorkspaceRuntimePortWorkspace Runtime Port interface with 3 public fields or methods.
WorkspaceRuntimeRequestinterfaceinterface WorkspaceRuntimeRequestWorkspace Runtime Request interface with 8 public fields or methods.
WorkspaceFileOperationtypetype WorkspaceFileOperation = 'read' | 'write' | 'list' | 'execute'Public type alias for Workspace File Operation; the declaration contains its complete type expression.

WorkspaceRuntimeConfig

Workspace Runtime Config interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { WorkspaceRuntimeConfig } from '@codesoul-co/hypha-tools';
  • Source module: workspace

Declaration

text
export interface WorkspaceRuntimeConfig {
    workingDirectory: string;
    readPaths: string[];
    writePaths: string[];
    executePaths: string[];
    execution: {
        enabled: boolean;
        timeoutMs: number;
        maxOutputBytes: number;
    };
}

Contract members

MemberKindSignatureDescription
executePathspropertyexecutePaths: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
executionpropertyexecution: { enabled: boolean; timeoutMs: number; maxOutputBytes: number; }Public property; its type, readonly modifier and optionality are shown in the signature.
readPathspropertyreadPaths: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
workingDirectorypropertyworkingDirectory: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
writePathspropertywritePaths: string[]Public property; its type, readonly modifier and optionality are shown in the signature.

WorkspaceRuntimePort

Workspace Runtime Port interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { WorkspaceRuntimePort } from '@codesoul-co/hypha-tools';
  • Source module: workspace

Declaration

text
export interface WorkspaceRuntimePort {
    execute(request: WorkspaceRuntimeRequest): Promise<unknown>;
    health(): Promise<ProviderHealth>;
    close?(): Promise<void>;
}

Contract members

MemberKindSignatureDescription
closemethodclose?(): Promise<void>Public method; parameters and return type are shown in the signature.
executemethodexecute(request: WorkspaceRuntimeRequest): Promise<unknown>Public method; parameters and return type are shown in the signature.
healthmethodhealth(): Promise<ProviderHealth>Public method; parameters and return type are shown in the signature.

WorkspaceRuntimeRequest

Workspace Runtime Request interface with 8 public fields or methods.

  • Kind: interface
  • Import: import type { WorkspaceRuntimeRequest } from '@codesoul-co/hypha-tools';
  • Source module: workspace

Declaration

text
export interface WorkspaceRuntimeRequest {
    operation: WorkspaceFileOperation;
    path: string;
    content?: string;
    executable?: boolean;
    args?: string[];
    cwd?: string;
    timeoutMs?: number;
    signal?: AbortSignal;
}

Contract members

MemberKindSignatureDescription
argspropertyargs?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
contentpropertycontent?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
cwdpropertycwd?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
executablepropertyexecutable?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
operationpropertyoperation: WorkspaceFileOperationPublic property; its type, readonly modifier and optionality are shown in the signature.
pathpropertypath: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
signalpropertysignal?: AbortSignalPublic property; its type, readonly modifier and optionality are shown in the signature.
timeoutMspropertytimeoutMs?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

WorkspaceFileOperation

Public type alias for Workspace File Operation; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { WorkspaceFileOperation } from '@codesoul-co/hypha-tools';
  • Source module: workspace

Declaration

text
export type WorkspaceFileOperation = 'read' | 'write' | 'list' | 'execute';