@criticalbridge/brain-client 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/README.md +23 -0
- package/dist/auth.d.ts +2 -0
- package/dist/auth.js +21 -0
- package/dist/auth.js.map +1 -0
- package/dist/client.d.ts +604 -0
- package/dist/client.js +1197 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +17 -0
- package/dist/errors.js +44 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/types/a2a.types.d.ts +42 -0
- package/dist/types/a2a.types.js +3 -0
- package/dist/types/a2a.types.js.map +1 -0
- package/dist/types/agent-skill-lifecycle.types.d.ts +46 -0
- package/dist/types/agent-skill-lifecycle.types.js +22 -0
- package/dist/types/agent-skill-lifecycle.types.js.map +1 -0
- package/dist/types/agent.types.d.ts +117 -0
- package/dist/types/agent.types.js +3 -0
- package/dist/types/agent.types.js.map +1 -0
- package/dist/types/ai-knowledge.types.d.ts +180 -0
- package/dist/types/ai-knowledge.types.js +3 -0
- package/dist/types/ai-knowledge.types.js.map +1 -0
- package/dist/types/api.types.d.ts +550 -0
- package/dist/types/api.types.js +3 -0
- package/dist/types/api.types.js.map +1 -0
- package/dist/types/approval-events.types.d.ts +43 -0
- package/dist/types/approval-events.types.js +7 -0
- package/dist/types/approval-events.types.js.map +1 -0
- package/dist/types/best-practices-kg.types.d.ts +112 -0
- package/dist/types/best-practices-kg.types.js +3 -0
- package/dist/types/best-practices-kg.types.js.map +1 -0
- package/dist/types/bias-threshold-policy.types.d.ts +37 -0
- package/dist/types/bias-threshold-policy.types.js +3 -0
- package/dist/types/bias-threshold-policy.types.js.map +1 -0
- package/dist/types/change-approval-gate.types.d.ts +110 -0
- package/dist/types/change-approval-gate.types.js +53 -0
- package/dist/types/change-approval-gate.types.js.map +1 -0
- package/dist/types/connection.types.d.ts +100 -0
- package/dist/types/connection.types.js +3 -0
- package/dist/types/connection.types.js.map +1 -0
- package/dist/types/connector-manifest.types.d.ts +889 -0
- package/dist/types/connector-manifest.types.js +118 -0
- package/dist/types/connector-manifest.types.js.map +1 -0
- package/dist/types/control-profile.types.d.ts +69 -0
- package/dist/types/control-profile.types.js +10 -0
- package/dist/types/control-profile.types.js.map +1 -0
- package/dist/types/corpus.types.d.ts +2584 -0
- package/dist/types/corpus.types.js +120 -0
- package/dist/types/corpus.types.js.map +1 -0
- package/dist/types/credentials.types.d.ts +18 -0
- package/dist/types/credentials.types.js +3 -0
- package/dist/types/credentials.types.js.map +1 -0
- package/dist/types/dashboard.types.d.ts +205 -0
- package/dist/types/dashboard.types.js +3 -0
- package/dist/types/dashboard.types.js.map +1 -0
- package/dist/types/document-ingestion.types.d.ts +30 -0
- package/dist/types/document-ingestion.types.js +3 -0
- package/dist/types/document-ingestion.types.js.map +1 -0
- package/dist/types/domain-event.types.d.ts +21 -0
- package/dist/types/domain-event.types.js +3 -0
- package/dist/types/domain-event.types.js.map +1 -0
- package/dist/types/drift-dashboard.types.d.ts +17 -0
- package/dist/types/drift-dashboard.types.js +3 -0
- package/dist/types/drift-dashboard.types.js.map +1 -0
- package/dist/types/effective-control-profile.types.d.ts +39 -0
- package/dist/types/effective-control-profile.types.js +39 -0
- package/dist/types/effective-control-profile.types.js.map +1 -0
- package/dist/types/entity-kg.types.d.ts +140 -0
- package/dist/types/entity-kg.types.js +3 -0
- package/dist/types/entity-kg.types.js.map +1 -0
- package/dist/types/entity-model-graph.types.d.ts +63 -0
- package/dist/types/entity-model-graph.types.js +3 -0
- package/dist/types/entity-model-graph.types.js.map +1 -0
- package/dist/types/entity-model-sources.types.d.ts +117 -0
- package/dist/types/entity-model-sources.types.js +3 -0
- package/dist/types/entity-model-sources.types.js.map +1 -0
- package/dist/types/entity.types.d.ts +6 -0
- package/dist/types/entity.types.js +3 -0
- package/dist/types/entity.types.js.map +1 -0
- package/dist/types/failure.types.d.ts +22 -0
- package/dist/types/failure.types.js +3 -0
- package/dist/types/failure.types.js.map +1 -0
- package/dist/types/harvest.types.d.ts +662 -0
- package/dist/types/harvest.types.js +52 -0
- package/dist/types/harvest.types.js.map +1 -0
- package/dist/types/incident.types.d.ts +105 -0
- package/dist/types/incident.types.js +3 -0
- package/dist/types/incident.types.js.map +1 -0
- package/dist/types/introspection.types.d.ts +46 -0
- package/dist/types/introspection.types.js +3 -0
- package/dist/types/introspection.types.js.map +1 -0
- package/dist/types/kb-kg.types.d.ts +38 -0
- package/dist/types/kb-kg.types.js +3 -0
- package/dist/types/kb-kg.types.js.map +1 -0
- package/dist/types/managed-agent.types.d.ts +59 -0
- package/dist/types/managed-agent.types.js +11 -0
- package/dist/types/managed-agent.types.js.map +1 -0
- package/dist/types/object-store.types.d.ts +25 -0
- package/dist/types/object-store.types.js +8 -0
- package/dist/types/object-store.types.js.map +1 -0
- package/dist/types/pipeline.types.d.ts +39 -0
- package/dist/types/pipeline.types.js +3 -0
- package/dist/types/pipeline.types.js.map +1 -0
- package/dist/types/policy.types.d.ts +32 -0
- package/dist/types/policy.types.js +3 -0
- package/dist/types/policy.types.js.map +1 -0
- package/dist/types/risk-classification.types.d.ts +71 -0
- package/dist/types/risk-classification.types.js +3 -0
- package/dist/types/risk-classification.types.js.map +1 -0
- package/dist/types/skill-draft.types.d.ts +271 -0
- package/dist/types/skill-draft.types.js +48 -0
- package/dist/types/skill-draft.types.js.map +1 -0
- package/dist/types/source-mapping.types.d.ts +69 -0
- package/dist/types/source-mapping.types.js +3 -0
- package/dist/types/source-mapping.types.js.map +1 -0
- package/dist/types/synthesize.types.d.ts +90 -0
- package/dist/types/synthesize.types.js +41 -0
- package/dist/types/synthesize.types.js.map +1 -0
- package/dist/types/wizard-assistant.types.d.ts +25 -0
- package/dist/types/wizard-assistant.types.js +3 -0
- package/dist/types/wizard-assistant.types.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
import type { AgentAssignment, EntityUser, PortalAgent } from './agent.types';
|
|
2
|
+
export interface BrainClientConfig {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
entityId: string;
|
|
5
|
+
getAccessToken?: AccessTokenProvider;
|
|
6
|
+
fetchImpl?: FetchLike;
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
requestTimeoutMs?: number;
|
|
9
|
+
}
|
|
10
|
+
export type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
11
|
+
export type AccessTokenProvider = () => Promise<string | null | undefined> | string | null | undefined;
|
|
12
|
+
export interface ListAgentsParams {
|
|
13
|
+
stages?: AgentStageFilter[];
|
|
14
|
+
}
|
|
15
|
+
export type AgentStageFilter = 'staging' | 'production';
|
|
16
|
+
export interface ListAgentsResponse<T = PortalAgent> {
|
|
17
|
+
agents: T[];
|
|
18
|
+
count: number;
|
|
19
|
+
entityId: string;
|
|
20
|
+
}
|
|
21
|
+
export interface RegisterAgentRequest<TAgent = unknown> {
|
|
22
|
+
agent: TAgent;
|
|
23
|
+
seatLicenseId?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface RegisterAgentResponse {
|
|
26
|
+
success: boolean;
|
|
27
|
+
agentId: string;
|
|
28
|
+
agent: PortalAgent;
|
|
29
|
+
created: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface ResolveTenantResponse {
|
|
32
|
+
id: string;
|
|
33
|
+
externalId: string;
|
|
34
|
+
slug: string;
|
|
35
|
+
currentTier: 'L1' | 'L2' | 'L3';
|
|
36
|
+
resourcePointers: Record<string, unknown>;
|
|
37
|
+
}
|
|
38
|
+
export interface RbacRole {
|
|
39
|
+
user_id: string;
|
|
40
|
+
entity_id: string;
|
|
41
|
+
role_name: string;
|
|
42
|
+
is_inherited: boolean;
|
|
43
|
+
granted_at: string;
|
|
44
|
+
granted_by: string;
|
|
45
|
+
is_active: boolean;
|
|
46
|
+
expires_at?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface GetMyRbacRolesResponse {
|
|
49
|
+
roles: RbacRole[];
|
|
50
|
+
}
|
|
51
|
+
export interface AssignRbacRoleResponse {
|
|
52
|
+
assignment: RbacRole;
|
|
53
|
+
}
|
|
54
|
+
export interface CreateDelegationResponse {
|
|
55
|
+
assignment: RbacRole;
|
|
56
|
+
}
|
|
57
|
+
export interface GetDelegationsResponse {
|
|
58
|
+
roles: RbacRole[];
|
|
59
|
+
}
|
|
60
|
+
export type SuperUserScope = 'full' | 'read_only' | 'emergency';
|
|
61
|
+
export interface SuperUserAccessRecord {
|
|
62
|
+
user_id: string;
|
|
63
|
+
granted_by: string;
|
|
64
|
+
granted_at: string;
|
|
65
|
+
expires_at?: string;
|
|
66
|
+
justification: string;
|
|
67
|
+
scope: SuperUserScope;
|
|
68
|
+
audit_required: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface GrantSuperUserRequest {
|
|
71
|
+
scope: SuperUserScope;
|
|
72
|
+
justification: string;
|
|
73
|
+
expiresAt?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface GrantSuperUserResponse {
|
|
76
|
+
access: SuperUserAccessRecord;
|
|
77
|
+
}
|
|
78
|
+
export interface ListSuperUsersResponse {
|
|
79
|
+
superUsers: Array<{
|
|
80
|
+
userId: string;
|
|
81
|
+
access: SuperUserAccessRecord;
|
|
82
|
+
}>;
|
|
83
|
+
}
|
|
84
|
+
export interface GetSelfSuperUserResponse {
|
|
85
|
+
access: SuperUserAccessRecord | null;
|
|
86
|
+
}
|
|
87
|
+
export interface EntityMetadata {
|
|
88
|
+
id: string;
|
|
89
|
+
name: string;
|
|
90
|
+
display_name: string;
|
|
91
|
+
entity_type: string;
|
|
92
|
+
}
|
|
93
|
+
export interface GetEntityMetadataResponse {
|
|
94
|
+
metadata: EntityMetadata;
|
|
95
|
+
}
|
|
96
|
+
export interface BootstrapLoginResponse {
|
|
97
|
+
assigned: boolean;
|
|
98
|
+
assignment?: RbacRole;
|
|
99
|
+
alreadyAssigned?: boolean;
|
|
100
|
+
entityId?: string;
|
|
101
|
+
reason?: 'no_bootstrap_role';
|
|
102
|
+
}
|
|
103
|
+
export interface GetAgentResponse {
|
|
104
|
+
agent: PortalAgent;
|
|
105
|
+
}
|
|
106
|
+
export interface DeleteAgentResponse {
|
|
107
|
+
success: boolean;
|
|
108
|
+
agentId: string;
|
|
109
|
+
}
|
|
110
|
+
export interface UpdateAgentRequest<TAgent = Record<string, unknown>> {
|
|
111
|
+
patch: Partial<TAgent>;
|
|
112
|
+
}
|
|
113
|
+
export interface UpdateAgentResponse {
|
|
114
|
+
success: boolean;
|
|
115
|
+
agentId: string;
|
|
116
|
+
agent: PortalAgent;
|
|
117
|
+
}
|
|
118
|
+
export interface ListUsersResponse {
|
|
119
|
+
users: EntityUser[];
|
|
120
|
+
count: number;
|
|
121
|
+
entityId: string;
|
|
122
|
+
source?: 'auth0' | 'fallback';
|
|
123
|
+
}
|
|
124
|
+
export interface AssignAgentParams {
|
|
125
|
+
userId: string;
|
|
126
|
+
userEmail?: string;
|
|
127
|
+
userName?: string;
|
|
128
|
+
assignedBy?: string;
|
|
129
|
+
}
|
|
130
|
+
export interface AssignAgentResponse {
|
|
131
|
+
success: boolean;
|
|
132
|
+
assignment: AgentAssignment;
|
|
133
|
+
message: string;
|
|
134
|
+
}
|
|
135
|
+
export interface UnassignAgentResponse {
|
|
136
|
+
success: boolean;
|
|
137
|
+
message: string;
|
|
138
|
+
previousAssignment?: AgentAssignment;
|
|
139
|
+
}
|
|
140
|
+
export interface GetAssignmentResponse {
|
|
141
|
+
assigned: boolean;
|
|
142
|
+
agentId: string;
|
|
143
|
+
entityId: string;
|
|
144
|
+
assignment?: AgentAssignment;
|
|
145
|
+
}
|
|
146
|
+
export interface ListProcessesParams {
|
|
147
|
+
status?: string;
|
|
148
|
+
limit?: number;
|
|
149
|
+
page?: number;
|
|
150
|
+
}
|
|
151
|
+
export interface AgentActionResponse {
|
|
152
|
+
success: boolean;
|
|
153
|
+
message: string;
|
|
154
|
+
agentId: string;
|
|
155
|
+
previousStatus?: string;
|
|
156
|
+
newStatus?: string;
|
|
157
|
+
}
|
|
158
|
+
export interface ListProcessInstancesParams {
|
|
159
|
+
status?: string;
|
|
160
|
+
}
|
|
161
|
+
export type MonitorEventStatus = 'success' | 'warning' | 'error';
|
|
162
|
+
export interface MonitorEvent {
|
|
163
|
+
eventId: string;
|
|
164
|
+
entityId: string;
|
|
165
|
+
domainPackId: string;
|
|
166
|
+
eventType: string;
|
|
167
|
+
timestamp: string;
|
|
168
|
+
source: string;
|
|
169
|
+
correlationId?: string;
|
|
170
|
+
causationId?: string;
|
|
171
|
+
version: number;
|
|
172
|
+
payload: Record<string, unknown>;
|
|
173
|
+
metadata?: Record<string, string>;
|
|
174
|
+
status: MonitorEventStatus;
|
|
175
|
+
duration: number;
|
|
176
|
+
}
|
|
177
|
+
export interface ListEventsParams {
|
|
178
|
+
limit?: number;
|
|
179
|
+
domainPackId?: string;
|
|
180
|
+
eventType?: string;
|
|
181
|
+
}
|
|
182
|
+
export interface ListEventsResponse {
|
|
183
|
+
events: MonitorEvent[];
|
|
184
|
+
count: number;
|
|
185
|
+
entityId: string;
|
|
186
|
+
}
|
|
187
|
+
export interface ListProcessInstancesResponse<T = unknown> {
|
|
188
|
+
processes: T[];
|
|
189
|
+
count: number;
|
|
190
|
+
entityId: string;
|
|
191
|
+
}
|
|
192
|
+
export type GetEntityLicenseUsageResponse<T = unknown> = T;
|
|
193
|
+
export type GetSeatLicenseUsageResponse<T = unknown> = T;
|
|
194
|
+
export interface ListAgentGroupsResponse<T = unknown> {
|
|
195
|
+
groups: T[];
|
|
196
|
+
count: number;
|
|
197
|
+
entityId: string;
|
|
198
|
+
}
|
|
199
|
+
export interface LicenseUtilizationPerSeat {
|
|
200
|
+
id: string;
|
|
201
|
+
userId: string;
|
|
202
|
+
eligibleAgentCount: number;
|
|
203
|
+
}
|
|
204
|
+
export interface LicenseUtilizationCursor {
|
|
205
|
+
agentId: string;
|
|
206
|
+
cursor: number;
|
|
207
|
+
}
|
|
208
|
+
export interface LicenseUtilizationOversubscribed {
|
|
209
|
+
agentId: string;
|
|
210
|
+
pendingItems: number;
|
|
211
|
+
seatCount: number;
|
|
212
|
+
}
|
|
213
|
+
export interface LicenseUtilizationUnusedSeat {
|
|
214
|
+
id: string;
|
|
215
|
+
userId: string;
|
|
216
|
+
}
|
|
217
|
+
export interface LicenseUtilizationSnapshot {
|
|
218
|
+
entityId: string;
|
|
219
|
+
perSeat: LicenseUtilizationPerSeat[];
|
|
220
|
+
cursors: LicenseUtilizationCursor[];
|
|
221
|
+
oversubscribed: LicenseUtilizationOversubscribed[];
|
|
222
|
+
unusedSeats: LicenseUtilizationUnusedSeat[];
|
|
223
|
+
}
|
|
224
|
+
export type GetLicenseAwareUtilizationResponse = LicenseUtilizationSnapshot;
|
|
225
|
+
export type DispatchTerminalState = 'succeeded' | 'failed' | 'needs_attention' | 'heartbeat-timeout';
|
|
226
|
+
export interface DispatchSummary {
|
|
227
|
+
dispatchId: string;
|
|
228
|
+
dispatchedAt: string;
|
|
229
|
+
workItemId: string;
|
|
230
|
+
agentId: string;
|
|
231
|
+
entityId: string;
|
|
232
|
+
runnerInstanceId: string | null;
|
|
233
|
+
lastHeartbeatAt: string | null;
|
|
234
|
+
terminalState: DispatchTerminalState | null;
|
|
235
|
+
}
|
|
236
|
+
export interface DispatchEvent {
|
|
237
|
+
kind: 'started' | 'step_completed' | 'succeeded' | 'failed' | 'needs_attention';
|
|
238
|
+
runnerInstanceId: string;
|
|
239
|
+
emittedAt: string;
|
|
240
|
+
stepId?: string;
|
|
241
|
+
stepName?: string;
|
|
242
|
+
durationMs?: number;
|
|
243
|
+
}
|
|
244
|
+
export interface ListDispatchesResponse {
|
|
245
|
+
dispatches: DispatchSummary[];
|
|
246
|
+
count: number;
|
|
247
|
+
entityId: string;
|
|
248
|
+
}
|
|
249
|
+
export interface GetDispatchResponse {
|
|
250
|
+
dispatch: DispatchSummary;
|
|
251
|
+
events: DispatchEvent[];
|
|
252
|
+
entityId: string;
|
|
253
|
+
}
|
|
254
|
+
export interface CancelDispatchResponse {
|
|
255
|
+
cancelled: boolean;
|
|
256
|
+
dispatchId: string;
|
|
257
|
+
runnerInstanceId?: string;
|
|
258
|
+
}
|
|
259
|
+
export interface CreateDispatchRequest<TWorkItem = Record<string, unknown>> {
|
|
260
|
+
dispatchId: string;
|
|
261
|
+
workItem: {
|
|
262
|
+
id: string;
|
|
263
|
+
} & TWorkItem;
|
|
264
|
+
agent: {
|
|
265
|
+
id: string;
|
|
266
|
+
entityId: string;
|
|
267
|
+
executionMode: string;
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
export interface CreateDispatchResponse {
|
|
271
|
+
accepted: true;
|
|
272
|
+
dispatchId: string;
|
|
273
|
+
runnerInstanceId: string;
|
|
274
|
+
}
|
|
275
|
+
export type MeshSurface = 'slack' | 'teams' | 'google-chat' | 'discord' | 'in-app' | 'a2a-internal' | 'a2a-external';
|
|
276
|
+
export type MeshAdapterState = 'stopped' | 'starting' | 'running' | 'failed';
|
|
277
|
+
export interface MeshAdapterHealth {
|
|
278
|
+
surface: MeshSurface;
|
|
279
|
+
state: MeshAdapterState;
|
|
280
|
+
lastError: string | null;
|
|
281
|
+
eventsProcessed: number;
|
|
282
|
+
eventsRejected: number;
|
|
283
|
+
}
|
|
284
|
+
export interface MeshSubscriptionRecord {
|
|
285
|
+
subscriptionId: string;
|
|
286
|
+
resource: string;
|
|
287
|
+
expiresAt: string;
|
|
288
|
+
}
|
|
289
|
+
export interface MeshSurfaceHealth {
|
|
290
|
+
health: MeshAdapterHealth;
|
|
291
|
+
subscriptions: MeshSubscriptionRecord[];
|
|
292
|
+
}
|
|
293
|
+
export interface MeshSubscriptionHealthResponse {
|
|
294
|
+
surfaces: MeshSurfaceHealth[];
|
|
295
|
+
entityId: string;
|
|
296
|
+
source?: 'live' | 'mock';
|
|
297
|
+
}
|
|
298
|
+
export type OperatorSignalTier = 'page' | 'investigation' | 'benign';
|
|
299
|
+
export interface OperatorSignal {
|
|
300
|
+
id: string;
|
|
301
|
+
tag: string;
|
|
302
|
+
tier: OperatorSignalTier;
|
|
303
|
+
emittedAt: string;
|
|
304
|
+
message: string;
|
|
305
|
+
dispatchId?: string;
|
|
306
|
+
runnerInstanceId?: string;
|
|
307
|
+
context?: Record<string, unknown>;
|
|
308
|
+
}
|
|
309
|
+
export interface ListOperatorSignalsParams {
|
|
310
|
+
since?: string;
|
|
311
|
+
}
|
|
312
|
+
export interface ListOperatorSignalsResponse {
|
|
313
|
+
signals: OperatorSignal[];
|
|
314
|
+
count: number;
|
|
315
|
+
entityId: string;
|
|
316
|
+
}
|
|
317
|
+
export type SystemHealthStatus = 'healthy' | 'degraded' | 'unconfigured';
|
|
318
|
+
export interface DispatcherHealth {
|
|
319
|
+
status: SystemHealthStatus;
|
|
320
|
+
configured: boolean;
|
|
321
|
+
brainEntityId: string | null;
|
|
322
|
+
}
|
|
323
|
+
export interface HeartbeatReconcilerHealth {
|
|
324
|
+
status: SystemHealthStatus;
|
|
325
|
+
enabled: boolean;
|
|
326
|
+
scanIntervalMs: number | null;
|
|
327
|
+
heartbeatThresholdMs: number | null;
|
|
328
|
+
dispatchGracePeriodMs: number | null;
|
|
329
|
+
}
|
|
330
|
+
export interface LedgerSizeHealth {
|
|
331
|
+
dispatchEntries: number;
|
|
332
|
+
runnerStatusEntries: number;
|
|
333
|
+
operatorSignals: number;
|
|
334
|
+
warnThreshold: number;
|
|
335
|
+
operatorSignalsCap: number;
|
|
336
|
+
}
|
|
337
|
+
export interface SystemHealthResponse {
|
|
338
|
+
dispatcher: DispatcherHealth;
|
|
339
|
+
reconciler: HeartbeatReconcilerHealth;
|
|
340
|
+
ledgers: LedgerSizeHealth;
|
|
341
|
+
snapshotAt: string;
|
|
342
|
+
entityId: string;
|
|
343
|
+
}
|
|
344
|
+
export interface WorkItem {
|
|
345
|
+
id: string;
|
|
346
|
+
enqueuedAt: string;
|
|
347
|
+
slaMinutes?: number;
|
|
348
|
+
staleFlagged?: boolean;
|
|
349
|
+
payload: Record<string, unknown>;
|
|
350
|
+
}
|
|
351
|
+
export type WorkAssignmentEventKind = 'enqueued' | 'completed' | 'reassigned-out' | 'reassigned-in' | 'stale-flagged';
|
|
352
|
+
export interface WorkAssignmentEvent {
|
|
353
|
+
id: string;
|
|
354
|
+
ts: string;
|
|
355
|
+
kind: WorkAssignmentEventKind;
|
|
356
|
+
entityId: string;
|
|
357
|
+
agentId: string;
|
|
358
|
+
userSub: string;
|
|
359
|
+
itemId: string;
|
|
360
|
+
payload?: Record<string, unknown>;
|
|
361
|
+
}
|
|
362
|
+
export interface EnqueueWorkItemRequest {
|
|
363
|
+
userSub: string;
|
|
364
|
+
item: {
|
|
365
|
+
id: string;
|
|
366
|
+
slaMinutes?: number;
|
|
367
|
+
payload?: Record<string, unknown>;
|
|
368
|
+
};
|
|
369
|
+
source?: string;
|
|
370
|
+
}
|
|
371
|
+
export interface EnqueueWorkItemResponse {
|
|
372
|
+
enqueued: boolean;
|
|
373
|
+
itemId: string;
|
|
374
|
+
entityId?: string;
|
|
375
|
+
agentId?: string;
|
|
376
|
+
event?: WorkAssignmentEvent;
|
|
377
|
+
}
|
|
378
|
+
export interface ReassignWorkItemRequest {
|
|
379
|
+
targetUserSub?: string;
|
|
380
|
+
reason?: string;
|
|
381
|
+
}
|
|
382
|
+
export interface ReassignWorkItemResponse {
|
|
383
|
+
reassigned: boolean;
|
|
384
|
+
itemId: string;
|
|
385
|
+
fromUserSub: string;
|
|
386
|
+
toUserSub: string;
|
|
387
|
+
event: WorkAssignmentEvent;
|
|
388
|
+
}
|
|
389
|
+
export interface ListAgentWorkItemsParams {
|
|
390
|
+
limit?: number;
|
|
391
|
+
offset?: number;
|
|
392
|
+
}
|
|
393
|
+
export interface ListAgentWorkItemsResponse {
|
|
394
|
+
agentId: string;
|
|
395
|
+
entityId: string;
|
|
396
|
+
items: WorkItem[];
|
|
397
|
+
totalCount: number;
|
|
398
|
+
pagination: {
|
|
399
|
+
limit: number;
|
|
400
|
+
offset: number;
|
|
401
|
+
};
|
|
402
|
+
source: 'empty' | 'enabled' | 'stub';
|
|
403
|
+
}
|
|
404
|
+
export interface ListWorkAssignmentEventsParams {
|
|
405
|
+
agentId?: string;
|
|
406
|
+
userSub?: string;
|
|
407
|
+
workItemId?: string;
|
|
408
|
+
since?: string;
|
|
409
|
+
limit?: number;
|
|
410
|
+
}
|
|
411
|
+
export interface ListWorkAssignmentEventsResponse {
|
|
412
|
+
events: WorkAssignmentEvent[];
|
|
413
|
+
count: number;
|
|
414
|
+
entityId: string;
|
|
415
|
+
}
|
|
416
|
+
export interface DecisionLineageCitation {
|
|
417
|
+
source: string;
|
|
418
|
+
url?: string;
|
|
419
|
+
excerpt?: string;
|
|
420
|
+
}
|
|
421
|
+
export interface DecisionLineageRecord {
|
|
422
|
+
signalId: string;
|
|
423
|
+
signature: string;
|
|
424
|
+
workItemId: string;
|
|
425
|
+
agentId: string;
|
|
426
|
+
skill: string;
|
|
427
|
+
decidedAt: string;
|
|
428
|
+
inputs?: Record<string, unknown>;
|
|
429
|
+
outputs?: Record<string, unknown>;
|
|
430
|
+
citations: DecisionLineageCitation[];
|
|
431
|
+
}
|
|
432
|
+
export type DecisionLineageRiskTier = 'low' | 'medium' | 'high' | 'critical';
|
|
433
|
+
export type DecisionLineageDataClassification = 'public' | 'internal' | 'confidential' | 'restricted';
|
|
434
|
+
export type DecisionLineageHITLTouchpointType = 'approval_requested' | 'approval_granted' | 'approval_denied' | 'notify';
|
|
435
|
+
export interface DecisionLineageHITLTouchpoint {
|
|
436
|
+
timestamp: string;
|
|
437
|
+
type: DecisionLineageHITLTouchpointType;
|
|
438
|
+
hitlRequestId?: string;
|
|
439
|
+
userId?: string;
|
|
440
|
+
reason?: string;
|
|
441
|
+
resolutionTimeMs?: number;
|
|
442
|
+
}
|
|
443
|
+
export interface DecisionLineageModelInvocation {
|
|
444
|
+
provider: string;
|
|
445
|
+
model: string;
|
|
446
|
+
modelVersion?: string;
|
|
447
|
+
tokensIn?: number;
|
|
448
|
+
tokensOut?: number;
|
|
449
|
+
cachedTokensIn?: number;
|
|
450
|
+
}
|
|
451
|
+
export type DecisionLineageContextSourceType = 'document' | 'database' | 'rules_engine' | 'api';
|
|
452
|
+
export interface DecisionLineageRetrievedContextSource {
|
|
453
|
+
type: DecisionLineageContextSourceType;
|
|
454
|
+
sourceId: string;
|
|
455
|
+
sourceName?: string;
|
|
456
|
+
excerpt?: string;
|
|
457
|
+
url?: string;
|
|
458
|
+
retrievedAt: string;
|
|
459
|
+
relevanceScore?: number;
|
|
460
|
+
}
|
|
461
|
+
export interface DecisionLineageRecordV2 extends DecisionLineageRecord {
|
|
462
|
+
schemaVersion: number;
|
|
463
|
+
decisionId: string;
|
|
464
|
+
useCase?: string;
|
|
465
|
+
riskTier?: DecisionLineageRiskTier;
|
|
466
|
+
consumerRef?: string;
|
|
467
|
+
skillVersion?: string;
|
|
468
|
+
promptConfigHash?: string;
|
|
469
|
+
modelInvocation?: DecisionLineageModelInvocation;
|
|
470
|
+
retrievedContext?: DecisionLineageRetrievedContextSource[];
|
|
471
|
+
hitlTouchpoints?: DecisionLineageHITLTouchpoint[];
|
|
472
|
+
redactedFields?: string[];
|
|
473
|
+
dataClassification?: DecisionLineageDataClassification;
|
|
474
|
+
consumerImpacting?: boolean;
|
|
475
|
+
}
|
|
476
|
+
export interface GetDecisionLineageResponse {
|
|
477
|
+
record: DecisionLineageRecordV2;
|
|
478
|
+
entityId: string;
|
|
479
|
+
}
|
|
480
|
+
export interface RecordDecisionLineageRequest {
|
|
481
|
+
workItemId: string;
|
|
482
|
+
agentId: string;
|
|
483
|
+
skill: string;
|
|
484
|
+
inputs?: Record<string, unknown>;
|
|
485
|
+
outputs?: Record<string, unknown>;
|
|
486
|
+
citations?: DecisionLineageCitation[];
|
|
487
|
+
decisionId?: string;
|
|
488
|
+
useCase?: string;
|
|
489
|
+
riskTier?: DecisionLineageRiskTier;
|
|
490
|
+
consumerRef?: string;
|
|
491
|
+
skillVersion?: string;
|
|
492
|
+
promptConfigHash?: string;
|
|
493
|
+
modelInvocation?: DecisionLineageModelInvocation;
|
|
494
|
+
retrievedContext?: DecisionLineageRetrievedContextSource[];
|
|
495
|
+
hitlTouchpoints?: DecisionLineageHITLTouchpoint[];
|
|
496
|
+
dataClassification?: DecisionLineageDataClassification;
|
|
497
|
+
consumerImpacting?: boolean;
|
|
498
|
+
}
|
|
499
|
+
export interface RecordDecisionLineageResponse {
|
|
500
|
+
record: DecisionLineageRecordV2;
|
|
501
|
+
entityId: string;
|
|
502
|
+
}
|
|
503
|
+
export interface ListDecisionLineageParams {
|
|
504
|
+
decisionId?: string;
|
|
505
|
+
consumerRef?: string;
|
|
506
|
+
skill?: string;
|
|
507
|
+
skillVersion?: string;
|
|
508
|
+
modelProvider?: string;
|
|
509
|
+
modelName?: string;
|
|
510
|
+
riskTier?: DecisionLineageRiskTier;
|
|
511
|
+
startDate?: string;
|
|
512
|
+
endDate?: string;
|
|
513
|
+
hitlApprovalRequired?: boolean;
|
|
514
|
+
consumerImpacting?: boolean;
|
|
515
|
+
limit?: number;
|
|
516
|
+
offset?: number;
|
|
517
|
+
}
|
|
518
|
+
export interface DecisionLineageSummary {
|
|
519
|
+
signalId: string;
|
|
520
|
+
decisionId: string;
|
|
521
|
+
agentId: string;
|
|
522
|
+
workItemId: string;
|
|
523
|
+
skill: string;
|
|
524
|
+
skillVersion?: string;
|
|
525
|
+
consumerRef?: string;
|
|
526
|
+
modelProvider?: string;
|
|
527
|
+
modelName?: string;
|
|
528
|
+
riskTier?: DecisionLineageRiskTier;
|
|
529
|
+
decidedAt: string;
|
|
530
|
+
hitlTouchpointCount: number;
|
|
531
|
+
hitlApprovalRequired: boolean;
|
|
532
|
+
schemaVersion: number;
|
|
533
|
+
consumerImpacting?: boolean;
|
|
534
|
+
}
|
|
535
|
+
export interface ListDecisionLineageResponse {
|
|
536
|
+
records: DecisionLineageSummary[];
|
|
537
|
+
count: number;
|
|
538
|
+
totalCount: number;
|
|
539
|
+
entityId: string;
|
|
540
|
+
pagination: {
|
|
541
|
+
limit: number;
|
|
542
|
+
offset: number;
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
export interface GetDecisionLineageByConsumerResponse {
|
|
546
|
+
records: DecisionLineageSummary[];
|
|
547
|
+
count: number;
|
|
548
|
+
consumerRef: string;
|
|
549
|
+
entityId: string;
|
|
550
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.types.js","sourceRoot":"","sources":["../../src/types/api.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type ApprovalEventKind = 'approval.pending' | 'approval.decided' | 'approval.escalated' | 'approval.resumed' | 'work.assigned' | 'work.completed';
|
|
2
|
+
export interface ApprovalEventEnvelope {
|
|
3
|
+
entityId: string;
|
|
4
|
+
kind: ApprovalEventKind;
|
|
5
|
+
at: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ApprovalPendingEvent extends ApprovalEventEnvelope {
|
|
8
|
+
kind: 'approval.pending';
|
|
9
|
+
actionId: string;
|
|
10
|
+
agentId?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ApprovalDecidedEvent extends ApprovalEventEnvelope {
|
|
13
|
+
kind: 'approval.decided';
|
|
14
|
+
actionId: string;
|
|
15
|
+
agentId?: string;
|
|
16
|
+
decision: 'approved' | 'rejected';
|
|
17
|
+
approverId?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ApprovalEscalatedEvent extends ApprovalEventEnvelope {
|
|
20
|
+
kind: 'approval.escalated';
|
|
21
|
+
actionId: string;
|
|
22
|
+
agentId?: string;
|
|
23
|
+
level: number;
|
|
24
|
+
}
|
|
25
|
+
export interface ApprovalResumedEvent extends ApprovalEventEnvelope {
|
|
26
|
+
kind: 'approval.resumed';
|
|
27
|
+
actionId: string;
|
|
28
|
+
agentId?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface WorkAssignedEvent extends ApprovalEventEnvelope {
|
|
31
|
+
kind: 'work.assigned';
|
|
32
|
+
itemId: string;
|
|
33
|
+
agentId: string;
|
|
34
|
+
ownerSub: string;
|
|
35
|
+
}
|
|
36
|
+
export interface WorkCompletedEvent extends ApprovalEventEnvelope {
|
|
37
|
+
kind: 'work.completed';
|
|
38
|
+
itemId: string;
|
|
39
|
+
agentId: string;
|
|
40
|
+
ownerSub: string;
|
|
41
|
+
}
|
|
42
|
+
export type ApprovalEvent = ApprovalPendingEvent | ApprovalDecidedEvent | ApprovalEscalatedEvent | ApprovalResumedEvent | WorkAssignedEvent | WorkCompletedEvent;
|
|
43
|
+
export declare function brainEventsTopicName(entityId: string): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.brainEventsTopicName = brainEventsTopicName;
|
|
4
|
+
function brainEventsTopicName(entityId) {
|
|
5
|
+
return `brain-events-${entityId}`;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=approval-events.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval-events.types.js","sourceRoot":"","sources":["../../src/types/approval-events.types.ts"],"names":[],"mappings":";;AA4DA,oDAEC;AAFD,SAAgB,oBAAoB,CAAC,QAAgB;IACnD,OAAO,gBAAgB,QAAQ,EAAE,CAAC;AACpC,CAAC"}
|