mitra-interactions-sdk 1.0.58-beta.0 → 1.0.58-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -5,7 +5,7 @@ interface LoginOptions {
5
5
  /** URL da página de autenticação Mitra (ex: https://coder.mitralab.io/sdk-auth/). Opcional se já configurado via configureSdkMitra. */
6
6
  authUrl?: string;
7
7
  /** ID do projeto. Opcional se já configurado via configureSdkMitra. */
8
- projectId?: number | string;
8
+ projectId?: number;
9
9
  /** Modo de login: 'popup' (default) abre popup, 'redirect' navega para a página de auth. */
10
10
  mode?: 'popup' | 'redirect';
11
11
  /** URL de retorno após login com mode 'redirect'. A página de auth redirecionará de volta para esta URL com token nos query params. */
@@ -18,18 +18,18 @@ interface LoginOptions {
18
18
  interface LoginResponse {
19
19
  /** Token JWT (já com prefixo Bearer) */
20
20
  token: string;
21
- /** Refresh token (novo Mitra). Presente apenas no novo mundo. */
22
- refreshToken?: string;
23
21
  /** URL base da API */
24
22
  baseURL: string;
25
23
  /** URL do serviço de integrações (opcional) */
26
24
  integrationURL?: string;
25
+ /** URL do WebSocket do Agent Chat (opcional — vem do sdk-auth quando configurado) */
26
+ agentWsUrl?: string;
27
27
  }
28
28
  interface EmailSignupOptions {
29
29
  /** URL da página de auth (ex: https://validacao.mitralab.io/sdk-auth/). Opcional se já configurado via configureSdkMitra. */
30
30
  authUrl?: string;
31
31
  /** ID do projeto. Opcional se já configurado via configureSdkMitra. */
32
- projectId?: number | string;
32
+ projectId?: number;
33
33
  /** Nome completo do usuário */
34
34
  name: string;
35
35
  /** Email do usuário */
@@ -41,7 +41,7 @@ interface EmailLoginOptions {
41
41
  /** URL da página de auth (ex: https://validacao.mitralab.io/sdk-auth/). Opcional se já configurado via configureSdkMitra. */
42
42
  authUrl?: string;
43
43
  /** ID do projeto. Opcional se já configurado via configureSdkMitra. */
44
- projectId?: number | string;
44
+ projectId?: number;
45
45
  /** Email do usuário */
46
46
  email: string;
47
47
  /** Senha */
@@ -51,7 +51,7 @@ interface EmailVerifyCodeOptions {
51
51
  /** URL da página de auth. Opcional se já configurado via configureSdkMitra. */
52
52
  authUrl?: string;
53
53
  /** ID do projeto. Opcional se já configurado via configureSdkMitra. */
54
- projectId?: number | string;
54
+ projectId?: number;
55
55
  /** Email do usuário */
56
56
  email: string;
57
57
  /** Código de verificação de 6 dígitos */
@@ -63,7 +63,7 @@ interface EmailResendCodeOptions {
63
63
  /** URL da página de auth. Opcional se já configurado via configureSdkMitra. */
64
64
  authUrl?: string;
65
65
  /** ID do projeto. Opcional se já configurado via configureSdkMitra. */
66
- projectId?: number | string;
66
+ projectId?: number;
67
67
  /** Email do usuário */
68
68
  email: string;
69
69
  }
@@ -96,14 +96,14 @@ interface ResetPasswordOptions {
96
96
  authApiURL?: string;
97
97
  }
98
98
  interface ExecuteDataLoaderOptions {
99
- projectId?: number | string;
100
- dataLoaderId: number | string;
99
+ projectId?: number;
100
+ dataLoaderId: number;
101
101
  input?: Record<string, unknown>;
102
102
  }
103
103
  interface ExecuteDataLoaderResponse {
104
104
  status: string;
105
105
  result: {
106
- dataLoaderId: number | string;
106
+ dataLoaderId: number;
107
107
  executionLog: {
108
108
  timestamp: string;
109
109
  rowCount: number;
@@ -117,9 +117,9 @@ interface ExecuteDataLoaderResponse {
117
117
  }
118
118
  interface ExecuteDbActionOptions {
119
119
  /** ID do projeto (opcional se já configurado via configureSdkMitra) */
120
- projectId?: number | string;
120
+ projectId?: number;
121
121
  /** ID da DBAction cadastrada */
122
- dbActionId: number | string;
122
+ dbActionId: number;
123
123
  /** Parâmetros de entrada (opcional) — substituição de variáveis no SQL (ex: { "nome": "João" } substitui :nome) */
124
124
  input?: Record<string, unknown>;
125
125
  }
@@ -131,7 +131,7 @@ interface ExecuteDbActionResponse {
131
131
  }
132
132
  interface SetFileStatusOptions {
133
133
  /** ID do projeto (opcional se já configurado via configureSdkMitra) */
134
- projectId?: number | string;
134
+ projectId?: number;
135
135
  /** Nome do arquivo */
136
136
  fileName: string;
137
137
  /** Caminho de destino: "PUBLIC" ou "LOADABLE" */
@@ -148,7 +148,7 @@ interface SetFileStatusResponse {
148
148
  }
149
149
  interface SetVariableOptions {
150
150
  /** ID do projeto (opcional se já configurado via configureSdkMitra) */
151
- projectId?: number | string;
151
+ projectId?: number;
152
152
  /** Nome da variável (key) */
153
153
  key: string;
154
154
  /** Valor da variável (opcional) */
@@ -163,9 +163,9 @@ interface SetVariableResponse {
163
163
  }
164
164
  interface ExecuteServerFunctionOptions {
165
165
  /** ID do projeto (opcional se já configurado via configureSdkMitra) */
166
- projectId?: number | string;
166
+ projectId?: number;
167
167
  /** ID da Server Function cadastrada */
168
- serverFunctionId: number | string;
168
+ serverFunctionId: number;
169
169
  /** Objeto de entrada para a função (opcional) */
170
170
  input?: Record<string, unknown>;
171
171
  }
@@ -182,9 +182,9 @@ interface ExecuteServerFunctionResponse {
182
182
  }
183
183
  interface ExecuteServerFunctionAsyncOptions {
184
184
  /** ID do projeto (opcional se já configurado via configureSdkMitra) */
185
- projectId?: number | string;
185
+ projectId?: number;
186
186
  /** ID da Server Function cadastrada */
187
- serverFunctionId: number | string;
187
+ serverFunctionId: number;
188
188
  /** Objeto de entrada para a função (opcional) */
189
189
  input?: Record<string, unknown>;
190
190
  }
@@ -197,9 +197,9 @@ interface ExecuteServerFunctionAsyncResponse {
197
197
  }
198
198
  interface ExecutePublicServerFunctionOptions {
199
199
  /** ID do projeto (tenant) */
200
- projectId: number | string;
200
+ projectId: number;
201
201
  /** ID da Server Function (deve ter publicExecution = true) */
202
- serverFunctionId: number | string;
202
+ serverFunctionId: number;
203
203
  /** Objeto de entrada para a função (opcional) */
204
204
  input?: Record<string, unknown>;
205
205
  }
@@ -216,7 +216,7 @@ interface ExecutePublicServerFunctionAsyncResponse {
216
216
  status: string;
217
217
  }
218
218
  interface GetPublicServerFunctionExecutionOptions {
219
- projectId: number | string;
219
+ projectId: number;
220
220
  executionId: string;
221
221
  }
222
222
  interface GetPublicServerFunctionExecutionResponse {
@@ -235,54 +235,54 @@ interface ListRecordsResponse {
235
235
  totalPages: number;
236
236
  }
237
237
  interface ListRecordsOptions {
238
- projectId?: number | string;
238
+ projectId?: number;
239
239
  tableName: string;
240
240
  page?: number;
241
241
  size?: number;
242
242
  filters?: Record<string, unknown>;
243
- jdbcConnectionConfigId?: number | string;
243
+ jdbcConnectionConfigId?: number;
244
244
  }
245
245
  interface GetRecordOptions {
246
- projectId?: number | string;
246
+ projectId?: number;
247
247
  tableName: string;
248
- id: number | string;
249
- jdbcConnectionConfigId?: number | string;
248
+ id: number;
249
+ jdbcConnectionConfigId?: number;
250
250
  }
251
251
  interface CreateRecordOptions {
252
- projectId?: number | string;
252
+ projectId?: number;
253
253
  tableName: string;
254
254
  data: Record<string, unknown>;
255
- jdbcConnectionConfigId?: number | string;
255
+ jdbcConnectionConfigId?: number;
256
256
  }
257
257
  interface UpdateRecordOptions {
258
- projectId?: number | string;
258
+ projectId?: number;
259
259
  tableName: string;
260
- id: number | string;
260
+ id: number;
261
261
  data: Record<string, unknown>;
262
- jdbcConnectionConfigId?: number | string;
262
+ jdbcConnectionConfigId?: number;
263
263
  }
264
264
  interface PatchRecordOptions {
265
- projectId?: number | string;
265
+ projectId?: number;
266
266
  tableName: string;
267
- id: number | string;
267
+ id: number;
268
268
  data: Record<string, unknown>;
269
- jdbcConnectionConfigId?: number | string;
269
+ jdbcConnectionConfigId?: number;
270
270
  }
271
271
  interface DeleteRecordOptions {
272
- projectId?: number | string;
272
+ projectId?: number;
273
273
  tableName: string;
274
- id: number | string;
275
- jdbcConnectionConfigId?: number | string;
274
+ id: number;
275
+ jdbcConnectionConfigId?: number;
276
276
  }
277
277
  interface CreateRecordsBatchOptions {
278
- projectId?: number | string;
278
+ projectId?: number;
279
279
  tableName: string;
280
280
  records: Record<string, unknown>[];
281
- jdbcConnectionConfigId?: number | string;
281
+ jdbcConnectionConfigId?: number;
282
282
  }
283
283
  interface UploadFileOptions {
284
284
  /** ID do projeto (opcional se já configurado via configureSdkMitra) */
285
- projectId?: number | string;
285
+ projectId?: number;
286
286
  /** Arquivo a ser enviado (File ou Blob) */
287
287
  file: File | Blob;
288
288
  /** Habilitar debug (opcional) */
@@ -299,11 +299,11 @@ interface UploadFileResponse {
299
299
  }
300
300
  interface ListVariablesOptions {
301
301
  /** ID do projeto (opcional se já configurado via configureSdkMitra) */
302
- projectId?: number | string;
302
+ projectId?: number;
303
303
  }
304
304
  interface ListVariablesResponse {
305
305
  status: string;
306
- projectId: number | string;
306
+ projectId: number;
307
307
  result: {
308
308
  key: string;
309
309
  value: string;
@@ -311,7 +311,7 @@ interface ListVariablesResponse {
311
311
  }
312
312
  interface GetVariableOptions {
313
313
  /** ID do projeto (opcional se já configurado via configureSdkMitra) */
314
- projectId?: number | string;
314
+ projectId?: number;
315
315
  /** Nome da variável (com ou sem :VAR_) */
316
316
  key: string;
317
317
  }
@@ -324,9 +324,9 @@ interface GetVariableResponse {
324
324
  }
325
325
  interface RunActionOptions {
326
326
  /** ID do projeto (opcional se já configurado via configureSdkMitra) */
327
- projectId?: number | string;
327
+ projectId?: number;
328
328
  /** ID da Action a executar */
329
- actionId: number | string;
329
+ actionId: number;
330
330
  /** Parâmetros de entrada para a action (opcional) */
331
331
  input?: Record<string, unknown>;
332
332
  }
@@ -340,7 +340,7 @@ interface RunActionResponse {
340
340
  }
341
341
  interface CallIntegrationOptions {
342
342
  /** ID do projeto (opcional se já configurado via configureSdkMitra) */
343
- projectId?: number | string;
343
+ projectId?: number;
344
344
  /** Slug da integração configurada no painel */
345
345
  connection: string;
346
346
  /** Método HTTP: GET, POST, PUT, DELETE */
@@ -360,11 +360,11 @@ interface CallIntegrationResponse {
360
360
  }
361
361
  interface ListIntegrationsOptions {
362
362
  /** ID do projeto (opcional se já configurado via configureSdkMitra) */
363
- projectId?: number | string;
363
+ projectId?: number;
364
364
  }
365
365
  interface IntegrationResponse {
366
366
  id: string;
367
- projectId: number | string;
367
+ projectId: number;
368
368
  name: string;
369
369
  slug: string;
370
370
  blueprintId: string | null;
@@ -378,7 +378,7 @@ interface IntegrationResponse {
378
378
  }
379
379
  interface StopServerFunctionExecutionOptions {
380
380
  /** ID do projeto (opcional se já configurado via configureSdkMitra) */
381
- projectId?: number | string;
381
+ projectId?: number;
382
382
  /** ID da execução a ser parada */
383
383
  executionId: string;
384
384
  }
@@ -390,87 +390,87 @@ interface StopServerFunctionExecutionResponse {
390
390
  };
391
391
  }
392
392
  interface ListProfilesOptions {
393
- projectId?: number | string;
393
+ projectId?: number;
394
394
  }
395
395
  interface ListProfilesResponse {
396
396
  status: string;
397
- projectId: number | string;
397
+ projectId: number;
398
398
  result: {
399
- id: number | string;
399
+ id: number;
400
400
  name: string;
401
401
  color: string;
402
- homeScreenId: number | string;
402
+ homeScreenId: number;
403
403
  }[];
404
404
  }
405
405
  interface GetProfileDetailsOptions {
406
- projectId?: number | string;
407
- profileId: number | string;
406
+ projectId?: number;
407
+ profileId: number;
408
408
  }
409
409
  interface GetProfileDetailsResponse {
410
410
  status: string;
411
- projectId: number | string;
411
+ projectId: number;
412
412
  result: {
413
- id: number | string;
413
+ id: number;
414
414
  name: string;
415
415
  users: {
416
- id: number | string;
416
+ id: number;
417
417
  name: string;
418
418
  email: string;
419
419
  }[];
420
420
  selectTables: {
421
421
  tableName: string;
422
- jdbcConnectionConfigId?: number | string;
422
+ jdbcConnectionConfigId?: number;
423
423
  }[];
424
424
  dmlTables: {
425
425
  tableName: string;
426
- jdbcConnectionConfigId?: number | string;
426
+ jdbcConnectionConfigId?: number;
427
427
  }[];
428
428
  actions: {
429
- id: number | string;
429
+ id: number;
430
430
  name: string;
431
431
  }[];
432
432
  screens: {
433
- id: number | string;
433
+ id: number;
434
434
  name: string;
435
435
  }[];
436
436
  serverFunctions: {
437
- id: number | string;
437
+ id: number;
438
438
  name: string;
439
439
  }[];
440
440
  };
441
441
  }
442
442
  interface CreateProfileOptions {
443
- projectId?: number | string;
443
+ projectId?: number;
444
444
  name: string;
445
445
  color?: string;
446
- homeScreenId?: number | string;
446
+ homeScreenId?: number;
447
447
  }
448
448
  interface CreateProfileResponse {
449
449
  status: string;
450
450
  result: {
451
- id: number | string;
451
+ id: number;
452
452
  name: string;
453
453
  message: string;
454
454
  };
455
455
  }
456
456
  interface UpdateProfileOptions {
457
- projectId?: number | string;
458
- profileId: number | string;
457
+ projectId?: number;
458
+ profileId: number;
459
459
  name?: string;
460
460
  color?: string;
461
- homeScreenId?: number | string;
461
+ homeScreenId?: number;
462
462
  }
463
463
  interface UpdateProfileResponse {
464
464
  status: string;
465
465
  result: {
466
- id: number | string;
466
+ id: number;
467
467
  name: string;
468
468
  message: string;
469
469
  };
470
470
  }
471
471
  interface DeleteProfileOptions {
472
- projectId?: number | string;
473
- profileId: number | string;
472
+ projectId?: number;
473
+ profileId: number;
474
474
  }
475
475
  interface DeleteProfileResponse {
476
476
  status: string;
@@ -479,48 +479,128 @@ interface DeleteProfileResponse {
479
479
  };
480
480
  }
481
481
  interface SetProfileUsersOptions {
482
- projectId?: number | string;
483
- profileId: number | string;
482
+ projectId?: number;
483
+ profileId: number;
484
484
  userIds: number[];
485
485
  }
486
486
  interface ProfileTableRef {
487
487
  tableName: string;
488
488
  }
489
489
  interface SetProfileSelectTablesOptions {
490
- projectId?: number | string;
491
- profileId: number | string;
492
- jdbcConnectionConfigId?: number | string;
490
+ projectId?: number;
491
+ profileId: number;
492
+ jdbcConnectionConfigId?: number;
493
493
  tables: ProfileTableRef[];
494
494
  }
495
495
  interface SetProfileDmlTablesOptions {
496
- projectId?: number | string;
497
- profileId: number | string;
498
- jdbcConnectionConfigId?: number | string;
496
+ projectId?: number;
497
+ profileId: number;
498
+ jdbcConnectionConfigId?: number;
499
499
  tables: ProfileTableRef[];
500
500
  }
501
501
  interface SetProfileActionsOptions {
502
- projectId?: number | string;
503
- profileId: number | string;
502
+ projectId?: number;
503
+ profileId: number;
504
504
  actionIds: number[];
505
505
  }
506
506
  interface SetProfileScreensOptions {
507
- projectId?: number | string;
508
- profileId: number | string;
507
+ projectId?: number;
508
+ profileId: number;
509
509
  screenIds: number[];
510
510
  }
511
511
  interface SetProfileServerFunctionsOptions {
512
- projectId?: number | string;
513
- profileId: number | string;
512
+ projectId?: number;
513
+ profileId: number;
514
514
  serverFunctionIds: number[];
515
515
  }
516
516
  interface SetProfilePermissionResponse {
517
517
  status: string;
518
518
  result: {
519
- profileId: number | string;
519
+ profileId: number;
520
520
  message: string;
521
521
  [key: string]: unknown;
522
522
  };
523
523
  }
524
+ interface AgentChat {
525
+ id: string;
526
+ name: string;
527
+ agentType?: string;
528
+ provider?: string;
529
+ createdAt: string;
530
+ updatedAt: string;
531
+ }
532
+ interface AgentMessage {
533
+ id: string;
534
+ content: string;
535
+ type: string;
536
+ sender?: 'user' | 'agent';
537
+ createdAt: string;
538
+ metadata?: Record<string, unknown> | null;
539
+ }
540
+ interface GetAgentChatsOptions {
541
+ /** Sobrescreve o projectId configurado globalmente. */
542
+ projectId?: number;
543
+ }
544
+ interface GetAgentHistoryOptions {
545
+ /** ID do chat cuja conversa será carregada. */
546
+ taskId: string;
547
+ /** Quantidade máxima de mensagens (default: tudo). */
548
+ limit?: number;
549
+ }
550
+ interface AgentStreamDeltaEvent {
551
+ taskId: string;
552
+ /** Pedaço de texto que chegou. */
553
+ delta: string;
554
+ /** Tipo do conteúdo: 'text' (resposta do agente) ou 'tool' (atividade de ferramenta). */
555
+ kind: 'text' | 'tool';
556
+ }
557
+ interface AgentStreamToolEvent {
558
+ taskId: string;
559
+ tool: string;
560
+ input?: string;
561
+ content?: string;
562
+ timestamp: number;
563
+ }
564
+ interface AgentStreamEndEvent {
565
+ taskId: string;
566
+ /** Conteúdo final acumulado (concatenação dos deltas). */
567
+ content: string;
568
+ }
569
+ interface AgentTaskCreatedEvent {
570
+ task: AgentChat;
571
+ }
572
+ interface AgentErrorEvent {
573
+ taskId?: string;
574
+ error: string;
575
+ }
576
+ interface SendAgentPromptOptions {
577
+ /** Texto enviado ao agente. */
578
+ prompt: string;
579
+ /** ID do chat existente. Se ausente, cria um chat novo. */
580
+ taskId?: string;
581
+ /** Tipo do agente. Default: 'claudecode'. */
582
+ agentType?: 'claudecode' | 'codex' | 'opencode-cli' | 'opencode-sdk';
583
+ /** Sobrescreve projectId global. */
584
+ projectId?: number;
585
+ /** Nome do chat quando criando novo (default: derivado do prompt). */
586
+ name?: string;
587
+ /** Callback chamado a cada chunk de texto. */
588
+ onDelta?: (event: AgentStreamDeltaEvent) => void;
589
+ /** Callback chamado quando uma ferramenta é usada. */
590
+ onTool?: (event: AgentStreamToolEvent) => void;
591
+ /** Callback chamado quando um novo chat é criado (só dispara se taskId era ausente). */
592
+ onTaskCreated?: (event: AgentTaskCreatedEvent) => void;
593
+ /** Callback chamado quando ocorre erro durante o stream. */
594
+ onError?: (event: AgentErrorEvent) => void;
595
+ /** Permite cancelar o stream mid-flight. */
596
+ signal?: AbortSignal;
597
+ }
598
+ interface SendAgentPromptResponse {
599
+ /** ID do chat (existente ou recém-criado). */
600
+ taskId: string;
601
+ /** Texto completo acumulado dos deltas. */
602
+ content: string;
603
+ }
524
604
 
525
605
  /**
526
606
  * Mitra Interactions SDK - Instance
@@ -568,6 +648,10 @@ interface MitraInstance {
568
648
  sendPasswordResetCode(options: SendPasswordResetCodeOptions): Promise<Record<string, unknown>>;
569
649
  validatePasswordResetCode(options: ValidatePasswordResetCodeOptions): Promise<Record<string, unknown>>;
570
650
  resetPassword(options: ResetPasswordOptions): Promise<Record<string, unknown>>;
651
+ getAgentChats(options?: GetAgentChatsOptions): Promise<AgentChat[]>;
652
+ getAgentHistory(options: GetAgentHistoryOptions): Promise<AgentMessage[]>;
653
+ sendAgentPrompt(options: SendAgentPromptOptions): Promise<SendAgentPromptResponse>;
654
+ disconnectAgentChat(): void;
571
655
  openChat(): void;
572
656
  closeChat(): void;
573
657
  }
@@ -578,14 +662,14 @@ interface MitraConfig {
578
662
  baseURL: string;
579
663
  /** Token JWT para autenticação (opcional para Server Functions públicas) */
580
664
  token?: string;
581
- /** Refresh token (novo Mitra). Necessário para refresh automático no novo mundo. */
582
- refreshToken?: string;
583
665
  /** URL base do serviço de integrações (ex: https://api0.mitraecp.com:1003) */
584
666
  integrationURL?: string;
585
667
  /** URL da página de autenticação Mitra (ex: https://coder.mitralab.io/sdk-auth/) */
586
668
  authUrl?: string;
669
+ /** URL do WebSocket do Agent Chat (ex: wss://agent.mitralab.io/sdk-ws ou ws://localhost:3456/sdk-ws) */
670
+ agentWsUrl?: string;
587
671
  /** ID do projeto (usado como fallback nos métodos de login e serviços) */
588
- projectId?: number | string;
672
+ projectId?: number;
589
673
  /** Callback chamado quando o token é renovado automaticamente (após 401/403). Recebe a nova sessão. */
590
674
  onTokenRefresh?: (session: LoginResponse) => void;
591
675
  }
@@ -600,7 +684,7 @@ declare function getConfig(): MitraConfig;
600
684
  /**
601
685
  * Resolve projectId: usa o valor passado, senão pega do config salvo.
602
686
  */
603
- declare function resolveProjectId(projectId?: number | string): number | string;
687
+ declare function resolveProjectId(projectId?: number): number;
604
688
 
605
689
  /**
606
690
  * Mitra Interactions SDK - Chat Integration
@@ -619,24 +703,56 @@ declare function openChatMitra(): void;
619
703
  declare function closeChatMitra(): void;
620
704
 
621
705
  /**
622
- * Mitra Interactions SDK - Autenticação (Router)
623
- *
624
- * Roteia chamadas de auth para a implementação correta com base no `authUrl`:
625
- * - URLs legadas (`coder.mitralab.io/sdk-auth/`, `agent.mitralab.io/sdk-auth/`) → auth-legacy.ts
626
- * - Qualquer outro authUrl → auth-new.ts (novo Mitra: Kong gateway + IAM service)
706
+ * Mitra Interactions SDK - Autenticação
627
707
  *
628
- * A API pública é idêntica à legacy. Consumers não precisam alterar código.
708
+ * Login via popup seguro hospedado no domínio Mitra.
709
+ * Credenciais nunca passam pelo código do desenvolvedor.
629
710
  */
630
711
 
631
- declare function loginMitra(method: 'email' | 'google' | 'microsoft' | 'mitra', options?: LoginOptions): Promise<LoginResponse>;
712
+ /**
713
+ * Login com email e senha via popup/redirect seguro Mitra.
714
+ */
632
715
  declare function loginWithEmailMitra(options?: LoginOptions): Promise<LoginResponse>;
716
+ /**
717
+ * Login com Google via popup/redirect seguro Mitra.
718
+ */
633
719
  declare function loginWithGoogleMitra(options?: LoginOptions): Promise<LoginResponse>;
720
+ /**
721
+ * Login com Microsoft via popup/redirect seguro Mitra.
722
+ */
634
723
  declare function loginWithMicrosoftMitra(options?: LoginOptions): Promise<LoginResponse>;
724
+ /**
725
+ * Login genérico via popup/redirect seguro Mitra.
726
+ */
727
+ declare function loginMitra(method: 'email' | 'google' | 'microsoft' | 'mitra', options?: LoginOptions): Promise<LoginResponse>;
728
+ /**
729
+ * Renova o token silenciosamente via iframe invisível.
730
+ * Se já houver um refresh em andamento, reaproveita a mesma promise.
731
+ */
732
+ declare function refreshTokenSilently(authUrl: string, projectId: number): Promise<LoginResponse>;
733
+ /**
734
+ * Cria conta via email usando iframe silencioso.
735
+ * Após sucesso, o usuário recebe um código de verificação por email.
736
+ * Fluxo: emailSignupMitra → emailVerifyCodeMitra → emailLoginMitra
737
+ */
635
738
  declare function emailSignupMitra(options: EmailSignupOptions): Promise<void>;
636
- declare function emailLoginMitra(options: EmailLoginOptions): Promise<LoginResponse>;
739
+ /**
740
+ * Verifica o código de 6 dígitos enviado por email após signup.
741
+ * Após verificação, faz login automático e retorna LoginResponse.
742
+ * Auto-configura o SDK após sucesso.
743
+ */
637
744
  declare function emailVerifyCodeMitra(options: EmailVerifyCodeOptions): Promise<LoginResponse>;
745
+ /**
746
+ * Reenvia o código de verificação para o email.
747
+ */
638
748
  declare function emailResendCodeMitra(options: EmailResendCodeOptions): Promise<void>;
639
- declare function refreshTokenSilently(authUrl: string, projectId: number | string): Promise<LoginResponse>;
749
+ /**
750
+ * Login via email e senha usando iframe silencioso.
751
+ * O HTML de auth faz a chamada à API e resolve as credenciais do projeto.
752
+ * Retorna LoginResponse com token, baseURL e integrationURL.
753
+ * Auto-configura o SDK após sucesso.
754
+ */
755
+ declare function emailLoginMitra(options: EmailLoginOptions): Promise<LoginResponse>;
640
756
 
641
757
  /**
642
758
  * Mitra Interactions SDK - Password Reset (legacy backend)
@@ -662,6 +778,28 @@ declare function validatePasswordResetCodeMitra(options: ValidatePasswordResetCo
662
778
  */
663
779
  declare function resetPasswordMitra(options: ResetPasswordOptions): Promise<Record<string, unknown>>;
664
780
 
781
+ /**
782
+ * Mitra Interactions SDK - Agent Chat (embedded)
783
+ *
784
+ * Conecta via WebSocket ao mitra-agent-websocket. Tudo (lista de chats,
785
+ * histórico, envio de prompt + stream) trafega pela mesma conexão.
786
+ *
787
+ * - Open: lazy — só conecta na primeira chamada.
788
+ * - Auth: JWT do config global passado como query param do handshake.
789
+ * O backend valida o token e resolve userSpaceID server-side.
790
+ * - Request/Response: cada chamada envia { type, requestId } e aguarda
791
+ * { type: 'response', requestId, ok, data | error }.
792
+ * - Stream: send_prompt dispara push events (stream_delta, stream_end, ...).
793
+ */
794
+
795
+ declare function getAgentChatsMitra(options?: GetAgentChatsOptions): Promise<AgentChat[]>;
796
+ declare function getAgentHistoryMitra(options: GetAgentHistoryOptions): Promise<AgentMessage[]>;
797
+ declare function sendAgentPromptMitra(options: SendAgentPromptOptions): Promise<SendAgentPromptResponse>;
798
+ /**
799
+ * Fecha o WebSocket do Agent Chat. Útil em testes ou no logout.
800
+ */
801
+ declare function disconnectAgentChatMitra(): void;
802
+
665
803
  /**
666
804
  * Mitra Interactions SDK - Services
667
805
  */
@@ -817,4 +955,4 @@ declare function setProfileScreensMitra(options: SetProfileScreensOptions): Prom
817
955
  */
818
956
  declare function setProfileServerFunctionsMitra(options: SetProfileServerFunctionsOptions): Promise<SetProfilePermissionResponse>;
819
957
 
820
- export { type CallIntegrationOptions, type CallIntegrationResponse, type CreateProfileOptions, type CreateProfileResponse, type CreateRecordOptions, type CreateRecordsBatchOptions, type DeleteProfileOptions, type DeleteProfileResponse, type DeleteRecordOptions, type EmailLoginOptions, type EmailResendCodeOptions, type EmailSignupOptions, type EmailVerifyCodeOptions, type ExecuteDataLoaderOptions, type ExecuteDataLoaderResponse, type ExecuteDbActionOptions, type ExecuteDbActionResponse, type ExecutePublicServerFunctionAsyncResponse, type ExecutePublicServerFunctionOptions, type ExecutePublicServerFunctionResponse, type ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type GetProfileDetailsOptions, type GetProfileDetailsResponse, type GetPublicServerFunctionExecutionOptions, type GetPublicServerFunctionExecutionResponse, type GetRecordOptions, type GetVariableOptions, type GetVariableResponse, type IntegrationResponse, type ListIntegrationsOptions, type ListProfilesOptions, type ListProfilesResponse, type ListRecordsOptions, type ListRecordsResponse, type ListVariablesOptions, type ListVariablesResponse, type LoginOptions, type LoginResponse, type MitraConfig, type MitraInstance, type PatchRecordOptions, type ProfileTableRef, type ResetPasswordOptions, type RunActionOptions, type RunActionResponse, type SendPasswordResetCodeOptions, type SetFileStatusOptions, type SetFileStatusResponse, type SetProfileActionsOptions, type SetProfileDmlTablesOptions, type SetProfilePermissionResponse, type SetProfileScreensOptions, type SetProfileSelectTablesOptions, type SetProfileServerFunctionsOptions, type SetProfileUsersOptions, type SetVariableOptions, type SetVariableResponse, type StopServerFunctionExecutionOptions, type StopServerFunctionExecutionResponse, type UpdateProfileOptions, type UpdateProfileResponse, type UpdateRecordOptions, type UploadFileOptions, type UploadFileResponse, type ValidatePasswordResetCodeOptions, callIntegrationMitra, closeChatMitra, configureSdkMitra, createMitraInstance, createProfileMitra, createRecordMitra, createRecordsBatchMitra, deleteProfileMitra, deleteRecordMitra, emailLoginMitra, emailResendCodeMitra, emailSignupMitra, emailVerifyCodeMitra, executeDataLoaderMitra, executeDbActionMitra, executePublicServerFunctionAsyncMitra, executePublicServerFunctionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getConfig, getProfileDetailsMitra, getPublicServerFunctionExecutionMitra, getRecordMitra, getVariableMitra, listIntegrationsMitra, listProfilesMitra, listRecordsMitra, listVariablesMitra, loginMitra, loginWithEmailMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, openChatMitra, patchRecordMitra, refreshTokenSilently, resetPasswordMitra, resolveProjectId, runActionMitra, sendPasswordResetCodeMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePublicMitra, validatePasswordResetCodeMitra };
958
+ export { type AgentChat, type AgentErrorEvent, type AgentMessage, type AgentStreamDeltaEvent, type AgentStreamEndEvent, type AgentStreamToolEvent, type AgentTaskCreatedEvent, type CallIntegrationOptions, type CallIntegrationResponse, type CreateProfileOptions, type CreateProfileResponse, type CreateRecordOptions, type CreateRecordsBatchOptions, type DeleteProfileOptions, type DeleteProfileResponse, type DeleteRecordOptions, type EmailLoginOptions, type EmailResendCodeOptions, type EmailSignupOptions, type EmailVerifyCodeOptions, type ExecuteDataLoaderOptions, type ExecuteDataLoaderResponse, type ExecuteDbActionOptions, type ExecuteDbActionResponse, type ExecutePublicServerFunctionAsyncResponse, type ExecutePublicServerFunctionOptions, type ExecutePublicServerFunctionResponse, type ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type GetAgentChatsOptions, type GetAgentHistoryOptions, type GetProfileDetailsOptions, type GetProfileDetailsResponse, type GetPublicServerFunctionExecutionOptions, type GetPublicServerFunctionExecutionResponse, type GetRecordOptions, type GetVariableOptions, type GetVariableResponse, type IntegrationResponse, type ListIntegrationsOptions, type ListProfilesOptions, type ListProfilesResponse, type ListRecordsOptions, type ListRecordsResponse, type ListVariablesOptions, type ListVariablesResponse, type LoginOptions, type LoginResponse, type MitraConfig, type MitraInstance, type PatchRecordOptions, type ProfileTableRef, type ResetPasswordOptions, type RunActionOptions, type RunActionResponse, type SendAgentPromptOptions, type SendAgentPromptResponse, type SendPasswordResetCodeOptions, type SetFileStatusOptions, type SetFileStatusResponse, type SetProfileActionsOptions, type SetProfileDmlTablesOptions, type SetProfilePermissionResponse, type SetProfileScreensOptions, type SetProfileSelectTablesOptions, type SetProfileServerFunctionsOptions, type SetProfileUsersOptions, type SetVariableOptions, type SetVariableResponse, type StopServerFunctionExecutionOptions, type StopServerFunctionExecutionResponse, type UpdateProfileOptions, type UpdateProfileResponse, type UpdateRecordOptions, type UploadFileOptions, type UploadFileResponse, type ValidatePasswordResetCodeOptions, callIntegrationMitra, closeChatMitra, configureSdkMitra, createMitraInstance, createProfileMitra, createRecordMitra, createRecordsBatchMitra, deleteProfileMitra, deleteRecordMitra, disconnectAgentChatMitra, emailLoginMitra, emailResendCodeMitra, emailSignupMitra, emailVerifyCodeMitra, executeDataLoaderMitra, executeDbActionMitra, executePublicServerFunctionAsyncMitra, executePublicServerFunctionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getAgentChatsMitra, getAgentHistoryMitra, getConfig, getProfileDetailsMitra, getPublicServerFunctionExecutionMitra, getRecordMitra, getVariableMitra, listIntegrationsMitra, listProfilesMitra, listRecordsMitra, listVariablesMitra, loginMitra, loginWithEmailMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, openChatMitra, patchRecordMitra, refreshTokenSilently, resetPasswordMitra, resolveProjectId, runActionMitra, sendAgentPromptMitra, sendPasswordResetCodeMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePublicMitra, validatePasswordResetCodeMitra };