{"version":3,"file":"guards.mjs","names":[],"sources":["../src/guards.ts"],"sourcesContent":["import {\n  PermissionMode,\n  type PermissionMode as PermissionModeType,\n} from \"./schema.ts\";\nimport { agentId, type AgentId } from \"./compat/codecs.ts\";\n\n/**\n * Narrowing guards shared across the library. Each derives its truth from the schema/enum it protects (the zod enum's own options list), so a new value added to the schema is automatically accepted here without an edit.\n */\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n  return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nexport function isAgentId(value: string): value is AgentId {\n  for (const id of agentId.options) {\n    if (id === value) return true;\n  }\n  return false;\n}\n\nexport function isPermissionMode(value: string): value is PermissionModeType {\n  for (const mode of PermissionMode.options) {\n    if (mode === value) return true;\n  }\n  return false;\n}\n"],"mappings":";;;;;;;AAUA,SAAgB,SAAS,OAAkD;CACzE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAgB,UAAU,OAAiC;CACzD,KAAK,MAAM,MAAM,QAAQ,SACvB,IAAI,OAAO,OAAO,OAAO;CAE3B,OAAO;AACT;AAEA,SAAgB,iBAAiB,OAA4C;CAC3E,KAAK,MAAM,QAAQ,eAAe,SAChC,IAAI,SAAS,OAAO,OAAO;CAE7B,OAAO;AACT"}