@axiom-lattice/protocols 4.1.1 → 4.1.3

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/index.d.mts CHANGED
@@ -2012,8 +2012,10 @@ interface WorkspaceStore {
2012
2012
  * Project kind classification
2013
2013
  *
2014
2014
  * Defaults to "business" for legacy rows and omitted input.
2015
+ * "public" is reserved for the automatically ensured workspace public room;
2016
+ * user-facing project create/update APIs reject it.
2015
2017
  */
2016
- type ProjectKind = "business" | "training" | "personal";
2018
+ type ProjectKind = "business" | "training" | "personal" | "public";
2017
2019
  /**
2018
2020
  * Project type definition
2019
2021
  */
@@ -2342,7 +2344,11 @@ interface ConnectionStore {
2342
2344
  delete(tenantId: string, type: string, key: string): Promise<boolean>;
2343
2345
  }
2344
2346
 
2345
- type ChannelInstallationType = "lark" | "email" | "slack" | "wechat";
2347
+ /** Channel types persisted by the installation store, including internal-only channels. */
2348
+ type ChannelInstallationType = "lark" | "email" | "slack" | "wechat" | "room";
2349
+ /** Channel types exposed by the public installation management API. */
2350
+ type PublicChannelInstallationType = Exclude<ChannelInstallationType, "room">;
2351
+ /** Credentials and routing configuration for a Lark installation. */
2346
2352
  interface LarkChannelInstallationConfig {
2347
2353
  appId: string;
2348
2354
  appSecret: string;
@@ -2350,10 +2356,12 @@ interface LarkChannelInstallationConfig {
2350
2356
  encryptKey?: string;
2351
2357
  assistantId?: string;
2352
2358
  }
2359
+ /** Credentials and identity configuration for a WeChat installation. */
2353
2360
  interface WechatChannelInstallationConfig {
2354
2361
  botToken: string;
2355
2362
  uin?: string;
2356
2363
  }
2364
+ /** A persisted tenant-scoped channel installation. */
2357
2365
  interface ChannelInstallation<TConfig = unknown> {
2358
2366
  id: string;
2359
2367
  tenantId: string;
@@ -2366,14 +2374,28 @@ interface ChannelInstallation<TConfig = unknown> {
2366
2374
  createdAt: Date;
2367
2375
  updatedAt: Date;
2368
2376
  }
2369
- interface CreateChannelInstallationRequest {
2377
+ /** Internal input accepted by installation stores. */
2378
+ interface CreateChannelInstallationInput {
2370
2379
  channel: ChannelInstallationType;
2371
2380
  name?: string;
2372
- config: LarkChannelInstallationConfig;
2381
+ config: Record<string, unknown>;
2373
2382
  enabled?: boolean;
2374
2383
  fallbackAgentId?: string;
2375
2384
  rejectWhenNoBinding?: boolean;
2376
2385
  }
2386
+ type PublicInstallationBase = Omit<CreateChannelInstallationInput, "channel" | "config">;
2387
+ /** Public create request with channel-specific configuration and no internal room variant. */
2388
+ type CreateChannelInstallationRequest = PublicInstallationBase & ({
2389
+ channel: "lark";
2390
+ config: LarkChannelInstallationConfig;
2391
+ } | {
2392
+ channel: "wechat";
2393
+ config: WechatChannelInstallationConfig;
2394
+ } | {
2395
+ channel: "email" | "slack";
2396
+ config: Record<string, unknown>;
2397
+ });
2398
+ /** Fields accepted when updating an existing public installation. */
2377
2399
  interface UpdateChannelInstallationRequest {
2378
2400
  name?: string;
2379
2401
  config?: Record<string, unknown>;
@@ -2381,6 +2403,7 @@ interface UpdateChannelInstallationRequest {
2381
2403
  fallbackAgentId?: string;
2382
2404
  rejectWhenNoBinding?: boolean;
2383
2405
  }
2406
+ /** Persistence boundary for tenant-scoped channel installations. */
2384
2407
  interface ChannelInstallationStore {
2385
2408
  getInstallationById(installationId: string): Promise<ChannelInstallation | null>;
2386
2409
  getInstallationsByTenant(tenantId: string, channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
@@ -2389,7 +2412,7 @@ interface ChannelInstallationStore {
2389
2412
  * 用于 connectAllChannels 等不需要按租户过滤的场景。
2390
2413
  */
2391
2414
  getAllInstallations(channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
2392
- createInstallation(tenantId: string, installationId: string, data: CreateChannelInstallationRequest): Promise<ChannelInstallation>;
2415
+ createInstallation(tenantId: string, installationId: string, data: CreateChannelInstallationInput): Promise<ChannelInstallation>;
2393
2416
  updateInstallation(tenantId: string, installationId: string, updates: UpdateChannelInstallationRequest): Promise<ChannelInstallation | null>;
2394
2417
  deleteInstallation(tenantId: string, installationId: string): Promise<boolean>;
2395
2418
  }
@@ -3253,13 +3276,81 @@ interface CreateBindingInput {
3253
3276
  tenantId: string;
3254
3277
  senderId: string;
3255
3278
  agentId: string;
3279
+ threadId?: string;
3256
3280
  threadMode?: "fixed" | "per_conversation";
3257
3281
  senderDisplayName?: string;
3258
3282
  senderMetadata?: Record<string, unknown>;
3259
3283
  workspaceId?: string;
3260
3284
  projectId?: string;
3285
+ /** Whether the binding is eligible for inbound resolution immediately after creation. */
3286
+ enabled?: boolean;
3287
+ }
3288
+ /** Filters binding records before pagination is applied. */
3289
+ interface BindingListParams {
3290
+ tenantId: string;
3291
+ channel?: string;
3292
+ agentId?: string;
3293
+ channelInstallationId?: string;
3294
+ /** Installation ID prefixes excluded before pagination, for internal namespaces. */
3295
+ excludeInstallationIdPrefixes?: string[];
3296
+ excludeChannels?: string[];
3297
+ limit?: number;
3298
+ offset?: number;
3299
+ }
3300
+ /**
3301
+ * Fields that may change after a binding is created.
3302
+ *
3303
+ * Binding identity (`id`, tenant, channel, installation, sender, and timestamps) is intentionally
3304
+ * absent so every persistence backend can enforce tenant-scoped mutation without identity drift.
3305
+ */
3306
+ interface BindingMutablePatch {
3307
+ /** Agent that receives messages for this subject. */
3308
+ agentId?: string;
3309
+ /** Fixed thread used when `threadMode` is `fixed`. */
3310
+ threadId?: string;
3311
+ /** Optional workspace execution scope. */
3312
+ workspaceId?: string;
3313
+ /** Optional project execution scope. */
3314
+ projectId?: string;
3315
+ /** Whether messages share one thread or create one per conversation. */
3316
+ threadMode?: "fixed" | "per_conversation";
3317
+ /** Human-readable sender label. */
3318
+ senderDisplayName?: string;
3319
+ /** Mutable sender metadata supplied by trusted internal callers. */
3320
+ senderMetadata?: Record<string, unknown>;
3321
+ /** Whether inbound resolution may use this binding. */
3322
+ enabled?: boolean;
3323
+ }
3324
+ /** Raised when a channel installation already has a binding for the same tenant and sender. */
3325
+ declare class DuplicateChannelBindingSubjectError extends Error {
3326
+ constructor();
3327
+ }
3328
+ /** A duplicate subject found while upgrading a local channel-binding database. */
3329
+ interface ChannelBindingMigrationConflict {
3330
+ tenantId: string;
3331
+ channel: string;
3332
+ channelInstallationId: string;
3333
+ senderId: string;
3334
+ count: number;
3335
+ }
3336
+ /**
3337
+ * Raised when a local binding uniqueness migration requires operator reconciliation.
3338
+ *
3339
+ * The conflict list contains only subject identifiers and row counts; binding metadata and other
3340
+ * potentially sensitive payloads are never included.
3341
+ */
3342
+ declare class ChannelBindingMigrationConflictError extends Error {
3343
+ readonly conflicts: ChannelBindingMigrationConflict[];
3344
+ constructor(conflicts: ChannelBindingMigrationConflict[]);
3261
3345
  }
3262
3346
  interface BindingRegistry {
3347
+ findById(tenantId: string, id: string): Promise<Binding | null>;
3348
+ findBySubject(params: {
3349
+ tenantId: string;
3350
+ channel: string;
3351
+ channelInstallationId: string;
3352
+ senderId: string;
3353
+ }): Promise<Binding | null>;
3263
3354
  resolve(params: {
3264
3355
  channel: string;
3265
3356
  senderId: string;
@@ -3267,17 +3358,10 @@ interface BindingRegistry {
3267
3358
  tenantId: string;
3268
3359
  }): Promise<Binding | null>;
3269
3360
  create(binding: CreateBindingInput): Promise<Binding>;
3270
- update(id: string, patch: Partial<Binding>): Promise<Binding>;
3271
- delete(id: string): Promise<void>;
3272
- list(params: {
3273
- channel?: string;
3274
- agentId?: string;
3275
- tenantId: string;
3276
- channelInstallationId?: string;
3277
- limit?: number;
3278
- offset?: number;
3279
- }): Promise<Binding[]>;
3280
- import(bindings: CreateBindingInput[]): Promise<Binding[]>;
3361
+ update(tenantId: string, id: string, patch: BindingMutablePatch): Promise<Binding>;
3362
+ delete(tenantId: string, id: string): Promise<void>;
3363
+ list(params: BindingListParams): Promise<Binding[]>;
3364
+ import(tenantId: string, bindings: CreateBindingInput[]): Promise<Binding[]>;
3281
3365
  export(params: {
3282
3366
  tenantId: string;
3283
3367
  }): Promise<Binding[]>;
@@ -4032,9 +4116,10 @@ interface TaskListFilter {
4032
4116
  */
4033
4117
  workspaceId?: string;
4034
4118
  /**
4035
- * Filter by project ID
4119
+ * Filter by project ID. `null` matches only absent, empty, or `default` projects;
4120
+ * `undefined` applies no project predicate.
4036
4121
  */
4037
- projectId?: string;
4122
+ projectId?: string | null;
4038
4123
  /**
4039
4124
  * Filter by parent task ID
4040
4125
  */
@@ -4056,6 +4141,40 @@ interface TaskListFilter {
4056
4141
  */
4057
4142
  offset?: number;
4058
4143
  }
4144
+ /**
4145
+ * Exact scope and pagination for tasks that depend on another project task.
4146
+ */
4147
+ interface TaskDependentListQuery {
4148
+ /** Tenant identifier. */
4149
+ tenantId: string;
4150
+ /** Workspace identifier. */
4151
+ workspaceId: string;
4152
+ /** Project identifier. */
4153
+ projectId: string;
4154
+ /** Identifier that must occur as a string in the dependency array. */
4155
+ dependencyTaskId: string;
4156
+ /** Nonempty statuses eligible for recovery. */
4157
+ statuses: TaskItem["status"][];
4158
+ /** Maximum rows to return, from 1 through 100. */
4159
+ limit: number;
4160
+ /** Number of matching rows to skip. */
4161
+ offset: number;
4162
+ }
4163
+ /** Exact mutable identity captured before a trusted task mutation. */
4164
+ interface TaskMutationSnapshot {
4165
+ /** Status observed during authorization. */
4166
+ status: TaskItem["status"];
4167
+ /** Update timestamp observed during authorization. */
4168
+ updatedAt: Date | string;
4169
+ /** Owner kind observed during authorization. */
4170
+ ownerType: TaskItem["ownerType"];
4171
+ /** Owner identifier observed during authorization. */
4172
+ ownerId: string;
4173
+ /** Exact workspace scope observed during authorization. */
4174
+ workspaceId: string | null;
4175
+ /** Exact Project scope observed during authorization. */
4176
+ projectId: string | null;
4177
+ }
4059
4178
  /**
4060
4179
  * TaskStore interface
4061
4180
  * Provides CRUD operations for task data
@@ -4084,6 +4203,13 @@ interface TaskStore {
4084
4203
  * @returns Array of matching tasks
4085
4204
  */
4086
4205
  list(filter: TaskListFilter): Promise<TaskItem[]>;
4206
+ /**
4207
+ * Lists exact project tasks that depend on another task.
4208
+ *
4209
+ * @param query Exact scope, statuses, and bounded offset page.
4210
+ * @returns Matching tasks ordered by creation time and ID descending.
4211
+ */
4212
+ listDependents(query: TaskDependentListQuery): Promise<TaskItem[]>;
4087
4213
  /**
4088
4214
  * Update an existing task
4089
4215
  * @param tenantId Tenant identifier
@@ -4120,6 +4246,16 @@ interface TaskStore {
4120
4246
  * @returns The updated task, or `null` when the task is missing or either snapshot predicate differs.
4121
4247
  */
4122
4248
  updateIfStatusAndUpdatedAt(tenantId: string, id: string, updates: UpdateTaskRequest, expectedStatuses: TaskItem["status"][], expectedUpdatedAt: Date | string): Promise<TaskItem | null>;
4249
+ /**
4250
+ * Atomically updates a task only while its full trusted mutation snapshot matches.
4251
+ *
4252
+ * @param tenantId Tenant identifier.
4253
+ * @param id Task identifier.
4254
+ * @param updates Partial task data to update.
4255
+ * @param snapshot Exact status, timestamp, owner, and Project scope snapshot.
4256
+ * @returns Updated task, or `null` when any snapshot field differs.
4257
+ */
4258
+ updateIfSnapshot(tenantId: string, id: string, updates: UpdateTaskRequest, snapshot: TaskMutationSnapshot): Promise<TaskItem | null>;
4123
4259
  /**
4124
4260
  * Atomically updates a child only when both child and parent snapshots match.
4125
4261
  *
@@ -4133,6 +4269,8 @@ interface TaskStore {
4133
4269
  * @returns The updated child, or `null` when either task is missing or either snapshot differs.
4134
4270
  */
4135
4271
  updateIfStatusUpdatedAtAndParentUpdatedAt(tenantId: string, id: string, updates: UpdateTaskRequest, expectedStatuses: TaskItem["status"][], expectedUpdatedAt: Date | string, parentId: string, expectedParentUpdatedAt: Date | string): Promise<TaskItem | null>;
4272
+ /** Atomically deletes a task only while its full trusted mutation snapshot matches. */
4273
+ deleteIfSnapshot(tenantId: string, id: string, snapshot: TaskMutationSnapshot): Promise<boolean>;
4136
4274
  /**
4137
4275
  * Atomically update a task unless its current status is blocked.
4138
4276
  *
@@ -4230,8 +4368,36 @@ declare const MAX_PENDING_EXECUTION_RESULTS_LIMIT = 1000;
4230
4368
  * @returns True only for the portable canonical ASCII grammar.
4231
4369
  */
4232
4370
  declare function isExecutionResultEventKey(value: unknown): value is string;
4371
+ /** Canonical lifecycle actions projected into Project Rooms. */
4372
+ declare const PROJECT_TASK_LIFECYCLE_ACTIONS: readonly ["in_progress", "interrupted", "failed", "completed", "cancelled", "reassigned"];
4373
+ /** Lifecycle action eligible for Project Room projection. */
4374
+ type ProjectTaskLifecycleAction = typeof PROJECT_TASK_LIFECYCLE_ACTIONS[number];
4375
+ /** Exclusive cursor for deterministic project lifecycle pagination. */
4376
+ interface ProjectLifecycleEventCursor {
4377
+ /** Creation timestamp of the last returned event. */
4378
+ createdAt: Date;
4379
+ /** Identifier of the last returned event. */
4380
+ id: string;
4381
+ }
4382
+ /** Exact project scope and bounded page for canonical lifecycle events. */
4383
+ interface ProjectLifecycleEventQuery {
4384
+ /** Tenant identifier. */
4385
+ tenantId: string;
4386
+ /** Workspace identifier. */
4387
+ workspaceId: string;
4388
+ /** Project identifier. */
4389
+ projectId: string;
4390
+ /** Nonempty lifecycle actions to include. */
4391
+ actions: ProjectTaskLifecycleAction[];
4392
+ /** Optional exclusive descending cursor. */
4393
+ before?: ProjectLifecycleEventCursor;
4394
+ /** Maximum rows to return, from 1 through 100. */
4395
+ limit: number;
4396
+ }
4233
4397
  interface TaskWorkItemStore {
4234
4398
  create(params: CreateWorkItemRequest): Promise<TaskWorkItem>;
4399
+ /** Atomically creates a work item only while the owning task snapshot matches. */
4400
+ createIfTaskSnapshot?(params: CreateWorkItemRequest, snapshot: TaskMutationSnapshot): Promise<TaskWorkItem | null>;
4235
4401
  list(filter: TaskWorkItemListFilter): Promise<TaskWorkItem[]>;
4236
4402
  /**
4237
4403
  * List the newest bounded set of execution results awaiting reconciliation.
@@ -4254,6 +4420,13 @@ interface TaskWorkItemStore {
4254
4420
  taskId: string;
4255
4421
  limit: number;
4256
4422
  }): Promise<TaskWorkItem[]>;
4423
+ /**
4424
+ * Lists canonical lifecycle events in an exact project scope.
4425
+ *
4426
+ * @param query Exact scope, actions, exclusive cursor, and page bound.
4427
+ * @returns Events ordered by creation time and ID descending.
4428
+ */
4429
+ listProjectLifecycleEvents?(query: ProjectLifecycleEventQuery): Promise<TaskWorkItem[]>;
4257
4430
  /**
4258
4431
  * Find an event by deterministic identity without list pagination.
4259
4432
  *
@@ -4272,6 +4445,19 @@ interface TaskWorkItemStore {
4272
4445
  */
4273
4446
  createIfAbsentByEventKey(params: CreateWorkItemIfAbsentRequest): Promise<TaskWorkItem>;
4274
4447
  }
4448
+ /** Work-item capabilities required by trusted Project Task consumers. */
4449
+ interface ProjectTaskWorkItemStore extends TaskWorkItemStore {
4450
+ createIfTaskSnapshot(params: CreateWorkItemRequest, snapshot: TaskMutationSnapshot): Promise<TaskWorkItem | null>;
4451
+ listProjectLifecycleEvents(query: ProjectLifecycleEventQuery): Promise<TaskWorkItem[]>;
4452
+ }
4453
+ /** Stable capability failure raised before any trusted Project Task mutation. */
4454
+ declare class ProjectTaskStoreUnsupportedError extends Error {
4455
+ readonly missingMethods: readonly string[];
4456
+ readonly code: "PROJECT_TASK_STORE_UNSUPPORTED";
4457
+ constructor(missingMethods: readonly string[]);
4458
+ }
4459
+ /** Refines a Main-compatible WorkItem store for trusted Project Task consumers. */
4460
+ declare function requireProjectTaskWorkItemStore(store: TaskWorkItemStore): ProjectTaskWorkItemStore;
4275
4461
 
4276
4462
  /**
4277
4463
  * A single canonical belief recorded in a task description.
@@ -4900,6 +5086,471 @@ interface CapabilityPreview {
4900
5086
  bundleRevisions?: Record<string, string>;
4901
5087
  }
4902
5088
 
5089
+ /** Human access roles available within a project. */
5090
+ type ProjectHumanRole = "owner" | "admin" | "member" | "viewer";
5091
+ /** Lifecycle states for a human project membership. */
5092
+ type ProjectMembershipStatus = "active" | "removed";
5093
+ /** Roles a bot can hold within a project room. */
5094
+ type ProjectBotRole = "coordinator" | "specialist";
5095
+ /** Lifecycle states for a bot room membership. */
5096
+ type ProjectBotMembershipStatus = "active" | "paused" | "removed";
5097
+ /** Origins supported by project room messages. */
5098
+ type ProjectRoomMessageSource = "user" | "agent" | "task" | "routine" | "system";
5099
+ /** The main room associated with a project. */
5100
+ interface ProjectRoom {
5101
+ id: string;
5102
+ tenantId: string;
5103
+ workspaceId: string;
5104
+ projectId: string;
5105
+ type: "main";
5106
+ name: string;
5107
+ createdAt: Date;
5108
+ updatedAt: Date;
5109
+ }
5110
+ /** A user's membership and access role within a project. */
5111
+ interface ProjectMembership {
5112
+ id: string;
5113
+ tenantId: string;
5114
+ projectId: string;
5115
+ userId: string;
5116
+ role: ProjectHumanRole;
5117
+ status: ProjectMembershipStatus;
5118
+ joinedAt: Date;
5119
+ updatedAt: Date;
5120
+ }
5121
+ /** A bot's role, presentation, and execution thread within a project room. */
5122
+ interface ProjectBotMembership {
5123
+ id: string;
5124
+ tenantId: string;
5125
+ workspaceId: string;
5126
+ projectId: string;
5127
+ roomId: string;
5128
+ assistantId: string;
5129
+ role: ProjectBotRole;
5130
+ title: string;
5131
+ responsibility?: string;
5132
+ mentionName: string;
5133
+ status: ProjectBotMembershipStatus;
5134
+ roomThreadId: string;
5135
+ joinedAt: Date;
5136
+ updatedAt: Date;
5137
+ }
5138
+ /** Identifies a human author of a project room message. */
5139
+ interface ProjectRoomMessageHumanAuthor {
5140
+ type: "human";
5141
+ userId: string;
5142
+ }
5143
+ /** Identifies a bot membership as the author of a project room message. */
5144
+ interface ProjectRoomMessageBotAuthor {
5145
+ type: "bot";
5146
+ membershipId: string;
5147
+ assistantId: string;
5148
+ }
5149
+ /** Identifies the system as the author of a project room message. */
5150
+ interface ProjectRoomMessageSystemAuthor {
5151
+ type: "system";
5152
+ }
5153
+ /** The discriminated author variants supported by project room messages. */
5154
+ type ProjectRoomMessageAuthor = ProjectRoomMessageHumanAuthor | ProjectRoomMessageBotAuthor | ProjectRoomMessageSystemAuthor;
5155
+ /** A bot or the whole team targeted by a room message. */
5156
+ type ProjectRoomMention = {
5157
+ type: "bot";
5158
+ membershipId: string;
5159
+ } | {
5160
+ type: "team";
5161
+ };
5162
+ /** Text payload carried by a project room message. */
5163
+ interface ProjectRoomTextContent {
5164
+ type: "text";
5165
+ text: string;
5166
+ }
5167
+ /** A message posted to a project room. */
5168
+ interface ProjectRoomMessage {
5169
+ id: string;
5170
+ tenantId: string;
5171
+ workspaceId: string;
5172
+ projectId: string;
5173
+ roomId: string;
5174
+ author: ProjectRoomMessageAuthor;
5175
+ content: ProjectRoomTextContent;
5176
+ mentions: ProjectRoomMention[];
5177
+ replyToMessageId?: string;
5178
+ source: ProjectRoomMessageSource;
5179
+ sourceId?: string;
5180
+ idempotencyKey?: string;
5181
+ createdAt: Date;
5182
+ }
5183
+ /** Stable position used to page through project room messages. */
5184
+ interface ProjectRoomMessageCursor {
5185
+ createdAt: Date;
5186
+ id: string;
5187
+ }
5188
+ /** Metadata linking a room-presence thread to its project room bot membership. */
5189
+ interface ProjectRoomThreadMetadata {
5190
+ source: "project_room";
5191
+ kind: "room_presence";
5192
+ workspaceId: string;
5193
+ projectId: string;
5194
+ roomId: string;
5195
+ membershipId: string;
5196
+ assistantId: string;
5197
+ }
5198
+ /** Metadata linking a task-execution thread to its owning project task and bot membership. */
5199
+ interface ProjectTaskThreadMetadata {
5200
+ source: "project_task";
5201
+ kind: "task_execution";
5202
+ workspaceId: string;
5203
+ projectId: string;
5204
+ roomId: string;
5205
+ membershipId: string;
5206
+ assistantId: string;
5207
+ taskId: string;
5208
+ parentTaskId?: string;
5209
+ }
5210
+
5211
+ /** Persistence operations for a project's canonical main room. */
5212
+ interface ProjectRoomStore {
5213
+ /** Creates the main room if needed and returns the canonical record. */
5214
+ ensureMainRoom(input: {
5215
+ id: string;
5216
+ tenantId: string;
5217
+ workspaceId: string;
5218
+ projectId: string;
5219
+ name: string;
5220
+ }): Promise<ProjectRoom>;
5221
+ /** Finds the main room for a project, if one exists. */
5222
+ getMainRoom(tenantId: string, projectId: string): Promise<ProjectRoom | null>;
5223
+ }
5224
+
5225
+ /** Result of an atomic human membership mutation, including its committed row. */
5226
+ type ProjectMembershipMutationResult = {
5227
+ kind: "updated" | "removed";
5228
+ membership: ProjectMembership;
5229
+ } | {
5230
+ kind: "not_found" | "conflict" | "last_owner";
5231
+ };
5232
+ /** Persistence operations for human membership in a project. */
5233
+ interface ProjectMembershipStore {
5234
+ /** Lists memberships belonging to a project. */
5235
+ list(tenantId: string, projectId: string): Promise<ProjectMembership[]>;
5236
+ /** Finds a user's membership in a project, if one exists. */
5237
+ findByUser(tenantId: string, projectId: string, userId: string): Promise<ProjectMembership | null>;
5238
+ /** Creates a project membership. */
5239
+ create(input: Omit<ProjectMembership, "joinedAt" | "updatedAt">): Promise<ProjectMembership>;
5240
+ /**
5241
+ * Atomically initializes an empty Project with its first owner.
5242
+ * `created` means this call initialized the Project; `existing` means the
5243
+ * requested user already owns the initialized Project and this was an
5244
+ * idempotent retry; `already_initialized` means membership rows exist but
5245
+ * this call did not produce either initial-owner outcome.
5246
+ */
5247
+ createInitialOwner(input: Omit<ProjectMembership, "role" | "status" | "joinedAt" | "updatedAt">): Promise<{
5248
+ kind: "created" | "existing";
5249
+ membership: ProjectMembership;
5250
+ } | {
5251
+ kind: "already_initialized";
5252
+ }>;
5253
+ /**
5254
+ * Updates a role within the tenant using optimistic concurrency and owner
5255
+ * safeguards. `not_found` means the membership is not in the tenant;
5256
+ * `conflict` means `updatedAt` differs from `expectedUpdatedAt`.
5257
+ */
5258
+ updateRole(input: {
5259
+ tenantId: string;
5260
+ id: string;
5261
+ role: ProjectHumanRole;
5262
+ expectedUpdatedAt: Date;
5263
+ }): Promise<ProjectMembershipMutationResult>;
5264
+ /**
5265
+ * Removes a membership within the tenant using optimistic concurrency and
5266
+ * owner safeguards. `not_found` means the membership is not in the tenant;
5267
+ * `conflict` means `updatedAt` differs from `expectedUpdatedAt`.
5268
+ */
5269
+ remove(input: {
5270
+ tenantId: string;
5271
+ id: string;
5272
+ expectedUpdatedAt: Date;
5273
+ }): Promise<ProjectMembershipMutationResult>;
5274
+ }
5275
+
5276
+ /** Persistence operations for bot membership in a project room. */
5277
+ interface ProjectBotMembershipStore {
5278
+ /** Lists bot memberships belonging to a project. */
5279
+ list(tenantId: string, projectId: string): Promise<ProjectBotMembership[]>;
5280
+ /** Finds a bot membership by identifier within a tenant. */
5281
+ findById(tenantId: string, id: string): Promise<ProjectBotMembership | null>;
5282
+ /** Finds a bot membership by assistant within a project. */
5283
+ findByAssistant(tenantId: string, projectId: string, assistantId: string): Promise<ProjectBotMembership | null>;
5284
+ /**
5285
+ * Saves a bot membership. A new row returns `created`, an existing active or
5286
+ * paused row returns `updated`, and a removed row returns `reactivated`.
5287
+ * `coordinator_conflict` means a non-removed
5288
+ * coordinator already exists for the Tenant+Project; `mention_conflict`
5289
+ * means the mention name is already used by an active or paused membership
5290
+ * in the Tenant+room.
5291
+ */
5292
+ save(input: Omit<ProjectBotMembership, "joinedAt" | "updatedAt">): Promise<{
5293
+ kind: "created" | "updated" | "reactivated";
5294
+ membership: ProjectBotMembership;
5295
+ } | {
5296
+ kind: "coordinator_conflict" | "mention_conflict";
5297
+ }>;
5298
+ /**
5299
+ * Updates a bot membership using optimistic concurrency and uniqueness
5300
+ * safeguards. `not_found` means the membership is not in the tenant;
5301
+ * `conflict` means `updatedAt` differs from `expectedUpdatedAt`.
5302
+ * `coordinator_conflict` applies to the one non-removed Coordinator per
5303
+ * Tenant+Project rule; `mention_conflict` applies to mention uniqueness
5304
+ * among active and paused memberships in the Tenant+room.
5305
+ */
5306
+ update(input: {
5307
+ tenantId: string;
5308
+ id: string;
5309
+ patch: Partial<Pick<ProjectBotMembership, "role" | "title" | "responsibility" | "mentionName" | "status">>;
5310
+ expectedUpdatedAt: Date;
5311
+ }): Promise<{
5312
+ kind: "updated";
5313
+ membership: ProjectBotMembership;
5314
+ } | {
5315
+ kind: "not_found" | "conflict" | "coordinator_conflict" | "mention_conflict";
5316
+ }>;
5317
+ }
5318
+
5319
+ /** Persistence operations for messages in a project room. */
5320
+ interface ProjectRoomMessageStore {
5321
+ /** Creates a room message. */
5322
+ create(input: Omit<ProjectRoomMessage, "createdAt">): Promise<ProjectRoomMessage>;
5323
+ /** Creates or returns the existing room message for an idempotency key. */
5324
+ createIdempotent(input: Omit<ProjectRoomMessage, "createdAt"> & {
5325
+ idempotencyKey: string;
5326
+ }): Promise<ProjectRoomMessage>;
5327
+ /** Lists messages strictly before an optional cursor, up to the requested limit. */
5328
+ list(input: {
5329
+ tenantId: string;
5330
+ roomId: string;
5331
+ before?: ProjectRoomMessageCursor;
5332
+ limit: number;
5333
+ }): Promise<ProjectRoomMessage[]>;
5334
+ /** Finds a room message by identifier within a tenant. */
5335
+ findById(tenantId: string, id: string): Promise<ProjectRoomMessage | null>;
5336
+ }
5337
+
5338
+ /** A safely extracted value from an own enumerable data-property descriptor. */
5339
+ interface DescriptorDataValue {
5340
+ ok: true;
5341
+ value: unknown;
5342
+ }
5343
+ /**
5344
+ * Reads an own enumerable data-property descriptor without consulting its prototype.
5345
+ *
5346
+ * @param descriptor Property descriptor to inspect.
5347
+ * @returns The descriptor value when it is an own enumerable data descriptor, otherwise `undefined`.
5348
+ */
5349
+ declare function descriptorDataValue(descriptor: unknown): DescriptorDataValue | undefined;
5350
+ /**
5351
+ * Copies an object-like value into a local plain record using only exact own enumerable data descriptors.
5352
+ *
5353
+ * Prototypes are deliberately ignored so records from other JavaScript realms remain valid and inherited
5354
+ * behavior can never participate in validation.
5355
+ *
5356
+ * @param value Untrusted value to snapshot.
5357
+ * @param required Own string keys that must be present.
5358
+ * @param optional Own string keys that may be present.
5359
+ * @returns A canonical local record, or `undefined` for malformed descriptors, keys, arrays, or proxies.
5360
+ */
5361
+ declare function snapshotExactRecord(value: unknown, required: readonly string[], optional?: readonly string[]): Record<string, unknown> | undefined;
5362
+ /**
5363
+ * Copies a dense cross-realm array using only own element data descriptors and the intrinsic length descriptor.
5364
+ *
5365
+ * @param value Untrusted value to snapshot.
5366
+ * @returns A canonical local dense array, or `undefined` for holes, extras, accessors, or malformed proxies.
5367
+ */
5368
+ declare function snapshotExactArray(value: unknown): unknown[] | undefined;
5369
+
5370
+ /** A message shape safe to expose to Project Room clients. */
5371
+ interface ProjectRoomPublicMessage {
5372
+ id: string;
5373
+ roomId: string;
5374
+ author: {
5375
+ type: "human";
5376
+ userId: string;
5377
+ } | {
5378
+ type: "bot";
5379
+ membershipId: string;
5380
+ } | {
5381
+ type: "system";
5382
+ };
5383
+ content: {
5384
+ type: "text";
5385
+ text: string;
5386
+ };
5387
+ mentions: ProjectRoomMention[];
5388
+ replyToMessageId?: string;
5389
+ source: ProjectRoomMessageSource;
5390
+ createdAt: string;
5391
+ }
5392
+ /** A human membership shape safe to expose to Project Room clients. */
5393
+ interface ProjectRoomPublicMembership {
5394
+ id: string;
5395
+ userId: string;
5396
+ role: ProjectHumanRole;
5397
+ status: ProjectMembershipStatus;
5398
+ joinedAt: string;
5399
+ updatedAt: string;
5400
+ }
5401
+ /** A bot membership shape safe to expose to Project Room clients. */
5402
+ interface ProjectRoomPublicBotMembership {
5403
+ id: string;
5404
+ role: ProjectBotRole;
5405
+ title: string;
5406
+ responsibility?: string;
5407
+ mentionName: string;
5408
+ status: ProjectBotMembershipStatus;
5409
+ joinedAt: string;
5410
+ updatedAt: string;
5411
+ }
5412
+ /** A fully identified business event carried by the realtime stream. */
5413
+ interface ProjectRoomEventOf<TType extends string, TData> {
5414
+ id: string;
5415
+ type: TType;
5416
+ occurredAt: string;
5417
+ data: TData;
5418
+ }
5419
+ /** A newly committed message event. */
5420
+ type ProjectRoomMessageCreatedEvent = ProjectRoomEventOf<"message.created", {
5421
+ message: ProjectRoomPublicMessage;
5422
+ }>;
5423
+ /** A changed bot roster event. */
5424
+ type ProjectRoomRosterChangedEvent = ProjectRoomEventOf<"roster.changed", {
5425
+ change: "added" | "updated" | "paused" | "resumed" | "removed";
5426
+ membership: ProjectRoomPublicBotMembership;
5427
+ }>;
5428
+ /** A changed human membership event. */
5429
+ type ProjectRoomMembershipChangedEvent = ProjectRoomEventOf<"membership.changed", {
5430
+ change: "added" | "role_changed" | "removed";
5431
+ membership: ProjectRoomPublicMembership;
5432
+ }>;
5433
+ /** A changed Project Task fact event. */
5434
+ type ProjectRoomTaskChangedEvent = ProjectRoomEventOf<"task.changed", {
5435
+ taskId: string;
5436
+ status: TaskItem["status"];
5437
+ ownerMembershipId: string;
5438
+ updatedAt: string;
5439
+ }>;
5440
+ /** All identified business events retained by the realtime broker. */
5441
+ type ProjectRoomBusinessEvent = ProjectRoomMessageCreatedEvent | ProjectRoomRosterChangedEvent | ProjectRoomMembershipChangedEvent | ProjectRoomTaskChangedEvent;
5442
+ /** A business event before the broker assigns its process-local ID. */
5443
+ type ProjectRoomBusinessEventDraft = Omit<ProjectRoomMessageCreatedEvent, "id"> | Omit<ProjectRoomRosterChangedEvent, "id"> | Omit<ProjectRoomMembershipChangedEvent, "id"> | Omit<ProjectRoomTaskChangedEvent, "id">;
5444
+ /** A connection control event; control events are never replayed. */
5445
+ type ProjectRoomControlEvent = {
5446
+ type: "ready";
5447
+ data: {
5448
+ epoch: string;
5449
+ headEventId: string | null;
5450
+ };
5451
+ } | {
5452
+ type: "resync";
5453
+ data: {
5454
+ reason: "SERVER_RESTART" | "CURSOR_EXPIRED" | "SLOW_CONSUMER";
5455
+ };
5456
+ } | {
5457
+ type: "access.revoked";
5458
+ data: {
5459
+ reason: "PROJECT_ACCESS_REVOKED" | "TOKEN_EXPIRED";
5460
+ };
5461
+ };
5462
+ /** The authenticated identity used by Project Room realtime access checks. */
5463
+ interface ProjectRoomRealtimeActor {
5464
+ tenantId: string;
5465
+ userId: string;
5466
+ projectId: string;
5467
+ tokenExpiresAt: number;
5468
+ }
5469
+ /** Writable HTTP socket surface required by the bounded SSE transport. */
5470
+ interface ProjectRoomSseWritable {
5471
+ write(chunk: string): boolean;
5472
+ end(): void;
5473
+ destroy(): void;
5474
+ on(event: "close" | "error" | "drain", listener: () => void): this;
5475
+ off(event: "close" | "error" | "drain", listener: () => void): this;
5476
+ }
5477
+ /** The scope used to isolate events between tenant rooms. */
5478
+ interface ProjectRoomEventScope {
5479
+ tenantId: string;
5480
+ roomId: string;
5481
+ projectId: string;
5482
+ }
5483
+ /** An internal broker event carrying scope that is removed before public serialization. */
5484
+ type ProjectRoomScopedBusinessEvent = ProjectRoomBusinessEvent & {
5485
+ scope: ProjectRoomEventScope;
5486
+ };
5487
+ /** A broker subscription containing replay and its room head. */
5488
+ interface ProjectRoomEventSubscription {
5489
+ replay: ProjectRoomBusinessEvent[];
5490
+ headEventId: string | null;
5491
+ unsubscribe(): void;
5492
+ }
5493
+ /** The narrow broker contract consumed by realtime publishers and services. */
5494
+ interface ProjectRoomEventBrokerProtocol {
5495
+ readonly epoch: string;
5496
+ publish(scope: ProjectRoomEventScope, draft: ProjectRoomBusinessEventDraft): ProjectRoomScopedBusinessEvent;
5497
+ subscribe(scope: ProjectRoomEventScope, afterEventId: string | undefined, listener: (event: ProjectRoomBusinessEvent) => void): ProjectRoomEventSubscription;
5498
+ close(): void;
5499
+ }
5500
+ /** A typed cursor failure requiring client REST resynchronization. */
5501
+ declare class ProjectRoomCursorError extends Error {
5502
+ readonly code: "SERVER_RESTART" | "CURSOR_EXPIRED";
5503
+ readonly name = "ProjectRoomCursorError";
5504
+ constructor(code: "SERVER_RESTART" | "CURSOR_EXPIRED");
5505
+ }
5506
+ /** A typed failure raised when the process-local event sequence is exhausted. */
5507
+ declare class ProjectRoomBrokerCapacityError extends Error {
5508
+ readonly name = "ProjectRoomBrokerCapacityError";
5509
+ readonly code: "PROJECT_ROOM_EVENT_SEQUENCE_EXHAUSTED";
5510
+ constructor();
5511
+ }
5512
+ /** The parsed components of a canonical Project Room event ID. */
5513
+ interface ProjectRoomEventId {
5514
+ epoch: string;
5515
+ sequence: number;
5516
+ }
5517
+ /** Parses a canonical event ID, returning undefined for malformed or unsafe IDs. */
5518
+ declare function parseProjectRoomEventId(value: unknown): ProjectRoomEventId | undefined;
5519
+ /** Checks an event ID without relying on realm-specific object identity. */
5520
+ declare function isProjectRoomEventId(value: unknown): value is string;
5521
+ /** Maps a canonical internal message to the strict public message DTO. */
5522
+ declare function toProjectRoomPublicMessage(value: unknown): ProjectRoomPublicMessage | undefined;
5523
+ /** A descriptor-safe message projection together with its canonical realtime scope. */
5524
+ declare function snapshotProjectRoomMessageRealtime(value: unknown): {
5525
+ scope: {
5526
+ tenantId: string;
5527
+ roomId: string;
5528
+ projectId: string;
5529
+ };
5530
+ publicMessage: ProjectRoomPublicMessage;
5531
+ } | undefined;
5532
+ /** Maps a canonical internal human membership to the strict public DTO. */
5533
+ declare function toProjectRoomPublicMembership(value: unknown): ProjectRoomPublicMembership | undefined;
5534
+ /** A descriptor-safe human membership projection with canonical tenant/project scope. */
5535
+ declare function snapshotProjectRoomMembershipRealtime(value: unknown): {
5536
+ scope: {
5537
+ tenantId: string;
5538
+ projectId: string;
5539
+ };
5540
+ publicMembership: ProjectRoomPublicMembership;
5541
+ } | undefined;
5542
+ /** Maps a canonical internal bot membership to the strict public DTO. */
5543
+ declare function toProjectRoomPublicBotMembership(value: unknown): ProjectRoomPublicBotMembership | undefined;
5544
+ /** A descriptor-safe bot membership projection with canonical realtime scope. */
5545
+ declare function snapshotProjectRoomBotMembershipRealtime(value: unknown): {
5546
+ scope: {
5547
+ tenantId: string;
5548
+ roomId: string;
5549
+ projectId: string;
5550
+ };
5551
+ publicMembership: ProjectRoomPublicBotMembership;
5552
+ } | undefined;
5553
+
4903
5554
  /**
4904
5555
  * YAML Workflow DSL — linear model with parallel blocks
4905
5556
  *
@@ -5425,4 +6076,54 @@ type Timestamp = number;
5425
6076
  */
5426
6077
  type Callback<T = any, R = void> = (data: T) => R | Promise<R>;
5427
6078
 
5428
- export { type A2AApiKeyEntry, type A2AApiKeyRecord, type A2AApiKeyStore, type A2AAuthContext, type A2AExposure, type A2ARemoteAgentConfig, type AgentClient, type AgentConfig, type AgentConfigWithTools, type AgentLatticeProtocol, type AgentMenuConfig, type AgentMiddlewareConfig, type AgentRunConfig, AgentType, type AgentWebApp, type AgentWebAppAppearance, type AgentWebAppBootstrap, type AgentWebAppCalloutWidget, type AgentWebAppError, type AgentWebAppErrorCode, type AgentWebAppFeatures, type AgentWebAppGenUIBlock, type AgentWebAppInterrupt, type AgentWebAppRuntimeMessage, type AgentWebAppRuntimeThread, type AgentWebAppScope, type AgentWebAppStatus, type AgentWebAppStore, type AgentWebAppStorePatch, type AgentWebAppStreamEvent, type AgentWebAppTableWidget, type AgentWebAppThreadMetadata, type AgentWebAppUpdateOptions, type Assistant, type AssistantMessage, type AssistantStore, type Attachment, type AvailableModule, type BaseLatticeProtocol, type BaseMessage, type Binding, type BindingRegistry, type BootstrapFilesConfig, type BrowserMiddlewareConfig, type Callback, type CapabilityBundle, type CapabilityBundleDeleteResult, type CapabilityBundleStore, type CapabilityBundleUpdateConflict, type CapabilityFieldSource, type CapabilityOverride, type CapabilityPreview, type CapabilityPreviewIssue, type CapabilityRuntime, type ChannelAdapter, type ChannelInstallation, type ChannelInstallationStore, type ChannelInstallationType, type ClawMiddlewareConfig, type CodeEvalMiddlewareConfig, type Collection, type CollectionField, type CollectionFieldType, type CollectionMiddlewareConfig, type CollectionSchema, type CollectionStore, type ConnectionEntry, type ConnectionStore, type ConversationRecord, type CreateA2AApiKeyInput, type CreateAgentWebAppInput, type CreateAssistantRequest, type CreateBindingInput, type CreateCapabilityBundleInput, type CreateChannelInstallationRequest, type CreateCollectionRequest, type CreateConversationInput, type CreateDatabaseConfigRequest, type CreateEvalCaseRequest, type CreateEvalProjectRequest, type CreateEvalRunRequest, type CreateEvalSuiteRequest, type CreateMcpServerConfigRequest, type CreateMenuItemInput, type CreateMetricsServerConfigRequest, type CreateProjectRequest, type CreateRunStepRequest, type CreateShareRequest, type CreateSkillRequest, type CreateTaskRequest, type CreateTenantRequest, type CreateThreadRequest, type CreateUserRequest, type CreateUserTenantLinkRequest, type CreateWorkItemIfAbsentRequest, type CreateWorkItemRequest, type CreateWorkflowRunRequest, type CreateWorkspaceRequest, type CustomMenuConfig, type DataSource, type DatabaseConfig, type DatabaseConfigEntry, type DatabaseConfigStore, type DatabaseType, type DeepAgentConfig, type DeveloperMessage, type DispatchResult, EXECUTION_RESULT_EVENT_KEY_PATTERN, EXECUTION_RESULT_EVENT_KEY_PATTERN_SOURCE, EXECUTION_RESULT_EVENT_KEY_PREFIX, type EmbeddingsConfig, type EmbeddingsLatticeProtocol, type EvalCase, type EvalProject, type EvalProjectReport, type EvalRun, type EvalRunResult, type EvalStore, type EvalSuite, type ExecuteSqlQueryRequest, type ExecuteSqlQueryResponse, type ExpectedCapabilityBundleRevisions, type FilterCondition, type GraphBuildOptions, type HtmlMenuConfig, type IConversationStore, type ID, type InboundMessage, type InternalAgentNode, type InternalBaseNode, type InternalCreateCapabilityBundleInput, type InternalDSL, type InternalEdge, type InternalInput, type InternalInputNode, type InternalMapNode, type InternalNode, type InternalNodeConfig, type InternalOutput, type InternalState, type InternalStateField, type InternalTerminalNode, type InternalUpdateCapabilityBundleInput, type InterruptMessage, type InterruptPolicy, InvalidProjectCapabilityBundleConfigError, type LLMConfig, type LarkChannelInstallationConfig, type LatticeError, type LatticeEventBus, type LatticeMessage, type LocalA2AProviderId, type LocalA2AProviderState, type LocalA2AProviderStatus, type LocalA2ATemplateDefinition, type LocalRuntimeConfig, type LoggerClient, type LoggerConfig, type LoggerContext, type LoggerLatticeProtocol, LoggerType, MAX_PENDING_EXECUTION_RESULTS_LIMIT, type McpClient, type McpClientOptions, type McpConnectionStatus, type McpLatticeMessage, type McpLatticeProtocol, McpMessageType, type McpServerConfig, type McpServerConfigEntry, type McpServerConfigStore, type McpStats, type McpTool, type McpToolResult, type McpTransportType, type MemoryClient, type MemoryConfig, type MemoryLatticeProtocol, MemoryType, type MenuContentConfig, type MenuContentType, type MenuItem, type MenuRegistry, type MenuTarget, type Message, type MessageChunk, type MessageChunkType, MessageChunkTypes, type MessageContext, type MessageMiddleware, type MetricColumn, type MetricDataPoint, type MetricMeta, type MetricQueryResult, type MetricsMiddlewareConfig, type MetricsServerConfig, type MetricsServerConfigEntry, type MetricsServerConfigStore, type MetricsServerType, type MiddlewareType, type ModelLatticeProtocol, type OutboundMessage, type PaginatedResult, type PaginationParams, type PinoFileOptions, type Plugin, type PluginConnection, type PluginConnectionFieldSchema, type PluginConnectionTestResult, type PluginContext, type PluginDiscoveredResource, type PluginMeta, type PluginMetaOutput, type PluginMiddlewareFactory, type PluginSkillDefinition, type PluginSkillResource, type PluginStandardConnectionConfig, type PluginToolMeta, type ProcessingAgentConfig, type Project, type ProjectCapabilityConfig, type ProjectFilter, type ProjectKind, type ProjectStore, type QueryParams, type QueryResultFormat, type QueryWorkflowRunsOptions, type QueryWorkflowRunsResult, type QueueClient, type QueueConfig, type QueueLatticeProtocol, type QueueResult, QueueType, type ReactAgentConfig, type ReplyTarget, type ResourceAddress, type ResourceResolver, type Result, type RunStep, type STTClient, type STTConfig, type STTModelLatticeProtocol, type SandboxMiddlewareConfig, type ScheduleClient, type ScheduleConfig, type ScheduleCronOptions, ScheduleExecutionType, type ScheduleLatticeProtocol, type ScheduleOnceOptions, type ScheduleStorage, ScheduleType, type ScheduledTaskDefinition, ScheduledTaskStatus, type SchedulerMiddlewareConfig, type SemanticMetricsFilter, type SemanticMetricsQueryRequest, type SemanticMetricsQueryResponse, type SemanticMetricsServerConfig, type ShareRecord, type ShareResult, type ShareVisibility, type SharedResourceStore, type Skill, type SkillClient, type SkillClientType, type SkillConfig, type SkillLatticeProtocol, type SkillStore, type SkillStoreContext, type SqlMiddlewareConfig, type StepStatus, type StepType, type StorageType, type SystemMessage, type TableQueryRequest, type TableQueryResponse, type TaskBeliefDiagnosticCode, type TaskBeliefEntry, type TaskBeliefParseFailure, type TaskBeliefParseResult, type TaskBeliefParseSuccess, type TaskBeliefState, type TaskFileRef, type TaskHandler, type TaskItem, type TaskListFilter, type TaskStore, type TaskWorkItem, type TaskWorkItemListFilter, type TaskWorkItemStore, type TeamAgentConfig, type TeamTeammateConfig, type Tenant, type TenantStatus, type TenantStore, type TestMcpServerToolsResponse, type Thread, type ThreadStore, type Timestamp, type ToolCall, type ToolConfig, type ToolExecutor, type ToolLatticeProtocol, type ToolMessage, type TopologyEdge, type TranscriptionResult, type UIComponent, UIComponentType, type UIConfig, type UILatticeProtocol, type UpdateAgentWebAppInput, type UpdateCapabilityBundleInput, type UpdateChannelInstallationRequest, type UpdateCollectionRequest, type UpdateDatabaseConfigRequest, type UpdateMcpServerConfigRequest, type UpdateMenuItemInput, type UpdateMetricsServerConfigRequest, type UpdateProjectCapabilityBundlesResult, type UpdateProjectRequest, type UpdateRunStepRequest, type UpdateTaskRequest, type UpdateTenantRequest, type UpdateUserRequest, type UpdateUserTenantLinkRequest, type UpdateWorkflowRunRequest, type UpdateWorkspaceRequest, type User, type UserMessage, type UserStatus, type UserStore, type UserTenantLink, type UserTenantLinkStore, type UserTenantRole, type VectorStoreConfig, type VectorStoreCreateParams, type VectorStoreLatticeProtocol, type VectorStoreProvider, type WechatChannelInstallationConfig, type WorkflowAgentConfig, type WorkflowRun, type WorkflowRunStatus, type WorkflowTrackingStore, type Workspace, type WorkspaceStore, type YamlAgentStep, type YamlMapStep, type YamlParallelBlock, type YamlTopLevelStep, type YamlWorkflow, assertGenericProjectConfig, getSubAgentsFromConfig, getToolsFromConfig, hasTools, isA2ARemoteAgentConfig, isDeepAgentConfig, isExecutionResultEventKey, isProcessingAgentConfig, isTeamAgentConfig, isWorkflowAgentConfig, parseAgentWebAppGenUIBlock, parseTaskBeliefState, replaceTaskBeliefState, taskBeliefStatesEqual };
6079
+ /** Queue execution behavior available to privileged host dispatchers. */
6080
+ type QueuedExecutionMode = "followup";
6081
+ /** Trusted Project Room identity persisted with a privileged queue message. */
6082
+ interface ProjectRoomTrustedRunContext {
6083
+ tenantId: string;
6084
+ workspaceId: string;
6085
+ projectId: string;
6086
+ roomId: string;
6087
+ sourceRoomMessageId: string;
6088
+ membershipId: string;
6089
+ assistantId: string;
6090
+ inputMessageId: string;
6091
+ role: "coordinator" | "specialist";
6092
+ title: string;
6093
+ responsibility?: string;
6094
+ }
6095
+ /** Trusted Project Task identity persisted with a privileged queue message. */
6096
+ interface ProjectTaskTrustedRunContext {
6097
+ tenantId: string;
6098
+ workspaceId: string;
6099
+ projectId: string;
6100
+ roomId: string;
6101
+ membershipId: string;
6102
+ assistantId: string;
6103
+ taskId: string;
6104
+ threadId: string;
6105
+ inputMessageId: string;
6106
+ }
6107
+ /** Host-authenticated metadata that cannot be supplied through public Agent APIs. */
6108
+ interface TrustedRunContext {
6109
+ projectRoom?: ProjectRoomTrustedRunContext;
6110
+ projectTask?: ProjectTaskTrustedRunContext;
6111
+ }
6112
+ /**
6113
+ * Strictly validates and clones host-authenticated queue context read from durable storage.
6114
+ *
6115
+ * @param value - Untrusted decoded database value.
6116
+ * @returns A validated defensive clone of the trusted run context.
6117
+ * @throws Error when the stored value does not exactly match the trusted context contract.
6118
+ */
6119
+ declare function parseTrustedRunContext(value: unknown): TrustedRunContext;
6120
+ /**
6121
+ * Strictly validates a queued execution mode read from durable storage.
6122
+ *
6123
+ * @param value - Untrusted database value.
6124
+ * @returns The validated execution mode.
6125
+ * @throws Error when the stored value is not supported.
6126
+ */
6127
+ declare function parseQueuedExecutionMode(value: unknown): QueuedExecutionMode;
6128
+
6129
+ export { type A2AApiKeyEntry, type A2AApiKeyRecord, type A2AApiKeyStore, type A2AAuthContext, type A2AExposure, type A2ARemoteAgentConfig, type AgentClient, type AgentConfig, type AgentConfigWithTools, type AgentLatticeProtocol, type AgentMenuConfig, type AgentMiddlewareConfig, type AgentRunConfig, AgentType, type AgentWebApp, type AgentWebAppAppearance, type AgentWebAppBootstrap, type AgentWebAppCalloutWidget, type AgentWebAppError, type AgentWebAppErrorCode, type AgentWebAppFeatures, type AgentWebAppGenUIBlock, type AgentWebAppInterrupt, type AgentWebAppRuntimeMessage, type AgentWebAppRuntimeThread, type AgentWebAppScope, type AgentWebAppStatus, type AgentWebAppStore, type AgentWebAppStorePatch, type AgentWebAppStreamEvent, type AgentWebAppTableWidget, type AgentWebAppThreadMetadata, type AgentWebAppUpdateOptions, type Assistant, type AssistantMessage, type AssistantStore, type Attachment, type AvailableModule, type BaseLatticeProtocol, type BaseMessage, type Binding, type BindingListParams, type BindingMutablePatch, type BindingRegistry, type BootstrapFilesConfig, type BrowserMiddlewareConfig, type Callback, type CapabilityBundle, type CapabilityBundleDeleteResult, type CapabilityBundleStore, type CapabilityBundleUpdateConflict, type CapabilityFieldSource, type CapabilityOverride, type CapabilityPreview, type CapabilityPreviewIssue, type CapabilityRuntime, type ChannelAdapter, type ChannelBindingMigrationConflict, ChannelBindingMigrationConflictError, type ChannelInstallation, type ChannelInstallationStore, type ChannelInstallationType, type ClawMiddlewareConfig, type CodeEvalMiddlewareConfig, type Collection, type CollectionField, type CollectionFieldType, type CollectionMiddlewareConfig, type CollectionSchema, type CollectionStore, type ConnectionEntry, type ConnectionStore, type ConversationRecord, type CreateA2AApiKeyInput, type CreateAgentWebAppInput, type CreateAssistantRequest, type CreateBindingInput, type CreateCapabilityBundleInput, type CreateChannelInstallationInput, type CreateChannelInstallationRequest, type CreateCollectionRequest, type CreateConversationInput, type CreateDatabaseConfigRequest, type CreateEvalCaseRequest, type CreateEvalProjectRequest, type CreateEvalRunRequest, type CreateEvalSuiteRequest, type CreateMcpServerConfigRequest, type CreateMenuItemInput, type CreateMetricsServerConfigRequest, type CreateProjectRequest, type CreateRunStepRequest, type CreateShareRequest, type CreateSkillRequest, type CreateTaskRequest, type CreateTenantRequest, type CreateThreadRequest, type CreateUserRequest, type CreateUserTenantLinkRequest, type CreateWorkItemIfAbsentRequest, type CreateWorkItemRequest, type CreateWorkflowRunRequest, type CreateWorkspaceRequest, type CustomMenuConfig, type DataSource, type DatabaseConfig, type DatabaseConfigEntry, type DatabaseConfigStore, type DatabaseType, type DeepAgentConfig, type DescriptorDataValue, type DeveloperMessage, type DispatchResult, DuplicateChannelBindingSubjectError, EXECUTION_RESULT_EVENT_KEY_PATTERN, EXECUTION_RESULT_EVENT_KEY_PATTERN_SOURCE, EXECUTION_RESULT_EVENT_KEY_PREFIX, type EmbeddingsConfig, type EmbeddingsLatticeProtocol, type EvalCase, type EvalProject, type EvalProjectReport, type EvalRun, type EvalRunResult, type EvalStore, type EvalSuite, type ExecuteSqlQueryRequest, type ExecuteSqlQueryResponse, type ExpectedCapabilityBundleRevisions, type FilterCondition, type GraphBuildOptions, type HtmlMenuConfig, type IConversationStore, type ID, type InboundMessage, type InternalAgentNode, type InternalBaseNode, type InternalCreateCapabilityBundleInput, type InternalDSL, type InternalEdge, type InternalInput, type InternalInputNode, type InternalMapNode, type InternalNode, type InternalNodeConfig, type InternalOutput, type InternalState, type InternalStateField, type InternalTerminalNode, type InternalUpdateCapabilityBundleInput, type InterruptMessage, type InterruptPolicy, InvalidProjectCapabilityBundleConfigError, type LLMConfig, type LarkChannelInstallationConfig, type LatticeError, type LatticeEventBus, type LatticeMessage, type LocalA2AProviderId, type LocalA2AProviderState, type LocalA2AProviderStatus, type LocalA2ATemplateDefinition, type LocalRuntimeConfig, type LoggerClient, type LoggerConfig, type LoggerContext, type LoggerLatticeProtocol, LoggerType, MAX_PENDING_EXECUTION_RESULTS_LIMIT, type McpClient, type McpClientOptions, type McpConnectionStatus, type McpLatticeMessage, type McpLatticeProtocol, McpMessageType, type McpServerConfig, type McpServerConfigEntry, type McpServerConfigStore, type McpStats, type McpTool, type McpToolResult, type McpTransportType, type MemoryClient, type MemoryConfig, type MemoryLatticeProtocol, MemoryType, type MenuContentConfig, type MenuContentType, type MenuItem, type MenuRegistry, type MenuTarget, type Message, type MessageChunk, type MessageChunkType, MessageChunkTypes, type MessageContext, type MessageMiddleware, type MetricColumn, type MetricDataPoint, type MetricMeta, type MetricQueryResult, type MetricsMiddlewareConfig, type MetricsServerConfig, type MetricsServerConfigEntry, type MetricsServerConfigStore, type MetricsServerType, type MiddlewareType, type ModelLatticeProtocol, type OutboundMessage, PROJECT_TASK_LIFECYCLE_ACTIONS, type PaginatedResult, type PaginationParams, type PinoFileOptions, type Plugin, type PluginConnection, type PluginConnectionFieldSchema, type PluginConnectionTestResult, type PluginContext, type PluginDiscoveredResource, type PluginMeta, type PluginMetaOutput, type PluginMiddlewareFactory, type PluginSkillDefinition, type PluginSkillResource, type PluginStandardConnectionConfig, type PluginToolMeta, type ProcessingAgentConfig, type Project, type ProjectBotMembership, type ProjectBotMembershipStatus, type ProjectBotMembershipStore, type ProjectBotRole, type ProjectCapabilityConfig, type ProjectFilter, type ProjectHumanRole, type ProjectKind, type ProjectLifecycleEventCursor, type ProjectLifecycleEventQuery, type ProjectMembership, type ProjectMembershipMutationResult, type ProjectMembershipStatus, type ProjectMembershipStore, type ProjectRoom, ProjectRoomBrokerCapacityError, type ProjectRoomBusinessEvent, type ProjectRoomBusinessEventDraft, type ProjectRoomControlEvent, ProjectRoomCursorError, type ProjectRoomEventBrokerProtocol, type ProjectRoomEventId, type ProjectRoomEventOf, type ProjectRoomEventScope, type ProjectRoomEventSubscription, type ProjectRoomMembershipChangedEvent, type ProjectRoomMention, type ProjectRoomMessage, type ProjectRoomMessageAuthor, type ProjectRoomMessageCreatedEvent, type ProjectRoomMessageCursor, type ProjectRoomMessageSource, type ProjectRoomMessageStore, type ProjectRoomPublicBotMembership, type ProjectRoomPublicMembership, type ProjectRoomPublicMessage, type ProjectRoomRealtimeActor, type ProjectRoomRosterChangedEvent, type ProjectRoomScopedBusinessEvent, type ProjectRoomSseWritable, type ProjectRoomStore, type ProjectRoomTaskChangedEvent, type ProjectRoomThreadMetadata, type ProjectRoomTrustedRunContext, type ProjectStore, type ProjectTaskLifecycleAction, ProjectTaskStoreUnsupportedError, type ProjectTaskThreadMetadata, type ProjectTaskTrustedRunContext, type ProjectTaskWorkItemStore, type PublicChannelInstallationType, type QueryParams, type QueryResultFormat, type QueryWorkflowRunsOptions, type QueryWorkflowRunsResult, type QueueClient, type QueueConfig, type QueueLatticeProtocol, type QueueResult, QueueType, type QueuedExecutionMode, type ReactAgentConfig, type ReplyTarget, type ResourceAddress, type ResourceResolver, type Result, type RunStep, type STTClient, type STTConfig, type STTModelLatticeProtocol, type SandboxMiddlewareConfig, type ScheduleClient, type ScheduleConfig, type ScheduleCronOptions, ScheduleExecutionType, type ScheduleLatticeProtocol, type ScheduleOnceOptions, type ScheduleStorage, ScheduleType, type ScheduledTaskDefinition, ScheduledTaskStatus, type SchedulerMiddlewareConfig, type SemanticMetricsFilter, type SemanticMetricsQueryRequest, type SemanticMetricsQueryResponse, type SemanticMetricsServerConfig, type ShareRecord, type ShareResult, type ShareVisibility, type SharedResourceStore, type Skill, type SkillClient, type SkillClientType, type SkillConfig, type SkillLatticeProtocol, type SkillStore, type SkillStoreContext, type SqlMiddlewareConfig, type StepStatus, type StepType, type StorageType, type SystemMessage, type TableQueryRequest, type TableQueryResponse, type TaskBeliefDiagnosticCode, type TaskBeliefEntry, type TaskBeliefParseFailure, type TaskBeliefParseResult, type TaskBeliefParseSuccess, type TaskBeliefState, type TaskDependentListQuery, type TaskFileRef, type TaskHandler, type TaskItem, type TaskListFilter, type TaskMutationSnapshot, type TaskStore, type TaskWorkItem, type TaskWorkItemListFilter, type TaskWorkItemStore, type TeamAgentConfig, type TeamTeammateConfig, type Tenant, type TenantStatus, type TenantStore, type TestMcpServerToolsResponse, type Thread, type ThreadStore, type Timestamp, type ToolCall, type ToolConfig, type ToolExecutor, type ToolLatticeProtocol, type ToolMessage, type TopologyEdge, type TranscriptionResult, type TrustedRunContext, type UIComponent, UIComponentType, type UIConfig, type UILatticeProtocol, type UpdateAgentWebAppInput, type UpdateCapabilityBundleInput, type UpdateChannelInstallationRequest, type UpdateCollectionRequest, type UpdateDatabaseConfigRequest, type UpdateMcpServerConfigRequest, type UpdateMenuItemInput, type UpdateMetricsServerConfigRequest, type UpdateProjectCapabilityBundlesResult, type UpdateProjectRequest, type UpdateRunStepRequest, type UpdateTaskRequest, type UpdateTenantRequest, type UpdateUserRequest, type UpdateUserTenantLinkRequest, type UpdateWorkflowRunRequest, type UpdateWorkspaceRequest, type User, type UserMessage, type UserStatus, type UserStore, type UserTenantLink, type UserTenantLinkStore, type UserTenantRole, type VectorStoreConfig, type VectorStoreCreateParams, type VectorStoreLatticeProtocol, type VectorStoreProvider, type WechatChannelInstallationConfig, type WorkflowAgentConfig, type WorkflowRun, type WorkflowRunStatus, type WorkflowTrackingStore, type Workspace, type WorkspaceStore, type YamlAgentStep, type YamlMapStep, type YamlParallelBlock, type YamlTopLevelStep, type YamlWorkflow, assertGenericProjectConfig, descriptorDataValue, getSubAgentsFromConfig, getToolsFromConfig, hasTools, isA2ARemoteAgentConfig, isDeepAgentConfig, isExecutionResultEventKey, isProcessingAgentConfig, isProjectRoomEventId, isTeamAgentConfig, isWorkflowAgentConfig, parseAgentWebAppGenUIBlock, parseProjectRoomEventId, parseQueuedExecutionMode, parseTaskBeliefState, parseTrustedRunContext, replaceTaskBeliefState, requireProjectTaskWorkItemStore, snapshotExactArray, snapshotExactRecord, snapshotProjectRoomBotMembershipRealtime, snapshotProjectRoomMembershipRealtime, snapshotProjectRoomMessageRealtime, taskBeliefStatesEqual, toProjectRoomPublicBotMembership, toProjectRoomPublicMembership, toProjectRoomPublicMessage };