feat: enforce device-bound connect challenge

This commit is contained in:
Peter Steinberger
2026-01-20 11:15:10 +00:00
parent 121ae6036b
commit dfbf6ac263
21 changed files with 953 additions and 129 deletions

View File

@@ -18,14 +18,25 @@ type JsonSchema = {
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const repoRoot = path.resolve(__dirname, "..");
const outPath = path.join(
repoRoot,
"apps",
"macos",
"Sources",
"ClawdbotProtocol",
"GatewayModels.swift",
);
const outPaths = [
path.join(
repoRoot,
"apps",
"macos",
"Sources",
"ClawdbotProtocol",
"GatewayModels.swift",
),
path.join(
repoRoot,
"apps",
"shared",
"ClawdbotKit",
"Sources",
"ClawdbotProtocol",
"GatewayModels.swift",
),
];
const header = `// Generated by scripts/protocol-gen-swift.ts — do not edit by hand\nimport Foundation\n\npublic let GATEWAY_PROTOCOL_VERSION = ${PROTOCOL_VERSION}\n\npublic enum ErrorCode: String, Codable, Sendable {\n${Object.values(ErrorCodes)
.map((c) => ` case ${camelCase(c)} = "${c}"`)
@@ -221,9 +232,11 @@ async function generate() {
parts.push(emitGatewayFrame());
const content = parts.join("\n");
await fs.mkdir(path.dirname(outPath), { recursive: true });
await fs.writeFile(outPath, content);
console.log(`wrote ${outPath}`);
for (const outPath of outPaths) {
await fs.mkdir(path.dirname(outPath), { recursive: true });
await fs.writeFile(outPath, content);
console.log(`wrote ${outPath}`);
}
}
generate().catch((err) => {