mitra-interactions-sdk 1.0.60-beta.33 → 1.0.60-beta.34

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
@@ -248,7 +248,7 @@ const result2 = await listRecordsMitra({
248
248
 
249
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
- 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).
251
+ Precisa de `token` e `baseURL` configurados (o login já deixa pronto). O transporte do prompt aceita `transport: 'ws' | 'http'` — `'ws'` é o default; `'http'` é **funcional**: `POST /copilot/api/v1/tasks/{id}/inputs` + SSE em `/events` via fetch, com a MESMA paridade de eventos do WS (pra ambientes onde WebSocket não rola, ex.: serverless).
252
252
 
253
253
  ### Gerenciar os chats — `manageAgentChatMitra`
254
254
 
@@ -303,7 +303,7 @@ await existing.loadHistory({ limit: 50 });
303
303
 
304
304
  #### Métodos
305
305
 
306
- - `send(prompt)` → `void` — dispara um turno (WS `message`). Se já está streamando, **enfileira** (FIFO, máx 10).
306
+ - `send(prompt, { reasoningEffort?, agentType? })` → `void` — dispara um turno (`message` no WS ou POST `/inputs`). Se já está streamando, **enfileira** (FIFO, máx 10; as opções viajam com o item). `reasoningEffort`: intensidade desta mensagem — valores válidos vêm das `reasoningOptions` do modelo em `list_models` (**nunca invente**; fora do registro = `INVALID_REASONING_EFFORT`); herda o default de `getAgentTaskMitra({ create, reasoningEffort })` quando omitido. `agentType`: troca o modelo nesta mensagem — **só dentro do mesmo harness** (Claude↔Codex em conversa iniciada = `HARNESS_SWITCH`).
307
307
  - `cancel()` → `Promise<void>` — interrompe o turno atual (WS `interrupt`, safety net de 10s).
308
308
  - `respondApproval(approved)` → `void` — responde um pedido de aprovação do agente (WS `approval_response`).
309
309
  - `loadHistory({ limit? })` → `Promise<AgentTimelineItem[]>` — histórico persistido via REST, já no formato canônico da timeline (renderizou o streaming, renderizou o histórico).
@@ -344,7 +344,9 @@ const { providers } = await manageAgentCredentialMitra({ action: 'list_providers
344
344
 
345
345
  // Modelos selecionáveis → use o agentType em getAgentTaskMitra
346
346
  const { models } = await manageAgentCredentialMitra({ action: 'list_models' });
347
- // AgentModel[]: { model, name, provider, agentType }
347
+ // AgentModel[]: { model, name, provider, agentType, reasoningOptions }
348
+ // reasoningOptions = registro das intensidades válidas por modelo (variam por
349
+ // harness) — monte o seletor de reasoning a partir DAQUI, nunca hardcode
348
350
 
349
351
  // API key
350
352
  await manageAgentCredentialMitra({ action: 'save', target: 'openai', key: 'sk-...' });
@@ -359,6 +361,30 @@ const { authUrl, state } = await manageAgentCredentialMitra({ action: 'auth', ta
359
361
  const { connected, email } = await manageAgentCredentialMitra({ action: 'connect', target: 'anthropic', code, state });
360
362
  ```
361
363
 
364
+ ### Connections do app — `manageAgentConnectionMitra`
365
+
366
+ Credencial de agente **compartilhada do app** (tenant+app) — espelho do management de credencial de user, apontando um `connectionId`. Pra sistemas montarem a tela de auth do agente. REST direto no copilot (`{origin}/copilot/api/v1/connections`).
367
+
368
+ Chamável com **token de user** (app-scoped, roles EDIT/OWNER/ADMIN) **ou** com **chave de SF** (`CONNECTION_READ`/`CONNECTION_WRITE`) — o caminho por chave é aditivo. A credencial nunca sai do servidor.
369
+
370
+ ```typescript
371
+ import { manageAgentConnectionMitra } from 'mitra-interactions-sdk';
372
+
373
+ const { connections } = await manageAgentConnectionMitra({ action: 'list' });
374
+ const conn = await manageAgentConnectionMitra({ action: 'create', provider: 'anthropic', name: 'shared' });
375
+
376
+ // API key
377
+ await manageAgentConnectionMitra({ action: 'save', connectionId: conn.id, key: 'sk-...' });
378
+
379
+ // OAuth (anthropic)
380
+ const { authUrl, state } = await manageAgentConnectionMitra({ action: 'auth', connectionId: conn.id });
381
+ await manageAgentConnectionMitra({ action: 'connect', connectionId: conn.id, code, state });
382
+
383
+ // Device flow (openai)
384
+ const { deviceAuthId, userCode, verificationUri } = await manageAgentConnectionMitra({ action: 'device_auth', connectionId: conn.id });
385
+ await manageAgentConnectionMitra({ action: 'device_poll', connectionId: conn.id, deviceAuthId });
386
+ ```
387
+
362
388
  Device flow (só OpenAI) — mostre `userCode` + `verificationUri` e faça polling:
363
389
 
364
390
  ```typescript
package/dist/index.d.mts CHANGED
@@ -276,9 +276,9 @@ interface DeleteAgentChatResult {
276
276
  deleted: boolean;
277
277
  }
278
278
  /**
279
- * Transporte do prompt. 'ws' (default) = streaming via WebSocket.
280
- * 'http' = reservado pra ambientes serverless — o backend ainda não expõe
281
- * o prompt por HTTP; hoje lança erro claro.
279
+ * Transporte do prompt. 'ws' (default) = streaming via WebSocket por task.
280
+ * 'http' = POST /inputs + SSE /events via fetch — mesma paridade de eventos,
281
+ * pra ambientes onde WebSocket não rola (ex.: serverless).
282
282
  */
283
283
  type AgentTaskTransport = 'ws' | 'http';
284
284
  interface GetAgentTaskCreateOptions {
@@ -288,6 +288,12 @@ interface GetAgentTaskCreateOptions {
288
288
  projectId?: number | string;
289
289
  /** Tipo/modelo do agente (de list_models). Default: 'ANTHROPIC_CLAUDE_OPUS'. */
290
290
  agentType?: AgentType;
291
+ /**
292
+ * Default de intensidade de reasoning da session — o send() herda quando a
293
+ * mensagem não sobrescreve. Valores válidos: reasoningOptions do modelo em
294
+ * list_models (nunca invente).
295
+ */
296
+ reasoningEffort?: string;
291
297
  /** Nome/título do chat. */
292
298
  name?: string;
293
299
  /**
@@ -318,10 +324,26 @@ interface QueuedItem {
318
324
  seq: number;
319
325
  createdAt: number;
320
326
  status: 'pending' | 'sending';
327
+ /** Opções da mensagem preservadas na fila (enviadas quando o item despachar). */
328
+ reasoningEffort?: string;
329
+ agentType?: AgentType;
321
330
  }
322
331
  interface SendOptions {
323
- /** Reservado (o modelo/agentType é fixado na criação da task). */
324
- _reserved?: never;
332
+ /**
333
+ * Intensidade de reasoning DESTA mensagem. Valores válidos vêm SEMPRE do
334
+ * registro `reasoningOptions` do modelo em list_models (variam por harness) —
335
+ * nunca invente: valor fora do registro é recusado pelo copilot
336
+ * (INVALID_REASONING_EFFORT). Sobrescreve o default da session; a SDK envia
337
+ * em maiúsculo. Omitido = herda o default da abertura (ou o do backend).
338
+ */
339
+ reasoningEffort?: string;
340
+ /**
341
+ * Troca o modelo NESTA mensagem (value de list_models). O copilot reinicia a
342
+ * sessão retomando o mesmo chat com os parâmetros novos. Só dentro do MESMO
343
+ * harness — trocar Claude↔Codex numa conversa iniciada é recusado
344
+ * (HARNESS_SWITCH).
345
+ */
346
+ agentType?: AgentType;
325
347
  }
326
348
  interface AgentDeltaEvent {
327
349
  delta: string;
@@ -416,6 +438,12 @@ interface AgentModel {
416
438
  name: string;
417
439
  provider: string;
418
440
  agentType: AgentType;
441
+ /**
442
+ * Registro das intensidades de reasoning válidas pra este modelo (variam por
443
+ * harness — ex.: claude low..max; codex none..ultra). A UI monta o seletor a
444
+ * partir DAQUI; valor fora do registro é recusado pelo copilot.
445
+ */
446
+ reasoningOptions?: string[];
419
447
  }
420
448
  interface ListAgentProvidersResult {
421
449
  providers: AgentCredentialStatus[];
@@ -476,6 +504,43 @@ type ManageAgentCredentialOptions = {
476
504
  deviceAuthId: string;
477
505
  projectId?: number | string;
478
506
  };
507
+ /** Connection do app (shape do copilot; campos extras passam intactos). */
508
+ interface AgentConnection {
509
+ id: string;
510
+ provider?: string;
511
+ name?: string;
512
+ connected?: boolean;
513
+ [key: string]: unknown;
514
+ }
515
+ type ManageAgentConnectionOptions = {
516
+ action: 'list';
517
+ } | {
518
+ action: 'create';
519
+ provider: AgentProvider;
520
+ name?: string;
521
+ } | {
522
+ action: 'save';
523
+ connectionId: string;
524
+ key: string;
525
+ } | {
526
+ action: 'auth';
527
+ connectionId: string;
528
+ } | {
529
+ action: 'connect';
530
+ connectionId: string;
531
+ code: string;
532
+ state: string;
533
+ } | {
534
+ action: 'device_auth';
535
+ connectionId: string;
536
+ } | {
537
+ action: 'device_poll';
538
+ connectionId: string;
539
+ deviceAuthId: string;
540
+ };
541
+ interface ListAgentConnectionsResult {
542
+ connections: AgentConnection[];
543
+ }
479
544
 
480
545
  /**
481
546
  * Mitra Interactions SDK - Instance
@@ -681,6 +746,66 @@ declare function manageAgentCredentialMitra(options: {
681
746
  projectId?: number | string;
682
747
  }): Promise<ConnectAgentCredentialResult>;
683
748
 
749
+ /**
750
+ * Mitra Interactions SDK — Agent Connections
751
+ *
752
+ * Management de credencial de agente COMPARTILHADA (connection do app,
753
+ * tenant+app) — espelho do management de credencial de user
754
+ * (agent-credentials.ts), apontando um connectionId. Pra sistemas montarem
755
+ * a tela de auth do agente.
756
+ *
757
+ * REST direto no copilot ({origin}/copilot/api/v1/connections):
758
+ * - list → GET /connections
759
+ * - create → POST /connections
760
+ * - save → PUT /connections/{id}/api-key
761
+ * - auth → POST /connections/{id}/oauth/start
762
+ * - connect → POST /connections/{id}/oauth/exchange
763
+ * - device_auth → POST /connections/{id}/device-authorizations
764
+ * - device_poll → POST /connections/{id}/device-authorizations/{deviceAuthId}/poll
765
+ *
766
+ * Auth: Authorization Bearer com o token da config — funciona com token de
767
+ * user (app-scoped, roles EDIT/OWNER/ADMIN) E com chave de SF
768
+ * (CONNECTION_READ/WRITE). O caminho por chave é aditivo: nada aqui exige
769
+ * tipo específico de credencial — o servidor decide. Só sessão de CONSOLE
770
+ * (JWT token_use=session, sem app_id) é barrada no client, com causa clara.
771
+ *
772
+ * SEGURANÇA: a credencial nunca sai do servidor — as respostas trazem só
773
+ * status/metadados da connection.
774
+ */
775
+
776
+ declare function manageAgentConnectionMitra(options: {
777
+ action: 'list';
778
+ }): Promise<ListAgentConnectionsResult>;
779
+ declare function manageAgentConnectionMitra(options: {
780
+ action: 'create';
781
+ provider: 'anthropic' | 'openai';
782
+ name?: string;
783
+ }): Promise<AgentConnection>;
784
+ declare function manageAgentConnectionMitra(options: {
785
+ action: 'save';
786
+ connectionId: string;
787
+ key: string;
788
+ }): Promise<void>;
789
+ declare function manageAgentConnectionMitra(options: {
790
+ action: 'auth';
791
+ connectionId: string;
792
+ }): Promise<AuthAgentCredentialResult>;
793
+ declare function manageAgentConnectionMitra(options: {
794
+ action: 'connect';
795
+ connectionId: string;
796
+ code: string;
797
+ state: string;
798
+ }): Promise<ConnectAgentCredentialResult>;
799
+ declare function manageAgentConnectionMitra(options: {
800
+ action: 'device_auth';
801
+ connectionId: string;
802
+ }): Promise<DeviceAuthAgentCredentialResult>;
803
+ declare function manageAgentConnectionMitra(options: {
804
+ action: 'device_poll';
805
+ connectionId: string;
806
+ deviceAuthId: string;
807
+ }): Promise<ConnectAgentCredentialResult>;
808
+
684
809
  /**
685
810
  * Mitra Interactions SDK - Services
686
811
  */
@@ -736,4 +861,4 @@ declare function patchRecordMitra(options: PatchRecordOptions): Promise<Record<s
736
861
  declare function deleteRecordMitra(options: DeleteRecordOptions): Promise<void>;
737
862
  declare function createRecordsBatchMitra(options: CreateRecordsBatchOptions): Promise<Record<string, any>[]>;
738
863
 
739
- export { type AgentChat, type AgentCredentialStatus, type AgentDeltaEvent, type AgentErrorEvent, type AgentMessage, type AgentModel, type AgentProvider, type AgentQueueChangeEvent, type AgentRawEvent, type AgentStatusChangeEvent, type AgentTaskCreatedEvent, type AgentTaskEventMap, type AgentTaskEventName, type AgentTaskSession, type AgentTaskStatus, type AgentTaskTransport, type AgentTimelineItem, type AgentToolEvent, type AgentTurnEndEvent, type AgentType, type AuthAgentCredentialResult, type CallIntegrationOptions, type CallIntegrationResponse, type ChatManageAction, type ConnectAgentCredentialResult, type CreateRecordOptions, type CreateRecordsBatchOptions, type CredentialAction, type DeleteAgentChatResult, type DeleteRecordOptions, type DeviceAuthAgentCredentialResult, type ExecutePublicServerFunctionAsyncResponse, type ExecutePublicServerFunctionOptions, type ExecutePublicServerFunctionResponse, type ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type GetAgentTaskCreateOptions, type GetAgentTaskOpenOptions, type GetAgentTaskOptions, type GetPublicServerFunctionExecutionOptions, type GetPublicServerFunctionExecutionResponse, type GetRecordOptions, type IntegrationResponse, type ListAgentModelsResult, type ListAgentProvidersResult, type ListIntegrationsOptions, type ListRecordsOptions, type ListRecordsResponse, type LoginOptions, type LoginResponse, type ManageAgentChatDeleteOptions, type ManageAgentChatListOptions, type ManageAgentChatOptions, type ManageAgentChatRenameOptions, type ManageAgentCredentialOptions, type MitraConfig, type MitraInstance, type PatchRecordOptions, type QueuedItem, type RenameAgentChatResult, type SendOptions, type StopServerFunctionExecutionOptions, type StopServerFunctionExecutionResponse, type UpdateRecordOptions, callIntegrationMitra, configureSdkMitra, createMitraInstance, createRecordMitra, createRecordsBatchMitra, deleteRecordMitra, exchangeSsoCodeMitra, executePublicServerFunctionAsyncMitra, executePublicServerFunctionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getAgentTaskMitra, getConfig, getPublicServerFunctionExecutionMitra, getRecordMitra, listIntegrationsMitra, listRecordsMitra, loginMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, manageAgentChatMitra, manageAgentCredentialMitra, patchRecordMitra, refreshTokenSilently, resolveProjectId, stopServerFunctionExecutionMitra, updateRecordMitra };
864
+ export { type AgentChat, type AgentConnection, type AgentCredentialStatus, type AgentDeltaEvent, type AgentErrorEvent, type AgentMessage, type AgentModel, type AgentProvider, type AgentQueueChangeEvent, type AgentRawEvent, type AgentStatusChangeEvent, type AgentTaskCreatedEvent, type AgentTaskEventMap, type AgentTaskEventName, type AgentTaskSession, type AgentTaskStatus, type AgentTaskTransport, type AgentTimelineItem, type AgentToolEvent, type AgentTurnEndEvent, type AgentType, type AuthAgentCredentialResult, type CallIntegrationOptions, type CallIntegrationResponse, type ChatManageAction, type ConnectAgentCredentialResult, type CreateRecordOptions, type CreateRecordsBatchOptions, type CredentialAction, type DeleteAgentChatResult, type DeleteRecordOptions, type DeviceAuthAgentCredentialResult, type ExecutePublicServerFunctionAsyncResponse, type ExecutePublicServerFunctionOptions, type ExecutePublicServerFunctionResponse, type ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type GetAgentTaskCreateOptions, type GetAgentTaskOpenOptions, type GetAgentTaskOptions, type GetPublicServerFunctionExecutionOptions, type GetPublicServerFunctionExecutionResponse, type GetRecordOptions, type IntegrationResponse, type ListAgentConnectionsResult, type ListAgentModelsResult, type ListAgentProvidersResult, type ListIntegrationsOptions, type ListRecordsOptions, type ListRecordsResponse, type LoginOptions, type LoginResponse, type ManageAgentChatDeleteOptions, type ManageAgentChatListOptions, type ManageAgentChatOptions, type ManageAgentChatRenameOptions, type ManageAgentConnectionOptions, type ManageAgentCredentialOptions, type MitraConfig, type MitraInstance, type PatchRecordOptions, type QueuedItem, type RenameAgentChatResult, type SendOptions, type StopServerFunctionExecutionOptions, type StopServerFunctionExecutionResponse, type UpdateRecordOptions, callIntegrationMitra, configureSdkMitra, createMitraInstance, createRecordMitra, createRecordsBatchMitra, deleteRecordMitra, exchangeSsoCodeMitra, executePublicServerFunctionAsyncMitra, executePublicServerFunctionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getAgentTaskMitra, getConfig, getPublicServerFunctionExecutionMitra, getRecordMitra, listIntegrationsMitra, listRecordsMitra, loginMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, manageAgentChatMitra, manageAgentConnectionMitra, manageAgentCredentialMitra, patchRecordMitra, refreshTokenSilently, resolveProjectId, stopServerFunctionExecutionMitra, updateRecordMitra };
package/dist/index.d.ts CHANGED
@@ -276,9 +276,9 @@ interface DeleteAgentChatResult {
276
276
  deleted: boolean;
277
277
  }
278
278
  /**
279
- * Transporte do prompt. 'ws' (default) = streaming via WebSocket.
280
- * 'http' = reservado pra ambientes serverless — o backend ainda não expõe
281
- * o prompt por HTTP; hoje lança erro claro.
279
+ * Transporte do prompt. 'ws' (default) = streaming via WebSocket por task.
280
+ * 'http' = POST /inputs + SSE /events via fetch — mesma paridade de eventos,
281
+ * pra ambientes onde WebSocket não rola (ex.: serverless).
282
282
  */
283
283
  type AgentTaskTransport = 'ws' | 'http';
284
284
  interface GetAgentTaskCreateOptions {
@@ -288,6 +288,12 @@ interface GetAgentTaskCreateOptions {
288
288
  projectId?: number | string;
289
289
  /** Tipo/modelo do agente (de list_models). Default: 'ANTHROPIC_CLAUDE_OPUS'. */
290
290
  agentType?: AgentType;
291
+ /**
292
+ * Default de intensidade de reasoning da session — o send() herda quando a
293
+ * mensagem não sobrescreve. Valores válidos: reasoningOptions do modelo em
294
+ * list_models (nunca invente).
295
+ */
296
+ reasoningEffort?: string;
291
297
  /** Nome/título do chat. */
292
298
  name?: string;
293
299
  /**
@@ -318,10 +324,26 @@ interface QueuedItem {
318
324
  seq: number;
319
325
  createdAt: number;
320
326
  status: 'pending' | 'sending';
327
+ /** Opções da mensagem preservadas na fila (enviadas quando o item despachar). */
328
+ reasoningEffort?: string;
329
+ agentType?: AgentType;
321
330
  }
322
331
  interface SendOptions {
323
- /** Reservado (o modelo/agentType é fixado na criação da task). */
324
- _reserved?: never;
332
+ /**
333
+ * Intensidade de reasoning DESTA mensagem. Valores válidos vêm SEMPRE do
334
+ * registro `reasoningOptions` do modelo em list_models (variam por harness) —
335
+ * nunca invente: valor fora do registro é recusado pelo copilot
336
+ * (INVALID_REASONING_EFFORT). Sobrescreve o default da session; a SDK envia
337
+ * em maiúsculo. Omitido = herda o default da abertura (ou o do backend).
338
+ */
339
+ reasoningEffort?: string;
340
+ /**
341
+ * Troca o modelo NESTA mensagem (value de list_models). O copilot reinicia a
342
+ * sessão retomando o mesmo chat com os parâmetros novos. Só dentro do MESMO
343
+ * harness — trocar Claude↔Codex numa conversa iniciada é recusado
344
+ * (HARNESS_SWITCH).
345
+ */
346
+ agentType?: AgentType;
325
347
  }
326
348
  interface AgentDeltaEvent {
327
349
  delta: string;
@@ -416,6 +438,12 @@ interface AgentModel {
416
438
  name: string;
417
439
  provider: string;
418
440
  agentType: AgentType;
441
+ /**
442
+ * Registro das intensidades de reasoning válidas pra este modelo (variam por
443
+ * harness — ex.: claude low..max; codex none..ultra). A UI monta o seletor a
444
+ * partir DAQUI; valor fora do registro é recusado pelo copilot.
445
+ */
446
+ reasoningOptions?: string[];
419
447
  }
420
448
  interface ListAgentProvidersResult {
421
449
  providers: AgentCredentialStatus[];
@@ -476,6 +504,43 @@ type ManageAgentCredentialOptions = {
476
504
  deviceAuthId: string;
477
505
  projectId?: number | string;
478
506
  };
507
+ /** Connection do app (shape do copilot; campos extras passam intactos). */
508
+ interface AgentConnection {
509
+ id: string;
510
+ provider?: string;
511
+ name?: string;
512
+ connected?: boolean;
513
+ [key: string]: unknown;
514
+ }
515
+ type ManageAgentConnectionOptions = {
516
+ action: 'list';
517
+ } | {
518
+ action: 'create';
519
+ provider: AgentProvider;
520
+ name?: string;
521
+ } | {
522
+ action: 'save';
523
+ connectionId: string;
524
+ key: string;
525
+ } | {
526
+ action: 'auth';
527
+ connectionId: string;
528
+ } | {
529
+ action: 'connect';
530
+ connectionId: string;
531
+ code: string;
532
+ state: string;
533
+ } | {
534
+ action: 'device_auth';
535
+ connectionId: string;
536
+ } | {
537
+ action: 'device_poll';
538
+ connectionId: string;
539
+ deviceAuthId: string;
540
+ };
541
+ interface ListAgentConnectionsResult {
542
+ connections: AgentConnection[];
543
+ }
479
544
 
480
545
  /**
481
546
  * Mitra Interactions SDK - Instance
@@ -681,6 +746,66 @@ declare function manageAgentCredentialMitra(options: {
681
746
  projectId?: number | string;
682
747
  }): Promise<ConnectAgentCredentialResult>;
683
748
 
749
+ /**
750
+ * Mitra Interactions SDK — Agent Connections
751
+ *
752
+ * Management de credencial de agente COMPARTILHADA (connection do app,
753
+ * tenant+app) — espelho do management de credencial de user
754
+ * (agent-credentials.ts), apontando um connectionId. Pra sistemas montarem
755
+ * a tela de auth do agente.
756
+ *
757
+ * REST direto no copilot ({origin}/copilot/api/v1/connections):
758
+ * - list → GET /connections
759
+ * - create → POST /connections
760
+ * - save → PUT /connections/{id}/api-key
761
+ * - auth → POST /connections/{id}/oauth/start
762
+ * - connect → POST /connections/{id}/oauth/exchange
763
+ * - device_auth → POST /connections/{id}/device-authorizations
764
+ * - device_poll → POST /connections/{id}/device-authorizations/{deviceAuthId}/poll
765
+ *
766
+ * Auth: Authorization Bearer com o token da config — funciona com token de
767
+ * user (app-scoped, roles EDIT/OWNER/ADMIN) E com chave de SF
768
+ * (CONNECTION_READ/WRITE). O caminho por chave é aditivo: nada aqui exige
769
+ * tipo específico de credencial — o servidor decide. Só sessão de CONSOLE
770
+ * (JWT token_use=session, sem app_id) é barrada no client, com causa clara.
771
+ *
772
+ * SEGURANÇA: a credencial nunca sai do servidor — as respostas trazem só
773
+ * status/metadados da connection.
774
+ */
775
+
776
+ declare function manageAgentConnectionMitra(options: {
777
+ action: 'list';
778
+ }): Promise<ListAgentConnectionsResult>;
779
+ declare function manageAgentConnectionMitra(options: {
780
+ action: 'create';
781
+ provider: 'anthropic' | 'openai';
782
+ name?: string;
783
+ }): Promise<AgentConnection>;
784
+ declare function manageAgentConnectionMitra(options: {
785
+ action: 'save';
786
+ connectionId: string;
787
+ key: string;
788
+ }): Promise<void>;
789
+ declare function manageAgentConnectionMitra(options: {
790
+ action: 'auth';
791
+ connectionId: string;
792
+ }): Promise<AuthAgentCredentialResult>;
793
+ declare function manageAgentConnectionMitra(options: {
794
+ action: 'connect';
795
+ connectionId: string;
796
+ code: string;
797
+ state: string;
798
+ }): Promise<ConnectAgentCredentialResult>;
799
+ declare function manageAgentConnectionMitra(options: {
800
+ action: 'device_auth';
801
+ connectionId: string;
802
+ }): Promise<DeviceAuthAgentCredentialResult>;
803
+ declare function manageAgentConnectionMitra(options: {
804
+ action: 'device_poll';
805
+ connectionId: string;
806
+ deviceAuthId: string;
807
+ }): Promise<ConnectAgentCredentialResult>;
808
+
684
809
  /**
685
810
  * Mitra Interactions SDK - Services
686
811
  */
@@ -736,4 +861,4 @@ declare function patchRecordMitra(options: PatchRecordOptions): Promise<Record<s
736
861
  declare function deleteRecordMitra(options: DeleteRecordOptions): Promise<void>;
737
862
  declare function createRecordsBatchMitra(options: CreateRecordsBatchOptions): Promise<Record<string, any>[]>;
738
863
 
739
- export { type AgentChat, type AgentCredentialStatus, type AgentDeltaEvent, type AgentErrorEvent, type AgentMessage, type AgentModel, type AgentProvider, type AgentQueueChangeEvent, type AgentRawEvent, type AgentStatusChangeEvent, type AgentTaskCreatedEvent, type AgentTaskEventMap, type AgentTaskEventName, type AgentTaskSession, type AgentTaskStatus, type AgentTaskTransport, type AgentTimelineItem, type AgentToolEvent, type AgentTurnEndEvent, type AgentType, type AuthAgentCredentialResult, type CallIntegrationOptions, type CallIntegrationResponse, type ChatManageAction, type ConnectAgentCredentialResult, type CreateRecordOptions, type CreateRecordsBatchOptions, type CredentialAction, type DeleteAgentChatResult, type DeleteRecordOptions, type DeviceAuthAgentCredentialResult, type ExecutePublicServerFunctionAsyncResponse, type ExecutePublicServerFunctionOptions, type ExecutePublicServerFunctionResponse, type ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type GetAgentTaskCreateOptions, type GetAgentTaskOpenOptions, type GetAgentTaskOptions, type GetPublicServerFunctionExecutionOptions, type GetPublicServerFunctionExecutionResponse, type GetRecordOptions, type IntegrationResponse, type ListAgentModelsResult, type ListAgentProvidersResult, type ListIntegrationsOptions, type ListRecordsOptions, type ListRecordsResponse, type LoginOptions, type LoginResponse, type ManageAgentChatDeleteOptions, type ManageAgentChatListOptions, type ManageAgentChatOptions, type ManageAgentChatRenameOptions, type ManageAgentCredentialOptions, type MitraConfig, type MitraInstance, type PatchRecordOptions, type QueuedItem, type RenameAgentChatResult, type SendOptions, type StopServerFunctionExecutionOptions, type StopServerFunctionExecutionResponse, type UpdateRecordOptions, callIntegrationMitra, configureSdkMitra, createMitraInstance, createRecordMitra, createRecordsBatchMitra, deleteRecordMitra, exchangeSsoCodeMitra, executePublicServerFunctionAsyncMitra, executePublicServerFunctionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getAgentTaskMitra, getConfig, getPublicServerFunctionExecutionMitra, getRecordMitra, listIntegrationsMitra, listRecordsMitra, loginMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, manageAgentChatMitra, manageAgentCredentialMitra, patchRecordMitra, refreshTokenSilently, resolveProjectId, stopServerFunctionExecutionMitra, updateRecordMitra };
864
+ export { type AgentChat, type AgentConnection, type AgentCredentialStatus, type AgentDeltaEvent, type AgentErrorEvent, type AgentMessage, type AgentModel, type AgentProvider, type AgentQueueChangeEvent, type AgentRawEvent, type AgentStatusChangeEvent, type AgentTaskCreatedEvent, type AgentTaskEventMap, type AgentTaskEventName, type AgentTaskSession, type AgentTaskStatus, type AgentTaskTransport, type AgentTimelineItem, type AgentToolEvent, type AgentTurnEndEvent, type AgentType, type AuthAgentCredentialResult, type CallIntegrationOptions, type CallIntegrationResponse, type ChatManageAction, type ConnectAgentCredentialResult, type CreateRecordOptions, type CreateRecordsBatchOptions, type CredentialAction, type DeleteAgentChatResult, type DeleteRecordOptions, type DeviceAuthAgentCredentialResult, type ExecutePublicServerFunctionAsyncResponse, type ExecutePublicServerFunctionOptions, type ExecutePublicServerFunctionResponse, type ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type GetAgentTaskCreateOptions, type GetAgentTaskOpenOptions, type GetAgentTaskOptions, type GetPublicServerFunctionExecutionOptions, type GetPublicServerFunctionExecutionResponse, type GetRecordOptions, type IntegrationResponse, type ListAgentConnectionsResult, type ListAgentModelsResult, type ListAgentProvidersResult, type ListIntegrationsOptions, type ListRecordsOptions, type ListRecordsResponse, type LoginOptions, type LoginResponse, type ManageAgentChatDeleteOptions, type ManageAgentChatListOptions, type ManageAgentChatOptions, type ManageAgentChatRenameOptions, type ManageAgentConnectionOptions, type ManageAgentCredentialOptions, type MitraConfig, type MitraInstance, type PatchRecordOptions, type QueuedItem, type RenameAgentChatResult, type SendOptions, type StopServerFunctionExecutionOptions, type StopServerFunctionExecutionResponse, type UpdateRecordOptions, callIntegrationMitra, configureSdkMitra, createMitraInstance, createRecordMitra, createRecordsBatchMitra, deleteRecordMitra, exchangeSsoCodeMitra, executePublicServerFunctionAsyncMitra, executePublicServerFunctionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getAgentTaskMitra, getConfig, getPublicServerFunctionExecutionMitra, getRecordMitra, listIntegrationsMitra, listRecordsMitra, loginMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, manageAgentChatMitra, manageAgentConnectionMitra, manageAgentCredentialMitra, patchRecordMitra, refreshTokenSilently, resolveProjectId, stopServerFunctionExecutionMitra, updateRecordMitra };