@makinbakin/sdk 0.0.0-bootstrap.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/README.md +107 -0
- package/_internal/app/components/agent-avatar.d.ts +11 -0
- package/_internal/app/components/agent-filter.d.ts +8 -0
- package/_internal/app/components/agent-select.d.ts +15 -0
- package/_internal/app/components/agent-status.d.ts +8 -0
- package/_internal/app/components/bakin-drawer.d.ts +23 -0
- package/_internal/app/components/color-picker.d.ts +7 -0
- package/_internal/app/components/empty-state.d.ts +10 -0
- package/_internal/app/components/error-banner.d.ts +6 -0
- package/_internal/app/components/error-state.d.ts +8 -0
- package/_internal/app/components/facet-filter.d.ts +17 -0
- package/_internal/app/components/integrated-brainstorm/collapsed-header.d.ts +14 -0
- package/_internal/app/components/integrated-brainstorm/empty-state.d.ts +5 -0
- package/_internal/app/components/integrated-brainstorm/index.d.ts +3 -0
- package/_internal/app/components/integrated-brainstorm/input-row.d.ts +16 -0
- package/_internal/app/components/integrated-brainstorm/message-list.d.ts +8 -0
- package/_internal/app/components/integrated-brainstorm/thinking-indicator.d.ts +19 -0
- package/_internal/app/components/integrated-brainstorm/types.d.ts +61 -0
- package/_internal/app/components/integrated-brainstorm/use-auto-grow.d.ts +6 -0
- package/_internal/app/components/integrated-brainstorm/use-brainstorm-state.d.ts +21 -0
- package/_internal/app/components/markdown-content.d.ts +3 -0
- package/_internal/app/components/markdown-editor.d.ts +11 -0
- package/_internal/app/components/model-select.d.ts +9 -0
- package/_internal/app/components/page-layout.d.ts +9 -0
- package/_internal/app/components/plugin-header.d.ts +16 -0
- package/_internal/app/components/plugin-settings-renderer.d.ts +9 -0
- package/_internal/app/components/sortable-head.d.ts +13 -0
- package/_internal/app/components/ui/alert.d.ts +10 -0
- package/_internal/app/components/ui/avatar.d.ts +11 -0
- package/_internal/app/components/ui/badge.d.ts +7 -0
- package/_internal/app/components/ui/button.d.ts +8 -0
- package/_internal/app/components/ui/card.d.ts +11 -0
- package/_internal/app/components/ui/checkbox.d.ts +3 -0
- package/_internal/app/components/ui/collapsible.d.ts +5 -0
- package/_internal/app/components/ui/command.d.ts +19 -0
- package/_internal/app/components/ui/dialog.d.ts +17 -0
- package/_internal/app/components/ui/dropdown-menu.d.ts +29 -0
- package/_internal/app/components/ui/form.d.ts +23 -0
- package/_internal/app/components/ui/input-group.d.ts +18 -0
- package/_internal/app/components/ui/input.d.ts +3 -0
- package/_internal/app/components/ui/label.d.ts +3 -0
- package/_internal/app/components/ui/popover.d.ts +9 -0
- package/_internal/app/components/ui/progress.d.ts +7 -0
- package/_internal/app/components/ui/select.d.ts +15 -0
- package/_internal/app/components/ui/separator.d.ts +3 -0
- package/_internal/app/components/ui/sheet.d.ts +14 -0
- package/_internal/app/components/ui/skeleton.d.ts +2 -0
- package/_internal/app/components/ui/switch.d.ts +5 -0
- package/_internal/app/components/ui/table.d.ts +10 -0
- package/_internal/app/components/ui/tabs.d.ts +10 -0
- package/_internal/app/components/ui/textarea.d.ts +3 -0
- package/_internal/app/components/ui/tooltip.d.ts +6 -0
- package/_internal/app/components/underline-tabs.d.ts +15 -0
- package/_internal/app/hooks/use-assets.d.ts +25 -0
- package/_internal/app/hooks/use-content-store.d.ts +36 -0
- package/_internal/app/hooks/use-debug.d.ts +1 -0
- package/_internal/app/hooks/use-form-guard.d.ts +5 -0
- package/_internal/app/hooks/use-query-state.d.ts +14 -0
- package/_internal/app/hooks/use-runtime-status.d.ts +12 -0
- package/_internal/app/hooks/use-schedule.d.ts +63 -0
- package/_internal/app/hooks/use-search.d.ts +65 -0
- package/_internal/app/hooks/use-sidebar.d.ts +4 -0
- package/_internal/app/hooks/use-sse.d.ts +1 -0
- package/_internal/app/hooks/use-toast.d.ts +16 -0
- package/_internal/app/hooks/use-vertical-resize.d.ts +22 -0
- package/_internal/app/lib/browser-notify.d.ts +5 -0
- package/_internal/app/lib/map-audit-message.d.ts +7 -0
- package/_internal/app/lib/utils.d.ts +2 -0
- package/_internal/app/types/index.d.ts +126 -0
- package/_internal/core/adapters/runtime/capabilities.d.ts +2 -0
- package/_internal/core/adapters/runtime/concepts.d.ts +458 -0
- package/_internal/core/adapters/runtime/helpers.d.ts +5 -0
- package/_internal/core/adapters/runtime/index.d.ts +5 -0
- package/_internal/core/adapters/shared.d.ts +37 -0
- package/_internal/core/docs/index.d.ts +2 -0
- package/_internal/core/docs/metadata.d.ts +92 -0
- package/_internal/core/docs/route.d.ts +9 -0
- package/_internal/core/format.d.ts +6 -0
- package/_internal/core/openapi/errors.d.ts +29 -0
- package/_internal/core/openapi/zod-to-openapi.d.ts +14 -0
- package/_internal/core/plugin-types.d.ts +849 -0
- package/_internal/core/routing/define.d.ts +34 -0
- package/_internal/core/routing/dispatcher.d.ts +44 -0
- package/_internal/core/routing/index.d.ts +15 -0
- package/_internal/core/routing/operation-id.d.ts +9 -0
- package/_internal/core/routing/registry.d.ts +52 -0
- package/_internal/core/routing/search-route.d.ts +26 -0
- package/_internal/core/routing/types.d.ts +123 -0
- package/_internal/plugins/team/hooks/use-agent-store.d.ts +49 -0
- package/_internal/plugins/team/types.d.ts +131 -0
- package/_internal/plugins/workflows/hooks/channel-icon.d.ts +6 -0
- package/_internal/plugins/workflows/hooks/use-notification-channels.d.ts +13 -0
- package/_internal/plugins/workflows/lib/notification-channel-registry.d.ts +26 -0
- package/components/index.d.ts +33 -0
- package/components/index.js +39522 -0
- package/hooks/index.d.ts +25 -0
- package/hooks/index.js +1738 -0
- package/hooks/router.d.ts +38 -0
- package/index.d.ts +27 -0
- package/index.js +13917 -0
- package/metadata/index.d.ts +16 -0
- package/metadata/index.js +31 -0
- package/package.json +88 -0
- package/register.d.ts +103 -0
- package/routing/index.d.ts +11 -0
- package/routing/index.js +13721 -0
- package/slots/index.d.ts +55 -0
- package/slots/index.js +92 -0
- package/types/index.d.ts +840 -0
- package/types/index.js +1 -0
- package/ui/index.d.ts +34 -0
- package/ui/index.js +28713 -0
- package/utils/index.d.ts +9 -0
- package/utils/index.js +1832 -0
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
import type { AdapterHealthCheckDefinition, AdapterInitOpts, Unsubscribe } from '../shared';
|
|
2
|
+
import type { ChannelCapability } from './capabilities';
|
|
3
|
+
export type RuntimeMetadata = Record<string, unknown>;
|
|
4
|
+
export interface RuntimeAgent {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
role?: string;
|
|
8
|
+
model?: string;
|
|
9
|
+
status?: 'active' | 'inactive' | 'unknown';
|
|
10
|
+
metadata?: RuntimeMetadata;
|
|
11
|
+
}
|
|
12
|
+
export interface CreateRuntimeAgentInput {
|
|
13
|
+
id?: string;
|
|
14
|
+
name: string;
|
|
15
|
+
role?: string;
|
|
16
|
+
model?: string;
|
|
17
|
+
metadata?: RuntimeMetadata;
|
|
18
|
+
}
|
|
19
|
+
export interface UpdateRuntimeAgentInput {
|
|
20
|
+
name?: string;
|
|
21
|
+
role?: string;
|
|
22
|
+
model?: string;
|
|
23
|
+
metadata?: RuntimeMetadata;
|
|
24
|
+
}
|
|
25
|
+
export interface RuntimePermissionPatch {
|
|
26
|
+
allow?: string[];
|
|
27
|
+
deny?: string[];
|
|
28
|
+
replace?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface RuntimeAllowlistPatch {
|
|
31
|
+
add?: string[];
|
|
32
|
+
remove?: string[];
|
|
33
|
+
replace?: string[];
|
|
34
|
+
}
|
|
35
|
+
export interface WorkspaceFile {
|
|
36
|
+
path: string;
|
|
37
|
+
content: string;
|
|
38
|
+
updatedAt?: string;
|
|
39
|
+
metadata?: RuntimeMetadata;
|
|
40
|
+
}
|
|
41
|
+
export interface MessageArgs {
|
|
42
|
+
agentId: string;
|
|
43
|
+
content: string;
|
|
44
|
+
threadId?: string;
|
|
45
|
+
metadata?: RuntimeMetadata;
|
|
46
|
+
}
|
|
47
|
+
export interface MessageResult {
|
|
48
|
+
id: string;
|
|
49
|
+
content?: string;
|
|
50
|
+
metadata?: RuntimeMetadata;
|
|
51
|
+
}
|
|
52
|
+
export interface ChatChunk {
|
|
53
|
+
type: 'text' | 'tool' | 'status' | 'done' | 'error';
|
|
54
|
+
content?: string;
|
|
55
|
+
data?: unknown;
|
|
56
|
+
}
|
|
57
|
+
export interface ToolDefinition {
|
|
58
|
+
name: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
inputSchema?: unknown;
|
|
61
|
+
}
|
|
62
|
+
export interface ToolResult {
|
|
63
|
+
ok: boolean;
|
|
64
|
+
output?: unknown;
|
|
65
|
+
error?: {
|
|
66
|
+
message: string;
|
|
67
|
+
recoverable: boolean;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export interface ChannelInfo {
|
|
71
|
+
id: string;
|
|
72
|
+
platform: string;
|
|
73
|
+
label: string;
|
|
74
|
+
capabilities: ChannelCapability[];
|
|
75
|
+
metadata?: RuntimeMetadata;
|
|
76
|
+
}
|
|
77
|
+
export interface DeliveryResult {
|
|
78
|
+
deliveries: ApprovalDelivery[];
|
|
79
|
+
}
|
|
80
|
+
export interface NotificationArgs {
|
|
81
|
+
channels: string[];
|
|
82
|
+
notification: {
|
|
83
|
+
severity: 'info' | 'warn' | 'error' | 'success';
|
|
84
|
+
title: string;
|
|
85
|
+
body: string;
|
|
86
|
+
fields?: {
|
|
87
|
+
label: string;
|
|
88
|
+
value: string;
|
|
89
|
+
}[];
|
|
90
|
+
metadata?: RuntimeMetadata;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export interface ChannelMessageArgs {
|
|
94
|
+
channels: string[];
|
|
95
|
+
message: {
|
|
96
|
+
body: string;
|
|
97
|
+
title?: string;
|
|
98
|
+
threadId?: string;
|
|
99
|
+
metadata?: RuntimeMetadata;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export interface ContentDeliveryArgs {
|
|
103
|
+
channels: string[];
|
|
104
|
+
content: {
|
|
105
|
+
title: string;
|
|
106
|
+
body?: string;
|
|
107
|
+
url?: string;
|
|
108
|
+
files?: Array<{
|
|
109
|
+
name: string;
|
|
110
|
+
path: string;
|
|
111
|
+
contentType?: string;
|
|
112
|
+
} | {
|
|
113
|
+
kind: 'asset';
|
|
114
|
+
filename: string;
|
|
115
|
+
mimeType?: string;
|
|
116
|
+
}>;
|
|
117
|
+
metadata?: RuntimeMetadata;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
export interface ApprovalOption {
|
|
121
|
+
id: string;
|
|
122
|
+
label: string;
|
|
123
|
+
variant?: 'primary' | 'destructive' | 'neutral';
|
|
124
|
+
}
|
|
125
|
+
export interface ApprovalDelivery {
|
|
126
|
+
channelId: string;
|
|
127
|
+
ref: string;
|
|
128
|
+
renderedAt: string;
|
|
129
|
+
}
|
|
130
|
+
export interface ApprovalPatch {
|
|
131
|
+
body?: string;
|
|
132
|
+
options?: ApprovalOption[];
|
|
133
|
+
expiresAt?: string;
|
|
134
|
+
context?: RuntimeMetadata;
|
|
135
|
+
}
|
|
136
|
+
export interface ApprovalResponse {
|
|
137
|
+
selectedOption: string;
|
|
138
|
+
respondedAt: string;
|
|
139
|
+
actor: {
|
|
140
|
+
type: 'agent' | 'human';
|
|
141
|
+
id: string;
|
|
142
|
+
displayName?: string;
|
|
143
|
+
};
|
|
144
|
+
comment?: string;
|
|
145
|
+
}
|
|
146
|
+
export interface ApprovalRenderResult {
|
|
147
|
+
deliveries: ApprovalDelivery[];
|
|
148
|
+
}
|
|
149
|
+
export interface ApprovalRenderRef {
|
|
150
|
+
approvalId: string;
|
|
151
|
+
deliveries: ApprovalDelivery[];
|
|
152
|
+
}
|
|
153
|
+
export interface CreateApprovalArgs {
|
|
154
|
+
approvalId: string;
|
|
155
|
+
channels: string[];
|
|
156
|
+
request: {
|
|
157
|
+
title: string;
|
|
158
|
+
body: string;
|
|
159
|
+
options: ApprovalOption[];
|
|
160
|
+
expiresAt?: string;
|
|
161
|
+
context?: RuntimeMetadata;
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
export interface EditApprovalArgs extends ApprovalRenderRef {
|
|
165
|
+
patch: ApprovalPatch;
|
|
166
|
+
}
|
|
167
|
+
export interface CancelApprovalArgs extends ApprovalRenderRef {
|
|
168
|
+
reason?: string;
|
|
169
|
+
}
|
|
170
|
+
export interface ResolveApprovalArgs extends ApprovalRenderRef {
|
|
171
|
+
response: ApprovalResponse;
|
|
172
|
+
}
|
|
173
|
+
export interface ApprovalResolveEvent {
|
|
174
|
+
approvalId: string;
|
|
175
|
+
response: ApprovalResponse;
|
|
176
|
+
channelId: string;
|
|
177
|
+
}
|
|
178
|
+
export interface ChannelMessageEvent {
|
|
179
|
+
channelId: string;
|
|
180
|
+
messageId: string;
|
|
181
|
+
actor: {
|
|
182
|
+
type: 'agent' | 'human';
|
|
183
|
+
id: string;
|
|
184
|
+
displayName?: string;
|
|
185
|
+
};
|
|
186
|
+
body: string;
|
|
187
|
+
threadId?: string;
|
|
188
|
+
receivedAt: string;
|
|
189
|
+
metadata?: RuntimeMetadata;
|
|
190
|
+
}
|
|
191
|
+
export interface ChannelInteractionEvent {
|
|
192
|
+
channelId: string;
|
|
193
|
+
interactionId: string;
|
|
194
|
+
actor: {
|
|
195
|
+
type: 'agent' | 'human';
|
|
196
|
+
id: string;
|
|
197
|
+
displayName?: string;
|
|
198
|
+
};
|
|
199
|
+
kind: string;
|
|
200
|
+
payload: RuntimeMetadata;
|
|
201
|
+
receivedAt: string;
|
|
202
|
+
}
|
|
203
|
+
export interface DurableApprovalRecord {
|
|
204
|
+
approvalId: string;
|
|
205
|
+
owner: {
|
|
206
|
+
workflowId: string;
|
|
207
|
+
runId: string;
|
|
208
|
+
stepId: string;
|
|
209
|
+
taskId?: string;
|
|
210
|
+
};
|
|
211
|
+
status: 'pending' | 'approved' | 'rejected' | 'cancelled' | 'expired';
|
|
212
|
+
request: CreateApprovalArgs['request'];
|
|
213
|
+
deliveries: ApprovalDelivery[];
|
|
214
|
+
response?: ApprovalResponse;
|
|
215
|
+
createdAt: string;
|
|
216
|
+
updatedAt: string;
|
|
217
|
+
resolvedAt?: string;
|
|
218
|
+
}
|
|
219
|
+
export interface RuntimeSkill {
|
|
220
|
+
name: string;
|
|
221
|
+
path?: string;
|
|
222
|
+
instructions?: string;
|
|
223
|
+
files?: Record<string, string>;
|
|
224
|
+
metadata?: RuntimeMetadata;
|
|
225
|
+
}
|
|
226
|
+
export interface RuntimeSession {
|
|
227
|
+
id: string;
|
|
228
|
+
agentId: string;
|
|
229
|
+
title?: string;
|
|
230
|
+
startedAt?: string;
|
|
231
|
+
updatedAt?: string;
|
|
232
|
+
metadata?: RuntimeMetadata;
|
|
233
|
+
}
|
|
234
|
+
export interface RuntimeMemoryTier {
|
|
235
|
+
id: string;
|
|
236
|
+
label: string;
|
|
237
|
+
description?: string;
|
|
238
|
+
metadata?: RuntimeMetadata;
|
|
239
|
+
}
|
|
240
|
+
export interface RuntimeMemoryEntry {
|
|
241
|
+
id: string;
|
|
242
|
+
tierId: string;
|
|
243
|
+
agentId?: string;
|
|
244
|
+
path?: string;
|
|
245
|
+
content: string;
|
|
246
|
+
updatedAt?: string;
|
|
247
|
+
metadata?: RuntimeMetadata;
|
|
248
|
+
}
|
|
249
|
+
export interface RuntimeMemoryEntryStat {
|
|
250
|
+
size: number;
|
|
251
|
+
mtimeMs: number;
|
|
252
|
+
updatedAt?: string;
|
|
253
|
+
metadata?: RuntimeMetadata;
|
|
254
|
+
}
|
|
255
|
+
export interface RuntimeMemoryReadRange {
|
|
256
|
+
content: string;
|
|
257
|
+
size: number;
|
|
258
|
+
mtimeMs?: number;
|
|
259
|
+
updatedAt?: string;
|
|
260
|
+
metadata?: RuntimeMetadata;
|
|
261
|
+
}
|
|
262
|
+
export interface RuntimeMemoryPathMatch {
|
|
263
|
+
tierId: string;
|
|
264
|
+
id: string;
|
|
265
|
+
agentId?: string;
|
|
266
|
+
path: string;
|
|
267
|
+
metadata?: RuntimeMetadata;
|
|
268
|
+
}
|
|
269
|
+
export interface RuntimeMemorySearchResult {
|
|
270
|
+
results: unknown[];
|
|
271
|
+
metadata?: RuntimeMetadata;
|
|
272
|
+
}
|
|
273
|
+
export interface RuntimeAvailableModel {
|
|
274
|
+
id: string;
|
|
275
|
+
name?: string;
|
|
276
|
+
input?: string;
|
|
277
|
+
contextWindow?: number;
|
|
278
|
+
local?: boolean;
|
|
279
|
+
available?: boolean;
|
|
280
|
+
tags?: string[];
|
|
281
|
+
metadata?: RuntimeMetadata;
|
|
282
|
+
}
|
|
283
|
+
export interface TaskDispatchArgs {
|
|
284
|
+
bakinTaskId: string;
|
|
285
|
+
agentId?: string;
|
|
286
|
+
title: string;
|
|
287
|
+
description?: string;
|
|
288
|
+
metadata?: RuntimeMetadata;
|
|
289
|
+
}
|
|
290
|
+
export interface TaskDispatchResult {
|
|
291
|
+
flowId: string;
|
|
292
|
+
}
|
|
293
|
+
export interface TaskExecutionStatus {
|
|
294
|
+
flowId: string;
|
|
295
|
+
bakinTaskId?: string;
|
|
296
|
+
state: 'queued' | 'running' | 'blocked' | 'succeeded' | 'failed' | 'cancelled' | 'unknown';
|
|
297
|
+
currentStep?: string | null;
|
|
298
|
+
blockingReason?: string | null;
|
|
299
|
+
retryCount?: number;
|
|
300
|
+
startedAt?: string | null;
|
|
301
|
+
endedAt?: string | null;
|
|
302
|
+
updatedAt?: string | null;
|
|
303
|
+
metadata?: RuntimeMetadata;
|
|
304
|
+
}
|
|
305
|
+
export interface ListExecutionsOpts {
|
|
306
|
+
bakinTaskId?: string;
|
|
307
|
+
agentId?: string;
|
|
308
|
+
state?: TaskExecutionStatus['state'];
|
|
309
|
+
limit?: number;
|
|
310
|
+
}
|
|
311
|
+
export interface TaskExecutionEvent {
|
|
312
|
+
flowId: string;
|
|
313
|
+
bakinTaskId?: string;
|
|
314
|
+
status: TaskExecutionStatus;
|
|
315
|
+
}
|
|
316
|
+
export interface CronJob {
|
|
317
|
+
id: string;
|
|
318
|
+
name: string;
|
|
319
|
+
schedule: string;
|
|
320
|
+
command: string;
|
|
321
|
+
enabled: boolean;
|
|
322
|
+
toolsAllow?: string[];
|
|
323
|
+
metadata?: RuntimeMetadata;
|
|
324
|
+
}
|
|
325
|
+
export interface CronRun {
|
|
326
|
+
id: string;
|
|
327
|
+
jobId: string;
|
|
328
|
+
status: 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled';
|
|
329
|
+
startedAt?: string;
|
|
330
|
+
endedAt?: string;
|
|
331
|
+
output?: string;
|
|
332
|
+
error?: string;
|
|
333
|
+
}
|
|
334
|
+
export interface CreateCronJobInput {
|
|
335
|
+
id?: string;
|
|
336
|
+
name: string;
|
|
337
|
+
schedule: string;
|
|
338
|
+
command: string;
|
|
339
|
+
enabled?: boolean;
|
|
340
|
+
toolsAllow?: string[];
|
|
341
|
+
metadata?: RuntimeMetadata;
|
|
342
|
+
}
|
|
343
|
+
export type UpdateCronJobInput = Partial<Omit<CreateCronJobInput, 'id' | 'toolsAllow'>> & {
|
|
344
|
+
toolsAllow?: string[] | null;
|
|
345
|
+
};
|
|
346
|
+
export interface RawCronSnapshot {
|
|
347
|
+
provider: string;
|
|
348
|
+
capturedAt: string;
|
|
349
|
+
snapshot: unknown;
|
|
350
|
+
}
|
|
351
|
+
export interface RuntimeConfigAccess {
|
|
352
|
+
get<T = Record<string, unknown>>(): Promise<T>;
|
|
353
|
+
update(patch: Record<string, unknown>): Promise<void>;
|
|
354
|
+
replace<T = Record<string, unknown>>(next: T, reason: string): Promise<void>;
|
|
355
|
+
raw<T = unknown>(key: string, reason: string): Promise<T>;
|
|
356
|
+
}
|
|
357
|
+
export interface AgentRuntimeAdapter {
|
|
358
|
+
readonly name: string;
|
|
359
|
+
readonly version: string;
|
|
360
|
+
readonly requiredCoreVersion: string;
|
|
361
|
+
initialize(opts: AdapterInitOpts): Promise<void>;
|
|
362
|
+
shutdown(): Promise<void>;
|
|
363
|
+
ping(): Promise<boolean>;
|
|
364
|
+
restart(): Promise<void>;
|
|
365
|
+
getHealthChecks(): AdapterHealthCheckDefinition[];
|
|
366
|
+
agents: {
|
|
367
|
+
list(): Promise<RuntimeAgent[]>;
|
|
368
|
+
get(agentId: string): Promise<RuntimeAgent | null>;
|
|
369
|
+
create(input: CreateRuntimeAgentInput): Promise<RuntimeAgent>;
|
|
370
|
+
update(agentId: string, input: UpdateRuntimeAgentInput): Promise<RuntimeAgent>;
|
|
371
|
+
remove(agentId: string): Promise<void>;
|
|
372
|
+
listWorkspaceFiles(agentId: string): Promise<string[]>;
|
|
373
|
+
readWorkspaceFile(agentId: string, path: string): Promise<WorkspaceFile | null>;
|
|
374
|
+
writeWorkspaceFile(agentId: string, file: WorkspaceFile): Promise<void>;
|
|
375
|
+
removeWorkspaceFile(agentId: string, path: string): Promise<void>;
|
|
376
|
+
updatePermissions(agentId: string, patch: RuntimePermissionPatch): Promise<void>;
|
|
377
|
+
updateAllowlist(agentId: string, patch: RuntimeAllowlistPatch): Promise<void>;
|
|
378
|
+
heartbeat(agentId: string): Promise<boolean>;
|
|
379
|
+
};
|
|
380
|
+
messaging: {
|
|
381
|
+
send(args: MessageArgs): Promise<MessageResult>;
|
|
382
|
+
stream(args: MessageArgs): AsyncIterable<ChatChunk>;
|
|
383
|
+
};
|
|
384
|
+
tools: {
|
|
385
|
+
invoke(agentId: string, name: string, args: unknown): Promise<ToolResult>;
|
|
386
|
+
list(agentId: string): Promise<ToolDefinition[]>;
|
|
387
|
+
};
|
|
388
|
+
channels: {
|
|
389
|
+
list(): Promise<ChannelInfo[]>;
|
|
390
|
+
sendNotification(args: NotificationArgs): Promise<DeliveryResult>;
|
|
391
|
+
sendMessage(args: ChannelMessageArgs): Promise<DeliveryResult>;
|
|
392
|
+
deliverContent(args: ContentDeliveryArgs): Promise<DeliveryResult>;
|
|
393
|
+
createApproval(args: CreateApprovalArgs): Promise<ApprovalRenderResult>;
|
|
394
|
+
editApproval(args: EditApprovalArgs): Promise<ApprovalRenderResult>;
|
|
395
|
+
cancelApproval(args: CancelApprovalArgs): Promise<void>;
|
|
396
|
+
resolveApproval(args: ResolveApprovalArgs): Promise<void>;
|
|
397
|
+
subscribeApprovalResponses(handler: (event: ApprovalResolveEvent) => void): Unsubscribe;
|
|
398
|
+
onMessage(handler: (event: ChannelMessageEvent) => void): Unsubscribe;
|
|
399
|
+
onInteraction(handler: (event: ChannelInteractionEvent) => void): Unsubscribe;
|
|
400
|
+
};
|
|
401
|
+
skills: {
|
|
402
|
+
list(agentId?: string): Promise<RuntimeSkill[]>;
|
|
403
|
+
get(name: string, agentId?: string): Promise<RuntimeSkill | null>;
|
|
404
|
+
write(skill: RuntimeSkill, agentId?: string): Promise<void>;
|
|
405
|
+
remove(name: string, agentId?: string): Promise<void>;
|
|
406
|
+
};
|
|
407
|
+
sessions: {
|
|
408
|
+
list(agentId?: string): Promise<RuntimeSession[]>;
|
|
409
|
+
get(sessionId: string): Promise<RuntimeSession | null>;
|
|
410
|
+
};
|
|
411
|
+
memory: {
|
|
412
|
+
listTiers(): Promise<RuntimeMemoryTier[]>;
|
|
413
|
+
listEntries(tierId: string, opts?: {
|
|
414
|
+
agentId?: string;
|
|
415
|
+
}): Promise<RuntimeMemoryEntry[]>;
|
|
416
|
+
getEntry(tierId: string, id: string, opts?: {
|
|
417
|
+
agentId?: string;
|
|
418
|
+
}): Promise<RuntimeMemoryEntry | null>;
|
|
419
|
+
statEntry(tierId: string, id: string, opts?: {
|
|
420
|
+
agentId?: string;
|
|
421
|
+
}): Promise<RuntimeMemoryEntryStat | null>;
|
|
422
|
+
readEntryRange(tierId: string, id: string, opts?: {
|
|
423
|
+
agentId?: string;
|
|
424
|
+
offset?: number;
|
|
425
|
+
length?: number;
|
|
426
|
+
}): Promise<RuntimeMemoryReadRange | null>;
|
|
427
|
+
resolvePath(path: string): Promise<RuntimeMemoryPathMatch | null>;
|
|
428
|
+
watchPaths(): Promise<string[]>;
|
|
429
|
+
search(query: string, opts?: {
|
|
430
|
+
agentId?: string;
|
|
431
|
+
limit?: number;
|
|
432
|
+
}): Promise<RuntimeMemorySearchResult>;
|
|
433
|
+
};
|
|
434
|
+
models: {
|
|
435
|
+
listAvailable(opts?: {
|
|
436
|
+
includeUnavailable?: boolean;
|
|
437
|
+
}): Promise<RuntimeAvailableModel[]>;
|
|
438
|
+
};
|
|
439
|
+
tasks: {
|
|
440
|
+
dispatch(args: TaskDispatchArgs): Promise<TaskDispatchResult>;
|
|
441
|
+
getExecutionStatus(flowId: string): Promise<TaskExecutionStatus>;
|
|
442
|
+
listExecutions(opts?: ListExecutionsOpts): Promise<TaskExecutionStatus[]>;
|
|
443
|
+
cancelExecution(flowId: string): Promise<void>;
|
|
444
|
+
subscribeExecutionUpdates(handler: (event: TaskExecutionEvent) => void): Unsubscribe;
|
|
445
|
+
};
|
|
446
|
+
cron: {
|
|
447
|
+
list(): Promise<CronJob[]>;
|
|
448
|
+
get(id: string): Promise<CronJob | null>;
|
|
449
|
+
create(input: CreateCronJobInput): Promise<CronJob>;
|
|
450
|
+
update(id: string, patch: UpdateCronJobInput): Promise<CronJob>;
|
|
451
|
+
remove(id: string): Promise<void>;
|
|
452
|
+
runNow(id: string): Promise<CronRun>;
|
|
453
|
+
listRuns(jobId: string): Promise<CronRun[]>;
|
|
454
|
+
getRaw(id: string, reason: string): Promise<unknown | null>;
|
|
455
|
+
restoreRaw(id: string, snapshot: unknown, reason: string): Promise<CronJob>;
|
|
456
|
+
};
|
|
457
|
+
config: RuntimeConfigAccess;
|
|
458
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AgentRuntimeAdapter, RuntimeAgent } from './concepts';
|
|
2
|
+
export declare function selectRuntimeMainAgent(agents: RuntimeAgent[]): RuntimeAgent | null;
|
|
3
|
+
export declare function getRuntimeMainAgent(runtime: AgentRuntimeAdapter): Promise<RuntimeAgent | null>;
|
|
4
|
+
export declare function getRuntimeMainAgentId(runtime: AgentRuntimeAdapter, fallback?: string): Promise<string>;
|
|
5
|
+
export declare function getRuntimeMainAgentName(runtime: AgentRuntimeAdapter, fallback?: string): Promise<string>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { AdapterAuditEvent, AdapterHealthCheckDefinition, AdapterHealthCheckResult, AdapterInitOpts, AdapterLogger, Unsubscribe, } from '../shared';
|
|
2
|
+
export type { ChannelCapability } from './capabilities';
|
|
3
|
+
export { hasChannelCapability } from './capabilities';
|
|
4
|
+
export { getRuntimeMainAgent, getRuntimeMainAgentId, getRuntimeMainAgentName, selectRuntimeMainAgent, } from './helpers';
|
|
5
|
+
export type { AgentRuntimeAdapter, ApprovalDelivery, ApprovalOption, ApprovalPatch, ApprovalRenderRef, ApprovalRenderResult, ApprovalResolveEvent, ApprovalResponse, CancelApprovalArgs, ChannelInfo, ChannelInteractionEvent, ChannelMessageArgs, ChannelMessageEvent, ChatChunk, ContentDeliveryArgs, CreateApprovalArgs, CreateCronJobInput, CreateRuntimeAgentInput, CronJob, CronRun, DeliveryResult, DurableApprovalRecord, EditApprovalArgs, ListExecutionsOpts, MessageArgs, MessageResult, NotificationArgs, ResolveApprovalArgs, RuntimeAgent, RuntimeAllowlistPatch, RuntimeAvailableModel, RuntimeConfigAccess, RuntimeMemoryEntry, RuntimeMemoryEntryStat, RuntimeMemoryPathMatch, RuntimeMemoryReadRange, RuntimeMemorySearchResult, RuntimeMemoryTier, RuntimeMetadata, RuntimePermissionPatch, RawCronSnapshot, RuntimeSession, RuntimeSkill, TaskDispatchArgs, TaskDispatchResult, TaskExecutionEvent, TaskExecutionStatus, ToolDefinition, ToolResult, UpdateCronJobInput, UpdateRuntimeAgentInput, WorkspaceFile, } from './concepts';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type Unsubscribe = () => void;
|
|
2
|
+
export interface AdapterLogger {
|
|
3
|
+
debug(message: string, data?: unknown): void;
|
|
4
|
+
info(message: string, data?: unknown): void;
|
|
5
|
+
warn(message: string, data?: unknown): void;
|
|
6
|
+
error(message: string, data?: unknown): void;
|
|
7
|
+
}
|
|
8
|
+
export interface AdapterAuditEvent {
|
|
9
|
+
adapter: string;
|
|
10
|
+
action: string;
|
|
11
|
+
subject?: string;
|
|
12
|
+
data?: Record<string, unknown>;
|
|
13
|
+
at?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface AdapterInitOpts {
|
|
16
|
+
contentDir: string;
|
|
17
|
+
settings?: Record<string, unknown>;
|
|
18
|
+
logger?: AdapterLogger;
|
|
19
|
+
audit?: (event: AdapterAuditEvent) => void;
|
|
20
|
+
}
|
|
21
|
+
export interface AdapterHealthCheckResult {
|
|
22
|
+
check: string;
|
|
23
|
+
status: 'ok' | 'warn' | 'error' | 'fixed';
|
|
24
|
+
message: string;
|
|
25
|
+
autoFixable: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface AdapterHealthCheckDefinition {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
run(): Promise<AdapterHealthCheckResult[]>;
|
|
31
|
+
autoFix?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface AdapterVersionInfo {
|
|
34
|
+
readonly name: string;
|
|
35
|
+
readonly version: string;
|
|
36
|
+
readonly requiredCoreVersion?: string;
|
|
37
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export type ContractVisibility = 'public' | 'internal' | 'experimental';
|
|
2
|
+
export type ContractStability = 'stable' | 'beta' | 'experimental' | 'deprecated';
|
|
3
|
+
export type HookKind = 'rpc' | 'event' | 'waterfall';
|
|
4
|
+
export interface SchemaLike<T = unknown> {
|
|
5
|
+
parse(data: unknown): T;
|
|
6
|
+
safeParse?(data: unknown): {
|
|
7
|
+
success: true;
|
|
8
|
+
data: T;
|
|
9
|
+
} | {
|
|
10
|
+
success: false;
|
|
11
|
+
error: unknown;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface SourceLocation {
|
|
15
|
+
file: string;
|
|
16
|
+
symbol?: string;
|
|
17
|
+
line?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface DocsExample {
|
|
20
|
+
title: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
code?: string;
|
|
23
|
+
request?: unknown;
|
|
24
|
+
response?: unknown;
|
|
25
|
+
test?: 'automated' | 'schema' | 'illustrative';
|
|
26
|
+
reason?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ContractMetadata {
|
|
29
|
+
summary: string;
|
|
30
|
+
description: string;
|
|
31
|
+
visibility: ContractVisibility;
|
|
32
|
+
stability: ContractStability;
|
|
33
|
+
since?: string;
|
|
34
|
+
deprecated?: {
|
|
35
|
+
since?: string;
|
|
36
|
+
removeIn?: string;
|
|
37
|
+
replacement?: string;
|
|
38
|
+
};
|
|
39
|
+
source?: SourceLocation;
|
|
40
|
+
examples?: DocsExample[];
|
|
41
|
+
related?: string[];
|
|
42
|
+
}
|
|
43
|
+
export interface RouteContract<Input = unknown, Output = unknown> extends ContractMetadata {
|
|
44
|
+
kind: 'route';
|
|
45
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
46
|
+
path: string;
|
|
47
|
+
input?: SchemaLike<Input>;
|
|
48
|
+
output?: SchemaLike<Output>;
|
|
49
|
+
permissions?: string[];
|
|
50
|
+
}
|
|
51
|
+
export interface CliCommandContract extends ContractMetadata {
|
|
52
|
+
kind: 'cli';
|
|
53
|
+
name: string;
|
|
54
|
+
usage: string;
|
|
55
|
+
group?: string;
|
|
56
|
+
aliases?: string[];
|
|
57
|
+
options?: Array<{
|
|
58
|
+
name: string;
|
|
59
|
+
description: string;
|
|
60
|
+
value?: string;
|
|
61
|
+
required?: boolean;
|
|
62
|
+
}>;
|
|
63
|
+
environment?: string[];
|
|
64
|
+
}
|
|
65
|
+
export interface HookContract<Input = unknown, Output = unknown> extends ContractMetadata {
|
|
66
|
+
kind: 'hook';
|
|
67
|
+
name: string;
|
|
68
|
+
hookKind: HookKind;
|
|
69
|
+
input?: SchemaLike<Input>;
|
|
70
|
+
output?: SchemaLike<Output>;
|
|
71
|
+
}
|
|
72
|
+
export interface SlotContract<Props = unknown> extends ContractMetadata {
|
|
73
|
+
kind: 'slot';
|
|
74
|
+
name: string;
|
|
75
|
+
props?: SchemaLike<Props>;
|
|
76
|
+
renderLocation: string;
|
|
77
|
+
ordering?: string;
|
|
78
|
+
fallback?: string;
|
|
79
|
+
}
|
|
80
|
+
export interface ExecToolContract<Input = unknown, Output = unknown> extends ContractMetadata {
|
|
81
|
+
kind: 'exec-tool';
|
|
82
|
+
name: string;
|
|
83
|
+
input?: SchemaLike<Input>;
|
|
84
|
+
output?: SchemaLike<Output>;
|
|
85
|
+
permissions?: string[];
|
|
86
|
+
}
|
|
87
|
+
export type PublicContract = RouteContract | CliCommandContract | HookContract | SlotContract | ExecToolContract;
|
|
88
|
+
export declare function defineRouteContract<const T extends RouteContract>(contract: T): T;
|
|
89
|
+
export declare function defineCliCommandContract<const T extends CliCommandContract>(contract: T): T;
|
|
90
|
+
export declare function defineHookContract<const T extends HookContract>(contract: T): T;
|
|
91
|
+
export declare function defineSlotContract<const T extends SlotContract>(contract: T): T;
|
|
92
|
+
export declare function defineExecToolContract<const T extends ExecToolContract>(contract: T): T;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { APIRoute } from '../plugin-types';
|
|
2
|
+
export type DocsAwareAPIRoute = APIRoute & {
|
|
3
|
+
summary: string;
|
|
4
|
+
description: string;
|
|
5
|
+
visibility: NonNullable<APIRoute['visibility']>;
|
|
6
|
+
stability: NonNullable<APIRoute['stability']>;
|
|
7
|
+
};
|
|
8
|
+
export declare function defineApiRoute<const T extends DocsAwareAPIRoute>(route: T): T;
|
|
9
|
+
export declare const definePluginRoute: typeof defineApiRoute;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Human-readable relative time from an ISO timestamp */
|
|
2
|
+
export declare function formatAge(timestamp: string): string;
|
|
3
|
+
/** Human-readable file size */
|
|
4
|
+
export declare function formatSize(bytes: number): string;
|
|
5
|
+
/** Check if a heartbeat timestamp is stale (> 15 min) */
|
|
6
|
+
export declare function isStale(timestamp: string, thresholdMs?: number): boolean;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared error envelope and global response builders for the dispatcher.
|
|
3
|
+
*
|
|
4
|
+
* The dispatcher emits these automatically:
|
|
5
|
+
* - 400 on params/query/body parse failure (when any are declared)
|
|
6
|
+
* - 415 on body content-type mismatch (when body is declared)
|
|
7
|
+
*
|
|
8
|
+
* Routes don't repeat them in their `responses` map; OpenAPI emission picks
|
|
9
|
+
* them up from `globalErrorResponses` based on the route's input declarations.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
export declare const errorEnvelope: z.ZodObject<{
|
|
13
|
+
error: z.ZodString;
|
|
14
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type ErrorEnvelope = z.infer<typeof errorEnvelope>;
|
|
17
|
+
export interface GlobalErrorOptions {
|
|
18
|
+
/** True when `params`, `query`, or `body` is declared. */
|
|
19
|
+
hasInput: boolean;
|
|
20
|
+
/** True when `body` is declared. */
|
|
21
|
+
hasBody: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Returns the global error responses (`400`/`415`) appropriate for a route
|
|
25
|
+
* given its declared inputs. Empty object when nothing applies.
|
|
26
|
+
*/
|
|
27
|
+
export declare function globalErrorResponses(opts: GlobalErrorOptions): Record<string, unknown>;
|
|
28
|
+
/** Build a JSON error response body. */
|
|
29
|
+
export declare function errorResponseBody(error: string, issues?: unknown[]): ErrorEnvelope;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps `z.toJSONSchema` for embedding in OpenAPI 3.1 documents.
|
|
3
|
+
*
|
|
4
|
+
* Targets `openapi-3.1` so emitted schemas omit the JSON Schema `$schema`
|
|
5
|
+
* draft link (which would clutter the OpenAPI document).
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
export type OpenApiSchema = Record<string, unknown>;
|
|
9
|
+
export declare function zodToOpenApi(schema: z.ZodType<unknown>): OpenApiSchema;
|
|
10
|
+
/**
|
|
11
|
+
* Convert a route path with `:param` placeholders to OpenAPI's `{param}`.
|
|
12
|
+
* Idempotent — paths already in OpenAPI form pass through.
|
|
13
|
+
*/
|
|
14
|
+
export declare function normalizeOpenApiPath(path: string): string;
|