@codesoul-co/hypha-adapters-local / local-process-policy
模块用法
用于实施 Policy 与治理检查。Local process policy 模块公开 1 类、2 接口。
从包入口导入
ts
import {
LocalProcessPolicyResolver,
} from '@codesoul-co/hypha-adapters-local';
import type {
LocalProcessPolicyResolverOptions,
ResolvedLocalProcessPolicy,
} from '@codesoul-co/hypha-adapters-local';使用要点
- 2 个类型/接口用于应用代码、Adapter 或测试中的静态契约;请使用
import type,运行时不应依赖它们。 - 1 个类提供可实例化的运行时实现;构造参数与公开方法在各自条目中完整列出。
公共导出
| Symbol | 种类 | 签名 | 说明 |
|---|---|---|---|
LocalProcessPolicyResolver | 类 | new LocalProcessPolicyResolver(options: LocalProcessPolicyResolverOptions): LocalProcessPolicyResolver | Resolves untrusted command input into an explicit, host-local execution policy. |
LocalProcessPolicyResolverOptions | 接口 | interface LocalProcessPolicyResolverOptions | Local Process Policy Resolver Options 接口,共包含 14 个公开字段或方法。 |
ResolvedLocalProcessPolicy | 接口 | interface ResolvedLocalProcessPolicy | Resolved Local Process Policy 接口,共包含 9 个公开字段或方法。 |
LocalProcessPolicyResolver
Resolves untrusted command input into an explicit, host-local execution policy.
- 种类: 类
- 导入:
import { LocalProcessPolicyResolver } from '@codesoul-co/hypha-adapters-local'; - 源码模块:
local-process-policy
声明
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>;
}公开成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
assertExecutionSurfaceUnchanged | 方法 | assertExecutionSurfaceUnchanged(policy: ResolvedLocalProcessPolicy): Promise<void> | 公开方法;参数与返回类型以签名列为准。 |
assertSurfaceAvailable | 方法 | assertSurfaceAvailable(): Promise<void> | 公开方法;参数与返回类型以签名列为准。 |
constructor | 构造函数 | (options: LocalProcessPolicyResolverOptions): LocalProcessPolicyResolver | 创建该类的实例。 |
resolve | 方法 | resolve(environment: ExecutionEnvironmentSpec, request: CommandExecutionRequest): Promise<ResolvedLocalProcessPolicy> | 公开方法;参数与返回类型以签名列为准。 |
validateEnvironment | 方法 | validateEnvironment(environment: ExecutionEnvironmentSpec): void | 公开方法;参数与返回类型以签名列为准。 |
workspaceRoot | 属性 | readonly workspaceRoot: string | 公开属性;类型、只读和可选状态以签名列为准。 |
LocalProcessPolicyResolverOptions
Local Process Policy Resolver Options 接口,共包含 14 个公开字段或方法。
- 种类: 接口
- 导入:
import type { LocalProcessPolicyResolverOptions } from '@codesoul-co/hypha-adapters-local'; - 源码模块:
local-process-policy
声明
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;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
baseEnvironment | 属性 | baseEnvironment?: Record<string, string> | 公开属性;类型、只读和可选状态以签名列为准。 |
executables | 属性 | executables: Record<string, string> | 公开属性;类型、只读和可选状态以签名列为准。 |
inheritEnvironment | 属性 | inheritEnvironment?: string[] | 公开属性;类型、只读和可选状态以签名列为准。 |
maxArgumentBytes | 属性 | maxArgumentBytes?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
maxArgumentCount | 属性 | maxArgumentCount?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
maxCombinedOutputBytes | 属性 | maxCombinedOutputBytes?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
maxEnvironmentValueBytes | 属性 | maxEnvironmentValueBytes?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
maxEnvironmentVariables | 属性 | maxEnvironmentVariables?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
maxExecutionTimeoutMs | 属性 | maxExecutionTimeoutMs?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
maxStderrBytes | 属性 | maxStderrBytes?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
maxStdoutBytes | 属性 | maxStdoutBytes?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
maxTotalArgumentBytes | 属性 | maxTotalArgumentBytes?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
maxTotalEnvironmentBytes | 属性 | maxTotalEnvironmentBytes?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
workspaceRoot | 属性 | workspaceRoot: string | 公开属性;类型、只读和可选状态以签名列为准。 |
ResolvedLocalProcessPolicy
Resolved Local Process Policy 接口,共包含 9 个公开字段或方法。
- 种类: 接口
- 导入:
import type { ResolvedLocalProcessPolicy } from '@codesoul-co/hypha-adapters-local'; - 源码模块:
local-process-policy
声明
text
export interface ResolvedLocalProcessPolicy {
executable: string;
args: readonly string[];
cwd: string;
environment: NodeJS.ProcessEnv;
timeoutMs: number;
idleTimeoutMs?: number;
maxStdoutBytes: number;
maxStderrBytes: number;
maxCombinedOutputBytes: number;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
args | 属性 | args: readonly string[] | 公开属性;类型、只读和可选状态以签名列为准。 |
cwd | 属性 | cwd: string | 公开属性;类型、只读和可选状态以签名列为准。 |
environment | 属性 | environment: NodeJS.ProcessEnv | 公开属性;类型、只读和可选状态以签名列为准。 |
executable | 属性 | executable: string | 公开属性;类型、只读和可选状态以签名列为准。 |
idleTimeoutMs | 属性 | idleTimeoutMs?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
maxCombinedOutputBytes | 属性 | maxCombinedOutputBytes: number | 公开属性;类型、只读和可选状态以签名列为准。 |
maxStderrBytes | 属性 | maxStderrBytes: number | 公开属性;类型、只读和可选状态以签名列为准。 |
maxStdoutBytes | 属性 | maxStdoutBytes: number | 公开属性;类型、只读和可选状态以签名列为准。 |
timeoutMs | 属性 | timeoutMs: number | 公开属性;类型、只读和可选状态以签名列为准。 |
