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:
@@ -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 = (
|
||||
|
||||
Reference in New Issue
Block a user