/** * 探针执行器 — 把 ProbeRule 跑出 ProbeHit[]。 * * 职责边界: * - 负责:4 种探针实现(builtin/semgrep/rego/property)+ 完整源码集输入 + 输出脱敏 * - 不负责:规则加载(probe_rule.ts)、gate 注册(executors_probe.ts) * * 纯净最终态原则(硬失败,不降级): * - 外部探针(semgrep/rego)用 execa 参数数组(不经 shell,防命令注入)。 * - 依赖缺失 / 执行异常 → throw(由 gate executor 转 CheckResult fail)。确定性探针的结果不可信时绝不假装通过。 * - 对项目完整有效源码运行;依赖目录、构建产物和 SoloForge 内部状态由统一收集器排除。 * * 被谁调用:gate/executors/executors_probe.ts 的 registerProbeExecutor * 调用谁:execa(外部探针 semgrep/rego)、node:fs/node:path/node:os(临时文件/系统路径)、probe_rule(类型) * * 数据流:ProbeRule + ProbeExecContext(sourceFiles/projectRoot) → 4 种探针执行 → ProbeHit[] * 持久化:无 */ import type { ProbeRule, ProbeHit, ProbeKind } from "./probe_rule.js"; /** 探针执行上下文 */ export interface ProbeExecContext { /** 本次校验的有效源码文件(调用方负责排除依赖、构建产物和内部状态) */ sourceFiles: string[]; projectRoot: string; } /** 探针执行器接口 */ export interface ProbeExecutor { readonly kind: ProbeKind; execute(rule: ProbeRule, ctx: ProbeExecContext): Promise; } export declare class BuiltinProbeExecutor implements ProbeExecutor { readonly kind: "builtin"; execute(rule: ProbeRule, ctx: ProbeExecContext): Promise; } export declare class SemgrepProbeExecutor implements ProbeExecutor { readonly kind: "semgrep"; execute(rule: ProbeRule, ctx: ProbeExecContext): Promise; } /** 探针执行器注册表 */ export declare const PROBE_EXECUTORS: Record; /** 获取完整源码集;full verify 不以工作区是否有未提交 diff 决定真值。 * exclude(intent.scan_exclude)同步排除参考原型包/vendored 等非工程代码。 */ export declare function getProjectSourceFiles(projectRoot: string, exclude?: string[]): Promise;