mitra-interactions-sdk 1.0.60-beta.25 → 1.0.60-beta.27

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**: credenciais e modelos vão pela **BFF no `baseURL` normal** (`/agentAiShortcut/*` — herdam `fetchWithRefresh` e CORS); chats e histórico via `{origin}/copilot/api/v1`. **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).
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,21 +265,19 @@ 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';
277
277
 
278
- // Chat novo — taskId é preenchido no primeiro send() (evento taskCreated)
279
- const session = getAgentTaskMitra({ create: true, agentType: 'ANTHROPIC_CLAUDE_OPUS', name: 'Meu chat' });
280
-
281
- // Chat com um agente business (system prompt + SFs do agente; token escopado)
282
- const sales = getAgentTaskMitra({ create: true, agentId: 'uuid-do-agente' });
278
+ // Chat novo — SEMPRE com agentId (sessão sem agente não executa nada).
279
+ // taskId é preenchido no primeiro send() (evento taskCreated)
280
+ const session = getAgentTaskMitra({ create: true, agentId: 'uuid-do-agente', agentType: 'ANTHROPIC_CLAUDE_OPUS', name: 'Meu chat' });
283
281
 
284
282
  // Chat existente
285
283
  const existing = getAgentTaskMitra({ taskId: 'uuid-da-task' });
@@ -289,7 +287,7 @@ await existing.loadHistory({ limit: 50 });
289
287
  `getAgentTaskMitra({ create: true, agentType?, name?, agentId?, transport? })` ou `getAgentTaskMitra({ taskId, transport? })`.
290
288
 
291
289
  - `agentType` vem de `manageAgentCredentialMitra({ action: 'list_models' })` — ex.: `'ANTHROPIC_CLAUDE_OPUS'`, `'OPENAI_GPT5'`, `'GOOGLE_GEMINI_PRO'`. Default: `'ANTHROPIC_CLAUDE_OPUS'`.
292
- - **`agentId`**: id de um agente business (CRUD via `mitra-sdk`: `listAgentsMitra` e família). A sessão sobe com o system prompt do agente e um token escopado — as tools enxergam só as Server Functions dele. Sem `agentId`, é o chat de desenvolvimento.
290
+ - **`agentId`**: id de um agente business (CRUD via `mitra-sdk`: `listAgentsMitra` e família). A sessão sobe com o system prompt do agente e um token escopado — as tools enxergam só as Server Functions dele. **Sem `agentId`: sessão business sem agente** — sem system prompt e sem acesso às Server Functions (as tools recusam); não há adoção automática de agente único. Na prática, sempre passe `agentId`.
293
291
 
294
292
  #### Propriedades (somente leitura)
295
293
 
@@ -318,7 +316,7 @@ await existing.loadHistory({ limit: 50 });
318
316
  `statusChange` · `historyLoaded` · `taskCreated` · `turnStart` · `delta` (`{ delta, kind: 'text' | 'thinking' }`) · `tool` (`{ tool, toolId?, input?, content?, phase: 'call' | 'result' }`) · `turnEnd` (`{ content }`) · `cancelled` · `queueChange` · `error` (`{ code?, error }`) · `raw` (eventos não mapeados do stream, ex.: `workspace`).
319
317
 
320
318
  ```typescript
321
- const session = getAgentTaskMitra({ create: true });
319
+ const session = getAgentTaskMitra({ create: true, agentId: 'uuid-do-agente' });
322
320
 
323
321
  session.on('delta', ({ delta, kind }) => { if (kind === 'text') process.stdout.write(delta); });
324
322
  session.on('tool', ({ tool, phase }) => console.log('🔧', phase, tool));
package/dist/index.d.mts CHANGED
@@ -205,7 +205,7 @@ interface AgentChat {
205
205
  id: string;
206
206
  name: string | null;
207
207
  agentType: AgentType;
208
- /** Agente business dono do chat (null = chat de desenvolvimento). */
208
+ /** Agente business dono do chat (null = sessão business sem agente — não executa nada). */
209
209
  agentId: string | null;
210
210
  archived: boolean;
211
211
  createdAt: string;
@@ -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. */
@@ -268,8 +276,10 @@ interface GetAgentTaskCreateOptions {
268
276
  /**
269
277
  * ID de um agente business (CRUD via mitra-sdk: listAgentsMitra e família).
270
278
  * Com agentId, a sessão sobe com o system prompt do agente e um token escopado —
271
- * as tools enxergam só as Server Functions daquele agente. Sem agentId, é o
272
- * chat de desenvolvimento de sempre.
279
+ * as tools enxergam só as Server Functions daquele agente.
280
+ * Sem agentId: sessão business SEM agente — sem system prompt e sem acesso às
281
+ * Server Functions (as tools recusam). Não há adoção automática de agente
282
+ * único; na prática, sempre passe agentId.
273
283
  */
274
284
  agentId?: string;
275
285
  /** Transporte do prompt (default 'ws'). */
@@ -278,6 +288,8 @@ interface GetAgentTaskCreateOptions {
278
288
  interface GetAgentTaskOpenOptions {
279
289
  /** Abre chat existente. */
280
290
  taskId: string;
291
+ /** Obrigatório (opcional na chamada se configurado via configureSdkMitra). */
292
+ projectId?: number | string;
281
293
  /** Transporte do prompt (default 'ws'). */
282
294
  transport?: AgentTaskTransport;
283
295
  }
@@ -513,36 +525,44 @@ declare function getConfig(): MitraConfig;
513
525
  declare function resolveProjectId(projectId?: number | string): number | string;
514
526
 
515
527
  /**
516
- * Mitra Interactions SDK - Autenticação (Router)
517
- *
518
- * Roteia chamadas de auth para a implementação correta com base no `authUrl`:
519
- * - URLs legadas (`coder.mitralab.io/sdk-auth/`, `agent.mitralab.io/sdk-auth/`) → auth-legacy.ts
520
- * - Qualquer outro authUrl → auth-new.ts (novo Mitra: Kong gateway + IAM service)
528
+ * Mitra Interactions SDK - Autenticação (Novo Mitra)
521
529
  *
522
- * A API pública é idêntica à legacy. Consumers não precisam alterar código.
530
+ * Implementação do auth para o novo Mitra (Kong gateway).
531
+ * - Email login/signup/refresh: via BFF (mitra-legacy-bff), POST {gateway}/auth/*.
532
+ * O BFF resolve projectId->appId, chama o mitra-iam e já devolve o envelope
533
+ * { token, baseURL, integrationURL } que a SDK consome.
534
+ * - SSO (Google): página atravessadora (sdk-auth.html) faz o start do OAuth e
535
+ * devolve o `code` cru (popup via postMessage, redirect via #codeMitra). A SDK
536
+ * troca o code por token no BFF (POST {gateway}/auth/{provider}), mesmo host do
537
+ * /email/login. Provider-agnóstico: Microsoft entra só mudando a allowlist
538
+ * quando o back liberar o endpoint. Suporta popup (desktop) e redirect (mobile).
523
539
  */
524
540
 
525
- declare function loginMitra(method: 'email' | 'google' | 'microsoft' | 'mitra', options?: LoginOptions): Promise<LoginResponse>;
526
- declare function loginWithGoogleMitra(options?: LoginOptions): Promise<LoginResponse>;
527
- declare function loginWithMicrosoftMitra(options?: LoginOptions): Promise<LoginResponse>;
528
- declare function refreshTokenSilently(authUrl: string, projectId: number | string): Promise<LoginResponse>;
529
541
  /**
530
- * Gera o JWT a partir do code do SSO (novo Mitra). O app lê codeMitra/stateMitra
531
- * do fragment (lógica de template) e chama aqui pra validar o nonce e trocar o
532
- * code por token no BFF. Exclusivo do novo mundo — no legacy o token já vem
533
- * pronto no fragment (tokenMitra).
542
+ * Gera o JWT a partir do `code` do SSO (retorno do redirect). Valida o `state`
543
+ * contra o nonce gerado no start (anti-CSRF), troca o code no BFF
544
+ * (POST {gateway}/auth/{provider}) e configura o SDK. Ler/limpar o fragment da
545
+ * URL é responsabilidade do app — aqui só se gera o token.
534
546
  */
535
547
  declare function exchangeSsoCodeMitra(options: {
536
548
  code: string;
537
549
  state: string;
538
550
  }): Promise<LoginResponse>;
551
+ declare function loginWithGoogleMitra(options?: LoginOptions): Promise<LoginResponse>;
552
+ declare function loginWithMicrosoftMitra(options?: LoginOptions): Promise<LoginResponse>;
553
+ declare function loginMitra(method: 'email' | 'google' | 'microsoft' | 'mitra', options?: LoginOptions): Promise<LoginResponse>;
554
+ declare function refreshTokenSilently(authUrl: string, _projectId: number | string): Promise<LoginResponse>;
539
555
 
540
556
  /**
541
- * Mitra Interactions SDK — Agent Chat (copilot novo mundo)
557
+ * Mitra Interactions SDK — Agent Chat (via BFF)
558
+ *
559
+ * REST-first, tudo pela BFF no baseURL normal (`/agentAiShortcut/*`) — herda
560
+ * fetchWithRefresh e o CORS do BFF. Envelope `{ status, result }`; listas vêm
561
+ * desembrulhadas do Page (result é o array direto).
542
562
  *
543
- * REST-first: chats (tasks), histórico, credenciais e modelos são HTTP no
544
- * gateway `{origin}/copilot/api/v1`. SÓ o prompt é streaming — WebSocket por
545
- * task em `{origin}/copilot/ws/tasks/{taskId}?token=JWT`.
563
+ * SÓ o prompt é streaming: WebSocket por task em
564
+ * `wss://{origin}/copilot/ws/tasks/{taskId}?token=JWT` (não passa por
565
+ * preflight de CORS).
546
566
  *
547
567
  * API pública:
548
568
  * - manageAgentChatMitra({ action: 'list' | 'rename' | 'delete', ... })
@@ -550,10 +570,12 @@ declare function exchangeSsoCodeMitra(options: {
550
570
  */
551
571
 
552
572
  /**
553
- * Gerencia a coleção de chats do usuário — tudo HTTP:
554
- * - list → GET /copilot/api/v1/tasks (filtros: agentId, archived, search, page, size)
555
- * - rename → PATCH /copilot/api/v1/tasks/{id}
556
- * - delete → PATCH /copilot/api/v1/tasks/{id}/archive (arquiva; some da lista default)
573
+ * Gerencia a coleção de chats do usuário — tudo HTTP via BFF:
574
+ * - list → GET /agentAiShortcut/listChats (filtros: agentId, archived, search, page, size)
575
+ * - rename → POST /agentAiShortcut/renameChat
576
+ * - delete → POST /agentAiShortcut/deleteChat (arquiva; some da lista default)
577
+ *
578
+ * `projectId` é obrigatório (opcional na chamada se configurado no configureSdkMitra).
557
579
  *
558
580
  * @example
559
581
  * const chats = await manageAgentChatMitra({ action: 'list' });
@@ -566,7 +588,7 @@ declare function manageAgentChatMitra(options: ManageAgentChatRenameOptions): Pr
566
588
  declare function manageAgentChatMitra(options: ManageAgentChatDeleteOptions): Promise<DeleteAgentChatResult>;
567
589
  /**
568
590
  * Abre um handle de chat (session). Use:
569
- * - `{ create: true }` para iniciar um chat novo (a task é criada via REST no 1º send)
591
+ * - `{ create: true }` para iniciar um chat novo (a task é criada via BFF no 1º send)
570
592
  * - `{ taskId: 'X' }` para abrir um chat existente
571
593
  *
572
594
  * A session expõe histórico, streaming, fila, cancel e eventos. Se a
package/dist/index.d.ts CHANGED
@@ -205,7 +205,7 @@ interface AgentChat {
205
205
  id: string;
206
206
  name: string | null;
207
207
  agentType: AgentType;
208
- /** Agente business dono do chat (null = chat de desenvolvimento). */
208
+ /** Agente business dono do chat (null = sessão business sem agente — não executa nada). */
209
209
  agentId: string | null;
210
210
  archived: boolean;
211
211
  createdAt: string;
@@ -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. */
@@ -268,8 +276,10 @@ interface GetAgentTaskCreateOptions {
268
276
  /**
269
277
  * ID de um agente business (CRUD via mitra-sdk: listAgentsMitra e família).
270
278
  * Com agentId, a sessão sobe com o system prompt do agente e um token escopado —
271
- * as tools enxergam só as Server Functions daquele agente. Sem agentId, é o
272
- * chat de desenvolvimento de sempre.
279
+ * as tools enxergam só as Server Functions daquele agente.
280
+ * Sem agentId: sessão business SEM agente — sem system prompt e sem acesso às
281
+ * Server Functions (as tools recusam). Não há adoção automática de agente
282
+ * único; na prática, sempre passe agentId.
273
283
  */
274
284
  agentId?: string;
275
285
  /** Transporte do prompt (default 'ws'). */
@@ -278,6 +288,8 @@ interface GetAgentTaskCreateOptions {
278
288
  interface GetAgentTaskOpenOptions {
279
289
  /** Abre chat existente. */
280
290
  taskId: string;
291
+ /** Obrigatório (opcional na chamada se configurado via configureSdkMitra). */
292
+ projectId?: number | string;
281
293
  /** Transporte do prompt (default 'ws'). */
282
294
  transport?: AgentTaskTransport;
283
295
  }
@@ -513,36 +525,44 @@ declare function getConfig(): MitraConfig;
513
525
  declare function resolveProjectId(projectId?: number | string): number | string;
514
526
 
515
527
  /**
516
- * Mitra Interactions SDK - Autenticação (Router)
517
- *
518
- * Roteia chamadas de auth para a implementação correta com base no `authUrl`:
519
- * - URLs legadas (`coder.mitralab.io/sdk-auth/`, `agent.mitralab.io/sdk-auth/`) → auth-legacy.ts
520
- * - Qualquer outro authUrl → auth-new.ts (novo Mitra: Kong gateway + IAM service)
528
+ * Mitra Interactions SDK - Autenticação (Novo Mitra)
521
529
  *
522
- * A API pública é idêntica à legacy. Consumers não precisam alterar código.
530
+ * Implementação do auth para o novo Mitra (Kong gateway).
531
+ * - Email login/signup/refresh: via BFF (mitra-legacy-bff), POST {gateway}/auth/*.
532
+ * O BFF resolve projectId->appId, chama o mitra-iam e já devolve o envelope
533
+ * { token, baseURL, integrationURL } que a SDK consome.
534
+ * - SSO (Google): página atravessadora (sdk-auth.html) faz o start do OAuth e
535
+ * devolve o `code` cru (popup via postMessage, redirect via #codeMitra). A SDK
536
+ * troca o code por token no BFF (POST {gateway}/auth/{provider}), mesmo host do
537
+ * /email/login. Provider-agnóstico: Microsoft entra só mudando a allowlist
538
+ * quando o back liberar o endpoint. Suporta popup (desktop) e redirect (mobile).
523
539
  */
524
540
 
525
- declare function loginMitra(method: 'email' | 'google' | 'microsoft' | 'mitra', options?: LoginOptions): Promise<LoginResponse>;
526
- declare function loginWithGoogleMitra(options?: LoginOptions): Promise<LoginResponse>;
527
- declare function loginWithMicrosoftMitra(options?: LoginOptions): Promise<LoginResponse>;
528
- declare function refreshTokenSilently(authUrl: string, projectId: number | string): Promise<LoginResponse>;
529
541
  /**
530
- * Gera o JWT a partir do code do SSO (novo Mitra). O app lê codeMitra/stateMitra
531
- * do fragment (lógica de template) e chama aqui pra validar o nonce e trocar o
532
- * code por token no BFF. Exclusivo do novo mundo — no legacy o token já vem
533
- * pronto no fragment (tokenMitra).
542
+ * Gera o JWT a partir do `code` do SSO (retorno do redirect). Valida o `state`
543
+ * contra o nonce gerado no start (anti-CSRF), troca o code no BFF
544
+ * (POST {gateway}/auth/{provider}) e configura o SDK. Ler/limpar o fragment da
545
+ * URL é responsabilidade do app — aqui só se gera o token.
534
546
  */
535
547
  declare function exchangeSsoCodeMitra(options: {
536
548
  code: string;
537
549
  state: string;
538
550
  }): Promise<LoginResponse>;
551
+ declare function loginWithGoogleMitra(options?: LoginOptions): Promise<LoginResponse>;
552
+ declare function loginWithMicrosoftMitra(options?: LoginOptions): Promise<LoginResponse>;
553
+ declare function loginMitra(method: 'email' | 'google' | 'microsoft' | 'mitra', options?: LoginOptions): Promise<LoginResponse>;
554
+ declare function refreshTokenSilently(authUrl: string, _projectId: number | string): Promise<LoginResponse>;
539
555
 
540
556
  /**
541
- * Mitra Interactions SDK — Agent Chat (copilot novo mundo)
557
+ * Mitra Interactions SDK — Agent Chat (via BFF)
558
+ *
559
+ * REST-first, tudo pela BFF no baseURL normal (`/agentAiShortcut/*`) — herda
560
+ * fetchWithRefresh e o CORS do BFF. Envelope `{ status, result }`; listas vêm
561
+ * desembrulhadas do Page (result é o array direto).
542
562
  *
543
- * REST-first: chats (tasks), histórico, credenciais e modelos são HTTP no
544
- * gateway `{origin}/copilot/api/v1`. SÓ o prompt é streaming — WebSocket por
545
- * task em `{origin}/copilot/ws/tasks/{taskId}?token=JWT`.
563
+ * SÓ o prompt é streaming: WebSocket por task em
564
+ * `wss://{origin}/copilot/ws/tasks/{taskId}?token=JWT` (não passa por
565
+ * preflight de CORS).
546
566
  *
547
567
  * API pública:
548
568
  * - manageAgentChatMitra({ action: 'list' | 'rename' | 'delete', ... })
@@ -550,10 +570,12 @@ declare function exchangeSsoCodeMitra(options: {
550
570
  */
551
571
 
552
572
  /**
553
- * Gerencia a coleção de chats do usuário — tudo HTTP:
554
- * - list → GET /copilot/api/v1/tasks (filtros: agentId, archived, search, page, size)
555
- * - rename → PATCH /copilot/api/v1/tasks/{id}
556
- * - delete → PATCH /copilot/api/v1/tasks/{id}/archive (arquiva; some da lista default)
573
+ * Gerencia a coleção de chats do usuário — tudo HTTP via BFF:
574
+ * - list → GET /agentAiShortcut/listChats (filtros: agentId, archived, search, page, size)
575
+ * - rename → POST /agentAiShortcut/renameChat
576
+ * - delete → POST /agentAiShortcut/deleteChat (arquiva; some da lista default)
577
+ *
578
+ * `projectId` é obrigatório (opcional na chamada se configurado no configureSdkMitra).
557
579
  *
558
580
  * @example
559
581
  * const chats = await manageAgentChatMitra({ action: 'list' });
@@ -566,7 +588,7 @@ declare function manageAgentChatMitra(options: ManageAgentChatRenameOptions): Pr
566
588
  declare function manageAgentChatMitra(options: ManageAgentChatDeleteOptions): Promise<DeleteAgentChatResult>;
567
589
  /**
568
590
  * Abre um handle de chat (session). Use:
569
- * - `{ create: true }` para iniciar um chat novo (a task é criada via REST no 1º send)
591
+ * - `{ create: true }` para iniciar um chat novo (a task é criada via BFF no 1º send)
570
592
  * - `{ taskId: 'X' }` para abrir um chat existente
571
593
  *
572
594
  * A session expõe histórico, streaming, fila, cancel e eventos. Se a