refactor: return complete tool results inline

This commit is contained in:
morluto
2026-09-29 07:08:46 +08:00
parent 2160d4fae5
commit 0d96275b68
535 changed files with 4084 additions and 13537 deletions
+3 -11
View File
@@ -1,5 +1,4 @@
import {
LEGACY_PROCESS_CAPTURE_MESSAGE,
processCaptureSchema,
type UnverifiedProcessCapture,
} from "./processCapture.js";
@@ -8,7 +7,7 @@ declare class ProcessCaptureProof {
private readonly verified: never;
}
/** Semantically verified Process Capture v4 value. */
/** Semantically verified process capture value. */
export type ProcessCapture = UnverifiedProcessCapture & ProcessCaptureProof;
const verifiedCaptures = new WeakSet<UnverifiedProcessCapture>();
@@ -23,15 +22,8 @@ const attachProof = (capture: UnverifiedProcessCapture): ProcessCapture => {
throw new TypeError("Process Capture proof ownership failed");
};
/** Parse unknown input as v4 and reject invalid commitments or semantics. */
/** Parse unknown input and reject invalid commitments or semantics. */
export const parseProcessCapture = (input: unknown): ProcessCapture => {
if (
typeof input === "object" &&
input !== null &&
"schema_version" in input &&
input.schema_version === 3
)
throw new TypeError(LEGACY_PROCESS_CAPTURE_MESSAGE);
const parsed = processCaptureSchema.safeParse(input);
if (parsed.success) return attachProof(parsed.data);
const issues = parsed.error.issues.flatMap((issue) =>
@@ -41,7 +33,7 @@ export const parseProcessCapture = (input: unknown): ProcessCapture => {
);
if (issues.length > 0)
throw new TypeError(
`Invalid Process Capture v4: ${issues.map(({ path, message }) => `${path}: ${message}`).join("; ")}`,
`Invalid process capture: ${issues.map(({ path, message }) => `${path}: ${message}`).join("; ")}`,
);
throw parsed.error;
};