@sema-agent/server 7.88.1 → 7.88.2
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/dist/brain.js +2 -2
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +23 -0
- package/package.json +2 -2
package/dist/brain.js
CHANGED
|
@@ -3,7 +3,7 @@ import { normalizeBaseUrl } from "@sema-agent/core";
|
|
|
3
3
|
import { buildDefaultResilience } from "./config-types.js";
|
|
4
4
|
import { resolveModelApiKey } from "./key-resolver.js";
|
|
5
5
|
import { catalogBrainLane } from "./model-provider.js";
|
|
6
|
-
import { buildDisplaySafeUrl } from "./trace/redact.js";
|
|
6
|
+
import { buildDisplaySafeUrl, redactSecrets } from "./trace/redact.js";
|
|
7
7
|
function isOffDeploymentRoot(baseUrl, config) {
|
|
8
8
|
if (!baseUrl)
|
|
9
9
|
return false;
|
|
@@ -158,7 +158,7 @@ export function brainSummary(config) {
|
|
|
158
158
|
const verdict = adjudicateModelRoute({ id: target.id, baseUrl: target.baseUrl }, resolveRouteCredential({ ...(config.gatewayApiKey ? { configApiKey: config.gatewayApiKey } : {}) }), { baseUrl: degradeDeclaredRoot(target.baseUrl, config) });
|
|
159
159
|
return verdict.ok
|
|
160
160
|
? { reactiveDegradeRoutePairing: `ok:${verdict.posture}`, reactiveDegradeRouteRefusal: null }
|
|
161
|
-
: { reactiveDegradeRoutePairing: `broken:${verdict.code}`, reactiveDegradeRouteRefusal: routeRefusalText(verdict) };
|
|
161
|
+
: { reactiveDegradeRoutePairing: `broken:${verdict.code}`, reactiveDegradeRouteRefusal: redactSecrets(routeRefusalText(verdict)) };
|
|
162
162
|
})()),
|
|
163
163
|
};
|
|
164
164
|
}
|
|
@@ -166,6 +166,29 @@ Sign with the device private key over exactly these bytes:
|
|
|
166
166
|
Any deviation — a different tag, a missing length prefix, a differently-encoded epoch — makes **every**
|
|
167
167
|
handshake fail with `auth_failed`, with no hint as to which half is wrong. Get this right first.
|
|
168
168
|
|
|
169
|
+
#### `epoch` is a byte-exact key: exactly which strings are accepted
|
|
170
|
+
|
|
171
|
+
`epoch` is a 26-character **upper-case** Crockford base32 ULID whose first character is `0`–`7`. Crockford's
|
|
172
|
+
alphabet is case-insensitive on paper; this protocol is **not**, on purpose: the same `epoch` string is also the
|
|
173
|
+
key the server compares when fencing connection generations and leases, so two spellings of one ULID would let
|
|
174
|
+
one connection be counted as two. That is worse than a failed handshake, so the decoder stays strict.
|
|
175
|
+
|
|
176
|
+
The two entry points reject differently — if you call the low-level decoder yourself, check for `null`:
|
|
177
|
+
|
|
178
|
+
| Input | `decodeUlid16(...)` | `buildHelloSignaturePayload({ epoch })` |
|
|
179
|
+
|---|---|---|
|
|
180
|
+
| valid, e.g. `01J8ZQ4T9X7M3K5N6P8R0S2V4W` | 16 bytes | payload |
|
|
181
|
+
| lower-case, e.g. `01j8zq4t9x…` | `null` | throws `Error: device-ws: epoch must be a 26-char Crockford ULID (got "…")` |
|
|
182
|
+
| first character `8`, `9`, `A` … `Z` (128-bit overflow) | `null` | throws |
|
|
183
|
+
| 25 characters (or 27) | `null` | throws |
|
|
184
|
+
| contains an excluded letter `I`, `L`, `O`, `U` | `null` | throws |
|
|
185
|
+
|
|
186
|
+
The discriminating case, if you want to prove your own decoder judges the right thing: a `Z` as the **last**
|
|
187
|
+
character is accepted (it is just the value 31), while a `Z` as the **first** character is rejected (overflow).
|
|
188
|
+
A decoder that rejects "any Z" is wrong. Remember that a bad signature is answered with `auth_failed` and nothing
|
|
189
|
+
else — the server does not say which half was wrong — so run the vector below and these rejection cases against
|
|
190
|
+
your implementation before the first live handshake.
|
|
191
|
+
|
|
169
192
|
#### Importable source of truth and a fixed test vector
|
|
170
193
|
|
|
171
194
|
You do not have to transcribe the byte layout. From `@sema-agent/server` 7.88.0 the executor-facing part of the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/server",
|
|
3
|
-
"version": "7.88.
|
|
3
|
+
"version": "7.88.2",
|
|
4
4
|
"description": "Sema Server — the server/API implementation layer for Sema, wiring core, registry, model providers, and cloud agent execution. Built on @sema-agent/core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"build:binary:run-local:darwin-arm64": "bun build --compile --target=bun-darwin-arm64 src/run-local.ts --outfile dist/run-local-darwin-arm64"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@sema-agent/core": "7.23.
|
|
62
|
+
"@sema-agent/core": "7.23.5",
|
|
63
63
|
"@sema-agent/settings-schema": "3.0.0",
|
|
64
64
|
"e2b": "^2.28.0",
|
|
65
65
|
"libsodium-wrappers": "^0.8.4",
|