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A,CAAM,CAAA,0BAAA,EAA6B,KAAK,CAAA,oBAAA,CAAsB,CAAA;AAAA,MAC1E;AACA,MAAA,gBAAA,CAAiB,KAAA,CAAM,IAAA,EAAM,CAAA,OAAA,EAAU,KAAK,CAAA,MAAA,CAAQ,CAAA;AAAA,IACtD,CAAC,CAAA;AAAA,EACH;AAEA,EAAA,IAAI,MAAA,CAAO,WAAW,MAAA,EAAW;AAC/B,IAAA,IAAI,CAAC,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO,MAAM,CAAA,EAAG;AACjC,MAAA,MAAM,IAAI,MAAM,6DAA6D,CAAA;AAAA,IAC/E;AACA,IAAA,MAAA,CAAO,MAAA,CAAO,OAAA,CAAQ,CAAC,KAAA,EAAO,KAAA,KAAU;AACtC,MAAA,IAAI,KAAA,KAAU,IAAA,IAAQ,OAAO,KAAA,KAAU,QAAA,EAAU;AAC/C,QAAA,MAAM,IAAI,KAAA,CAAM,CAAA,0BAAA,EAA6B,KAAK,CAAA,oBAAA,CAAsB,CAAA;AAAA,MAC1E;AACA,MAAA,gBAAA,CAAiB,KAAA,CAAM,EAAA,EAAI,CAAA,OAAA,EAAU,KAAK,CAAA,IAAA,CAAM,CAAA;AAChD,MAAA,gBAAA,CAAiB,KAAA,CAAM,IAAA,EAAM,CAAA,OAAA,EAAU,KAAK,CAAA,MAAA,CAAQ,CAAA;AACpD,MAAA,yBAAA,CAA0B,KAAA,CAAM,MAAA,EAAQ,CAAA,OAAA,EAAU,KAAK,CAAA,QAAA,CAAU,CAAA;AAAA,IACnE,CAAC,CAAA;AAAA,EACH;AAEA,EAAA,OAAO,MAAA;AACT","file":"index.mjs","sourcesContent":["/**\n * Declarative Soma configuration (\"Config as Code\").\n *\n * These types and the `defineSomaConfig` helper let client projects declare\n * their organization's skills and agents in a type-safe, git-tracked file\n * (e.g. `soma.config.ts`) that the `zea soma sync` command compiles and sends\n * to the Soma backend for idempotent upsert.\n */\n\nexport interface SkillSpec {\n  /** Unique skill name (e.g. `fund-management`). */\n  name: string\n  /** Human-readable description of what the skill does. */\n  description?: string\n  /** Path to the skill definition file (e.g. `./skills/fund-management/SKILL.md`). */\n  filePath?: string\n  /** Inline skill content. Mutually exclusive with `filePath` in practice. */\n  content?: string\n}\n\nexport interface AgentSpec {\n  /** Unique agent id (e.g. `fund-management-copilot`). */\n  id: string\n  /** Display name for the agent. */\n  name: string\n  /** Engine that runs the agent. */\n  engine?: 'pi' | 'react' | 'opencode'\n  /** Model backing the agent. Known values are suggested for autocomplete; any string is accepted. */\n  model?: 'deepseek-v4-pro' | 'gpt-4o' | 'claude-sonnet-4-20250514' | (string & {})\n  /** System prompt that primes the agent's behavior. */\n  systemPrompt?: string\n  /** Names of skills assigned to this agent. */\n  skills?: string[]\n}\n\nexport interface SomaConfig {\n  /** Organization slug (e.g. `zea`). */\n  organization: string\n  skills?: SkillSpec[]\n  agents?: AgentSpec[]\n}\n\nfunction isNonEmptyString(value: unknown, label: string): string {\n  if (typeof value !== 'string' || value.trim() === '') {\n    throw new Error(`[defineSomaConfig] \"${label}\" must be a non-empty string.`)\n  }\n  return value\n}\n\nfunction assertOptionalStringArray(value: unknown, label: string): void {\n  if (value === undefined) return\n  if (!Array.isArray(value) || value.some((item) => typeof item !== 'string')) {\n    throw new Error(`[defineSomaConfig] \"${label}\" must be an array of strings when provided.`)\n  }\n}\n\n/**\n * Validates a declarative Soma configuration and returns it unchanged.\n *\n * The validation is intentionally lightweight and dependency-free: it asserts\n * the required fields (`organization`, and `name`/`id` on each skill/agent)\n * so invalid configs fail fast at sync time instead of silently producing\n * a partial upsert on the backend.\n */\nexport function defineSomaConfig(config: SomaConfig): SomaConfig {\n  if (config === null || typeof config !== 'object') {\n    throw new Error('[defineSomaConfig] config must be an object.')\n  }\n\n  isNonEmptyString(config.organization, 'organization')\n\n  if (config.skills !== undefined) {\n    if (!Array.isArray(config.skills)) {\n      throw new Error('[defineSomaConfig] \"skills\" must be an array when provided.')\n    }\n    config.skills.forEach((skill, index) => {\n      if (skill === null || typeof skill !== 'object') {\n        throw new Error(`[defineSomaConfig] skills[${index}] must be an object.`)\n      }\n      isNonEmptyString(skill.name, `skills[${index}].name`)\n    })\n  }\n\n  if (config.agents !== undefined) {\n    if (!Array.isArray(config.agents)) {\n      throw new Error('[defineSomaConfig] \"agents\" must be an array when provided.')\n    }\n    config.agents.forEach((agent, index) => {\n      if (agent === null || typeof agent !== 'object') {\n        throw new Error(`[defineSomaConfig] agents[${index}] must be an object.`)\n      }\n      isNonEmptyString(agent.id, `agents[${index}].id`)\n      isNonEmptyString(agent.name, `agents[${index}].name`)\n      assertOptionalStringArray(agent.skills, `agents[${index}].skills`)\n    })\n  }\n\n  return config\n}\n"]}