agent-relay-sdk 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bus-client.d.ts +26 -0
- package/dist/bus-client.d.ts.map +1 -1
- package/dist/bus-client.js +136 -3
- package/dist/bus-client.js.map +1 -1
- package/dist/context-probe.d.ts +43 -0
- package/dist/context-probe.d.ts.map +1 -0
- package/dist/context-probe.js +210 -0
- package/dist/context-probe.js.map +1 -0
- package/dist/contracts.d.ts +27 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +34 -0
- package/dist/contracts.js.map +1 -0
- package/dist/http-client.d.ts +66 -5
- package/dist/http-client.d.ts.map +1 -1
- package/dist/http-client.js +148 -9
- package/dist/http-client.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/protocol.d.ts +4 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js.map +1 -1
- package/dist/provider-catalog.d.ts +80 -0
- package/dist/provider-catalog.d.ts.map +1 -0
- package/dist/provider-catalog.js +84 -0
- package/dist/provider-catalog.js.map +1 -0
- package/dist/types.d.ts +921 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +13 -1
- package/src/bus-client.ts +142 -3
- package/src/context-probe.ts +257 -0
- package/src/contracts.ts +47 -0
- package/src/http-client.ts +166 -11
- package/src/index.ts +3 -0
- package/src/protocol.ts +4 -0
- package/src/provider-catalog.ts +174 -0
- package/src/types.ts +1035 -7
package/src/types.ts
CHANGED
|
@@ -13,6 +13,8 @@ export interface AgentCard {
|
|
|
13
13
|
status: AgentStatus;
|
|
14
14
|
instanceId?: string;
|
|
15
15
|
epoch: number;
|
|
16
|
+
providerCapabilities?: ProviderCapabilities;
|
|
17
|
+
context?: ContextState;
|
|
16
18
|
meta?: Record<string, unknown>;
|
|
17
19
|
lastSeen: number;
|
|
18
20
|
createdAt: number;
|
|
@@ -20,6 +22,291 @@ export interface AgentCard {
|
|
|
20
22
|
|
|
21
23
|
export type AgentStatus = "online" | "idle" | "busy" | "stale" | "offline";
|
|
22
24
|
|
|
25
|
+
export type CapabilitySource = "catalog" | "provider" | "runtime" | "override" | "estimate";
|
|
26
|
+
export type CapabilityConfidence = "declared" | "reported" | "verified" | "estimated" | "unknown";
|
|
27
|
+
|
|
28
|
+
export interface ProviderCapabilities {
|
|
29
|
+
lifecycle: {
|
|
30
|
+
managed: boolean;
|
|
31
|
+
shutdownHard: boolean;
|
|
32
|
+
restartHard: boolean;
|
|
33
|
+
semanticStatus?: boolean;
|
|
34
|
+
reconnect?: boolean;
|
|
35
|
+
hibernate?: boolean;
|
|
36
|
+
resume?: boolean;
|
|
37
|
+
};
|
|
38
|
+
model?: {
|
|
39
|
+
provider?: SpawnProvider | string;
|
|
40
|
+
id?: string;
|
|
41
|
+
alias?: string;
|
|
42
|
+
providerModel?: string;
|
|
43
|
+
effort?: SpawnEffort | string;
|
|
44
|
+
source: CapabilitySource;
|
|
45
|
+
confidence: CapabilityConfidence;
|
|
46
|
+
lastUpdatedAt?: number;
|
|
47
|
+
};
|
|
48
|
+
session?: {
|
|
49
|
+
approvalMode?: SpawnApprovalMode | string;
|
|
50
|
+
fileRead?: boolean;
|
|
51
|
+
fileWrite?: boolean;
|
|
52
|
+
shell?: boolean;
|
|
53
|
+
source: CapabilitySource;
|
|
54
|
+
confidence: CapabilityConfidence;
|
|
55
|
+
lastUpdatedAt?: number;
|
|
56
|
+
};
|
|
57
|
+
context?: {
|
|
58
|
+
stats?: {
|
|
59
|
+
source: "api" | "statusline" | "hook" | "estimate";
|
|
60
|
+
confidence: "exact" | "reported" | "estimated";
|
|
61
|
+
};
|
|
62
|
+
compact?: boolean;
|
|
63
|
+
clear?: boolean;
|
|
64
|
+
inject?: boolean;
|
|
65
|
+
fork?: boolean;
|
|
66
|
+
rollback?: boolean;
|
|
67
|
+
archive?: boolean;
|
|
68
|
+
};
|
|
69
|
+
terminal?: {
|
|
70
|
+
live?: {
|
|
71
|
+
read?: boolean;
|
|
72
|
+
write?: boolean;
|
|
73
|
+
};
|
|
74
|
+
attach?: {
|
|
75
|
+
create?: boolean;
|
|
76
|
+
read?: boolean;
|
|
77
|
+
write?: boolean;
|
|
78
|
+
detach?: boolean;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
source: CapabilitySource;
|
|
82
|
+
confidence: CapabilityConfidence;
|
|
83
|
+
lastUpdatedAt: number;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export type ContextLifecycleState =
|
|
87
|
+
| "fresh"
|
|
88
|
+
| "primed"
|
|
89
|
+
| "working"
|
|
90
|
+
| "cooling"
|
|
91
|
+
| "compacting"
|
|
92
|
+
| "hibernating";
|
|
93
|
+
|
|
94
|
+
export interface ContextProbeMetrics {
|
|
95
|
+
agentId: string;
|
|
96
|
+
contextPercent: number;
|
|
97
|
+
tokensUsed?: number;
|
|
98
|
+
tokensMax?: number;
|
|
99
|
+
quotaUsed?: number;
|
|
100
|
+
quotaLimit?: number;
|
|
101
|
+
quotaResetIn?: number;
|
|
102
|
+
model?: string;
|
|
103
|
+
effort?: string;
|
|
104
|
+
source: "statusline" | "hook" | "api" | "estimate";
|
|
105
|
+
confidence: "exact" | "reported" | "estimated";
|
|
106
|
+
timestamp: number;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface ContextState {
|
|
110
|
+
utilization: number;
|
|
111
|
+
tokensUsed?: number;
|
|
112
|
+
tokensMax?: number;
|
|
113
|
+
lifecycleState: ContextLifecycleState;
|
|
114
|
+
warmTopics: string[];
|
|
115
|
+
activeMemories: string[];
|
|
116
|
+
tasksSinceCompact: number;
|
|
117
|
+
lastCompactedAt?: number;
|
|
118
|
+
lastUpdatedAt: number;
|
|
119
|
+
source: "statusline" | "hook" | "api" | "estimate";
|
|
120
|
+
confidence: "exact" | "reported" | "estimated";
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface ContextSnapshot {
|
|
124
|
+
id: number;
|
|
125
|
+
agentId: string;
|
|
126
|
+
context: ContextState;
|
|
127
|
+
utilization: number;
|
|
128
|
+
lifecycleState: ContextLifecycleState;
|
|
129
|
+
tokensUsed?: number;
|
|
130
|
+
tokensMax?: number;
|
|
131
|
+
source: ContextState["source"];
|
|
132
|
+
confidence: ContextState["confidence"];
|
|
133
|
+
capturedAt: number;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export type MemoryType = "organization" | "role" | "project" | "task" | "interaction" | "agent";
|
|
137
|
+
export type MemoryVisibility = "private" | "project" | "org" | "public";
|
|
138
|
+
export type MemorySensitivity = "public" | "normal" | "sensitive" | "secret";
|
|
139
|
+
export type MemoryConfidence = "reported" | "inferred" | "verified";
|
|
140
|
+
export type MemoryRedactionState = "raw" | "redacted" | "rejected";
|
|
141
|
+
|
|
142
|
+
export interface Memory {
|
|
143
|
+
id: string;
|
|
144
|
+
type: MemoryType;
|
|
145
|
+
scope: string;
|
|
146
|
+
title: string;
|
|
147
|
+
content: string;
|
|
148
|
+
tags: string[];
|
|
149
|
+
visibility: MemoryVisibility;
|
|
150
|
+
sensitivity: MemorySensitivity;
|
|
151
|
+
confidence: MemoryConfidence;
|
|
152
|
+
redactionState: MemoryRedactionState;
|
|
153
|
+
relevanceScore: number;
|
|
154
|
+
sourceAgent?: string;
|
|
155
|
+
sourceTask?: number;
|
|
156
|
+
createdBy?: string;
|
|
157
|
+
contentHash?: string;
|
|
158
|
+
metadata: Record<string, unknown>;
|
|
159
|
+
accessCount: number;
|
|
160
|
+
lastAccessedAt?: number;
|
|
161
|
+
createdAt: number;
|
|
162
|
+
updatedAt: number;
|
|
163
|
+
expiresAt?: number;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface CreateMemoryInput {
|
|
167
|
+
type: MemoryType;
|
|
168
|
+
scope: string;
|
|
169
|
+
title: string;
|
|
170
|
+
content: string;
|
|
171
|
+
tags?: string[];
|
|
172
|
+
visibility?: MemoryVisibility;
|
|
173
|
+
sensitivity?: MemorySensitivity;
|
|
174
|
+
confidence?: MemoryConfidence;
|
|
175
|
+
redactionState?: MemoryRedactionState;
|
|
176
|
+
relevanceScore?: number;
|
|
177
|
+
sourceAgent?: string;
|
|
178
|
+
sourceTask?: number;
|
|
179
|
+
createdBy?: string;
|
|
180
|
+
metadata?: Record<string, unknown>;
|
|
181
|
+
ttlMs?: number;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export interface UpdateMemoryInput {
|
|
185
|
+
title?: string;
|
|
186
|
+
content?: string;
|
|
187
|
+
tags?: string[];
|
|
188
|
+
visibility?: MemoryVisibility;
|
|
189
|
+
sensitivity?: MemorySensitivity;
|
|
190
|
+
confidence?: MemoryConfidence;
|
|
191
|
+
redactionState?: MemoryRedactionState;
|
|
192
|
+
relevanceScore?: number;
|
|
193
|
+
metadata?: Record<string, unknown>;
|
|
194
|
+
expiresAt?: number | null;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface MemoryQuery {
|
|
198
|
+
type?: MemoryType;
|
|
199
|
+
scope?: string;
|
|
200
|
+
tags?: string[];
|
|
201
|
+
minRelevance?: number;
|
|
202
|
+
limit?: number;
|
|
203
|
+
includeExpired?: boolean;
|
|
204
|
+
visibility?: MemoryVisibility;
|
|
205
|
+
includeSensitive?: boolean;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface MemorySearchResult {
|
|
209
|
+
memories: Memory[];
|
|
210
|
+
total: number;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface PackagedMemory {
|
|
214
|
+
memory: Memory;
|
|
215
|
+
reason: string;
|
|
216
|
+
priority: 1 | 2 | 3;
|
|
217
|
+
score?: number;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export interface TaskRoutingHints {
|
|
221
|
+
id?: number;
|
|
222
|
+
title?: string;
|
|
223
|
+
text?: string;
|
|
224
|
+
scope?: string;
|
|
225
|
+
tags?: string[];
|
|
226
|
+
capabilities?: string[];
|
|
227
|
+
target?: string;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export interface ContextBudget {
|
|
231
|
+
maxTokens: number;
|
|
232
|
+
maxMemories: number;
|
|
233
|
+
priorityCutoff: 1 | 2 | 3;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export interface TaskHistorySummary {
|
|
237
|
+
taskId: number;
|
|
238
|
+
agentId: string;
|
|
239
|
+
status: string;
|
|
240
|
+
summary?: string;
|
|
241
|
+
completedAt?: number;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface ContextPackage {
|
|
245
|
+
memories: PackagedMemory[];
|
|
246
|
+
rolePrompt?: string;
|
|
247
|
+
recentContext?: string;
|
|
248
|
+
taskHistory?: TaskHistorySummary[];
|
|
249
|
+
estimatedTokens: number;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface ContextPackageRequest {
|
|
253
|
+
task: TaskRoutingHints;
|
|
254
|
+
agent: AgentCard;
|
|
255
|
+
budget: ContextBudget;
|
|
256
|
+
memories?: Memory[];
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export interface MemoryStats {
|
|
260
|
+
total: number;
|
|
261
|
+
byType: Partial<Record<MemoryType, number>>;
|
|
262
|
+
byScope: Record<string, number>;
|
|
263
|
+
bySensitivity: Partial<Record<MemorySensitivity, number>>;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export type ActiveMemoryClearReason = "compact" | "clearContext" | "restart" | "shutdown" | "manual";
|
|
267
|
+
|
|
268
|
+
export interface MemoryBrokerCapabilities {
|
|
269
|
+
search: true;
|
|
270
|
+
create: boolean;
|
|
271
|
+
update: boolean;
|
|
272
|
+
delete: boolean;
|
|
273
|
+
stats: boolean;
|
|
274
|
+
assemble: boolean;
|
|
275
|
+
activeTracking: boolean;
|
|
276
|
+
activeList: boolean;
|
|
277
|
+
external: boolean;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export interface MemoryBrokerContext {
|
|
281
|
+
now: number;
|
|
282
|
+
actor: string;
|
|
283
|
+
scopes: string[];
|
|
284
|
+
relayUrl?: string;
|
|
285
|
+
requestId?: string;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export type MemoryBrokerKind = "sqlite" | "http" | "command";
|
|
289
|
+
|
|
290
|
+
export interface SqliteMemoryBrokerConfig {
|
|
291
|
+
type: "sqlite";
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export interface HttpMemoryBrokerConfig {
|
|
295
|
+
type: "http";
|
|
296
|
+
url: string;
|
|
297
|
+
tokenEnv?: string;
|
|
298
|
+
timeoutMs?: number;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export interface CommandMemoryBrokerConfig {
|
|
302
|
+
type: "command";
|
|
303
|
+
command: string;
|
|
304
|
+
args?: string[];
|
|
305
|
+
timeoutMs?: number;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export type MemoryBrokerConfig = SqliteMemoryBrokerConfig | HttpMemoryBrokerConfig | CommandMemoryBrokerConfig;
|
|
309
|
+
|
|
23
310
|
export type MessageKind =
|
|
24
311
|
| "chat"
|
|
25
312
|
| "channel.event"
|
|
@@ -28,6 +315,71 @@ export type MessageKind =
|
|
|
28
315
|
| "control"
|
|
29
316
|
| "system";
|
|
30
317
|
|
|
318
|
+
export type ArtifactKind = "image" | "audio" | "video" | "document" | "archive" | "other";
|
|
319
|
+
export type ArtifactSensitivity = "public" | "normal" | "sensitive" | "secret";
|
|
320
|
+
export type ArtifactVisibility = "private" | "project" | "org";
|
|
321
|
+
export type ArtifactRole = "media" | "patch" | "report" | "log" | "output" | "input";
|
|
322
|
+
|
|
323
|
+
export interface ArtifactBlob {
|
|
324
|
+
digest: string;
|
|
325
|
+
storageUri: string;
|
|
326
|
+
mediaType: string;
|
|
327
|
+
size: number;
|
|
328
|
+
createdAt: number;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export interface ArtifactLink {
|
|
332
|
+
id: string;
|
|
333
|
+
artifactId: string;
|
|
334
|
+
entityType: "message" | "task" | "recipeRun" | "recipeStep" | "channelEvent";
|
|
335
|
+
entityId: string;
|
|
336
|
+
role?: ArtifactRole;
|
|
337
|
+
title?: string;
|
|
338
|
+
createdBy: string;
|
|
339
|
+
createdAt: number;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export interface Artifact {
|
|
343
|
+
id: string;
|
|
344
|
+
blobDigest: string;
|
|
345
|
+
mediaType: string;
|
|
346
|
+
kind: ArtifactKind;
|
|
347
|
+
filename?: string;
|
|
348
|
+
size: number;
|
|
349
|
+
digest: string;
|
|
350
|
+
visibility: ArtifactVisibility;
|
|
351
|
+
sensitivity: ArtifactSensitivity;
|
|
352
|
+
createdBy: string;
|
|
353
|
+
createdAt: number;
|
|
354
|
+
expiresAt?: number;
|
|
355
|
+
metadata: Record<string, unknown>;
|
|
356
|
+
links?: ArtifactLink[];
|
|
357
|
+
url?: string;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export interface AttachmentRef {
|
|
361
|
+
artifactId: string;
|
|
362
|
+
kind?: ArtifactKind;
|
|
363
|
+
role?: ArtifactRole;
|
|
364
|
+
title?: string;
|
|
365
|
+
ref?: AttachmentSourceRef;
|
|
366
|
+
metadata?: Record<string, unknown>;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
export interface ChannelAttachmentRef {
|
|
370
|
+
artifactId?: string;
|
|
371
|
+
kind?: ArtifactKind;
|
|
372
|
+
role?: ArtifactRole;
|
|
373
|
+
title?: string;
|
|
374
|
+
ref?: AttachmentSourceRef;
|
|
375
|
+
metadata?: Record<string, unknown>;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export type AttachmentSourceRef =
|
|
379
|
+
| { type: "relay-blob"; id: string; [key: string]: unknown }
|
|
380
|
+
| { type: "external-url"; url: string; [key: string]: unknown }
|
|
381
|
+
| { type: "channel-file"; id: string; provider?: string; uniqueId?: string; [key: string]: unknown };
|
|
382
|
+
|
|
31
383
|
export interface Message {
|
|
32
384
|
id: number;
|
|
33
385
|
from: string;
|
|
@@ -43,12 +395,93 @@ export interface Message {
|
|
|
43
395
|
claimedAt?: number;
|
|
44
396
|
claimExpiresAt?: number;
|
|
45
397
|
idempotencyKey?: string;
|
|
398
|
+
deliveryStatus?: MessageDeliveryStatus;
|
|
399
|
+
deliveryAttempts?: number;
|
|
400
|
+
deliveryLastError?: string;
|
|
401
|
+
deliveryNextRetryAt?: number;
|
|
402
|
+
deliveryPoisonReason?: string;
|
|
403
|
+
deliveryUpdatedAt?: number;
|
|
404
|
+
queuedAt?: number;
|
|
405
|
+
maxAgeSeconds?: number;
|
|
406
|
+
resolvedToAgent?: string;
|
|
46
407
|
payload: Record<string, unknown>;
|
|
47
408
|
meta?: Record<string, unknown>;
|
|
409
|
+
reactions?: MessageReaction[];
|
|
48
410
|
readBy: string[];
|
|
49
411
|
createdAt: number;
|
|
50
412
|
}
|
|
51
413
|
|
|
414
|
+
export interface ReplyObligation {
|
|
415
|
+
messageId: number;
|
|
416
|
+
agentId: string;
|
|
417
|
+
from: string;
|
|
418
|
+
kind: MessageKind;
|
|
419
|
+
subject?: string;
|
|
420
|
+
channel?: string;
|
|
421
|
+
bodyPreview: string;
|
|
422
|
+
createdAt: number;
|
|
423
|
+
replyCommand: string;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
export interface MessageReaction {
|
|
427
|
+
messageId: number;
|
|
428
|
+
actorId: string;
|
|
429
|
+
emoji: string;
|
|
430
|
+
createdAt: number;
|
|
431
|
+
updatedAt: number;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
export type RelayNotificationKind =
|
|
435
|
+
| "message"
|
|
436
|
+
| "reply"
|
|
437
|
+
| "error"
|
|
438
|
+
| "agent.blocked";
|
|
439
|
+
|
|
440
|
+
export type RelayNotificationSeverity = "info" | "warning" | "error";
|
|
441
|
+
|
|
442
|
+
export interface RelayNotification {
|
|
443
|
+
id: string;
|
|
444
|
+
kind: RelayNotificationKind;
|
|
445
|
+
severity: RelayNotificationSeverity;
|
|
446
|
+
title: string;
|
|
447
|
+
body: string;
|
|
448
|
+
messageId?: number;
|
|
449
|
+
agentId?: string;
|
|
450
|
+
threadPeer?: string;
|
|
451
|
+
view?: "chat" | "messages" | "agents" | "work" | "tasks" | "channels" | "overview";
|
|
452
|
+
createdAt: number;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
export type MessageDeliveryStatus = "pending" | "delivered" | "queued" | "failed" | "dead";
|
|
456
|
+
|
|
457
|
+
export interface MessageDeliveryAttempt {
|
|
458
|
+
id: number;
|
|
459
|
+
messageId: number;
|
|
460
|
+
agentId?: string;
|
|
461
|
+
action: "attempt" | "retry-now" | "mark-dead" | "clear";
|
|
462
|
+
status: MessageDeliveryStatus;
|
|
463
|
+
error?: string;
|
|
464
|
+
nextRetryAt?: number;
|
|
465
|
+
poisonReason?: string;
|
|
466
|
+
createdAt: number;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
export interface MessageDeliveryState extends Pick<Message,
|
|
470
|
+
| "id"
|
|
471
|
+
| "to"
|
|
472
|
+
| "deliveryStatus"
|
|
473
|
+
| "deliveryAttempts"
|
|
474
|
+
| "deliveryLastError"
|
|
475
|
+
| "deliveryNextRetryAt"
|
|
476
|
+
| "deliveryPoisonReason"
|
|
477
|
+
| "deliveryUpdatedAt"
|
|
478
|
+
| "queuedAt"
|
|
479
|
+
| "maxAgeSeconds"
|
|
480
|
+
| "resolvedToAgent"
|
|
481
|
+
> {
|
|
482
|
+
attempts: MessageDeliveryAttempt[];
|
|
483
|
+
}
|
|
484
|
+
|
|
52
485
|
export interface SendMessageInput {
|
|
53
486
|
from: string;
|
|
54
487
|
to: string;
|
|
@@ -59,6 +492,8 @@ export interface SendMessageInput {
|
|
|
59
492
|
replyTo?: number;
|
|
60
493
|
claimable?: boolean;
|
|
61
494
|
idempotencyKey?: string;
|
|
495
|
+
maxAgeSeconds?: number;
|
|
496
|
+
attachments?: AttachmentRef[];
|
|
62
497
|
payload?: Record<string, unknown>;
|
|
63
498
|
meta?: Record<string, unknown>;
|
|
64
499
|
}
|
|
@@ -175,6 +610,8 @@ export interface RegisterAgentInput {
|
|
|
175
610
|
ready?: boolean;
|
|
176
611
|
status?: AgentCard["status"];
|
|
177
612
|
instanceId?: string;
|
|
613
|
+
providerCapabilities?: ProviderCapabilities;
|
|
614
|
+
context?: ContextState;
|
|
178
615
|
meta?: Record<string, unknown>;
|
|
179
616
|
}
|
|
180
617
|
|
|
@@ -280,6 +717,7 @@ export interface IntegrationEventInput {
|
|
|
280
717
|
channel?: string;
|
|
281
718
|
dedupeKey?: string;
|
|
282
719
|
externalUrl?: string;
|
|
720
|
+
attachments?: AttachmentRef[];
|
|
283
721
|
metadata?: Record<string, unknown>;
|
|
284
722
|
}
|
|
285
723
|
|
|
@@ -295,8 +733,19 @@ export interface IntegrationTaskStats {
|
|
|
295
733
|
|
|
296
734
|
export interface IntegrationSummary {
|
|
297
735
|
name: string;
|
|
736
|
+
displayName?: string;
|
|
737
|
+
description?: string;
|
|
738
|
+
enabled: boolean;
|
|
298
739
|
configured: boolean;
|
|
299
740
|
observed: boolean;
|
|
741
|
+
type?: string;
|
|
742
|
+
icon?: string;
|
|
743
|
+
accentColor?: string;
|
|
744
|
+
tags: string[];
|
|
745
|
+
homepageUrl?: string;
|
|
746
|
+
repositoryUrl?: string;
|
|
747
|
+
docsUrl?: string;
|
|
748
|
+
manifest?: Record<string, unknown>;
|
|
300
749
|
scopes: string[];
|
|
301
750
|
targets: string[];
|
|
302
751
|
channels: string[];
|
|
@@ -310,6 +759,32 @@ export interface IntegrationSummary {
|
|
|
310
759
|
taskStats: IntegrationTaskStats;
|
|
311
760
|
}
|
|
312
761
|
|
|
762
|
+
export type RuntimeContractName =
|
|
763
|
+
| "relayApi"
|
|
764
|
+
| "orchestratorProtocol"
|
|
765
|
+
| "runnerProtocol"
|
|
766
|
+
| "providerPluginProtocol";
|
|
767
|
+
|
|
768
|
+
export type RuntimeContracts = Partial<Record<RuntimeContractName, number>>;
|
|
769
|
+
export type RuntimeCapabilities = Record<string, boolean>;
|
|
770
|
+
|
|
771
|
+
export interface RuntimePackageMetadata {
|
|
772
|
+
name: string;
|
|
773
|
+
version: string;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
export interface ContractCompatibilityIssue {
|
|
777
|
+
contract: string;
|
|
778
|
+
expected: string;
|
|
779
|
+
actual?: number;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
export interface ContractCompatibility {
|
|
783
|
+
status: "compatible" | "incompatible" | "unknown";
|
|
784
|
+
compatible: boolean;
|
|
785
|
+
issues: ContractCompatibilityIssue[];
|
|
786
|
+
}
|
|
787
|
+
|
|
313
788
|
export type AutomationKind = "scheduled_task";
|
|
314
789
|
export type AutomationCatchUpPolicy = "skip" | "run_once" | "run_all";
|
|
315
790
|
export type AutomationConcurrencyPolicy = "skip" | "queue" | "replace";
|
|
@@ -337,15 +812,25 @@ export interface AutomationExistingAgentPolicy {
|
|
|
337
812
|
export interface AutomationOnDemandAgentPolicy {
|
|
338
813
|
mode: "on_demand_agent";
|
|
339
814
|
provider: SpawnProvider;
|
|
815
|
+
model?: string;
|
|
816
|
+
effort?: SpawnEffort;
|
|
340
817
|
cwd?: string;
|
|
818
|
+
workspaceMode?: WorkspaceMode;
|
|
341
819
|
profile?: string;
|
|
342
820
|
approvalMode?: SpawnApprovalMode;
|
|
343
821
|
keepAlive?: boolean;
|
|
822
|
+
runtimeBudget?: AutomationRuntimeBudget;
|
|
344
823
|
shutdownAfterMs?: number;
|
|
345
824
|
}
|
|
346
825
|
|
|
347
826
|
export type AutomationTargetPolicy = AutomationExistingAgentPolicy | AutomationOnDemandAgentPolicy;
|
|
348
827
|
|
|
828
|
+
export interface AutomationRuntimeBudget {
|
|
829
|
+
maxRuntimeMs: number;
|
|
830
|
+
warnAtMs?: number;
|
|
831
|
+
warningMessage?: string;
|
|
832
|
+
}
|
|
833
|
+
|
|
349
834
|
export interface AutomationTaskTemplate {
|
|
350
835
|
title: string;
|
|
351
836
|
body: string;
|
|
@@ -429,7 +914,8 @@ export type ChannelRouteTarget =
|
|
|
429
914
|
| { type: "capability"; id: string }
|
|
430
915
|
| { type: "broadcast" }
|
|
431
916
|
| { type: "orchestrator"; id: string }
|
|
432
|
-
| { type: "pool"; id: string }
|
|
917
|
+
| { type: "pool"; id: string }
|
|
918
|
+
| { type: "policy"; id: string };
|
|
433
919
|
|
|
434
920
|
export type ChannelBindingMode = "exclusive" | "broadcast";
|
|
435
921
|
|
|
@@ -484,6 +970,22 @@ export interface ChannelSummary {
|
|
|
484
970
|
meta?: Record<string, unknown>;
|
|
485
971
|
}
|
|
486
972
|
|
|
973
|
+
export interface ChannelEventInput {
|
|
974
|
+
body?: string;
|
|
975
|
+
payload: Record<string, unknown>;
|
|
976
|
+
attachments?: ChannelAttachmentRef[];
|
|
977
|
+
conversationId?: string;
|
|
978
|
+
idempotencyKey?: string;
|
|
979
|
+
instanceId?: string;
|
|
980
|
+
epoch?: number;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
export interface ChannelEventResult {
|
|
984
|
+
messages: Message[];
|
|
985
|
+
bindings: ChannelBinding[];
|
|
986
|
+
created: boolean;
|
|
987
|
+
}
|
|
988
|
+
|
|
487
989
|
export interface TaskStatusInput {
|
|
488
990
|
status: TaskStatus;
|
|
489
991
|
agentId?: string;
|
|
@@ -517,6 +1019,28 @@ export interface InboxState {
|
|
|
517
1019
|
drafts: InboxDraft[];
|
|
518
1020
|
}
|
|
519
1021
|
|
|
1022
|
+
export interface ChatHistoryImportEntry {
|
|
1023
|
+
position: number;
|
|
1024
|
+
originalMessageId: number;
|
|
1025
|
+
originalFrom: string;
|
|
1026
|
+
originalTo: string;
|
|
1027
|
+
originalCreatedAt: number;
|
|
1028
|
+
message: Message;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
export interface ChatHistoryImport {
|
|
1032
|
+
id: string;
|
|
1033
|
+
targetAgentId?: string;
|
|
1034
|
+
targetSpawnRequestId?: string;
|
|
1035
|
+
sourcePeerId: string;
|
|
1036
|
+
sourceAgentId?: string;
|
|
1037
|
+
sourceThreadId?: string;
|
|
1038
|
+
sourceAgentLabel?: string;
|
|
1039
|
+
importedBy: string;
|
|
1040
|
+
importedAt: number;
|
|
1041
|
+
entries: ChatHistoryImportEntry[];
|
|
1042
|
+
}
|
|
1043
|
+
|
|
520
1044
|
export type ActivityKind = "message" | "reply" | "question" | "operator" | "pair" | "task" | "state";
|
|
521
1045
|
|
|
522
1046
|
export interface ActivityEvent {
|
|
@@ -560,6 +1084,218 @@ export interface ActivityEventInput {
|
|
|
560
1084
|
export type OrchestratorStatus = "online" | "offline";
|
|
561
1085
|
export type SpawnProvider = "claude" | "codex";
|
|
562
1086
|
export type SpawnApprovalMode = "open" | "guarded" | "read-only";
|
|
1087
|
+
export type SpawnEffort = "low" | "medium" | "high" | "xhigh" | "max";
|
|
1088
|
+
export type WorkspaceMode = "isolated" | "shared" | "inherit";
|
|
1089
|
+
export type WorkspaceStatus = "active" | "ready" | "conflict" | "review_requested" | "merge_planned" | "abandoned" | "cleanup_requested" | "cleaned";
|
|
1090
|
+
|
|
1091
|
+
export interface WorkspaceProbeWorktree {
|
|
1092
|
+
path: string;
|
|
1093
|
+
branch?: string;
|
|
1094
|
+
headSha?: string;
|
|
1095
|
+
bare?: boolean;
|
|
1096
|
+
detached?: boolean;
|
|
1097
|
+
prunable?: boolean;
|
|
1098
|
+
locked?: boolean;
|
|
1099
|
+
reason?: string;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
export interface WorkspaceProbe {
|
|
1103
|
+
path: string;
|
|
1104
|
+
isGitRepo: boolean;
|
|
1105
|
+
repoRoot?: string;
|
|
1106
|
+
branch?: string;
|
|
1107
|
+
headSha?: string;
|
|
1108
|
+
dirty?: boolean;
|
|
1109
|
+
detached?: boolean;
|
|
1110
|
+
worktrees?: WorkspaceProbeWorktree[];
|
|
1111
|
+
error?: string;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
export interface WorkspaceMetadata {
|
|
1115
|
+
id?: string;
|
|
1116
|
+
mode: WorkspaceMode;
|
|
1117
|
+
requestedMode?: WorkspaceMode;
|
|
1118
|
+
repoRoot?: string;
|
|
1119
|
+
sourceCwd?: string;
|
|
1120
|
+
worktreePath?: string;
|
|
1121
|
+
branch?: string;
|
|
1122
|
+
baseRef?: string;
|
|
1123
|
+
baseSha?: string;
|
|
1124
|
+
status?: WorkspaceStatus;
|
|
1125
|
+
stewardAgentId?: string;
|
|
1126
|
+
probe?: WorkspaceProbe;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
export interface WorkspaceRecord {
|
|
1130
|
+
id: string;
|
|
1131
|
+
repoRoot: string;
|
|
1132
|
+
sourceCwd: string;
|
|
1133
|
+
worktreePath: string;
|
|
1134
|
+
branch?: string;
|
|
1135
|
+
baseRef?: string;
|
|
1136
|
+
baseSha?: string;
|
|
1137
|
+
mode: WorkspaceMode;
|
|
1138
|
+
requestedMode?: WorkspaceMode;
|
|
1139
|
+
status: WorkspaceStatus;
|
|
1140
|
+
ownerAgentId?: string;
|
|
1141
|
+
ownerPolicyName?: string;
|
|
1142
|
+
ownerAutomationRunId?: string;
|
|
1143
|
+
stewardAgentId?: string;
|
|
1144
|
+
metadata: Record<string, unknown>;
|
|
1145
|
+
createdAt: number;
|
|
1146
|
+
updatedAt: number;
|
|
1147
|
+
readyAt?: number;
|
|
1148
|
+
cleanedAt?: number;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
export interface ConfigEntry<T = unknown> {
|
|
1152
|
+
namespace: string;
|
|
1153
|
+
key: string;
|
|
1154
|
+
value: T;
|
|
1155
|
+
version: number;
|
|
1156
|
+
updatedAt: string;
|
|
1157
|
+
updatedBy?: string;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
export interface ConfigHistoryEntry<T = unknown> {
|
|
1161
|
+
id: number;
|
|
1162
|
+
namespace: string;
|
|
1163
|
+
key: string;
|
|
1164
|
+
value: T;
|
|
1165
|
+
version: number;
|
|
1166
|
+
changedAt: string;
|
|
1167
|
+
changedBy?: string;
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
export type ManagedAgentStatus = "stopped" | "starting" | "running" | "stopping" | "backoff";
|
|
1171
|
+
|
|
1172
|
+
export interface ManagedAgentState {
|
|
1173
|
+
policyName: string;
|
|
1174
|
+
status: ManagedAgentStatus;
|
|
1175
|
+
agentId?: string;
|
|
1176
|
+
orchestratorId: string;
|
|
1177
|
+
provider: SpawnProvider;
|
|
1178
|
+
tmuxSession?: string;
|
|
1179
|
+
spawnRequestId?: string;
|
|
1180
|
+
workspaceId?: string;
|
|
1181
|
+
workspacePath?: string;
|
|
1182
|
+
workspaceBranch?: string;
|
|
1183
|
+
lastSpawnAt?: number;
|
|
1184
|
+
lastStopAt?: number;
|
|
1185
|
+
healthySince?: number;
|
|
1186
|
+
restartCount: number;
|
|
1187
|
+
consecutiveFailures: number;
|
|
1188
|
+
backoffUntil?: number;
|
|
1189
|
+
lastError?: string;
|
|
1190
|
+
updatedAt: number;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
export type SpawnPolicyMode = "always-on" | "on-demand";
|
|
1194
|
+
|
|
1195
|
+
export type AgentProfileProvider = SpawnProvider | "any";
|
|
1196
|
+
export type AgentProfileBase = "host" | "minimal" | "isolated";
|
|
1197
|
+
export type AgentProfileInstructionPolicy = "allow" | "ignore";
|
|
1198
|
+
export type AgentProfileCategoryMode = "host" | "profile" | "repo" | "none";
|
|
1199
|
+
export type AgentProfileFilesystemScope = "repo" | "workspace" | "host";
|
|
1200
|
+
|
|
1201
|
+
export interface AgentProfileAssetRef {
|
|
1202
|
+
source: "relay" | "repo" | "inline" | "provider";
|
|
1203
|
+
ref: string;
|
|
1204
|
+
enabled: boolean;
|
|
1205
|
+
provider?: AgentProfileProvider;
|
|
1206
|
+
meta?: Record<string, unknown>;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
export interface AgentProfile {
|
|
1210
|
+
name: string;
|
|
1211
|
+
description?: string;
|
|
1212
|
+
provider?: AgentProfileProvider;
|
|
1213
|
+
base: AgentProfileBase;
|
|
1214
|
+
builtIn?: boolean;
|
|
1215
|
+
instructions: {
|
|
1216
|
+
system?: string;
|
|
1217
|
+
append: string[];
|
|
1218
|
+
repoInstructions: AgentProfileInstructionPolicy;
|
|
1219
|
+
globalInstructions: AgentProfileInstructionPolicy;
|
|
1220
|
+
};
|
|
1221
|
+
relay: {
|
|
1222
|
+
context: boolean;
|
|
1223
|
+
skills: boolean;
|
|
1224
|
+
plugins: boolean;
|
|
1225
|
+
statusLine: boolean;
|
|
1226
|
+
};
|
|
1227
|
+
skills: AgentProfileAssetRef[];
|
|
1228
|
+
plugins: AgentProfileAssetRef[];
|
|
1229
|
+
mcp: {
|
|
1230
|
+
mode: AgentProfileCategoryMode;
|
|
1231
|
+
servers?: Record<string, unknown>;
|
|
1232
|
+
};
|
|
1233
|
+
hooks: {
|
|
1234
|
+
mode: AgentProfileCategoryMode;
|
|
1235
|
+
};
|
|
1236
|
+
permissions: {
|
|
1237
|
+
mode?: SpawnApprovalMode;
|
|
1238
|
+
filesystem: AgentProfileFilesystemScope;
|
|
1239
|
+
};
|
|
1240
|
+
env: Record<string, string>;
|
|
1241
|
+
providerOptions: Record<string, unknown>;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
export type AgentProfileProjectionResult = "applied" | "partial" | "unsupported" | "not-applicable";
|
|
1245
|
+
|
|
1246
|
+
export interface AgentProfileProjectionEntry {
|
|
1247
|
+
capability: string;
|
|
1248
|
+
requested: string;
|
|
1249
|
+
result: AgentProfileProjectionResult;
|
|
1250
|
+
detail: string;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
export interface AgentProfileProjectionReport {
|
|
1254
|
+
profileName: string;
|
|
1255
|
+
provider: SpawnProvider;
|
|
1256
|
+
base: AgentProfileBase;
|
|
1257
|
+
generatedAt: number;
|
|
1258
|
+
entries: AgentProfileProjectionEntry[];
|
|
1259
|
+
warnings: string[];
|
|
1260
|
+
unsupported: string[];
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
export interface SpawnPolicy {
|
|
1264
|
+
name: string;
|
|
1265
|
+
description?: string;
|
|
1266
|
+
// Desired on/off switch. `false` keeps the policy from (re)spawning even for
|
|
1267
|
+
// always-on mode, so a manual stop survives reconcile ticks. Defaults to true.
|
|
1268
|
+
enabled?: boolean;
|
|
1269
|
+
orchestratorId: string;
|
|
1270
|
+
cwd: string;
|
|
1271
|
+
provider: SpawnProvider;
|
|
1272
|
+
workspaceMode?: WorkspaceMode;
|
|
1273
|
+
rig?: string;
|
|
1274
|
+
model?: string;
|
|
1275
|
+
effort?: SpawnEffort;
|
|
1276
|
+
profile?: string;
|
|
1277
|
+
providerArgs: string[];
|
|
1278
|
+
prompt?: string;
|
|
1279
|
+
tags: string[];
|
|
1280
|
+
capabilities: string[];
|
|
1281
|
+
label?: string;
|
|
1282
|
+
mode: SpawnPolicyMode;
|
|
1283
|
+
permissionMode: SpawnApprovalMode;
|
|
1284
|
+
restartOnUpdate: boolean;
|
|
1285
|
+
scheduledDailyRestart: boolean;
|
|
1286
|
+
onDemand?: {
|
|
1287
|
+
keepaliveSeconds: number;
|
|
1288
|
+
idleDefinition: "no-activity";
|
|
1289
|
+
};
|
|
1290
|
+
backoff: {
|
|
1291
|
+
schedule: number[];
|
|
1292
|
+
resetAfterSeconds: number;
|
|
1293
|
+
};
|
|
1294
|
+
binding?: {
|
|
1295
|
+
type: "channel";
|
|
1296
|
+
channelId: string;
|
|
1297
|
+
};
|
|
1298
|
+
}
|
|
563
1299
|
|
|
564
1300
|
export interface Orchestrator {
|
|
565
1301
|
id: string;
|
|
@@ -567,9 +1303,15 @@ export interface Orchestrator {
|
|
|
567
1303
|
status: OrchestratorStatus;
|
|
568
1304
|
agentId: string; // relay agent id for messaging
|
|
569
1305
|
providers: SpawnProvider[];
|
|
1306
|
+
providerStatus?: ProviderStatusReport[];
|
|
1307
|
+
providerCatalog?: ProviderCatalogSummary[];
|
|
570
1308
|
baseDir: string;
|
|
571
1309
|
apiUrl?: string;
|
|
572
1310
|
envKeys: string[]; // names only, never values
|
|
1311
|
+
package?: RuntimePackageMetadata;
|
|
1312
|
+
contracts?: RuntimeContracts;
|
|
1313
|
+
capabilities?: RuntimeCapabilities;
|
|
1314
|
+
contractCompatibility?: ContractCompatibility;
|
|
573
1315
|
version?: string;
|
|
574
1316
|
protocolVersion?: number;
|
|
575
1317
|
gitSha?: string;
|
|
@@ -581,10 +1323,11 @@ export interface Orchestrator {
|
|
|
581
1323
|
}
|
|
582
1324
|
|
|
583
1325
|
export interface OrchestratorHealth {
|
|
584
|
-
status: "ok" | "warn" | "
|
|
1326
|
+
status: "ok" | "warn" | "restart-required" | "upgrade-required" | "unknown";
|
|
585
1327
|
restartRequired: boolean;
|
|
1328
|
+
upgradeRequired?: boolean;
|
|
586
1329
|
issues: Array<{
|
|
587
|
-
code: "missing-version" | "
|
|
1330
|
+
code: "missing-version" | "package-drift" | "missing-contract" | "protocol-mismatch" | "restart-required" | "upgrade-required";
|
|
588
1331
|
detail: string;
|
|
589
1332
|
}>;
|
|
590
1333
|
}
|
|
@@ -592,21 +1335,80 @@ export interface OrchestratorHealth {
|
|
|
592
1335
|
export interface ManagedAgent {
|
|
593
1336
|
agentId: string;
|
|
594
1337
|
provider: SpawnProvider;
|
|
1338
|
+
model?: string;
|
|
1339
|
+
effort?: SpawnEffort;
|
|
1340
|
+
profile?: string;
|
|
1341
|
+
workspaceMode?: WorkspaceMode;
|
|
1342
|
+
workspace?: WorkspaceMetadata;
|
|
1343
|
+
sessionName?: string;
|
|
1344
|
+
supervisor?: "process" | "systemd" | "unknown";
|
|
1345
|
+
systemdUnit?: string;
|
|
1346
|
+
terminalSession?: string;
|
|
1347
|
+
terminalAvailable?: boolean;
|
|
595
1348
|
tmuxSession: string;
|
|
596
1349
|
cwd: string;
|
|
597
1350
|
label?: string;
|
|
598
1351
|
approvalMode: SpawnApprovalMode;
|
|
1352
|
+
policyName?: string;
|
|
1353
|
+
spawnRequestId?: string;
|
|
1354
|
+
automationRunId?: string;
|
|
599
1355
|
pid?: number;
|
|
600
1356
|
startedAt: number;
|
|
601
1357
|
}
|
|
602
1358
|
|
|
1359
|
+
export interface ManagedSessionExitDiagnostics {
|
|
1360
|
+
agentId: string;
|
|
1361
|
+
provider: SpawnProvider;
|
|
1362
|
+
workspaceMode?: WorkspaceMode;
|
|
1363
|
+
workspace?: WorkspaceMetadata;
|
|
1364
|
+
sessionName?: string;
|
|
1365
|
+
tmuxSession: string;
|
|
1366
|
+
cwd: string;
|
|
1367
|
+
label?: string;
|
|
1368
|
+
policyName?: string;
|
|
1369
|
+
spawnRequestId?: string;
|
|
1370
|
+
automationRunId?: string;
|
|
1371
|
+
supervisor: "process" | "systemd" | "unknown";
|
|
1372
|
+
systemdUnit?: string;
|
|
1373
|
+
terminalSession?: string;
|
|
1374
|
+
terminalAvailable?: boolean;
|
|
1375
|
+
pid?: number;
|
|
1376
|
+
currentPid?: number;
|
|
1377
|
+
startedAt: number;
|
|
1378
|
+
detectedAt: number;
|
|
1379
|
+
runtimeMs: number;
|
|
1380
|
+
logFile?: string;
|
|
1381
|
+
logBytes?: number;
|
|
1382
|
+
logEmpty?: boolean;
|
|
1383
|
+
logTail?: string[];
|
|
1384
|
+
runnerInfoFile?: string;
|
|
1385
|
+
runnerInfoPresent?: boolean;
|
|
1386
|
+
systemd?: {
|
|
1387
|
+
unit: string;
|
|
1388
|
+
activeState?: string;
|
|
1389
|
+
subState?: string;
|
|
1390
|
+
result?: string;
|
|
1391
|
+
execMainCode?: string;
|
|
1392
|
+
execMainStatus?: string;
|
|
1393
|
+
mainPid?: number;
|
|
1394
|
+
unavailable?: string;
|
|
1395
|
+
};
|
|
1396
|
+
unavailable?: string[];
|
|
1397
|
+
lastError: string;
|
|
1398
|
+
}
|
|
1399
|
+
|
|
603
1400
|
export interface RegisterOrchestratorInput {
|
|
604
1401
|
id: string;
|
|
605
1402
|
hostname: string;
|
|
606
1403
|
providers: SpawnProvider[];
|
|
1404
|
+
providerStatus?: ProviderStatusReport[];
|
|
1405
|
+
providerCatalog?: ProviderCatalogSummary[];
|
|
607
1406
|
baseDir: string;
|
|
608
1407
|
apiUrl?: string;
|
|
609
1408
|
envKeys?: string[];
|
|
1409
|
+
package?: RuntimePackageMetadata;
|
|
1410
|
+
contracts?: RuntimeContracts;
|
|
1411
|
+
capabilities?: RuntimeCapabilities;
|
|
610
1412
|
version?: string;
|
|
611
1413
|
protocolVersion?: number;
|
|
612
1414
|
gitSha?: string;
|
|
@@ -614,23 +1416,120 @@ export interface RegisterOrchestratorInput {
|
|
|
614
1416
|
}
|
|
615
1417
|
|
|
616
1418
|
export interface OrchestratorRuntimeInput {
|
|
1419
|
+
package?: RuntimePackageMetadata;
|
|
1420
|
+
contracts?: RuntimeContracts;
|
|
1421
|
+
capabilities?: RuntimeCapabilities;
|
|
617
1422
|
version?: string;
|
|
618
1423
|
protocolVersion?: number;
|
|
619
1424
|
gitSha?: string;
|
|
1425
|
+
providers?: SpawnProvider[];
|
|
1426
|
+
providerStatus?: ProviderStatusReport[];
|
|
1427
|
+
providerCatalog?: ProviderCatalogSummary[];
|
|
620
1428
|
}
|
|
621
1429
|
|
|
622
1430
|
export interface OrchestratorSpawnInput {
|
|
623
1431
|
provider: SpawnProvider;
|
|
1432
|
+
model?: string;
|
|
1433
|
+
effort?: SpawnEffort;
|
|
624
1434
|
cwd?: string;
|
|
1435
|
+
workspaceMode?: WorkspaceMode;
|
|
625
1436
|
label?: string;
|
|
626
1437
|
approvalMode?: SpawnApprovalMode;
|
|
627
1438
|
prompt?: string;
|
|
1439
|
+
systemPromptAppend?: string;
|
|
628
1440
|
env?: Record<string, string>;
|
|
629
1441
|
}
|
|
630
1442
|
|
|
1443
|
+
export interface ProviderStatusReport {
|
|
1444
|
+
name: SpawnProvider;
|
|
1445
|
+
available: boolean;
|
|
1446
|
+
checkedAt: number;
|
|
1447
|
+
reason?: string;
|
|
1448
|
+
version?: string;
|
|
1449
|
+
features?: Record<string, boolean>;
|
|
1450
|
+
cli?: {
|
|
1451
|
+
command: string;
|
|
1452
|
+
path?: string;
|
|
1453
|
+
ok: boolean;
|
|
1454
|
+
version?: string;
|
|
1455
|
+
error?: string;
|
|
1456
|
+
};
|
|
1457
|
+
runner?: {
|
|
1458
|
+
command: string;
|
|
1459
|
+
path?: string;
|
|
1460
|
+
ok: boolean;
|
|
1461
|
+
version?: string;
|
|
1462
|
+
error?: string;
|
|
1463
|
+
};
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
export interface ProviderCatalogSummary {
|
|
1467
|
+
provider: SpawnProvider;
|
|
1468
|
+
label: string;
|
|
1469
|
+
defaultModel?: string;
|
|
1470
|
+
models: Array<{
|
|
1471
|
+
alias: string;
|
|
1472
|
+
label: string;
|
|
1473
|
+
providerModel: string;
|
|
1474
|
+
efforts: SpawnEffort[];
|
|
1475
|
+
defaultEffort?: SpawnEffort;
|
|
1476
|
+
limits?: {
|
|
1477
|
+
contextWindowTokens?: {
|
|
1478
|
+
value: number;
|
|
1479
|
+
source: "catalog" | "provider" | "runtime" | "override";
|
|
1480
|
+
confidence: "declared" | "verified" | "estimated" | "unknown";
|
|
1481
|
+
lastUpdatedAt?: number;
|
|
1482
|
+
};
|
|
1483
|
+
maxOutputTokens?: {
|
|
1484
|
+
value: number;
|
|
1485
|
+
source: "catalog" | "provider" | "runtime" | "override";
|
|
1486
|
+
confidence: "declared" | "verified" | "estimated" | "unknown";
|
|
1487
|
+
lastUpdatedAt?: number;
|
|
1488
|
+
};
|
|
1489
|
+
};
|
|
1490
|
+
capabilities?: {
|
|
1491
|
+
modalities: {
|
|
1492
|
+
input: {
|
|
1493
|
+
text: boolean;
|
|
1494
|
+
image?: boolean;
|
|
1495
|
+
audio?: boolean;
|
|
1496
|
+
video?: boolean;
|
|
1497
|
+
pdf?: boolean;
|
|
1498
|
+
};
|
|
1499
|
+
output: {
|
|
1500
|
+
text: boolean;
|
|
1501
|
+
image?: boolean;
|
|
1502
|
+
audio?: boolean;
|
|
1503
|
+
video?: boolean;
|
|
1504
|
+
};
|
|
1505
|
+
};
|
|
1506
|
+
tools?: {
|
|
1507
|
+
code?: boolean;
|
|
1508
|
+
review?: boolean;
|
|
1509
|
+
debug?: boolean;
|
|
1510
|
+
refactor?: boolean;
|
|
1511
|
+
shell?: boolean;
|
|
1512
|
+
fileRead?: boolean;
|
|
1513
|
+
fileWrite?: boolean;
|
|
1514
|
+
webSearch?: boolean;
|
|
1515
|
+
imageGeneration?: boolean;
|
|
1516
|
+
imageEditing?: boolean;
|
|
1517
|
+
};
|
|
1518
|
+
source: "catalog" | "provider" | "runtime" | "override";
|
|
1519
|
+
confidence: "declared" | "verified" | "estimated" | "unknown";
|
|
1520
|
+
lastUpdatedAt?: number;
|
|
1521
|
+
};
|
|
1522
|
+
}>;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
631
1525
|
export interface OrchestratorSpawnResult {
|
|
632
1526
|
orchestratorId: string;
|
|
633
1527
|
provider: SpawnProvider;
|
|
1528
|
+
sessionName?: string;
|
|
1529
|
+
supervisor?: "process" | "systemd" | "unknown";
|
|
1530
|
+
systemdUnit?: string;
|
|
1531
|
+
terminalSession?: string;
|
|
1532
|
+
terminalAvailable?: boolean;
|
|
634
1533
|
tmuxSession: string;
|
|
635
1534
|
cwd: string;
|
|
636
1535
|
label?: string;
|
|
@@ -656,9 +1555,11 @@ export interface RecipeAgent {
|
|
|
656
1555
|
capabilities: string[];
|
|
657
1556
|
label?: string;
|
|
658
1557
|
tags?: string[];
|
|
1558
|
+
memoryTags?: string[];
|
|
659
1559
|
approvalMode?: "open" | "guarded" | "read-only";
|
|
660
1560
|
prompt?: string;
|
|
661
1561
|
model?: string;
|
|
1562
|
+
effort?: SpawnEffort;
|
|
662
1563
|
env?: Record<string, string>;
|
|
663
1564
|
}
|
|
664
1565
|
|
|
@@ -677,6 +1578,20 @@ export interface RecipeRoute {
|
|
|
677
1578
|
export interface RecipeLifecycle {
|
|
678
1579
|
mode?: "persistent" | "ephemeral";
|
|
679
1580
|
idleTimeoutMs?: number;
|
|
1581
|
+
memory?: RecipeMemoryPolicy;
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
export interface RecipeMemoryPolicy {
|
|
1585
|
+
injectOnAssign?: boolean;
|
|
1586
|
+
autoCapture?: boolean;
|
|
1587
|
+
captureTypes?: MemoryType[];
|
|
1588
|
+
memoryTags?: string[];
|
|
1589
|
+
alwaysReload?: string[];
|
|
1590
|
+
scope?: string;
|
|
1591
|
+
maxTokens?: number;
|
|
1592
|
+
maxMemories?: number;
|
|
1593
|
+
priorityCutoff?: 1 | 2 | 3;
|
|
1594
|
+
ttlMs?: number;
|
|
680
1595
|
}
|
|
681
1596
|
|
|
682
1597
|
export interface RecipeInstance {
|
|
@@ -687,6 +1602,7 @@ export interface RecipeInstance {
|
|
|
687
1602
|
orchestratorId: string;
|
|
688
1603
|
status: "starting" | "running" | "stopping" | "stopped" | "failed";
|
|
689
1604
|
agents: RecipeAgentInstance[];
|
|
1605
|
+
artifacts?: Artifact[];
|
|
690
1606
|
startedAt: number;
|
|
691
1607
|
stoppedAt?: number;
|
|
692
1608
|
startedBy: string;
|
|
@@ -705,30 +1621,142 @@ export interface ComponentToken {
|
|
|
705
1621
|
sub: string;
|
|
706
1622
|
role: "provider" | "channel" | "orchestrator" | "admin" | "dashboard" | string;
|
|
707
1623
|
scope: string[];
|
|
1624
|
+
constraints?: TokenConstraints;
|
|
708
1625
|
iat: number;
|
|
709
1626
|
exp?: number;
|
|
710
1627
|
jti?: string;
|
|
711
1628
|
}
|
|
712
1629
|
|
|
1630
|
+
export interface TokenRecord {
|
|
1631
|
+
jti: string;
|
|
1632
|
+
sub: string;
|
|
1633
|
+
role: string;
|
|
1634
|
+
scope: string[];
|
|
1635
|
+
constraints?: TokenConstraints;
|
|
1636
|
+
profileId?: string;
|
|
1637
|
+
issuedAt: number;
|
|
1638
|
+
expiresAt?: number;
|
|
1639
|
+
revokedAt?: number;
|
|
1640
|
+
createdBy?: string;
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
export interface TokenProfile {
|
|
1644
|
+
id: string;
|
|
1645
|
+
name: string;
|
|
1646
|
+
description?: string;
|
|
1647
|
+
role: string;
|
|
1648
|
+
scope: string[];
|
|
1649
|
+
constraints?: TokenConstraints;
|
|
1650
|
+
ttlSeconds?: number;
|
|
1651
|
+
builtIn: boolean;
|
|
1652
|
+
createdAt: number;
|
|
1653
|
+
updatedAt: number;
|
|
1654
|
+
createdBy?: string;
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
export interface CreateTokenProfileInput {
|
|
1658
|
+
id?: string;
|
|
1659
|
+
name: string;
|
|
1660
|
+
description?: string;
|
|
1661
|
+
role: string;
|
|
1662
|
+
scope: string[];
|
|
1663
|
+
constraints?: TokenConstraints;
|
|
1664
|
+
ttlSeconds?: number;
|
|
1665
|
+
createdBy?: string;
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
export type UpdateTokenProfileInput = Partial<Omit<CreateTokenProfileInput, "id">>;
|
|
1669
|
+
|
|
1670
|
+
export interface TokenConstraints {
|
|
1671
|
+
agents?: string[];
|
|
1672
|
+
policies?: string[];
|
|
1673
|
+
parentAgents?: string[];
|
|
1674
|
+
targets?: string[];
|
|
1675
|
+
channels?: string[];
|
|
1676
|
+
orchestrators?: string[];
|
|
1677
|
+
hosts?: string[];
|
|
1678
|
+
cwd?: string;
|
|
1679
|
+
cwdPrefixes?: string[];
|
|
1680
|
+
taskIds?: string[];
|
|
1681
|
+
memoryScopes?: string[];
|
|
1682
|
+
integrationNames?: string[];
|
|
1683
|
+
spawnRequestIds?: string[];
|
|
1684
|
+
terminalAttach?: boolean;
|
|
1685
|
+
logsRead?: boolean;
|
|
1686
|
+
canDelegate?: boolean;
|
|
1687
|
+
}
|
|
1688
|
+
|
|
713
1689
|
export type TokenScope =
|
|
1690
|
+
| "system:admin"
|
|
1691
|
+
| "token:read"
|
|
1692
|
+
| "token:write"
|
|
714
1693
|
| "agent:read"
|
|
715
1694
|
| "agent:write"
|
|
716
|
-
| "message:send"
|
|
717
1695
|
| "message:read"
|
|
718
|
-
| "
|
|
719
|
-
| "command:shutdown"
|
|
720
|
-
| "command:*"
|
|
1696
|
+
| "message:send"
|
|
721
1697
|
| "task:read"
|
|
722
1698
|
| "task:write"
|
|
1699
|
+
| "command:read"
|
|
1700
|
+
| "command:write"
|
|
1701
|
+
| "command:*"
|
|
1702
|
+
| "artifact:read"
|
|
1703
|
+
| "artifact:write"
|
|
1704
|
+
| "artifact:admin"
|
|
1705
|
+
| "memory:read"
|
|
1706
|
+
| "memory:write"
|
|
1707
|
+
| "memory:admin"
|
|
1708
|
+
| "mcp:use"
|
|
1709
|
+
| "terminal:attach"
|
|
1710
|
+
| "logs:read"
|
|
1711
|
+
| "integration:read"
|
|
1712
|
+
| "integration:write"
|
|
1713
|
+
| "channel:read"
|
|
1714
|
+
| "channel:write"
|
|
1715
|
+
| "stats:read"
|
|
1716
|
+
| "health:read"
|
|
1717
|
+
| "events:read"
|
|
1718
|
+
| "command:spawn"
|
|
1719
|
+
| "command:shutdown"
|
|
723
1720
|
| "recipe:start"
|
|
724
1721
|
| "recipe:stop"
|
|
725
1722
|
| "admin:*";
|
|
726
1723
|
|
|
1724
|
+
export interface MaintenanceJob {
|
|
1725
|
+
id: string;
|
|
1726
|
+
title: string;
|
|
1727
|
+
description?: string;
|
|
1728
|
+
intervalMs: number;
|
|
1729
|
+
timeoutMs: number;
|
|
1730
|
+
enabled: boolean;
|
|
1731
|
+
runOnStart: boolean;
|
|
1732
|
+
lastRunAt?: number;
|
|
1733
|
+
nextRunAt?: number;
|
|
1734
|
+
lastDurationMs?: number;
|
|
1735
|
+
lastStatus: "idle" | "running" | "succeeded" | "failed" | "disabled";
|
|
1736
|
+
lastError?: string;
|
|
1737
|
+
lastResult?: Record<string, unknown>;
|
|
1738
|
+
consecutiveFailures: number;
|
|
1739
|
+
running: boolean;
|
|
1740
|
+
leaseUntil?: number;
|
|
1741
|
+
updatedAt: number;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
export interface MaintenanceJobRun {
|
|
1745
|
+
id: string;
|
|
1746
|
+
status: "succeeded" | "failed" | "skipped";
|
|
1747
|
+
startedAt: number;
|
|
1748
|
+
finishedAt: number;
|
|
1749
|
+
durationMs: number;
|
|
1750
|
+
result?: Record<string, unknown>;
|
|
1751
|
+
error?: string;
|
|
1752
|
+
}
|
|
1753
|
+
|
|
727
1754
|
export interface HealthCheck {
|
|
728
1755
|
name: string;
|
|
729
1756
|
status: "ok" | "warn" | "error";
|
|
730
1757
|
detail?: string;
|
|
731
1758
|
count?: number;
|
|
1759
|
+
subjects?: Array<{ id: string; label?: string; status?: string; detail?: string }>;
|
|
732
1760
|
}
|
|
733
1761
|
|
|
734
1762
|
export interface HealthReport {
|