mitra-interactions-sdk 1.0.60-beta.24 → 1.0.60-beta.26

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 CHANGED
@@ -246,7 +246,7 @@ const result2 = await listRecordsMitra({
246
246
 
247
247
  ## Agent Chat (copilot)
248
248
 
249
- Chat com o agente de IA embarcado. **REST-first**: chats, histórico, credenciais e modelos são HTTP no gateway `{origin}/copilot/api/v1` (mesmo domínio da `baseURL`, `Authorization: Bearer`). **Só o prompt é streaming** — um WebSocket por task em `wss://{origin}/copilot/ws/tasks/{taskId}?token=JWT`, aberto pela SDK quando a conversa começa.
249
+ Chat com o agente de IA embarcado. **REST-first, tudo pela BFF no `baseURL` normal** (`/agentAiShortcut/*` — herda `fetchWithRefresh` e CORS): chats (`createChat`/`listChats`/`readChat`/`renameChat`/`deleteChat`), histórico (`listChatMessages`), credenciais e modelos. `projectId` obrigatório em todas (opcional na chamada se veio do `configureSdkMitra`). **Só o prompt é streaming** — um WebSocket por task em `wss://{origin}/copilot/ws/tasks/{taskId}?token=JWT`, aberto pela SDK quando a conversa começa (WS não passa por preflight de CORS).
250
250
 
251
251
  Precisa de `token` e `baseURL` configurados (o login já deixa pronto). O transporte do prompt aceita `transport: 'ws' | 'http'` — `'ws'` é o default; `'http'` é reservado pra ambientes serverless e hoje lança erro claro (o backend ainda não expõe prompt por HTTP).
252
252
 
@@ -265,12 +265,12 @@ const deleted = await manageAgentChatMitra({ action: 'delete', taskId }); // ar
265
265
  ```
266
266
 
267
267
  - `action: 'list'` → `AgentChat[]` — `{ id, name, agentType, agentId, archived, createdAt, updatedAt }`. Filtros: `agentId?`, `archived?`, `search?`, `page?`, `size?`.
268
- - `action: 'rename'` → `{ taskId, name }` (PATCH `/tasks/{id}`)
269
- - `action: 'delete'` → `{ taskId, deleted }` (PATCH `/tasks/{id}/archive` — o histórico não é destruído)
268
+ - `action: 'rename'` → `{ taskId, name }` (POST `/agentAiShortcut/renameChat`)
269
+ - `action: 'delete'` → `{ taskId, deleted }` (POST `/agentAiShortcut/deleteChat` — arquiva, o histórico não é destruído)
270
270
 
271
271
  ### Abrir uma session — `getAgentTaskMitra`
272
272
 
273
- Retorna uma `AgentTaskSession` que encapsula o ciclo de vida do chat. A task é criada via REST (`POST /tasks`) no primeiro `send()`; o WS da task conecta em seguida. Abrir a mesma `taskId` duas vezes devolve a **mesma** instância (cache).
273
+ Retorna uma `AgentTaskSession` que encapsula o ciclo de vida do chat. A task é criada via BFF (`POST /agentAiShortcut/createChat`) no primeiro `send()`; o WS da task conecta em seguida. Abrir a mesma `taskId` duas vezes devolve a **mesma** instância (cache).
274
274
 
275
275
  ```typescript
276
276
  import { getAgentTaskMitra } from 'mitra-interactions-sdk';
@@ -331,7 +331,9 @@ session.send('Analise estas vendas e gere um resumo');
331
331
 
332
332
  ### Credenciais do agente — `manageAgentCredentialMitra`
333
333
 
334
- Função única, toda HTTP. Providers: `'anthropic'`, `'openai'`, `'google'`. API key via `save`/`remove`; OAuth via `auth`/`connect`; device flow via `device_auth`/`device_poll`.
334
+ Função única, toda HTTP **via BFF** (`/agentAiShortcut/listProviders`, `saveCredential`, `oauthStart`...). Providers: `'anthropic'`, `'openai'`, `'google'`. API key via `save`/`remove`; OAuth via `auth`/`connect`; device flow via `device_auth`/`device_poll`.
335
+
336
+ **`projectId` é obrigatório** em todas as actions (opcional na chamada se já veio do `configureSdkMitra`) — é ele que define de qual app é a credencial; o BFF resolve `projectId → appId` e cunha o token de app.
335
337
 
336
338
  > 🔒 Tokens/keys nunca voltam crus — o backend devolve só status, e-mail da conta e a key mascarada.
337
339
 
package/dist/index.d.mts CHANGED
@@ -222,6 +222,8 @@ interface AgentMessage {
222
222
  type ChatManageAction = 'list' | 'rename' | 'delete';
223
223
  interface ManageAgentChatListOptions {
224
224
  action: 'list';
225
+ /** Obrigatório (opcional na chamada se configurado via configureSdkMitra). */
226
+ projectId?: number | string;
225
227
  /** Filtra os chats de um agente business específico. Omitido = todos os chats. */
226
228
  agentId?: string;
227
229
  /** Inclui só arquivados (true) ou só ativos (false, default). */
@@ -237,10 +239,14 @@ interface ManageAgentChatRenameOptions {
237
239
  action: 'rename';
238
240
  taskId: string;
239
241
  name: string;
242
+ /** Obrigatório (opcional na chamada se configurado via configureSdkMitra). */
243
+ projectId?: number | string;
240
244
  }
241
245
  interface ManageAgentChatDeleteOptions {
242
246
  action: 'delete';
243
247
  taskId: string;
248
+ /** Obrigatório (opcional na chamada se configurado via configureSdkMitra). */
249
+ projectId?: number | string;
244
250
  }
245
251
  type ManageAgentChatOptions = ManageAgentChatListOptions | ManageAgentChatRenameOptions | ManageAgentChatDeleteOptions;
246
252
  interface RenameAgentChatResult {
@@ -259,8 +265,10 @@ interface DeleteAgentChatResult {
259
265
  */
260
266
  type AgentTaskTransport = 'ws' | 'http';
261
267
  interface GetAgentTaskCreateOptions {
262
- /** Cria chat novo. A task é criada via REST no primeiro send(). */
268
+ /** Cria chat novo. A task é criada via BFF no primeiro send(). */
263
269
  create: true;
270
+ /** Obrigatório (opcional na chamada se configurado via configureSdkMitra). */
271
+ projectId?: number | string;
264
272
  /** Tipo/modelo do agente (de list_models). Default: 'ANTHROPIC_CLAUDE_OPUS'. */
265
273
  agentType?: AgentType;
266
274
  /** Nome/título do chat. */
@@ -278,6 +286,8 @@ interface GetAgentTaskCreateOptions {
278
286
  interface GetAgentTaskOpenOptions {
279
287
  /** Abre chat existente. */
280
288
  taskId: string;
289
+ /** Obrigatório (opcional na chamada se configurado via configureSdkMitra). */
290
+ projectId?: number | string;
281
291
  /** Transporte do prompt (default 'ws'). */
282
292
  transport?: AgentTaskTransport;
283
293
  }
@@ -408,32 +418,44 @@ interface DeviceAuthAgentCredentialResult {
408
418
  verificationUri: string;
409
419
  intervalSeconds: number;
410
420
  }
421
+ /**
422
+ * `projectId` é obrigatório em todas as actions (opcional na chamada se já
423
+ * configurado via configureSdkMitra) — define de qual app é a credencial.
424
+ */
411
425
  type ManageAgentCredentialOptions = {
412
426
  action: 'list_providers';
427
+ projectId?: number | string;
413
428
  } | {
414
429
  action: 'list_models';
430
+ projectId?: number | string;
415
431
  } | {
416
432
  action: 'save';
417
433
  target: AgentProvider;
418
434
  key: string;
435
+ projectId?: number | string;
419
436
  } | {
420
437
  action: 'remove';
421
438
  target: AgentProvider;
439
+ projectId?: number | string;
422
440
  } | {
423
441
  action: 'auth';
424
442
  target: AgentProvider;
443
+ projectId?: number | string;
425
444
  } | {
426
445
  action: 'connect';
427
446
  target: AgentProvider;
428
447
  code: string;
429
448
  state: string;
449
+ projectId?: number | string;
430
450
  } | {
431
451
  action: 'device_auth';
432
452
  target: AgentProvider;
453
+ projectId?: number | string;
433
454
  } | {
434
455
  action: 'device_poll';
435
456
  target: AgentProvider;
436
457
  deviceAuthId: string;
458
+ projectId?: number | string;
437
459
  };
438
460
 
439
461
  /**
@@ -526,11 +548,15 @@ declare function exchangeSsoCodeMitra(options: {
526
548
  }): Promise<LoginResponse>;
527
549
 
528
550
  /**
529
- * Mitra Interactions SDK — Agent Chat (copilot novo mundo)
551
+ * Mitra Interactions SDK — Agent Chat (via BFF)
552
+ *
553
+ * REST-first, tudo pela BFF no baseURL normal (`/agentAiShortcut/*`) — herda
554
+ * fetchWithRefresh e o CORS do BFF. Envelope `{ status, result }`; listas vêm
555
+ * desembrulhadas do Page (result é o array direto).
530
556
  *
531
- * REST-first: chats (tasks), histórico, credenciais e modelos são HTTP no
532
- * gateway `{origin}/copilot/api/v1`. SÓ o prompt é streaming — WebSocket por
533
- * task em `{origin}/copilot/ws/tasks/{taskId}?token=JWT`.
557
+ * SÓ o prompt é streaming: WebSocket por task em
558
+ * `wss://{origin}/copilot/ws/tasks/{taskId}?token=JWT` (não passa por
559
+ * preflight de CORS).
534
560
  *
535
561
  * API pública:
536
562
  * - manageAgentChatMitra({ action: 'list' | 'rename' | 'delete', ... })
@@ -538,10 +564,12 @@ declare function exchangeSsoCodeMitra(options: {
538
564
  */
539
565
 
540
566
  /**
541
- * Gerencia a coleção de chats do usuário — tudo HTTP:
542
- * - list → GET /copilot/api/v1/tasks (filtros: agentId, archived, search, page, size)
543
- * - rename → PATCH /copilot/api/v1/tasks/{id}
544
- * - delete → PATCH /copilot/api/v1/tasks/{id}/archive (arquiva; some da lista default)
567
+ * Gerencia a coleção de chats do usuário — tudo HTTP via BFF:
568
+ * - list → GET /agentAiShortcut/listChats (filtros: agentId, archived, search, page, size)
569
+ * - rename → POST /agentAiShortcut/renameChat
570
+ * - delete → POST /agentAiShortcut/deleteChat (arquiva; some da lista default)
571
+ *
572
+ * `projectId` é obrigatório (opcional na chamada se configurado no configureSdkMitra).
545
573
  *
546
574
  * @example
547
575
  * const chats = await manageAgentChatMitra({ action: 'list' });
@@ -554,7 +582,7 @@ declare function manageAgentChatMitra(options: ManageAgentChatRenameOptions): Pr
554
582
  declare function manageAgentChatMitra(options: ManageAgentChatDeleteOptions): Promise<DeleteAgentChatResult>;
555
583
  /**
556
584
  * Abre um handle de chat (session). Use:
557
- * - `{ create: true }` para iniciar um chat novo (a task é criada via REST no 1º send)
585
+ * - `{ create: true }` para iniciar um chat novo (a task é criada via BFF no 1º send)
558
586
  * - `{ taskId: 'X' }` para abrir um chat existente
559
587
  *
560
588
  * A session expõe histórico, streaming, fila, cancel e eventos. Se a
@@ -563,56 +591,71 @@ declare function manageAgentChatMitra(options: ManageAgentChatDeleteOptions): Pr
563
591
  declare function getAgentTaskMitra(options: GetAgentTaskOptions): AgentTaskSession;
564
592
 
565
593
  /**
566
- * Mitra Interactions SDK — Agent Credentials (copilot novo mundo)
594
+ * Mitra Interactions SDK — Agent Credentials (via BFF)
595
+ *
596
+ * Função ÚNICA `manageAgentCredentialMitra`, toda HTTP pela BFF no baseURL
597
+ * normal (`/agentAiShortcut/*`) — herda fetchWithRefresh e o CORS do BFF:
598
+ * - list_providers → GET /agentAiShortcut/listProviders?projectId=
599
+ * - list_models → GET /agentAiShortcut/listModels?projectId=
600
+ * - save → POST /agentAiShortcut/saveCredential {projectId, provider, key}
601
+ * - remove → POST /agentAiShortcut/removeCredential {projectId, provider}
602
+ * - auth → POST /agentAiShortcut/oauthStart {projectId, provider}
603
+ * - connect → POST /agentAiShortcut/oauthExchange {projectId, provider, code, state}
604
+ * - device_auth → POST /agentAiShortcut/deviceStart {projectId, provider}
605
+ * - device_poll → POST /agentAiShortcut/devicePoll {projectId, provider, deviceAuthId}
567
606
  *
568
- * Função ÚNICA `manageAgentCredentialMitra`, toda HTTP no gateway
569
- * `{origin}/copilot/api/v1`:
570
- * - list_providers → GET /credentials
571
- * - list_models → GET /models
572
- * - save → PUT /credentials/{provider}/api-key
573
- * - remove → DELETE /credentials/{provider}
574
- * - auth → POST /oauth/start (OAuth: { authUrl, state })
575
- * - connect → POST /oauth/exchange (OAuth: { code, state })
576
- * - device_auth → POST /credentials/{provider}/device-authorizations
577
- * - device_poll → POST /credentials/{provider}/device-authorizations/{id}/poll
607
+ * `projectId` é obrigatório (opcional na chamada se configurado no
608
+ * configureSdkMitra): é ele que define de qual app é a credencial — o BFF
609
+ * resolve projectId → appId e cunha o token de app.
578
610
  *
579
- * SEGURANÇA: tokens/keys nunca voltam crus — o backend devolve só status,
580
- * e-mail da conta e a key mascarada.
611
+ * As respostas vêm no envelope BFF `{ status, result }`; a SDK devolve o
612
+ * `result` cru (mesmos campos que o copilot retorna hoje, nada renomeado).
613
+ *
614
+ * SEGURANÇA: tokens/keys nunca voltam crus — só status, e-mail da conta e a
615
+ * key mascarada.
581
616
  */
582
617
 
583
618
  declare function manageAgentCredentialMitra(options: {
584
619
  action: 'list_providers';
620
+ projectId?: number | string;
585
621
  }): Promise<ListAgentProvidersResult>;
586
622
  declare function manageAgentCredentialMitra(options: {
587
623
  action: 'list_models';
624
+ projectId?: number | string;
588
625
  }): Promise<ListAgentModelsResult>;
589
626
  declare function manageAgentCredentialMitra(options: {
590
627
  action: 'save';
591
628
  target: AgentProvider;
592
629
  key: string;
630
+ projectId?: number | string;
593
631
  }): Promise<void>;
594
632
  declare function manageAgentCredentialMitra(options: {
595
633
  action: 'remove';
596
634
  target: AgentProvider;
635
+ projectId?: number | string;
597
636
  }): Promise<void>;
598
637
  declare function manageAgentCredentialMitra(options: {
599
638
  action: 'auth';
600
639
  target: AgentProvider;
640
+ projectId?: number | string;
601
641
  }): Promise<AuthAgentCredentialResult>;
602
642
  declare function manageAgentCredentialMitra(options: {
603
643
  action: 'connect';
604
644
  target: AgentProvider;
605
645
  code: string;
606
646
  state: string;
647
+ projectId?: number | string;
607
648
  }): Promise<ConnectAgentCredentialResult>;
608
649
  declare function manageAgentCredentialMitra(options: {
609
650
  action: 'device_auth';
610
651
  target: AgentProvider;
652
+ projectId?: number | string;
611
653
  }): Promise<DeviceAuthAgentCredentialResult>;
612
654
  declare function manageAgentCredentialMitra(options: {
613
655
  action: 'device_poll';
614
656
  target: AgentProvider;
615
657
  deviceAuthId: string;
658
+ projectId?: number | string;
616
659
  }): Promise<ConnectAgentCredentialResult>;
617
660
 
618
661
  /**
package/dist/index.d.ts CHANGED
@@ -222,6 +222,8 @@ interface AgentMessage {
222
222
  type ChatManageAction = 'list' | 'rename' | 'delete';
223
223
  interface ManageAgentChatListOptions {
224
224
  action: 'list';
225
+ /** Obrigatório (opcional na chamada se configurado via configureSdkMitra). */
226
+ projectId?: number | string;
225
227
  /** Filtra os chats de um agente business específico. Omitido = todos os chats. */
226
228
  agentId?: string;
227
229
  /** Inclui só arquivados (true) ou só ativos (false, default). */
@@ -237,10 +239,14 @@ interface ManageAgentChatRenameOptions {
237
239
  action: 'rename';
238
240
  taskId: string;
239
241
  name: string;
242
+ /** Obrigatório (opcional na chamada se configurado via configureSdkMitra). */
243
+ projectId?: number | string;
240
244
  }
241
245
  interface ManageAgentChatDeleteOptions {
242
246
  action: 'delete';
243
247
  taskId: string;
248
+ /** Obrigatório (opcional na chamada se configurado via configureSdkMitra). */
249
+ projectId?: number | string;
244
250
  }
245
251
  type ManageAgentChatOptions = ManageAgentChatListOptions | ManageAgentChatRenameOptions | ManageAgentChatDeleteOptions;
246
252
  interface RenameAgentChatResult {
@@ -259,8 +265,10 @@ interface DeleteAgentChatResult {
259
265
  */
260
266
  type AgentTaskTransport = 'ws' | 'http';
261
267
  interface GetAgentTaskCreateOptions {
262
- /** Cria chat novo. A task é criada via REST no primeiro send(). */
268
+ /** Cria chat novo. A task é criada via BFF no primeiro send(). */
263
269
  create: true;
270
+ /** Obrigatório (opcional na chamada se configurado via configureSdkMitra). */
271
+ projectId?: number | string;
264
272
  /** Tipo/modelo do agente (de list_models). Default: 'ANTHROPIC_CLAUDE_OPUS'. */
265
273
  agentType?: AgentType;
266
274
  /** Nome/título do chat. */
@@ -278,6 +286,8 @@ interface GetAgentTaskCreateOptions {
278
286
  interface GetAgentTaskOpenOptions {
279
287
  /** Abre chat existente. */
280
288
  taskId: string;
289
+ /** Obrigatório (opcional na chamada se configurado via configureSdkMitra). */
290
+ projectId?: number | string;
281
291
  /** Transporte do prompt (default 'ws'). */
282
292
  transport?: AgentTaskTransport;
283
293
  }
@@ -408,32 +418,44 @@ interface DeviceAuthAgentCredentialResult {
408
418
  verificationUri: string;
409
419
  intervalSeconds: number;
410
420
  }
421
+ /**
422
+ * `projectId` é obrigatório em todas as actions (opcional na chamada se já
423
+ * configurado via configureSdkMitra) — define de qual app é a credencial.
424
+ */
411
425
  type ManageAgentCredentialOptions = {
412
426
  action: 'list_providers';
427
+ projectId?: number | string;
413
428
  } | {
414
429
  action: 'list_models';
430
+ projectId?: number | string;
415
431
  } | {
416
432
  action: 'save';
417
433
  target: AgentProvider;
418
434
  key: string;
435
+ projectId?: number | string;
419
436
  } | {
420
437
  action: 'remove';
421
438
  target: AgentProvider;
439
+ projectId?: number | string;
422
440
  } | {
423
441
  action: 'auth';
424
442
  target: AgentProvider;
443
+ projectId?: number | string;
425
444
  } | {
426
445
  action: 'connect';
427
446
  target: AgentProvider;
428
447
  code: string;
429
448
  state: string;
449
+ projectId?: number | string;
430
450
  } | {
431
451
  action: 'device_auth';
432
452
  target: AgentProvider;
453
+ projectId?: number | string;
433
454
  } | {
434
455
  action: 'device_poll';
435
456
  target: AgentProvider;
436
457
  deviceAuthId: string;
458
+ projectId?: number | string;
437
459
  };
438
460
 
439
461
  /**
@@ -526,11 +548,15 @@ declare function exchangeSsoCodeMitra(options: {
526
548
  }): Promise<LoginResponse>;
527
549
 
528
550
  /**
529
- * Mitra Interactions SDK — Agent Chat (copilot novo mundo)
551
+ * Mitra Interactions SDK — Agent Chat (via BFF)
552
+ *
553
+ * REST-first, tudo pela BFF no baseURL normal (`/agentAiShortcut/*`) — herda
554
+ * fetchWithRefresh e o CORS do BFF. Envelope `{ status, result }`; listas vêm
555
+ * desembrulhadas do Page (result é o array direto).
530
556
  *
531
- * REST-first: chats (tasks), histórico, credenciais e modelos são HTTP no
532
- * gateway `{origin}/copilot/api/v1`. SÓ o prompt é streaming — WebSocket por
533
- * task em `{origin}/copilot/ws/tasks/{taskId}?token=JWT`.
557
+ * SÓ o prompt é streaming: WebSocket por task em
558
+ * `wss://{origin}/copilot/ws/tasks/{taskId}?token=JWT` (não passa por
559
+ * preflight de CORS).
534
560
  *
535
561
  * API pública:
536
562
  * - manageAgentChatMitra({ action: 'list' | 'rename' | 'delete', ... })
@@ -538,10 +564,12 @@ declare function exchangeSsoCodeMitra(options: {
538
564
  */
539
565
 
540
566
  /**
541
- * Gerencia a coleção de chats do usuário — tudo HTTP:
542
- * - list → GET /copilot/api/v1/tasks (filtros: agentId, archived, search, page, size)
543
- * - rename → PATCH /copilot/api/v1/tasks/{id}
544
- * - delete → PATCH /copilot/api/v1/tasks/{id}/archive (arquiva; some da lista default)
567
+ * Gerencia a coleção de chats do usuário — tudo HTTP via BFF:
568
+ * - list → GET /agentAiShortcut/listChats (filtros: agentId, archived, search, page, size)
569
+ * - rename → POST /agentAiShortcut/renameChat
570
+ * - delete → POST /agentAiShortcut/deleteChat (arquiva; some da lista default)
571
+ *
572
+ * `projectId` é obrigatório (opcional na chamada se configurado no configureSdkMitra).
545
573
  *
546
574
  * @example
547
575
  * const chats = await manageAgentChatMitra({ action: 'list' });
@@ -554,7 +582,7 @@ declare function manageAgentChatMitra(options: ManageAgentChatRenameOptions): Pr
554
582
  declare function manageAgentChatMitra(options: ManageAgentChatDeleteOptions): Promise<DeleteAgentChatResult>;
555
583
  /**
556
584
  * Abre um handle de chat (session). Use:
557
- * - `{ create: true }` para iniciar um chat novo (a task é criada via REST no 1º send)
585
+ * - `{ create: true }` para iniciar um chat novo (a task é criada via BFF no 1º send)
558
586
  * - `{ taskId: 'X' }` para abrir um chat existente
559
587
  *
560
588
  * A session expõe histórico, streaming, fila, cancel e eventos. Se a
@@ -563,56 +591,71 @@ declare function manageAgentChatMitra(options: ManageAgentChatDeleteOptions): Pr
563
591
  declare function getAgentTaskMitra(options: GetAgentTaskOptions): AgentTaskSession;
564
592
 
565
593
  /**
566
- * Mitra Interactions SDK — Agent Credentials (copilot novo mundo)
594
+ * Mitra Interactions SDK — Agent Credentials (via BFF)
595
+ *
596
+ * Função ÚNICA `manageAgentCredentialMitra`, toda HTTP pela BFF no baseURL
597
+ * normal (`/agentAiShortcut/*`) — herda fetchWithRefresh e o CORS do BFF:
598
+ * - list_providers → GET /agentAiShortcut/listProviders?projectId=
599
+ * - list_models → GET /agentAiShortcut/listModels?projectId=
600
+ * - save → POST /agentAiShortcut/saveCredential {projectId, provider, key}
601
+ * - remove → POST /agentAiShortcut/removeCredential {projectId, provider}
602
+ * - auth → POST /agentAiShortcut/oauthStart {projectId, provider}
603
+ * - connect → POST /agentAiShortcut/oauthExchange {projectId, provider, code, state}
604
+ * - device_auth → POST /agentAiShortcut/deviceStart {projectId, provider}
605
+ * - device_poll → POST /agentAiShortcut/devicePoll {projectId, provider, deviceAuthId}
567
606
  *
568
- * Função ÚNICA `manageAgentCredentialMitra`, toda HTTP no gateway
569
- * `{origin}/copilot/api/v1`:
570
- * - list_providers → GET /credentials
571
- * - list_models → GET /models
572
- * - save → PUT /credentials/{provider}/api-key
573
- * - remove → DELETE /credentials/{provider}
574
- * - auth → POST /oauth/start (OAuth: { authUrl, state })
575
- * - connect → POST /oauth/exchange (OAuth: { code, state })
576
- * - device_auth → POST /credentials/{provider}/device-authorizations
577
- * - device_poll → POST /credentials/{provider}/device-authorizations/{id}/poll
607
+ * `projectId` é obrigatório (opcional na chamada se configurado no
608
+ * configureSdkMitra): é ele que define de qual app é a credencial — o BFF
609
+ * resolve projectId → appId e cunha o token de app.
578
610
  *
579
- * SEGURANÇA: tokens/keys nunca voltam crus — o backend devolve só status,
580
- * e-mail da conta e a key mascarada.
611
+ * As respostas vêm no envelope BFF `{ status, result }`; a SDK devolve o
612
+ * `result` cru (mesmos campos que o copilot retorna hoje, nada renomeado).
613
+ *
614
+ * SEGURANÇA: tokens/keys nunca voltam crus — só status, e-mail da conta e a
615
+ * key mascarada.
581
616
  */
582
617
 
583
618
  declare function manageAgentCredentialMitra(options: {
584
619
  action: 'list_providers';
620
+ projectId?: number | string;
585
621
  }): Promise<ListAgentProvidersResult>;
586
622
  declare function manageAgentCredentialMitra(options: {
587
623
  action: 'list_models';
624
+ projectId?: number | string;
588
625
  }): Promise<ListAgentModelsResult>;
589
626
  declare function manageAgentCredentialMitra(options: {
590
627
  action: 'save';
591
628
  target: AgentProvider;
592
629
  key: string;
630
+ projectId?: number | string;
593
631
  }): Promise<void>;
594
632
  declare function manageAgentCredentialMitra(options: {
595
633
  action: 'remove';
596
634
  target: AgentProvider;
635
+ projectId?: number | string;
597
636
  }): Promise<void>;
598
637
  declare function manageAgentCredentialMitra(options: {
599
638
  action: 'auth';
600
639
  target: AgentProvider;
640
+ projectId?: number | string;
601
641
  }): Promise<AuthAgentCredentialResult>;
602
642
  declare function manageAgentCredentialMitra(options: {
603
643
  action: 'connect';
604
644
  target: AgentProvider;
605
645
  code: string;
606
646
  state: string;
647
+ projectId?: number | string;
607
648
  }): Promise<ConnectAgentCredentialResult>;
608
649
  declare function manageAgentCredentialMitra(options: {
609
650
  action: 'device_auth';
610
651
  target: AgentProvider;
652
+ projectId?: number | string;
611
653
  }): Promise<DeviceAuthAgentCredentialResult>;
612
654
  declare function manageAgentCredentialMitra(options: {
613
655
  action: 'device_poll';
614
656
  target: AgentProvider;
615
657
  deviceAuthId: string;
658
+ projectId?: number | string;
616
659
  }): Promise<ConnectAgentCredentialResult>;
617
660
 
618
661
  /**