@sema-agent/core
Version:
Stateless, task-oriented AI agent core
250 lines (249 loc) • 18 kB
JSON
{
"repo": "core",
"version": "7.24.0",
"from": "6b1dcaefbdd7abf1a39f17d67c3b926a94ddc75f",
"to": "v7.24.0",
"added": [
{
"name": "displayUrlOf",
"kind": "function",
"tier": "advanced",
"at": [
"src/brain/route-adjudicator.ts:136",
"src/index.ts:3207"
],
"criteriaCovered": false,
"breaking": false
},
{
"name": "resolveRequestRoot",
"kind": "function",
"tier": "stable",
"at": [
"src/brain/route-adjudicator.ts:230",
"src/index.ts:3209"
],
"criteriaCovered": false,
"breaking": false
},
{
"name": "routeKeyOf",
"kind": "function",
"tier": "advanced",
"at": [
"src/brain/route-adjudicator.ts:96",
"src/index.ts:3206"
],
"criteriaCovered": false,
"breaking": false
}
],
"removed": [
{
"name": "normalizeBaseUrl",
"kind": "function",
"tier": "advanced",
"at": [
"src/brain/route-adjudicator.ts:60",
"src/index.ts:3206"
],
"breaking": true
}
],
"changed": [],
"narrowed": [
{
"id": "F1",
"source": "behaviorFlips.summary",
"text": "BREAKING export removal, plus a NARROWING of what three already-shipped members carry (#950). `normalizeBaseUrl` is REMOVED; the same function ships as `routeKeyOf` (the pairing law's comparison value, query byte-preserved), and two new exports join it — `displayUrlOf` (the only spelling of a request root allowed into text) and `resolveRequestRoot` (the request-root law itself, exported because a custom brain is a seat that builds one). `RouteRefusalDetail.{entryBaseUrl, requestBaseUrl, configBaseUrl}`, `fixHint`, the exported `routeRefusalText` and the `route.base_url_changed_key_unchanged` notice now carry DISPLAY spellings: userinfo dropped, EVERY query value replaced with `«redacted»`, query NAMES kept (dropping the query whole would render two roots that differ only in their query as one string, so the refusal about that very pair would read `targets X … paired with X`), and a BARE query token (`?<token>`, no `=`) rendered as one placeholder with no name. An unparseable root is withheld by POSITION in all three credential positions — userinfo, query and fragment. The ARRIVAL-time refusal took the same rule: `assertServableRequestRoot` used to hand-compose its own spelling (`${protocol}//${host}${pathname}`), and for a NON-SPECIAL scheme `pathname` IS the opaque body, so `weird:u:<secret>@h/v1`, `blob:https://u:<secret>@h/x` and `mailto:u:<secret>@h` echoed the credential in the very sentence that refuses them (`ftp:`/`file:` are special schemes and did not — the leak was shape-dependent, which is why a spot fix at one call site would have missed it). It now names its root through `displayUrlOf`, the one renderer. Two predicates make the split explicit: `servableParse` (http/https only) answers the KEY's question, `composableParse` (has an authority, or a real path) answers the RENDERING's — an opaque body has neither and falls to the positional arm. Who needs it: any deployment whose gateway root carries a credential in the query (`?api_key=<secret>` rode `fixHint`, all three detail members, `routeRefusalText` and the catalog-swap notice into whatever a host logs). Who is hurt: a consumer importing `normalizeBaseUrl` (server, `src/hooks/hook-llm.ts` — a pure comparison, so a rename is the whole migration), and any consumer COMPARING those three members against a catalog. Compensation: `routeKeyOf` is the same function under the name that says what it is; identity is computed with it; the refusal codes, the two-leg disposition and every posture word are byte-unchanged, and a conformance vector (`deployment-mismatch-query-differs`) was added so an origin+path-only implementation is caught pairing a credential with someone else's tenant. One sibling seat took the same rule in the same pass: `primaryActivityArg` (`src/core/arg-summary.ts`) rendered a URL as `origin + pathname`, and for an OPAQUE-body scheme `origin` is the string `\"null\"` while `host` is empty — so `blob:https://u:<secret>@h/v1` came out as `nullu:<secret>@h/v1`, gluing a literal `null` onto a credential it had just failed to drop. The arm is now judged on `host !== \"\"` and falls to the same positional withholding."
},
{
"id": "F2",
"source": "behaviorFlips.summary",
"text": "ADDITIVE wire key, plus one NARROWING of a TypeScript guarantee (#946). The `compacted` event gains `freedTokens?: number` — the engine's own structural delta (one structural sum over the pre-messages minus the same sum over the post-messages), clamped >= 0 at the mint, published from all three lanes (turn boundary, prompt-too-long recovery, end-of-task settle) through ONE `mintCompactedEvent`. `Hooks.postCompact`'s `PostCompactContext` gains the same member from the same source. `tokensAfter` and `triggerTokensBefore` stay, un-clamped and un-deleted, retyped as DIAGNOSTICS with `not subtractable` said at the type: the trigger gate reads a usage-ANCHORED figure whenever the provider's last usage is fresh while the post size is always structural + the fixed prompt overhead, so their difference mixes coordinates and goes negative on ordinary runs (measured: 3037 - 4591 = -1554 on the plain auto lane; 4237 - 4987 = -750 on a short-session `/compact`). Who needs it: any consumer rendering a context meter — the cli `/context` line drew its arrow from the two diagnostics. Who is hurt: a caller doing arithmetic on `RunnerDeps.onCompaction`'s `freedTokens`, which is now optional (it previously carried `preChars` when the post measurement failed — a fabricated `fully effective` that is never true of a landing which leaves a summary behind), and the two anti-thrash floor sites that used the `triggerTokens - freedTokens` fallback. Compensation: purely additive on the wire; absence is information (`freedTokens` missing = the post measurement failed, render `unknown`, never `0`); no measurement now means the floor does not move, the same non-suppressing direction the fabricated value was chosen for, without the claim."
},
{
"id": "F4",
"source": "behaviorFlips.summary",
"text": "NARROWING of the member re-dispatch ladder, no key and no text change (#941). `runTurn` retried every member turn that did not settle completed-with-text, once, with the identical objective, prompt, model and toolset — including terminals that cannot come out differently. The retry is now refused only for the two terminals the engine can POSITIVELY identify as deterministic: a `blocked` cause (a host `UserPromptSubmit` denial, taken at its word), and a `failed` whose code the governance table adjudicated TERMINAL, read off `classifySubagentError` — no second opinion about any code. Everything else keeps its second attempt, INCLUDING that classifier's `logic` bucket, which is an ELSE-ARM: `stream_torn` (a response lost before any content or finish reason, the textbook re-issuable failure) lives there and lost its retry under a first draft of this change. Who needs it: any deployment paying for team discussions — such a turn now costs one child run instead of two (measured on a scripted runner: 3 runs instead of 6 for a two-member, one-round discussion). Who is hurt: nobody observably — the `[unavailable: <status>/<code>]` marker, the discussion, the transcript and the budget accounting are unchanged in shape. Compensation: the deliberate divergence from the classifier's own `retryable` on two rows is stated at the seat, and the row-level fix belongs in that table (ticket #964), not at this seat."
},
{
"id": "F5",
"source": "behaviorFlips.summary",
"text": "FAILURE FACE, plus one NARROWING stated rather than announced (#942). ELEVEN sites still read a value the engine did not construct bare, and three were load-bearing: a third-party `execute`'s RETURN value was read by a `normalizeContent` running OUTSIDE `defineTool`'s own try, so a member behind a throwing getter, a revoked proxy handed back as `content`, or one hostile content block raised a raw `TypeError` past the tool wrapper; and `reduceToolEnd` (`src/core/runner/turn-attachments.ts:454`, the TENTH station, found on the real lane rather than in the diff) read a third-party `details` inside the harness's tool_end handler, outside that try and a SECOND time after the result store already walked the card — measured end to end with a Runner, a scripted brain and a third-party `ToolSpec`: a `type` getter that answered once and raised on the second read ended the whole run as `failed` / `provider.error` on turn one, and the model never reached turn two. The ELEVENTH is the ERROR-frame code lift (`src/core/runner/tool-end-body.ts:99-104`), which read `result.details` and then its `code` / `errorKind` / `delivered` bare — on a failure path, in the same handler, after the result store had already walked the same card once, so a member raising on that SECOND read ended the run. All of them now read through `readMember` / `isErrorLike`, with two structural changes rather than more guards: `defineTool`'s whole result-building path runs inside the one try it already had, and `errorCodeOf`'s coarse try is replaced by per-member reads so an unreadable link costs THAT link and the walk continues (`{ code: <throws>, cause: { code: \"x\" } }` now answers `x`, and used to answer nothing). The class-level rules have ONE home each beside the other readers (`thrownIs`, `thrownName`), four private copies folded in. Who needs it: any deployment mounting a BYOM or MCP tool whose result crosses a host seam or a realm boundary. Who is hurt: a consumer text-matching the failure words for a HOSTILE value (three text changes, each named in the changelog), and a BYOM tool returning a truthy non-`true` `terminate` — now read `=== true` rather than `?? false`, the one unannounced narrowing, stated here because every in-tree consumer already tested `=== true`. Compensation: no wire key, no code word and no text change for any readable value. A REGRESSION this batch introduced was caught by the merge-tree review and fixed in it: `readListLength` accepted any value carrying a numeric `length`, so a third-party card whose `newTodos` was the STRING `\"bad card\"` read as a 8-element list and CLEARED the todo snapshot. A list is an object with a length; a string is not one. Pinned with a Proxy-over-array positive control, so the guard cannot be tightened into refusing a real list."
},
{
"id": "F6",
"source": "behaviorFlips.summary",
"text": "NARROWING at construction, no wire key (#943). `openAiCompatChatSeat` screened its `baseUrl` for emptiness and nothing else, then built `${baseUrl}/chat/completions` by hand: a root carrying userinfo, a `file:`/`ftp:` scheme, or a spelling that is not a URL at all constructed cleanly and failed at `fetch` as a transport error indistinguishable from an outage, so the consolidation driver retried it for the whole backoff ladder. #933 closed the same three shapes at the three brain factories; this seat builds a request root too and was not asked. The root now goes through `assertServableRequestRoot`, the same law, judged at CONSTRUCTION, with the trailing-slash strip moved there too so the root is read once instead of once per call. The ENVELOPE stays this seat's (`config.memory_consolidation_driver`, like its sibling api-key and alias-model screens) because a host screens on that code and the driver routes config-class throws differently from transport ones; only the envelope is local, the question and its wording are the adjudicator's, and the original refusal is kept as `cause`. Who needs it: any deployment wiring `RunnerDeps.memoryConsolidationDriver.chat` as an endpoint triple. Who is hurt: a deployment whose distillation seat carried one of the three bad roots and relied on it failing late — it now refuses where it is configured. Compensation: a userinfo root is named as `[redacted-credentials]@host`, never echoed; servable roots are untouched."
},
{
"id": "F9",
"source": "behaviorFlips.summary",
"text": "TWO VALUE FLIPS on the credential egress/refusal vocabularies, one of them a NARROWING of what the memory write face accepts, no wire key (#954). The two vendor tables had diverged, measured on synthetic shapes: a `github_pat_`-shaped token rode `scrubSecrets` (`src/core/arg-summary.ts`) and `redactSecrets` (`src/core/untrusted-egress.ts`) VERBATIM — the prefixed-token row is structurally unable to match that spelling — while `detectSecret` (`src/core/memory.ts`) recognised it; in the reverse direction an `hf_`-shaped token was masked on the way out but ACCEPTED by the memory write face. The EGRESS face now strips `github_pat_`, an Azure `AccountKey=` and a PGP `PRIVATE KEY BLOCK` banner where they used to ride in clear, and the memory WRITE door now throws `MemoryGateError(\"memory.secret_detected\")` on an `hf_` token of twenty or more characters CARRYING A DIGIT, at all three write entrances (`remember`, and consolidation's ADD and UPDATE). A two-way reconciliation pin is added over the ROW SETS, their FLAGS and their TIERS — not just the rows: every vendor shape in the refusal table must be masked by the egress table, every vendor shape in the egress table must be refused by (or explicitly exempted from) the refusal table, a masking row must mask EVERY occurrence in one rendering rather than the first, and a row added to a composed tier outside the egress pass list is caught by the kind list. A vendor added in ONE place alone reds. Who needs it: any deployment whose MCP failure text, delegation step summaries, tool-argument summaries or memory writes can carry a vendor credential. Who is hurt: a deployment relying on an `hf_`-shaped value being writable into memory verbatim, and a consumer byte-comparing an egress rendering that now carries `[redacted]`. Compensation: the digit discriminator keeps an ordinary `hf_`-prefixed IDENTIFIER writable; shapes already recognised by both tables (`ghp_`, `AKIA`, `AIza`) are byte-unchanged; the point repair stops the divergence until a single `CREDENTIAL_VOCABULARY` closes it for good (design ticket #958). A qualifier alphabet mismatch was found in the same pass: the refuse-write banner accepted a DIGIT in the qualifier (`-----BEGIN RSA2 PRIVATE KEY-----`) while the egress banner did not, so that shape was refused at the write door and rode out in clear. Both faces now carry the same alphabet, and the parity nail's mirror was corrected with them."
}
],
"closedSetMembers": [],
"closedSetsUnreadable": [],
"typeKeys": [
{
"type": "PostCompactContext",
"at": [
"src/core/hooks.ts:711"
],
"added": [
"freedTokens"
],
"removed": [],
"breaking": false,
"criteriaCovered": true
},
{
"type": "TaskEvent",
"at": [
"src/core/task-event.ts:265"
],
"added": [
"compacted.freedTokens"
],
"removed": [],
"breaking": false,
"criteriaCovered": true
}
],
"declarationMoves": [
{
"name": "resolveRequestRoot",
"kind": "function",
"onSurface": true,
"from": [
"src/brain/route-adjudicator.ts"
],
"to": [
"src/brain/route-adjudicator.ts",
"src/index.ts"
]
}
],
"mintMoves": [],
"criteriaObserves": [
{
"kind": "engineNoticeCode",
"name": "route.base_url_changed_key_unchanged",
"assertions": [
"G1.b"
]
},
{
"kind": "taskEventField",
"name": "compacted.freedTokens",
"assertions": [
"G2.a"
]
},
{
"kind": "taskEventField",
"name": "task_progress.currentAction",
"assertions": [
"G6.a"
]
},
{
"kind": "taskEventField",
"name": "tool_end.errorCode",
"assertions": [
"G6.b"
]
},
{
"kind": "taskEventField",
"name": "tool_end.isError",
"assertions": [
"G4.a",
"G6.b"
]
},
{
"kind": "taskEventField",
"name": "tool_end.output",
"assertions": [
"G3.b",
"G6.a"
]
},
{
"kind": "taskEventField",
"name": "tool_end.structured",
"assertions": [
"G3.b"
]
},
{
"kind": "typeMember",
"name": "ListAgentsRow.state",
"assertions": [
"G3.a"
]
},
{
"kind": "typeMember",
"name": "PostCompactContext.freedTokens",
"assertions": [
"G2.b"
]
},
{
"kind": "typeMember",
"name": "RouteRefusalDetail.entryBaseUrl",
"assertions": [
"G1.a"
]
},
{
"kind": "typeMember",
"name": "RouteRefusalDetail.fixHint",
"assertions": [
"G1.a"
]
},
{
"kind": "typeMember",
"name": "RouteRefusalDetail.requestBaseUrl",
"assertions": [
"G1.b"
]
},
{
"kind": "typeMember",
"name": "RunnerDeps.memoryConsolidationDriver",
"assertions": [
"G5.a"
]
},
{
"kind": "typeMember",
"name": "RunnerDeps.onError",
"assertions": [
"G5.b"
]
},
{
"kind": "typeMember",
"name": "TaskResult.terminal.code",
"assertions": [
"G4.b"
]
}
],
"consumersHint": {
"cli": [],
"server": [],
"sdk": [],
"note": "NOT SCANNED: sema-cli, sema-server, sema-sdk — an empty list for those repos means \"not checked out\", not \"no consumer\""
},
"breakingCount": 1,
"breakingItems": [
"export removed: normalizeBaseUrl (function)"
],
"toResolvedAt": "f1abe12bc6c9dfcc40b6c68dde97c4b7a201284f"
}