@cadenya/cadenya 1.4.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,6CAA6C;AA61L7C,iEAAiE;AAEjE,MAAM,UAAU,SAAS,CAAI,KAAkC,EAAE,EAAqB;IACpF,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,OAAO,CAAI,KAA2C,EAAE,EAAqB;IAC3F,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvG,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAyC;IACtE,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS;QAAE,GAAG,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC;IAC5E,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS;QAAE,GAAG,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC;IAC5E,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,sCAAsC,CAAC,KAAiE;IACtH,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,QAAS,KAA0C,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5D,KAAK,QAAQ,CAAC,CAAC,OAAO,6CAA6C,CAAE,KAAe,CAAC,CAAC;QACtF,KAAK,WAAW,CAAC,CAAC,OAAO,gDAAgD,CAAE,KAAe,CAAC,CAAC;QAC5F,KAAK,YAAY,CAAC,CAAC,OAAO,iDAAiD,CAAE,KAAe,CAAC,CAAC;QAC9F,OAAO,CAAC,CAAC,OAAO,KAAK,CAAC;IACxB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,KAA0D;IACxG,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS;QAAE,GAAG,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC;IACnE,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IACvD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAA8C;IAChF,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IACvD,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS;QAAE,GAAG,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC;IAC5E,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,KAAsD;IAChG,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS;QAAE,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;IACpD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,yCAAyC,CAAC,KAAoE;IAC5H,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,QAAS,KAA0C,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5D,KAAK,QAAQ,CAAC,CAAC,OAAO,gDAAgD,CAAE,KAAe,CAAC,CAAC;QACzF,KAAK,WAAW,CAAC,CAAC,OAAO,mDAAmD,CAAE,KAAe,CAAC,CAAC;QAC/F,KAAK,YAAY,CAAC,CAAC,OAAO,oDAAoD,CAAE,KAAe,CAAC,CAAC;QACjG,OAAO,CAAC,CAAC,OAAO,KAAK,CAAC;IACxB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAgD;IACpF,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS;QAAE,GAAG,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC;IACnE,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IAC7D,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS;QAAE,GAAG,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC;IAChE,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;QAAE,GAAG,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;IACtE,IAAI,KAAK,CAAC,gBAAgB,KAAK,SAAS;QAAE,GAAG,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC,gBAAgB,CAAC;IAC3F,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,6CAA6C,CAAC,KAAwE;IACpI,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IACvD,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IAC7D,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,gDAAgD,CAAC,KAA2E;IAC1I,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IACvD,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;QAAE,GAAG,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;IACtE,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,iDAAiD,CAAC,KAA4E;IAC5I,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IACvD,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS;QAAE,GAAG,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC;IACzE,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,gDAAgD,CAAC,KAA2E;IAC1I,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IACvD,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IAC7D,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,mDAAmD,CAAC,KAA8E;IAChJ,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IACvD,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;QAAE,GAAG,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;IACtE,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,oDAAoD,CAAC,KAA+E;IAClJ,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IACvD,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS;QAAE,GAAG,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC;IACzE,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// Generated by redwood. Do not edit by hand.\n\n/**\n * AIProviderConfig holds non-secret, provider-specific settings. The set case\n * must correspond to AIProviderKeySpec.provider. Providers with no settings\n * (Anthropic, Gemini) simply leave this unset. The endpoint of a named provider\n * is fixed and intentionally not overridable here; use the OpenAI-compatible\n * provider to target a custom endpoint.\n */\nexport type AIProviderConfig =\n | AIProviderConfig_Openrouter\n | AIProviderConfig_Openai\n | AIProviderConfig_OpenaiCompatible\n | AIProviderConfig_Vertex\n | AIProviderConfig_Bedrock;\n\n/**\n * AIProviderCredential is the secret material used to authenticate with a\n * provider. The set case must correspond to AIProviderKeySpec.provider. The\n * server classifies and encrypts sensitive fields at rest and never returns\n * secret values on reads.\n */\nexport type AIProviderCredential =\n | AIProviderCredential_ApiKey\n | AIProviderCredential_Headers\n | AIProviderCredential_GoogleServiceAccount\n | AIProviderCredential_AwsAccessKey;\n\n/**\n * AIProviderCredentialFieldStatus is the safe read representation of one\n * credential field. Value is populated only when sensitive is false.\n */\nexport interface AIProviderCredentialFieldStatus {\n name?: string;\n sensitive?: boolean;\n configured?: boolean;\n value?: string;\n}\n\n/**\n * AIProviderCredentialPatch changes selected fields of the current credential.\n * Omitted values are retained and clear_fields explicitly removes optional\n * fields. Changing type replaces the credential and requires all mandatory\n * fields for the new type.\n */\nexport interface AIProviderCredentialPatch {\n credentials?: AIProviderCredential;\n clearFields?: Array<string>;\n}\n\n/**\n * AIProviderCredentialStatus describes the stored authentication method and\n * its fields without returning secret material.\n */\nexport interface AIProviderCredentialStatus {\n type?: string;\n fields?: Array<AIProviderCredentialFieldStatus>;\n}\n\n/**\n * AIProviderKey is a credential for an AI provider, scoped to a workspace.\n * Most keys are customer-provided (BYOK); Cadenya also provisions promotional\n * keys (see AIProviderKeyInfo.is_promotional), which cannot be modified or\n * deleted by account administrators. The secret value is never returned in\n * responses.\n */\nexport interface AIProviderKey {\n metadata: ResourceMetadata;\n spec: AIProviderKeySpec;\n /**\n * Server-populated info (e.g. how many models route through this key).\n * Populated on reads when requested; see ListAIProviderKeysRequest.include_info.\n */\n info?: AIProviderKeyInfo;\n}\n\n/**\n * How models on this key are maintained; see ModelManagement.\n */\nexport type AiProviderKeyInfoModelManagement = 'MODEL_MANAGEMENT_UNSPECIFIED' | 'MODEL_MANAGEMENT_CADENYA' | 'MODEL_MANAGEMENT_SYNCED' | 'MODEL_MANAGEMENT_CUSTOMIZABLE' | 'MODEL_MANAGEMENT_MANUAL';\n\n/**\n * AIProviderKeyInfo carries server-derived, read-only details about a key, for\n * AI provider management UIs.\n */\nexport interface AIProviderKeyInfo {\n /**\n * Number of enabled models provisioned on this key.\n */\n enabledModelCount: number;\n /**\n * Number of disabled models provisioned on this key.\n */\n disabledModelCount: number;\n /**\n * Cadenya includes promotional keys (one for onboarding, and potentially more in the future).\n * These are not added or maintained by account administrators.\n */\n isPromotional: boolean;\n /**\n * Safe-to-display credential state. Secret values are never populated;\n * configured reports whether a value is present without revealing it.\n */\n credentialStatus?: AIProviderCredentialStatus;\n /**\n * How models on this key are maintained; see ModelManagement.\n */\n modelManagement: AiProviderKeyInfoModelManagement;\n}\n\n/**\n * The AI provider this key authenticates against.\n */\nexport type AiProviderKeySpecProvider = 'AI_PROVIDER_UNSPECIFIED' | 'AI_PROVIDER_OPENROUTER' | 'AI_PROVIDER_OPENAI' | 'AI_PROVIDER_ANTHROPIC' | 'AI_PROVIDER_GEMINI' | 'AI_PROVIDER_OPENAI_COMPATIBLE' | 'AI_PROVIDER_VERTEX' | 'AI_PROVIDER_BEDROCK';\n\nexport interface AIProviderKeySpec {\n /**\n * The AI provider this key authenticates against.\n */\n provider?: AiProviderKeySpecProvider;\n /**\n * The provider credential. Accepted on create/update; never populated in\n * responses (the server returns an empty value to avoid leaking the secret).\n */\n credentials?: AIProviderCredential;\n /**\n * Non-secret, provider-specific settings (OpenAI org/project, OpenRouter\n * region, OpenAI-compatible base URL, Vertex project/location, or Bedrock\n * Region). The set case must correspond to `provider`. Returned on reads.\n * Optional for providers that have usable defaults.\n */\n config?: AIProviderConfig;\n}\n\n/**\n * The current lifecycle state of the API key. Output only. Keys are\n * created STATE_ENABLED; use the :disable and :enable actions to\n * transition between states.\n */\nexport type ApiKeyState = 'STATE_UNSPECIFIED' | 'STATE_ENABLED' | 'STATE_DISABLED';\n\n/**\n * An API key. Every key belongs to exactly one workspace and is managed via\n * the workspace-scoped API key routes. The only exception is the\n * system-managed global account key, which spans all workspaces and is\n * managed via the account global_api_key routes.\n */\nexport interface APIKey {\n metadata: AccountResourceMetadata;\n spec: APIKeySpec;\n info?: APIKeyInfo;\n /**\n * The current lifecycle state of the API key. Output only. Keys are\n * created STATE_ENABLED; use the :disable and :enable actions to\n * transition between states.\n */\n state: ApiKeyState;\n}\n\nexport interface APIKeyInfo {\n /**\n * The profile that created the key.\n */\n createdBy?: Profile;\n}\n\n/**\n * Configuration for an API key.\n */\nexport interface APIKeySpec {\n /**\n * The bearer token used to authenticate as this API key. Returned only on\n * creation and rotation; subsequent reads omit this field.\n */\n token: string;\n /**\n * Free-form description of what this API key is used for.\n */\n description?: string;\n /**\n * Scopes granted to this key. Each entry is a colon-separated\n * resource:verb string (e.g. \"objectives:manage\").\n * \n * Resources: agents, objectives, tools, memory, api_keys, workspaces,\n * widgets, widget_sessions, secrets, account.\n * Verbs: read and manage, where manage implies read — a stored scope set\n * is normalized to drop \"x:read\" when \"x:manage\" is present. The secrets\n * and account resources support only manage. \"*\" is an explicit\n * full-access grant.\n * \n * Scopes are deny-by-default: a key with an empty list can call only\n * scope-free endpoints. Full access is always an explicit \"*\" grant.\n */\n permissions?: Array<string>;\n /**\n * True when this key is managed by the system (i.e. the auto-provisioned\n * global account key). System keys cannot be deleted but can be rotated.\n */\n system: boolean;\n}\n\n/**\n * An account, the top-level organizational unit. Contains workspaces and\n * account-wide settings such as the webhook signing secret.\n */\nexport interface Account {\n metadata: AccountResourceMetadata;\n spec: AccountSpec;\n info: AccountInfo;\n}\n\n/**\n * Server-populated information about the account.\n */\nexport interface AccountInfo {\n /**\n * The generated secret that will sign all webhooks that are sent to your configured Webhook URL.\n * Formatted as \"wh_asdf1234\" per the https://www.standardwebhooks.com/ format.\n */\n webhookEventsHmacSecret: string;\n /**\n * The challenge token Cadenya sends in the X-Cadenya-Challenge-Token header\n * on every MCP tools/list request. Server implementations can accept a valid\n * challenge token in place of per-user auth when listing tools, while still\n * requiring real auth on tools/call. Rotate with RotateChallengeToken; update\n * any servers validating the token before rotating.\n */\n challengeToken: string;\n}\n\n/**\n * AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace.\n */\nexport interface AccountResourceMetadata {\n /**\n * Unique identifier for the resource (prefixed ULID, e.g., \"apikey_01HXK...\")\n */\n id: string;\n /**\n * Account this resource belongs to for multi-tenant isolation (prefixed ULID)\n */\n accountId: string;\n /**\n * Human-readable name for the resource (e.g., \"Customer Support Agent\", \"Email Tool\")\n * Required for resources that users interact with directly\n */\n name: string;\n /**\n * External ID for the resource (e.g., a workflow ID from an external system)\n */\n externalId: string;\n /**\n * Key-value pairs for categorization and filtering. Values are 0-63\n * alphanumeric characters with \"-\", \"_\", or \".\" allowed between; keys\n * follow the same shape and additionally accept an optional DNS-subdomain\n * prefix (e.g. \"cadenya.com/\") of at most 253 characters.\n * Examples: {\"environment\": \"production\", \"team\": \"platform\", \"version\": \"v2\"}\n */\n labels: Record<string, string>;\n profileId: string;\n createdAt?: string;\n}\n\n/**\n * Configuration for an account.\n */\nexport interface AccountSpec {\n description: string;\n domain: string;\n billingEmail: string;\n workspaces: Array<Workspace>;\n}\n\n/**\n * Attach a single tool, tool set, or sub-agent to a variation. Exactly one\n * of the target fields must be set; the assignment kind is inferred from the\n * populated field. Adding an existing target returns AlreadyExists.\n * All targets must be in the variation's workspace and eligible for assignment.\n */\nexport type AddAgentVariationAssignmentRequest =\n | AddAgentVariationAssignmentRequest_ToolId\n | AddAgentVariationAssignmentRequest_ToolSetId\n | AddAgentVariationAssignmentRequest_SubAgentId;\n\n/**\n * Attach a memory layer to a variation. Use UpdateAgentVariationMemoryLayer or\n * replace the spec list to reposition an existing layer. Rejected when:\n * - the layer is already assigned, regardless of position (AlreadyExists)\n * - the layer is system-managed (FailedPrecondition)\n * - the variation is already at the 10-assignment cap (FailedPrecondition)\n * - the position is already in use on this variation (InvalidArgument)\n */\nexport interface AddAgentVariationMemoryLayerRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n /**\n * Layer to attach. Accepts the canonical `memlyr_…` form or the `external_id:<value>` form.\n */\n memoryLayerId: string;\n /**\n * Position in the baseline cascade (lower = more specific). If\n * omitted, the server appends at the most general end (max existing\n * position + 1).\n */\n position?: number;\n}\n\n/**\n * AddWorkspaceMemberRequest grants a profile access to a workspace. Provide\n * exactly one of profile_id (an existing account profile) or email. When email\n * is given, the backend resolves it to an existing account profile or invites a\n * new one before linking it to the workspace via an actor.\n */\nexport interface AddWorkspaceMemberRequest {\n /**\n * The workspace to add the member to (path).\n */\n workspaceId?: string;\n /**\n * An existing account profile to add. Mutually exclusive with email.\n */\n profileId?: string;\n /**\n * Email address to add (resolve-or-invite). Mutually exclusive with profile_id.\n */\n email?: string;\n}\n\n/**\n * The current lifecycle state of the agent. Output only. Agents are created\n * in STATE_DRAFT; use the :publish, :unpublish, :archive, and :unarchive\n * actions to transition between states.\n */\nexport type AgentState = 'STATE_UNSPECIFIED' | 'STATE_DRAFT' | 'STATE_PUBLISHED' | 'STATE_ARCHIVED';\n\n/**\n * Agent resource\n */\nexport interface Agent {\n /**\n * Resource metadata\n */\n metadata: ResourceMetadata;\n /**\n * Agent specification\n */\n spec: AgentSpec;\n /**\n * Agent information\n */\n info: AgentInfo;\n /**\n * The current lifecycle state of the agent. Output only. Agents are created\n * in STATE_DRAFT; use the :publish, :unpublish, :archive, and :unarchive\n * actions to transition between states.\n */\n state: AgentState;\n}\n\n/**\n * AgentInfo contains simple information about an agent for display or quick reference\n */\nexport interface AgentInfo {\n variationCount: number;\n createdBy?: Profile;\n}\n\n/**\n * The current lifecycle state of the schedule. Output only. Schedules are\n * created STATE_ACTIVE; use the :pause, :resume, and :archive actions to\n * transition between states.\n */\nexport type AgentScheduleState = 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_PAUSED' | 'STATE_ARCHIVED';\n\n/**\n * AgentSchedule resource — a recurring trigger attached to an agent that\n * creates objectives on its cadence.\n */\nexport interface AgentSchedule {\n metadata: ResourceMetadata;\n spec: AgentScheduleSpec;\n info: AgentScheduleInfo;\n /**\n * The current lifecycle state of the schedule. Output only. Schedules are\n * created STATE_ACTIVE; use the :pause, :resume, and :archive actions to\n * transition between states.\n */\n state: AgentScheduleState;\n}\n\n/**\n * AgentScheduleInfo provides read-only runtime data about a schedule.\n */\nexport interface AgentScheduleInfo {\n /**\n * When the schedule will next fire. Computed from the spec; absent when\n * the schedule is STATE_PAUSED/STATE_ARCHIVED or has no future fire times.\n */\n nextFireAt?: string;\n /**\n * When the schedule last fired (regardless of objective outcome).\n */\n lastFireAt?: string;\n /**\n * ID of the most recent objective the schedule created.\n */\n lastObjectiveId?: string;\n /**\n * When the schedule most recently skipped a fire (SKIP policy + prior in flight).\n */\n lastSkippedAt?: string;\n /**\n * Reason for the most recent skip (e.g. \"previous objective still running\").\n */\n lastSkipReason?: string;\n /**\n * Lifetime count of objectives created by this schedule.\n */\n totalFires: number;\n createdBy?: Profile;\n}\n\n/**\n * What to do when the previous run is still in flight. Defaults to SKIP.\n */\nexport type AgentScheduleSpecOverlapPolicy = 'OVERLAP_POLICY_UNSPECIFIED' | 'OVERLAP_POLICY_ALLOW' | 'OVERLAP_POLICY_SKIP';\n\n/**\n * AgentScheduleSpec is the user-provided configuration for a schedule.\n */\nexport interface AgentScheduleSpec {\n /**\n * When to fire. Required.\n */\n schedule: AgentScheduleSpec_Schedule;\n /**\n * What to do when the previous run is still in flight. Defaults to SKIP.\n */\n overlapPolicy?: AgentScheduleSpecOverlapPolicy;\n /**\n * Optional explicit first user message passed to CreateObjective on each fire.\n * Becomes the first user message in the objective's chat history. When unset, the\n * fired objective defers to the selected variation's first_user_message_template.\n */\n firstUserMessage?: string;\n /**\n * Optional explicit variation. When unset, the agent's variation_selection_mode\n * chooses per fire.\n */\n variationId?: string;\n /**\n * Optional data rendered into the variation's system_prompt_template when each\n * fired objective is created. If the agent has a system_prompt_data_schema,\n * this must satisfy it.\n */\n systemPromptData?: Record<string, unknown>;\n /**\n * Optional data rendered into the variation's first_user_message_template when\n * each fired objective is created. Separate from `system_prompt_data`, which\n * renders the system prompt template.\n */\n firstUserMessageData?: Record<string, unknown>;\n}\n\n/**\n * Schedule defines WHEN the schedule fires. Temporal-style structured form:\n * a list of calendar rules (wall-clock) and/or interval rules (duration),\n * OR'd together. At least one rule is required.\n */\nexport interface AgentScheduleSpec_Schedule {\n /**\n * Wall-clock rules. May be empty if `intervals` is non-empty.\n */\n calendars?: Array<Schedule_Calendar>;\n /**\n * Duration-based rules. May be empty if `calendars` is non-empty.\n */\n intervals?: Array<Schedule_Interval>;\n /**\n * IANA tz name (e.g. \"America/New_York\"). Required. Applies to calendars;\n * intervals fire on wall-clock cadence anchored in this zone.\n */\n timezone?: string;\n}\n\n/**\n * Controls how variations are automatically selected when creating objectives\n * Defaults to WEIGHTED when unspecified\n */\nexport type AgentSpecVariationSelectionMode = 'VARIATION_SELECTION_MODE_UNSPECIFIED' | 'VARIATION_SELECTION_MODE_RANDOM' | 'VARIATION_SELECTION_MODE_WEIGHTED';\n\n/**\n * Agent specification (user-provided configuration)\n */\nexport interface AgentSpec {\n /**\n * Description of the agent's purpose\n */\n description?: string;\n /**\n * The URL that Cadenya will send events for any objective assigned to the agent.\n */\n webhookEventsUrl?: string;\n /**\n * Controls how variations are automatically selected when creating objectives\n * Defaults to WEIGHTED when unspecified\n */\n variationSelectionMode?: AgentSpecVariationSelectionMode;\n /**\n * SystemPromptDataSchema enforces the shape of system_prompt_data when objectives are created. This is valuable when using liquid formatting in agent\n * variation system prompt templates. The schema is also used when the agent is attached as a sub-agent, as it becomes the tool's input parameter schema.\n * If omitted, the sub-agent schema will be loaded with a simple \"prompt\" free text string as its schema.\n */\n systemPromptDataSchema?: Record<string, unknown>;\n /**\n * Optional output definition for objectives created for this agent.\n * When provided, Cadenya will append a tool to that will be called by the LLM in use by the variant to extract information in the format provided here.\n * Use this option when you want structured data to be created by your objectives.\n */\n outputDefinition?: Record<string, unknown>;\n /**\n * Enable episodic memory for objectives created for this agent.\n * When true, objective creation requires an episodic_memory key and the\n * system finds or creates a memory layer for that (agent, key) pair, letting\n * the agent store and retrieve memories across objectives that share the key.\n * Memory is agent-level so all variations of the agent share the same layers.\n */\n enableEpisodicMemory?: boolean;\n /**\n * How long episodic memories should be retained.\n * Each new objective slides the layer's expiry forward by this duration, and\n * stored entries expire this long after they are written.\n * If not set, episodic memories are retained indefinitely.\n */\n episodicMemoryTtl?: number;\n}\n\n/**\n * AgentVariation resource\n */\nexport interface AgentVariation {\n /**\n * Resource metadata\n */\n metadata: ResourceMetadata;\n /**\n * Variation specification\n */\n spec: AgentVariationSpec;\n /**\n * Read-only summary information\n */\n info: AgentVariationInfo;\n}\n\n/**\n * AgentVariationInfo provides read-only summary information about a variation\n */\nexport interface AgentVariationInfo {\n /**\n * Number of individual tools assigned to this variation\n */\n toolCount: number;\n /**\n * Number of tool sets assigned to this variation\n */\n toolSetCount: number;\n /**\n * Number of sub-agents assigned to this variation\n */\n subAgentCount: number;\n createdBy?: Profile;\n /**\n * Metadata for the model assigned to this variation\n */\n model?: ResourceMetadata;\n /**\n * Thompson Sampling score: posterior mean of Beta(ts_alpha, ts_beta).\n * Range [0, 1] where 0.5 = neutral, >0.5 = positive, <0.5 = negative.\n */\n score: number;\n /**\n * Total number of objective feedbacks received for this variation\n */\n feedbackCount: number;\n /**\n * Count of memory layer assignments.\n */\n memoryLayerCount: number;\n /**\n * Number of distinct callable tools available through this variation's\n * assignments after normalization. Expands tool sets and deduplicates tools\n * also assigned directly. Each sub-agent contributes one callable tool;\n * its own assignments are not expanded. Counts the full normalized set,\n * regardless of which tools progressive discovery has loaded.\n */\n effectiveToolCount: number;\n /**\n * Current display metadata for targets explicitly referenced by\n * spec.assignments and spec.memory_layer_assignments, keyed by canonical\n * resource ID. Includes tools, tool sets, sub-agents, and memory layers in\n * one map; each value's id equals its key. Does not expand tools within\n * assigned tool sets or assignments within sub-agents.\n * Populated whenever info is returned; empty when there are no assignments.\n * Missing or inaccessible targets are omitted, and names may be absent.\n * Clients use spec for assignment type/order and fall back to the ID when\n * display metadata is unavailable. This map never accepts assignment writes.\n */\n assignmentMetadata: Record<string, BareMetadata>;\n}\n\n/**\n * AgentVariationSpec defines the complete operational configuration for a\n * variation, including assignments. Reads always populate both assignment lists,\n * even when include_info is false. Create and update validate and persist the\n * configuration atomically: any invalid target or cascade rejects the entire\n * request. Targets must belong to the variation's workspace and pass the same\n * eligibility checks as the dedicated add methods.\n */\nexport interface AgentVariationSpec {\n /**\n * Liquid template for the system prompt of objectives using this variation.\n * Rendered with CreateObjectiveRequest.system_prompt_data into Objective.system_prompt.\n */\n systemPromptTemplate?: string;\n /**\n * ProgressiveDiscovery is an optional config that, when set, will load a Cadenya provided tool that\n * can search for tools in the assigned tool sets or tools.\n * \n * Note: Sub-agents are always loaded as a tool regardless of this value.\n */\n progressiveDiscovery?: AgentVariationSpec_ProgressiveDiscovery;\n /**\n * Execution constraints\n */\n constraints?: AgentVariationSpec_Constraints;\n /**\n * Human-readable description of what this variation does or when it should be used\n */\n description?: string;\n /**\n * Model configuration for this variation\n */\n modelConfig?: AgentVariationSpec_ModelConfig;\n /**\n * Compaction configuration for managing context window limits during long-running objectives.\n * When not set, the system uses a default summarization strategy at 75% context window usage.\n */\n compactionConfig?: AgentVariationSpec_CompactionConfig;\n /**\n * Liquid template for the first user message of objectives using this variation.\n * Rendered with CreateObjectiveRequest.first_user_message_data into\n * Objective.first_user_message, the first user message in the LLM chat history.\n * CreateObjectiveRequest.first_user_message, when set, overrides the rendered\n * result. If neither this template nor first_user_message is present, objective\n * creation is rejected with InvalidArgument.\n */\n firstUserMessageTemplate?: string;\n /**\n * Complete set of assigned tools, tool sets, and sub-agents. Order has no\n * meaning. Duplicate (target kind, canonical target ID) pairs are collapsed.\n * On create, omitted or empty means no assignments. On update, selecting\n * spec.assignments in update_mask replaces the entire set; empty clears it.\n */\n assignments?: Array<VariationAssignment>;\n /**\n * Complete baseline memory cascade, returned in ascending position. At most\n * 10 whole layers; system-managed layers cannot be assigned. Duplicate layer\n * IDs (after alias resolution) or positions are InvalidArgument. Validate the\n * final cascade, so swapping two positions in one update is supported.\n * On create, omitted or empty means no layers. On update, selecting\n * spec.memory_layer_assignments replaces the entire list; empty clears it.\n */\n memoryLayerAssignments?: Array<VariationMemoryLayerAssignment>;\n}\n\n/**\n * CompactionConfig defines how context window compaction behaves for objectives using this variation.\n */\nexport interface AgentVariationSpec_CompactionConfig {\n /**\n * Trigger threshold as a percentage of the model's context window (0.0 to 1.0).\n * When input tokens reach this percentage of the model's limit, compaction triggers.\n * Default: 0.75 (75%)\n */\n triggerThreshold?: number;\n /**\n * Strategies — set one or more. When multiple are set, they execute in order:\n * tool_result_clearing → summarization.\n * When none are set, defaults to summarization with the system default prompt.\n */\n summarization?: CompactionConfig_SummarizationStrategy;\n toolResultClearing?: CompactionConfig_ToolResultClearingStrategy;\n}\n\nexport interface AgentVariationSpec_Constraints {\n /**\n * The maximum number of tool calls that can be made. 0 means no limit.\n */\n maxToolCalls?: number;\n /**\n * The maximum number of sub-objectives that can be created. 0 means no limit.\n */\n maxSubObjectives?: number;\n /**\n * How long an objective may sit with no activity (no user messages, no\n * LLM calls) before it is finalized as timed out. Between 1 minute and\n * 24 hours, expressed as a duration string in seconds (e.g. \"7200s\").\n * When not set, objectives are still swept at the system-wide 24 hour\n * maximum — every objective eventually reaches a terminal state.\n * \n * SDKs represent this as a duration string, like AgentScheduleSpec.every,\n * rather than an integer.\n */\n inactivityTimeout?: string;\n}\n\n/**\n * Reasoning effort. Requires the model's \"reasoning\" capability.\n */\nexport type AgentVariationSpecModelConfigReasoningEffort = 'REASONING_EFFORT_UNSPECIFIED' | 'REASONING_EFFORT_NONE' | 'REASONING_EFFORT_LOW' | 'REASONING_EFFORT_MEDIUM' | 'REASONING_EFFORT_HIGH';\n\n/**\n * ModelConfig defines the model configuration for a variation.\n * \n * Every knob besides model_id is honored only when the assigned model's\n * spec.capabilities lists the matching capability.\n */\nexport interface AgentVariationSpec_ModelConfig {\n /**\n * The model identifier for the agent variation to use. Should be either the reference key (ai-provider.model-name) or the canonical model ID (e.g.: \"model_ABC123\")\n */\n modelId: string;\n /**\n * Sampling temperature for model inference (0.0 to 1.0)\n * Lower values produce more deterministic outputs, higher values increase randomness.\n * Presence-tracked so a deliberate 0.0 (fully deterministic) is\n * distinguishable from unset.\n */\n temperature?: number;\n /**\n * Nucleus sampling: only tokens comprising the top_p probability mass\n * are considered. Requires the model's \"topP\" capability.\n */\n topP?: number;\n /**\n * Only sample from the top_k most likely tokens.\n * Requires the model's \"topK\" capability.\n */\n topK?: number;\n /**\n * Sequences that stop generation when produced. Empty means none.\n * No count cap here — providers impose their own limits (surfaced as\n * the \"stopSequences\" capability's `limit` on the model spec), and it\n * is the caller's responsibility to stay within the selected model's\n * limit. Requires the model's \"stopSequences\" capability.\n */\n stopSequences?: Array<string>;\n /**\n * Cap on output tokens per LLM call. Must not exceed the model's\n * spec.max_output_tokens. Requires the model's \"maxOutputTokens\"\n * capability.\n */\n maxOutputTokens?: number;\n /**\n * Reasoning effort. Requires the model's \"reasoning\" capability.\n */\n reasoningEffort?: AgentVariationSpecModelConfigReasoningEffort;\n /**\n * Prompt/token caching. Requires the model's \"caching\" capability.\n * Presence-tracked tri-state: unset means the default — caching is ON\n * whenever the model has the capability; false opts this variation\n * out; true is an explicit opt-in (equivalent to unset).\n */\n cachingEnabled?: boolean;\n}\n\n/**\n * ProgressiveDiscovery is used to indicate that the agent should automatically discover tools that are not explicitly assigned to it.\n * Max tools is the maximum number of tools that can be discovered per search.\n * Hints are optional hints for tool search. These are used in conjunction with the context-aware tool search and can help select the best tools for the task.\n */\nexport interface AgentVariationSpec_ProgressiveDiscovery {\n /**\n * The most tool names tool_search will load in a single call. Requesting more\n * than this returns an error telling the model to retry in smaller batches --\n * it is a per-call batch limit, not a ceiling on how many tools an objective\n * may end up with.\n */\n maxTools?: number;\n /**\n * Free-text guidance appended to the discoverable-tools appendix in the\n * system prompt. Hints steer the model's choice of tool names; they do not\n * filter or rank anything, because tool_search matches names exactly rather\n * than searching.\n */\n hints?: Array<string>;\n}\n\nexport interface ApproveToolCallRequest {\n workspaceId?: string;\n /**\n * The ID of the objective. Supports \"external_id:\" prefix for external IDs.\n */\n objectiveId?: string;\n /**\n * The ID of the tool call to approve\n */\n toolCallId?: string;\n}\n\n/**\n * Archive agent request\n */\nexport interface ArchiveAgentRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\n/**\n * Archive agent schedule request.\n */\nexport interface ArchiveAgentScheduleRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Schedule ID. Accepts the canonical `as_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\n/**\n * Archive tool set request\n */\nexport interface ArchiveToolSetRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Tool set ID. Accepts the canonical ts_… form or the\n * external_id:<value> form.\n */\n id?: string;\n}\n\n/**\n * Archive widget request.\n */\nexport interface ArchiveWidgetRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Widget ID. Accepts the canonical `wgt_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\nexport interface AssistantMessage {\n content?: string;\n toolCalls: Array<AssistantToolCall>;\n}\n\nexport interface AssistantToolCall {\n tool?: CallableTool;\n arguments: string;\n functionName: string;\n}\n\n/**\n * BareMetadata contains the minimal metadata for a resource: the ID and an\n * optional human-readable name. These are used for reference fields where the\n * full metadata (account scoping, timestamps, labels, external IDs) is not\n * needed — e.g., the assignment metadata inside agent variation info or the\n * tools assigned to an objective. Both fields are server-populated; clients\n * provide IDs through sibling fields rather than by constructing a\n * BareMetadata themselves.\n */\nexport interface BareMetadata {\n id: string;\n /**\n * Human-readable name of the referenced resource, populated by the server\n * on reads for convenience. Absent on references to resources that do not\n * have a name.\n */\n name?: string;\n}\n\n/**\n * BedrockConfig selects the AWS source Region used for Bedrock Runtime calls.\n */\nexport interface BedrockConfig {\n region?: string;\n}\n\n/**\n * CallableTool is a union that represents a tool that can be called by an agent. In Cadenya, a tool that is used within an agent objective\n * might be a user-defined tool (IE: MCP, HTTP), another Agent (useful to separate context), or a Cadenya Tool (one Cadenya provides).\n */\nexport type CallableTool =\n | CallableTool_Tool\n | CallableTool_Agent\n | CallableTool_CadenyaProvidedTool;\n\nexport interface CancelObjectiveRequest {\n workspaceId?: string;\n /**\n * The ID of the objective. Supports \"external_id:\" prefix for external IDs.\n */\n objectiveId?: string;\n /**\n * Optional reason for cancellation\n */\n reason?: string;\n}\n\n/**\n * Prompt/token caching (ModelConfig.caching_enabled). A model that\n * cannot cache prompt prefixes simply omits this capability. When the\n * capability is present, caching defaults to ON — a variation opts out\n * by setting caching_enabled to false.\n */\nexport interface Capability_Caching {\n}\n\n/**\n * Per-request output token cap (ModelConfig.max_output_tokens).\n * The effective ceiling is ModelSpec.max_output_tokens.\n */\nexport interface Capability_MaxOutputTokens {\n}\n\n/**\n * How reasoning is enabled for this model. Catalog data used to decide\n * whether thinking is requested for objective iterations on this model.\n */\nexport type CapabilityReasoningMode = 'MODE_UNSPECIFIED' | 'MODE_ADAPTIVE' | 'MODE_BUDGET';\n\n/**\n * Reasoning / extended thinking (ModelConfig.reasoning_effort). A model\n * that does not reason simply omits this capability.\n */\nexport interface Capability_Reasoning {\n /**\n * How reasoning is enabled for this model. Catalog data used to decide\n * whether thinking is requested for objective iterations on this model.\n */\n mode: CapabilityReasoningMode;\n}\n\n/**\n * Custom stop sequences (ModelConfig.stop_sequences).\n */\nexport interface Capability_StopSequences {\n /**\n * Maximum number of stop sequences the model accepts per request.\n * 0 means the provider imposes no meaningful limit.\n */\n limit: number;\n}\n\n/**\n * Sampling temperature (ModelConfig.temperature).\n */\nexport interface Capability_Temperature {\n}\n\n/**\n * Top-k sampling (ModelConfig.top_k).\n */\nexport interface Capability_TopK {\n}\n\n/**\n * Nucleus sampling (ModelConfig.top_p).\n */\nexport interface Capability_TopP {\n}\n\n/**\n * Compact objective request — triggers compaction on a running objective.\n */\nexport interface CompactObjectiveRequest {\n workspaceId?: string;\n /**\n * The ID of the objective. Supports \"external_id:\" prefix for external IDs.\n */\n objectiveId?: string;\n /**\n * Optional compaction config override. When not set, uses the variation's compaction_config.\n */\n compactionConfig?: AgentVariationSpec_CompactionConfig;\n}\n\n/**\n * Compact objective response\n */\nexport interface CompactObjectiveResponse {\n /**\n * The new context window created by the compaction\n */\n contextWindow?: ObjectiveContextWindowData;\n}\n\n/**\n * SummarizationStrategy configures LLM-powered summarization of older conversation turns.\n */\nexport interface CompactionConfig_SummarizationStrategy {\n /**\n * Custom instructions that guide what the summarizer preserves.\n * Replaces the default summarization prompt entirely.\n * Example: \"Preserve all code snippets, variable names, and technical decisions.\"\n */\n instructions?: string;\n}\n\n/**\n * ToolResultClearingStrategy configures clearing of older tool result content.\n */\nexport interface CompactionConfig_ToolResultClearingStrategy {\n /**\n * Number of most recent tool call results to keep intact.\n * Older tool results have their content replaced with \"[result cleared]\"\n * while preserving the assistant tool call message (function name, arguments).\n * Default: 2\n */\n preserveRecentResults?: number;\n}\n\n/**\n * Marks the tool as bare: it has no execution adapter of its own and\n * relies on the parent tool set being a Bare tool set. Present so a\n * webhook consumer can tell a tool is bare from the tool data alone,\n * without cross-referencing the tool set.\n */\nexport interface Config_Bare {\n /**\n * When set, the tool call's result is recorded immediately as this\n * fixed text instead of parking the call to wait for externally\n * supplied content. The tool_called event is still emitted. Useful for\n * tools whose dispatch is the intent (e.g. a frontend renders a\n * component from the call parameters) but whose LLM turn still needs\n * tool-result content.\n */\n alwaysSetResult?: string;\n}\n\nexport type ConfigHttpRequestMethod = 'HTTP_METHOD_UNSPECIFIED' | 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n\nexport interface Config_HTTP {\n requestMethod: ConfigHttpRequestMethod;\n path?: string;\n query?: string;\n headers?: Record<string, string>;\n /**\n * These are only used when the request method is a POST, PUT, or PATCH\n */\n requestBodyTemplate?: string;\n requestBodyContentType?: string;\n}\n\nexport interface Config_MCP {\n /**\n * Tool behavior annotations from the MCP server, captured during sync.\n */\n annotations?: MCP_Annotations;\n}\n\nexport interface Config_OpenAPI {\n path?: string;\n method?: string;\n}\n\n/**\n * ContextLengths is the measured character length of each distinct component\n * of an iteration's assembled context window. Values are raw character\n * lengths of the component as assembled into the request — token estimates\n * are derived by the client against input_tokens (component share =\n * component length / sum of all lengths).\n * \n * New components are added as new fields — wire-compatible; absent\n * components read as 0.\n */\nexport interface ContextLengths {\n /**\n * Character length of the objective's base system prompt (rendered variation\n * template). Not tokens -- see the message comment.\n */\n systemPrompt: number;\n /**\n * Character length of the skills memory appendix attached to the system prompt.\n */\n skillsMemory: number;\n /**\n * Character length of the episodic memory appendix attached to the system prompt.\n */\n episodicMemory: number;\n /**\n * Character length of the discoverable/available-tools appendix attached to the\n * system prompt.\n */\n availableTools: number;\n /**\n * Character length of the serialized tool definitions sent with the completion\n * request (names, descriptions, and JSON-schema parameters).\n */\n toolDefinitions: number;\n /**\n * Character length of the chat history messages with the user role.\n */\n userMessages: number;\n /**\n * Character length of the chat history messages with the assistant role.\n */\n assistantMessages: number;\n /**\n * Character length of the tool results present in the chat history.\n */\n toolResults: number;\n}\n\nexport interface ContextWindowCompacted {\n /**\n * The new context window created by this compaction\n */\n newContextWindow: ObjectiveContextWindowData;\n /**\n * The strategies that were applied during this compaction\n */\n strategies: Array<string>;\n /**\n * Number of messages that were compacted\n */\n messagesCompacted: number;\n /**\n * The summary generated by the summarization strategy, if used.\n */\n summary?: string;\n}\n\nexport interface ContinueObjectiveRequest {\n workspaceId?: string;\n /**\n * The ID of the objective. If you have assigned an external ID to the objective, you can prefix the ID with \"external_id:\". For example, \"external_id:1234567890\". Otherwise, the ID assigned by Cadenya should be used.\n */\n objectiveId?: string;\n /**\n * The message to continue an objective that has completed (or you are enqueing)\n */\n message: string;\n /**\n * When set to true, the message will be enqueued for when the agent loop is available to process it.\n */\n enqueue?: boolean;\n}\n\nexport interface CreateAIProviderKeyRequest {\n /**\n * The workspace that will own this key.\n */\n workspaceId?: string;\n metadata: CreateResourceMetadata;\n spec: AIProviderKeySpec;\n}\n\nexport interface CreateAPIKeyRequest {\n metadata: CreateAccountResourceMetadata;\n spec: APIKeySpec;\n /**\n * The workspace this API key belongs to (path).\n */\n workspaceId?: string;\n}\n\n/**\n * CreateAccountResourceMetadata contains the user-provided fields for creating\n * an account-scoped resource. Read-only fields (id, account_id, profile_id) are excluded\n * since they are set by the server.\n */\nexport interface CreateAccountResourceMetadata {\n /**\n * Human-readable name for the resource (e.g., \"Production API Key\", \"Staging Workspace\")\n */\n name: string;\n /**\n * External ID for the resource (e.g., a workflow ID from an external system)\n */\n externalId?: string;\n /**\n * Key-value pairs for categorization and filtering. Values are 0-63\n * alphanumeric characters with \"-\", \"_\", or \".\" allowed between; keys\n * follow the same shape and additionally accept an optional DNS-subdomain\n * prefix (e.g. \"cadenya.com/\") of at most 253 characters.\n * Examples: {\"environment\": \"production\", \"team\": \"platform\", \"version\": \"v2\"}\n */\n labels?: Record<string, string>;\n}\n\n/**\n * Create agent request\n */\nexport interface CreateAgentRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n metadata: CreateResourceMetadata;\n spec: AgentSpec;\n /**\n * Optional default variation to add to the agent on create. Its spec accepts\n * assignments and memory_layer_assignments using the same atomic validation\n * as CreateAgentVariation. Failure rejects the entire agent creation.\n */\n defaultVariation?: CreateAgentVariationRequest;\n}\n\n/**\n * Create agent schedule request.\n */\nexport interface CreateAgentScheduleRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n metadata: CreateResourceMetadata;\n spec: AgentScheduleSpec;\n}\n\n/**\n * Create agent variation request\n */\nexport interface CreateAgentVariationRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n metadata: CreateResourceMetadata;\n spec: AgentVariationSpec;\n}\n\nexport interface CreateMemoryEntryRequest {\n workspaceId?: string;\n /**\n * Memory layer ID. Accepts canonical memlyr_… form or external_id:<value> form.\n */\n memoryLayerId?: string;\n metadata: CreateResourceMetadata;\n spec: MemoryEntryCreateSpec;\n}\n\nexport interface CreateMemoryLayerRequest {\n workspaceId?: string;\n metadata: CreateResourceMetadata;\n spec: MemoryLayerSpec;\n}\n\n/**\n * Create model request. The model is created on the given AI provider key with\n * PROVENANCE_MANUALLY_ENTERED and STATE_ENABLED. The key must be customer\n * provided and its provider must accept manual definitions (see\n * AIProviderKeyInfo.model_management).\n */\nexport interface CreateModelRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * The AI provider key the model routes through. Accepts the canonical\n * `aipk_…` form or the `external_id:<value>` form.\n */\n aiProviderKeyId?: string;\n metadata: CreateResourceMetadata;\n spec: ModelSpec;\n}\n\n/**\n * Request to submit feedback for an objective\n */\nexport interface CreateObjectiveFeedbackRequest {\n workspaceId?: string;\n /**\n * The ID of the objective. Supports \"external_id:\" prefix for external IDs.\n */\n objectiveId?: string;\n metadata: CreateOperationMetadata;\n data: ObjectiveFeedbackData;\n}\n\nexport interface CreateObjectiveRequest {\n workspaceId: string;\n agentId: string;\n /**\n * Optional explicit variation selection. Overrides the agent's variation_selection_mode.\n */\n variationId?: string;\n metadata?: CreateOperationMetadata;\n /**\n * Arbitrary data rendered into the selected variation's system_prompt_template\n * (liquid) to produce the objective's system prompt. If the agent has a\n * system_prompt_data_schema, this must satisfy it.\n */\n systemPromptData: Record<string, unknown>;\n /**\n * Optional explicit first user message for the LLM chat history. When not set,\n * the selected variation's first_user_message_template is rendered with\n * first_user_message_data instead. If neither this field nor a\n * first_user_message_template is present, the request is rejected with InvalidArgument.\n */\n firstUserMessage?: string;\n /**\n * Secrets that can be used in the headers for tool calls using the secret interpolation format.\n */\n secrets?: Array<CreateObjectiveRequest_Secret>;\n /**\n * Memory layers/entries layered over the baseline cascade inherited\n * from the selected variation — element-level rules over inherited\n * styles, in CSS terms.\n * \n * Array order is resolution order: EARLIER elements are more specific\n * and are consulted first. Entries pinned via memory_entry_id behave\n * as single-entry layers at their position.\n * \n * System-managed layers (e.g., episodic) cannot be referenced here;\n * they attach themselves automatically based on the episodic key.\n * \n * Size cap: the TOTAL effective cascade (this field + the variation's\n * memory layer assignments) must not exceed 10 entries. A request\n * that would produce a larger cascade is rejected with\n * InvalidArgument.\n */\n memoryCascade?: Array<MemoryReference>;\n /**\n * Arbitrary data rendered into the selected variation's first_user_message_template\n * (liquid) to produce the first user message. Separate from `system_prompt_data`,\n * which renders the system prompt template.\n */\n firstUserMessageData?: Record<string, unknown>;\n /**\n * If the agent variation that is selected has episodic memory enabled, then this key is used to create/update a memory layer\n * specific to the episodic memory. The layer may have a TTL configured by the variation.\n */\n episodicMemory?: ObjectiveEpisodicConfig;\n /**\n * Optional tenant assertion — the customer's org/company identifier for the\n * end user this objective serves. Upserts the tenant record in the\n * workspace and associates the objective with it.\n */\n tenant?: TenantAssertion;\n /**\n * Optional subject assertion — the person within the tenant this objective\n * serves. Requires `tenant`; a subject asserted without a tenant is\n * rejected with InvalidArgument.\n */\n subject?: SubjectAssertion;\n /**\n * Parameters forced onto this objective's tool calls. A pinned parameter\n * is removed from the tool schema the LLM sees, and its value is always\n * overwritten server-side with the pinned value — the model cannot choose\n * a different value for it. By default a pinned key applies to every tool\n * with a top-level parameter of the same name; a tool set's overlays\n * (ToolSetSpec.overlays) can bind pinned keys to nested paths, differently\n * named parameters, or a subset of tools.\n */\n pinnedParameters?: Record<string, string>;\n}\n\nexport interface CreateObjectiveRequest_Secret {\n name?: string;\n value?: string;\n}\n\n/**\n * CreateOperationMetadata contains the user-provided fields for creating\n * an operation. Read-only fields (id, account_id, workspace_id, created_at, profile_id)\n * are excluded since they are set by the server.\n */\nexport interface CreateOperationMetadata {\n /**\n * Key-value pairs for categorization and filtering. Values are 0-63\n * alphanumeric characters with \"-\", \"_\", or \".\" allowed between; keys\n * follow the same shape and additionally accept an optional DNS-subdomain\n * prefix (e.g. \"cadenya.com/\") of at most 253 characters.\n * Examples: {\"priority\": \"high\", \"source\": \"api\", \"workflow\": \"onboarding\"}\n */\n labels?: Record<string, string>;\n /**\n * External ID for the operation (e.g., a workflow ID from an external system)\n */\n externalId?: string;\n}\n\n/**\n * CreateResourceMetadata contains the user-provided fields for creating\n * a workspace-scoped resource. Read-only fields (id, account_id, workspace_id, profile_id,\n * created_at) are excluded since they are set by the server.\n */\nexport interface CreateResourceMetadata {\n /**\n * Human-readable name for the resource (e.g., \"Customer Support Agent\", \"Email Tool\")\n */\n name: string;\n /**\n * External ID for the resource (e.g., a workflow ID from an external system)\n */\n externalId?: string;\n /**\n * Key-value pairs for categorization and filtering. Values are 0-63\n * alphanumeric characters with \"-\", \"_\", or \".\" allowed between; keys\n * follow the same shape and additionally accept an optional DNS-subdomain\n * prefix (e.g. \"cadenya.com/\") of at most 253 characters.\n * Examples: {\"environment\": \"production\", \"team\": \"platform\", \"version\": \"v2\"}\n */\n labels?: Record<string, string>;\n}\n\nexport interface CreateToolRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Tool set ID. Accepts the canonical ts_… form or the\n * external_id:<value> form.\n */\n toolSetId?: string;\n metadata: CreateResourceMetadata;\n spec: ToolSpec;\n}\n\nexport interface CreateToolSetRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n metadata: CreateResourceMetadata;\n spec: ToolSetSpec;\n}\n\nexport interface CreateToolSetSecretRequest {\n /**\n * The workspace that owns the tool set.\n */\n workspaceId?: string;\n /**\n * The tool set that will own this secret. Accepts the canonical ts_… form\n * or the external_id:<value> form.\n */\n toolSetId?: string;\n metadata: CreateResourceMetadata;\n spec: ToolSetSecretSpec;\n}\n\nexport interface CreateUploadRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n metadata: CreateResourceMetadata;\n spec: UploadSpec;\n}\n\n/**\n * Create widget request.\n */\nexport interface CreateWidgetRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n metadata: CreateResourceMetadata;\n spec: WidgetSpec;\n}\n\n/**\n * Create widget session request.\n */\nexport interface CreateWidgetSessionRequest {\n /**\n * Workspace ID.\n */\n workspaceId: string;\n metadata?: CreateOperationMetadata;\n spec: WidgetSessionSpec;\n /**\n * Secrets to attach to the session.\n */\n secrets?: Array<CreateWidgetSessionRequest_Secret>;\n}\n\n/**\n * Secret is a named credential attached to the session — typically a token\n * the customer's backend minted for the visitor, so the agent acts against\n * their API as that subject. Values are captured at the boundary, encrypted\n * at rest, appended to every conversation the session creates (re-synced on\n * each turn), and never returned by any API. Session secrets take\n * precedence over workspace and tool-set secrets of the same name.\n */\nexport interface CreateWidgetSessionRequest_Secret {\n name?: string;\n value?: string;\n}\n\nexport interface CreateWorkspaceRequest {\n metadata: CreateAccountResourceMetadata;\n spec: WorkspaceSpec;\n}\n\nexport interface CreateWorkspaceSecretRequest {\n /**\n * The workspace that will own this secret.\n */\n workspaceId?: string;\n metadata: CreateResourceMetadata;\n spec: WorkspaceSecretSpec;\n}\n\n/**\n * CredentialAPIKey carries a single bearer/header API key.\n */\nexport interface CredentialAPIKey {\n apiKey?: string;\n}\n\n/**\n * CredentialAWSAccessKey carries AWS SigV4 credentials. Optional presence is\n * used by credential patches so omitted values remain unchanged.\n */\nexport interface CredentialAWSAccessKey {\n accessKeyId?: string;\n secretAccessKey?: string;\n sessionToken?: string;\n}\n\n/**\n * CredentialGoogleServiceAccount carries an in-memory Google service-account\n * credential document.\n */\nexport interface CredentialGoogleServiceAccount {\n json?: string;\n}\n\n/**\n * CredentialHeaders carries arbitrary HTTP headers sent with every request to\n * the provider (e.g. {\"Authorization\": \"Bearer ...\", \"X-Api-Key\": \"...\"}).\n */\nexport interface CredentialHeaders {\n headers?: Record<string, string>;\n}\n\n/**\n * Delete tenant widget sessions response.\n */\nexport interface DeleteTenantWidgetSessionsResponse {\n /**\n * Number of sessions deleted.\n */\n sessionsDeleted: number;\n /**\n * Number of conversations (objectives) deleted along with the sessions.\n */\n objectivesDeleted: number;\n}\n\nexport interface DenyToolCallRequest {\n workspaceId?: string;\n /**\n * The ID of the objective. Supports \"external_id:\" prefix for external IDs.\n */\n objectiveId?: string;\n /**\n * The ID of the tool call to deny\n */\n toolCallId?: string;\n /**\n * A memo to associate to the tool call denial. Use a memo to steer the LLM to a different decision or usage of the tool.\n */\n memo?: string;\n}\n\nexport interface DisableAPIKeyRequest {\n /**\n * The workspace the API key belongs to (path).\n */\n workspaceId?: string;\n /**\n * The API key to disable.\n */\n id?: string;\n}\n\n/**\n * Disable model request\n */\nexport interface DisableModelRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Model ID\n */\n id?: string;\n}\n\nexport interface EnableAPIKeyRequest {\n /**\n * The workspace the API key belongs to (path).\n */\n workspaceId?: string;\n /**\n * The API key to enable.\n */\n id?: string;\n}\n\n/**\n * Enable model request\n */\nexport interface EnableModelRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Model ID\n */\n id?: string;\n}\n\nexport interface GetObjectiveDiagnosticsResponse {\n /**\n * Context usage from the objective's most recent iteration.\n */\n diagnostics: ObjectiveDiagnostics;\n}\n\nexport interface GetToolSetOpenAPISpecResponse {\n /**\n * The consumed OpenAPI specification as a JSON string.\n */\n spec: string;\n}\n\n/**\n * Contains an arbitrary serialized message along with a @type that describes the type of the serialized message.\n */\nexport interface GoogleProtobufAny {\n /**\n * The type of the serialized message.\n */\n '@type'?: string;\n}\n\nexport interface ListAIProviderKeysResponse {\n items: Array<AIProviderKey>;\n pagination?: Page;\n}\n\nexport interface ListAPIKeysResponse {\n items: Array<APIKey>;\n pagination?: Page;\n}\n\nexport interface ListAccountWorkspacesResponse {\n items: Array<Workspace>;\n pagination?: Page;\n}\n\n/**\n * Response for listing feedback across an agent.\n */\nexport interface ListAgentFeedbackResponse {\n items: Array<ObjectiveFeedback>;\n pagination?: Page;\n}\n\n/**\n * List agent schedules response.\n */\nexport interface ListAgentSchedulesResponse {\n items: Array<AgentSchedule>;\n pagination?: Page;\n}\n\n/**\n * List agent variations response\n */\nexport interface ListAgentVariationsResponse {\n items: Array<AgentVariation>;\n pagination?: Page;\n}\n\nexport interface ListAgentWebhookDeliveriesResponse {\n items: Array<WebhookDelivery>;\n pagination?: Page;\n}\n\n/**\n * List agents response\n */\nexport interface ListAgentsResponse {\n items: Array<Agent>;\n pagination?: Page;\n}\n\nexport interface ListMemoryEntriesResponse {\n items: Array<MemoryEntry>;\n pagination?: Page;\n}\n\nexport interface ListMemoryLayersResponse {\n items: Array<MemoryLayer>;\n pagination?: Page;\n}\n\n/**\n * List models response\n */\nexport interface ListModelsResponse {\n items: Array<Model>;\n pagination?: Page;\n}\n\n/**\n * ListObjectiveContextWindowsResponse is the response to a ListObjectiveContextWindowsRequest\n */\nexport interface ListObjectiveContextWindowsResponse {\n items: Array<ObjectiveContextWindow>;\n pagination?: Page;\n}\n\nexport interface ListObjectiveEventsResponse {\n items: Array<ObjectiveEvent>;\n pagination?: Page;\n}\n\n/**\n * Response for listing feedback\n */\nexport interface ListObjectiveFeedbackResponse {\n items: Array<ObjectiveFeedback>;\n pagination?: Page;\n}\n\nexport interface ListObjectiveToolCallsResponse {\n items: Array<ObjectiveToolCall>;\n pagination?: Page;\n}\n\nexport interface ListObjectiveToolsResponse {\n items: Array<ObjectiveTool>;\n pagination?: Page;\n}\n\nexport interface ListObjectivesResponse {\n items: Array<Objective>;\n pagination?: Page;\n}\n\nexport interface ListProfilesResponse {\n items: Array<Profile>;\n pagination?: Page;\n}\n\n/**\n * List tenant subjects response.\n */\nexport interface ListTenantSubjectsResponse {\n items: Array<Subject>;\n pagination?: Page;\n}\n\n/**\n * List tenants response.\n */\nexport interface ListTenantsResponse {\n items: Array<Tenant>;\n pagination?: Page;\n}\n\nexport interface ListToolSetEventsResponse {\n items: Array<ToolSetEvent>;\n pagination?: Page;\n}\n\nexport interface ListToolSetSecretsResponse {\n items: Array<ToolSetSecret>;\n pagination?: Page;\n}\n\nexport interface ListToolSetUsageResponse {\n items: Array<ToolSetUsage>;\n pagination?: Page;\n}\n\nexport interface ListToolSetsResponse {\n items: Array<ToolSet>;\n pagination?: Page;\n}\n\nexport interface ListToolsResponse {\n items: Array<Tool>;\n pagination?: Page;\n}\n\n/**\n * List widget sessions response.\n */\nexport interface ListWidgetSessionsResponse {\n items: Array<WidgetSession>;\n pagination?: Page;\n}\n\n/**\n * List widgets response.\n */\nexport interface ListWidgetsResponse {\n items: Array<Widget>;\n pagination?: Page;\n}\n\nexport interface ListWorkspaceMembersResponse {\n items: Array<WorkspaceMember>;\n pagination?: Page;\n}\n\nexport interface ListWorkspaceSecretsResponse {\n items: Array<WorkspaceSecret>;\n pagination?: Page;\n}\n\nexport interface ListWorkspacesResponse {\n items: Array<Workspace>;\n pagination?: Page;\n}\n\n/**\n * Behavior hints synced from the MCP server's tool definition\n * (ToolAnnotations in the MCP specification). All hints are advisory:\n * servers are not required to send them, and clients should not rely\n * on them for security decisions. Absent hints keep the MCP spec\n * defaults (destructiveHint and openWorldHint default to true;\n * readOnlyHint and idempotentHint default to false).\n */\nexport interface MCP_Annotations {\n /**\n * A human-readable title for the tool.\n */\n title?: string;\n /**\n * If true, the tool does not modify its environment.\n */\n readOnlyHint?: boolean;\n /**\n * If true, the tool may perform destructive updates to its environment.\n * Only meaningful when read_only_hint is false.\n */\n destructiveHint?: boolean;\n /**\n * If true, calling the tool repeatedly with the same arguments has no\n * additional effect. Only meaningful when read_only_hint is false.\n */\n idempotentHint?: boolean;\n /**\n * If true, the tool may interact with an \"open world\" of external\n * entities (e.g. web search); if false, its domain is closed.\n */\n openWorldHint?: boolean;\n}\n\n/**\n * MemoryEntry is a single keyed value within a MemoryLayer. Entries are\n * addressed by their key, which follows the S3 object key safe-character\n * convention (see MemoryEntrySpec.key for the full rule). Keys are unique\n * within a single layer; the same key may appear in multiple layers, in which\n * case the cascade walk determines which one wins for a given objective (most\n * specific layer first).\n * \n * MemoryEntry is the summary shape, returned by ListMemoryEntries. It does\n * not carry the entry body — callers that need the body must fetch the entry\n * individually via GetMemoryEntry, which returns a MemoryEntryDetail.\n */\nexport interface MemoryEntry {\n metadata: ResourceMetadata;\n spec: MemoryEntrySpec;\n info: MemoryEntryInfo;\n}\n\n/**\n * MemoryEntryCreateSpec is the input shape for CreateMemoryEntry. It accepts\n * either inline content or a reference to a completed Upload; exactly one of\n * the two must be set.\n */\nexport type MemoryEntryCreateSpec =\n | MemoryEntryCreateSpec_Content\n | MemoryEntryCreateSpec_UploadId;\n\n/**\n * MemoryEntryDetail is the full representation of an entry, including the\n * resolved content body. Returned by GetMemoryEntry, CreateMemoryEntry, and\n * UpdateMemoryEntry.\n */\nexport interface MemoryEntryDetail {\n metadata: ResourceMetadata;\n spec: MemoryEntrySpec;\n info: MemoryEntryInfo;\n /**\n * The resolved body of the entry. For entries created or updated via an\n * upload_id, this is the ingested content, not the original upload handle.\n * May be empty; an entry with only a key and description is valid\n * (e.g., a stub skill being drafted, or an entry where the frontmatter\n * alone is the payload).\n */\n content: string;\n}\n\nexport interface MemoryEntryInfo {\n /**\n * The layer this entry belongs to.\n */\n memoryLayer?: ResourceMetadata;\n createdBy?: Profile;\n}\n\n/**\n * MemoryEntrySpec is the metadata portion of an entry — the fields that\n * identify and describe it, without the body. It appears on both the summary\n * (MemoryEntry) and detail (MemoryEntryDetail) views.\n */\nexport interface MemoryEntrySpec {\n /**\n * The lookup key for this entry within its layer. Must conform to the S3\n * object key safe-characters spec: ASCII alphanumerics and the special\n * characters !, -, _, ., *, ', (, ), and /. Forward slashes may be used to\n * suggest hierarchy (e.g., \"skills/postmortem/write\"), but lookups are flat\n * — the key is a single opaque string, not a path.\n * \n * Additional rules enforced by the service:\n * - May not begin or end with /\n * - May not contain consecutive slashes (//)\n * - May not begin with reserved prefixes (cadenya/, system/)\n * - Case-sensitive\n * - Unique within the parent layer\n * \n * For skills entries, this key is what the model passes to get_memory to\n * load the entry's content.\n */\n key: string;\n /**\n * One-line \"when to use this\" hint shown in the frontmatter manifest for\n * skills entries. The model uses this to decide whether to load the body,\n * so it should be written for the model as the audience. Ignored for layer\n * types that do not advertise frontmatter.\n */\n description: string;\n}\n\n/**\n * MemoryEntryUpdateSpec is the input shape for UpdateMemoryEntry. Fields\n * present in the request's update_mask are applied; unset fields are left\n * alone. The source oneof is optional for updates — omit it to leave the\n * body untouched, or set exactly one branch to replace it.\n */\nexport interface MemoryEntryUpdateSpec {\n key?: string;\n description?: string;\n content?: string;\n uploadId?: string;\n}\n\n/**\n * MemoryLayer is a named container of memory entries that can be composed into\n * an objective's memory cascade. Layers are workspace-scoped resources. The layer\n * type controls how its entries participate in the agent loop — see\n * MemoryLayerType for details.\n * \n * See \"Memory cascade composition\" above for how layers compose at lookup time.\n */\nexport interface MemoryLayer {\n metadata: ResourceMetadata;\n spec: MemoryLayerSpec;\n info: MemoryLayerInfo;\n}\n\nexport interface MemoryLayerInfo {\n /**\n * Number of entries currently in this layer.\n */\n entryCount: number;\n createdBy?: Profile;\n /**\n * Timestamp of the most recent objective that resolved against this layer.\n * Useful for surfacing unused layers in the dashboard.\n */\n lastUsedAt?: string;\n /**\n * For episodic layers, the metadata of the agent the layer belongs to\n * (resolved from MemoryLayerSpec.agent_id). Unset for non-episodic layers.\n */\n agent?: ResourceMetadata;\n}\n\nexport type MemoryLayerSpecType = 'MEMORY_LAYER_TYPE_UNSPECIFIED' | 'MEMORY_LAYER_TYPE_EPISODIC' | 'MEMORY_LAYER_TYPE_SKILLS';\n\nexport interface MemoryLayerSpec {\n type: MemoryLayerSpecType;\n /**\n * Human-readable description of the layer's purpose. Encouraged for\n * user-created layers; system-managed layers may have a generated description.\n */\n description?: string;\n /**\n * Server-set. True for layers managed by the system (e.g., episodic layers\n * created automatically when an objective uses an episodic_key). System-managed\n * layers cannot be assigned to objective cascades via the API and cannot be\n * mutated by clients — their lifecycle is controlled entirely by the runtime.\n */\n systemManaged: boolean;\n /**\n * For layers with a finite lifetime (e.g., episodic), the time at which the\n * layer becomes eligible for cleanup. Set by the system; unset for\n * persistent layers.\n */\n expiresAt?: string;\n /**\n * Server-set on episodic layers: the agent this layer belongs to. Unset for\n * non-episodic layers.\n */\n agentId: string;\n /**\n * Server-set on episodic layers: the caller-supplied episodic key the layer\n * was created for. Unset for non-episodic layers.\n */\n episodicKey: string;\n}\n\n/**\n * MemoryRead is emitted each time the agent resolves a key against the\n * memory cascade and loads an entry. Lookups that miss (key not found in\n * any layer) do not emit this event.\n */\nexport interface MemoryRead {\n /**\n * Human-readable description of the read, set by the runtime. For\n * example: \"Loaded skill\", \"Resolved context key\". Not machine-parsed;\n * intended for UI display alongside the other events in an objective's\n * timeline.\n */\n message: string;\n /**\n * The layer the entry resolved to. The top-most layer that contained\n * the key — other layers beneath it that also contained the key are\n * shadowed and not referenced here.\n */\n memoryLayerId: string;\n /**\n * The specific entry that was read.\n */\n memoryEntryId: string;\n}\n\n/**\n * MemoryReference identifies a memory layer or a specific entry within\n * one, for composition into a memory cascade. Used on objectives (where\n * entry pinning is permitted).\n * \n * memory_layer_id accepts both the canonical form (memlyr_…) and the\n * external-id form (external_id:my-custom-id). The same applies to\n * memory_entry_id when set.\n */\nexport interface MemoryReference {\n memoryLayerId: string;\n /**\n * When set, inserts only this entry from memory_layer_id into the cascade —\n * behaves as a single-entry layer (only this key resolves at this\n * position). The entry must belong to memory_layer_id; mismatches are\n * rejected with InvalidArgument.\n */\n memoryEntryId?: string;\n}\n\n/**\n * Whether the model is usable in this workspace. Output only. Use the\n * :enable and :disable actions to transition.\n */\nexport type ModelState = 'STATE_UNSPECIFIED' | 'STATE_ENABLED' | 'STATE_DISABLED';\n\n/**\n * Where this definition came from. Output only; set at creation. Synced\n * models reject edits to metadata.name and spec, manually entered models\n * accept them.\n */\nexport type ModelProvenance = 'PROVENANCE_UNSPECIFIED' | 'PROVENANCE_SYNCED_FROM_PROVIDER' | 'PROVENANCE_MANUALLY_ENTERED';\n\nexport interface Model {\n /**\n * Resource metadata\n */\n metadata: ResourceMetadata;\n /**\n * Model specification\n */\n spec: ModelSpec;\n /**\n * Server-populated info (e.g. the AI provider this model routes through).\n * Populated on reads when requested; see ListModelsRequest.include_info.\n */\n info?: ModelInfo;\n /**\n * Whether the model is usable in this workspace. Output only. Use the\n * :enable and :disable actions to transition.\n */\n state: ModelState;\n /**\n * Where this definition came from. Output only; set at creation. Synced\n * models reject edits to metadata.name and spec, manually entered models\n * accept them.\n */\n provenance: ModelProvenance;\n /**\n * Customer price overrides. Output only here; set through UpdateModel with\n * pricing_override.* mask paths. When an override is present, spec's price\n * fields already reflect it (they are the effective prices).\n */\n pricingOverride?: ModelPricingOverride;\n /**\n * The rates before any customer override: the catalog rate for a synced\n * model, the entered rate for a manually entered one. Output only. When a\n * side matches the spec price, an override may still be present; inspect\n * pricing_override field presence to determine whether an override is set.\n */\n basePricing: ModelBasePricing;\n}\n\n/**\n * ModelBasePricing is a model's default rates in cents per million tokens,\n * unaffected by pricing overrides. Zero means the rate is not known.\n */\nexport interface ModelBasePricing {\n /**\n * Default input token rate, in cents per million tokens.\n */\n inputPricePerMillionTokens: string;\n /**\n * Default output token rate, in cents per million tokens.\n */\n outputPricePerMillionTokens: string;\n}\n\n/**\n * ModelInfo carries server-derived, read-only details about a model.\n */\nexport interface ModelInfo {\n /**\n * The AI provider key powering this model, embedded so clients can read the\n * provider, key name, and promotional status (info.is_promotional) without a\n * second lookup. The key's model counts are not populated here; use the AI\n * provider key endpoints for those.\n */\n aiProviderKey?: AIProviderKey;\n /**\n * Number of agent variations currently provisioned on this model. Useful for\n * previewing how many variations a swap would affect.\n */\n agentVariationCount: number;\n /**\n * Represents the last time this model was used in an agent objective\n */\n lastUsedAt?: string;\n}\n\n/**\n * ModelPricingOverride replaces the catalog prices for a model. Each field is\n * independent: an absent field keeps the catalog price, a present field (zero\n * included) replaces it. Prices are cents per million tokens.\n */\nexport interface ModelPricingOverride {\n /**\n * Override for input token price, in cents per million tokens.\n */\n inputPricePerMillionTokens?: string;\n /**\n * Override for output token price, in cents per million tokens.\n */\n outputPricePerMillionTokens?: string;\n}\n\nexport interface ModelSpec {\n /**\n * The model provider (e.g., \"anthropic\", \"openai\", \"google\")\n */\n provider: string;\n /**\n * The model family (e.g., \"claude-sonnet-4.6\", \"gpt-5.4\", \"gemini-2.5-flash\")\n */\n family: string;\n /**\n * Maximum number of input tokens the model supports\n */\n maxInputTokens: number;\n /**\n * Maximum number of output tokens the model can generate\n */\n maxOutputTokens: number;\n /**\n * Cost per million input tokens in cents (e.g., 300 = $3.00). On reads this\n * is the effective price: the catalog price unless\n * Model.pricing_override replaces it. Writes only apply to manually\n * entered models; use UpdateModel's pricing_override paths to override a\n * synced model's price.\n */\n inputPricePerMillionTokens: string;\n /**\n * Cost per million output tokens in cents (e.g., 1500 = $15.00). Effective\n * price on reads, see input_price_per_million_tokens.\n */\n outputPricePerMillionTokens: string;\n /**\n * The inference knobs this model supports. Catalog data; drives which\n * ModelConfig fields a variation on this model may set. Reasoning support\n * (and its mode) lives here too, as the \"reasoning\" capability.\n */\n capabilities: Array<ModelSpec_Capability>;\n /**\n * The identifier the provider expects in inference requests, exactly as the\n * provider spells it: an OpenAI model name, a Vertex publisher model\n * resource, a Bedrock inference-profile ID or ARN, or an OpenAI-compatible\n * endpoint's model ID. Distinct from metadata.external_id, which is\n * Cadenya's slug. Verified with a minimal provider completion on creation\n * and whenever the identifier changes.\n */\n providerModelId: string;\n}\n\n/**\n * Capability describes one inference knob this model supports, with any\n * model-specific parameters for it. A variation's ModelConfig may only\n * set a knob whose capability is listed on the model's spec.\n */\nexport type ModelSpec_Capability =\n | ModelSpec_Capability_Temperature\n | ModelSpec_Capability_TopP\n | ModelSpec_Capability_TopK\n | ModelSpec_Capability_StopSequences\n | ModelSpec_Capability_MaxOutputTokens\n | ModelSpec_Capability_Reasoning\n | ModelSpec_Capability_Caching;\n\nexport type NoticeLevel = 'LEVEL_UNSPECIFIED' | 'LEVEL_INFO' | 'LEVEL_WARN';\n\n/**\n * Notice is a non-terminal event emitted by the runtime when something\n * noteworthy but non-fatal happens during an objective — for example a\n * just-in-time tool set failing to load, or a previously loaded tool being\n * dropped because it was archived. Notices carry no structured payload; they\n * exist to make the objective timeline self-explanatory.\n */\nexport interface Notice {\n level: NoticeLevel;\n /**\n * Human-readable description of what happened.\n */\n message: string;\n /**\n * Stable machine-readable identifier for the notice kind (for example\n * \"tool_set_load_failed\", \"tool_archived\"). Clients can switch on it or use\n * it as an i18n key; the message is the English fallback.\n */\n key: string;\n}\n\n/**\n * The current lifecycle state of the objective.\n */\nexport type ObjectiveState = 'OBJECTIVE_STATE_UNSPECIFIED' | 'OBJECTIVE_STATE_PENDING' | 'OBJECTIVE_STATE_RUNNING' | 'OBJECTIVE_STATE_WAITING' | 'OBJECTIVE_STATE_FAILED' | 'OBJECTIVE_STATE_CANCELLED' | 'OBJECTIVE_STATE_FINALIZED' | 'OBJECTIVE_STATE_TIMED_OUT';\n\n/**\n * Objective is the data for an objective. It contains the snapshotted fields for the selected agent and variation. Secrets are returned\n * only with their names, and the output definition is copied from the agent's configuration.\n */\nexport interface Objective {\n metadata: OperationMetadata;\n /**\n * The snapshot of the agent and the variation selected (either explicitly or by sampling) will be set here. Cadenya stores\n * the point-in-time snapshot of the configuration used to start an objective and maintains it throughout the entire lifecycle\n * so that changes to agents and variations in the middle of a cycle don't impact the objective itself\n */\n configSnapshot: ObjectiveConfigSnapshot;\n /**\n * The current lifecycle state of the objective.\n */\n state: ObjectiveState;\n /**\n * Optional human-readable detail about the current state (e.g. a failure reason).\n */\n stateMessage: string;\n /**\n * Read-only aggregated info about this objective's execution\n */\n info?: ObjectiveInfo;\n /**\n * system_prompt is read-only, derived from the selected variation's prompt\n */\n systemPrompt: string;\n /**\n * The first user message in the LLM chat history, either provided explicitly at\n * creation or rendered from the variation's first_user_message_template.\n */\n firstUserMessage: string;\n /**\n * A parent objective means the objective was spawned off using a separate agent to complete an objective\n */\n parentObjectiveId: string;\n /**\n * Secrets that can be used in the headers for tool calls using the secret interpolation format.\n */\n secrets: Array<Objective_Secret>;\n /**\n * Arbitrary data rendered into the variation's system_prompt_template\n */\n systemPromptData?: Record<string, unknown>;\n /**\n * Memory layers/entries layered over the baseline cascade inherited\n * from the selected variation — element-level rules over inherited\n * styles, in CSS terms.\n * \n * Array order is resolution order: EARLIER elements are more specific\n * and are consulted first. Entries pinned via memory_entry_id behave\n * as single-entry layers at their position.\n * \n * System-managed layers (e.g., episodic) cannot be referenced here;\n * they attach themselves automatically based on the episodic key.\n * \n * Size cap: the TOTAL effective cascade (this field + the variation's\n * memory layer assignments) must not exceed 10 entries. A request\n * that would produce a larger cascade is rejected with\n * InvalidArgument.\n */\n memoryCascade: Array<MemoryReference>;\n /**\n * The output of the objective, populated when the objective completes. Will match the schema of output_json_schema or output_json_inferred.\n * This will only be set if the state of the objective is set to OBJECTIVE_STATE_FINALIZED\n */\n output?: Record<string, unknown>;\n /**\n * Arbitrary data rendered into the variation's first_user_message_template\n */\n firstUserMessageData?: Record<string, unknown>;\n /**\n * If the agent variation that is selected has episodic memory enabled, then this key is used to create/update a memory layer\n * specific to the episodic memory. The layer may have a TTL configured by the variation.\n */\n episodicMemory?: ObjectiveEpisodicConfig;\n /**\n * Parameters forced onto this objective's tool calls, as provided at\n * creation. See CreateObjectiveRequest.pinned_parameters for semantics.\n */\n pinnedParameters: Record<string, string>;\n}\n\n/**\n * ObjectiveCancelled is the terminal event written when an objective is\n * cancelled. After this event, the objective is super-terminal: no further\n * iterations, compaction, or continuation are permitted.\n */\nexport interface ObjectiveCancelled {\n /**\n * Optional human-readable note recorded at cancel time. Today the workflow\n * sets \"Cancelled\" but this field leaves room for richer reasons (e.g.\n * \"Cancelled by user\", \"Cancelled by schedule sweep\", \"Credit balance exhausted\").\n */\n message: string;\n}\n\n/**\n * ObjectiveConfigSnapshot is the point-in-time snapshot of the agent, variation, and\n * (when applicable) schedule that an objective was started with.\n */\nexport interface ObjectiveConfigSnapshot {\n agent: Agent;\n agentVariation: AgentVariation;\n agentSchedule?: AgentSchedule;\n}\n\n/**\n * ObjectiveContextWindow is a window of chat completions that is grouped together to prevent context-window overflows. Context windows also allow\n * agents to compact their windows and carry on into a new one.\n */\nexport interface ObjectiveContextWindow {\n metadata: OperationMetadata;\n data: ObjectiveContextWindowData;\n info?: ObjectiveContextWindowInfo;\n}\n\nexport interface ObjectiveContextWindowData {\n /**\n * The objective's ID that this window belongs to\n */\n objectiveId: string;\n /**\n * sequence is a numeric representation of which context window this is. Sequences are useful to perform a max(sequence) on in order\n * to calculate how many context windows an objective has.\n */\n sequence: number;\n /**\n * A calculated value for how many prompt tokens (input tokens) have been used in this context window\n */\n promptTokens: number;\n /**\n * A calculated value for how many completion tokens (output tokens) have been used in this context window\n */\n completionTokens: number;\n /**\n * The instructions for this window to continue from a previous window's chat history.\n */\n previousWindowContinueInstructions: string;\n}\n\nexport interface ObjectiveContextWindowInfo {\n objective?: OperationMetadata;\n createdBy?: Profile;\n}\n\n/**\n * Context-usage breakdown measured for a single iteration at request-assembly\n * time. It reports how much of the context window each component occupies so\n * tool parameters, memory cascades, and prompts can be tuned against real\n * token usage.\n */\nexport interface ObjectiveDiagnostics {\n /**\n * Measured character lengths per context component.\n */\n contextLengths: ContextLengths;\n /**\n * Input tokens reported by the LLM provider for the iteration's completion.\n */\n inputTokens: number;\n /**\n * The portion of input_tokens served from the provider's prompt cache.\n * Lets clients distinguish \"big but cached\" from \"big and paid fresh\n * every iteration\".\n */\n cachedInputTokens: number;\n}\n\n/**\n * Episodic is used to configure the episodic memory for the objective\n */\nexport interface ObjectiveEpisodicConfig {\n /**\n * The caller-supplied episodic key. Objectives created with the same key\n * (for the same agent) share one episodic memory layer.\n */\n key: string;\n /**\n * The episodic memory layer resolved (created or reused) for this\n * objective's key. Populated by the system at objective creation.\n */\n memoryLayerId: string;\n}\n\nexport interface ObjectiveError {\n type: string;\n message: string;\n}\n\nexport interface ObjectiveEvent {\n /**\n * Durable events use objevt_ IDs, the only IDs accepted as reconnect\n * cursors. Live-only heartbeats use hb_ IDs and have no SSE id: field.\n */\n metadata: OperationMetadata;\n data: ObjectiveEventData;\n contextWindowId: string;\n info?: ObjectiveEventInfo;\n /**\n * Elapsed time of the work this event records, when it is known at\n * write time (e.g. assistant message generation, tool execution for\n * result/error events). Unset means the event is instantaneous or the\n * duration is not measurable. Serialized as a canonical duration\n * string (e.g. \"4.1s\"). Always set together with started_at.\n */\n duration?: string;\n /**\n * When the work this event records began. Set together with duration,\n * so the work interval is [started_at, started_at + duration]. The\n * event's created_at remains the time the event was persisted.\n */\n startedAt?: string;\n}\n\nexport type ObjectiveEventData =\n | ObjectiveEventData_UserMessage\n | ObjectiveEventData_ToolApprovalRequested\n | ObjectiveEventData_ToolApproved\n | ObjectiveEventData_ToolDenied\n | ObjectiveEventData_ToolCalled\n | ObjectiveEventData_Error\n | ObjectiveEventData_AssistantMessage\n | ObjectiveEventData_ToolResult\n | ObjectiveEventData_ToolError\n | ObjectiveEventData_ContextWindowCompacted\n | ObjectiveEventData_MemoryRead\n | ObjectiveEventData_Cancelled\n | ObjectiveEventData_SubAgentSpawned\n | ObjectiveEventData_SubAgentUpdated\n | ObjectiveEventData_Finalized\n | ObjectiveEventData_Notice\n | ObjectiveEventData_TimedOut\n | ObjectiveEventData_Reasoning\n | ObjectiveEventData_StateChanged\n | ObjectiveEventData_Heartbeat;\n\nexport interface ObjectiveEventInfo {\n objective?: OperationMetadata;\n createdBy: Profile;\n}\n\n/**\n * ObjectiveFeedback represents feedback submitted for an objective's execution.\n * Feedback is used to score agent variations and improve agent performance over time.\n */\nexport interface ObjectiveFeedback {\n metadata: OperationMetadata;\n data: ObjectiveFeedbackData;\n info: ObjectiveFeedbackInfo;\n}\n\nexport interface ObjectiveFeedbackData {\n /**\n * A score between -1.0 and 1.0 representing the quality of the objective's execution.\n * -1.0 is the worst possible score, 0.0 is neutral, and 1.0 is the best.\n */\n score?: number;\n /**\n * Optional human-readable comment explaining the feedback\n */\n comment?: string;\n}\n\nexport interface ObjectiveFeedbackInfo {\n /**\n * The profile that submitted the feedback\n */\n submittedBy: Profile;\n /**\n * The objective the feedback was submitted for.\n */\n objective?: BareMetadata;\n /**\n * The agent variation that executed the objective this feedback is about.\n */\n agentVariation?: BareMetadata;\n}\n\n/**\n * ObjectiveFinalized is the terminal event written when an objective is\n * finalized. After this event, the objective is super-terminal: no further\n * iterations, compaction, or continuation are permitted.\n */\nexport interface ObjectiveFinalized {\n /**\n * If the objective was created with an output schema, and the agent\n * successfully completed the objective, this field will contain the\n * structured output of the objective.\n */\n output?: Record<string, unknown>;\n}\n\n/**\n * ObjectiveHeartbeat reports recent execution liveness. It is transient:\n * delivered only on live streams, never stored in event history or delivered\n * to webhooks. Its hb_ event ID is not a reconnect cursor. Heartbeats do not\n * change objective state or promise progress from the model.\n */\nexport interface ObjectiveHeartbeat {\n}\n\n/**\n * ObjectiveInfo provides read-only aggregated statistics about an objective's execution\n */\nexport interface ObjectiveInfo {\n /**\n * Total number of events generated during this objective's execution\n */\n totalEvents: number;\n /**\n * Total number of tool calls made during execution\n */\n totalToolCalls: number;\n /**\n * Total input tokens consumed across all LLM completions across all context windows\n */\n totalInputTokens: number;\n /**\n * Total output tokens generated across all LLM completions across all context windows\n */\n totalOutputTokens: number;\n /**\n * Total number of context windows that this objective has generated\n */\n totalContextWindows: number;\n totalIterations: number;\n createdBy: Profile;\n /**\n * The effective memory cascade at objective creation time: the\n * episodic layer (when present), then Objective.memory_cascade, then\n * the variation's baseline layers by ascending position. Order is\n * resolution order — index 0 is the most specific and is consulted\n * first; the first layer containing a key wins. Returned on reads so\n * clients can see exactly what the objective resolves against without\n * re-joining variation state.\n */\n effectiveMemoryCascade: Array<MemoryReference>;\n /**\n * Agent details (not snapshotted).\n */\n agent: ResourceMetadata;\n /**\n * Agent variation details (not snapshotted).\n */\n agentVariation: ResourceMetadata;\n /**\n * ID of the objective's current (most recent) context window. Hydrated on\n * demand; empty when the objective has not yet produced a context window.\n */\n currentContextWindowId: string;\n /**\n * The tenant this objective is associated with, when one was asserted at\n * creation (directly or via a widget session).\n */\n tenant?: TenantReference;\n /**\n * The subject (person within the tenant) this objective is associated\n * with, when one was asserted at creation.\n */\n subject?: SubjectReference;\n /**\n * The widget this objective's conversation ran through, when it was\n * created via a widget session.\n */\n widget?: BareMetadata;\n}\n\n/**\n * The state before this write. OBJECTIVE_STATE_UNSPECIFIED when the\n * objective was just created.\n */\nexport type ObjectiveStateChangedFromState = 'OBJECTIVE_STATE_UNSPECIFIED' | 'OBJECTIVE_STATE_PENDING' | 'OBJECTIVE_STATE_RUNNING' | 'OBJECTIVE_STATE_WAITING' | 'OBJECTIVE_STATE_FAILED' | 'OBJECTIVE_STATE_CANCELLED' | 'OBJECTIVE_STATE_FINALIZED' | 'OBJECTIVE_STATE_TIMED_OUT';\n\n/**\n * The state after this write.\n */\nexport type ObjectiveStateChangedToState = 'OBJECTIVE_STATE_UNSPECIFIED' | 'OBJECTIVE_STATE_PENDING' | 'OBJECTIVE_STATE_RUNNING' | 'OBJECTIVE_STATE_WAITING' | 'OBJECTIVE_STATE_FAILED' | 'OBJECTIVE_STATE_CANCELLED' | 'OBJECTIVE_STATE_FINALIZED' | 'OBJECTIVE_STATE_TIMED_OUT';\n\n/**\n * ObjectiveStateChanged is written every time the objective's lifecycle state\n * is set, including the initial move into OBJECTIVE_STATE_PENDING at creation. Terminal\n * transitions also write their dedicated event (cancelled, timedOut,\n * finalized, error) immediately before this one, so consumers that only care\n * about the outcome can keep listening for those.\n */\nexport interface ObjectiveStateChanged {\n /**\n * The state before this write. OBJECTIVE_STATE_UNSPECIFIED when the\n * objective was just created.\n */\n fromState: ObjectiveStateChangedFromState;\n /**\n * The state after this write.\n */\n toState: ObjectiveStateChangedToState;\n /**\n * The status message recorded with the transition, if any (e.g.\n * \"Continued\", or the error summary on a failure).\n */\n message?: string;\n}\n\n/**\n * ObjectiveTimedOut is the terminal event written when an objective is\n * finalized by the inactivity sweep because it saw no activity (no user\n * messages, no LLM calls) within its variation's inactivity timeout — or the\n * system-wide 24 hour maximum when no timeout is configured. The objective\n * produces no output. After this event, the objective is super-terminal: no\n * further iterations, compaction, or continuation are permitted.\n */\nexport interface ObjectiveTimedOut {\n /**\n * Human-readable note recorded at timeout time (e.g. \"Timed out after 2h\n * of inactivity\").\n */\n message: string;\n}\n\n/**\n * ObjectiveTool represents a tool that was assigned to an objective.\n */\nexport interface ObjectiveTool {\n metadata: BareMetadata;\n /**\n * Snapshot of the tool at the time it was assigned to the objective. Because tools can change over time, snapshots\n * are used to ensure tools don't change unexpectedly during an objective's lifecycle.\n */\n snapshot: Tool;\n}\n\n/**\n * Current status of the tool call\n */\nexport type ObjectiveToolCallStatus = 'TOOL_CALL_STATUS_UNSPECIFIED' | 'TOOL_CALL_STATUS_AUTO_APPROVED' | 'TOOL_CALL_STATUS_WAITING_FOR_APPROVAL' | 'TOOL_CALL_STATUS_APPROVED' | 'TOOL_CALL_STATUS_DENIED';\n\nexport type ObjectiveToolCallExecutionStatus = 'TOOL_CALL_EXECUTION_STATUS_UNSPECIFIED' | 'TOOL_CALL_EXECUTION_STATUS_PENDING' | 'TOOL_CALL_EXECUTION_STATUS_RUNNING' | 'TOOL_CALL_EXECUTION_STATUS_COMPLETED' | 'TOOL_CALL_EXECUTION_STATUS_ERRORED' | 'TOOL_CALL_EXECUTION_STATUS_WAITING_FOR_CONTENT';\n\n/**\n * ObjectiveToolCall is a record of a tool call made during an objective's execution.\n * Tool calls are mutable — their status changes as they are approved, denied, or executed.\n */\nexport interface ObjectiveToolCall {\n metadata: OperationMetadata;\n data: ObjectiveToolCallData;\n /**\n * Current status of the tool call\n */\n status: ObjectiveToolCallStatus;\n info?: ObjectiveToolCallInfo;\n executionStatus: ObjectiveToolCallExecutionStatus;\n}\n\nexport interface ObjectiveToolCallData {\n /**\n * The tool that was called\n */\n callable: CallableTool;\n /**\n * The arguments passed to the tool\n */\n arguments: Record<string, unknown>;\n /**\n * A memo supplied by the reviewer when denying the tool call\n */\n memo?: string;\n /**\n * The profile that changed the status of this tool call. Set when the status is changed to APPROVED or DENIED by a user.\n */\n statusChangedBy?: Profile;\n /**\n * List of resolved secrets used by the tool call\n */\n resolvedSecrets: Array<ResolvedSecret>;\n}\n\nexport interface ObjectiveToolCallInfo {\n objective: OperationMetadata;\n createdBy?: Profile;\n tool?: BareMetadata;\n toolSet?: BareMetadata;\n}\n\n/**\n * ObjectiveToolCallResult is the content a tool returned after execution.\n * Tools can return multiple content blocks, and blocks can be multi-modal\n * (text, image, audio). Media blocks are stored by Cadenya and served as\n * short-lived signed URLs rather than inline bytes.\n */\nexport interface ObjectiveToolCallResult {\n /**\n * The result content as recorded — which is what the model was shown.\n * When a tool set overlay transformed the result (ToolOverlay\n * result_actions), this is the transformed content; the adapter's raw\n * response is kept in the tool call's debug log, not here.\n */\n content: Array<ObjectiveToolCallResult_ContentBlock>;\n}\n\nexport interface ObjectiveToolCallResult_AudioBlock {\n /**\n * Short-lived signed URL to download the stored audio.\n */\n url: string;\n /**\n * IANA media type of the stored audio, e.g. audio/wav.\n */\n mimeType: string;\n /**\n * Size of the stored audio in bytes.\n */\n sizeBytes: string;\n /**\n * When the signed URL expires.\n */\n expiresAt: string;\n}\n\n/**\n * ContentBlock is a single block of tool result content. Exactly one of\n * the variants is set.\n */\nexport type ObjectiveToolCallResult_ContentBlock =\n | ObjectiveToolCallResult_ContentBlock_Text\n | ObjectiveToolCallResult_ContentBlock_Image\n | ObjectiveToolCallResult_ContentBlock_Audio;\n\nexport interface ObjectiveToolCallResult_ImageBlock {\n /**\n * Short-lived signed URL to download the stored image.\n */\n url: string;\n /**\n * IANA media type of the stored image, e.g. image/png.\n */\n mimeType: string;\n /**\n * Size of the stored image in bytes.\n */\n sizeBytes: string;\n /**\n * When the signed URL expires.\n */\n expiresAt: string;\n}\n\nexport interface ObjectiveToolCallResult_TextBlock {\n text: string;\n /**\n * Size of the stored text in bytes. Filled by the server at record time;\n * zero on results recorded before this field existed.\n */\n sizeBytes?: string;\n}\n\n/**\n * Current status of the tool call\n */\nexport type ObjectiveToolCallWithResultStatus = 'TOOL_CALL_STATUS_UNSPECIFIED' | 'TOOL_CALL_STATUS_AUTO_APPROVED' | 'TOOL_CALL_STATUS_WAITING_FOR_APPROVAL' | 'TOOL_CALL_STATUS_APPROVED' | 'TOOL_CALL_STATUS_DENIED';\n\nexport type ObjectiveToolCallWithResultExecutionStatus = 'TOOL_CALL_EXECUTION_STATUS_UNSPECIFIED' | 'TOOL_CALL_EXECUTION_STATUS_PENDING' | 'TOOL_CALL_EXECUTION_STATUS_RUNNING' | 'TOOL_CALL_EXECUTION_STATUS_COMPLETED' | 'TOOL_CALL_EXECUTION_STATUS_ERRORED' | 'TOOL_CALL_EXECUTION_STATUS_WAITING_FOR_CONTENT';\n\n/**\n * ObjectiveToolCallWithResult is an ObjectiveToolCall plus the content the\n * tool returned. Returned by GetObjectiveToolCall.\n */\nexport interface ObjectiveToolCallWithResult {\n metadata: OperationMetadata;\n data: ObjectiveToolCallData;\n /**\n * Current status of the tool call\n */\n status: ObjectiveToolCallWithResultStatus;\n info: ObjectiveToolCallInfo;\n executionStatus: ObjectiveToolCallWithResultExecutionStatus;\n /**\n * The content returned by the tool. Only set once execution_status is\n * TOOL_CALL_EXECUTION_STATUS_COMPLETED.\n */\n result?: ObjectiveToolCallResult;\n /**\n * List of resolved secrets used by the tool call\n */\n resolvedSecrets: Array<ResolvedSecret>;\n}\n\nexport interface Objective_Secret {\n name: string;\n}\n\n/**\n * Omit tool request\n */\nexport interface OmitToolRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Tool set ID. Accepts the canonical ts_… form or the\n * external_id:<value> form.\n */\n toolSetId?: string;\n /**\n * Tool ID. Accepts the canonical tool_… form or the\n * external_id:<value> form.\n */\n id?: string;\n}\n\n/**\n * OpenAICompatibleConfig configures a generic endpoint that speaks the OpenAI\n * Chat Completions API. The base URL is required and its model catalog is\n * discovered live via GET {base_url}/models.\n */\nexport interface OpenAICompatibleConfig {\n baseUrl: string;\n}\n\n/**\n * OpenAIConfig holds OpenAI-specific settings.\n */\nexport interface OpenAIConfig {\n /**\n * Sent as the OpenAI-Organization header when set.\n */\n organizationId?: string;\n /**\n * Sent as the OpenAI-Project header when set.\n */\n projectId?: string;\n}\n\n/**\n * OpenRouterConfig holds OpenRouter-specific settings.\n */\nexport interface OpenRouterConfig {\n /**\n * Data-residency region (e.g. \"us\", \"eu\"). Empty uses the provider default.\n */\n region?: string;\n}\n\n/**\n * Metadata for ephemeral operations and activities (e.g., objectives, executions, runs)\n */\nexport interface OperationMetadata {\n /**\n * Unique identifier for the operation (prefixed ULID, e.g., \"obj_01HXK...\")\n */\n id: string;\n /**\n * Account this operation belongs to for multi-tenant isolation (prefixed ULID)\n */\n accountId: string;\n /**\n * Workspace this operation belongs to for organizational grouping (prefixed ULID)\n */\n workspaceId: string;\n /**\n * Key-value pairs for categorization and filtering. Values are 0-63\n * alphanumeric characters with \"-\", \"_\", or \".\" allowed between; keys\n * follow the same shape and additionally accept an optional DNS-subdomain\n * prefix (e.g. \"cadenya.com/\") of at most 253 characters.\n * Examples: {\"priority\": \"high\", \"source\": \"api\", \"workflow\": \"onboarding\"}\n */\n labels: Record<string, string>;\n /**\n * Timestamp when this operation was created\n * ULID includes timestamp information, but this explicit field enables easier querying\n */\n createdAt: string;\n /**\n * External ID for the operation (e.g., a workflow ID from an external system)\n */\n externalId: string;\n /**\n * ID of the actor (user or service account) that created this operation\n */\n profileId: string;\n}\n\n/**\n * Page carries cursor-based pagination state. There is no total: the cursor\n * walks the result set without ever counting it, and a count would cost a second\n * query on every list.\n */\nexport interface Page {\n nextCursor: string;\n}\n\n/**\n * Default: ON_MISSING_FAIL.\n */\nexport type ParameterActionPinOnMissing = 'ON_MISSING_UNSPECIFIED' | 'ON_MISSING_FAIL' | 'ON_MISSING_SKIP';\n\n/**\n * Bind the parameter to one of the objective's pinned parameters. It is\n * deleted from the schema (including any `required` entry), and on every\n * call the pinned value is written into the arguments, overwriting\n * anything the model supplied.\n * This is the authoritative-value action: the model never sees the\n * parameter and cannot influence it.\n * \n * `pin` differs from `set` with `{{ pinned_parameters.key }}` only in\n * how a missing key is handled (see `on_missing`) and in intent —\n * reading the tool set config, `pin` says \"this comes from the caller\".\n */\nexport interface ParameterAction_Pin {\n path: string;\n /**\n * Key into the objective's pinned_parameters map. Need not equal the\n * last segment of `path` — this is how a pinned `orgId` reaches a\n * tool whose parameter is named `organizationId`.\n */\n pinnedParameter: string;\n /**\n * Default: ON_MISSING_FAIL.\n */\n onMissing: ParameterActionPinOnMissing;\n}\n\n/**\n * Remove the parameter entirely. It is deleted from the schema\n * (including any `required` entry) and stripped from the arguments if\n * the model supplies it anyway. The tool receives no value for it — the\n * upstream default, if any, applies. Use this to save context on\n * parameters the model has no business setting (pagination cursors,\n * expansion flags, debug toggles).\n */\nexport interface ParameterAction_Remove {\n path: string;\n}\n\n/**\n * Force the parameter to a value. It is deleted from the schema\n * (including any `required` entry), and on every call the rendered\n * value is written into the arguments, overwriting anything the model\n * supplied.\n * \n * `value_template` is a Liquid template rendered against the objective:\n * \n * {{ pinned_parameters.<key> }} the objective's pinned parameters\n * {{ objective.id }} the objective's id\n * {{ objective.external_id }} the objective's external id\n * {{ objective.labels.<key> }} the objective's labels\n * \n * Templates render with strict variables: referencing a pinned\n * parameter or label that does not exist fails the call rather than\n * rendering an empty value.\n * \n * Tool set secrets are intentionally not exposed here: overlay-set\n * values are recorded as tool call arguments in events and tool call\n * history, and would leak. Use adapter headers for credentials.\n * \n * The rendered string is coerced to the parameter's declared schema\n * type: for a non-string parameter (integer, number, boolean, object,\n * array) the output is parsed as JSON. A value that fails to parse\n * errors the tool call. Prefer `pin` when the value is simply a pinned\n * parameter — it fails loudly when the key is absent instead of\n * rendering an empty string.\n */\nexport interface ParameterAction_Set {\n path: string;\n valueTemplate: string;\n}\n\n/**\n * Pause agent schedule request.\n */\nexport interface PauseAgentScheduleRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Schedule ID. Accepts the canonical `as_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\n/**\n * A profile identifies a user or non-human principal (such as an API key)\n * at the account level. Profiles are account-scoped and can be granted access\n * to multiple workspaces.\n */\nexport interface Profile {\n metadata: AccountResourceMetadata;\n spec: ProfileSpec;\n}\n\n/**\n * Whether this profile represents a human user, an API key, or a system\n * principal.\n */\nexport type ProfileSpecType = 'PROFILE_TYPE_UNSPECIFIED' | 'PROFILE_TYPE_USER' | 'PROFILE_TYPE_API_KEY' | 'PROFILE_TYPE_SYSTEM';\n\n/**\n * Configuration for a profile.\n */\nexport interface ProfileSpec {\n /**\n * Email address of the profile. Required and unique within an account for\n * user profiles.\n */\n email: string;\n /**\n * Display name (e.g., \"Bobby Tables\").\n */\n name: string;\n /**\n * Whether this profile represents a human user, an API key, or a system\n * principal.\n */\n type: ProfileSpecType;\n}\n\n/**\n * Publish agent request\n */\nexport interface PublishAgentRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\n/**\n * Reasoning carries the human-readable reasoning text a model produced while\n * working on an iteration — extended thinking (Anthropic, Gemini) or reasoning\n * summaries (OpenAI). It is emitted alongside the assistant message from the\n * same model response and is purely informational: the text shown here is\n * never sent back to the model.\n */\nexport interface Reasoning {\n /**\n * The reasoning text. May be a verbatim chain of thought or a\n * provider-generated summary depending on the model.\n */\n content: string;\n}\n\n/**\n * Detach a target by its foreign key. Removing an unassigned target returns\n * NotFound. The parent variation must exist and be accessible.\n */\nexport type RemoveAgentVariationAssignmentRequest =\n | RemoveAgentVariationAssignmentRequest_ToolId\n | RemoveAgentVariationAssignmentRequest_ToolSetId\n | RemoveAgentVariationAssignmentRequest_SubAgentId;\n\n/**\n * Remove by memory layer ID. An unassigned layer returns NotFound.\n * The parent variation must still exist and be accessible.\n */\nexport interface RemoveAgentVariationMemoryLayerRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n /**\n * Layer to detach. Accepts memlyr_… or external_id:<value>.\n */\n memoryLayerId: string;\n}\n\nexport type ResolvedSecretSource = 'RESOLVED_SECRET_SOURCE_UNSPECIFIED' | 'RESOLVED_SECRET_SOURCE_WORKSPACE' | 'RESOLVED_SECRET_SOURCE_TOOLSET' | 'RESOLVED_SECRET_SOURCE_OBJECTIVE';\n\n/**\n * ResolvedSecret is a resolved secret value from the workspace, toolset, or objective. When a tool is called, it will rely\n * on secrets in the order of:\n * - Objective\n * - Toolset\n * - Workspace\n */\nexport interface ResolvedSecret {\n key: string;\n source: ResolvedSecretSource;\n}\n\n/**\n * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)\n */\nexport interface ResourceMetadata {\n /**\n * Unique identifier for the resource (prefixed ULID, e.g., \"agent_01HXK...\")\n */\n id: string;\n /**\n * Account this resource belongs to for multi-tenant isolation (prefixed ULID)\n */\n accountId: string;\n /**\n * Workspace this resource belongs to for organizational grouping (prefixed ULID)\n */\n workspaceId: string;\n /**\n * Human-readable name for the resource (e.g., \"Customer Support Agent\", \"Email Tool\")\n * Required for resources that users interact with directly\n */\n name: string;\n /**\n * External ID for the resource (e.g., a workflow ID from an external system)\n */\n externalId: string;\n /**\n * Key-value pairs for categorization and filtering. Values are 0-63\n * alphanumeric characters with \"-\", \"_\", or \".\" allowed between; keys\n * follow the same shape and additionally accept an optional DNS-subdomain\n * prefix (e.g. \"cadenya.com/\") of at most 253 characters.\n * Examples: {\"environment\": \"production\", \"team\": \"platform\", \"version\": \"v2\"}\n */\n labels: Record<string, string>;\n /**\n * ID of the actor (user or service account) that created this resource\n */\n profileId: string;\n /**\n * Timestamp when this resource was created\n */\n createdAt: string;\n /**\n * Timestamp when this resource was last updated\n */\n updatedAt?: string;\n}\n\n/**\n * Restore tool request\n */\nexport interface RestoreToolRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Tool set ID. Accepts the canonical ts_… form or the\n * external_id:<value> form.\n */\n toolSetId?: string;\n /**\n * Tool ID. Accepts the canonical tool_… form or the\n * external_id:<value> form.\n */\n id?: string;\n}\n\n/**\n * Default: ON_ERROR_RAW_CONTENT.\n */\nexport type ResultActionTransformOnError = 'ON_ERROR_UNSPECIFIED' | 'ON_ERROR_RAW_CONTENT' | 'ON_ERROR_FAIL';\n\n/**\n * Replace the result's text content with a rendered Liquid template.\n * Used to compact verbose responses to the fields the model actually\n * needs, or to rewrite a JSON response into a smaller JSON document.\n * \n * `content_template` is rendered against the call:\n * \n * {{ result.text }} the result's text content (text blocks\n * joined with newlines)\n * {{ result.json }} result.text parsed as JSON — objects and\n * arrays are navigable (`result.json.items`,\n * `| map: \"id\"`); absent when the text is not\n * valid JSON\n * {{ result.blocks }} every content block: [{type, text?,\n * mime_type?, size_bytes?}]\n * {{ parameters }} the arguments the tool was called with,\n * after parameter actions were applied\n * {{ tool.name }} the tool's metadata.name\n * {{ tool.llm_tool_name }} the name the model called it by\n * {{ pinned_parameters }} the objective's pinned parameters\n * {{ objective.id }} / {{ objective.external_id }} /\n * {{ objective.labels.<key> }}\n * \n * Templates render with strict variables: referencing `result.json` on\n * a non-JSON result, or any other undefined variable, is a render error\n * and `on_error` decides the outcome. The `json` filter pretty-prints a\n * value as JSON; `sanitized_json` emits it compact and escaped for\n * embedding.\n * \n * Transforms are text-only. `result.text` and `result.json` are built\n * from the result's text blocks; media blocks (images, audio) are opaque\n * to the template and pass through unchanged. The rendered text replaces\n * the text blocks as a single text block. A result with no text blocks\n * at all (an image-only or audio-only result) is out of scope: the\n * transform is skipped, the result is recorded as returned, and the\n * skip is noted in the tool call's debug log — this is not an `on_error`\n * case, nothing was attempted. The one exception is `expect_json`, where\n * a result with no text is a violated precondition and `on_error`\n * applies.\n */\nexport interface ResultAction_Transform {\n contentTemplate: string;\n /**\n * Default: ON_ERROR_RAW_CONTENT.\n */\n onError: ResultActionTransformOnError;\n /**\n * Require the tool result to have text content that parses as JSON\n * before rendering. A non-JSON (or text-less) result is then an error\n * subject to `on_error` even if the template never reads\n * `result.json`. Off by default: `result.json` is simply absent for\n * non-JSON results, and text-less results skip the transform.\n */\n expectJson: boolean;\n}\n\n/**\n * Resume agent schedule request.\n */\nexport interface ResumeAgentScheduleRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Schedule ID. Accepts the canonical `as_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\n/**\n * Revoke widget session request.\n */\nexport interface RevokeWidgetSessionRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Session ID. Accepts the canonical `wsess_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\nexport interface RotateAPIKeyRequest {\n /**\n * The workspace the API key belongs to (path).\n */\n workspaceId?: string;\n /**\n * The API key to rotate. A new token is issued and any existing token is\n * invalidated.\n */\n id?: string;\n}\n\n/**\n * Response containing the newly generated challenge token.\n */\nexport interface RotateChallengeTokenResponse {\n challengeToken: string;\n}\n\n/**\n * Response containing the newly generated webhook signing secret.\n */\nexport interface RotateWebhookEventsHmacSecretResponse {\n webhookEventsHmacSecret: string;\n}\n\n/**\n * Calendar is a wall-clock rule. Empty field-list semantics:\n * - second/minute/hour: empty means [{start: 0}] (top of the unit)\n * - day_of_month/month/day_of_week: empty means \"any value\"\n * Fire times = cartesian product across all fields.\n */\nexport interface Schedule_Calendar {\n second?: Array<Schedule_Range>;\n minute?: Array<Schedule_Range>;\n hour?: Array<Schedule_Range>;\n dayOfMonth?: Array<Schedule_Range>;\n month?: Array<Schedule_Range>;\n dayOfWeek?: Array<Schedule_Range>;\n comment?: string;\n}\n\n/**\n * Interval is a duration-based rule. Fires every `every` from a stable\n * anchor (workspace epoch), optionally phase-shifted by `offset`.\n */\nexport interface Schedule_Interval {\n every?: string;\n /**\n * Phase shift within `every`. Must be < `every` (enforced at runtime).\n */\n offset?: string;\n}\n\n/**\n * Inclusive numeric range with optional step.\n * {start: 9} → 9\n * {start: 9, end: 17} → 9..17\n * {start: 0, end: 59, step: 15} → 0,15,30,45\n * `end` defaults to `start`; `step` defaults to 1.\n */\nexport interface Schedule_Range {\n start?: number;\n end?: number;\n step?: number;\n}\n\nexport interface SearchToolsOrToolSetsResponse {\n tools: Array<Tool>;\n toolSets: Array<ToolSet>;\n agents: Array<Agent>;\n}\n\n/**\n * A single selector condition.\n */\nexport type Selector_Condition =\n | Selector_Condition_Attribute\n | Selector_Condition_HasParameter\n | Selector_Condition_Tools;\n\n/**\n * An explicit list of tools, matched on spec.llm_tool_name — the name\n * the model calls the tool by. It identifies a tool across versions:\n * just-in-time MCP sets keep one tool per signature and every version\n * shares the LLM name, so the condition keeps matching as the source\n * evolves. Any name in the list matches (OR). Names of tools not (or\n * not yet) present in the set are allowed and match nothing.\n */\nexport interface Selector_ToolNames {\n names?: Array<string>;\n}\n\n/**\n * SetToolCallContentRequest lets an external API consumer supply the result\n * of a bare tool call (one whose tool set has no execution adapter). Used\n * for human-in-the-loop tools and reverse harnesses that execute tools\n * locally and report results back.\n */\nexport interface SetToolCallContentRequest {\n workspaceId?: string;\n /**\n * The ID of the objective. Supports \"external_id:\" prefix for external IDs.\n */\n objectiveId?: string;\n /**\n * The ID of the tool call to set content for\n */\n toolCallId?: string;\n /**\n * The content to set on the tool call. Mirrors\n * ObjectiveToolCallResult.ContentBlock but writable: media blocks carry\n * raw data on input where the result-side carries a signed url on output.\n */\n content: Array<SetToolCallContentRequest_ContentBlock>;\n}\n\nexport interface SetToolCallContentRequest_AudioBlock {\n /**\n * Base64-encoded audio bytes.\n */\n data: string;\n /**\n * IANA media type of the audio, e.g. audio/wav.\n */\n mimeType: string;\n}\n\n/**\n * ContentBlock is a single block of tool call content supplied on input.\n * Exactly one of the variants is set.\n */\nexport type SetToolCallContentRequest_ContentBlock =\n | SetToolCallContentRequest_ContentBlock_Text\n | SetToolCallContentRequest_ContentBlock_Image\n | SetToolCallContentRequest_ContentBlock_Audio;\n\nexport interface SetToolCallContentRequest_ImageBlock {\n /**\n * Base64-encoded image bytes.\n */\n data: string;\n /**\n * IANA media type of the image, e.g. image/png.\n */\n mimeType: string;\n}\n\nexport interface SetToolCallContentRequest_TextBlock {\n text: string;\n}\n\n/**\n * The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).\n */\nexport interface Status {\n /**\n * The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].\n */\n code?: number;\n /**\n * A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.\n */\n message?: string;\n /**\n * A list of messages that carry the error details. There is a common set of message types for APIs to use.\n */\n details?: Array<GoogleProtobufAny>;\n}\n\nexport interface SubAgentSpawned {\n agent: ResourceMetadata;\n objective: OperationMetadata;\n task: string;\n}\n\nexport type SubAgentUpdatedStatus = 'STATUS_UNSPECIFIED' | 'STATUS_PENDING' | 'STATUS_RUNNING' | 'STATUS_COMPLETED' | 'STATUS_FAILED' | 'STATUS_CANCELLED';\n\nexport interface SubAgentUpdated {\n agent?: BareMetadata;\n objective?: BareMetadata;\n status: SubAgentUpdatedStatus;\n message?: string;\n}\n\n/**\n * Subject is a person within a tenant as a readable record. Like Tenant it\n * carries no spec — `metadata.external_id` is the customer's key for them,\n * unique within the tenant rather than the workspace.\n */\nexport interface Subject {\n metadata: ResourceMetadata;\n info?: SubjectInfo;\n}\n\n/**\n * SubjectAssertion identifies a person within a tenant in the customer's own\n * namespace — typically their user id. Asserting a subject upserts the\n * subject record under the asserted tenant and associates the created\n * resource with it. A subject assertion is only valid alongside a tenant\n * assertion: subject identifiers are scoped to their tenant.\n */\nexport interface SubjectAssertion {\n /**\n * The subject identifier in the customer's namespace (e.g. their user id).\n * Stored as the subject record's external_id; unique within the tenant.\n */\n id: string;\n /**\n * Optional human-readable name for the subject. Updates the subject\n * record's name on every assertion that provides it.\n */\n name?: string;\n}\n\n/**\n * SubjectInfo provides read-only server-derived data about a subject.\n */\nexport interface SubjectInfo {\n /**\n * The tenant this subject belongs to.\n */\n tenant: TenantReference;\n /**\n * Number of objectives associated with this subject.\n */\n objectiveCount: number;\n}\n\n/**\n * SubjectReference is the read-only echo of a resource's subject association,\n * carrying both Cadenya's canonical id and the customer's own key.\n */\nexport interface SubjectReference {\n /**\n * Cadenya's canonical subject id.\n */\n id: string;\n /**\n * The subject identifier in the customer's namespace, as asserted. Unique\n * within the subject's tenant.\n */\n externalId: string;\n /**\n * Human-readable name of the subject, when one has been asserted.\n */\n name?: string;\n}\n\n/**\n * Swap model on variations request. Each ModelSwap reassigns every agent\n * variation on current_model_id to next_model_id. The work runs asynchronously.\n */\nexport interface SwapModelOnVariationsRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * The swaps to perform.\n */\n modelSwaps?: Array<SwapModelOnVariationsRequest_ModelSwap>;\n}\n\nexport interface SwapModelOnVariationsRequest_ModelSwap {\n /**\n * The model variations are currently on. Accepts an id or \"external_id:\" slug.\n */\n currentModelId?: string;\n /**\n * The model to move variations to. Accepts an id or \"external_id:\" slug.\n */\n nextModelId?: string;\n /**\n * Whether to disable the current model after the swap.\n */\n disableCurrentAfterSwap?: boolean;\n}\n\n/**\n * Swap model on variations response. Empty: the work runs asynchronously, so no\n * counts are returned (a large data set would make the call slow).\n */\nexport interface SwapModelOnVariationsResponse {\n}\n\n/**\n * Emitted when a tool set sync operation completes successfully.\n */\nexport interface SyncCompleted {\n /**\n * Number of tools synced.\n */\n toolsSynced: number;\n /**\n * Optional message with additional details.\n */\n message: string;\n}\n\n/**\n * Emitted when a tool set sync operation fails.\n */\nexport interface SyncFailed {\n /**\n * Indicates this is an error event.\n */\n error: boolean;\n /**\n * Error message describing what went wrong.\n */\n message: string;\n /**\n * Optional error type/code for programmatic handling.\n */\n errorType: string;\n}\n\n/**\n * Emitted when a tool set sync operation begins.\n */\nexport interface SyncStarted {\n /**\n * Human-readable message describing the start of the sync.\n */\n message: string;\n}\n\n/**\n * The current lifecycle state of the tenant. Output only.\n */\nexport type TenantState = 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_ERASING';\n\n/**\n * Tenant is the customer's organization as a readable record rather than an\n * echo. It carries no spec: a tenant is never configured, only asserted, so\n * everything about it lives in the metadata envelope — `external_id` is the key\n * the customer asserted it under, `name` is the most recent name they asserted,\n * and `updated_at` is therefore when the tenant was last asserted.\n */\nexport interface Tenant {\n metadata: ResourceMetadata;\n info?: TenantInfo;\n /**\n * The current lifecycle state of the tenant. Output only.\n */\n state: TenantState;\n}\n\n/**\n * TenantAssertion identifies a tenant in the customer's own namespace — their\n * org, company, or team identifier for an end user. Asserting a tenant\n * upserts the tenant record in the workspace (keyed on `id` as the tenant's\n * external_id) and associates the created resource with it.\n */\nexport interface TenantAssertion {\n /**\n * The tenant identifier in the customer's namespace (e.g. \"acme-corp\").\n * Stored as the tenant record's external_id; stable across requests.\n */\n id: string;\n /**\n * Optional human-readable name for the tenant. Updates the tenant record's\n * name on every assertion that provides it.\n */\n name?: string;\n}\n\n/**\n * TenantInfo provides read-only server-derived data about a tenant.\n */\nexport interface TenantInfo {\n /**\n * Number of subjects asserted under this tenant.\n */\n subjectCount: number;\n /**\n * Number of objectives associated with this tenant, across every surface —\n * widget conversations and objectives created directly against the API\n * alike. This is the footprint a delete would destroy, which is why it is\n * worth the count query that populating `info` costs.\n */\n objectiveCount: number;\n /**\n * Number of widget sessions minted for this tenant that still exist.\n */\n widgetSessionCount: number;\n}\n\n/**\n * TenantReference is the read-only echo of a resource's tenant association,\n * carrying both Cadenya's canonical id and the customer's own key.\n */\nexport interface TenantReference {\n /**\n * Cadenya's canonical tenant id.\n */\n id: string;\n /**\n * The tenant identifier in the customer's namespace, as asserted.\n */\n externalId: string;\n /**\n * Human-readable name of the tenant, when one has been asserted.\n */\n name?: string;\n}\n\n/**\n * The current lifecycle state of the tool. Output only. Use the :omit and\n * :restore actions to transition; tool set syncs may also update it.\n */\nexport type ToolState = 'STATE_UNSPECIFIED' | 'STATE_AVAILABLE' | 'STATE_OMITTED' | 'STATE_ARCHIVED';\n\nexport interface Tool {\n metadata: ResourceMetadata;\n spec: ToolSpec;\n info?: ToolInfo;\n /**\n * The current lifecycle state of the tool. Output only. Use the :omit and\n * :restore actions to transition; tool set syncs may also update it.\n */\n state: ToolState;\n}\n\nexport interface ToolApprovalRequested {\n /**\n * The ID of the objective tool call record. Use this ID with the ApproveToolCall or DenyToolCall RPCs to approve or deny the tool call.\n */\n toolCallId: string;\n}\n\nexport interface ToolApproved {\n /**\n * The ID of the objective tool call record that was approved via the ApproveToolCall RPC.\n */\n toolCallId: string;\n}\n\nexport interface ToolCalled {\n /**\n * The ID of the objective tool call record that was executed.\n */\n toolCallId: string;\n /**\n * The tool that was called.\n */\n tool?: CallableTool;\n /**\n * The called tool's adapter configuration, including the bare adapter\n * marker for bare tools. Lets a webhook consumer act on the call (e.g.\n * detect a bare tool call and prepare to supply its content) without a\n * round-trip to GetObjectiveToolCall.\n */\n config?: ToolSpec_Config;\n /**\n * The arguments passed to the tool.\n */\n arguments?: Record<string, unknown>;\n /**\n * Whether the runtime authorized this call's arguments to be exposed in\n * public widget events. This records the resolved policy at call time so\n * consumers do not need to re-evaluate the tool set's current overlays.\n */\n argumentsExposedInWidgets?: boolean;\n}\n\nexport interface ToolDenied {\n /**\n * The ID of the objective tool call record that was denied via the DenyToolCall RPC.\n */\n toolCallId: string;\n /**\n * The memo provided by the reviewer when denying the tool call. This is passed to the agent to provide further instructions.\n */\n memo: string;\n}\n\nexport interface ToolError {\n /**\n * The ID of the objective tool call record that encountered an error during execution.\n */\n toolCallId: string;\n message: string;\n}\n\nexport interface ToolInfo {\n toolSet?: ResourceMetadata;\n createdBy?: Profile;\n /**\n * Content signature identifying the tool within its tool set: a hash of the\n * sanitized llm_tool_name, description, and canonical parameters. Two tools\n * with the same llm_tool_name but different parameters or description (as\n * MCP servers may return per user) have distinct signatures. Computed over\n * the raw spec — overlays do not change a tool's signature.\n */\n signature: string;\n /**\n * Keys of the tool set's overlays whose selectors match this tool\n * (ToolSetSpec.overlays), in evaluation order. Disabled overlays are\n * excluded. An overlay is listed when its selector matches even if none\n * of its actions changed this tool's schema (all its paths were absent),\n * so this answers \"which policies apply to this tool\" — diff\n * effective_parameters against spec.parameters for \"what changed\".\n * Empty when no overlay applies.\n */\n overlays?: Array<string>;\n /**\n * The parameter schema as presented to the model: spec.parameters after\n * every matching overlay's parameter actions have been applied, in order,\n * including maintenance of the schema's `required` list. Actions whose\n * outcome depends on the objective (pin with ON_MISSING_SKIP) are applied\n * as if the pinned key were present, so this reflects the intended steady\n * state rather than any one objective. Equals spec.parameters when no\n * overlay applies. Result actions have no effect here.\n */\n effectiveParameters?: Record<string, unknown>;\n}\n\n/**\n * A tool overlay is a policy attached to a tool set that reshapes the tools\n * the model sees and calls. It pairs a selector (which tools it applies to)\n * with actions that run before a call — rewriting the tool's parameter\n * schema and the arguments the model supplied — and after a call —\n * rewriting the result before it enters the model's context. It can also\n * explicitly allow the final call arguments to cross the otherwise-private\n * widget API boundary.\n * \n * Overlays exist for three reasons:\n * \n * - Authority. Adapter-derived tool sets (OpenAPI especially) expose many\n * parameters the model must never guess — a workspace id, a tenant id,\n * an account scope. Overlays bind those parameters to the objective's\n * `pinned_parameters` (see CreateObjectiveRequest.pinned_parameters):\n * the parameter disappears from the schema and the value is forced\n * server-side, so the model has no opportunity to supply a different\n * one.\n * - Context. Large specs carry pagination cursors, expansion flags and\n * verbose responses that cost tokens without helping the model.\n * Overlays strip parameters, fix them to literals, and compact results.\n * - Widget presentation. Tool arguments are private by default. An overlay\n * can opt matching tools into exposing their final call arguments in\n * visitor-facing widget events so an embedding UI can select a custom\n * renderer or presentation.\n * \n * Pinned parameters and overlays are complementary: pinned parameters are\n * *data* supplied per objective (or per widget session) by the caller;\n * overlays are *policy* authored once on the tool set. Pinning by name\n * still works without an overlay — a pinned key that matches a top-level\n * parameter name is applied to every tool in the objective — overlays are\n * for the cases that needs more: nested paths, renamed keys, a subset of\n * tools, or values that are literals rather than caller-supplied.\n * \n * Evaluation model:\n * \n * - Overlays are evaluated in list order; within an overlay, actions are\n * evaluated in list order. Later actions win on the same path (a `set`\n * followed by a `remove` leaves the parameter removed).\n * - The parameter schema the model sees is computed when tools are\n * assembled for an objective, so pre-call actions can consult that\n * objective's pinned parameters (this is what makes `pin` with\n * ON_MISSING_SKIP meaningful). Argument rewriting runs on every call.\n * - An action whose `path` does not exist in the tool's parameter schema\n * changes nothing in the schema the model sees. This is deliberate: a\n * broad selector (every `list_*` tool) may match tools with different\n * shapes, and one overlay should be able to cover all of them without\n * erroring on the ones that lack a given parameter. At call time the\n * model's arguments can still not widen what it controls: `remove`\n * strips the path whether or not it is declared, and `set`/`pin`\n * overwrite a value the model sent at an undeclared path (a schema this\n * evaluator cannot see through, e.g. behind $ref/allOf) while injecting\n * nothing into tools that lack the parameter.\n * - Overlays apply to just-in-time tool sets as well; the tools are\n * evaluated against overlays at the moment they are loaded.\n * - Result actions run once, when the tool call's result is recorded; the\n * stored result is the transformed one, so every reader (the model,\n * compaction, the API) sees the same content. They are not supported on\n * bare tool sets.\n */\nexport interface ToolOverlay {\n /**\n * Identifies the overlay within its tool set. Unique across the tool\n * set's overlays (enforced by the server), stable across reorders, and\n * surfaced in tool call messages (\"parameter removed by overlay\n * strip-list-knobs\") so an operator can trace a rewritten call back to\n * the policy that rewrote it. Referenced by ToolInfo.overlays and the\n * ListToolsRequest.overlays filter.\n */\n key: string;\n /**\n * Which tools this overlay applies to. Required; an empty selector\n * (no conditions) matches every tool in the set.\n */\n selector: ToolOverlay_Selector;\n /**\n * Pre-call actions, applied in order. See ParameterAction.\n */\n parameterActions?: Array<ToolOverlay_ParameterAction>;\n /**\n * Post-call actions, applied in order. See ResultAction.\n */\n resultActions?: Array<ToolOverlay_ResultAction>;\n /**\n * When true the overlay is retained in the spec but not evaluated. Lets an\n * operator switch a policy off to diagnose a misbehaving tool without\n * deleting it and losing the configuration.\n */\n disabled: boolean;\n /**\n * Arguments may carry sensitive customer data, including values injected by\n * parameter actions, so they stay private unless an overlay enables them.\n * \n * Unset means this overlay has no opinion. When several enabled overlays\n * match a tool, they are evaluated in list order and the last overlay that\n * supplies this policy wins. If none supplies it, arguments stay private.\n * Disabled overlays never participate.\n */\n widgetArgumentExposure?: ToolOverlay_WidgetArgumentExposure;\n}\n\n/**\n * A pre-call action. Parameter actions rewrite the tool's parameter\n * schema as presented to the model and the arguments the model supplies\n * when it calls the tool. Both sides are always kept in agreement: a\n * parameter that is hidden from the schema is also stripped from (or\n * forced in) the arguments, so the model can neither see nor smuggle it.\n */\nexport type ToolOverlay_ParameterAction =\n | ToolOverlay_ParameterAction_Remove\n | ToolOverlay_ParameterAction_Set\n | ToolOverlay_ParameterAction_Pin;\n\n/**\n * A dotted path into a tool's parameter schema. Each segment is a property\n * name; the path `filter.workspaceId` addresses\n * `properties.filter.properties.workspaceId` in the schema and\n * `arguments.filter.workspaceId` in the call. Only object properties are\n * addressable — there is no array indexing, wildcarding or filtering.\n * \n * This is deliberately not JSONPath: every action needs a single,\n * unambiguous location in both the schema and the arguments so that\n * removing a parameter from the schema and stripping it from the call are\n * guaranteed to agree.\n */\nexport interface ToolOverlay_ParameterPath {\n path: string;\n}\n\n/**\n * A post-call action. Result actions rewrite a tool call's result after\n * the adapter returns and before it is recorded: the transformed content\n * is what is stored and what the model reads (ObjectiveToolCallResult\n * content). The adapter's raw response is kept in the tool call's debug\n * log for operators; it is not otherwise retained.\n * \n * Result actions apply to MCP, OpenAPI and HTTP tool sets. They are not\n * supported on bare tool sets — a bare tool's content is supplied by an\n * external consumer, so there is nothing for the platform to reshape —\n * and a tool set whose adapter is `bare` rejects overlays that carry\n * result actions.\n * \n * When several matching overlays carry transforms they run in overlay\n * order, each one reading the previous one's output.\n */\nexport type ToolOverlay_ResultAction =\n | ToolOverlay_ResultAction_Transform;\n\n/**\n * Default: OPERATOR_AND.\n */\nexport type ToolOverlaySelectorOperator = 'OPERATOR_UNSPECIFIED' | 'OPERATOR_AND' | 'OPERATOR_OR';\n\n/**\n * Which tools in the tool set an overlay applies to. Conditions are\n * combined with `operator`; an overlay with no conditions matches every\n * tool in the set.\n */\nexport interface ToolOverlay_Selector {\n conditions?: Array<Selector_Condition>;\n /**\n * Default: OPERATOR_AND.\n */\n operator: ToolOverlaySelectorOperator;\n}\n\n/**\n * Controls whether matching tool calls may expose their final arguments to\n * visitor-facing widget events. The containing message's presence means the\n * overlay has an opinion; enabled selects whether that opinion is on or off.\n */\nexport interface ToolOverlay_WidgetArgumentExposure {\n enabled: boolean;\n}\n\nexport interface ToolResult {\n toolCallId: string;\n /**\n * The content returned by the tool.\n */\n result: ObjectiveToolCallResult;\n}\n\n/**\n * The current lifecycle state of the tool set. Output only. Tool sets are\n * created STATE_ACTIVE; use the :archive and :unarchive actions to\n * transition between states.\n */\nexport type ToolSetState = 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_ARCHIVED';\n\nexport interface ToolSet {\n metadata: ResourceMetadata;\n spec: ToolSetSpec;\n /**\n * Tool set information\n */\n info?: ToolSetInfo;\n /**\n * The current lifecycle state of the tool set. Output only. Tool sets are\n * created STATE_ACTIVE; use the :archive and :unarchive actions to\n * transition between states.\n */\n state: ToolSetState;\n}\n\nexport type ToolSetAdapter =\n | ToolSetAdapter_McpVariant\n | ToolSetAdapter_HttpVariant\n | ToolSetAdapter_OpenapiVariant\n | ToolSetAdapter_BareVariant;\n\n/**\n * Approval filters that will automatically set the approval requirement on tools synced from an external source\n */\nexport type ToolSetAdapter_ApprovalRequirementFilter =\n | ToolSetAdapter_ApprovalRequirementFilter_Always\n | ToolSetAdapter_ApprovalRequirementFilter_Only;\n\nexport type ToolSetAdapterAttributeFilterAttribute = 'ATTRIBUTE_UNSPECIFIED' | 'ATTRIBUTE_NAME' | 'ATTRIBUTE_TITLE' | 'ATTRIBUTE_DESCRIPTION' | 'ATTRIBUTE_LLM_TOOL_NAME';\n\n/**\n * Single attribute filter\n */\nexport interface ToolSetAdapter_AttributeFilter {\n attribute: ToolSetAdapterAttributeFilterAttribute;\n matcher?: ToolSetAdapter_StringMatcher;\n}\n\n/**\n * Bare tool sets define tools without an execution adapter. A bare tool\n * call doesn't fire anything: the objective's workflow pauses and waits\n * for an external API consumer to set the tool call's content (e.g.\n * human-in-the-loop tools, or a reverse harness that polls for pending\n * tool calls, executes locally, and reports results back via\n * SetToolCallContent).\n */\nexport interface ToolSetAdapter_Bare {\n /**\n * How long to wait for content to be set before the tool call errors.\n * If unset, the call waits indefinitely.\n */\n contentTimeout?: number;\n}\n\nexport interface ToolSetAdapter_HTTP {\n /**\n * Base URL for dispatching tool calls.\n * \n * May be templated. Two reference forms are supported, and they resolve\n * in a single pass each so neither can inject into the other:\n * \n * ${SECRET_NAME} a workspace or tool set secret\n * {{ pinned_parameters.<key> }} the objective's pinned parameters\n * (see CreateObjectiveRequest.pinned_parameters)\n * \n * Pinned parameters are what make a per-tenant host possible: one tool\n * set can serve every customer of a product that assigns each of them\n * their own subdomain, e.g.\n * \n * https://{{ pinned_parameters.tenant }}.example.com\n * \n * Because the value may be a template rather than a literal URL, this\n * field is not constrained to a URI shape. It is validated as an\n * absolute http(s) URL after references are resolved, both on write\n * (with references stubbed) and again before each tool call.\n */\n baseUrl?: string;\n headers?: Record<string, string>;\n}\n\n/**\n * Defines behavior for just-in-time capable tool set adapters (IE: MCP).\n */\nexport interface ToolSetAdapter_JustInTime {\n enabled?: boolean;\n /**\n * If set, an objective will automatically be failed if tools cannot be loaded\n * in the initial stages of an objective being created. Tools are loaded asynchronously,\n * so this setting is useful for ensuring that an objective continued any further if tools are not available.\n */\n failObjectiveOnToolListError?: boolean;\n}\n\nexport interface ToolSetAdapter_MCP {\n url?: string;\n headers?: Record<string, string>;\n /**\n * Include/exclude with flat filters\n */\n includeTools?: ToolSetAdapter_ToolFilter;\n excludeTools?: ToolSetAdapter_ToolFilter;\n /**\n * Setting for how to assign tool approval requirements when they are synced from an MCP server\n */\n toolApprovals?: ToolSetAdapter_ApprovalRequirementFilter;\n /**\n * When enabled, tools are loaded from the MCP server just-in-time at\n * objective creation using the objective's resolved secrets, instead of\n * being synced ahead of time. Just-in-time tool sets are excluded from\n * the background sync system.\n */\n justInTime?: ToolSetAdapter_JustInTime;\n}\n\nexport type ToolSetAdapter_OpenAPI =\n | ToolSetAdapter_OpenAPI_Url\n | ToolSetAdapter_OpenAPI_UploadId;\n\n/**\n * String matching operations\n */\nexport type ToolSetAdapter_StringMatcher =\n | ToolSetAdapter_StringMatcher_Exact\n | ToolSetAdapter_StringMatcher_StartsWith\n | ToolSetAdapter_StringMatcher_EndsWith\n | ToolSetAdapter_StringMatcher_Contains\n | ToolSetAdapter_StringMatcher_Regex;\n\nexport type ToolSetAdapterToolFilterOperator = 'OPERATOR_UNSPECIFIED' | 'OPERATOR_AND' | 'OPERATOR_OR';\n\n/**\n * Top-level filter with simple boolean logic (no nesting)\n */\nexport interface ToolSetAdapter_ToolFilter {\n filters?: Array<ToolSetAdapter_AttributeFilter>;\n operator: ToolSetAdapterToolFilterOperator;\n}\n\n/**\n * A single event in the tool set's operation timeline.\n */\nexport interface ToolSetEvent {\n /**\n * Metadata for this operation event.\n */\n metadata: OperationMetadata;\n /**\n * The tool set this event is associated with.\n */\n toolSetId: string;\n /**\n * The event payload.\n */\n event: ToolSetEventData;\n info?: ToolSetEventInfo;\n}\n\n/**\n * Event payload for a tool set operation.\n */\nexport type ToolSetEventData =\n | ToolSetEventData_SyncStarted\n | ToolSetEventData_SyncCompleted\n | ToolSetEventData_SyncFailed;\n\nexport interface ToolSetEventInfo {\n toolSet?: ResourceMetadata;\n createdBy?: Profile;\n}\n\nexport interface ToolSetInfo {\n toolCount: number;\n agentCount: number;\n lastSync?: string;\n createdBy?: Profile;\n availableTools: number;\n omittedTools: number;\n}\n\nexport interface ToolSetSecret {\n metadata: ResourceMetadata;\n spec: ToolSetSecretSpec;\n /**\n * Tool set secret information\n */\n info?: ToolSetSecretInfo;\n}\n\nexport interface ToolSetSecretInfo {\n lastUsedAt?: string;\n createdBy?: Profile;\n}\n\nexport interface ToolSetSecretSpec {\n value?: string;\n}\n\nexport interface ToolSetSpec {\n description?: string;\n adapter: ToolSetAdapter;\n /**\n * Overlays applied to this tool set's tools, evaluated in order. See\n * ToolOverlay. Overlay keys must be unique within the list.\n * \n * As a repeated field this is replaced wholesale on update: an\n * update_mask of `spec.overlays` swaps the entire list for the one in the\n * request. Read-modify-write to add or remove a single overlay.\n */\n overlays?: Array<ToolOverlay>;\n}\n\n/**\n * ToolSetUsage describes one agent variation that uses the tool set (or, when\n * filtering by tool, an individual tool within it).\n */\nexport interface ToolSetUsage {\n /**\n * Metadata for the agent variation the assignment belongs to.\n */\n agentVariation: ResourceMetadata;\n /**\n * Metadata for the variation's parent agent.\n */\n agent: ResourceMetadata;\n /**\n * Metadata for the model assigned to the variation.\n */\n model: ResourceMetadata;\n /**\n * When the assignment was created.\n */\n assignedAt: string;\n}\n\nexport interface ToolSpec {\n description: string;\n requiresApproval: boolean;\n /**\n * The tool's JSON Schema, as handed to the LLM. Required, but may be the\n * empty object `{}` for a tool that takes no arguments. Requiring it rather\n * than defaulting it means a misspelled field name (`inputSchema`, say) is a\n * 400 instead of a silently parameterless tool.\n */\n parameters: Record<string, unknown>;\n /**\n * Configuration for this specific tool. Its transport is derived from the\n * tool set adapter, while details such as endpoint and method are stored on\n * the tool itself.\n * \n * Required, and exactly one adapter must be set.\n */\n config: ToolSpec_Config;\n /**\n * The name provided to the LLM, which may differ from the metadata.name on the tool.\n * LLMs have specific length and format requirements, and tool set sources may not comply\n * with them, so Cadenya does its best to format names into a usable format.\n */\n llmToolName?: string;\n}\n\n/**\n * Config defines the adapter to use for the tool.\n * This is used to determine how the tool is called.\n * For example, if the tool is an HTTP tool, the adapter will be Http.\n * If the tool is an inline tool, the adapter will be Inline.\n */\nexport type ToolSpec_Config =\n | ToolSpec_Config_Http\n | ToolSpec_Config_Mcp\n | ToolSpec_Config_Openapi\n | ToolSpec_Config_Bare;\n\n/**\n * Unarchive agent request\n */\nexport interface UnarchiveAgentRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\n/**\n * Unarchive tool set request\n */\nexport interface UnarchiveToolSetRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Tool set ID. Accepts the canonical ts_… form or the\n * external_id:<value> form.\n */\n id?: string;\n}\n\n/**\n * Unarchive widget request.\n */\nexport interface UnarchiveWidgetRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Widget ID. Accepts the canonical `wgt_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\n/**\n * Unpublish agent request\n */\nexport interface UnpublishAgentRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\nexport interface UpdateAIProviderKeyRequest {\n /**\n * The workspace the key belongs to.\n */\n workspaceId?: string;\n /**\n * The key to update.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: AIProviderKeySpec;\n /**\n * Fields to update.\n */\n updateMask?: string;\n /**\n * Field-level credential changes. This is independent of update_mask;\n * legacy clients may continue replacing spec.credentials atomically.\n */\n credentialPatch?: AIProviderCredentialPatch;\n}\n\nexport interface UpdateAPIKeyRequest {\n /**\n * The workspace the API key belongs to (path).\n */\n workspaceId?: string;\n /**\n * The API key to update.\n */\n id?: string;\n metadata?: UpdateAccountResourceMetadata;\n spec?: APIKeySpec;\n /**\n * Fields to update.\n */\n updateMask?: string;\n}\n\n/**\n * UpdateAccountResourceMetadata contains the user-provided fields for updating\n * an account-scoped resource. Read-only fields (id, account_id, profile_id) are excluded\n * since they are set by the server.\n */\nexport interface UpdateAccountResourceMetadata {\n /**\n * Human-readable name for the resource (e.g., \"Production API Key\", \"Staging Workspace\")\n */\n name: string;\n /**\n * External ID for the resource (e.g., a workflow ID from an external system)\n */\n externalId?: string;\n /**\n * Key-value pairs for categorization and filtering. Values are 0-63\n * alphanumeric characters with \"-\", \"_\", or \".\" allowed between; keys\n * follow the same shape and additionally accept an optional DNS-subdomain\n * prefix (e.g. \"cadenya.com/\") of at most 253 characters.\n * Examples: {\"environment\": \"production\", \"team\": \"platform\", \"version\": \"v2\"}\n */\n labels?: Record<string, string>;\n}\n\n/**\n * Update agent request\n */\nexport interface UpdateAgentRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: AgentSpec;\n /**\n * Fields to update\n */\n updateMask?: string;\n}\n\n/**\n * Update agent schedule request.\n */\nexport interface UpdateAgentScheduleRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Schedule ID. Accepts the canonical `as_…` form or the `external_id:<value>` form.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: AgentScheduleSpec;\n /**\n * Fields to update.\n */\n updateMask?: string;\n}\n\n/**\n * Update an existing memory layer assignment. Only `position` is mutable.\n * A new position that collides with another assignment on the same variation\n * is rejected with InvalidArgument. An unassigned layer returns NotFound.\n */\nexport interface UpdateAgentVariationMemoryLayerRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n /**\n * Layer to reposition. Accepts memlyr_… or external_id:<value>.\n */\n memoryLayerId: string;\n /**\n * New position. Only field currently updatable on an assignment.\n */\n position: number;\n}\n\n/**\n * Update agent variation request\n */\nexport interface UpdateAgentVariationRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: AgentVariationSpec;\n /**\n * Fields to update. Assignment lists are replaced as a whole, never merged.\n * Select spec.assignments or spec.memory_layer_assignments to replace/clear\n * one list. Selecting spec replaces the entire spec (including omitted lists);\n * * replaces all mutable fields. Element/index paths are not supported.\n * Without a mask, infer paths from non-empty fields: non-empty assignment\n * lists replace existing lists, while omitted/empty lists remain unchanged.\n * To clear a list, explicitly include its path in the mask.\n */\n updateMask?: string;\n}\n\nexport interface UpdateMemoryEntryRequest {\n workspaceId?: string;\n /**\n * Memory layer ID. Accepts canonical memlyr_… form or external_id:<value> form.\n */\n memoryLayerId?: string;\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: MemoryEntryUpdateSpec;\n updateMask?: string;\n}\n\nexport interface UpdateMemoryLayerRequest {\n workspaceId?: string;\n /**\n * Memory layer ID. Accepts canonical memlyr_… form or external_id:<value> form.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: MemoryLayerSpec;\n updateMask?: string;\n}\n\n/**\n * Update model request. update_mask must list leaf paths: metadata.name,\n * metadata.external_id, metadata.labels, spec.provider_model_id,\n * spec.provider, spec.family, spec.max_input_tokens, spec.max_output_tokens,\n * spec.capabilities, pricing_override.input_price_per_million_tokens, and\n * pricing_override.output_price_per_million_tokens. Synced models\n * (PROVENANCE_SYNCED_FROM_PROVIDER) reject metadata.name and spec.* paths.\n * spec price fields are never writable; price changes go through\n * pricing_override, where a masked-but-absent field clears the override.\n * Metadata and spec must be present when their respective paths are masked.\n */\nexport interface UpdateModelRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Model ID. Accepts the canonical `model_…` form or the `external_id:<value>` form.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n /**\n * When any spec.* path is masked, send the complete spec (current values\n * plus edits); it is validated as a whole.\n */\n spec?: ModelSpec;\n /**\n * Customer price overrides, applied per masked path.\n */\n pricingOverride?: ModelPricingOverride;\n /**\n * Fields to update. Required; leaf paths only.\n */\n updateMask?: string;\n}\n\n/**\n * UpdateResourceMetadata contains the user-provided fields for updating\n * a workspace-scoped resource. Read-only fields (id, account_id, workspace_id, profile_id,\n * created_at) are excluded since they are set by the server.\n */\nexport interface UpdateResourceMetadata {\n /**\n * Human-readable name for the resource (e.g., \"Customer Support Agent\", \"Email Tool\")\n */\n name: string;\n /**\n * External ID for the resource (e.g., a workflow ID from an external system)\n */\n externalId?: string;\n /**\n * Key-value pairs for categorization and filtering. Values are 0-63\n * alphanumeric characters with \"-\", \"_\", or \".\" allowed between; keys\n * follow the same shape and additionally accept an optional DNS-subdomain\n * prefix (e.g. \"cadenya.com/\") of at most 253 characters.\n * Examples: {\"environment\": \"production\", \"team\": \"platform\", \"version\": \"v2\"}\n */\n labels?: Record<string, string>;\n}\n\nexport interface UpdateToolRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Tool set ID. Accepts the canonical ts_… form or the\n * external_id:<value> form.\n */\n toolSetId?: string;\n /**\n * Tool ID. Accepts the canonical tool_… form or the\n * external_id:<value> form.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: ToolSpec;\n updateMask?: string;\n}\n\nexport interface UpdateToolSetRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Tool set ID. Accepts the canonical ts_… form or the\n * external_id:<value> form.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: ToolSetSpec;\n updateMask?: string;\n}\n\nexport interface UpdateToolSetSecretRequest {\n /**\n * The workspace that owns the tool set.\n */\n workspaceId?: string;\n /**\n * The tool set the secret belongs to. Accepts the canonical ts_… form\n * or the external_id:<value> form.\n */\n toolSetId?: string;\n /**\n * The secret to update.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: ToolSetSecretSpec;\n /**\n * Fields to update.\n */\n updateMask?: string;\n}\n\n/**\n * Update widget request.\n */\nexport interface UpdateWidgetRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Widget ID. Accepts the canonical `wgt_…` form or the `external_id:<value>` form.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: WidgetSpec;\n /**\n * Fields to update.\n */\n updateMask?: string;\n}\n\nexport interface UpdateWorkspaceRequest {\n /**\n * Workspace ID to update (path).\n */\n workspaceId?: string;\n metadata?: UpdateAccountResourceMetadata;\n spec?: WorkspaceSpec;\n /**\n * Fields to update.\n */\n updateMask?: string;\n}\n\nexport interface UpdateWorkspaceSecretRequest {\n /**\n * The workspace the secret belongs to.\n */\n workspaceId?: string;\n /**\n * The secret to update.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: WorkspaceSecretSpec;\n /**\n * Fields to update.\n */\n updateMask?: string;\n}\n\n/**\n * A handle representing a single file upload flow. Clients call CreateUpload\n * to receive a short-lived presigned URL, PUT the file directly to object\n * storage, then reference the upload by id when creating or updating\n * resources that accept binary content.\n * \n * Uploads are one-shot: once consumed by a creating or updating resource the\n * upload transitions to UPLOAD_STATUS_CONSUMED and cannot be reused. Unused\n * uploads expire and are garbage-collected.\n */\nexport interface Upload {\n metadata: ResourceMetadata;\n spec: UploadSpec;\n info: UploadInfo;\n}\n\n/**\n * Lifecycle state. Transitions PENDING → COMPLETE (storage confirms the\n * object exists) → CONSUMED (a resource referenced this upload), or\n * → EXPIRED (URL elapsed without a PUT).\n */\nexport type UploadInfoStatus = 'UPLOAD_STATUS_UNSPECIFIED' | 'UPLOAD_STATUS_PENDING' | 'UPLOAD_STATUS_COMPLETE' | 'UPLOAD_STATUS_CONSUMED' | 'UPLOAD_STATUS_EXPIRED';\n\nexport interface UploadInfo {\n /**\n * Presigned PUT URL. Short-lived. The client must PUT with the exact\n * Content-Type declared in the spec, and the body length must match\n * size_bytes.\n */\n uploadUrl: string;\n /**\n * Absolute time at which upload_url stops working.\n */\n uploadUrlExpiresAt?: string;\n /**\n * Lifecycle state. Transitions PENDING → COMPLETE (storage confirms the\n * object exists) → CONSUMED (a resource referenced this upload), or\n * → EXPIRED (URL elapsed without a PUT).\n */\n status: UploadInfoStatus;\n createdBy?: Profile;\n}\n\nexport interface UploadSpec {\n /**\n * Client-supplied filename. Used for audit and display only; does not\n * control the object's storage path.\n */\n filename: string;\n /**\n * MIME type the client will send. Baked into the presigned URL's signature\n * — the PUT must match exactly or object storage will reject it.\n */\n contentType: string;\n /**\n * Expected size of the upload in bytes. Baked into the presigned URL as a\n * Content-Length constraint.\n */\n sizeBytes: string;\n}\n\nexport interface UserMessage {\n content: string;\n}\n\n/**\n * A tool, tool set, or sub-agent assigned to a variation, identified only by\n * the target resource ID. The same shape is accepted in a spec and returned\n * on reads. Assignment junction records are an internal implementation detail.\n */\nexport type VariationAssignment =\n | VariationAssignment_ToolId\n | VariationAssignment_ToolSetId\n | VariationAssignment_SubAgentId;\n\n/**\n * A whole memory layer in a variation's baseline memory cascade. Identified\n * by the memory layer ID; no assignment junction ID is exposed. Entry pinning\n * remains an objective-level capability.\n */\nexport interface VariationMemoryLayerAssignment {\n /**\n * Accepts the canonical memlyr_… ID or external_id:<value> on input.\n * Reads always return the canonical ID.\n */\n memoryLayerId: string;\n /**\n * Position is specificity: lower positions are consulted first; the highest\n * position is the most general fallback. Gaps and zero are valid. Positions\n * must be unique within a variation. Explicitly required in a full spec;\n * only AddAgentVariationMemoryLayer can choose an append position for you.\n */\n position: number;\n}\n\n/**\n * VertexConfig configures the Google Cloud project and location used by the\n * Vertex AI backend. Both are required for service-account authentication.\n */\nexport interface VertexConfig {\n projectId?: string;\n location?: string;\n}\n\nexport interface WebhookDelivery {\n metadata: OperationMetadata;\n /**\n * Webhook delivery details.\n */\n data: WebhookDeliveryData;\n}\n\nexport type WebhookDeliveryDataStatus = 'WEBHOOK_DELIVERY_STATUS_UNSPECIFIED' | 'WEBHOOK_DELIVERY_STATUS_PENDING' | 'WEBHOOK_DELIVERY_STATUS_COMPLETED' | 'WEBHOOK_DELIVERY_STATUS_FAILED' | 'WEBHOOK_DELIVERY_STATUS_DISABLED';\n\n/**\n * The type of objective event that triggered this webhook delivery\n */\nexport type WebhookDeliveryDataEventType = 'OBJECTIVE_EVENT_TYPE_UNSPECIFIED' | 'OBJECTIVE_EVENT_TYPE_USER_MESSAGE' | 'OBJECTIVE_EVENT_TYPE_TOOL_APPROVAL_REQUESTED' | 'OBJECTIVE_EVENT_TYPE_TOOL_APPROVED' | 'OBJECTIVE_EVENT_TYPE_TOOL_DENIED' | 'OBJECTIVE_EVENT_TYPE_TOOL_CALLED' | 'OBJECTIVE_EVENT_TYPE_ERROR' | 'OBJECTIVE_EVENT_TYPE_ASSISTANT_MESSAGE' | 'OBJECTIVE_EVENT_TYPE_TOOL_RESULT' | 'OBJECTIVE_EVENT_TYPE_TOOL_ERROR' | 'OBJECTIVE_EVENT_TYPE_CONTEXT_WINDOW_COMPACTED' | 'OBJECTIVE_EVENT_TYPE_MEMORY_READ' | 'OBJECTIVE_EVENT_TYPE_CANCELLED' | 'OBJECTIVE_EVENT_TYPE_SUB_AGENT_SPAWNED' | 'OBJECTIVE_EVENT_TYPE_SUB_AGENT_UPDATED' | 'OBJECTIVE_EVENT_TYPE_FINALIZED' | 'OBJECTIVE_EVENT_TYPE_NOTICE' | 'OBJECTIVE_EVENT_TYPE_TIMED_OUT' | 'OBJECTIVE_EVENT_TYPE_REASONING' | 'OBJECTIVE_EVENT_TYPE_STATE_CHANGED' | 'OBJECTIVE_EVENT_TYPE_HEARTBEAT';\n\nexport interface WebhookDeliveryData {\n /**\n * Related resources\n */\n agentId: string;\n objectiveId: string;\n objectiveEventId: string;\n /**\n * Webhook delivery details\n */\n webhookUrl: string;\n webhookId: string;\n status: WebhookDeliveryDataStatus;\n attemptCount: number;\n lastAttemptAt: string;\n /**\n * Response details. The response body is not retained.\n */\n httpStatusCode: number;\n errorMessage: string;\n latencyMs: number;\n /**\n * The type of objective event that triggered this webhook delivery\n */\n eventType: WebhookDeliveryDataEventType;\n /**\n * Response headers received from the webhook endpoint\n */\n responseHeaders: Record<string, string>;\n /**\n * Content length of the response body in bytes\n */\n responseContentLength: string;\n}\n\n/**\n * The current lifecycle state of the widget. Output only. Widgets are\n * created STATE_ACTIVE; use the :archive and :unarchive actions to\n * transition between states.\n */\nexport type WidgetState = 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_ARCHIVED';\n\n/**\n * Widget is an embeddable chat surface bound to a single agent. Each widget\n * owns a globally unique, immutable DNS label under the widgets domain\n * (e.g. \"k7m2xq9fp4wn.widgets.cadenya.com\"): one widget = one hostname = one\n * origin allowlist = one agent binding. Browsers talk to the widget host with\n * session bearer tokens minted server-side via WidgetSessionService.\n */\nexport interface Widget {\n metadata: ResourceMetadata;\n spec: WidgetSpec;\n info?: WidgetInfo;\n /**\n * The current lifecycle state of the widget. Output only. Widgets are\n * created STATE_ACTIVE; use the :archive and :unarchive actions to\n * transition between states.\n */\n state: WidgetState;\n}\n\n/**\n * WidgetInfo provides read-only server-derived data about a widget.\n */\nexport interface WidgetInfo {\n /**\n * The widget's DNS label — the single hostname label under the widgets\n * domain. Server-generated at creation, globally unique, immutable, and\n * deliberately unrelated to the widget's id.\n */\n dnsLabel: string;\n /**\n * The full hostname browsers talk to. Authoritative — clients must use this\n * value rather than constructing the hostname themselves.\n */\n host: string;\n /**\n * The agent this widget is bound to.\n */\n agent: BareMetadata;\n createdBy?: Profile;\n}\n\n/**\n * The current lifecycle state of the session. Output only. Sessions are\n * created STATE_ACTIVE; use :revoke to end one early.\n */\nexport type WidgetSessionState = 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_EXPIRED' | 'STATE_REVOKED' | 'STATE_EXHAUSTED';\n\n/**\n * WidgetSession is a delegated, narrowed credential for one visitor's use of\n * a widget, minted server-to-server by the customer's backend. The session\n * carries all customer-asserted context — tenant, subject, labels, secrets —\n * and every conversation (objective) created through the widget inherits it.\n * The bearer token returned at mint is short-lived and refreshed at the\n * widget host; the session row is what makes revocation possible.\n */\nexport interface WidgetSession {\n metadata: OperationMetadata;\n spec: WidgetSessionSpec;\n info?: WidgetSessionInfo;\n /**\n * The current lifecycle state of the session. Output only. Sessions are\n * created STATE_ACTIVE; use :revoke to end one early.\n */\n state: WidgetSessionState;\n /**\n * Names of the secrets attached to the session. Values are write-only:\n * provided at creation, encrypted at rest, and interpolated into tool-call\n * headers server-side — never returned by any API.\n */\n secrets: Array<WidgetSession_Secret>;\n}\n\n/**\n * WidgetSessionInfo provides read-only server-derived data about a session.\n */\nexport interface WidgetSessionInfo {\n /**\n * The widget this session belongs to.\n */\n widget: BareMetadata;\n /**\n * The agent serving this session. Copied from the widget at mint and\n * immutable for the session's lifetime — re-pointing the widget's agent\n * affects new sessions only.\n */\n agent: BareMetadata;\n /**\n * The resolved tenant record, when a tenant was asserted at mint.\n */\n tenant?: TenantReference;\n /**\n * The resolved subject record, when a subject was asserted at mint.\n */\n subject?: SubjectReference;\n /**\n * The widget hostname this session's tokens are bound to. Authoritative —\n * clients must use this value rather than constructing the hostname.\n */\n host: string;\n /**\n * Number of conversation messages created through this session, counted\n * against the session's message cap.\n */\n messageCount: number;\n /**\n * When the session last created a conversation, sent a message, or\n * refreshed a token.\n */\n lastActiveAt?: string;\n}\n\n/**\n * WidgetSessionSpec is the configuration of a session, fixed at mint.\n */\nexport interface WidgetSessionSpec {\n /**\n * Widget this session is minted against. Accepts the canonical `wgt_…` form\n * or the `external_id:<value>` form.\n */\n widgetId: string;\n /**\n * Optional tenant assertion — the customer's org/company identifier for the\n * visitor. Upserts the tenant record in the workspace and tags the session\n * and every conversation it creates. Conversation listing at the widget\n * host is scoped to this tenant.\n */\n tenant?: TenantAssertion;\n /**\n * Optional subject assertion — the visitor within the tenant (e.g. their\n * user id in the customer's namespace). Requires `tenant`; a subject\n * asserted without a tenant is rejected with InvalidArgument.\n */\n subject?: SubjectAssertion;\n /**\n * Hard session expiry. Tokens never outlive it; after it passes the session\n * transitions to STATE_EXPIRED. Defaults to a server-chosen horizon when\n * unset.\n */\n expiresAt?: string;\n /**\n * The session bearer token. Returned only on creation — subsequent reads\n * omit it. The token is short-lived; the widget refreshes it at the widget\n * host without involving the customer's backend.\n */\n token: string;\n /**\n * Expiry of the token returned in `token`. Distinct from `expires_at`,\n * which bounds the session itself.\n */\n tokenExpiresAt?: string;\n /**\n * Parameters forced onto tool calls made by this session's conversations.\n * A pinned parameter is removed from the tool schema the LLM sees, and its\n * value is always overwritten server-side with the pinned value — so the\n * model cannot be tricked into calling a tool with a different id than the\n * one the session was minted for (e.g. pin \"workspaceId\" for an OpenAPI\n * tool with a /workspaces/{workspaceId} path). Flows to every objective\n * the session creates. See ToolSetSpec.overlays for binding pinned keys to\n * nested or differently named parameters.\n */\n pinnedParameters?: Record<string, string>;\n}\n\n/**\n * Secret is the name-only echo of a secret attached to the session. Values\n * are never returned.\n */\nexport interface WidgetSession_Secret {\n name: string;\n}\n\n/**\n * WidgetSpec is the user-provided configuration for a widget.\n */\nexport interface WidgetSpec {\n /**\n * Agent this widget is bound to. Accepts the canonical `agent_…` form or the\n * `external_id:<value>` form. Sessions copy the agent at mint: re-pointing a\n * widget's agent affects new sessions only.\n */\n agentId: string;\n /**\n * Optional explicit variation pin. Must belong to the widget's agent. When\n * set, every objective created through the widget runs this variation —\n * bypassing the agent's variation_selection_mode (staged rollout: pin in\n * production, follow in staging, promote by clearing). When unset, the\n * agent's selection mode chooses per conversation.\n */\n variationId?: string;\n /**\n * Web origins allowed to embed and use this widget, enforced at the edge on\n * every browser request. Exact origins only (scheme + host + optional\n * port), no paths, no wildcard subdomains.\n */\n originAllowlist?: Array<string>;\n}\n\n/**\n * Lifecycle status of the workspace. Archived workspaces reject all\n * requests scoped to them. Server-populated.\n */\nexport type WorkspaceStatus = 'STATUS_ENABLED' | 'STATUS_DISABLED' | 'STATUS_ARCHIVED';\n\nexport interface Workspace {\n metadata: AccountResourceMetadata;\n spec: WorkspaceSpec;\n /**\n * Lifecycle status of the workspace. Archived workspaces reject all\n * requests scoped to them. Server-populated.\n */\n status: WorkspaceStatus;\n /**\n * The workspace information\n */\n info?: WorkspaceInfo;\n}\n\n/**\n * WorkspaceInfo returns counts\n */\nexport interface WorkspaceInfo {\n totalAvailableTools: number;\n totalMemoryEntries: number;\n totalAgents: number;\n totalAgentVariations: number;\n}\n\n/**\n * A member of a workspace: the profile granted access plus the actor row that\n * links it to the workspace. Returned by member list/add operations.\n */\nexport interface WorkspaceMember {\n /**\n * The account profile that has access to the workspace.\n */\n profileId: string;\n /**\n * The actor row linking the profile to the workspace (the junction record).\n */\n actorId: string;\n /**\n * Display name of the member's profile.\n */\n name: string;\n /**\n * Email address of the member's profile.\n */\n email: string;\n /**\n * When the member was added to the workspace.\n */\n addedAt?: string;\n}\n\nexport interface WorkspaceSecret {\n metadata: ResourceMetadata;\n spec: WorkspaceSecretSpec;\n /**\n * Workspace secret information\n */\n info?: WorkspaceSecretInfo;\n}\n\nexport interface WorkspaceSecretInfo {\n lastUsedAt?: string;\n createdBy?: Profile;\n}\n\nexport interface WorkspaceSecretSpec {\n value?: string;\n}\n\nexport interface WorkspaceSpec {\n description?: string;\n}\n\n/**\n * The webhook data payload with flat top-level keys for agent, variation, objective, and event.\n */\nexport interface ObjectiveEventWebhookDataData {\n agent: ResourceMetadata;\n agentVariation: ResourceMetadata;\n objective: OperationMetadata;\n objectiveEvent: ObjectiveEvent;\n}\n\n/**\n * The envelope for an objective event webhook delivery. Contains timestamp, event type, and the webhook data payload.\n */\nexport interface ObjectiveEventWebhookData {\n /**\n * The event type, prefixed with objective_event. (e.g., objective_event.tool_result)\n */\n type: string;\n timestamp: string;\n /**\n * The webhook data payload with flat top-level keys for agent, variation, objective, and event.\n */\n data: ObjectiveEventWebhookDataData;\n}\n\nexport interface VariationAssignment_ToolId {\n type: 'toolId';\n /**\n * Canonical tool ID.\n */\n toolId: string;\n}\n\nexport interface VariationAssignment_ToolSetId {\n type: 'toolSetId';\n /**\n * Canonical tool set ID.\n */\n toolSetId: string;\n}\n\nexport interface VariationAssignment_SubAgentId {\n type: 'subAgentId';\n /**\n * Canonical sub-agent ID.\n */\n subAgentId: string;\n}\n\nexport interface ObjectiveToolCallResult_ContentBlock_Text {\n type: 'text';\n text: ObjectiveToolCallResult_TextBlock;\n}\n\nexport interface ObjectiveToolCallResult_ContentBlock_Image {\n type: 'image';\n image: ObjectiveToolCallResult_ImageBlock;\n}\n\nexport interface ObjectiveToolCallResult_ContentBlock_Audio {\n type: 'audio';\n audio: ObjectiveToolCallResult_AudioBlock;\n}\n\nexport interface ToolSetEventData_SyncStarted {\n type: 'syncStarted';\n syncStarted: SyncStarted;\n}\n\nexport interface ToolSetEventData_SyncCompleted {\n type: 'syncCompleted';\n syncCompleted: SyncCompleted;\n}\n\nexport interface ToolSetEventData_SyncFailed {\n type: 'syncFailed';\n syncFailed: SyncFailed;\n}\n\nexport interface ToolSetAdapter_McpVariant {\n type: 'mcp';\n mcp: ToolSetAdapter_MCP;\n}\n\nexport interface ToolSetAdapter_HttpVariant {\n type: 'http';\n http: ToolSetAdapter_HTTP;\n}\n\nexport interface ToolSetAdapter_OpenapiVariant {\n type: 'openapi';\n openapi: ToolSetAdapter_OpenAPI;\n}\n\nexport interface ToolSetAdapter_BareVariant {\n type: 'bare';\n bare: ToolSetAdapter_Bare;\n}\n\nexport interface ToolSetAdapter_StringMatcher_Exact {\n type: 'exact';\n exact: string;\n caseSensitive?: boolean;\n}\n\nexport interface ToolSetAdapter_StringMatcher_StartsWith {\n type: 'startsWith';\n startsWith: string;\n caseSensitive?: boolean;\n}\n\nexport interface ToolSetAdapter_StringMatcher_EndsWith {\n type: 'endsWith';\n endsWith: string;\n caseSensitive?: boolean;\n}\n\nexport interface ToolSetAdapter_StringMatcher_Contains {\n type: 'contains';\n contains: string;\n caseSensitive?: boolean;\n}\n\nexport interface ToolSetAdapter_StringMatcher_Regex {\n type: 'regex';\n regex: string;\n caseSensitive?: boolean;\n}\n\nexport interface ToolSetAdapter_ApprovalRequirementFilter_Always {\n type: 'always';\n always: boolean;\n}\n\nexport interface ToolSetAdapter_ApprovalRequirementFilter_Only {\n type: 'only';\n only: ToolSetAdapter_ToolFilter;\n}\n\nexport interface ToolSetAdapter_OpenAPI_Url {\n type: 'url';\n /**\n * URL to fetch the OpenAPI spec from. Synced automatically every hour.\n */\n url: string;\n /**\n * Headers sent when fetching the spec from a URL and when dispatching tool calls.\n */\n headers?: Record<string, string>;\n includeTools?: ToolSetAdapter_ToolFilter;\n excludeTools?: ToolSetAdapter_ToolFilter;\n toolApprovals?: ToolSetAdapter_ApprovalRequirementFilter;\n /**\n * Base URL for dispatching tool calls. If set, overrides the server\n * resolved from the spec's servers array.\n * \n * May be templated with the same two reference forms the HTTP adapter's\n * base_url accepts:\n * \n * ${SECRET_NAME} a workspace or tool set secret\n * {{ pinned_parameters.<key> }} the objective's pinned parameters\n * \n * A spec written against a single host can therefore be dispatched to a\n * per-tenant one, e.g. https://{{ pinned_parameters.tenant }}.example.com,\n * without cloning the tool set per customer. Validated as an absolute\n * http(s) URL after references are resolved rather than as a literal URI.\n */\n baseUrl?: string;\n /**\n * Name of the server entry in the spec's servers array (OpenAPI 3.2\n * server.name field). Used to select which server URL to dispatch to\n * when base_url is not set. If unset, the first server is used.\n * Ignored when base_url is set.\n */\n serverName?: string;\n}\n\nexport interface ToolSetAdapter_OpenAPI_UploadId {\n type: 'uploadId';\n /**\n * ID of a COMPLETE Upload containing the OpenAPI spec document.\n */\n uploadId: string;\n /**\n * Headers sent when fetching the spec from a URL and when dispatching tool calls.\n */\n headers?: Record<string, string>;\n includeTools?: ToolSetAdapter_ToolFilter;\n excludeTools?: ToolSetAdapter_ToolFilter;\n toolApprovals?: ToolSetAdapter_ApprovalRequirementFilter;\n /**\n * Base URL for dispatching tool calls. If set, overrides the server\n * resolved from the spec's servers array.\n * \n * May be templated with the same two reference forms the HTTP adapter's\n * base_url accepts:\n * \n * ${SECRET_NAME} a workspace or tool set secret\n * {{ pinned_parameters.<key> }} the objective's pinned parameters\n * \n * A spec written against a single host can therefore be dispatched to a\n * per-tenant one, e.g. https://{{ pinned_parameters.tenant }}.example.com,\n * without cloning the tool set per customer. Validated as an absolute\n * http(s) URL after references are resolved rather than as a literal URI.\n */\n baseUrl?: string;\n /**\n * Name of the server entry in the spec's servers array (OpenAPI 3.2\n * server.name field). Used to select which server URL to dispatch to\n * when base_url is not set. If unset, the first server is used.\n * Ignored when base_url is set.\n */\n serverName?: string;\n}\n\nexport interface Selector_Condition_Attribute {\n type: 'attribute';\n /**\n * Match on a tool attribute (name, title, description,\n * llm_tool_name) with a string matcher — the same filter used by\n * the adapter's include/exclude lists.\n */\n attribute: ToolSetAdapter_AttributeFilter;\n}\n\nexport interface Selector_Condition_HasParameter {\n type: 'hasParameter';\n /**\n * Match tools whose parameter schema contains the given path. This\n * is the usual way to target \"every tool that takes a workspaceId\"\n * without enumerating tools by name.\n */\n hasParameter: ToolOverlay_ParameterPath;\n}\n\nexport interface Selector_Condition_Tools {\n type: 'tools';\n /**\n * Match specific tools by LLM tool name. The direct way to assign an\n * overlay to one tool (or a handful) without writing a matcher.\n */\n tools: Selector_ToolNames;\n}\n\nexport interface ToolOverlay_ParameterAction_Remove {\n type: 'remove';\n remove: ParameterAction_Remove;\n}\n\nexport interface ToolOverlay_ParameterAction_Set {\n type: 'set';\n set: ParameterAction_Set;\n}\n\nexport interface ToolOverlay_ParameterAction_Pin {\n type: 'pin';\n pin: ParameterAction_Pin;\n}\n\nexport interface ToolOverlay_ResultAction_Transform {\n type: 'transform';\n transform: ResultAction_Transform;\n}\n\nexport interface ToolSpec_Config_Http {\n type: 'http';\n http: Config_HTTP;\n}\n\nexport interface ToolSpec_Config_Mcp {\n type: 'mcp';\n mcp: Config_MCP;\n}\n\nexport interface ToolSpec_Config_Openapi {\n type: 'openapi';\n openapi: Config_OpenAPI;\n}\n\nexport interface ToolSpec_Config_Bare {\n type: 'bare';\n bare: Config_Bare;\n}\n\nexport interface ObjectiveEventData_UserMessage {\n type: 'userMessage';\n userMessage: UserMessage;\n}\n\nexport interface ObjectiveEventData_ToolApprovalRequested {\n type: 'toolApprovalRequested';\n toolApprovalRequested: ToolApprovalRequested;\n}\n\nexport interface ObjectiveEventData_ToolApproved {\n type: 'toolApproved';\n toolApproved: ToolApproved;\n}\n\nexport interface ObjectiveEventData_ToolDenied {\n type: 'toolDenied';\n toolDenied: ToolDenied;\n}\n\nexport interface ObjectiveEventData_ToolCalled {\n type: 'toolCalled';\n toolCalled: ToolCalled;\n}\n\nexport interface ObjectiveEventData_Error {\n type: 'error';\n error: ObjectiveError;\n}\n\nexport interface ObjectiveEventData_AssistantMessage {\n type: 'assistantMessage';\n assistantMessage: AssistantMessage;\n}\n\nexport interface ObjectiveEventData_ToolResult {\n type: 'toolResult';\n toolResult: ToolResult;\n}\n\nexport interface ObjectiveEventData_ToolError {\n type: 'toolError';\n toolError: ToolError;\n}\n\nexport interface ObjectiveEventData_ContextWindowCompacted {\n type: 'contextWindowCompacted';\n contextWindowCompacted: ContextWindowCompacted;\n}\n\nexport interface ObjectiveEventData_MemoryRead {\n type: 'memoryRead';\n memoryRead: MemoryRead;\n}\n\nexport interface ObjectiveEventData_Cancelled {\n type: 'cancelled';\n cancelled: ObjectiveCancelled;\n}\n\nexport interface ObjectiveEventData_SubAgentSpawned {\n type: 'subAgentSpawned';\n subAgentSpawned: SubAgentSpawned;\n}\n\nexport interface ObjectiveEventData_SubAgentUpdated {\n type: 'subAgentUpdated';\n subAgentUpdated: SubAgentUpdated;\n}\n\nexport interface ObjectiveEventData_Finalized {\n type: 'finalized';\n finalized: ObjectiveFinalized;\n}\n\nexport interface ObjectiveEventData_Notice {\n type: 'notice';\n notice: Notice;\n}\n\nexport interface ObjectiveEventData_TimedOut {\n type: 'timedOut';\n timedOut: ObjectiveTimedOut;\n}\n\nexport interface ObjectiveEventData_Reasoning {\n type: 'reasoning';\n reasoning: Reasoning;\n}\n\nexport interface ObjectiveEventData_StateChanged {\n type: 'stateChanged';\n stateChanged: ObjectiveStateChanged;\n}\n\nexport interface ObjectiveEventData_Heartbeat {\n type: 'heartbeat';\n heartbeat: ObjectiveHeartbeat;\n}\n\nexport interface CallableTool_Tool {\n type: 'tool';\n tool: ResourceMetadata;\n}\n\nexport interface CallableTool_Agent {\n type: 'agent';\n agent: ResourceMetadata;\n}\n\nexport interface CallableTool_CadenyaProvidedTool {\n type: 'cadenyaProvidedTool';\n cadenyaProvidedTool: ResourceMetadata;\n}\n\nexport interface MemoryEntryCreateSpec_Content {\n type: 'content';\n /**\n * Inline content, written directly into the entry.\n */\n content: string;\n /**\n * See MemoryEntrySpec.key for the full rule set. Same constraints apply\n * here.\n */\n key: string;\n description?: string;\n}\n\nexport interface MemoryEntryCreateSpec_UploadId {\n type: 'uploadId';\n /**\n * ID of a COMPLETE Upload. The server reads the object from storage,\n * copies its bytes into the entry, and marks the upload consumed.\n */\n uploadId: string;\n /**\n * See MemoryEntrySpec.key for the full rule set. Same constraints apply\n * here.\n */\n key: string;\n description?: string;\n}\n\nexport interface SetToolCallContentRequest_ContentBlock_Text {\n type: 'text';\n text: SetToolCallContentRequest_TextBlock;\n}\n\nexport interface SetToolCallContentRequest_ContentBlock_Image {\n type: 'image';\n image: SetToolCallContentRequest_ImageBlock;\n}\n\nexport interface SetToolCallContentRequest_ContentBlock_Audio {\n type: 'audio';\n audio: SetToolCallContentRequest_AudioBlock;\n}\n\nexport interface AddAgentVariationAssignmentRequest_ToolId {\n type: 'toolId';\n toolId: string;\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n}\n\nexport interface AddAgentVariationAssignmentRequest_ToolSetId {\n type: 'toolSetId';\n toolSetId: string;\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n}\n\nexport interface AddAgentVariationAssignmentRequest_SubAgentId {\n type: 'subAgentId';\n subAgentId: string;\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n}\n\nexport interface RemoveAgentVariationAssignmentRequest_ToolId {\n type: 'toolId';\n toolId: string;\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n}\n\nexport interface RemoveAgentVariationAssignmentRequest_ToolSetId {\n type: 'toolSetId';\n toolSetId: string;\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n}\n\nexport interface RemoveAgentVariationAssignmentRequest_SubAgentId {\n type: 'subAgentId';\n subAgentId: string;\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n}\n\nexport interface AIProviderCredential_ApiKey {\n type: 'apiKey';\n /**\n * Single API key (OpenRouter, OpenAI, Anthropic, Gemini, and most others).\n */\n apiKey: CredentialAPIKey;\n}\n\nexport interface AIProviderCredential_Headers {\n type: 'headers';\n /**\n * Arbitrary auth headers, for generic endpoints that authenticate with a\n * custom header rather than a bearer key (pairs with the OpenAI-compatible\n * provider).\n */\n headers: CredentialHeaders;\n}\n\nexport interface AIProviderCredential_GoogleServiceAccount {\n type: 'googleServiceAccount';\n /**\n * Google service-account JSON for Vertex AI. The server accepts only the\n * service_account credential type and never writes the JSON to plaintext\n * storage.\n */\n googleServiceAccount: CredentialGoogleServiceAccount;\n}\n\nexport interface AIProviderCredential_AwsAccessKey {\n type: 'awsAccessKey';\n /**\n * AWS access credentials for Bedrock SigV4 authentication.\n */\n awsAccessKey: CredentialAWSAccessKey;\n}\n\nexport interface AIProviderConfig_Openrouter {\n type: 'openrouter';\n openrouter: OpenRouterConfig;\n}\n\nexport interface AIProviderConfig_Openai {\n type: 'openai';\n openai: OpenAIConfig;\n}\n\nexport interface AIProviderConfig_OpenaiCompatible {\n type: 'openaiCompatible';\n openaiCompatible: OpenAICompatibleConfig;\n}\n\nexport interface AIProviderConfig_Vertex {\n type: 'vertex';\n vertex: VertexConfig;\n}\n\nexport interface AIProviderConfig_Bedrock {\n type: 'bedrock';\n bedrock: BedrockConfig;\n}\n\nexport interface ModelSpec_Capability_Temperature {\n type: 'temperature';\n temperature: Capability_Temperature;\n}\n\nexport interface ModelSpec_Capability_TopP {\n type: 'topP';\n topP: Capability_TopP;\n}\n\nexport interface ModelSpec_Capability_TopK {\n type: 'topK';\n topK: Capability_TopK;\n}\n\nexport interface ModelSpec_Capability_StopSequences {\n type: 'stopSequences';\n stopSequences: Capability_StopSequences;\n}\n\nexport interface ModelSpec_Capability_MaxOutputTokens {\n type: 'maxOutputTokens';\n maxOutputTokens: Capability_MaxOutputTokens;\n}\n\nexport interface ModelSpec_Capability_Reasoning {\n type: 'reasoning';\n reasoning: Capability_Reasoning;\n}\n\nexport interface ModelSpec_Capability_Caching {\n type: 'caching';\n caching: Capability_Caching;\n}\n\nexport type AgentServiceListAgentsState = 'STATE_UNSPECIFIED' | 'STATE_DRAFT' | 'STATE_PUBLISHED' | 'STATE_ARCHIVED';\n\nexport type AgentServiceListAgentsVariationSelectionMode = 'VARIATION_SELECTION_MODE_UNSPECIFIED' | 'VARIATION_SELECTION_MODE_RANDOM' | 'VARIATION_SELECTION_MODE_WEIGHTED';\n\nexport type AgentServiceListAgentFeedbackSentiment = 'FEEDBACK_SENTIMENT_UNSPECIFIED' | 'FEEDBACK_SENTIMENT_POSITIVE' | 'FEEDBACK_SENTIMENT_NEGATIVE';\n\nexport type AgentServiceListAgentWebhookDeliveriesEventType = 'OBJECTIVE_EVENT_TYPE_UNSPECIFIED' | 'OBJECTIVE_EVENT_TYPE_USER_MESSAGE' | 'OBJECTIVE_EVENT_TYPE_TOOL_APPROVAL_REQUESTED' | 'OBJECTIVE_EVENT_TYPE_TOOL_APPROVED' | 'OBJECTIVE_EVENT_TYPE_TOOL_DENIED' | 'OBJECTIVE_EVENT_TYPE_TOOL_CALLED' | 'OBJECTIVE_EVENT_TYPE_ERROR' | 'OBJECTIVE_EVENT_TYPE_ASSISTANT_MESSAGE' | 'OBJECTIVE_EVENT_TYPE_TOOL_RESULT' | 'OBJECTIVE_EVENT_TYPE_TOOL_ERROR' | 'OBJECTIVE_EVENT_TYPE_CONTEXT_WINDOW_COMPACTED' | 'OBJECTIVE_EVENT_TYPE_MEMORY_READ' | 'OBJECTIVE_EVENT_TYPE_CANCELLED' | 'OBJECTIVE_EVENT_TYPE_SUB_AGENT_SPAWNED' | 'OBJECTIVE_EVENT_TYPE_SUB_AGENT_UPDATED' | 'OBJECTIVE_EVENT_TYPE_FINALIZED' | 'OBJECTIVE_EVENT_TYPE_NOTICE' | 'OBJECTIVE_EVENT_TYPE_TIMED_OUT' | 'OBJECTIVE_EVENT_TYPE_REASONING' | 'OBJECTIVE_EVENT_TYPE_STATE_CHANGED' | 'OBJECTIVE_EVENT_TYPE_HEARTBEAT';\n\nexport type MemoryServiceListMemoryLayersType = 'MEMORY_LAYER_TYPE_UNSPECIFIED' | 'MEMORY_LAYER_TYPE_EPISODIC' | 'MEMORY_LAYER_TYPE_SKILLS';\n\nexport type ModelServiceListModelsState = 'STATE_UNSPECIFIED' | 'STATE_ENABLED' | 'STATE_DISABLED';\n\nexport type ObjectiveServiceListObjectivesState = 'OBJECTIVE_STATE_UNSPECIFIED' | 'OBJECTIVE_STATE_PENDING' | 'OBJECTIVE_STATE_RUNNING' | 'OBJECTIVE_STATE_WAITING' | 'OBJECTIVE_STATE_FAILED' | 'OBJECTIVE_STATE_CANCELLED' | 'OBJECTIVE_STATE_FINALIZED' | 'OBJECTIVE_STATE_TIMED_OUT';\n\nexport type ObjectiveServiceListObjectiveToolCallsStatus = 'TOOL_CALL_STATUS_UNSPECIFIED' | 'TOOL_CALL_STATUS_AUTO_APPROVED' | 'TOOL_CALL_STATUS_WAITING_FOR_APPROVAL' | 'TOOL_CALL_STATUS_APPROVED' | 'TOOL_CALL_STATUS_DENIED';\n\nexport type ObjectiveServiceListObjectiveToolCallsExecutionStatus = 'TOOL_CALL_EXECUTION_STATUS_UNSPECIFIED' | 'TOOL_CALL_EXECUTION_STATUS_PENDING' | 'TOOL_CALL_EXECUTION_STATUS_RUNNING' | 'TOOL_CALL_EXECUTION_STATUS_COMPLETED' | 'TOOL_CALL_EXECUTION_STATUS_ERRORED' | 'TOOL_CALL_EXECUTION_STATUS_WAITING_FOR_CONTENT';\n\nexport type ToolServiceListToolSetsState = 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_ARCHIVED';\n\nexport type ToolServiceListToolsStates = 'STATE_UNSPECIFIED' | 'STATE_AVAILABLE' | 'STATE_OMITTED' | 'STATE_ARCHIVED';\n\nexport type WidgetSessionServiceListWidgetSessionsState = 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_EXPIRED' | 'STATE_REVOKED' | 'STATE_EXHAUSTED';\n\n\n// ---- request input shapes (direction-aware) ----\n\nexport interface APIKeySpecParam {\n /**\n * Free-form description of what this API key is used for.\n */\n description?: string;\n /**\n * Scopes granted to this key. Each entry is a colon-separated\n * resource:verb string (e.g. \"objectives:manage\").\n * \n * Resources: agents, objectives, tools, memory, api_keys, workspaces,\n * widgets, widget_sessions, secrets, account.\n * Verbs: read and manage, where manage implies read — a stored scope set\n * is normalized to drop \"x:read\" when \"x:manage\" is present. The secrets\n * and account resources support only manage. \"*\" is an explicit\n * full-access grant.\n * \n * Scopes are deny-by-default: a key with an empty list can call only\n * scope-free endpoints. Full access is always an explicit \"*\" grant.\n */\n permissions?: Array<string>;\n}\n\nexport type AddAgentVariationAssignmentRequestParam = AddAgentVariationAssignmentRequest_ToolIdParam | AddAgentVariationAssignmentRequest_ToolSetIdParam | AddAgentVariationAssignmentRequest_SubAgentIdParam;\n\nexport interface CreateAgentVariationRequestParam {\n metadata: CreateResourceMetadata;\n spec: AgentVariationSpec;\n}\n\nexport interface MemoryLayerSpecParam {\n type: MemoryLayerSpecType;\n /**\n * Human-readable description of the layer's purpose. Encouraged for\n * user-created layers; system-managed layers may have a generated description.\n */\n description?: string;\n}\n\nexport interface ObjectiveEpisodicConfigParam {\n /**\n * The caller-supplied episodic key. Objectives created with the same key\n * (for the same agent) share one episodic memory layer.\n */\n key: string;\n}\n\nexport type RemoveAgentVariationAssignmentRequestParam = RemoveAgentVariationAssignmentRequest_ToolIdParam | RemoveAgentVariationAssignmentRequest_ToolSetIdParam | RemoveAgentVariationAssignmentRequest_SubAgentIdParam;\n\nexport interface WidgetSessionSpecParam {\n /**\n * Widget this session is minted against. Accepts the canonical `wgt_…` form\n * or the `external_id:<value>` form.\n */\n widgetId: string;\n /**\n * Optional tenant assertion — the customer's org/company identifier for the\n * visitor. Upserts the tenant record in the workspace and tags the session\n * and every conversation it creates. Conversation listing at the widget\n * host is scoped to this tenant.\n */\n tenant?: TenantAssertion;\n /**\n * Optional subject assertion — the visitor within the tenant (e.g. their\n * user id in the customer's namespace). Requires `tenant`; a subject\n * asserted without a tenant is rejected with InvalidArgument.\n */\n subject?: SubjectAssertion;\n /**\n * Hard session expiry. Tokens never outlive it; after it passes the session\n * transitions to STATE_EXPIRED. Defaults to a server-chosen horizon when\n * unset.\n */\n expiresAt?: string;\n /**\n * Parameters forced onto tool calls made by this session's conversations.\n * A pinned parameter is removed from the tool schema the LLM sees, and its\n * value is always overwritten server-side with the pinned value — so the\n * model cannot be tricked into calling a tool with a different id than the\n * one the session was minted for (e.g. pin \"workspaceId\" for an OpenAPI\n * tool with a /workspaces/{workspaceId} path). Flows to every objective\n * the session creates. See ToolSetSpec.overlays for binding pinned keys to\n * nested or differently named parameters.\n */\n pinnedParameters?: Record<string, string>;\n}\n\nexport interface AddAgentVariationAssignmentRequest_ToolIdParam {\n type: 'toolId';\n toolId: string;\n}\n\nexport interface AddAgentVariationAssignmentRequest_ToolSetIdParam {\n type: 'toolSetId';\n toolSetId: string;\n}\n\nexport interface AddAgentVariationAssignmentRequest_SubAgentIdParam {\n type: 'subAgentId';\n subAgentId: string;\n}\n\nexport interface RemoveAgentVariationAssignmentRequest_ToolIdParam {\n type: 'toolId';\n toolId: string;\n}\n\nexport interface RemoveAgentVariationAssignmentRequest_ToolSetIdParam {\n type: 'toolSetId';\n toolSetId: string;\n}\n\nexport interface RemoveAgentVariationAssignmentRequest_SubAgentIdParam {\n type: 'subAgentId';\n subAgentId: string;\n}\n\n\n// ---- request wire projections (strip readOnly at runtime) ----\n\nexport function wireArray<T>(value: Array<T> | null | undefined, fn: (v: T) => unknown): unknown {\n return value == null ? value : value.map(fn);\n}\n\nexport function wireMap<T>(value: Record<string, T> | null | undefined, fn: (v: T) => unknown): unknown {\n return value == null ? value : Object.fromEntries(Object.entries(value).map(([k, v]) => [k, fn(v)]));\n}\n\nexport function wireAPIKeySpec(value: APIKeySpecParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.description !== undefined) out[\"description\"] = value.description;\n if (value.permissions !== undefined) out[\"permissions\"] = value.permissions;\n return out;\n}\n\nexport function wireAddAgentVariationAssignmentRequest(value: AddAgentVariationAssignmentRequestParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n switch ((value as never as Record<string, unknown>)[\"type\"]) {\n case \"toolId\": return wireAddAgentVariationAssignmentRequest_ToolId((value as never));\n case \"toolSetId\": return wireAddAgentVariationAssignmentRequest_ToolSetId((value as never));\n case \"subAgentId\": return wireAddAgentVariationAssignmentRequest_SubAgentId((value as never));\n default: return value;\n }\n}\n\nexport function wireCreateAgentVariationRequest(value: CreateAgentVariationRequestParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.metadata !== undefined) out[\"metadata\"] = value.metadata;\n if (value.spec !== undefined) out[\"spec\"] = value.spec;\n return out;\n}\n\nexport function wireMemoryLayerSpec(value: MemoryLayerSpecParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.type !== undefined) out[\"type\"] = value.type;\n if (value.description !== undefined) out[\"description\"] = value.description;\n return out;\n}\n\nexport function wireObjectiveEpisodicConfig(value: ObjectiveEpisodicConfigParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.key !== undefined) out[\"key\"] = value.key;\n return out;\n}\n\nexport function wireRemoveAgentVariationAssignmentRequest(value: RemoveAgentVariationAssignmentRequestParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n switch ((value as never as Record<string, unknown>)[\"type\"]) {\n case \"toolId\": return wireRemoveAgentVariationAssignmentRequest_ToolId((value as never));\n case \"toolSetId\": return wireRemoveAgentVariationAssignmentRequest_ToolSetId((value as never));\n case \"subAgentId\": return wireRemoveAgentVariationAssignmentRequest_SubAgentId((value as never));\n default: return value;\n }\n}\n\nexport function wireWidgetSessionSpec(value: WidgetSessionSpecParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.widgetId !== undefined) out[\"widgetId\"] = value.widgetId;\n if (value.tenant !== undefined) out[\"tenant\"] = value.tenant;\n if (value.subject !== undefined) out[\"subject\"] = value.subject;\n if (value.expiresAt !== undefined) out[\"expiresAt\"] = value.expiresAt;\n if (value.pinnedParameters !== undefined) out[\"pinnedParameters\"] = value.pinnedParameters;\n return out;\n}\n\nexport function wireAddAgentVariationAssignmentRequest_ToolId(value: AddAgentVariationAssignmentRequest_ToolIdParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.type !== undefined) out[\"type\"] = value.type;\n if (value.toolId !== undefined) out[\"toolId\"] = value.toolId;\n return out;\n}\n\nexport function wireAddAgentVariationAssignmentRequest_ToolSetId(value: AddAgentVariationAssignmentRequest_ToolSetIdParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.type !== undefined) out[\"type\"] = value.type;\n if (value.toolSetId !== undefined) out[\"toolSetId\"] = value.toolSetId;\n return out;\n}\n\nexport function wireAddAgentVariationAssignmentRequest_SubAgentId(value: AddAgentVariationAssignmentRequest_SubAgentIdParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.type !== undefined) out[\"type\"] = value.type;\n if (value.subAgentId !== undefined) out[\"subAgentId\"] = value.subAgentId;\n return out;\n}\n\nexport function wireRemoveAgentVariationAssignmentRequest_ToolId(value: RemoveAgentVariationAssignmentRequest_ToolIdParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.type !== undefined) out[\"type\"] = value.type;\n if (value.toolId !== undefined) out[\"toolId\"] = value.toolId;\n return out;\n}\n\nexport function wireRemoveAgentVariationAssignmentRequest_ToolSetId(value: RemoveAgentVariationAssignmentRequest_ToolSetIdParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.type !== undefined) out[\"type\"] = value.type;\n if (value.toolSetId !== undefined) out[\"toolSetId\"] = value.toolSetId;\n return out;\n}\n\nexport function wireRemoveAgentVariationAssignmentRequest_SubAgentId(value: RemoveAgentVariationAssignmentRequest_SubAgentIdParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.type !== undefined) out[\"type\"] = value.type;\n if (value.subAgentId !== undefined) out[\"subAgentId\"] = value.subAgentId;\n return out;\n}\n\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAsrM7C,iEAAiE;AAEjE,MAAM,UAAU,SAAS,CAAI,KAAkC,EAAE,EAAqB;IACpF,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,OAAO,CAAI,KAA2C,EAAE,EAAqB;IAC3F,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvG,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAyC;IACtE,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS;QAAE,GAAG,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC;IAC5E,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS;QAAE,GAAG,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC;IAC5E,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,sCAAsC,CAAC,KAAiE;IACtH,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,QAAS,KAA0C,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5D,KAAK,QAAQ,CAAC,CAAC,OAAO,6CAA6C,CAAE,KAAe,CAAC,CAAC;QACtF,KAAK,WAAW,CAAC,CAAC,OAAO,gDAAgD,CAAE,KAAe,CAAC,CAAC;QAC5F,KAAK,YAAY,CAAC,CAAC,OAAO,iDAAiD,CAAE,KAAe,CAAC,CAAC;QAC9F,KAAK,aAAa,CAAC,CAAC,OAAO,kDAAkD,CAAE,KAAe,CAAC,CAAC;QAChG,OAAO,CAAC,CAAC,OAAO,KAAK,CAAC;IACxB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,KAA0D;IACxG,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS;QAAE,GAAG,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC;IACnE,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IACvD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAA8C;IAChF,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IACvD,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS;QAAE,GAAG,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC;IAC5E,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,KAAsD;IAChG,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS;QAAE,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;IACpD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,yCAAyC,CAAC,KAAoE;IAC5H,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,QAAS,KAA0C,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5D,KAAK,QAAQ,CAAC,CAAC,OAAO,gDAAgD,CAAE,KAAe,CAAC,CAAC;QACzF,KAAK,WAAW,CAAC,CAAC,OAAO,mDAAmD,CAAE,KAAe,CAAC,CAAC;QAC/F,KAAK,YAAY,CAAC,CAAC,OAAO,oDAAoD,CAAE,KAAe,CAAC,CAAC;QACjG,KAAK,aAAa,CAAC,CAAC,OAAO,qDAAqD,CAAE,KAAe,CAAC,CAAC;QACnG,OAAO,CAAC,CAAC,OAAO,KAAK,CAAC;IACxB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAgD;IACpF,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS;QAAE,GAAG,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC;IACnE,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IAC7D,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS;QAAE,GAAG,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC;IAChE,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;QAAE,GAAG,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;IACtE,IAAI,KAAK,CAAC,gBAAgB,KAAK,SAAS;QAAE,GAAG,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC,gBAAgB,CAAC;IAC3F,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,6CAA6C,CAAC,KAAwE;IACpI,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IACvD,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IAC7D,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,gDAAgD,CAAC,KAA2E;IAC1I,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IACvD,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;QAAE,GAAG,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;IACtE,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,iDAAiD,CAAC,KAA4E;IAC5I,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IACvD,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS;QAAE,GAAG,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC;IACzE,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,kDAAkD,CAAC,KAA6E;IAC9I,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IACvD,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS;QAAE,GAAG,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC;IAC5E,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,gDAAgD,CAAC,KAA2E;IAC1I,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IACvD,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IAC7D,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,mDAAmD,CAAC,KAA8E;IAChJ,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IACvD,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;QAAE,GAAG,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;IACtE,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,oDAAoD,CAAC,KAA+E;IAClJ,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IACvD,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS;QAAE,GAAG,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC;IACzE,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,qDAAqD,CAAC,KAAgF;IACpJ,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IACvD,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS;QAAE,GAAG,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC;IAC5E,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// Generated by redwood. Do not edit by hand.\n\n/**\n * AIProviderConfig holds non-secret, provider-specific settings. The set case\n * must correspond to AIProviderKeySpec.provider. Providers with no settings\n * (Anthropic, Gemini) simply leave this unset. The endpoint of a named provider\n * is fixed and intentionally not overridable here; use the OpenAI-compatible\n * provider to target a custom endpoint.\n */\nexport type AIProviderConfig =\n | AIProviderConfig_Openrouter\n | AIProviderConfig_Openai\n | AIProviderConfig_OpenaiCompatible\n | AIProviderConfig_Vertex\n | AIProviderConfig_Bedrock;\n\n/**\n * AIProviderCredential is the secret material used to authenticate with a\n * provider. The set case must correspond to AIProviderKeySpec.provider. The\n * server classifies and encrypts sensitive fields at rest and never returns\n * secret values on reads.\n */\nexport type AIProviderCredential =\n | AIProviderCredential_ApiKey\n | AIProviderCredential_Headers\n | AIProviderCredential_GoogleServiceAccount\n | AIProviderCredential_AwsAccessKey;\n\n/**\n * AIProviderCredentialFieldStatus is the safe read representation of one\n * credential field. Value is populated only when sensitive is false.\n */\nexport interface AIProviderCredentialFieldStatus {\n name?: string;\n sensitive?: boolean;\n configured?: boolean;\n value?: string;\n}\n\n/**\n * AIProviderCredentialPatch changes selected fields of the current credential.\n * Omitted values are retained and clear_fields explicitly removes optional\n * fields. Changing type replaces the credential and requires all mandatory\n * fields for the new type.\n */\nexport interface AIProviderCredentialPatch {\n credentials?: AIProviderCredential;\n clearFields?: Array<string>;\n}\n\n/**\n * AIProviderCredentialStatus describes the stored authentication method and\n * its fields without returning secret material.\n */\nexport interface AIProviderCredentialStatus {\n type?: string;\n fields?: Array<AIProviderCredentialFieldStatus>;\n}\n\n/**\n * AIProviderKey is a credential for an AI provider, scoped to a workspace.\n * Most keys are customer-provided (BYOK); Cadenya also provisions promotional\n * keys (see AIProviderKeyInfo.is_promotional), which cannot be modified or\n * deleted by account administrators. The secret value is never returned in\n * responses.\n */\nexport interface AIProviderKey {\n metadata: ResourceMetadata;\n spec: AIProviderKeySpec;\n /**\n * Server-populated info (e.g. how many models route through this key).\n * Populated on reads when requested; see ListAIProviderKeysRequest.include_info.\n */\n info?: AIProviderKeyInfo;\n}\n\n/**\n * How models on this key are maintained; see ModelManagement.\n */\nexport type AiProviderKeyInfoModelManagement = 'MODEL_MANAGEMENT_UNSPECIFIED' | 'MODEL_MANAGEMENT_CADENYA' | 'MODEL_MANAGEMENT_SYNCED' | 'MODEL_MANAGEMENT_CUSTOMIZABLE' | 'MODEL_MANAGEMENT_MANUAL';\n\n/**\n * AIProviderKeyInfo carries server-derived, read-only details about a key, for\n * AI provider management UIs.\n */\nexport interface AIProviderKeyInfo {\n /**\n * Number of enabled models provisioned on this key.\n */\n enabledModelCount: number;\n /**\n * Number of disabled models provisioned on this key.\n */\n disabledModelCount: number;\n /**\n * Cadenya includes promotional keys (one for onboarding, and potentially more in the future).\n * These are not added or maintained by account administrators.\n */\n isPromotional: boolean;\n /**\n * Safe-to-display credential state. Secret values are never populated;\n * configured reports whether a value is present without revealing it.\n */\n credentialStatus?: AIProviderCredentialStatus;\n /**\n * How models on this key are maintained; see ModelManagement.\n */\n modelManagement: AiProviderKeyInfoModelManagement;\n}\n\n/**\n * The AI provider this key authenticates against.\n */\nexport type AiProviderKeySpecProvider = 'AI_PROVIDER_UNSPECIFIED' | 'AI_PROVIDER_OPENROUTER' | 'AI_PROVIDER_OPENAI' | 'AI_PROVIDER_ANTHROPIC' | 'AI_PROVIDER_GEMINI' | 'AI_PROVIDER_OPENAI_COMPATIBLE' | 'AI_PROVIDER_VERTEX' | 'AI_PROVIDER_BEDROCK';\n\nexport interface AIProviderKeySpec {\n /**\n * The AI provider this key authenticates against.\n */\n provider?: AiProviderKeySpecProvider;\n /**\n * The provider credential. Accepted on create/update; never populated in\n * responses (the server returns an empty value to avoid leaking the secret).\n */\n credentials?: AIProviderCredential;\n /**\n * Non-secret, provider-specific settings (OpenAI org/project, OpenRouter\n * region, OpenAI-compatible base URL, Vertex project/location, or Bedrock\n * Region). The set case must correspond to `provider`. Returned on reads.\n * Optional for providers that have usable defaults.\n */\n config?: AIProviderConfig;\n}\n\n/**\n * The current lifecycle state of the API key. Output only. Keys are\n * created STATE_ENABLED; use the :disable and :enable actions to\n * transition between states.\n */\nexport type ApiKeyState = 'STATE_UNSPECIFIED' | 'STATE_ENABLED' | 'STATE_DISABLED';\n\n/**\n * An API key. Every key belongs to exactly one workspace and is managed via\n * the workspace-scoped API key routes. The only exception is the\n * system-managed global account key, which spans all workspaces and is\n * managed via the account global_api_key routes.\n */\nexport interface APIKey {\n metadata: AccountResourceMetadata;\n spec: APIKeySpec;\n info?: APIKeyInfo;\n /**\n * The current lifecycle state of the API key. Output only. Keys are\n * created STATE_ENABLED; use the :disable and :enable actions to\n * transition between states.\n */\n state: ApiKeyState;\n}\n\nexport interface APIKeyInfo {\n /**\n * The profile that created the key.\n */\n createdBy?: Profile;\n}\n\n/**\n * Configuration for an API key.\n */\nexport interface APIKeySpec {\n /**\n * The bearer token used to authenticate as this API key. Returned only on\n * creation and rotation; subsequent reads omit this field.\n */\n token: string;\n /**\n * Free-form description of what this API key is used for.\n */\n description?: string;\n /**\n * Scopes granted to this key. Each entry is a colon-separated\n * resource:verb string (e.g. \"objectives:manage\").\n * \n * Resources: agents, objectives, tools, memory, api_keys, workspaces,\n * widgets, widget_sessions, secrets, account.\n * Verbs: read and manage, where manage implies read — a stored scope set\n * is normalized to drop \"x:read\" when \"x:manage\" is present. The secrets\n * and account resources support only manage. \"*\" is an explicit\n * full-access grant.\n * \n * Scopes are deny-by-default: a key with an empty list can call only\n * scope-free endpoints. Full access is always an explicit \"*\" grant.\n */\n permissions?: Array<string>;\n /**\n * True when this key is managed by the system (i.e. the auto-provisioned\n * global account key). System keys cannot be deleted but can be rotated.\n */\n system: boolean;\n}\n\n/**\n * An account, the top-level organizational unit. Contains workspaces and\n * account-wide settings such as the webhook signing secret.\n */\nexport interface Account {\n metadata: AccountResourceMetadata;\n spec: AccountSpec;\n info: AccountInfo;\n}\n\n/**\n * Server-populated information about the account.\n */\nexport interface AccountInfo {\n /**\n * The generated secret that will sign all webhooks that are sent to your configured Webhook URL.\n * Formatted as \"wh_asdf1234\" per the https://www.standardwebhooks.com/ format.\n */\n webhookEventsHmacSecret: string;\n /**\n * The challenge token Cadenya sends in the X-Cadenya-Challenge-Token header\n * on every MCP tools/list request. Server implementations can accept a valid\n * challenge token in place of per-user auth when listing tools, while still\n * requiring real auth on tools/call. Rotate with RotateChallengeToken; update\n * any servers validating the token before rotating.\n */\n challengeToken: string;\n}\n\n/**\n * AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace.\n */\nexport interface AccountResourceMetadata {\n /**\n * Unique identifier for the resource (prefixed ULID, e.g., \"apikey_01HXK...\")\n */\n id: string;\n /**\n * Account this resource belongs to for multi-tenant isolation (prefixed ULID)\n */\n accountId: string;\n /**\n * Human-readable name for the resource (e.g., \"Customer Support Agent\", \"Email Tool\")\n * Required for resources that users interact with directly\n */\n name: string;\n /**\n * External ID for the resource (e.g., a workflow ID from an external system)\n */\n externalId: string;\n /**\n * Key-value pairs for categorization and filtering. Values are 0-63\n * alphanumeric characters with \"-\", \"_\", or \".\" allowed between; keys\n * follow the same shape and additionally accept an optional DNS-subdomain\n * prefix (e.g. \"cadenya.com/\") of at most 253 characters.\n * Examples: {\"environment\": \"production\", \"team\": \"platform\", \"version\": \"v2\"}\n */\n labels: Record<string, string>;\n profileId: string;\n createdAt?: string;\n}\n\n/**\n * Configuration for an account.\n */\nexport interface AccountSpec {\n description: string;\n domain: string;\n billingEmail: string;\n workspaces: Array<Workspace>;\n}\n\n/**\n * Activate an inactive pool.\n */\nexport interface ActivateAgentPoolRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * AgentPool ID. Accepts the canonical `apool_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\n/**\n * Attach a single tool, tool set, sub-agent, or agent pool to a variation. Exactly one\n * of the target fields must be set; the assignment kind is inferred from the\n * populated field. Adding an existing target returns AlreadyExists.\n * All targets must be in the variation's workspace and eligible for assignment.\n */\nexport type AddAgentVariationAssignmentRequest =\n | AddAgentVariationAssignmentRequest_ToolId\n | AddAgentVariationAssignmentRequest_ToolSetId\n | AddAgentVariationAssignmentRequest_SubAgentId\n | AddAgentVariationAssignmentRequest_AgentPoolId;\n\n/**\n * Attach a memory layer to a variation. Use UpdateAgentVariationMemoryLayer or\n * replace the spec list to reposition an existing layer. Rejected when:\n * - the layer is already assigned, regardless of position (AlreadyExists)\n * - the layer is system-managed (FailedPrecondition)\n * - the variation is already at the 10-assignment cap (FailedPrecondition)\n * - the position is already in use on this variation (InvalidArgument)\n */\nexport interface AddAgentVariationMemoryLayerRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n /**\n * Layer to attach. Accepts the canonical `memlyr_…` form or the `external_id:<value>` form.\n */\n memoryLayerId: string;\n /**\n * Position in the baseline cascade (lower = more specific). If\n * omitted, the server appends at the most general end (max existing\n * position + 1).\n */\n position?: number;\n}\n\n/**\n * AddWorkspaceMemberRequest grants a profile access to a workspace. Provide\n * exactly one of profile_id (an existing account profile) or email. When email\n * is given, the backend resolves it to an existing account profile or invites a\n * new one before linking it to the workspace via an actor.\n */\nexport interface AddWorkspaceMemberRequest {\n /**\n * The workspace to add the member to (path).\n */\n workspaceId?: string;\n /**\n * An existing account profile to add. Mutually exclusive with email.\n */\n profileId?: string;\n /**\n * Email address to add (resolve-or-invite). Mutually exclusive with profile_id.\n */\n email?: string;\n}\n\n/**\n * The current lifecycle state of the agent. Output only. Agents are created\n * in STATE_DRAFT; use the :publish, :unpublish, :archive, and :unarchive\n * actions to transition between states.\n */\nexport type AgentState = 'STATE_UNSPECIFIED' | 'STATE_DRAFT' | 'STATE_PUBLISHED' | 'STATE_ARCHIVED';\n\n/**\n * Agent resource\n */\nexport interface Agent {\n /**\n * Resource metadata\n */\n metadata: ResourceMetadata;\n /**\n * Agent specification\n */\n spec: AgentSpec;\n /**\n * Agent information\n */\n info: AgentInfo;\n /**\n * The current lifecycle state of the agent. Output only. Agents are created\n * in STATE_DRAFT; use the :publish, :unpublish, :archive, and :unarchive\n * actions to transition between states.\n */\n state: AgentState;\n}\n\n/**\n * AgentInfo contains simple information about an agent for display or quick reference\n */\nexport interface AgentInfo {\n variationCount: number;\n createdBy?: Profile;\n}\n\n/**\n * Output only. Pools are created INACTIVE. Use :activate, :deactivate,\n * :archive, and :unarchive to transition states. Unarchive returns INACTIVE.\n */\nexport type AgentPoolState = 'AGENT_POOL_STATE_UNSPECIFIED' | 'AGENT_POOL_STATE_ACTIVE' | 'AGENT_POOL_STATE_INACTIVE' | 'AGENT_POOL_STATE_ARCHIVED';\n\n/**\n * A workspace-scoped group of agents. When assigned to a variation, the pool\n * exposes one callable target that routes a request to a member agent.\n * Pool membership references agents; variation assignments reference the pool.\n */\nexport interface AgentPool {\n metadata: ResourceMetadata;\n spec: AgentPoolSpec;\n info?: AgentPoolInfo;\n /**\n * Output only. Pools are created INACTIVE. Use :activate, :deactivate,\n * :archive, and :unarchive to transition states. Unarchive returns INACTIVE.\n */\n state: AgentPoolState;\n}\n\n/**\n * A member of a pool, identified by its agent ID. This is distinct from a\n * VariationAssignment, which attaches the entire pool to a variation.\n */\nexport interface AgentPoolAssignment {\n /**\n * Canonical ID of an agent in the pool's workspace.\n */\n agentId: string;\n}\n\n/**\n * AgentPoolInfo represents the information of an agent pool.\n */\nexport interface AgentPoolInfo {\n /**\n * Number of member agents in spec.assignments.\n */\n assignedAgents: number;\n createdBy: Profile;\n}\n\n/**\n * AgentPoolSpec describes the pool's purpose, membership, input schema, and routing instructions.\n */\nexport interface AgentPoolSpec {\n /**\n * Describes when a calling agent should use this pool.\n */\n description: string;\n /**\n * JSON Schema defining the input arguments for this pool's callable tool.\n * When the pool is assigned to an agent variation, this schema tells the LLM\n * what arguments to supply. The supplied arguments provide the context used\n * to route the request to an agent in the pool.\n */\n state?: Record<string, unknown>;\n /**\n * Complete set of member agents, all in the pool's workspace. At least one\n * member is required. Order has no meaning; duplicate agent IDs are invalid.\n */\n assignments: Array<AgentPoolAssignment>;\n /**\n * Instructions for routing requests to an agent in the pool.\n * If empty, defaults to \"Which agent is best suited to handle this request?\".\n */\n instructions?: string;\n}\n\n/**\n * Partial input for UpdateAgentPool. The server applies update_mask, then\n * validates the resulting AgentPoolSpec before persisting any changes.\n */\nexport interface AgentPoolUpdateSpec {\n /**\n * Omit to leave unchanged, unless the mask selects this field or all of spec.\n */\n description?: string;\n /**\n * JSON Schema for the pool's callable input arguments. Update through\n * spec.state in the update mask.\n */\n state?: Record<string, unknown>;\n /**\n * Replacement membership. A selected empty list is invalid because a pool\n * must retain at least one member. Unselected fields remain unchanged.\n */\n assignments?: Array<AgentPoolAssignment>;\n /**\n * Routing instructions to update through spec.instructions in the update\n * mask. Selecting this field with an empty value restores the default question.\n */\n instructions?: string;\n}\n\n/**\n * The current lifecycle state of the schedule. Output only. Schedules are\n * created STATE_ACTIVE; use the :pause, :resume, and :archive actions to\n * transition between states.\n */\nexport type AgentScheduleState = 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_PAUSED' | 'STATE_ARCHIVED';\n\n/**\n * AgentSchedule resource — a recurring trigger attached to an agent that\n * creates objectives on its cadence.\n */\nexport interface AgentSchedule {\n metadata: ResourceMetadata;\n spec: AgentScheduleSpec;\n info: AgentScheduleInfo;\n /**\n * The current lifecycle state of the schedule. Output only. Schedules are\n * created STATE_ACTIVE; use the :pause, :resume, and :archive actions to\n * transition between states.\n */\n state: AgentScheduleState;\n}\n\n/**\n * AgentScheduleInfo provides read-only runtime data about a schedule.\n */\nexport interface AgentScheduleInfo {\n /**\n * When the schedule will next fire. Computed from the spec; absent when\n * the schedule is STATE_PAUSED/STATE_ARCHIVED or has no future fire times.\n */\n nextFireAt?: string;\n /**\n * When the schedule last fired (regardless of objective outcome).\n */\n lastFireAt?: string;\n /**\n * ID of the most recent objective the schedule created.\n */\n lastObjectiveId?: string;\n /**\n * When the schedule most recently skipped a fire (SKIP policy + prior in flight).\n */\n lastSkippedAt?: string;\n /**\n * Reason for the most recent skip (e.g. \"previous objective still running\").\n */\n lastSkipReason?: string;\n /**\n * Lifetime count of objectives created by this schedule.\n */\n totalFires: number;\n createdBy?: Profile;\n}\n\n/**\n * What to do when the previous run is still in flight. Defaults to SKIP.\n */\nexport type AgentScheduleSpecOverlapPolicy = 'OVERLAP_POLICY_UNSPECIFIED' | 'OVERLAP_POLICY_ALLOW' | 'OVERLAP_POLICY_SKIP';\n\n/**\n * AgentScheduleSpec is the user-provided configuration for a schedule.\n */\nexport interface AgentScheduleSpec {\n /**\n * When to fire. Required.\n */\n schedule: AgentScheduleSpec_Schedule;\n /**\n * What to do when the previous run is still in flight. Defaults to SKIP.\n */\n overlapPolicy?: AgentScheduleSpecOverlapPolicy;\n /**\n * Optional explicit first user message passed to CreateObjective on each fire.\n * Becomes the first user message in the objective's chat history. When unset, the\n * fired objective defers to the selected variation's first_user_message_template.\n */\n firstUserMessage?: string;\n /**\n * Optional explicit variation. When unset, the agent's variation_selection_mode\n * chooses per fire.\n */\n variationId?: string;\n /**\n * Optional data rendered into the variation's system_prompt_template when each\n * fired objective is created. If the agent has a system_prompt_data_schema,\n * this must satisfy it.\n */\n systemPromptData?: Record<string, unknown>;\n /**\n * Optional data rendered into the variation's first_user_message_template when\n * each fired objective is created. Separate from `system_prompt_data`, which\n * renders the system prompt template.\n */\n firstUserMessageData?: Record<string, unknown>;\n}\n\n/**\n * Schedule defines WHEN the schedule fires. Temporal-style structured form:\n * a list of calendar rules (wall-clock) and/or interval rules (duration),\n * OR'd together. At least one rule is required.\n */\nexport interface AgentScheduleSpec_Schedule {\n /**\n * Wall-clock rules. May be empty if `intervals` is non-empty.\n */\n calendars?: Array<Schedule_Calendar>;\n /**\n * Duration-based rules. May be empty if `calendars` is non-empty.\n */\n intervals?: Array<Schedule_Interval>;\n /**\n * IANA tz name (e.g. \"America/New_York\"). Required. Applies to calendars;\n * intervals fire on wall-clock cadence anchored in this zone.\n */\n timezone?: string;\n}\n\n/**\n * Controls how variations are automatically selected when creating objectives\n * Defaults to WEIGHTED when unspecified\n */\nexport type AgentSpecVariationSelectionMode = 'VARIATION_SELECTION_MODE_UNSPECIFIED' | 'VARIATION_SELECTION_MODE_RANDOM' | 'VARIATION_SELECTION_MODE_WEIGHTED';\n\n/**\n * Agent specification (user-provided configuration)\n */\nexport interface AgentSpec {\n /**\n * Description of the agent's purpose\n */\n description?: string;\n /**\n * The URL that Cadenya will send events for any objective assigned to the agent.\n */\n webhookEventsUrl?: string;\n /**\n * Controls how variations are automatically selected when creating objectives\n * Defaults to WEIGHTED when unspecified\n */\n variationSelectionMode?: AgentSpecVariationSelectionMode;\n /**\n * SystemPromptDataSchema enforces the shape of system_prompt_data when objectives are created. This is valuable when using liquid formatting in agent\n * variation system prompt templates. The schema is also used when the agent is attached as a sub-agent, as it becomes the tool's input parameter schema.\n * If omitted, the sub-agent schema will be loaded with a simple \"prompt\" free text string as its schema.\n */\n systemPromptDataSchema?: Record<string, unknown>;\n /**\n * Optional output definition for objectives created for this agent.\n * When provided, Cadenya will append a tool to that will be called by the LLM in use by the variant to extract information in the format provided here.\n * Use this option when you want structured data to be created by your objectives.\n */\n outputDefinition?: Record<string, unknown>;\n /**\n * Enable episodic memory for objectives created for this agent.\n * When true, objective creation requires an episodic_memory key and the\n * system finds or creates a memory layer for that (agent, key) pair, letting\n * the agent store and retrieve memories across objectives that share the key.\n * Memory is agent-level so all variations of the agent share the same layers.\n */\n enableEpisodicMemory?: boolean;\n /**\n * How long episodic memories should be retained.\n * Each new objective slides the layer's expiry forward by this duration, and\n * stored entries expire this long after they are written.\n * If not set, episodic memories are retained indefinitely.\n */\n episodicMemoryTtl?: number;\n}\n\n/**\n * AgentVariation resource\n */\nexport interface AgentVariation {\n /**\n * Resource metadata\n */\n metadata: ResourceMetadata;\n /**\n * Variation specification\n */\n spec: AgentVariationSpec;\n /**\n * Read-only summary information\n */\n info: AgentVariationInfo;\n}\n\n/**\n * AgentVariationInfo provides read-only summary information about a variation\n */\nexport interface AgentVariationInfo {\n /**\n * Number of individual tools assigned to this variation\n */\n toolCount: number;\n /**\n * Number of tool sets assigned to this variation\n */\n toolSetCount: number;\n /**\n * Number of sub-agents assigned to this variation\n */\n subAgentCount: number;\n createdBy?: Profile;\n /**\n * Metadata for the model assigned to this variation\n */\n model?: ResourceMetadata;\n /**\n * Thompson Sampling score: posterior mean of Beta(ts_alpha, ts_beta).\n * Range [0, 1] where 0.5 = neutral, >0.5 = positive, <0.5 = negative.\n */\n score: number;\n /**\n * Total number of objective feedbacks received for this variation\n */\n feedbackCount: number;\n /**\n * Count of memory layer assignments.\n */\n memoryLayerCount: number;\n /**\n * Number of distinct callable tools available through this variation's\n * assignments after normalization. Expands tool sets and deduplicates tools\n * also assigned directly. Each sub-agent or pool contributes one callable\n * tool; sub-agent assignments and pool members are not expanded. Counts the\n * full normalized set, regardless of which tools progressive discovery has loaded.\n */\n effectiveToolCount: number;\n /**\n * Current display metadata for targets explicitly referenced by\n * spec.assignments and spec.memory_layer_assignments, keyed by canonical\n * resource ID. Includes tools, tool sets, sub-agents, agent pools,\n * and memory layers in one map; each value's id equals its key. Does not expand\n * tools within assigned tool sets, assignments within sub-agents, or pool members.\n * Populated whenever info is returned; empty when there are no assignments.\n * Missing or inaccessible targets are omitted, and names may be absent.\n * Clients use spec for assignment type/order and fall back to the ID when\n * display metadata is unavailable. This map never accepts assignment writes.\n */\n assignmentMetadata: Record<string, BareMetadata>;\n /**\n * Number of agent pools assigned to this variation.\n */\n agentPoolCount: number;\n}\n\n/**\n * AgentVariationSpec defines the complete operational configuration for a\n * variation, including assignments. Reads always populate both assignment lists,\n * even when include_info is false. Create and update validate and persist the\n * configuration atomically: any invalid target or cascade rejects the entire\n * request. Targets must belong to the variation's workspace and pass the same\n * eligibility checks as the dedicated add methods.\n */\nexport interface AgentVariationSpec {\n /**\n * Liquid template for the system prompt of objectives using this variation.\n * Rendered with CreateObjectiveRequest.system_prompt_data into Objective.system_prompt.\n */\n systemPromptTemplate?: string;\n /**\n * ProgressiveDiscovery is an optional config that, when set, will load a Cadenya provided tool that\n * can search for tools in the assigned tool sets or tools.\n * \n * Note: Sub-agents and agent pools are always loaded as tools regardless of this value.\n */\n progressiveDiscovery?: AgentVariationSpec_ProgressiveDiscovery;\n /**\n * Execution constraints\n */\n constraints?: AgentVariationSpec_Constraints;\n /**\n * Human-readable description of what this variation does or when it should be used\n */\n description?: string;\n /**\n * Model configuration for this variation\n */\n modelConfig?: AgentVariationSpec_ModelConfig;\n /**\n * Compaction configuration for managing context window limits during long-running objectives.\n * When not set, the system uses a default summarization strategy at 75% context window usage.\n */\n compactionConfig?: AgentVariationSpec_CompactionConfig;\n /**\n * Liquid template for the first user message of objectives using this variation.\n * Rendered with CreateObjectiveRequest.first_user_message_data into\n * Objective.first_user_message, the first user message in the LLM chat history.\n * CreateObjectiveRequest.first_user_message, when set, overrides the rendered\n * result. If neither this template nor first_user_message is present, objective\n * creation is rejected with InvalidArgument.\n */\n firstUserMessageTemplate?: string;\n /**\n * Complete set of assigned tools, tool sets, sub-agents, and agent pools. Order has no\n * meaning. Duplicate (target kind, canonical target ID) pairs are collapsed.\n * On create, omitted or empty means no assignments. On update, selecting\n * spec.assignments in update_mask replaces the entire set; empty clears it.\n */\n assignments?: Array<VariationAssignment>;\n /**\n * Complete baseline memory cascade, returned in ascending position. At most\n * 10 whole layers; system-managed layers cannot be assigned. Duplicate layer\n * IDs (after alias resolution) or positions are InvalidArgument. Validate the\n * final cascade, so swapping two positions in one update is supported.\n * On create, omitted or empty means no layers. On update, selecting\n * spec.memory_layer_assignments replaces the entire list; empty clears it.\n */\n memoryLayerAssignments?: Array<VariationMemoryLayerAssignment>;\n}\n\n/**\n * CompactionConfig defines how context window compaction behaves for objectives using this variation.\n */\nexport interface AgentVariationSpec_CompactionConfig {\n /**\n * Trigger threshold as a percentage of the model's context window (0.0 to 1.0).\n * When input tokens reach this percentage of the model's limit, compaction triggers.\n * Default: 0.75 (75%)\n */\n triggerThreshold?: number;\n /**\n * Strategies — set one or more. When multiple are set, they execute in order:\n * tool_result_clearing → summarization.\n * When none are set, defaults to summarization with the system default prompt.\n */\n summarization?: CompactionConfig_SummarizationStrategy;\n toolResultClearing?: CompactionConfig_ToolResultClearingStrategy;\n}\n\nexport interface AgentVariationSpec_Constraints {\n /**\n * The maximum number of tool calls that can be made. 0 means no limit.\n */\n maxToolCalls?: number;\n /**\n * The maximum number of sub-objectives that can be created. 0 means no limit.\n */\n maxSubObjectives?: number;\n /**\n * How long an objective may sit with no activity (no user messages, no\n * LLM calls) before it is finalized as timed out. Between 1 minute and\n * 24 hours, expressed as a duration string in seconds (e.g. \"7200s\").\n * When not set, objectives are still swept at the system-wide 24 hour\n * maximum — every objective eventually reaches a terminal state.\n * \n * SDKs represent this as a duration string, like AgentScheduleSpec.every,\n * rather than an integer.\n */\n inactivityTimeout?: string;\n}\n\n/**\n * Reasoning effort. Requires the model's \"reasoning\" capability.\n */\nexport type AgentVariationSpecModelConfigReasoningEffort = 'REASONING_EFFORT_UNSPECIFIED' | 'REASONING_EFFORT_NONE' | 'REASONING_EFFORT_LOW' | 'REASONING_EFFORT_MEDIUM' | 'REASONING_EFFORT_HIGH';\n\n/**\n * ModelConfig defines the model configuration for a variation.\n * \n * Every knob besides model_id is honored only when the assigned model's\n * spec.capabilities lists the matching capability.\n */\nexport interface AgentVariationSpec_ModelConfig {\n /**\n * The model identifier for the agent variation to use. Should be either the reference key (ai-provider.model-name) or the canonical model ID (e.g.: \"model_ABC123\")\n */\n modelId: string;\n /**\n * Sampling temperature for model inference (0.0 to 1.0)\n * Lower values produce more deterministic outputs, higher values increase randomness.\n * Presence-tracked so a deliberate 0.0 (fully deterministic) is\n * distinguishable from unset.\n */\n temperature?: number;\n /**\n * Nucleus sampling: only tokens comprising the top_p probability mass\n * are considered. Requires the model's \"topP\" capability.\n */\n topP?: number;\n /**\n * Only sample from the top_k most likely tokens.\n * Requires the model's \"topK\" capability.\n */\n topK?: number;\n /**\n * Sequences that stop generation when produced. Empty means none.\n * No count cap here — providers impose their own limits (surfaced as\n * the \"stopSequences\" capability's `limit` on the model spec), and it\n * is the caller's responsibility to stay within the selected model's\n * limit. Requires the model's \"stopSequences\" capability.\n */\n stopSequences?: Array<string>;\n /**\n * Cap on output tokens per LLM call. Must not exceed the model's\n * spec.max_output_tokens. Requires the model's \"maxOutputTokens\"\n * capability.\n */\n maxOutputTokens?: number;\n /**\n * Reasoning effort. Requires the model's \"reasoning\" capability.\n */\n reasoningEffort?: AgentVariationSpecModelConfigReasoningEffort;\n /**\n * Prompt/token caching. Requires the model's \"caching\" capability.\n * Presence-tracked tri-state: unset means the default — caching is ON\n * whenever the model has the capability; false opts this variation\n * out; true is an explicit opt-in (equivalent to unset).\n */\n cachingEnabled?: boolean;\n}\n\n/**\n * ProgressiveDiscovery is used to indicate that the agent should automatically discover tools that are not explicitly assigned to it.\n * Max tools is the maximum number of tools that can be discovered per search.\n * Hints are optional hints for tool search. These are used in conjunction with the context-aware tool search and can help select the best tools for the task.\n */\nexport interface AgentVariationSpec_ProgressiveDiscovery {\n /**\n * The most tool names tool_search will load in a single call. Requesting more\n * than this returns an error telling the model to retry in smaller batches --\n * it is a per-call batch limit, not a ceiling on how many tools an objective\n * may end up with.\n */\n maxTools?: number;\n /**\n * Free-text guidance appended to the discoverable-tools appendix in the\n * system prompt. Hints steer the model's choice of tool names; they do not\n * filter or rank anything, because tool_search matches names exactly rather\n * than searching.\n */\n hints?: Array<string>;\n}\n\nexport interface ApproveToolCallRequest {\n workspaceId?: string;\n /**\n * The ID of the objective. Supports \"external_id:\" prefix for external IDs.\n */\n objectiveId?: string;\n /**\n * The ID of the tool call to approve\n */\n toolCallId?: string;\n}\n\n/**\n * Archive an active or inactive pool, preserving membership and assignments.\n */\nexport interface ArchiveAgentPoolRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * AgentPool ID. Accepts the canonical `apool_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\n/**\n * Archive agent request\n */\nexport interface ArchiveAgentRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\n/**\n * Archive agent schedule request.\n */\nexport interface ArchiveAgentScheduleRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Schedule ID. Accepts the canonical `as_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\n/**\n * Archive tool set request\n */\nexport interface ArchiveToolSetRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Tool set ID. Accepts the canonical ts_… form or the\n * external_id:<value> form.\n */\n id?: string;\n}\n\n/**\n * Archive widget request.\n */\nexport interface ArchiveWidgetRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Widget ID. Accepts the canonical `wgt_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\nexport interface AssistantMessage {\n content?: string;\n toolCalls: Array<AssistantToolCall>;\n}\n\nexport interface AssistantToolCall {\n tool?: CallableTool;\n arguments: string;\n functionName: string;\n}\n\n/**\n * BareMetadata contains the minimal metadata for a resource: the ID and an\n * optional human-readable name. These are used for reference fields where the\n * full metadata (account scoping, timestamps, labels, external IDs) is not\n * needed — e.g., the assignment metadata inside agent variation info or the\n * tools assigned to an objective. Both fields are server-populated; clients\n * provide IDs through sibling fields rather than by constructing a\n * BareMetadata themselves.\n */\nexport interface BareMetadata {\n id: string;\n /**\n * Human-readable name of the referenced resource, populated by the server\n * on reads for convenience. Absent on references to resources that do not\n * have a name.\n */\n name?: string;\n}\n\n/**\n * BedrockConfig selects the AWS source Region used for Bedrock Runtime calls.\n */\nexport interface BedrockConfig {\n region?: string;\n}\n\n/**\n * CallableTool is a union that represents a tool that can be called by an agent. In Cadenya, a tool that is used within an agent objective\n * might be a user-defined tool (IE: MCP, HTTP), another Agent (useful to separate context), or a Cadenya Tool (one Cadenya provides).\n */\nexport type CallableTool =\n | CallableTool_Tool\n | CallableTool_Agent\n | CallableTool_CadenyaProvidedTool\n | CallableTool_AgentPool;\n\nexport interface CancelObjectiveRequest {\n workspaceId?: string;\n /**\n * The ID of the objective. Supports \"external_id:\" prefix for external IDs.\n */\n objectiveId?: string;\n /**\n * Optional reason for cancellation\n */\n reason?: string;\n}\n\n/**\n * Prompt/token caching (ModelConfig.caching_enabled). A model that\n * cannot cache prompt prefixes simply omits this capability. When the\n * capability is present, caching defaults to ON — a variation opts out\n * by setting caching_enabled to false.\n */\nexport interface Capability_Caching {\n}\n\n/**\n * Per-request output token cap (ModelConfig.max_output_tokens).\n * The effective ceiling is ModelSpec.max_output_tokens.\n */\nexport interface Capability_MaxOutputTokens {\n}\n\n/**\n * How reasoning is enabled for this model. Catalog data used to decide\n * whether thinking is requested for objective iterations on this model.\n */\nexport type CapabilityReasoningMode = 'MODE_UNSPECIFIED' | 'MODE_ADAPTIVE' | 'MODE_BUDGET';\n\n/**\n * Reasoning / extended thinking (ModelConfig.reasoning_effort). A model\n * that does not reason simply omits this capability.\n */\nexport interface Capability_Reasoning {\n /**\n * How reasoning is enabled for this model. Catalog data used to decide\n * whether thinking is requested for objective iterations on this model.\n */\n mode: CapabilityReasoningMode;\n}\n\n/**\n * Custom stop sequences (ModelConfig.stop_sequences).\n */\nexport interface Capability_StopSequences {\n /**\n * Maximum number of stop sequences the model accepts per request.\n * 0 means the provider imposes no meaningful limit.\n */\n limit: number;\n}\n\n/**\n * Sampling temperature (ModelConfig.temperature).\n */\nexport interface Capability_Temperature {\n}\n\n/**\n * Top-k sampling (ModelConfig.top_k).\n */\nexport interface Capability_TopK {\n}\n\n/**\n * Nucleus sampling (ModelConfig.top_p).\n */\nexport interface Capability_TopP {\n}\n\n/**\n * Compact objective request — triggers compaction on a running objective.\n */\nexport interface CompactObjectiveRequest {\n workspaceId?: string;\n /**\n * The ID of the objective. Supports \"external_id:\" prefix for external IDs.\n */\n objectiveId?: string;\n /**\n * Optional compaction config override. When not set, uses the variation's compaction_config.\n */\n compactionConfig?: AgentVariationSpec_CompactionConfig;\n}\n\n/**\n * Compact objective response\n */\nexport interface CompactObjectiveResponse {\n /**\n * The new context window created by the compaction\n */\n contextWindow?: ObjectiveContextWindowData;\n}\n\n/**\n * SummarizationStrategy configures LLM-powered summarization of older conversation turns.\n */\nexport interface CompactionConfig_SummarizationStrategy {\n /**\n * Custom instructions that guide what the summarizer preserves.\n * Replaces the default summarization prompt entirely.\n * Example: \"Preserve all code snippets, variable names, and technical decisions.\"\n */\n instructions?: string;\n}\n\n/**\n * ToolResultClearingStrategy configures clearing of older tool result content.\n */\nexport interface CompactionConfig_ToolResultClearingStrategy {\n /**\n * Number of most recent tool call results to keep intact.\n * Older tool results have their content replaced with \"[result cleared]\"\n * while preserving the assistant tool call message (function name, arguments).\n * Default: 2\n */\n preserveRecentResults?: number;\n}\n\n/**\n * Marks the tool as bare: it has no execution adapter of its own and\n * relies on the parent tool set being a Bare tool set. Present so a\n * webhook consumer can tell a tool is bare from the tool data alone,\n * without cross-referencing the tool set.\n */\nexport interface Config_Bare {\n /**\n * When set, the tool call's result is recorded immediately as this\n * fixed text instead of parking the call to wait for externally\n * supplied content. The tool_called event is still emitted. Useful for\n * tools whose dispatch is the intent (e.g. a frontend renders a\n * component from the call parameters) but whose LLM turn still needs\n * tool-result content.\n */\n alwaysSetResult?: string;\n}\n\nexport type ConfigHttpRequestMethod = 'HTTP_METHOD_UNSPECIFIED' | 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n\nexport interface Config_HTTP {\n requestMethod: ConfigHttpRequestMethod;\n path?: string;\n query?: string;\n headers?: Record<string, string>;\n /**\n * These are only used when the request method is a POST, PUT, or PATCH\n */\n requestBodyTemplate?: string;\n requestBodyContentType?: string;\n}\n\nexport interface Config_MCP {\n /**\n * Tool behavior annotations from the MCP server, captured during sync.\n */\n annotations?: MCP_Annotations;\n}\n\nexport interface Config_OpenAPI {\n path?: string;\n method?: string;\n}\n\n/**\n * ContextLengths is the measured character length of each distinct component\n * of an iteration's assembled context window. Values are raw character\n * lengths of the component as assembled into the request — token estimates\n * are derived by the client against input_tokens (component share =\n * component length / sum of all lengths).\n * \n * New components are added as new fields — wire-compatible; absent\n * components read as 0.\n */\nexport interface ContextLengths {\n /**\n * Character length of the objective's base system prompt (rendered variation\n * template). Not tokens -- see the message comment.\n */\n systemPrompt: number;\n /**\n * Character length of the skills memory appendix attached to the system prompt.\n */\n skillsMemory: number;\n /**\n * Character length of the episodic memory appendix attached to the system prompt.\n */\n episodicMemory: number;\n /**\n * Character length of the discoverable/available-tools appendix attached to the\n * system prompt.\n */\n availableTools: number;\n /**\n * Character length of the serialized tool definitions sent with the completion\n * request (names, descriptions, and JSON-schema parameters).\n */\n toolDefinitions: number;\n /**\n * Character length of the chat history messages with the user role.\n */\n userMessages: number;\n /**\n * Character length of the chat history messages with the assistant role.\n */\n assistantMessages: number;\n /**\n * Character length of the tool results present in the chat history.\n */\n toolResults: number;\n}\n\nexport interface ContextWindowCompacted {\n /**\n * The new context window created by this compaction\n */\n newContextWindow: ObjectiveContextWindowData;\n /**\n * The strategies that were applied during this compaction\n */\n strategies: Array<string>;\n /**\n * Number of messages that were compacted\n */\n messagesCompacted: number;\n /**\n * The summary generated by the summarization strategy, if used.\n */\n summary?: string;\n}\n\nexport interface ContinueObjectiveRequest {\n workspaceId?: string;\n /**\n * The ID of the objective. If you have assigned an external ID to the objective, you can prefix the ID with \"external_id:\". For example, \"external_id:1234567890\". Otherwise, the ID assigned by Cadenya should be used.\n */\n objectiveId?: string;\n /**\n * The message to continue an objective that has completed (or you are enqueing)\n */\n message: string;\n /**\n * When set to true, the message will be enqueued for when the agent loop is available to process it.\n */\n enqueue?: boolean;\n}\n\nexport interface CreateAIProviderKeyRequest {\n /**\n * The workspace that will own this key.\n */\n workspaceId?: string;\n metadata: CreateResourceMetadata;\n spec: AIProviderKeySpec;\n}\n\nexport interface CreateAPIKeyRequest {\n metadata: CreateAccountResourceMetadata;\n spec: APIKeySpec;\n /**\n * The workspace this API key belongs to (path).\n */\n workspaceId?: string;\n}\n\n/**\n * CreateAccountResourceMetadata contains the user-provided fields for creating\n * an account-scoped resource. Read-only fields (id, account_id, profile_id) are excluded\n * since they are set by the server.\n */\nexport interface CreateAccountResourceMetadata {\n /**\n * Human-readable name for the resource (e.g., \"Production API Key\", \"Staging Workspace\")\n */\n name: string;\n /**\n * External ID for the resource (e.g., a workflow ID from an external system)\n */\n externalId?: string;\n /**\n * Key-value pairs for categorization and filtering. Values are 0-63\n * alphanumeric characters with \"-\", \"_\", or \".\" allowed between; keys\n * follow the same shape and additionally accept an optional DNS-subdomain\n * prefix (e.g. \"cadenya.com/\") of at most 253 characters.\n * Examples: {\"environment\": \"production\", \"team\": \"platform\", \"version\": \"v2\"}\n */\n labels?: Record<string, string>;\n}\n\n/**\n * Create a pool in INACTIVE state. Validate and persist membership atomically.\n */\nexport interface CreateAgentPoolRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n metadata: CreateResourceMetadata;\n spec: AgentPoolSpec;\n}\n\n/**\n * Create agent request\n */\nexport interface CreateAgentRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n metadata: CreateResourceMetadata;\n spec: AgentSpec;\n /**\n * Optional default variation to add to the agent on create. Its spec accepts\n * assignments and memory_layer_assignments using the same atomic validation\n * as CreateAgentVariation. Failure rejects the entire agent creation.\n */\n defaultVariation?: CreateAgentVariationRequest;\n}\n\n/**\n * Create agent schedule request.\n */\nexport interface CreateAgentScheduleRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n metadata: CreateResourceMetadata;\n spec: AgentScheduleSpec;\n}\n\n/**\n * Create agent variation request\n */\nexport interface CreateAgentVariationRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n metadata: CreateResourceMetadata;\n spec: AgentVariationSpec;\n}\n\nexport interface CreateMemoryEntryRequest {\n workspaceId?: string;\n /**\n * Memory layer ID. Accepts canonical memlyr_… form or external_id:<value> form.\n */\n memoryLayerId?: string;\n metadata: CreateResourceMetadata;\n spec: MemoryEntryCreateSpec;\n}\n\nexport interface CreateMemoryLayerRequest {\n workspaceId?: string;\n metadata: CreateResourceMetadata;\n spec: MemoryLayerSpec;\n}\n\n/**\n * Create model request. The model is created on the given AI provider key with\n * PROVENANCE_MANUALLY_ENTERED and STATE_ENABLED. The key must be customer\n * provided and its provider must accept manual definitions (see\n * AIProviderKeyInfo.model_management).\n */\nexport interface CreateModelRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * The AI provider key the model routes through. Accepts the canonical\n * `aipk_…` form or the `external_id:<value>` form.\n */\n aiProviderKeyId?: string;\n metadata: CreateResourceMetadata;\n spec: ModelSpec;\n}\n\n/**\n * Request to submit feedback for an objective\n */\nexport interface CreateObjectiveFeedbackRequest {\n workspaceId?: string;\n /**\n * The ID of the objective. Supports \"external_id:\" prefix for external IDs.\n */\n objectiveId?: string;\n metadata: CreateOperationMetadata;\n data: ObjectiveFeedbackData;\n}\n\nexport interface CreateObjectiveRequest {\n workspaceId: string;\n agentId: string;\n /**\n * Optional explicit variation selection. Overrides the agent's variation_selection_mode.\n */\n variationId?: string;\n metadata?: CreateOperationMetadata;\n /**\n * Arbitrary data rendered into the selected variation's system_prompt_template\n * (liquid) to produce the objective's system prompt. If the agent has a\n * system_prompt_data_schema, this must satisfy it.\n */\n systemPromptData: Record<string, unknown>;\n /**\n * Optional explicit first user message for the LLM chat history. When not set,\n * the selected variation's first_user_message_template is rendered with\n * first_user_message_data instead. If neither this field nor a\n * first_user_message_template is present, the request is rejected with InvalidArgument.\n */\n firstUserMessage?: string;\n /**\n * Secrets that can be used in the headers for tool calls using the secret interpolation format.\n */\n secrets?: Array<CreateObjectiveRequest_Secret>;\n /**\n * Memory layers/entries layered over the baseline cascade inherited\n * from the selected variation — element-level rules over inherited\n * styles, in CSS terms.\n * \n * Array order is resolution order: EARLIER elements are more specific\n * and are consulted first. Entries pinned via memory_entry_id behave\n * as single-entry layers at their position.\n * \n * System-managed layers (e.g., episodic) cannot be referenced here;\n * they attach themselves automatically based on the episodic key.\n * \n * Size cap: the TOTAL effective cascade (this field + the variation's\n * memory layer assignments) must not exceed 10 entries. A request\n * that would produce a larger cascade is rejected with\n * InvalidArgument.\n */\n memoryCascade?: Array<MemoryReference>;\n /**\n * Arbitrary data rendered into the selected variation's first_user_message_template\n * (liquid) to produce the first user message. Separate from `system_prompt_data`,\n * which renders the system prompt template.\n */\n firstUserMessageData?: Record<string, unknown>;\n /**\n * If the agent variation that is selected has episodic memory enabled, then this key is used to create/update a memory layer\n * specific to the episodic memory. The layer may have a TTL configured by the variation.\n */\n episodicMemory?: ObjectiveEpisodicConfig;\n /**\n * Optional tenant assertion — the customer's org/company identifier for the\n * end user this objective serves. Upserts the tenant record in the\n * workspace and associates the objective with it.\n */\n tenant?: TenantAssertion;\n /**\n * Optional subject assertion — the person within the tenant this objective\n * serves. Requires `tenant`; a subject asserted without a tenant is\n * rejected with InvalidArgument.\n */\n subject?: SubjectAssertion;\n /**\n * Parameters forced onto this objective's tool calls. A pinned parameter\n * is removed from the tool schema the LLM sees, and its value is always\n * overwritten server-side with the pinned value — the model cannot choose\n * a different value for it. By default a pinned key applies to every tool\n * with a top-level parameter of the same name; a tool set's overlays\n * (ToolSetSpec.overlays) can bind pinned keys to nested paths, differently\n * named parameters, or a subset of tools.\n */\n pinnedParameters?: Record<string, string>;\n}\n\nexport interface CreateObjectiveRequest_Secret {\n name?: string;\n value?: string;\n}\n\n/**\n * CreateOperationMetadata contains the user-provided fields for creating\n * an operation. Read-only fields (id, account_id, workspace_id, created_at, profile_id)\n * are excluded since they are set by the server.\n */\nexport interface CreateOperationMetadata {\n /**\n * Key-value pairs for categorization and filtering. Values are 0-63\n * alphanumeric characters with \"-\", \"_\", or \".\" allowed between; keys\n * follow the same shape and additionally accept an optional DNS-subdomain\n * prefix (e.g. \"cadenya.com/\") of at most 253 characters.\n * Examples: {\"priority\": \"high\", \"source\": \"api\", \"workflow\": \"onboarding\"}\n */\n labels?: Record<string, string>;\n /**\n * External ID for the operation (e.g., a workflow ID from an external system)\n */\n externalId?: string;\n}\n\n/**\n * CreateResourceMetadata contains the user-provided fields for creating\n * a workspace-scoped resource. Read-only fields (id, account_id, workspace_id, profile_id,\n * created_at) are excluded since they are set by the server.\n */\nexport interface CreateResourceMetadata {\n /**\n * Human-readable name for the resource (e.g., \"Customer Support Agent\", \"Email Tool\")\n */\n name: string;\n /**\n * External ID for the resource (e.g., a workflow ID from an external system)\n */\n externalId?: string;\n /**\n * Key-value pairs for categorization and filtering. Values are 0-63\n * alphanumeric characters with \"-\", \"_\", or \".\" allowed between; keys\n * follow the same shape and additionally accept an optional DNS-subdomain\n * prefix (e.g. \"cadenya.com/\") of at most 253 characters.\n * Examples: {\"environment\": \"production\", \"team\": \"platform\", \"version\": \"v2\"}\n */\n labels?: Record<string, string>;\n}\n\nexport interface CreateToolRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Tool set ID. Accepts the canonical ts_… form or the\n * external_id:<value> form.\n */\n toolSetId?: string;\n metadata: CreateResourceMetadata;\n spec: ToolSpec;\n}\n\nexport interface CreateToolSetRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n metadata: CreateResourceMetadata;\n spec: ToolSetSpec;\n}\n\nexport interface CreateToolSetSecretRequest {\n /**\n * The workspace that owns the tool set.\n */\n workspaceId?: string;\n /**\n * The tool set that will own this secret. Accepts the canonical ts_… form\n * or the external_id:<value> form.\n */\n toolSetId?: string;\n metadata: CreateResourceMetadata;\n spec: ToolSetSecretSpec;\n}\n\nexport interface CreateUploadRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n metadata: CreateResourceMetadata;\n spec: UploadSpec;\n}\n\n/**\n * Create widget request.\n */\nexport interface CreateWidgetRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n metadata: CreateResourceMetadata;\n spec: WidgetSpec;\n}\n\n/**\n * Create widget session request.\n */\nexport interface CreateWidgetSessionRequest {\n /**\n * Workspace ID.\n */\n workspaceId: string;\n metadata?: CreateOperationMetadata;\n spec: WidgetSessionSpec;\n /**\n * Secrets to attach to the session.\n */\n secrets?: Array<CreateWidgetSessionRequest_Secret>;\n}\n\n/**\n * Secret is a named credential attached to the session — typically a token\n * the customer's backend minted for the visitor, so the agent acts against\n * their API as that subject. Values are captured at the boundary, encrypted\n * at rest, appended to every conversation the session creates (re-synced on\n * each turn), and never returned by any API. Session secrets take\n * precedence over workspace and tool-set secrets of the same name.\n */\nexport interface CreateWidgetSessionRequest_Secret {\n name?: string;\n value?: string;\n}\n\nexport interface CreateWorkspaceRequest {\n metadata: CreateAccountResourceMetadata;\n spec: WorkspaceSpec;\n}\n\nexport interface CreateWorkspaceSecretRequest {\n /**\n * The workspace that will own this secret.\n */\n workspaceId?: string;\n metadata: CreateResourceMetadata;\n spec: WorkspaceSecretSpec;\n}\n\n/**\n * CredentialAPIKey carries a single bearer/header API key.\n */\nexport interface CredentialAPIKey {\n apiKey?: string;\n}\n\n/**\n * CredentialAWSAccessKey carries AWS SigV4 credentials. Optional presence is\n * used by credential patches so omitted values remain unchanged.\n */\nexport interface CredentialAWSAccessKey {\n accessKeyId?: string;\n secretAccessKey?: string;\n sessionToken?: string;\n}\n\n/**\n * CredentialGoogleServiceAccount carries an in-memory Google service-account\n * credential document.\n */\nexport interface CredentialGoogleServiceAccount {\n json?: string;\n}\n\n/**\n * CredentialHeaders carries arbitrary HTTP headers sent with every request to\n * the provider (e.g. {\"Authorization\": \"Bearer ...\", \"X-Api-Key\": \"...\"}).\n */\nexport interface CredentialHeaders {\n headers?: Record<string, string>;\n}\n\n/**\n * Deactivate an active pool.\n */\nexport interface DeactivateAgentPoolRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * AgentPool ID. Accepts the canonical `apool_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\n/**\n * Delete tenant widget sessions response.\n */\nexport interface DeleteTenantWidgetSessionsResponse {\n /**\n * Number of sessions deleted.\n */\n sessionsDeleted: number;\n /**\n * Number of conversations (objectives) deleted along with the sessions.\n */\n objectivesDeleted: number;\n}\n\nexport interface DenyToolCallRequest {\n workspaceId?: string;\n /**\n * The ID of the objective. Supports \"external_id:\" prefix for external IDs.\n */\n objectiveId?: string;\n /**\n * The ID of the tool call to deny\n */\n toolCallId?: string;\n /**\n * A memo to associate to the tool call denial. Use a memo to steer the LLM to a different decision or usage of the tool.\n */\n memo?: string;\n}\n\nexport interface DisableAPIKeyRequest {\n /**\n * The workspace the API key belongs to (path).\n */\n workspaceId?: string;\n /**\n * The API key to disable.\n */\n id?: string;\n}\n\n/**\n * Disable model request\n */\nexport interface DisableModelRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Model ID\n */\n id?: string;\n}\n\nexport interface EnableAPIKeyRequest {\n /**\n * The workspace the API key belongs to (path).\n */\n workspaceId?: string;\n /**\n * The API key to enable.\n */\n id?: string;\n}\n\n/**\n * Enable model request\n */\nexport interface EnableModelRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Model ID\n */\n id?: string;\n}\n\nexport interface GetObjectiveDiagnosticsResponse {\n /**\n * Context usage from the objective's most recent iteration.\n */\n diagnostics: ObjectiveDiagnostics;\n}\n\nexport interface GetToolSetOpenAPISpecResponse {\n /**\n * The consumed OpenAPI specification as a JSON string.\n */\n spec: string;\n}\n\n/**\n * Contains an arbitrary serialized message along with a @type that describes the type of the serialized message.\n */\nexport interface GoogleProtobufAny {\n /**\n * The type of the serialized message.\n */\n '@type'?: string;\n}\n\nexport interface ListAIProviderKeysResponse {\n items: Array<AIProviderKey>;\n pagination?: Page;\n}\n\nexport interface ListAPIKeysResponse {\n items: Array<APIKey>;\n pagination?: Page;\n}\n\nexport interface ListAccountWorkspacesResponse {\n items: Array<Workspace>;\n pagination?: Page;\n}\n\n/**\n * Response for listing feedback across an agent.\n */\nexport interface ListAgentFeedbackResponse {\n items: Array<ObjectiveFeedback>;\n pagination?: Page;\n}\n\n/**\n * List agent pools response\n */\nexport interface ListAgentPoolsResponse {\n items: Array<AgentPool>;\n pagination?: Page;\n}\n\n/**\n * List agent schedules response.\n */\nexport interface ListAgentSchedulesResponse {\n items: Array<AgentSchedule>;\n pagination?: Page;\n}\n\n/**\n * List agent variations response\n */\nexport interface ListAgentVariationsResponse {\n items: Array<AgentVariation>;\n pagination?: Page;\n}\n\nexport interface ListAgentWebhookDeliveriesResponse {\n items: Array<WebhookDelivery>;\n pagination?: Page;\n}\n\n/**\n * List agents response\n */\nexport interface ListAgentsResponse {\n items: Array<Agent>;\n pagination?: Page;\n}\n\nexport interface ListMemoryEntriesResponse {\n items: Array<MemoryEntry>;\n pagination?: Page;\n}\n\nexport interface ListMemoryLayersResponse {\n items: Array<MemoryLayer>;\n pagination?: Page;\n}\n\n/**\n * List models response\n */\nexport interface ListModelsResponse {\n items: Array<Model>;\n pagination?: Page;\n}\n\n/**\n * ListObjectiveContextWindowsResponse is the response to a ListObjectiveContextWindowsRequest\n */\nexport interface ListObjectiveContextWindowsResponse {\n items: Array<ObjectiveContextWindow>;\n pagination?: Page;\n}\n\nexport interface ListObjectiveEventsResponse {\n items: Array<ObjectiveEvent>;\n pagination?: Page;\n}\n\n/**\n * Response for listing feedback\n */\nexport interface ListObjectiveFeedbackResponse {\n items: Array<ObjectiveFeedback>;\n pagination?: Page;\n}\n\nexport interface ListObjectiveToolCallsResponse {\n items: Array<ObjectiveToolCall>;\n pagination?: Page;\n}\n\nexport interface ListObjectiveToolsResponse {\n items: Array<ObjectiveTool>;\n pagination?: Page;\n}\n\nexport interface ListObjectivesResponse {\n items: Array<Objective>;\n pagination?: Page;\n}\n\nexport interface ListProfilesResponse {\n items: Array<Profile>;\n pagination?: Page;\n}\n\n/**\n * List tenant subjects response.\n */\nexport interface ListTenantSubjectsResponse {\n items: Array<Subject>;\n pagination?: Page;\n}\n\n/**\n * List tenants response.\n */\nexport interface ListTenantsResponse {\n items: Array<Tenant>;\n pagination?: Page;\n}\n\nexport interface ListToolSetEventsResponse {\n items: Array<ToolSetEvent>;\n pagination?: Page;\n}\n\nexport interface ListToolSetSecretsResponse {\n items: Array<ToolSetSecret>;\n pagination?: Page;\n}\n\nexport interface ListToolSetUsageResponse {\n items: Array<ToolSetUsage>;\n pagination?: Page;\n}\n\nexport interface ListToolSetsResponse {\n items: Array<ToolSet>;\n pagination?: Page;\n}\n\nexport interface ListToolsResponse {\n items: Array<Tool>;\n pagination?: Page;\n}\n\n/**\n * List widget sessions response.\n */\nexport interface ListWidgetSessionsResponse {\n items: Array<WidgetSession>;\n pagination?: Page;\n}\n\n/**\n * List widgets response.\n */\nexport interface ListWidgetsResponse {\n items: Array<Widget>;\n pagination?: Page;\n}\n\nexport interface ListWorkspaceMembersResponse {\n items: Array<WorkspaceMember>;\n pagination?: Page;\n}\n\nexport interface ListWorkspaceSecretsResponse {\n items: Array<WorkspaceSecret>;\n pagination?: Page;\n}\n\nexport interface ListWorkspacesResponse {\n items: Array<Workspace>;\n pagination?: Page;\n}\n\n/**\n * Behavior hints synced from the MCP server's tool definition\n * (ToolAnnotations in the MCP specification). All hints are advisory:\n * servers are not required to send them, and clients should not rely\n * on them for security decisions. Absent hints keep the MCP spec\n * defaults (destructiveHint and openWorldHint default to true;\n * readOnlyHint and idempotentHint default to false).\n */\nexport interface MCP_Annotations {\n /**\n * A human-readable title for the tool.\n */\n title?: string;\n /**\n * If true, the tool does not modify its environment.\n */\n readOnlyHint?: boolean;\n /**\n * If true, the tool may perform destructive updates to its environment.\n * Only meaningful when read_only_hint is false.\n */\n destructiveHint?: boolean;\n /**\n * If true, calling the tool repeatedly with the same arguments has no\n * additional effect. Only meaningful when read_only_hint is false.\n */\n idempotentHint?: boolean;\n /**\n * If true, the tool may interact with an \"open world\" of external\n * entities (e.g. web search); if false, its domain is closed.\n */\n openWorldHint?: boolean;\n}\n\n/**\n * MemoryEntry is a single keyed value within a MemoryLayer. Entries are\n * addressed by their key, which follows the S3 object key safe-character\n * convention (see MemoryEntrySpec.key for the full rule). Keys are unique\n * within a single layer; the same key may appear in multiple layers, in which\n * case the cascade walk determines which one wins for a given objective (most\n * specific layer first).\n * \n * MemoryEntry is the summary shape, returned by ListMemoryEntries. It does\n * not carry the entry body — callers that need the body must fetch the entry\n * individually via GetMemoryEntry, which returns a MemoryEntryDetail.\n */\nexport interface MemoryEntry {\n metadata: ResourceMetadata;\n spec: MemoryEntrySpec;\n info: MemoryEntryInfo;\n}\n\n/**\n * MemoryEntryCreateSpec is the input shape for CreateMemoryEntry. It accepts\n * either inline content or a reference to a completed Upload; exactly one of\n * the two must be set.\n */\nexport type MemoryEntryCreateSpec =\n | MemoryEntryCreateSpec_Content\n | MemoryEntryCreateSpec_UploadId;\n\n/**\n * MemoryEntryDetail is the full representation of an entry, including the\n * resolved content body. Returned by GetMemoryEntry, CreateMemoryEntry, and\n * UpdateMemoryEntry.\n */\nexport interface MemoryEntryDetail {\n metadata: ResourceMetadata;\n spec: MemoryEntrySpec;\n info: MemoryEntryInfo;\n /**\n * The resolved body of the entry. For entries created or updated via an\n * upload_id, this is the ingested content, not the original upload handle.\n * May be empty; an entry with only a key and description is valid\n * (e.g., a stub skill being drafted, or an entry where the frontmatter\n * alone is the payload).\n */\n content: string;\n}\n\nexport interface MemoryEntryInfo {\n /**\n * The layer this entry belongs to.\n */\n memoryLayer?: ResourceMetadata;\n createdBy?: Profile;\n}\n\n/**\n * MemoryEntrySpec is the metadata portion of an entry — the fields that\n * identify and describe it, without the body. It appears on both the summary\n * (MemoryEntry) and detail (MemoryEntryDetail) views.\n */\nexport interface MemoryEntrySpec {\n /**\n * The lookup key for this entry within its layer. Must conform to the S3\n * object key safe-characters spec: ASCII alphanumerics and the special\n * characters !, -, _, ., *, ', (, ), and /. Forward slashes may be used to\n * suggest hierarchy (e.g., \"skills/postmortem/write\"), but lookups are flat\n * — the key is a single opaque string, not a path.\n * \n * Additional rules enforced by the service:\n * - May not begin or end with /\n * - May not contain consecutive slashes (//)\n * - May not begin with reserved prefixes (cadenya/, system/)\n * - Case-sensitive\n * - Unique within the parent layer\n * \n * For skills entries, this key is what the model passes to get_memory to\n * load the entry's content.\n */\n key: string;\n /**\n * One-line \"when to use this\" hint shown in the frontmatter manifest for\n * skills entries. The model uses this to decide whether to load the body,\n * so it should be written for the model as the audience. Ignored for layer\n * types that do not advertise frontmatter.\n */\n description: string;\n}\n\n/**\n * MemoryEntryUpdateSpec is the input shape for UpdateMemoryEntry. Fields\n * present in the request's update_mask are applied; unset fields are left\n * alone. The source oneof is optional for updates — omit it to leave the\n * body untouched, or set exactly one branch to replace it.\n */\nexport interface MemoryEntryUpdateSpec {\n key?: string;\n description?: string;\n content?: string;\n uploadId?: string;\n}\n\n/**\n * MemoryLayer is a named container of memory entries that can be composed into\n * an objective's memory cascade. Layers are workspace-scoped resources. The layer\n * type controls how its entries participate in the agent loop — see\n * MemoryLayerType for details.\n * \n * See \"Memory cascade composition\" above for how layers compose at lookup time.\n */\nexport interface MemoryLayer {\n metadata: ResourceMetadata;\n spec: MemoryLayerSpec;\n info: MemoryLayerInfo;\n}\n\nexport interface MemoryLayerInfo {\n /**\n * Number of entries currently in this layer.\n */\n entryCount: number;\n createdBy?: Profile;\n /**\n * Timestamp of the most recent objective that resolved against this layer.\n * Useful for surfacing unused layers in the dashboard.\n */\n lastUsedAt?: string;\n /**\n * For episodic layers, the metadata of the agent the layer belongs to\n * (resolved from MemoryLayerSpec.agent_id). Unset for non-episodic layers.\n */\n agent?: ResourceMetadata;\n}\n\nexport type MemoryLayerSpecType = 'MEMORY_LAYER_TYPE_UNSPECIFIED' | 'MEMORY_LAYER_TYPE_EPISODIC' | 'MEMORY_LAYER_TYPE_SKILLS';\n\nexport interface MemoryLayerSpec {\n type: MemoryLayerSpecType;\n /**\n * Human-readable description of the layer's purpose. Encouraged for\n * user-created layers; system-managed layers may have a generated description.\n */\n description?: string;\n /**\n * Server-set. True for layers managed by the system (e.g., episodic layers\n * created automatically when an objective uses an episodic_key). System-managed\n * layers cannot be assigned to objective cascades via the API and cannot be\n * mutated by clients — their lifecycle is controlled entirely by the runtime.\n */\n systemManaged: boolean;\n /**\n * For layers with a finite lifetime (e.g., episodic), the time at which the\n * layer becomes eligible for cleanup. Set by the system; unset for\n * persistent layers.\n */\n expiresAt?: string;\n /**\n * Server-set on episodic layers: the agent this layer belongs to. Unset for\n * non-episodic layers.\n */\n agentId: string;\n /**\n * Server-set on episodic layers: the caller-supplied episodic key the layer\n * was created for. Unset for non-episodic layers.\n */\n episodicKey: string;\n}\n\n/**\n * MemoryRead is emitted each time the agent resolves a key against the\n * memory cascade and loads an entry. Lookups that miss (key not found in\n * any layer) do not emit this event.\n */\nexport interface MemoryRead {\n /**\n * Human-readable description of the read, set by the runtime. For\n * example: \"Loaded skill\", \"Resolved context key\". Not machine-parsed;\n * intended for UI display alongside the other events in an objective's\n * timeline.\n */\n message: string;\n /**\n * The layer the entry resolved to. The top-most layer that contained\n * the key — other layers beneath it that also contained the key are\n * shadowed and not referenced here.\n */\n memoryLayerId: string;\n /**\n * The specific entry that was read.\n */\n memoryEntryId: string;\n}\n\n/**\n * MemoryReference identifies a memory layer or a specific entry within\n * one, for composition into a memory cascade. Used on objectives (where\n * entry pinning is permitted).\n * \n * memory_layer_id accepts both the canonical form (memlyr_…) and the\n * external-id form (external_id:my-custom-id). The same applies to\n * memory_entry_id when set.\n */\nexport interface MemoryReference {\n memoryLayerId: string;\n /**\n * When set, inserts only this entry from memory_layer_id into the cascade —\n * behaves as a single-entry layer (only this key resolves at this\n * position). The entry must belong to memory_layer_id; mismatches are\n * rejected with InvalidArgument.\n */\n memoryEntryId?: string;\n}\n\n/**\n * Whether the model is usable in this workspace. Output only. Use the\n * :enable and :disable actions to transition.\n */\nexport type ModelState = 'STATE_UNSPECIFIED' | 'STATE_ENABLED' | 'STATE_DISABLED';\n\n/**\n * Where this definition came from. Output only; set at creation. Synced\n * models reject edits to metadata.name and spec, manually entered models\n * accept them.\n */\nexport type ModelProvenance = 'PROVENANCE_UNSPECIFIED' | 'PROVENANCE_SYNCED_FROM_PROVIDER' | 'PROVENANCE_MANUALLY_ENTERED';\n\nexport interface Model {\n /**\n * Resource metadata\n */\n metadata: ResourceMetadata;\n /**\n * Model specification\n */\n spec: ModelSpec;\n /**\n * Server-populated info (e.g. the AI provider this model routes through).\n * Populated on reads when requested; see ListModelsRequest.include_info.\n */\n info?: ModelInfo;\n /**\n * Whether the model is usable in this workspace. Output only. Use the\n * :enable and :disable actions to transition.\n */\n state: ModelState;\n /**\n * Where this definition came from. Output only; set at creation. Synced\n * models reject edits to metadata.name and spec, manually entered models\n * accept them.\n */\n provenance: ModelProvenance;\n /**\n * Customer price overrides. Output only here; set through UpdateModel with\n * pricing_override.* mask paths. When an override is present, spec's price\n * fields already reflect it (they are the effective prices).\n */\n pricingOverride?: ModelPricingOverride;\n /**\n * The rates before any customer override: the catalog rate for a synced\n * model, the entered rate for a manually entered one. Output only. When a\n * side matches the spec price, an override may still be present; inspect\n * pricing_override field presence to determine whether an override is set.\n */\n basePricing: ModelBasePricing;\n}\n\n/**\n * ModelBasePricing is a model's default rates in cents per million tokens,\n * unaffected by pricing overrides. Zero means the rate is not known.\n */\nexport interface ModelBasePricing {\n /**\n * Default input token rate, in cents per million tokens.\n */\n inputPricePerMillionTokens: string;\n /**\n * Default output token rate, in cents per million tokens.\n */\n outputPricePerMillionTokens: string;\n}\n\n/**\n * ModelInfo carries server-derived, read-only details about a model.\n */\nexport interface ModelInfo {\n /**\n * The AI provider key powering this model, embedded so clients can read the\n * provider, key name, and promotional status (info.is_promotional) without a\n * second lookup. The key's model counts are not populated here; use the AI\n * provider key endpoints for those.\n */\n aiProviderKey?: AIProviderKey;\n /**\n * Number of agent variations currently provisioned on this model. Useful for\n * previewing how many variations a swap would affect.\n */\n agentVariationCount: number;\n /**\n * Represents the last time this model was used in an agent objective\n */\n lastUsedAt?: string;\n}\n\n/**\n * ModelPricingOverride replaces the catalog prices for a model. Each field is\n * independent: an absent field keeps the catalog price, a present field (zero\n * included) replaces it. Prices are cents per million tokens.\n */\nexport interface ModelPricingOverride {\n /**\n * Override for input token price, in cents per million tokens.\n */\n inputPricePerMillionTokens?: string;\n /**\n * Override for output token price, in cents per million tokens.\n */\n outputPricePerMillionTokens?: string;\n}\n\nexport interface ModelSpec {\n /**\n * The model provider (e.g., \"anthropic\", \"openai\", \"google\")\n */\n provider: string;\n /**\n * The model family (e.g., \"claude-sonnet-4.6\", \"gpt-5.4\", \"gemini-2.5-flash\")\n */\n family: string;\n /**\n * Maximum number of input tokens the model supports\n */\n maxInputTokens: number;\n /**\n * Maximum number of output tokens the model can generate\n */\n maxOutputTokens: number;\n /**\n * Cost per million input tokens in cents (e.g., 300 = $3.00). On reads this\n * is the effective price: the catalog price unless\n * Model.pricing_override replaces it. Writes only apply to manually\n * entered models; use UpdateModel's pricing_override paths to override a\n * synced model's price.\n */\n inputPricePerMillionTokens: string;\n /**\n * Cost per million output tokens in cents (e.g., 1500 = $15.00). Effective\n * price on reads, see input_price_per_million_tokens.\n */\n outputPricePerMillionTokens: string;\n /**\n * The inference knobs this model supports. Catalog data; drives which\n * ModelConfig fields a variation on this model may set. Reasoning support\n * (and its mode) lives here too, as the \"reasoning\" capability.\n */\n capabilities: Array<ModelSpec_Capability>;\n /**\n * The identifier the provider expects in inference requests, exactly as the\n * provider spells it: an OpenAI model name, a Vertex publisher model\n * resource, a Bedrock inference-profile ID or ARN, or an OpenAI-compatible\n * endpoint's model ID. Distinct from metadata.external_id, which is\n * Cadenya's slug. Verified with a minimal provider completion on creation\n * and whenever the identifier changes.\n */\n providerModelId: string;\n}\n\n/**\n * Capability describes one inference knob this model supports, with any\n * model-specific parameters for it. A variation's ModelConfig may only\n * set a knob whose capability is listed on the model's spec.\n */\nexport type ModelSpec_Capability =\n | ModelSpec_Capability_Temperature\n | ModelSpec_Capability_TopP\n | ModelSpec_Capability_TopK\n | ModelSpec_Capability_StopSequences\n | ModelSpec_Capability_MaxOutputTokens\n | ModelSpec_Capability_Reasoning\n | ModelSpec_Capability_Caching;\n\nexport type NoticeLevel = 'LEVEL_UNSPECIFIED' | 'LEVEL_INFO' | 'LEVEL_WARN';\n\n/**\n * Notice is a non-terminal event emitted by the runtime when something\n * noteworthy but non-fatal happens during an objective — for example a\n * just-in-time tool set failing to load, or a previously loaded tool being\n * dropped because it was archived. Notices carry no structured payload; they\n * exist to make the objective timeline self-explanatory.\n */\nexport interface Notice {\n level: NoticeLevel;\n /**\n * Human-readable description of what happened.\n */\n message: string;\n /**\n * Stable machine-readable identifier for the notice kind (for example\n * \"tool_set_load_failed\", \"tool_archived\"). Clients can switch on it or use\n * it as an i18n key; the message is the English fallback.\n */\n key: string;\n}\n\n/**\n * The current lifecycle state of the objective.\n */\nexport type ObjectiveState = 'OBJECTIVE_STATE_UNSPECIFIED' | 'OBJECTIVE_STATE_PENDING' | 'OBJECTIVE_STATE_RUNNING' | 'OBJECTIVE_STATE_WAITING' | 'OBJECTIVE_STATE_FAILED' | 'OBJECTIVE_STATE_CANCELLED' | 'OBJECTIVE_STATE_FINALIZED' | 'OBJECTIVE_STATE_TIMED_OUT';\n\n/**\n * Objective is the data for an objective. It contains the snapshotted fields for the selected agent and variation. Secrets are returned\n * only with their names, and the output definition is copied from the agent's configuration.\n */\nexport interface Objective {\n metadata: OperationMetadata;\n /**\n * The snapshot of the agent and the variation selected (either explicitly or by sampling) will be set here. Cadenya stores\n * the point-in-time snapshot of the configuration used to start an objective and maintains it throughout the entire lifecycle\n * so that changes to agents and variations in the middle of a cycle don't impact the objective itself\n */\n configSnapshot: ObjectiveConfigSnapshot;\n /**\n * The current lifecycle state of the objective.\n */\n state: ObjectiveState;\n /**\n * Optional human-readable detail about the current state (e.g. a failure reason).\n */\n stateMessage: string;\n /**\n * Read-only aggregated info about this objective's execution\n */\n info?: ObjectiveInfo;\n /**\n * system_prompt is read-only, derived from the selected variation's prompt\n */\n systemPrompt: string;\n /**\n * The first user message in the LLM chat history, either provided explicitly at\n * creation or rendered from the variation's first_user_message_template.\n */\n firstUserMessage: string;\n /**\n * A parent objective means the objective was spawned off using a separate agent to complete an objective\n */\n parentObjectiveId: string;\n /**\n * Secrets that can be used in the headers for tool calls using the secret interpolation format.\n */\n secrets: Array<Objective_Secret>;\n /**\n * Arbitrary data rendered into the variation's system_prompt_template\n */\n systemPromptData?: Record<string, unknown>;\n /**\n * Memory layers/entries layered over the baseline cascade inherited\n * from the selected variation — element-level rules over inherited\n * styles, in CSS terms.\n * \n * Array order is resolution order: EARLIER elements are more specific\n * and are consulted first. Entries pinned via memory_entry_id behave\n * as single-entry layers at their position.\n * \n * System-managed layers (e.g., episodic) cannot be referenced here;\n * they attach themselves automatically based on the episodic key.\n * \n * Size cap: the TOTAL effective cascade (this field + the variation's\n * memory layer assignments) must not exceed 10 entries. A request\n * that would produce a larger cascade is rejected with\n * InvalidArgument.\n */\n memoryCascade: Array<MemoryReference>;\n /**\n * The output of the objective, populated when the objective completes. Will match the schema of output_json_schema or output_json_inferred.\n * This will only be set if the state of the objective is set to OBJECTIVE_STATE_FINALIZED\n */\n output?: Record<string, unknown>;\n /**\n * Arbitrary data rendered into the variation's first_user_message_template\n */\n firstUserMessageData?: Record<string, unknown>;\n /**\n * If the agent variation that is selected has episodic memory enabled, then this key is used to create/update a memory layer\n * specific to the episodic memory. The layer may have a TTL configured by the variation.\n */\n episodicMemory?: ObjectiveEpisodicConfig;\n /**\n * Parameters forced onto this objective's tool calls, as provided at\n * creation. See CreateObjectiveRequest.pinned_parameters for semantics.\n */\n pinnedParameters: Record<string, string>;\n}\n\n/**\n * ObjectiveCancelled is the terminal event written when an objective is\n * cancelled. After this event, the objective is super-terminal: no further\n * iterations, compaction, or continuation are permitted.\n */\nexport interface ObjectiveCancelled {\n /**\n * Optional human-readable note recorded at cancel time. Today the workflow\n * sets \"Cancelled\" but this field leaves room for richer reasons (e.g.\n * \"Cancelled by user\", \"Cancelled by schedule sweep\", \"Credit balance exhausted\").\n */\n message: string;\n}\n\n/**\n * ObjectiveConfigSnapshot is the point-in-time snapshot of the agent, variation, and\n * (when applicable) schedule that an objective was started with.\n */\nexport interface ObjectiveConfigSnapshot {\n agent: Agent;\n agentVariation: AgentVariation;\n agentSchedule?: AgentSchedule;\n}\n\n/**\n * ObjectiveContextWindow is a window of chat completions that is grouped together to prevent context-window overflows. Context windows also allow\n * agents to compact their windows and carry on into a new one.\n */\nexport interface ObjectiveContextWindow {\n metadata: OperationMetadata;\n data: ObjectiveContextWindowData;\n info?: ObjectiveContextWindowInfo;\n}\n\nexport interface ObjectiveContextWindowData {\n /**\n * The objective's ID that this window belongs to\n */\n objectiveId: string;\n /**\n * sequence is a numeric representation of which context window this is. Sequences are useful to perform a max(sequence) on in order\n * to calculate how many context windows an objective has.\n */\n sequence: number;\n /**\n * A calculated value for how many prompt tokens (input tokens) have been used in this context window\n */\n promptTokens: number;\n /**\n * A calculated value for how many completion tokens (output tokens) have been used in this context window\n */\n completionTokens: number;\n /**\n * The instructions for this window to continue from a previous window's chat history.\n */\n previousWindowContinueInstructions: string;\n}\n\nexport interface ObjectiveContextWindowInfo {\n objective?: OperationMetadata;\n createdBy?: Profile;\n}\n\n/**\n * Context-usage breakdown measured for a single iteration at request-assembly\n * time. It reports how much of the context window each component occupies so\n * tool parameters, memory cascades, and prompts can be tuned against real\n * token usage.\n */\nexport interface ObjectiveDiagnostics {\n /**\n * Measured character lengths per context component.\n */\n contextLengths: ContextLengths;\n /**\n * Input tokens reported by the LLM provider for the iteration's completion.\n */\n inputTokens: number;\n /**\n * The portion of input_tokens served from the provider's prompt cache.\n * Lets clients distinguish \"big but cached\" from \"big and paid fresh\n * every iteration\".\n */\n cachedInputTokens: number;\n}\n\n/**\n * Episodic is used to configure the episodic memory for the objective\n */\nexport interface ObjectiveEpisodicConfig {\n /**\n * The caller-supplied episodic key. Objectives created with the same key\n * (for the same agent) share one episodic memory layer.\n */\n key: string;\n /**\n * The episodic memory layer resolved (created or reused) for this\n * objective's key. Populated by the system at objective creation.\n */\n memoryLayerId: string;\n}\n\nexport interface ObjectiveError {\n type: string;\n message: string;\n}\n\nexport interface ObjectiveEvent {\n /**\n * Durable events use objevt_ IDs, the only IDs accepted as reconnect\n * cursors. Live-only heartbeats use hb_ IDs and have no SSE id: field.\n */\n metadata: OperationMetadata;\n data: ObjectiveEventData;\n contextWindowId: string;\n info?: ObjectiveEventInfo;\n /**\n * Elapsed time of the work this event records, when it is known at\n * write time (e.g. assistant message generation, tool execution for\n * result/error events). Unset means the event is instantaneous or the\n * duration is not measurable. Serialized as a canonical duration\n * string (e.g. \"4.1s\"). Always set together with started_at.\n */\n duration?: string;\n /**\n * When the work this event records began. Set together with duration,\n * so the work interval is [started_at, started_at + duration]. The\n * event's created_at remains the time the event was persisted.\n */\n startedAt?: string;\n}\n\nexport type ObjectiveEventData =\n | ObjectiveEventData_UserMessage\n | ObjectiveEventData_ToolApprovalRequested\n | ObjectiveEventData_ToolApproved\n | ObjectiveEventData_ToolDenied\n | ObjectiveEventData_ToolCalled\n | ObjectiveEventData_Error\n | ObjectiveEventData_AssistantMessage\n | ObjectiveEventData_ToolResult\n | ObjectiveEventData_ToolError\n | ObjectiveEventData_ContextWindowCompacted\n | ObjectiveEventData_MemoryRead\n | ObjectiveEventData_Cancelled\n | ObjectiveEventData_SubAgentSpawned\n | ObjectiveEventData_SubAgentUpdated\n | ObjectiveEventData_Finalized\n | ObjectiveEventData_Notice\n | ObjectiveEventData_TimedOut\n | ObjectiveEventData_Reasoning\n | ObjectiveEventData_StateChanged\n | ObjectiveEventData_Heartbeat;\n\nexport interface ObjectiveEventInfo {\n objective?: OperationMetadata;\n createdBy: Profile;\n}\n\n/**\n * ObjectiveFeedback represents feedback submitted for an objective's execution.\n * Feedback is used to score agent variations and improve agent performance over time.\n */\nexport interface ObjectiveFeedback {\n metadata: OperationMetadata;\n data: ObjectiveFeedbackData;\n info: ObjectiveFeedbackInfo;\n}\n\nexport interface ObjectiveFeedbackData {\n /**\n * A score between -1.0 and 1.0 representing the quality of the objective's execution.\n * -1.0 is the worst possible score, 0.0 is neutral, and 1.0 is the best.\n */\n score?: number;\n /**\n * Optional human-readable comment explaining the feedback\n */\n comment?: string;\n}\n\nexport interface ObjectiveFeedbackInfo {\n /**\n * The profile that submitted the feedback\n */\n submittedBy: Profile;\n /**\n * The objective the feedback was submitted for.\n */\n objective?: BareMetadata;\n /**\n * The agent variation that executed the objective this feedback is about.\n */\n agentVariation?: BareMetadata;\n}\n\n/**\n * ObjectiveFinalized is the terminal event written when an objective is\n * finalized. After this event, the objective is super-terminal: no further\n * iterations, compaction, or continuation are permitted.\n */\nexport interface ObjectiveFinalized {\n /**\n * If the objective was created with an output schema, and the agent\n * successfully completed the objective, this field will contain the\n * structured output of the objective.\n */\n output?: Record<string, unknown>;\n}\n\n/**\n * ObjectiveHeartbeat reports recent execution liveness. It is transient:\n * delivered only on live streams, never stored in event history or delivered\n * to webhooks. Its hb_ event ID is not a reconnect cursor. Heartbeats do not\n * change objective state or promise progress from the model.\n */\nexport interface ObjectiveHeartbeat {\n}\n\n/**\n * ObjectiveInfo provides read-only aggregated statistics about an objective's execution\n */\nexport interface ObjectiveInfo {\n /**\n * Total number of events generated during this objective's execution\n */\n totalEvents: number;\n /**\n * Total number of tool calls made during execution\n */\n totalToolCalls: number;\n /**\n * Total input tokens consumed across all LLM completions across all context windows\n */\n totalInputTokens: number;\n /**\n * Total output tokens generated across all LLM completions across all context windows\n */\n totalOutputTokens: number;\n /**\n * Total number of context windows that this objective has generated\n */\n totalContextWindows: number;\n totalIterations: number;\n createdBy: Profile;\n /**\n * The effective memory cascade at objective creation time: the\n * episodic layer (when present), then Objective.memory_cascade, then\n * the variation's baseline layers by ascending position. Order is\n * resolution order — index 0 is the most specific and is consulted\n * first; the first layer containing a key wins. Returned on reads so\n * clients can see exactly what the objective resolves against without\n * re-joining variation state.\n */\n effectiveMemoryCascade: Array<MemoryReference>;\n /**\n * Agent details (not snapshotted).\n */\n agent: ResourceMetadata;\n /**\n * Agent variation details (not snapshotted).\n */\n agentVariation: ResourceMetadata;\n /**\n * ID of the objective's current (most recent) context window. Hydrated on\n * demand; empty when the objective has not yet produced a context window.\n */\n currentContextWindowId: string;\n /**\n * The tenant this objective is associated with, when one was asserted at\n * creation (directly or via a widget session).\n */\n tenant?: TenantReference;\n /**\n * The subject (person within the tenant) this objective is associated\n * with, when one was asserted at creation.\n */\n subject?: SubjectReference;\n /**\n * The widget this objective's conversation ran through, when it was\n * created via a widget session.\n */\n widget?: BareMetadata;\n}\n\n/**\n * The state before this write. OBJECTIVE_STATE_UNSPECIFIED when the\n * objective was just created.\n */\nexport type ObjectiveStateChangedFromState = 'OBJECTIVE_STATE_UNSPECIFIED' | 'OBJECTIVE_STATE_PENDING' | 'OBJECTIVE_STATE_RUNNING' | 'OBJECTIVE_STATE_WAITING' | 'OBJECTIVE_STATE_FAILED' | 'OBJECTIVE_STATE_CANCELLED' | 'OBJECTIVE_STATE_FINALIZED' | 'OBJECTIVE_STATE_TIMED_OUT';\n\n/**\n * The state after this write.\n */\nexport type ObjectiveStateChangedToState = 'OBJECTIVE_STATE_UNSPECIFIED' | 'OBJECTIVE_STATE_PENDING' | 'OBJECTIVE_STATE_RUNNING' | 'OBJECTIVE_STATE_WAITING' | 'OBJECTIVE_STATE_FAILED' | 'OBJECTIVE_STATE_CANCELLED' | 'OBJECTIVE_STATE_FINALIZED' | 'OBJECTIVE_STATE_TIMED_OUT';\n\n/**\n * ObjectiveStateChanged is written every time the objective's lifecycle state\n * is set, including the initial move into OBJECTIVE_STATE_PENDING at creation. Terminal\n * transitions also write their dedicated event (cancelled, timedOut,\n * finalized, error) immediately before this one, so consumers that only care\n * about the outcome can keep listening for those.\n */\nexport interface ObjectiveStateChanged {\n /**\n * The state before this write. OBJECTIVE_STATE_UNSPECIFIED when the\n * objective was just created.\n */\n fromState: ObjectiveStateChangedFromState;\n /**\n * The state after this write.\n */\n toState: ObjectiveStateChangedToState;\n /**\n * The status message recorded with the transition, if any (e.g.\n * \"Continued\", or the error summary on a failure).\n */\n message?: string;\n}\n\n/**\n * ObjectiveTimedOut is the terminal event written when an objective is\n * finalized by the inactivity sweep because it saw no activity (no user\n * messages, no LLM calls) within its variation's inactivity timeout — or the\n * system-wide 24 hour maximum when no timeout is configured. The objective\n * produces no output. After this event, the objective is super-terminal: no\n * further iterations, compaction, or continuation are permitted.\n */\nexport interface ObjectiveTimedOut {\n /**\n * Human-readable note recorded at timeout time (e.g. \"Timed out after 2h\n * of inactivity\").\n */\n message: string;\n}\n\n/**\n * ObjectiveTool represents a tool that was assigned to an objective.\n */\nexport interface ObjectiveTool {\n metadata: BareMetadata;\n /**\n * Snapshot of the tool at the time it was assigned to the objective. Because tools can change over time, snapshots\n * are used to ensure tools don't change unexpectedly during an objective's lifecycle.\n */\n snapshot: Tool;\n}\n\n/**\n * Current status of the tool call\n */\nexport type ObjectiveToolCallStatus = 'TOOL_CALL_STATUS_UNSPECIFIED' | 'TOOL_CALL_STATUS_AUTO_APPROVED' | 'TOOL_CALL_STATUS_WAITING_FOR_APPROVAL' | 'TOOL_CALL_STATUS_APPROVED' | 'TOOL_CALL_STATUS_DENIED';\n\nexport type ObjectiveToolCallExecutionStatus = 'TOOL_CALL_EXECUTION_STATUS_UNSPECIFIED' | 'TOOL_CALL_EXECUTION_STATUS_PENDING' | 'TOOL_CALL_EXECUTION_STATUS_RUNNING' | 'TOOL_CALL_EXECUTION_STATUS_COMPLETED' | 'TOOL_CALL_EXECUTION_STATUS_ERRORED' | 'TOOL_CALL_EXECUTION_STATUS_WAITING_FOR_CONTENT';\n\n/**\n * ObjectiveToolCall is a record of a tool call made during an objective's execution.\n * Tool calls are mutable — their status changes as they are approved, denied, or executed.\n */\nexport interface ObjectiveToolCall {\n metadata: OperationMetadata;\n data: ObjectiveToolCallData;\n /**\n * Current status of the tool call\n */\n status: ObjectiveToolCallStatus;\n info?: ObjectiveToolCallInfo;\n executionStatus: ObjectiveToolCallExecutionStatus;\n}\n\nexport interface ObjectiveToolCallData {\n /**\n * The tool that was called\n */\n callable: CallableTool;\n /**\n * The arguments passed to the tool\n */\n arguments: Record<string, unknown>;\n /**\n * A memo supplied by the reviewer when denying the tool call\n */\n memo?: string;\n /**\n * The profile that changed the status of this tool call. Set when the status is changed to APPROVED or DENIED by a user.\n */\n statusChangedBy?: Profile;\n /**\n * List of resolved secrets used by the tool call\n */\n resolvedSecrets: Array<ResolvedSecret>;\n}\n\nexport interface ObjectiveToolCallInfo {\n objective: OperationMetadata;\n createdBy?: Profile;\n tool?: BareMetadata;\n toolSet?: BareMetadata;\n}\n\n/**\n * ObjectiveToolCallResult is the content a tool returned after execution.\n * Tools can return multiple content blocks, and blocks can be multi-modal\n * (text, image, audio). Media blocks are stored by Cadenya and served as\n * short-lived signed URLs rather than inline bytes.\n */\nexport interface ObjectiveToolCallResult {\n /**\n * The result content as recorded — which is what the model was shown.\n * When a tool set overlay transformed the result (ToolOverlay\n * result_actions), this is the transformed content; the adapter's raw\n * response is kept in the tool call's debug log, not here.\n */\n content: Array<ObjectiveToolCallResult_ContentBlock>;\n}\n\nexport interface ObjectiveToolCallResult_AudioBlock {\n /**\n * Short-lived signed URL to download the stored audio.\n */\n url: string;\n /**\n * IANA media type of the stored audio, e.g. audio/wav.\n */\n mimeType: string;\n /**\n * Size of the stored audio in bytes.\n */\n sizeBytes: string;\n /**\n * When the signed URL expires.\n */\n expiresAt: string;\n}\n\n/**\n * ContentBlock is a single block of tool result content. Exactly one of\n * the variants is set.\n */\nexport type ObjectiveToolCallResult_ContentBlock =\n | ObjectiveToolCallResult_ContentBlock_Text\n | ObjectiveToolCallResult_ContentBlock_Image\n | ObjectiveToolCallResult_ContentBlock_Audio;\n\nexport interface ObjectiveToolCallResult_ImageBlock {\n /**\n * Short-lived signed URL to download the stored image.\n */\n url: string;\n /**\n * IANA media type of the stored image, e.g. image/png.\n */\n mimeType: string;\n /**\n * Size of the stored image in bytes.\n */\n sizeBytes: string;\n /**\n * When the signed URL expires.\n */\n expiresAt: string;\n}\n\nexport interface ObjectiveToolCallResult_TextBlock {\n text: string;\n /**\n * Size of the stored text in bytes. Filled by the server at record time;\n * zero on results recorded before this field existed.\n */\n sizeBytes?: string;\n}\n\n/**\n * Current status of the tool call\n */\nexport type ObjectiveToolCallWithResultStatus = 'TOOL_CALL_STATUS_UNSPECIFIED' | 'TOOL_CALL_STATUS_AUTO_APPROVED' | 'TOOL_CALL_STATUS_WAITING_FOR_APPROVAL' | 'TOOL_CALL_STATUS_APPROVED' | 'TOOL_CALL_STATUS_DENIED';\n\nexport type ObjectiveToolCallWithResultExecutionStatus = 'TOOL_CALL_EXECUTION_STATUS_UNSPECIFIED' | 'TOOL_CALL_EXECUTION_STATUS_PENDING' | 'TOOL_CALL_EXECUTION_STATUS_RUNNING' | 'TOOL_CALL_EXECUTION_STATUS_COMPLETED' | 'TOOL_CALL_EXECUTION_STATUS_ERRORED' | 'TOOL_CALL_EXECUTION_STATUS_WAITING_FOR_CONTENT';\n\n/**\n * ObjectiveToolCallWithResult is an ObjectiveToolCall plus the content the\n * tool returned. Returned by GetObjectiveToolCall.\n */\nexport interface ObjectiveToolCallWithResult {\n metadata: OperationMetadata;\n data: ObjectiveToolCallData;\n /**\n * Current status of the tool call\n */\n status: ObjectiveToolCallWithResultStatus;\n info: ObjectiveToolCallInfo;\n executionStatus: ObjectiveToolCallWithResultExecutionStatus;\n /**\n * The content returned by the tool. Only set once execution_status is\n * TOOL_CALL_EXECUTION_STATUS_COMPLETED.\n */\n result?: ObjectiveToolCallResult;\n /**\n * List of resolved secrets used by the tool call\n */\n resolvedSecrets: Array<ResolvedSecret>;\n}\n\nexport interface Objective_Secret {\n name: string;\n}\n\n/**\n * Omit tool request\n */\nexport interface OmitToolRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Tool set ID. Accepts the canonical ts_… form or the\n * external_id:<value> form.\n */\n toolSetId?: string;\n /**\n * Tool ID. Accepts the canonical tool_… form or the\n * external_id:<value> form.\n */\n id?: string;\n}\n\n/**\n * OpenAICompatibleConfig configures a generic endpoint that speaks the OpenAI\n * Chat Completions API. The base URL is required and its model catalog is\n * discovered live via GET {base_url}/models.\n */\nexport interface OpenAICompatibleConfig {\n baseUrl: string;\n}\n\n/**\n * OpenAIConfig holds OpenAI-specific settings.\n */\nexport interface OpenAIConfig {\n /**\n * Sent as the OpenAI-Organization header when set.\n */\n organizationId?: string;\n /**\n * Sent as the OpenAI-Project header when set.\n */\n projectId?: string;\n}\n\n/**\n * OpenRouterConfig holds OpenRouter-specific settings.\n */\nexport interface OpenRouterConfig {\n /**\n * Data-residency region (e.g. \"us\", \"eu\"). Empty uses the provider default.\n */\n region?: string;\n}\n\n/**\n * Metadata for ephemeral operations and activities (e.g., objectives, executions, runs)\n */\nexport interface OperationMetadata {\n /**\n * Unique identifier for the operation (prefixed ULID, e.g., \"obj_01HXK...\")\n */\n id: string;\n /**\n * Account this operation belongs to for multi-tenant isolation (prefixed ULID)\n */\n accountId: string;\n /**\n * Workspace this operation belongs to for organizational grouping (prefixed ULID)\n */\n workspaceId: string;\n /**\n * Key-value pairs for categorization and filtering. Values are 0-63\n * alphanumeric characters with \"-\", \"_\", or \".\" allowed between; keys\n * follow the same shape and additionally accept an optional DNS-subdomain\n * prefix (e.g. \"cadenya.com/\") of at most 253 characters.\n * Examples: {\"priority\": \"high\", \"source\": \"api\", \"workflow\": \"onboarding\"}\n */\n labels: Record<string, string>;\n /**\n * Timestamp when this operation was created\n * ULID includes timestamp information, but this explicit field enables easier querying\n */\n createdAt: string;\n /**\n * External ID for the operation (e.g., a workflow ID from an external system)\n */\n externalId: string;\n /**\n * ID of the actor (user or service account) that created this operation\n */\n profileId: string;\n}\n\n/**\n * Page carries cursor-based pagination state. There is no total: the cursor\n * walks the result set without ever counting it, and a count would cost a second\n * query on every list.\n */\nexport interface Page {\n nextCursor: string;\n}\n\n/**\n * Default: ON_MISSING_FAIL.\n */\nexport type ParameterActionPinOnMissing = 'ON_MISSING_UNSPECIFIED' | 'ON_MISSING_FAIL' | 'ON_MISSING_SKIP';\n\n/**\n * Bind the parameter to one of the objective's pinned parameters. It is\n * deleted from the schema (including any `required` entry), and on every\n * call the pinned value is written into the arguments, overwriting\n * anything the model supplied.\n * This is the authoritative-value action: the model never sees the\n * parameter and cannot influence it.\n * \n * `pin` differs from `set` with `{{ pinned_parameters.key }}` only in\n * how a missing key is handled (see `on_missing`) and in intent —\n * reading the tool set config, `pin` says \"this comes from the caller\".\n */\nexport interface ParameterAction_Pin {\n path: string;\n /**\n * Key into the objective's pinned_parameters map. Need not equal the\n * last segment of `path` — this is how a pinned `orgId` reaches a\n * tool whose parameter is named `organizationId`.\n */\n pinnedParameter: string;\n /**\n * Default: ON_MISSING_FAIL.\n */\n onMissing: ParameterActionPinOnMissing;\n}\n\n/**\n * Remove the parameter entirely. It is deleted from the schema\n * (including any `required` entry) and stripped from the arguments if\n * the model supplies it anyway. The tool receives no value for it — the\n * upstream default, if any, applies. Use this to save context on\n * parameters the model has no business setting (pagination cursors,\n * expansion flags, debug toggles).\n */\nexport interface ParameterAction_Remove {\n path: string;\n}\n\n/**\n * Force the parameter to a value. It is deleted from the schema\n * (including any `required` entry), and on every call the rendered\n * value is written into the arguments, overwriting anything the model\n * supplied.\n * \n * `value_template` is a Liquid template rendered against the objective:\n * \n * {{ pinned_parameters.<key> }} the objective's pinned parameters\n * {{ objective.id }} the objective's id\n * {{ objective.external_id }} the objective's external id\n * {{ objective.labels.<key> }} the objective's labels\n * \n * Templates render with strict variables: referencing a pinned\n * parameter or label that does not exist fails the call rather than\n * rendering an empty value.\n * \n * Tool set secrets are intentionally not exposed here: overlay-set\n * values are recorded as tool call arguments in events and tool call\n * history, and would leak. Use adapter headers for credentials.\n * \n * The rendered string is coerced to the parameter's declared schema\n * type: for a non-string parameter (integer, number, boolean, object,\n * array) the output is parsed as JSON. A value that fails to parse\n * errors the tool call. Prefer `pin` when the value is simply a pinned\n * parameter — it fails loudly when the key is absent instead of\n * rendering an empty string.\n */\nexport interface ParameterAction_Set {\n path: string;\n valueTemplate: string;\n}\n\n/**\n * Pause agent schedule request.\n */\nexport interface PauseAgentScheduleRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Schedule ID. Accepts the canonical `as_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\n/**\n * A profile identifies a user or non-human principal (such as an API key)\n * at the account level. Profiles are account-scoped and can be granted access\n * to multiple workspaces.\n */\nexport interface Profile {\n metadata: AccountResourceMetadata;\n spec: ProfileSpec;\n}\n\n/**\n * Whether this profile represents a human user, an API key, or a system\n * principal.\n */\nexport type ProfileSpecType = 'PROFILE_TYPE_UNSPECIFIED' | 'PROFILE_TYPE_USER' | 'PROFILE_TYPE_API_KEY' | 'PROFILE_TYPE_SYSTEM';\n\n/**\n * Configuration for a profile.\n */\nexport interface ProfileSpec {\n /**\n * Email address of the profile. Required and unique within an account for\n * user profiles.\n */\n email: string;\n /**\n * Display name (e.g., \"Bobby Tables\").\n */\n name: string;\n /**\n * Whether this profile represents a human user, an API key, or a system\n * principal.\n */\n type: ProfileSpecType;\n}\n\n/**\n * Publish agent request\n */\nexport interface PublishAgentRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\n/**\n * Reasoning carries the human-readable reasoning text a model produced while\n * working on an iteration — extended thinking (Anthropic, Gemini) or reasoning\n * summaries (OpenAI). It is emitted alongside the assistant message from the\n * same model response and is purely informational: the text shown here is\n * never sent back to the model.\n */\nexport interface Reasoning {\n /**\n * The reasoning text. May be a verbatim chain of thought or a\n * provider-generated summary depending on the model.\n */\n content: string;\n}\n\n/**\n * Detach a target by its foreign key. Removing an unassigned target returns\n * NotFound. The parent variation must exist and be accessible.\n */\nexport type RemoveAgentVariationAssignmentRequest =\n | RemoveAgentVariationAssignmentRequest_ToolId\n | RemoveAgentVariationAssignmentRequest_ToolSetId\n | RemoveAgentVariationAssignmentRequest_SubAgentId\n | RemoveAgentVariationAssignmentRequest_AgentPoolId;\n\n/**\n * Remove by memory layer ID. An unassigned layer returns NotFound.\n * The parent variation must still exist and be accessible.\n */\nexport interface RemoveAgentVariationMemoryLayerRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n /**\n * Layer to detach. Accepts memlyr_… or external_id:<value>.\n */\n memoryLayerId: string;\n}\n\nexport type ResolvedSecretSource = 'RESOLVED_SECRET_SOURCE_UNSPECIFIED' | 'RESOLVED_SECRET_SOURCE_WORKSPACE' | 'RESOLVED_SECRET_SOURCE_TOOLSET' | 'RESOLVED_SECRET_SOURCE_OBJECTIVE';\n\n/**\n * ResolvedSecret is a resolved secret value from the workspace, toolset, or objective. When a tool is called, it will rely\n * on secrets in the order of:\n * - Objective\n * - Toolset\n * - Workspace\n */\nexport interface ResolvedSecret {\n key: string;\n source: ResolvedSecretSource;\n}\n\n/**\n * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)\n */\nexport interface ResourceMetadata {\n /**\n * Unique identifier for the resource (prefixed ULID, e.g., \"agent_01HXK...\")\n */\n id: string;\n /**\n * Account this resource belongs to for multi-tenant isolation (prefixed ULID)\n */\n accountId: string;\n /**\n * Workspace this resource belongs to for organizational grouping (prefixed ULID)\n */\n workspaceId: string;\n /**\n * Human-readable name for the resource (e.g., \"Customer Support Agent\", \"Email Tool\")\n * Required for resources that users interact with directly\n */\n name: string;\n /**\n * External ID for the resource (e.g., a workflow ID from an external system)\n */\n externalId: string;\n /**\n * Key-value pairs for categorization and filtering. Values are 0-63\n * alphanumeric characters with \"-\", \"_\", or \".\" allowed between; keys\n * follow the same shape and additionally accept an optional DNS-subdomain\n * prefix (e.g. \"cadenya.com/\") of at most 253 characters.\n * Examples: {\"environment\": \"production\", \"team\": \"platform\", \"version\": \"v2\"}\n */\n labels: Record<string, string>;\n /**\n * ID of the actor (user or service account) that created this resource\n */\n profileId: string;\n /**\n * Timestamp when this resource was created\n */\n createdAt: string;\n /**\n * Timestamp when this resource was last updated\n */\n updatedAt?: string;\n}\n\n/**\n * Restore tool request\n */\nexport interface RestoreToolRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Tool set ID. Accepts the canonical ts_… form or the\n * external_id:<value> form.\n */\n toolSetId?: string;\n /**\n * Tool ID. Accepts the canonical tool_… form or the\n * external_id:<value> form.\n */\n id?: string;\n}\n\n/**\n * Default: ON_ERROR_RAW_CONTENT.\n */\nexport type ResultActionTransformOnError = 'ON_ERROR_UNSPECIFIED' | 'ON_ERROR_RAW_CONTENT' | 'ON_ERROR_FAIL';\n\n/**\n * Replace the result's text content with a rendered Liquid template.\n * Used to compact verbose responses to the fields the model actually\n * needs, or to rewrite a JSON response into a smaller JSON document.\n * \n * `content_template` is rendered against the call:\n * \n * {{ result.text }} the result's text content (text blocks\n * joined with newlines)\n * {{ result.json }} result.text parsed as JSON — objects and\n * arrays are navigable (`result.json.items`,\n * `| map: \"id\"`); absent when the text is not\n * valid JSON\n * {{ result.blocks }} every content block: [{type, text?,\n * mime_type?, size_bytes?}]\n * {{ parameters }} the arguments the tool was called with,\n * after parameter actions were applied\n * {{ tool.name }} the tool's metadata.name\n * {{ tool.llm_tool_name }} the name the model called it by\n * {{ pinned_parameters }} the objective's pinned parameters\n * {{ objective.id }} / {{ objective.external_id }} /\n * {{ objective.labels.<key> }}\n * \n * Templates render with strict variables: referencing `result.json` on\n * a non-JSON result, or any other undefined variable, is a render error\n * and `on_error` decides the outcome. The `json` filter pretty-prints a\n * value as JSON; `sanitized_json` emits it compact and escaped for\n * embedding.\n * \n * Transforms are text-only. `result.text` and `result.json` are built\n * from the result's text blocks; media blocks (images, audio) are opaque\n * to the template and pass through unchanged. The rendered text replaces\n * the text blocks as a single text block. A result with no text blocks\n * at all (an image-only or audio-only result) is out of scope: the\n * transform is skipped, the result is recorded as returned, and the\n * skip is noted in the tool call's debug log — this is not an `on_error`\n * case, nothing was attempted. The one exception is `expect_json`, where\n * a result with no text is a violated precondition and `on_error`\n * applies.\n */\nexport interface ResultAction_Transform {\n contentTemplate: string;\n /**\n * Default: ON_ERROR_RAW_CONTENT.\n */\n onError: ResultActionTransformOnError;\n /**\n * Require the tool result to have text content that parses as JSON\n * before rendering. A non-JSON (or text-less) result is then an error\n * subject to `on_error` even if the template never reads\n * `result.json`. Off by default: `result.json` is simply absent for\n * non-JSON results, and text-less results skip the transform.\n */\n expectJson: boolean;\n}\n\n/**\n * Resume agent schedule request.\n */\nexport interface ResumeAgentScheduleRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Schedule ID. Accepts the canonical `as_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\n/**\n * Revoke widget session request.\n */\nexport interface RevokeWidgetSessionRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Session ID. Accepts the canonical `wsess_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\nexport interface RotateAPIKeyRequest {\n /**\n * The workspace the API key belongs to (path).\n */\n workspaceId?: string;\n /**\n * The API key to rotate. A new token is issued and any existing token is\n * invalidated.\n */\n id?: string;\n}\n\n/**\n * Response containing the newly generated challenge token.\n */\nexport interface RotateChallengeTokenResponse {\n challengeToken: string;\n}\n\n/**\n * Response containing the newly generated webhook signing secret.\n */\nexport interface RotateWebhookEventsHmacSecretResponse {\n webhookEventsHmacSecret: string;\n}\n\n/**\n * Calendar is a wall-clock rule. Empty field-list semantics:\n * - second/minute/hour: empty means [{start: 0}] (top of the unit)\n * - day_of_month/month/day_of_week: empty means \"any value\"\n * Fire times = cartesian product across all fields.\n */\nexport interface Schedule_Calendar {\n second?: Array<Schedule_Range>;\n minute?: Array<Schedule_Range>;\n hour?: Array<Schedule_Range>;\n dayOfMonth?: Array<Schedule_Range>;\n month?: Array<Schedule_Range>;\n dayOfWeek?: Array<Schedule_Range>;\n comment?: string;\n}\n\n/**\n * Interval is a duration-based rule. Fires every `every` from a stable\n * anchor (workspace epoch), optionally phase-shifted by `offset`.\n */\nexport interface Schedule_Interval {\n every?: string;\n /**\n * Phase shift within `every`. Must be < `every` (enforced at runtime).\n */\n offset?: string;\n}\n\n/**\n * Inclusive numeric range with optional step.\n * {start: 9} → 9\n * {start: 9, end: 17} → 9..17\n * {start: 0, end: 59, step: 15} → 0,15,30,45\n * `end` defaults to `start`; `step` defaults to 1.\n */\nexport interface Schedule_Range {\n start?: number;\n end?: number;\n step?: number;\n}\n\nexport interface SearchToolsOrToolSetsResponse {\n tools: Array<Tool>;\n toolSets: Array<ToolSet>;\n agents: Array<Agent>;\n}\n\n/**\n * A single selector condition.\n */\nexport type Selector_Condition =\n | Selector_Condition_Attribute\n | Selector_Condition_HasParameter\n | Selector_Condition_Tools;\n\n/**\n * An explicit list of tools, matched on spec.llm_tool_name — the name\n * the model calls the tool by. It identifies a tool across versions:\n * just-in-time MCP sets keep one tool per signature and every version\n * shares the LLM name, so the condition keeps matching as the source\n * evolves. Any name in the list matches (OR). Names of tools not (or\n * not yet) present in the set are allowed and match nothing.\n */\nexport interface Selector_ToolNames {\n names?: Array<string>;\n}\n\n/**\n * SetToolCallContentRequest lets an external API consumer supply the result\n * of a bare tool call (one whose tool set has no execution adapter). Used\n * for human-in-the-loop tools and reverse harnesses that execute tools\n * locally and report results back.\n */\nexport interface SetToolCallContentRequest {\n workspaceId?: string;\n /**\n * The ID of the objective. Supports \"external_id:\" prefix for external IDs.\n */\n objectiveId?: string;\n /**\n * The ID of the tool call to set content for\n */\n toolCallId?: string;\n /**\n * The content to set on the tool call. Mirrors\n * ObjectiveToolCallResult.ContentBlock but writable: media blocks carry\n * raw data on input where the result-side carries a signed url on output.\n */\n content: Array<SetToolCallContentRequest_ContentBlock>;\n}\n\nexport interface SetToolCallContentRequest_AudioBlock {\n /**\n * Base64-encoded audio bytes.\n */\n data: string;\n /**\n * IANA media type of the audio, e.g. audio/wav.\n */\n mimeType: string;\n}\n\n/**\n * ContentBlock is a single block of tool call content supplied on input.\n * Exactly one of the variants is set.\n */\nexport type SetToolCallContentRequest_ContentBlock =\n | SetToolCallContentRequest_ContentBlock_Text\n | SetToolCallContentRequest_ContentBlock_Image\n | SetToolCallContentRequest_ContentBlock_Audio;\n\nexport interface SetToolCallContentRequest_ImageBlock {\n /**\n * Base64-encoded image bytes.\n */\n data: string;\n /**\n * IANA media type of the image, e.g. image/png.\n */\n mimeType: string;\n}\n\nexport interface SetToolCallContentRequest_TextBlock {\n text: string;\n}\n\nexport type StatusDetails =\n | WidgetSessionErrorInfo\n | GoogleProtobufAny;\n\n/**\n * The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).\n */\nexport interface Status {\n /**\n * The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].\n */\n code?: number;\n /**\n * A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.\n */\n message?: string;\n /**\n * A list of messages that carry the error details. There is a common set of message types for APIs to use.\n */\n details?: Array<StatusDetails>;\n}\n\nexport interface SubAgentSpawned {\n agent: ResourceMetadata;\n objective: OperationMetadata;\n task: string;\n}\n\nexport type SubAgentUpdatedStatus = 'STATUS_UNSPECIFIED' | 'STATUS_PENDING' | 'STATUS_RUNNING' | 'STATUS_COMPLETED' | 'STATUS_FAILED' | 'STATUS_CANCELLED';\n\nexport interface SubAgentUpdated {\n agent?: BareMetadata;\n objective?: BareMetadata;\n status: SubAgentUpdatedStatus;\n message?: string;\n}\n\n/**\n * Subject is a person within a tenant as a readable record. Like Tenant it\n * carries no spec — `metadata.external_id` is the customer's key for them,\n * unique within the tenant rather than the workspace.\n */\nexport interface Subject {\n metadata: ResourceMetadata;\n info?: SubjectInfo;\n}\n\n/**\n * SubjectAssertion identifies a person within a tenant in the customer's own\n * namespace — typically their user id. Asserting a subject upserts the\n * subject record under the asserted tenant and associates the created\n * resource with it. A subject assertion is only valid alongside a tenant\n * assertion: subject identifiers are scoped to their tenant.\n */\nexport interface SubjectAssertion {\n /**\n * The subject identifier in the customer's namespace (e.g. their user id).\n * Stored as the subject record's external_id; unique within the tenant.\n */\n id: string;\n /**\n * Optional human-readable name for the subject. Updates the subject\n * record's name on every assertion that provides it.\n */\n name?: string;\n}\n\n/**\n * SubjectInfo provides read-only server-derived data about a subject.\n */\nexport interface SubjectInfo {\n /**\n * The tenant this subject belongs to.\n */\n tenant: TenantReference;\n /**\n * Number of objectives associated with this subject.\n */\n objectiveCount: number;\n}\n\n/**\n * SubjectReference is the read-only echo of a resource's subject association,\n * carrying both Cadenya's canonical id and the customer's own key.\n */\nexport interface SubjectReference {\n /**\n * Cadenya's canonical subject id.\n */\n id: string;\n /**\n * The subject identifier in the customer's namespace, as asserted. Unique\n * within the subject's tenant.\n */\n externalId: string;\n /**\n * Human-readable name of the subject, when one has been asserted.\n */\n name?: string;\n}\n\n/**\n * Swap model on variations request. Each ModelSwap reassigns every agent\n * variation on current_model_id to next_model_id. The work runs asynchronously.\n */\nexport interface SwapModelOnVariationsRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * The swaps to perform.\n */\n modelSwaps?: Array<SwapModelOnVariationsRequest_ModelSwap>;\n}\n\nexport interface SwapModelOnVariationsRequest_ModelSwap {\n /**\n * The model variations are currently on. Accepts an id or \"external_id:\" slug.\n */\n currentModelId?: string;\n /**\n * The model to move variations to. Accepts an id or \"external_id:\" slug.\n */\n nextModelId?: string;\n /**\n * Whether to disable the current model after the swap.\n */\n disableCurrentAfterSwap?: boolean;\n}\n\n/**\n * Swap model on variations response. Empty: the work runs asynchronously, so no\n * counts are returned (a large data set would make the call slow).\n */\nexport interface SwapModelOnVariationsResponse {\n}\n\n/**\n * Emitted when a tool set sync operation completes successfully.\n */\nexport interface SyncCompleted {\n /**\n * Number of tools synced.\n */\n toolsSynced: number;\n /**\n * Optional message with additional details.\n */\n message: string;\n}\n\n/**\n * Emitted when a tool set sync operation fails.\n */\nexport interface SyncFailed {\n /**\n * Indicates this is an error event.\n */\n error: boolean;\n /**\n * Error message describing what went wrong.\n */\n message: string;\n /**\n * Optional error type/code for programmatic handling.\n */\n errorType: string;\n}\n\n/**\n * Emitted when a tool set sync operation begins.\n */\nexport interface SyncStarted {\n /**\n * Human-readable message describing the start of the sync.\n */\n message: string;\n}\n\n/**\n * The current lifecycle state of the tenant. Output only.\n */\nexport type TenantState = 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_ERASING';\n\n/**\n * Tenant is the customer's organization as a readable record rather than an\n * echo. It carries no spec: a tenant is never configured, only asserted, so\n * everything about it lives in the metadata envelope — `external_id` is the key\n * the customer asserted it under, `name` is the most recent name they asserted,\n * and `updated_at` is therefore when the tenant was last asserted.\n */\nexport interface Tenant {\n metadata: ResourceMetadata;\n info?: TenantInfo;\n /**\n * The current lifecycle state of the tenant. Output only.\n */\n state: TenantState;\n}\n\n/**\n * TenantAssertion identifies a tenant in the customer's own namespace — their\n * org, company, or team identifier for an end user. Asserting a tenant\n * upserts the tenant record in the workspace (keyed on `id` as the tenant's\n * external_id) and associates the created resource with it.\n */\nexport interface TenantAssertion {\n /**\n * The tenant identifier in the customer's namespace (e.g. \"acme-corp\").\n * Stored as the tenant record's external_id; stable across requests.\n */\n id: string;\n /**\n * Optional human-readable name for the tenant. Updates the tenant record's\n * name on every assertion that provides it.\n */\n name?: string;\n}\n\n/**\n * TenantInfo provides read-only server-derived data about a tenant.\n */\nexport interface TenantInfo {\n /**\n * Number of subjects asserted under this tenant.\n */\n subjectCount: number;\n /**\n * Number of objectives associated with this tenant, across every surface —\n * widget conversations and objectives created directly against the API\n * alike. This is the footprint a delete would destroy, which is why it is\n * worth the count query that populating `info` costs.\n */\n objectiveCount: number;\n /**\n * Number of widget sessions minted for this tenant that still exist.\n */\n widgetSessionCount: number;\n}\n\n/**\n * TenantReference is the read-only echo of a resource's tenant association,\n * carrying both Cadenya's canonical id and the customer's own key.\n */\nexport interface TenantReference {\n /**\n * Cadenya's canonical tenant id.\n */\n id: string;\n /**\n * The tenant identifier in the customer's namespace, as asserted.\n */\n externalId: string;\n /**\n * Human-readable name of the tenant, when one has been asserted.\n */\n name?: string;\n}\n\n/**\n * The current lifecycle state of the tool. Output only. Use the :omit and\n * :restore actions to transition; tool set syncs may also update it.\n */\nexport type ToolState = 'STATE_UNSPECIFIED' | 'STATE_AVAILABLE' | 'STATE_OMITTED' | 'STATE_ARCHIVED';\n\nexport interface Tool {\n metadata: ResourceMetadata;\n spec: ToolSpec;\n info?: ToolInfo;\n /**\n * The current lifecycle state of the tool. Output only. Use the :omit and\n * :restore actions to transition; tool set syncs may also update it.\n */\n state: ToolState;\n}\n\nexport interface ToolApprovalRequested {\n /**\n * The ID of the objective tool call record. Use this ID with the ApproveToolCall or DenyToolCall RPCs to approve or deny the tool call.\n */\n toolCallId: string;\n}\n\nexport interface ToolApproved {\n /**\n * The ID of the objective tool call record that was approved via the ApproveToolCall RPC.\n */\n toolCallId: string;\n}\n\nexport interface ToolCalled {\n /**\n * The ID of the objective tool call record that was executed.\n */\n toolCallId: string;\n /**\n * The tool that was called.\n */\n tool?: CallableTool;\n /**\n * The called tool's adapter configuration, including the bare adapter\n * marker for bare tools. Lets a webhook consumer act on the call (e.g.\n * detect a bare tool call and prepare to supply its content) without a\n * round-trip to GetObjectiveToolCall.\n */\n config?: ToolSpec_Config;\n /**\n * The arguments passed to the tool.\n */\n arguments?: Record<string, unknown>;\n /**\n * Whether the runtime authorized this call's arguments to be exposed in\n * public widget events. This records the resolved policy at call time so\n * consumers do not need to re-evaluate the tool set's current overlays.\n */\n argumentsExposedInWidgets?: boolean;\n}\n\nexport interface ToolDenied {\n /**\n * The ID of the objective tool call record that was denied via the DenyToolCall RPC.\n */\n toolCallId: string;\n /**\n * The memo provided by the reviewer when denying the tool call. This is passed to the agent to provide further instructions.\n */\n memo: string;\n}\n\nexport interface ToolError {\n /**\n * The ID of the objective tool call record that encountered an error during execution.\n */\n toolCallId: string;\n message: string;\n}\n\nexport interface ToolInfo {\n toolSet?: ResourceMetadata;\n createdBy?: Profile;\n /**\n * Content signature identifying the tool within its tool set: a hash of the\n * sanitized llm_tool_name, description, and canonical parameters. Two tools\n * with the same llm_tool_name but different parameters or description (as\n * MCP servers may return per user) have distinct signatures. Computed over\n * the raw spec — overlays do not change a tool's signature.\n */\n signature: string;\n /**\n * Keys of the tool set's overlays whose selectors match this tool\n * (ToolSetSpec.overlays), in evaluation order. Disabled overlays are\n * excluded. An overlay is listed when its selector matches even if none\n * of its actions changed this tool's schema (all its paths were absent),\n * so this answers \"which policies apply to this tool\" — diff\n * effective_parameters against spec.parameters for \"what changed\".\n * Empty when no overlay applies.\n */\n overlays?: Array<string>;\n /**\n * The parameter schema as presented to the model: spec.parameters after\n * every matching overlay's parameter actions have been applied, in order,\n * including maintenance of the schema's `required` list. Actions whose\n * outcome depends on the objective (pin with ON_MISSING_SKIP) are applied\n * as if the pinned key were present, so this reflects the intended steady\n * state rather than any one objective. Equals spec.parameters when no\n * overlay applies. Result actions have no effect here.\n */\n effectiveParameters?: Record<string, unknown>;\n}\n\n/**\n * A tool overlay is a policy attached to a tool set that reshapes the tools\n * the model sees and calls. It pairs a selector (which tools it applies to)\n * with actions that run before a call — rewriting the tool's parameter\n * schema and the arguments the model supplied — and after a call —\n * rewriting the result before it enters the model's context. It can also\n * explicitly allow the final call arguments to cross the otherwise-private\n * widget API boundary.\n * \n * Overlays exist for three reasons:\n * \n * - Authority. Adapter-derived tool sets (OpenAPI especially) expose many\n * parameters the model must never guess — a workspace id, a tenant id,\n * an account scope. Overlays bind those parameters to the objective's\n * `pinned_parameters` (see CreateObjectiveRequest.pinned_parameters):\n * the parameter disappears from the schema and the value is forced\n * server-side, so the model has no opportunity to supply a different\n * one.\n * - Context. Large specs carry pagination cursors, expansion flags and\n * verbose responses that cost tokens without helping the model.\n * Overlays strip parameters, fix them to literals, and compact results.\n * - Widget presentation. Tool arguments are private by default. An overlay\n * can opt matching tools into exposing their final call arguments in\n * visitor-facing widget events so an embedding UI can select a custom\n * renderer or presentation.\n * \n * Pinned parameters and overlays are complementary: pinned parameters are\n * *data* supplied per objective (or per widget session) by the caller;\n * overlays are *policy* authored once on the tool set. Pinning by name\n * still works without an overlay — a pinned key that matches a top-level\n * parameter name is applied to every tool in the objective — overlays are\n * for the cases that needs more: nested paths, renamed keys, a subset of\n * tools, or values that are literals rather than caller-supplied.\n * \n * Evaluation model:\n * \n * - Overlays are evaluated in list order; within an overlay, actions are\n * evaluated in list order. Later actions win on the same path (a `set`\n * followed by a `remove` leaves the parameter removed).\n * - The parameter schema the model sees is computed when tools are\n * assembled for an objective, so pre-call actions can consult that\n * objective's pinned parameters (this is what makes `pin` with\n * ON_MISSING_SKIP meaningful). Argument rewriting runs on every call.\n * - An action whose `path` does not exist in the tool's parameter schema\n * changes nothing in the schema the model sees. This is deliberate: a\n * broad selector (every `list_*` tool) may match tools with different\n * shapes, and one overlay should be able to cover all of them without\n * erroring on the ones that lack a given parameter. At call time the\n * model's arguments can still not widen what it controls: `remove`\n * strips the path whether or not it is declared, and `set`/`pin`\n * overwrite a value the model sent at an undeclared path (a schema this\n * evaluator cannot see through, e.g. behind $ref/allOf) while injecting\n * nothing into tools that lack the parameter.\n * - Overlays apply to just-in-time tool sets as well; the tools are\n * evaluated against overlays at the moment they are loaded.\n * - Result actions run once, when the tool call's result is recorded; the\n * stored result is the transformed one, so every reader (the model,\n * compaction, the API) sees the same content. They are not supported on\n * bare tool sets.\n */\nexport interface ToolOverlay {\n /**\n * Identifies the overlay within its tool set. Unique across the tool\n * set's overlays (enforced by the server), stable across reorders, and\n * surfaced in tool call messages (\"parameter removed by overlay\n * strip-list-knobs\") so an operator can trace a rewritten call back to\n * the policy that rewrote it. Referenced by ToolInfo.overlays and the\n * ListToolsRequest.overlays filter.\n */\n key: string;\n /**\n * Which tools this overlay applies to. Required; an empty selector\n * (no conditions) matches every tool in the set.\n */\n selector: ToolOverlay_Selector;\n /**\n * Pre-call actions, applied in order. See ParameterAction.\n */\n parameterActions?: Array<ToolOverlay_ParameterAction>;\n /**\n * Post-call actions, applied in order. See ResultAction.\n */\n resultActions?: Array<ToolOverlay_ResultAction>;\n /**\n * When true the overlay is retained in the spec but not evaluated. Lets an\n * operator switch a policy off to diagnose a misbehaving tool without\n * deleting it and losing the configuration.\n */\n disabled: boolean;\n /**\n * Arguments may carry sensitive customer data, including values injected by\n * parameter actions, so they stay private unless an overlay enables them.\n * \n * Unset means this overlay has no opinion. When several enabled overlays\n * match a tool, they are evaluated in list order and the last overlay that\n * supplies this policy wins. If none supplies it, arguments stay private.\n * Disabled overlays never participate.\n */\n widgetArgumentExposure?: ToolOverlay_WidgetArgumentExposure;\n}\n\n/**\n * A pre-call action. Parameter actions rewrite the tool's parameter\n * schema as presented to the model and the arguments the model supplies\n * when it calls the tool. Both sides are always kept in agreement: a\n * parameter that is hidden from the schema is also stripped from (or\n * forced in) the arguments, so the model can neither see nor smuggle it.\n */\nexport type ToolOverlay_ParameterAction =\n | ToolOverlay_ParameterAction_Remove\n | ToolOverlay_ParameterAction_Set\n | ToolOverlay_ParameterAction_Pin;\n\n/**\n * A dotted path into a tool's parameter schema. Each segment is a property\n * name; the path `filter.workspaceId` addresses\n * `properties.filter.properties.workspaceId` in the schema and\n * `arguments.filter.workspaceId` in the call. Only object properties are\n * addressable — there is no array indexing, wildcarding or filtering.\n * \n * This is deliberately not JSONPath: every action needs a single,\n * unambiguous location in both the schema and the arguments so that\n * removing a parameter from the schema and stripping it from the call are\n * guaranteed to agree.\n */\nexport interface ToolOverlay_ParameterPath {\n path: string;\n}\n\n/**\n * A post-call action. Result actions rewrite a tool call's result after\n * the adapter returns and before it is recorded: the transformed content\n * is what is stored and what the model reads (ObjectiveToolCallResult\n * content). The adapter's raw response is kept in the tool call's debug\n * log for operators; it is not otherwise retained.\n * \n * Result actions apply to MCP, OpenAPI and HTTP tool sets. They are not\n * supported on bare tool sets — a bare tool's content is supplied by an\n * external consumer, so there is nothing for the platform to reshape —\n * and a tool set whose adapter is `bare` rejects overlays that carry\n * result actions.\n * \n * When several matching overlays carry transforms they run in overlay\n * order, each one reading the previous one's output.\n */\nexport type ToolOverlay_ResultAction =\n | ToolOverlay_ResultAction_Transform;\n\n/**\n * Default: OPERATOR_AND.\n */\nexport type ToolOverlaySelectorOperator = 'OPERATOR_UNSPECIFIED' | 'OPERATOR_AND' | 'OPERATOR_OR';\n\n/**\n * Which tools in the tool set an overlay applies to. Conditions are\n * combined with `operator`; an overlay with no conditions matches every\n * tool in the set.\n */\nexport interface ToolOverlay_Selector {\n conditions?: Array<Selector_Condition>;\n /**\n * Default: OPERATOR_AND.\n */\n operator: ToolOverlaySelectorOperator;\n}\n\n/**\n * Controls whether matching tool calls may expose their final arguments to\n * visitor-facing widget events. The containing message's presence means the\n * overlay has an opinion; enabled selects whether that opinion is on or off.\n */\nexport interface ToolOverlay_WidgetArgumentExposure {\n enabled: boolean;\n}\n\nexport interface ToolResult {\n toolCallId: string;\n /**\n * The content returned by the tool.\n */\n result: ObjectiveToolCallResult;\n}\n\n/**\n * The current lifecycle state of the tool set. Output only. Tool sets are\n * created STATE_ACTIVE; use the :archive and :unarchive actions to\n * transition between states.\n */\nexport type ToolSetState = 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_ARCHIVED';\n\nexport interface ToolSet {\n metadata: ResourceMetadata;\n spec: ToolSetSpec;\n /**\n * Tool set information\n */\n info?: ToolSetInfo;\n /**\n * The current lifecycle state of the tool set. Output only. Tool sets are\n * created STATE_ACTIVE; use the :archive and :unarchive actions to\n * transition between states.\n */\n state: ToolSetState;\n}\n\nexport type ToolSetAdapter =\n | ToolSetAdapter_McpVariant\n | ToolSetAdapter_HttpVariant\n | ToolSetAdapter_OpenapiVariant\n | ToolSetAdapter_BareVariant;\n\n/**\n * Approval filters that will automatically set the approval requirement on tools synced from an external source\n */\nexport type ToolSetAdapter_ApprovalRequirementFilter =\n | ToolSetAdapter_ApprovalRequirementFilter_Always\n | ToolSetAdapter_ApprovalRequirementFilter_Only;\n\nexport type ToolSetAdapterAttributeFilterAttribute = 'ATTRIBUTE_UNSPECIFIED' | 'ATTRIBUTE_NAME' | 'ATTRIBUTE_TITLE' | 'ATTRIBUTE_DESCRIPTION' | 'ATTRIBUTE_LLM_TOOL_NAME';\n\n/**\n * Single attribute filter\n */\nexport interface ToolSetAdapter_AttributeFilter {\n attribute: ToolSetAdapterAttributeFilterAttribute;\n matcher?: ToolSetAdapter_StringMatcher;\n}\n\n/**\n * Bare tool sets define tools without an execution adapter. A bare tool\n * call doesn't fire anything: the objective's workflow pauses and waits\n * for an external API consumer to set the tool call's content (e.g.\n * human-in-the-loop tools, or a reverse harness that polls for pending\n * tool calls, executes locally, and reports results back via\n * SetToolCallContent).\n */\nexport interface ToolSetAdapter_Bare {\n /**\n * How long to wait for content to be set before the tool call errors.\n * If unset, the call waits indefinitely.\n */\n contentTimeout?: number;\n}\n\nexport interface ToolSetAdapter_HTTP {\n /**\n * Base URL for dispatching tool calls.\n * \n * May be templated. Two reference forms are supported, and they resolve\n * in a single pass each so neither can inject into the other:\n * \n * ${SECRET_NAME} a workspace or tool set secret\n * {{ pinned_parameters.<key> }} the objective's pinned parameters\n * (see CreateObjectiveRequest.pinned_parameters)\n * \n * Pinned parameters are what make a per-tenant host possible: one tool\n * set can serve every customer of a product that assigns each of them\n * their own subdomain, e.g.\n * \n * https://{{ pinned_parameters.tenant }}.example.com\n * \n * Because the value may be a template rather than a literal URL, this\n * field is not constrained to a URI shape. It is validated as an\n * absolute http(s) URL after references are resolved, both on write\n * (with references stubbed) and again before each tool call.\n */\n baseUrl?: string;\n headers?: Record<string, string>;\n}\n\n/**\n * Defines behavior for just-in-time capable tool set adapters (IE: MCP).\n */\nexport interface ToolSetAdapter_JustInTime {\n enabled?: boolean;\n /**\n * If set, an objective will automatically be failed if tools cannot be loaded\n * in the initial stages of an objective being created. Tools are loaded asynchronously,\n * so this setting is useful for ensuring that an objective continued any further if tools are not available.\n */\n failObjectiveOnToolListError?: boolean;\n}\n\nexport interface ToolSetAdapter_MCP {\n url?: string;\n headers?: Record<string, string>;\n /**\n * Include/exclude with flat filters\n */\n includeTools?: ToolSetAdapter_ToolFilter;\n excludeTools?: ToolSetAdapter_ToolFilter;\n /**\n * Setting for how to assign tool approval requirements when they are synced from an MCP server\n */\n toolApprovals?: ToolSetAdapter_ApprovalRequirementFilter;\n /**\n * When enabled, tools are loaded from the MCP server just-in-time at\n * objective creation using the objective's resolved secrets, instead of\n * being synced ahead of time. Just-in-time tool sets are excluded from\n * the background sync system.\n */\n justInTime?: ToolSetAdapter_JustInTime;\n}\n\nexport type ToolSetAdapter_OpenAPI =\n | ToolSetAdapter_OpenAPI_Url\n | ToolSetAdapter_OpenAPI_UploadId;\n\n/**\n * String matching operations\n */\nexport type ToolSetAdapter_StringMatcher =\n | ToolSetAdapter_StringMatcher_Exact\n | ToolSetAdapter_StringMatcher_StartsWith\n | ToolSetAdapter_StringMatcher_EndsWith\n | ToolSetAdapter_StringMatcher_Contains\n | ToolSetAdapter_StringMatcher_Regex;\n\nexport type ToolSetAdapterToolFilterOperator = 'OPERATOR_UNSPECIFIED' | 'OPERATOR_AND' | 'OPERATOR_OR';\n\n/**\n * Top-level filter with simple boolean logic (no nesting)\n */\nexport interface ToolSetAdapter_ToolFilter {\n filters?: Array<ToolSetAdapter_AttributeFilter>;\n operator: ToolSetAdapterToolFilterOperator;\n}\n\n/**\n * A single event in the tool set's operation timeline.\n */\nexport interface ToolSetEvent {\n /**\n * Metadata for this operation event.\n */\n metadata: OperationMetadata;\n /**\n * The tool set this event is associated with.\n */\n toolSetId: string;\n /**\n * The event payload.\n */\n event: ToolSetEventData;\n info?: ToolSetEventInfo;\n}\n\n/**\n * Event payload for a tool set operation.\n */\nexport type ToolSetEventData =\n | ToolSetEventData_SyncStarted\n | ToolSetEventData_SyncCompleted\n | ToolSetEventData_SyncFailed;\n\nexport interface ToolSetEventInfo {\n toolSet?: ResourceMetadata;\n createdBy?: Profile;\n}\n\nexport interface ToolSetInfo {\n toolCount: number;\n agentCount: number;\n lastSync?: string;\n createdBy?: Profile;\n availableTools: number;\n omittedTools: number;\n}\n\nexport interface ToolSetSecret {\n metadata: ResourceMetadata;\n spec: ToolSetSecretSpec;\n /**\n * Tool set secret information\n */\n info?: ToolSetSecretInfo;\n}\n\nexport interface ToolSetSecretInfo {\n lastUsedAt?: string;\n createdBy?: Profile;\n}\n\nexport interface ToolSetSecretSpec {\n value?: string;\n}\n\nexport interface ToolSetSpec {\n description?: string;\n adapter: ToolSetAdapter;\n /**\n * Overlays applied to this tool set's tools, evaluated in order. See\n * ToolOverlay. Overlay keys must be unique within the list.\n * \n * As a repeated field this is replaced wholesale on update: an\n * update_mask of `spec.overlays` swaps the entire list for the one in the\n * request. Read-modify-write to add or remove a single overlay.\n */\n overlays?: Array<ToolOverlay>;\n}\n\n/**\n * ToolSetUsage describes one agent variation that uses the tool set (or, when\n * filtering by tool, an individual tool within it).\n */\nexport interface ToolSetUsage {\n /**\n * Metadata for the agent variation the assignment belongs to.\n */\n agentVariation: ResourceMetadata;\n /**\n * Metadata for the variation's parent agent.\n */\n agent: ResourceMetadata;\n /**\n * Metadata for the model assigned to the variation.\n */\n model: ResourceMetadata;\n /**\n * When the assignment was created.\n */\n assignedAt: string;\n}\n\nexport interface ToolSpec {\n description: string;\n requiresApproval: boolean;\n /**\n * The tool's JSON Schema, as handed to the LLM. Required, but may be the\n * empty object `{}` for a tool that takes no arguments. Requiring it rather\n * than defaulting it means a misspelled field name (`inputSchema`, say) is a\n * 400 instead of a silently parameterless tool.\n */\n parameters: Record<string, unknown>;\n /**\n * Configuration for this specific tool. Its transport is derived from the\n * tool set adapter, while details such as endpoint and method are stored on\n * the tool itself.\n * \n * Required, and exactly one adapter must be set.\n */\n config: ToolSpec_Config;\n /**\n * The name provided to the LLM, which may differ from the metadata.name on the tool.\n * LLMs have specific length and format requirements, and tool set sources may not comply\n * with them, so Cadenya does its best to format names into a usable format.\n */\n llmToolName?: string;\n}\n\n/**\n * Config defines the adapter to use for the tool.\n * This is used to determine how the tool is called.\n * For example, if the tool is an HTTP tool, the adapter will be Http.\n * If the tool is an inline tool, the adapter will be Inline.\n */\nexport type ToolSpec_Config =\n | ToolSpec_Config_Http\n | ToolSpec_Config_Mcp\n | ToolSpec_Config_Openapi\n | ToolSpec_Config_Bare;\n\n/**\n * Restore an archived pool to INACTIVE; activate it separately to route requests.\n */\nexport interface UnarchiveAgentPoolRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * AgentPool ID. Accepts the canonical `apool_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\n/**\n * Unarchive agent request\n */\nexport interface UnarchiveAgentRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\n/**\n * Unarchive tool set request\n */\nexport interface UnarchiveToolSetRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Tool set ID. Accepts the canonical ts_… form or the\n * external_id:<value> form.\n */\n id?: string;\n}\n\n/**\n * Unarchive widget request.\n */\nexport interface UnarchiveWidgetRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Widget ID. Accepts the canonical `wgt_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\n/**\n * Unpublish agent request\n */\nexport interface UnpublishAgentRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n id?: string;\n}\n\nexport interface UpdateAIProviderKeyRequest {\n /**\n * The workspace the key belongs to.\n */\n workspaceId?: string;\n /**\n * The key to update.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: AIProviderKeySpec;\n /**\n * Fields to update.\n */\n updateMask?: string;\n /**\n * Field-level credential changes. This is independent of update_mask;\n * legacy clients may continue replacing spec.credentials atomically.\n */\n credentialPatch?: AIProviderCredentialPatch;\n}\n\nexport interface UpdateAPIKeyRequest {\n /**\n * The workspace the API key belongs to (path).\n */\n workspaceId?: string;\n /**\n * The API key to update.\n */\n id?: string;\n metadata?: UpdateAccountResourceMetadata;\n spec?: APIKeySpec;\n /**\n * Fields to update.\n */\n updateMask?: string;\n}\n\n/**\n * UpdateAccountResourceMetadata contains the user-provided fields for updating\n * an account-scoped resource. Read-only fields (id, account_id, profile_id) are excluded\n * since they are set by the server.\n */\nexport interface UpdateAccountResourceMetadata {\n /**\n * Human-readable name for the resource (e.g., \"Production API Key\", \"Staging Workspace\")\n */\n name: string;\n /**\n * External ID for the resource (e.g., a workflow ID from an external system)\n */\n externalId?: string;\n /**\n * Key-value pairs for categorization and filtering. Values are 0-63\n * alphanumeric characters with \"-\", \"_\", or \".\" allowed between; keys\n * follow the same shape and additionally accept an optional DNS-subdomain\n * prefix (e.g. \"cadenya.com/\") of at most 253 characters.\n * Examples: {\"environment\": \"production\", \"team\": \"platform\", \"version\": \"v2\"}\n */\n labels?: Record<string, string>;\n}\n\n/**\n * Update agent pool request\n */\nexport interface UpdateAgentPoolRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * AgentPool ID. Accepts the canonical `apool_…` form or the `external_id:<value>` form.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: AgentPoolUpdateSpec;\n /**\n * Fields to update. Only metadata and spec are mutable; top-level state and info\n * paths are invalid. spec.assignments replaces the entire membership list.\n * A spec mask replaces the full spec; * replaces all mutable fields.\n * Without a mask, infer paths from non-empty fields. Empty or omitted\n * membership then leaves the existing list unchanged. Element/index paths\n * are invalid. Validate the merged pool atomically: an empty description\n * or membership (including an explicitly masked empty list) is invalid.\n */\n updateMask?: string;\n}\n\n/**\n * Update agent request\n */\nexport interface UpdateAgentRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: AgentSpec;\n /**\n * Fields to update\n */\n updateMask?: string;\n}\n\n/**\n * Update agent schedule request.\n */\nexport interface UpdateAgentScheduleRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Schedule ID. Accepts the canonical `as_…` form or the `external_id:<value>` form.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: AgentScheduleSpec;\n /**\n * Fields to update.\n */\n updateMask?: string;\n}\n\n/**\n * Update an existing memory layer assignment. Only `position` is mutable.\n * A new position that collides with another assignment on the same variation\n * is rejected with InvalidArgument. An unassigned layer returns NotFound.\n */\nexport interface UpdateAgentVariationMemoryLayerRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n /**\n * Layer to reposition. Accepts memlyr_… or external_id:<value>.\n */\n memoryLayerId: string;\n /**\n * New position. Only field currently updatable on an assignment.\n */\n position: number;\n}\n\n/**\n * Update agent variation request\n */\nexport interface UpdateAgentVariationRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: AgentVariationSpec;\n /**\n * Fields to update. Assignment lists are replaced as a whole, never merged.\n * Select spec.assignments or spec.memory_layer_assignments to replace/clear\n * one list. Selecting spec replaces the entire spec (including omitted lists);\n * * replaces all mutable fields. Element/index paths are not supported.\n * Without a mask, infer paths from non-empty fields: non-empty assignment\n * lists replace existing lists, while omitted/empty lists remain unchanged.\n * To clear a list, explicitly include its path in the mask.\n */\n updateMask?: string;\n}\n\nexport interface UpdateMemoryEntryRequest {\n workspaceId?: string;\n /**\n * Memory layer ID. Accepts canonical memlyr_… form or external_id:<value> form.\n */\n memoryLayerId?: string;\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: MemoryEntryUpdateSpec;\n updateMask?: string;\n}\n\nexport interface UpdateMemoryLayerRequest {\n workspaceId?: string;\n /**\n * Memory layer ID. Accepts canonical memlyr_… form or external_id:<value> form.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: MemoryLayerSpec;\n updateMask?: string;\n}\n\n/**\n * Update model request. update_mask must list leaf paths: metadata.name,\n * metadata.external_id, metadata.labels, spec.provider_model_id,\n * spec.provider, spec.family, spec.max_input_tokens, spec.max_output_tokens,\n * spec.capabilities, pricing_override.input_price_per_million_tokens, and\n * pricing_override.output_price_per_million_tokens. Synced models\n * (PROVENANCE_SYNCED_FROM_PROVIDER) reject metadata.name and spec.* paths.\n * spec price fields are never writable; price changes go through\n * pricing_override, where a masked-but-absent field clears the override.\n * Metadata and spec must be present when their respective paths are masked.\n */\nexport interface UpdateModelRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Model ID. Accepts the canonical `model_…` form or the `external_id:<value>` form.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n /**\n * When any spec.* path is masked, send the complete spec (current values\n * plus edits); it is validated as a whole.\n */\n spec?: ModelSpec;\n /**\n * Customer price overrides, applied per masked path.\n */\n pricingOverride?: ModelPricingOverride;\n /**\n * Fields to update. Required; leaf paths only.\n */\n updateMask?: string;\n}\n\n/**\n * UpdateResourceMetadata contains the user-provided fields for updating\n * a workspace-scoped resource. Read-only fields (id, account_id, workspace_id, profile_id,\n * created_at) are excluded since they are set by the server.\n */\nexport interface UpdateResourceMetadata {\n /**\n * Human-readable name for the resource (e.g., \"Customer Support Agent\", \"Email Tool\")\n */\n name: string;\n /**\n * External ID for the resource (e.g., a workflow ID from an external system)\n */\n externalId?: string;\n /**\n * Key-value pairs for categorization and filtering. Values are 0-63\n * alphanumeric characters with \"-\", \"_\", or \".\" allowed between; keys\n * follow the same shape and additionally accept an optional DNS-subdomain\n * prefix (e.g. \"cadenya.com/\") of at most 253 characters.\n * Examples: {\"environment\": \"production\", \"team\": \"platform\", \"version\": \"v2\"}\n */\n labels?: Record<string, string>;\n}\n\nexport interface UpdateToolRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Tool set ID. Accepts the canonical ts_… form or the\n * external_id:<value> form.\n */\n toolSetId?: string;\n /**\n * Tool ID. Accepts the canonical tool_… form or the\n * external_id:<value> form.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: ToolSpec;\n updateMask?: string;\n}\n\nexport interface UpdateToolSetRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Tool set ID. Accepts the canonical ts_… form or the\n * external_id:<value> form.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: ToolSetSpec;\n updateMask?: string;\n}\n\nexport interface UpdateToolSetSecretRequest {\n /**\n * The workspace that owns the tool set.\n */\n workspaceId?: string;\n /**\n * The tool set the secret belongs to. Accepts the canonical ts_… form\n * or the external_id:<value> form.\n */\n toolSetId?: string;\n /**\n * The secret to update.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: ToolSetSecretSpec;\n /**\n * Fields to update.\n */\n updateMask?: string;\n}\n\n/**\n * Update widget request.\n */\nexport interface UpdateWidgetRequest {\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Widget ID. Accepts the canonical `wgt_…` form or the `external_id:<value>` form.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: WidgetSpec;\n /**\n * Fields to update.\n */\n updateMask?: string;\n}\n\nexport interface UpdateWorkspaceRequest {\n /**\n * Workspace ID to update (path).\n */\n workspaceId?: string;\n metadata?: UpdateAccountResourceMetadata;\n spec?: WorkspaceSpec;\n /**\n * Fields to update.\n */\n updateMask?: string;\n}\n\nexport interface UpdateWorkspaceSecretRequest {\n /**\n * The workspace the secret belongs to.\n */\n workspaceId?: string;\n /**\n * The secret to update.\n */\n id?: string;\n metadata?: UpdateResourceMetadata;\n spec?: WorkspaceSecretSpec;\n /**\n * Fields to update.\n */\n updateMask?: string;\n}\n\n/**\n * A handle representing a single file upload flow. Clients call CreateUpload\n * to receive a short-lived presigned URL, PUT the file directly to object\n * storage, then reference the upload by id when creating or updating\n * resources that accept binary content.\n * \n * Uploads are one-shot: once consumed by a creating or updating resource the\n * upload transitions to UPLOAD_STATUS_CONSUMED and cannot be reused. Unused\n * uploads expire and are garbage-collected.\n */\nexport interface Upload {\n metadata: ResourceMetadata;\n spec: UploadSpec;\n info: UploadInfo;\n}\n\n/**\n * Lifecycle state. Transitions PENDING → COMPLETE (storage confirms the\n * object exists) → CONSUMED (a resource referenced this upload), or\n * → EXPIRED (URL elapsed without a PUT).\n */\nexport type UploadInfoStatus = 'UPLOAD_STATUS_UNSPECIFIED' | 'UPLOAD_STATUS_PENDING' | 'UPLOAD_STATUS_COMPLETE' | 'UPLOAD_STATUS_CONSUMED' | 'UPLOAD_STATUS_EXPIRED';\n\nexport interface UploadInfo {\n /**\n * Presigned PUT URL. Short-lived. The client must PUT with the exact\n * Content-Type declared in the spec, and the body length must match\n * size_bytes.\n */\n uploadUrl: string;\n /**\n * Absolute time at which upload_url stops working.\n */\n uploadUrlExpiresAt?: string;\n /**\n * Lifecycle state. Transitions PENDING → COMPLETE (storage confirms the\n * object exists) → CONSUMED (a resource referenced this upload), or\n * → EXPIRED (URL elapsed without a PUT).\n */\n status: UploadInfoStatus;\n createdBy?: Profile;\n}\n\nexport interface UploadSpec {\n /**\n * Client-supplied filename. Used for audit and display only; does not\n * control the object's storage path.\n */\n filename: string;\n /**\n * MIME type the client will send. Baked into the presigned URL's signature\n * — the PUT must match exactly or object storage will reject it.\n */\n contentType: string;\n /**\n * Expected size of the upload in bytes. Baked into the presigned URL as a\n * Content-Length constraint.\n */\n sizeBytes: string;\n}\n\nexport interface UserMessage {\n content: string;\n}\n\n/**\n * A tool, tool set, sub-agent, or agent pool assigned to a variation, identified only by\n * the target resource ID. The same shape is accepted in a spec and returned\n * on reads. Assignment junction records are an internal implementation detail.\n */\nexport type VariationAssignment =\n | VariationAssignment_ToolId\n | VariationAssignment_ToolSetId\n | VariationAssignment_SubAgentId\n | VariationAssignment_AgentPoolId;\n\n/**\n * A whole memory layer in a variation's baseline memory cascade. Identified\n * by the memory layer ID; no assignment junction ID is exposed. Entry pinning\n * remains an objective-level capability.\n */\nexport interface VariationMemoryLayerAssignment {\n /**\n * Accepts the canonical memlyr_… ID or external_id:<value> on input.\n * Reads always return the canonical ID.\n */\n memoryLayerId: string;\n /**\n * Position is specificity: lower positions are consulted first; the highest\n * position is the most general fallback. Gaps and zero are valid. Positions\n * must be unique within a variation. Explicitly required in a full spec;\n * only AddAgentVariationMemoryLayer can choose an append position for you.\n */\n position: number;\n}\n\n/**\n * VertexConfig configures the Google Cloud project and location used by the\n * Vertex AI backend. Both are required for service-account authentication.\n */\nexport interface VertexConfig {\n projectId?: string;\n location?: string;\n}\n\nexport interface WebhookDelivery {\n metadata: OperationMetadata;\n /**\n * Webhook delivery details.\n */\n data: WebhookDeliveryData;\n}\n\nexport type WebhookDeliveryDataStatus = 'WEBHOOK_DELIVERY_STATUS_UNSPECIFIED' | 'WEBHOOK_DELIVERY_STATUS_PENDING' | 'WEBHOOK_DELIVERY_STATUS_COMPLETED' | 'WEBHOOK_DELIVERY_STATUS_FAILED' | 'WEBHOOK_DELIVERY_STATUS_DISABLED';\n\n/**\n * The type of objective event that triggered this webhook delivery\n */\nexport type WebhookDeliveryDataEventType = 'OBJECTIVE_EVENT_TYPE_UNSPECIFIED' | 'OBJECTIVE_EVENT_TYPE_USER_MESSAGE' | 'OBJECTIVE_EVENT_TYPE_TOOL_APPROVAL_REQUESTED' | 'OBJECTIVE_EVENT_TYPE_TOOL_APPROVED' | 'OBJECTIVE_EVENT_TYPE_TOOL_DENIED' | 'OBJECTIVE_EVENT_TYPE_TOOL_CALLED' | 'OBJECTIVE_EVENT_TYPE_ERROR' | 'OBJECTIVE_EVENT_TYPE_ASSISTANT_MESSAGE' | 'OBJECTIVE_EVENT_TYPE_TOOL_RESULT' | 'OBJECTIVE_EVENT_TYPE_TOOL_ERROR' | 'OBJECTIVE_EVENT_TYPE_CONTEXT_WINDOW_COMPACTED' | 'OBJECTIVE_EVENT_TYPE_MEMORY_READ' | 'OBJECTIVE_EVENT_TYPE_CANCELLED' | 'OBJECTIVE_EVENT_TYPE_SUB_AGENT_SPAWNED' | 'OBJECTIVE_EVENT_TYPE_SUB_AGENT_UPDATED' | 'OBJECTIVE_EVENT_TYPE_FINALIZED' | 'OBJECTIVE_EVENT_TYPE_NOTICE' | 'OBJECTIVE_EVENT_TYPE_TIMED_OUT' | 'OBJECTIVE_EVENT_TYPE_REASONING' | 'OBJECTIVE_EVENT_TYPE_STATE_CHANGED' | 'OBJECTIVE_EVENT_TYPE_HEARTBEAT';\n\nexport interface WebhookDeliveryData {\n /**\n * Related resources\n */\n agentId: string;\n objectiveId: string;\n objectiveEventId: string;\n /**\n * Webhook delivery details\n */\n webhookUrl: string;\n webhookId: string;\n status: WebhookDeliveryDataStatus;\n attemptCount: number;\n lastAttemptAt: string;\n /**\n * Response details. The response body is not retained.\n */\n httpStatusCode: number;\n errorMessage: string;\n latencyMs: number;\n /**\n * The type of objective event that triggered this webhook delivery\n */\n eventType: WebhookDeliveryDataEventType;\n /**\n * Response headers received from the webhook endpoint\n */\n responseHeaders: Record<string, string>;\n /**\n * Content length of the response body in bytes\n */\n responseContentLength: string;\n}\n\n/**\n * The current lifecycle state of the widget. Output only. Widgets are\n * created STATE_ACTIVE; use the :archive and :unarchive actions to\n * transition between states.\n */\nexport type WidgetState = 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_ARCHIVED';\n\n/**\n * Widget is an embeddable chat surface bound to a single agent. Each widget\n * owns a globally unique, immutable DNS label under the widgets domain\n * (e.g. \"k7m2xq9fp4wn.widgets.cadenya.com\"): one widget = one hostname = one\n * origin allowlist = one agent binding. Browsers talk to the widget host with\n * session bearer tokens minted server-side via WidgetSessionService.\n */\nexport interface Widget {\n metadata: ResourceMetadata;\n spec: WidgetSpec;\n info?: WidgetInfo;\n /**\n * The current lifecycle state of the widget. Output only. Widgets are\n * created STATE_ACTIVE; use the :archive and :unarchive actions to\n * transition between states.\n */\n state: WidgetState;\n}\n\n/**\n * WidgetInfo provides read-only server-derived data about a widget.\n */\nexport interface WidgetInfo {\n /**\n * The widget's DNS label — the single hostname label under the widgets\n * domain. Server-generated at creation, globally unique, immutable, and\n * deliberately unrelated to the widget's id.\n */\n dnsLabel: string;\n /**\n * The full hostname browsers talk to. Authoritative — clients must use this\n * value rather than constructing the hostname themselves.\n */\n host: string;\n /**\n * The agent this widget is bound to.\n */\n agent: BareMetadata;\n createdBy?: Profile;\n}\n\n/**\n * The current lifecycle state of the session. Output only. Sessions are\n * created STATE_ACTIVE; use :revoke to end one early.\n */\nexport type WidgetSessionState = 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_EXPIRED' | 'STATE_REVOKED' | 'STATE_EXHAUSTED';\n\n/**\n * WidgetSession is a delegated, narrowed credential for one visitor's use of\n * a widget, minted server-to-server by the customer's backend. The session\n * carries all customer-asserted context — tenant, subject, labels, secrets —\n * and every conversation (objective) created through the widget inherits it.\n * The browser renews short-lived bearer tokens at the widget host with\n * RenewWidgetSession, authenticated by its existing token. Renewal preserves\n * this bounded grant and does not extend its hard expiry.\n */\nexport interface WidgetSession {\n metadata: OperationMetadata;\n spec: WidgetSessionSpec;\n info?: WidgetSessionInfo;\n /**\n * The current lifecycle state of the session. Output only. Sessions are\n * created STATE_ACTIVE; use :revoke to end one early.\n */\n state: WidgetSessionState;\n /**\n * Names of the secrets attached to the session. Values are write-only:\n * provided at creation, encrypted at rest, and interpolated into tool-call\n * headers server-side — never returned by any API.\n */\n secrets: Array<WidgetSession_Secret>;\n /**\n * Present only on creation. The same envelope is returned by\n * RenewWidgetSession on the widget host. Omitted on reads, lists, and revocation.\n * Existing spec.token/spec.token_expires_at and info.host remain populated\n * on creation for v1 compatibility and agree with these credentials.\n */\n credentials?: WidgetSessionCredentials;\n}\n\n/**\n * WidgetSessionCredentials is the only credential envelope the customer's\n * backend forwards to the browser. Never log or persist its token. Responses\n * containing credentials use Cache-Control: no-store. Both initial and later\n * issuance use the same schema; no refresh token or management key is included.\n */\nexport interface WidgetSessionCredentials {\n /**\n * Canonical wsess_ identifier. Ordinary renewal cannot change the session.\n */\n sessionId: string;\n /**\n * Authoritative hostname, without a scheme or path. Use HTTPS with this\n * host; never construct it or accept a host change during renewal.\n */\n host: string;\n /**\n * Short-lived bearer credential for the widget host only.\n */\n token: string;\n /**\n * Exact token expiry, at most 15 minutes after issuance and never later\n * than session_expires_at. Equals JWT exp without the 60-second validation\n * tolerance added. Renew proactively before this timestamp.\n */\n tokenExpiresAt: string;\n /**\n * Immutable hard session expiry. Issuance never extends this deadline.\n */\n sessionExpiresAt: string;\n}\n\n/**\n * WidgetSessionInfo provides read-only server-derived data about a session.\n */\nexport interface WidgetSessionInfo {\n /**\n * The widget this session belongs to.\n */\n widget: BareMetadata;\n /**\n * The agent serving this session. Copied from the widget at mint and\n * immutable for the session's lifetime — re-pointing the widget's agent\n * affects new sessions only.\n */\n agent: BareMetadata;\n /**\n * The resolved tenant record, when a tenant was asserted at mint.\n */\n tenant?: TenantReference;\n /**\n * The resolved subject record, when a subject was asserted at mint.\n */\n subject?: SubjectReference;\n /**\n * The widget hostname this session's tokens are bound to. Authoritative —\n * clients must use this value rather than constructing the hostname.\n */\n host: string;\n /**\n * Number of conversation messages created through this session, counted\n * against the session's message cap.\n */\n messageCount: number;\n /**\n * When the session last created a conversation, sent a message, or\n * received a newly issued token.\n */\n lastActiveAt?: string;\n}\n\n/**\n * WidgetSessionSpec is the configuration of a session, fixed at mint.\n */\nexport interface WidgetSessionSpec {\n /**\n * Widget this session is minted against. Accepts the canonical `wgt_…` form\n * or the `external_id:<value>` form.\n */\n widgetId: string;\n /**\n * Required tenant assertion — the customer's organization identifier.\n * Upserts the tenant record in the workspace. Every conversation created\n * through this session inherits the tenant and subject identity.\n */\n tenant: TenantAssertion;\n /**\n * Required subject assertion — the visitor's ID within the tenant.\n * Sessions with the same tenant and subject share conversation history on\n * the same widget and agent, subject to the current session's permissions.\n * A static ID deliberately shares that history; use a distinct ID per\n * visitor when their conversations should be separate.\n */\n subject: SubjectAssertion;\n /**\n * Hard session expiry. Tokens never outlive it; after it passes the session\n * transitions to STATE_EXPIRED. Defaults to a server-chosen horizon when\n * unset.\n */\n expiresAt?: string;\n /**\n * Legacy creation-only alias of credentials.token; omitted on reads.\n * Supported throughout v1. New clients should consume credentials.\n * The browser obtains replacements with RenewWidgetSession at the widget host.\n */\n token: string;\n /**\n * Legacy creation-only alias of credentials.token_expires_at, supported\n * throughout v1. Distinct from expires_at, which bounds the session itself.\n */\n tokenExpiresAt?: string;\n /**\n * Parameters forced onto tool calls made by this session's conversations.\n * A pinned parameter is removed from the tool schema the LLM sees, and its\n * value is always overwritten server-side with the pinned value — so the\n * model cannot be tricked into calling a tool with a different id than the\n * one the session was minted for (e.g. pin \"workspaceId\" for an OpenAPI\n * tool with a /workspaces/{workspaceId} path). Flows to every objective\n * the session creates. See ToolSetSpec.overlays for binding pinned keys to\n * nested or differently named parameters.\n */\n pinnedParameters?: Record<string, string>;\n}\n\n/**\n * Secret is the name-only echo of a secret attached to the session. Values\n * are never returned.\n */\nexport interface WidgetSession_Secret {\n name: string;\n}\n\n/**\n * WidgetSpec is the user-provided configuration for a widget.\n */\nexport interface WidgetSpec {\n /**\n * Agent this widget is bound to. Accepts the canonical `agent_…` form or the\n * `external_id:<value>` form. Sessions copy the agent at mint: re-pointing a\n * widget's agent affects new sessions only.\n */\n agentId: string;\n /**\n * Optional explicit variation pin. Must belong to the widget's agent. When\n * set, every objective created through the widget runs this variation —\n * bypassing the agent's variation_selection_mode (staged rollout: pin in\n * production, follow in staging, promote by clearing). When unset, the\n * agent's selection mode chooses per conversation.\n */\n variationId?: string;\n /**\n * Web origins allowed to embed and use this widget, enforced at the edge on\n * every browser request. Exact origins only (scheme + host + optional\n * port), no paths, no wildcard subdomains.\n */\n originAllowlist?: Array<string>;\n}\n\n/**\n * Lifecycle status of the workspace. Archived workspaces reject all\n * requests scoped to them. Server-populated.\n */\nexport type WorkspaceStatus = 'STATUS_ENABLED' | 'STATUS_DISABLED' | 'STATUS_ARCHIVED';\n\nexport interface Workspace {\n metadata: AccountResourceMetadata;\n spec: WorkspaceSpec;\n /**\n * Lifecycle status of the workspace. Archived workspaces reject all\n * requests scoped to them. Server-populated.\n */\n status: WorkspaceStatus;\n /**\n * The workspace information\n */\n info?: WorkspaceInfo;\n}\n\n/**\n * WorkspaceInfo returns counts\n */\nexport interface WorkspaceInfo {\n totalAvailableTools: number;\n totalMemoryEntries: number;\n totalAgents: number;\n totalAgentVariations: number;\n}\n\n/**\n * A member of a workspace: the profile granted access plus the actor row that\n * links it to the workspace. Returned by member list/add operations.\n */\nexport interface WorkspaceMember {\n /**\n * The account profile that has access to the workspace.\n */\n profileId: string;\n /**\n * The actor row linking the profile to the workspace (the junction record).\n */\n actorId: string;\n /**\n * Display name of the member's profile.\n */\n name: string;\n /**\n * Email address of the member's profile.\n */\n email: string;\n /**\n * When the member was added to the workspace.\n */\n addedAt?: string;\n}\n\nexport interface WorkspaceSecret {\n metadata: ResourceMetadata;\n spec: WorkspaceSecretSpec;\n /**\n * Workspace secret information\n */\n info?: WorkspaceSecretInfo;\n}\n\nexport interface WorkspaceSecretInfo {\n lastUsedAt?: string;\n createdBy?: Profile;\n}\n\nexport interface WorkspaceSecretSpec {\n value?: string;\n}\n\nexport interface WorkspaceSpec {\n description?: string;\n}\n\n/**\n * The webhook data payload with flat top-level keys for agent, variation, objective, and event.\n */\nexport interface ObjectiveEventWebhookDataData {\n agent: ResourceMetadata;\n agentVariation: ResourceMetadata;\n objective: OperationMetadata;\n objectiveEvent: ObjectiveEvent;\n}\n\n/**\n * The envelope for an objective event webhook delivery. Contains timestamp, event type, and the webhook data payload.\n */\nexport interface ObjectiveEventWebhookData {\n /**\n * The event type, prefixed with objective_event. (e.g., objective_event.tool_result)\n */\n type: string;\n timestamp: string;\n /**\n * The webhook data payload with flat top-level keys for agent, variation, objective, and event.\n */\n data: ObjectiveEventWebhookDataData;\n}\n\nexport interface VariationAssignment_ToolId {\n type: 'toolId';\n /**\n * Canonical tool ID.\n */\n toolId: string;\n}\n\nexport interface VariationAssignment_ToolSetId {\n type: 'toolSetId';\n /**\n * Canonical tool set ID.\n */\n toolSetId: string;\n}\n\nexport interface VariationAssignment_SubAgentId {\n type: 'subAgentId';\n /**\n * Canonical sub-agent ID.\n */\n subAgentId: string;\n}\n\nexport interface VariationAssignment_AgentPoolId {\n type: 'agentPoolId';\n /**\n * Canonical agent pool ID. Attaches the pool as a single callable target.\n */\n agentPoolId: string;\n}\n\nexport interface ObjectiveToolCallResult_ContentBlock_Text {\n type: 'text';\n text: ObjectiveToolCallResult_TextBlock;\n}\n\nexport interface ObjectiveToolCallResult_ContentBlock_Image {\n type: 'image';\n image: ObjectiveToolCallResult_ImageBlock;\n}\n\nexport interface ObjectiveToolCallResult_ContentBlock_Audio {\n type: 'audio';\n audio: ObjectiveToolCallResult_AudioBlock;\n}\n\nexport interface ToolSetEventData_SyncStarted {\n type: 'syncStarted';\n syncStarted: SyncStarted;\n}\n\nexport interface ToolSetEventData_SyncCompleted {\n type: 'syncCompleted';\n syncCompleted: SyncCompleted;\n}\n\nexport interface ToolSetEventData_SyncFailed {\n type: 'syncFailed';\n syncFailed: SyncFailed;\n}\n\nexport interface ToolSetAdapter_McpVariant {\n type: 'mcp';\n mcp: ToolSetAdapter_MCP;\n}\n\nexport interface ToolSetAdapter_HttpVariant {\n type: 'http';\n http: ToolSetAdapter_HTTP;\n}\n\nexport interface ToolSetAdapter_OpenapiVariant {\n type: 'openapi';\n openapi: ToolSetAdapter_OpenAPI;\n}\n\nexport interface ToolSetAdapter_BareVariant {\n type: 'bare';\n bare: ToolSetAdapter_Bare;\n}\n\nexport interface ToolSetAdapter_StringMatcher_Exact {\n type: 'exact';\n exact: string;\n caseSensitive?: boolean;\n}\n\nexport interface ToolSetAdapter_StringMatcher_StartsWith {\n type: 'startsWith';\n startsWith: string;\n caseSensitive?: boolean;\n}\n\nexport interface ToolSetAdapter_StringMatcher_EndsWith {\n type: 'endsWith';\n endsWith: string;\n caseSensitive?: boolean;\n}\n\nexport interface ToolSetAdapter_StringMatcher_Contains {\n type: 'contains';\n contains: string;\n caseSensitive?: boolean;\n}\n\nexport interface ToolSetAdapter_StringMatcher_Regex {\n type: 'regex';\n regex: string;\n caseSensitive?: boolean;\n}\n\nexport interface ToolSetAdapter_ApprovalRequirementFilter_Always {\n type: 'always';\n always: boolean;\n}\n\nexport interface ToolSetAdapter_ApprovalRequirementFilter_Only {\n type: 'only';\n only: ToolSetAdapter_ToolFilter;\n}\n\nexport interface ToolSetAdapter_OpenAPI_Url {\n type: 'url';\n /**\n * URL to fetch the OpenAPI spec from. Synced automatically every hour.\n */\n url: string;\n /**\n * Headers sent when fetching the spec from a URL and when dispatching tool calls.\n */\n headers?: Record<string, string>;\n includeTools?: ToolSetAdapter_ToolFilter;\n excludeTools?: ToolSetAdapter_ToolFilter;\n toolApprovals?: ToolSetAdapter_ApprovalRequirementFilter;\n /**\n * Base URL for dispatching tool calls. If set, overrides the server\n * resolved from the spec's servers array.\n * \n * May be templated with the same two reference forms the HTTP adapter's\n * base_url accepts:\n * \n * ${SECRET_NAME} a workspace or tool set secret\n * {{ pinned_parameters.<key> }} the objective's pinned parameters\n * \n * A spec written against a single host can therefore be dispatched to a\n * per-tenant one, e.g. https://{{ pinned_parameters.tenant }}.example.com,\n * without cloning the tool set per customer. Validated as an absolute\n * http(s) URL after references are resolved rather than as a literal URI.\n */\n baseUrl?: string;\n /**\n * Name of the server entry in the spec's servers array (OpenAPI 3.2\n * server.name field). Used to select which server URL to dispatch to\n * when base_url is not set. If unset, the first server is used.\n * Ignored when base_url is set.\n */\n serverName?: string;\n}\n\nexport interface ToolSetAdapter_OpenAPI_UploadId {\n type: 'uploadId';\n /**\n * ID of a COMPLETE Upload containing the OpenAPI spec document.\n */\n uploadId: string;\n /**\n * Headers sent when fetching the spec from a URL and when dispatching tool calls.\n */\n headers?: Record<string, string>;\n includeTools?: ToolSetAdapter_ToolFilter;\n excludeTools?: ToolSetAdapter_ToolFilter;\n toolApprovals?: ToolSetAdapter_ApprovalRequirementFilter;\n /**\n * Base URL for dispatching tool calls. If set, overrides the server\n * resolved from the spec's servers array.\n * \n * May be templated with the same two reference forms the HTTP adapter's\n * base_url accepts:\n * \n * ${SECRET_NAME} a workspace or tool set secret\n * {{ pinned_parameters.<key> }} the objective's pinned parameters\n * \n * A spec written against a single host can therefore be dispatched to a\n * per-tenant one, e.g. https://{{ pinned_parameters.tenant }}.example.com,\n * without cloning the tool set per customer. Validated as an absolute\n * http(s) URL after references are resolved rather than as a literal URI.\n */\n baseUrl?: string;\n /**\n * Name of the server entry in the spec's servers array (OpenAPI 3.2\n * server.name field). Used to select which server URL to dispatch to\n * when base_url is not set. If unset, the first server is used.\n * Ignored when base_url is set.\n */\n serverName?: string;\n}\n\nexport interface Selector_Condition_Attribute {\n type: 'attribute';\n /**\n * Match on a tool attribute (name, title, description,\n * llm_tool_name) with a string matcher — the same filter used by\n * the adapter's include/exclude lists.\n */\n attribute: ToolSetAdapter_AttributeFilter;\n}\n\nexport interface Selector_Condition_HasParameter {\n type: 'hasParameter';\n /**\n * Match tools whose parameter schema contains the given path. This\n * is the usual way to target \"every tool that takes a workspaceId\"\n * without enumerating tools by name.\n */\n hasParameter: ToolOverlay_ParameterPath;\n}\n\nexport interface Selector_Condition_Tools {\n type: 'tools';\n /**\n * Match specific tools by LLM tool name. The direct way to assign an\n * overlay to one tool (or a handful) without writing a matcher.\n */\n tools: Selector_ToolNames;\n}\n\nexport interface ToolOverlay_ParameterAction_Remove {\n type: 'remove';\n remove: ParameterAction_Remove;\n}\n\nexport interface ToolOverlay_ParameterAction_Set {\n type: 'set';\n set: ParameterAction_Set;\n}\n\nexport interface ToolOverlay_ParameterAction_Pin {\n type: 'pin';\n pin: ParameterAction_Pin;\n}\n\nexport interface ToolOverlay_ResultAction_Transform {\n type: 'transform';\n transform: ResultAction_Transform;\n}\n\nexport interface ToolSpec_Config_Http {\n type: 'http';\n http: Config_HTTP;\n}\n\nexport interface ToolSpec_Config_Mcp {\n type: 'mcp';\n mcp: Config_MCP;\n}\n\nexport interface ToolSpec_Config_Openapi {\n type: 'openapi';\n openapi: Config_OpenAPI;\n}\n\nexport interface ToolSpec_Config_Bare {\n type: 'bare';\n bare: Config_Bare;\n}\n\nexport interface ObjectiveEventData_UserMessage {\n type: 'userMessage';\n userMessage: UserMessage;\n}\n\nexport interface ObjectiveEventData_ToolApprovalRequested {\n type: 'toolApprovalRequested';\n toolApprovalRequested: ToolApprovalRequested;\n}\n\nexport interface ObjectiveEventData_ToolApproved {\n type: 'toolApproved';\n toolApproved: ToolApproved;\n}\n\nexport interface ObjectiveEventData_ToolDenied {\n type: 'toolDenied';\n toolDenied: ToolDenied;\n}\n\nexport interface ObjectiveEventData_ToolCalled {\n type: 'toolCalled';\n toolCalled: ToolCalled;\n}\n\nexport interface ObjectiveEventData_Error {\n type: 'error';\n error: ObjectiveError;\n}\n\nexport interface ObjectiveEventData_AssistantMessage {\n type: 'assistantMessage';\n assistantMessage: AssistantMessage;\n}\n\nexport interface ObjectiveEventData_ToolResult {\n type: 'toolResult';\n toolResult: ToolResult;\n}\n\nexport interface ObjectiveEventData_ToolError {\n type: 'toolError';\n toolError: ToolError;\n}\n\nexport interface ObjectiveEventData_ContextWindowCompacted {\n type: 'contextWindowCompacted';\n contextWindowCompacted: ContextWindowCompacted;\n}\n\nexport interface ObjectiveEventData_MemoryRead {\n type: 'memoryRead';\n memoryRead: MemoryRead;\n}\n\nexport interface ObjectiveEventData_Cancelled {\n type: 'cancelled';\n cancelled: ObjectiveCancelled;\n}\n\nexport interface ObjectiveEventData_SubAgentSpawned {\n type: 'subAgentSpawned';\n subAgentSpawned: SubAgentSpawned;\n}\n\nexport interface ObjectiveEventData_SubAgentUpdated {\n type: 'subAgentUpdated';\n subAgentUpdated: SubAgentUpdated;\n}\n\nexport interface ObjectiveEventData_Finalized {\n type: 'finalized';\n finalized: ObjectiveFinalized;\n}\n\nexport interface ObjectiveEventData_Notice {\n type: 'notice';\n notice: Notice;\n}\n\nexport interface ObjectiveEventData_TimedOut {\n type: 'timedOut';\n timedOut: ObjectiveTimedOut;\n}\n\nexport interface ObjectiveEventData_Reasoning {\n type: 'reasoning';\n reasoning: Reasoning;\n}\n\nexport interface ObjectiveEventData_StateChanged {\n type: 'stateChanged';\n stateChanged: ObjectiveStateChanged;\n}\n\nexport interface ObjectiveEventData_Heartbeat {\n type: 'heartbeat';\n heartbeat: ObjectiveHeartbeat;\n}\n\nexport interface CallableTool_Tool {\n type: 'tool';\n tool: ResourceMetadata;\n}\n\nexport interface CallableTool_Agent {\n type: 'agent';\n agent: ResourceMetadata;\n}\n\nexport interface CallableTool_CadenyaProvidedTool {\n type: 'cadenyaProvidedTool';\n cadenyaProvidedTool: ResourceMetadata;\n}\n\nexport interface CallableTool_AgentPool {\n type: 'agentPool';\n /**\n * Agent pool responsible for routing this call to a member agent.\n */\n agentPool: ResourceMetadata;\n}\n\nexport interface MemoryEntryCreateSpec_Content {\n type: 'content';\n /**\n * Inline content, written directly into the entry.\n */\n content: string;\n /**\n * See MemoryEntrySpec.key for the full rule set. Same constraints apply\n * here.\n */\n key: string;\n description?: string;\n}\n\nexport interface MemoryEntryCreateSpec_UploadId {\n type: 'uploadId';\n /**\n * ID of a COMPLETE Upload. The server reads the object from storage,\n * copies its bytes into the entry, and marks the upload consumed.\n */\n uploadId: string;\n /**\n * See MemoryEntrySpec.key for the full rule set. Same constraints apply\n * here.\n */\n key: string;\n description?: string;\n}\n\nexport interface SetToolCallContentRequest_ContentBlock_Text {\n type: 'text';\n text: SetToolCallContentRequest_TextBlock;\n}\n\nexport interface SetToolCallContentRequest_ContentBlock_Image {\n type: 'image';\n image: SetToolCallContentRequest_ImageBlock;\n}\n\nexport interface SetToolCallContentRequest_ContentBlock_Audio {\n type: 'audio';\n audio: SetToolCallContentRequest_AudioBlock;\n}\n\nexport interface AddAgentVariationAssignmentRequest_ToolId {\n type: 'toolId';\n toolId: string;\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n}\n\nexport interface AddAgentVariationAssignmentRequest_ToolSetId {\n type: 'toolSetId';\n toolSetId: string;\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n}\n\nexport interface AddAgentVariationAssignmentRequest_SubAgentId {\n type: 'subAgentId';\n subAgentId: string;\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n}\n\nexport interface AddAgentVariationAssignmentRequest_AgentPoolId {\n type: 'agentPoolId';\n /**\n * Canonical agent pool ID in the variation's workspace.\n */\n agentPoolId: string;\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n}\n\nexport interface RemoveAgentVariationAssignmentRequest_ToolId {\n type: 'toolId';\n toolId: string;\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n}\n\nexport interface RemoveAgentVariationAssignmentRequest_ToolSetId {\n type: 'toolSetId';\n toolSetId: string;\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n}\n\nexport interface RemoveAgentVariationAssignmentRequest_SubAgentId {\n type: 'subAgentId';\n subAgentId: string;\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n}\n\nexport interface RemoveAgentVariationAssignmentRequest_AgentPoolId {\n type: 'agentPoolId';\n /**\n * Canonical agent pool ID in the variation's workspace.\n */\n agentPoolId: string;\n /**\n * Workspace ID.\n */\n workspaceId?: string;\n /**\n * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.\n */\n agentId?: string;\n /**\n * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.\n */\n variationId?: string;\n}\n\nexport interface AIProviderCredential_ApiKey {\n type: 'apiKey';\n /**\n * Single API key (OpenRouter, OpenAI, Anthropic, Gemini, and most others).\n */\n apiKey: CredentialAPIKey;\n}\n\nexport interface AIProviderCredential_Headers {\n type: 'headers';\n /**\n * Arbitrary auth headers, for generic endpoints that authenticate with a\n * custom header rather than a bearer key (pairs with the OpenAI-compatible\n * provider).\n */\n headers: CredentialHeaders;\n}\n\nexport interface AIProviderCredential_GoogleServiceAccount {\n type: 'googleServiceAccount';\n /**\n * Google service-account JSON for Vertex AI. The server accepts only the\n * service_account credential type and never writes the JSON to plaintext\n * storage.\n */\n googleServiceAccount: CredentialGoogleServiceAccount;\n}\n\nexport interface AIProviderCredential_AwsAccessKey {\n type: 'awsAccessKey';\n /**\n * AWS access credentials for Bedrock SigV4 authentication.\n */\n awsAccessKey: CredentialAWSAccessKey;\n}\n\nexport interface AIProviderConfig_Openrouter {\n type: 'openrouter';\n openrouter: OpenRouterConfig;\n}\n\nexport interface AIProviderConfig_Openai {\n type: 'openai';\n openai: OpenAIConfig;\n}\n\nexport interface AIProviderConfig_OpenaiCompatible {\n type: 'openaiCompatible';\n openaiCompatible: OpenAICompatibleConfig;\n}\n\nexport interface AIProviderConfig_Vertex {\n type: 'vertex';\n vertex: VertexConfig;\n}\n\nexport interface AIProviderConfig_Bedrock {\n type: 'bedrock';\n bedrock: BedrockConfig;\n}\n\nexport interface ModelSpec_Capability_Temperature {\n type: 'temperature';\n temperature: Capability_Temperature;\n}\n\nexport interface ModelSpec_Capability_TopP {\n type: 'topP';\n topP: Capability_TopP;\n}\n\nexport interface ModelSpec_Capability_TopK {\n type: 'topK';\n topK: Capability_TopK;\n}\n\nexport interface ModelSpec_Capability_StopSequences {\n type: 'stopSequences';\n stopSequences: Capability_StopSequences;\n}\n\nexport interface ModelSpec_Capability_MaxOutputTokens {\n type: 'maxOutputTokens';\n maxOutputTokens: Capability_MaxOutputTokens;\n}\n\nexport interface ModelSpec_Capability_Reasoning {\n type: 'reasoning';\n reasoning: Capability_Reasoning;\n}\n\nexport interface ModelSpec_Capability_Caching {\n type: 'caching';\n caching: Capability_Caching;\n}\n\n/**\n * TOKEN_EXPIRED identifies access-token expiry beyond the 60-second clock-skew tolerance. That token cannot renew; use already-installed newer credentials or require explicit app reauthentication. SESSION_* reasons are terminal. Never infer renewability from HTTP status alone.\n */\nexport type WidgetSessionErrorReason = 'TOKEN_EXPIRED' | 'SESSION_REVOKED' | 'SESSION_EXPIRED' | 'SESSION_EXHAUSTED';\n\n/**\n * google.rpc.ErrorInfo detail for widget lifecycle failures. Match both domain and reason; ignore unknown reasons rather than renewing automatically.\n */\nexport interface WidgetSessionErrorInfo {\n '@type': 'type.googleapis.com/google.rpc.ErrorInfo';\n domain: 'api.cadenya.com';\n reason: WidgetSessionErrorReason;\n /**\n * Optional non-sensitive context. Never contains tokens or secrets.\n */\n metadata?: Record<string, string>;\n}\n\nexport type AgentPoolServiceListAgentPoolsState = 'AGENT_POOL_STATE_UNSPECIFIED' | 'AGENT_POOL_STATE_ACTIVE' | 'AGENT_POOL_STATE_INACTIVE' | 'AGENT_POOL_STATE_ARCHIVED';\n\nexport type AgentServiceListAgentsState = 'STATE_UNSPECIFIED' | 'STATE_DRAFT' | 'STATE_PUBLISHED' | 'STATE_ARCHIVED';\n\nexport type AgentServiceListAgentsVariationSelectionMode = 'VARIATION_SELECTION_MODE_UNSPECIFIED' | 'VARIATION_SELECTION_MODE_RANDOM' | 'VARIATION_SELECTION_MODE_WEIGHTED';\n\nexport type AgentServiceListAgentFeedbackSentiment = 'FEEDBACK_SENTIMENT_UNSPECIFIED' | 'FEEDBACK_SENTIMENT_POSITIVE' | 'FEEDBACK_SENTIMENT_NEGATIVE';\n\nexport type AgentServiceListAgentWebhookDeliveriesEventType = 'OBJECTIVE_EVENT_TYPE_UNSPECIFIED' | 'OBJECTIVE_EVENT_TYPE_USER_MESSAGE' | 'OBJECTIVE_EVENT_TYPE_TOOL_APPROVAL_REQUESTED' | 'OBJECTIVE_EVENT_TYPE_TOOL_APPROVED' | 'OBJECTIVE_EVENT_TYPE_TOOL_DENIED' | 'OBJECTIVE_EVENT_TYPE_TOOL_CALLED' | 'OBJECTIVE_EVENT_TYPE_ERROR' | 'OBJECTIVE_EVENT_TYPE_ASSISTANT_MESSAGE' | 'OBJECTIVE_EVENT_TYPE_TOOL_RESULT' | 'OBJECTIVE_EVENT_TYPE_TOOL_ERROR' | 'OBJECTIVE_EVENT_TYPE_CONTEXT_WINDOW_COMPACTED' | 'OBJECTIVE_EVENT_TYPE_MEMORY_READ' | 'OBJECTIVE_EVENT_TYPE_CANCELLED' | 'OBJECTIVE_EVENT_TYPE_SUB_AGENT_SPAWNED' | 'OBJECTIVE_EVENT_TYPE_SUB_AGENT_UPDATED' | 'OBJECTIVE_EVENT_TYPE_FINALIZED' | 'OBJECTIVE_EVENT_TYPE_NOTICE' | 'OBJECTIVE_EVENT_TYPE_TIMED_OUT' | 'OBJECTIVE_EVENT_TYPE_REASONING' | 'OBJECTIVE_EVENT_TYPE_STATE_CHANGED' | 'OBJECTIVE_EVENT_TYPE_HEARTBEAT';\n\nexport type MemoryServiceListMemoryLayersType = 'MEMORY_LAYER_TYPE_UNSPECIFIED' | 'MEMORY_LAYER_TYPE_EPISODIC' | 'MEMORY_LAYER_TYPE_SKILLS';\n\nexport type ModelServiceListModelsState = 'STATE_UNSPECIFIED' | 'STATE_ENABLED' | 'STATE_DISABLED';\n\nexport type ObjectiveServiceListObjectivesState = 'OBJECTIVE_STATE_UNSPECIFIED' | 'OBJECTIVE_STATE_PENDING' | 'OBJECTIVE_STATE_RUNNING' | 'OBJECTIVE_STATE_WAITING' | 'OBJECTIVE_STATE_FAILED' | 'OBJECTIVE_STATE_CANCELLED' | 'OBJECTIVE_STATE_FINALIZED' | 'OBJECTIVE_STATE_TIMED_OUT';\n\nexport type ObjectiveServiceListObjectiveToolCallsStatus = 'TOOL_CALL_STATUS_UNSPECIFIED' | 'TOOL_CALL_STATUS_AUTO_APPROVED' | 'TOOL_CALL_STATUS_WAITING_FOR_APPROVAL' | 'TOOL_CALL_STATUS_APPROVED' | 'TOOL_CALL_STATUS_DENIED';\n\nexport type ObjectiveServiceListObjectiveToolCallsExecutionStatus = 'TOOL_CALL_EXECUTION_STATUS_UNSPECIFIED' | 'TOOL_CALL_EXECUTION_STATUS_PENDING' | 'TOOL_CALL_EXECUTION_STATUS_RUNNING' | 'TOOL_CALL_EXECUTION_STATUS_COMPLETED' | 'TOOL_CALL_EXECUTION_STATUS_ERRORED' | 'TOOL_CALL_EXECUTION_STATUS_WAITING_FOR_CONTENT';\n\nexport type ToolServiceListToolSetsState = 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_ARCHIVED';\n\nexport type ToolServiceListToolsStates = 'STATE_UNSPECIFIED' | 'STATE_AVAILABLE' | 'STATE_OMITTED' | 'STATE_ARCHIVED';\n\nexport type WidgetSessionServiceListWidgetSessionsState = 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_EXPIRED' | 'STATE_REVOKED' | 'STATE_EXHAUSTED';\n\n\n// ---- request input shapes (direction-aware) ----\n\nexport interface APIKeySpecParam {\n /**\n * Free-form description of what this API key is used for.\n */\n description?: string;\n /**\n * Scopes granted to this key. Each entry is a colon-separated\n * resource:verb string (e.g. \"objectives:manage\").\n * \n * Resources: agents, objectives, tools, memory, api_keys, workspaces,\n * widgets, widget_sessions, secrets, account.\n * Verbs: read and manage, where manage implies read — a stored scope set\n * is normalized to drop \"x:read\" when \"x:manage\" is present. The secrets\n * and account resources support only manage. \"*\" is an explicit\n * full-access grant.\n * \n * Scopes are deny-by-default: a key with an empty list can call only\n * scope-free endpoints. Full access is always an explicit \"*\" grant.\n */\n permissions?: Array<string>;\n}\n\nexport type AddAgentVariationAssignmentRequestParam = AddAgentVariationAssignmentRequest_ToolIdParam | AddAgentVariationAssignmentRequest_ToolSetIdParam | AddAgentVariationAssignmentRequest_SubAgentIdParam | AddAgentVariationAssignmentRequest_AgentPoolIdParam;\n\nexport interface CreateAgentVariationRequestParam {\n metadata: CreateResourceMetadata;\n spec: AgentVariationSpec;\n}\n\nexport interface MemoryLayerSpecParam {\n type: MemoryLayerSpecType;\n /**\n * Human-readable description of the layer's purpose. Encouraged for\n * user-created layers; system-managed layers may have a generated description.\n */\n description?: string;\n}\n\nexport interface ObjectiveEpisodicConfigParam {\n /**\n * The caller-supplied episodic key. Objectives created with the same key\n * (for the same agent) share one episodic memory layer.\n */\n key: string;\n}\n\nexport type RemoveAgentVariationAssignmentRequestParam = RemoveAgentVariationAssignmentRequest_ToolIdParam | RemoveAgentVariationAssignmentRequest_ToolSetIdParam | RemoveAgentVariationAssignmentRequest_SubAgentIdParam | RemoveAgentVariationAssignmentRequest_AgentPoolIdParam;\n\nexport interface WidgetSessionSpecParam {\n /**\n * Widget this session is minted against. Accepts the canonical `wgt_…` form\n * or the `external_id:<value>` form.\n */\n widgetId: string;\n /**\n * Required tenant assertion — the customer's organization identifier.\n * Upserts the tenant record in the workspace. Every conversation created\n * through this session inherits the tenant and subject identity.\n */\n tenant: TenantAssertion;\n /**\n * Required subject assertion — the visitor's ID within the tenant.\n * Sessions with the same tenant and subject share conversation history on\n * the same widget and agent, subject to the current session's permissions.\n * A static ID deliberately shares that history; use a distinct ID per\n * visitor when their conversations should be separate.\n */\n subject: SubjectAssertion;\n /**\n * Hard session expiry. Tokens never outlive it; after it passes the session\n * transitions to STATE_EXPIRED. Defaults to a server-chosen horizon when\n * unset.\n */\n expiresAt?: string;\n /**\n * Parameters forced onto tool calls made by this session's conversations.\n * A pinned parameter is removed from the tool schema the LLM sees, and its\n * value is always overwritten server-side with the pinned value — so the\n * model cannot be tricked into calling a tool with a different id than the\n * one the session was minted for (e.g. pin \"workspaceId\" for an OpenAPI\n * tool with a /workspaces/{workspaceId} path). Flows to every objective\n * the session creates. See ToolSetSpec.overlays for binding pinned keys to\n * nested or differently named parameters.\n */\n pinnedParameters?: Record<string, string>;\n}\n\nexport interface AddAgentVariationAssignmentRequest_ToolIdParam {\n type: 'toolId';\n toolId: string;\n}\n\nexport interface AddAgentVariationAssignmentRequest_ToolSetIdParam {\n type: 'toolSetId';\n toolSetId: string;\n}\n\nexport interface AddAgentVariationAssignmentRequest_SubAgentIdParam {\n type: 'subAgentId';\n subAgentId: string;\n}\n\nexport interface AddAgentVariationAssignmentRequest_AgentPoolIdParam {\n type: 'agentPoolId';\n /**\n * Canonical agent pool ID in the variation's workspace.\n */\n agentPoolId: string;\n}\n\nexport interface RemoveAgentVariationAssignmentRequest_ToolIdParam {\n type: 'toolId';\n toolId: string;\n}\n\nexport interface RemoveAgentVariationAssignmentRequest_ToolSetIdParam {\n type: 'toolSetId';\n toolSetId: string;\n}\n\nexport interface RemoveAgentVariationAssignmentRequest_SubAgentIdParam {\n type: 'subAgentId';\n subAgentId: string;\n}\n\nexport interface RemoveAgentVariationAssignmentRequest_AgentPoolIdParam {\n type: 'agentPoolId';\n /**\n * Canonical agent pool ID in the variation's workspace.\n */\n agentPoolId: string;\n}\n\n\n// ---- request wire projections (strip readOnly at runtime) ----\n\nexport function wireArray<T>(value: Array<T> | null | undefined, fn: (v: T) => unknown): unknown {\n return value == null ? value : value.map(fn);\n}\n\nexport function wireMap<T>(value: Record<string, T> | null | undefined, fn: (v: T) => unknown): unknown {\n return value == null ? value : Object.fromEntries(Object.entries(value).map(([k, v]) => [k, fn(v)]));\n}\n\nexport function wireAPIKeySpec(value: APIKeySpecParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.description !== undefined) out[\"description\"] = value.description;\n if (value.permissions !== undefined) out[\"permissions\"] = value.permissions;\n return out;\n}\n\nexport function wireAddAgentVariationAssignmentRequest(value: AddAgentVariationAssignmentRequestParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n switch ((value as never as Record<string, unknown>)[\"type\"]) {\n case \"toolId\": return wireAddAgentVariationAssignmentRequest_ToolId((value as never));\n case \"toolSetId\": return wireAddAgentVariationAssignmentRequest_ToolSetId((value as never));\n case \"subAgentId\": return wireAddAgentVariationAssignmentRequest_SubAgentId((value as never));\n case \"agentPoolId\": return wireAddAgentVariationAssignmentRequest_AgentPoolId((value as never));\n default: return value;\n }\n}\n\nexport function wireCreateAgentVariationRequest(value: CreateAgentVariationRequestParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.metadata !== undefined) out[\"metadata\"] = value.metadata;\n if (value.spec !== undefined) out[\"spec\"] = value.spec;\n return out;\n}\n\nexport function wireMemoryLayerSpec(value: MemoryLayerSpecParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.type !== undefined) out[\"type\"] = value.type;\n if (value.description !== undefined) out[\"description\"] = value.description;\n return out;\n}\n\nexport function wireObjectiveEpisodicConfig(value: ObjectiveEpisodicConfigParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.key !== undefined) out[\"key\"] = value.key;\n return out;\n}\n\nexport function wireRemoveAgentVariationAssignmentRequest(value: RemoveAgentVariationAssignmentRequestParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n switch ((value as never as Record<string, unknown>)[\"type\"]) {\n case \"toolId\": return wireRemoveAgentVariationAssignmentRequest_ToolId((value as never));\n case \"toolSetId\": return wireRemoveAgentVariationAssignmentRequest_ToolSetId((value as never));\n case \"subAgentId\": return wireRemoveAgentVariationAssignmentRequest_SubAgentId((value as never));\n case \"agentPoolId\": return wireRemoveAgentVariationAssignmentRequest_AgentPoolId((value as never));\n default: return value;\n }\n}\n\nexport function wireWidgetSessionSpec(value: WidgetSessionSpecParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.widgetId !== undefined) out[\"widgetId\"] = value.widgetId;\n if (value.tenant !== undefined) out[\"tenant\"] = value.tenant;\n if (value.subject !== undefined) out[\"subject\"] = value.subject;\n if (value.expiresAt !== undefined) out[\"expiresAt\"] = value.expiresAt;\n if (value.pinnedParameters !== undefined) out[\"pinnedParameters\"] = value.pinnedParameters;\n return out;\n}\n\nexport function wireAddAgentVariationAssignmentRequest_ToolId(value: AddAgentVariationAssignmentRequest_ToolIdParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.type !== undefined) out[\"type\"] = value.type;\n if (value.toolId !== undefined) out[\"toolId\"] = value.toolId;\n return out;\n}\n\nexport function wireAddAgentVariationAssignmentRequest_ToolSetId(value: AddAgentVariationAssignmentRequest_ToolSetIdParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.type !== undefined) out[\"type\"] = value.type;\n if (value.toolSetId !== undefined) out[\"toolSetId\"] = value.toolSetId;\n return out;\n}\n\nexport function wireAddAgentVariationAssignmentRequest_SubAgentId(value: AddAgentVariationAssignmentRequest_SubAgentIdParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.type !== undefined) out[\"type\"] = value.type;\n if (value.subAgentId !== undefined) out[\"subAgentId\"] = value.subAgentId;\n return out;\n}\n\nexport function wireAddAgentVariationAssignmentRequest_AgentPoolId(value: AddAgentVariationAssignmentRequest_AgentPoolIdParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.type !== undefined) out[\"type\"] = value.type;\n if (value.agentPoolId !== undefined) out[\"agentPoolId\"] = value.agentPoolId;\n return out;\n}\n\nexport function wireRemoveAgentVariationAssignmentRequest_ToolId(value: RemoveAgentVariationAssignmentRequest_ToolIdParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.type !== undefined) out[\"type\"] = value.type;\n if (value.toolId !== undefined) out[\"toolId\"] = value.toolId;\n return out;\n}\n\nexport function wireRemoveAgentVariationAssignmentRequest_ToolSetId(value: RemoveAgentVariationAssignmentRequest_ToolSetIdParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.type !== undefined) out[\"type\"] = value.type;\n if (value.toolSetId !== undefined) out[\"toolSetId\"] = value.toolSetId;\n return out;\n}\n\nexport function wireRemoveAgentVariationAssignmentRequest_SubAgentId(value: RemoveAgentVariationAssignmentRequest_SubAgentIdParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.type !== undefined) out[\"type\"] = value.type;\n if (value.subAgentId !== undefined) out[\"subAgentId\"] = value.subAgentId;\n return out;\n}\n\nexport function wireRemoveAgentVariationAssignmentRequest_AgentPoolId(value: RemoveAgentVariationAssignmentRequest_AgentPoolIdParam | null | undefined): unknown {\n if (value == null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n if (value.type !== undefined) out[\"type\"] = value.type;\n if (value.agentPoolId !== undefined) out[\"agentPoolId\"] = value.agentPoolId;\n return out;\n}\n\n"]}