mitra-interactions-sdk 1.0.60-beta.24 → 1.0.60-beta.25
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 +4 -2
- package/dist/index.d.mts +40 -13
- package/dist/index.d.ts +40 -13
- package/dist/index.js +217 -202
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +217 -202
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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**:
|
|
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).
|
|
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
|
|
|
@@ -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
|
@@ -408,32 +408,44 @@ interface DeviceAuthAgentCredentialResult {
|
|
|
408
408
|
verificationUri: string;
|
|
409
409
|
intervalSeconds: number;
|
|
410
410
|
}
|
|
411
|
+
/**
|
|
412
|
+
* `projectId` é obrigatório em todas as actions (opcional na chamada se já
|
|
413
|
+
* configurado via configureSdkMitra) — define de qual app é a credencial.
|
|
414
|
+
*/
|
|
411
415
|
type ManageAgentCredentialOptions = {
|
|
412
416
|
action: 'list_providers';
|
|
417
|
+
projectId?: number | string;
|
|
413
418
|
} | {
|
|
414
419
|
action: 'list_models';
|
|
420
|
+
projectId?: number | string;
|
|
415
421
|
} | {
|
|
416
422
|
action: 'save';
|
|
417
423
|
target: AgentProvider;
|
|
418
424
|
key: string;
|
|
425
|
+
projectId?: number | string;
|
|
419
426
|
} | {
|
|
420
427
|
action: 'remove';
|
|
421
428
|
target: AgentProvider;
|
|
429
|
+
projectId?: number | string;
|
|
422
430
|
} | {
|
|
423
431
|
action: 'auth';
|
|
424
432
|
target: AgentProvider;
|
|
433
|
+
projectId?: number | string;
|
|
425
434
|
} | {
|
|
426
435
|
action: 'connect';
|
|
427
436
|
target: AgentProvider;
|
|
428
437
|
code: string;
|
|
429
438
|
state: string;
|
|
439
|
+
projectId?: number | string;
|
|
430
440
|
} | {
|
|
431
441
|
action: 'device_auth';
|
|
432
442
|
target: AgentProvider;
|
|
443
|
+
projectId?: number | string;
|
|
433
444
|
} | {
|
|
434
445
|
action: 'device_poll';
|
|
435
446
|
target: AgentProvider;
|
|
436
447
|
deviceAuthId: string;
|
|
448
|
+
projectId?: number | string;
|
|
437
449
|
};
|
|
438
450
|
|
|
439
451
|
/**
|
|
@@ -563,56 +575,71 @@ declare function manageAgentChatMitra(options: ManageAgentChatDeleteOptions): Pr
|
|
|
563
575
|
declare function getAgentTaskMitra(options: GetAgentTaskOptions): AgentTaskSession;
|
|
564
576
|
|
|
565
577
|
/**
|
|
566
|
-
* Mitra Interactions SDK — Agent Credentials (
|
|
578
|
+
* Mitra Interactions SDK — Agent Credentials (via BFF)
|
|
567
579
|
*
|
|
568
|
-
* Função ÚNICA `manageAgentCredentialMitra`, toda HTTP no
|
|
569
|
-
*
|
|
570
|
-
* - list_providers → GET /
|
|
571
|
-
* - list_models → GET /
|
|
572
|
-
* - save →
|
|
573
|
-
* - remove →
|
|
574
|
-
* - auth → POST /
|
|
575
|
-
* - connect → POST /
|
|
576
|
-
* - device_auth → POST /
|
|
577
|
-
* - device_poll → POST /
|
|
580
|
+
* Função ÚNICA `manageAgentCredentialMitra`, toda HTTP pela BFF no baseURL
|
|
581
|
+
* normal (`/agentAiShortcut/*`) — herda fetchWithRefresh e o CORS do BFF:
|
|
582
|
+
* - list_providers → GET /agentAiShortcut/listProviders?projectId=
|
|
583
|
+
* - list_models → GET /agentAiShortcut/listModels?projectId=
|
|
584
|
+
* - save → POST /agentAiShortcut/saveCredential {projectId, provider, key}
|
|
585
|
+
* - remove → POST /agentAiShortcut/removeCredential {projectId, provider}
|
|
586
|
+
* - auth → POST /agentAiShortcut/oauthStart {projectId, provider}
|
|
587
|
+
* - connect → POST /agentAiShortcut/oauthExchange {projectId, provider, code, state}
|
|
588
|
+
* - device_auth → POST /agentAiShortcut/deviceStart {projectId, provider}
|
|
589
|
+
* - device_poll → POST /agentAiShortcut/devicePoll {projectId, provider, deviceAuthId}
|
|
578
590
|
*
|
|
579
|
-
*
|
|
580
|
-
*
|
|
591
|
+
* `projectId` é obrigatório (opcional na chamada se configurado no
|
|
592
|
+
* configureSdkMitra): é ele que define de qual app é a credencial — o BFF
|
|
593
|
+
* resolve projectId → appId e cunha o token de app.
|
|
594
|
+
*
|
|
595
|
+
* As respostas vêm no envelope BFF `{ status, result }`; a SDK devolve o
|
|
596
|
+
* `result` cru (mesmos campos que o copilot retorna hoje, nada renomeado).
|
|
597
|
+
*
|
|
598
|
+
* SEGURANÇA: tokens/keys nunca voltam crus — só status, e-mail da conta e a
|
|
599
|
+
* key mascarada.
|
|
581
600
|
*/
|
|
582
601
|
|
|
583
602
|
declare function manageAgentCredentialMitra(options: {
|
|
584
603
|
action: 'list_providers';
|
|
604
|
+
projectId?: number | string;
|
|
585
605
|
}): Promise<ListAgentProvidersResult>;
|
|
586
606
|
declare function manageAgentCredentialMitra(options: {
|
|
587
607
|
action: 'list_models';
|
|
608
|
+
projectId?: number | string;
|
|
588
609
|
}): Promise<ListAgentModelsResult>;
|
|
589
610
|
declare function manageAgentCredentialMitra(options: {
|
|
590
611
|
action: 'save';
|
|
591
612
|
target: AgentProvider;
|
|
592
613
|
key: string;
|
|
614
|
+
projectId?: number | string;
|
|
593
615
|
}): Promise<void>;
|
|
594
616
|
declare function manageAgentCredentialMitra(options: {
|
|
595
617
|
action: 'remove';
|
|
596
618
|
target: AgentProvider;
|
|
619
|
+
projectId?: number | string;
|
|
597
620
|
}): Promise<void>;
|
|
598
621
|
declare function manageAgentCredentialMitra(options: {
|
|
599
622
|
action: 'auth';
|
|
600
623
|
target: AgentProvider;
|
|
624
|
+
projectId?: number | string;
|
|
601
625
|
}): Promise<AuthAgentCredentialResult>;
|
|
602
626
|
declare function manageAgentCredentialMitra(options: {
|
|
603
627
|
action: 'connect';
|
|
604
628
|
target: AgentProvider;
|
|
605
629
|
code: string;
|
|
606
630
|
state: string;
|
|
631
|
+
projectId?: number | string;
|
|
607
632
|
}): Promise<ConnectAgentCredentialResult>;
|
|
608
633
|
declare function manageAgentCredentialMitra(options: {
|
|
609
634
|
action: 'device_auth';
|
|
610
635
|
target: AgentProvider;
|
|
636
|
+
projectId?: number | string;
|
|
611
637
|
}): Promise<DeviceAuthAgentCredentialResult>;
|
|
612
638
|
declare function manageAgentCredentialMitra(options: {
|
|
613
639
|
action: 'device_poll';
|
|
614
640
|
target: AgentProvider;
|
|
615
641
|
deviceAuthId: string;
|
|
642
|
+
projectId?: number | string;
|
|
616
643
|
}): Promise<ConnectAgentCredentialResult>;
|
|
617
644
|
|
|
618
645
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -408,32 +408,44 @@ interface DeviceAuthAgentCredentialResult {
|
|
|
408
408
|
verificationUri: string;
|
|
409
409
|
intervalSeconds: number;
|
|
410
410
|
}
|
|
411
|
+
/**
|
|
412
|
+
* `projectId` é obrigatório em todas as actions (opcional na chamada se já
|
|
413
|
+
* configurado via configureSdkMitra) — define de qual app é a credencial.
|
|
414
|
+
*/
|
|
411
415
|
type ManageAgentCredentialOptions = {
|
|
412
416
|
action: 'list_providers';
|
|
417
|
+
projectId?: number | string;
|
|
413
418
|
} | {
|
|
414
419
|
action: 'list_models';
|
|
420
|
+
projectId?: number | string;
|
|
415
421
|
} | {
|
|
416
422
|
action: 'save';
|
|
417
423
|
target: AgentProvider;
|
|
418
424
|
key: string;
|
|
425
|
+
projectId?: number | string;
|
|
419
426
|
} | {
|
|
420
427
|
action: 'remove';
|
|
421
428
|
target: AgentProvider;
|
|
429
|
+
projectId?: number | string;
|
|
422
430
|
} | {
|
|
423
431
|
action: 'auth';
|
|
424
432
|
target: AgentProvider;
|
|
433
|
+
projectId?: number | string;
|
|
425
434
|
} | {
|
|
426
435
|
action: 'connect';
|
|
427
436
|
target: AgentProvider;
|
|
428
437
|
code: string;
|
|
429
438
|
state: string;
|
|
439
|
+
projectId?: number | string;
|
|
430
440
|
} | {
|
|
431
441
|
action: 'device_auth';
|
|
432
442
|
target: AgentProvider;
|
|
443
|
+
projectId?: number | string;
|
|
433
444
|
} | {
|
|
434
445
|
action: 'device_poll';
|
|
435
446
|
target: AgentProvider;
|
|
436
447
|
deviceAuthId: string;
|
|
448
|
+
projectId?: number | string;
|
|
437
449
|
};
|
|
438
450
|
|
|
439
451
|
/**
|
|
@@ -563,56 +575,71 @@ declare function manageAgentChatMitra(options: ManageAgentChatDeleteOptions): Pr
|
|
|
563
575
|
declare function getAgentTaskMitra(options: GetAgentTaskOptions): AgentTaskSession;
|
|
564
576
|
|
|
565
577
|
/**
|
|
566
|
-
* Mitra Interactions SDK — Agent Credentials (
|
|
578
|
+
* Mitra Interactions SDK — Agent Credentials (via BFF)
|
|
567
579
|
*
|
|
568
|
-
* Função ÚNICA `manageAgentCredentialMitra`, toda HTTP no
|
|
569
|
-
*
|
|
570
|
-
* - list_providers → GET /
|
|
571
|
-
* - list_models → GET /
|
|
572
|
-
* - save →
|
|
573
|
-
* - remove →
|
|
574
|
-
* - auth → POST /
|
|
575
|
-
* - connect → POST /
|
|
576
|
-
* - device_auth → POST /
|
|
577
|
-
* - device_poll → POST /
|
|
580
|
+
* Função ÚNICA `manageAgentCredentialMitra`, toda HTTP pela BFF no baseURL
|
|
581
|
+
* normal (`/agentAiShortcut/*`) — herda fetchWithRefresh e o CORS do BFF:
|
|
582
|
+
* - list_providers → GET /agentAiShortcut/listProviders?projectId=
|
|
583
|
+
* - list_models → GET /agentAiShortcut/listModels?projectId=
|
|
584
|
+
* - save → POST /agentAiShortcut/saveCredential {projectId, provider, key}
|
|
585
|
+
* - remove → POST /agentAiShortcut/removeCredential {projectId, provider}
|
|
586
|
+
* - auth → POST /agentAiShortcut/oauthStart {projectId, provider}
|
|
587
|
+
* - connect → POST /agentAiShortcut/oauthExchange {projectId, provider, code, state}
|
|
588
|
+
* - device_auth → POST /agentAiShortcut/deviceStart {projectId, provider}
|
|
589
|
+
* - device_poll → POST /agentAiShortcut/devicePoll {projectId, provider, deviceAuthId}
|
|
578
590
|
*
|
|
579
|
-
*
|
|
580
|
-
*
|
|
591
|
+
* `projectId` é obrigatório (opcional na chamada se configurado no
|
|
592
|
+
* configureSdkMitra): é ele que define de qual app é a credencial — o BFF
|
|
593
|
+
* resolve projectId → appId e cunha o token de app.
|
|
594
|
+
*
|
|
595
|
+
* As respostas vêm no envelope BFF `{ status, result }`; a SDK devolve o
|
|
596
|
+
* `result` cru (mesmos campos que o copilot retorna hoje, nada renomeado).
|
|
597
|
+
*
|
|
598
|
+
* SEGURANÇA: tokens/keys nunca voltam crus — só status, e-mail da conta e a
|
|
599
|
+
* key mascarada.
|
|
581
600
|
*/
|
|
582
601
|
|
|
583
602
|
declare function manageAgentCredentialMitra(options: {
|
|
584
603
|
action: 'list_providers';
|
|
604
|
+
projectId?: number | string;
|
|
585
605
|
}): Promise<ListAgentProvidersResult>;
|
|
586
606
|
declare function manageAgentCredentialMitra(options: {
|
|
587
607
|
action: 'list_models';
|
|
608
|
+
projectId?: number | string;
|
|
588
609
|
}): Promise<ListAgentModelsResult>;
|
|
589
610
|
declare function manageAgentCredentialMitra(options: {
|
|
590
611
|
action: 'save';
|
|
591
612
|
target: AgentProvider;
|
|
592
613
|
key: string;
|
|
614
|
+
projectId?: number | string;
|
|
593
615
|
}): Promise<void>;
|
|
594
616
|
declare function manageAgentCredentialMitra(options: {
|
|
595
617
|
action: 'remove';
|
|
596
618
|
target: AgentProvider;
|
|
619
|
+
projectId?: number | string;
|
|
597
620
|
}): Promise<void>;
|
|
598
621
|
declare function manageAgentCredentialMitra(options: {
|
|
599
622
|
action: 'auth';
|
|
600
623
|
target: AgentProvider;
|
|
624
|
+
projectId?: number | string;
|
|
601
625
|
}): Promise<AuthAgentCredentialResult>;
|
|
602
626
|
declare function manageAgentCredentialMitra(options: {
|
|
603
627
|
action: 'connect';
|
|
604
628
|
target: AgentProvider;
|
|
605
629
|
code: string;
|
|
606
630
|
state: string;
|
|
631
|
+
projectId?: number | string;
|
|
607
632
|
}): Promise<ConnectAgentCredentialResult>;
|
|
608
633
|
declare function manageAgentCredentialMitra(options: {
|
|
609
634
|
action: 'device_auth';
|
|
610
635
|
target: AgentProvider;
|
|
636
|
+
projectId?: number | string;
|
|
611
637
|
}): Promise<DeviceAuthAgentCredentialResult>;
|
|
612
638
|
declare function manageAgentCredentialMitra(options: {
|
|
613
639
|
action: 'device_poll';
|
|
614
640
|
target: AgentProvider;
|
|
615
641
|
deviceAuthId: string;
|
|
642
|
+
projectId?: number | string;
|
|
616
643
|
}): Promise<ConnectAgentCredentialResult>;
|
|
617
644
|
|
|
618
645
|
/**
|