mitra-interactions-sdk 1.0.60-beta.39 → 1.0.60-beta.40
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 +2 -2
- package/dist/index.d.mts +3 -10
- package/dist/index.d.ts +3 -10
- package/dist/index.js +6 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -284,9 +284,9 @@ const existing = getAgentTaskMitra({ taskId: 'uuid-da-task' });
|
|
|
284
284
|
await existing.loadHistory({ limit: 50 });
|
|
285
285
|
```
|
|
286
286
|
|
|
287
|
-
`getAgentTaskMitra({ create: true, agentType?, name?, agentId?, reasoningEffort?,
|
|
287
|
+
`getAgentTaskMitra({ create: true, agentType?, name?, agentId?, reasoningEffort?, transport? })` ou `getAgentTaskMitra({ taskId, transport? })`.
|
|
288
288
|
|
|
289
|
-
**
|
|
289
|
+
**Agente autônomo**: a autonomia é **propriedade do AGENTE** (`autonomous` em `createAgentMitra`/`updateAgentMitra`, no `mitra-sdk`) — não existe flag na criação do chat. Ao criar um chat contra um agente autônomo (`getAgentTaskMitra({ create: true, agentId })`), o copilot deriva a autonomia do agente e o chat já nasce **sem dono** (`user_id NULL` — a dona é o agente), usando a connection anexada ao agente como credencial. Exige auth `AGENT_WRITE` (chave de SF ou token de app EDIT) — usuário business comum não abre chat autônomo. Depois de criado, dirigir/listar é igual ao chat normal (`getAgentTaskMitra({ taskId })`, `send`, `manageAgentChatMitra({ list, agentId })`).
|
|
290
290
|
|
|
291
291
|
- `agentType` vem de `manageAgentCredentialMitra({ action: 'list_models' })` — ex.: `'ANTHROPIC_CLAUDE_OPUS'`, `'OPENAI_GPT5'`. Default: `'ANTHROPIC_CLAUDE_OPUS'`.
|
|
292
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`: 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`.
|
package/dist/index.d.mts
CHANGED
|
@@ -303,18 +303,11 @@ interface GetAgentTaskCreateOptions {
|
|
|
303
303
|
* Sem agentId: sessão business SEM agente — sem system prompt e sem acesso às
|
|
304
304
|
* Server Functions (as tools recusam). Não há adoção automática de agente
|
|
305
305
|
* único; na prática, sempre passe agentId.
|
|
306
|
+
* Se o agente for AUTÔNOMO (propriedade `autonomous` do agente, definida em
|
|
307
|
+
* createAgentMitra/updateAgentMitra no mitra-sdk), o chat já nasce sem dono
|
|
308
|
+
* automaticamente — não existe flag aqui; exige auth AGENT_WRITE.
|
|
306
309
|
*/
|
|
307
310
|
agentId?: string;
|
|
308
|
-
/**
|
|
309
|
-
* Cria o chat SEM dono (user_id NULL — a dona é o agente): a modalidade
|
|
310
|
-
* AUTÔNOMA, onde uma Server Function / webhook / cron dirige o agente.
|
|
311
|
-
* Exige `agentId` e o agente precisa ter uma connection anexada (credencial);
|
|
312
|
-
* auth AGENT_WRITE (chave de SF ou token de app EDIT), senão 403.
|
|
313
|
-
* Omitido = chat com dono (o caller), comportamento de sempre.
|
|
314
|
-
* ATENÇÃO: depende do backend impl-autonomous — antes dele o servidor
|
|
315
|
-
* ignora o flag e cria chat com dono normalmente.
|
|
316
|
-
*/
|
|
317
|
-
autonomous?: boolean;
|
|
318
311
|
/** Transporte do prompt (default 'ws'). */
|
|
319
312
|
transport?: AgentTaskTransport;
|
|
320
313
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -303,18 +303,11 @@ interface GetAgentTaskCreateOptions {
|
|
|
303
303
|
* Sem agentId: sessão business SEM agente — sem system prompt e sem acesso às
|
|
304
304
|
* Server Functions (as tools recusam). Não há adoção automática de agente
|
|
305
305
|
* único; na prática, sempre passe agentId.
|
|
306
|
+
* Se o agente for AUTÔNOMO (propriedade `autonomous` do agente, definida em
|
|
307
|
+
* createAgentMitra/updateAgentMitra no mitra-sdk), o chat já nasce sem dono
|
|
308
|
+
* automaticamente — não existe flag aqui; exige auth AGENT_WRITE.
|
|
306
309
|
*/
|
|
307
310
|
agentId?: string;
|
|
308
|
-
/**
|
|
309
|
-
* Cria o chat SEM dono (user_id NULL — a dona é o agente): a modalidade
|
|
310
|
-
* AUTÔNOMA, onde uma Server Function / webhook / cron dirige o agente.
|
|
311
|
-
* Exige `agentId` e o agente precisa ter uma connection anexada (credencial);
|
|
312
|
-
* auth AGENT_WRITE (chave de SF ou token de app EDIT), senão 403.
|
|
313
|
-
* Omitido = chat com dono (o caller), comportamento de sempre.
|
|
314
|
-
* ATENÇÃO: depende do backend impl-autonomous — antes dele o servidor
|
|
315
|
-
* ignora o flag e cria chat com dono normalmente.
|
|
316
|
-
*/
|
|
317
|
-
autonomous?: boolean;
|
|
318
311
|
/** Transporte do prompt (default 'ws'). */
|
|
319
312
|
transport?: AgentTaskTransport;
|
|
320
313
|
}
|
package/dist/index.js
CHANGED
|
@@ -486,7 +486,6 @@ var AgentTaskSession = class {
|
|
|
486
486
|
this._initialName = init.name;
|
|
487
487
|
this._agentId = init.agentId;
|
|
488
488
|
this._reasoningEffort = init.reasoningEffort;
|
|
489
|
-
this._autonomous = init.autonomous;
|
|
490
489
|
this._status = "idle";
|
|
491
490
|
} else {
|
|
492
491
|
this._agentType = DEFAULT_AGENT_TYPE;
|
|
@@ -572,8 +571,7 @@ var AgentTaskSession = class {
|
|
|
572
571
|
projectId: this._projectId,
|
|
573
572
|
title: this._initialName,
|
|
574
573
|
agentType: this._agentType,
|
|
575
|
-
agentId: this._agentId
|
|
576
|
-
autonomous: this._autonomous
|
|
574
|
+
agentId: this._agentId
|
|
577
575
|
});
|
|
578
576
|
this._task = toAgentChat(t);
|
|
579
577
|
this._taskId = this._task.id;
|
|
@@ -1048,10 +1046,10 @@ async function createChatTask(options) {
|
|
|
1048
1046
|
projectId: resolveProjectId(options.projectId),
|
|
1049
1047
|
...options.title ? { title: options.title } : {},
|
|
1050
1048
|
agentType: options.agentType,
|
|
1051
|
-
|
|
1052
|
-
//
|
|
1053
|
-
//
|
|
1054
|
-
...options.
|
|
1049
|
+
// Autonomia é propriedade do AGENTE (createAgentMitra/updateAgentMitra no
|
|
1050
|
+
// mitra-sdk): o copilot deriva do agentId — o chat de agente autônomo já
|
|
1051
|
+
// nasce ownerless sem flag nenhum aqui.
|
|
1052
|
+
...options.agentId ? { agentId: options.agentId } : {}
|
|
1055
1053
|
});
|
|
1056
1054
|
return env.result;
|
|
1057
1055
|
}
|
|
@@ -1125,9 +1123,6 @@ function getAgentTaskMitra(options) {
|
|
|
1125
1123
|
});
|
|
1126
1124
|
}
|
|
1127
1125
|
if ("create" in options && options.create) {
|
|
1128
|
-
if (options.autonomous && !options.agentId) {
|
|
1129
|
-
throw new Error("getAgentTaskMitra: autonomous exige agentId \u2014 o chat aut\xF4nomo pertence ao agente (e o agente precisa ter uma connection anexada).");
|
|
1130
|
-
}
|
|
1131
1126
|
return new AgentTaskSession({
|
|
1132
1127
|
kind: "new",
|
|
1133
1128
|
projectId: options.projectId,
|
|
@@ -1135,8 +1130,7 @@ function getAgentTaskMitra(options) {
|
|
|
1135
1130
|
name: options.name,
|
|
1136
1131
|
agentId: options.agentId,
|
|
1137
1132
|
transport: options.transport,
|
|
1138
|
-
reasoningEffort: options.reasoningEffort
|
|
1139
|
-
autonomous: options.autonomous
|
|
1133
|
+
reasoningEffort: options.reasoningEffort
|
|
1140
1134
|
});
|
|
1141
1135
|
}
|
|
1142
1136
|
throw new Error("getAgentTaskMitra: passe { create: true } ou { taskId }.");
|