@mitralab.io/sdk-core 0.2.12 → 0.2.14

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/CHANGELOG.md CHANGED
@@ -2,6 +2,36 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## 0.2.14
6
+
7
+ - `messenger.sendEmail({ to, subject, html, text?, cc?, bcc?, replyTo? })` sends an email through
8
+ Messenger's `POST /api/v1/messages/send` as a `RAW` payload on the `EMAIL` channel and resolves
9
+ with the `messageId` of the accepted message. There is no `from`: Messenger sends with the
10
+ sender of the app in the token, so only the app's backend sends (a token exchanged from an api
11
+ key or the Server Function token). `to`, `cc` and `bcc` are lists with one address per entry;
12
+ absent optional fields are left out of the body.
13
+ - Recipient limits, the app's daily quota and the token check stay on Messenger. Their errors
14
+ (`400` above Messenger's recipient cap, `429` with `Retry-After` above the quota, `403` for an
15
+ app end-user token) come from the transport unchanged.
16
+ - `apps.update()` takes `emailLoginEnabled` and `passwordLoginEnabled`, sent on Code Studio's
17
+ `PATCH /api/v1/apps/{id}` only when supplied, so omission keeps the current value. Code Studio
18
+ rejects `passwordLoginEnabled: true` while the app inherits the platform login, with a `400`
19
+ and `PASSWORD_LOGIN_REQUIRES_EXCLUSIVE_MODE`, which comes from the transport unchanged.
20
+ - `AppDefinition` and `AppSummary` carry both fields when Code Studio returns them. The response
21
+ validator accepts their absence, as a Code Studio that predates them sends, and rejects a value
22
+ that is not a boolean.
23
+
24
+ ## 0.2.13
25
+
26
+ - `AgentTurnUsage` gains `contextTokens` and `contextWindow`. `contextTokens` is the number of
27
+ tokens occupying the chat's context window at the end of the turn: the prompt of the last
28
+ model request of the main conversation, input plus cache read and cache creation, with
29
+ subagents excluded. `contextWindow` is the model's window size, in tokens, and is kept only
30
+ as a positive integer: the box omits it when it does not know it.
31
+ - Both come from the box in `stepFinish`, so they show live in `turnEnd` and in the result
32
+ `sendAndWait` resolves, and in the `agent` item of the history. An invalid value is dropped
33
+ on its own; the rest of the usage stays.
34
+
5
35
  ## 0.2.11-beta.0
6
36
 
7
37
  - Agent turn usage (`AgentTurnUsage`): `inputTokens` and `outputTokens`, and when the harness
package/README.md CHANGED
@@ -66,7 +66,8 @@ const { data: tasks, hasMore } = await core.entities.getTable("Task").list({ lim
66
66
  - `functions`, `publicFunctions`, `functionsAdmin` e `workflows`: executar e administrar Server Functions e workflows.
67
67
  - `integration`, `integrationAdmin`, `integrationResources` e `integrationTemplates`: chamadas a APIs externas e a configuração delas.
68
68
  - `agentTasks`, com `createAgentTaskSessionManager` e `withAgentTaskSessions`: chats de agente com `send`, `sendAndWait`, `cancel` e eventos. O gerenciador recebe `tasks`, o `eventSource` do seu SDK e `directChannel`, com o `apiUrl` do gateway e, se quiser, `WebSocket` e `fetch`.
69
- - `apps`, `context`, `agents`, `agentConnections`, `agentCredentials`, `members`, `messenger`, `imports`, `dataSources` e `auth`: o app em si, a configuração de agentes e os demais recursos.
69
+ - `apps`, `context`, `agents`, `agentConnections`, `agentCredentials`, `members`, `imports`, `dataSources` e `auth`: o app em si, a configuração de agentes e os demais recursos.
70
+ - `messenger`: `notify` avisa o usuário autenticado e `sendEmail` manda e-mail com o remetente do app.
70
71
  - `resolveApiKeyToken`, `readTokenAppId` e `tokenAuthorizesApp`: contrato da troca de API key por token, para o SDK que autentica por chave.
71
72
 
72
73
  ## Configuração
@@ -95,6 +96,7 @@ const { data: tasks, hasMore } = await core.entities.getTable("Task").list({ lim
95
96
  - Fixe o app no adaptador: `getAppId` e o header `X-App-Id` vêm do valor configurado no seu SDK, nunca de um argumento de quem chama. Aplique as credenciais depois dos headers de `options`, como no exemplo, para que eles não as substituam.
96
97
  - O Core não repete requisição nem renova token. Se o seu transporte repetir, repita só o que não grava.
97
98
  - `publicFunctions` precisa de um transporte sem credencial. O Core não usa o transporte autenticado no lugar dele.
99
+ - `sendEmail({ to, subject, html, text?, cc?, bcc?, replyTo? })` não tem `from`: o Messenger usa o remetente do app do token. Por isso só o backend do app manda e-mail, com o token trocado pela API key ou o token da Server Function; token de usuário final do app recebe `403`. `to`, `cc` e `bcc` são listas com um endereço por item. Os limites ficam no Messenger e chegam como erro do seu `Transport`: `400` acima do limite de destinatários dele somando os três campos e `429` acima da cota diária do app, com o header `Retry-After` e `retry_after_seconds` no corpo.
98
100
  - `sendAndWait` com `timeoutMs` ou `signal` só para de esperar; o turno continua no servidor. Para interromper, chame `cancel()`.
99
101
  - `cancel()` chamado antes de a box aceitar o prompt espera esse aceite e só então manda o stop; a promise resolve depois disso. Se o prompt não chegar a virar turno, nada é enviado e o status não passa por `cancelled`.
100
102
  - O `open()` do seu `eventSource` só deve resolver depois que o stream estiver conectado, para nenhum evento do turno se perder.
@@ -24,6 +24,16 @@ publishes.
24
24
 
25
25
  ## Versions
26
26
 
27
+ - `0.2.14` is the `0.2.13` parity surface republished with `messenger.sendEmail()` and the
28
+ `emailLoginEnabled` and `passwordLoginEnabled` fields of `apps.update()`, which the parity cases do
29
+ not cover. Same parity cases; the version exists so a consumer pinning the package can pin a corpus
30
+ with the same number.
31
+
32
+ - `0.2.13` is the `0.2.12` parity surface republished with the occupied context of the chat:
33
+ `contextTokens` and `contextWindow` on `AgentTurnUsage`, which the parity cases do not cover.
34
+ Same parity cases; the version exists so a consumer pinning the package can pin a corpus with
35
+ the same number.
36
+
27
37
  - `0.2.12` is the stable release of the `0.2.12-beta.1` surface: a `cancel()` pressed before the turn
28
38
  starts waits for the box to admit the prompt and goes out right after it. Same parity cases; the
29
39
  version exists so a consumer pinning the stable package can pin a corpus with the same number.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "contract": "SDK-PARITY-001",
3
- "current": "0.2.12",
3
+ "current": "0.2.14",
4
4
  "versions": [
5
5
  {
6
6
  "version": "0.1.0",
@@ -115,6 +115,16 @@
115
115
  "version": "0.2.12",
116
116
  "path": "v0.2.12/sdk-parity.json",
117
117
  "sha256": "685238cadcf898128a5dad60c30bcdd8dcc9a02f03077d765aee01f8d6e34709"
118
+ },
119
+ {
120
+ "version": "0.2.13",
121
+ "path": "v0.2.13/sdk-parity.json",
122
+ "sha256": "36a1dd5b8d0ab604a8baa68ce19823c9b2f2745cdf57fad9000917b83c60be20"
123
+ },
124
+ {
125
+ "version": "0.2.14",
126
+ "path": "v0.2.14/sdk-parity.json",
127
+ "sha256": "112e7eb52bd4362737ef03efff2cad4f529e41d5ac8ccda442e57c09b2e3c459"
118
128
  }
119
129
  ]
120
130
  }