Skip to content

@codesoul-co/hypha-adapters-local / local-process-policy

Using this module

Use the Local process policy module for applying policy and governance checks. It exports 1 class, 2 interfaces.

Import from the package entrypoint

ts
import {
  LocalProcessPolicyResolver,
} from '@codesoul-co/hypha-adapters-local';

import type {
  LocalProcessPolicyResolverOptions,
  ResolvedLocalProcessPolicy,
} from '@codesoul-co/hypha-adapters-local';

Usage patterns

  • Use the 2 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.
  • The module exposes 1 class as constructable runtime implementations. Each symbol entry lists its constructor and public methods.

Public exports

SymbolKindSignatureDescription
LocalProcessPolicyResolverclassnew LocalProcessPolicyResolver(options: LocalProcessPolicyResolverOptions): LocalProcessPolicyResolverResolves untrusted command input into an explicit, host-local execution policy.
LocalProcessPolicyResolverOptionsinterfaceinterface LocalProcessPolicyResolverOptionsLocal Process Policy Resolver Options interface with 14 public fields or methods.
ResolvedLocalProcessPolicyinterfaceinterface ResolvedLocalProcessPolicyResolved Local Process Policy interface with 9 public fields or methods.

LocalProcessPolicyResolver

Resolves untrusted command input into an explicit, host-local execution policy.

  • Kind: class
  • Import: import { LocalProcessPolicyResolver } from '@codesoul-co/hypha-adapters-local';
  • Source module: local-process-policy

Declaration

text
export declare class LocalProcessPolicyResolver {
    readonly workspaceRoot: string;
    constructor(options: LocalProcessPolicyResolverOptions);
    validateEnvironment(environment: ExecutionEnvironmentSpec): void;
    resolve(environment: ExecutionEnvironmentSpec, request: CommandExecutionRequest): Promise<ResolvedLocalProcessPolicy>;
    assertExecutionSurfaceUnchanged(policy: ResolvedLocalProcessPolicy): Promise<void>;
    assertSurfaceAvailable(): Promise<void>;
}

Public members

MemberKindSignatureDescription
assertExecutionSurfaceUnchangedmethodassertExecutionSurfaceUnchanged(policy: ResolvedLocalProcessPolicy): Promise<void>Public method; parameters and return type are shown in the signature.
assertSurfaceAvailablemethodassertSurfaceAvailable(): Promise<void>Public method; parameters and return type are shown in the signature.
constructorconstructor(options: LocalProcessPolicyResolverOptions): LocalProcessPolicyResolverCreates an instance of this class.
resolvemethodresolve(environment: ExecutionEnvironmentSpec, request: CommandExecutionRequest): Promise<ResolvedLocalProcessPolicy>Public method; parameters and return type are shown in the signature.
validateEnvironmentmethodvalidateEnvironment(environment: ExecutionEnvironmentSpec): voidPublic method; parameters and return type are shown in the signature.
workspaceRootpropertyreadonly workspaceRoot: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

LocalProcessPolicyResolverOptions

Local Process Policy Resolver Options interface with 14 public fields or methods.

  • Kind: interface
  • Import: import type { LocalProcessPolicyResolverOptions } from '@codesoul-co/hypha-adapters-local';
  • Source module: local-process-policy

Declaration

text
export interface LocalProcessPolicyResolverOptions {
    workspaceRoot: string;
    executables: Record<string, string>;
    baseEnvironment?: Record<string, string>;
    inheritEnvironment?: string[];
    maxExecutionTimeoutMs?: number;
    maxStdoutBytes?: number;
    maxStderrBytes?: number;
    maxCombinedOutputBytes?: number;
    maxArgumentCount?: number;
    maxArgumentBytes?: number;
    maxTotalArgumentBytes?: number;
    maxEnvironmentVariables?: number;
    maxEnvironmentValueBytes?: number;
    maxTotalEnvironmentBytes?: number;
}

Contract members

MemberKindSignatureDescription
baseEnvironmentpropertybaseEnvironment?: Record<string, string>Public property; its type, readonly modifier and optionality are shown in the signature.
executablespropertyexecutables: Record<string, string>Public property; its type, readonly modifier and optionality are shown in the signature.
inheritEnvironmentpropertyinheritEnvironment?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
maxArgumentBytespropertymaxArgumentBytes?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
maxArgumentCountpropertymaxArgumentCount?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
maxCombinedOutputBytespropertymaxCombinedOutputBytes?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
maxEnvironmentValueBytespropertymaxEnvironmentValueBytes?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
maxEnvironmentVariablespropertymaxEnvironmentVariables?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
maxExecutionTimeoutMspropertymaxExecutionTimeoutMs?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
maxStderrBytespropertymaxStderrBytes?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
maxStdoutBytespropertymaxStdoutBytes?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
maxTotalArgumentBytespropertymaxTotalArgumentBytes?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
maxTotalEnvironmentBytespropertymaxTotalEnvironmentBytes?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
workspaceRootpropertyworkspaceRoot: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ResolvedLocalProcessPolicy

Resolved Local Process Policy interface with 9 public fields or methods.

  • Kind: interface
  • Import: import type { ResolvedLocalProcessPolicy } from '@codesoul-co/hypha-adapters-local';
  • Source module: local-process-policy

Declaration

text
export interface ResolvedLocalProcessPolicy {
    executable: string;
    args: readonly string[];
    cwd: string;
    environment: NodeJS.ProcessEnv;
    timeoutMs: number;
    idleTimeoutMs?: number;
    maxStdoutBytes: number;
    maxStderrBytes: number;
    maxCombinedOutputBytes: number;
}

Contract members

MemberKindSignatureDescription
argspropertyargs: readonly string[]Public 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.
environmentpropertyenvironment: NodeJS.ProcessEnvPublic property; its type, readonly modifier and optionality are shown in the signature.
executablepropertyexecutable: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
idleTimeoutMspropertyidleTimeoutMs?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
maxCombinedOutputBytespropertymaxCombinedOutputBytes: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
maxStderrBytespropertymaxStderrBytes: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
maxStdoutBytespropertymaxStdoutBytes: numberPublic 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.