源码快照 @ 2026-09-02 (source-only, 剔除非源码素材)

This commit is contained in:
agent-radar
2026-09-02 01:05:41 +08:00
commit 04bac1f6e2
2200 changed files with 489415 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
const PORTABLE_OPENCODE_TOP_LEVEL_KEYS = [
"agent",
"command",
"instructions",
"mcp",
"permission",
"plugin",
"share",
"tools",
"watcher",
] as const;
function cloneJson<T>(value: T): T {
return JSON.parse(JSON.stringify(value));
}
export function sanitizePortableOpencodeConfig(opencode: Record<string, unknown> | null | undefined): Record<string, unknown> {
const source = opencode && typeof opencode === "object" && !Array.isArray(opencode) ? opencode : {};
const next: Record<string, unknown> = {};
for (const key of PORTABLE_OPENCODE_TOP_LEVEL_KEYS) {
if (!(key in source)) continue;
next[key] = cloneJson(source[key]);
}
return next;
}