mitra-interactions-sdk 1.0.60-beta.2 → 1.0.60-beta.21
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 +296 -558
- package/dist/index.d.mts +11 -919
- package/dist/index.d.ts +11 -919
- package/dist/index.js +570 -1884
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +569 -1851
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -25,142 +25,6 @@ interface LoginResponse {
|
|
|
25
25
|
/** URL do serviço de integrações (opcional) */
|
|
26
26
|
integrationURL?: string;
|
|
27
27
|
}
|
|
28
|
-
interface EmailSignupOptions {
|
|
29
|
-
/** URL da página de auth (ex: https://validacao.mitralab.io/sdk-auth/). Opcional se já configurado via configureSdkMitra. */
|
|
30
|
-
authUrl?: string;
|
|
31
|
-
/** ID do projeto. Opcional se já configurado via configureSdkMitra. */
|
|
32
|
-
projectId?: number | string;
|
|
33
|
-
/** Nome completo do usuário */
|
|
34
|
-
name: string;
|
|
35
|
-
/** Email do usuário */
|
|
36
|
-
email: string;
|
|
37
|
-
/** Senha */
|
|
38
|
-
password: string;
|
|
39
|
-
}
|
|
40
|
-
interface EmailLoginOptions {
|
|
41
|
-
/** URL da página de auth (ex: https://validacao.mitralab.io/sdk-auth/). Opcional se já configurado via configureSdkMitra. */
|
|
42
|
-
authUrl?: string;
|
|
43
|
-
/** ID do projeto. Opcional se já configurado via configureSdkMitra. */
|
|
44
|
-
projectId?: number | string;
|
|
45
|
-
/** Email do usuário */
|
|
46
|
-
email: string;
|
|
47
|
-
/** Senha */
|
|
48
|
-
password: string;
|
|
49
|
-
}
|
|
50
|
-
interface EmailVerifyCodeOptions {
|
|
51
|
-
/** URL da página de auth. Opcional se já configurado via configureSdkMitra. */
|
|
52
|
-
authUrl?: string;
|
|
53
|
-
/** ID do projeto. Opcional se já configurado via configureSdkMitra. */
|
|
54
|
-
projectId?: number | string;
|
|
55
|
-
/** Email do usuário */
|
|
56
|
-
email: string;
|
|
57
|
-
/** Código de verificação de 6 dígitos */
|
|
58
|
-
code: string;
|
|
59
|
-
/** Senha do usuário (necessário para login automático após verificação) */
|
|
60
|
-
password: string;
|
|
61
|
-
}
|
|
62
|
-
interface EmailResendCodeOptions {
|
|
63
|
-
/** URL da página de auth. Opcional se já configurado via configureSdkMitra. */
|
|
64
|
-
authUrl?: string;
|
|
65
|
-
/** ID do projeto. Opcional se já configurado via configureSdkMitra. */
|
|
66
|
-
projectId?: number | string;
|
|
67
|
-
/** Email do usuário */
|
|
68
|
-
email: string;
|
|
69
|
-
}
|
|
70
|
-
interface SendPasswordResetCodeOptions {
|
|
71
|
-
/** Email do usuário que esqueceu a senha */
|
|
72
|
-
email: string;
|
|
73
|
-
/** ID do projeto. Default: do config global. */
|
|
74
|
-
projectId?: number | string;
|
|
75
|
-
/** URL da página de auth (opcional — usado pra derivar a API base). Default: do config global. */
|
|
76
|
-
authUrl?: string;
|
|
77
|
-
/** Override explícito da API base (ex: https://api0.mitraecp.com:1005). Default: derivado do authUrl. */
|
|
78
|
-
authApiURL?: string;
|
|
79
|
-
}
|
|
80
|
-
interface ValidatePasswordResetCodeOptions {
|
|
81
|
-
email: string;
|
|
82
|
-
/** Código de 6 dígitos recebido por email */
|
|
83
|
-
code: string;
|
|
84
|
-
projectId?: number | string;
|
|
85
|
-
authUrl?: string;
|
|
86
|
-
authApiURL?: string;
|
|
87
|
-
}
|
|
88
|
-
interface ResetPasswordOptions {
|
|
89
|
-
email: string;
|
|
90
|
-
/** Código de 6 dígitos recebido por email */
|
|
91
|
-
code: string;
|
|
92
|
-
/** Nova senha */
|
|
93
|
-
newPassword: string;
|
|
94
|
-
projectId?: number | string;
|
|
95
|
-
authUrl?: string;
|
|
96
|
-
authApiURL?: string;
|
|
97
|
-
}
|
|
98
|
-
interface ExecuteDataLoaderOptions {
|
|
99
|
-
projectId?: number | string;
|
|
100
|
-
dataLoaderId: number | string;
|
|
101
|
-
input?: Record<string, unknown>;
|
|
102
|
-
}
|
|
103
|
-
interface ExecuteDataLoaderResponse {
|
|
104
|
-
status: string;
|
|
105
|
-
result: {
|
|
106
|
-
dataLoaderId: number | string;
|
|
107
|
-
executionLog: {
|
|
108
|
-
timestamp: string;
|
|
109
|
-
rowCount: number;
|
|
110
|
-
query: string;
|
|
111
|
-
status: string;
|
|
112
|
-
fileSize?: string;
|
|
113
|
-
duration?: string;
|
|
114
|
-
};
|
|
115
|
-
message: string;
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
interface ExecuteDbActionOptions {
|
|
119
|
-
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
120
|
-
projectId?: number | string;
|
|
121
|
-
/** ID da DBAction cadastrada */
|
|
122
|
-
dbActionId: number | string;
|
|
123
|
-
/** Parâmetros de entrada (opcional) — substituição de variáveis no SQL (ex: { "nome": "João" } substitui :nome) */
|
|
124
|
-
input?: Record<string, unknown>;
|
|
125
|
-
}
|
|
126
|
-
interface ExecuteDbActionResponse {
|
|
127
|
-
status: string;
|
|
128
|
-
result: {
|
|
129
|
-
rowsAffected: number;
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
interface SetFileStatusOptions {
|
|
133
|
-
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
134
|
-
projectId?: number | string;
|
|
135
|
-
/** Nome do arquivo */
|
|
136
|
-
fileName: string;
|
|
137
|
-
/** Caminho de destino: "PUBLIC" ou "LOADABLE" */
|
|
138
|
-
targetPath: 'PUBLIC' | 'LOADABLE';
|
|
139
|
-
}
|
|
140
|
-
interface SetFileStatusResponse {
|
|
141
|
-
status: string;
|
|
142
|
-
result: {
|
|
143
|
-
fileName: string;
|
|
144
|
-
currentPath: string;
|
|
145
|
-
publicUrl: string | null;
|
|
146
|
-
message: string;
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
interface SetVariableOptions {
|
|
150
|
-
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
151
|
-
projectId?: number | string;
|
|
152
|
-
/** Nome da variável (key) */
|
|
153
|
-
key: string;
|
|
154
|
-
/** Valor da variável (opcional) */
|
|
155
|
-
value?: string;
|
|
156
|
-
}
|
|
157
|
-
interface SetVariableResponse {
|
|
158
|
-
status: string;
|
|
159
|
-
result: {
|
|
160
|
-
key: string;
|
|
161
|
-
value: string;
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
28
|
interface ExecuteServerFunctionOptions {
|
|
165
29
|
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
166
30
|
projectId?: number | string;
|
|
@@ -280,64 +144,6 @@ interface CreateRecordsBatchOptions {
|
|
|
280
144
|
records: Record<string, unknown>[];
|
|
281
145
|
jdbcConnectionConfigId?: number | string;
|
|
282
146
|
}
|
|
283
|
-
interface UploadFileOptions {
|
|
284
|
-
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
285
|
-
projectId?: number | string;
|
|
286
|
-
/** Arquivo a ser enviado (File ou Blob) */
|
|
287
|
-
file: File | Blob;
|
|
288
|
-
/** Habilitar debug (opcional) */
|
|
289
|
-
debug?: boolean;
|
|
290
|
-
}
|
|
291
|
-
interface UploadFileResponse {
|
|
292
|
-
status: string;
|
|
293
|
-
result: {
|
|
294
|
-
fileName: string;
|
|
295
|
-
currentPath: string;
|
|
296
|
-
publicUrl: string | null;
|
|
297
|
-
message: string;
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
interface ListVariablesOptions {
|
|
301
|
-
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
302
|
-
projectId?: number | string;
|
|
303
|
-
}
|
|
304
|
-
interface ListVariablesResponse {
|
|
305
|
-
status: string;
|
|
306
|
-
projectId: number | string;
|
|
307
|
-
result: {
|
|
308
|
-
key: string;
|
|
309
|
-
value: string;
|
|
310
|
-
}[];
|
|
311
|
-
}
|
|
312
|
-
interface GetVariableOptions {
|
|
313
|
-
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
314
|
-
projectId?: number | string;
|
|
315
|
-
/** Nome da variável (com ou sem :VAR_) */
|
|
316
|
-
key: string;
|
|
317
|
-
}
|
|
318
|
-
interface GetVariableResponse {
|
|
319
|
-
status: string;
|
|
320
|
-
result: {
|
|
321
|
-
key: string;
|
|
322
|
-
value: string;
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
interface RunActionOptions {
|
|
326
|
-
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
327
|
-
projectId?: number | string;
|
|
328
|
-
/** ID da Action a executar */
|
|
329
|
-
actionId: number | string;
|
|
330
|
-
/** Parâmetros de entrada para a action (opcional) */
|
|
331
|
-
input?: Record<string, unknown>;
|
|
332
|
-
}
|
|
333
|
-
interface RunActionResponse {
|
|
334
|
-
status: string;
|
|
335
|
-
executionTime?: string;
|
|
336
|
-
result: {
|
|
337
|
-
stepsExecuted: number;
|
|
338
|
-
message: string;
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
147
|
interface CallIntegrationOptions {
|
|
342
148
|
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
343
149
|
projectId?: number | string;
|
|
@@ -389,468 +195,6 @@ interface StopServerFunctionExecutionResponse {
|
|
|
389
195
|
executionStatus: string;
|
|
390
196
|
};
|
|
391
197
|
}
|
|
392
|
-
interface ListProfilesOptions {
|
|
393
|
-
projectId?: number | string;
|
|
394
|
-
}
|
|
395
|
-
interface ListProfilesResponse {
|
|
396
|
-
status: string;
|
|
397
|
-
projectId: number | string;
|
|
398
|
-
result: {
|
|
399
|
-
id: number | string;
|
|
400
|
-
name: string;
|
|
401
|
-
color: string;
|
|
402
|
-
homeScreenId: number | string;
|
|
403
|
-
}[];
|
|
404
|
-
}
|
|
405
|
-
interface GetProfileDetailsOptions {
|
|
406
|
-
projectId?: number | string;
|
|
407
|
-
profileId: number | string;
|
|
408
|
-
}
|
|
409
|
-
interface GetProfileDetailsResponse {
|
|
410
|
-
status: string;
|
|
411
|
-
projectId: number | string;
|
|
412
|
-
result: {
|
|
413
|
-
id: number | string;
|
|
414
|
-
name: string;
|
|
415
|
-
users: {
|
|
416
|
-
id: number | string;
|
|
417
|
-
name: string;
|
|
418
|
-
email: string;
|
|
419
|
-
}[];
|
|
420
|
-
selectTables: {
|
|
421
|
-
tableName: string;
|
|
422
|
-
jdbcConnectionConfigId?: number | string;
|
|
423
|
-
}[];
|
|
424
|
-
dmlTables: {
|
|
425
|
-
tableName: string;
|
|
426
|
-
jdbcConnectionConfigId?: number | string;
|
|
427
|
-
}[];
|
|
428
|
-
actions: {
|
|
429
|
-
id: number | string;
|
|
430
|
-
name: string;
|
|
431
|
-
}[];
|
|
432
|
-
screens: {
|
|
433
|
-
id: number | string;
|
|
434
|
-
name: string;
|
|
435
|
-
}[];
|
|
436
|
-
serverFunctions: {
|
|
437
|
-
id: number | string;
|
|
438
|
-
name: string;
|
|
439
|
-
}[];
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
interface CreateProfileOptions {
|
|
443
|
-
projectId?: number | string;
|
|
444
|
-
name: string;
|
|
445
|
-
color?: string;
|
|
446
|
-
homeScreenId?: number | string;
|
|
447
|
-
}
|
|
448
|
-
interface CreateProfileResponse {
|
|
449
|
-
status: string;
|
|
450
|
-
result: {
|
|
451
|
-
id: number | string;
|
|
452
|
-
name: string;
|
|
453
|
-
message: string;
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
interface UpdateProfileOptions {
|
|
457
|
-
projectId?: number | string;
|
|
458
|
-
profileId: number | string;
|
|
459
|
-
name?: string;
|
|
460
|
-
color?: string;
|
|
461
|
-
homeScreenId?: number | string;
|
|
462
|
-
}
|
|
463
|
-
interface UpdateProfileResponse {
|
|
464
|
-
status: string;
|
|
465
|
-
result: {
|
|
466
|
-
id: number | string;
|
|
467
|
-
name: string;
|
|
468
|
-
message: string;
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
interface DeleteProfileOptions {
|
|
472
|
-
projectId?: number | string;
|
|
473
|
-
profileId: number | string;
|
|
474
|
-
}
|
|
475
|
-
interface DeleteProfileResponse {
|
|
476
|
-
status: string;
|
|
477
|
-
result: {
|
|
478
|
-
message: string;
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
interface SetProfileUsersOptions {
|
|
482
|
-
projectId?: number | string;
|
|
483
|
-
profileId: number | string;
|
|
484
|
-
userIds: number[];
|
|
485
|
-
}
|
|
486
|
-
interface ProfileTableRef {
|
|
487
|
-
tableName: string;
|
|
488
|
-
}
|
|
489
|
-
interface SetProfileSelectTablesOptions {
|
|
490
|
-
projectId?: number | string;
|
|
491
|
-
profileId: number | string;
|
|
492
|
-
jdbcConnectionConfigId?: number | string;
|
|
493
|
-
tables: ProfileTableRef[];
|
|
494
|
-
}
|
|
495
|
-
interface SetProfileDmlTablesOptions {
|
|
496
|
-
projectId?: number | string;
|
|
497
|
-
profileId: number | string;
|
|
498
|
-
jdbcConnectionConfigId?: number | string;
|
|
499
|
-
tables: ProfileTableRef[];
|
|
500
|
-
}
|
|
501
|
-
interface SetProfileActionsOptions {
|
|
502
|
-
projectId?: number | string;
|
|
503
|
-
profileId: number | string;
|
|
504
|
-
actionIds: number[];
|
|
505
|
-
}
|
|
506
|
-
interface SetProfileScreensOptions {
|
|
507
|
-
projectId?: number | string;
|
|
508
|
-
profileId: number | string;
|
|
509
|
-
screenIds: number[];
|
|
510
|
-
}
|
|
511
|
-
interface SetProfileServerFunctionsOptions {
|
|
512
|
-
projectId?: number | string;
|
|
513
|
-
profileId: number | string;
|
|
514
|
-
serverFunctionIds: number[];
|
|
515
|
-
}
|
|
516
|
-
interface SetProfilePermissionResponse {
|
|
517
|
-
status: string;
|
|
518
|
-
result: {
|
|
519
|
-
profileId: number | string;
|
|
520
|
-
message: string;
|
|
521
|
-
[key: string]: unknown;
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
type AgentType = 'claudecode' | 'codex' | 'opencode-cli' | 'opencode-sdk';
|
|
525
|
-
interface AgentChat {
|
|
526
|
-
id: string;
|
|
527
|
-
name: string;
|
|
528
|
-
agentType?: string;
|
|
529
|
-
provider?: string;
|
|
530
|
-
createdAt: string;
|
|
531
|
-
updatedAt: string;
|
|
532
|
-
}
|
|
533
|
-
interface AgentMessage {
|
|
534
|
-
id: string;
|
|
535
|
-
content: string;
|
|
536
|
-
type: string;
|
|
537
|
-
sender?: 'user' | 'agent';
|
|
538
|
-
createdAt: string;
|
|
539
|
-
metadata?: Record<string, unknown> | null;
|
|
540
|
-
}
|
|
541
|
-
type ChatManageAction = 'list' | 'rename' | 'delete';
|
|
542
|
-
interface ManageAgentChatListOptions {
|
|
543
|
-
action: 'list';
|
|
544
|
-
/** Sobrescreve o projectId configurado globalmente. */
|
|
545
|
-
projectId?: number | string;
|
|
546
|
-
}
|
|
547
|
-
interface ManageAgentChatRenameOptions {
|
|
548
|
-
action: 'rename';
|
|
549
|
-
taskId: string;
|
|
550
|
-
name: string;
|
|
551
|
-
}
|
|
552
|
-
interface ManageAgentChatDeleteOptions {
|
|
553
|
-
action: 'delete';
|
|
554
|
-
taskId: string;
|
|
555
|
-
}
|
|
556
|
-
type ManageAgentChatOptions = ManageAgentChatListOptions | ManageAgentChatRenameOptions | ManageAgentChatDeleteOptions;
|
|
557
|
-
interface RenameAgentChatResult {
|
|
558
|
-
taskId: string;
|
|
559
|
-
name: string;
|
|
560
|
-
}
|
|
561
|
-
interface DeleteAgentChatResult {
|
|
562
|
-
taskId: string;
|
|
563
|
-
deleted: boolean;
|
|
564
|
-
}
|
|
565
|
-
interface GetAgentTaskCreateOptions {
|
|
566
|
-
/** Cria chat novo. taskId é preenchido depois do primeiro send(). */
|
|
567
|
-
create: true;
|
|
568
|
-
/** Sobrescreve projectId global. */
|
|
569
|
-
projectId?: number | string;
|
|
570
|
-
/** Tipo do agente. Default: 'claudecode'. */
|
|
571
|
-
agentType?: AgentType;
|
|
572
|
-
/**
|
|
573
|
-
* Modelo a usar (value vindo de manageAgentCredentialMitra({action:'list_models'})).
|
|
574
|
-
* Ex: 'openai/gpt-5.5:medium', 'glm/glm-5.1', 'subscription:anthropic:claude-opus-4-7'.
|
|
575
|
-
* O backend deriva agentType/provider/model a partir dele. Vira o default da
|
|
576
|
-
* task; cada send() pode sobrescrever via SendOptions.modelId.
|
|
577
|
-
*/
|
|
578
|
-
modelId?: string;
|
|
579
|
-
/** Nome do chat (default: derivado do prompt). */
|
|
580
|
-
name?: string;
|
|
581
|
-
}
|
|
582
|
-
interface GetAgentTaskOpenOptions {
|
|
583
|
-
/** Abre chat existente. Detecta automático se stream está ativo. */
|
|
584
|
-
taskId: string;
|
|
585
|
-
}
|
|
586
|
-
type GetAgentTaskOptions = GetAgentTaskCreateOptions | GetAgentTaskOpenOptions;
|
|
587
|
-
type AgentTaskStatus = 'opening' | 'idle' | 'uploading' | 'streaming' | 'cancelled' | 'error' | 'closed';
|
|
588
|
-
interface QueuedItem {
|
|
589
|
-
id: string;
|
|
590
|
-
text: string;
|
|
591
|
-
agentType?: AgentType;
|
|
592
|
-
seq: number;
|
|
593
|
-
createdAt: number;
|
|
594
|
-
status: 'pending' | 'sending';
|
|
595
|
-
injected?: boolean;
|
|
596
|
-
}
|
|
597
|
-
/** Tipo de arquivo de um anexo (espelha o pipeline do backend). */
|
|
598
|
-
type AgentAttachmentType = 'image' | 'pdf' | 'csv' | 'excel' | 'word' | 'powerpoint' | 'text' | 'code' | 'json' | 'zip' | 'audio' | 'unknown';
|
|
599
|
-
/**
|
|
600
|
-
* Anexo enviado junto com um prompt. O arquivo precisa estar hospedado numa
|
|
601
|
-
* URL pública (use uploadFilePublicMitra pra obter). O backend baixa, valida,
|
|
602
|
-
* transforma (comprime imagem, extrai texto de pdf/docx/xlsx...) e escreve no
|
|
603
|
-
* sandbox antes de rodar o agente.
|
|
604
|
-
*/
|
|
605
|
-
interface AgentAttachment {
|
|
606
|
-
/** URL pública do arquivo (ex: retorno de uploadFilePublicMitra). */
|
|
607
|
-
url: string;
|
|
608
|
-
/** Nome do arquivo (ex: 'planilha.xlsx'). */
|
|
609
|
-
name: string;
|
|
610
|
-
/** Tipo do arquivo. */
|
|
611
|
-
type: AgentAttachmentType;
|
|
612
|
-
/** MIME type (ex: 'image/png'). */
|
|
613
|
-
mimeType: string;
|
|
614
|
-
/** Tamanho em bytes. */
|
|
615
|
-
size: number;
|
|
616
|
-
}
|
|
617
|
-
interface SendOptions {
|
|
618
|
-
agentType?: AgentType;
|
|
619
|
-
/**
|
|
620
|
-
* Modelo a usar neste turno (value de list_models). Ex: 'openai/gpt-5.5:medium',
|
|
621
|
-
* 'glm/glm-5.1', 'subscription:anthropic:claude-opus-4-7'. Sobrescreve o modelId
|
|
622
|
-
* default da session. Se omitido, usa o default da session / agentType.
|
|
623
|
-
*/
|
|
624
|
-
modelId?: string;
|
|
625
|
-
/**
|
|
626
|
-
* Arquivos anexados ao prompt. A SDK detecta o tipo, sobe cada um (URL pública)
|
|
627
|
-
* e monta os anexos — o consumidor só passa os File (do drop/input). O upload
|
|
628
|
-
* acontece no send (status muda pra 'uploading'); falha de upload sai pelo
|
|
629
|
-
* evento 'error'. Mesmo comportamento do chat do mitra-nuxt.
|
|
630
|
-
*/
|
|
631
|
-
files?: File[];
|
|
632
|
-
}
|
|
633
|
-
interface AgentDeltaEvent {
|
|
634
|
-
delta: string;
|
|
635
|
-
kind: 'text' | 'tool';
|
|
636
|
-
}
|
|
637
|
-
interface AgentToolEvent {
|
|
638
|
-
tool: string;
|
|
639
|
-
input?: string;
|
|
640
|
-
content?: string;
|
|
641
|
-
timestamp: number;
|
|
642
|
-
}
|
|
643
|
-
interface AgentTurnEndEvent {
|
|
644
|
-
/** Conteúdo final acumulado do turno. */
|
|
645
|
-
content: string;
|
|
646
|
-
}
|
|
647
|
-
interface AgentTaskCreatedEvent {
|
|
648
|
-
task: AgentChat;
|
|
649
|
-
}
|
|
650
|
-
interface AgentErrorEvent {
|
|
651
|
-
error: string;
|
|
652
|
-
}
|
|
653
|
-
interface AgentQueueChangeEvent {
|
|
654
|
-
queue: ReadonlyArray<QueuedItem>;
|
|
655
|
-
}
|
|
656
|
-
interface AgentStatusChangeEvent {
|
|
657
|
-
status: AgentTaskStatus;
|
|
658
|
-
previous: AgentTaskStatus;
|
|
659
|
-
}
|
|
660
|
-
type AgentTaskEventMap = {
|
|
661
|
-
historyLoaded: AgentMessage[];
|
|
662
|
-
turnStart: void;
|
|
663
|
-
delta: AgentDeltaEvent;
|
|
664
|
-
tool: AgentToolEvent;
|
|
665
|
-
turnEnd: AgentTurnEndEvent;
|
|
666
|
-
taskCreated: AgentTaskCreatedEvent;
|
|
667
|
-
cancelled: void;
|
|
668
|
-
error: AgentErrorEvent;
|
|
669
|
-
queueChange: AgentQueueChangeEvent;
|
|
670
|
-
statusChange: AgentStatusChangeEvent;
|
|
671
|
-
};
|
|
672
|
-
type AgentTaskEventName = keyof AgentTaskEventMap;
|
|
673
|
-
interface AgentTaskSession {
|
|
674
|
-
readonly taskId: string | null;
|
|
675
|
-
readonly task: AgentChat | null;
|
|
676
|
-
readonly isNew: boolean;
|
|
677
|
-
readonly status: AgentTaskStatus;
|
|
678
|
-
readonly history: ReadonlyArray<AgentMessage>;
|
|
679
|
-
readonly content: string;
|
|
680
|
-
readonly queue: ReadonlyArray<QueuedItem>;
|
|
681
|
-
loadHistory(options?: {
|
|
682
|
-
limit?: number;
|
|
683
|
-
}): Promise<AgentMessage[]>;
|
|
684
|
-
close(): void;
|
|
685
|
-
send(prompt: string, options?: SendOptions): void;
|
|
686
|
-
cancel(): Promise<void>;
|
|
687
|
-
editQueueItem(itemId: string, newText: string): boolean;
|
|
688
|
-
removeQueueItem(itemId: string): boolean;
|
|
689
|
-
clearQueue(): void;
|
|
690
|
-
on<E extends AgentTaskEventName>(event: E, handler: (payload: AgentTaskEventMap[E]) => void): () => void;
|
|
691
|
-
}
|
|
692
|
-
/** Targets de subscription (OAuth/device flow). */
|
|
693
|
-
type AgentSubscriptionTarget = 'claude' | 'openai_oauth' | 'codex';
|
|
694
|
-
/** Targets de API key (8 providers suportados pelo backend). */
|
|
695
|
-
type AgentApiKeyTarget = 'anthropic' | 'openai' | 'gemini' | 'kimi' | 'minimax' | 'glm' | 'qwen' | 'openrouter';
|
|
696
|
-
/** Union — qualquer credencial. */
|
|
697
|
-
type CredentialTarget = AgentSubscriptionTarget | AgentApiKeyTarget;
|
|
698
|
-
/**
|
|
699
|
-
* Verbos aceitos por `manageAgentCredentialMitra`.
|
|
700
|
-
*
|
|
701
|
-
* Baixo nível (RPC direto contra o backend `credentials`):
|
|
702
|
-
* status | remove | list | validate | save
|
|
703
|
-
* oauth_start | oauth_exchange | device_start | device_poll | device_cancel
|
|
704
|
-
*
|
|
705
|
-
* Alto nível (orquestrado no browser, NÃO é um type WS — encadeia as actions
|
|
706
|
-
* de baixo nível + abre popup + espera autorização):
|
|
707
|
-
* connect
|
|
708
|
-
*/
|
|
709
|
-
type CredentialAction = 'auth' | 'connect' | 'status' | 'remove' | 'list' | 'list_models' | 'list_providers' | 'validate' | 'save' | 'oauth_start' | 'oauth_exchange' | 'device_start' | 'device_poll' | 'device_cancel';
|
|
710
|
-
/** Forma de acesso a uma credencial. */
|
|
711
|
-
type CredentialAccessType = 'subscription' | 'api_key';
|
|
712
|
-
/** Método de conexão — diz ao app/agent qual UI montar. */
|
|
713
|
-
type AuthMethod = 'api_key' | 'paste_code' | 'device';
|
|
714
|
-
/** Metadados pra montar a UI de conexão (vem em cada provider de list_providers). */
|
|
715
|
-
interface AgentAuthMeta {
|
|
716
|
-
method: AuthMethod;
|
|
717
|
-
/** Só para method='api_key'. */
|
|
718
|
-
keyLabel?: string;
|
|
719
|
-
/** Só para method='api_key'. */
|
|
720
|
-
keyPlaceholder?: string;
|
|
721
|
-
}
|
|
722
|
-
/** Um modelo selecionável (retornado por action='list_models'). */
|
|
723
|
-
interface AgentModelOption {
|
|
724
|
-
/** Passe direto em send({ modelId }) ou getAgentTaskMitra({ create, modelId }). */
|
|
725
|
-
modelId: string;
|
|
726
|
-
/** Label exibível. */
|
|
727
|
-
name: string;
|
|
728
|
-
}
|
|
729
|
-
/** Grupo de modelos por (tipo × provedor) — só grupos com credencial. */
|
|
730
|
-
interface AgentModelGroup {
|
|
731
|
-
id: string;
|
|
732
|
-
name: string;
|
|
733
|
-
type: CredentialAccessType;
|
|
734
|
-
models: AgentModelOption[];
|
|
735
|
-
}
|
|
736
|
-
/** Retorno de manageAgentCredentialMitra({ action: 'list_models' }). */
|
|
737
|
-
interface ListAgentModelsResult {
|
|
738
|
-
providers: AgentModelGroup[];
|
|
739
|
-
}
|
|
740
|
-
/** Um provedor suportado + status (retornado por action='list_providers'). */
|
|
741
|
-
interface AgentProviderListItem {
|
|
742
|
-
id: string;
|
|
743
|
-
name: string;
|
|
744
|
-
type: CredentialAccessType;
|
|
745
|
-
/** Passe direto em auth/connect/save/remove. */
|
|
746
|
-
target: string;
|
|
747
|
-
/** Como conectar: method (api_key|paste_code|device) + label/placeholder. */
|
|
748
|
-
auth: AgentAuthMeta;
|
|
749
|
-
connected: boolean;
|
|
750
|
-
/** Presente em subscription Claude conectada. */
|
|
751
|
-
account?: AgentSubscriptionAccount;
|
|
752
|
-
expiresAt?: number;
|
|
753
|
-
/** Presente em API key conectada. */
|
|
754
|
-
maskedKey?: string;
|
|
755
|
-
updatedAt?: string | Date;
|
|
756
|
-
}
|
|
757
|
-
/** Retorno de manageAgentCredentialMitra({ action: 'list_providers' }). */
|
|
758
|
-
interface ListAgentProvidersResult {
|
|
759
|
-
providers: AgentProviderListItem[];
|
|
760
|
-
}
|
|
761
|
-
/**
|
|
762
|
-
* Opções de baixo nível (RPC direto) de `manageAgentCredentialMitra`. Campos
|
|
763
|
-
* extras (key, code, codeVerifier, redirectUri, pollId, accessToken,
|
|
764
|
-
* refreshToken, expiresAt) são empacotados em `data` antes de enviar ao backend.
|
|
765
|
-
*
|
|
766
|
-
* NÃO use com action='connect' — para isso use ConnectAgentCredentialOptions.
|
|
767
|
-
*/
|
|
768
|
-
interface ManageAgentCredentialOptions {
|
|
769
|
-
action: Exclude<CredentialAction, 'connect' | 'auth'>;
|
|
770
|
-
/** Obrigatório exceto para action='list' / 'list_models'. */
|
|
771
|
-
target?: CredentialTarget;
|
|
772
|
-
/** Para `save` / `validate` de API key. */
|
|
773
|
-
key?: string;
|
|
774
|
-
/** Para `oauth_exchange`. */
|
|
775
|
-
code?: string;
|
|
776
|
-
/** Para `oauth_exchange`. */
|
|
777
|
-
state?: string;
|
|
778
|
-
/** Para `oauth_exchange`. */
|
|
779
|
-
codeVerifier?: string;
|
|
780
|
-
/** Para `oauth_start` (openai_oauth) e `oauth_exchange` (openai_oauth). */
|
|
781
|
-
redirectUri?: string;
|
|
782
|
-
/** Para `device_poll` / `device_cancel`. */
|
|
783
|
-
pollId?: string;
|
|
784
|
-
/** Para `save` (codex). */
|
|
785
|
-
accessToken?: string;
|
|
786
|
-
/** Para `save` (codex). */
|
|
787
|
-
refreshToken?: string;
|
|
788
|
-
/** Para `save` (codex). */
|
|
789
|
-
expiresAt?: number;
|
|
790
|
-
}
|
|
791
|
-
/** Tipo "ampliado" — o backend retorna shapes diferentes por (action, target). */
|
|
792
|
-
type ManageAgentCredentialResult = unknown;
|
|
793
|
-
interface AgentSubscriptionAccount {
|
|
794
|
-
email: string;
|
|
795
|
-
orgName: string;
|
|
796
|
-
}
|
|
797
|
-
/**
|
|
798
|
-
* Opções de alto nível de `manageAgentCredentialMitra` quando action='connect'.
|
|
799
|
-
* Orquestra o fluxo OAuth/device ponta-a-ponta no browser (abre popup, espera
|
|
800
|
-
* autorização, troca por tokens server-side).
|
|
801
|
-
*/
|
|
802
|
-
/**
|
|
803
|
-
* Targets que conectam SEM redirect (paste código / device flow). O
|
|
804
|
-
* 'openai_oauth' fica de fora porque depende de redirect localhost:1455
|
|
805
|
-
* (client OAuth compartilhado da OpenAI) — inviável em domínio de cliente.
|
|
806
|
-
* OpenAI subscription conecta via 'codex' (device flow).
|
|
807
|
-
*/
|
|
808
|
-
type ConnectableSubscriptionTarget = 'claude' | 'codex';
|
|
809
|
-
interface AuthAgentCredentialOptions {
|
|
810
|
-
action: 'auth';
|
|
811
|
-
target: ConnectableSubscriptionTarget;
|
|
812
|
-
}
|
|
813
|
-
/** Resultado de auth(claude): abra a authUrl, depois connect com o código. */
|
|
814
|
-
interface AuthClaudeResult {
|
|
815
|
-
target: 'claude';
|
|
816
|
-
/** URL pra abrir (a Anthropic mostra o código na própria tela). */
|
|
817
|
-
authUrl: string;
|
|
818
|
-
/** Passe de volta no connect junto com o código. */
|
|
819
|
-
state: string;
|
|
820
|
-
}
|
|
821
|
-
/** Resultado de auth(codex): mostre userCode/verificationUrl, depois connect com pollId. */
|
|
822
|
-
interface AuthCodexResult {
|
|
823
|
-
target: 'codex';
|
|
824
|
-
/** Código que o user digita no site da OpenAI. */
|
|
825
|
-
userCode: string | null;
|
|
826
|
-
/** URL que o user abre pra autorizar. */
|
|
827
|
-
verificationUrl: string | null;
|
|
828
|
-
/** Passe de volta no connect; a SDK faz o polling. */
|
|
829
|
-
pollId: string;
|
|
830
|
-
}
|
|
831
|
-
type AuthAgentCredentialResult = AuthClaudeResult | AuthCodexResult;
|
|
832
|
-
interface ConnectAgentCredentialOptions {
|
|
833
|
-
action: 'connect';
|
|
834
|
-
target: ConnectableSubscriptionTarget;
|
|
835
|
-
/** Código que o user copiou da página da Anthropic. Obrigatório p/ claude. */
|
|
836
|
-
code?: string;
|
|
837
|
-
/** O `state` devolvido por auth(claude). Obrigatório p/ claude. */
|
|
838
|
-
state?: string;
|
|
839
|
-
/** O `pollId` devolvido por auth(codex). Obrigatório p/ codex. */
|
|
840
|
-
pollId?: string;
|
|
841
|
-
/** Intervalo de poll do device flow (default 2000ms). */
|
|
842
|
-
pollIntervalMs?: number;
|
|
843
|
-
/** Timeout total do device flow (default 15min). */
|
|
844
|
-
deviceTimeoutMs?: number;
|
|
845
|
-
}
|
|
846
|
-
interface ConnectAgentSubscriptionResult {
|
|
847
|
-
target: ConnectableSubscriptionTarget;
|
|
848
|
-
success: boolean;
|
|
849
|
-
/** Presente em claude (epoch ms). */
|
|
850
|
-
expiresAt?: number;
|
|
851
|
-
/** Presente apenas em claude. */
|
|
852
|
-
account?: AgentSubscriptionAccount | null;
|
|
853
|
-
}
|
|
854
198
|
|
|
855
199
|
/**
|
|
856
200
|
* Mitra Interactions SDK - Instance
|
|
@@ -860,21 +204,12 @@ interface ConnectAgentSubscriptionResult {
|
|
|
860
204
|
|
|
861
205
|
interface MitraInstance {
|
|
862
206
|
readonly config: MitraConfig;
|
|
863
|
-
executeDataLoader(options: ExecuteDataLoaderOptions): Promise<ExecuteDataLoaderResponse>;
|
|
864
|
-
executeDbAction(options: ExecuteDbActionOptions): Promise<ExecuteDbActionResponse>;
|
|
865
|
-
setFileStatus(options: SetFileStatusOptions): Promise<SetFileStatusResponse>;
|
|
866
|
-
setVariable(options: SetVariableOptions): Promise<SetVariableResponse>;
|
|
867
|
-
listVariables(options?: ListVariablesOptions): Promise<ListVariablesResponse>;
|
|
868
|
-
getVariable(options: GetVariableOptions): Promise<GetVariableResponse>;
|
|
869
|
-
runAction(options: RunActionOptions): Promise<RunActionResponse>;
|
|
870
207
|
executeServerFunction(options: ExecuteServerFunctionOptions): Promise<ExecuteServerFunctionResponse>;
|
|
871
208
|
executeServerFunctionAsync(options: ExecuteServerFunctionAsyncOptions): Promise<ExecuteServerFunctionAsyncResponse>;
|
|
872
209
|
executePublicServerFunction(options: ExecutePublicServerFunctionOptions): Promise<ExecutePublicServerFunctionResponse>;
|
|
873
210
|
executePublicServerFunctionAsync(options: ExecutePublicServerFunctionOptions): Promise<ExecutePublicServerFunctionAsyncResponse>;
|
|
874
211
|
getPublicServerFunctionExecution(options: GetPublicServerFunctionExecutionOptions): Promise<GetPublicServerFunctionExecutionResponse>;
|
|
875
212
|
stopServerFunctionExecution(options: StopServerFunctionExecutionOptions): Promise<StopServerFunctionExecutionResponse>;
|
|
876
|
-
uploadFilePublic(options: UploadFileOptions): Promise<UploadFileResponse>;
|
|
877
|
-
uploadFileLoadable(options: UploadFileOptions): Promise<UploadFileResponse>;
|
|
878
213
|
listIntegrations(options?: ListIntegrationsOptions): Promise<IntegrationResponse[]>;
|
|
879
214
|
callIntegration(options: CallIntegrationOptions): Promise<CallIntegrationResponse>;
|
|
880
215
|
listRecords(options: ListRecordsOptions): Promise<ListRecordsResponse>;
|
|
@@ -884,25 +219,6 @@ interface MitraInstance {
|
|
|
884
219
|
patchRecord(options: PatchRecordOptions): Promise<Record<string, any>>;
|
|
885
220
|
deleteRecord(options: DeleteRecordOptions): Promise<void>;
|
|
886
221
|
createRecordsBatch(options: CreateRecordsBatchOptions): Promise<Record<string, any>[]>;
|
|
887
|
-
listProfiles(options?: ListProfilesOptions): Promise<ListProfilesResponse>;
|
|
888
|
-
getProfileDetails(options: GetProfileDetailsOptions): Promise<GetProfileDetailsResponse>;
|
|
889
|
-
createProfile(options: CreateProfileOptions): Promise<CreateProfileResponse>;
|
|
890
|
-
updateProfile(options: UpdateProfileOptions): Promise<UpdateProfileResponse>;
|
|
891
|
-
deleteProfile(options: DeleteProfileOptions): Promise<DeleteProfileResponse>;
|
|
892
|
-
setProfileUsers(options: SetProfileUsersOptions): Promise<SetProfilePermissionResponse>;
|
|
893
|
-
setProfileSelectTables(options: SetProfileSelectTablesOptions): Promise<SetProfilePermissionResponse>;
|
|
894
|
-
setProfileDmlTables(options: SetProfileDmlTablesOptions): Promise<SetProfilePermissionResponse>;
|
|
895
|
-
setProfileActions(options: SetProfileActionsOptions): Promise<SetProfilePermissionResponse>;
|
|
896
|
-
setProfileScreens(options: SetProfileScreensOptions): Promise<SetProfilePermissionResponse>;
|
|
897
|
-
setProfileServerFunctions(options: SetProfileServerFunctionsOptions): Promise<SetProfilePermissionResponse>;
|
|
898
|
-
sendPasswordResetCode(options: SendPasswordResetCodeOptions): Promise<Record<string, unknown>>;
|
|
899
|
-
validatePasswordResetCode(options: ValidatePasswordResetCodeOptions): Promise<Record<string, unknown>>;
|
|
900
|
-
resetPassword(options: ResetPasswordOptions): Promise<Record<string, unknown>>;
|
|
901
|
-
getAgentTask(options: GetAgentTaskOptions): AgentTaskSession;
|
|
902
|
-
manageAgentChat(options: ManageAgentChatOptions): Promise<unknown>;
|
|
903
|
-
manageAgentCredential(options: ManageAgentCredentialOptions | ConnectAgentCredentialOptions): Promise<unknown>;
|
|
904
|
-
openChat(): void;
|
|
905
|
-
closeChat(): void;
|
|
906
222
|
}
|
|
907
223
|
declare function createMitraInstance(initialConfig: Partial<MitraConfig>): MitraInstance;
|
|
908
224
|
|
|
@@ -917,6 +233,8 @@ interface MitraConfig {
|
|
|
917
233
|
integrationURL?: string;
|
|
918
234
|
/** URL da página de autenticação Mitra (ex: https://coder.mitralab.io/sdk-auth/) */
|
|
919
235
|
authUrl?: string;
|
|
236
|
+
/** URL da página do popup de SSO (sdk-auth.html). Opcional se houver window.__mitraEnv.authPageUrl. */
|
|
237
|
+
authPageUrl?: string;
|
|
920
238
|
/** ID do projeto (usado como fallback nos métodos de login e serviços) */
|
|
921
239
|
projectId?: number | string;
|
|
922
240
|
/** Callback chamado quando o token é renovado automaticamente (após 401/403). Recebe a nova sessão. */
|
|
@@ -939,22 +257,6 @@ declare function getConfig(): MitraConfig;
|
|
|
939
257
|
*/
|
|
940
258
|
declare function resolveProjectId(projectId?: number | string): number | string;
|
|
941
259
|
|
|
942
|
-
/**
|
|
943
|
-
* Mitra Interactions SDK - Chat Integration
|
|
944
|
-
*
|
|
945
|
-
* Integrates with the __mitraChat object injected by the build-proxy
|
|
946
|
-
* in published apps. Chat is initialized automatically by configureSdkMitra().
|
|
947
|
-
*/
|
|
948
|
-
/**
|
|
949
|
-
* Opens the Mitra Chat sidebar.
|
|
950
|
-
* If chat is still loading, polls until ready (max 15s).
|
|
951
|
-
*/
|
|
952
|
-
declare function openChatMitra(): void;
|
|
953
|
-
/**
|
|
954
|
-
* Closes the Mitra Chat sidebar.
|
|
955
|
-
*/
|
|
956
|
-
declare function closeChatMitra(): void;
|
|
957
|
-
|
|
958
260
|
/**
|
|
959
261
|
* Mitra Interactions SDK - Autenticação (Router)
|
|
960
262
|
*
|
|
@@ -966,169 +268,24 @@ declare function closeChatMitra(): void;
|
|
|
966
268
|
*/
|
|
967
269
|
|
|
968
270
|
declare function loginMitra(method: 'email' | 'google' | 'microsoft' | 'mitra', options?: LoginOptions): Promise<LoginResponse>;
|
|
969
|
-
declare function loginWithEmailMitra(options?: LoginOptions): Promise<LoginResponse>;
|
|
970
271
|
declare function loginWithGoogleMitra(options?: LoginOptions): Promise<LoginResponse>;
|
|
971
272
|
declare function loginWithMicrosoftMitra(options?: LoginOptions): Promise<LoginResponse>;
|
|
972
|
-
declare function emailSignupMitra(options: EmailSignupOptions): Promise<void>;
|
|
973
|
-
declare function emailLoginMitra(options: EmailLoginOptions): Promise<LoginResponse>;
|
|
974
|
-
declare function emailVerifyCodeMitra(options: EmailVerifyCodeOptions): Promise<LoginResponse>;
|
|
975
|
-
declare function emailResendCodeMitra(options: EmailResendCodeOptions): Promise<void>;
|
|
976
273
|
declare function refreshTokenSilently(authUrl: string, projectId: number | string): Promise<LoginResponse>;
|
|
977
|
-
|
|
978
274
|
/**
|
|
979
|
-
*
|
|
980
|
-
*
|
|
981
|
-
*
|
|
982
|
-
*
|
|
983
|
-
* resolvido a partir do `authUrl` configurado.
|
|
275
|
+
* Gera o JWT a partir do code do SSO (novo Mitra). O app lê codeMitra/stateMitra
|
|
276
|
+
* do fragment (lógica de template) e chama aqui pra validar o nonce e trocar o
|
|
277
|
+
* code por token no BFF. Exclusivo do novo mundo — no legacy o token já vem
|
|
278
|
+
* pronto no fragment (tokenMitra).
|
|
984
279
|
*/
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
*/
|
|
990
|
-
declare function sendPasswordResetCodeMitra(options: SendPasswordResetCodeOptions): Promise<Record<string, unknown>>;
|
|
991
|
-
/**
|
|
992
|
-
* POST /mitraspace/auth/resetPassword/validateCode
|
|
993
|
-
* Valida o código recebido por email (sem trocar a senha ainda).
|
|
994
|
-
*/
|
|
995
|
-
declare function validatePasswordResetCodeMitra(options: ValidatePasswordResetCodeOptions): Promise<Record<string, unknown>>;
|
|
996
|
-
/**
|
|
997
|
-
* PUT /mitraspace/auth/resetPassword
|
|
998
|
-
* Troca a senha usando email + código + nova senha.
|
|
999
|
-
*/
|
|
1000
|
-
declare function resetPasswordMitra(options: ResetPasswordOptions): Promise<Record<string, unknown>>;
|
|
1001
|
-
|
|
1002
|
-
/**
|
|
1003
|
-
* Mitra Interactions SDK — Agent Chat
|
|
1004
|
-
*
|
|
1005
|
-
* Hub do WebSocket compartilhado e factories da API pública:
|
|
1006
|
-
* - manageAgentChatMitra({ action: 'list' | 'rename' | 'delete', ... })
|
|
1007
|
-
* - getAgentTaskMitra({ create | taskId, ... })
|
|
1008
|
-
*
|
|
1009
|
-
* O WS é singleton: todas as sessions usam UMA conexão. O roteamento
|
|
1010
|
-
* de eventos é feito por taskId, despachando pra session correspondente.
|
|
1011
|
-
*
|
|
1012
|
-
* NÃO há `sendAgentPromptMitra` ou `getAgentHistoryMitra` exportados —
|
|
1013
|
-
* essas operações vivem dentro de `AgentTaskSession`.
|
|
1014
|
-
*/
|
|
1015
|
-
|
|
1016
|
-
/**
|
|
1017
|
-
* Gerencia os chats do user (coleção) — espelha `manageAgentCredentialMitra`.
|
|
1018
|
-
* Operações stateless: listar, renomear, deletar.
|
|
1019
|
-
*
|
|
1020
|
-
* @example
|
|
1021
|
-
* const chats = await manageAgentChatMitra({ action: 'list' });
|
|
1022
|
-
* await manageAgentChatMitra({ action: 'rename', taskId, name: 'Novo nome' });
|
|
1023
|
-
* await manageAgentChatMitra({ action: 'delete', taskId });
|
|
1024
|
-
*/
|
|
1025
|
-
declare function manageAgentChatMitra(options: ManageAgentChatListOptions): Promise<AgentChat[]>;
|
|
1026
|
-
declare function manageAgentChatMitra(options: ManageAgentChatRenameOptions): Promise<RenameAgentChatResult>;
|
|
1027
|
-
declare function manageAgentChatMitra(options: ManageAgentChatDeleteOptions): Promise<DeleteAgentChatResult>;
|
|
1028
|
-
/**
|
|
1029
|
-
* Abre um handle de chat (session). Use:
|
|
1030
|
-
* - `{ create: true }` para iniciar um chat novo
|
|
1031
|
-
* - `{ taskId: 'X' }` para abrir um chat existente
|
|
1032
|
-
*
|
|
1033
|
-
* A session expõe histórico, streaming, fila, cancel e eventos. Se a
|
|
1034
|
-
* mesma taskId for aberta duas vezes, retorna a MESMA instância (cache).
|
|
1035
|
-
*/
|
|
1036
|
-
declare function getAgentTaskMitra(options: GetAgentTaskOptions): AgentTaskSession;
|
|
1037
|
-
|
|
1038
|
-
/**
|
|
1039
|
-
* Mitra Interactions SDK — Agent Credentials
|
|
1040
|
-
*
|
|
1041
|
-
* Função ÚNICA `manageAgentCredentialMitra` sobre /sdk-ws para todas as
|
|
1042
|
-
* operações de credencial do agente:
|
|
1043
|
-
* - API keys (8 providers: anthropic, openai, gemini, kimi, minimax, glm, qwen, openrouter)
|
|
1044
|
-
* - Subscriptions OAuth (Claude paste-código / OpenAI device flow via Codex)
|
|
1045
|
-
*
|
|
1046
|
-
* Actions de baixo nível (RPC direto contra o backend):
|
|
1047
|
-
* status | remove | list | list_models | validate | save
|
|
1048
|
-
* oauth_start | oauth_exchange | device_start | device_poll | device_cancel
|
|
1049
|
-
*
|
|
1050
|
-
* Actions de alto nível (orquestradas na SDK — o app controla UI/popup/timing):
|
|
1051
|
-
* auth — inicia o fluxo e retorna o que a UI mostra (sem efeito colateral
|
|
1052
|
-
* de janela). claude → { authUrl, state }; codex → { userCode,
|
|
1053
|
-
* verificationUrl, pollId }.
|
|
1054
|
-
* connect — finaliza/salva. claude → passa { code, state }; codex → passa
|
|
1055
|
-
* { pollId } e a SDK faz o polling até autorizar.
|
|
1056
|
-
*
|
|
1057
|
-
* Fluxo típico (sem callbacks, sem redirect, sem callback page):
|
|
1058
|
-
* const { authUrl, state } = await manageAgentCredentialMitra({ action:'auth', target:'claude' });
|
|
1059
|
-
* // app abre authUrl + coleta o código do user
|
|
1060
|
-
* await manageAgentCredentialMitra({ action:'connect', target:'claude', code, state });
|
|
1061
|
-
*
|
|
1062
|
-
* const { userCode, verificationUrl, pollId } = await manageAgentCredentialMitra({ action:'auth', target:'codex' });
|
|
1063
|
-
* // app mostra "abra {verificationUrl}, digite {userCode}"
|
|
1064
|
-
* await manageAgentCredentialMitra({ action:'connect', target:'codex', pollId });
|
|
1065
|
-
*
|
|
1066
|
-
* SEGURANÇA: o token de subscription NUNCA volta cru pro cliente. É salvo
|
|
1067
|
-
* server-side (Firestore) e injetado no sandbox E2B direto de lá.
|
|
1068
|
-
*/
|
|
1069
|
-
|
|
1070
|
-
/**
|
|
1071
|
-
* Inicia um fluxo de subscription. Não abre janelas — retorna os dados pra UI:
|
|
1072
|
-
* claude → { authUrl, state } codex → { userCode, verificationUrl, pollId }
|
|
1073
|
-
*/
|
|
1074
|
-
declare function manageAgentCredentialMitra(options: AuthAgentCredentialOptions): Promise<AuthAgentCredentialResult>;
|
|
1075
|
-
/**
|
|
1076
|
-
* Finaliza/salva uma subscription:
|
|
1077
|
-
* claude → { code, state } codex → { pollId } (a SDK faz o polling)
|
|
1078
|
-
*/
|
|
1079
|
-
declare function manageAgentCredentialMitra(options: ConnectAgentCredentialOptions): Promise<ConnectAgentSubscriptionResult>;
|
|
1080
|
-
/**
|
|
1081
|
-
* RPC direto contra o backend. Retorno depende de (action, target).
|
|
1082
|
-
*
|
|
1083
|
-
* @example
|
|
1084
|
-
* await manageAgentCredentialMitra({ action: 'list' });
|
|
1085
|
-
* await manageAgentCredentialMitra({ action: 'list_models' });
|
|
1086
|
-
* await manageAgentCredentialMitra({ action: 'status', target: 'anthropic' });
|
|
1087
|
-
* await manageAgentCredentialMitra({ action: 'validate', target: 'openai', key: 'sk-...' });
|
|
1088
|
-
* await manageAgentCredentialMitra({ action: 'save', target: 'glm', key: '...' });
|
|
1089
|
-
* await manageAgentCredentialMitra({ action: 'remove', target: 'claude' });
|
|
1090
|
-
*/
|
|
1091
|
-
declare function manageAgentCredentialMitra<R = ManageAgentCredentialResult>(options: ManageAgentCredentialOptions): Promise<R>;
|
|
280
|
+
declare function exchangeSsoCodeMitra(options: {
|
|
281
|
+
code: string;
|
|
282
|
+
state: string;
|
|
283
|
+
}): Promise<LoginResponse>;
|
|
1092
284
|
|
|
1093
285
|
/**
|
|
1094
286
|
* Mitra Interactions SDK - Services
|
|
1095
287
|
*/
|
|
1096
288
|
|
|
1097
|
-
/**
|
|
1098
|
-
* POST /interactions/executeDataLoader
|
|
1099
|
-
* Executa um Data Loader
|
|
1100
|
-
*/
|
|
1101
|
-
declare function executeDataLoaderMitra(options: ExecuteDataLoaderOptions): Promise<ExecuteDataLoaderResponse>;
|
|
1102
|
-
/**
|
|
1103
|
-
* POST /interactions/executeDbAction
|
|
1104
|
-
* Executa uma DBAction (DML) cadastrada
|
|
1105
|
-
*/
|
|
1106
|
-
declare function executeDbActionMitra(options: ExecuteDbActionOptions): Promise<ExecuteDbActionResponse>;
|
|
1107
|
-
/**
|
|
1108
|
-
* POST /interactions/setFileStatus
|
|
1109
|
-
* Move arquivo do chat para PUBLIC ou LOADABLE
|
|
1110
|
-
*/
|
|
1111
|
-
declare function setFileStatusMitra(options: SetFileStatusOptions): Promise<SetFileStatusResponse>;
|
|
1112
|
-
/**
|
|
1113
|
-
* POST /interactions/setVariable
|
|
1114
|
-
* Cria ou atualiza uma variável customizada
|
|
1115
|
-
*/
|
|
1116
|
-
declare function setVariableMitra(options: SetVariableOptions): Promise<SetVariableResponse>;
|
|
1117
|
-
/**
|
|
1118
|
-
* GET /interactions/listVariables?projectId={id}
|
|
1119
|
-
* Lista variáveis de um projeto
|
|
1120
|
-
*/
|
|
1121
|
-
declare function listVariablesMitra(options?: ListVariablesOptions): Promise<ListVariablesResponse>;
|
|
1122
|
-
/**
|
|
1123
|
-
* GET /interactions/getVariable?projectId={id}&key={key}
|
|
1124
|
-
* Busca o valor de uma variável específica
|
|
1125
|
-
*/
|
|
1126
|
-
declare function getVariableMitra(options: GetVariableOptions): Promise<GetVariableResponse>;
|
|
1127
|
-
/**
|
|
1128
|
-
* POST /interactions/runAction
|
|
1129
|
-
* Executa uma Action (fluxo de ação) cadastrada
|
|
1130
|
-
*/
|
|
1131
|
-
declare function runActionMitra(options: RunActionOptions): Promise<RunActionResponse>;
|
|
1132
289
|
/**
|
|
1133
290
|
* POST /interactions/executeServerFunction
|
|
1134
291
|
* Executa uma Server Function de forma SÍNCRONA (timeout 60s no backend)
|
|
@@ -1172,16 +329,6 @@ declare function callIntegrationMitra(options: CallIntegrationOptions): Promise<
|
|
|
1172
329
|
* Para a execução de uma Server Function em andamento
|
|
1173
330
|
*/
|
|
1174
331
|
declare function stopServerFunctionExecutionMitra(options: StopServerFunctionExecutionOptions): Promise<StopServerFunctionExecutionResponse>;
|
|
1175
|
-
/**
|
|
1176
|
-
* POST /interactions/uploadFilePublic (multipart/form-data)
|
|
1177
|
-
* Faz upload de um arquivo para a pasta PUBLIC do projeto.
|
|
1178
|
-
*/
|
|
1179
|
-
declare function uploadFilePublicMitra(options: UploadFileOptions): Promise<UploadFileResponse>;
|
|
1180
|
-
/**
|
|
1181
|
-
* POST /interactions/uploadFileLoadable (multipart/form-data)
|
|
1182
|
-
* Faz upload de um arquivo para a pasta LOADABLE do projeto.
|
|
1183
|
-
*/
|
|
1184
|
-
declare function uploadFileLoadableMitra(options: UploadFileOptions): Promise<UploadFileResponse>;
|
|
1185
332
|
declare function listRecordsMitra(options: ListRecordsOptions): Promise<ListRecordsResponse>;
|
|
1186
333
|
declare function getRecordMitra(options: GetRecordOptions): Promise<Record<string, any>>;
|
|
1187
334
|
declare function createRecordMitra(options: CreateRecordOptions): Promise<Record<string, any>>;
|
|
@@ -1189,60 +336,5 @@ declare function updateRecordMitra(options: UpdateRecordOptions): Promise<Record
|
|
|
1189
336
|
declare function patchRecordMitra(options: PatchRecordOptions): Promise<Record<string, any>>;
|
|
1190
337
|
declare function deleteRecordMitra(options: DeleteRecordOptions): Promise<void>;
|
|
1191
338
|
declare function createRecordsBatchMitra(options: CreateRecordsBatchOptions): Promise<Record<string, any>[]>;
|
|
1192
|
-
/**
|
|
1193
|
-
* GET /interactions/profiles?projectId={id}
|
|
1194
|
-
* Lista todos os perfis do projeto
|
|
1195
|
-
*/
|
|
1196
|
-
declare function listProfilesMitra(options?: ListProfilesOptions): Promise<ListProfilesResponse>;
|
|
1197
|
-
/**
|
|
1198
|
-
* GET /interactions/profiles/{profileId}?projectId={id}
|
|
1199
|
-
* Detalhes de um perfil (usuários, tabelas, actions, screens, server functions)
|
|
1200
|
-
*/
|
|
1201
|
-
declare function getProfileDetailsMitra(options: GetProfileDetailsOptions): Promise<GetProfileDetailsResponse>;
|
|
1202
|
-
/**
|
|
1203
|
-
* POST /interactions/profiles
|
|
1204
|
-
* Cria um novo perfil
|
|
1205
|
-
*/
|
|
1206
|
-
declare function createProfileMitra(options: CreateProfileOptions): Promise<CreateProfileResponse>;
|
|
1207
|
-
/**
|
|
1208
|
-
* PUT /interactions/profiles
|
|
1209
|
-
* Atualiza um perfil existente
|
|
1210
|
-
*/
|
|
1211
|
-
declare function updateProfileMitra(options: UpdateProfileOptions): Promise<UpdateProfileResponse>;
|
|
1212
|
-
/**
|
|
1213
|
-
* DELETE /interactions/profiles
|
|
1214
|
-
* Deleta um perfil
|
|
1215
|
-
*/
|
|
1216
|
-
declare function deleteProfileMitra(options: DeleteProfileOptions): Promise<DeleteProfileResponse>;
|
|
1217
|
-
/**
|
|
1218
|
-
* POST /interactions/profiles/users
|
|
1219
|
-
* Define os usuários de um perfil (substitui lista atual)
|
|
1220
|
-
*/
|
|
1221
|
-
declare function setProfileUsersMitra(options: SetProfileUsersOptions): Promise<SetProfilePermissionResponse>;
|
|
1222
|
-
/**
|
|
1223
|
-
* POST /interactions/profiles/selectTables
|
|
1224
|
-
* Define as tabelas SELECT permitidas por perfil
|
|
1225
|
-
*/
|
|
1226
|
-
declare function setProfileSelectTablesMitra(options: SetProfileSelectTablesOptions): Promise<SetProfilePermissionResponse>;
|
|
1227
|
-
/**
|
|
1228
|
-
* POST /interactions/profiles/dmlTables
|
|
1229
|
-
* Define as tabelas DML permitidas por perfil
|
|
1230
|
-
*/
|
|
1231
|
-
declare function setProfileDmlTablesMitra(options: SetProfileDmlTablesOptions): Promise<SetProfilePermissionResponse>;
|
|
1232
|
-
/**
|
|
1233
|
-
* POST /interactions/profiles/actions
|
|
1234
|
-
* Define as actions permitidas por perfil
|
|
1235
|
-
*/
|
|
1236
|
-
declare function setProfileActionsMitra(options: SetProfileActionsOptions): Promise<SetProfilePermissionResponse>;
|
|
1237
|
-
/**
|
|
1238
|
-
* POST /interactions/profiles/screens
|
|
1239
|
-
* Define as screens permitidas por perfil
|
|
1240
|
-
*/
|
|
1241
|
-
declare function setProfileScreensMitra(options: SetProfileScreensOptions): Promise<SetProfilePermissionResponse>;
|
|
1242
|
-
/**
|
|
1243
|
-
* POST /interactions/profiles/serverFunctions
|
|
1244
|
-
* Define as server functions permitidas por perfil
|
|
1245
|
-
*/
|
|
1246
|
-
declare function setProfileServerFunctionsMitra(options: SetProfileServerFunctionsOptions): Promise<SetProfilePermissionResponse>;
|
|
1247
339
|
|
|
1248
|
-
export { type
|
|
340
|
+
export { type CallIntegrationOptions, type CallIntegrationResponse, type CreateRecordOptions, type CreateRecordsBatchOptions, type DeleteRecordOptions, type ExecutePublicServerFunctionAsyncResponse, type ExecutePublicServerFunctionOptions, type ExecutePublicServerFunctionResponse, type ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type GetPublicServerFunctionExecutionOptions, type GetPublicServerFunctionExecutionResponse, type GetRecordOptions, type IntegrationResponse, type ListIntegrationsOptions, type ListRecordsOptions, type ListRecordsResponse, type LoginOptions, type LoginResponse, type MitraConfig, type MitraInstance, type PatchRecordOptions, type StopServerFunctionExecutionOptions, type StopServerFunctionExecutionResponse, type UpdateRecordOptions, callIntegrationMitra, configureSdkMitra, createMitraInstance, createRecordMitra, createRecordsBatchMitra, deleteRecordMitra, exchangeSsoCodeMitra, executePublicServerFunctionAsyncMitra, executePublicServerFunctionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getConfig, getPublicServerFunctionExecutionMitra, getRecordMitra, listIntegrationsMitra, listRecordsMitra, loginMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, patchRecordMitra, refreshTokenSilently, resolveProjectId, stopServerFunctionExecutionMitra, updateRecordMitra };
|