@agentforge-io/sdk-console 0.0.0-stage → 0.1.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 +150 -2
- package/dist/client.d.ts +43 -0
- package/dist/client.js +58 -0
- package/dist/errors.d.ts +25 -0
- package/dist/errors.js +93 -0
- package/dist/http.d.ts +70 -0
- package/dist/http.js +288 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +55 -0
- package/dist/resources/agents.d.ts +40 -0
- package/dist/resources/agents.js +67 -0
- package/dist/resources/apps.d.ts +16 -0
- package/dist/resources/apps.js +26 -0
- package/dist/resources/auth.d.ts +29 -0
- package/dist/resources/auth.js +57 -0
- package/dist/resources/connectors.d.ts +25 -0
- package/dist/resources/connectors.js +47 -0
- package/dist/resources/marketplace.d.ts +10 -0
- package/dist/resources/marketplace.js +14 -0
- package/dist/resources/members.d.ts +62 -0
- package/dist/resources/members.js +85 -0
- package/dist/resources/playground.d.ts +22 -0
- package/dist/resources/playground.js +32 -0
- package/dist/resources/teams.d.ts +49 -0
- package/dist/resources/teams.js +78 -0
- package/dist/resources/templates.d.ts +115 -0
- package/dist/resources/templates.js +187 -0
- package/dist/resources/tenants.d.ts +12 -0
- package/dist/resources/tenants.js +25 -0
- package/dist/resources/tools.d.ts +13 -0
- package/dist/resources/tools.js +17 -0
- package/dist/resources/variables.d.ts +28 -0
- package/dist/resources/variables.js +43 -0
- package/dist/token-store.d.ts +23 -0
- package/dist/token-store.js +27 -0
- package/dist/types.d.ts +1009 -0
- package/dist/types.js +19 -0
- package/package.json +44 -4
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,1009 @@
|
|
|
1
|
+
export type UserRole = 'user' | 'platform_admin';
|
|
2
|
+
export type TenantRole = 'owner' | 'admin' | 'member';
|
|
3
|
+
/** `GET /auth/me` */
|
|
4
|
+
export interface AuthUser {
|
|
5
|
+
userId: string;
|
|
6
|
+
email?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
isApiKey?: boolean;
|
|
9
|
+
tenantId?: string;
|
|
10
|
+
role?: UserRole;
|
|
11
|
+
isPlatformAdmin?: boolean;
|
|
12
|
+
/** False until the user finishes (or skips) onboarding. */
|
|
13
|
+
onboardingCompleted?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Body of `POST /auth/register`. */
|
|
16
|
+
export interface RegisterInput {
|
|
17
|
+
email: string;
|
|
18
|
+
password: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
/** Cloudflare Turnstile token. Required when the server has a secret set. */
|
|
21
|
+
captchaToken?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Body of `POST /auth/login`. */
|
|
24
|
+
export interface LoginInput {
|
|
25
|
+
email: string;
|
|
26
|
+
password: string;
|
|
27
|
+
captchaToken?: string;
|
|
28
|
+
}
|
|
29
|
+
/** Response of login / register / refresh. */
|
|
30
|
+
export interface AuthResult {
|
|
31
|
+
accessToken: string;
|
|
32
|
+
refreshToken: string;
|
|
33
|
+
user: {
|
|
34
|
+
id: string;
|
|
35
|
+
email?: string;
|
|
36
|
+
name?: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** `GET /auth/strategies` */
|
|
40
|
+
export interface AuthStrategies {
|
|
41
|
+
strategies: Array<{
|
|
42
|
+
name: 'local' | 'google' | 'github';
|
|
43
|
+
loginUrl?: string;
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
export interface TenantBrand {
|
|
47
|
+
logoUrl?: string;
|
|
48
|
+
primaryColor?: string;
|
|
49
|
+
accentColor?: string;
|
|
50
|
+
bannerUrl?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface TenantTheme {
|
|
53
|
+
logoUrl?: string;
|
|
54
|
+
tagline?: string;
|
|
55
|
+
bio?: string;
|
|
56
|
+
primaryColor?: string;
|
|
57
|
+
accentColor?: string;
|
|
58
|
+
headerBg?: string;
|
|
59
|
+
surfaceBg?: string;
|
|
60
|
+
surfaceFg?: string;
|
|
61
|
+
font?: 'inter' | 'geist' | 'dm-sans' | 'serif';
|
|
62
|
+
mode?: 'light' | 'dark' | 'auto';
|
|
63
|
+
bannerUrl?: string;
|
|
64
|
+
}
|
|
65
|
+
export type OgLayout = 'centered' | 'split' | 'minimal' | 'banner-hero';
|
|
66
|
+
export interface Tenant {
|
|
67
|
+
id: string;
|
|
68
|
+
name: string;
|
|
69
|
+
ownerUserId: string;
|
|
70
|
+
/** Caller's role in this workspace (filled by `/me/tenants`). */
|
|
71
|
+
myRole?: TenantRole | null;
|
|
72
|
+
planId: string;
|
|
73
|
+
isActive: boolean;
|
|
74
|
+
timezone?: string;
|
|
75
|
+
/** @deprecated server promotes it to `theme` at read time. */
|
|
76
|
+
brand?: TenantBrand;
|
|
77
|
+
theme?: TenantTheme;
|
|
78
|
+
publicSlug?: string;
|
|
79
|
+
visibility: 'private' | 'public';
|
|
80
|
+
ogLayout?: OgLayout;
|
|
81
|
+
ogThumbnailUrl?: string;
|
|
82
|
+
createdAt: string;
|
|
83
|
+
updatedAt: string;
|
|
84
|
+
}
|
|
85
|
+
export interface TenantList {
|
|
86
|
+
items: Tenant[];
|
|
87
|
+
total: number;
|
|
88
|
+
limit: number | null;
|
|
89
|
+
offset: number;
|
|
90
|
+
}
|
|
91
|
+
export interface ListTenantsInput {
|
|
92
|
+
q?: string;
|
|
93
|
+
limit?: number;
|
|
94
|
+
offset?: number;
|
|
95
|
+
}
|
|
96
|
+
/** Body of `POST /admin/tenants`. */
|
|
97
|
+
export interface CreateTenantInput {
|
|
98
|
+
name: string;
|
|
99
|
+
planId?: string;
|
|
100
|
+
}
|
|
101
|
+
/** Body of `PATCH /admin/tenants/:tenantId`. */
|
|
102
|
+
export interface UpdateTenantInput {
|
|
103
|
+
name?: string;
|
|
104
|
+
/** `null` clears. */
|
|
105
|
+
timezone?: string | null;
|
|
106
|
+
publicSlug?: string | null;
|
|
107
|
+
visibility?: 'private' | 'public';
|
|
108
|
+
brand?: TenantBrand | null;
|
|
109
|
+
theme?: {
|
|
110
|
+
[K in keyof TenantTheme]?: TenantTheme[K] | null;
|
|
111
|
+
} | null;
|
|
112
|
+
ogLayout?: OgLayout;
|
|
113
|
+
}
|
|
114
|
+
/** Row of `GET /admin/tenants/:tenantId/members`. The owner has `id: null`. */
|
|
115
|
+
export interface TenantMember {
|
|
116
|
+
id: string | null;
|
|
117
|
+
userId: string;
|
|
118
|
+
email?: string;
|
|
119
|
+
name?: string;
|
|
120
|
+
role: TenantRole;
|
|
121
|
+
createdAt: string;
|
|
122
|
+
isOwner: boolean;
|
|
123
|
+
}
|
|
124
|
+
export type HumanCapability = 'receives_escalations' | 'approves_actions' | 'specialist';
|
|
125
|
+
export interface TenantInvite {
|
|
126
|
+
id: string;
|
|
127
|
+
email: string;
|
|
128
|
+
role: 'admin' | 'member';
|
|
129
|
+
invitedByUserId: string;
|
|
130
|
+
invitedByName?: string;
|
|
131
|
+
expiresAt: string;
|
|
132
|
+
createdAt: string;
|
|
133
|
+
teamId?: string | null;
|
|
134
|
+
teamCapabilities?: HumanCapability[];
|
|
135
|
+
}
|
|
136
|
+
export interface CreateInviteInput {
|
|
137
|
+
email: string;
|
|
138
|
+
role?: 'member' | 'admin';
|
|
139
|
+
/** Also add the invitee to this team on accept. */
|
|
140
|
+
teamId?: string;
|
|
141
|
+
capabilities?: HumanCapability[];
|
|
142
|
+
}
|
|
143
|
+
/** `GET /invite/:token` (public). */
|
|
144
|
+
export type InvitePreview = {
|
|
145
|
+
valid: false;
|
|
146
|
+
} | {
|
|
147
|
+
valid: true;
|
|
148
|
+
email: string;
|
|
149
|
+
tenantName: string;
|
|
150
|
+
role: 'admin' | 'member';
|
|
151
|
+
};
|
|
152
|
+
/** Body of `POST /invite/:token/accept` (public). Creates the account and joins. */
|
|
153
|
+
export interface AcceptInviteInput {
|
|
154
|
+
password: string;
|
|
155
|
+
name?: string;
|
|
156
|
+
}
|
|
157
|
+
export type ToolPermissionMode = 'allow' | 'approval' | 'blocked';
|
|
158
|
+
export interface ToolPermissionInput {
|
|
159
|
+
name: string;
|
|
160
|
+
mode: ToolPermissionMode;
|
|
161
|
+
}
|
|
162
|
+
/** A bare string means `{ name, mode: 'allow' }`. */
|
|
163
|
+
export type ToolListInput = Array<string | ToolPermissionInput>;
|
|
164
|
+
export interface AgentAppearance {
|
|
165
|
+
primaryColor?: string;
|
|
166
|
+
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
167
|
+
title?: string;
|
|
168
|
+
greeting?: string;
|
|
169
|
+
avatarUrl?: string;
|
|
170
|
+
}
|
|
171
|
+
export type ModelTier = 'haiku' | 'sonnet' | 'opus';
|
|
172
|
+
export interface ModelStrategy {
|
|
173
|
+
kind: 'fixed' | 'tiered';
|
|
174
|
+
default: string;
|
|
175
|
+
tiers?: {
|
|
176
|
+
haiku?: string;
|
|
177
|
+
sonnet?: string;
|
|
178
|
+
opus?: string;
|
|
179
|
+
};
|
|
180
|
+
escalate?: Array<'toolUse' | 'longContext' | 'approvalRequired'>;
|
|
181
|
+
fallback?: Array<'shortInput'>;
|
|
182
|
+
thresholds?: {
|
|
183
|
+
longContextTokens?: number;
|
|
184
|
+
shortInputTokens?: number;
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
export type AgentEscalationRule = {
|
|
188
|
+
when: 'customer_asks_for_human';
|
|
189
|
+
keywords?: string[];
|
|
190
|
+
assign: HumanCapability;
|
|
191
|
+
} | {
|
|
192
|
+
when: 'agent_uncertain';
|
|
193
|
+
assign: HumanCapability;
|
|
194
|
+
} | {
|
|
195
|
+
when: 'tool_requires_approval';
|
|
196
|
+
tools?: string[];
|
|
197
|
+
assign: HumanCapability;
|
|
198
|
+
};
|
|
199
|
+
/** Public-profile blocks / theme are edited by the dashboard only; kept open. */
|
|
200
|
+
export type ProfileBlock = {
|
|
201
|
+
id: string;
|
|
202
|
+
enabled: boolean;
|
|
203
|
+
title?: string;
|
|
204
|
+
[k: string]: unknown;
|
|
205
|
+
};
|
|
206
|
+
export type ProfileTheme = {
|
|
207
|
+
[k: string]: unknown;
|
|
208
|
+
};
|
|
209
|
+
export interface Agent {
|
|
210
|
+
id: string;
|
|
211
|
+
tenantId: string;
|
|
212
|
+
slug: string;
|
|
213
|
+
name: string;
|
|
214
|
+
description?: string;
|
|
215
|
+
model?: string;
|
|
216
|
+
modelStrategy?: ModelStrategy;
|
|
217
|
+
systemPrompt: string;
|
|
218
|
+
context?: string;
|
|
219
|
+
temperature?: number;
|
|
220
|
+
topP?: number;
|
|
221
|
+
maxTokens?: number;
|
|
222
|
+
/** The platform returns `{name, mode}` entries; older rows may hold plain names. */
|
|
223
|
+
tools?: ToolListInput;
|
|
224
|
+
skills?: string[];
|
|
225
|
+
appearance?: AgentAppearance;
|
|
226
|
+
timezone?: string;
|
|
227
|
+
isActive: boolean;
|
|
228
|
+
visibility: 'private' | 'public';
|
|
229
|
+
publicSlug?: string;
|
|
230
|
+
profileTemplate: 'minimal' | 'brand' | 'beacons';
|
|
231
|
+
profileBlocks?: ProfileBlock[];
|
|
232
|
+
profileTheme?: ProfileTheme;
|
|
233
|
+
observerEnabled?: boolean;
|
|
234
|
+
observerCapture?: {
|
|
235
|
+
clicks?: boolean;
|
|
236
|
+
inputs?: boolean;
|
|
237
|
+
navigation?: boolean;
|
|
238
|
+
scroll?: boolean;
|
|
239
|
+
};
|
|
240
|
+
createdByUserId?: string;
|
|
241
|
+
metadata?: Record<string, unknown>;
|
|
242
|
+
escalation?: AgentEscalationRule[];
|
|
243
|
+
ogLayout?: OgLayout;
|
|
244
|
+
ogThumbnailUrl?: string;
|
|
245
|
+
createdAt: string;
|
|
246
|
+
updatedAt: string;
|
|
247
|
+
}
|
|
248
|
+
export interface AgentList {
|
|
249
|
+
items: Agent[];
|
|
250
|
+
total: number;
|
|
251
|
+
limit: number | null;
|
|
252
|
+
offset: number;
|
|
253
|
+
}
|
|
254
|
+
export interface ListAgentsInput {
|
|
255
|
+
q?: string;
|
|
256
|
+
status?: 'active' | 'inactive';
|
|
257
|
+
limit?: number;
|
|
258
|
+
offset?: number;
|
|
259
|
+
/** Only agents created by this App. */
|
|
260
|
+
appId?: string;
|
|
261
|
+
}
|
|
262
|
+
/** Body of `POST /admin/tenants/:tenantId/agents` (and, partial, of PATCH). */
|
|
263
|
+
export interface AgentInput {
|
|
264
|
+
slug?: string;
|
|
265
|
+
name: string;
|
|
266
|
+
systemPrompt?: string;
|
|
267
|
+
description?: string;
|
|
268
|
+
model?: string;
|
|
269
|
+
/** `null` reverts to the single `model`. */
|
|
270
|
+
modelStrategy?: ModelStrategy | null;
|
|
271
|
+
context?: string;
|
|
272
|
+
temperature?: number;
|
|
273
|
+
topP?: number;
|
|
274
|
+
maxTokens?: number;
|
|
275
|
+
tools?: ToolListInput;
|
|
276
|
+
skills?: string[];
|
|
277
|
+
appearance?: AgentAppearance;
|
|
278
|
+
isActive?: boolean;
|
|
279
|
+
visibility?: 'private' | 'public';
|
|
280
|
+
profileTemplate?: 'minimal' | 'brand' | 'beacons';
|
|
281
|
+
profileBlocks?: ProfileBlock[];
|
|
282
|
+
profileTheme?: ProfileTheme | null;
|
|
283
|
+
observerEnabled?: boolean;
|
|
284
|
+
observerCapture?: {
|
|
285
|
+
clicks?: boolean;
|
|
286
|
+
inputs?: boolean;
|
|
287
|
+
navigation?: boolean;
|
|
288
|
+
scroll?: boolean;
|
|
289
|
+
} | null;
|
|
290
|
+
/** `null` or `[]` wipes the rules. */
|
|
291
|
+
escalation?: AgentEscalationRule[] | null;
|
|
292
|
+
ogLayout?: OgLayout;
|
|
293
|
+
metadata?: Record<string, unknown>;
|
|
294
|
+
}
|
|
295
|
+
/** `GET .../agents/:agentId/parent-team` */
|
|
296
|
+
export type AgentParentTeam = {
|
|
297
|
+
teamId: string;
|
|
298
|
+
teamSlug: string;
|
|
299
|
+
} | {
|
|
300
|
+
teamId: null;
|
|
301
|
+
};
|
|
302
|
+
export interface ChatToken {
|
|
303
|
+
token: string;
|
|
304
|
+
tenantId: string;
|
|
305
|
+
agentId: string;
|
|
306
|
+
name: string;
|
|
307
|
+
allowedOrigins?: string[];
|
|
308
|
+
isActive: boolean;
|
|
309
|
+
createdByUserId?: string;
|
|
310
|
+
lastUsedAt?: string;
|
|
311
|
+
createdAt: string;
|
|
312
|
+
updatedAt: string;
|
|
313
|
+
}
|
|
314
|
+
export interface ChatTokenInput {
|
|
315
|
+
name: string;
|
|
316
|
+
allowedOrigins?: string[];
|
|
317
|
+
}
|
|
318
|
+
export interface TeamTheme {
|
|
319
|
+
logoUrl?: string;
|
|
320
|
+
primaryColor?: string;
|
|
321
|
+
accentColor?: string;
|
|
322
|
+
headerBg?: string;
|
|
323
|
+
surfaceBg?: string;
|
|
324
|
+
surfaceFg?: string;
|
|
325
|
+
font?: 'inter' | 'geist' | 'dm-sans' | 'serif';
|
|
326
|
+
mode?: 'light' | 'dark' | 'auto';
|
|
327
|
+
bannerUrl?: string;
|
|
328
|
+
personaName?: string;
|
|
329
|
+
tagline?: string;
|
|
330
|
+
bio?: string;
|
|
331
|
+
greeting?: string;
|
|
332
|
+
shortcuts?: string[];
|
|
333
|
+
bubbleAgentBg?: string;
|
|
334
|
+
bubbleAgentFg?: string;
|
|
335
|
+
bubbleUserBg?: string;
|
|
336
|
+
bubbleUserFg?: string;
|
|
337
|
+
sendButtonBg?: string;
|
|
338
|
+
inputBg?: string;
|
|
339
|
+
inputFg?: string;
|
|
340
|
+
avatarBg?: string;
|
|
341
|
+
}
|
|
342
|
+
export type OrchestrationMode = 'flat' | 'hierarchical';
|
|
343
|
+
export interface Team {
|
|
344
|
+
id: string;
|
|
345
|
+
tenantId: string;
|
|
346
|
+
name: string;
|
|
347
|
+
slug: string;
|
|
348
|
+
publicSlug?: string;
|
|
349
|
+
visibility: 'private' | 'public';
|
|
350
|
+
description?: string;
|
|
351
|
+
systemPrompt?: string;
|
|
352
|
+
orchestratorAgentId: string;
|
|
353
|
+
theme?: TeamTheme;
|
|
354
|
+
orchestrationMode: OrchestrationMode;
|
|
355
|
+
profileTemplate?: 'minimal' | 'brand' | 'beacons';
|
|
356
|
+
profileBlocks?: ProfileBlock[];
|
|
357
|
+
ogLayout?: OgLayout;
|
|
358
|
+
ogThumbnailUrl?: string;
|
|
359
|
+
timezone?: string;
|
|
360
|
+
humanCloseTimeoutMinutes?: number;
|
|
361
|
+
humanHandbackTimeoutMinutes?: number;
|
|
362
|
+
createdAt: string;
|
|
363
|
+
updatedAt: string;
|
|
364
|
+
/** Session list / get only. Set when this team is the editable source copy of
|
|
365
|
+
* a template («… (plantilla)»): hide it from normal team pickers. `null` for
|
|
366
|
+
* any other team. Absent on responses that do not compute it. */
|
|
367
|
+
templateSourceOf?: TemplateSourceOf | null;
|
|
368
|
+
}
|
|
369
|
+
export interface TemplateSourceOf {
|
|
370
|
+
templateId: string;
|
|
371
|
+
templateName: string;
|
|
372
|
+
}
|
|
373
|
+
export interface TeamMember {
|
|
374
|
+
teamId: string;
|
|
375
|
+
agentId: string;
|
|
376
|
+
/** Routing priority: lower reads as "try first". */
|
|
377
|
+
position: number;
|
|
378
|
+
roleHint?: string;
|
|
379
|
+
/** Only meaningful when `orchestrationMode === 'hierarchical'`. */
|
|
380
|
+
parentAgentId?: string;
|
|
381
|
+
addedAt: string;
|
|
382
|
+
}
|
|
383
|
+
export interface TeamList {
|
|
384
|
+
items: Team[];
|
|
385
|
+
total: number;
|
|
386
|
+
}
|
|
387
|
+
export interface TeamWithMembers {
|
|
388
|
+
team: Team;
|
|
389
|
+
members: TeamMember[];
|
|
390
|
+
}
|
|
391
|
+
export interface CreateTeamInput {
|
|
392
|
+
name: string;
|
|
393
|
+
slug?: string;
|
|
394
|
+
description?: string;
|
|
395
|
+
systemPrompt?: string;
|
|
396
|
+
/** Order = routing priority. */
|
|
397
|
+
memberAgentIds: string[];
|
|
398
|
+
/** Keyed by agentId. */
|
|
399
|
+
roleHints?: Record<string, string>;
|
|
400
|
+
publicSlug?: string;
|
|
401
|
+
visibility?: 'private' | 'public';
|
|
402
|
+
orchestrationMode?: OrchestrationMode;
|
|
403
|
+
}
|
|
404
|
+
export interface UpdateTeamInput {
|
|
405
|
+
name?: string;
|
|
406
|
+
description?: string | null;
|
|
407
|
+
systemPrompt?: string | null;
|
|
408
|
+
publicSlug?: string | null;
|
|
409
|
+
visibility?: 'private' | 'public';
|
|
410
|
+
/** Replaces the full ordered member list. */
|
|
411
|
+
members?: Array<{
|
|
412
|
+
agentId: string;
|
|
413
|
+
roleHint?: string;
|
|
414
|
+
parentAgentId?: string | null;
|
|
415
|
+
}>;
|
|
416
|
+
theme?: TeamTheme | null;
|
|
417
|
+
orchestrationMode?: OrchestrationMode;
|
|
418
|
+
profileTemplate?: 'minimal' | 'brand' | 'beacons' | null;
|
|
419
|
+
profileBlocks?: ProfileBlock[] | null;
|
|
420
|
+
ogLayout?: OgLayout;
|
|
421
|
+
/** IANA timezone; `null` clears. */
|
|
422
|
+
timezone?: string | null;
|
|
423
|
+
humanCloseTimeoutMinutes?: number | null;
|
|
424
|
+
humanHandbackTimeoutMinutes?: number | null;
|
|
425
|
+
}
|
|
426
|
+
/** draft | unverified (reachable, never validated) | published | degraded (published, now failing). */
|
|
427
|
+
export type TeamPublicationStatus = 'draft' | 'unverified' | 'published' | 'degraded';
|
|
428
|
+
export interface TeamPublicationIssue {
|
|
429
|
+
code: string;
|
|
430
|
+
severity: 'error' | 'warning' | 'info';
|
|
431
|
+
message: string;
|
|
432
|
+
path?: string;
|
|
433
|
+
params?: Record<string, string | number>;
|
|
434
|
+
}
|
|
435
|
+
export interface TeamPublication {
|
|
436
|
+
teamId: string;
|
|
437
|
+
teamName: string;
|
|
438
|
+
status: TeamPublicationStatus;
|
|
439
|
+
canPublish: boolean;
|
|
440
|
+
exposure: {
|
|
441
|
+
public: boolean;
|
|
442
|
+
channels: Array<{
|
|
443
|
+
kind: 'inbox' | 'voice' | 'whatsapp';
|
|
444
|
+
count: number;
|
|
445
|
+
}>;
|
|
446
|
+
};
|
|
447
|
+
publishedAt: string | null;
|
|
448
|
+
publishedByUserId: string | null;
|
|
449
|
+
issues: TeamPublicationIssue[];
|
|
450
|
+
/** PDK-CONSOLE G2. Set when checked against an App (`publication(id, { publisherAppId })`):
|
|
451
|
+
* `issues` then include that App's policy issues and `canPublish` accounts for them. */
|
|
452
|
+
publisherApp?: {
|
|
453
|
+
id: string;
|
|
454
|
+
name: string;
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
export type TeamPublicationSummary = Pick<TeamPublication, 'teamId' | 'teamName' | 'status' | 'publishedAt' | 'exposure'>;
|
|
458
|
+
export type HumanNotifyVia = {
|
|
459
|
+
kind: 'slack';
|
|
460
|
+
slackUserId: string;
|
|
461
|
+
} | {
|
|
462
|
+
kind: 'whatsapp';
|
|
463
|
+
phone: string;
|
|
464
|
+
} | {
|
|
465
|
+
kind: 'email';
|
|
466
|
+
};
|
|
467
|
+
export interface TeamHumanMember {
|
|
468
|
+
teamId: string;
|
|
469
|
+
userId: string;
|
|
470
|
+
capabilities: HumanCapability[];
|
|
471
|
+
skills?: string[];
|
|
472
|
+
availability: 'always' | 'business_hours' | 'off';
|
|
473
|
+
notifyVia?: HumanNotifyVia;
|
|
474
|
+
position: number;
|
|
475
|
+
addedAt: string;
|
|
476
|
+
}
|
|
477
|
+
export interface TeamHumanMemberInput {
|
|
478
|
+
userId: string;
|
|
479
|
+
capabilities: HumanCapability[];
|
|
480
|
+
skills?: string[];
|
|
481
|
+
availability?: 'always' | 'business_hours' | 'off';
|
|
482
|
+
notifyVia?: HumanNotifyVia;
|
|
483
|
+
position?: number;
|
|
484
|
+
}
|
|
485
|
+
export interface ToolDescription {
|
|
486
|
+
name: string;
|
|
487
|
+
description: string;
|
|
488
|
+
inputSchema: Record<string, unknown>;
|
|
489
|
+
agents?: string[];
|
|
490
|
+
connectorId?: string;
|
|
491
|
+
connectorName?: string;
|
|
492
|
+
mcpServerName?: string;
|
|
493
|
+
tenantId?: string;
|
|
494
|
+
}
|
|
495
|
+
/** `GET /tools/grouped` bucket. */
|
|
496
|
+
export interface ToolGroup {
|
|
497
|
+
id: string;
|
|
498
|
+
kind: 'connector' | 'mcp' | 'builtin';
|
|
499
|
+
name: string;
|
|
500
|
+
iconUrl?: string;
|
|
501
|
+
description?: string;
|
|
502
|
+
tools: ToolDescription[];
|
|
503
|
+
}
|
|
504
|
+
export interface ConnectorStatus {
|
|
505
|
+
connectorId: string;
|
|
506
|
+
name: string;
|
|
507
|
+
description: string;
|
|
508
|
+
category?: string;
|
|
509
|
+
iconUrl?: string;
|
|
510
|
+
/** False = the platform has no OAuth credentials for it ("needs admin setup"). */
|
|
511
|
+
configured: boolean;
|
|
512
|
+
connected: boolean;
|
|
513
|
+
accountLabel?: string;
|
|
514
|
+
connectedAt?: string;
|
|
515
|
+
/** Older servers omit it: treat as `oauth`. */
|
|
516
|
+
authKind?: 'oauth' | 'api_key';
|
|
517
|
+
}
|
|
518
|
+
export interface ListConnectorsInput {
|
|
519
|
+
/** Case-insensitive substring of the display name. */
|
|
520
|
+
q?: string;
|
|
521
|
+
category?: string;
|
|
522
|
+
status?: 'connected' | 'available' | 'pending';
|
|
523
|
+
}
|
|
524
|
+
export interface ConnectorFacets {
|
|
525
|
+
total: number;
|
|
526
|
+
status: {
|
|
527
|
+
connected: number;
|
|
528
|
+
available: number;
|
|
529
|
+
pending: number;
|
|
530
|
+
};
|
|
531
|
+
categories: Array<{
|
|
532
|
+
name: string;
|
|
533
|
+
count: number;
|
|
534
|
+
}>;
|
|
535
|
+
}
|
|
536
|
+
export interface AuthorizeConnectorInput {
|
|
537
|
+
/** Where the platform sends the browser after the provider consent. */
|
|
538
|
+
postAuthRedirect: string;
|
|
539
|
+
/** Shopify only. */
|
|
540
|
+
shop?: string;
|
|
541
|
+
}
|
|
542
|
+
export type AppStatus = 'draft' | 'published';
|
|
543
|
+
/** `GET /apps?tenantId=` item (secrets only as prefixes). */
|
|
544
|
+
/** PDK-CONSOLE G2. Publication rules an App declares as data (server:
|
|
545
|
+
* identity/domain/app-template-policy.ts). `*` wildcards, case-insensitive. */
|
|
546
|
+
export interface AppTemplatePolicy {
|
|
547
|
+
requireUsesCatalog?: boolean;
|
|
548
|
+
forbiddenToolNamePatterns?: string[];
|
|
549
|
+
forbiddenConnectorIds?: string[];
|
|
550
|
+
forbiddenSecretKeyPatterns?: string[];
|
|
551
|
+
blockFixedValuesInPrompts?: boolean;
|
|
552
|
+
}
|
|
553
|
+
/** Editable fields of `PATCH /apps/:id` (server UpdateAppDto). `templatePolicy` is owner-only; null clears. */
|
|
554
|
+
export interface UpdateAppInput {
|
|
555
|
+
name?: string;
|
|
556
|
+
description?: string | null;
|
|
557
|
+
logoUrl?: string | null;
|
|
558
|
+
coverUrl?: string | null;
|
|
559
|
+
content?: string | null;
|
|
560
|
+
templatePolicy?: AppTemplatePolicy | null;
|
|
561
|
+
}
|
|
562
|
+
export interface AppSummary {
|
|
563
|
+
id: string;
|
|
564
|
+
name: string;
|
|
565
|
+
description?: string | null;
|
|
566
|
+
content?: string | null;
|
|
567
|
+
logoUrl?: string | null;
|
|
568
|
+
coverUrl?: string | null;
|
|
569
|
+
/** PDK-CONSOLE G2. Publication rules for templates published under the App; null = none. */
|
|
570
|
+
templatePolicy?: AppTemplatePolicy | null;
|
|
571
|
+
status: AppStatus;
|
|
572
|
+
publicKey: string;
|
|
573
|
+
apiSecretPrefix: string;
|
|
574
|
+
publicKeyTest: string | null;
|
|
575
|
+
apiSecretTestPrefix: string | null;
|
|
576
|
+
revokedAt?: string | null;
|
|
577
|
+
lastUsedAt?: string | null;
|
|
578
|
+
createdAt: string;
|
|
579
|
+
updatedAt: string;
|
|
580
|
+
}
|
|
581
|
+
export type TemplateKind = 'agent' | 'team' | 'app';
|
|
582
|
+
export type TemplateVisibility = 'system' | 'tenant' | 'public';
|
|
583
|
+
export type MarketplaceStatus = 'none' | 'pending_review' | 'approved' | 'rejected';
|
|
584
|
+
export type MarketplaceLocale = 'es' | 'en';
|
|
585
|
+
export type MarketplaceCategoryGroup = 'industry' | 'use_case';
|
|
586
|
+
export declare const CONFIG_FIELD_TYPES: readonly ["text", "longtext", "phone", "address", "url", "google_sheet", "drive_file", "hours", "delivery", "payments"];
|
|
587
|
+
/** Known types; the server may add more, hence `string` in the wire field. */
|
|
588
|
+
export type ConfigFieldType = (typeof CONFIG_FIELD_TYPES)[number] | (string & {});
|
|
589
|
+
export interface TemplateConfigField {
|
|
590
|
+
key: string;
|
|
591
|
+
label: string;
|
|
592
|
+
help?: string;
|
|
593
|
+
type: ConfigFieldType;
|
|
594
|
+
required: boolean;
|
|
595
|
+
picker?: {
|
|
596
|
+
connectorId: string;
|
|
597
|
+
resourceType: string;
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
export interface TemplateCategoryRef {
|
|
601
|
+
slug: string;
|
|
602
|
+
group: MarketplaceCategoryGroup;
|
|
603
|
+
primary: boolean;
|
|
604
|
+
active: boolean;
|
|
605
|
+
labels: Record<string, string>;
|
|
606
|
+
}
|
|
607
|
+
export interface MarketplaceCategory {
|
|
608
|
+
slug: string;
|
|
609
|
+
group: MarketplaceCategoryGroup;
|
|
610
|
+
labels: Record<string, string>;
|
|
611
|
+
icon?: string | null;
|
|
612
|
+
active: boolean;
|
|
613
|
+
}
|
|
614
|
+
/** PDK-CONSOLE-a. The App a template is published under (its brand). */
|
|
615
|
+
export interface TemplatePublisher {
|
|
616
|
+
appId: string;
|
|
617
|
+
name: string;
|
|
618
|
+
logoUrl: string | null;
|
|
619
|
+
}
|
|
620
|
+
/** PDK-CONSOLE-a. The workspace (and person) that authored a template. */
|
|
621
|
+
export interface TemplateAuthor {
|
|
622
|
+
tenantId: string;
|
|
623
|
+
tenantName: string;
|
|
624
|
+
userDisplayName?: string;
|
|
625
|
+
}
|
|
626
|
+
/** A template row (summary + payload where the route returns it). */
|
|
627
|
+
export interface Template {
|
|
628
|
+
id: string;
|
|
629
|
+
tenantId: string | null;
|
|
630
|
+
kind: TemplateKind;
|
|
631
|
+
name: string;
|
|
632
|
+
description?: string | null;
|
|
633
|
+
icon?: string | null;
|
|
634
|
+
/** @deprecated legacy free text; use `categories`. */
|
|
635
|
+
category?: string | null;
|
|
636
|
+
tags?: string[] | null;
|
|
637
|
+
payload?: Record<string, unknown>;
|
|
638
|
+
requiresConnectors?: string[] | null;
|
|
639
|
+
requiresSecrets?: string[] | null;
|
|
640
|
+
requiresConfig?: string[] | null;
|
|
641
|
+
configSchema?: TemplateConfigField[] | null;
|
|
642
|
+
visibility: TemplateVisibility;
|
|
643
|
+
shareToken?: string;
|
|
644
|
+
installedFromTemplateId?: string | null;
|
|
645
|
+
/** The team the template is edited through (its copy). */
|
|
646
|
+
sourceTeamId?: string | null;
|
|
647
|
+
installsCount: number;
|
|
648
|
+
currentVersion: number;
|
|
649
|
+
createdByUserId?: string | null;
|
|
650
|
+
priceCents?: number | null;
|
|
651
|
+
marketplaceStatus?: MarketplaceStatus;
|
|
652
|
+
sourceAppId?: string;
|
|
653
|
+
appActive?: boolean;
|
|
654
|
+
logoUrl?: string | null;
|
|
655
|
+
coverUrl?: string | null;
|
|
656
|
+
locale?: MarketplaceLocale | null;
|
|
657
|
+
guideMd?: string | null;
|
|
658
|
+
categories?: TemplateCategoryRef[];
|
|
659
|
+
/** PDK-CONSOLE-a. Optional so an older platform still type-checks. */
|
|
660
|
+
publisher?: TemplatePublisher | null;
|
|
661
|
+
author?: TemplateAuthor | null;
|
|
662
|
+
/** Raw publisher App id; null = published by the workspace. */
|
|
663
|
+
publisherAppId?: string | null;
|
|
664
|
+
/** PDK-CONSOLE G4. On `GET /templates/:id`, for the template's workspace members and platform admins only. */
|
|
665
|
+
installs?: TemplateInstallStats;
|
|
666
|
+
createdAt: string;
|
|
667
|
+
updatedAt: string;
|
|
668
|
+
}
|
|
669
|
+
/** PDK-CONSOLE G4. `total` cumulative; `byVersion` counts installs that exist now (`version: null` = pre-versioning). */
|
|
670
|
+
export interface TemplateInstallStats {
|
|
671
|
+
total: number;
|
|
672
|
+
active: number;
|
|
673
|
+
byVersion: Array<{
|
|
674
|
+
version: number | null;
|
|
675
|
+
count: number;
|
|
676
|
+
}>;
|
|
677
|
+
}
|
|
678
|
+
/** `GET /templates/:id/policy-check`: dry run of an App's template policy (nothing is written). */
|
|
679
|
+
export interface TemplatePolicyCheck {
|
|
680
|
+
appId: string | null;
|
|
681
|
+
appName: string | null;
|
|
682
|
+
version: number;
|
|
683
|
+
issues: TeamPublicationIssue[];
|
|
684
|
+
canPublish: boolean;
|
|
685
|
+
}
|
|
686
|
+
export interface ListTemplatesInput {
|
|
687
|
+
kind?: TemplateKind;
|
|
688
|
+
q?: string;
|
|
689
|
+
/** Linked to ANY of these category slugs. */
|
|
690
|
+
categories?: string[];
|
|
691
|
+
primaryCategory?: string;
|
|
692
|
+
/** PDK-CONSOLE G1. Session `GET /templates` only: rows published under this App. */
|
|
693
|
+
publisherAppId?: string;
|
|
694
|
+
/** 1-200. */
|
|
695
|
+
limit?: number;
|
|
696
|
+
}
|
|
697
|
+
export interface SaveTemplateInput {
|
|
698
|
+
name?: string;
|
|
699
|
+
description?: string;
|
|
700
|
+
icon?: string;
|
|
701
|
+
category?: string;
|
|
702
|
+
tags?: string[];
|
|
703
|
+
visibility?: TemplateVisibility;
|
|
704
|
+
/** Fields for the prompts' `{{config:KEY}}` tokens (400 `invalid_config_schema` if malformed). */
|
|
705
|
+
configSchema?: TemplateConfigField[];
|
|
706
|
+
/** PDK-CONSOLE G1. App to publish under (live App; owner/admin only); null clears; omitted keeps.
|
|
707
|
+
* 400 `publisher_app_not_found` / `publisher_app_not_live` / `invalid_publisher_app_id`,
|
|
708
|
+
* `publisher_policy_violation` (all 400; `ApiError.details.issues`). */
|
|
709
|
+
publisherAppId?: string | null;
|
|
710
|
+
}
|
|
711
|
+
/** Body of `PATCH /templates/:id`: metadata + listing, applied at once. */
|
|
712
|
+
export interface TemplateListingPatch {
|
|
713
|
+
name?: string;
|
|
714
|
+
description?: string;
|
|
715
|
+
icon?: string;
|
|
716
|
+
tags?: string[];
|
|
717
|
+
visibility?: TemplateVisibility;
|
|
718
|
+
logoUrl?: string | null;
|
|
719
|
+
coverUrl?: string | null;
|
|
720
|
+
guideMd?: string | null;
|
|
721
|
+
locale?: MarketplaceLocale | null;
|
|
722
|
+
categories?: Array<{
|
|
723
|
+
slug: string;
|
|
724
|
+
primary?: boolean;
|
|
725
|
+
}>;
|
|
726
|
+
/** PDK-CONSOLE G1. See {@link SaveTemplateInput.publisherAppId}. */
|
|
727
|
+
publisherAppId?: string | null;
|
|
728
|
+
}
|
|
729
|
+
export interface SignListingAssetInput {
|
|
730
|
+
kind: 'logo' | 'cover';
|
|
731
|
+
contentType: string;
|
|
732
|
+
contentLength?: number;
|
|
733
|
+
}
|
|
734
|
+
/** PUT the file bytes to `uploadUrl`, then PATCH the template with `publicUrl`. */
|
|
735
|
+
export interface SignedUpload {
|
|
736
|
+
uploadUrl: string;
|
|
737
|
+
publicUrl: string;
|
|
738
|
+
key?: string;
|
|
739
|
+
}
|
|
740
|
+
export interface InstallTemplateOverrides {
|
|
741
|
+
orchestrator?: {
|
|
742
|
+
tools?: ToolPermissionInput[];
|
|
743
|
+
systemPrompt?: string;
|
|
744
|
+
};
|
|
745
|
+
/** Matched by the slug inside the template payload. */
|
|
746
|
+
members?: Array<{
|
|
747
|
+
sourceSlug: string;
|
|
748
|
+
tools?: ToolPermissionInput[];
|
|
749
|
+
systemPrompt?: string;
|
|
750
|
+
}>;
|
|
751
|
+
}
|
|
752
|
+
export interface InstallTemplateInput {
|
|
753
|
+
name?: string;
|
|
754
|
+
overrides?: InstallTemplateOverrides;
|
|
755
|
+
}
|
|
756
|
+
export interface TemplateInstallResult {
|
|
757
|
+
kind: TemplateKind;
|
|
758
|
+
agentId: string | null;
|
|
759
|
+
agentSlug: string | null;
|
|
760
|
+
teamId: string | null;
|
|
761
|
+
teamSlug: string | null;
|
|
762
|
+
requiresConnectors: string[];
|
|
763
|
+
requiresSecrets: string[];
|
|
764
|
+
requiresConfig?: string[];
|
|
765
|
+
}
|
|
766
|
+
export type ReadinessStatus = 'ready' | 'needs_setup' | 'blocked';
|
|
767
|
+
export interface ToolReadiness {
|
|
768
|
+
name: string;
|
|
769
|
+
mode: ToolPermissionMode;
|
|
770
|
+
status: ReadinessStatus;
|
|
771
|
+
connectorId?: string;
|
|
772
|
+
connectorName?: string;
|
|
773
|
+
reason?: string;
|
|
774
|
+
}
|
|
775
|
+
export interface AgentReadiness {
|
|
776
|
+
slug: string;
|
|
777
|
+
name: string;
|
|
778
|
+
kind: 'standalone' | 'team-orchestrator';
|
|
779
|
+
status: ReadinessStatus;
|
|
780
|
+
tools: ToolReadiness[];
|
|
781
|
+
}
|
|
782
|
+
export interface TemplateReadiness {
|
|
783
|
+
templateId: string;
|
|
784
|
+
destinationTenantId: string;
|
|
785
|
+
status: ReadinessStatus;
|
|
786
|
+
agents: AgentReadiness[];
|
|
787
|
+
connectors: Array<{
|
|
788
|
+
connectorId: string;
|
|
789
|
+
connectorName: string;
|
|
790
|
+
status: ReadinessStatus;
|
|
791
|
+
reason?: string;
|
|
792
|
+
}>;
|
|
793
|
+
secrets: Array<{
|
|
794
|
+
key: string;
|
|
795
|
+
status: 'ready' | 'needs_setup';
|
|
796
|
+
}>;
|
|
797
|
+
config?: Array<{
|
|
798
|
+
key: string;
|
|
799
|
+
label: string;
|
|
800
|
+
type: ConfigFieldType;
|
|
801
|
+
required: boolean;
|
|
802
|
+
status: 'ready' | 'needs_setup';
|
|
803
|
+
}>;
|
|
804
|
+
notes: string[];
|
|
805
|
+
}
|
|
806
|
+
/** Old-style published version row (`GET /templates/:id/versions`). */
|
|
807
|
+
export interface TemplateVersionRow {
|
|
808
|
+
id: string;
|
|
809
|
+
templateId: string;
|
|
810
|
+
version: number;
|
|
811
|
+
payload: Record<string, unknown>;
|
|
812
|
+
requiresConnectors?: string[] | null;
|
|
813
|
+
requiresSecrets?: string[] | null;
|
|
814
|
+
changelog?: string | null;
|
|
815
|
+
publishedByUserId?: string | null;
|
|
816
|
+
publishedAt: string;
|
|
817
|
+
}
|
|
818
|
+
export interface UpdatesAvailable {
|
|
819
|
+
agents: Array<{
|
|
820
|
+
agentId: string;
|
|
821
|
+
agentName: string;
|
|
822
|
+
templateId: string;
|
|
823
|
+
installedVersion: number | null;
|
|
824
|
+
currentVersion: number;
|
|
825
|
+
}>;
|
|
826
|
+
teams: Array<{
|
|
827
|
+
teamId: string;
|
|
828
|
+
teamName: string;
|
|
829
|
+
templateId: string;
|
|
830
|
+
installedVersion: number | null;
|
|
831
|
+
currentVersion: number;
|
|
832
|
+
}>;
|
|
833
|
+
}
|
|
834
|
+
export interface UpdateFromTemplateResult {
|
|
835
|
+
agentId?: string;
|
|
836
|
+
teamId?: string;
|
|
837
|
+
appliedVersion: number;
|
|
838
|
+
membersUpdated?: number;
|
|
839
|
+
membersSkipped?: number;
|
|
840
|
+
requiresConnectors?: string[];
|
|
841
|
+
requiresSecrets?: string[];
|
|
842
|
+
}
|
|
843
|
+
export type TemplateVersionStatus = 'draft' | 'in_review' | 'published' | 'archived';
|
|
844
|
+
export interface TemplateVersionReview {
|
|
845
|
+
reviewerUserId: string;
|
|
846
|
+
decision: 'approved' | 'changes_requested';
|
|
847
|
+
comment: string | null;
|
|
848
|
+
decidedAt: string;
|
|
849
|
+
}
|
|
850
|
+
export interface TemplateVersionView {
|
|
851
|
+
version: number;
|
|
852
|
+
status: TemplateVersionStatus;
|
|
853
|
+
changelog: string | null;
|
|
854
|
+
authorUserId: string | null;
|
|
855
|
+
/** The author's name (never the email); absent when unknown / unnamed. */
|
|
856
|
+
authorDisplayName?: string;
|
|
857
|
+
createdAt: string;
|
|
858
|
+
submittedAt: string | null;
|
|
859
|
+
releasedAt: string | null;
|
|
860
|
+
restoredFromVersion: number | null;
|
|
861
|
+
reviews: TemplateVersionReview[];
|
|
862
|
+
}
|
|
863
|
+
export interface VersionHistory {
|
|
864
|
+
items: TemplateVersionView[];
|
|
865
|
+
sourceTeamId: string | null;
|
|
866
|
+
requiredApprovals: number;
|
|
867
|
+
approverUserIds: string[];
|
|
868
|
+
}
|
|
869
|
+
export interface TemplateSourceStatus {
|
|
870
|
+
templateId: string;
|
|
871
|
+
templateName: string;
|
|
872
|
+
kind: 'agent' | 'team';
|
|
873
|
+
publishedVersion: number;
|
|
874
|
+
open: TemplateVersionView | null;
|
|
875
|
+
unpublishedChanges: boolean;
|
|
876
|
+
approvalsNeeded: number;
|
|
877
|
+
approverUserIds: string[];
|
|
878
|
+
}
|
|
879
|
+
export type DiffJson = null | boolean | number | string | DiffJson[] | {
|
|
880
|
+
[k: string]: DiffJson;
|
|
881
|
+
};
|
|
882
|
+
export interface DiffFieldChange {
|
|
883
|
+
field: string;
|
|
884
|
+
before?: DiffJson;
|
|
885
|
+
after?: DiffJson;
|
|
886
|
+
}
|
|
887
|
+
export interface VersionDiff {
|
|
888
|
+
same: boolean;
|
|
889
|
+
team: DiffFieldChange[];
|
|
890
|
+
agents: Array<{
|
|
891
|
+
key: string;
|
|
892
|
+
name: string;
|
|
893
|
+
role: 'orchestrator' | 'member';
|
|
894
|
+
status: 'added' | 'removed' | 'changed';
|
|
895
|
+
fields: DiffFieldChange[];
|
|
896
|
+
}>;
|
|
897
|
+
config: Array<{
|
|
898
|
+
key: string;
|
|
899
|
+
label: string;
|
|
900
|
+
status: 'added' | 'removed' | 'changed';
|
|
901
|
+
fields: DiffFieldChange[];
|
|
902
|
+
}>;
|
|
903
|
+
other: DiffFieldChange[];
|
|
904
|
+
}
|
|
905
|
+
export interface TemplateConfigFields {
|
|
906
|
+
fields: TemplateConfigField[];
|
|
907
|
+
/** Keys referenced by `{{config:KEY}}` in the prompts. */
|
|
908
|
+
referenced: string[];
|
|
909
|
+
draftVersion: number | null;
|
|
910
|
+
}
|
|
911
|
+
export interface PlaygroundMetrics {
|
|
912
|
+
messages: number;
|
|
913
|
+
agentMessages: number;
|
|
914
|
+
userMessages: number;
|
|
915
|
+
totalTokens: number;
|
|
916
|
+
inputTokens: number;
|
|
917
|
+
outputTokens: number;
|
|
918
|
+
totalCostUsd: number;
|
|
919
|
+
totalDurationMs: number;
|
|
920
|
+
averageDurationMs: number;
|
|
921
|
+
delegationsCount: number;
|
|
922
|
+
toolCallsCount: number;
|
|
923
|
+
byAgent: Array<{
|
|
924
|
+
agentId: string;
|
|
925
|
+
messages: number;
|
|
926
|
+
inputTokens: number;
|
|
927
|
+
outputTokens: number;
|
|
928
|
+
costUsd: number;
|
|
929
|
+
durationMs: number;
|
|
930
|
+
}>;
|
|
931
|
+
}
|
|
932
|
+
export interface PlaygroundRun {
|
|
933
|
+
id: string;
|
|
934
|
+
tenantId: string;
|
|
935
|
+
teamId: string;
|
|
936
|
+
name: string;
|
|
937
|
+
scenarioSlug?: string | null;
|
|
938
|
+
scenarioPrompt: string;
|
|
939
|
+
configMode?: string | null;
|
|
940
|
+
channelId: string;
|
|
941
|
+
status: 'running' | 'finalized' | 'aborted';
|
|
942
|
+
startedByUserId?: string | null;
|
|
943
|
+
startedAt: string;
|
|
944
|
+
finalizedAt?: string | null;
|
|
945
|
+
metrics?: PlaygroundMetrics | null;
|
|
946
|
+
transcript?: Array<{
|
|
947
|
+
id: string;
|
|
948
|
+
senderKind: 'user' | 'agent' | 'system';
|
|
949
|
+
senderAgentId?: string;
|
|
950
|
+
senderUserId?: string;
|
|
951
|
+
content: string;
|
|
952
|
+
createdAt: string;
|
|
953
|
+
metadata?: Record<string, unknown>;
|
|
954
|
+
}> | null;
|
|
955
|
+
notes?: string | null;
|
|
956
|
+
createdAt: string;
|
|
957
|
+
updatedAt: string;
|
|
958
|
+
}
|
|
959
|
+
export interface StartPlaygroundRunInput {
|
|
960
|
+
teamId: string;
|
|
961
|
+
scenarioPrompt: string;
|
|
962
|
+
scenarioSlug?: string;
|
|
963
|
+
name?: string;
|
|
964
|
+
configMode?: string;
|
|
965
|
+
notes?: string;
|
|
966
|
+
}
|
|
967
|
+
export type TenantVariableKind = 'config' | 'secret';
|
|
968
|
+
/** One workspace variable. `kind: 'config'` carries `value`; `kind: 'secret'`
|
|
969
|
+
* never does: only `valueHint` (last 4 chars) once stored. */
|
|
970
|
+
export interface TenantVariable {
|
|
971
|
+
key: string;
|
|
972
|
+
kind: TenantVariableKind;
|
|
973
|
+
description: string;
|
|
974
|
+
/** Plaintext. Present only for stored `config` variables. */
|
|
975
|
+
value?: string;
|
|
976
|
+
/** Last 4 characters of a stored secret. */
|
|
977
|
+
valueHint?: string;
|
|
978
|
+
configured: boolean;
|
|
979
|
+
source: 'env' | 'db' | 'vault' | 'none';
|
|
980
|
+
/** `system`: declared by code (cannot be deleted); `user`: created by an operator. */
|
|
981
|
+
managedBy: 'system' | 'user';
|
|
982
|
+
updatedAt?: string;
|
|
983
|
+
updatedByUserId?: string;
|
|
984
|
+
/** What reads it (adapters / connectors / tools); a non-empty list makes DELETE a 409. */
|
|
985
|
+
bindings: unknown[];
|
|
986
|
+
secretScope?: string;
|
|
987
|
+
tenantId?: string;
|
|
988
|
+
appId?: string;
|
|
989
|
+
sensitivity?: string;
|
|
990
|
+
}
|
|
991
|
+
export interface UpsertTenantVariableInput {
|
|
992
|
+
value: string;
|
|
993
|
+
kind?: TenantVariableKind;
|
|
994
|
+
description?: string;
|
|
995
|
+
}
|
|
996
|
+
/** `ApiError.code` of the publisher App checks on save / release / publish. */
|
|
997
|
+
export type PublisherErrorCode = 'publisher_app_not_found' | 'publisher_app_not_live' | 'publisher_policy_violation' | 'invalid_publisher_app_id' | 'invalid_template_policy';
|
|
998
|
+
/** `ApiError.details` of a 400 `publisher_policy_violation`. Each issue has a
|
|
999
|
+
* stable `code` and `params` to translate (`policy_forbidden_tool`: tool,
|
|
1000
|
+
* pattern, agent; `policy_forbidden_connector`: tool, connector, agent;
|
|
1001
|
+
* `policy_forbidden_secret`: key, pattern, agent; `policy_fixed_value_in_prompt`:
|
|
1002
|
+
* kind, sample, agent; `policy_requires_catalog`: requirement). */
|
|
1003
|
+
export interface PublisherErrorBody {
|
|
1004
|
+
code: PublisherErrorCode;
|
|
1005
|
+
/** Same value as `code` (kept for back-compat). */
|
|
1006
|
+
reason: PublisherErrorCode;
|
|
1007
|
+
message: string;
|
|
1008
|
+
issues?: TeamPublicationIssue[];
|
|
1009
|
+
}
|