fix(contracts): preserve local inputs and comparison uncertainty

This commit is contained in:
morluto
2026-10-09 06:49:02 +08:00
parent 7a7460f04f
commit 70e8a8f860
35 changed files with 460 additions and 386 deletions
+12 -8
View File
@@ -1,16 +1,21 @@
import { z } from "zod";
import { localPathStringSchema } from "../localPath.js";
const hexSchema = z.string().regex(/^0x[0-9a-f]+$/u);
/** Objective-C class names and selectors never contain spaces or brackets. */
const objcName = z
const nativeString = z
.string()
.regex(
/^[^\0]*$/u,
"Native launch and breakpoint strings cannot contain NUL",
);
/** Objective-C class names and selectors never contain spaces or brackets. */
const objcName = nativeString
.min(1)
.regex(/^[^\s[\]]+$/u, "Use the bare name without spaces or brackets");
const functionBreakpoint = {
kind: z.literal("function"),
name: z
.string()
name: nativeString
.min(1)
.describe(
"Exact symbol name, such as `open`, a C++ or mangled Swift symbol, or `-[NSString length]`.",
@@ -28,8 +33,7 @@ const objcMethodBreakpoint = {
export const nativeCallBreakpointSchema = z.discriminatedUnion("kind", [
z.strictObject({
...functionBreakpoint,
module: z
.string()
module: nativeString
.min(1)
.optional()
.describe(
@@ -51,7 +55,7 @@ export const nativeCallBreakpointSchema = z.discriminatedUnion("kind", [
*/
export const nativeCallObservationInputSchema = z.strictObject({
breakpoints: z.array(nativeCallBreakpointSchema).min(1),
arguments: z.array(z.string()).default([]),
arguments: z.array(nativeString).default([]),
environment: z
.record(
z
@@ -62,7 +66,7 @@ export const nativeCallObservationInputSchema = z.strictObject({
)
.default({})
.describe("Overrides on top of the environment REA runs with."),
working_directory: z.string().min(1).optional(),
working_directory: localPathStringSchema.optional(),
duration_ms: z
.number()
.int()