mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 22:40:43 +00:00
fix: add before-agent-run blocking hook
This commit is contained in:
@@ -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" +
|
||||
|
||||
Reference in New Issue
Block a user