@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/src/types.ts CHANGED
@@ -272,7 +272,21 @@ export interface AccountSpec {
272
272
  }
273
273
 
274
274
  /**
275
- * Attach a single tool, tool set, or sub-agent to a variation. Exactly one
275
+ * Activate an inactive pool.
276
+ */
277
+ export interface ActivateAgentPoolRequest {
278
+ /**
279
+ * Workspace ID.
280
+ */
281
+ workspaceId?: string;
282
+ /**
283
+ * AgentPool ID. Accepts the canonical `apool_…` form or the `external_id:<value>` form.
284
+ */
285
+ id?: string;
286
+ }
287
+
288
+ /**
289
+ * Attach a single tool, tool set, sub-agent, or agent pool to a variation. Exactly one
276
290
  * of the target fields must be set; the assignment kind is inferred from the
277
291
  * populated field. Adding an existing target returns AlreadyExists.
278
292
  * All targets must be in the variation's workspace and eligible for assignment.
@@ -280,7 +294,8 @@ export interface AccountSpec {
280
294
  export type AddAgentVariationAssignmentRequest =
281
295
  | AddAgentVariationAssignmentRequest_ToolId
282
296
  | AddAgentVariationAssignmentRequest_ToolSetId
283
- | AddAgentVariationAssignmentRequest_SubAgentId;
297
+ | AddAgentVariationAssignmentRequest_SubAgentId
298
+ | AddAgentVariationAssignmentRequest_AgentPoolId;
284
299
 
285
300
  /**
286
301
  * Attach a memory layer to a variation. Use UpdateAgentVariationMemoryLayer or
@@ -375,6 +390,103 @@ export interface AgentInfo {
375
390
  createdBy?: Profile;
376
391
  }
377
392
 
393
+ /**
394
+ * Output only. Pools are created INACTIVE. Use :activate, :deactivate,
395
+ * :archive, and :unarchive to transition states. Unarchive returns INACTIVE.
396
+ */
397
+ export type AgentPoolState = 'AGENT_POOL_STATE_UNSPECIFIED' | 'AGENT_POOL_STATE_ACTIVE' | 'AGENT_POOL_STATE_INACTIVE' | 'AGENT_POOL_STATE_ARCHIVED';
398
+
399
+ /**
400
+ * A workspace-scoped group of agents. When assigned to a variation, the pool
401
+ * exposes one callable target that routes a request to a member agent.
402
+ * Pool membership references agents; variation assignments reference the pool.
403
+ */
404
+ export interface AgentPool {
405
+ metadata: ResourceMetadata;
406
+ spec: AgentPoolSpec;
407
+ info?: AgentPoolInfo;
408
+ /**
409
+ * Output only. Pools are created INACTIVE. Use :activate, :deactivate,
410
+ * :archive, and :unarchive to transition states. Unarchive returns INACTIVE.
411
+ */
412
+ state: AgentPoolState;
413
+ }
414
+
415
+ /**
416
+ * A member of a pool, identified by its agent ID. This is distinct from a
417
+ * VariationAssignment, which attaches the entire pool to a variation.
418
+ */
419
+ export interface AgentPoolAssignment {
420
+ /**
421
+ * Canonical ID of an agent in the pool's workspace.
422
+ */
423
+ agentId: string;
424
+ }
425
+
426
+ /**
427
+ * AgentPoolInfo represents the information of an agent pool.
428
+ */
429
+ export interface AgentPoolInfo {
430
+ /**
431
+ * Number of member agents in spec.assignments.
432
+ */
433
+ assignedAgents: number;
434
+ createdBy: Profile;
435
+ }
436
+
437
+ /**
438
+ * AgentPoolSpec describes the pool's purpose, membership, input schema, and routing instructions.
439
+ */
440
+ export interface AgentPoolSpec {
441
+ /**
442
+ * Describes when a calling agent should use this pool.
443
+ */
444
+ description: string;
445
+ /**
446
+ * JSON Schema defining the input arguments for this pool's callable tool.
447
+ * When the pool is assigned to an agent variation, this schema tells the LLM
448
+ * what arguments to supply. The supplied arguments provide the context used
449
+ * to route the request to an agent in the pool.
450
+ */
451
+ state?: Record<string, unknown>;
452
+ /**
453
+ * Complete set of member agents, all in the pool's workspace. At least one
454
+ * member is required. Order has no meaning; duplicate agent IDs are invalid.
455
+ */
456
+ assignments: Array<AgentPoolAssignment>;
457
+ /**
458
+ * Instructions for routing requests to an agent in the pool.
459
+ * If empty, defaults to "Which agent is best suited to handle this request?".
460
+ */
461
+ instructions?: string;
462
+ }
463
+
464
+ /**
465
+ * Partial input for UpdateAgentPool. The server applies update_mask, then
466
+ * validates the resulting AgentPoolSpec before persisting any changes.
467
+ */
468
+ export interface AgentPoolUpdateSpec {
469
+ /**
470
+ * Omit to leave unchanged, unless the mask selects this field or all of spec.
471
+ */
472
+ description?: string;
473
+ /**
474
+ * JSON Schema for the pool's callable input arguments. Update through
475
+ * spec.state in the update mask.
476
+ */
477
+ state?: Record<string, unknown>;
478
+ /**
479
+ * Replacement membership. A selected empty list is invalid because a pool
480
+ * must retain at least one member. Unselected fields remain unchanged.
481
+ */
482
+ assignments?: Array<AgentPoolAssignment>;
483
+ /**
484
+ * Routing instructions to update through spec.instructions in the update
485
+ * mask. Selecting this field with an empty value restores the default question.
486
+ */
487
+ instructions?: string;
488
+ }
489
+
378
490
  /**
379
491
  * The current lifecycle state of the schedule. Output only. Schedules are
380
492
  * created STATE_ACTIVE; use the :pause, :resume, and :archive actions to
@@ -600,23 +712,27 @@ export interface AgentVariationInfo {
600
712
  /**
601
713
  * Number of distinct callable tools available through this variation's
602
714
  * assignments after normalization. Expands tool sets and deduplicates tools
603
- * also assigned directly. Each sub-agent contributes one callable tool;
604
- * its own assignments are not expanded. Counts the full normalized set,
605
- * regardless of which tools progressive discovery has loaded.
715
+ * also assigned directly. Each sub-agent or pool contributes one callable
716
+ * tool; sub-agent assignments and pool members are not expanded. Counts the
717
+ * full normalized set, regardless of which tools progressive discovery has loaded.
606
718
  */
607
719
  effectiveToolCount: number;
608
720
  /**
609
721
  * Current display metadata for targets explicitly referenced by
610
722
  * spec.assignments and spec.memory_layer_assignments, keyed by canonical
611
- * resource ID. Includes tools, tool sets, sub-agents, and memory layers in
612
- * one map; each value's id equals its key. Does not expand tools within
613
- * assigned tool sets or assignments within sub-agents.
723
+ * resource ID. Includes tools, tool sets, sub-agents, agent pools,
724
+ * and memory layers in one map; each value's id equals its key. Does not expand
725
+ * tools within assigned tool sets, assignments within sub-agents, or pool members.
614
726
  * Populated whenever info is returned; empty when there are no assignments.
615
727
  * Missing or inaccessible targets are omitted, and names may be absent.
616
728
  * Clients use spec for assignment type/order and fall back to the ID when
617
729
  * display metadata is unavailable. This map never accepts assignment writes.
618
730
  */
619
731
  assignmentMetadata: Record<string, BareMetadata>;
732
+ /**
733
+ * Number of agent pools assigned to this variation.
734
+ */
735
+ agentPoolCount: number;
620
736
  }
621
737
 
622
738
  /**
@@ -637,7 +753,7 @@ export interface AgentVariationSpec {
637
753
  * ProgressiveDiscovery is an optional config that, when set, will load a Cadenya provided tool that
638
754
  * can search for tools in the assigned tool sets or tools.
639
755
  *
640
- * Note: Sub-agents are always loaded as a tool regardless of this value.
756
+ * Note: Sub-agents and agent pools are always loaded as tools regardless of this value.
641
757
  */
642
758
  progressiveDiscovery?: AgentVariationSpec_ProgressiveDiscovery;
643
759
  /**
@@ -667,7 +783,7 @@ export interface AgentVariationSpec {
667
783
  */
668
784
  firstUserMessageTemplate?: string;
669
785
  /**
670
- * Complete set of assigned tools, tool sets, and sub-agents. Order has no
786
+ * Complete set of assigned tools, tool sets, sub-agents, and agent pools. Order has no
671
787
  * meaning. Duplicate (target kind, canonical target ID) pairs are collapsed.
672
788
  * On create, omitted or empty means no assignments. On update, selecting
673
789
  * spec.assignments in update_mask replaces the entire set; empty clears it.
@@ -819,6 +935,20 @@ export interface ApproveToolCallRequest {
819
935
  toolCallId?: string;
820
936
  }
821
937
 
938
+ /**
939
+ * Archive an active or inactive pool, preserving membership and assignments.
940
+ */
941
+ export interface ArchiveAgentPoolRequest {
942
+ /**
943
+ * Workspace ID.
944
+ */
945
+ workspaceId?: string;
946
+ /**
947
+ * AgentPool ID. Accepts the canonical `apool_…` form or the `external_id:<value>` form.
948
+ */
949
+ id?: string;
950
+ }
951
+
822
952
  /**
823
953
  * Archive agent request
824
954
  */
@@ -924,7 +1054,8 @@ export interface BedrockConfig {
924
1054
  export type CallableTool =
925
1055
  | CallableTool_Tool
926
1056
  | CallableTool_Agent
927
- | CallableTool_CadenyaProvidedTool;
1057
+ | CallableTool_CadenyaProvidedTool
1058
+ | CallableTool_AgentPool;
928
1059
 
929
1060
  export interface CancelObjectiveRequest {
930
1061
  workspaceId?: string;
@@ -1220,6 +1351,18 @@ export interface CreateAccountResourceMetadata {
1220
1351
  labels?: Record<string, string>;
1221
1352
  }
1222
1353
 
1354
+ /**
1355
+ * Create a pool in INACTIVE state. Validate and persist membership atomically.
1356
+ */
1357
+ export interface CreateAgentPoolRequest {
1358
+ /**
1359
+ * Workspace ID.
1360
+ */
1361
+ workspaceId?: string;
1362
+ metadata: CreateResourceMetadata;
1363
+ spec: AgentPoolSpec;
1364
+ }
1365
+
1223
1366
  /**
1224
1367
  * Create agent request
1225
1368
  */
@@ -1580,6 +1723,20 @@ export interface CredentialHeaders {
1580
1723
  headers?: Record<string, string>;
1581
1724
  }
1582
1725
 
1726
+ /**
1727
+ * Deactivate an active pool.
1728
+ */
1729
+ export interface DeactivateAgentPoolRequest {
1730
+ /**
1731
+ * Workspace ID.
1732
+ */
1733
+ workspaceId?: string;
1734
+ /**
1735
+ * AgentPool ID. Accepts the canonical `apool_…` form or the `external_id:<value>` form.
1736
+ */
1737
+ id?: string;
1738
+ }
1739
+
1583
1740
  /**
1584
1741
  * Delete tenant widget sessions response.
1585
1742
  */
@@ -1707,6 +1864,14 @@ export interface ListAgentFeedbackResponse {
1707
1864
  pagination?: Page;
1708
1865
  }
1709
1866
 
1867
+ /**
1868
+ * List agent pools response
1869
+ */
1870
+ export interface ListAgentPoolsResponse {
1871
+ items: Array<AgentPool>;
1872
+ pagination?: Page;
1873
+ }
1874
+
1710
1875
  /**
1711
1876
  * List agent schedules response.
1712
1877
  */
@@ -3165,7 +3330,8 @@ export interface Reasoning {
3165
3330
  export type RemoveAgentVariationAssignmentRequest =
3166
3331
  | RemoveAgentVariationAssignmentRequest_ToolId
3167
3332
  | RemoveAgentVariationAssignmentRequest_ToolSetId
3168
- | RemoveAgentVariationAssignmentRequest_SubAgentId;
3333
+ | RemoveAgentVariationAssignmentRequest_SubAgentId
3334
+ | RemoveAgentVariationAssignmentRequest_AgentPoolId;
3169
3335
 
3170
3336
  /**
3171
3337
  * Remove by memory layer ID. An unassigned layer returns NotFound.
@@ -3516,6 +3682,10 @@ export interface SetToolCallContentRequest_TextBlock {
3516
3682
  text: string;
3517
3683
  }
3518
3684
 
3685
+ export type StatusDetails =
3686
+ | WidgetSessionErrorInfo
3687
+ | GoogleProtobufAny;
3688
+
3519
3689
  /**
3520
3690
  * 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).
3521
3691
  */
@@ -3531,7 +3701,7 @@ export interface Status {
3531
3701
  /**
3532
3702
  * A list of messages that carry the error details. There is a common set of message types for APIs to use.
3533
3703
  */
3534
- details?: Array<GoogleProtobufAny>;
3704
+ details?: Array<StatusDetails>;
3535
3705
  }
3536
3706
 
3537
3707
  export interface SubAgentSpawned {
@@ -4345,6 +4515,20 @@ export type ToolSpec_Config =
4345
4515
  | ToolSpec_Config_Openapi
4346
4516
  | ToolSpec_Config_Bare;
4347
4517
 
4518
+ /**
4519
+ * Restore an archived pool to INACTIVE; activate it separately to route requests.
4520
+ */
4521
+ export interface UnarchiveAgentPoolRequest {
4522
+ /**
4523
+ * Workspace ID.
4524
+ */
4525
+ workspaceId?: string;
4526
+ /**
4527
+ * AgentPool ID. Accepts the canonical `apool_…` form or the `external_id:<value>` form.
4528
+ */
4529
+ id?: string;
4530
+ }
4531
+
4348
4532
  /**
4349
4533
  * Unarchive agent request
4350
4534
  */
@@ -4465,6 +4649,32 @@ export interface UpdateAccountResourceMetadata {
4465
4649
  labels?: Record<string, string>;
4466
4650
  }
4467
4651
 
4652
+ /**
4653
+ * Update agent pool request
4654
+ */
4655
+ export interface UpdateAgentPoolRequest {
4656
+ /**
4657
+ * Workspace ID.
4658
+ */
4659
+ workspaceId?: string;
4660
+ /**
4661
+ * AgentPool ID. Accepts the canonical `apool_…` form or the `external_id:<value>` form.
4662
+ */
4663
+ id?: string;
4664
+ metadata?: UpdateResourceMetadata;
4665
+ spec?: AgentPoolUpdateSpec;
4666
+ /**
4667
+ * Fields to update. Only metadata and spec are mutable; top-level state and info
4668
+ * paths are invalid. spec.assignments replaces the entire membership list.
4669
+ * A spec mask replaces the full spec; * replaces all mutable fields.
4670
+ * Without a mask, infer paths from non-empty fields. Empty or omitted
4671
+ * membership then leaves the existing list unchanged. Element/index paths
4672
+ * are invalid. Validate the merged pool atomically: an empty description
4673
+ * or membership (including an explicitly masked empty list) is invalid.
4674
+ */
4675
+ updateMask?: string;
4676
+ }
4677
+
4468
4678
  /**
4469
4679
  * Update agent request
4470
4680
  */
@@ -4823,14 +5033,15 @@ export interface UserMessage {
4823
5033
  }
4824
5034
 
4825
5035
  /**
4826
- * A tool, tool set, or sub-agent assigned to a variation, identified only by
5036
+ * A tool, tool set, sub-agent, or agent pool assigned to a variation, identified only by
4827
5037
  * the target resource ID. The same shape is accepted in a spec and returned
4828
5038
  * on reads. Assignment junction records are an internal implementation detail.
4829
5039
  */
4830
5040
  export type VariationAssignment =
4831
5041
  | VariationAssignment_ToolId
4832
5042
  | VariationAssignment_ToolSetId
4833
- | VariationAssignment_SubAgentId;
5043
+ | VariationAssignment_SubAgentId
5044
+ | VariationAssignment_AgentPoolId;
4834
5045
 
4835
5046
  /**
4836
5047
  * A whole memory layer in a variation's baseline memory cascade. Identified
@@ -4970,8 +5181,9 @@ export type WidgetSessionState = 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_E
4970
5181
  * a widget, minted server-to-server by the customer's backend. The session
4971
5182
  * carries all customer-asserted context — tenant, subject, labels, secrets —
4972
5183
  * and every conversation (objective) created through the widget inherits it.
4973
- * The bearer token returned at mint is short-lived and refreshed at the
4974
- * widget host; the session row is what makes revocation possible.
5184
+ * The browser renews short-lived bearer tokens at the widget host with
5185
+ * RenewWidgetSession, authenticated by its existing token. Renewal preserves
5186
+ * this bounded grant and does not extend its hard expiry.
4975
5187
  */
4976
5188
  export interface WidgetSession {
4977
5189
  metadata: OperationMetadata;
@@ -4988,6 +5200,45 @@ export interface WidgetSession {
4988
5200
  * headers server-side — never returned by any API.
4989
5201
  */
4990
5202
  secrets: Array<WidgetSession_Secret>;
5203
+ /**
5204
+ * Present only on creation. The same envelope is returned by
5205
+ * RenewWidgetSession on the widget host. Omitted on reads, lists, and revocation.
5206
+ * Existing spec.token/spec.token_expires_at and info.host remain populated
5207
+ * on creation for v1 compatibility and agree with these credentials.
5208
+ */
5209
+ credentials?: WidgetSessionCredentials;
5210
+ }
5211
+
5212
+ /**
5213
+ * WidgetSessionCredentials is the only credential envelope the customer's
5214
+ * backend forwards to the browser. Never log or persist its token. Responses
5215
+ * containing credentials use Cache-Control: no-store. Both initial and later
5216
+ * issuance use the same schema; no refresh token or management key is included.
5217
+ */
5218
+ export interface WidgetSessionCredentials {
5219
+ /**
5220
+ * Canonical wsess_ identifier. Ordinary renewal cannot change the session.
5221
+ */
5222
+ sessionId: string;
5223
+ /**
5224
+ * Authoritative hostname, without a scheme or path. Use HTTPS with this
5225
+ * host; never construct it or accept a host change during renewal.
5226
+ */
5227
+ host: string;
5228
+ /**
5229
+ * Short-lived bearer credential for the widget host only.
5230
+ */
5231
+ token: string;
5232
+ /**
5233
+ * Exact token expiry, at most 15 minutes after issuance and never later
5234
+ * than session_expires_at. Equals JWT exp without the 60-second validation
5235
+ * tolerance added. Renew proactively before this timestamp.
5236
+ */
5237
+ tokenExpiresAt: string;
5238
+ /**
5239
+ * Immutable hard session expiry. Issuance never extends this deadline.
5240
+ */
5241
+ sessionExpiresAt: string;
4991
5242
  }
4992
5243
 
4993
5244
  /**
@@ -5024,7 +5275,7 @@ export interface WidgetSessionInfo {
5024
5275
  messageCount: number;
5025
5276
  /**
5026
5277
  * When the session last created a conversation, sent a message, or
5027
- * refreshed a token.
5278
+ * received a newly issued token.
5028
5279
  */
5029
5280
  lastActiveAt?: string;
5030
5281
  }
@@ -5039,18 +5290,19 @@ export interface WidgetSessionSpec {
5039
5290
  */
5040
5291
  widgetId: string;
5041
5292
  /**
5042
- * Optional tenant assertion — the customer's org/company identifier for the
5043
- * visitor. Upserts the tenant record in the workspace and tags the session
5044
- * and every conversation it creates. Conversation listing at the widget
5045
- * host is scoped to this tenant.
5293
+ * Required tenant assertion — the customer's organization identifier.
5294
+ * Upserts the tenant record in the workspace. Every conversation created
5295
+ * through this session inherits the tenant and subject identity.
5046
5296
  */
5047
- tenant?: TenantAssertion;
5297
+ tenant: TenantAssertion;
5048
5298
  /**
5049
- * Optional subject assertion — the visitor within the tenant (e.g. their
5050
- * user id in the customer's namespace). Requires `tenant`; a subject
5051
- * asserted without a tenant is rejected with InvalidArgument.
5299
+ * Required subject assertion — the visitor's ID within the tenant.
5300
+ * Sessions with the same tenant and subject share conversation history on
5301
+ * the same widget and agent, subject to the current session's permissions.
5302
+ * A static ID deliberately shares that history; use a distinct ID per
5303
+ * visitor when their conversations should be separate.
5052
5304
  */
5053
- subject?: SubjectAssertion;
5305
+ subject: SubjectAssertion;
5054
5306
  /**
5055
5307
  * Hard session expiry. Tokens never outlive it; after it passes the session
5056
5308
  * transitions to STATE_EXPIRED. Defaults to a server-chosen horizon when
@@ -5058,14 +5310,14 @@ export interface WidgetSessionSpec {
5058
5310
  */
5059
5311
  expiresAt?: string;
5060
5312
  /**
5061
- * The session bearer token. Returned only on creation — subsequent reads
5062
- * omit it. The token is short-lived; the widget refreshes it at the widget
5063
- * host without involving the customer's backend.
5313
+ * Legacy creation-only alias of credentials.token; omitted on reads.
5314
+ * Supported throughout v1. New clients should consume credentials.
5315
+ * The browser obtains replacements with RenewWidgetSession at the widget host.
5064
5316
  */
5065
5317
  token: string;
5066
5318
  /**
5067
- * Expiry of the token returned in `token`. Distinct from `expires_at`,
5068
- * which bounds the session itself.
5319
+ * Legacy creation-only alias of credentials.token_expires_at, supported
5320
+ * throughout v1. Distinct from expires_at, which bounds the session itself.
5069
5321
  */
5070
5322
  tokenExpiresAt?: string;
5071
5323
  /**
@@ -5243,6 +5495,14 @@ export interface VariationAssignment_SubAgentId {
5243
5495
  subAgentId: string;
5244
5496
  }
5245
5497
 
5498
+ export interface VariationAssignment_AgentPoolId {
5499
+ type: 'agentPoolId';
5500
+ /**
5501
+ * Canonical agent pool ID. Attaches the pool as a single callable target.
5502
+ */
5503
+ agentPoolId: string;
5504
+ }
5505
+
5246
5506
  export interface ObjectiveToolCallResult_ContentBlock_Text {
5247
5507
  type: 'text';
5248
5508
  text: ObjectiveToolCallResult_TextBlock;
@@ -5593,6 +5853,14 @@ export interface CallableTool_CadenyaProvidedTool {
5593
5853
  cadenyaProvidedTool: ResourceMetadata;
5594
5854
  }
5595
5855
 
5856
+ export interface CallableTool_AgentPool {
5857
+ type: 'agentPool';
5858
+ /**
5859
+ * Agent pool responsible for routing this call to a member agent.
5860
+ */
5861
+ agentPool: ResourceMetadata;
5862
+ }
5863
+
5596
5864
  export interface MemoryEntryCreateSpec_Content {
5597
5865
  type: 'content';
5598
5866
  /**
@@ -5688,6 +5956,26 @@ export interface AddAgentVariationAssignmentRequest_SubAgentId {
5688
5956
  variationId?: string;
5689
5957
  }
5690
5958
 
5959
+ export interface AddAgentVariationAssignmentRequest_AgentPoolId {
5960
+ type: 'agentPoolId';
5961
+ /**
5962
+ * Canonical agent pool ID in the variation's workspace.
5963
+ */
5964
+ agentPoolId: string;
5965
+ /**
5966
+ * Workspace ID.
5967
+ */
5968
+ workspaceId?: string;
5969
+ /**
5970
+ * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.
5971
+ */
5972
+ agentId?: string;
5973
+ /**
5974
+ * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.
5975
+ */
5976
+ variationId?: string;
5977
+ }
5978
+
5691
5979
  export interface RemoveAgentVariationAssignmentRequest_ToolId {
5692
5980
  type: 'toolId';
5693
5981
  toolId: string;
@@ -5739,6 +6027,26 @@ export interface RemoveAgentVariationAssignmentRequest_SubAgentId {
5739
6027
  variationId?: string;
5740
6028
  }
5741
6029
 
6030
+ export interface RemoveAgentVariationAssignmentRequest_AgentPoolId {
6031
+ type: 'agentPoolId';
6032
+ /**
6033
+ * Canonical agent pool ID in the variation's workspace.
6034
+ */
6035
+ agentPoolId: string;
6036
+ /**
6037
+ * Workspace ID.
6038
+ */
6039
+ workspaceId?: string;
6040
+ /**
6041
+ * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>` form.
6042
+ */
6043
+ agentId?: string;
6044
+ /**
6045
+ * Variation ID. Accepts the canonical `agentvar_…` form or the `external_id:<value>` form.
6046
+ */
6047
+ variationId?: string;
6048
+ }
6049
+
5742
6050
  export interface AIProviderCredential_ApiKey {
5743
6051
  type: 'apiKey';
5744
6052
  /**
@@ -5835,6 +6143,26 @@ export interface ModelSpec_Capability_Caching {
5835
6143
  caching: Capability_Caching;
5836
6144
  }
5837
6145
 
6146
+ /**
6147
+ * 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.
6148
+ */
6149
+ export type WidgetSessionErrorReason = 'TOKEN_EXPIRED' | 'SESSION_REVOKED' | 'SESSION_EXPIRED' | 'SESSION_EXHAUSTED';
6150
+
6151
+ /**
6152
+ * google.rpc.ErrorInfo detail for widget lifecycle failures. Match both domain and reason; ignore unknown reasons rather than renewing automatically.
6153
+ */
6154
+ export interface WidgetSessionErrorInfo {
6155
+ '@type': 'type.googleapis.com/google.rpc.ErrorInfo';
6156
+ domain: 'api.cadenya.com';
6157
+ reason: WidgetSessionErrorReason;
6158
+ /**
6159
+ * Optional non-sensitive context. Never contains tokens or secrets.
6160
+ */
6161
+ metadata?: Record<string, string>;
6162
+ }
6163
+
6164
+ export type AgentPoolServiceListAgentPoolsState = 'AGENT_POOL_STATE_UNSPECIFIED' | 'AGENT_POOL_STATE_ACTIVE' | 'AGENT_POOL_STATE_INACTIVE' | 'AGENT_POOL_STATE_ARCHIVED';
6165
+
5838
6166
  export type AgentServiceListAgentsState = 'STATE_UNSPECIFIED' | 'STATE_DRAFT' | 'STATE_PUBLISHED' | 'STATE_ARCHIVED';
5839
6167
 
5840
6168
  export type AgentServiceListAgentsVariationSelectionMode = 'VARIATION_SELECTION_MODE_UNSPECIFIED' | 'VARIATION_SELECTION_MODE_RANDOM' | 'VARIATION_SELECTION_MODE_WEIGHTED';
@@ -5884,7 +6212,7 @@ export interface APIKeySpecParam {
5884
6212
  permissions?: Array<string>;
5885
6213
  }
5886
6214
 
5887
- export type AddAgentVariationAssignmentRequestParam = AddAgentVariationAssignmentRequest_ToolIdParam | AddAgentVariationAssignmentRequest_ToolSetIdParam | AddAgentVariationAssignmentRequest_SubAgentIdParam;
6215
+ export type AddAgentVariationAssignmentRequestParam = AddAgentVariationAssignmentRequest_ToolIdParam | AddAgentVariationAssignmentRequest_ToolSetIdParam | AddAgentVariationAssignmentRequest_SubAgentIdParam | AddAgentVariationAssignmentRequest_AgentPoolIdParam;
5888
6216
 
5889
6217
  export interface CreateAgentVariationRequestParam {
5890
6218
  metadata: CreateResourceMetadata;
@@ -5908,7 +6236,7 @@ export interface ObjectiveEpisodicConfigParam {
5908
6236
  key: string;
5909
6237
  }
5910
6238
 
5911
- export type RemoveAgentVariationAssignmentRequestParam = RemoveAgentVariationAssignmentRequest_ToolIdParam | RemoveAgentVariationAssignmentRequest_ToolSetIdParam | RemoveAgentVariationAssignmentRequest_SubAgentIdParam;
6239
+ export type RemoveAgentVariationAssignmentRequestParam = RemoveAgentVariationAssignmentRequest_ToolIdParam | RemoveAgentVariationAssignmentRequest_ToolSetIdParam | RemoveAgentVariationAssignmentRequest_SubAgentIdParam | RemoveAgentVariationAssignmentRequest_AgentPoolIdParam;
5912
6240
 
5913
6241
  export interface WidgetSessionSpecParam {
5914
6242
  /**
@@ -5917,18 +6245,19 @@ export interface WidgetSessionSpecParam {
5917
6245
  */
5918
6246
  widgetId: string;
5919
6247
  /**
5920
- * Optional tenant assertion — the customer's org/company identifier for the
5921
- * visitor. Upserts the tenant record in the workspace and tags the session
5922
- * and every conversation it creates. Conversation listing at the widget
5923
- * host is scoped to this tenant.
6248
+ * Required tenant assertion — the customer's organization identifier.
6249
+ * Upserts the tenant record in the workspace. Every conversation created
6250
+ * through this session inherits the tenant and subject identity.
5924
6251
  */
5925
- tenant?: TenantAssertion;
6252
+ tenant: TenantAssertion;
5926
6253
  /**
5927
- * Optional subject assertion — the visitor within the tenant (e.g. their
5928
- * user id in the customer's namespace). Requires `tenant`; a subject
5929
- * asserted without a tenant is rejected with InvalidArgument.
6254
+ * Required subject assertion — the visitor's ID within the tenant.
6255
+ * Sessions with the same tenant and subject share conversation history on
6256
+ * the same widget and agent, subject to the current session's permissions.
6257
+ * A static ID deliberately shares that history; use a distinct ID per
6258
+ * visitor when their conversations should be separate.
5930
6259
  */
5931
- subject?: SubjectAssertion;
6260
+ subject: SubjectAssertion;
5932
6261
  /**
5933
6262
  * Hard session expiry. Tokens never outlive it; after it passes the session
5934
6263
  * transitions to STATE_EXPIRED. Defaults to a server-chosen horizon when
@@ -5963,6 +6292,14 @@ export interface AddAgentVariationAssignmentRequest_SubAgentIdParam {
5963
6292
  subAgentId: string;
5964
6293
  }
5965
6294
 
6295
+ export interface AddAgentVariationAssignmentRequest_AgentPoolIdParam {
6296
+ type: 'agentPoolId';
6297
+ /**
6298
+ * Canonical agent pool ID in the variation's workspace.
6299
+ */
6300
+ agentPoolId: string;
6301
+ }
6302
+
5966
6303
  export interface RemoveAgentVariationAssignmentRequest_ToolIdParam {
5967
6304
  type: 'toolId';
5968
6305
  toolId: string;
@@ -5978,6 +6315,14 @@ export interface RemoveAgentVariationAssignmentRequest_SubAgentIdParam {
5978
6315
  subAgentId: string;
5979
6316
  }
5980
6317
 
6318
+ export interface RemoveAgentVariationAssignmentRequest_AgentPoolIdParam {
6319
+ type: 'agentPoolId';
6320
+ /**
6321
+ * Canonical agent pool ID in the variation's workspace.
6322
+ */
6323
+ agentPoolId: string;
6324
+ }
6325
+
5981
6326
 
5982
6327
  // ---- request wire projections (strip readOnly at runtime) ----
5983
6328
 
@@ -6003,6 +6348,7 @@ export function wireAddAgentVariationAssignmentRequest(value: AddAgentVariationA
6003
6348
  case "toolId": return wireAddAgentVariationAssignmentRequest_ToolId((value as never));
6004
6349
  case "toolSetId": return wireAddAgentVariationAssignmentRequest_ToolSetId((value as never));
6005
6350
  case "subAgentId": return wireAddAgentVariationAssignmentRequest_SubAgentId((value as never));
6351
+ case "agentPoolId": return wireAddAgentVariationAssignmentRequest_AgentPoolId((value as never));
6006
6352
  default: return value;
6007
6353
  }
6008
6354
  }
@@ -6036,6 +6382,7 @@ export function wireRemoveAgentVariationAssignmentRequest(value: RemoveAgentVari
6036
6382
  case "toolId": return wireRemoveAgentVariationAssignmentRequest_ToolId((value as never));
6037
6383
  case "toolSetId": return wireRemoveAgentVariationAssignmentRequest_ToolSetId((value as never));
6038
6384
  case "subAgentId": return wireRemoveAgentVariationAssignmentRequest_SubAgentId((value as never));
6385
+ case "agentPoolId": return wireRemoveAgentVariationAssignmentRequest_AgentPoolId((value as never));
6039
6386
  default: return value;
6040
6387
  }
6041
6388
  }
@@ -6075,6 +6422,14 @@ export function wireAddAgentVariationAssignmentRequest_SubAgentId(value: AddAgen
6075
6422
  return out;
6076
6423
  }
6077
6424
 
6425
+ export function wireAddAgentVariationAssignmentRequest_AgentPoolId(value: AddAgentVariationAssignmentRequest_AgentPoolIdParam | null | undefined): unknown {
6426
+ if (value == null || typeof value !== 'object') return value;
6427
+ const out: Record<string, unknown> = {};
6428
+ if (value.type !== undefined) out["type"] = value.type;
6429
+ if (value.agentPoolId !== undefined) out["agentPoolId"] = value.agentPoolId;
6430
+ return out;
6431
+ }
6432
+
6078
6433
  export function wireRemoveAgentVariationAssignmentRequest_ToolId(value: RemoveAgentVariationAssignmentRequest_ToolIdParam | null | undefined): unknown {
6079
6434
  if (value == null || typeof value !== 'object') return value;
6080
6435
  const out: Record<string, unknown> = {};
@@ -6099,3 +6454,11 @@ export function wireRemoveAgentVariationAssignmentRequest_SubAgentId(value: Remo
6099
6454
  return out;
6100
6455
  }
6101
6456
 
6457
+ export function wireRemoveAgentVariationAssignmentRequest_AgentPoolId(value: RemoveAgentVariationAssignmentRequest_AgentPoolIdParam | null | undefined): unknown {
6458
+ if (value == null || typeof value !== 'object') return value;
6459
+ const out: Record<string, unknown> = {};
6460
+ if (value.type !== undefined) out["type"] = value.type;
6461
+ if (value.agentPoolId !== undefined) out["agentPoolId"] = value.agentPoolId;
6462
+ return out;
6463
+ }
6464
+