mitra-interactions-sdk 1.0.60-beta.34 → 1.0.60-beta.35
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 +3 -1
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -284,7 +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?, transport? })` ou `getAgentTaskMitra({ taskId, transport? })`.
|
|
287
|
+
`getAgentTaskMitra({ create: true, agentType?, name?, agentId?, reasoningEffort?, autonomous?, transport? })` ou `getAgentTaskMitra({ taskId, transport? })`.
|
|
288
|
+
|
|
289
|
+
**Chat autônomo (`autonomous: true`)**: cria o chat **sem dono** (`user_id NULL` — a dona é o agente), pra Server Function/webhook/cron dirigir o agente. Exige `agentId` (fail-fast no client) e o agente precisa ter uma **connection anexada** como credencial; auth `AGENT_WRITE` (chave de SF ou token de app EDIT), senão 403. Depois de criado, dirigir/listar é igual ao chat normal (`getAgentTaskMitra({ taskId })`, `send`, `manageAgentChatMitra({ list, agentId })`). Sem o flag, comportamento de sempre (chat com dono = o caller). ⚠️ Depende do backend `impl-autonomous` — antes dele o servidor ignora o flag.
|
|
288
290
|
|
|
289
291
|
- `agentType` vem de `manageAgentCredentialMitra({ action: 'list_models' })` — ex.: `'ANTHROPIC_CLAUDE_OPUS'`, `'OPENAI_GPT5'`. Default: `'ANTHROPIC_CLAUDE_OPUS'`.
|
|
290
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
|
@@ -305,6 +305,16 @@ interface GetAgentTaskCreateOptions {
|
|
|
305
305
|
* único; na prática, sempre passe agentId.
|
|
306
306
|
*/
|
|
307
307
|
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;
|
|
308
318
|
/** Transporte do prompt (default 'ws'). */
|
|
309
319
|
transport?: AgentTaskTransport;
|
|
310
320
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -305,6 +305,16 @@ interface GetAgentTaskCreateOptions {
|
|
|
305
305
|
* único; na prática, sempre passe agentId.
|
|
306
306
|
*/
|
|
307
307
|
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;
|
|
308
318
|
/** Transporte do prompt (default 'ws'). */
|
|
309
319
|
transport?: AgentTaskTransport;
|
|
310
320
|
}
|
package/dist/index.js
CHANGED
|
@@ -486,6 +486,7 @@ 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;
|
|
489
490
|
this._status = "idle";
|
|
490
491
|
} else {
|
|
491
492
|
this._agentType = DEFAULT_AGENT_TYPE;
|
|
@@ -571,7 +572,8 @@ var AgentTaskSession = class {
|
|
|
571
572
|
projectId: this._projectId,
|
|
572
573
|
title: this._initialName,
|
|
573
574
|
agentType: this._agentType,
|
|
574
|
-
agentId: this._agentId
|
|
575
|
+
agentId: this._agentId,
|
|
576
|
+
autonomous: this._autonomous
|
|
575
577
|
});
|
|
576
578
|
this._task = toAgentChat(t);
|
|
577
579
|
this._taskId = this._task.id;
|
|
@@ -1045,7 +1047,10 @@ async function createChatTask(options) {
|
|
|
1045
1047
|
projectId: resolveProjectId(options.projectId),
|
|
1046
1048
|
...options.title ? { title: options.title } : {},
|
|
1047
1049
|
agentType: options.agentType,
|
|
1048
|
-
...options.agentId ? { agentId: options.agentId } : {}
|
|
1050
|
+
...options.agentId ? { agentId: options.agentId } : {},
|
|
1051
|
+
// Chat autônomo (sem dono; exige agentId + connection no agente).
|
|
1052
|
+
// Só entra no body quando informado — sem o flag, byte a byte como sempre.
|
|
1053
|
+
...options.autonomous ? { autonomous: true } : {}
|
|
1049
1054
|
});
|
|
1050
1055
|
return env.result;
|
|
1051
1056
|
}
|
|
@@ -1119,6 +1124,9 @@ function getAgentTaskMitra(options) {
|
|
|
1119
1124
|
});
|
|
1120
1125
|
}
|
|
1121
1126
|
if ("create" in options && options.create) {
|
|
1127
|
+
if (options.autonomous && !options.agentId) {
|
|
1128
|
+
throw new Error("getAgentTaskMitra: autonomous exige agentId \u2014 o chat aut\xF4nomo pertence ao agente (e o agente precisa ter uma connection anexada).");
|
|
1129
|
+
}
|
|
1122
1130
|
return new AgentTaskSession({
|
|
1123
1131
|
kind: "new",
|
|
1124
1132
|
projectId: options.projectId,
|
|
@@ -1126,7 +1134,8 @@ function getAgentTaskMitra(options) {
|
|
|
1126
1134
|
name: options.name,
|
|
1127
1135
|
agentId: options.agentId,
|
|
1128
1136
|
transport: options.transport,
|
|
1129
|
-
reasoningEffort: options.reasoningEffort
|
|
1137
|
+
reasoningEffort: options.reasoningEffort,
|
|
1138
|
+
autonomous: options.autonomous
|
|
1130
1139
|
});
|
|
1131
1140
|
}
|
|
1132
1141
|
throw new Error("getAgentTaskMitra: passe { create: true } ou { taskId }.");
|