fix: add before-agent-run blocking hook

This commit is contained in:
Jesse Merhi
2026-05-05 11:30:35 +10:00
committed by clawsweeper
parent cc9f88e6e6
commit 5e64394239
86 changed files with 3500 additions and 300 deletions

View File

@@ -33,6 +33,11 @@ const header = `// Generated by scripts/protocol-gen-swift.ts — do not edit by
.map((c) => ` case ${camelCase(c)} = "${c}"`)
.join("\n")}\n}\n`;
const OPTIONAL_INIT_DEFAULTS = new Map<string, Set<string>>([
["ChatHistoryParams", new Set(["includeblockedoriginalcontent"])],
["PluginApprovalRequestParams", new Set(["alloweddecisions"])],
]);
const reserved = new Set([
"associatedtype",
"class",
@@ -190,7 +195,9 @@ function emitStruct(name: string, schema: JsonSchema): string {
.map(([key, prop]) => {
const propName = safeName(key);
const req = required.has(key);
return ` ${propName}: ${swiftType(prop, true)}${req ? "" : "?"}`;
const defaultValue =
!req && OPTIONAL_INIT_DEFAULTS.get(name)?.has(propName) ? " = nil" : "";
return ` ${propName}: ${swiftType(prop, true)}${req ? "" : "?"}${defaultValue}`;
})
.join(",\n") +
")\n" +