fix(tools)!: simplify direct invocation and harden boundary contracts (#555)

Remove REA permission grants, scope ceilings, approval confirmations, and inert settings. Preserve selected local evidence, accept caller-chosen commands and paths, and report actual runtime failures.

Harden provider results, schema serialization, snapshot evidence binding, archive paths, source maps, native screenshots, managed EH parsing, and cancellation cleanup. Regenerate tool metadata and document direct invocation.

BREAKING CHANGE: Removed permission configuration and policy commands, approval fields, filesystem scope inputs, and fixed confirmation options. Process capture inherits the host environment and accepts command names; callers must refresh tool schemas and migrate removed fields.
This commit is contained in:
morluto
2026-10-05 20:16:44 +08:00
committed by GitHub
parent 4f099a10f8
commit b5e98915c6
350 changed files with 5347 additions and 10599 deletions
+3 -44
View File
@@ -1,50 +1,9 @@
import { loadConfiguredPermissionAuthority } from "./application/PermissionConfiguration.js";
import { CdpBrowserProvider } from "./browser/CdpBrowserProvider.js";
import { parseConfig } from "./config.js";
import {
AnalysisCapabilityUnavailableError,
projectAnalysisError,
} from "./domain/errors.js";
import { projectAnalysisError } from "./domain/errors.js";
import type { JsonValue } from "./domain/jsonValue.js";
/**
* Load the configured passive browser authority and provider for one CLI
* operation.
*
* `environment` defaults to the process environment so CLI callers stay
* unchanged, but every caller may supply the environment explicitly. That is
* what makes configuration-driven behaviour testable without mutating
* `process.env` for the duration of a test.
*/
export const browserContext = async (
operation: string,
environment: Readonly<Record<string, string | undefined>> = process.env,
) => {
const config = parseConfig(environment);
if (!config.ok)
return { ok: false as const, error: browserCliError(config.error) };
const policy = config.value.browserObservationPolicy;
if (policy.status === "disabled")
return {
ok: false as const,
error: browserCliError(
new AnalysisCapabilityUnavailableError(
"rea-cdp-browser",
operation,
"browser observation is disabled; configure exact endpoints and origins before enabling it",
),
),
};
const authority = await loadConfiguredPermissionAuthority(config.value);
if (!authority.ok)
return { ok: false as const, error: browserCliError(authority.error) };
return {
ok: true as const,
authority: authority.value,
provider: new CdpBrowserProvider(),
allowedBrowserOrigins: policy.allowedOrigins,
};
};
/** Build the passive browser provider; scope is supplied on each request. */
export const browserContext = () => ({ provider: new CdpBrowserProvider() });
/** Project a browser operation failure consistently across CLI command groups. */
export const browserCliError = (