@axiom-lattice/protocols 4.1.0 → 4.1.2
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +1021 -26
- package/dist/index.d.ts +1021 -26
- package/dist/index.js +448 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +420 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
- package/src/BindingProtocol.ts +87 -11
- package/src/CapabilityBundleStoreProtocol.ts +78 -0
- package/src/CapabilityRuntimeProtocol.ts +82 -0
- package/src/ChannelInstallationStoreProtocol.ts +23 -4
- package/src/ExactDataSnapshot.ts +119 -0
- package/src/PluginProtocol.ts +59 -7
- package/src/ProjectBotMembershipStoreProtocol.ts +48 -0
- package/src/ProjectMembershipStoreProtocol.ts +58 -0
- package/src/ProjectRoomMessageStoreProtocol.ts +26 -0
- package/src/ProjectRoomProtocol.ts +143 -0
- package/src/ProjectRoomRealtimeProtocol.ts +349 -0
- package/src/ProjectRoomStoreProtocol.ts +16 -0
- package/src/SkillStoreProtocol.ts +30 -0
- package/src/TaskBeliefProtocol.ts +6 -1
- package/src/TaskStoreProtocol.ts +66 -2
- package/src/TaskWorkItemProtocol.ts +138 -0
- package/src/TrustedRunContextProtocol.ts +119 -0
- package/src/WorkspaceStoreProtocol.ts +33 -0
- package/src/__tests__/BindingProtocol.test.ts +36 -0
- package/src/__tests__/ExactDataSnapshot.test.ts +105 -0
- package/src/__tests__/ProjectRoomProtocol.test.ts +48 -0
- package/src/__tests__/ProjectRoomRealtimeProtocol.test.ts +185 -0
- package/src/__tests__/ProjectRoomStores.test.ts +363 -0
- package/src/__tests__/ProjectTaskProtocol.test.ts +29 -0
- package/src/__tests__/TaskWorkItemProtocol.test.ts +111 -0
- package/src/__tests__/TrustedRunContextProtocol.test.ts +265 -0
- package/src/__tests__/capability-bundle-types.test.ts +177 -0
- package/src/index.ts +13 -0
- package/tsconfig.type-tests.json +9 -0
- package/type-tests/task-work-item-store-compatibility.ts +37 -0
package/dist/index.d.ts
CHANGED
|
@@ -1478,6 +1478,34 @@ interface Skill {
|
|
|
1478
1478
|
* Creates a hierarchical tree structure for organizing skills
|
|
1479
1479
|
*/
|
|
1480
1480
|
subSkills?: string[];
|
|
1481
|
+
/**
|
|
1482
|
+
* Source of the skill (optional)
|
|
1483
|
+
* e.g. "builtin-plugin" for read-only plugin-provided skills
|
|
1484
|
+
*/
|
|
1485
|
+
source?: string;
|
|
1486
|
+
/**
|
|
1487
|
+
* Owning plugin type (optional)
|
|
1488
|
+
* Set for skills contributed by a registered plugin
|
|
1489
|
+
*/
|
|
1490
|
+
pluginType?: string;
|
|
1491
|
+
/**
|
|
1492
|
+
* Plugin skill bundle version (optional)
|
|
1493
|
+
* Set for skills contributed by a registered plugin
|
|
1494
|
+
*/
|
|
1495
|
+
version?: string;
|
|
1496
|
+
/**
|
|
1497
|
+
* Resource catalog (optional)
|
|
1498
|
+
* Safe relative paths of a plugin skill's bundled resources with their MIME types
|
|
1499
|
+
*/
|
|
1500
|
+
resourcePaths?: Array<{
|
|
1501
|
+
path: string;
|
|
1502
|
+
mimeType?: string;
|
|
1503
|
+
}>;
|
|
1504
|
+
/**
|
|
1505
|
+
* Read-only flag (optional)
|
|
1506
|
+
* True for immutable sources (e.g. plugin-provided skills) that cannot be created/updated/deleted
|
|
1507
|
+
*/
|
|
1508
|
+
readOnly?: boolean;
|
|
1481
1509
|
/**
|
|
1482
1510
|
* Skill creation timestamp
|
|
1483
1511
|
*/
|
|
@@ -2028,12 +2056,34 @@ interface UpdateProjectRequest {
|
|
|
2028
2056
|
/** Project classification */
|
|
2029
2057
|
kind?: ProjectKind;
|
|
2030
2058
|
}
|
|
2059
|
+
/** Error raised when generic project writes attempt to change capability Bundle references. */
|
|
2060
|
+
declare class InvalidProjectCapabilityBundleConfigError extends Error {
|
|
2061
|
+
/** Stable machine-readable error code. */
|
|
2062
|
+
readonly code: "INVALID_BUNDLE_CONFIG";
|
|
2063
|
+
/** Creates the reserved-config error returned by generic Project writes. */
|
|
2064
|
+
constructor();
|
|
2065
|
+
}
|
|
2066
|
+
/** Rejects capability Bundle references supplied through generic Project config writes. */
|
|
2067
|
+
declare function assertGenericProjectConfig(config: Record<string, unknown> | undefined): void;
|
|
2031
2068
|
/**
|
|
2032
2069
|
* Filter options for listing projects within a workspace
|
|
2033
2070
|
*/
|
|
2034
2071
|
interface ProjectFilter {
|
|
2035
2072
|
kind?: ProjectKind;
|
|
2036
2073
|
}
|
|
2074
|
+
/** Atomic result of replacing a Project's capability Bundle IDs. */
|
|
2075
|
+
type UpdateProjectCapabilityBundlesResult = {
|
|
2076
|
+
status: "updated";
|
|
2077
|
+
project: Project;
|
|
2078
|
+
} | {
|
|
2079
|
+
status: "project_not_found";
|
|
2080
|
+
} | {
|
|
2081
|
+
status: "bundle_not_found";
|
|
2082
|
+
} | {
|
|
2083
|
+
status: "bundle_conflict";
|
|
2084
|
+
};
|
|
2085
|
+
/** Revision preconditions for the bundles reviewed before project assignment. */
|
|
2086
|
+
type ExpectedCapabilityBundleRevisions = Record<string, string>;
|
|
2037
2087
|
/**
|
|
2038
2088
|
* ProjectStore interface
|
|
2039
2089
|
* Provides CRUD operations for project data
|
|
@@ -2043,7 +2093,11 @@ interface ProjectStore {
|
|
|
2043
2093
|
getProjectById(tenantId: string, id: string): Promise<Project | null>;
|
|
2044
2094
|
createProject(tenantId: string, workspaceId: string, id: string, data: CreateProjectRequest): Promise<Project>;
|
|
2045
2095
|
updateProject(tenantId: string, id: string, updates: UpdateProjectRequest): Promise<Project | null>;
|
|
2096
|
+
/** Omitted expectedRevisions is reserved for internal maintenance callers. */
|
|
2097
|
+
updateCapabilityBundleIds(tenantId: string, projectId: string, bundleIds: string[], expectedRevisions?: ExpectedCapabilityBundleRevisions): Promise<UpdateProjectCapabilityBundlesResult>;
|
|
2046
2098
|
deleteProject(tenantId: string, id: string): Promise<boolean>;
|
|
2099
|
+
/** Returns whether a tenant project references the given capability bundle. */
|
|
2100
|
+
isCapabilityBundleReferenced(tenantId: string, bundleId: string): Promise<boolean>;
|
|
2047
2101
|
}
|
|
2048
2102
|
|
|
2049
2103
|
/**
|
|
@@ -2288,7 +2342,11 @@ interface ConnectionStore {
|
|
|
2288
2342
|
delete(tenantId: string, type: string, key: string): Promise<boolean>;
|
|
2289
2343
|
}
|
|
2290
2344
|
|
|
2291
|
-
|
|
2345
|
+
/** Channel types persisted by the installation store, including internal-only channels. */
|
|
2346
|
+
type ChannelInstallationType = "lark" | "email" | "slack" | "wechat" | "room";
|
|
2347
|
+
/** Channel types exposed by the public installation management API. */
|
|
2348
|
+
type PublicChannelInstallationType = Exclude<ChannelInstallationType, "room">;
|
|
2349
|
+
/** Credentials and routing configuration for a Lark installation. */
|
|
2292
2350
|
interface LarkChannelInstallationConfig {
|
|
2293
2351
|
appId: string;
|
|
2294
2352
|
appSecret: string;
|
|
@@ -2296,10 +2354,12 @@ interface LarkChannelInstallationConfig {
|
|
|
2296
2354
|
encryptKey?: string;
|
|
2297
2355
|
assistantId?: string;
|
|
2298
2356
|
}
|
|
2357
|
+
/** Credentials and identity configuration for a WeChat installation. */
|
|
2299
2358
|
interface WechatChannelInstallationConfig {
|
|
2300
2359
|
botToken: string;
|
|
2301
2360
|
uin?: string;
|
|
2302
2361
|
}
|
|
2362
|
+
/** A persisted tenant-scoped channel installation. */
|
|
2303
2363
|
interface ChannelInstallation<TConfig = unknown> {
|
|
2304
2364
|
id: string;
|
|
2305
2365
|
tenantId: string;
|
|
@@ -2312,14 +2372,28 @@ interface ChannelInstallation<TConfig = unknown> {
|
|
|
2312
2372
|
createdAt: Date;
|
|
2313
2373
|
updatedAt: Date;
|
|
2314
2374
|
}
|
|
2315
|
-
|
|
2375
|
+
/** Internal input accepted by installation stores. */
|
|
2376
|
+
interface CreateChannelInstallationInput {
|
|
2316
2377
|
channel: ChannelInstallationType;
|
|
2317
2378
|
name?: string;
|
|
2318
|
-
config:
|
|
2379
|
+
config: Record<string, unknown>;
|
|
2319
2380
|
enabled?: boolean;
|
|
2320
2381
|
fallbackAgentId?: string;
|
|
2321
2382
|
rejectWhenNoBinding?: boolean;
|
|
2322
2383
|
}
|
|
2384
|
+
type PublicInstallationBase = Omit<CreateChannelInstallationInput, "channel" | "config">;
|
|
2385
|
+
/** Public create request with channel-specific configuration and no internal room variant. */
|
|
2386
|
+
type CreateChannelInstallationRequest = PublicInstallationBase & ({
|
|
2387
|
+
channel: "lark";
|
|
2388
|
+
config: LarkChannelInstallationConfig;
|
|
2389
|
+
} | {
|
|
2390
|
+
channel: "wechat";
|
|
2391
|
+
config: WechatChannelInstallationConfig;
|
|
2392
|
+
} | {
|
|
2393
|
+
channel: "email" | "slack";
|
|
2394
|
+
config: Record<string, unknown>;
|
|
2395
|
+
});
|
|
2396
|
+
/** Fields accepted when updating an existing public installation. */
|
|
2323
2397
|
interface UpdateChannelInstallationRequest {
|
|
2324
2398
|
name?: string;
|
|
2325
2399
|
config?: Record<string, unknown>;
|
|
@@ -2327,6 +2401,7 @@ interface UpdateChannelInstallationRequest {
|
|
|
2327
2401
|
fallbackAgentId?: string;
|
|
2328
2402
|
rejectWhenNoBinding?: boolean;
|
|
2329
2403
|
}
|
|
2404
|
+
/** Persistence boundary for tenant-scoped channel installations. */
|
|
2330
2405
|
interface ChannelInstallationStore {
|
|
2331
2406
|
getInstallationById(installationId: string): Promise<ChannelInstallation | null>;
|
|
2332
2407
|
getInstallationsByTenant(tenantId: string, channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
|
|
@@ -2335,7 +2410,7 @@ interface ChannelInstallationStore {
|
|
|
2335
2410
|
* 用于 connectAllChannels 等不需要按租户过滤的场景。
|
|
2336
2411
|
*/
|
|
2337
2412
|
getAllInstallations(channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
|
|
2338
|
-
createInstallation(tenantId: string, installationId: string, data:
|
|
2413
|
+
createInstallation(tenantId: string, installationId: string, data: CreateChannelInstallationInput): Promise<ChannelInstallation>;
|
|
2339
2414
|
updateInstallation(tenantId: string, installationId: string, updates: UpdateChannelInstallationRequest): Promise<ChannelInstallation | null>;
|
|
2340
2415
|
deleteInstallation(tenantId: string, installationId: string): Promise<boolean>;
|
|
2341
2416
|
}
|
|
@@ -3199,13 +3274,81 @@ interface CreateBindingInput {
|
|
|
3199
3274
|
tenantId: string;
|
|
3200
3275
|
senderId: string;
|
|
3201
3276
|
agentId: string;
|
|
3277
|
+
threadId?: string;
|
|
3202
3278
|
threadMode?: "fixed" | "per_conversation";
|
|
3203
3279
|
senderDisplayName?: string;
|
|
3204
3280
|
senderMetadata?: Record<string, unknown>;
|
|
3205
3281
|
workspaceId?: string;
|
|
3206
3282
|
projectId?: string;
|
|
3283
|
+
/** Whether the binding is eligible for inbound resolution immediately after creation. */
|
|
3284
|
+
enabled?: boolean;
|
|
3285
|
+
}
|
|
3286
|
+
/** Filters binding records before pagination is applied. */
|
|
3287
|
+
interface BindingListParams {
|
|
3288
|
+
tenantId: string;
|
|
3289
|
+
channel?: string;
|
|
3290
|
+
agentId?: string;
|
|
3291
|
+
channelInstallationId?: string;
|
|
3292
|
+
/** Installation ID prefixes excluded before pagination, for internal namespaces. */
|
|
3293
|
+
excludeInstallationIdPrefixes?: string[];
|
|
3294
|
+
excludeChannels?: string[];
|
|
3295
|
+
limit?: number;
|
|
3296
|
+
offset?: number;
|
|
3297
|
+
}
|
|
3298
|
+
/**
|
|
3299
|
+
* Fields that may change after a binding is created.
|
|
3300
|
+
*
|
|
3301
|
+
* Binding identity (`id`, tenant, channel, installation, sender, and timestamps) is intentionally
|
|
3302
|
+
* absent so every persistence backend can enforce tenant-scoped mutation without identity drift.
|
|
3303
|
+
*/
|
|
3304
|
+
interface BindingMutablePatch {
|
|
3305
|
+
/** Agent that receives messages for this subject. */
|
|
3306
|
+
agentId?: string;
|
|
3307
|
+
/** Fixed thread used when `threadMode` is `fixed`. */
|
|
3308
|
+
threadId?: string;
|
|
3309
|
+
/** Optional workspace execution scope. */
|
|
3310
|
+
workspaceId?: string;
|
|
3311
|
+
/** Optional project execution scope. */
|
|
3312
|
+
projectId?: string;
|
|
3313
|
+
/** Whether messages share one thread or create one per conversation. */
|
|
3314
|
+
threadMode?: "fixed" | "per_conversation";
|
|
3315
|
+
/** Human-readable sender label. */
|
|
3316
|
+
senderDisplayName?: string;
|
|
3317
|
+
/** Mutable sender metadata supplied by trusted internal callers. */
|
|
3318
|
+
senderMetadata?: Record<string, unknown>;
|
|
3319
|
+
/** Whether inbound resolution may use this binding. */
|
|
3320
|
+
enabled?: boolean;
|
|
3321
|
+
}
|
|
3322
|
+
/** Raised when a channel installation already has a binding for the same tenant and sender. */
|
|
3323
|
+
declare class DuplicateChannelBindingSubjectError extends Error {
|
|
3324
|
+
constructor();
|
|
3325
|
+
}
|
|
3326
|
+
/** A duplicate subject found while upgrading a local channel-binding database. */
|
|
3327
|
+
interface ChannelBindingMigrationConflict {
|
|
3328
|
+
tenantId: string;
|
|
3329
|
+
channel: string;
|
|
3330
|
+
channelInstallationId: string;
|
|
3331
|
+
senderId: string;
|
|
3332
|
+
count: number;
|
|
3333
|
+
}
|
|
3334
|
+
/**
|
|
3335
|
+
* Raised when a local binding uniqueness migration requires operator reconciliation.
|
|
3336
|
+
*
|
|
3337
|
+
* The conflict list contains only subject identifiers and row counts; binding metadata and other
|
|
3338
|
+
* potentially sensitive payloads are never included.
|
|
3339
|
+
*/
|
|
3340
|
+
declare class ChannelBindingMigrationConflictError extends Error {
|
|
3341
|
+
readonly conflicts: ChannelBindingMigrationConflict[];
|
|
3342
|
+
constructor(conflicts: ChannelBindingMigrationConflict[]);
|
|
3207
3343
|
}
|
|
3208
3344
|
interface BindingRegistry {
|
|
3345
|
+
findById(tenantId: string, id: string): Promise<Binding | null>;
|
|
3346
|
+
findBySubject(params: {
|
|
3347
|
+
tenantId: string;
|
|
3348
|
+
channel: string;
|
|
3349
|
+
channelInstallationId: string;
|
|
3350
|
+
senderId: string;
|
|
3351
|
+
}): Promise<Binding | null>;
|
|
3209
3352
|
resolve(params: {
|
|
3210
3353
|
channel: string;
|
|
3211
3354
|
senderId: string;
|
|
@@ -3213,17 +3356,10 @@ interface BindingRegistry {
|
|
|
3213
3356
|
tenantId: string;
|
|
3214
3357
|
}): Promise<Binding | null>;
|
|
3215
3358
|
create(binding: CreateBindingInput): Promise<Binding>;
|
|
3216
|
-
update(id: string, patch:
|
|
3217
|
-
delete(id: string): Promise<void>;
|
|
3218
|
-
list(params:
|
|
3219
|
-
|
|
3220
|
-
agentId?: string;
|
|
3221
|
-
tenantId: string;
|
|
3222
|
-
channelInstallationId?: string;
|
|
3223
|
-
limit?: number;
|
|
3224
|
-
offset?: number;
|
|
3225
|
-
}): Promise<Binding[]>;
|
|
3226
|
-
import(bindings: CreateBindingInput[]): Promise<Binding[]>;
|
|
3359
|
+
update(tenantId: string, id: string, patch: BindingMutablePatch): Promise<Binding>;
|
|
3360
|
+
delete(tenantId: string, id: string): Promise<void>;
|
|
3361
|
+
list(params: BindingListParams): Promise<Binding[]>;
|
|
3362
|
+
import(tenantId: string, bindings: CreateBindingInput[]): Promise<Binding[]>;
|
|
3227
3363
|
export(params: {
|
|
3228
3364
|
tenantId: string;
|
|
3229
3365
|
}): Promise<Binding[]>;
|
|
@@ -3978,9 +4114,10 @@ interface TaskListFilter {
|
|
|
3978
4114
|
*/
|
|
3979
4115
|
workspaceId?: string;
|
|
3980
4116
|
/**
|
|
3981
|
-
* Filter by project ID
|
|
4117
|
+
* Filter by project ID. `null` matches only absent, empty, or `default` projects;
|
|
4118
|
+
* `undefined` applies no project predicate.
|
|
3982
4119
|
*/
|
|
3983
|
-
projectId?: string;
|
|
4120
|
+
projectId?: string | null;
|
|
3984
4121
|
/**
|
|
3985
4122
|
* Filter by parent task ID
|
|
3986
4123
|
*/
|
|
@@ -4002,6 +4139,40 @@ interface TaskListFilter {
|
|
|
4002
4139
|
*/
|
|
4003
4140
|
offset?: number;
|
|
4004
4141
|
}
|
|
4142
|
+
/**
|
|
4143
|
+
* Exact scope and pagination for tasks that depend on another project task.
|
|
4144
|
+
*/
|
|
4145
|
+
interface TaskDependentListQuery {
|
|
4146
|
+
/** Tenant identifier. */
|
|
4147
|
+
tenantId: string;
|
|
4148
|
+
/** Workspace identifier. */
|
|
4149
|
+
workspaceId: string;
|
|
4150
|
+
/** Project identifier. */
|
|
4151
|
+
projectId: string;
|
|
4152
|
+
/** Identifier that must occur as a string in the dependency array. */
|
|
4153
|
+
dependencyTaskId: string;
|
|
4154
|
+
/** Nonempty statuses eligible for recovery. */
|
|
4155
|
+
statuses: TaskItem["status"][];
|
|
4156
|
+
/** Maximum rows to return, from 1 through 100. */
|
|
4157
|
+
limit: number;
|
|
4158
|
+
/** Number of matching rows to skip. */
|
|
4159
|
+
offset: number;
|
|
4160
|
+
}
|
|
4161
|
+
/** Exact mutable identity captured before a trusted task mutation. */
|
|
4162
|
+
interface TaskMutationSnapshot {
|
|
4163
|
+
/** Status observed during authorization. */
|
|
4164
|
+
status: TaskItem["status"];
|
|
4165
|
+
/** Update timestamp observed during authorization. */
|
|
4166
|
+
updatedAt: Date | string;
|
|
4167
|
+
/** Owner kind observed during authorization. */
|
|
4168
|
+
ownerType: TaskItem["ownerType"];
|
|
4169
|
+
/** Owner identifier observed during authorization. */
|
|
4170
|
+
ownerId: string;
|
|
4171
|
+
/** Exact workspace scope observed during authorization. */
|
|
4172
|
+
workspaceId: string | null;
|
|
4173
|
+
/** Exact Project scope observed during authorization. */
|
|
4174
|
+
projectId: string | null;
|
|
4175
|
+
}
|
|
4005
4176
|
/**
|
|
4006
4177
|
* TaskStore interface
|
|
4007
4178
|
* Provides CRUD operations for task data
|
|
@@ -4030,6 +4201,13 @@ interface TaskStore {
|
|
|
4030
4201
|
* @returns Array of matching tasks
|
|
4031
4202
|
*/
|
|
4032
4203
|
list(filter: TaskListFilter): Promise<TaskItem[]>;
|
|
4204
|
+
/**
|
|
4205
|
+
* Lists exact project tasks that depend on another task.
|
|
4206
|
+
*
|
|
4207
|
+
* @param query Exact scope, statuses, and bounded offset page.
|
|
4208
|
+
* @returns Matching tasks ordered by creation time and ID descending.
|
|
4209
|
+
*/
|
|
4210
|
+
listDependents(query: TaskDependentListQuery): Promise<TaskItem[]>;
|
|
4033
4211
|
/**
|
|
4034
4212
|
* Update an existing task
|
|
4035
4213
|
* @param tenantId Tenant identifier
|
|
@@ -4066,6 +4244,16 @@ interface TaskStore {
|
|
|
4066
4244
|
* @returns The updated task, or `null` when the task is missing or either snapshot predicate differs.
|
|
4067
4245
|
*/
|
|
4068
4246
|
updateIfStatusAndUpdatedAt(tenantId: string, id: string, updates: UpdateTaskRequest, expectedStatuses: TaskItem["status"][], expectedUpdatedAt: Date | string): Promise<TaskItem | null>;
|
|
4247
|
+
/**
|
|
4248
|
+
* Atomically updates a task only while its full trusted mutation snapshot matches.
|
|
4249
|
+
*
|
|
4250
|
+
* @param tenantId Tenant identifier.
|
|
4251
|
+
* @param id Task identifier.
|
|
4252
|
+
* @param updates Partial task data to update.
|
|
4253
|
+
* @param snapshot Exact status, timestamp, owner, and Project scope snapshot.
|
|
4254
|
+
* @returns Updated task, or `null` when any snapshot field differs.
|
|
4255
|
+
*/
|
|
4256
|
+
updateIfSnapshot(tenantId: string, id: string, updates: UpdateTaskRequest, snapshot: TaskMutationSnapshot): Promise<TaskItem | null>;
|
|
4069
4257
|
/**
|
|
4070
4258
|
* Atomically updates a child only when both child and parent snapshots match.
|
|
4071
4259
|
*
|
|
@@ -4079,6 +4267,8 @@ interface TaskStore {
|
|
|
4079
4267
|
* @returns The updated child, or `null` when either task is missing or either snapshot differs.
|
|
4080
4268
|
*/
|
|
4081
4269
|
updateIfStatusUpdatedAtAndParentUpdatedAt(tenantId: string, id: string, updates: UpdateTaskRequest, expectedStatuses: TaskItem["status"][], expectedUpdatedAt: Date | string, parentId: string, expectedParentUpdatedAt: Date | string): Promise<TaskItem | null>;
|
|
4270
|
+
/** Atomically deletes a task only while its full trusted mutation snapshot matches. */
|
|
4271
|
+
deleteIfSnapshot(tenantId: string, id: string, snapshot: TaskMutationSnapshot): Promise<boolean>;
|
|
4082
4272
|
/**
|
|
4083
4273
|
* Atomically update a task unless its current status is blocked.
|
|
4084
4274
|
*
|
|
@@ -4155,9 +4345,86 @@ interface TaskWorkItemListFilter {
|
|
|
4155
4345
|
limit?: number;
|
|
4156
4346
|
offset?: number;
|
|
4157
4347
|
}
|
|
4348
|
+
/** Canonical prefix for public task execution-result event identities. */
|
|
4349
|
+
declare const EXECUTION_RESULT_EVENT_KEY_PREFIX = "execution-result:";
|
|
4350
|
+
/**
|
|
4351
|
+
* Portable regular-expression source for canonical execution-result event keys.
|
|
4352
|
+
*
|
|
4353
|
+
* The entire key is the literal `execution-result:` prefix followed by a nonempty
|
|
4354
|
+
* suffix containing only ASCII letters, digits, period, underscore, colon, or hyphen.
|
|
4355
|
+
* Colon is intentionally allowed so callers can compose structured suffixes.
|
|
4356
|
+
*/
|
|
4357
|
+
declare const EXECUTION_RESULT_EVENT_KEY_PATTERN_SOURCE = "^execution-result:[A-Za-z0-9._:-]+$";
|
|
4358
|
+
/** Compiled runtime expression for canonical execution-result event keys. */
|
|
4359
|
+
declare const EXECUTION_RESULT_EVENT_KEY_PATTERN: RegExp;
|
|
4360
|
+
/** Maximum pending execution-result rows accepted by one store query. */
|
|
4361
|
+
declare const MAX_PENDING_EXECUTION_RESULTS_LIMIT = 1000;
|
|
4362
|
+
/**
|
|
4363
|
+
* Determines whether a runtime value is a canonical execution-result event key.
|
|
4364
|
+
*
|
|
4365
|
+
* @param value Runtime value to validate.
|
|
4366
|
+
* @returns True only for the portable canonical ASCII grammar.
|
|
4367
|
+
*/
|
|
4368
|
+
declare function isExecutionResultEventKey(value: unknown): value is string;
|
|
4369
|
+
/** Canonical lifecycle actions projected into Project Rooms. */
|
|
4370
|
+
declare const PROJECT_TASK_LIFECYCLE_ACTIONS: readonly ["in_progress", "interrupted", "failed", "completed", "cancelled", "reassigned"];
|
|
4371
|
+
/** Lifecycle action eligible for Project Room projection. */
|
|
4372
|
+
type ProjectTaskLifecycleAction = typeof PROJECT_TASK_LIFECYCLE_ACTIONS[number];
|
|
4373
|
+
/** Exclusive cursor for deterministic project lifecycle pagination. */
|
|
4374
|
+
interface ProjectLifecycleEventCursor {
|
|
4375
|
+
/** Creation timestamp of the last returned event. */
|
|
4376
|
+
createdAt: Date;
|
|
4377
|
+
/** Identifier of the last returned event. */
|
|
4378
|
+
id: string;
|
|
4379
|
+
}
|
|
4380
|
+
/** Exact project scope and bounded page for canonical lifecycle events. */
|
|
4381
|
+
interface ProjectLifecycleEventQuery {
|
|
4382
|
+
/** Tenant identifier. */
|
|
4383
|
+
tenantId: string;
|
|
4384
|
+
/** Workspace identifier. */
|
|
4385
|
+
workspaceId: string;
|
|
4386
|
+
/** Project identifier. */
|
|
4387
|
+
projectId: string;
|
|
4388
|
+
/** Nonempty lifecycle actions to include. */
|
|
4389
|
+
actions: ProjectTaskLifecycleAction[];
|
|
4390
|
+
/** Optional exclusive descending cursor. */
|
|
4391
|
+
before?: ProjectLifecycleEventCursor;
|
|
4392
|
+
/** Maximum rows to return, from 1 through 100. */
|
|
4393
|
+
limit: number;
|
|
4394
|
+
}
|
|
4158
4395
|
interface TaskWorkItemStore {
|
|
4159
4396
|
create(params: CreateWorkItemRequest): Promise<TaskWorkItem>;
|
|
4397
|
+
/** Atomically creates a work item only while the owning task snapshot matches. */
|
|
4398
|
+
createIfTaskSnapshot?(params: CreateWorkItemRequest, snapshot: TaskMutationSnapshot): Promise<TaskWorkItem | null>;
|
|
4160
4399
|
list(filter: TaskWorkItemListFilter): Promise<TaskWorkItem[]>;
|
|
4400
|
+
/**
|
|
4401
|
+
* List the newest bounded set of execution results awaiting reconciliation.
|
|
4402
|
+
*
|
|
4403
|
+
* Only `execution_result` items with a canonical ASCII
|
|
4404
|
+
* `execution-result:[A-Za-z0-9._:-]+` event key are returned. An item is excluded when
|
|
4405
|
+
* a task-scoped `execution_reconciled` item has a
|
|
4406
|
+
* `detail.executionResultId` equal to that event key. Results are ordered by
|
|
4407
|
+
* `createdAt` descending and then `id` descending for deterministic ties.
|
|
4408
|
+
*
|
|
4409
|
+
* @param params Tenant/task scope and required maximum number of rows.
|
|
4410
|
+
* @returns At most `limit` pending execution-result work items, newest first.
|
|
4411
|
+
* @throws RangeError with code `INVALID_LIMIT` unless limit is a safe integer from zero through
|
|
4412
|
+
* {@link MAX_PENDING_EXECUTION_RESULTS_LIMIT}.
|
|
4413
|
+
* @remarks Optional optimization. Stores that omit it remain compatible; callers may use a
|
|
4414
|
+
* bounded, non-authoritative fallback through the pre-existing list and event-key methods.
|
|
4415
|
+
*/
|
|
4416
|
+
listPendingExecutionResults?(params: {
|
|
4417
|
+
tenantId: string;
|
|
4418
|
+
taskId: string;
|
|
4419
|
+
limit: number;
|
|
4420
|
+
}): Promise<TaskWorkItem[]>;
|
|
4421
|
+
/**
|
|
4422
|
+
* Lists canonical lifecycle events in an exact project scope.
|
|
4423
|
+
*
|
|
4424
|
+
* @param query Exact scope, actions, exclusive cursor, and page bound.
|
|
4425
|
+
* @returns Events ordered by creation time and ID descending.
|
|
4426
|
+
*/
|
|
4427
|
+
listProjectLifecycleEvents?(query: ProjectLifecycleEventQuery): Promise<TaskWorkItem[]>;
|
|
4161
4428
|
/**
|
|
4162
4429
|
* Find an event by deterministic identity without list pagination.
|
|
4163
4430
|
*
|
|
@@ -4176,8 +4443,26 @@ interface TaskWorkItemStore {
|
|
|
4176
4443
|
*/
|
|
4177
4444
|
createIfAbsentByEventKey(params: CreateWorkItemIfAbsentRequest): Promise<TaskWorkItem>;
|
|
4178
4445
|
}
|
|
4446
|
+
/** Work-item capabilities required by trusted Project Task consumers. */
|
|
4447
|
+
interface ProjectTaskWorkItemStore extends TaskWorkItemStore {
|
|
4448
|
+
createIfTaskSnapshot(params: CreateWorkItemRequest, snapshot: TaskMutationSnapshot): Promise<TaskWorkItem | null>;
|
|
4449
|
+
listProjectLifecycleEvents(query: ProjectLifecycleEventQuery): Promise<TaskWorkItem[]>;
|
|
4450
|
+
}
|
|
4451
|
+
/** Stable capability failure raised before any trusted Project Task mutation. */
|
|
4452
|
+
declare class ProjectTaskStoreUnsupportedError extends Error {
|
|
4453
|
+
readonly missingMethods: readonly string[];
|
|
4454
|
+
readonly code: "PROJECT_TASK_STORE_UNSUPPORTED";
|
|
4455
|
+
constructor(missingMethods: readonly string[]);
|
|
4456
|
+
}
|
|
4457
|
+
/** Refines a Main-compatible WorkItem store for trusted Project Task consumers. */
|
|
4458
|
+
declare function requireProjectTaskWorkItemStore(store: TaskWorkItemStore): ProjectTaskWorkItemStore;
|
|
4179
4459
|
|
|
4180
|
-
/**
|
|
4460
|
+
/**
|
|
4461
|
+
* A single canonical belief recorded in a task description.
|
|
4462
|
+
*
|
|
4463
|
+
* `probability` is retained as the persisted field name, but task guidance uses
|
|
4464
|
+
* it as an evidence-support percentage rather than a calibrated probability.
|
|
4465
|
+
*/
|
|
4181
4466
|
interface TaskBeliefEntry {
|
|
4182
4467
|
key: string;
|
|
4183
4468
|
probability: number;
|
|
@@ -4653,6 +4938,617 @@ type AgentWebAppStreamEvent = {
|
|
|
4653
4938
|
/** Validate and copy one strict public GenUI block at a trust boundary. */
|
|
4654
4939
|
declare function parseAgentWebAppGenUIBlock(value: unknown): AgentWebAppGenUIBlock | undefined;
|
|
4655
4940
|
|
|
4941
|
+
/**
|
|
4942
|
+
* Capability bundle persistence protocol.
|
|
4943
|
+
*
|
|
4944
|
+
* A capability bundle is a tenant-scoped, flat collection of middleware
|
|
4945
|
+
* configurations that can be selected by a project.
|
|
4946
|
+
*/
|
|
4947
|
+
|
|
4948
|
+
/** A tenant-scoped collection of middleware configurations. */
|
|
4949
|
+
interface CapabilityBundle {
|
|
4950
|
+
/** Stable bundle identifier. */
|
|
4951
|
+
readonly id: string;
|
|
4952
|
+
/** Tenant that owns the bundle. */
|
|
4953
|
+
tenantId: string;
|
|
4954
|
+
/** Tenant-local unique key. */
|
|
4955
|
+
key: string;
|
|
4956
|
+
/** Human-readable bundle name. */
|
|
4957
|
+
name: string;
|
|
4958
|
+
/** Optional bundle description. */
|
|
4959
|
+
description?: string;
|
|
4960
|
+
/** Middleware configurations contained in the bundle. */
|
|
4961
|
+
capabilities: AgentMiddlewareConfig[];
|
|
4962
|
+
/** Creation timestamp in ISO string format. */
|
|
4963
|
+
createdAt: string;
|
|
4964
|
+
/** Last update timestamp in ISO string format. */
|
|
4965
|
+
updatedAt: string;
|
|
4966
|
+
}
|
|
4967
|
+
/** Public input used to create a capability bundle; the tenant-local key is generated internally. */
|
|
4968
|
+
interface CreateCapabilityBundleInput {
|
|
4969
|
+
/** Human-readable bundle name. */
|
|
4970
|
+
name: string;
|
|
4971
|
+
/** Optional bundle description. */
|
|
4972
|
+
description?: string;
|
|
4973
|
+
/** Middleware configurations contained in the bundle. */
|
|
4974
|
+
capabilities: AgentMiddlewareConfig[];
|
|
4975
|
+
}
|
|
4976
|
+
/** Input with a generated key used by persistence implementations. */
|
|
4977
|
+
interface InternalCreateCapabilityBundleInput extends Omit<CreateCapabilityBundleInput, "key"> {
|
|
4978
|
+
key: string;
|
|
4979
|
+
}
|
|
4980
|
+
/** Public partial bundle update; the stable key is immutable and the revision is mandatory for gateway updates. */
|
|
4981
|
+
interface UpdateCapabilityBundleInput extends Partial<CreateCapabilityBundleInput> {
|
|
4982
|
+
expectedUpdatedAt: string;
|
|
4983
|
+
}
|
|
4984
|
+
/** Store input retained for internal maintenance callers that may omit CAS. */
|
|
4985
|
+
interface InternalUpdateCapabilityBundleInput extends Partial<CreateCapabilityBundleInput> {
|
|
4986
|
+
expectedUpdatedAt?: string;
|
|
4987
|
+
}
|
|
4988
|
+
/** Result returned when an update's expected revision no longer matches. */
|
|
4989
|
+
interface CapabilityBundleUpdateConflict {
|
|
4990
|
+
status: "conflict";
|
|
4991
|
+
}
|
|
4992
|
+
/** Result of deleting a bundle only when no tenant project references it. */
|
|
4993
|
+
type CapabilityBundleDeleteResult = "deleted" | "not_found" | "in_use";
|
|
4994
|
+
/** Persistence operations for tenant-scoped capability bundles. */
|
|
4995
|
+
interface CapabilityBundleStore {
|
|
4996
|
+
/** Lists all bundles owned by a tenant. */
|
|
4997
|
+
listByTenant(tenantId: string): Promise<CapabilityBundle[]>;
|
|
4998
|
+
/** Gets one bundle by tenant and identifier. */
|
|
4999
|
+
getById(tenantId: string, id: string): Promise<CapabilityBundle | null>;
|
|
5000
|
+
/** Gets bundles by tenant and identifiers. */
|
|
5001
|
+
getManyByIds(tenantId: string, ids: string[]): Promise<CapabilityBundle[]>;
|
|
5002
|
+
/** Creates a bundle for a tenant. */
|
|
5003
|
+
create(tenantId: string, input: InternalCreateCapabilityBundleInput): Promise<CapabilityBundle>;
|
|
5004
|
+
/** Updates a bundle, or returns null when it does not exist. */
|
|
5005
|
+
/** Omitted expectedUpdatedAt is reserved for internal maintenance callers. */
|
|
5006
|
+
update(tenantId: string, id: string, input: InternalUpdateCapabilityBundleInput): Promise<CapabilityBundle | CapabilityBundleUpdateConflict | null>;
|
|
5007
|
+
/** Atomically deletes a bundle unless a tenant project references it. */
|
|
5008
|
+
deleteIfUnreferenced(tenantId: string, id: string): Promise<CapabilityBundleDeleteResult>;
|
|
5009
|
+
}
|
|
5010
|
+
|
|
5011
|
+
/**
|
|
5012
|
+
* Capability runtime and preview protocol definitions.
|
|
5013
|
+
*
|
|
5014
|
+
* These contracts describe the resolved middleware runtime and the
|
|
5015
|
+
* provenance data exposed while composing project bundles.
|
|
5016
|
+
*/
|
|
5017
|
+
|
|
5018
|
+
/** Project configuration selecting ordered capability bundles. */
|
|
5019
|
+
interface ProjectCapabilityConfig {
|
|
5020
|
+
/** Bundle identifiers in composition order. */
|
|
5021
|
+
capabilityBundleIds: string[];
|
|
5022
|
+
}
|
|
5023
|
+
/** Resolved middleware available to an agent execution. */
|
|
5024
|
+
interface CapabilityRuntime {
|
|
5025
|
+
/** Revision identifying the resolved capability set. */
|
|
5026
|
+
revision: string;
|
|
5027
|
+
/** Middleware indexed by middleware identifier. */
|
|
5028
|
+
middleware: Record<string, AgentMiddlewareConfig>;
|
|
5029
|
+
}
|
|
5030
|
+
/** Provenance for a resolved capability field. */
|
|
5031
|
+
interface CapabilityFieldSource {
|
|
5032
|
+
/** Middleware type owning the field. */
|
|
5033
|
+
capabilityType: string;
|
|
5034
|
+
/** RFC 6901 escaped JSON Pointer path of the field within the middleware configuration. */
|
|
5035
|
+
fieldPath: string;
|
|
5036
|
+
/** Bundle that supplied the field value. */
|
|
5037
|
+
sourceBundleId: string;
|
|
5038
|
+
/** Supplied field value. */
|
|
5039
|
+
value: unknown;
|
|
5040
|
+
}
|
|
5041
|
+
/** A later bundle value replacing an earlier field value. */
|
|
5042
|
+
interface CapabilityOverride {
|
|
5043
|
+
/** Middleware type owning the field. */
|
|
5044
|
+
capabilityType: string;
|
|
5045
|
+
/** RFC 6901 escaped JSON Pointer path of the overridden field. */
|
|
5046
|
+
fieldPath: string;
|
|
5047
|
+
/** Value supplied by the earlier bundle. */
|
|
5048
|
+
previousValue: unknown;
|
|
5049
|
+
/** Value supplied by the later bundle. */
|
|
5050
|
+
nextValue: unknown;
|
|
5051
|
+
/** Bundle that supplied the later value. */
|
|
5052
|
+
sourceBundleId: string;
|
|
5053
|
+
}
|
|
5054
|
+
/** A warning or error produced while previewing bundle composition. */
|
|
5055
|
+
interface CapabilityPreviewIssue {
|
|
5056
|
+
/** Stable issue code. */
|
|
5057
|
+
code: string;
|
|
5058
|
+
/** Human-readable issue description. */
|
|
5059
|
+
message: string;
|
|
5060
|
+
/** Related bundle, when applicable. */
|
|
5061
|
+
bundleId?: string;
|
|
5062
|
+
/** Related middleware type, when applicable. */
|
|
5063
|
+
capabilityType?: string;
|
|
5064
|
+
/** Related middleware field path, when applicable. */
|
|
5065
|
+
fieldPath?: string;
|
|
5066
|
+
}
|
|
5067
|
+
/** Result of composing capability bundles for a project. */
|
|
5068
|
+
interface CapabilityPreview {
|
|
5069
|
+
/** Bundle identifiers in composition order. */
|
|
5070
|
+
bundleIds: string[];
|
|
5071
|
+
/** Composed middleware configurations. */
|
|
5072
|
+
capabilities: AgentMiddlewareConfig[];
|
|
5073
|
+
/** Field replacements detected during composition. */
|
|
5074
|
+
overrides: CapabilityOverride[];
|
|
5075
|
+
/** Field-level provenance for composed values. */
|
|
5076
|
+
sources: CapabilityFieldSource[];
|
|
5077
|
+
/** Non-blocking composition issues. */
|
|
5078
|
+
warnings: CapabilityPreviewIssue[];
|
|
5079
|
+
/** Blocking composition issues. */
|
|
5080
|
+
errors: CapabilityPreviewIssue[];
|
|
5081
|
+
/** Revision identifying this preview. */
|
|
5082
|
+
revision: string;
|
|
5083
|
+
/** Bundle content revisions captured by this preview. */
|
|
5084
|
+
bundleRevisions?: Record<string, string>;
|
|
5085
|
+
}
|
|
5086
|
+
|
|
5087
|
+
/** Human access roles available within a project. */
|
|
5088
|
+
type ProjectHumanRole = "owner" | "admin" | "member" | "viewer";
|
|
5089
|
+
/** Lifecycle states for a human project membership. */
|
|
5090
|
+
type ProjectMembershipStatus = "active" | "removed";
|
|
5091
|
+
/** Roles a bot can hold within a project room. */
|
|
5092
|
+
type ProjectBotRole = "coordinator" | "specialist";
|
|
5093
|
+
/** Lifecycle states for a bot room membership. */
|
|
5094
|
+
type ProjectBotMembershipStatus = "active" | "paused" | "removed";
|
|
5095
|
+
/** Origins supported by project room messages. */
|
|
5096
|
+
type ProjectRoomMessageSource = "user" | "agent" | "task" | "routine" | "system";
|
|
5097
|
+
/** The main room associated with a project. */
|
|
5098
|
+
interface ProjectRoom {
|
|
5099
|
+
id: string;
|
|
5100
|
+
tenantId: string;
|
|
5101
|
+
workspaceId: string;
|
|
5102
|
+
projectId: string;
|
|
5103
|
+
type: "main";
|
|
5104
|
+
name: string;
|
|
5105
|
+
createdAt: Date;
|
|
5106
|
+
updatedAt: Date;
|
|
5107
|
+
}
|
|
5108
|
+
/** A user's membership and access role within a project. */
|
|
5109
|
+
interface ProjectMembership {
|
|
5110
|
+
id: string;
|
|
5111
|
+
tenantId: string;
|
|
5112
|
+
projectId: string;
|
|
5113
|
+
userId: string;
|
|
5114
|
+
role: ProjectHumanRole;
|
|
5115
|
+
status: ProjectMembershipStatus;
|
|
5116
|
+
joinedAt: Date;
|
|
5117
|
+
updatedAt: Date;
|
|
5118
|
+
}
|
|
5119
|
+
/** A bot's role, presentation, and execution thread within a project room. */
|
|
5120
|
+
interface ProjectBotMembership {
|
|
5121
|
+
id: string;
|
|
5122
|
+
tenantId: string;
|
|
5123
|
+
workspaceId: string;
|
|
5124
|
+
projectId: string;
|
|
5125
|
+
roomId: string;
|
|
5126
|
+
assistantId: string;
|
|
5127
|
+
role: ProjectBotRole;
|
|
5128
|
+
title: string;
|
|
5129
|
+
responsibility?: string;
|
|
5130
|
+
mentionName: string;
|
|
5131
|
+
status: ProjectBotMembershipStatus;
|
|
5132
|
+
roomThreadId: string;
|
|
5133
|
+
joinedAt: Date;
|
|
5134
|
+
updatedAt: Date;
|
|
5135
|
+
}
|
|
5136
|
+
/** Identifies a human author of a project room message. */
|
|
5137
|
+
interface ProjectRoomMessageHumanAuthor {
|
|
5138
|
+
type: "human";
|
|
5139
|
+
userId: string;
|
|
5140
|
+
}
|
|
5141
|
+
/** Identifies a bot membership as the author of a project room message. */
|
|
5142
|
+
interface ProjectRoomMessageBotAuthor {
|
|
5143
|
+
type: "bot";
|
|
5144
|
+
membershipId: string;
|
|
5145
|
+
assistantId: string;
|
|
5146
|
+
}
|
|
5147
|
+
/** Identifies the system as the author of a project room message. */
|
|
5148
|
+
interface ProjectRoomMessageSystemAuthor {
|
|
5149
|
+
type: "system";
|
|
5150
|
+
}
|
|
5151
|
+
/** The discriminated author variants supported by project room messages. */
|
|
5152
|
+
type ProjectRoomMessageAuthor = ProjectRoomMessageHumanAuthor | ProjectRoomMessageBotAuthor | ProjectRoomMessageSystemAuthor;
|
|
5153
|
+
/** A bot or the whole team targeted by a room message. */
|
|
5154
|
+
type ProjectRoomMention = {
|
|
5155
|
+
type: "bot";
|
|
5156
|
+
membershipId: string;
|
|
5157
|
+
} | {
|
|
5158
|
+
type: "team";
|
|
5159
|
+
};
|
|
5160
|
+
/** Text payload carried by a project room message. */
|
|
5161
|
+
interface ProjectRoomTextContent {
|
|
5162
|
+
type: "text";
|
|
5163
|
+
text: string;
|
|
5164
|
+
}
|
|
5165
|
+
/** A message posted to a project room. */
|
|
5166
|
+
interface ProjectRoomMessage {
|
|
5167
|
+
id: string;
|
|
5168
|
+
tenantId: string;
|
|
5169
|
+
workspaceId: string;
|
|
5170
|
+
projectId: string;
|
|
5171
|
+
roomId: string;
|
|
5172
|
+
author: ProjectRoomMessageAuthor;
|
|
5173
|
+
content: ProjectRoomTextContent;
|
|
5174
|
+
mentions: ProjectRoomMention[];
|
|
5175
|
+
replyToMessageId?: string;
|
|
5176
|
+
source: ProjectRoomMessageSource;
|
|
5177
|
+
sourceId?: string;
|
|
5178
|
+
idempotencyKey?: string;
|
|
5179
|
+
createdAt: Date;
|
|
5180
|
+
}
|
|
5181
|
+
/** Stable position used to page through project room messages. */
|
|
5182
|
+
interface ProjectRoomMessageCursor {
|
|
5183
|
+
createdAt: Date;
|
|
5184
|
+
id: string;
|
|
5185
|
+
}
|
|
5186
|
+
/** Metadata linking a room-presence thread to its project room bot membership. */
|
|
5187
|
+
interface ProjectRoomThreadMetadata {
|
|
5188
|
+
source: "project_room";
|
|
5189
|
+
kind: "room_presence";
|
|
5190
|
+
workspaceId: string;
|
|
5191
|
+
projectId: string;
|
|
5192
|
+
roomId: string;
|
|
5193
|
+
membershipId: string;
|
|
5194
|
+
assistantId: string;
|
|
5195
|
+
}
|
|
5196
|
+
/** Metadata linking a task-execution thread to its owning project task and bot membership. */
|
|
5197
|
+
interface ProjectTaskThreadMetadata {
|
|
5198
|
+
source: "project_task";
|
|
5199
|
+
kind: "task_execution";
|
|
5200
|
+
workspaceId: string;
|
|
5201
|
+
projectId: string;
|
|
5202
|
+
roomId: string;
|
|
5203
|
+
membershipId: string;
|
|
5204
|
+
assistantId: string;
|
|
5205
|
+
taskId: string;
|
|
5206
|
+
parentTaskId?: string;
|
|
5207
|
+
}
|
|
5208
|
+
|
|
5209
|
+
/** Persistence operations for a project's canonical main room. */
|
|
5210
|
+
interface ProjectRoomStore {
|
|
5211
|
+
/** Creates the main room if needed and returns the canonical record. */
|
|
5212
|
+
ensureMainRoom(input: {
|
|
5213
|
+
id: string;
|
|
5214
|
+
tenantId: string;
|
|
5215
|
+
workspaceId: string;
|
|
5216
|
+
projectId: string;
|
|
5217
|
+
name: string;
|
|
5218
|
+
}): Promise<ProjectRoom>;
|
|
5219
|
+
/** Finds the main room for a project, if one exists. */
|
|
5220
|
+
getMainRoom(tenantId: string, projectId: string): Promise<ProjectRoom | null>;
|
|
5221
|
+
}
|
|
5222
|
+
|
|
5223
|
+
/** Result of an atomic human membership mutation, including its committed row. */
|
|
5224
|
+
type ProjectMembershipMutationResult = {
|
|
5225
|
+
kind: "updated" | "removed";
|
|
5226
|
+
membership: ProjectMembership;
|
|
5227
|
+
} | {
|
|
5228
|
+
kind: "not_found" | "conflict" | "last_owner";
|
|
5229
|
+
};
|
|
5230
|
+
/** Persistence operations for human membership in a project. */
|
|
5231
|
+
interface ProjectMembershipStore {
|
|
5232
|
+
/** Lists memberships belonging to a project. */
|
|
5233
|
+
list(tenantId: string, projectId: string): Promise<ProjectMembership[]>;
|
|
5234
|
+
/** Finds a user's membership in a project, if one exists. */
|
|
5235
|
+
findByUser(tenantId: string, projectId: string, userId: string): Promise<ProjectMembership | null>;
|
|
5236
|
+
/** Creates a project membership. */
|
|
5237
|
+
create(input: Omit<ProjectMembership, "joinedAt" | "updatedAt">): Promise<ProjectMembership>;
|
|
5238
|
+
/**
|
|
5239
|
+
* Atomically initializes an empty Project with its first owner.
|
|
5240
|
+
* `created` means this call initialized the Project; `existing` means the
|
|
5241
|
+
* requested user already owns the initialized Project and this was an
|
|
5242
|
+
* idempotent retry; `already_initialized` means membership rows exist but
|
|
5243
|
+
* this call did not produce either initial-owner outcome.
|
|
5244
|
+
*/
|
|
5245
|
+
createInitialOwner(input: Omit<ProjectMembership, "role" | "status" | "joinedAt" | "updatedAt">): Promise<{
|
|
5246
|
+
kind: "created" | "existing";
|
|
5247
|
+
membership: ProjectMembership;
|
|
5248
|
+
} | {
|
|
5249
|
+
kind: "already_initialized";
|
|
5250
|
+
}>;
|
|
5251
|
+
/**
|
|
5252
|
+
* Updates a role within the tenant using optimistic concurrency and owner
|
|
5253
|
+
* safeguards. `not_found` means the membership is not in the tenant;
|
|
5254
|
+
* `conflict` means `updatedAt` differs from `expectedUpdatedAt`.
|
|
5255
|
+
*/
|
|
5256
|
+
updateRole(input: {
|
|
5257
|
+
tenantId: string;
|
|
5258
|
+
id: string;
|
|
5259
|
+
role: ProjectHumanRole;
|
|
5260
|
+
expectedUpdatedAt: Date;
|
|
5261
|
+
}): Promise<ProjectMembershipMutationResult>;
|
|
5262
|
+
/**
|
|
5263
|
+
* Removes a membership within the tenant using optimistic concurrency and
|
|
5264
|
+
* owner safeguards. `not_found` means the membership is not in the tenant;
|
|
5265
|
+
* `conflict` means `updatedAt` differs from `expectedUpdatedAt`.
|
|
5266
|
+
*/
|
|
5267
|
+
remove(input: {
|
|
5268
|
+
tenantId: string;
|
|
5269
|
+
id: string;
|
|
5270
|
+
expectedUpdatedAt: Date;
|
|
5271
|
+
}): Promise<ProjectMembershipMutationResult>;
|
|
5272
|
+
}
|
|
5273
|
+
|
|
5274
|
+
/** Persistence operations for bot membership in a project room. */
|
|
5275
|
+
interface ProjectBotMembershipStore {
|
|
5276
|
+
/** Lists bot memberships belonging to a project. */
|
|
5277
|
+
list(tenantId: string, projectId: string): Promise<ProjectBotMembership[]>;
|
|
5278
|
+
/** Finds a bot membership by identifier within a tenant. */
|
|
5279
|
+
findById(tenantId: string, id: string): Promise<ProjectBotMembership | null>;
|
|
5280
|
+
/** Finds a bot membership by assistant within a project. */
|
|
5281
|
+
findByAssistant(tenantId: string, projectId: string, assistantId: string): Promise<ProjectBotMembership | null>;
|
|
5282
|
+
/**
|
|
5283
|
+
* Saves a bot membership. A new row returns `created`, an existing active or
|
|
5284
|
+
* paused row returns `updated`, and a removed row returns `reactivated`.
|
|
5285
|
+
* `coordinator_conflict` means a non-removed
|
|
5286
|
+
* coordinator already exists for the Tenant+Project; `mention_conflict`
|
|
5287
|
+
* means the mention name is already used by an active or paused membership
|
|
5288
|
+
* in the Tenant+room.
|
|
5289
|
+
*/
|
|
5290
|
+
save(input: Omit<ProjectBotMembership, "joinedAt" | "updatedAt">): Promise<{
|
|
5291
|
+
kind: "created" | "updated" | "reactivated";
|
|
5292
|
+
membership: ProjectBotMembership;
|
|
5293
|
+
} | {
|
|
5294
|
+
kind: "coordinator_conflict" | "mention_conflict";
|
|
5295
|
+
}>;
|
|
5296
|
+
/**
|
|
5297
|
+
* Updates a bot membership using optimistic concurrency and uniqueness
|
|
5298
|
+
* safeguards. `not_found` means the membership is not in the tenant;
|
|
5299
|
+
* `conflict` means `updatedAt` differs from `expectedUpdatedAt`.
|
|
5300
|
+
* `coordinator_conflict` applies to the one non-removed Coordinator per
|
|
5301
|
+
* Tenant+Project rule; `mention_conflict` applies to mention uniqueness
|
|
5302
|
+
* among active and paused memberships in the Tenant+room.
|
|
5303
|
+
*/
|
|
5304
|
+
update(input: {
|
|
5305
|
+
tenantId: string;
|
|
5306
|
+
id: string;
|
|
5307
|
+
patch: Partial<Pick<ProjectBotMembership, "role" | "title" | "responsibility" | "mentionName" | "status">>;
|
|
5308
|
+
expectedUpdatedAt: Date;
|
|
5309
|
+
}): Promise<{
|
|
5310
|
+
kind: "updated";
|
|
5311
|
+
membership: ProjectBotMembership;
|
|
5312
|
+
} | {
|
|
5313
|
+
kind: "not_found" | "conflict" | "coordinator_conflict" | "mention_conflict";
|
|
5314
|
+
}>;
|
|
5315
|
+
}
|
|
5316
|
+
|
|
5317
|
+
/** Persistence operations for messages in a project room. */
|
|
5318
|
+
interface ProjectRoomMessageStore {
|
|
5319
|
+
/** Creates a room message. */
|
|
5320
|
+
create(input: Omit<ProjectRoomMessage, "createdAt">): Promise<ProjectRoomMessage>;
|
|
5321
|
+
/** Creates or returns the existing room message for an idempotency key. */
|
|
5322
|
+
createIdempotent(input: Omit<ProjectRoomMessage, "createdAt"> & {
|
|
5323
|
+
idempotencyKey: string;
|
|
5324
|
+
}): Promise<ProjectRoomMessage>;
|
|
5325
|
+
/** Lists messages strictly before an optional cursor, up to the requested limit. */
|
|
5326
|
+
list(input: {
|
|
5327
|
+
tenantId: string;
|
|
5328
|
+
roomId: string;
|
|
5329
|
+
before?: ProjectRoomMessageCursor;
|
|
5330
|
+
limit: number;
|
|
5331
|
+
}): Promise<ProjectRoomMessage[]>;
|
|
5332
|
+
/** Finds a room message by identifier within a tenant. */
|
|
5333
|
+
findById(tenantId: string, id: string): Promise<ProjectRoomMessage | null>;
|
|
5334
|
+
}
|
|
5335
|
+
|
|
5336
|
+
/** A safely extracted value from an own enumerable data-property descriptor. */
|
|
5337
|
+
interface DescriptorDataValue {
|
|
5338
|
+
ok: true;
|
|
5339
|
+
value: unknown;
|
|
5340
|
+
}
|
|
5341
|
+
/**
|
|
5342
|
+
* Reads an own enumerable data-property descriptor without consulting its prototype.
|
|
5343
|
+
*
|
|
5344
|
+
* @param descriptor Property descriptor to inspect.
|
|
5345
|
+
* @returns The descriptor value when it is an own enumerable data descriptor, otherwise `undefined`.
|
|
5346
|
+
*/
|
|
5347
|
+
declare function descriptorDataValue(descriptor: unknown): DescriptorDataValue | undefined;
|
|
5348
|
+
/**
|
|
5349
|
+
* Copies an object-like value into a local plain record using only exact own enumerable data descriptors.
|
|
5350
|
+
*
|
|
5351
|
+
* Prototypes are deliberately ignored so records from other JavaScript realms remain valid and inherited
|
|
5352
|
+
* behavior can never participate in validation.
|
|
5353
|
+
*
|
|
5354
|
+
* @param value Untrusted value to snapshot.
|
|
5355
|
+
* @param required Own string keys that must be present.
|
|
5356
|
+
* @param optional Own string keys that may be present.
|
|
5357
|
+
* @returns A canonical local record, or `undefined` for malformed descriptors, keys, arrays, or proxies.
|
|
5358
|
+
*/
|
|
5359
|
+
declare function snapshotExactRecord(value: unknown, required: readonly string[], optional?: readonly string[]): Record<string, unknown> | undefined;
|
|
5360
|
+
/**
|
|
5361
|
+
* Copies a dense cross-realm array using only own element data descriptors and the intrinsic length descriptor.
|
|
5362
|
+
*
|
|
5363
|
+
* @param value Untrusted value to snapshot.
|
|
5364
|
+
* @returns A canonical local dense array, or `undefined` for holes, extras, accessors, or malformed proxies.
|
|
5365
|
+
*/
|
|
5366
|
+
declare function snapshotExactArray(value: unknown): unknown[] | undefined;
|
|
5367
|
+
|
|
5368
|
+
/** A message shape safe to expose to Project Room clients. */
|
|
5369
|
+
interface ProjectRoomPublicMessage {
|
|
5370
|
+
id: string;
|
|
5371
|
+
roomId: string;
|
|
5372
|
+
author: {
|
|
5373
|
+
type: "human";
|
|
5374
|
+
userId: string;
|
|
5375
|
+
} | {
|
|
5376
|
+
type: "bot";
|
|
5377
|
+
membershipId: string;
|
|
5378
|
+
} | {
|
|
5379
|
+
type: "system";
|
|
5380
|
+
};
|
|
5381
|
+
content: {
|
|
5382
|
+
type: "text";
|
|
5383
|
+
text: string;
|
|
5384
|
+
};
|
|
5385
|
+
mentions: ProjectRoomMention[];
|
|
5386
|
+
replyToMessageId?: string;
|
|
5387
|
+
source: ProjectRoomMessageSource;
|
|
5388
|
+
createdAt: string;
|
|
5389
|
+
}
|
|
5390
|
+
/** A human membership shape safe to expose to Project Room clients. */
|
|
5391
|
+
interface ProjectRoomPublicMembership {
|
|
5392
|
+
id: string;
|
|
5393
|
+
userId: string;
|
|
5394
|
+
role: ProjectHumanRole;
|
|
5395
|
+
status: ProjectMembershipStatus;
|
|
5396
|
+
joinedAt: string;
|
|
5397
|
+
updatedAt: string;
|
|
5398
|
+
}
|
|
5399
|
+
/** A bot membership shape safe to expose to Project Room clients. */
|
|
5400
|
+
interface ProjectRoomPublicBotMembership {
|
|
5401
|
+
id: string;
|
|
5402
|
+
role: ProjectBotRole;
|
|
5403
|
+
title: string;
|
|
5404
|
+
responsibility?: string;
|
|
5405
|
+
mentionName: string;
|
|
5406
|
+
status: ProjectBotMembershipStatus;
|
|
5407
|
+
joinedAt: string;
|
|
5408
|
+
updatedAt: string;
|
|
5409
|
+
}
|
|
5410
|
+
/** A fully identified business event carried by the realtime stream. */
|
|
5411
|
+
interface ProjectRoomEventOf<TType extends string, TData> {
|
|
5412
|
+
id: string;
|
|
5413
|
+
type: TType;
|
|
5414
|
+
occurredAt: string;
|
|
5415
|
+
data: TData;
|
|
5416
|
+
}
|
|
5417
|
+
/** A newly committed message event. */
|
|
5418
|
+
type ProjectRoomMessageCreatedEvent = ProjectRoomEventOf<"message.created", {
|
|
5419
|
+
message: ProjectRoomPublicMessage;
|
|
5420
|
+
}>;
|
|
5421
|
+
/** A changed bot roster event. */
|
|
5422
|
+
type ProjectRoomRosterChangedEvent = ProjectRoomEventOf<"roster.changed", {
|
|
5423
|
+
change: "added" | "updated" | "paused" | "resumed" | "removed";
|
|
5424
|
+
membership: ProjectRoomPublicBotMembership;
|
|
5425
|
+
}>;
|
|
5426
|
+
/** A changed human membership event. */
|
|
5427
|
+
type ProjectRoomMembershipChangedEvent = ProjectRoomEventOf<"membership.changed", {
|
|
5428
|
+
change: "added" | "role_changed" | "removed";
|
|
5429
|
+
membership: ProjectRoomPublicMembership;
|
|
5430
|
+
}>;
|
|
5431
|
+
/** A changed Project Task fact event. */
|
|
5432
|
+
type ProjectRoomTaskChangedEvent = ProjectRoomEventOf<"task.changed", {
|
|
5433
|
+
taskId: string;
|
|
5434
|
+
status: TaskItem["status"];
|
|
5435
|
+
ownerMembershipId: string;
|
|
5436
|
+
updatedAt: string;
|
|
5437
|
+
}>;
|
|
5438
|
+
/** All identified business events retained by the realtime broker. */
|
|
5439
|
+
type ProjectRoomBusinessEvent = ProjectRoomMessageCreatedEvent | ProjectRoomRosterChangedEvent | ProjectRoomMembershipChangedEvent | ProjectRoomTaskChangedEvent;
|
|
5440
|
+
/** A business event before the broker assigns its process-local ID. */
|
|
5441
|
+
type ProjectRoomBusinessEventDraft = Omit<ProjectRoomMessageCreatedEvent, "id"> | Omit<ProjectRoomRosterChangedEvent, "id"> | Omit<ProjectRoomMembershipChangedEvent, "id"> | Omit<ProjectRoomTaskChangedEvent, "id">;
|
|
5442
|
+
/** A connection control event; control events are never replayed. */
|
|
5443
|
+
type ProjectRoomControlEvent = {
|
|
5444
|
+
type: "ready";
|
|
5445
|
+
data: {
|
|
5446
|
+
epoch: string;
|
|
5447
|
+
headEventId: string | null;
|
|
5448
|
+
};
|
|
5449
|
+
} | {
|
|
5450
|
+
type: "resync";
|
|
5451
|
+
data: {
|
|
5452
|
+
reason: "SERVER_RESTART" | "CURSOR_EXPIRED" | "SLOW_CONSUMER";
|
|
5453
|
+
};
|
|
5454
|
+
} | {
|
|
5455
|
+
type: "access.revoked";
|
|
5456
|
+
data: {
|
|
5457
|
+
reason: "PROJECT_ACCESS_REVOKED" | "TOKEN_EXPIRED";
|
|
5458
|
+
};
|
|
5459
|
+
};
|
|
5460
|
+
/** The authenticated identity used by Project Room realtime access checks. */
|
|
5461
|
+
interface ProjectRoomRealtimeActor {
|
|
5462
|
+
tenantId: string;
|
|
5463
|
+
userId: string;
|
|
5464
|
+
projectId: string;
|
|
5465
|
+
tokenExpiresAt: number;
|
|
5466
|
+
}
|
|
5467
|
+
/** Writable HTTP socket surface required by the bounded SSE transport. */
|
|
5468
|
+
interface ProjectRoomSseWritable {
|
|
5469
|
+
write(chunk: string): boolean;
|
|
5470
|
+
end(): void;
|
|
5471
|
+
destroy(): void;
|
|
5472
|
+
on(event: "close" | "error" | "drain", listener: () => void): this;
|
|
5473
|
+
off(event: "close" | "error" | "drain", listener: () => void): this;
|
|
5474
|
+
}
|
|
5475
|
+
/** The scope used to isolate events between tenant rooms. */
|
|
5476
|
+
interface ProjectRoomEventScope {
|
|
5477
|
+
tenantId: string;
|
|
5478
|
+
roomId: string;
|
|
5479
|
+
projectId: string;
|
|
5480
|
+
}
|
|
5481
|
+
/** An internal broker event carrying scope that is removed before public serialization. */
|
|
5482
|
+
type ProjectRoomScopedBusinessEvent = ProjectRoomBusinessEvent & {
|
|
5483
|
+
scope: ProjectRoomEventScope;
|
|
5484
|
+
};
|
|
5485
|
+
/** A broker subscription containing replay and its room head. */
|
|
5486
|
+
interface ProjectRoomEventSubscription {
|
|
5487
|
+
replay: ProjectRoomBusinessEvent[];
|
|
5488
|
+
headEventId: string | null;
|
|
5489
|
+
unsubscribe(): void;
|
|
5490
|
+
}
|
|
5491
|
+
/** The narrow broker contract consumed by realtime publishers and services. */
|
|
5492
|
+
interface ProjectRoomEventBrokerProtocol {
|
|
5493
|
+
readonly epoch: string;
|
|
5494
|
+
publish(scope: ProjectRoomEventScope, draft: ProjectRoomBusinessEventDraft): ProjectRoomScopedBusinessEvent;
|
|
5495
|
+
subscribe(scope: ProjectRoomEventScope, afterEventId: string | undefined, listener: (event: ProjectRoomBusinessEvent) => void): ProjectRoomEventSubscription;
|
|
5496
|
+
close(): void;
|
|
5497
|
+
}
|
|
5498
|
+
/** A typed cursor failure requiring client REST resynchronization. */
|
|
5499
|
+
declare class ProjectRoomCursorError extends Error {
|
|
5500
|
+
readonly code: "SERVER_RESTART" | "CURSOR_EXPIRED";
|
|
5501
|
+
readonly name = "ProjectRoomCursorError";
|
|
5502
|
+
constructor(code: "SERVER_RESTART" | "CURSOR_EXPIRED");
|
|
5503
|
+
}
|
|
5504
|
+
/** A typed failure raised when the process-local event sequence is exhausted. */
|
|
5505
|
+
declare class ProjectRoomBrokerCapacityError extends Error {
|
|
5506
|
+
readonly name = "ProjectRoomBrokerCapacityError";
|
|
5507
|
+
readonly code: "PROJECT_ROOM_EVENT_SEQUENCE_EXHAUSTED";
|
|
5508
|
+
constructor();
|
|
5509
|
+
}
|
|
5510
|
+
/** The parsed components of a canonical Project Room event ID. */
|
|
5511
|
+
interface ProjectRoomEventId {
|
|
5512
|
+
epoch: string;
|
|
5513
|
+
sequence: number;
|
|
5514
|
+
}
|
|
5515
|
+
/** Parses a canonical event ID, returning undefined for malformed or unsafe IDs. */
|
|
5516
|
+
declare function parseProjectRoomEventId(value: unknown): ProjectRoomEventId | undefined;
|
|
5517
|
+
/** Checks an event ID without relying on realm-specific object identity. */
|
|
5518
|
+
declare function isProjectRoomEventId(value: unknown): value is string;
|
|
5519
|
+
/** Maps a canonical internal message to the strict public message DTO. */
|
|
5520
|
+
declare function toProjectRoomPublicMessage(value: unknown): ProjectRoomPublicMessage | undefined;
|
|
5521
|
+
/** A descriptor-safe message projection together with its canonical realtime scope. */
|
|
5522
|
+
declare function snapshotProjectRoomMessageRealtime(value: unknown): {
|
|
5523
|
+
scope: {
|
|
5524
|
+
tenantId: string;
|
|
5525
|
+
roomId: string;
|
|
5526
|
+
projectId: string;
|
|
5527
|
+
};
|
|
5528
|
+
publicMessage: ProjectRoomPublicMessage;
|
|
5529
|
+
} | undefined;
|
|
5530
|
+
/** Maps a canonical internal human membership to the strict public DTO. */
|
|
5531
|
+
declare function toProjectRoomPublicMembership(value: unknown): ProjectRoomPublicMembership | undefined;
|
|
5532
|
+
/** A descriptor-safe human membership projection with canonical tenant/project scope. */
|
|
5533
|
+
declare function snapshotProjectRoomMembershipRealtime(value: unknown): {
|
|
5534
|
+
scope: {
|
|
5535
|
+
tenantId: string;
|
|
5536
|
+
projectId: string;
|
|
5537
|
+
};
|
|
5538
|
+
publicMembership: ProjectRoomPublicMembership;
|
|
5539
|
+
} | undefined;
|
|
5540
|
+
/** Maps a canonical internal bot membership to the strict public DTO. */
|
|
5541
|
+
declare function toProjectRoomPublicBotMembership(value: unknown): ProjectRoomPublicBotMembership | undefined;
|
|
5542
|
+
/** A descriptor-safe bot membership projection with canonical realtime scope. */
|
|
5543
|
+
declare function snapshotProjectRoomBotMembershipRealtime(value: unknown): {
|
|
5544
|
+
scope: {
|
|
5545
|
+
tenantId: string;
|
|
5546
|
+
roomId: string;
|
|
5547
|
+
projectId: string;
|
|
5548
|
+
};
|
|
5549
|
+
publicMembership: ProjectRoomPublicBotMembership;
|
|
5550
|
+
} | undefined;
|
|
5551
|
+
|
|
4656
5552
|
/**
|
|
4657
5553
|
* YAML Workflow DSL — linear model with parallel blocks
|
|
4658
5554
|
*
|
|
@@ -4927,18 +5823,59 @@ interface PluginConnection {
|
|
|
4927
5823
|
}
|
|
4928
5824
|
/**
|
|
4929
5825
|
* 工具元信息(用于前端 allowedTools 筛选)
|
|
5826
|
+
*
|
|
5827
|
+
* New connection-backed plugin tools that select one connection must accept
|
|
5828
|
+
* the selected key as `args.connectionKey`. Existing legacy tools retain their
|
|
5829
|
+
* established resource argument names.
|
|
4930
5830
|
*/
|
|
4931
5831
|
interface PluginToolMeta {
|
|
4932
5832
|
name: string;
|
|
4933
5833
|
description: string;
|
|
4934
5834
|
}
|
|
5835
|
+
/**
|
|
5836
|
+
* A text file included in a plugin skill bundle.
|
|
5837
|
+
*
|
|
5838
|
+
* @property content - Text content written to the skill resource file.
|
|
5839
|
+
* @property mimeType - Optional MIME type for consumers that need it.
|
|
5840
|
+
*/
|
|
5841
|
+
interface PluginSkillResource {
|
|
5842
|
+
content: string;
|
|
5843
|
+
mimeType?: string;
|
|
5844
|
+
}
|
|
5845
|
+
/**
|
|
5846
|
+
* Versioned definition of a plugin-provided skill.
|
|
5847
|
+
*
|
|
5848
|
+
* @property version - Bundle version used to detect resource updates.
|
|
5849
|
+
* @property content - Complete SKILL.md markdown content.
|
|
5850
|
+
* @property resources - Optional text resources keyed by safe relative paths.
|
|
5851
|
+
*/
|
|
5852
|
+
interface PluginSkillDefinition {
|
|
5853
|
+
version: string;
|
|
5854
|
+
content: string;
|
|
5855
|
+
resources?: Record<string, PluginSkillResource>;
|
|
5856
|
+
}
|
|
5857
|
+
/**
|
|
5858
|
+
* Standard configuration for a new connection-backed plugin.
|
|
5859
|
+
*
|
|
5860
|
+
* `PluginMeta.type` is also the Connection Store type. `connections` selects
|
|
5861
|
+
* connection keys of that type; `connectAll` opts into using all available
|
|
5862
|
+
* connections of that type. Do not add a separate connection or resource type
|
|
5863
|
+
* or selector field to this configuration.
|
|
5864
|
+
*/
|
|
5865
|
+
type PluginStandardConnectionConfig = {
|
|
5866
|
+
connections: string[];
|
|
5867
|
+
connectAll?: boolean;
|
|
5868
|
+
};
|
|
4935
5869
|
/**
|
|
4936
5870
|
* 插件元数据(开发者声明)
|
|
4937
5871
|
*
|
|
4938
5872
|
* connectionSchema 不在此类型中——由 serializePluginMeta 自动推导后注入 PluginMetaOutput。
|
|
4939
5873
|
*/
|
|
4940
5874
|
interface PluginMeta {
|
|
4941
|
-
/**
|
|
5875
|
+
/**
|
|
5876
|
+
* 插件唯一标识,如 "erp"; for connection-backed plugins this is also the
|
|
5877
|
+
* Connection Store type.
|
|
5878
|
+
*/
|
|
4942
5879
|
type: string;
|
|
4943
5880
|
/** 显示名称 */
|
|
4944
5881
|
name: string;
|
|
@@ -4952,9 +5889,13 @@ interface PluginMeta {
|
|
|
4952
5889
|
icon?: string;
|
|
4953
5890
|
/** 工具清单(可选,middleware 能自动提取时不需要写) */
|
|
4954
5891
|
tools?: PluginToolMeta[];
|
|
4955
|
-
/**
|
|
5892
|
+
/**
|
|
5893
|
+
* 中间件配置 schema(用于 agent 配置面板)。新的 connection-backed
|
|
5894
|
+
* plugins use `connections: string[]` and optional `connectAll?: boolean`.
|
|
5895
|
+
* Do not introduce connectionType, resourceType, or resourceSelector fields.
|
|
5896
|
+
*/
|
|
4956
5897
|
configSchema?: Record<string, unknown>;
|
|
4957
|
-
/**
|
|
5898
|
+
/** 默认配置;connection-backed plugins use PluginStandardConnectionConfig. */
|
|
4958
5899
|
defaultConfig?: Record<string, unknown>;
|
|
4959
5900
|
/** 推荐配置的 companion 插件 */
|
|
4960
5901
|
recommends?: string[];
|
|
@@ -4964,6 +5905,8 @@ interface PluginMeta {
|
|
|
4964
5905
|
* 第三方插件可自定义分类名,前端会原样显示;未提供时归入 "Other"。
|
|
4965
5906
|
*/
|
|
4966
5907
|
category?: string;
|
|
5908
|
+
/** Whether this plugin's middleware may be included in capability bundles. */
|
|
5909
|
+
capabilityBundleEligible?: boolean;
|
|
4967
5910
|
}
|
|
4968
5911
|
/**
|
|
4969
5912
|
* 插件元数据输出(API 返回格式)
|
|
@@ -4992,7 +5935,7 @@ interface PluginMetaOutput extends PluginMeta {
|
|
|
4992
5935
|
* const myPlugin: Plugin = {
|
|
4993
5936
|
* meta: { ... },
|
|
4994
5937
|
* middleware: (config, context) => {
|
|
4995
|
-
* const skills = context?.
|
|
5938
|
+
* const skills = context?.pluginSkills ?? {};
|
|
4996
5939
|
* return createMyMiddleware({ ...config, pluginSkills: skills });
|
|
4997
5940
|
* },
|
|
4998
5941
|
* };
|
|
@@ -5000,12 +5943,14 @@ interface PluginMetaOutput extends PluginMeta {
|
|
|
5000
5943
|
*/
|
|
5001
5944
|
interface PluginContext {
|
|
5002
5945
|
/**
|
|
5003
|
-
* Cross-plugin aggregated skill
|
|
5946
|
+
* Cross-plugin aggregated skill bundles, keyed by skill name.
|
|
5004
5947
|
* Collected from all enabled plugins before the main middleware loop.
|
|
5005
5948
|
* Most plugins should ignore this; only cross-plugin coordination
|
|
5006
5949
|
* middleware (e.g. skillMiddleware) consumes it.
|
|
5007
5950
|
*/
|
|
5008
|
-
|
|
5951
|
+
pluginSkills?: Record<string, PluginSkillDefinition>;
|
|
5952
|
+
/** Owning plugin type for each enabled plugin skill bundle. */
|
|
5953
|
+
pluginSkillOwners?: Record<string, string>;
|
|
5009
5954
|
}
|
|
5010
5955
|
/**
|
|
5011
5956
|
* Factory function that creates middleware from plugin config.
|
|
@@ -5051,7 +5996,7 @@ interface Plugin {
|
|
|
5051
5996
|
* 名称必须以 "{pluginType}-" 为前缀,注册时校验。
|
|
5052
5997
|
* Builder 在构建中间件之前从所有启用的插件中收集。
|
|
5053
5998
|
*/
|
|
5054
|
-
skills?: Record<string,
|
|
5999
|
+
skills?: Record<string, PluginSkillDefinition>;
|
|
5055
6000
|
/**
|
|
5056
6001
|
* 插件贡献的 Agent 定义(以 agent key 为键)。
|
|
5057
6002
|
* 在租户首次访问时通过 ensurePluginAgentsForTenant 按租户注册到
|
|
@@ -5129,4 +6074,54 @@ type Timestamp = number;
|
|
|
5129
6074
|
*/
|
|
5130
6075
|
type Callback<T = any, R = void> = (data: T) => R | Promise<R>;
|
|
5131
6076
|
|
|
5132
|
-
|
|
6077
|
+
/** Queue execution behavior available to privileged host dispatchers. */
|
|
6078
|
+
type QueuedExecutionMode = "followup";
|
|
6079
|
+
/** Trusted Project Room identity persisted with a privileged queue message. */
|
|
6080
|
+
interface ProjectRoomTrustedRunContext {
|
|
6081
|
+
tenantId: string;
|
|
6082
|
+
workspaceId: string;
|
|
6083
|
+
projectId: string;
|
|
6084
|
+
roomId: string;
|
|
6085
|
+
sourceRoomMessageId: string;
|
|
6086
|
+
membershipId: string;
|
|
6087
|
+
assistantId: string;
|
|
6088
|
+
inputMessageId: string;
|
|
6089
|
+
role: "coordinator" | "specialist";
|
|
6090
|
+
title: string;
|
|
6091
|
+
responsibility?: string;
|
|
6092
|
+
}
|
|
6093
|
+
/** Trusted Project Task identity persisted with a privileged queue message. */
|
|
6094
|
+
interface ProjectTaskTrustedRunContext {
|
|
6095
|
+
tenantId: string;
|
|
6096
|
+
workspaceId: string;
|
|
6097
|
+
projectId: string;
|
|
6098
|
+
roomId: string;
|
|
6099
|
+
membershipId: string;
|
|
6100
|
+
assistantId: string;
|
|
6101
|
+
taskId: string;
|
|
6102
|
+
threadId: string;
|
|
6103
|
+
inputMessageId: string;
|
|
6104
|
+
}
|
|
6105
|
+
/** Host-authenticated metadata that cannot be supplied through public Agent APIs. */
|
|
6106
|
+
interface TrustedRunContext {
|
|
6107
|
+
projectRoom?: ProjectRoomTrustedRunContext;
|
|
6108
|
+
projectTask?: ProjectTaskTrustedRunContext;
|
|
6109
|
+
}
|
|
6110
|
+
/**
|
|
6111
|
+
* Strictly validates and clones host-authenticated queue context read from durable storage.
|
|
6112
|
+
*
|
|
6113
|
+
* @param value - Untrusted decoded database value.
|
|
6114
|
+
* @returns A validated defensive clone of the trusted run context.
|
|
6115
|
+
* @throws Error when the stored value does not exactly match the trusted context contract.
|
|
6116
|
+
*/
|
|
6117
|
+
declare function parseTrustedRunContext(value: unknown): TrustedRunContext;
|
|
6118
|
+
/**
|
|
6119
|
+
* Strictly validates a queued execution mode read from durable storage.
|
|
6120
|
+
*
|
|
6121
|
+
* @param value - Untrusted database value.
|
|
6122
|
+
* @returns The validated execution mode.
|
|
6123
|
+
* @throws Error when the stored value is not supported.
|
|
6124
|
+
*/
|
|
6125
|
+
declare function parseQueuedExecutionMode(value: unknown): QueuedExecutionMode;
|
|
6126
|
+
|
|
6127
|
+
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 };
|