mirror of
https://github.com/morluto/rea.git
synced 2026-11-20 05:32:44 +00:00
* refactor(contracts): declare each tool's effect audit on its contract Every public tool's effects lived in a 255-entry TOOL_EFFECT_AUDIT table in toolEffects.ts, keyed by name and looked up again by toolContractMetadata, the capability inventory (toolSessionEffects) and tests (TOOL_EFFECTS). toolContractMetadata(name, audit) now takes the audit from the contract declaration, and the contract carries both the provider-wide effects and the session effects. The inventory reads contract.sessionEffects. The table, TOOL_EFFECTS and toolSessionEffects are removed; toolEffects.ts keeps the effect type, the shared presets and annotation derivation. Effects, session effects, annotations and titles are byte-identical for all 255 contracts. * test(contracts): read focused effect expectations from their contract family
52 lines
2.2 KiB
TypeScript
52 lines
2.2 KiB
TypeScript
import {
|
||
javascriptRecoveryInputSchema,
|
||
javascriptRecoveryResultSchema,
|
||
} from "../../domain/javascript/javascriptRecovery.js";
|
||
import { toolContractMetadata, toolEffects } from "../toolEffects.js";
|
||
import { evidenceResultOf } from "../toolOutputSchemaPrimitives.js";
|
||
import type { ToolContract } from "../toolContractTypes.js";
|
||
|
||
/** Derived script artifacts from optional upstream recovery adapters. */
|
||
export const JAVASCRIPT_RECOVERY_TOOL_CONTRACTS = [
|
||
{
|
||
name: "recover_javascript_sources",
|
||
availability: { host: "javascriptRecovery" },
|
||
cli: true,
|
||
...toolContractMetadata(
|
||
"recover_javascript_sources",
|
||
toolEffects({
|
||
mutatesSession: true,
|
||
writesFilesystem: true,
|
||
launchesProcess: true,
|
||
idempotent: false,
|
||
}),
|
||
),
|
||
kind: "application",
|
||
description:
|
||
"Recover readable modules from local UTF-8 JavaScript bundles into an absent output_directory, without executing application code. Requires caller-supplied Wakaru ^1.13.0 (verified 1.14.0), Linux x64 and util-linux prlimit. additional_paths includes related chunks, preserving each input’s snapshot/provenance. Returns original/derived digests, extraction ranges, source maps, warnings and analysis_input for analyze_javascript_application. Splitting may fall back to one module; original names and runtime equivalence remain unknown. One worker has a fixed 120-second deadline and bounded input/output/report admission; limit failures are explicit and roll back output.",
|
||
inputSchema: javascriptRecoveryInputSchema,
|
||
outputSchema: evidenceResultOf(javascriptRecoveryResultSchema),
|
||
examples: [
|
||
{
|
||
title: "Recover a captured production bundle",
|
||
input: {
|
||
path: "/tmp/web-scripts/app.js",
|
||
output_directory: "/tmp/recovered-app",
|
||
},
|
||
},
|
||
{
|
||
title: "Recover a code-split bundle together",
|
||
input: {
|
||
path: "/tmp/web-scripts/main.js",
|
||
additional_paths: [
|
||
"/tmp/web-scripts/runtime.js",
|
||
"/tmp/web-scripts/shared.js",
|
||
"/tmp/web-scripts/checkout.chunk.js",
|
||
],
|
||
output_directory: "/tmp/recovered-chunks",
|
||
},
|
||
},
|
||
],
|
||
},
|
||
] as const satisfies readonly ToolContract[];
|